http://stackoverflow.com/comment/35727906
type: Comment
has text: you should post the exception that you get
type: QuestionComment
comment on: http://stackoverflow.com/q/23332416
score: 0

http://stackoverflow.com/comment/63156911
type: Comment
has text: It looks like your `interceptors ()` and `networkInterceptors ()` are identical. Why did you duplicate this?
score: 7
type: AnswerComment
comment on: http://stackoverflow.com/a/34266019

http://stackoverflow.com/comment/35746607
has text: @Sanjee he is Internship trainee and i think you should know spring mvc learning curve is more and complex then other Java frame wroks
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/23342930
type: Comment

http://stackoverflow.com/comment/35781003
has text: It would still not be necessary to create them. One would call `new Robot(Direction.DOWN)` for example. Creating new instances is indeed not a good idea.
type: AnswerComment
type: Comment
score: 0
comment on: http://stackoverflow.com/a/23361721

http://stackoverflow.com/comment/35816554
type: Comment
has text: @gnasher729 - I meant the milliseconds since Epoch only. Probably I forgot to mention that in a hurry. That is how even java's `Date` object is implemented, atleast till Java 7.
comment on: http://stackoverflow.com/a/23380258
score: 0
type: AnswerComment

http://stackoverflow.com/a/23452557
has body: The second one is better performance-wise, it is not creating a variable multiple times. Therefore, yes, auth.getProjects is being called every time.
has comment: http://stackoverflow.com/comment/35957620
score: -1
answers question: http://stackoverflow.com/q/23452537
downvote count: 2
upvote count: 1
has comment: http://stackoverflow.com/comment/35959992
type: Answer

http://stackoverflow.com/a/23409910
has body: The hash of the substring s[A..B] is hash[B] - R^(B - A + 1) * hash[A - 1] mod M Use modular exponentiation to compute the power of R mod M. And no, unless you precomputed the powers of R it is not possible to compute that in O(1).
answers question: http://stackoverflow.com/q/23409609
score: 2
downvote count: 0
type: Answer
upvote count: 2

http://stackoverflow.com/comment/35672684
score: 0
type: Comment
type: QuestionComment
has text: Please do some basic research before posting here: http://en.wikipedia.org/wiki/Binary_search_algorithm#Iterative
comment on: http://stackoverflow.com/q/23302259

asynchronous
tags question: http://stackoverflow.com/q/23431247
tags question: http://stackoverflow.com/q/23291426
tags question: http://stackoverflow.com/q/23394999
type: Tag
tag name: asynchronous
tags question: http://stackoverflow.com/q/23328448
tags question: http://stackoverflow.com/q/23404205
tags question: http://stackoverflow.com/q/23409604
tags question: http://stackoverflow.com/q/23390438
tags question: http://stackoverflow.com/q/23435688
tags question: http://stackoverflow.com/q/23348458
tags question: http://stackoverflow.com/q/23338367
tags question: http://stackoverflow.com/q/23315091
tags question: http://stackoverflow.com/q/23375459
tags question: http://stackoverflow.com/q/23401578

http://stackoverflow.com/a/45258018
answers question: http://stackoverflow.com/q/23397497
score: 0
has body: I'm adding an answer here because none of the previous indicates the correct error. The problem is where the nodes are marked as visited: in the original it is done when the node is popped from the queue, which means that until a given node reach the top of the queue it may be added several time and thus altering the path construction. You must mark your node when enqueuing them so, after the line queue.addFirst(n) just add visited.add(n).
type: Answer

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

http://stackoverflow.com/q/23298981
has title: Sum value of List into Bean with iReport
score: 0
linked to: http://stackoverflow.com/q/18119754
has body: Well, i have the following relationship: One Dentist have one or many Historys. See a peace of my Class in JPA: public class Dentista extends AbstractBean { @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "dentista", targetEntity = HistoricoCaixaDentista.class) private List&lt;HistoricoCaixaDentista&gt; historicosCaixa; I created a JRBeanCollectionDataSource passing a list of "Dentista" with EAGER "historicosCaixa" inside each bean. In iReport I created the following field: $F{historicosCaixa.valor}, but when I try to execute the report I got the following error: Caused by: java.lang.NoSuchMethodException: Unknown property 'valor' on class 'class org.hibernate.collection.PersistentBag' I tried the following too: In iReport click in 'Edit Query', open 'JavaBean DataSource', type my class ('br.com.odontonew.bean.Dentista'), click 'Read Attrbutes'. After i click twice in 'historicosCaixa' property but just show 'empty' word. EDIT 1 This is my HistoricoCaixaDentista class and your supperclass. public class HistoricoCaixaDentista extends HistoricoCaixa { /** * */ private static final long serialVersionUID = 1L; public static final String FIND_BY_DENTISTA = "HistoricoCaixaDentista.findByDentista"; @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.MERGE) @JoinColumn(name = "id_dentista") private Dentista dentista; public Dentista getDentista() { return dentista; } public void setDentista(Dentista dentista) { this.dentista = dentista; } } public class HistoricoCaixa extends AbstractBean { /** * */ private static final long serialVersionUID = 1L; @Column private String descricao; @Column private double valor; @Column(name = "data_hora") @Temporal(value = TemporalType.TIMESTAMP) private Date dataHora; @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "id_usuario") private Usuario usuario; @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "id_forma_pagamento") private FormaPagamento formaPagamento; @OneToOne(fetch = FetchType.LAZY) @Join…
has comment: http://stackoverflow.com/comment/35693454
answer count: 0
type: UnansweredQuestion
tagged with: ireport
has comment: http://stackoverflow.com/comment/35682489
tagged with: java
has comment: http://stackoverflow.com/comment/35690880
has comment: http://stackoverflow.com/comment/35689273
type: Question
tagged with: jasper-reports
tagged with: jpa

http://stackoverflow.com/q/23314711
has answer: http://stackoverflow.com/a/23314865
has comment: http://stackoverflow.com/comment/35695340
has comment: http://stackoverflow.com/comment/35695145
type: AnsweredQuestion
tagged with: java.util.scanner
has answer: http://stackoverflow.com/a/23314731
accepted answer: http://stackoverflow.com/a/23314731
type: Question
possible better answer: http://stackoverflow.com/a/23314865
tagged with: java
has comment: http://stackoverflow.com/comment/35695264
score: 0
tagged with: split
has comment: http://stackoverflow.com/comment/35695408
answer count: 2
tagged with: arrays
has comment: http://stackoverflow.com/comment/35695316
has body: So I have some code that is supposed to use a jfilechooser get a text file use a split and scanner with a colon as a delimeter and store the data into an array. The code and text is as seen below. I have added a segment of code to test if the array length is less than 1 and it always is even though I have set it to to store in a String array. Why is it doing this and how can I get it to store the text from each line of the code into an array of 6 intervals? else if (e.getSource()==readButton) { JFileChooser fileChooser = new JFileChooser("Local Disk (C:)"); if (fileChooser.showOpenDialog(null)==JFileChooser.APPROVE_OPTION) { empFile=fileChooser.getSelectedFile(); } Scanner scan = new Scanner("empFile"); while(scan.hasNext()) { String[] rowData = scan.nextLine().split(":"); if (rowData.length &lt; 1){ System.out.println("error"); } else if(rowData.length == 5) { rowData[4] = "0"; fName = rowData[0]; lName = rowData[1]; position2 = rowData[2]; firstParam = Double.parseDouble(rowData[3]); empNum = Integer.parseInt(rowData[4]); c.addEmployee(fName, lName, position2, firstParam, 0, empNum); } else { fName = rowData[0]; lName = rowData[1]; position2 = rowData[2]; firstParam = Double.parseDouble(rowData[3]); secondParam = Integer.parseInt(rowData[4]); empNum = Integer.parseInt(rowData[5]); c.addEmployee(fName, lName, position2, firstParam, secondParam, empNum); } } } John:Smith:Manufacturing:6.75:120:444 Betty:White:Manager:1200.00:111 Stan:Slimy:Sales:10000.00:332 Betty:Boop:Design:12.50:50:244
has title: String array not storing data from text file

http://stackoverflow.com/comment/35702214
has text: @ataylor, no I haven't because I was not aware of this possibility. I try to keep it in mind, should I need it in the future.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23294330

http://stackoverflow.com/comment/35660709
comment on: http://stackoverflow.com/q/23295495
has text: @GriffeyDog, saw that. However, there is more XML configuration there than needed. I'd actually like a way to set the property `Marshaller.JAXB_FORMATTED_OUTPUT` with an annotation or something like that. I'd like not to have to configure a whole bean just for this, when everything else works so nicely out of the box.
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/35818526
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23381514
has text: Yes, I know that. I want to know is there a way to find which predefined life cycle goals were called, from inside my Mojo's execute method. I need my plugin to have one behaviour when it is executed in the "install" phase and another when it is executed in the "deploy" phase. The way I see things is I need to get the list of goals for the current execution (from inside my mojo) and check if it has "deploy". Does this make any sense? P.S. I'm coming with a Gradle background and I'm quite new to Maven. Is it okay that I think of Maven goals the same way I think of Gradle tasks?

http://stackoverflow.com/comment/35720639
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23327831
has text: As I pointed out, this does exactly the same thing as before, so this is not what is causing OP the problem. But with the parentheses where you have them, if there are 10 rows (for example), you're going to get a result between 0 and 8 - that is, you'll never select the last row.
type: Comment

http://stackoverflow.com/comment/35733862
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/23335607
type: Comment
has text: I'm sorry, a_horse_with_no_name, I'm not pretty sure what do you mean.

http://stackoverflow.com/q/23396692
score: -1
tagged with: java
answer count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/35855012
tagged with: cardlayout
linked to: http://stackoverflow.com/q/9554636
type: UnansweredQuestion
has body: I have 2 frames, the first frame has the nothing more and a button, which leads to another frame which will have all the components, like tabs which have more components. The code I am using is: button_1.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JFrame Frame_2 = new JFrame(); Frame_1.setVisible(false); Frame_2.setVisible(true); } }); this is creating a new separate frame , but i want to create new JFrame over existing JFrame update @VinceEmigh +1 Thanks for the detail custom solution. It shows that someone is really willing to help, I am a self learner , started just 3 months ago so your code is bit difficult to understand, but the idea of using cardlayout did the work and i came up with a solution. JFrame guiFrame = new JFrame(); CardLayout cards; JPanel cardPane; JButton B_1 = new JButton("Next Card"); B_1.setActionCommand("Next Card"); B_1.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent event) { cards.next(cardPane); } }); cards = new CardLayout(); cardPane = new JPanel(); cardPane.setLayout(cards); cards.show(cardPane, "Main"); JPanel Card_1 = new JPanel(); JLabel background_1 = new JLabel(new ImageIcon("C:\\Users\\ME\\Desktop\\Back1.jpg")); Card_1.add(background_1); Card_1.add(B_1); JPanel Card_2 = new JPanel(); JLabel background_2 = new JLabel(new ImageIcon("C:\\Users\\ME\\Desktop\\Back2.jpg")); Card_2.add(background_2); cardPane.add(Card_1, "Main"); cardPane.add(Card_2, "Sub");
upvote count: 0
has answer: http://stackoverflow.com/a/23396789
favorite count: 0
has title: How would I use a button in Java to open Jframe over existing Jframe
type: Question
tagged with: jframe
tagged with: swing

http://stackoverflow.com/q/23419553
has comment: http://stackoverflow.com/comment/35890614
type: AnsweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/35889411
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/35889359
has comment: http://stackoverflow.com/comment/35890286
has title: Class not creating new instance of JTextField
has answer: http://stackoverflow.com/a/23420328
possible better answer: http://stackoverflow.com/a/23419570
has answer: http://stackoverflow.com/a/23419570
answer count: 2
accepted answer: http://stackoverflow.com/a/23420328
downvote count: 0
favorite count: 0
has body: My aim here is to be able to create multiple JTextFields, using my ClockBuilder class. I wonder if you could give some advice on how I might achieve this goal. I've included an SSCCE of my code. My full program creates an array of 145 cities from a txt file. I use this array to fill a jlist, then +/- buttons should allow the user to add/remove cities from being displayed. I'm at the stage where I have the JList and buttons functioning correctly. It adds/removes cities into a separate array list. I've been trying to use this array list to create multiple instances of my JTextField but, I am not able to achieve this, where am I going wrong? I've simplified this in my SSCCE where I am manually creating two Clockbuilder classes, why is it that New York displays correctly but London doesn't display at all? I'm quite new to programming and am still getting my head around classes, methods and constructors, please excuse me if I have phrased parts of my question incorrectly I hope I have been clear in what I wish to achieve. ClockBuilder.java import java.awt.*; import javax.swing.*; import javax.swing.border.*; public class ClockBuilder extends JTextField{ ClockView view; public ClockBuilder(){ super(8); } public JTextField ClockBuilder(String city){ Border lineBorder = BorderFactory.createLineBorder(Color.BLACK,1); Font font = new Font("Bradley Hand ITC", Font.BOLD, 24); setFont(font); setEditable(false); setFocusable(false); setHorizontalAlignment(JTextField.CENTER); setBorder(BorderFactory.createTitledBorder(lineBorder, city)); return this; } } View.java import java.io.*; import java.util.*; import java.awt.*; import javax.swing.*; import javax.swing.border.*; public class ClockView{ JFrame clockFrame; JPanel displayArea; JPanel clockPanel; String cities[] = {"London","New York","Barcelona", "Toronto"}; public ClockView() { clockFrame = new JFrame("World Clock"); clockFrame.setSize(400,400); clockFrame.setLocationRelativeTo(null); clockFrame.setDefaultCloseOperation(JFra…
has comment: http://stackoverflow.com/comment/35889197
has comment: http://stackoverflow.com/comment/35890127
tagged with: swing

http://stackoverflow.com/comment/35897230
score: 0
comment on: http://stackoverflow.com/q/23423894
type: Comment
type: QuestionComment
has text: Your fragment is a AllAppsFragment which cannot be cast to WebViewFragment. It would be helpful if you post the AllAppsFragment code here because it doesn't look like an layout error but rather like a cast error in your MainActivity.

http://stackoverflow.com/a/23451868
answers question: http://stackoverflow.com/q/23451825
has comment: http://stackoverflow.com/comment/35949488
has comment: http://stackoverflow.com/comment/35949523
type: AcceptedAnswer
downvote count: 0
has body: class Test { //implicitly inherits type Object } class Quiz extends Test { //explicitly inherits type Test //implicitly inherits type Object } class PopQuiz extends Quiz { //explicitly inheirts type Quiz //implicitly inheirts type Test and Object } Object -&gt; Test -&gt; Quiz -&gt; PopQuiz instanceof refers to the type of the instance. If an instance implicitly or explicitly "extends" a class, it is an instanceof that type, since it inherits the type of the class its extending (and any other classes that are extended upon, as seen in my hierarchy example). PopQuiz is both a Quiz AND a Test. Therefore, an instance of PopQuiz inherits both types Quiz amd Test, so it is an instanceof Quiz AND Test.
has comment: http://stackoverflow.com/comment/35949369
type: Answer
has comment: http://stackoverflow.com/comment/35949449
has comment: http://stackoverflow.com/comment/35949327
upvote count: 3
score: 3
accepted answer of: http://stackoverflow.com/q/23451825
has comment: http://stackoverflow.com/comment/35949569

http://stackoverflow.com/a/23343799
score: 0
has body: Surely, you should use nio nowadays for this type of action: Path dir = Paths.get("/etc"); for (Path file : Files.newDirectoryStream(dir, "*-release")) System.out.println (new String(Files.readAllBytes(file), "UTF-8"));
type: Answer
answers question: http://stackoverflow.com/q/23339905

http://stackoverflow.com/q/23434318
favorite count: 0
has comment: http://stackoverflow.com/comment/35916373
type: UnansweredQuestion
downvote count: 2
has body: I have an if condition that evaluates an email address. I'm testing for 2 things It has an "@" sign After the first @ sign, it ends with "gmail.com". My understanding of short-circuiting is that if the first condition in an OR (||) statement is true, then the second won't be evaluated. And yet I'm getting a NullPointerException because the second statement does get evaluated (I've tested it). What don't I understand about short-circuiting here? The relevant code is below: FYI: emailtext is from an EditText element and in this case is "notavalidemail" String[] split = emailtext.split("@", 2); final AlertDialog.Builder notifier = new AlertDialog.Builder(this); Log.i("GetToken","Split[0]=" + split[0] + "; length=" + split.length); if (split.length == 1 || !split[1].equals("gmail.com")) { //Tell the user they didn't enter a correct gmail } The log in the code returns this: 05-02 13:51:16.447 27553-27553/com.farmsoft.lunchguru.app I/GetToken﹕ Split[0]=notavalidemail; length=1
upvote count: 6
has answer: http://stackoverflow.com/a/23434767
has title: If conditions are not short-circuiting correctly
has comment: http://stackoverflow.com/comment/35916614
tagged with: java
has comment: http://stackoverflow.com/comment/35916642
type: Question
has comment: http://stackoverflow.com/comment/35916649
tagged with: short-circuiting
has comment: http://stackoverflow.com/comment/35916453
has comment: http://stackoverflow.com/comment/35917066
has comment: http://stackoverflow.com/comment/35916368
has comment: http://stackoverflow.com/comment/35916479
score: 4
has comment: http://stackoverflow.com/comment/35916478
has comment: http://stackoverflow.com/comment/35919548
answer count: 1

http://stackoverflow.com/comment/35658119
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23291060
score: 0
has text: Could you add some information about the way you build your application? Could you give a brief explanation of the deliverable you have generated (its structure, libraries that you have included, resources, etc.)?

http://stackoverflow.com/a/23361738
accepted answer of: http://stackoverflow.com/q/23361671
has comment: http://stackoverflow.com/comment/35780982
has comment: http://stackoverflow.com/comment/35781244
type: AcceptedAnswer
has body: Call GetISD method of country.asmx service by passing country name as parameter as: http://www.webservicex.net/country.asmx/GetISD?CountryName=INDIA also make sure you have INTERNET Permission in AndroidManifest.xml
has comment: http://stackoverflow.com/comment/35780912
has comment: http://stackoverflow.com/comment/35781088
has comment: http://stackoverflow.com/comment/35781002
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23361671
has comment: http://stackoverflow.com/comment/35781049

http://stackoverflow.com/comment/35861944
comment on: http://stackoverflow.com/q/23405400
type: QuestionComment
type: Comment
score: 0
has text: use a 'do while' loop.

http://stackoverflow.com/q/23402814
tagged with: java
has answer: http://stackoverflow.com/a/23407825
answer count: 3
has answer: http://stackoverflow.com/a/57974989
upvote count: 7
accepted answer: http://stackoverflow.com/a/23407825
tagged with: jersey
has body: According to HK2 @Service javadoc Annotation placed on classes that are to be automatically added to an hk2 ServiceLocator. I don't know how to make ServiceLocator find annotated classes automatically. TestService @Contract public interface TestService { } TestServiceImpl @Service public class TestServiceImpl implements TestService { } Main public static void main(String[] args) { ServiceLocator locator = ServiceLocatorUtilities.createAndPopulateServiceLocator(); TestService service = locator.getService(TestServiceImpl.class); System.out.println(service); // null } The result is always null. I have to add Descriptor so the ServiceLocator can find it. public static void main(String[] args) { ServiceLocator locator = ServiceLocatorUtilities.createAndPopulateServiceLocator(); DynamicConfigurationService dcs = locator.getService(DynamicConfigurationService.class); DynamicConfiguration config = dcs.createDynamicConfiguration(); config.bind(BuilderHelper.link(TestServiceImpl.class).to(TestService.class).in(Singleton.class).build()); config.commit(); TestService service = locator.getService(TestServiceImpl.class); System.out.println(service); // TestServiceImpl instance } How do I let ServiceLocator find the annotated classes automatically ? Did I misunderstand something ?
type: AnsweredQuestion
downvote count: 0
score: 7
possible better answer: http://stackoverflow.com/a/35191749
favorite count: 0
has answer: http://stackoverflow.com/a/35191749
type: Question
tagged with: hk2
has title: How does ServiceLocator find @Service and @Contact automatically in HK2?

http://stackoverflow.com/comment/35863486
comment on: http://stackoverflow.com/a/23406074
score: 0
type: AnswerComment
type: Comment
has text: thanks for that I thought it was going to work perfectly for mine. but im getting the following error Exception in thread "main" java.lang.NullPointerException at ArrayDirectory.main(ArrayDirectory.java:18)

jfreechart
type: Tag
tags question: http://stackoverflow.com/q/23381148
tags question: http://stackoverflow.com/q/23317007
tags question: http://stackoverflow.com/q/23452585
tags question: http://stackoverflow.com/q/23395295
tags question: http://stackoverflow.com/q/23294381
tags question: http://stackoverflow.com/q/23355302
tags question: http://stackoverflow.com/q/23395983
tags question: http://stackoverflow.com/q/23370505
tag name: jfreechart
tags question: http://stackoverflow.com/q/23395093

http://stackoverflow.com/q/23410408
has body: In trying to learn Java lambdas, I came across an article (listed below), where under a section on the limitations of the stream API, he states that: "Stateful lambdas are usually not a problem when executing sequentially, but when the stream execution is parallelized, it breaks". He then gives this code as an example of problems due to execution order: List&lt;String&gt; ss = ...; List&lt;String&gt; result = ...; Stream&lt;String&gt; stream = ss.stream(); stream.map(s -&gt; { synchronized (result) { if (result.size() &lt; 10) { result.add(s); } } }) .forEach(e -&gt; { }); I can see how this would be non-deterministic if it were parallelized, but what I can't see is how you would fix this with stateless lambdas -- isn't there something inherently non-deterministic about adding things to a list in a parallel fashion. An example that a six year old in a hat could understand, perhaps in C#, would be much appreciated. Link to original article http://blog.hartveld.com/2013/03/jdk-8-33-stream-api.html
answer count: 3
accepted answer: http://stackoverflow.com/a/23412673
has title: Java lambdas, stateless lambdas and parallel execution
has answer: http://stackoverflow.com/a/23415083
possible better answer: http://stackoverflow.com/a/23410609
upvote count: 7
tagged with: lambda
tagged with: java-8
has answer: http://stackoverflow.com/a/23410609
type: Question
tagged with: parallel-processing
has comment: http://stackoverflow.com/comment/35872306
type: AnsweredQuestion
score: 7
tagged with: java
has comment: http://stackoverflow.com/comment/35872240
has answer: http://stackoverflow.com/a/23412673
downvote count: 0
favorite count: 0

http://stackoverflow.com/comment/35699821
type: AnswerComment
type: Comment
has text: It's a good news. Please post it as answer to make it helpful for others.
score: 1
comment on: http://stackoverflow.com/a/23314097

http://stackoverflow.com/a/23431219
has body: The problem is likely here in your decodeMessage method. I've snipped out some code to isolate the problem: int[] digit = new int[3]; while (!nullReached) { for (int i = sampleIndex; i &lt; sampleIndex + 3; i++) { if (i &lt; samples.length) { digit[i] = getDecimalDigit(samples[i].getValue(), 0); // This should be the line that throws the exception } } sampleIndex += 3; } The second time through your while loop, sampleIndex will be 3, so i will start at 3. Then you try to dereference digit[i], which would be digit[3]. Since digit[] is an int[3], then digit[3] is out of the bounds of the array. Maybe you want to do this instead: digit[i-sampleIndex] = getDecimalDigit(samples[i].getValue(), 0);
has comment: http://stackoverflow.com/comment/35910464
upvote count: 1
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/35910481
accepted answer of: http://stackoverflow.com/q/23431065
answers question: http://stackoverflow.com/q/23431065
has comment: http://stackoverflow.com/comment/35910778
downvote count: 0
score: 1

java
tags question: http://stackoverflow.com/q/23450600
tags question: http://stackoverflow.com/q/23316034
tags question: http://stackoverflow.com/q/23450402
tags question: http://stackoverflow.com/q/23416264
tags question: http://stackoverflow.com/q/23372092
tags question: http://stackoverflow.com/q/23418595
tags question: http://stackoverflow.com/q/23328594
tags question: http://stackoverflow.com/q/23301549
tags question: http://stackoverflow.com/q/23414892
tags question: http://stackoverflow.com/q/23293095
tags question: http://stackoverflow.com/q/23301754
tags question: http://stackoverflow.com/q/23403552
tags question: http://stackoverflow.com/q/23407025
tags question: http://stackoverflow.com/q/23402289
tags question: http://stackoverflow.com/q/23297313
tags question: http://stackoverflow.com/q/23440036
tags question: http://stackoverflow.com/q/23338035
tags question: http://stackoverflow.com/q/23376246
tags question: http://stackoverflow.com/q/23349296
tags question: http://stackoverflow.com/q/23325931
tags question: http://stackoverflow.com/q/23371856
tags question: http://stackoverflow.com/q/23317008
tags question: http://stackoverflow.com/q/23325413
tags question: http://stackoverflow.com/q/23296864
tags question: http://stackoverflow.com/q/23301860
tags question: http://stackoverflow.com/q/23325133
tags question: http://stackoverflow.com/q/23306000
tags question: http://stackoverflow.com/q/23365056
tags question: http://stackoverflow.com/q/23430854
tags question: http://stackoverflow.com/q/23442299
tags question: http://stackoverflow.com/q/23301460
tags question: http://stackoverflow.com/q/23345570
tags question: http://stackoverflow.com/q/23367487
tags question: http://stackoverflow.com/q/23339539
tags question: http://stackoverflow.com/q/23355039
tags question: http://stackoverflow.com/q/23367968
tags question: http://stackoverflow.com/q/23376385
tags question: http://stackoverflow.com/q/23447519
tags question: http://stackoverflow.com/q/23408987
tags question: http://stackoverflow.com/q/23324349
tags question: http://stackoverflow.com/q/23302096
tags question: http://stackoverflow.com/q/23390181
tags question: http://stackoverflow.com/q/23344695
tags question: http://stackoverflow.com/q/23404600
tags question: http://stackoverflow.com/q/23320988
tags question: http://stackoverflow.com/q/23414744
tags question: http://stackoverflow.com/q/23295333
tags question: http://stackoverflow.com/q/23415192
tags question: http://stackoverflow.com/q/23339429
tags question: http://stackoverflow.com/q/23413094
tags question: http://stackoverflow.com/q/23317871
tags question: http://stackoverflow.com/q/23303898
tags question: http://stackoverflow.com/q/23360595
tags question: http://stackoverflow.com/q/23321542
tags question: http://stackoverflow.com/q/23440267
tags question: http://stackoverflow.com/q/23442064
tags question: http://stackoverflow.com/q/23333747
tags question: http://stackoverflow.com/q/23422176
tags question: http://stackoverflow.com/q/23438550
tags question: http://stackoverflow.com/q/23351467
tags question: http://stackoverflow.com/q/23378069
tags question: http://stackoverflow.com/q/23392037
tags question: http://stackoverflow.com/q/23423160
tags question: http://stackoverflow.com/q/23301702
tags question: http://stackoverflow.com/q/23307933
tags question: http://stackoverflow.com/q/23446832
tags question: http://stackoverflow.com/q/23331935
tags question: http://stackoverflow.com/q/23444000
tags question: http://stackoverflow.com/q/23318278
tags question: http://stackoverflow.com/q/23385471
tags question: http://stackoverflow.com/q/23301622
tags question: http://stackoverflow.com/q/23328448
tags question: http://stackoverflow.com/q/23413789
tags question: http://stackoverflow.com/q/23451036
tags question: http://stackoverflow.com/q/23329933
tags question: http://stackoverflow.com/q/23443820
tags question: http://stackoverflow.com/q/23324986
tags question: http://stackoverflow.com/q/23429547
tags question: http://stackoverflow.com/q/23305370
tags question: http://stackoverflow.com/q/23351595

http://stackoverflow.com/comment/35721380
type: Comment
has text: I've managed to resolve my problem. It was not related to my question (sorry about that) so I will not paste it here. Thanks again for your help Marco, your answer is helpful for this question.
comment on: http://stackoverflow.com/a/23326771
score: 0
type: AnswerComment

http://stackoverflow.com/q/23405399
has comment: http://stackoverflow.com/comment/35863022
has title: how to access jsp arraylist object in action class
has comment: http://stackoverflow.com/comment/35863470
has comment: http://stackoverflow.com/comment/35864502
has comment: http://stackoverflow.com/comment/35862683
has comment: http://stackoverflow.com/comment/35862861
has comment: http://stackoverflow.com/comment/35862330
has comment: http://stackoverflow.com/comment/35898064
has comment: http://stackoverflow.com/comment/35863623
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35896902
has comment: http://stackoverflow.com/comment/35864009
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/35862436
has comment: http://stackoverflow.com/comment/35862423
has comment: http://stackoverflow.com/comment/35894411
type: Question
has comment: http://stackoverflow.com/comment/35863275
tagged with: jsp
has comment: http://stackoverflow.com/comment/35863829
has body: I am having paidList ArrayList in action I am iterating it and getting appropriate value now again I am submitting this paidList(to update its value) into update() and printing its value in output window, it is showing simple value but not able to show value of getPaidList().get(0).getCashActionList(),getDDActionList() ,getOnlineActionList() index.jsp <s:form action="UpdatedPaid" method="post"> <s:if test="paidList.size>0"> <s:iterator value="paidList" var="pdlst"> Amount <s:hidden name="paidId" id="paidId"> <s:param name="value"> <s:property value="paidId"/> </s:param> </s:hidden> <s:textfield name="amount" id="amount"> <s:param name="value"> <s:property value="amount"/> </s:param> </s:textfield> Payment Date <s:textfield name="paymentDate" id="paymentDate"> <s:param name="value"> <s:property value="paymentDate"/> </s:param> </s:textfield> <s:if test="cashActionList.size>0"> <s:iterator value="cashActionList" var="calst"> TO Person <s:hidden name="id" id="id"> <s:param name="value"> <s:property value="id"/> </s:param> </s:hidden> <s:textfield name="toPerson" id="toPerson"> <s:param name="value"> <s:property value="toPerson"/> </s:param> </s:textfield> </s:iterator> </s:if> <s:if test="DDActionList.size>0"> <s:iterator value="DDActionList" var="calst"> </s:iterator> </if> <s:if test="OnlineActionList.size>0"> <s:iterator value="OnlineActionList" var="calst"> </s:iterator> </s:if> </s:iterator> </s:if> </s:form> Action Class public class SupplierPaidAction extends ActionSupport { private long paidId; private long supplierPaymentId; private float amount; private float paidAmount; private String payment_mode; private Date paymentDate; private Timestamp addDate; private String dataStatus; private long ccold; private ArrayList<SupplierPaidAction> paidList; private ArrayList<CashAction> cashActionList; private ArrayList<DDAction> DDActionList; private ArrayList<OnlinePaymentAction> OnlineActionList; //getter and setter of all fields public String update() { System.out.pri…
tagged with: struts2
tagged with: arraylist
score: 0

http://stackoverflow.com/comment/35739649
type: AnswerComment
type: Comment
has text: I can't believe I didn't think of this. I sometimes over-complicate things when I'm working on something for too long.
comment on: http://stackoverflow.com/a/23312356
score: 0

http://stackoverflow.com/q/23403992
tagged with: nosql
type: AnsweredQuestion
tagged with: java
tagged with: spring-data
type: Question
tagged with: mongodb
answer count: 2
has body: see http://docs.mongodb.org/manual/reference/method/Bulk/ Can you please point me to the version which supports this new API or in which version this support will be available?
has answer: http://stackoverflow.com/a/23442112
accepted answer: http://stackoverflow.com/a/23442112
has comment: http://stackoverflow.com/comment/35870760
score: 0
has comment: http://stackoverflow.com/comment/35859373
possible better answer: http://stackoverflow.com/a/23410506
has title: Does spring data uses the new MongoDB Bulk API for bulk operations?
has answer: http://stackoverflow.com/a/23410506
tagged with: spring-data-mongodb

http://stackoverflow.com/q/23442866
type: AnsweredQuestion
tagged with: apache-poi
downvote count: 0
has title: How can I make particular cell as border form in excel using java
score: 1
tagged with: java
tagged with: excel
type: Question
has answer: http://stackoverflow.com/a/23585498
accepted answer: http://stackoverflow.com/a/23585498
upvote count: 1
answer count: 1
has body: May i know How can I make particular cell as border form in excel using java ? i need only particular cell with table foramat. Ref: i have enclosed screen shot for more details. My Code: try { int rowCount = 1; FileOutputStream fileOut = new FileOutputStream("poi-test.xls"); HSSFWorkbook workbook = new HSSFWorkbook(); HSSFSheet sheet = workbook.createSheet(); HSSFRow row = null; HSSFCell cell = null; HSSFFont heading_caption_font = null; HSSFCellStyle heading_caption_style = null; workbook.setSheetName(0, "Ageing Report", HSSFWorkbook.ENCODING_COMPRESSED_UNICODE); heading_caption_font = workbook.createFont(); heading_caption_font.setFontHeightInPoints((short)12); heading_caption_font.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD); heading_caption_font.setFontName("Calibri"); heading_caption_style = workbook.createCellStyle(); heading_caption_style.setFont(heading_caption_font); row = sheet.createRow(rowCount); rowCount += 1; cell = row.createCell((short)3); cell.setCellValue("Aging Report on UN-acted (DETAILED)"); cell.setCellStyle(heading_caption_style); sheet.addMergedRegion(new Region(1, (short)3, 1, (short)4)); workbook.write(fileOut); fileOut.flush(); fileOut.close(); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } i can't able to get reqeried output:
favorite count: 0

http://stackoverflow.com/comment/35934822
comment on: http://stackoverflow.com/q/23444267
score: 0
type: QuestionComment
type: Comment
has text: I'm sorry, I forgot to go over that part as well. It would be much easier to draw in the same panel, the KeyBoardListener makes the image of the radar rotate. The line I want to draw is not supposed to rotate, only shift to the sides. Thats why I could not draw them in the same panel

http://stackoverflow.com/q/23414744
has answer: http://stackoverflow.com/a/23414925
has comment: http://stackoverflow.com/comment/35880093
has answer: http://stackoverflow.com/a/23414981
answer count: 4
upvote count: 2
tagged with: multithreading
has comment: http://stackoverflow.com/comment/35880074
has answer: http://stackoverflow.com/a/23414870
has comment: http://stackoverflow.com/comment/35880098
score: 2
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/23414804
has body: public class Qn { static class Friend { private final String name; public Friend(String name) { this.name = name; } public String getName() { return this.name; } // recipient - the person who greets public synchronized void sayHi(Friend recipient) { System.out.format("%s" + " said hi to %s %n", this.name, recipient.getName()); } } public static void main(String[] args) { final Friend john = new Friend("John"); final Friend peter = new Friend("Peter"); new Thread(new Runnable() { public void run() { john.sayHi(peter); } }, "thread1").start(); } } Questions: Please clarify the ones below if understanding is correct When invoking john.sayHi(), the Thread thread1 has acquired intrinsic lock of john object in-order to access the sayHi() method of john object. The Thread thread1 is running independently in JVM. I read these statements online, not sure what they mean! [How can a thread run on objects!!! Infact Threads execute the code, correct?] The thread thread1 is not running on any other object inside the JVM. A thread never runs on any object. A thread is never executed by an object. A thread never runs on any other thread. A thread always run directly in JVM.
has comment: http://stackoverflow.com/comment/35880194
type: Question
has comment: http://stackoverflow.com/comment/35880129
accepted answer: http://stackoverflow.com/a/23414925
has comment: http://stackoverflow.com/comment/35880601
has answer: http://stackoverflow.com/a/23414804
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/35880109
has title: Java Thread: Please clarify this understanding

http://stackoverflow.com/comment/40838659
type: AnswerComment
type: Comment
score: 1
has text: Thanks @Andrew I'm using DailyRazor with Tomcat. They don't allow listeners nor incoming connections, only output connections, but it worked great with downstream messages (haven't tested with upstream messages). Only catch was I had to upgrade to Tomcat 7 and JVM 7 because the Smack library was causing compatibility issues.
comment on: http://stackoverflow.com/a/23405653

http://stackoverflow.com/q/23353173
has comment: http://stackoverflow.com/comment/36455211
has comment: http://stackoverflow.com/comment/54650520
has answer: http://stackoverflow.com/a/72994473
has answer: http://stackoverflow.com/a/56254974
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/38364939
has answer: http://stackoverflow.com/a/31378800
has answer: http://stackoverflow.com/a/37235752
has answer: http://stackoverflow.com/a/55349981
has answer: http://stackoverflow.com/a/23353174
accepted answer: http://stackoverflow.com/a/23353174
has answer: http://stackoverflow.com/a/67833754
has answer: http://stackoverflow.com/a/30778896
has comment: http://stackoverflow.com/comment/54643269
tagged with: java
linked to: http://stackoverflow.com/q/4325073
has answer: http://stackoverflow.com/a/60704091
has body: I am developing an application, and everytime I run it, I get the message: Unfortunately, MyApp has stopped. What can I do to solve this? About this question - obviously inspired by What is a stack trace, and how can I use it to debug my application errors?, there are lots of questions stating that their application has crashed, without any further detail. This question aims to instruct novice Android programmers on how to try and fix their problems themselves, or ask the right questions.
type: Question
tagged with: debugging
linked to: http://stackoverflow.com/q/218384
has answer: http://stackoverflow.com/a/46528312
possible better answer: http://stackoverflow.com/a/29200956
has answer: http://stackoverflow.com/a/29200956
has answer: http://stackoverflow.com/a/43181212
tagged with: kotlin
has answer: http://stackoverflow.com/a/56563005
has answer: http://stackoverflow.com/a/33492207
has answer: http://stackoverflow.com/a/68813623
has answer: http://stackoverflow.com/a/40447785
linked to: http://stackoverflow.com/q/3988788
answer count: 23
upvote count: 905
score: 886
has answer: http://stackoverflow.com/a/50427810
favorite count: 0
has answer: http://stackoverflow.com/a/29192526
downvote count: 19
has answer: http://stackoverflow.com/a/31114928
has answer: http://stackoverflow.com/a/44897145
has answer: http://stackoverflow.com/a/29116807
has comment: http://stackoverflow.com/comment/36509909
has answer: http://stackoverflow.com/a/52271886
has title: Unfortunately MyApp has stopped. How can I solve this?
tagged with: android

jtable
tags question: http://stackoverflow.com/q/23425757
tags question: http://stackoverflow.com/q/23374734
tags question: http://stackoverflow.com/q/23403595
tags question: http://stackoverflow.com/q/23369527
tags question: http://stackoverflow.com/q/23446517
tags question: http://stackoverflow.com/q/23304550
tags question: http://stackoverflow.com/q/23401463
tags question: http://stackoverflow.com/q/23341335
tags question: http://stackoverflow.com/q/23323380
type: Tag
tags question: http://stackoverflow.com/q/23387790
tags question: http://stackoverflow.com/q/23393741
tags question: http://stackoverflow.com/q/23367468
tags question: http://stackoverflow.com/q/23401602
tags question: http://stackoverflow.com/q/23340425
tags question: http://stackoverflow.com/q/23329279
tags question: http://stackoverflow.com/q/23350956
tag name: jtable
tags question: http://stackoverflow.com/q/23401318
tags question: http://stackoverflow.com/q/23326031
tags question: http://stackoverflow.com/q/23354103
tags question: http://stackoverflow.com/q/23372092
tags question: http://stackoverflow.com/q/23407771
tags question: http://stackoverflow.com/q/23312901
tags question: http://stackoverflow.com/q/23416155
tags question: http://stackoverflow.com/q/23344154
tags question: http://stackoverflow.com/q/23414059
tags question: http://stackoverflow.com/q/23395982
tags question: http://stackoverflow.com/q/23421952
tags question: http://stackoverflow.com/q/23449367
tags question: http://stackoverflow.com/q/23329496
tags question: http://stackoverflow.com/q/23374684
tags question: http://stackoverflow.com/q/23305319
tags question: http://stackoverflow.com/q/23327693

http://stackoverflow.com/comment/35729990
comment on: http://stackoverflow.com/a/23332561
has text: You mean my query is wrong? Apparently it worked, when I added the default constructor.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/52229679
comment on: http://stackoverflow.com/a/29794690
score: 0
type: AnswerComment
type: Comment
has text: What does "update my maven library" mean? Can you provide some instructions?

http://stackoverflow.com/comment/35808332
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23374582
type: Comment
has text: @Boschman, I think you're onto something. When this error first started occurring was right after I added another method down below which includes a FileNotFoundException. Hopefully I post this correctly ``try { inputStream = new Scanner(new File(fileIn)); outputStream = new PrintWriter(fileOut); } catch(FileNotFoundException e3) { fileNotFound(); }``

http://stackoverflow.com/q/23449282
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35944194
tagged with: cache-control
has comment: http://stackoverflow.com/comment/35944180
has comment: http://stackoverflow.com/comment/35944713
tagged with: java
has body: Where does the cache (OScache or EHCache) runs on web/application server If i have multiple servers on clustered environment, how to make sure to get the data from cache before the application server 1 turns off and route it through another application server 2 . E.g. if i have something in shopping cart and application server 1 crashes. How can i get the data from cache before the application server 1 crashes and save it through application server 2?
type: Question
has comment: http://stackoverflow.com/comment/37464773
has comment: http://stackoverflow.com/comment/35946397
has comment: http://stackoverflow.com/comment/35944321
score: 0
tagged with: architecture
has title: Get data from Cache before server turns off

http://stackoverflow.com/q/23380802
type: UnansweredQuestion
has body: Opera 12.17 (Presto) and Chrome 34.0.1847.131m make a strong copy of Java applet in cache so the interactive development is almost impossible. How to reload applet at my will?
downvote count: 0
score: 1
tagged with: applet
favorite count: 0
type: Question
tagged with: opera
has answer: http://stackoverflow.com/a/23422266
has answer: http://stackoverflow.com/a/23381496
answer count: 2
upvote count: 1
tagged with: google-chrome
tagged with: debugging
tagged with: java
has title: How to reload Java applet in browser?

http://stackoverflow.com/q/23298386
has title: How do I make sure the replaceAll() doesn't leave my String with many spaces?
type: UnansweredQuestion
has body: I am doing this on my String right now: .replaceAll("[^A-Za-z0-9]"," ").toLowerCase() Gives me something like this: yg jarang orang perasan pernah tak korang perasan dlm mickey mouse dulu http I want to make sure those unnecessary whitespaces are minimized. I tried .trim() but to no avail.
score: 0
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/23298410
answer count: 2
has answer: http://stackoverflow.com/a/23298411

http://stackoverflow.com/a/23383415
has body: I'm not sure about your declaration of the return value of getAllItems, but you can't put itemToAdd with type T extends Type into ArrayList&lt;? extends Type&gt;. The type of element may be unmatch (different type although both are the derived class of Type), so the ArrayList should be declared as ArrayList&lt;? super Type&gt; allItems; which can guarantee itmeToAdd can be put into the ArrayList, or just: ArrayList&lt;Type&gt; allItems;
answers question: http://stackoverflow.com/q/23383169
score: 0
type: Answer

http://stackoverflow.com/a/23350911
type: Answer
accepted answer of: http://stackoverflow.com/q/23349251
downvote count: 0
score: 1
has body: "Security information of a request is available by injecting a JAX-RS SecurityContext instance using @Context annotation. The injected security context instance provides the equivalent of the functionality available on HttpServletRequest API" https://jersey.java.net/documentation/latest/security.html#d0e10543 Hope that helps
upvote count: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23349251

http://stackoverflow.com/q/23410560
tagged with: image
type: Question
possible better answer: http://stackoverflow.com/a/23411263
answer count: 2
has answer: http://stackoverflow.com/a/23411263
has answer: http://stackoverflow.com/a/23411670
tagged with: jar
has title: How can I hide resource images in executable .Jar?
favorite count: 0
has comment: http://stackoverflow.com/comment/35872235
accepted answer: http://stackoverflow.com/a/23411670
score: 0
upvote count: 1
downvote count: 1
type: AnsweredQuestion
has body: I made a little java game and if you beat it, it loads embarrassing pictures of my friends. The problem is they can cheat and open the jar with WinRar and look at all the pictures. How can I prevent this? (This is with their consent. It's completely friendly.)
tagged with: java

http://stackoverflow.com/q/23420942
has comment: http://stackoverflow.com/comment/35892607
type: Question
has comment: http://stackoverflow.com/comment/35891763
tagged with: java
tagged with: arrays
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/35891730
has comment: http://stackoverflow.com/comment/35893263
favorite count: 0
tagged with: arraylist
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/35893140
has comment: http://stackoverflow.com/comment/35893687
has comment: http://stackoverflow.com/comment/35891705
has answer: http://stackoverflow.com/a/23421169
has body: This is a very basic java question, I have an array of strings String[] navTitles = new String[] {Home, HR, company, joiner, next}; These titles are shown in a ListView. When the first item is clicked, I have to display a certain list, else if any other title is clicked I have to show a different list. The first (default) list should be the one which appears on clicking the first item. The issue is,if I click on a title, the list related to the next title is displayed. When I click the last title i get an error:- 05-02 04:47:38.787: E/AndroidRuntime(1490): java.lang.ArrayIndexOutOfBoundsException: length=5; index=5 05-02 04:47:38.787: E/AndroidRuntime(1490): at com.abc.attini.Home.displayView(Home.java:600) Here is my code:-- for (int j = 0; j &lt; navMenuTitles.length &amp;&amp; j &lt; iconColors.length; j++) { navDrawerItems.add(new NavDrawerItem(navMenuTitles[j], iconColors[j])); } adapter = new NavDrawerListAdapter(getApplicationContext(), navDrawerItems); mDrawerList.setAdapter(adapter); mDrawerList.setOnItemClickListener(new SlideMenuClickListener()); private class SlideMenuClickListener implements ListView.OnItemClickListener { } @Override public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) { // display view for selected nav drawer item displayView(position); } } private void displayView(int position) { Fragment fragment = null; if (position == 0) { fragment = new HomeFragment(SPHostUrl, encodedAccountName, deviceAuthKey, usersname, avatarUrl, fullName, getApplicationContext(), myFinalNewsList); } else { String myPosition = null; myPosition = navDrawerItems.get(position).getTitle(); //Line 600 companyNewsList = Lists.newArrayList(Collections2.filter(myFinalNewsList, new ArticleFilter(myPosition))); fragment = new HomeFragment(SPHostUrl, encodedAccountName, deviceAuthKey, usersname, avatarUrl, fullName, getApplicationContext(), companyNewsList); }
score: 1
has title: Next item displayed from array instead of the expected value
upvote count: 1

http://stackoverflow.com/comment/35934489
type: Comment
comment on: http://stackoverflow.com/q/23430477
score: 0
type: QuestionComment
has text: @LuiggiMendoza Please will you elaborate the answer.

http://stackoverflow.com/a/23419765
has body: Write a custom comparator: public SalesPersonComparator implements Comparator&lt;salesPerson&gt; { public int compare(final salesPerson p1, final salesPerson p2) { // get the comparison of the unit prices (in descending order, so compare p2 to p1) int comp = new Double(p2.getUnitPrice()).compareTo(new Double(p1.getUnitPrice())); // if the same if(comp == 0) { // compare the units sold (in descending order, so compare p2 to p1) comp = new Integer(p2.getUnitsSold()).compareTo(new Integer(p1.getUnitsSold())); } return comp; } } Edit (thanks to @Levenal): Then use Collections.sort() to sort your list.
has comment: http://stackoverflow.com/comment/35889532
type: Answer
accepted answer of: http://stackoverflow.com/q/23419725
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/35889859
answers question: http://stackoverflow.com/q/23419725
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/35948935
has text: @JoshWein The first step to understanding recursion is to understand recursion :D
score: 2
comment on: http://stackoverflow.com/a/23451564
type: AnswerComment
type: Comment

http://stackoverflow.com/q/23292388
tagged with: java
type: Question
answer count: 2
tagged with: sql
linked to: http://stackoverflow.com/q/11129212
has answer: http://stackoverflow.com/a/23293029
has answer: http://stackoverflow.com/a/23292818
tagged with: p2p
score: 0
has body: I have seen a lot of tutorials on client/server chat rooms using sockets, I am trying to create a instant messenger which will allow users (stored in a sql db) to chat with there contacts and groups(also stored on sql db). now I am really puzzled where to start. how would i go about creating a server which can handle peer to peer chat and group chat. I am using a mysql database which will store the user data and contacts list.
tagged with: client
type: UnansweredQuestion
has title: how to make a socket server for multiple clients

http://stackoverflow.com/comment/35751736
type: QuestionComment
type: Comment
has text: I don't think there is anything standard. Please refer http://stackoverflow.com/questions/3421643/is-there-a-neater-way-to-analyse-the-authenticationexception-for-the-error-code
comment on: http://stackoverflow.com/q/23345629
score: 0

http://stackoverflow.com/comment/35827552
type: Comment
type: AnswerComment
has text: what is this lineWidth corresponds to? How can i get it?
comment on: http://stackoverflow.com/a/23383117
score: 0

http://stackoverflow.com/comment/35939140
type: AnswerComment
type: Comment
score: 0
has text: Sorry to bother you again Xaver. How would I place line breaks between the fields? Right now the fields are in a single line, but I'd like to have the each form field on top of each other. I tried "editText.setLines(2)" and "editText.setSingleLine(false);" and many others for the last hour but can't seem to do it.
comment on: http://stackoverflow.com/a/23445771

http://stackoverflow.com/comment/35844069
type: Comment
has text: This sounds more like a `Stack` that drops old entries, rather than a `Map`
type: QuestionComment
comment on: http://stackoverflow.com/q/23395622
score: 1

http://stackoverflow.com/a/23407235
has comment: http://stackoverflow.com/comment/35867984
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23386118
has comment: http://stackoverflow.com/comment/35868613
accepted answer of: http://stackoverflow.com/q/23386118
has comment: http://stackoverflow.com/comment/35871269
type: Answer
has body: I've tested your code with some of my devices. It is running. I would say it is a driver issue. With ZADIG you should check the menu item "list all devices" then you have to choose the right device from the dropdown-list. Then just push the "replace driver" button. But be careful: if you do so, you can only communicate with your device out of the Java app. No other apps can access the device anymore. But you could just reinstall the old one from windows device manager, if that should be a problem.
score: 2
has comment: http://stackoverflow.com/comment/35870237
upvote count: 2
has comment: http://stackoverflow.com/comment/35868713

http://stackoverflow.com/comment/139201718
type: Comment
has text: You aren't supposed to need the `@ResponseBody` if your class is a `RestController` class. Those details weren't in the original question, but I'm having a similar issue, but shouldn't need to add the `WResponseBody`.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23350741

http://stackoverflow.com/comment/35711272
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23323455
type: AnswerComment
has text: Works for me. At least if I put debug point in setter. Where/how you try to use this property?

http://stackoverflow.com/comment/35941911
type: AnswerComment
comment on: http://stackoverflow.com/a/23447913
type: Comment
has text: That you so much! This worked. Ive been struggling with this problem for about 3 days straight and it was impeding my ability to work. Thanks again
score: 0

iteration
tags question: http://stackoverflow.com/q/23315702
type: Tag
tags question: http://stackoverflow.com/q/23328171
tag name: iteration

http://stackoverflow.com/comment/35822123
type: Comment
type: QuestionComment
has text: hi @Coder please tell me any Solution You Have
score: 0
comment on: http://stackoverflow.com/q/23380663

http://stackoverflow.com/q/23316843
has answer: http://stackoverflow.com/a/51457230
has answer: http://stackoverflow.com/a/24975516
tagged with: maven
type: Question
has answer: http://stackoverflow.com/a/23317071
type: AnsweredQuestion
tagged with: spring-boot
tagged with: java
possible better answer: http://stackoverflow.com/a/29386174
tagged with: command-line-arguments
has answer: http://stackoverflow.com/a/29386174
has answer: http://stackoverflow.com/a/54514393
has answer: http://stackoverflow.com/a/61726571
upvote count: 78
has answer: http://stackoverflow.com/a/66840758
downvote count: 0
score: 78
accepted answer: http://stackoverflow.com/a/23317071
has answer: http://stackoverflow.com/a/74912466
favorite count: 0
has body: Is there any way to input arguments when launching spring-boot application (mvn spring-boot:run) from commandline and then get them in main()?
has answer: http://stackoverflow.com/a/46628861
answer count: 10
has title: Get command-line arguments from spring-boot:run
has answer: http://stackoverflow.com/a/43730962

http://stackoverflow.com/comment/35872247
comment on: http://stackoverflow.com/a/23409932
score: 0
has text: Let's wait and see if a guru answers :)
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/35895214
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23422828
has text: corrected it but then also same thing,only frame appears,no table,no data.And in cmd java.lang.NullPointerException after quitting.
type: AnswerComment

http://stackoverflow.com/comment/35849275
type: AnswerComment
has text: I am looking for the equivalent symbol mate.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23398365

drools
tags question: http://stackoverflow.com/q/23410450
tags question: http://stackoverflow.com/q/23312150
tags question: http://stackoverflow.com/q/23360318
type: Tag
tag name: drools
tags question: http://stackoverflow.com/q/23327662

http://stackoverflow.com/a/23311075
has body: s=((String) arr[0]+ (String) arr[1]+t + (String) arr[3]); s = s.replaceAll(" ", "");
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/23311033
upvote count: 1
score: 1

http://stackoverflow.com/comment/35880593
type: Comment
has text: This is fine but how will I package JRE with this.
comment on: http://stackoverflow.com/a/23410945
score: 0
type: AnswerComment

http://stackoverflow.com/comment/35689601
type: Comment
has text: Yes it is a dashed line from point A(0,0) to point B(5,5). But what i actually want to draw is each segment (0,0)->(1,1), (1,1)->(2,2) and so on finally plotting the pixel B(5,5). In this process i would like to erase the previous segment before drawing the next segment.. i cant wrap my head around the logic of this...
comment on: http://stackoverflow.com/q/23307273
score: 0
type: QuestionComment

http://stackoverflow.com/q/23298572
type: AnsweredQuestion
has body: HashSet contains objects,I want to remove duplicates whose objects are having same id's the following is the code.. Set&lt;Employee&gt; empSet=new HashSet&lt;Employee&gt;(); empSet.add(new Employee(1,"naresh")); empSet.add(new Employee(2,"raj")); empSet.add(new Employee(1,"nesh")); empSet.add(new Employee(2,"rajes")); //i saw in some blog that we can use hashCode equals method, but i don't how to use that in this context, please help me out
accepted answer: http://stackoverflow.com/a/23298703
tagged with: java
has title: how to remove duplicate objects with same id's in a set
type: Question
has comment: http://stackoverflow.com/comment/35666013
has answer: http://stackoverflow.com/a/23298703
tagged with: hashset
upvote count: 2
possible better answer: http://stackoverflow.com/a/23298707
score: 0
downvote count: 2
has answer: http://stackoverflow.com/a/23298838
answer count: 3
has answer: http://stackoverflow.com/a/23298707
favorite count: 0
has comment: http://stackoverflow.com/comment/35667128

ftp
tags question: http://stackoverflow.com/q/23359568
type: Tag
tags question: http://stackoverflow.com/q/23414892
tag name: ftp
tags question: http://stackoverflow.com/q/23312957

http://stackoverflow.com/q/23420844
has answer: http://stackoverflow.com/a/23439225
type: Question
has title: Grab the current position of a moving ellipse in processing.js
has body: Easy Question! I have an ellipse moving from left to right, I was wondering if there is anyway to store a specific point in that left to right path in a variable e.g when the ellipse hits position X 100 pixels, store the specific position of the ellipse in a variable. I'd like the ellipse must continue to run from left. void draw(){ background(44,209,216); fill(colourR,250,182); noStroke(); ellipse(posX,posY,100,50); posX = posX + speed; if(posX == 100){ store posX in a variable } } That is the sort of process I am looking for, the problem I am getting is that when I try to do something like newPosX = posX, they both continue to increment. How can I make it so newPosX stores the current position of posX and posX continues to increment? Also I mean that newPosX can NOT just = 100, I want to grab the position of posX when it hits 100 and store it in a variable.
has comment: http://stackoverflow.com/comment/35925728
has comment: http://stackoverflow.com/comment/35925726
score: 2
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/35896747
favorite count: 0
upvote count: 2
type: UnansweredQuestion
tagged with: 2d-games
tagged with: game-physics
tagged with: java

http://stackoverflow.com/q/23432722
tagged with: oop
tagged with: java
has title: Shadowing instance variables with local variables in Java
score: 0
answer count: 2
tagged with: variables
tagged with: shadowing
has comment: http://stackoverflow.com/comment/35913234
has body: I have read that " a variable is shadowed if there is another variable with the same name that is closer in scope". I found this Point class with a constructor as an example: public class Point { public int x = 0; public int y = 0; public Point(int x, int y) { x = x; y = y; } } Then I created an object of the Point class in the CreateObjectDemo class below and printed the value of the variable x. public class CreateObjectDemo { public static void main(String[] args) { Point originOne = new Point(23, 94); System.out.println(originOne.x); } } After running the compiler, it prints 0. But why doesn't it print 23? I thought that "x = x" in the constructor would be like "23 = 23". Did I misunderstand the definition of shadowing variables?
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23432751
possible better answer: http://stackoverflow.com/a/23432771
has answer: http://stackoverflow.com/a/23432771
has comment: http://stackoverflow.com/comment/35913272
type: Question
has answer: http://stackoverflow.com/a/23432751

http://stackoverflow.com/q/23359791
downvote count: 0
favorite count: 0
tagged with: static
type: Question
has comment: http://stackoverflow.com/comment/35777890
has answer: http://stackoverflow.com/a/23359859
has answer: http://stackoverflow.com/a/23359948
has title: what does static here refer to in java
has answer: http://stackoverflow.com/a/23359822
tagged with: refer
upvote count: 2
possible better answer: http://stackoverflow.com/a/23359831
tagged with: methods
has answer: http://stackoverflow.com/a/23359850
has body: pretty rusty but im pretty sure i've never seen a code written like this. it is a mock question from java associate exam could someone tell me whether the 'static' in line 10 is connected to the go() method?? and mainly why is the output is x y c g ??? public class testclass { testclass() { System.out.print("c "); } { System.out.print("y "); } public static void main(String[] args) { new testclass().go(); } void go() { System.out.print("g "); } static { System.out.print("x "); } }
has comment: http://stackoverflow.com/comment/35777495
has comment: http://stackoverflow.com/comment/35777533
has answer: http://stackoverflow.com/a/23359831
tagged with: java
accepted answer: http://stackoverflow.com/a/23359948
answer count: 6
has comment: http://stackoverflow.com/comment/35778082
linked to: http://stackoverflow.com/q/13699075
has answer: http://stackoverflow.com/a/23359845
has comment: http://stackoverflow.com/comment/35777685
score: 2
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/2943556
tagged with: program-entry-point

http://stackoverflow.com/a/23293465
answers question: http://stackoverflow.com/q/23293095
has body: SELECT * FROM T1 WHERE id IN (1,2);
type: AcceptedAnswer
downvote count: 0
score: 1
type: Answer
accepted answer of: http://stackoverflow.com/q/23293095
upvote count: 1

http://stackoverflow.com/a/23342776
answers question: http://stackoverflow.com/q/23342613
type: Answer
has body: All of the answers thus far are defeating the purpose of using the type system in Java. Understand and use the visitor pattern. Think about what you have created: A Circle, that "is a" Shape An container which can hold anything that "is a" Shape This does not mean that everything in the container is a Circle. How do you expect your program to behave when someone places something that is not a Circle in your container? Casting and using instanceof are hacks that suggest a poorly designed program/system.
score: 0

http://stackoverflow.com/comment/35716890
has text: I actually prefer `++/--` *not* being part of a language. They are very useful for "C-like" code, but can also lead to abuse in expressions.
comment on: http://stackoverflow.com/q/23326571
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35861914
type: QuestionComment
comment on: http://stackoverflow.com/q/23385471
has text: @Jules: I know the 1 GB isn't actually allocated. But there will be approximately 4MB of metadata stating which parts of the 1GB are just reserved, in RAM, and/or on disk. (Assuming one 8 byte pointer plus status per 4kB page)
score: 0
type: Comment

http://stackoverflow.com/q/23401972
has title: Remove last element from SortedSet
has comment: http://stackoverflow.com/comment/35857865
has comment: http://stackoverflow.com/comment/35855819
answer count: 0
type: UnansweredQuestion
tagged with: set
has body: for(RoomBookingDTO r : bb.getBooking().getRoomBookings()) { if(r.getLocalId() == bb.getCurrentRoomNumber()) { System.out.println("kom hit"); bb.getBooking().getRoomBookings().remove(r); } } When I try to print the roomBookings set before and after the remove method is run, the set contains exactly the same elements. Thus, bb.getBooking().getRoomBookings().remove(r); does not work. I use java.util.SortedSet implemented as a java.util.TreeSet. Any suggestions to why this is not working? RoomBookingDTO roomBooking = createRoomBooking(request); System.out.println("Before: " + bb.getBooking().getRoomBookings()); bb.getBooking().getRoomBookings().add(roomBooking); System.out.println("Add: " + bb.getBooking().getRoomBookings()); bb.getBooking().getRoomBookings().remove(roomBooking); System.out.println("After: " + bb.getBooking().getRoomBookings());
upvote count: 1
type: Question
tagged with: jakarta-ee
score: 1
has comment: http://stackoverflow.com/comment/35855976
tagged with: java
has comment: http://stackoverflow.com/comment/35855877
has comment: http://stackoverflow.com/comment/35855802
has comment: http://stackoverflow.com/comment/35860632
downvote count: 0
tagged with: jsp
favorite count: 0

http://stackoverflow.com/comment/36007245
score: 0
type: Comment
type: QuestionComment
has text: I do not see it as possible, but you would get a better answer on the forum. http://devnet.jetbrains.com/community/idea
comment on: http://stackoverflow.com/q/23428826

http://stackoverflow.com/a/23499920
accepted answer of: http://stackoverflow.com/q/23443131
upvote count: 1
answers question: http://stackoverflow.com/q/23443131
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: Most likely, the NullPointerException is thrown at one of the following two lines File fileToCreate = new File(filePath, this.userImageFileName); FileUtils.copyFile(this.userImage, fileToCreate); because this.userImageFileName and/or this.userImage is null, if you do not upload a file. So, try this: if(this.userImageFileName != null &amp;&amp; this.userImage != null){ File fileToCreate = new File(filePath, this.userImageFileName); FileUtils.copyFile(this.userImage, fileToCreate); } Now, no NullPointerException should occure, since you checked for null in advance.
score: 1

http://stackoverflow.com/comment/35919136
has text: Could you post the error that occurs?
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23435735
type: Comment

http://stackoverflow.com/comment/35910622
comment on: http://stackoverflow.com/q/23431154
has text: Is there a way I could download the second page without even loading the first one? That would be the most ideal solution.
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/35658999
comment on: http://stackoverflow.com/q/23294894
score: 0
type: Comment
has text: Welcome to StackOverflow, what have you tried so far?
type: QuestionComment

http://stackoverflow.com/q/23310350
tagged with: servlets
type: Question
possible better answer: http://stackoverflow.com/a/23313005
tagged with: mockito
has answer: http://stackoverflow.com/a/23310743
downvote count: 0
favorite count: 0
answer count: 5
has answer: http://stackoverflow.com/a/23319573
accepted answer: http://stackoverflow.com/a/23319573
upvote count: 7
tagged with: junit
has title: Mockito ArgumentCaptor gives NullpointerException on verify()
linked to: http://stackoverflow.com/q/10806345
has answer: http://stackoverflow.com/a/23313005
has answer: http://stackoverflow.com/a/68737076
tagged with: unit-testing
type: AnsweredQuestion
score: 7
tagged with: java
has body: I'm currently trying to create tests for our Servlets. I've mocked HttpServletRequest, HttpServletResponse and an object serving as a database handler. In the test for the doPost method, my wish is to compare the values from the Json object and the ArrayList sent to the database object. The servlet: public class WidgetStatusServlet extends HttpServlet { private DBController db = new DBController(); @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("application/json"); JsonParser parser = new JsonParser(); JsonElement tradeElement = parser.parse(request.getParameter("widgetdata")); JsonArray json = tradeElement.getAsJsonArray(); Gson gson = new Gson(); Type listType = new TypeToken&lt;List&lt;WidgetStatus&gt;&gt;() { }.getType(); ArrayList&lt;WidgetStatus&gt; widgets = gson.fromJson(json, listType); Iterator&lt;WidgetStatus&gt; iterator = widgets.iterator(); System.out.println("Widgets"); while (iterator.hasNext()) { WidgetStatus node = (WidgetStatus) iterator.next(); System.out.println(node); } db.addWidgetStatus(widgets); } The test: public class WidgetStatusServletTest { @Captor private ArgumentCaptor&lt;ArrayList&lt;WidgetStatus&gt;&gt; captor; private DBController dbMock = mock(DBController.class); private HttpServletRequest request = mock(HttpServletRequest.class); private HttpServletResponse response = mock(HttpServletResponse.class); Repository repository = mock(Repository.class);` @Test public void doPost_ShouldVerifyWidgetsIsProvided() throws Exception { final WidgetStatus widget1 = new WidgetStatus("id1", "div_id1", "5", "5", "1", "2", false); final WidgetStatus widget2 = new WidgetStatus("id2", "div_id2", "2", "1", "3", "1", true); when(request.getParameter("widgetdata")).thenAnswer(new Answer&lt;String&gt;() { @Override public String answer(InvocationOnMock invocation) throws Throwable { ArrayList&lt;WidgetStatus&gt; array = new ArrayList&lt;WidgetStatu…
has answer: http://stackoverflow.com/a/43061495

http://stackoverflow.com/q/23417786
tagged with: java
has comment: http://stackoverflow.com/comment/35887202
type: Question
has comment: http://stackoverflow.com/comment/35887269
tagged with: graphics
has comment: http://stackoverflow.com/comment/35887052
score: 0
has comment: http://stackoverflow.com/comment/35886820
has comment: http://stackoverflow.com/comment/35887410
has comment: http://stackoverflow.com/comment/35886971
answer count: 1
has comment: http://stackoverflow.com/comment/35887869
has comment: http://stackoverflow.com/comment/35886778
has comment: http://stackoverflow.com/comment/35887401
has comment: http://stackoverflow.com/comment/35886764
has comment: http://stackoverflow.com/comment/35887516
has answer: http://stackoverflow.com/a/23419824
has comment: http://stackoverflow.com/comment/35886916
has comment: http://stackoverflow.com/comment/35888612
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35887148
has comment: http://stackoverflow.com/comment/35887564
has comment: http://stackoverflow.com/comment/35887596
has body: I am creating a top down shooter that has zombies follow you and rotate to aim directly at you. If there are up to 5 zombies following there is no flickering. If there are over 5 zombies there is a flicker on all other images drawn to the screen. It seems to me that as more zombies get added it is causing the game to run slower and for it to draw the other images slightly out of place every now and again. I am using Graphics2D and rotating the image. The image after being drawn is then rotated back to the original position so it doesn't affect other images being drawn after it. How can I stop the flickering and slight movement in pixels? Thanks in advance! Here is the code for the zombies... package com.game.stayalive; import java.awt.Color; import java.awt.Graphics; import java.awt.Graphics2D; import java.util.Random; public class Zombie extends Sprite { Zombie() { x = -50; width = Display.spriteWidth; height = Display.spriteHeight; DELAY = rand.nextInt(8)+8; life = 5; } long lastUpdate; boolean barrierDestroyed = false; public void drawZombie(Graphics g,int playerX, int playerY) { if (!visible) { return; } Graphics2D g2d = (Graphics2D) g; direction = Math.atan2(y - playerY, x - playerX); g2d.rotate(direction - Math.PI / 2.0, x + width / 2, y + height / 2); if(DELAY &gt; 10){ g2d.setColor(Color.green.darker()); }else{ g2d.setColor(Color.red.darker()); } // Main body rectangle g2d.drawRect(x, y, width, height); // Left arm g2d.drawRect(x - width / 2, y, width / 2, height); g2d.fillRect(x - width / 2, y, width / 2, height); // Right arm g2d.drawRect(x + width, y, width / 2, height); g2d.fillRect(x + width, y, width / 2, height); // Main body filled if(DELAY &gt; 10){ g2d.setColor(Color.green); }else{ g2d.setColor(Color.red); } g2d.fillRect(x, y, width, height); g2d.rotate(-(direction - Math.PI / 2.0), x + width / 2, y + height / 2); } long waited = System.currentTimeMillis(); long waitTime; public void setWaitTime(long waitTime){ this.waitTime = waitTime; if (System.…
has comment: http://stackoverflow.com/comment/35886084
has comment: http://stackoverflow.com/comment/35886750
has comment: http://stackoverflow.com/comment/35886117
has comment: http://stackoverflow.com/comment/35887311
has title: Rotating multiple images causing flickering. Java Graphics2D

http://stackoverflow.com/a/23425854
type: Answer
score: 2
downvote count: 0
has body: Your assumption on FileWriter seems to be correct. References: The constructors of this class assume that the default character encoding and the default byte-buffer size are acceptable. [1] http://docs.oracle.com/javase/6/docs/api/java/io/FileWriter.html [2] java - Does FileWriter use a buffer? (it acts like it does in my example) Buffering is applied at the underlying Stream Writing in Java, not at the FileWriter level.
answers question: http://stackoverflow.com/q/23424958
upvote count: 2

http://stackoverflow.com/comment/35653756
has text: Also, please post how `phases` array is declared and initialized. It is a field of `ESprite`, right?
comment on: http://stackoverflow.com/q/23291550
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/a/41291310
has body: HttpServletRequest has the setattribute() method.
upvote count: 2
downvote count: 2
answers question: http://stackoverflow.com/q/23389207
has comment: http://stackoverflow.com/comment/69888429
score: 0
has comment: http://stackoverflow.com/comment/69926185
has comment: http://stackoverflow.com/comment/69927069
has comment: http://stackoverflow.com/comment/69888364
type: Answer

http://stackoverflow.com/a/23396196
type: AcceptedAnswer
has body: Platform.exit(); will do it click here for javafx2.2 documentation
type: Answer
answers question: http://stackoverflow.com/q/23350953
accepted answer of: http://stackoverflow.com/q/23350953
score: 0

http://stackoverflow.com/q/23319581
has comment: http://stackoverflow.com/comment/35704126
has answer: http://stackoverflow.com/a/23319609
has comment: http://stackoverflow.com/comment/35704064
has answer: http://stackoverflow.com/a/23319614
type: Question
answer count: 2
has title: Java 8 Identifiers/Keywords List
has comment: http://stackoverflow.com/comment/35704099
upvote count: 1
possible better answer: http://stackoverflow.com/a/23319614
has comment: http://stackoverflow.com/comment/35704110
favorite count: 0
has comment: http://stackoverflow.com/comment/35704144
has comment: http://stackoverflow.com/comment/35704076
has comment: http://stackoverflow.com/comment/35704137
has comment: http://stackoverflow.com/comment/35704182
downvote count: 5
score: -4
has comment: http://stackoverflow.com/comment/35704101
has comment: http://stackoverflow.com/comment/35704096
accepted answer: http://stackoverflow.com/a/23319609
has body: I've been recently looking at the Java 8 Documentation and was surprised to see so many new identifiers (e.g. Consumer). Can someone please give me a list of these identifiers and what they mean? Thanks a bunch!
tagged with: java-8
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35704093
has comment: http://stackoverflow.com/comment/35704077
tagged with: java

http://stackoverflow.com/q/23308363
answer count: 1
has comment: http://stackoverflow.com/comment/35684378
has comment: http://stackoverflow.com/comment/35683761
has comment: http://stackoverflow.com/comment/35683537
has body: I have a JFrame which contains a JPanel with the JButton "Press Me" Pressing the "Press me" button will change to another JPanel(SecondPanel) within the same JFrame I am facing a problem where there is a 10 second delay when i press the "Press Me" button before the SecondPanel appears. This 10 second delay is caused the Timer event . I wish for the SecondPanel to appear before the Timer event start. What is happening now is that the Timer event starts , i am waiting at the "Press Me" button for 10 seconds , before the SecondPanel appears , can someone help me resolve this issue Thanks Main class used to run the project package testing; import java.io.*; import java.security.*; import javax.xml.bind.DatatypeConverter; import java.lang.*; import java.awt.*; import javax.swing.*; import java.awt.event.*; import java.awt.image.BufferedImage; import javax.imageio.ImageIO; public class Testing extends JPanel { public static void main(String[] args) { frame = new JFrame(); LoginPanel lp = new LoginPanel(); frame.add(lp); frame.pack(); frame.validate(); frame.setVisible(true); } static JFrame frame; } LoginPanel class import java.util.*; import javax.swing.*; import java.awt.*; import java.awt.event.*; public class LoginPanel extends JPanel { LoginPanel() { Loginbtn = new JButton("Press Me"); Loginbtn.addActionListener(new LoginButtonListener()); add(Loginbtn); } private class LoginButtonListener implements ActionListener { public void actionPerformed(ActionEvent event) { SecondPanel sp = new SecondPanel(); Utility.ChangePanel(sp); sp.run(); } } JButton Loginbtn; } SecondPanel class import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import javax.imageio.ImageIO; public class SecondPanel extends JPanel { SecondPanel() { setLayout(new GridLayout(2,2)); //set deck image File deckfile = new File("./src/testing/Ace_Club_1_1.png"); //deck image file location try { Deckimg = ImageI…
linked to: http://stackoverflow.com/q/7036509
tagged with: timer
has comment: http://stackoverflow.com/comment/35683573
has comment: http://stackoverflow.com/comment/35683544
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23308408
has comment: http://stackoverflow.com/comment/35683468
has comment: http://stackoverflow.com/comment/35683531
tagged with: swing
has comment: http://stackoverflow.com/comment/35684388
type: Question
tagged with: debugging
tagged with: java
tagged with: jpanel
has comment: http://stackoverflow.com/comment/35683501
has comment: http://stackoverflow.com/comment/35683685
has title: Timer event runs before changing of JPanel
accepted answer: http://stackoverflow.com/a/23308408
score: 0
has comment: http://stackoverflow.com/comment/35684913

http://stackoverflow.com/a/23359723
has body: I solved the issue by manually copying all plugins and feature files into their respective folders, making sure everything was installed as well and then restarting eclipse a couple of times with the -clean addition. After that, it started working.. weird :/ Thanks for the answers though!
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23336329

http://stackoverflow.com/comment/127218219
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23327024
has text: @TilmanHausherr do you know if the Active content is executed or ignored with this conversion?
type: AnswerComment

http://stackoverflow.com/comment/35871119
score: 0
has text: Have you gone through the possible causes listed in the answer that I referenced?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23387798

http://stackoverflow.com/q/23341335
type: UnansweredQuestion
has body: I have a JTable with one column displaying certain text in every row Like, Example (www.example.com) Test (www.Test.com) Now, when mouse hovers on url i.e. text inside bracket cursor should change to HAND cursor and text inside bracket should be in different color and underlined to show that it looks like its an hyperlink Tried lot of things but couldn't achieve. Tried TableCellRenderer, but its changes the whole row content Tried Map map = new Hashtable(); map.put(TextAttribute.KERNING, TextAttribute.KERNING_ON); font = font.deriveFont(map); but again it changes the content of whole row Any solution would be great help Object rows[][]={ }; Object headers[]={""}; TableModel model=new DefaultTableModel(rows,header); String name= "Example"; String url="www.example.com"; String display = name + "(" + url +")" ; (DefaultTableModel)model).addRow(new Object[]{display}); JTable table=Jtable(model);
has title: Java: Show HAND cursor and change font of part of text in JTable row
score: 1
tagged with: java
upvote count: 1
tagged with: swing
type: Question
linked to: http://stackoverflow.com/q/6635730
has answer: http://stackoverflow.com/a/23342098
tagged with: jtable
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/23342138
favorite count: 0

http://stackoverflow.com/comment/35833082
score: 0
type: AnswerComment
type: Comment
has text: @Holger see my question about [PropertyChangeListener and EDT violated by Thread.sleep(int)](http://stackoverflow.com/questions/8169964/is-mvc-in-swing-thread-safe)
comment on: http://stackoverflow.com/a/23389032

http://stackoverflow.com/comment/35844246
type: Comment
has text: thanks, yes well its related to a MCV because: -1 every panel will be created in seperate classes -2 there will be a Main window which will contain all the panels -3 there is a back end side of the GUI, which connects to a DB using JDBC -4 the controller that I showed above will relate all the `MainWindow.Panel.object.addActionListener` and well since this is such a big class I was thinking of creating the ActionListener classes for each Panel separately so that the controller uses the ActionListener Classes, and the code won't be that big inside the controller.
comment on: http://stackoverflow.com/a/23394935
score: 0
type: AnswerComment

http://stackoverflow.com/a/23352310
upvote count: 2
type: Answer
has body: You have to write Arabic letters for the sake of readability. As for the machine, there is no big difference. Also set your character coding to UTF-8 as Arabic characters have issues with ASCII coding set. If you are familiar with Python, then NLTK module will be of great help to you.
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/23352143

http://stackoverflow.com/a/23361955
answers question: http://stackoverflow.com/q/23361865
upvote count: 1
downvote count: 0
type: Answer
has body: in.readLine() returns null if there are no more lines void read_quest()throws IOException { System.out.println("enter the questions(enter null to end input operation)"); for(int i = 0;; i++) { question[i]=in.readLine(); if(question[i]==null) { n=i-1; break; } } }
score: 1

http://stackoverflow.com/q/23358370
type: Question
upvote count: 2
answer count: 2
has body: I'm trying to play Java applets from bodo.com but whenever I click on one of the games, I get a pop-up that says: Application blocked by security settings Name: "game" Location: http://www.bodo.com Your security settings have blocked an application from running with an out-of-date or expired version of java. I don't understand this because I have the latest version of Java installed.
has answer: http://stackoverflow.com/a/26891650
tagged with: applet
has answer: http://stackoverflow.com/a/23511147
tagged with: security
favorite count: 0
has title: Application blocked by security settings
type: UnansweredQuestion
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/35816379
tagged with: java
has comment: http://stackoverflow.com/comment/35775806

http://stackoverflow.com/comment/35926939
has text: Though your point is valid, and in a few cases (huge arrays) `arraycopy()` is appropriate, in general, your assumption is a good reason to use `Arrays.copyOf()` instead. Way simpler and less error prone.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23439075
type: AnswerComment

http://stackoverflow.com/a/55349981
answers question: http://stackoverflow.com/q/23353173
type: Answer
has body: Logcat - To check the logs in the development phase of Android Studio Initially clear the Logcat and let the app crash again so you can get only crashed log detail. You have to check the Stack trace While, Unfortunately, MyApp has stopped. There are many reasons for it. You can check same in logs. For this, you can use the Log.e("TAG","Message"); Common error during app crash like: Coding mistake(Wrong use of keywords). Mismatch property name. Unsupported plugin(maybe). Mismatch version(maybe). Activity missing in AndroidManifest file. Permission missing in AndroidManifest file. Most common NullPointerException. Declared but not defined. To resolve app crash error: Keep in mind above points and go through it. With the error, you will get the file name also in blue colour (click on them and jump to code from error is occurring).
upvote count: 6
downvote count: 0
score: 6

http://stackoverflow.com/comment/35899492
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23425238
has text: Good point but the actual file was lower case, going to also check png file names of icons

http://stackoverflow.com/q/23369524
score: 3
accepted answer: http://stackoverflow.com/a/23369599
upvote count: 3
answer count: 1
tagged with: java
has comment: http://stackoverflow.com/comment/35800581
tagged with: jboss
has answer: http://stackoverflow.com/a/23369599
has comment: http://stackoverflow.com/comment/35797557
has body: I thought I had everything I need, but I get this error: 0:44:36,127 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-1) MSC00001: Failed to start service jboss.deployment.unit."myapp.war".STRUCTURE: org.jboss.msc.service.StartException in service jboss.deployment.unit."myapp.war".STRUCTURE: Failed to process phase STRUCTURE of deployment "myapp.war" at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:119) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final] at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA] at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA] at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [rt.jar:1.7.0_51] at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [rt.jar:1.7.0_51] at java.lang.Thread.run(Unknown Source) [rt.jar:1.7.0_51] Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: Error loading jboss-structure.xml from C:\jboss-as-7.1.1.Final\standalone\deployments\myapp.war\WEB-INF\jboss-deployment-structure.xml at org.jboss.as.server.deployment.module.descriptor.DeploymentStructureDescriptorParser.parse(DeploymentStructureDescriptorParser.java:277) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final] at org.jboss.as.server.deployment.module.descriptor.DeploymentStructureDescriptorParser.parse(DeploymentStructureDescriptorParser.java:249) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final] at org.jboss.as.server.deployment.module.descriptor.DeploymentStructureDescriptorParser.deploy(DeploymentStructureDescriptorParser.java:134) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final] at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:113) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final] ... 5 more Caused by: javax.xml.stream.XMLStreamException: ParseError …
type: AnsweredQuestion
downvote count: 0
favorite count: 0
has title: JBoss 7.1 failing to deploy war
type: Question

swing
tags question: http://stackoverflow.com/q/23434550
tags question: http://stackoverflow.com/q/23372092
tags question: http://stackoverflow.com/q/23303898
tags question: http://stackoverflow.com/q/23413789
tags question: http://stackoverflow.com/q/23416202
tags question: http://stackoverflow.com/q/23371077
tags question: http://stackoverflow.com/q/23300485
tags question: http://stackoverflow.com/q/23349506
tags question: http://stackoverflow.com/q/23327340
tags question: http://stackoverflow.com/q/23450861
tags question: http://stackoverflow.com/q/23312520
tags question: http://stackoverflow.com/q/23317978
tags question: http://stackoverflow.com/q/23407771
tags question: http://stackoverflow.com/q/23297709
tags question: http://stackoverflow.com/q/23400401
tags question: http://stackoverflow.com/q/23329279
tags question: http://stackoverflow.com/q/23309601
tags question: http://stackoverflow.com/q/23312901
tags question: http://stackoverflow.com/q/23412704
tags question: http://stackoverflow.com/q/23294604
tags question: http://stackoverflow.com/q/23328280
tags question: http://stackoverflow.com/q/23350264
tags question: http://stackoverflow.com/q/23375995
tags question: http://stackoverflow.com/q/23398214
tags question: http://stackoverflow.com/q/23440713
tags question: http://stackoverflow.com/q/23411226
tags question: http://stackoverflow.com/q/23442309
tags question: http://stackoverflow.com/q/23378755
tags question: http://stackoverflow.com/q/23313003
tags question: http://stackoverflow.com/q/23443503
tags question: http://stackoverflow.com/q/23400338
tags question: http://stackoverflow.com/q/23354143
tags question: http://stackoverflow.com/q/23344154
tags question: http://stackoverflow.com/q/23420980
tags question: http://stackoverflow.com/q/23297975
tags question: http://stackoverflow.com/q/23323085
tags question: http://stackoverflow.com/q/23422775
tags question: http://stackoverflow.com/q/23344800
tags question: http://stackoverflow.com/q/23418062
tags question: http://stackoverflow.com/q/23417279
tags question: http://stackoverflow.com/q/23425514
tags question: http://stackoverflow.com/q/23338098
tags question: http://stackoverflow.com/q/23358157
tags question: http://stackoverflow.com/q/23383123
tags question: http://stackoverflow.com/q/23306027
tags question: http://stackoverflow.com/q/23299469
tags question: http://stackoverflow.com/q/23444771
tags question: http://stackoverflow.com/q/23401205
tags question: http://stackoverflow.com/q/23439111
tags question: http://stackoverflow.com/q/23452499
tags question: http://stackoverflow.com/q/23432629
tags question: http://stackoverflow.com/q/23409138
tags question: http://stackoverflow.com/q/23399882
tags question: http://stackoverflow.com/q/23396048
tags question: http://stackoverflow.com/q/23355208
tags question: http://stackoverflow.com/q/23393597
tags question: http://stackoverflow.com/q/23376072
tags question: http://stackoverflow.com/q/23292808
tags question: http://stackoverflow.com/q/23443141
tags question: http://stackoverflow.com/q/23434714
tags question: http://stackoverflow.com/q/23384195
tags question: http://stackoverflow.com/q/23316347
tags question: http://stackoverflow.com/q/23380077
tags question: http://stackoverflow.com/q/23301364
tags question: http://stackoverflow.com/q/23311314
tags question: http://stackoverflow.com/q/23422313
tags question: http://stackoverflow.com/q/23392464
tags question: http://stackoverflow.com/q/23419826
tags question: http://stackoverflow.com/q/23396692
tags question: http://stackoverflow.com/q/23370914
tags question: http://stackoverflow.com/q/23362550
tags question: http://stackoverflow.com/q/23314005
tags question: http://stackoverflow.com/q/23294570
tags question: http://stackoverflow.com/q/23421952
tags question: http://stackoverflow.com/q/23436461
tags question: http://stackoverflow.com/q/23330347
tags question: http://stackoverflow.com/q/23362015
tags question: http://stackoverflow.com/q/23430880
tags question: http://stackoverflow.com/q/23304775
tags question: http://stackoverflow.com/q/23341652

http://stackoverflow.com/q/23316206
type: UnansweredQuestion
tagged with: http://stackoverflow.com/tag/html
score: 2
has body: I use GWT 2.6 with the option: &lt;set-configuration-property name="compiler.enum.obfuscate.names" value="true" /&gt; When I compile I get the following warning. [WARN] Call to Enum method valueOf when enum obfuscation is enabled: Someclass Replacing Enum.name method : com/google/gwt/emul/java/lang/Enum.java:115 What does this mean?
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/35698336
tagged with: gwt
tagged with: enums
tagged with: javascript
has title: GWT Warning: "Call to Enum method toString when enum obfuscation is enabled"
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/35699228
favorite count: 0
has answer: http://stackoverflow.com/a/23324913
upvote count: 2

http://stackoverflow.com/a/23318947
has body: ((ConnectThread)myThread).write();
upvote count: 2
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/23318932
answers question: http://stackoverflow.com/q/23318932
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/35704777
comment on: http://stackoverflow.com/a/23319867
score: 0
type: AnswerComment
has text: @OlegEstekhin yea there are many possibilities. I'll just wait to see an MCVE from the OP :-)
type: Comment

http://stackoverflow.com/a/23351609
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/23351515
has body: In the case the underlying collection does not matter to you, you could switch to one pre-defined ordered collection that allows repeats, make sure the two new collections are sorted, and then check for equality. One simple way to do it is convert your elements to arrays using toArray(), sort it with Arrays.sort(), and check for equality using Arrays.equals()
downvote count: 0
score: 1

http://stackoverflow.com/q/23398932
has title: Get unread messages from array with all email messages in Java
has answer: http://stackoverflow.com/a/23398987
has body: I am trying to write a method that gets an array of unread mail messages from an array with all messages. This is my code: public Message[] getUnreadMessages() { Message[] messages = inbox.getMessages(1, messageCount); Message[] unreadMessages; int i = 0; for (Message message : messages) { boolean isMessageRead = false; for (Flags.Flag flag : message.getFlags().getSystemFlags()) { if (flag == Flags.Flag.SEEN) { isMessageRead = true; break; } } String subject = message.getSubject(); if (isMessageRead) { log.debug("Message with subject '" + subject + "' has status read"); } else { unreadMessages[i] = new Message(); unreadMessages[i] = message; i++; log.info("Message with subject '" + subject + "' will be processed"); } } return unreadMessages; } However, this doesn't work because I cannot instantiate a new Message() type. How can I solve this?
favorite count: 0
possible better answer: http://stackoverflow.com/a/23398987
accepted answer: http://stackoverflow.com/a/23399006
downvote count: 1
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/35850419
type: Question
answer count: 2
upvote count: 0
tagged with: arrays
score: -1
has answer: http://stackoverflow.com/a/23399006
tagged with: jakarta-mail

http://stackoverflow.com/comment/35819362
type: Comment
has text: I got a problem with the Integer[] rows= (Integer[]) request.getParemeter("rows"); Integer[] columns= (Integer[]) request.getParemeter("columns"); "Cannot cast from String to Integer[]"
comment on: http://stackoverflow.com/a/23382359
score: 0
type: AnswerComment

http://stackoverflow.com/a/23410227
type: Answer
score: 2
has body: An object can be serialized only if it implements the Serializable interface. There are several reasons for this: Serializable caracteristics of an Object should be a design state for an object and not an automatic behavior for all classes. There could be reasons why a programmer should not make a class Serializable. Putting sensitive informations in the class is one of these examples. Consider this class: public class Machine implements Serializable{ private String password; } This is a possible design threat for the class machine which includes a password that could be serialized. Password here should be transient if no other needs for serilaizin password are required. Not all objects capture useful semantics in a serialized state. The thread state is one of these examples. The ObjectOutput has methods that allow objects to be written to a streamed content which could be done not only by Serialiazaton. ObjectOutputStream for example needs objects that implements Serialaizable.
answers question: http://stackoverflow.com/q/23409797
downvote count: 0
upvote count: 2

http://stackoverflow.com/q/23311356
has comment: http://stackoverflow.com/comment/35690149
tagged with: onclick
has title: I can't make my buttons work
tagged with: java
has comment: http://stackoverflow.com/comment/35689364
has answer: http://stackoverflow.com/a/23312058
type: Question
has comment: http://stackoverflow.com/comment/35689553
has body: I just wanted to start making aps on Android, I know C++ a bit, but I'm fighting for few days with the simpliest thing - I can't make my buttons work. I try every tutorials methods and I can't make the listener to button - everytime I do it my program just crushes. The code is simple (I don't change anything below my methods) and I also started brand new Android Project and just did those button and TextView edits as in all the tutorials: package com.example.buttonwork; import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v7.app.ActionBarActivity; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.TextView; public class MainActivity extends ActionBarActivity { Button but1; TextView tv1; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); if (savedInstanceState == null) { getSupportFragmentManager().beginTransaction() .add(R.id.container, new PlaceholderFragment()) .commit(); } tv1 = (TextView) findViewById(R.id.tv1); but1 = (Button) findViewById(R.id.b1); but1.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub tv1.setText("Button pressed"); } }); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } /** * A placeholder fragment cont…
score: 0
answer count: 2
accepted answer: http://stackoverflow.com/a/23312131
tagged with: button
has comment: http://stackoverflow.com/comment/35688996
possible better answer: http://stackoverflow.com/a/23312058
tagged with: listener
has comment: http://stackoverflow.com/comment/35689026
has answer: http://stackoverflow.com/a/23312131
tagged with: android
type: AnsweredQuestion

http://stackoverflow.com/q/23328563
has comment: http://stackoverflow.com/comment/35720761
type: Question
accepted answer: http://stackoverflow.com/a/23328802
has title: InputStream and a byte array producer?
has body: I have a class which will fetch a fixed-size byte array buffer from a zip file. Is there a way to hook that up to ZipInputStream? It's something like: public class MyByteArrayProducer { public boolean hasMoreData(); public void getNextChunk(byte[] buffer); } The ZipInputStream class wants an InputStream to read from, but I have to work with the above class. Thank you
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/23328802
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1

http://stackoverflow.com/comment/35898554
comment on: http://stackoverflow.com/q/23424683
has text: If I understand your question properly then you are looking for `Date` object from `String`. You can use `parse()` of `SimpleDateFormat` class.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23418770
tagged with: java
has comment: http://stackoverflow.com/comment/35887861
possible better answer: http://stackoverflow.com/a/23418900
has comment: http://stackoverflow.com/comment/35887921
type: Question
has answer: http://stackoverflow.com/a/23418900
answer count: 2
has comment: http://stackoverflow.com/comment/35887809
accepted answer: http://stackoverflow.com/a/23418794
has comment: http://stackoverflow.com/comment/35888179
score: 0
has title: Java " . " Operator and what it really does?
has comment: http://stackoverflow.com/comment/35887813
has comment: http://stackoverflow.com/comment/35887858
has answer: http://stackoverflow.com/a/23418794
has body: Lets say you have some random class called Dude, and you have some private instance variables and you have some get methods and a compareTo method to say if one instance of the class has the same variables as another instance of the class and that's pretty much it. Well, lets say in some driver class, you make two Dude objects, and you call them d1 and d2. Well, now you wanna compare the two and see if they have the same instance data, so you'd call d1.compareTo(d2); Now, my question is, when creating the compareTo method inside the dude class, you pass it one object as a parameter and the other one.....? I'm thinking it would go something like this: public boolean compareTo(Dude d){ if (this.getArbitraryVariable() == d.getArbitraryVariable()) return true and so on. But for that to work, you would have no clue what the currently executing object is, and the only logical explaination I can think of is that the "." operator makes whatever is to the left of it, the current executing object in the class. Is that right or no?
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/577575

http://stackoverflow.com/comment/35938444
type: Comment
type: QuestionComment
has text: Note that I prefer the most voted answer rather than the accepted answer.
score: 0
comment on: http://stackoverflow.com/q/23446357

http://stackoverflow.com/q/23428877
possible better answer: http://stackoverflow.com/a/23429012
tagged with: limit
has answer: http://stackoverflow.com/a/23429012
type: AnsweredQuestion
score: 1
tagged with: java
has body: How to handle custom inteceptors execptions in Struts 2? org.apache.commons.fileupload.FileUploadBase$SizeLimitExceededException: the request was rejected because its size (337867) exceeds the configured maximum (200)
tagged with: upload-max-filesize
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/23428923
tagged with: struts2
downvote count: 0
tagged with: file-upload
favorite count: 0
accepted answer: http://stackoverflow.com/a/23428923
has title: How to fix SizeLimitExceededException: the request was rejected because its size (337867) exceeds the configured maximum (200) in Struts 2?
upvote count: 1

google-api-client
tags question: http://stackoverflow.com/q/23340182
tag name: google-api-client
type: Tag

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

http://stackoverflow.com/comment/89304665
comment on: http://stackoverflow.com/a/49195067
type: AnswerComment
type: Comment
score: 2
has text: This is the best answer !

permissions
tags question: http://stackoverflow.com/q/23411462
tag name: permissions
type: Tag
tags question: http://stackoverflow.com/q/23392079
tags question: http://stackoverflow.com/q/23329590
tags question: http://stackoverflow.com/q/23406303

http://stackoverflow.com/a/23338518
has body: I heard that RMI is already multithreaded. You are correct. No change is necessary to this code. In general it is up to you to ensure thread-safety of your remote objects, but this particular one is already thread-safe.
upvote count: 1
type: Answer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/54818482
has comment: http://stackoverflow.com/comment/54818604
answers question: http://stackoverflow.com/q/23338233

http://stackoverflow.com/comment/35719059
score: 1
comment on: http://stackoverflow.com/a/23327704
has text: You mean `MainClass.this.`
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/36058226
score: 0
type: Comment
has text: I deleted all these types and there is no change
comment on: http://stackoverflow.com/a/23498377
type: AnswerComment

http://stackoverflow.com/comment/35664154
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/23297012
has text: @Saksak I have declared it yes: <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />
type: Comment

http://stackoverflow.com/q/23301775
upvote count: 4
has answer: http://stackoverflow.com/a/23301992
has answer: http://stackoverflow.com/a/64109251
possible better answer: http://stackoverflow.com/a/23301817
has body: Ok, so let's say I have an if statement and a boolean x: if (x) { // some stuff } What happens here? Does this mean the same thing as if(x == true) ?
has comment: http://stackoverflow.com/comment/35690782
has answer: http://stackoverflow.com/a/23301907
has answer: http://stackoverflow.com/a/23301824
has comment: http://stackoverflow.com/comment/35671817
accepted answer: http://stackoverflow.com/a/23301824
has comment: http://stackoverflow.com/comment/35672175
favorite count: 0
has answer: http://stackoverflow.com/a/23301825
has comment: http://stackoverflow.com/comment/35671909
has answer: http://stackoverflow.com/a/23301818
has comment: http://stackoverflow.com/comment/35672030
answer count: 10
has answer: http://stackoverflow.com/a/23301826
has comment: http://stackoverflow.com/comment/35859296
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/23301891
has title: Is if(x) same as if(x==true)?
has answer: http://stackoverflow.com/a/23301817
downvote count: 1
type: Question
score: 3
tagged with: if-statement
has comment: http://stackoverflow.com/comment/35671861
has answer: http://stackoverflow.com/a/23301908
has comment: http://stackoverflow.com/comment/35671799

http://stackoverflow.com/q/23335843
type: AnsweredQuestion
score: 0
tagged with: java
tagged with: error-handling
has body: I'm trying migrate webapp from tomcat to jetty (with jetty-runner) and this is the problem: In any class in my rest api I throw an Exception and in my tomcat, I had configured an error jsp to process, parse and to return a specific formatted message with json syntax. The configuration in tomcat had web.xml: errorJSP /errors.jsp errorJSP /error 500 /error Now, I launch the webapp with jetty and this configuration don't run. After throw exception, the rest api return 500 and the execution don't pass by my jsp
type: Question
has title: Error handler from tomcat to jetty
accepted answer: http://stackoverflow.com/a/23336248
answer count: 1
tagged with: jsp
tagged with: jetty
has answer: http://stackoverflow.com/a/23336248

http://stackoverflow.com/a/23443384
has comment: http://stackoverflow.com/comment/35933151
has comment: http://stackoverflow.com/comment/35933598
answers question: http://stackoverflow.com/q/23442621
has body: Make sure your source files are in "ProjectDirectory/src".
score: 0
has comment: http://stackoverflow.com/comment/35933815
type: Answer

http://stackoverflow.com/comment/35679558
comment on: http://stackoverflow.com/a/23305948
has text: Then there are a few options. I would recommend not using Neo4j for autocomplete. Rather you should create a JSON map using a file storage format you're familiar with. See my example on building predictive autocomplete with Neo4j -- https://github.com/kbastani/predictive-autocomplete
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/23403933
has body: I'musing ExecutionEngine in java to run cypher queries against a neo4j database. I'd like to get all relationships that exist for a node. My raw cypher would be: MATCH (n:Phone{id:'you'}) MATCH n-[r:calling]-&gt;m WHERE n&lt;&gt;m RETURN n, r, m I see plenty of example online that describe how I can get the results of noes from a query, but I'd like to return both the nodes n and m as well as relationship r. Do I need to do anything different than if I was just returning nodes?
has comment: http://stackoverflow.com/comment/35859968
score: 0
answer count: 1
tagged with: neo4j
has title: How can I use ExecutionEngine to get a list of relationships in neo4j?
has answer: http://stackoverflow.com/a/23407734
accepted answer: http://stackoverflow.com/a/23407734
type: AnsweredQuestion
tagged with: java
type: Question

http://stackoverflow.com/a/23354150
accepted answer of: http://stackoverflow.com/q/23353965
has body: It helps if you understand how the smallest element in the list is selected. An efficient way to do this is to start by assuming that the first unsorted element is the smallest and then iterate through the remaining unsorted elements testing this hypothesis. 90, 8, 7, 56, 123, 235, 9, 1, 653 If this is your list, then you begin by assuming 90 is the smallest. Then you compare 90 to 8. 8 is smaller than 90, so you update your hypothesis to be that 8 is the smallest. That makes 1 comparison. You compare 8 to 7. 7 is smaller, so now your hypothesis is that 7 is the smallest. 2 comparisons. You compare 7 to 56. 7 is smaller, so your hypothesis remains unchanged. 3 comparisons. It takes 8 comparisons to work your way through the list and determine that 1 is the smallest. Now that you know that 1 is the smallest you swap it with the first element in the list. 1, 8, 7, 56, 123, 235, 9, 90, 653 Now 1 is in the correct place and you do not have to worry about it again. Now you need to sort the following list. 8, 7, 56, 123, 235, 9, 90, 653 7 comparisons later, you determine that 7 is the smallest element in the list. You swap it with the first element. 7, 8, 56, 123, 235, 9, 90, 653 Now you need to sort the following list. 8, 56, 123, 235, 9, 90, 653 Keep in mind that even though 8 is already in the correct sorted location, you do not know that 8 is the smallest element in the list until you have compared it to every other item in the unsorted list. Therefore you must still make 6 comparisons in order to determine that 8 is the smallest element. However, since 8 is the first element in the list, you do not need to swap it. You can just leave it where it is. 8, 56, 123, 235, 9, 90, 653 Now you need to sort the following list. 56, 123, 235, 9, 90, 653 And so forth.
answers question: http://stackoverflow.com/q/23353965
upvote count: 2
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35768206
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/35768039
downvote count: 0

http://stackoverflow.com/q/23451640
type: Question
tagged with: c#
tagged with: swingworker
tagged with: backgroundworker
score: 0
answer count: 1
has title: SwingWorker vs BackgroundWorker
has comment: http://stackoverflow.com/comment/35949090
has body: In C# I came across Backgroundworker component for concurrency. Although it was slightly advanced than using a plain vanila thread, I found it to be much smoother. I have not used SwingWorker in Java yet. While doing some coding on threads I came across this reference from JavaDoc for SwingWorker as a solution for threadsafety when working with swing objects. Question: In C# I don't recall a statement like "not threadsafe for WinForm/WPF layouts, so use BackgroundWorker". I want to know if SwingWorker can be a substitute for threads in all aspect in Java, like how BackgroundWorker is used in C#? For a novice, should I expect same performance/smooth running/full debug support for SwingWorker?
has comment: http://stackoverflow.com/comment/35949011
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23451677
has comment: http://stackoverflow.com/comment/35948968
linked to: http://stackoverflow.com/q/5828625
tagged with: java
has comment: http://stackoverflow.com/comment/35948957
tagged with: swing

http://stackoverflow.com/comment/35795323
has text: but where i have to put this code i mean after writing file or before because i have tried that first i am writing file and then in that action page i have written this code and again writing file then it is giving error like : java.io.FileNotFoundException: CPIC_2.jpg (Access is denied)
type: Comment
comment on: http://stackoverflow.com/a/23360209
score: 0
type: AnswerComment

http://stackoverflow.com/comment/35818979
has text: @Pshemo yeah I checked them out and tried them but they didn't solve my problem. Those loops iterate the whole map, which in my program call the method for every row in the Map. Resulting in 8 dialogs showing up with 1 button press. I want 1 dialog to show up with 1 button press.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23372341
type: QuestionComment

http://stackoverflow.com/comment/35769877
comment on: http://stackoverflow.com/q/23355208
type: Comment
type: QuestionComment
score: 1
has text: Also, did you mean to comment out the add line: `//firstBoardPanel.add(firstBoard[x][y]);`?

http://stackoverflow.com/a/27129488
type: Answer
answers question: http://stackoverflow.com/q/23357350
has body: ModuleException come due to improper Build. Go through step by step. Update project Restart your eclipse Remove project from server clean server and redeploy your project Now publish it, I hope now it will work.
score: 0

http://stackoverflow.com/a/23802263
type: Answer
answers question: http://stackoverflow.com/q/23383205
has body: If you have a dynamic plugin, then you can create a service that interacts with the database through the dotcms core code for the db connection. Then call the service from whichever controller necessary. Your plugin project will have a dependency on the dotcms core library. Here's some sample code for your service: Connection conn = com.dotmarketing.db.DbConnectionFactory.getConnection(); Statement selectStatement = conn.createStatement(); selectStatement.execute( "SELECT * FROM some_table where..." );
score: 0

http://stackoverflow.com/q/23381603
has body: protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { PrintWriter out=response.getWriter(); HttpSession session=request.getSession(false); session.invalidate(); out.println(session.getId()); // processRequest(request, response); } This is servlet logout called from a jsp page.I am trying to destruct the session but after the function session.invalidate() , its still printing the session ID. Is my session has been destroyed or it will take some time for destruction after executing the invalidate function ?
answer count: 2
upvote count: 1
has answer: http://stackoverflow.com/a/23381700
has title: Still getting session ID after session destruction
tagged with: session
tagged with: java
possible better answer: http://stackoverflow.com/a/23381989
has answer: http://stackoverflow.com/a/23381989
type: AnsweredQuestion
downvote count: 0
tagged with: jsp
score: 1
accepted answer: http://stackoverflow.com/a/23381700
favorite count: 0
type: Question

http://stackoverflow.com/comment/35685063
type: QuestionComment
has text: @Neil Stockton this is the line: "tablo1FacadeLocal.create(tbl1);"
score: 0
comment on: http://stackoverflow.com/q/23299241
type: Comment

http://stackoverflow.com/q/23363111
score: 2
tagged with: java
has comment: http://stackoverflow.com/comment/35783331
has comment: http://stackoverflow.com/comment/35783543
type: Question
has comment: http://stackoverflow.com/comment/35784313
has comment: http://stackoverflow.com/comment/62125951
has body: I have the following code to read data from oracle database and write into csv file. I used OpenCSV jar to write. It takes 230 seconds to write 1MB data. Is there any other way to increase the performance? springJdbcTemplate.query(query,new ResultSetExtractor&lt;ResultSet&gt;(){ @Override public ResultSet extractData(ResultSet rs) throws SQLException, DataAccessException { try { CSVWriter writer = new CSVWriter(new FileWriter("C:/csv/Sample.csv"), ';'); writer.writeAll(rs, true); } catch (Exception e) { System.out.println("Exception -&gt; "+e); } return rs; }});
has comment: http://stackoverflow.com/comment/35787102
answer count: 2
tagged with: http://stackoverflow.com/tag/csv
downvote count: 0
has comment: http://stackoverflow.com/comment/35783373
favorite count: 0
has answer: http://stackoverflow.com/a/23363335
tagged with: resultset
has answer: http://stackoverflow.com/a/50356302
upvote count: 2
has comment: http://stackoverflow.com/comment/35783572
type: UnansweredQuestion
has title: How to improve performance of writing DB data to CSV

http://stackoverflow.com/comment/35941526
type: QuestionComment
type: Comment
has text: I'm trying to get the data inside a table html tags. The tags can vary inside '<' and '>'
comment on: http://stackoverflow.com/q/23447936
score: 0

http://stackoverflow.com/comment/36006713
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23448264
score: 0
has text: Now that I took some time to play with this in JUnit, I see exactly what the issue is. I don't think canonicalize was designed with URLs as input at all. One workaround maybe would be to split the query string up on `&`, canonicalize the contents, and then reconstruct the query String. I have to study for a final but hopefully that will get you somewhere in the meantime.

http://stackoverflow.com/q/23369952
score: 4
tagged with: concurrency
has body: I'm using a ScheduledExecutorService to close a network connection if it has been open for more than several hours. In most cases however, the network connection is closed before the timeout is reached, so I cancel the ScheduledFuture. In this case, I also want the executor service to terminate and to release its thread pool. To my surprise, this does not work out of the box: Although I have called shutdown() on the executor service after scheduling the task, the executor service does not terminate automatically when its only scheduled task is cancelled. From the JavaDoc of ExecutorService.shutdown() this behaviour may even be correct because arguably the cancelled task has not been "executed": void java.util.concurrent.ExecutorService.shutdown() Initiates an orderly shutdown in which previously submitted tasks are executed, but no new tasks will be accepted. Invocation has no additional effect if already shut down. My question is if this can be changed: Is it possible to configure an executor service to automatically terminate when its only scheduled task is cancelled? Or the same question written as a JUnit test: @Test public void testExecutorServiceTerminatesWhenScheduledTaskIsCanceled() throws Exception { ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1); Runnable task = new Runnable() { @Override public void run() { // ... } }; ScheduledFuture&lt;?&gt; scheduledTask = scheduler.schedule(task, 2000, TimeUnit.MILLISECONDS); scheduler.shutdown(); // do more configuration here... Thread.sleep(1000); scheduledTask.cancel(false); Thread.sleep(100); assertThat(scheduler.isTerminated(), is(true)); // ... so that this passes!? }
upvote count: 4
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/23370049
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/35796863
tagged with: multithreading
tagged with: java.util.concurrent
type: Question
has title: How to make a ScheduledExecutorService terminate automatically when its scheduled task is cancelled
has comment: http://stackoverflow.com/comment/35796909
accepted answer: http://stackoverflow.com/a/23370049

http://stackoverflow.com/q/23401627
score: 1
tagged with: java
type: Question
has body: Recently, I need to upgrade Struts2 libraries from 2.3.15.1 to 2.3.16.2. First all, I upgraded those libraries: commons-fileupload-1.3.1.jar commons-io-2.2.jar struts2-core-2.3.16.2.jar struts2-junit-plugin-2.3.16.2.jar struts2-tiles-plugin-2.3.16.2.jar xwork-core-2.3.16.2.jar After that I tried to login the website, it didn't work. And I can't get any error messages or logs from the Tomcat console. Here are some parts of my configuration files: web.xml struts2 org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter struts2 /* org.apache.struts2.tiles.StrutsTilesListener tiles org.apache.tiles.web.startup.TilesServlet definitions-config /WEB-INF/tiles.xml struts.xml <struts> <constant name="struts.custom.i18n.resources" value="ApplicationResources,errors"/> <constant name="struts.devMode" value="true" /> <constant name="struts.configuration.xml.reload" value="true" /> <constant name="struts.action.extension" value="do" /> <result-type name="tiles" class="org.apache.struts2.views.tiles.TilesResult"/> <default-interceptor-ref name="myStack"/> /error.jsp global.setting.successMessage global.setting.errorMessage global.home.index /index.jsp <struts> login.jsp <s:form action="Login.do"> <s:textfield required="true" key="user.account" /> <s:password required="true" key="user.password" /> <s:submit key="normal.login" align="right" method="login"/> </s:form> I closed other filters in web.xml, and interceptors in struts.xml. Finally, I can't login the website and didn't get any error messages or logs from Tomcat console.
has answer: http://stackoverflow.com/a/23405920
tagged with: configuration
has title: Upgrading Struts 2.3.16.2 libraries caused error
tagged with: jsp
tagged with: struts2
tagged with: dmi
accepted answer: http://stackoverflow.com/a/23405920
downvote count: 0
answer count: 1
favorite count: 0
upvote count: 1
type: AnsweredQuestion

http://stackoverflow.com/comment/35986666
has text: i know i need to these codes when i want to create OptionMenu, but when i try to overwrite that method i mean onCreateOptionsMenu() the eclipse shows me an error.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23449588
type: AnswerComment

http://stackoverflow.com/comment/75329888
comment on: http://stackoverflow.com/a/23380335
has text: I needed to check if any word of the sentence starts with the given string. So I changed it to: ".*\\bram.*"
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/23359340
has comment: http://stackoverflow.com/comment/35776801
has answer: http://stackoverflow.com/a/23359468
type: UnansweredQuestion
downvote count: 2
has body: [This is not a duplicate of 23247951] I'm maybe making too many packages, some are as deep as, for instance, mightypork.gamecore.control.events.input. Mostly it's nice, but sometimes I'm not sure I'm doing it right. Here's an example image: Do Tile.java and TileRenderer.java belong into tile package, because they are "top level" abstract or interfaces, or into the subpackages, because the implementations are all there? I want the structure to be logical, but this I'm really unsure about. Note, that this is just an example, I am in similar situation in at least a dozen places. More generally, is it a good practice to make a subpackage just for concrete implementations of something?
has comment: http://stackoverflow.com/comment/35776824
has comment: http://stackoverflow.com/comment/35776758
linked to: http://stackoverflow.com/q/3226282
type: Question
upvote count: 9
has comment: http://stackoverflow.com/comment/35776872
duplicate of: http://stackoverflow.com/q/3226282
tagged with: java
linked to: http://stackoverflow.com/q/23247951
has comment: http://stackoverflow.com/comment/35776977
has comment: http://stackoverflow.com/comment/35777258
score: 7
has title: How to organize java packages properly
favorite count: 0
has answer: http://stackoverflow.com/a/23359551
answer count: 3
tagged with: package
has answer: http://stackoverflow.com/a/23359507

http://stackoverflow.com/comment/35915978
score: 0
comment on: http://stackoverflow.com/q/23433587
type: Comment
type: QuestionComment
has text: on each line (getView) you either put the data in one or the other column. You can't put it in both, because one row of data only contains information about 1 team.

http://stackoverflow.com/comment/35832815
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23389385
has text: It's part of the Android api.

http://stackoverflow.com/a/23448889
score: 0
has comment: http://stackoverflow.com/comment/35943424
type: Answer
answers question: http://stackoverflow.com/q/23448787
has body: You dont have any form of delay, of course you wouldn't see it flash. It will run through that loop very quickly. Also for standards you should be using a for loop, not a while. For is explicityly for when you know how many times you are going to run.

http://stackoverflow.com/comment/35851357
has text: PainelBonus creates another JPanel, but is never added to anything
comment on: http://stackoverflow.com/q/23398214
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/a/23365262
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/23363626
score: 1
accepted answer of: http://stackoverflow.com/q/23363626
upvote count: 1
type: AcceptedAnswer
has body: I resolved it. It wasn't easy since it wasn't a real trouble of java. I had effectively Java 7 version 55 and Java 8 (but also 7-45 and 6). Java 8 was 64-bit while Java 7 was 32. Google Chrome (32-bit browser) used so the last version it could use. According to Oracle, it's recommended to remove older versions of java (because of security) so I removed everything but the 8, and then switched to 64-bit browser (Chromium). I left older JDK installed for compatibility development reasons.

http://stackoverflow.com/comment/35702790
has text: What you want it called auto-completion/auto0suggestion. [Google it](https://www.google.com/search?q=auto%20join#q=auto-suggest+combobox+in+swing+)
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23318753
score: 0

http://stackoverflow.com/a/23326004
has body: Try to replace String str = "[Peter Jackson] [UK] [United Kingdom] [London]"; str = str.replace("[", ""); str = str.replace("]", ""); And then you can try to split it.
answers question: http://stackoverflow.com/q/23325931
type: Answer
has comment: http://stackoverflow.com/comment/35715715
score: 1
upvote count: 2
downvote count: 1
has comment: http://stackoverflow.com/comment/35715676

http://stackoverflow.com/a/23349239
accepted answer of: http://stackoverflow.com/q/23349119
has comment: http://stackoverflow.com/comment/35758491
type: AcceptedAnswer
has body: With REST you should be returning correct Http status codes, not throwing exceptions.
has comment: http://stackoverflow.com/comment/35758450
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/23349119
has comment: http://stackoverflow.com/comment/35760824
upvote count: 2

http://stackoverflow.com/comment/35834554
has text: Why do you create your own custom `FileHandleResolver`? You just have to do `assetManager.load("SFx/button_click.ogg", Sound.class)` and `Sound sound = assetManager.get("SFx/button_click.ogg", Sound.class)`. This is all standard functionality of libgdx.
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23388946

http://stackoverflow.com/comment/56683891
has text: and when i want to set_username ? its same like get right ?
type: AnswerComment
comment on: http://stackoverflow.com/a/23352828
score: 0
type: Comment

http://stackoverflow.com/q/23420930
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: data-structures
has comment: http://stackoverflow.com/comment/35898662
favorite count: 0
has comment: http://stackoverflow.com/comment/35895596
has comment: http://stackoverflow.com/comment/35898630
type: Question
has comment: http://stackoverflow.com/comment/35894840
has answer: http://stackoverflow.com/a/23428761
tagged with: binary-search-tree
upvote count: 1
has comment: http://stackoverflow.com/comment/35896530
answer count: 1
tagged with: tree
tagged with: algorithm
tagged with: java
accepted answer: http://stackoverflow.com/a/23428761
has body: I know this is pretty straight forward code but wondering how exactly the internal working is. public static int getHeight(TreeNode root) { if (root == null) { return 0; } System.out.print(getHeight(root.left) +"\t"); return Math.max(getHeight(root.left), getHeight(root.right)) + 1; } For my understanding, I added print statement but it results the following. printing root.left() prints this: 0 0 0 1 0 0 0 printing root.right() prints this: 0 0 2 0 0 3 0 0 2 0 0 0 1 0 Following is the Tree created in the main program: TreeNode parent = new TreeNode(10); parent.insertInOrder(2); parent.insertInOrder(13); parent.insertInOrder(5); parent.insertInOrder(6); parent.insertInOrder(15); parent.insertInOrder(6); How is this printing the above result and how is it working. If anyone can explain me with the above example, it would really help me. I know how traversals work and how to print the tree but I really want to understand the above output. If anyone can help then it would be great. void setLeftChild(TreeNode left) { this.left = left; if(left == null) { left.parent = this; } } void setRightChild(TreeNode right) { this.right = right; if(right == null) { right.parent = this; } } void insertInOrder(int d) { if(d &lt;= data) { if(left == null) { setLeftChild(new TreeNode(d)); } else { left.insertInOrder(d); } } else{ if(right == null) { setRightChild(new TreeNode(d)); } else{ right.insertInOrder(d); } } size++; }
has comment: http://stackoverflow.com/comment/35895878
has title: Binary search Tree balanced working for getting height

http://stackoverflow.com/q/23410920
tagged with: java
has comment: http://stackoverflow.com/comment/35873753
has comment: http://stackoverflow.com/comment/35872756
score: 0
answer count: 2
tagged with: casting
has answer: http://stackoverflow.com/a/23411104
tagged with: arrays
tagged with: type-conversion
tagged with: arraylist
accepted answer: http://stackoverflow.com/a/23411104
has body: I am unable to understand the difference in the type of "Array of Objects" AND "ArrayList of same Objects". For example I have Interface X: public interface X { public void implemntX(); } Class XYZ implementing X: public class XYZ implements X{ @Override public void implemntX() { // TODO Auto-generated method stub } } Following codes works perfect: X arraryOfX[] = new XYZ[10]; if(arraryOfX instanceof XYZ[]){ System.out.println("arraryOfX is instanceOF XYZ[]"); }else{ System.out.println("arraryOfX is NOT instanceOF XYZ[]"); } Output: arraryOfX is instanceOF XYZ[] But following line of code gives me compile time error: ArrayList&lt;X&gt; arrayListOFX = new ArrayList&lt;XYZ&gt;(); ERROR: Type mismatch: cannot convert from ArrayList&lt;XYZ&gt; to ArrayList&lt;X&gt; To the best of my understanding, ArrayList internally uses array then why Type mismatch error is bubbling up?
possible better answer: http://stackoverflow.com/a/23411130
linked to: http://stackoverflow.com/q/2745265
has answer: http://stackoverflow.com/a/23411130
has title: Difference in the type of "Array of Objects" AND "ArrayList of same Objects"?
duplicate of: http://stackoverflow.com/q/2745265
type: Question
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/1368166

http://stackoverflow.com/comment/35921297
comment on: http://stackoverflow.com/q/23436868
has text: Are you claiming that Array.sort only returns sorting for ints/bytes?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23409662
has comment: http://stackoverflow.com/comment/35870649
answers question: http://stackoverflow.com/q/23409095
has body: By calling indexOf() you print the first index that matches, rather than the current index. If you're interested in tracking your position in the list, the best thing is to do that manually, so instead of a for-each loop: for(Object o : ls) { // the syntax is nice, but we don't have an easy way to // tell how far into the list we are System.out.println(o); } Instead, use a simple for loop: for(int i = 0; i &lt; ls.size(); i++) { Object o = ls.get(i); // Now we have access to the object *and* its index System.out.println(i+": "+o); } Additionally, there's quite a few simple cleanups you could make in your code, if you'll forgive me, here's some suggestions: Avoid allowing null in your objects - rarely is null actually meaningful, and allowing it forces all calling code to do null checks everywhere. public Person(String firstName,String lastName) { if(firstName == null || lastName == null) { throw new NullPointerException("First/Last name cannot be null"); } this.firstName = firstName; this.lastName = lastName; } Use String.format() correctly, or just avoid it. Your current toString() method calls String.format(this.firstName + " " + this.lastName), which doesn't actually do anything; you might as well just return the concatenated string without String.format(). Alternatively, you can properly use the format functionality like so: String.format("%s %s", firstName, lastName); Take advantage of Java 7's Objects class for your hashCode() and equals() methods: @Override public int hashCode() { return Objects.hash(firstName, lastName); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Person other = (Person) obj; return Objects.equals(firstName, other.firstName) &amp;&amp; Objects.equals(lastName, other.lastName); }
score: 0
type: Answer

http://stackoverflow.com/comment/49643677
type: Comment
has text: Try setting `org.springframework.http`, `org.apache.httpcomponents` and `org.apache.http` logging to DEBUG.
type: QuestionComment
comment on: http://stackoverflow.com/q/23322754
score: 0

http://stackoverflow.com/comment/35906271
has text: Afterwards you would replace the content of the list with the content of the map (it provides methods to deliver only a set containing the values).
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23429089
type: AnswerComment

http://stackoverflow.com/a/23388693
upvote count: 4
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23388468
type: Answer
accepted answer of: http://stackoverflow.com/q/23388468
has body: The issue appears because February has less than 30 days. For example, running this today (30.04.2014) : Calendar calendar = Calendar.getInstance(); calendar.set(Calendar.MONTH, 1); System.out.println(calendar.getTime()); returns Sun Mar 02 14:52:28 CET 2014 You should add in your code before setting month : calendar.set(Calendar.DAY_OF_MONTH, 1);
score: 4

http://stackoverflow.com/q/23421272
has body: I am trying to create a server socket using sslContext.getServerSocketFactory().createServerSocket(port); But its giving exception permission denied. Below is my complete code. private SSLServerSocket getSslServerSocket(int port) throws GeneralSecurityException { KeyManager[] keyManager = this.mKeyStoreManager.getKeyManagers(); TrustManager[] trustManager = this.mKeyStoreManager.getTrustManagers(); SSLContext sslContext = SSLContext.getInstance("TLS"); sslContext.init(keyManager, trustManager, (SecureRandom) null); SSLServerSocket sslServerSocket = null; try { sslServerSocket = (SSLServerSocket) sslContext .getServerSocketFactory().createServerSocket(port); sslServerSocket.setNeedClientAuth(true); sslServerSocket.setUseClientMode(false); } catch (Exception ex) { Log.e("----Exception", ex.getMessage()); } return sslServerSocket; } I have tried multiple ports, but I am getting same error on all. Below is the exception message. java.net.SocketException: socket failed: EACCES (Permission denied)
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35913016
type: Question
has title: createServerSocket returning java.net.SocketException: socket failed: EACCES (Permission denied)
tagged with: sockets
tagged with: android
tagged with: serversocket
score: 0
has answer: http://stackoverflow.com/a/34768850
answer count: 1
has comment: http://stackoverflow.com/comment/35893394
tagged with: java
tagged with: sslsocketfactory

http://stackoverflow.com/a/23370530
answers question: http://stackoverflow.com/q/23370445
upvote count: 1
has comment: http://stackoverflow.com/comment/35798195
score: 1
has comment: http://stackoverflow.com/comment/35799200
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/23370445
has body: It is a good programming practice to split up your code so you (and others) don't get lost. Split it into methods/functions/procedures, classes and packages by meaning, not by size alone. If several classes do the same thing, have you thought about using inheritance? Don't duplicate code, it makes maintenance harder (and is a waste). For Java, interfaces and abstract classes can also improve legibility and structure of your code; use with moderation. Many Java IDEs come with handy "refactoring" functionalities which allow you to restructure your code easier and cleaner than copy/paste would be. ( Possibly related topic: "how do you organize your programming work" how do you organize your programming work )

http://stackoverflow.com/comment/35753691
type: Comment
comment on: http://stackoverflow.com/a/23304810
score: 0
type: AnswerComment
has text: @kctang Jacoco is capable of attaching during runtime. Basically, you put it on the Tomcat classpath, and start executing code against Tomcat, and it generates usage reports based on that code, and continues to do so until you terminate Tomcat (there's a way to pull the report from Tomcat while it's running too). I know its _default_ mode is to show Unit test coverage, but I'm talking about a secondary mode that it can run in. Hope this helps!

http://stackoverflow.com/comment/35918397
has text: Please, note that there's no beginner, intermediate, advanced nor any other level here in the site. You ask as a professional, you get an answer from another professional.
comment on: http://stackoverflow.com/q/23435400
score: 4
type: QuestionComment
type: Comment

http://stackoverflow.com/q/23448740
answer count: 2
downvote count: 2
has title: Why does `--var` and `var-1` work differently?
has comment: http://stackoverflow.com/comment/35943235
has answer: http://stackoverflow.com/a/23448936
favorite count: 0
upvote count: 5
possible better answer: http://stackoverflow.com/a/23448936
tagged with: pre-increment
linked to: http://stackoverflow.com/q/561588
has answer: http://stackoverflow.com/a/23448782
accepted answer: http://stackoverflow.com/a/23448782
has comment: http://stackoverflow.com/comment/35943186
has body: I did write a code to print all valid combinations of n-pair parentheses. However, at my first try, the algorithm output all the combinations twice, that is, . The code was: public static void solve(char[] string, int open, int closed, int index) { if (open &lt; 0 || closed &lt; open) { return; } if (open == 0 &amp;&amp; closed == 0) { System.out.println(string); } if (open &gt; 0) { string[index] = '('; solve(string, --open, closed, ++index); } if (closed &gt; open) { string[index] = ')'; solve(string, open, --closed, ++index); } } I spend a significant amount of time in order to see what went wrong. I figured the code went into the last if branch more than it should. Then, while trying different things, I realized changing solve(string, --open, closed, ++index); to solve(string, open-1, closed, ++index); changed the outcome. This resulted in getting a java.lang.ArrayIndexOutOfBoundsException. Finally, I replaced all pre-increment operations with corresponding arithmetic operations(e.g., ++index to index+1) and the code ran correctly. My question is, shouldn't --open and open-1 calculate and send the same value as parameter to the function? How come the code behaves differently when they should calculate the same value?
has comment: http://stackoverflow.com/comment/35943166
has comment: http://stackoverflow.com/comment/35943255
type: Question
type: AnsweredQuestion
score: 3
tagged with: java

http://stackoverflow.com/a/52785065
has body: step 1: put &lt;uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /&gt; into manifest file and, step 2: put mouse cursor between cm and get.(cm.getActiveNetworkInfo();) Then type getActionNetworkInfo(); again.then automatically popup it.Then click Tab button.Then run your project. I faced same problem and worked it to me.
answers question: http://stackoverflow.com/q/23329590
score: 0
type: Answer

http://stackoverflow.com/a/23340748
type: Answer
has body: Since browsers will usually be able to deal with almost any garbage you feed into it (if it ain't XHTML...), if the only thing that actually happens with the input (assuming it's valid HTML of any kind) is being sliced, then the only thing you have to worry about is to actually get rid of invalid opening tags; you won't be able to distinguish broken 'endings' of tags, since they, in themselves, ain't special in any way. I'd just take a slice I've generated and parse it from the end; if I encounter a stray '&lt;', I'd get rid of everything after it. Likewise, I'd keep track of the last opened tag - if the next close after it wasn't closing that exact tag, it's likely the closing tag got out, so I'd insert it. This would still generate a lot of garbage, but would at least fix some rudimentary problems. A better way would be to manage a stack of opened/closed tags and generate/remove the needed/broken/unnecessary ones as they emerge. A stack is a proper solution since HTML tags musn't 'cross' [by the spec, AFAIR it's this way from HTML 4], i.e. &lt;span>&lt;div>&lt;/span>&lt;/div> isn't valid. A much better way would be to splice the document after first parsing it as SGML/HTML/XML (depends on the exact HTML doctype) - then you could just remove the nodes, without damaging the structure. Note that you can't actually know if a tag is correct without providing an exact algorithm you use to generate this 'garbled' content.
score: 0
answers question: http://stackoverflow.com/q/23340065

http://stackoverflow.com/a/43150099
type: Answer
has comment: http://stackoverflow.com/comment/139112568
upvote count: 169
downvote count: 1
score: 168
answers question: http://stackoverflow.com/q/23419087
has body: The accepted answer from @arshajii is totally correct. However just being more explicit by saying below, StringUtils.isBlank() StringUtils.isBlank(null) = true StringUtils.isBlank("") = true StringUtils.isBlank(" ") = true StringUtils.isBlank("bob") = false StringUtils.isBlank(" bob ") = false StringUtils.isEmpty StringUtils.isEmpty(null) = true StringUtils.isEmpty("") = true StringUtils.isEmpty(" ") = false StringUtils.isEmpty("bob") = false StringUtils.isEmpty(" bob ") = false

http://stackoverflow.com/q/23395284
tagged with: ajax
tagged with: response
has comment: http://stackoverflow.com/comment/35843400
has comment: http://stackoverflow.com/comment/35843959
has body: I have a form with fields which are getting populated from ajax response, but here is the problem when i submit the form with some validation errors then the form submission is getting failed as expected, but i'm unable to regain the same form with fields which are already populated through ajax response.they are displaying the state to the initial form load. private ActionResult updateAlertTemplate(final Control source, final JQEvent event, final String globalFormatYN, final Form form) { final JQTaconite actionResult = new JQTaconite(); new WithTransaction&lt;Object&gt;() { @Override protected Object execute0(final DatabaseSession s, final Object... args) { final Field sel = form.getField("format"); if (globalFormatYN.equals("G")) { final String eventcode = (String) getContext().getSession() .getAttribute("eventCode0"); final String channel = (String) getContext().getSession() .getAttribute("channel0"); ProgramUtils.fillAlertTemplate(s, sel, eventcode, channel); } // sel.setStyle("width", "200px"); actionResult.replace(sel); return null; } }.execute(); return actionResult; } its an apache click code
type: Question
tagged with: web-applications
has title: ajax response is getting lost after unsuccessful form submission in java webapp
score: 0
tagged with: java
tagged with: forms
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35869690

http://stackoverflow.com/a/23408189
type: Answer
score: 2
downvote count: 0
has body: Cohesion can be defined as the degree to which the elements of a module belong together. Visualizing it helps. Imagine the attributes of a class and the methods. If your class is cohesive, it means the methods are going to use many of the attributes, and conversely, the attributes will be used by many of the methods. This is the "sticking together" notion of cohesion. I like the following visualization that comes from NDepend's placemat: As others pointed out, the methods that direct the plane (e.g., directToX) are possibly outside of the "theme" of what is a Plane, but they're not flagrantly wrong. Those elements (responsibilities) might be better in another class, say, AirTrafficController. In reality, planes don't decide much how they fly. Their pilots must follow instructions from the ground. I'd argue that the Thread stuff (start, run) is definitely outside the theme of a Plane. Those methods hardly use anything that are part of a Plane (they are distractions from its theme). You could use an anonymous inner class to handle the processing in a thread from the main and your Plane would be even more reusable (and cohesive). A cohesive object gets to the essence of the thing it models. This means it could more likely be re-used easily in another application (or even another OO language). Anything that starts to creep outside the true theme of your concept will likely make it harder to re-use the concept in another application. The "distractions" don't make sense anymore in another application. If you're developing a Kamikaze project (one where you just want to make it work and don't care about re-use), it's perfectly OK to forget about cohesion (and other design elements). Design choices are trade-offs. You could refactor your Plane class to make it more cohesive, but if you never reuse it in another application, you've perhaps wasted your time. On the other hand, design is a learning process; even if you over-design something for one application, you maybe learne…
answers question: http://stackoverflow.com/q/23390145
upvote count: 2

http://stackoverflow.com/q/23442368
upvote count: 1
downvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/23442423
favorite count: 0
has body: i have created an app that shows user location in latitude and longitude . i now want this to take the latitude and longitude and send a Google maps link to other user through sms *the recievers phone number is set by the user here is my working code 1 (AndroidGPSTrackingActivity.java) public class AndroidGPSTrackingActivity extends Activity { Button btnShowLocation; // GPSTracker class GPSTracker gps; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); btnShowLocation = (Button) findViewById(R.id.btnShowLocation); // show location button click event btnShowLocation.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View arg0) { // create class object gps = new GPSTracker(AndroidGPSTrackingActivity.this); // check if GPS enabled if(gps.canGetLocation()){ double latitude = gps.getLatitude(); double longitude = gps.getLongitude(); // \n is for new line Toast.makeText(getApplicationContext(), "Your Location is - \nLat: " + latitude + "\nLong: " + longitude, Toast.LENGTH_LONG).show(); }else{ // can't get location // GPS or Network is not enabled // Ask user to enable GPS/network in settings gps.showSettingsAlert(); } } }); } } 2(GPSTracker.java) public class GPSTracker extends Service implements LocationListener { private final Context mContext; // flag for GPS status boolean isGPSEnabled = false; // flag for network status boolean isNetworkEnabled = false; // flag for GPS status boolean canGetLocation = false; Location location; // location double latitude; // latitude double longitude; // longitude // The minimum distance to change Updates in meters private static final long MIN_DISTANCE_CHANGE_FOR_UPDATES = 5; // 5 meters // The minimum time between updates in milliseconds private static final long MIN_TIME_BW_UPDATES = 1000 * 60 * 1; // 1 minute // Declaring a Location Manager protected LocationManager locationManager; public GPSTracker(Context context) { this.mCont…
accepted answer: http://stackoverflow.com/a/23442423
tagged with: android
type: AnsweredQuestion
has title: sending a location link as sms in background
score: 1
tagged with: java
type: Question

http://stackoverflow.com/q/23347996
accepted answer: http://stackoverflow.com/a/23348009
type: Question
tagged with: date
answer count: 1
downvote count: 0
favorite count: 0
tagged with: parsing
upvote count: 2
has title: Why won't my SimpleDateFormat convert correctly?
score: 2
has answer: http://stackoverflow.com/a/23348009
has body: I have my Date as String: 2014-06-23 22:00 To get the Date as java.util.date I parse it by using SimpleDateFormat Date listDate = new Date(); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-DD HH:mm",Locale.GERMANY); listDate = sdf.parse(gameList.get(position).getTime()); but my output System.out.println(listDate) is 2014-04-118 19:37 What's going on here??
type: AnsweredQuestion
tagged with: simpledateformat
tagged with: java

http://stackoverflow.com/comment/35763386
type: AnswerComment
comment on: http://stackoverflow.com/a/23351622
score: 0
type: Comment
has text: mmm. the error is pretty clear :) have you tried to access your schema from 10.55.200.1? In case mysql and your container are on the same host try to grant access to localhost, or try with a % to be less restrictive.

http://stackoverflow.com/a/23435897
has body: I apologize for writing a new answer, but I can't comment on invin's answer (due to not having 50 reputation) so I had to do it here. This BFS algorithm could be additionally optimized by making sure you're not expanding from any already visited states. With factoradic you can represent any possible state with a number between 1 and 9! (362880). You can use a simple bool array (size 362880) to keep track if you have already visited a state before in the BFS. You only expand into non-visited states which I believe would drastically reduce the operation time in cases with bigger steps.
downvote count: 0
upvote count: 2
type: Answer
score: 2
answers question: http://stackoverflow.com/q/23433442
has comment: http://stackoverflow.com/comment/36166074

http://stackoverflow.com/q/23343936
accepted answer: http://stackoverflow.com/a/23344082
type: AnsweredQuestion
has body: I'm programming some code with the mentioned library in JAVA. The problem is that, because the buffer receibed could be of variable long, as limit 512 bytes, when it is long enough I received the message fragmented. I thought that the serial event activated with the arrived of the first character, and when the program take the buffer it's not complete. In others language, there is a way to say to the library that only activate that event when specifics characters arrived, There is something like this in the metioned library? Thanks.-
score: 0
tagged with: java
type: Question
tagged with: rxtx
has answer: http://stackoverflow.com/a/23344082
has title: Using lybrary RXTX 2.1
answer count: 1

http://stackoverflow.com/a/39006509
has body: I know of only one way. Keep the JSP in /META-INF/resources folder. Create a 'lib' folder inside the WEB-INF folder in your WAR. Place the JAR (containing the JSP in the /META-INF/resources folder) in the lib folder of the WAR. In the main JSP where you want to include this external JSP residing in the JAR, use the following statement: &lt;jsp:include page="/myJSP.jsp" &gt;&lt;/jsp:include&gt;. Note that the '/' is required in front of the jsp file name to make the container look for the JSP in an absolute path (and hence in the jar in the lib folder) rather than in the current path where the main JSP is lying. This will surely work.
type: Answer
accepted answer of: http://stackoverflow.com/q/23344957
downvote count: 0
has comment: http://stackoverflow.com/comment/127877489
score: 1
answers question: http://stackoverflow.com/q/23344957
has comment: http://stackoverflow.com/comment/127863085
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/127927541

http://stackoverflow.com/a/23402524
has body: You can use Sesame's QueryResultIO utility for this. Simplest way is to just let it parse the stream into a query result object. Like so: InputStream in = ...; TupleQueryResult result = QueryResultIO.parse(in, TupleQueryResultFormat.SPARQL); The above is hardwired to create a result object. If you want more control over the processing, you can create a TupleQueryResultParser object and assign it your own TupleQueryResultHandler implementation. Something like this: TupleQueryResultParser parser = QueryResultIO.createParser(TupleQueryResultFormat.SPARQL); TupleQueryResultHandler handler = new MyCustomStreamingResultHandler(); parser.setQueryResultHandler(handler); parser.parseQueryResult(in); Or like this, if you're working with an older version of Sesame (2.6 or older): TupleQueryResultHandler handler = new MyCustomStreamingResultHandler(); parser.setTupleQueryResultHandler(handler); parser.parse(in); Sesame provides several stock implementation of TupleQueryResultHandler, but it's very straightforward to create your own as well if you wish to have full control over the parser output processing.
upvote count: 2
has comment: http://stackoverflow.com/comment/35888606
has comment: http://stackoverflow.com/comment/35889443
has comment: http://stackoverflow.com/comment/35920417
score: 2
accepted answer of: http://stackoverflow.com/q/23380911
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23380911
has comment: http://stackoverflow.com/comment/35920953
has comment: http://stackoverflow.com/comment/35888584
type: Answer

http://stackoverflow.com/a/23387768
answers question: http://stackoverflow.com/q/23387697
score: 2
downvote count: 0
type: Answer
has body: String[] book_array = new String[60]; Not sure I understand your question though. Better approach: Just use an Array or List of type Book: Book[] books = new Book[60]; while your Book type has these: public class Book { private String isbn; private String name; private String author; private int number; // getters and setters }
upvote count: 2

http://stackoverflow.com/comment/35786700
type: Comment
type: QuestionComment
has text: If you need to use code in different environment then you need to access the files using "relative paths". What seems to be the problem?
score: 0
comment on: http://stackoverflow.com/q/23364792

http://stackoverflow.com/q/23328709
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/35721412
tagged with: min
has comment: http://stackoverflow.com/comment/35721046
tagged with: max
tagged with: sorting
has body: I have a quick java program to perform some numerical actions. Right now it uses the Collections library, however the assignment says to not use any of the methods from the java.util.Collections class. What can I switch it out with? Right now I have Collections sorting the ArrayList and also getting the minimum and maximum values. Thank you. If you need my code: import java.util.ArrayList; import java.util.Scanner; import java.util.Collections; class Main { public static void main(String[] args) { ArrayList&lt;Integer&gt; grades = new ArrayList&lt;Integer&gt;(); Scanner input = new Scanner(System.in); System.out.println("Input:"); int i = 0; int strs = 0; strs = input.nextInt(); while (strs != -1) { if(strs &gt; 100 || strs &lt; 0 &amp;&amp; strs != -1) { strs = input.nextInt(); } else { grades.add(strs); strs = input.nextInt(); i++; } } System.out.println("\nOutput:\n"); System.out.println(grades); System.out.println("Sorted:"); Collections.sort(grades); System.out.println(grades); int sum = 0; for (int g : grades) sum += g; double average = sum / grades.size(); average = 1 * sum / grades.size(); System.out.println("Average: " + average); int mid = grades.size()/2; double median = grades.get(mid); if (grades.size()%2 == 0) { median = (median + grades.get(mid-1))/2; } System.out.println("Median: " + median); int max = Collections.max(grades); int min = Collections.min(grades); int range = max - min; System.out.println("Range: " + range); } }
score: 0
has comment: http://stackoverflow.com/comment/35721190
favorite count: 0
has comment: http://stackoverflow.com/comment/35722515
answer count: 0
has comment: http://stackoverflow.com/comment/35721204
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35721035
upvote count: 1
tagged with: collections
downvote count: 1
has comment: http://stackoverflow.com/comment/35721183
has title: How to do numerical actions without Collections?

http://stackoverflow.com/comment/35755897
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23344839
has text: Would you mind pasting the POM snippet?

http://stackoverflow.com/q/23298862
tagged with: java
tagged with: apache-axis
has answer: http://stackoverflow.com/a/28460349
type: Question
score: 0
answer count: 2
tagged with: maven-2
has answer: http://stackoverflow.com/a/23324337
has comment: http://stackoverflow.com/comment/35671483
has body: I have tried building the source distribution to generate the exact same binary distribution and have not been able to do so. I am using "mvn clean package" from command line and getting the jar under the /target and the .war under modules/webapp/target. I want all the executables present under/bin and the jar(s) under /lib as present in the binary distribution to be generated from source; in other words just the exact replica of the binary distribution from the source. Is it really possible to do so? If yes, can somebody please advice as how to proceed?
type: UnansweredQuestion
has title: Axis2 - Creating complete binary distribution from source distribution
tagged with: maven

http://stackoverflow.com/comment/35774666
comment on: http://stackoverflow.com/q/23343169
has text: I am not talking about the server certificates keystore, the K2 has sense, but K1 could be used at application level without any problems because is used to connect to external services. If you build a new application in the future to connect to another external services, what do you do?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35855374
type: Comment
type: QuestionComment
has text: @Davis Wallace Please to believe it can you just give me exact proof ? Such as a reference in case of question B.) or an example in case of question A) that will make me understand it better, though thanks for the answer.
comment on: http://stackoverflow.com/q/23401644
score: 0

http://stackoverflow.com/a/23405586
score: 0
has comment: http://stackoverflow.com/comment/35862805
has comment: http://stackoverflow.com/comment/35862847
has comment: http://stackoverflow.com/comment/35863323
type: Answer
has comment: http://stackoverflow.com/comment/35862958
has comment: http://stackoverflow.com/comment/35862512
answers question: http://stackoverflow.com/q/23403950
has body: any map (hashmap,linkedhashmap ,hashtable or treemap) in java can have only one unique key. if you add same key again then it overrides the previous key. so better to add values in a list or set and add that to map using single key. same is demonstrated as below Map&lt;String, List&lt;String&gt;&gt; map = new HashMap&lt;String, List&lt;String&gt;&gt;(); List&lt;String&gt; values1 = new ArrayList&lt;String&gt;(); List&lt;String&gt; values2 = new ArrayList&lt;String&gt;(); values1.add("10"); values1.add("20"); values2.add("30"); values2.add("40"); map.put("key1", values1); map.put("key2", values2); for (Map.Entry&lt;String, List&lt;String&gt;&gt; entry : map.entrySet()) { System.out.println(entry.getKey() + " values are "); System.out.println(entry.getValue()); } in your case create list with the values 04302014,abc,10,20,20 another list with values def,10,20,20 add these two list with corresponding key key 04302014 for list1 and key 05302014 for list2

http://stackoverflow.com/q/23342499
tagged with: functional-interface
upvote count: 43
favorite count: 0
type: UnansweredQuestion
tagged with: java-8
answer count: 4
has title: Why Functional Interfaces in Java 8 have one Abstract Method?
score: 41
tagged with: java
downvote count: 2
has answer: http://stackoverflow.com/a/26923773
has answer: http://stackoverflow.com/a/55095599
type: Question
has body: As we know in Java 8, the concept of functional interfaces are introduced. A Functional Interface has one abstract method and several default or static methods are possible. But why should a Functional interface have only one abstract method? If Interface has more then one abstract method, why is this not a Functional Interface?
has answer: http://stackoverflow.com/a/23342625
has comment: http://stackoverflow.com/comment/78004246
has comment: http://stackoverflow.com/comment/82427028
has answer: http://stackoverflow.com/a/68336258
linked to: http://stackoverflow.com/q/45466315

http://stackoverflow.com/comment/35769027
type: Comment
has text: Although what you say is correct, this wouldn't solve the problem in question.
comment on: http://stackoverflow.com/a/23354905
type: AnswerComment
score: 0

http://stackoverflow.com/q/23325251
has comment: http://stackoverflow.com/comment/35742340
tagged with: android
type: UnansweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/23341855
tagged with: opencv
has title: Which function can be used to swap matrices (Mat) in opencv4android
type: Question
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/35740235
has body: I am working on a project in OpenCV4android. I have to Mat objects that I would like to swap, in the same way the c++ function cv::swap(Mat &amp;a, Mat &amp;b) swaps matrices a and b. What is the equivalent java function in OpenCV4android?

http://stackoverflow.com/q/23359177
type: AnsweredQuestion
tagged with: automation
has body: I am trying to parse Octane benchmark page http://octane-benchmark.googlecode.com/svn/latest/index.html , with WebElements: Start Octane 2.0 I've started Selenium WebDriver on my tablet device (using Java, Eclipse, Selendoroid) SelendroidConfiguration config = new SelendroidConfiguration(); selendroidServer = new SelendroidLauncher(config); selendroidServer.lauchSelendroid(); DesiredCapabilities caps = SelendroidCapabilities.android(); driver = new SelendroidDriver(caps); and I've initialized driver with Octane page: driver.get("http://octane-benchmark.googlecode.com/svn/latest/index.html"); I am trying to parse it with xpath: String xpathString = "//div[@class='hero-unit']//h1"; String line = driver.findElement(By.xpath(xpathString)).getText(); System.out.println(line); but Java returns NullPointer Exception (on line)- function FindElement() can not find anything on this .html page. Driver is started well, it returns appropriate value for getCurrentUrl() function, but can not return PageSource(), and can not return any value for findElement(By.something...). Looks like, this Octane page has something that stops every search request (during parsing process). On the same way I have parsed 7 other benchmark pages, and they worked well, but this Octane page...acts just like it is "empty" for WebDriver... I don't know is it because of part, or something else? Is this Octane benchmark page special about something? Thanks...
has answer: http://stackoverflow.com/a/23361899
has answer: http://stackoverflow.com/a/23364318
answer count: 2
downvote count: 0
favorite count: 0
has title: Webdriver Automation - Unable to find element using xpath (in Octane 2.0 Benchmark page)
possible better answer: http://stackoverflow.com/a/23361899
tagged with: xpath
score: 1
tagged with: java
tagged with: selenium
upvote count: 1
tagged with: webdriver
type: Question
accepted answer: http://stackoverflow.com/a/23364318

http://stackoverflow.com/q/23407535
type: Question
has title: My app is messsed up in landscape view
tagged with: android-layout
has answer: http://stackoverflow.com/a/23407625
has answer: http://stackoverflow.com/a/23407620
has answer: http://stackoverflow.com/a/23407644
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/35866220
favorite count: 0
tagged with: android
has body: I have this xml: &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:ads="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#000000" android:orientation="vertical"&gt; &lt;LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical"&gt; &lt;com.google.android.gms.ads.AdView android:id="@+id/adView" android:layout_width="fill_parent" android:layout_height="wrap_content" android:gravity="center_vertical" ads:adUnitId="ca-app-pub-xxx/xxx" ads:adSize="SMART_BANNER" android:background="#E5E4E2" /&gt; &lt;ImageView android:id="@+id/sphereIcon" android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical" android:layout_gravity="center_horizontal" android:contentDescription="@string/magicBallDescr" android:src="@drawable/rsz_topkniga" /&gt; &lt;TextView android:id="@+id/txtAnswer" android:layout_marginTop="10dp" android:layout_width="match_parent" android:layout_height="wrap_content" android:textColor="#ed620b" android:orientation="vertical" android:gravity="center" android:typeface="sans" android:textSize="25sp" /&gt; &lt;EditText android:id="@+id/txtQuestion" android:layout_marginTop="13dp" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" android:layout_gravity="center" android:hint="@string/textHint" android:inputType="textMultiLine" android:lines="6" android:background="#ffffff"/&gt; &lt;/LinearLayout&gt; &lt;Button android:id="@+id/btnAsk" android:layout_marginTop="10dp" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="#e5802d" android:text="@string/btnAskQ" android:paddingEnd="@dimen/activity_vertical_margin" android:layout_alignParentBottom="true" /&gt; &lt;/RelativeLayout&gt; and in portrait view my app looks perf…
accepted answer: http://stackoverflow.com/a/23407620
answer count: 4
has comment: http://stackoverflow.com/comment/35866228
tagged with: http://stackoverflow.com/tag/xml
has answer: http://stackoverflow.com/a/23407692
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35866214
tagged with: android-fragments
has comment: http://stackoverflow.com/comment/35866189
upvote count: 2
tagged with: java
possible better answer: http://stackoverflow.com/a/23407625

http://stackoverflow.com/q/23308856
has body: I have a problem. I'm implementing the DPLL algorithm (which I've already finished). Now I'm calculating the running time by the standard function java api. System.currentTimeMillis(); The problem is that I have to provide the test results to my problem, but compared to all the sources that I found on the internet, my algorithm has run times considerably better. Now either I've found the best implementation of the algorithm ever (That rule it out), or the function returns a wrong time. The time unit of the function is milliseconds (ms)? Thank you all.
type: AnsweredQuestion
tagged with: algorithm
has title: DPLL algorithm - only advice
tagged with: java
has answer: http://stackoverflow.com/a/23308893
tagged with: eclipse
type: Question
has comment: http://stackoverflow.com/comment/35684373
score: 0
accepted answer: http://stackoverflow.com/a/23308893
has comment: http://stackoverflow.com/comment/35684325
answer count: 1
has comment: http://stackoverflow.com/comment/35684383
has comment: http://stackoverflow.com/comment/35684369

http://stackoverflow.com/q/23338097
tagged with: css
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23338527
accepted answer: http://stackoverflow.com/a/23338527
tagged with: java
has comment: http://stackoverflow.com/comment/35737805
type: Question
has title: How can I animate an image bluring?
answer count: 2
has answer: http://stackoverflow.com/a/23338262
tagged with: jquery
tagged with: blur
has comment: http://stackoverflow.com/comment/35737823
score: 0
tagged with: http://stackoverflow.com/tag/html
has body: I would like to animate the bluring on image in JQuery I have this image : &lt;img id="right" class="vote" src="css/images/no.png" alt="no button" onclick="vote(0)"&gt; And I would like to do become this image more blur during 1 seconde. Somethings like this : $("#right").animate({"-webkit-filter":"blur(30px)"},1000); But this don't works. I'm waiting for your answer.
linked to: http://stackoverflow.com/q/18211943
has comment: http://stackoverflow.com/comment/35738085
linked to: http://stackoverflow.com/q/16781486
possible better answer: http://stackoverflow.com/a/23338262

http://stackoverflow.com/comment/35834796
type: Comment
has text: @AmitJoki What will `<.+class=("|').+?\2.+?class.+>` do?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23390567

http://stackoverflow.com/comment/36820624
score: 0
type: AnswerComment
has text: No that combined the salary for those years they have in common. I still want the "avg(salary)" per year and per UserId. How can this be done?
type: Comment
comment on: http://stackoverflow.com/a/23358033

http://stackoverflow.com/comment/54681121
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/29200956
has text: I couldn't see why my app was crashing in the android studio logcat, there were no errors at all. This answer gave me what I needed. Later on however I realised that I had some filter on in the studio logcat which was preventing me from seeing the error. I switched back to "Show only selected application" and I was back up and running.
score: 1

http://stackoverflow.com/a/23414798
type: Answer
has body: Upcasting is casting to a supertype, while downcasting is casting to a subtype. Upcasting is always allowed, but downcasting involves a type check and can throw a ClassCastException. In your case, a cast from a Dog to an Animal is an upcast, because a Dog is-a Animal. In general, you can upcast whenever there is an is-a relationship between two classes. Downcasting would be something like this: Animal animal = new Dog(); Dog castedDog = (Dog) animal; Basically what you're doing is telling the compiler that you know what the runtime type of the object really is. The compiler will allow the conversion, but will still insert a runtime sanity check to make sure that the conversion makes sense. In this case, the cast is possible because at runtime animal is actually a Dog even though the static type of animal is Animal. However, if you were to do this: Animal animal = new Animal(); Dog notADog = (Dog) animal; You'd get a ClassCastException. The reason why is because animal's runtime type is Animal, and so when you tell the runtime to perform the cast it sees that animal isn't really a Dog and so throws a ClassCastException. To call a superclass's method you can do super.method() or by performing the upcast. To call a subclass's method you have to do a downcast. As shown above, you normally risk a ClassCastException by doing this; however, you can use the instanceof operator to check the runtime type of the object before performing the cast, which allows you to prevent ClassCastExceptions: Animal animal = getAnimal(); // Maybe a Dog? Maybe a Cat? Maybe an Animal? if (animal instanceof Dog) { // Guaranteed to succeed, barring classloader shenanigans Dog castedDog = (Dog) animal; } Downcasts can be expressed more succinctly starting from Java 16, which introduced pattern matching for instanceof: Animal animal = getAnimal(); // Maybe a Dog? Maybe a Cat? Maybe an Animal? if (animal instanceof Dog castedDog) { // now castedDog is available here as in the example above }
has comment: http://stackoverflow.com/comment/68514889
has comment: http://stackoverflow.com/comment/48023960
has comment: http://stackoverflow.com/comment/78127284
answers question: http://stackoverflow.com/q/23414090
upvote count: 248
accepted answer of: http://stackoverflow.com/q/23414090
has comment: http://stackoverflow.com/comment/47943794
score: 248
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/35959418
score: 0
type: Comment
has text: Presumably the downvoter voted based on the fact that this question has been asked many times before on here, and simple search would tell you what you need to know (does it "take guts" to use search?). But then you'd have to ask them why ...
type: QuestionComment
comment on: http://stackoverflow.com/q/23445830

http://stackoverflow.com/q/23384120
has comment: http://stackoverflow.com/comment/35822602
has comment: http://stackoverflow.com/comment/35826409
answer count: 1
favorite count: 0
type: UnansweredQuestion
tagged with: http://stackoverflow.com/tag/html
has comment: http://stackoverflow.com/comment/35822544
has body: I am working on a sentiment analysis project. I am extracting data(product reviews) from a given product URL using JAVA while the user selects the product by navigating through the site. I need to fetch the URL from the address bar of the browser and pass it to my JAVA code. How can I extract the URL ? How do I link the two codes ? I am already using jsoup library in my java code for extracting reviews from a link that the user specifies from console in eclipse. Is there any way such that the user is just supposed to select the product and it automatically fetches the URL from address bar? Here is my JAVA code for extracting reviews. Any help would be appreciated. public class dataextraction { public static void main(String[] args) { Document doc; try { String link; System.out.println("Enter the link of the product to be reviewed"); BufferedReader in=new BufferedReader(new InputStreamReader(System.in)); link=in.readLine(); // need http protocol doc = Jsoup.connect(link).get(); // get page title String title = doc.title(); System.out.println("title : " + title); Elements p= doc.select("p.line.bmargin10"); //get all links String text = p.text(); System.out.println("text : " + text); BufferedWriter writer = null; try { writer = new BufferedWriter(new FileWriter("E:/output.txt")); writer.write(text); } catch (IOException e) { System.err.println(e); } finally { if (writer != null) { try { writer.close(); } catch (IOException e) { System.err.println(e); } } } } catch (IOException e) { e.printStackTrace(); System.out.println(e); } } }
has title: Extracting URL from address bar of a browser using JAVA
has comment: http://stackoverflow.com/comment/35822963
tagged with: java
downvote count: 3
has comment: http://stackoverflow.com/comment/35822682
type: Question
has answer: http://stackoverflow.com/a/23384266
upvote count: 0
score: -3

http://stackoverflow.com/comment/35915463
has text: i edited it. sorry about that. I know I am close to solving this. This is my first time using a scanner to read a file.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23433789

http://stackoverflow.com/a/23385128
has body: Are you looking for something like this? public static &lt;T&gt; List&lt;T&gt; doSomething(Class&lt;T&gt; clazz){ ArrayList&lt;T&gt; testList = new ArrayList&lt;T&gt;(); return testList; // more code } and you can invoke this like : List&lt;Integer&gt; intList = doSomething(Integer.class); intList.add(1); List&lt;String&gt; stringList = doSomething(String.class); stringList.add("test"); and if you want to restrict the type of Class you need, you could use T extends youDataType. If what @subhash has explained is not the one you are looking for, and if what @zoyd explains is true, then i believe this could be of some use.
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/23384369
upvote count: 1
score: 1

http://stackoverflow.com/comment/35939297
type: Comment
type: QuestionComment
has text: Your question is probably too general to get a good answer. Consider looking for tutorials or how-to guides to get you started. In the process, you may run into specific problems that can be answered on Stack Overflow. Also, see http://stackoverflow.com/help/dont-ask
score: 0
comment on: http://stackoverflow.com/q/23446727

http://stackoverflow.com/q/23309141
upvote count: 0
has answer: http://stackoverflow.com/a/23309208
has comment: http://stackoverflow.com/comment/35685262
has comment: http://stackoverflow.com/comment/35686317
has body: I am making an application that tells you if the number you enter is prime or not.The problem I have is that it only asks once and terminates the program. How could I do to keep asking numbers and the program ends when enter the number 0? Updated Code. public class numerosPrimos { public static String CheckPrimo(int numero){ int contador = 0; int residuo = 0; int divisores = 0; for (contador=1;contador&lt;=numero;contador++) { residuo=numero%contador; if(residuo==0) { divisores++; } } if(divisores&gt;=3) { return "El numero "+numero+" no es primo"; } else { return "El numero "+numero+" es primo"; } } } Thank you in advance guys!
answer count: 3
has comment: http://stackoverflow.com/comment/35686293
has comment: http://stackoverflow.com/comment/35686703
favorite count: 0
has answer: http://stackoverflow.com/a/23322084
has comment: http://stackoverflow.com/comment/35686809
has comment: http://stackoverflow.com/comment/35685865
tagged with: sockets
has title: Java Prime Numbers Client/Server
has comment: http://stackoverflow.com/comment/35686978
downvote count: 1
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23309203
tagged with: java
has comment: http://stackoverflow.com/comment/35687053
score: -1
has comment: http://stackoverflow.com/comment/35686573
accepted answer: http://stackoverflow.com/a/23322084
type: Question
possible better answer: http://stackoverflow.com/a/23309208
has comment: http://stackoverflow.com/comment/35686645

http://stackoverflow.com/comment/35894413
comment on: http://stackoverflow.com/a/23421465
has text: your code is correct dude.. instead of "http://irctc.co.in" you change the URL like " http://www.theaudiocritic.com/back_issues/The_Audio_Critic_26_r.pdf " and set the read time out as 10000(10 Seconds) its taking more time and giving the response, but i need more then 10 seconds means error
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/a/23508873
type: Answer
upvote count: 2
score: 2
has body: You should continue your restructuring along the line you're going with the introduction of Mappings. You don't need to manage the three references individually (this is where it gets complex). Instead, manage one reference. class ClientData { // This is immutable after creation (like your OP) class Mappings { /* definition from your original post */ } // this should be volatile; private static volatile Mappings instance; // the read path proceeds without acquiring any lock at all. Hard to // get faster than a volatile read. Note the double-checked locking pattern // works JDK 6 or greater when using volatile references (above) public static Mappings getMappings() { Mappings result = instance; if(result == null) { synchronized(ClientData.class) { result = instance; // recall while() is required to handle spurious wakeup while(result == null) { ClientData.class.wait(); result = instance; } } } } public static setMappings(Map one, Map two, Map three) { synchronized(ClientData.class) { instance = new Mappings(one,two,three); ClientData.class.notifyAll() } } } I think this has the following benefits: No locks are required on the read path. This is a side effect of the immutability of the Mappings class. Volatile read is really fast. Callers that enter getMappings() before it simply wait for it to be set. No third-party objects semantics to worry about It's somewhat unfortunate (IMHO) that java doesn't have a good "Waitable Reference" built in. But one can't ask for everything! Third party libraries have some support -- Guava's Suppliers.memoize() is a good place to start. Good luck with your project.
accepted answer of: http://stackoverflow.com/q/23369069
answers question: http://stackoverflow.com/q/23369069
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/35688009
type: Comment
score: 0
type: AnswerComment
has text: You will need to inject an instance of `HibernateTemplate` instead of `SessionFactory` for the transaction to work. The Template will basically allow spring to NOT create a new connection instead manage it internally. look more at this [url](http://forum.spring.io/forum/spring-projects/data/6628-hibernatetemplate-and-transactions)
comment on: http://stackoverflow.com/a/23310203

http://stackoverflow.com/q/23450729
accepted answer: http://stackoverflow.com/a/23450751
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/35947125
has answer: http://stackoverflow.com/a/23450751
tagged with: getter-setter
type: AnsweredQuestion
tagged with: accessor
tagged with: java
type: Question
tagged with: mutators
has body: Consider the following class: class Foo { private List&lt;Integer&gt; all; private Set&lt;Integer&gt; distinct; public List&lt;Integer&gt; getAll() { return all; } public void add(Integer i) { all.add(i); distinct.add(i); } } I don't want bar to be modified like so: foo.getAll().add(3); instead, I want to force my own add() procedure. Is there a way to do this?
has title: A class attribute type of List which is not modifiable by accessor

http://stackoverflow.com/comment/49961930
type: AnswerComment
comment on: http://stackoverflow.com/a/23422735
type: Comment
has text: The runtime arguments are not in the UI as far as I know; this is an open issue on the Netbeans-Gradle plugin. See: [Cannot pass arguments to main method](https://github.com/kelemen/netbeans-gradle-project/issues/194) also there may be other not-yet-IDE type issues, e.g: [Gradle tasks should be started in own process - current directory should be netbeans project dir](https://github.com/kelemen/netbeans-gradle-project/issues/192).
score: 0

http://stackoverflow.com/a/23347632
has comment: http://stackoverflow.com/comment/35782600
has comment: http://stackoverflow.com/comment/35760877
score: 0
answers question: http://stackoverflow.com/q/23347556
has comment: http://stackoverflow.com/comment/35762721
type: Answer
has body: you can reverse it by using the reverse method: MONEY_FORMAT.reverse().toString()

http://stackoverflow.com/a/23352420
has comment: http://stackoverflow.com/comment/35764823
has comment: http://stackoverflow.com/comment/35765190
upvote count: 1
has comment: http://stackoverflow.com/comment/35765392
has comment: http://stackoverflow.com/comment/35765584
has body: If you use ([A-Z]+)[^a-z] you will get for each string: group 1: M then after next find() you will get again group 1: PS Explanation; the regex captures in a group any consecutive sequence of A to Z letters which are followed by something which is not a to z. Thus it will capture M in the first group, then start searching again and capture PS in the first group. For your 3 strings specifically, you can use ([A-Z]) */ *([A-Z]+) which will give you for each of them: group 1: M group 2: PS Explanation: the regex captures a single A to Z letter which is followed by a space 0 or more times, followed by a slash (/), followed by a space 0 or more times, followed by capturing a sequence of A to Z letters. Thus it will capture M in the first group, move through the possible spaces and slash, and capture PS in the second group.
has comment: http://stackoverflow.com/comment/35768345
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/35769304
has comment: http://stackoverflow.com/comment/35765144
type: Answer
has comment: http://stackoverflow.com/comment/35768276
answers question: http://stackoverflow.com/q/23351926
has comment: http://stackoverflow.com/comment/35764853
has comment: http://stackoverflow.com/comment/35765086

http://stackoverflow.com/comment/35845870
has text: All the answers are great, but this one fits my need better (reusable function) Thanks!
type: Comment
score: 0
comment on: http://stackoverflow.com/a/23393265
type: AnswerComment

http://stackoverflow.com/q/23375766
answer count: 1
tagged with: jpa
has answer: http://stackoverflow.com/a/23375842
accepted answer: http://stackoverflow.com/a/23375842
favorite count: 0
has title: EJB webservice, entity is not mapped error
has body: I have entity class User @Entity(name = "user") public class User { @Id @GeneratedValue(strategy = GenerationType.AUTO) private int id; @Column(unique = true, nullable = false) private String email; /** skipped **/ And stateless EJB DAO class(I am using jpa/hibernate) with method @Override public User findByEmail(String name) { TypedQuery&lt;User&gt; query = entityManager.createQuery("from User where email= :email", User.class); query.setParameter("email", name); return query.getSingleResult(); } When I execute this method from page(using jsf), it works fine. The problem occurse when I execute this method from WebService EJB bean. I've got following exception org.hibernate.hql.internal.ast.QuerySyntaxException: User is not mapped [from User where email= :email] My web service is very simple: @Stateless(name = "webServiceBean") @WebService(serviceName = "webService") public class MyWebService{ @EJB private UserDao dao; public String findUser(String email) { return dao.findByEmail(email); } } Application is deployed on JBoss7. I am using EJB 3.1 and hibernate 4.3 Does anybody knows what is the reason of this exception? And why it occurs only in WebService?
type: AnsweredQuestion
score: 2
downvote count: 0
tagged with: java
tagged with: hibernate
tagged with: web-services
tagged with: ejb-3.1
type: Question
upvote count: 2

http://stackoverflow.com/comment/35747124
comment on: http://stackoverflow.com/a/23342910
has text: +1 - Adding a disclaimer and recommending Key Binding (plus a link of some description) instead of `KeyListener` would make this answer perfect.
type: Comment
score: 1
type: AnswerComment

http://stackoverflow.com/a/23354529
has body: You can look at lock-striping techniques (used in concurrenthashmap )to see if it meets your needs. Their basic idea is that you break your structure into segments and if a thread is modifying one segment , you can still read from the other segments. You can also try the CopyOnWriteArrayList where if you are modfying an array, you create a copy and use it for any read operations while the array is being modified. The problem here is you are not guaranteed to get the latest update to the data Both the above approaches are for building concurrent systems instead of synchronized systems.
score: 1
has comment: http://stackoverflow.com/comment/35768610
upvote count: 1
has comment: http://stackoverflow.com/comment/35768776
downvote count: 0
answers question: http://stackoverflow.com/q/23354414
has comment: http://stackoverflow.com/comment/35768659
type: Answer

http://stackoverflow.com/q/23367752
has title: Tomcat 7 default bad request page conflict @ControllerAdvice
favorite count: 0
answer count: 0
downvote count: 0
type: UnansweredQuestion
has body: I am currently developing a webservice which will always return json as a response to any request(all good request are working already). I would like to return a json when the http status of the request is a bad request(status 400 to be exact). I used the @ControllerAdvice of spring mvc to do the job: @ControllerAdvice public class RestErrorHandler { @ExceptionHandler(Exception.class) @ResponseStatus(value=HttpStatus.BAD_REQUEST, reason="Something went wrong. Please check your JSON REQUEST!") public @ResponseBody ErrorClass processValidationError() { // some stuff in setting the error response return new ErrorClass(); } But what happen is that it returns the default Tomcat 7 error message for bad request and not the json I set. processValidationError() will return an ErrorClass instance which will automatically be in json format using jackson plugin. Did I missed something?
has comment: http://stackoverflow.com/comment/35792356
tagged with: tomcat7
type: Question
tagged with: spring-mvc
has comment: http://stackoverflow.com/comment/35811788
has comment: http://stackoverflow.com/comment/35858824
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/35792626
linked to: http://stackoverflow.com/q/18549456
upvote count: 1

http://stackoverflow.com/comment/35918815
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23435246
type: AnswerComment
has text: I am not understanding what this method is suppose to do

http://stackoverflow.com/a/23320846
downvote count: 0
has comment: http://stackoverflow.com/comment/35706261
answers question: http://stackoverflow.com/q/23320805
upvote count: 3
has body: If you use Collections.sort(countries); Then the countries will be sorted using their natural ordering, i.e. the ordering defined by their compareTo() method. They will thus be sorted by ID. You can only sort a collection this way if the collection contains instances of Comparable objects. If you use Collections.sort(countries, someComparator); Then the countries will be sorted using the ordering defined by the comparator (someComparator) passed as argument. In your case, since the comparator compares countries by name, they will be sorted by name. You can sort any kind of objects this way. So, in short, passing a comparator is what allows sorting things by a different ordering than the one defined by the class itself.
has comment: http://stackoverflow.com/comment/35706183
has comment: http://stackoverflow.com/comment/35706312
type: Answer
has comment: http://stackoverflow.com/comment/35706341
score: 3

http://stackoverflow.com/q/23301442
tagged with: oracle-database
has body: Am creating a SQL Database for multiple users(Roughly 100 user), each records having nearly 15 fields in it.. In which the ID field is auto incremented... Whenever a person Inserting a record to the database, it has to show "auto incremented ID" for that particular person, For this am using this code PreparedStatement ppstmt = conn.prepareStatement(sql,PreparedStatement.RETURN_GENERATED_KEYS); ppstmt.execute(sql,PreparedStatement.RETURN_GENERATED_KEYS); ResultSet rs = ppstmt.getGeneratedKeys(); long key = 0; if (rs != null &amp;&amp; rs.next()) { key = rs.getLong(1); } As of now its working fine but my doubt is when multiple users inserting the record at the same time, whether it will corresponding auto generated ID to each person..?
tagged with: sql
tagged with: jdbc
has comment: http://stackoverflow.com/comment/35682725
has answer: http://stackoverflow.com/a/23305090
type: UnansweredQuestion
score: 0
has answer: http://stackoverflow.com/a/23901848
has title: How to get Auto Generated ID from SQL Table when multiple users working simultaneously
tagged with: java
has comment: http://stackoverflow.com/comment/35671257
has comment: http://stackoverflow.com/comment/35671571
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/35679870
has comment: http://stackoverflow.com/comment/35673345
has comment: http://stackoverflow.com/comment/35671690
has comment: http://stackoverflow.com/comment/35678934

http://stackoverflow.com/q/23353423
linked to: http://stackoverflow.com/q/17043388
score: 0
has comment: http://stackoverflow.com/comment/35766501
downvote count: 1
has body: Lets say I have page1.jsp and I doing: request.setAttribute("message", "Here is my error message"); response.sendRedirect("page2.jsp"); In my page2.jsp I try to get that message by using this code: &lt;%= (String)request.getAttribute("message") %&gt; But the result is null. I could do this response.sendRedirect("page2.jsp?message=error message"); and get the message with request.getParameter but I don't like this approach. Any other idea?
has comment: http://stackoverflow.com/comment/35766522
has comment: http://stackoverflow.com/comment/35766524
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35766488
has comment: http://stackoverflow.com/comment/35766559
has answer: http://stackoverflow.com/a/23353475
accepted answer: http://stackoverflow.com/a/23353475
tagged with: java
has comment: http://stackoverflow.com/comment/35766591
has comment: http://stackoverflow.com/comment/35766523
has comment: http://stackoverflow.com/comment/35766613
type: Question
has comment: http://stackoverflow.com/comment/35766582
upvote count: 1
has comment: http://stackoverflow.com/comment/35766512
has comment: http://stackoverflow.com/comment/35766567
answer count: 1
tagged with: jsp
has title: How to get attribute from another page
favorite count: 0

http://stackoverflow.com/comment/35943562
type: QuestionComment
type: Comment
score: 1
comment on: http://stackoverflow.com/q/23448156
has text: It's hard to find out what you're asking and the reason for this is that you're presenting some pre-optimized solution instead of the problem. I'd suggest to write down the declarations of methods you need. I guess in your problem are no `Integer`s at all. Also note that the serialized form can be completely decoupled from the objects, so the space may be pretty unrelated.

http://stackoverflow.com/q/23365502
downvote count: 0
tagged with: android-spinner
tagged with: android
has title: Programmatically created spinner doesn't open
answer count: 1
has comment: http://stackoverflow.com/comment/35792952
has body: I created a spinner programmatically: ArrayAdapter&lt;ServiceObject&gt; medicineArrayAdapter = new ArrayAdapter&lt;ServiceObject&gt;(MedicineActivity.this, android.R.layout.simple_spinner_dropdown_item, medicines); medicineArrayAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); Spinner spinner = new Spinner(MedicineActivity.this, getSpinnerAttrs(), 0); spinner.setAdapter(medicineArrayAdapter); spinner.setLayoutParams(new ViewGroup.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)); spinner.setVisibility(View.VISIBLE); buttonLayout.addView(spinner, index); Where getSpinnerAttrs(): AttributeSet as = null; Resources r = getResources(); XmlResourceParser parser = r.getLayout(R.layout.fragment_medicine); int state = 0; do { try { state = parser.next(); } catch (XmlPullParserException xppe) { xppe.printStackTrace(); } catch (IOException ioe) { ioe.printStackTrace(); } if (state == XmlPullParser.START_TAG) { if (parser.getName().equals("Spinner")) { as = Xml.asAttributeSet(parser); break; } } } while(state != XmlPullParser.END_DOCUMENT); return as; and Spinner in fragment_medicine is: &lt;Spinner android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@android:drawable/btn_dropdown" android:spinnerMode="dropdown" android:visibility="invisible"/&gt; /&gt; It shows normally But when I click on it, it doesn't open . . .
has answer: http://stackoverflow.com/a/23431417
favorite count: 0
upvote count: 2
has comment: http://stackoverflow.com/comment/35789103
type: AnsweredQuestion
score: 2
tagged with: java
accepted answer: http://stackoverflow.com/a/23431417
tagged with: programmatically-created
type: Question

http://stackoverflow.com/a/23305468
has comment: http://stackoverflow.com/comment/35678644
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/35678544
accepted answer of: http://stackoverflow.com/q/23305001
answers question: http://stackoverflow.com/q/23305001
type: Answer
score: 11
upvote count: 11
has comment: http://stackoverflow.com/comment/35678706
has body: First, I'll assume that if a Patient has visited a Department more than once, that Department will appear in the Patient's history list more than once. If that's the case, then we can simply take our Stream of Patients and flatMap it to a Stream of Departments, where the occurrence of a Department indicates one visit from a Patient. Then we can pass this to the groupingBy collector. We want to classify by Department itself, so the classifier function is the identity function. For the value, we want to put a 1 as the value if an entry for the Department isn't present yet, but we want to add 1 to the existing value if an entry is present. There's a collector called counting() that does this for us already, so we just pass it as a downstream collector to groupingBy(). The resulting code is as follows: import static java.util.stream.Collectors.*; List&lt;Patient&gt; patients = ... ; Map&lt;Department, Long&gt; frequency = patients.stream() .flatMap(p -&gt; p.getHistory().stream()) .collect(groupingBy(d -&gt; d, counting())); Note that if a Department hasn't been visited, it will simply be absent from the map. If you have a list of departments, you can fill in the zero values like this: departments.forEach(d -&gt; frequency.putIfAbsent(d, 0L)); or if you want to fill in the zero on the get side, long numVisits = frequency.getOrDefault(dept, 0L);

http://stackoverflow.com/comment/35762633
has text: @Braj thank you for pointing that out, I probably would have never noticed that. I've made the correction as you suggested swapping the last two calls and also changed the line if(sc.hasNextInt()) to if(sc.hasNext()). Is it possible to have my toString() return the score as well? I've managed to get it display the name and score and the first entry to the list comes out fine however anything after that doesn't display properly, I've update my code above.
score: 0
comment on: http://stackoverflow.com/q/23349506
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23315095
upvote count: 0
favorite count: 0
tagged with: return
has comment: http://stackoverflow.com/comment/35695979
type: AnsweredQuestion
tagged with: java
has title: Problems returning an array from one method to another?
has answer: http://stackoverflow.com/a/23315172
tagged with: methods
downvote count: 1
has body: I am having an issue returning a new array from one method to my main method. I have been doing some research and unfortunately I can't seem to find an answer? The answers that I have found seem quite detailed and they are not actually what I am looking for. Here is my code: import java.util.*; public class SquareArray { public static void main (String[] args){ double a[] = new double[5]; a[0] = 0; a[1] = 1; a[2] = 2; a[3] = 3; square(b); } public static double[] square(double[] a){ double b[] = new double[a.length]; for(int i = 0; i &lt; a.length-1; i++){ b[i] = a[i] * a[i]; System.out.println(b[i]); } return (b); } } All the method is required to do is to square the numbers in the original array, store in a new array and return to the main method. Please forgive any errors in my code as I am still learning Java. Many thanks.
type: Question
tagged with: arrays
possible better answer: http://stackoverflow.com/a/23315152
has comment: http://stackoverflow.com/comment/35695975
score: -1
has answer: http://stackoverflow.com/a/23315152
has comment: http://stackoverflow.com/comment/35695918
has comment: http://stackoverflow.com/comment/35695948
answer count: 2
accepted answer: http://stackoverflow.com/a/23315172

http://stackoverflow.com/comment/37335026
comment on: http://stackoverflow.com/a/23564674
type: AnswerComment
type: Comment
score: 1
has text: i got negative results from my csv model due to const 0 columns

http://stackoverflow.com/a/23342539
upvote count: 0
has comment: http://stackoverflow.com/comment/35768100
has comment: http://stackoverflow.com/comment/35749007
type: Answer
has comment: http://stackoverflow.com/comment/35746757
has comment: http://stackoverflow.com/comment/35745689
has comment: http://stackoverflow.com/comment/35747023
downvote count: 1
has body: you should use the following command,and it definitely works update persons set city_id="+rid+" where name= 'John' OR name='Amy' OR name='Adam' OR name='Abraham' OR name= 'Bob' OR name='David' OR name='Robert' OR name='George' OR name='Elizabeth' OR name='Mike' OR name='Barbara';
score: -1
has comment: http://stackoverflow.com/comment/35746310
answers question: http://stackoverflow.com/q/23341997

http://stackoverflow.com/q/23308878
has title: Why is my value appearing at the start of the string even when it's supposed to be at the end?
has answer: http://stackoverflow.com/a/23308909
has body: "Statuses_count" is supposed to be at the end of the string, but somehow, it appears at the front. I don't understand why, even when other values are in their required order, this one just gets at the start of the string, even when it's supposed to be last. Here's the code. // loop over inner User object JSONObject user = (JSONObject) jsonObject.get("user"); Iterator&lt;JSONObject&gt; iterator_user = user.entrySet().iterator(); while (iterator_user.hasNext()) { Map.Entry entry = (Map.Entry)iterator_user.next(); //get user name if (entry.getKey().equals("name")) { sb.append(entry.getValue()+","); } //get user followers count if (entry.getKey().equals("followers_count")) { sb.append(entry.getValue()+","); } //get user tweets count if (entry.getKey().equals("statuses_count")) { sb.append(entry.getValue()+","); } }
accepted answer: http://stackoverflow.com/a/23308909
type: AnsweredQuestion
tagged with: java
downvote count: 1
type: Question
score: -1
upvote count: 0
answer count: 1
favorite count: 0

http://stackoverflow.com/comment/35683034
type: AnswerComment
has text: Since `log_2(x)=log_10(x)*3.3219` it doesn't matter in Big-o notation if its log2 or log10.
type: Comment
score: 1
comment on: http://stackoverflow.com/a/23308114

http://stackoverflow.com/a/23333654
downvote count: 0
answers question: http://stackoverflow.com/q/23333488
upvote count: 11
type: Answer
score: 11
has comment: http://stackoverflow.com/comment/35730180
accepted answer of: http://stackoverflow.com/q/23333488
has body: The JSP useBean declaration is not needed in your code. Just use &lt;body&gt; &lt;% MyClass tc = new MyClass(); tc.testMethod(); %&gt; &lt;/body&gt; But that WILL NOT print anything on the JSP. It will just print Hello on the server's console. To print Hello on the JSP, you have to return a String from your helper java class MyClass and then use the JSP output stream to display it. Something like this: In java Class public String testMethod(){ return "Hello"; } And then in JSP out.print(tc.testMethod());
has comment: http://stackoverflow.com/comment/35730418
type: AcceptedAnswer

http://stackoverflow.com/comment/35819972
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23382016
has text: Can you also include the part of the error message below the line you posted that may include the cause of the initialization error?

http://stackoverflow.com/a/24286641
type: Answer
score: 0
has body: Are you sure the output Total of confort for A 1024 B 32768 C 1073741824 is 1073739776 is correct ? I do agree with bitwise operation, with that I am getting different retult btw. public static int solution(int A,int B,int C){ int total = 0; int totalA=0,totalB=0,totalC=0; //int max = Math.max(Math.max(A, B), C); double limit = Math.pow(2,30); for(int i=0;i&lt;=limit;i++){ int no = A &amp; i; if(no == A){ total++; totalA++; //continue; } no = B &amp; i; if(no == B){ total++; totalB++; //continue; } no = C &amp; i; if(no == C){ total++; totalC++; //continue; } } System.out.println("totalA: " + totalA + " totalB: " + totalB + " totalC: " + totalC); total = totalA + totalB + totalC; return total; } It gives me totalA: 536870912 totalB: 536870912 totalC: 1 1073741825
answers question: http://stackoverflow.com/q/23397829

http://stackoverflow.com/q/23338049
tagged with: java
linked to: http://stackoverflow.com/q/421280
upvote count: 1
has title: What is the java equivalent of Assembly.GetCallingAssembly().GetName().Name?
type: Question
has comment: http://stackoverflow.com/comment/35738091
tagged with: c#
tagged with: .net-assembly
linked to: http://stackoverflow.com/q/1272648
downvote count: 0
tagged with: jar
favorite count: 0
type: UnansweredQuestion
tagged with: assembly-name
has body: If any, what is the java equivalent of Assembly.GetCallingAssembly().GetName().Name? Background and Research: I am working on translating some C# code into Java. At the moment I am unable to test what the Assemblyname returns, and so I am unable to figure out what kind of String I am actually looking for. I have figured out that the Assembly is compared with the compiled .jar file, and that the method retrieves variables related to the compiled running instance. Further on, it seems like the variables I need might be in the manifest, and that the manifest might be retrieved like this question's answers suggest: Reading my own Jar&#39;s Manifest. This is however where I got stuck. Since I am not able to figure out exactly what I am looking for, it is hard to find the equivalent variable. I realize that my question might be missing some key information, but on the chance that someone can understand what I need, better than myself, here i write. Pointers to what kind of information is needed to solve my problem, is also very welcome. EDIT 1: Realizing that I am probably looking for the name of an invoker of the title's containing method, I have found this link: How do I find the caller of a method using stacktrace or reflection? It seems like it is a step in the right direction, but I am still not sure.
has comment: http://stackoverflow.com/comment/35737671
answer count: 0
score: 1

http://stackoverflow.com/a/44652317
answers question: http://stackoverflow.com/q/23403575
has body: Firstly you are using java.util.Collections class which is not a generic class, So you can't parameterize it to String type.you should use java.util.Collection instead. Secondly, Since Collection is an Interface so have to make the object of its implementation classes. you can use - Collection &lt;String&gt; collection = new ArrayList&lt;String&gt;();
downvote count: 0
upvote count: 2
type: Answer
score: 2

http://stackoverflow.com/a/23546244
has comment: http://stackoverflow.com/comment/36131547
accepted answer of: http://stackoverflow.com/q/23370449
has body: That exit code probably comes from Apache Commons Exec: public interface Executor { /** Invalid exit code. */ int INVALID_EXITVALUE = 0xdeadbeef; ... There are some changes in Java 8 that might have introduced a bug. But without knowing your classpath and code, this is just an educated guess. Maybe you are using the asynchronous way to use Commons Exec: DefaultExecuteResultHandler resultHandler = new DefaultExecuteResultHandler(); Executor executor = new DefaultExecutor(); executor.execute(cmdLine, resultHandler); int exitValue = resultHandler.waitFor(); return exitValue; So the exception is only captured in the resultHandler, but not print on stderr automatically?
answers question: http://stackoverflow.com/q/23370449
has comment: http://stackoverflow.com/comment/36142334
has comment: http://stackoverflow.com/comment/36142432
score: 4
upvote count: 4
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/a/23414870
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/23414744
has body: It will not run until it has acquired the lock. It is a separate thread of execution from the main thread, so it is "independent" in the sense that it is not tethered. Threads are represented by stacks and instruction pointers. There's a Thread object, the thread is not "running on it". The object is merely "holding state" for it. True.
has comment: http://stackoverflow.com/comment/35881210
downvote count: 0
type: Answer

http://stackoverflow.com/q/23385528
downvote count: 0
answer count: 1
tagged with: jsp
has body: I'm new to JSP &amp; JSTL, I have a json array as below : [ { "id" : 1, "name" : "A" }, { "id" : 2, "name" : "b" }] which I need to print in HTML table view. I have tried to use the code said here &lt;table&gt; &lt;c:forEach items="${persons}" var="person"&gt; &lt;tr&gt; &lt;td&gt;${person.name}&lt;/td&gt; &lt;/tr&gt; &lt;/c:forEach&gt; &lt;/table&gt; But I am getting this error javax.el.PropertyNotFoundException: Property 'name' not found on type java.lang.String Someone correct me where I went wrong.
favorite count: 0
has comment: http://stackoverflow.com/comment/35824971
has answer: http://stackoverflow.com/a/23386521
has comment: http://stackoverflow.com/comment/35824887
linked to: http://stackoverflow.com/q/3751118
has comment: http://stackoverflow.com/comment/35825081
has title: Json array to html table - JSTL
type: UnansweredQuestion
score: 1
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/35824920
has comment: http://stackoverflow.com/comment/35824944
type: Question
has comment: http://stackoverflow.com/comment/35825736
tagged with: jstl
upvote count: 1

http://stackoverflow.com/comment/35745342
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23341905
has text: can't find this line exept in the onclick.

http://stackoverflow.com/q/23328111
tagged with: session
answer count: 1
has answer: http://stackoverflow.com/a/23328333
tagged with: jsp
has comment: http://stackoverflow.com/comment/35720138
has body: I am new to servlets and jsp. In my program the flow is as below: loginpage.html -> controller(servlet - here I created session like this) HttpSession session = request.getSession(true); session.setAttribute("uid", uname); System.out.println("session:"+session.getAttribute("uid"));// shows the value of uid ->create_user.html-> conroller( now it shows uid value as null)->view_customers.jsp (need uid value here but its null). How to avoid session attribute from becoming null? Thanks in advance!
score: 0
has comment: http://stackoverflow.com/comment/35720265
has comment: http://stackoverflow.com/comment/35720736
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/35727107
has comment: http://stackoverflow.com/comment/35719830
tagged with: servlets
type: Question
has title: Servlets-Session attribute becoming NULL
has comment: http://stackoverflow.com/comment/35720283

http://stackoverflow.com/q/23338779
type: Question
has title: linux: ps truncates command line output
has body: My goal is to get the command line args of a java process. I am running ps aux | grep java&gt; out.log to see the full argument list. Problem is that it's truncated at approx 4k bytes. Java is invoked from a build tool (maven) so I don't have much influence on the arguments. Most of the long argument list is related to classpath entries. On the windows platform the argument list is approx 12Kb. How can I see the full command line arguments in Linux even if they are longer than 4K? I am running on Linux Mint Petra. I've tried with the processes explorer but it also truncates (and it won't let my copy-paste the arguments)
has answer: http://stackoverflow.com/a/23339295
upvote count: 4
downvote count: 0
has answer: http://stackoverflow.com/a/23339135
favorite count: 0
tagged with: linux
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23339358
tagged with: linux-mint
answer count: 4
score: 4
tagged with: java
linked to: http://stackoverflow.com/q/199130
has answer: http://stackoverflow.com/a/45759472

http://stackoverflow.com/q/23309677
answer count: 1
tagged with: google-app-engine
type: AnsweredQuestion
tagged with: java
has body: I'm struggling with this basic stuff for weeks already. Can't make simple logs working in my Google App Engine (JAVA) app. I started from this tutorial. Looks pretty straight forward. Inside my Endpoint class I've defined a Logger like this: private static final Logger log = Logger.getLogger(GowMainEndpoint.class.getName()); Then in one of my endpoint methods I tried to log event like: log.info("test"); There is nothing showing up in logs. I have logging.properties file and appengine-web.xml configured just like in the mentioned tutorial. EDIT: Weird thing: log.warning("test"); is showing up logs...
has answer: http://stackoverflow.com/a/23309901
type: Question
has title: Logs don't show up under Google App Engine project console
score: 0
accepted answer: http://stackoverflow.com/a/23309901

http://stackoverflow.com/comment/35895878
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23420930
score: 0
has text: m trying balancing the bst and size isnt global

http://stackoverflow.com/q/23294175
tagged with: collision
has comment: http://stackoverflow.com/comment/35658603
has comment: http://stackoverflow.com/comment/35658279
tagged with: java
has title: Java 2d game finding correct enemy for fighting
type: Question
has comment: http://stackoverflow.com/comment/35658083
has comment: http://stackoverflow.com/comment/35657913
has comment: http://stackoverflow.com/comment/35658682
has answer: http://stackoverflow.com/a/23294422
tagged with: arraylist
has comment: http://stackoverflow.com/comment/35659157
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/35660472
has comment: http://stackoverflow.com/comment/35658143
has comment: http://stackoverflow.com/comment/35659202
type: UnansweredQuestion
has body: I am making a simple 2d game in java and i am trying to get fighting to work. I am going to do pokemon-style fighting, so what i am doing is when i press the spacebar, it checks if i am colliding with an enemy, finds that enemy in an arrayList, and then executes the fight method using that enemy. This works most of the time, but sometimes it can't seem to find the enemy in the ArrayList. My code for checking this is: if (space) { for (Rectangle collideable : Enemy.ens) { if (intersects(playerR, collideable)) { System.out.println("Colliding with Enemy!"); x = locx; y = locy; playerR.setLocation(x, y); for (int i = 0; i &lt; Game.enemies.size(); i++) { if (Enemy.ens.get(i).equals(collideable)) { System.out.println("Can't find enemy to fight"); System.out.println(Game.enemies.get(i).getName()); fightQuestion(Game.enemies.get(i), i); break; } } break; } } } Enemy.ens is created when i render each enemy. Game.enemies is created when I read in all of the enemy stats, and then i add each enemy to that ArrayList. For every enemy i try to fight, it is getting to the point where it prints out that it is colliding, but not always to the fight part. Any ideas as to why this is happening would be fantastic! EDIT Code for when Game.Enemies is filled: public static void loadEnemies() { im = getImageManager(); Scanner qwe; try { qwe = new Scanner(new File("enemyStats.txt")); while (qwe.hasNextLine()) { String name = qwe.nextLine(); String origin = qwe.nextLine(); String weapon = qwe.nextLine(); String gear = qwe.nextLine(); String spec = qwe.nextLine(); int hp = qwe.nextInt(); int att = qwe.nextInt(); int def = qwe.nextInt(); int randX = (int) (Math.random()*(18*SCALE*TILESIZE)); //Give random x coordinate int randY = (int) (Math.random()*(18*SCALE*TILESIZE)); //Give random y coordinate if(qwe.hasNextLine()){ qwe.nextLine(); } enemies.add(new Enemy(randX,randY,im,name,origin,weapon,gear,spec,hp,att,def)); //adds enemy into arrayList int randI = (int) (Math.random()*enemies.size());…
tagged with: 2d-games

http://stackoverflow.com/comment/35709704
comment on: http://stackoverflow.com/a/23322836
type: Comment
score: 0
type: AnswerComment
has text: Thanks! And what about if there is an array inside of object?

http://stackoverflow.com/q/23382380
has comment: http://stackoverflow.com/comment/35819471
has body: In some languages it is possible to get the column number of a line in a stacktrace, however in Java we only have line numbers. To give you an example, in another language we can have: Error at &lt;anonymous&gt;:2:2 at Object.InjectedScript._evaluateOn (&lt;anonymous&gt;:641:39) at Object.InjectedScript._evaluateAndWrap (&lt;anonymous&gt;:580:52) at Object.InjectedScript.evaluate (&lt;anonymous&gt;:495:21)" Although this might be a bad example as I'm causing the error from the browser console, you can see the column numbers which is really helpful in solving errors. To give you the example in Java ( Yes, names were changed ) : Caused by: java.lang.IllegalArgumentException: path was null at org.jboss.resteasy.specimpl.ResteasyUriBuilder.path(ResteasyUriBuilder.java:362) at enterprise.money.service(AbstractSomething.java:88) This leads to line 88 which contains URI uri = uriInfo.getBaseUriBuilder().path(objectA).path(objectB).build(); With the stacktrace I have I can't check which .path call caused the exception. So my question is, are there any solutions that allow me to get the reference of the column? ( To guard from some possible alternative answers, we need a solution to get the column numbers, other answers like how to step through the debugger or refactoring every builder pattern, etc., will not answer the question )
type: AnsweredQuestion
tagged with: java
tagged with: stack-trace
has comment: http://stackoverflow.com/comment/35819396
upvote count: 7
has title: How do I get lines' column numbers in Java stacktraces
has answer: http://stackoverflow.com/a/23382477
type: Question
has comment: http://stackoverflow.com/comment/35819453
downvote count: 0
has comment: http://stackoverflow.com/comment/35819313
answer count: 3
has comment: http://stackoverflow.com/comment/108667587
accepted answer: http://stackoverflow.com/a/23382477
has answer: http://stackoverflow.com/a/23382745
score: 7
favorite count: 0
possible better answer: http://stackoverflow.com/a/23382517
has answer: http://stackoverflow.com/a/23382517
linked to: http://stackoverflow.com/q/3881

http://stackoverflow.com/comment/35722731
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/23329160
type: Comment
has text: Looks like in the version I have, it's ServerConnector, I don't see a SelectChannelConnector, but using ServerConnector may work, I'll give you credit once I try it out. Thanks!

http://stackoverflow.com/comment/35878527
type: QuestionComment
has text: `5/9` is `int` division and will always equal 0.
comment on: http://stackoverflow.com/q/23413911
score: 0
type: Comment

http://stackoverflow.com/comment/36116767
type: AnswerComment
score: 0
type: Comment
has text: To clarify- This answer is helpful speculation, and I've incorporated its insight to specify my original question. However I am compelled to leave this question simply "unanswered" until such time as JetBrains clarifies if/when this feature is on their product road map for WebStorm.
comment on: http://stackoverflow.com/a/23376438

recursion
type: Tag
tags question: http://stackoverflow.com/q/23322686
tags question: http://stackoverflow.com/q/23309998
tags question: http://stackoverflow.com/q/23380334
tags question: http://stackoverflow.com/q/23398450
tag name: recursion
tags question: http://stackoverflow.com/q/23305119
tags question: http://stackoverflow.com/q/23302780
tags question: http://stackoverflow.com/q/23347681
tags question: http://stackoverflow.com/q/23398154
tags question: http://stackoverflow.com/q/23373421
tags question: http://stackoverflow.com/q/23394983
tags question: http://stackoverflow.com/q/23375561
tags question: http://stackoverflow.com/q/23319486
tags question: http://stackoverflow.com/q/23324514
tags question: http://stackoverflow.com/q/23309691
tags question: http://stackoverflow.com/q/23301682
tags question: http://stackoverflow.com/q/23417123
tags question: http://stackoverflow.com/q/23328698
tags question: http://stackoverflow.com/q/23423695
tags question: http://stackoverflow.com/q/23330570
tags question: http://stackoverflow.com/q/23334150
tags question: http://stackoverflow.com/q/23451549

http://stackoverflow.com/comment/35708970
type: QuestionComment
has text: Neither do I see a question nor an own approach.
comment on: http://stackoverflow.com/q/23322496
score: 3
type: Comment

http://stackoverflow.com/comment/35886820
comment on: http://stackoverflow.com/q/23417786
score: 0
has text: Your `move` worries me, the sprites should not be dictating the wait time, the main loop should, update the state, paint the state and then wait and repeat.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23318269
downvote count: 7
has body: java 8 Android supports all Java 7 language features and a subset of Java 8 language features that vary by platform version. To check which features of java 8 are supported Use Java 8 language features We've decided to add support for Java 8 language features directly into the current javac and dx set of tools, and deprecate the Jack toolchain. With this new direction, existing tools and plugins dependent on the Java class file format should continue to work. Moving forward, Java 8 language features will be natively supported by the Android build system. We're aiming to launch this as part of Android Studio in the coming weeks, and we wanted to share this decision early with you. Future of Java 8 Language Feature Support on Android Eclipse Users: For old developers who prefer Eclipse, google stops support Eclipse Android Developer tools if you installed Java 8 JDK, then give it a try, if any problems appears try to set the compiler as 1.6 in Eclipse from window menu → Preferences → Java → Compiler. Java 7 will works too: Java 7 or higher is required if you are targeting Android 5.0 and higher. install multiple JDK and try.
has comment: http://stackoverflow.com/comment/63201043
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23318109
has comment: http://stackoverflow.com/comment/59374928
has comment: http://stackoverflow.com/comment/76590072
type: Answer
score: 196
has comment: http://stackoverflow.com/comment/46282472
upvote count: 203
has comment: http://stackoverflow.com/comment/42906642
accepted answer of: http://stackoverflow.com/q/23318109
has comment: http://stackoverflow.com/comment/80682829
has comment: http://stackoverflow.com/comment/73204565
has comment: http://stackoverflow.com/comment/46343772
has comment: http://stackoverflow.com/comment/75576118
has comment: http://stackoverflow.com/comment/46269176

loops
tags question: http://stackoverflow.com/q/23362759
tags question: http://stackoverflow.com/q/23311738
tags question: http://stackoverflow.com/q/23308253
tags question: http://stackoverflow.com/q/23331280
tags question: http://stackoverflow.com/q/23400722
tags question: http://stackoverflow.com/q/23452537
tags question: http://stackoverflow.com/q/23384184
type: Tag
tags question: http://stackoverflow.com/q/23448132
tags question: http://stackoverflow.com/q/23351445
tags question: http://stackoverflow.com/q/23369600
tags question: http://stackoverflow.com/q/23311976
tags question: http://stackoverflow.com/q/23447682
tags question: http://stackoverflow.com/q/23370509
tags question: http://stackoverflow.com/q/23315706
tags question: http://stackoverflow.com/q/23451549
tags question: http://stackoverflow.com/q/23415890
tag name: loops
tags question: http://stackoverflow.com/q/23407439
tags question: http://stackoverflow.com/q/23352783
tags question: http://stackoverflow.com/q/23438550
tags question: http://stackoverflow.com/q/23358877
tags question: http://stackoverflow.com/q/23389385
tags question: http://stackoverflow.com/q/23313289
tags question: http://stackoverflow.com/q/23398323
tags question: http://stackoverflow.com/q/23306176
tags question: http://stackoverflow.com/q/23419672
tags question: http://stackoverflow.com/q/23434597
tags question: http://stackoverflow.com/q/23407051
tags question: http://stackoverflow.com/q/23350426
tags question: http://stackoverflow.com/q/23435141
tags question: http://stackoverflow.com/q/23427708

http://stackoverflow.com/q/23373714
answer count: 4
has title: Pattern for Integers in Java (###.###.###)
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35803760
has comment: http://stackoverflow.com/comment/35804047
tagged with: java
has answer: http://stackoverflow.com/a/23373828
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/35803750
possible better answer: http://stackoverflow.com/a/23373828
accepted answer: http://stackoverflow.com/a/23373788
has comment: http://stackoverflow.com/comment/35803910
downvote count: 0
has answer: http://stackoverflow.com/a/23373985
score: 1
favorite count: 0
has body: I need to format Integers to a different pattern. Example: Input: 13040321 Output: 13.040.321 Example2: Input: 2323 Output: 2.323 I tried use it: String pattern = "###.###.###"; DecimalFormat decimalFormat = new DecimalFormat(pattern); //ERROR HERE decimalFormat.setGroupingSize(3); String formattedValue = decimalFormat.format(value); return formattedValue; I cannot have outputs using "," or decimals.
linked to: http://stackoverflow.com/q/22456350
has answer: http://stackoverflow.com/a/23373788
has answer: http://stackoverflow.com/a/23373870

http://stackoverflow.com/a/23427487
accepted answer of: http://stackoverflow.com/q/23427387
has body: Even most synchronized collections do not like modifications and iterator together. From the API description of Collections.synchronizedList: It is imperative that the user manually synchronize on the returned list when iterating over it: List list = Collections.synchronizedList(new ArrayList()); ... synchronized (list) { Iterator i = list.iterator(); // Must be in synchronized block while (i.hasNext()) foo(i.next()); } Also: You can use the collections from java.concurrent instead. They usually have a more refined synchronization approach.
score: 1
upvote count: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23427387
downvote count: 0
has comment: http://stackoverflow.com/comment/35903637
type: Answer

http://stackoverflow.com/q/23293325
has comment: http://stackoverflow.com/comment/35655987
possible better answer: http://stackoverflow.com/a/28914917
has comment: http://stackoverflow.com/comment/35656358
downvote count: 0
has answer: http://stackoverflow.com/a/28914917
favorite count: 0
has comment: http://stackoverflow.com/comment/35657077
has answer: http://stackoverflow.com/a/23625048
has comment: http://stackoverflow.com/comment/35658194
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35656187
upvote count: 2
has body: I want to extract the data from wikipedia infobox and came upon the code in Wikipedia infobox extraction in Java that suggests a method to do so with java. I am not handy with java as I am with python so I am using the wikixmlj-r43.jar in my eclipse with the code : import edu.jhu.nlp.wikipedia.*; public class InfoboxParser { public static void main(String[] args) throws Exception{ WikiXMLParser parser = WikiXMLParserFactory.getSAXParser("/home/siddhartha/Documents/wiki/enwiki-latest-pages-articles.xml"); parser.setPageCallback(new PageCallbackHandler() { public void process(WikiPage page) { InfoBox infobox=page.getInfoBox(); //do something with info box } }); parser.parse(); } } I am getting the following error: Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/tools/bzip2/CBZip2InputStream at edu.jhu.nlp.wikipedia.WikiXMLParserFactory.getSAXParser(WikiXMLParserFactory.java:15) at parser.InfoboxParser.main(InfoboxParser.java:7) Caused by: java.lang.ClassNotFoundException: org.apache.tools.bzip2.CBZip2InputStream 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 have added the JAR in eclipse under properties > java build path > libraries. What I get is that it is not able to find CBZip2InputStream class. Please help.
tagged with: java
has title: Extract Wikipedia Infobox data
tagged with: wikipedia
type: Question
has comment: http://stackoverflow.com/comment/35656279
has comment: http://stackoverflow.com/comment/35657306
accepted answer: http://stackoverflow.com/a/23625048
tagged with: eclipse
has comment: http://stackoverflow.com/comment/35657712
has comment: http://stackoverflow.com/comment/35656777
has comment: http://stackoverflow.com/comment/35679243
answer count: 2

http://stackoverflow.com/comment/35815693
type: QuestionComment
has text: So what were you expecting 4 x 3 x 2 x 1 x 2 to be?
score: 0
comment on: http://stackoverflow.com/q/23380334
type: Comment

http://stackoverflow.com/q/23361891
tagged with: java
tagged with: mysql
linked to: http://stackoverflow.com/q/5535084
has comment: http://stackoverflow.com/comment/35781945
type: Question
possible better answer: http://stackoverflow.com/a/23363508
tagged with: jpa
has comment: http://stackoverflow.com/comment/35782231
has title: JPA Integer conversion to String for MySQL query
has body: I have to write a JPA query to select data in a MySQL DB. I have this part of code: SELECT NEW com.fiat.sc.um.mdm.bean.Vendor (e.fgpVndrNumber, e.companyName1, e.vndrCountry, e.city, e.postalCode, e.street, e.vatRegistrNum, e.vendorTypeDesc, e.companyName2, e.taxNumber2, e.taxNumber1, e.organizationCode) FROM ScVendor e I want to add this where clause: WHERE str(e.fgpVndrNumber) LIKE '%123%' or to_char(e.fgpVndrNumber) LIKE '%123%' In few words, I have to convert an Integer in String. But I obtain an error. Suggestions? EDIT This is the complete Java code: String selAndForm = "SELECT NEW com.fiat.sc.um.mdm.bean.Vendor(e.fgpVndrNumber, e.companyName1, e.vndrCountry," + " e.city, e.postalCode, e.street, e.vatRegistrNum, e.vendorTypeDesc, e.companyName2, e.taxNumber2, " + "e.taxNumber1, e.organizationCode) FROM ScVendor e "; String where = null; if (isNotNull(companyName)) { if (searchCriteriaCompName != null) { if (searchCriteriaCompName.equals("contains")) { companyName = "%" + companyName + "%"; } if (searchCriteriaCompName.equals("startWith")) { companyName = companyName + "%"; } if (searchCriteriaCompName.equals("endWith")) { companyName = "%" + companyName; } } if (where == null) { where = "WHERE lower(e.companyName1) like '" + companyName.toLowerCase() + "'"; } else { where = where + " AND lower(e.companyName1) like '" + companyName.toLowerCase() + "'"; } } if (isNotNull(immediateParent)) { if (searchCriteriaParentCode != null) { if (searchCriteriaParentCode.equals("contains")) { immediateParent = "%" + immediateParent + "%"; } if (searchCriteriaParentCode.equals("startWith")) { immediateParent = immediateParent + "%"; } if (searchCriteriaParentCode.equals("endWith")) { immediateParent = "%" + immediateParent; } if (searchCriteriaParentCode.equals("equals")) { // do nothing } } if (where == null) { where = "WHERE e.immediateParent LIKE '" + immediateParent + "'"; } else { where = where + " AND e.immediateParent LIKE '" + immediateParent + "'"; } } if (isNotNull(…
has answer: http://stackoverflow.com/a/52228441
score: 0
tagged with: sql
accepted answer: http://stackoverflow.com/a/23361993
answer count: 4
has answer: http://stackoverflow.com/a/23363508
has answer: http://stackoverflow.com/a/23361993
has answer: http://stackoverflow.com/a/51975367
type: AnsweredQuestion

http://stackoverflow.com/a/42707949
type: Answer
has body: As mentioned above: LinkedHashSet extends HashSet which extends AbstractSet which implements equals method: https://docs.oracle.com/javase/8/docs/api/java/util/AbstractSet.html#equals-java.lang.Object- Compares the specified object with this set for equality. Returns true if the given object is also a set, the two sets have the same size, and every member of the given set is contained in this set. This ensures that the equals method works properly across different implementations of the Set interface. The easiest way to compare LinkedHashSet if order if important to you is to serialize it and compare them then: LinkedHashSet&lt;Integer&gt; reverseOrder = new LinkedHashSet&lt;&gt;(); reverseOrder.add(2); reverseOrder.add(1); LinkedHashSet&lt;Integer&gt; ordered = new LinkedHashSet&lt;&gt;(); ordered.add(1); ordered.add(2); System.out.println("Equals via set: " + ordered.equals(reverseOrder)); System.out.println("Equals With Arrays: " + ordered.ordered.toString().equals(reverseOrder.ordered.toString())); Result: Equals via Set: true Equals With Arrays: false
has comment: http://stackoverflow.com/comment/77319690
answers question: http://stackoverflow.com/q/23302096
score: 0
has comment: http://stackoverflow.com/comment/77311756

http://stackoverflow.com/comment/35900974
type: QuestionComment
comment on: http://stackoverflow.com/q/23426155
has text: What is your question? The String class accepts a byte array as parameter if that helps...
score: 0
type: Comment

http://stackoverflow.com/q/23442254
has comment: http://stackoverflow.com/comment/35931032
favorite count: 0
has answer: http://stackoverflow.com/a/23442974
tagged with: http://stackoverflow.com/tag/html
answer count: 1
has comment: http://stackoverflow.com/comment/35931199
has title: My html form is not being redirected after filling form to HelloWorld.java?
has comment: http://stackoverflow.com/comment/35930996
type: UnansweredQuestion
downvote count: 1
has comment: http://stackoverflow.com/comment/35931154
has body: I'm a beginner in JavaEE, i'm using intellij idea as an IDE and i've made a form into html like this: here is my Hello.html: First name: last name: Now and i've made a servlet file says HelloWorld.java: import java.io.*; import javax.servlet.*; import javax.servlet.http.*; public class HelloWorld extends HttpServlet{ public void doGet(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException{ response.setContentType("text/html"); PrintWriter out=response.getWriter(); String docType=" "; out.println(docType+ " " + " This is just a title man.. ;) " + " " + " My name is Rajendra Arora " + " " + " First name: " + request.getParameter("first_name")+" "+ " Last name: " + request.getParameter("last_name")+ " " + " " + " "); } public void doPost(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException{ doGet(request, response); } } and here is my web.xml file: <?xml version="1.0" encoding="UTF-8"?> HelloWorld HelloWorld HelloWorld /HelloWorld Now as i run my HelloWorld.java it runs successfully but when run it along with form it doesn't run, i mean When i run Hello.html it shows form with proper way but when i fill the name after click submit it shows that error message please see my pic. and i started my with proper way and it's working, and After running only HelloWorld.java when i put into url using http://localhost:8888/HelloWorld?first_name=Raj&last_name=Arora it shows name successfully but by default usign Hello.html it's showing that error messages... please help please help!!
tagged with: java
has comment: http://stackoverflow.com/comment/35931121
score: -1
tagged with: forms
has comment: http://stackoverflow.com/comment/35931160
tagged with: servlets
type: Question
has comment: http://stackoverflow.com/comment/35931184
upvote count: 0
tagged with: intellij-idea

http://stackoverflow.com/q/23384047
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/24015082
accepted answer: http://stackoverflow.com/a/24015082
has title: Difficulties getting Spark SVMModel running with Java - java.lang.IncompatibleClassChangeError
type: Question
upvote count: 3
tagged with: apache-spark
has body: I've been trying to get Spark running using Java (in case it matters, I'm using IntelliJ as my IDE). I ran the calculate-pi code found here https://spark.apache.org/examples.html successfully after quite a bit of fiddling. I had the following error at first: "java.lang.ClassNotFoundException: [B" But I fixed it with the following flag in the VM: "-Dsun.lang.ClassLoader.allowArraySyntax=true". Now I'm trying to build, train and run an SVMModel, as described here http://spark.apache.org/docs/0.9.0/mllib-guide.html but I'm struggling with the small amount of Java documentation available. I'm trying to run the following code: import org.apache.spark.api.java.JavaRDD; import org.apache.spark.api.java.JavaSparkContext; import org.apache.spark.mllib.classification.SVMModel; import org.apache.spark.mllib.classification.SVMWithSGD; import org.apache.spark.mllib.regression.LabeledPoint; import org.jblas.DoubleMatrix; import java.util.ArrayList; import java.util.List; public class MinimalBugCode { public static void main(String[] args) throws Exception { try { JavaSparkContext spark = new JavaSparkContext("local","MinimalBugCode"); int numberOfIterations = 10000; double[] theOutputData = { 1.0, 0.0, 0.0, 1.0, 1.0}; double[][] theInputData = { { 2.2, 3.1, 1.7 }, { 1.9, 2.1, 0.6 }, { 4.7, 0.5, 1.3 }, { 2.6, 2.9, 2.2 }, { 1.5, 4.1, 1.5 }}; int lengthOfData = theOutputData.length; List&lt;LabeledPoint&gt; thePointList = new ArrayList&lt;LabeledPoint&gt;(); for ( int i=0; i&lt;lengthOfData; i++ ) { LabeledPoint thisLabelledPoint = new LabeledPoint( theOutputData[i], theInputData[i] ); thePointList.add(thisLabelledPoint); } JavaRDD&lt;LabeledPoint&gt; theSparkRDD = spark.parallelize( thePointList ); SVMModel theInnerModel = SVMWithSGD.train(theSparkRDD.rdd(), numberOfIterations); DoubleMatrix weights = new DoubleMatrix( theInnerModel.weights() ); } catch (Exception e) { e.printStackTrace(); } System.exit(0); } } It gets as far as the line SVMModel theInnerModel = SVMWithSGD.train(th…
answer count: 1
favorite count: 0
type: AnsweredQuestion
score: 3

http://stackoverflow.com/a/23335720
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23325862
type: Answer
has body: It turns out that my avro file is named sample.avro.deflate. Avro, 1.7.4, silently ignores any input files that don't end with '.avro'. In 1.7.6, they added a property avro.mapred.ignore.inputs.without.extension
upvote count: 2
score: 2
accepted answer of: http://stackoverflow.com/q/23325862

http://stackoverflow.com/a/23347698
has comment: http://stackoverflow.com/comment/35755438
answers question: http://stackoverflow.com/q/23347554
has body: Your logic is backwards. If tries is -1, then: while( ... || (guess.equals(word) &amp;&amp; (tries &lt; 8) &amp;&amp; (tries &gt; 0)) { while( ... || (guess.equals(word) &amp;&amp; (-1 &lt; 8) &amp;&amp; (-1 &gt; 0)) { while( ... || (guess.equals(word) &amp;&amp; true &amp;&amp; false)) { while( ... || !(false)) { while( ... || true) { while(true) { in other words, your loop can never terminate, because the tries checking is wrong. while (!guess.equals(word) &amp;&amp; (tries &gt; 0)) { is probably what you want.
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/35755368

http://stackoverflow.com/q/23395314
has body: I am trying to get my application running but all of a sudden it's throwing the following error: java.lang.NoSuchMethodError: org.slf4j.impl.StaticLoggerBinder.getSingleton()Lorg/slf4j/impl/StaticLoggerBinder; stacktrace: SEVERE: Exception while invoking class com.sun.enterprise.web.WebApplication start method java.lang.Exception: java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: java.lang.NoSuchMethodError: org.slf4j.impl.StaticLoggerBinder.getSingleton()Lorg/slf4j/impl/StaticLoggerBinder; at com.sun.enterprise.web.WebApplication.start(WebApplication.java:168) at org.glassfish.internal.data.EngineRef.start(EngineRef.java:122) at org.glassfish.internal.data.ModuleInfo.start(ModuleInfo.java:291) at org.glassfish.internal.data.ApplicationInfo.start(ApplicationInfo.java:352) at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:497) at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:219) at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:491) at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:527) at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:523) at java.security.AccessController.doPrivileged(Native Method) at javax.security.auth.Subject.doAs(Subject.java:356) at com.sun.enterprise.v3.admin.CommandRunnerImpl$2.execute(CommandRunnerImpl.java:522) at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:546) at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1423) at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1500(CommandRunnerImpl.java:108) at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1762) at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1674) at com.sun.enterprise.v3.admin.AdminAdapter.doCommand(Admi…
tagged with: slf4j
duplicate of: http://stackoverflow.com/q/17755893
has comment: http://stackoverflow.com/comment/35843559
answer count: 3
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/23395627
has comment: http://stackoverflow.com/comment/35843689
possible better answer: http://stackoverflow.com/a/23395479
tagged with: maven
linked to: http://stackoverflow.com/q/17755893
tagged with: spring
has comment: http://stackoverflow.com/comment/35843634
has comment: http://stackoverflow.com/comment/35843439
type: AnsweredQuestion
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/35843682
tagged with: java
has comment: http://stackoverflow.com/comment/35843479
accepted answer: http://stackoverflow.com/a/23395591
type: Question
has title: java.lang.NoSuchMethodError: org.slf4j.impl.StaticLoggerBinder.getSingleton()Lorg/slf4j/impl/StaticLoggerBinder;
has answer: http://stackoverflow.com/a/23395479
has answer: http://stackoverflow.com/a/23395591

http://stackoverflow.com/a/23342930
upvote count: 1
has comment: http://stackoverflow.com/comment/35746607
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23342739
score: 0
answers question: http://stackoverflow.com/q/23342739
downvote count: 1
type: Answer
has body: Hibernate is not a MVC framework it is an ORM that is used to handle persistence layer of any application. For MVC, there are many choices like struts,springs,jsf etc. In my opinion you shall go with Spring MVC due to the strong integration aspect of springs. You can use Hibernate with Springs very well. Hope this helps. EDIT There are lots of tutorials available online and on spring's site. here is one of the useful link
has comment: http://stackoverflow.com/comment/35746466
has comment: http://stackoverflow.com/comment/35746936

http://stackoverflow.com/q/23448532
has body: I'm working on a project in Java and I wanted to know if Java had a similar "in"/"not in" operator in Python like the example below. &gt;&gt;&gt;"jim" in "jimbo" &gt;&gt;&gt;True
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35942707
has comment: http://stackoverflow.com/comment/35942771
tagged with: java
has title: Does Java have an "in" or "not in" operator similar to Python?
linked to: http://stackoverflow.com/q/1128723
possible better answer: http://stackoverflow.com/a/23448550
type: Question
has comment: http://stackoverflow.com/comment/35942761
answer count: 2
has answer: http://stackoverflow.com/a/23448548
accepted answer: http://stackoverflow.com/a/23448548
score: 0
tagged with: python
has answer: http://stackoverflow.com/a/23448550
tagged with: operators

jlist
tags question: http://stackoverflow.com/q/23383123
tags question: http://stackoverflow.com/q/23398978
tags question: http://stackoverflow.com/q/23357605
tags question: http://stackoverflow.com/q/23354302
tags question: http://stackoverflow.com/q/23414873
tags question: http://stackoverflow.com/q/23302594
tags question: http://stackoverflow.com/q/23415658
tags question: http://stackoverflow.com/q/23404945
type: Tag
tags question: http://stackoverflow.com/q/23347169
tags question: http://stackoverflow.com/q/23374707
tags question: http://stackoverflow.com/q/23442309
tags question: http://stackoverflow.com/q/23331504
tag name: jlist
tags question: http://stackoverflow.com/q/23329832

http://stackoverflow.com/q/23407382
tagged with: java
has comment: http://stackoverflow.com/comment/35866258
type: Question
has title: unable to send array to listview in android
has answer: http://stackoverflow.com/a/23408026
tagged with: intellij-idea
tagged with: listview
answer count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/35866945
has comment: http://stackoverflow.com/comment/35866918
has body: I am trying to get a json list of menu items from a server, parse it, and display it in a fragment view. The full code is here: http://pastebin.com/8UEgcyfa Before the code for getting the json and parsing was added, the app was simply displaying a list of hard-coded menu items from a string resource as such: String[] adobe_products = getResources().getStringArray(R.array.adobe_products); // Binding resources Array to ListAdapter this.setListAdapter(new ArrayAdapter&lt;String&gt;(getActivity(), R.layout.fragment_viewdishes, R.id.label, adobe_products)); This was correctly working. While trying to actually print the menu items received after parsing, i did this in the onPostExecute method (please see full code), where menuNameArray, (i think) correctly holds an array of menu items i actually need to display on ListView: this.setListAdapter(new ArrayAdapter&lt;String&gt;(getActivity(), R.layout.fragment_viewdishes, R.id.label, adobe_products)); IntelliJ IDEA throws an error at this point: Cannot resolve method setListAdapter . I thought that its actually ViewDishes.setListAdapter that needs to be called, but it throws another error: Non static method cannot be referenced from a static content Any pointers as to how I can get past this error, please?
has comment: http://stackoverflow.com/comment/35865955
favorite count: 0
has answer: http://stackoverflow.com/a/23411359
type: UnansweredQuestion
tagged with: android
score: 2
upvote count: 2

http://stackoverflow.com/comment/35731165
comment on: http://stackoverflow.com/q/23334327
score: 0
type: Comment
type: QuestionComment
has text: I'm sure they aren't correct

http://stackoverflow.com/comment/35770456
type: Comment
comment on: http://stackoverflow.com/a/23354961
score: 0
type: AnswerComment
has text: I added an id for sharedData in the xml layout, however it still stops working when I hit save. I wonder why.

http://stackoverflow.com/comment/35849336
score: 0
comment on: http://stackoverflow.com/a/23381212
type: Comment
type: AnswerComment
has text: Add a progress bar on your form and set its Style to Marquee. This will show an indeterminate progress bar.

http://stackoverflow.com/a/23311635
accepted answer of: http://stackoverflow.com/q/23310871
has comment: http://stackoverflow.com/comment/35691579
answers question: http://stackoverflow.com/q/23310871
has comment: http://stackoverflow.com/comment/35691106
type: Answer
has body: For the ordering problem: you could use LinkedHashMap to ensure the ordering. The NullPointerException is the result of calling method equalsIgnoreCase on null object, you set identifier to null in the first iteration: you should make question and identifier method parameters rather than fields. here is the code after change: public class QuestionsActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.test_layout); // false = call showRiskEvaluationDialog() on button NO // true = call showRiskEvaluationDialog() on button YES Map&lt;String, Boolean&gt; question_map = new LinkedHashMap&lt;String, Boolean&gt;(); question_map.put("Have you cut the power?", false); question_map.put("Have you not cut the power?", true); question_map.put("Do you know your work assignment?", false); question_map.put("Don't you know your work assignment?", true); // For loop to extract a question and identifier from the Map for (Entry&lt;String, Boolean&gt; entry : question_map.entrySet()){ create_dialog_method(entry.getKey(), entry.getValue()); } } /** * Method to create a dialogbox with a question and YES, NO buttons * * @param question_param * @param identifier */ public void create_dialog_method(String question_param, final boolean identifier) { AlertDialog.Builder alert = new AlertDialog.Builder(this); alert.setTitle("Title"); alert.setMessage(question_param); alert.setPositiveButton("YES", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int whichButton) { if (identifier) showRiskEvaluationDialog(); else Toast.makeText(getApplicationContext(), "Saved", Toast.LENGTH_SHORT).show(); } }); alert.setNegativeButton("NO", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int whichButton) { if (identifier) Toast.makeText(getApplicationContext(), "Saved", Toast.LENGTH_SHORT).show(); else showRiskEvaluationDialog(); …
type: AcceptedAnswer
score: 0

http://stackoverflow.com/a/23373957
has body: I went with the XML configuration (as documented in the tutorial) as opposed to the java configuration and it worked.
score: 0
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/23369672
accepted answer of: http://stackoverflow.com/q/23369672

http://stackoverflow.com/q/23366401
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/35789696
upvote count: 2
accepted answer: http://stackoverflow.com/a/23367008
type: AnsweredQuestion
tagged with: linked-list
score: 1
tagged with: java
downvote count: 1
type: Question
tagged with: algorithm
tagged with: data-structures
has answer: http://stackoverflow.com/a/23367008
has title: Linked list code in Java
has body: I was watching a video on data structures and algorithms offered here There firstly code for linked list was written as public class SListNode{ public Object item; public SListNode next; public SListNode(Object item,SListNode next){ this.item=item; this.next=next; } public SListNode(Object item){ this(item,null); } public void insertAfter(Object item){ next=new SListNode(item,next); } public SListNode nth(int position){ if (position==1){ return this; } else if ((position&lt;1)|| next==null){ return null; } else{ return next.nth(position-1); } } Then the lecturer said that there are two problems associated with this implementation. 1)if X and Y refer to the same list and if a new item was inserted to x , y doesn't get updated.I think this can be checked by public static void main (String args[]){ SListNode l1=new SListNode("milk",new SListNode(0,new SListNode(1))); SListNode l2=l1; l2=new SListNode("soap",l2); System.out.println(l1.item+ " "+l1.next.item+ " " +l1.next.next.item); System.out.println(l2.item+ " "+l2.next.item+ " " +l2.next.next.item); 2)when creating an empty list. Therefore as a solution separate SListClass that maintains head of list was created. public class SList{ privte SListNode head; private int size; public SList(){ head=null; size=0; } public void insertFront(Object item){ head=new SListNode(item,head); } } I don't understand how to work with SList class. How to create a linked list with this class? How is SListNode and Slist classes are connected and how can the methods of SlistNode be called from SList? Also how has this new implementation provide a solution to earlier problem of if X and Y refer to the same list and if a new item was inserted to x , y doesn't get updated. I am new to programming and Java therefore a clear explanation would be great
has comment: http://stackoverflow.com/comment/35790179

http://stackoverflow.com/q/23314052
tagged with: windows
has comment: http://stackoverflow.com/comment/35846080
answer count: 1
downvote count: 0
has body: The screenshot shows on the menu bar an apple (which is the system menu) the app menu "GSPro" which has the about and quit items, the ss also shows how the built in about box looks, this can be modified to look more professional and have icons/revs/author etc. That's the bits I'm having trouble finding info on and good examples. The file menu onwards is what my app generates and will look the same in windows so I know I would have to do windows menus slightly differently from mac stuff. On the mac this is known as laf (look and feel). My code snip is as follows, no handlers yet but just testing how it shows... public class GSPro { /** * @param args */ public static void main(String[] args) { System.setProperty("apple.laf.useScreenMenuBar", "true"); JFrame frame = new JFrame(); frame.setExtendedState(frame.getExtendedState() | JFrame.MAXIMIZED_BOTH); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true); frame.setLocationRelativeTo(null); frame.setTitle("GSPro"); JMenuBar menuBar = new JMenuBar(); JMenu file = new JMenu("File"); menuBar.add(file); JMenu edit = new JMenu("Edit"); menuBar.add(edit); JMenuItem exit = new JMenuItem("New"); file.add(exit); JMenuItem open = new JMenuItem("Open"); file.add(open); file.addSeparator(); JMenuItem close = new JMenuItem("Close"); file.add(close); file.addSeparator(); JMenuItem save = new JMenuItem("Save"); file.add(save); JMenuItem saveas = new JMenuItem("Save As..."); file.add(saveas); frame.setJMenuBar(menuBar); } }
has comment: http://stackoverflow.com/comment/35849572
tagged with: macos
has comment: http://stackoverflow.com/comment/35849224
favorite count: 0
has answer: http://stackoverflow.com/a/23411278
has comment: http://stackoverflow.com/comment/35872497
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35859237
has title: How do I modify the auto-generated menu and "About" box of Mac LAF in Java?
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/35867177
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/35694595
has comment: http://stackoverflow.com/comment/35719653
has comment: http://stackoverflow.com/comment/35719266
tagged with: menubar

http://stackoverflow.com/a/23330407
score: 13
upvote count: 14
type: AcceptedAnswer
downvote count: 1
has body: The answer stating that an interface represents a contract is not acceptable. That's the answer we give to Junior since it may be too complex to clearly figure out the difference between the essence of an abstract class and the essence of an interface without much architecture experience and without reading a lot of classic books about. Any abstract class with public methods acts as a contract, as well as an interface. An abstract class that doesn't provide any implementation is in 99% of cases a representation of an object's Role. An interface represents a Role. Each object might have several different roles that shouldn't be tied together but composed by the concerned object. I'm explaining this with this example: Your interviewer could say: I have a Robot that can walk and a Human that can walk too. So based on this case, he asks you: should I extract the walking feature in an abstract base class or in an interface, knowing that the implementations have nothing in common? You think..."oh I know so: in this case, having one abstract class with an abstract method walk(), then is clearly the same than declaring an interface with the walk() method." So your answer would surely be: "it's the choice of the developer !". And it's really not an always valid answer. Why? Let's see the next expectation: A Human can eat, but obviously the Robot cannot and even doesn't need. What if you implemented the walking feature with an abstract class? You would end up with: public abstract class Biped { public void abstract walk(); } public Robot extends Biped { public void walk() { //walk at 10km/h speed } } public Human extends Biped { public void walk() { //walk at 5km/h speed } } How could you plug the eating feature? You're stuck because you can't implement it in the Biped base class since it would break Liskov Substitution Principle, since a Robot doesn't eat! And you can't expect Human extending another base class due to the known Java rule. Of course, you could add a specific …
accepted answer of: http://stackoverflow.com/q/23302920
answers question: http://stackoverflow.com/q/23302920
type: Answer

http://stackoverflow.com/comment/35763741
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23348968
has text: Because when i draw an image with the methode drawImage (Graphics). i know exactly its coordinates. so i will use them to link two images by using drawLine(x1,y1, x2,y2). but in this case you used a GridLayout .. (or other).. this is an [Example](http://2.bp.blogspot.com/_ccujEqzvArs/TEkRXpW4MmI/AAAAAAAAsDE/jsejvf-zJ6I/s1600/bgp-multipath-test.png) of what i want to Draw. (I mentioned it in my last comment ) Why not mention that in the first place : because my problem is with the method repaint ( I want to do it my self to learn ;) ) thank you.

http://stackoverflow.com/comment/35879978
score: 0
comment on: http://stackoverflow.com/a/23401550
type: AnswerComment
has text: Well thats part of the problem. If I knew the files that were dependencies, then I would be able to manually tell which files weren't unit tested.
type: Comment

http://stackoverflow.com/a/23331271
downvote count: 0
score: 15
type: AcceptedAnswer
has body: This is your "Canonical Metamodel". It can be used with the JPA Criteria API, as described by the JPA 2.x spec (Section 6.2). To stop Eclipse from generating these classes: edit your Eclipse project properties > JPA > Canonical metamodel (JPA 2.0) > Source folder - set the folder's value to "".
accepted answer of: http://stackoverflow.com/q/23326456
type: Answer
upvote count: 15
answers question: http://stackoverflow.com/q/23326456

http://stackoverflow.com/q/23339223
type: UnansweredQuestion
tagged with: jdbc
has body: What approach is better? 1. String sql = "select count(*) from table where date = trunc(?, 'DD')"; getJdbcTemplate().queryForInt(sql, new java.sql.Date(date.getTime())) 2. String sql = "select count(*) from table where date = ?"; getJdbcTemplate().queryForInt(sql, new java.sql.Date(DateUtils.truncate(date, Calendar.DATE).getTime()))
has comment: http://stackoverflow.com/comment/35739543
has answer: http://stackoverflow.com/a/23339247
has title: What approach is better of using date truncate?
type: Question
tagged with: java
tagged with: date
score: 0
answer count: 1

http://stackoverflow.com/comment/79044687
type: Comment
comment on: http://stackoverflow.com/a/23913830
score: 1
type: AnswerComment
has text: how do you programmatically call `hibernateBundle.run(configuration, environment);` since you don't have the `environment` instance available in the module (that extends abstractmodule)?

http://stackoverflow.com/comment/35924396
score: 0
type: Comment
has text: Regarding the LargeByteMapping factory, the entire file needs to be in memory at one time, because there's a minimum of 24 threads reading from it at a time. Currently, it's using a ByteSource to open a new buffered stream to the file for each thread. I'll take a look through the largetext project.
comment on: http://stackoverflow.com/a/23438317
type: AnswerComment

http://stackoverflow.com/a/55278899
downvote count: 0
score: 6
has body: If the creation of the nested future is beyond your control, you can flatten it like this: static &lt;T&gt; CompletableFuture&lt;T&gt; flatten( CompletableFuture&lt;CompletableFuture&lt;T&gt;&gt; nestedFuture) { return nestedFuture.thenCompose(Function.identity()); }
upvote count: 6
type: Answer
answers question: http://stackoverflow.com/q/23302200

http://stackoverflow.com/comment/35716328
has text: Use capital letters for EEE and MMM.
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/23326110

http://stackoverflow.com/q/23419972
has answer: http://stackoverflow.com/a/41161316
type: AnsweredQuestion
downvote count: 0
possible better answer: http://stackoverflow.com/a/23616663
tagged with: java
tagged with: dcm4che
has answer: http://stackoverflow.com/a/34206677
has body: I cannot inspect any of my beans in the JMX Agent View as clicking on any bean results in the error pasted below. Every thing else seems to be working fine within JBOSS as it is properly serving my application. Environment variables as follows... PATH = C:\Program Files\Java\jre8\bin;C:\Users\XXX\AppData\Roaming\npm;C:\Program Files (x86)\Java\jre7\bin;C:\Program Files\Java\jre7\bin; JAVA_HOME = C:\Program Files (x86)\Java\jdk1.8.0_05 JBossWeb/2.0.1.GA - Error report HTTP Status 500 - type Exception report message description The server encountered an internal error () that prevented it from fulfilling this request. exception org.apache.jasper.JasperException: Unable to compile class for JSP: An error occurred at line: 151 in the jsp file: /inspectMBean.jsp The type java.lang.CharSequence cannot be resolved. It is indirectly referenced from required .class files 148: else if (String.valueOf(attrValue).indexOf(sep) == -1) 149: { 150: %&gt; 151: &lt;input type=&quot;text&quot; name=&quot;&lt;%= attrName %&gt;&quot; value=&quot;&lt;%= attrValue.replace(&quot;\&quot;&quot;,&quot;&amp;quot;&quot;) %&gt;&quot; &lt;%= readonly %&gt;&gt; 152: &lt;% 153: } 154: else An error occurred at line: 151 in the jsp file: /inspectMBean.jsp The method replace(char, char) in the type String is not applicable for the arguments (String, String) 148: else if (String.valueOf(attrValue).indexOf(sep) == -1) 149: { 150: %&gt; 151: &lt;input type=&quot;text&quot; name=&quot;&lt;%= attrName %&gt;&quot; value=&quot;&lt;%= attrValue.replace(&quot;\&quot;&quot;,&quot;&amp;quot;&quot;) %&gt;&quot; &lt;%= readonly %&gt;&gt; 152: &lt;% 153: } 154: else Stacktrace: org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:92) org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330) org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:415) org.apache.jasper.compiler.Compiler.compile(Compiler.java:308) org.apache.jasper.compiler.Compiler.c…
type: Question
score: 9
tagged with: jboss
answer count: 3
has answer: http://stackoverflow.com/a/23616663
favorite count: 0
upvote count: 9
has title: Inspecting a bean in my JBOSS JMX Agent View fails with an error
linked to: http://stackoverflow.com/q/6780639
accepted answer: http://stackoverflow.com/a/34206677

http://stackoverflow.com/q/23303687
score: 1
tagged with: java
has body: I am simply trying to test my connection with SQL Server 2008 as follows: public class ForJDBC { public static void main(String[] args) { try{ Connection conn = DriverManager.getConnection("jdbc:sqlserver://XX.XX.X.XXX:1433;databaseName=MyDB;user=sa;password=mypassword"); if(conn != null){ System.out.println("Connection is Successfull"); } } catch(SQLException ex){ ex.printStackTrace(); } } } But I keep on getting the following exception: com.microsoft.sqlserver.jdbc.SQLServerException: Login failed for user 'sa'. ClientConnectionId:96f7d048-9734-4fd8-8216-21231d89b2e6 at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:216) at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:216) at com.microsoft.sqlserver.jdbc.TDSTokenHandler.onEOF(tdsparser.java:254) at com.microsoft.sqlserver.jdbc.TDSParser.parse(tdsparser.java:84) at com.microsoft.sqlserver.jdbc.SQLServerConnection.sendLogon(SQLServerConnection.java:2908) at com.microsoft.sqlserver.jdbc.SQLServerConnection.logon(SQLServerConnection.java:2234) at com.microsoft.sqlserver.jdbc.SQLServerConnection.access$000(SQLServerConnection.java:41) at com.microsoft.sqlserver.jdbc.SQLServerConnection$LogonCommand.doExecute(SQLServerConnection.java:2220) at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:5696) at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:1715) at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(SQLServerConnection.java:1326) at com.microsoft.sqlserver.jdbc.SQLServerConnection.login(SQLServerConnection.java:991) at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(SQLServerConnection.java:827) at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(SQLServerDriver.java:1012) at java.sql.DriverManager.getConnection(DriverManager.java:664) at java.sql.DriverManager.getConnection(DriverManager.java:270) at forjdbc.ForJDBC.main(ForJDBC.java:35) Whe…
linked to: http://stackoverflow.com/q/17372606
has answer: http://stackoverflow.com/a/26622335
type: Question
has answer: http://stackoverflow.com/a/24320231
downvote count: 0
has comment: http://stackoverflow.com/comment/35675459
tagged with: sql-server
answer count: 3
tagged with: jdbc
favorite count: 0
duplicate of: http://stackoverflow.com/q/17372606
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24320462
has title: com.microsoft.sqlserver.jdbc.SQLServerException: Login failed for user 'sa'
upvote count: 1
has comment: http://stackoverflow.com/comment/35675557
has comment: http://stackoverflow.com/comment/35818140

http://stackoverflow.com/comment/35781911
type: Comment
type: QuestionComment
has text: @Peter I have just a simple question server is writing data into outputstream so how that data is transferred into inputstream?
comment on: http://stackoverflow.com/q/23361862
score: 0

http://stackoverflow.com/q/23324009
has comment: http://stackoverflow.com/comment/35718490
has comment: http://stackoverflow.com/comment/35718056
tagged with: shell
has comment: http://stackoverflow.com/comment/35714925
has title: Java Executing ipconfig , Client-Server
has answer: http://stackoverflow.com/a/23329006
possible better answer: http://stackoverflow.com/a/23328125
linked to: http://stackoverflow.com/q/22881227
type: Question
type: AnsweredQuestion
tagged with: java
has body: im making a program that you type ifconfig(Linux) or ipconfig(Windows) in the Client, Then it sends to the Server and there execute the shell. It executes ok, and in the server I can see the ipconfig correctly, but i dont know how to return the result of the server to the client. Client Side: public class ShellClient { public static void main(String[] args) throws IOException { String comand; Socket server =null; server = new Socket("localhost", 1234); while(true){ System.out.println("Insert ipconfig(windows)/ ifconfig(Linux): "); @SuppressWarnings("resource") Scanner keyboard = new Scanner(System.in); comando = keyboard.next(); try{ System.out.println("Conecting..."); DataOutputStream out = new DataOutputStream(new BufferedOutputStream(server.getOutputStream())); DataInputStream in = new DataInputStream(new BufferedInputStream(server.getInputStream())); out.writeUTF(comand); out.flush(); String result = in.readUTF(); System.out.println(result); if (comand == "0"){server.close(); System.out.println("Finish. Thank You!"); System.exit(0);} }catch(IOException ioe){ System.err.println(ioe); } } } } Server Side: public class ShellServer { public static void main(String[] args) throws IOException { ServerSocket socket = null; Socket client = null; String result; String comand ; String s = null; socket = new ServerSocket(1234); System.out.println("The server keep working..."); client = socket.accept(); System.out.println("The client is connected"); DataInputStream in = new DataInputStream(new BufferedInputStream(client.getInputStream())); DataOutputStream out = new DataOutputStream(new BufferedOutputStream(client.getOutputStream())); comand = in.readUTF(); result = Shell.CheckCommand(comand); //out.writeUTF(result); //out.flush(); // Ejcutamos el comando Process p = Runtime.getRuntime().exec(result); BufferedReader stdInput = new BufferedReader(new InputStreamReader( p.getInputStream())); while ((s = stdInput.readLine()) != null) { System.out.println(s); } if(comand == "0"…
answer count: 2
has answer: http://stackoverflow.com/a/23328125
has comment: http://stackoverflow.com/comment/35718302
score: 0
accepted answer: http://stackoverflow.com/a/23329006

http://stackoverflow.com/comment/35710483
score: 1
comment on: http://stackoverflow.com/a/23323211
type: AnswerComment
has text: It uses a bit operator. For red method, `(color >> 16) & 0xFF`
type: Comment

http://stackoverflow.com/q/23292907
has answer: http://stackoverflow.com/a/23293017
score: 1
tagged with: java
type: Question
tagged with: object
possible better answer: http://stackoverflow.com/a/23293017
tagged with: arrays
has answer: http://stackoverflow.com/a/23293104
upvote count: 2
has answer: http://stackoverflow.com/a/23292975
downvote count: 1
accepted answer: http://stackoverflow.com/a/23292975
favorite count: 0
has answer: http://stackoverflow.com/a/23293329
has body: I have an object o which I know for fact that it is an array of something. How do I iterate over ȯ? Object o; if (o != null &amp;&amp; o.getClass().isArray()) { for (Object each : o) { // compile error, of course System.out.println(each); } }
has title: Iterate over Object
answer count: 4
type: AnsweredQuestion

http://stackoverflow.com/comment/35838915
has text: So, you need to get MotioEvent from a View in your library?
type: Comment
comment on: http://stackoverflow.com/q/23392413
type: QuestionComment
score: 0

jquery
tags question: http://stackoverflow.com/q/23406457
tags question: http://stackoverflow.com/q/23413388
tags question: http://stackoverflow.com/q/23375134
type: Tag
tags question: http://stackoverflow.com/q/23356956
tags question: http://stackoverflow.com/q/23325223
tags question: http://stackoverflow.com/q/23348769
tags question: http://stackoverflow.com/q/23411874
tags question: http://stackoverflow.com/q/23340918
tags question: http://stackoverflow.com/q/23303603
tags question: http://stackoverflow.com/q/23336903
tags question: http://stackoverflow.com/q/23340533
tags question: http://stackoverflow.com/q/23346692
tags question: http://stackoverflow.com/q/23342620
tags question: http://stackoverflow.com/q/23406244
tags question: http://stackoverflow.com/q/23319341
tag name: jquery
tags question: http://stackoverflow.com/q/23306868
tags question: http://stackoverflow.com/q/23409357
tags question: http://stackoverflow.com/q/23447257
tags question: http://stackoverflow.com/q/23379900
tags question: http://stackoverflow.com/q/23337179
tags question: http://stackoverflow.com/q/23414274
tags question: http://stackoverflow.com/q/23380695
tags question: http://stackoverflow.com/q/23366918
tags question: http://stackoverflow.com/q/23406136
tags question: http://stackoverflow.com/q/23360423
tags question: http://stackoverflow.com/q/23374852
tags question: http://stackoverflow.com/q/23338097
tags question: http://stackoverflow.com/q/23334049

http://stackoverflow.com/comment/35939013
type: Comment
comment on: http://stackoverflow.com/a/23445626
type: AnswerComment
has text: Thanks, interesting solution. But for example this input "\\\\|\\\\\\\\|\\\\\\\\\\\\" returns [\|\\|\\\] I would expect [\, \\, \\\]
score: 0

http://stackoverflow.com/comment/35653078
type: Comment
comment on: http://stackoverflow.com/a/23291127
type: AnswerComment
has text: You could try with getNames method to print all json properties to see if the objeject is parsed correctly or not and how object representation of JSON is composed.
score: 0

http://stackoverflow.com/comment/35673677
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23301709
has text: is there a way to write it so that when sPhrase = tmpArr it exits, or something around those lines?

http://stackoverflow.com/comment/35831767
has text: Could you please set your system time to 31 of March and then call your sequence of code? you might have a surprise...
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23388785
type: Comment

http://stackoverflow.com/q/23320680
has answer: http://stackoverflow.com/a/23320703
accepted answer: http://stackoverflow.com/a/23320703
type: Question
has answer: http://stackoverflow.com/a/23320713
has answer: http://stackoverflow.com/a/23320785
score: -2
has body: I want to make a simple space shooter game but it is not working well at the start. How it will be its end? Something is going wrong with my code. The overridden run() method of the Runnable interface is not working. Why the run method is not working as it should? Moreover any information about how to shoot more independent bullets. Here is my code. Thanks in advance. import java.awt.Color; import java.awt.Dimension; import javax.swing.JFrame; public class GameWindow extends JFrame implements Runnable { static final int WIDTH = 500; static final int HEIGHT = 500; static final String title = "East Game Development"; private boolean running = false; private Thread thread; GameWindow() { setSize(new Dimension(WIDTH, HEIGHT)); getContentPane().setBackground(Color.BLACK); setMaximumSize(new Dimension(WIDTH, HEIGHT)); setMinimumSize(new Dimension(WIDTH, HEIGHT)); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setTitle(title); setResizable(false); setVisible(true); } private synchronized void start() { System.out.println("Debugging start method"); if (running) { return; } running = true; thread = new Thread(); thread.start(); } private synchronized void stop() { if (!running) { return; } running = false; try { thread.join(); } catch (Exception ex) { } System.exit(1); } @Override public void run() { System.out.println("Debugging"); while (running) { System.out.println("Working well..."); } stop(); } public static void main(String[] args) { GameWindow gw = new GameWindow(); gw.start(); } }
has comment: http://stackoverflow.com/comment/35705975
tagged with: java
has title: run() method not running
upvote count: 0
possible better answer: http://stackoverflow.com/a/23320707
favorite count: 0
answer count: 4
type: AnsweredQuestion
tagged with: multithreading
downvote count: 2
has answer: http://stackoverflow.com/a/23320707

http://stackoverflow.com/comment/35683218
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/23308253
has text: You should use both. A loop allows the user to choose more than just one movie, and the switch can be used to select the wanted movie.
type: Comment

http://stackoverflow.com/comment/35819496
has text: I followed @Nathan Merrill `s answer.I've updated my question
type: AnswerComment
comment on: http://stackoverflow.com/a/23366864
score: 0
type: Comment

http://stackoverflow.com/comment/35735632
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23336843
type: Comment
has text: Try getting rid of the quotes in the PK constraint.

http://stackoverflow.com/a/23362613
downvote count: 0
answers question: http://stackoverflow.com/q/23356475
score: 4
has comment: http://stackoverflow.com/comment/35782722
has body: Java doesn't have a concept of sealed templates, therefore it is simply impossible for the Java compiler to enforce sealed constraints, because it doesn't even know they exist. This is not specific to sealed and not even specific to Scala/Java. This kind of thing only works if both languages know about each other (i.e. the Scala compiler needs to know about every programming language that could conceivably be used to interoperate with it, including ones that don't even exist yet, and vice-versa, every compiler and interpreter for a language that could conceivably be used to interoperate with Scala needs to know about Scala, even compilers that were written before Scala existed) and they can agree on a a way to communicate those semantics between each other. Of course, having all languages know about all other languages is O(n²) and doesn't scale, and obviously having languages know about languages that don't exist yet is just impossible. So, what we do instead is to define a common language that all languages know about. On Unix, that's C structs + C function calls, on the CLI, that's CIL byte code and on the Java platform, that's JVM byte code. This means that Scala and Java can communicate with each other via a detour through JVM byte code, but obviously they can only communicate semantics which can be expressed in JVM byte code. And sealed is not one of those. Scala uses an annotation to encode sealed in the byte code, but Java doesn't understand that annotation, and even if it did, it doesn't actually cleanly map to any concept in Java anyway! (Unlike, say, Java interfaces which cleanly map to fully abstract Scala traits).
type: Answer
upvote count: 4

http://stackoverflow.com/comment/35683602
score: 0
type: AnswerComment
has text: Can't modify the MainFrame , it claims it's corrupted.
type: Comment
comment on: http://stackoverflow.com/a/23300658

http://stackoverflow.com/q/23357884
has comment: http://stackoverflow.com/comment/35774607
favorite count: 0
type: UnansweredQuestion
tagged with: android
linked to: http://stackoverflow.com/q/4463886
has answer: http://stackoverflow.com/a/23358642
downvote count: 0
has title: Error Cannot be cast string to integer
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/23358873
type: Question
has comment: http://stackoverflow.com/comment/35774408
tagged with: edittextpreference
has comment: http://stackoverflow.com/comment/35774342
has comment: http://stackoverflow.com/comment/35774829
has comment: http://stackoverflow.com/comment/35774466
has comment: http://stackoverflow.com/comment/35774538
answer count: 3
has comment: http://stackoverflow.com/comment/35774383
has comment: http://stackoverflow.com/comment/35774568
has comment: http://stackoverflow.com/comment/35774295
upvote count: 1
tagged with: parseint
has body: I can't change the EditTextPreference value from string to int. I've done in this way: WifiOnOffValue = (EditTextPreference) findPreference("WifiOnOffValue"); String value = WifiOnOffValue.getText().toString(); if(value != null &amp;&amp; !value.isEmpty()) { try { vedit = Integer.parseInt(value); } catch (NumberFormatException ex) { ex.printStackTrace(); vedit = 0; } } And I get the error java.lang.Integer cannot be cast to java lang.String... I need convert the value of my EditTextPreference in integer. Thanks Log: Code: //-- Edittext Wifi WifiOnOffValue = (EditTextPreference) findPreference("WifiOnOffValue"); String value = WifiOnOffValue.getText().toString().trim(); if(value!=null &amp;&amp; !value.isEmpty()){ try{ vedit = Integer.parseInt(value); } catch (NumberFormatException ex) { ex.printStackTrace(); vedit=0; } } Solved.. this was the solution: ClassCastException in PreferenceActivity seems that it stored wrong values.. Now i can start the app and seems goes well.. The solution to me was simply uninstall and reinstall the application.. so strange. Thanks to everybody anyway
has comment: http://stackoverflow.com/comment/35774331
has answer: http://stackoverflow.com/a/23358263

http://stackoverflow.com/q/23292197
has answer: http://stackoverflow.com/a/23292429
has comment: http://stackoverflow.com/comment/35656398
answer count: 4
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35654234
has answer: http://stackoverflow.com/a/23292532
has comment: http://stackoverflow.com/comment/35653921
has comment: http://stackoverflow.com/comment/35654236
has body: I have an exercise to do in college, part of which consists of creating a pack of cards which must then be shuffled. I have the cards in an array (not shuffled) and want to shuffle them and push them onto a home made Stack, from which I can pop the cards off to deal them. My problem is that I want to check that the random number I generate (and which represents one of the cards in the array) is not already in the Stack. From reading on this forum I have come up with the code below which, it seems to me should work. On debugging though I notice duplicates. As per my comment below we can't use the Collections framework (edit) private Stack&lt;Card&gt; deck;//to hold cards private Card[] protoDeck;//to hold cards before shuffling private Random randomer; private int cardsDealt;//how many cards used. Used for other methods private static final int TOTALCARDS = 52;//sets limit of deck for all decks public void shuffle(){//remove cards from deck and put back in random order randomer = new Random(); int[] temp = new int[TOTALCARDS];//to keep track of random numbers int rand = 0; for (int i = 0; i &lt; temp.length ; i++) { do {//keep creating randoms if rand = randomer.nextInt(TOTALCARDS); deck.push(protoDeck[rand]);//puts the Card onto the Deck in a random position temp[i] = rand; } while (!(Arrays.asList(temp).contains(rand)));//check if the number already used } } @PeterLawrey I have tweaked the code slightly as follows as I only need to shuffle full decks and it works a treat, I will pop cards off the Stack to deal public void shuffle() { randomer = new Random(); for(int i = 0; i &lt; TOTALCARDS; i++) { // pick a random card from the rest of the deck int j = randomer.nextInt(protoDeck.length - i) + i; // swap cards Card tmp = protoDeck[i]; protoDeck[i] = protoDeck[j]; protoDeck[j] = tmp; deck.push(protoDeck[i]); } } Thanks to Peter and all the other contributors. M.
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/35654407
has comment: http://stackoverflow.com/comment/35661294
type: Question
has comment: http://stackoverflow.com/comment/35658080
score: 3
tagged with: arrays
possible better answer: http://stackoverflow.com/a/23292274
linked to: http://stackoverflow.com/q/859253
has answer: http://stackoverflow.com/a/23292274
linked to: http://stackoverflow.com/q/12020361
has title: Checking for an integer in array
accepted answer: http://stackoverflow.com/a/23292532
tagged with: random
has comment: http://stackoverflow.com/comment/35662722
has answer: http://stackoverflow.com/a/23292304
downvote count: 0
linked to: http://stackoverflow.com/q/13789109
favorite count: 0
has comment: http://stackoverflow.com/comment/35654008

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

graphics
tag name: graphics
tags question: http://stackoverflow.com/q/23393664
tags question: http://stackoverflow.com/q/23419889
tags question: http://stackoverflow.com/q/23305669
tags question: http://stackoverflow.com/q/23370897
tags question: http://stackoverflow.com/q/23348150
tags question: http://stackoverflow.com/q/23299993
tags question: http://stackoverflow.com/q/23297478
tags question: http://stackoverflow.com/q/23321196
tags question: http://stackoverflow.com/q/23391197
type: Tag
tags question: http://stackoverflow.com/q/23439512
tags question: http://stackoverflow.com/q/23319025
tags question: http://stackoverflow.com/q/23303445
tags question: http://stackoverflow.com/q/23346425
tags question: http://stackoverflow.com/q/23296974
tags question: http://stackoverflow.com/q/23416202
tags question: http://stackoverflow.com/q/23294604
tags question: http://stackoverflow.com/q/23440713
tags question: http://stackoverflow.com/q/23398744
tags question: http://stackoverflow.com/q/23315737
tags question: http://stackoverflow.com/q/23417279
tags question: http://stackoverflow.com/q/23313487
tags question: http://stackoverflow.com/q/23370914
tags question: http://stackoverflow.com/q/23428179
tags question: http://stackoverflow.com/q/23417884
tags question: http://stackoverflow.com/q/23324759
tags question: http://stackoverflow.com/q/23417786
tags question: http://stackoverflow.com/q/23401948
tags question: http://stackoverflow.com/q/23393967
tags question: http://stackoverflow.com/q/23403707

http://stackoverflow.com/comment/35761039
has text: Here you go, I've edited an answer to include a complete code sample.
type: Comment
comment on: http://stackoverflow.com/a/23341573
type: AnswerComment
score: 0

http://stackoverflow.com/comment/35755438
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23347698
score: 0
has text: Plus, I guess `guess` is actually just character that the user put in. You probably don't even want to compare letters inside the main while() loop. just check the `tries` value, then do your letter searching inside the loop. if you have to terminate the loop, then you can simply `break` out of it.

http://stackoverflow.com/a/23293239
has body: You're right, the syntax is slightly wrong (for all of them!). If you intend to issue two :! calls, these must be separated by | (escaped &lt;Bar&gt; in a mapping), not &amp;&amp;: autocmd FileType java nnoremap &lt;buffer&gt; &lt;F9&gt; :exec '!javac' shellescape(%) &lt;Bar&gt; exec '!java' shellescape(%:r)&lt;cr&gt; But better do this with a single call: The &amp;&amp; must then be quoted, so that it is evaluated by the shell launched by :!, not Vim: autocmd FileType java nnoremap &lt;buffer&gt; &lt;F9&gt; :exec '!javac' shellescape(%) '&amp;&amp; java' shellescape(%:r)&lt;cr&gt; Furthermore, the special % keyword is only recognized directly in the command-line, not when using it in an :execute expression. You need to wrap this with expand(). Oh, and shellescape() should receive an additional flag for proper :! escaping. autocmd FileType java nnoremap &lt;buffer&gt; &lt;F9&gt; :exec '!javac' shellescape(expand('%'), 1) '&amp;&amp; java' shellescape(expand('%:r'), 1)&lt;cr&gt;
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23292917
score: 3
type: Answer
accepted answer of: http://stackoverflow.com/q/23292917
has comment: http://stackoverflow.com/comment/35674581
upvote count: 3

http://stackoverflow.com/comment/35668031
comment on: http://stackoverflow.com/q/23299051
type: Comment
type: QuestionComment
score: 2
has text: i'd think the first thing to do is measure how long the tasks go between checks for interruption, and try to reduce that interval by introducing more checks. have you tried that?

http://stackoverflow.com/comment/35942423
score: 0
type: AnswerComment
has text: The components will be added dynamically!
comment on: http://stackoverflow.com/a/23448354
type: Comment

http://stackoverflow.com/comment/35898754
score: 0
type: Comment
has text: <TabWidget android:id="@android:id/tabs" android:layout_width="match_parent" android:layout_height="wrap_content" **android:layout_alignParentBottom="true"** android:layout_marginLeft="0dp" />
type: AnswerComment
comment on: http://stackoverflow.com/a/23423332

http://stackoverflow.com/q/23310627
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35688268
type: Question
has title: How to read text from url on jsp page
tagged with: java
has comment: http://stackoverflow.com/comment/35687976
has comment: http://stackoverflow.com/comment/35689547
has comment: http://stackoverflow.com/comment/35688150
tagged with: url
tagged with: jsp
has comment: http://stackoverflow.com/comment/35688096
score: 0
has body: Hi i am trying to read text from a url when i try to reap url text it print some some other text in place of original text original text is in hindi How ca i get my output Here is my code <% URL url; try { // get URL content String a="http://122.160.81.37:8080/mandic/commoditywise?c=paddy"; url = new URL(a); URLConnection conn = url.openConnection(); // open the stream and put it into BufferedReader BufferedReader br = new BufferedReader( new InputStreamReader(conn.getInputStream())); StringBuffer sb=new StringBuffer(); String inputLine; while ((inputLine = br.readLine()) != null) { System.out.println(inputLine); String s=inputLine.replace("|", "\n"); s=s.replace("~"," "); StringTokenizer str = new StringTokenizer(s); while(str.hasMoreTokens()) { String mandi = str.nextElement().toString(); String price = str.nextElement().toString(); %> <%= mandi%> <%= price%> <% } } br.close(); //System.out.println(sb); } catch (MalformedURLException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } %> i am getting this in output à¤…à¤šà¥à¤›à¤¨à¥‡à¤°à¤¾ NIL à¤†à¤—à¤°à¤¾ NIL à¤«à¤¼à¤¤à¥‡à¤¹à¤¾à¤¬à¤¾à¤ NIL Here is my simple code which is giving right output import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.net.MalformedURLException; import java.net.URL; import java.net.URLConnection; import java.util.StringTokenizer; public class URLConetent{ public static void main(String[] args) { URL url; try { // get URL content String a="http://122.160.81.37:8080/mandic/commoditywise?c=paddy"; url = new URL(a); URLConnection conn = url.openConnection(); // open the stream and put it into BufferedReader BufferedReader br = new BufferedReader( new InputStreamReader(conn.getInputStream())); StringBuffer sb=new StringBuffer(); String inputLine; while ((inputLine = br.readLine()) != null) { System.out.println(inputLine); // sb.append(inputLine); String s=inputLine.replace("|", "\n"); s=s.replace("~"," "); //System.out.pr…
has comment: http://stackoverflow.com/comment/35688377
has comment: http://stackoverflow.com/comment/35687821
answer count: 0

http://stackoverflow.com/q/23360975
tagged with: maven-profiles
has title: Maven call automatically the release prepare when activated a profile
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23361678
type: Question
has body: I do not have much experience with Maven profiles .... I do not know if Maven can do this, but it definitely could be useful to me ... Is possible to define a profile, which when called, automatically run the maven release plugin prepare goal? I explained better .... instead of: mvn release: prepare I would like to call mvn install-pProfileThatPerformThePrepare that automatically perform the prepare ... Thank you....
accepted answer: http://stackoverflow.com/a/23361678
score: 0
tagged with: maven
answer count: 1
tagged with: maven-release-plugin
tagged with: java

http://stackoverflow.com/comment/35829784
score: 0
comment on: http://stackoverflow.com/q/23385825
type: QuestionComment
type: Comment
has text: yes, but how are you importing the dump? What do you do in MySQL Administrator to get that error? Normally the output is imported using the mysql command.

http://stackoverflow.com/comment/35930681
comment on: http://stackoverflow.com/a/23441167
has text: @Battle_Slug still let me update my post to answer **how to pass the ResultSet from the servlet to the jsp?**
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/23347564
tagged with: java
has answer: http://stackoverflow.com/a/23361290
tagged with: marshalling
type: Question
has body: I've written a runnable network class that listens on a socket and unmarshalls the input. It also can write to the socket with a marshalled object. An issue arises because the socket remains open (in order to allow later communication between client and host) - this causes the unmarshalling of the input stream to hang. I've tried writing XMLStreamConstants.END_DOCUMENT from the sender side but this causes an error unmarshalling instead of hanging. Here's some of the code for the network class: @Override public void update(Observable o, Object arg) { try { if(!this.updatedByNetwork){ OutputStream os = socket.getOutputStream(); mh.marshal(this.gm.getBoard(), os); os.flush(); } }catch (IOException e) { e.printStackTrace(); } catch (JAXBException e) { e.printStackTrace(); } } @Override public void run() { try { if (this.ss != null){ this.socket = this.ss.accept(); this.update(this.gm, null); } while (true){ try { InputStream is = socket.getInputStream(); Board b = mh.unmarshal(is); this.updatedByNetwork = true; this.gm.updateBoard(b); } catch (SocketTimeoutException e){ e.printStackTrace(); } catch (JAXBException e) { e.printStackTrace(); } } } catch (IOException e) { e.printStackTrace(); } } Here's the code for my marshall handler: public Board unmarshal(InputStream in) throws JAXBException{ Unmarshaller um = this.jc.createUnmarshaller(); Board b = (Board) um.unmarshal(in); return b; } public void marshal(Board b, OutputStream os) throws JAXBException { Marshaller m = this.jc.createMarshaller(); m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); m.marshal(b, os); } So, is there a way to signify the end of file for the unmarshaller? Or, is there a better way to do this?
tagged with: unmarshalling
accepted answer: http://stackoverflow.com/a/23361290
downvote count: 0
answer count: 1
favorite count: 0
upvote count: 2
tagged with: sockets
tagged with: multithreading
has title: Unmarshalling Hangs on Open Socket
score: 2
type: AnsweredQuestion

http://stackoverflow.com/comment/35942863
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23448321
has text: Because `displayMenu()` is void you can't `return selection;` you would need it to return an int.

http://stackoverflow.com/q/23327436
has answer: http://stackoverflow.com/a/23328066
has comment: http://stackoverflow.com/comment/35718527
type: Question
has title: Need of declare gc() method in two different classes in java
has comment: http://stackoverflow.com/comment/35734988
has comment: http://stackoverflow.com/comment/35718630
answer count: 2
accepted answer: http://stackoverflow.com/a/23328066
has answer: http://stackoverflow.com/a/23327473
downvote count: 0
has comment: http://stackoverflow.com/comment/35718620
tagged with: jvm
favorite count: 0
upvote count: 2
possible better answer: http://stackoverflow.com/a/23327473
tagged with: garbage-collection
has comment: http://stackoverflow.com/comment/35718605
duplicate of: http://stackoverflow.com/q/6197306
score: 2
type: AnsweredQuestion
tagged with: java
has body: If we call System.gc() it internally call the Runtime.getRuntime().gc() method then why sun's need to make gc method in two class like System and Runtime, without System class we can call the Runtime.getRuntime().gc() and request the JVM for garbage collection. What is the reason behind making gc() method in two classes. Please explain your reason of that.

http://stackoverflow.com/a/23378792
has body: Assuming you did TreeNode a = new TreeNode (1); At this time a's left, right and root are null if you did TreeNode b = new TreeNode (b); a.setLeftChild (b); then now a's right and root are still null but left is b and b's root is now a
score: 1
has comment: http://stackoverflow.com/comment/35813244
upvote count: 1
has comment: http://stackoverflow.com/comment/35813281
downvote count: 0
answers question: http://stackoverflow.com/q/23378665
type: Answer

http://stackoverflow.com/comment/35818471
score: 2
has text: post code and not screenshots...
comment on: http://stackoverflow.com/q/23381949
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23426634
tagged with: android-fragments
score: 1
tagged with: java
tagged with: android-viewpager
downvote count: 0
answer count: 1
favorite count: 0
tagged with: android
has body: I've got a ViewPager containing 5 Fragments, each containing 1 ListView, which contain some data I downloaded. I'm making an refresh method now and to update the data the ListViews display, I'm just recalling the code I used to set it up the way I did in my onCreate()-method, which is this way: mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager()); mViewPager.setAdapter(mSectionsPagerAdapter); mViewPager.setOffscreenPageLimit(4); Where my mSectionsPagerAdapter looks like this: public class SectionsPagerAdapter extends FragmentPagerAdapter { public SectionsPagerAdapter(FragmentManager fm) { super(fm); } @Override public Fragment getItem(int i) { return MyFragment.newInstance(i); } @Override public int getCount() { return 5; } @Override public CharSequence getPageTitle(int position) { return "Title"; } } But I bet there's a more efficient way of updating the ViewPager than just recreating it. Any suggestions?
has title: Android: efficient way to update ViewPager
type: UnansweredQuestion
upvote count: 1
has answer: http://stackoverflow.com/a/23428267
type: Question
tagged with: refresh

http://stackoverflow.com/comment/35944522
type: QuestionComment
has text: `(MainActivity.java:23)` Which is `23`rd line in `MainActivity`.
score: 4
type: Comment
comment on: http://stackoverflow.com/q/23449470

http://stackoverflow.com/comment/35797552
comment on: http://stackoverflow.com/a/23370456
type: Comment
has text: I will make the client send output each time a key is pressed, if I remove the loop will the thread still read that client output? (at the same connecction, not new)
score: 0
type: AnswerComment

http://stackoverflow.com/q/23430179
type: Question
tagged with: performance
has answer: http://stackoverflow.com/a/35720799
accepted answer: http://stackoverflow.com/a/32525684
tagged with: java
possible better answer: http://stackoverflow.com/a/35720799
answer count: 2
tagged with: jvm
has title: Capture frequency of javacores during workloads
has answer: http://stackoverflow.com/a/32525684
has comment: http://stackoverflow.com/comment/36048383
has body: I often run workloads against my own web applications to try find performance issues. Sometimes I see memory leaks etc at variable duration. So I created a bash script to take javacores, kill -3 pid , every minute for 10 minutes and script is executed on the hour. For a workload that runs for 120 hours, this will produce 1200 javacores. I'm wondering, Is this overkill? I'd like a continuous view of system (javacore every 5 minutes, for 120 hours), but don't want to impact perf what is a reasonable frequency to automatically capture javacores against servlet based app?
type: AnsweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/35913390

http://stackoverflow.com/a/23425024
answers question: http://stackoverflow.com/q/23424996
score: 1
has comment: http://stackoverflow.com/comment/35899038
has comment: http://stackoverflow.com/comment/35899355
downvote count: 0
has body: object.getClass() will give you Object type. But out is of type String so you will get Type mismatch compile type error. After looking your comment If I pass the method Person person then it should use the toString method @Override in Person class. This can be done as below: public String objectToStringConverter(Object object) { String out = object.toString(); return out; } This will call toString method of your Person class.
type: Answer
upvote count: 1

http://stackoverflow.com/a/23393218
score: 0
has comment: http://stackoverflow.com/comment/35839546
has comment: http://stackoverflow.com/comment/35841671
answers question: http://stackoverflow.com/q/23392417
has body: This is the closest I can get you to using Constants in the same file as your enums. public enum Enumtricks { ELEMENT(EnumConstants.DESC); private final String description; private Enumtricks(String description) { this.description = description; } public String value() { return this.description; } private static class EnumConstants { private static final String DESC = "A String"; } }
has comment: http://stackoverflow.com/comment/35840220
type: Answer

http://stackoverflow.com/q/23379900
tagged with: servlets
type: AnsweredQuestion
answer count: 1
downvote count: 0
tagged with: jsp
tagged with: jquery
has comment: http://stackoverflow.com/comment/35815086
favorite count: 0
has body: I am trying to send some query from jsp file to servlet via post method and then get some modified result from servlet to jsp file. I am able to complete first part successfully, but I cannot receive the response in jsp file. Servlet post method is:- protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { JSONObject js = &lt;some method to get json&gt;; System.out.println(js); //works fine response.setContentType("application/json"); response.setCharacterEncoding("UTF-8"); response.getWriter().write(js.toJSONString()); } And my jsp code is: &lt;script&gt; function getData() { $.post("MyServlet", { query : "Wolf of wall street", choice : "M" }, function(response) { alert("hello" + response); }); } &lt;/script&gt; The output is: How can i get that json string ?
type: Question
has answer: http://stackoverflow.com/a/23380007
score: 1
has comment: http://stackoverflow.com/comment/35815164
upvote count: 1
has title: Can't receive response from servlet in Jsp file
tagged with: jakarta-ee
has comment: http://stackoverflow.com/comment/35815130
accepted answer: http://stackoverflow.com/a/23380007
tagged with: java

http://stackoverflow.com/q/23447847
has body: I am trying to deploy the hawtio-default-offline-1.3.1.war (into JBoss EAP 6.2) and I see this message in the logs: 10:16:07,988 WARN [io.hawt.jvm.local.JVMList] (ServerService Thread Pool -- 65) Local JVM discovery disabled as this JVM cannot access com.sun.tools.attach.VirtualMachine due to: com/sun/tools/attach/VirtualMachine So I don't have a local tab when I start up hawtio. Is this OK? This is my local Windows laptop and I am deploying the hawtio WAR alongside my app WAR and I am launching it using the JBoss bat file. I do a jps and I can see the JBoss server running. Appreciate any pointers, thanks!
type: AnsweredQuestion
tagged with: hawtio
tagged with: java
has title: Cannot access com.sun.tools.attach.VirtualMachine
type: Question
has answer: http://stackoverflow.com/a/23453140
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/23453140

http://stackoverflow.com/a/23418700
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23417711
type: Answer
has body: Ok, the problem is you have closed the Hibernate session here: session.close(); When you call getUsers(), the collection of related users is lazily loaded. However, this can only be done within an active Hibernate session (which you don't have). For lazy loading, there is some decent answers from BalusC and Pascal Thivent here: What is lazy loading in Hibernate? It is never a good idea to open and close sessions within a single DAO method. It is always better to do this in the tier above (usually referred to as the business/service tier). Change your DAO class to this: public class UnitsDaoImpl implements UnitsDao { private Session session; public UnitsDaoImpl(final Session session) { this.session = session; } @Override public List&lt;Units&gt; fetchAll() { return session.createQuery("FROM Units").list(); } // Other methods... } Change your calling code to this: Session session = HibernateUtil.getSessionFactory().openSession(); session.beginTransaction(); UnitsDao dao = (UnitsDao)new UnitsDaoImpl(session); List&lt;Units&gt; unity = (List&lt;Units&gt;)dao.fetchAll(); Users user = unity.get(0).getUsers(); System.out.println(user); session.getTransaction().commit(); session.close();
upvote count: 1
accepted answer of: http://stackoverflow.com/q/23417711
score: 1
has comment: http://stackoverflow.com/comment/35888224

http://stackoverflow.com/comment/35893653
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23421769
has text: @AkashG, With the above code you can already send the individual bytes of an `int` one at a time. Are you trying to send one _short_ at a time?
score: 0

http://stackoverflow.com/q/23388221
tagged with: java
tagged with: multithreading
has comment: http://stackoverflow.com/comment/35850983
has comment: http://stackoverflow.com/comment/35833156
has comment: http://stackoverflow.com/comment/35831936
has comment: http://stackoverflow.com/comment/35831733
tagged with: swing
has comment: http://stackoverflow.com/comment/35831411
type: Question
linked to: http://stackoverflow.com/q/1252190
has body: Inside a createAndShowGUI() method called by javax.swing.SwingUtilities.invokeLater like this...: public static void main(String[] args) { javax.swing.SwingUtilities.invokeLater(new Runnable() { public void run() { createAndShowGUI(); } }); } ...I have the following piece of code which launches multiple threads with invokeLater where each threads increments the value of progBar when it is ran: int times = 20; for(int x = 0; x &lt; times; x = x+1) { new Thread("T") { public void run() { try { Thread.sleep(5000); } catch(InterruptedException ex) { Thread.currentThread().interrupt(); } SwingUtilities.invokeLater(new Runnable() { public void run() { progBar.setValue(progBar.getValue()+1); } }); } }.start(); } How can I know where all the threads are finished? If I use a counter inside invokeLater I think I will I run into race conditions.. So what is the right way to do it? Should I use a mutex? Are there some facilities provided by Swing to this purpose? Thanks. I have implemented the code in this way according to http://www.java2s.com/Code/Java/Threads/InvokeExampleSwingandthread.htm
has answer: http://stackoverflow.com/a/23388349
has answer: http://stackoverflow.com/a/23389040
tagged with: invokelater
possible better answer: http://stackoverflow.com/a/23388349
score: 0
answer count: 3
has title: In Java using Swing, how can I know when all threads launched with invokeLater have finished?
has comment: http://stackoverflow.com/comment/35832997
linked to: http://stackoverflow.com/q/8169964
has comment: http://stackoverflow.com/comment/35832697
has comment: http://stackoverflow.com/comment/35831660
has comment: http://stackoverflow.com/comment/35830913
has comment: http://stackoverflow.com/comment/35831604
accepted answer: http://stackoverflow.com/a/23389040
has comment: http://stackoverflow.com/comment/35831758
has comment: http://stackoverflow.com/comment/35832584
has comment: http://stackoverflow.com/comment/35831550
has comment: http://stackoverflow.com/comment/35832413
has comment: http://stackoverflow.com/comment/35832049
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23389032

http://stackoverflow.com/comment/35965111
comment on: http://stackoverflow.com/q/23429046
score: 0
type: Comment
type: QuestionComment
has text: it returns this `Cache-Control: s-maxage=1209600, max-age=1209600` I don't know if it's enough.

http://stackoverflow.com/a/33316928
has body: Please keep in mind that your source(s) folder(s) has to be set correctly. See screenshot to get an idea what I mean..
answers question: http://stackoverflow.com/q/23421325
score: 0
type: Answer

http://stackoverflow.com/comment/35763185
comment on: http://stackoverflow.com/a/23349615
type: Comment
has text: Yes decrypting to a file, then feeding the file to ZipInputStream works fine. I have a feeling it's related to the padding. The encryption method server-side adds some padding at the end if the output length is not a multiple of 16. Maybe that's messing up the operation when trying to do everything via streams?
type: AnswerComment
score: 0

http://stackoverflow.com/comment/35689575
comment on: http://stackoverflow.com/a/23311689
type: Comment
has text: So their is no way for the user to type in "Red" and then just somehow concainate the "RED" onto java.awt.Color? Then create Color using that? Thank you
score: 0
type: AnswerComment

http://stackoverflow.com/a/55118839
has body: Add fx:controller="packagename.FXMLDocumentController" class to the upper most parent in fxml document. For example, in my case I added into top VBox and have all components in child of VBox, that's why everything is working fine with me now.
upvote count: 0
score: -1
answers question: http://stackoverflow.com/q/23293759
type: Answer
downvote count: 1

http://stackoverflow.com/comment/35779464
type: QuestionComment
score: 0
has text: For all the downvotes on my question, could you tell me where I went wrong and how I can avoid it next time?
comment on: http://stackoverflow.com/q/23339015
type: Comment

http://stackoverflow.com/q/23440361
upvote count: 3
has body: I'm trying to record audio, and it needs to be high quality. This code is working fine on a lot of devices, however on some devices like the galaxy s4 mini, moto G, and even the Galaxy s4 and HTC one mini, it will not work. Here is my recording method public class RecordingHandler { private static MediaRecorder recorder; static void beginRecording(String output) throws Exception { ditchMediaRecorder(); File outFile = new File(output); if (outFile.exists()) outFile.delete(); recorder = new MediaRecorder(); recorder.setAudioSource(MediaRecorder.AudioSource.MIC); recorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4); recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB); recorder.setAudioEncoder(MediaRecorder.getAudioSourceMax()); recorder.setAudioEncodingBitRate(16); recorder.setAudioSamplingRate(44100); recorder.setOutputFile(output); recorder.prepare(); recorder.start(); } static void ditchMediaRecorder() { // if we have the recorder, release it if (recorder != null) recorder.release(); } static void stopRecording() { if (recorder != null) { try { recorder.stop(); } catch (RuntimeException stopException) { // handle cleanup here Log.d("Recording Handler", "Runtime Exception"); } } } } The error I'm getting java.lang.RuntimeException: stop failed. at android.media.MediaRecorder.stop(Native Method) at com.appulse.beatbox.RecordingHandler.stopRecording(RecordingHandler.java:34) at com.appulse.beatbox.SoundRecord$5.onTouch(SoundRecord.java:347) at android.view.View.dispatchTouchEvent(View.java:7784) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2216) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1959) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2216) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1959) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2216) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1959) at android.view.ViewGroup.dispatchTran…
tagged with: java
type: Question
has title: mediaRecorder java.langRuntimeException stop failed - recording audio
downvote count: 0
has comment: http://stackoverflow.com/comment/82964210
favorite count: 0
type: UnansweredQuestion
tagged with: android
score: 3
has comment: http://stackoverflow.com/comment/35928156
tagged with: android-mediarecorder
answer count: 0

http://stackoverflow.com/q/23385407
type: AnsweredQuestion
type: Question
has comment: http://stackoverflow.com/comment/35825417
tagged with: java
has comment: http://stackoverflow.com/comment/35825928
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/23385877
accepted answer: http://stackoverflow.com/a/23385877
has title: matcher to avoid words ending with s,ing, or words in the middle
has body: I am trying to match a text against a glossary list. the problem is that my pattern shows different behavour for one text. for example here is my text : \nfor Sprints \nSprints \nSprinting \nAccount Accounts Accounting\nSprintsSprints with the following pattern matcher, I try to only find the exact word matches with glossary,and avoid finding the words ends with s,ing,... it only return me the right answer for "Account" word, but if I try Sprint, then it returns me Sprints, Sprinting, etc which is not right: Pattern findTerm = Pattern.compile("(" + item.getTerm() + ")(\\W)",Pattern.DOTALL); and here is my code : private static String findGlossaryTerms(String response, List&lt;Glossary&gt; glossary) { StringBuilder builder = new StringBuilder(); for (int offset = 0; offset &lt; response.length(); offset++) { boolean match = false; if (response.startsWith("&lt;", offset)) { String newString = response.substring(offset); Pattern findHtmlTag = Pattern.compile("\\&lt;.*?\\&gt;"); Matcher matcher = findHtmlTag.matcher(newString); if (matcher.find()) { String htmlTag = matcher.group(0); builder.append(htmlTag); offset += htmlTag.length() - 1; match = true; } } for (Glossary item : glossary) { if (response.startsWith(item.getTerm(), offset)) { String textFromOffset = response.substring(offset - 1); Pattern findTerm = Pattern.compile("(" + item.getTerm() + ")(\\W)",Pattern.DOTALL); Matcher matcher = findTerm.matcher(textFromOffset); if (matcher.find()) { builder.append("&lt;span class=\"term\"&gt;").append(item.getTerm()).append("&lt;/span&gt;"); offset += item.getTerm().length() - 1; match = true; break; } } if (!match) builder.append(response.charAt(offset)); } return builder.toString(); }
tagged with: regex

http://stackoverflow.com/q/23378067
has comment: http://stackoverflow.com/comment/35811825
score: 1
tagged with: java
has title: Objects Oriented Design for Two Classes with the same Fields in Java
accepted answer: http://stackoverflow.com/a/23378232
type: Question
downvote count: 0
has comment: http://stackoverflow.com/comment/35811822
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/23378232
tagged with: business-logic
has body: I have two classes called ShoppingCart and StoreInventory. These are used in a convenience store system, which involves the business domain of retail. They both contain a List products field. However, only the ShoppingCart should be able to calculate its own totalCost of all products in the list. Also, these two are suspiciously ENTIRELY different objects but have the same fields (addendum : and METHODS, except ShoppingCart can calculate its total value). What are the best ways thru interfaces and inheritance can this be solved?
upvote count: 1
type: AnsweredQuestion
tagged with: object
tagged with: code-analysis

http://stackoverflow.com/q/23445831
type: Question
has comment: http://stackoverflow.com/comment/35937513
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/35937521
has title: Residual 'x' in preparedStatement
has body: I am trying to write a class handling database interaction with a mysql server. To do this i utilize 'mysql-connector-java-5.1.30.jar'. I came across this behavior and am uncertain if I am making a mistake or found a bug. The tested statement reads like this: "INSERT INTO test.database.EncryptedClass (eMail) VALUES (?);" I insert an encrypted value in byte[] form. statement.setBytes(iterator, encryptedValue); // (iterator = 1) The result is the following error: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '.EncryptedClass (eMail) VALUES (x'63EEAAA2F3CE444C9F1256FA8052F287CD96D67D29E2EB' at line 1 As you can see, there is an x in front of the actual value. I believe that is the variable which is supposed to be replaced by the actual value, but for some unknown reason, this fails, and instead, the value is appended. If this is a bug, does it lie with the connector library or with the server itself. I know this much: the values are actually infused in the database, but I am uncertain as to whether the value is already transmitted false, or if the database function replacing '?' with the value fails at doing so.
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23446027
tagged with: java
tagged with: mysql
tagged with: prepared-statement

http://stackoverflow.com/q/23409517
type: Question
has answer: http://stackoverflow.com/a/23410176
downvote count: 0
favorite count: 0
answer count: 1
type: UnansweredQuestion
upvote count: 1
has comment: http://stackoverflow.com/comment/35871921
tagged with: jakarta-ee
has comment: http://stackoverflow.com/comment/35871920
score: 1
has body: In my application, there are many objects in session. Therefore, the size of the HttpSession is high for each user who access my application(It is a Employee information management system). I tried to reduce the objects in session and some time, used the HttpRequest. How ever still session caries many objects which results that the JVM memory usage is high and slow the server. Therefore I need to reduce the session size. Any solution for this ? Should I add another server and balance the load or upgrade the RAM size of the PC or JVM memory upgrade (If I upgrade so, what will happen in future when more users than now use the system, then again should I have to upgrade the memory?) ? My supposed solution is to add those object into a caching server which runs in separate server(separate PC) instead of the session. Please let me know your ideas.
tagged with: session
tagged with: java
has title: how to reduce usage of HttpSession

http://stackoverflow.com/comment/35918441
type: Comment
type: QuestionComment
has text: Yes, I did call the .start() method
comment on: http://stackoverflow.com/q/23435427
score: 0

http://stackoverflow.com/comment/35697198
comment on: http://stackoverflow.com/a/23312822
has text: Yes, I debugged it and setStyleClass is invoked. The log includes the messages from the code.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/35689519
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23311653
score: 0
has text: but I wont get each operand seperately

http://stackoverflow.com/q/23323648
tagged with: c++
has title: Write byte[] passed through jbytearray to a file
downvote count: 1
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23324023
has body: I need to write into a file a byte array that i pass to a function in C++ using jni. That's my Java code private void writeData(byte[] array) { Native nativeobject = new Native(); long tsize = this.size; long incremental = 0; while(tsize != 0 &amp;&amp; !this.stopped) { nativeobject.writeFile(whereToSave, array); publishProgress(incremental); incremental += TRANCE_SIZE; tsize -= TRANCE_SIZE; } } And that's my function header JNIEXPORT jbyteArray JNICALL Java_it_mls_secureeraser_algorithms_Native_writeFile(JNIEnv *jni, jobject thiz, jstring jfileName, jbyteArray jarray) { const char *fileName = jni-&gt;GetStringUTFChars(jfileName, 0); int len = jni-&gt;GetArrayLength (jarray); unsigned char* buf = new unsigned char[len]; jni-&gt;GetByteArrayRegion (jarray, 0, len, reinterpret_cast&lt;jbyte*&gt;(buf)); FILE *output = fopen(fileName, "a+"); fwrite(buf, sizeof(unsigned char*), sizeof(buf), output); fclose (output); } how can I pass from jbytearray to something that I can write to my file? Thanks for help
tagged with: java-native-interface
tagged with: java
score: -1
linked to: http://stackoverflow.com/q/16667029
tagged with: android-ndk
type: Question
upvote count: 0
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/23324023
tagged with: android

http://stackoverflow.com/a/23329962
answers question: http://stackoverflow.com/q/23329904
downvote count: 0
has comment: http://stackoverflow.com/comment/35723602
type: Answer
has body: This question is based on a misunderstanding. But, what about the Object class? Say you have an object A that inherits from the Object class. Now, you create a class B that inherits from the A class. But, with every class inheriting the Object class, isn't B exhibiting multiple inheritance by both inheriting from Object and A? The misunderstanding is here - "with every class inheriting the Object class" In fact, an class only (implicitly) extends Object if it does not explicitly extend another class. Object is the ultimate superclass of every class, but it is not a direct superclass of every class. The Java class hierarchy is a tree, with Object at the top.
upvote count: 3
score: 3
accepted answer of: http://stackoverflow.com/q/23329904
type: AcceptedAnswer

http://stackoverflow.com/a/23424546
type: Answer
score: 7
upvote count: 7
answers question: http://stackoverflow.com/q/23424348
has comment: http://stackoverflow.com/comment/35898830
has comment: http://stackoverflow.com/comment/35899016
has comment: http://stackoverflow.com/comment/35901358
has body: You can cast your byte array to an array of a type that matches the bit-depth of your recorded audio in its size. For example for 16-bit audio, you can use short, since it holds a 16-bit signed integer value. For 8-bit you can just use the byte array without casting. Then, simply, the largest "number" in the array (you would probably want to take the absolute value) will be the sample with the highest amplitude value.
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23424348

http://stackoverflow.com/comment/35895666
type: AnswerComment
score: 0
type: Comment
has text: Thanks but is there any way I can do it without StringTokenizer, don't think we are allowed to use stuff that we haven't studied so far.
comment on: http://stackoverflow.com/a/23423034

http
tags question: http://stackoverflow.com/q/23383728
tags question: http://stackoverflow.com/q/23421359
tags question: http://stackoverflow.com/q/23425216
tags question: http://stackoverflow.com/q/23413490
tags question: http://stackoverflow.com/q/23322250
tags question: http://stackoverflow.com/q/23445493
tags question: http://stackoverflow.com/q/23377272
tags question: http://stackoverflow.com/q/23292014
tag name: http
tags question: http://stackoverflow.com/q/23447459
tags question: http://stackoverflow.com/q/23361894
tags question: http://stackoverflow.com/q/23439755
tags question: http://stackoverflow.com/q/23325389
tags question: http://stackoverflow.com/q/23333434
tags question: http://stackoverflow.com/q/23442872
tags question: http://stackoverflow.com/q/23421673
type: Tag
tags question: http://stackoverflow.com/q/23405580
tags question: http://stackoverflow.com/q/23310585
tags question: http://stackoverflow.com/q/23307707
tags question: http://stackoverflow.com/q/23391889
tags question: http://stackoverflow.com/q/23330107
tags question: http://stackoverflow.com/q/23330341

http://stackoverflow.com/comment/35928315
comment on: http://stackoverflow.com/a/23440286
type: Comment
has text: inside the Quote class, where you have the variables declared, can u create getter and setter methods? then use the setter method to set the value and getter method to get the value. if it doesnt work then may be you could try the hashmap though i am not sure why its needed.
score: 0
type: AnswerComment

http://stackoverflow.com/q/23348730
score: 0
tagged with: dbpedia
linked to: http://stackoverflow.com/q/16737653
tagged with: sparql
accepted answer: http://stackoverflow.com/a/23348906
has comment: http://stackoverflow.com/comment/35757455
has title: SPARQL query against Portuguese dbpedia endpoint for dcterms:subject returns no results
type: Question
has body: I tested that query: SELECT ?comment WHERE {&lt;http://pt.dbpedia.org/resource/Portugal&gt; dcterms:subject ?comment} at http://pt.dbpedia.org/sparql and I get the correct result: http://pt.dbpedia.org/resource/Categoria:Portugal But I'm using Jena and when I try to do that query with Jena I get no results. That's the way I'm doing the query with Jena: private String getComment(String uri) { RDFNode node; String comment = ""; final String QUERY = "PREFIX rdf: &lt;http://www.w3.org/1999/02/22-rdf-syntax-ns#&gt;\n" + "PREFIX dcterms: &lt;http://purl.org/dc/terms/subject&gt;\n" + "SELECT ?comment WHERE {" + "&lt;" + uri + "&gt; dcterms:subject ?comment." + "}"; final String ENDPOINT = "http://pt.dbpedia.org/sparql"; final ResultSet rs = QueryExecutionFactory.sparqlService( ENDPOINT, QUERY ).execSelect(); while( rs.hasNext() ) { QuerySolution querySolution = rs.next(); node = querySolution.get("comment"); comment = node.toString(); } return comment; } Is there anything wrong? Thank you!
has comment: http://stackoverflow.com/comment/35758050
type: AnsweredQuestion
tagged with: jena
tagged with: java
has comment: http://stackoverflow.com/comment/35757854
has answer: http://stackoverflow.com/a/23348906
answer count: 1
has comment: http://stackoverflow.com/comment/35757497
tagged with: dublin-core

http://stackoverflow.com/q/23317815
tagged with: java
type: Question
tagged with: cloud
answer count: 1
accepted answer: http://stackoverflow.com/a/23345603
score: 0
has title: is it possible to get a list of all database servers that are available in the openstack cloud using jclouds?
tagged with: jclouds
tagged with: openstack
has body: i have successfully deployed an openstack cloud. i have installed mongodb server and mysql server in two virtual machines. how can I get a list of all database servers that are available using jclouds ?
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23345603

http://stackoverflow.com/comment/35921469
type: QuestionComment
has text: `str(articleTitle)` *also* includes an implicit encode. Django on the other hand can encode Unicode to a browser page just fine. That all works. What headers does Django send to the browser? Specifically, what is the `Content-Type` header? Is there a ` ` tag in the page that tells the browser what content type to use?
comment on: http://stackoverflow.com/q/23436818
score: 0
type: Comment

http://stackoverflow.com/comment/35672799
comment on: http://stackoverflow.com/q/23301364
type: QuestionComment
has text: Don't use setPreferredSize() on the scroll pane either. There is no need to do this. You created the JTextArea by specifying the rows/column. That will be the preferred size of the text area.
type: Comment
score: 0

http://stackoverflow.com/comment/35725036
score: 0
has text: You might be right. Anyway idea stays the same (actually, it should be checked from the back, but I wanted to stay to OP implementation as close as possible).
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23330806

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

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

http://stackoverflow.com/q/23348114
answer count: 1
tagged with: http://stackoverflow.com/tag/xml
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23348904
tagged with: java
tagged with: solr
has body: Good Afternoon. I'm pretty new in Sorl. I need index a lot of XML files from WS comunication request/response and more generic information like a "template", that template have by example the service invoked, operation, time consumed and so on. I maked a a few test with indexs in Solr and I advertise two strategies for index all this data. One solution will be save all the XML of the request and the response, in two fields of the document in the index of Solr. The other one will be make a transformation of the request and the response, and extract the data that will be important for Us, and populate the index with that info in a few fields of interest. I will put a small example of the first alternative, Save all XML as a field Index Schema Index Data ID:10.250.2.31-1456089599e-12:13722 SocioUnificado v1 getSocioCompleto testesb.osde.ar http://testesb.osde.ar/ESB/jbi/Socio/ 450 ESB_SUPPORT FLUX 2014-04-11T08:45:56Z false false <getXX> 20120813 234 01 <getXXResponse> <client> <contract> 11 CALIFORNIA LA 35 BIG BUILDING 2 ... And a lot of more XML DATA ... The second alternative pre process XML before save Index Schema Index Data ID:10 service1 v1 getXX server1 http://server1/ESB/service1/ 450 ESB_SUPPORT ODOR 2014-04-11T08:45:56Z false false 20120813 610 01 I whant know what are yours opinion about this strategies? and if you know another that fit better in this use case? I can say that the data of a request/response of ours service can be pretty long (like 120 lines of XML in avg), and we have in global more than 300 services. We have services that are consumed in production 80.000 request per day. Finally, I can say that all information in the request/response have diferent structure for each operation of each service (all heterogenuos data). Thanks in advance.
type: Question
has comment: http://stackoverflow.com/comment/35757509
tagged with: lucene
has comment: http://stackoverflow.com/comment/35756443
has title: Solr Indexing XML strategies. Save all XML as a field vs pre process XML before save
score: 0

http://stackoverflow.com/q/23447558
tagged with: eclipse
type: Question
upvote count: 0
answer count: 1
tagged with: awt
favorite count: 0
has title: Has anyone imported DrawingPanel.java to Eclipse?
has body: I'm working on a computer science graphics project that requires that I use drawingpanel.java. I'm new to this and the explanations that I've seen that are even remotely close to this make no sense to me. The code is presented in this form so I need to get it to work this way. import java.awt.*; // so I can use Graphics public class OutlineExample{ public static void main(String[] args) { DrawingPanelpanel = new DrawingPanel(150, 70); Graphics g = panel.getGraphics(); } } I'm told that I have to "import" drawingpanel.java into my project somehow. I've tried file -> import -> general -> filesystem but what happens makes no sense to me. I also saw a post somewhere that said it might work to zip drawingpanel.java and rename it to .jar and then import it somehow. I got nowhere with that. Then I tried loading drawingpanel.java into its own project but then what? Guess I need some step by step.....first push this button, select that file....push this button...type of instructions. No leaps of logic. I'm too dense at this point. Any help would be appreciated.
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35940761
downvote count: 1
tagged with: java
has answer: http://stackoverflow.com/a/23447697
score: -1

http://stackoverflow.com/comment/35796985
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23369774
has text: You don't need the second thread in your Background class, just call the paint method of your background class from your main game thread.

http://stackoverflow.com/comment/35743654
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23340833
type: QuestionComment
has text: I got @sreemanthpulagam...

http://stackoverflow.com/comment/35799166
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23371166
has text: Because the valueOf() will get the int value of a String, and the parseInt will try to convert a string to int if your string is like this "123bla" parseInt will give you an error, thats why you need to use try and catch

http://stackoverflow.com/comment/35720265
score: 0
has text: @ambarox uname is not null in the code...
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23328111

http://stackoverflow.com/a/23428268
answers question: http://stackoverflow.com/q/23428073
has body: Your algorithm to add at the end looks fine at first glance so you should check that it isn't working right. For the other problem though it's simple as if the list is empty then head is null. That means SListNode current=head; sets current to null, which then fails as soon as you try and access current.
upvote count: 2
score: 2
has comment: http://stackoverflow.com/comment/35904983
has comment: http://stackoverflow.com/comment/35905138
downvote count: 0
type: Answer

http://stackoverflow.com/q/23360153
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35788889
has comment: http://stackoverflow.com/comment/35778291
tagged with: java
has comment: http://stackoverflow.com/comment/35778781
has comment: http://stackoverflow.com/comment/35778605
has comment: http://stackoverflow.com/comment/35780068
has comment: http://stackoverflow.com/comment/35793064
has comment: http://stackoverflow.com/comment/35781850
type: Question
has comment: http://stackoverflow.com/comment/35782856
has comment: http://stackoverflow.com/comment/35782625
has body: I have a servlet that upload file to my server in webcontent\Upload folder. But when I try to reach for example dmbtest.gif in that file like this : localhost:8080/Upload/dmbtest.gif it doesn't work. I can't get image. Should I use get method of that servlet to show images?
has comment: http://stackoverflow.com/comment/35778340
tagged with: jsp
has comment: http://stackoverflow.com/comment/35778285
has comment: http://stackoverflow.com/comment/35778170
score: 0
linked to: http://stackoverflow.com/q/19139426
has title: Java EE How can I get uploaded files

http://stackoverflow.com/a/23294493
answers question: http://stackoverflow.com/q/23294393
score: 0
has body: Try out as below: private boolean value =getIntent().getBoolean("load");
type: Answer

http://stackoverflow.com/comment/35877794
has text: This is in the project I want to use and no where else this is mentioned
comment on: http://stackoverflow.com/q/23413498
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23424742
score: 0
accepted answer: http://stackoverflow.com/a/23424893
has comment: http://stackoverflow.com/comment/35898579
has comment: http://stackoverflow.com/comment/35898591
has body: I have string in java but not understand how to split these type of string using. I have only arithmetic and logical operator . char[] operators = new char[] { '\\', 'x', '+', '-', '&gt;', '*','&lt;', '=' }; String str_spit="usa_newyork=japan\london*44+jhon&lt;last-987"; Actual String - > String a= QN_770_0=QN_770_0\10 and String b= QN_770_0&gt;66 My Code: ArrayList &lt;String&gt; logics; ArrayList &lt;String&gt; logicQuestions = null; char[] operators = new char[] { '\\', 'x', '+', '-', '&gt;', '&lt;', '=' }; String str_spit="QN_770_0=QN_770_0\10"; for ( jj = 0; jj &lt; operators.length; jj++) { System.out.println("operators.toString()----&gt;"+operators[jj]); //String[] questions = logicText.split(operators); String s = "" + operators[jj]; String[] questions=str_spit.split(s); System.out.println("questions questions----&gt;"+questions); //for each segment, save all question codes. for (int j = 0; j &lt; questions.length; j++) { String question = questions[j]; System.out.println("questions questions---question-&gt;"+questions); if (question.startsWith("QN_") &amp;&amp; !logicQuestions.contains(question)) logicQuestions.add(question); System.out.println("logicQuestions---logicQuestions-&gt;"+logicQuestions); } } Error: operators.toString()----&gt;\ Exception in thread "main" java.util.regex.PatternSyntaxException: Unexpected internal error near index 1 \ ^
possible better answer: http://stackoverflow.com/a/23424946
has answer: http://stackoverflow.com/a/23424946
has title: How to split multiple operator in string in java
linked to: http://stackoverflow.com/q/5993779
has comment: http://stackoverflow.com/comment/35898670
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/23424893
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/35898671

http://stackoverflow.com/comment/35788560
score: 1
comment on: http://stackoverflow.com/q/23364323
type: Comment
type: QuestionComment
has text: can you put activity_main.xml?

http://stackoverflow.com/a/23372783
has comment: http://stackoverflow.com/comment/35802328
answers question: http://stackoverflow.com/q/23372710
score: 0
type: Answer
has body: You could write it like this: ArrayList&lt;String&gt; namesList=new ArrayList&lt;String&gt;(Arrays.asList(arrayNames));

http://stackoverflow.com/q/23380625
answer count: 4
type: AnsweredQuestion
tagged with: oop
has body: I have this: public interface IDongle { public abstract boolean connect(); } public abstract class DongleManager { private boolean connected = false; public void setConnected(boolean status) { connected = status; } public boolean getConnected() { return connected; } } public class SimulatedDongle extends DongleManager implements IDongle { { @Override public boolean connect() { // ... return true; } } public class RealDongle extends DongleManager implements IDongle { { @Override public boolean connect() { // ... return true; } } How should I create a instance of SimulatedDongle which I can access all of its methods? e.g DongleManager dongle = new DongleSimulator(); dongle.getConnected(); dongle.connect(); // Erorr!! or IDongle dongle = new DongleSimulator(); dongle.getConnected(); // Error!! dongle.connect();
tagged with: java
has answer: http://stackoverflow.com/a/23380764
type: Question
has answer: http://stackoverflow.com/a/23380692
has answer: http://stackoverflow.com/a/23380691
score: 0
possible better answer: http://stackoverflow.com/a/23380691
accepted answer: http://stackoverflow.com/a/23380764
has title: How can I access a method of inherited and sub-classed object
has answer: http://stackoverflow.com/a/23381211
tagged with: interface

http://stackoverflow.com/q/23350167
tagged with: java
has body: I want to test a method of a class. For that I need to mock another method of the class, which is been called from the constructor. Also I've to pass mocked object to the constructor. When I'm not using withConstructor, it is picking addMockedMethod correctly. But whenever I'm using withConstructor, it is not using the method passed in addMockedMethod anymore. (getting the exception for the following code) Is there anything I can do here to solve this? Following is the code Main Class: public class A { B b; C c; public A (B _b) { b = _b; c = getC(); } public void run (String _val) { String val = b.getValue(); //do something } public static C getC() { StaticD.getC(); } } public class StaticD { public static C getC() { throw new RuntimeException("error"); } } Test Class: @Test(testName = "ATest") public class ATest extends EasyMockSupport { public void testRun() { B bMock = createMock(B.class); expect(bMock.getValue()).andReturn("test"); replayAll(); A obj = createMockBuilder(A.class). addMockedMethod("getC"). withConstructor(bMock). createMock(); obj.run(); verifyAll(); resetAll(); }
accepted answer: http://stackoverflow.com/a/23364434
type: Question
tagged with: easymock
score: 0
answer count: 1
has title: EasyMock with withConstructor ignoring addMockedMethod called within constructor
has answer: http://stackoverflow.com/a/23364434
type: AnsweredQuestion

http://stackoverflow.com/comment/35694053
has text: @LuiggiMendoza can you pls point out to tht line!!!i mean am really lost with these errors
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23314059

http://stackoverflow.com/a/23303105
type: Answer
score: 0
has comment: http://stackoverflow.com/comment/35674372
has comment: http://stackoverflow.com/comment/35674510
has body: I can't say what your interviewer had in mind, but an interface is more of a "contract" whereas an abstract base class, while it can play that role too, is more geared towards hierarchies or IS-A relationships. E.g. an Apple IS-A Fruit, a Pear IS-A Fruit, etc. But you're right, they could well be used interchangeably for practical purposes in that context, but an OO purist might not want to use an abstract class unless they were expressing IS-A relationship(s).
answers question: http://stackoverflow.com/q/23302920

http://stackoverflow.com/a/23341427
accepted answer of: http://stackoverflow.com/q/23328448
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23328448
has comment: http://stackoverflow.com/comment/36184372
score: 0
has body: There are a lot of approaches you could take, but here is the one I'd recommend for maximum cleanliness and clarity of the code on each side. I'm assuming success and failure are strings, but the transformation is straightforward if they are something else. On the Java side, make your API: public class StuffExecutor { public abstract static class Listener { public abstract void success(String result); public abstract void failure(String reason); } private void stuff(Listener listener) { try { String result = doIt(); listener.success(result); } catch (Throwable t) { listener.failure(t.getMessage()); } } public void execute(final Listener listener) { new Thread(new Runnable() { public void run() { stuff(listener); } }).start(); } } Now on the JavaScript side: function hello() { var x = 42; // notice the closure over x in the success handler stuffExecutor.execute(new JavaAdapter(Packages.my.package.StuffExecutor.Listener, { success: function (result) { println("Success: " + (result + x)); }, failure: function (reason) { println("Failure: " + reason; } })); println("Starting to execute stuff..."); } Like I said, other approaches could work. You could pass functions directly to your Java API (they will appear as org.mozilla.javascript.Callable) but then your Java syntax for invoking them gets a lot more complex and messy. Note that there was a bug in JavaAdapter in the 1.7R4 release (which has caused many people to clamor for a 1.7R5 that has not come). This should work with any other release of Rhino or with the current master on GitHub. Note that result and reason would be java.lang.String objects in this scenario, not native JavaScript strings. In your code it would make no difference but if you needed to use them later as JavaScript strings you'd probably want to convert them using String(result) and String(failure).
type: Answer
has comment: http://stackoverflow.com/comment/36175303
has comment: http://stackoverflow.com/comment/35773011
has comment: http://stackoverflow.com/comment/35772212
has comment: http://stackoverflow.com/comment/35772157
has comment: http://stackoverflow.com/comment/36171747
has comment: http://stackoverflow.com/comment/35781289

http://stackoverflow.com/q/23446710
type: Question
score: -2
tagged with: java
has title: How does throws work at Java?
has answer: http://stackoverflow.com/a/23446733
has answer: http://stackoverflow.com/a/23446741
downvote count: 4
has answer: http://stackoverflow.com/a/23446757
has comment: http://stackoverflow.com/comment/35939141
favorite count: 0
has comment: http://stackoverflow.com/comment/35939158
has answer: http://stackoverflow.com/a/23447496
type: UnansweredQuestion
has body: I have been using catch and now I have to use throw. This is what I 've been given and I can't figure out what's missing so that it will work. public static void main(String args[]){ Exception_Tester et = new Exception_Tester(); int x1; int x2; x1=5; x2=0; et.printResults(x1,x2); } static void printResults(int a, int b) throws ArithmeticException { System.out.println("Add: "+(a+b)); System.out.println("Sub: "+(a-b)); System.out.println("Mul: "+(a*b)); System.out.println("Div: "+(a/b)); }
answer count: 4
upvote count: 2
has comment: http://stackoverflow.com/comment/35939787
tagged with: throws
has comment: http://stackoverflow.com/comment/35939125

http://stackoverflow.com/q/23314356
tagged with: automation
answer count: 1
score: 0
has answer: http://stackoverflow.com/a/23316566
has body: I have a small company and I want all the work to be professional, I was thinking if there is a way to scan the contract (signed) and I fill the name of the customer, phone number, address and day's date in some interface then I print the contract signed with all info I entered (every info has specific location in the contract). is this possible? what would be the best way to do it. p.s. I'm a beginner java programmer
type: UnansweredQuestion
has title: any ideas about how to program an automated signed contract
tagged with: java
type: Question

http://stackoverflow.com/a/23367818
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/35793827
downvote count: 0
has comment: http://stackoverflow.com/comment/35793615
has comment: http://stackoverflow.com/comment/35792686
answers question: http://stackoverflow.com/q/23367647
upvote count: 2
has body: You're adding stuff to the JFrame after it's already visible. If you do that, you need to revalidate your JFrame so it knows to redo its layout. You could also just wait to show your JFrame until after you've added everything. Edit: Here is an example program that shows what I'm talking about. Try running this, then take out the call to revalidate() to see the difference. 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; public class Test { public static void main(String[] args) { final JFrame frame = new JFrame("Test"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); final JButton show = new JButton("Show"); show.addActionListener(new ActionListener(){ @Override public void actionPerformed(ActionEvent showE) { frame.add(new JLabel("Test"), BorderLayout.SOUTH); frame.revalidate(); //tell the JFrame to redo its layout! } }); frame.add(show); frame.setSize(200, 200); frame.setVisible(true); } }

http://stackoverflow.com/q/23346425
has title: How to fix blinking/flashing
has comment: http://stackoverflow.com/comment/35758879
type: AnsweredQuestion
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/23346668
upvote count: 1
tagged with: swing
type: Question
tagged with: graphics
has answer: http://stackoverflow.com/a/23346668
answer count: 1
downvote count: 0
has body: Simple program that counts every time you click, however the image seems to blink/flash when clicked too fast. import java.awt.*; import java.awt.event.*; import java.awt.Graphics; import javax.swing.*; import java.lang.Object; import java.net.URL; import java.lang.String; import java.awt.Font; public class Spaceship extends Canvas { private Font font1; int myX = 100; int myY = 400; int count = 0; These are the 2 images that flash, the images used shouldn't matter though. Image img1 = Toolkit.getDefaultToolkit ().getImage ("spaceship.jpg"); Image img2 = Toolkit.getDefaultToolkit ().getImage ("background.jpg"); public Spaceship () { setSize (new Dimension (1272, 960)); addMouseListener (new MouseAdapter () { public void mousePressed (MouseEvent evt) { moveIt (evt); count = count + 1; } } ); } public void moveIt (MouseEvent evt) { myY = evt.getY () - 100; myX = evt.getX () - 150; update (); } public void update () { repaint (); } I assume this issue is in here somewhere but not really sure how to fix it. public void paint (Graphics g) { font1 = new Font ("Serif", Font.BOLD, 36); g.drawImage (img2, 0, 0, this); g.drawImage (img1, myX, myY, this); g.drawRect (1000, 0, 272, 96); g.drawRect (1000, 96, 272, 192); g.drawRect (1000, 192, 272, 288); g.drawRect (1000, 288, 272, 384); g.drawRect (1000, 384, 272, 480); g.drawRect (1000, 480, 272, 576); g.drawRect (1000, 576, 272, 672); g.drawRect (1000, 672, 272, 768); g.drawRect (1000, 768, 272, 864); g.drawRect (1000, 864, 272, 960); g.setFont (font1); g.drawString (Integer.toString (count), 500, 100); } public static void main (String[] args) { JFrame frame = new JFrame ("Basic Game"); frame.setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE); Spaceship ex = new Spaceship (); frame.getContentPane ().add (ex); frame.pack (); frame.setResizable (false); frame.setVisible (true); ex.requestFocus (); } } What is it exactly that I'm doing wrong?
favorite count: 0

maven
tags question: http://stackoverflow.com/q/23386234
tags question: http://stackoverflow.com/q/23328489
tags question: http://stackoverflow.com/q/23321046
tags question: http://stackoverflow.com/q/23301879
tags question: http://stackoverflow.com/q/23441433
tags question: http://stackoverflow.com/q/23374169
type: Tag
tags question: http://stackoverflow.com/q/23396169
tags question: http://stackoverflow.com/q/23335916
tags question: http://stackoverflow.com/q/23446184
tags question: http://stackoverflow.com/q/23410523
tags question: http://stackoverflow.com/q/23327920
tags question: http://stackoverflow.com/q/23306554
tags question: http://stackoverflow.com/q/23384357
tags question: http://stackoverflow.com/q/23448209
tags question: http://stackoverflow.com/q/23434187
tags question: http://stackoverflow.com/q/23409130
tags question: http://stackoverflow.com/q/23380808
tags question: http://stackoverflow.com/q/23330492
tags question: http://stackoverflow.com/q/23450402
tags question: http://stackoverflow.com/q/23344695
tags question: http://stackoverflow.com/q/23413094
tags question: http://stackoverflow.com/q/23298862
tags question: http://stackoverflow.com/q/23420089
tags question: http://stackoverflow.com/q/23337606
tags question: http://stackoverflow.com/q/23421699
tags question: http://stackoverflow.com/q/23293852
tags question: http://stackoverflow.com/q/23342562
tags question: http://stackoverflow.com/q/23368355
tags question: http://stackoverflow.com/q/23412427
tags question: http://stackoverflow.com/q/23378451
tags question: http://stackoverflow.com/q/23294165
tags question: http://stackoverflow.com/q/23415387
tags question: http://stackoverflow.com/q/23451175
tags question: http://stackoverflow.com/q/23293742
tags question: http://stackoverflow.com/q/23432651
tags question: http://stackoverflow.com/q/23381514
tags question: http://stackoverflow.com/q/23356056
tags question: http://stackoverflow.com/q/23425860
tags question: http://stackoverflow.com/q/23341261
tags question: http://stackoverflow.com/q/23411219
tags question: http://stackoverflow.com/q/23343918
tags question: http://stackoverflow.com/q/23399994
tags question: http://stackoverflow.com/q/23339153
tags question: http://stackoverflow.com/q/23360975
tags question: http://stackoverflow.com/q/23387616
tags question: http://stackoverflow.com/q/23358957
tags question: http://stackoverflow.com/q/23407285
tags question: http://stackoverflow.com/q/23394716
tags question: http://stackoverflow.com/q/23397376
tags question: http://stackoverflow.com/q/23420268
tags question: http://stackoverflow.com/q/23336329
tags question: http://stackoverflow.com/q/23379780
tags question: http://stackoverflow.com/q/23399110
tags question: http://stackoverflow.com/q/23413498
tags question: http://stackoverflow.com/q/23323413
tags question: http://stackoverflow.com/q/23415268
tags question: http://stackoverflow.com/q/23410495
tags question: http://stackoverflow.com/q/23423552
tags question: http://stackoverflow.com/q/23322984
tags question: http://stackoverflow.com/q/23398970
tags question: http://stackoverflow.com/q/23402914
tags question: http://stackoverflow.com/q/23408937
tags question: http://stackoverflow.com/q/23296757
tags question: http://stackoverflow.com/q/23424421
tags question: http://stackoverflow.com/q/23409142
tags question: http://stackoverflow.com/q/23350176
tags question: http://stackoverflow.com/q/23394542
tags question: http://stackoverflow.com/q/23395314
tags question: http://stackoverflow.com/q/23314348
tags question: http://stackoverflow.com/q/23316843
tags question: http://stackoverflow.com/q/23337678
tags question: http://stackoverflow.com/q/23434537
tags question: http://stackoverflow.com/q/23310474
tags question: http://stackoverflow.com/q/23414142
tags question: http://stackoverflow.com/q/23354067
tags question: http://stackoverflow.com/q/23396740
tags question: http://stackoverflow.com/q/23386274
tags question: http://stackoverflow.com/q/23312016
tags question: http://stackoverflow.com/q/23422005

http://stackoverflow.com/a/23323096
type: Answer
answers question: http://stackoverflow.com/q/23323061
has comment: http://stackoverflow.com/comment/35710976
score: 0
has body: Maybe the singleton pattern or an extension of this pattern could be what you need? The objects (instances from Class1 or Class2) would access Main.getInstance() to receive the/an instance of the Main class (the singleton pattern can be extended in order to support only a limited amount of instances instead of just exactly one).

http://stackoverflow.com/a/23308127
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23307977
answers question: http://stackoverflow.com/q/23307977
type: Answer
has comment: http://stackoverflow.com/comment/35683519
has body: Your first mapping uses cascade = ALL. That means that every operation you make on a TrainingCourse (persist, merge, remove, etc.) will also be applied on the associated TrainingClass. That's precisely what you don't want, if I understand correctly. So just don't set any cascade to this association. Regarding OneToMany vs. ManyToMany: if what you really want is a OneToMany (i.e. a TraningClass should not be associated with more than one TrainingCourse), then you should have a unique contraint on the TrainingCourseClass.ClassID column. That's what guarantees that the association is a OneToMany and not a ManyToMany.
has comment: http://stackoverflow.com/comment/35683401
has comment: http://stackoverflow.com/comment/35683560
has comment: http://stackoverflow.com/comment/35683302
score: 0

http://stackoverflow.com/q/23414137
has body: I'm studying about the structure of text components in Swing programs. As far as I understand, JTextComponent is essentially divided into a view and a model. The model is an instance of a class implementing Document, containing all of the text and offering ways to manipulate it, and the View presenting the text visually. However I don't understand exactly where, how and why an EditorKit is used. I'm not sure if it encapsulates ('owns') the model (Document), or if the Document encapsulates it. And not sure where the view fits inside all of this. So two questions: 1- Please describe the relations between the view, Document and EditorKit in JTextComponents. What encapsulates what, what interacts with what, and why? 2- Please explain the functionality and role of EditorKit. Thank you for your help
linked to: http://stackoverflow.com/q/12770485
type: Question
answer count: 3
has answer: http://stackoverflow.com/a/23421747
tagged with: swing
tagged with: text
linked to: http://stackoverflow.com/q/3066590
linked to: http://stackoverflow.com/q/8523445
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/23414256
accepted answer: http://stackoverflow.com/a/23421747
linked to: http://stackoverflow.com/q/10159469
downvote count: 0
possible better answer: http://stackoverflow.com/a/23420145
has answer: http://stackoverflow.com/a/23420145
type: AnsweredQuestion
score: 3
tagged with: user-interface
has title: What are EditorKits in JTextComponents and what is their job?
favorite count: 0

http://stackoverflow.com/comment/35720303
type: Comment
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/23328331
has text: ma y we see your code ;)

jinternalframe
tags question: http://stackoverflow.com/q/23293848
tag name: jinternalframe
tags question: http://stackoverflow.com/q/23363054
type: Tag

http://stackoverflow.com/a/23340978
has body: Java's array .sort() is (from about Java 6) actually TimSort [ http://svn.python.org/projects/python/trunk/Objects/listsort.txt ], the fastest general purpose #sort out there (much better than qsort in many situations); you won't be able to sort anything noticeably faster without a heuristic. "like 20 seconds or more" signifies to me that your problem is probably the famous ApplicationProfilingSkippedByDeveloperException - do a profiling and locate the exact bottleneck. I'd go with the OS file I/O as one; doing a native request of the file attributes in batch, caching the results and then processing them at once seems the only sensible solution here.
downvote count: 0
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/23340408

http://stackoverflow.com/q/23413785
has title: What lib (custom JTabbedPane) is used on this picture?
score: 0
has comment: http://stackoverflow.com/comment/35891520
answer count: 1
has comment: http://stackoverflow.com/comment/35891490
has comment: http://stackoverflow.com/comment/35891650
has comment: http://stackoverflow.com/comment/35891496
tagged with: jtabbedpane
tagged with: swing
has comment: http://stackoverflow.com/comment/35891443
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35891725
tagged with: java
tagged with: look-and-feel
has body: I found a picture - java swing nimbus. There they use non-standard JTabbedPane. I want such custom JTabbedPane! What lib should I use for that? Can you advise lib like that?
type: Question
has comment: http://stackoverflow.com/comment/35891461
has comment: http://stackoverflow.com/comment/35887693
has answer: http://stackoverflow.com/a/23415971
accepted answer: http://stackoverflow.com/a/23415971

http://stackoverflow.com/a/23445495
has body: I think you are using ANT. If it is the problem may be you've missed to include mysql library in build.xml
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23445096

http://stackoverflow.com/a/23334050
score: 3
has body: I had to write somehting to do this a few weeks ago. This should handle all comments, nested or otherwise. It is long, but I haven't seen a regex version that handled nested comments properly. I didn't have to preserve javadoc, but I presume you do, so I added some code that I belive should handle that. I also added code to support the \r\n and \r line separators. The new code is marked as such. public static String removeComments(String code) { StringBuilder newCode = new StringBuilder(); try (StringReader sr = new StringReader(code)) { boolean inBlockComment = false; boolean inLineComment = false; boolean out = true; int prev = sr.read(); int cur; for(cur = sr.read(); cur != -1; cur = sr.read()) { if(inBlockComment) { if (prev == '*' &amp;&amp; cur == '/') { inBlockComment = false; out = false; } } else if (inLineComment) { if (cur == '\r') { // start untested block sr.mark(1); int next = sr.read(); if (next != '\n') { sr.reset(); } inLineComment = false; out = false; // end untested block } else if (cur == '\n') { inLineComment = false; out = false; } } else { if (prev == '/' &amp;&amp; cur == '*') { sr.mark(1); // start untested block int next = sr.read(); if (next != '*') { inBlockComment = true; // tested line (without rest of block) } sr.reset(); // end untested block } else if (prev == '/' &amp;&amp; cur == '/') { inLineComment = true; } else if (out){ newCode.append((char)prev); } else { out = true; } } prev = cur; } if (prev != -1 &amp;&amp; out &amp;&amp; !inLineComment) { newCode.append((char)prev); } } catch (IOException e) { e.printStackTrace(); } return newCode.toString(); }
has comment: http://stackoverflow.com/comment/70332168
has comment: http://stackoverflow.com/comment/58357023
has comment: http://stackoverflow.com/comment/59293451
answers question: http://stackoverflow.com/q/23333031
has comment: http://stackoverflow.com/comment/59297371
downvote count: 1
type: Answer
upvote count: 4
has comment: http://stackoverflow.com/comment/44241870

http://stackoverflow.com/comment/35878078
has text: why you need additional check with subquery then this command is more than enough to do the update `UPDATE student SET student_score = 20 where student_id = 1`
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23413743

http://stackoverflow.com/comment/35673793
comment on: http://stackoverflow.com/q/23302335
type: Comment
type: QuestionComment
has text: The point is that the actual enum instances don't exist at compile-time, which is the only time generic type information exists in Java thanks to type-erasure. You can't use the members of an enum as a parameter to a generic, period.
score: 1

http://stackoverflow.com/comment/35943929
score: 1
has text: Your question is rather broad, I did my best answering it but could you summarize what is the exact problem you're having?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23449107

http://stackoverflow.com/a/23396466
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/35847095
upvote count: 1
has body: In case of reversed scan in HBase 0.98 onwards start key and end key are reversed. Documentation Link explains this: Doc Link
accepted answer of: http://stackoverflow.com/q/23390546
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/35846863
answers question: http://stackoverflow.com/q/23390546

http://stackoverflow.com/q/23340480
downvote count: 0
has body: I've a TimePicker to get time. And I've following Java code for an Android Application : Calendar calendar = Calendar.getInstance(); calendar.setTimeInMillis(System.currentTimeMillis()); Log.e("Alarm", "" + calendar.getTime()); calendar.set(Calendar.HOUR, timePicker.getCurrentHour()); calendar.set(Calendar.MINUTE, timePicker.getCurrentMinute()); Log.e("Alarm", "" + calendar.getTime()); The second process gives a day ahead than first process. I've tried following code and subtracted the one day. calendar.add(Calendar.DATE, -1); Is this the only way or best way? How to get the today's date / time using the TimePicker?
accepted answer: http://stackoverflow.com/a/23340839
favorite count: 0
tagged with: timepicker
score: 3
tagged with: android
has answer: http://stackoverflow.com/a/23340727
answer count: 4
has title: How to get the today's date / time using the TimePicker?
type: AnsweredQuestion
upvote count: 3
possible better answer: http://stackoverflow.com/a/23340727
tagged with: calendar
has comment: http://stackoverflow.com/comment/35742253
has answer: http://stackoverflow.com/a/23340796
type: Question
has answer: http://stackoverflow.com/a/23340839
has answer: http://stackoverflow.com/a/23340627
tagged with: java
tagged with: date

http://stackoverflow.com/comment/35699223
type: Comment
type: QuestionComment
score: 0
has text: @JBNizet Oh yes, I had misinterpreted this statement from the API: "Releases this ResultSet object's database and JDBC resources immediately..." Thank you for clarifying.
comment on: http://stackoverflow.com/q/23316517

http://stackoverflow.com/q/23367554
has comment: http://stackoverflow.com/comment/35793056
score: 0
answer count: 3
possible better answer: http://stackoverflow.com/a/23368370
accepted answer: http://stackoverflow.com/a/23368411
tagged with: javax.xml
tagged with: http://stackoverflow.com/tag/xml
has title: Xml to Java Object using JAXB
has body: I need converter this xml to Java Object, I was using a manual DOM w3c (DocumentBuilder). But I would use the JAXB, This is XML <?xml version="1.0" encoding="UTF-8"?> {prefix} {prefix}-{0} /META-INF/page-basic.xhtml /META-INF/page-frame.xhtml .*MSIE (4|5|6|7|8).* ie-old /META-INF/no-support.xhtml no-support {prefix} .*MSIE (\d+).* ie .*Firefox/(\d+).* fx .*Firefox/(\d+).*Android/(\d+).* fx /META-INF/movil-basic.xhtml /META-INF/movil-frame.xhtml fx fx-{0} android-{1} This is my java class: public class Support implements Serializable { private final String id; private final Pattern pattern; private final String prefix; private final Map<String, String> templates = new HashMap(); private final String defaultTemplate; private final String styleClass; } Help me please, I dont know how to uses case for default attribute and default template, I try implement my SupportAdapter (extends XmlAdapter)
has answer: http://stackoverflow.com/a/23367954
type: AnsweredQuestion
tagged with: java
tagged with: jaxb
has answer: http://stackoverflow.com/a/23368411
type: Question
has answer: http://stackoverflow.com/a/23368370

http://stackoverflow.com/comment/35939785
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23446901
has text: :) happens. I posted after seeing that you do have enough reps.
score: 0

http://stackoverflow.com/comment/35771521
has text: What error do you get ? Ideally you should be able to specify the dependency like any other artifact.
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/23356279
score: 0

http://stackoverflow.com/comment/37296561
comment on: http://stackoverflow.com/a/24159938
type: AnswerComment
type: Comment
has text: But it not working for "file" type. @KapilJituri
score: 1

http://stackoverflow.com/a/23318925
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/35703062
has body: You can't override static methods in Java, because, polymorphism and static won't work together. And static methods are invoked on Class, not in instances. You can hide a super class static method in sub class.
upvote count: 2
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23318914
answers question: http://stackoverflow.com/q/23318914
type: Answer

http://stackoverflow.com/comment/35851994
has text: Maybe I should have explained a little more what the program should do. When I run it I get "Please enter a file when running the program...." I will post the pic for you
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23398797

http://stackoverflow.com/a/23394720
answers question: http://stackoverflow.com/q/23394535
has body: The difference between a post-increment/decrement and a pre-increment/decrement is in the evaluation of the expression. The pre-increment and pre-decrement operators increment (or decrement) their operand by 1, and the value of the expression is the resulting incremented (or decremented) value. In contrast, the post-increment and post-decrement operators increase (or decrease) the value of their operand by 1, but the value of the expression is the operand's original value prior to the increment (or decrement) operation. In other words: int a = 5; int b; b = --a; // the value of the expression --a is a-1. b is now 4, as is a. b = a--; // the value of the expression a-- is a. b is still 4, but a is 3. Remember that a program must evaluate expressions to do everything. Everything is an expression, even just a casual mention of a variable. All of the following are expressions: a a-1 --a &amp;&amp; ++a System.out.println(a) Of course, in the evaluation of expressions, operator precedence dictates the value of an expression just as the PEMDAS you learned in grade school. Some operators, such as increment/decrement, have side effects, which is of course great fun, and one of the reasons why functional programming was created.
type: Answer
score: 3
upvote count: 3
downvote count: 0

http://stackoverflow.com/comment/35667984
score: 0
type: AnswerComment
has text: @BenSmith: Assuming you're referring to `AbstractNonStreamingHashFunction`, I would strongly suggest using `AbstractStreamingHashFunction` as I did here. `AbstractNonStreamingHashFunction` (as implied by the "non-streaming" part of the name) doesn't work well for processing a stream of bytes. It's designed for hash functions that have to process a set of bytes all at once, and as such it buffers everything that's written to it until you call `hash()`. The algorithm that `Arrays.hashCode` uses, on the other hand, is very amenable to being used in a streaming manner.
comment on: http://stackoverflow.com/a/23298351
type: Comment

http://stackoverflow.com/a/23354961
downvote count: 0
has comment: http://stackoverflow.com/comment/35769187
has comment: http://stackoverflow.com/comment/35770456
has comment: http://stackoverflow.com/comment/35770616
has comment: http://stackoverflow.com/comment/35770734
answers question: http://stackoverflow.com/q/23354926
type: Answer
has comment: http://stackoverflow.com/comment/35770779
has comment: http://stackoverflow.com/comment/35769196
has comment: http://stackoverflow.com/comment/35770602
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/35770463
has body: sharedData is not initialized. You need to initialize it before calling getText. You have only declared it EditText sharedData; sharedData =(EditText) findViewById(R.id.idforshareddata); String data = sharedData.getText().toString();
has comment: http://stackoverflow.com/comment/35770697

http://stackoverflow.com/a/23373428
downvote count: 2
type: Answer
has body: Remove the "public" from Event so that your class looks like this: public class Attendee { private final String fName; private final String lName; private final String email; public Attendee(Attendee A) { fName = A.fName; lName = A.lName; email = A.email; } public Attendee(String fName, String lName, String email) { this.fName = fName; this.lName = lName; this.email = email; } } class Event { private String name; private int soldTicketsNo; private Attendee w; // here is the wrong }
upvote count: 0
score: -2
has comment: http://stackoverflow.com/comment/35803204
answers question: http://stackoverflow.com/q/23373290

http://stackoverflow.com/a/23421295
has comment: http://stackoverflow.com/comment/35971481
score: 1
answers question: http://stackoverflow.com/q/23410753
downvote count: 0
has comment: http://stackoverflow.com/comment/35922528
has comment: http://stackoverflow.com/comment/35921513
has comment: http://stackoverflow.com/comment/35972038
type: Answer
has body: Create a method in your service like this: @Transactional public Project addExperts(Project project, List&lt;Expert&gt; experts){ List&lt;Expert&gt; projectExperts = project.getExperts(); for(Expert expert: experts){ projectExperts.add(expert); } project.setExperts(projectExperts); return project; } This will encapsulate the fetching of Project.experts inside a Transaction so that the lazily loaded collection can be fetched and initialised properly. By adding the list you have determined in your controller, you can then save the project properly and have the cascade create the new expert objects. I'm pretty sure this should fix your problem. If you don't see INSERT statements creating your Expert objects, then thats your problem. Hibernate can't insert a reference to your Expert objects into your JoinTable if they don't exist in the database, hence why it would delete your collection object.
upvote count: 1

http://stackoverflow.com/comment/35871365
has text: That's what I just said
type: Comment
comment on: http://stackoverflow.com/a/23410032
score: 1
type: AnswerComment

http://stackoverflow.com/comment/35892736
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23420575
type: Comment
has text: Worked partially! If I run the program now and enter say an alphabet or blank as the first entry, it throws NoSuchElementException and terminates. `` do { System.out.println("Enter a number or 0 to quit: "); try { input = Double.parseDouble( br.readLine() ); list.add( input ); } catch( NumberFormatException | IOException nfe ) { System.out.println( "You did not enter a number!" ); } } while (input != 0.0); if (list.size() == 1) { System.out.println("You did not enter any numbers"); ``

http://stackoverflow.com/q/23341332
answer count: 1
downvote count: 0
favorite count: 0
type: UnansweredQuestion
has body: I'm trying to print a web content from inside another web content in Liferay 5.2.3. Following the issue How to embed WebContent in Liferay i've tried: set ($group_id = $getterUtil.getLong($request.theme-display.scope-group-id)) set ($webcontent-id = "ROBAPAGINES-COL-ESQUERRA") set ($webcontent=$journalContentUtil.getContent($group_id, $webcontent-id, "", "$locale", "")) $webcontent It works when the embedded web content has no structure and template but $webcontent is empty when I assign an structure-template to the same web content. I'd greatly appreciate any help
tagged with: velocity
score: 1
tagged with: java
has title: Embed web liferay content within existing liferay web content
upvote count: 1
type: Question
tagged with: liferay
linked to: http://stackoverflow.com/q/15390704
has answer: http://stackoverflow.com/a/23341682

http://stackoverflow.com/q/23425890
answer count: 1
tagged with: semantic-web
score: 0
tagged with: semantics
tagged with: http://stackoverflow.com/tag/rdf
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23430008
has title: Unable to extend Node_Literal Jena class
tagged with: java
has body: I am trying to write implementation of jena graph API and while implementing it. I am facing problem in extending Node_Literal class which is a jena class for literal values. While extending it, it is giving this error "The constructor Node_Literal(Object) is not visible" The code of parent class (Node_Literal) is following: public class Node_Literal extends Node_Concrete{ Node_Literal( Object label ) { super( label ); } @Override public LiteralLabel getLiteral() { return (LiteralLabel) label; } @Override public final Object getLiteralValue() { return getLiteral().getValue(); } @Override public final String getLiteralLexicalForm() { return getLiteral().getLexicalForm(); } @Override public final String getLiteralLanguage() { return getLiteral().language(); } @Override public final String getLiteralDatatypeURI() { return getLiteral().getDatatypeURI(); } @Override public final RDFDatatype getLiteralDatatype() { return getLiteral().getDatatype(); } @Override public final boolean getLiteralIsXML() { return getLiteral().isXML(); } @Override public String toString( PrefixMapping pm, boolean quoting ) { return ((LiteralLabel) label).toString( quoting ); } @Override public boolean isLiteral() { return true; } /** Literal nodes defer their indexing value to the component literal. @see com.hp.hpl.jena.graph.Node#getIndexingValue() */ @Override public Object getIndexingValue() { return getLiteral().getIndexingValue(); } @Override public Object visitWith( NodeVisitor v ) { return v.visitLiteral( this, getLiteral() ); } @Override public boolean equals( Object other ) { if ( this == other ) return true ; return other instanceof Node_Literal &amp;&amp; label.equals( ((Node_Literal) other).label ); } @Override public boolean sameValueAs(Object o) { return o instanceof Node_Literal &amp;&amp; ((LiteralLabel)label).sameValueAs( ((Node_Literal) o).getLiteral() ); } @Override public boolean matches( Node x ) { return sameValueAs( x ); } } Class that is extending node literal is given be…
type: Question
tagged with: jena

http://stackoverflow.com/comment/35694693
comment on: http://stackoverflow.com/a/23314404
type: AnswerComment
score: 0
type: Comment
has text: You can use a number of different approaches for converting infix to postfix. Using a string would require you to have even more logic for the formatting. Out of curiosity is this for an assignment?

http://stackoverflow.com/comment/35906172
has text: Then change disabled="disabled" to readonly, you can not send the value of a disabled field
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23428115
score: 0

http://stackoverflow.com/comment/35752292
has text: @Hirak i need to know how to get the appropriate values from the array
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23345332
type: QuestionComment

http://stackoverflow.com/comment/35758798
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23348029
has text: Good catch for `this.a = a;` One main problem is bad readability in presented code so such things can easily overlooked on first glance. With better coding style much less errors!
type: Comment

http://stackoverflow.com/q/23416031
answer count: 1
score: 0
has answer: http://stackoverflow.com/a/23472364
tagged with: gridgain
tagged with: grid-computing
has title: Build gridgain on Windows?
tagged with: scala
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35888985
has comment: http://stackoverflow.com/comment/36009436
tagged with: java
has body: I just git pull'ed from head. mvn compile works fine. [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building gridgain 6.1.1 [INFO] ------------------------------------------------------------------------ [INFO] ------------------------------------------------------------------------ [INFO] Reactor Summary: [INFO] [INFO] gridgain-tools .................................... SUCCESS [ 1.097 s] [INFO] jdk8-backport ..................................... SUCCESS [ 1.453 s] [INFO] gridgain-core ..................................... SUCCESS [ 24.937 s] [INFO] gridgain-extdata-p2p .............................. SUCCESS [ 0.757 s] [INFO] gridgain-extdata-uri .............................. SUCCESS [ 0.458 s] [INFO] gridgain-clients .................................. SUCCESS [ 1.522 s] [INFO] gridgain-scalar ................................... SUCCESS [ 49.385 s] [INFO] gridgain-examples ................................. SUCCESS [ 23.718 s] [INFO] gridgain-visor-console ............................ SUCCESS [ 24.935 s] [INFO] gridgain-jdbc-driver .............................. SUCCESS [ 0.765 s] [INFO] gridgain .......................................... SUCCESS [ 0.000 s] [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 02:09 min [INFO] Finished at: 2014-05-01T13:22:38-08:00 [INFO] Final Memory: 50M/246M [INFO] ------------------------------------------------------------------------ C:\apps\gridgain&gt;mvn package [INFO] Scanning for projects... But mvn package is pretty unhappy (here is an excerpt): [WARNING] Try running the build up to the lifecycle phase "package" [INFO] [INFO] --- maven-javadoc-plugin:2.9.1:aggregate-jar (aggregate) @ gridgain-tools --- [WARNING] The POM for org.apache.maven.doxia:doxia-module-fml:jar:1.0 is invalid, transitive dependencies (if any) will not be av…
type: Question

http://stackoverflow.com/comment/35820787
has text: Hi thank you Adrian!! Coding my Code!, But i don't know. what's Check dialog?
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23383034

http://stackoverflow.com/q/23410381
has answer: http://stackoverflow.com/a/23411035
accepted answer: http://stackoverflow.com/a/23412678
has title: Copy text from JTextField to JTextArea
downvote count: 0
has body: Why can't I copy the text from a JTextField to a JTextArea? orders is a JTextArea and get is a JTextField. Status is JButton. class client: public client() extends superclass{ super("CLIENT"); setLayout(new FlowLayout()); update = new JLabel("status"); add(update,BorderLayout.SOUTH); order = new JPanel(); add(order,BorderLayout.SOUTH); menu = new JList(kveb); menu.setVisibleRowCount(8); menu.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); add(new JScrollPane(menu)); get = new JTextField("chaweret rac gsurt"); add(get); status = new JButton("ORDER!"); status.setFont(new Font("Serif",Font.BOLD,16)); add(status); guga k1 = new guga(); menu.addListSelectionListener(k1); get.addActionListener(k1); status.addActionListener(k1); server tes = new server(); tes.setSize(300,300); tes.setDefaultCloseOperation(EXIT_ON_CLOSE); tes.setVisible(true); } class server: public class server extends superclass{ public server() { super("SERVER"); setLayout(new FlowLayout()); // public JCheckBox ready; // public JCheckBox working; // public JCheckBox ordered; //public JCheckBox trans; // public JTextField orders; ready = new JCheckBox("text"); ready.setFont(new Font("Serif",Font.BOLD,16)); add(ready); Font x = new Font("Serif",Font.BOLD,16); working = new JCheckBox("text here"); working.setFont(x); add(working); migebulia = new JCheckBox("text heere"); migebulia.setFont(x); add(migebulia); trans = new JCheckBox("mtext"); trans.setFont(x); add(trans); orders = new JTextArea("text"); orders.setFont(new Font("Serif",Font.BOLD,16)); add(orders); guga k2 = new guga(); ready.addActionListener(k2); working.addActionListener(k2); ordered.addActionListener(k2); trans.addActionListener(k2); // orders.addActionListener(k2); } } super class: public class superclass extends JFrame { //client public JList menu; public JTextField get; public JPanel order; public JButton status; public String kveb[] = {"text","texti","text","text"}; public JLabel update; //server public JCheckBox ready;…
tagged with: swing
tagged with: text
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23412678
possible better answer: http://stackoverflow.com/a/23411035
score: 1
tagged with: java
tagged with: jtextfield
type: Question
answer count: 2
tagged with: jtextarea
upvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/35873665
has comment: http://stackoverflow.com/comment/35871797
has comment: http://stackoverflow.com/comment/35871845

rmi
tags question: http://stackoverflow.com/q/23341380
tags question: http://stackoverflow.com/q/23354891
tags question: http://stackoverflow.com/q/23444004
tags question: http://stackoverflow.com/q/23399368
tags question: http://stackoverflow.com/q/23333368
tags question: http://stackoverflow.com/q/23338233
tag name: rmi
type: Tag
tags question: http://stackoverflow.com/q/23397280
tags question: http://stackoverflow.com/q/23392079

http://stackoverflow.com/a/23330640
score: 0
answers question: http://stackoverflow.com/q/23330617
type: Answer
has body: public is a visibility modifier, in this case there would be no limitation on which classes can access the method void is a return type, void means the method doesn't return anything to the caller.

http://stackoverflow.com/comment/35772701
score: 0
type: AnswerComment
type: Comment
has text: yeah2 i'll change it to the simplest one
comment on: http://stackoverflow.com/a/23357032

http://stackoverflow.com/comment/35940887
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23447519
has text: @LuiggiMendoza yes, and also, modifying one list (removing, adding item) would not modify the other one.

http://stackoverflow.com/q/23301694
has title: Guice synthetic methods warning
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/23334307
has body: We are having Guice and its AOP support. We have two 3d party modules which use the AOP support: Shiro and the Guice's JPA module. As a result Guice complains that "The method may be intercepted twice". My question is how can I avoid such behavior: I probably do not need to intercept synthetic methods at all. If the modules were ours we could just add a Matcher which filters out all synthetic methods (like it says here) but the problem is these are 3d party modules.
type: AnsweredQuestion
tagged with: java
tagged with: aop
type: Question
score: 5
tagged with: shiro
tagged with: guice
upvote count: 5
tagged with: jpa
downvote count: 0
accepted answer: http://stackoverflow.com/a/23334307

http://stackoverflow.com/a/23435357
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35919495
type: Answer
accepted answer of: http://stackoverflow.com/q/23435050
has comment: http://stackoverflow.com/comment/35920937
has body: If you want to set the label for the jl field with one of the lines from the text file, then you need to do the following: add a List field inside your Driver class: public class Driver { List&lt;String&gt; lines; //other fields that you need } in the gui() method, on the first line, initialize the lines field with the actual lines from the file, and initialize i counter with 0: public void gui() { lines = readLinesFromFile(); i = 0; //other code add the following method: public static List&lt;String&gt; readLinesFromFile() { List&lt;String&gt; lines = new ArrayList&lt;String&gt;(); try { Scanner scanner = new Scanner(new File("upload.txt")); if (scanner.hasNext()){ lines.add(scanner.nextLine()); } } catch (FileNotFoundException e) { e.printStackTrace(); } return lines; } change the first ActionListener for b1 with the following: b1.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { jl.setText(lines.get(i)); i++; if ( i &gt; lines.size() ) { i = 0; } if (b1.getText().equals("Click For Answer")) { b1.setText("Next Question"); } else { b1.setText("Click For Answer"); } } }); Also, using this implementation, you don't need the line variable anymore, because you set the text for the label to one of the values from the lines field. NOTE: if i gets higher that the actual number of lines in the file, it is reset to 0. If you don't want this, just change the if block in the ActionListener that checks the size
answers question: http://stackoverflow.com/q/23435050
has comment: http://stackoverflow.com/comment/35922607
has comment: http://stackoverflow.com/comment/35928419
has comment: http://stackoverflow.com/comment/35918527
score: 0
has comment: http://stackoverflow.com/comment/35928407
has comment: http://stackoverflow.com/comment/35920877

http://stackoverflow.com/comment/35954511
score: 0
type: AnswerComment
type: Comment
has text: Yep, that was exactly what I needed. I´ll update the SSCCE with my solution.
comment on: http://stackoverflow.com/a/23450922

http://stackoverflow.com/a/23414081
type: Answer
upvote count: 4
downvote count: 0
has body: Why are you override onCreateView? In onCreate() you are setting the content using a layout resource. Your other initilization code should go here or onResume() depending on what it's doing. Try this... public class SmsViewActivity extends Activity { private static final String TAG = "SmsViewActivity"; private FoodJSONSerializer mSerializer; public Button mSaveButton, mDismissButton; public int mNotificationId; public String message; private EditText mTitleField; private CheckBox mImperialCheckBox; private CheckBox mMetricCheckBox; private EditText mServingsField; private EditText mDirectionsField; private Spinner mMetricSpinner; private Spinner mImperialSpinner; Food mFood; public void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); setContentView(R.layout.view_sms); mSaveButton = (Button) findViewById(R.id.save_button_sms); mDismissButton = (Button) findViewById(R.id.dismiss_button_sms); // ------------------------------------------------------------ // Get extras and display information in view //String sender = getIntent().getStringExtra("sender"); String msg = getIntent().getStringExtra("message"); try { JSONObject jsonRecipe = new JSONObject(msg); Food mFood = new Food(jsonRecipe); Log.i(TAG, "Food = " + mFood); } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } // ----------------------------------------------------------------------- mNotificationId = getIntent().getIntExtra("notificationid", 0); if (mNotificationId == 0) { Log.e(TAG, "Could not retrieve notification ID."); Toast.makeText(this, "A fatal error has occurred in SMS viewer.", Toast.LENGTH_LONG).show(); finish(); } // Cancel the notification String ns = Context.NOTIFICATION_SERVICE; NotificationManager notificationMgr = (NotificationManager) getSystemService(ns); notificationMgr.cancel(mNotificationId); // -------------------------------------------------- mTitleField = (EditText)v. findViewById(R.id.food_title_sms); mTitleField.setText(…
has comment: http://stackoverflow.com/comment/35887966
accepted answer of: http://stackoverflow.com/q/23413480
answers question: http://stackoverflow.com/q/23413480
score: 4
has comment: http://stackoverflow.com/comment/35879356
type: AcceptedAnswer

http://stackoverflow.com/comment/35923420
score: 0
type: AnswerComment
has text: Your counter should be set to 0 before pack is called, not inside pack (and this is really dirty).
type: Comment
comment on: http://stackoverflow.com/a/23437590

http://stackoverflow.com/comment/35816868
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23381018
has text: i'm trying to say that the VALUE I WANT is in the middle, and i'm using m.group to pull the (.*?) that's in the middle, and the , is on the end

http://stackoverflow.com/comment/35782775
type: Comment
has text: check if there is an error in any of the layouts. if you do not see any error mark, go to show views, and select error log and there you will get the error
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/23362792

http://stackoverflow.com/q/23368375
score: 2
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/23368567
accepted answer: http://stackoverflow.com/a/23368567
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/35793587
tagged with: database
has body: I am trying to show all my data from my database into the listview Code to create database: DataHander.java package com.example.testingforstack; import android.content.ContentValues; import android.content.Context; import android.database.Cursor; import android.database.SQLException; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteOpenHelper; public class DataHandler { public static final String NAME = "name"; public static final String EMAIL = "email"; public static final String TABLE_NAME = "mytable"; public static final String DATA_BASE_NAME = "mydatabase"; public static final int DATABASE_VERSION = 1; public static final String TABLE_CREATE = "create table mytable (name text not null, email text not null);"; DataBaseHelper dbhelper; Context ctx; SQLiteDatabase db; public DataHandler(Context ctx){ this.ctx = ctx; dbhelper = new DataBaseHelper(ctx); } public static class DataBaseHelper extends SQLiteOpenHelper{ public DataBaseHelper(Context ctx) { super(ctx, DATA_BASE_NAME, null, DATABASE_VERSION); } @Override public void onCreate(SQLiteDatabase db){ try{ db.execSQL(TABLE_CREATE); }catch (SQLException e){ e.printStackTrace(); } } @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion){ //db.execSQL("DROP TABLE IF EXISTS mytable"); onCreate(db); } } public DataHandler open(){ db = dbhelper.getReadableDatabase(); return this; } public void close(){ dbhelper.close(); } public long insertData(String name, String email){ ContentValues content = new ContentValues(); content.put(NAME, name); content.put(EMAIL, email); return db.insertOrThrow(TABLE_NAME, null, content); } public Cursor returnData(){ return db.query(TABLE_NAME, new String[] {NAME, EMAIL}, null, null, null, null, null); } } mainActivity.java package com.example.testingforstack; import android.app.Activity; import android.app.AlertDialog; import android.content.DialogInterface; import android.database.Cursor; import android.os.Bundle; import andr…
tagged with: android-listview
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/35793696
tagged with: android
has title: show data from database to listView Android
type: AnsweredQuestion

http://stackoverflow.com/q/23417218
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/23419595
type: AnsweredQuestion
tagged with: interpreter
tagged with: java
has answer: http://stackoverflow.com/a/23419803
accepted answer: http://stackoverflow.com/a/23419595
has body: I have some doubts about a JIT Compiler and an Interpreter. Starting from their definitions: (Interpreter) From Wikipedia: In computer science, an interpreter is a computer program that directly executes, i.e. performs, instructions written in a programming or scripting language, without previously batch-compiling them into machine language. An interpreter generally uses one of the following strategies for program execution: 1) parse the source code and perform its behavior directly 2) translate source code into some efficient intermediate representation and immediately execute this 3) explicitly execute stored precompiled code[1] made by a compiler which is part of the interpreter system (JIT COMPILER) From Wikipedia: In computing, just-in-time compilation (JIT), also known as dynamic translation, is compilation done during execution of a program – at run time – rather than prior to execution.[1] Most often this consists of translation to machine code, which is then executed directly, but can also refer to translation to another format. and From StackOverFlow: Just-in-time compilation is the conversion of non-native code, for example bytecode, into native code just before it is executed. I have 4 questions: 1) It's always said JIT=runtime, why doesn't an Interpreter work at runtime? Doesn't an Interpreter translate and execute each line at runtime, while the program is running? 2) It's always said JIT translates a non-native code to native-code, so what? Doesn't an interpreter convert a code to native code? How can my process execute an instruction if it is not translated to native code? So the interpreter needs to translate the code to native code too. 3) A normal interpreter translates each line when it needs to execute it, while using a JIT compiler each line is translated just before it is executed, so it is aviable in that moment when the line need to be executed. Isn't it? 4) So what are the real differene between an interpreter and a JIT compiler, both execu…
type: Question
tagged with: jit
score: 5
upvote count: 5
possible better answer: http://stackoverflow.com/a/23419803
has answer: http://stackoverflow.com/a/26715282
answer count: 3
has title: Clarifications on JIT Compiler and Interpreter

http://stackoverflow.com/a/23380611
has body: You can use @PathVariable to pass any number of values to the controller. You can read this simple example.
type: Answer
score: 0
upvote count: 1
downvote count: 1
answers question: http://stackoverflow.com/q/23371928

http://stackoverflow.com/q/23424594
has comment: http://stackoverflow.com/comment/35898633
tagged with: selenium-webdriver
type: AnsweredQuestion
score: 3
tagged with: java
tagged with: webdriver
type: Question
has comment: http://stackoverflow.com/comment/35898800
has answer: http://stackoverflow.com/a/23426307
accepted answer: http://stackoverflow.com/a/23428469
has comment: http://stackoverflow.com/comment/35899072
has comment: http://stackoverflow.com/comment/35923685
answer count: 3
possible better answer: http://stackoverflow.com/a/23426307
tagged with: http://stackoverflow.com/tag/html
downvote count: 1
has body: I want to be able to select a radio button within a group (of radio buttons) identified by the name attribute: &lt;div&gt; &lt;input type="radio" name="exampleInputRadio" id="optionRadio1" value="1"&gt; &lt;input type="radio" name="exampleInputRadio" id="optionRadio2" value="2"&gt; &lt;input type="radio" name="exampleInputRadio" id="optionRadio3" value="3"&gt; &lt;input type="radio" name="exampleInputRadio" id="optionRadio4" value="4"&gt; &lt;/div&gt; I use the following code to do what I want: public void exampleInputRadio(WebDriver driver, int option) { List&lt;WebElement&gt; radios = driver.findElements(By.name("exampleInputRadio")); if (option &gt; 0 &amp;&amp; option &lt;= radios.size()) { radios.get(option - 1).click(); } else { throw new NotFoundException("option " + option + " not found"); } } The problem is that Selenium always selects the first radio button, no matter the value of option argument is. And when I code this in the above method: for (int i = 0; i &lt; radios.size(); i++) { System.out.println(radios.get(i).getAttribute("id")); } I get this output: optionRadio1 optionRadio2 optionRadio3 optionRadio4
has answer: http://stackoverflow.com/a/23428469
favorite count: 0
has title: Select Radio Button in a group using Selenium WebDriver with Java
has answer: http://stackoverflow.com/a/31688259
tagged with: selenium
upvote count: 4
has comment: http://stackoverflow.com/comment/35899131

http://stackoverflow.com/comment/35848510
type: Comment
score: 1
has text: You can't assign array of ints to array of doubles!
type: AnswerComment
comment on: http://stackoverflow.com/a/23397758

http://stackoverflow.com/q/23327756
has answer: http://stackoverflow.com/a/23328015
score: 0
answer count: 2
has title: Counting undirect graph
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35719154
has body: Right now I am counting the edges twice since (u,w) and (w,u) is the same. for (int i = 0; i &lt; graph.length; i++){ for (int j = 0; j &lt; graph.length; j++){ if (isEdge(graph.vertex[i], graph.vertex[j]){ // if u -&gt; w is edge. counter++; } } } How can I make it so that it is not counting the edges twice? I can't think of a simple way, please enlighten me. (There are selfedge too, and I don't want to do counter/2 at the end of loop, edge count can be odd numbers). An self edge is (u,u). I'm not allowed to add any extra fields in the data structure such as "visited". I also tried to make the inner for loop start from int j = i. However, using that method will not detect self edges.
tagged with: java
has comment: http://stackoverflow.com/comment/35719274
has comment: http://stackoverflow.com/comment/35719168
type: Question
has answer: http://stackoverflow.com/a/23327818

http://stackoverflow.com/a/57154931
score: 0
type: Answer
has body: I just had the same issue, and it was due to a corrupted jar file as suggested in the comments. I just replaced it and the command worked without any extra switches for groupid, packaging etc (because it was a maven jar already). It turned out that the jar was corrupted by pushing it from Windows to a git repo then pulling onto a Linux box. The solution was to tell get that jars are binaries to it didn't convert the line endings - see here: Jar file gets corrupted after pushing to github
answers question: http://stackoverflow.com/q/23421699

http://stackoverflow.com/comment/35698697
has text: @MarcB, I edited it with the errors
comment on: http://stackoverflow.com/q/23316466
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35759260
type: AnswerComment
has text: What does the [protocol trace](http://www.oracle.com/technetwork/java/javamail/faq/index.html#debug) show?
comment on: http://stackoverflow.com/a/23301458
score: 0
type: Comment

http://stackoverflow.com/comment/35676516
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23304181
has text: Code relying on the existance of database records sounds inherently problematic, can you move this out of the database completely?

http://stackoverflow.com/a/23415380
type: Answer
score: 1
upvote count: 1
has body: You may want to try using Windows runas program. It allows you to execute command with authentication of another user. This MSDN article contains neccesary information: http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/runas.mspx?mfr=true You may run runas without being prompted for password, but you'll have to type it in .exec() as plain text, or you may want to try to use keyboard-interactive authentication with runas.
answers question: http://stackoverflow.com/q/23411462
downvote count: 0

method-declaration
type: Tag
tag name: method-declaration
tags question: http://stackoverflow.com/q/23294195

http://stackoverflow.com/q/23377898
has answer: http://stackoverflow.com/a/23377999
tagged with: java
type: Question
has title: Sharing multiple variables between methods in Java
has body: What is the best way to pass multiple variables between methods? I have done it one way in which there is a return statement in the first method, but I want to access every variable from the first method in the second method. The variable "value0" in method "addTasks0" is not recognized. public Integer addValues(){ int value0 = sliderExample.getValue(); int value1 = sliderExample1.getValue(); int value2 = sliderExample2.getValue(); int value3 = sliderExample3.getValue(); int value4 = sliderExample4.getValue(); int value5 = sliderExample5.getValue(); int value6 = sliderExample6.getValue(); int value7 = sliderExample7.getValue(); int totalValue = (value0 + value1 + value2 + value3 + value4 + value5 + value6 + value7); return totalValue; } public void addTasks0(){ Integer totalValue = addValues(); if (totalValue &lt;= 100) { progressBar.setValue(value0); } else{ int overkill = (totalValue - 100); int margin = (value0 - overkill); String taskTitle = inputText.getText(); String marginmessage = "The maximum priority of " + taskTitle + " is" + Integer.toString(margin) + "%"; sliderExample.setValue(0); //custom title, warning icon JOptionPane.showMessageDialog(null, marginmessage, "Check Math", JOptionPane.WARNING_MESSAGE); } }
has answer: http://stackoverflow.com/a/23377944
answer count: 4
has answer: http://stackoverflow.com/a/23378430
type: UnansweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/35811535
has answer: http://stackoverflow.com/a/23378458

http://stackoverflow.com/a/23426528
has body: Hope this can help: PemObject pemObject = new PemObject("CERTIFICATE REQUEST", certRequest.getEncoded()); StringWriter str = new StringWriter(); PEMWriter pemWriter = new PEMWriter(str); pemWriter.writeObject(pemObject); pemWriter.close(); str.close(); System.out.println(str);
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23390925
type: Answer
answers question: http://stackoverflow.com/q/23390925
has comment: http://stackoverflow.com/comment/46214915
upvote count: 17
has comment: http://stackoverflow.com/comment/117155529
score: 17

http://stackoverflow.com/q/23401520
has answer: http://stackoverflow.com/a/23401555
tagged with: android
type: AnsweredQuestion
tagged with: android-fragments
tagged with: java
tagged with: onitemselectedlistener
has answer: http://stackoverflow.com/a/23402644
accepted answer: http://stackoverflow.com/a/23402644
type: Question
has answer: http://stackoverflow.com/a/23401749
tagged with: android-spinner
possible better answer: http://stackoverflow.com/a/23401555
score: 0
answer count: 3
has title: Android onItemSelected Spinner not activating
has body: My application is not initiating the onItemSelected method, when I change my spinner view. It should work fine, but it is not functioning. class UnitConverter extends Fragment implements OnItemSelectedListener{ Spinner spinner, spinner2; ArrayAdapter&lt;CharSequence&gt; adapter, kilogramAdapter, metreAdapter; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { super.onCreateView(inflater,container,savedInstanceState); View v = inflater.inflate(R.layout.activity_converter, container, false); spinner = (Spinner) v.findViewById(R.id.SI_spinner); spinner2 = (Spinner) v.findViewById(R.id.spinner1); adapter = ArrayAdapter.createFromResource(getActivity(), R.array.si_array, android.R.layout.simple_spinner_item); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); metreAdapter = ArrayAdapter.createFromResource(getActivity(), R.array.metre_array, android.R.layout.simple_spinner_item); metreAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); kilogramAdapter = ArrayAdapter.createFromResource(getActivity(), R.array.kilogram_array, android.R.layout.simple_spinner_item); kilogramAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spinner.setAdapter(adapter); spinner2.setAdapter(metreAdapter); return v; } @Override public void onItemSelected(AdapterView&lt;?&gt; arg0, View arg1, int arg2, long arg3){ spinner2.setAdapter(kilogramAdapter); } @Override public void onNothingSelected(AdapterView&lt;?&gt; arg0) { } }

http://stackoverflow.com/comment/35749769
score: 0
type: Comment
has text: @La-comadreja Try to update the Maven dependencies to the latest Camel version and check if it works.
type: AnswerComment
comment on: http://stackoverflow.com/a/23338113

http://stackoverflow.com/a/25562928
score: 3
upvote count: 3
downvote count: 0
answers question: http://stackoverflow.com/q/23375923
type: Answer
has body: To access the objects in your workspace you have to write the SQL statements specifying the object name with the workspace name like "workspacename.objectname". for e.g. If you have created your workspace and named it "XESPACE" and created a table "STUDENT" inside the workspace, then to access the STUDENT table from JDBC follow the code below. Step 1: Register the JDBC Driver as Class.forName("oracle.jdbc.driver.OracleDriver"). Step 2: Open connection with DriverManager.getConnection("jdbc:oracle:thin:@127.0.0.1:1521:XE", &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "Username", "Password"). &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; where 127.0.0.1 stands for localhost. Step 3: Now to access the table inside your workspace write the sql query as follows &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "select * from XESPACE.STUDENT"

http://stackoverflow.com/q/23313064
has comment: http://stackoverflow.com/comment/35694366
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/23313402
answer count: 2
upvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/23314877
has body: I'm setting up a Project with Spring and Hibernate. I created an abstract DAO class that contains an EntityManager. When I want to use this EntityManager, it's null and I dont understand why. Maybe you can help me. My persistence-context <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:p="http://www.springframework.org/schema/p" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.2.xsd"> <import resource="persistence-beans.xml" /> <mvc:annotation-driven /> <tx:annotation-driven transaction-manager="transactionManager" /> PersonDao.java: @Repository @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class) public class PersonDao extends AbstractDao<Person> { public PersonDao() { super(Person.class); } } AbstractDao.java @SuppressWarnings("unchecked") @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class) public abstract class AbstractDao<T> { @PersistenceContext protected EntityManager em; private Class<T> entityClass; public AbstractDao(Class<T> entityClass) { this.entityClass = entityClass; } public AbstractDao() { } public void create(T entity) { this.em.persist(entity); } public void edit(T entity) { this.em.merge(entity); } public void remove(T entity) { this.em.remove(this.em.merge(entity)); } public T find(long primaryKey) { return this.em.find(entityClass, primaryKey); } @SuppressWarnings("raw…
type: UnansweredQuestion
has title: Hibernate & Spring: EntityManager is Null
tagged with: spring
downvote count: 0
score: 1
type: Question

http://stackoverflow.com/a/23305510
upvote count: 1
has body: It is throwing a null pointer because you are returning a null object: public static IAtmHelper getAtmHelper() { // this dummy impl is just included to satisfy compile-time errors return null; // &lt;-- I am causing your NPE } You probably want to return an instance of an AtmHelper from within the function like this: public static IAtmHelper getAtmHelper() { return new AtmHelper(); }
answers question: http://stackoverflow.com/q/23305482
has comment: http://stackoverflow.com/comment/35721099
downvote count: 0
has comment: http://stackoverflow.com/comment/35697303
has comment: http://stackoverflow.com/comment/35696962
type: Answer
has comment: http://stackoverflow.com/comment/35711833
has comment: http://stackoverflow.com/comment/35694634
has comment: http://stackoverflow.com/comment/35721271
score: 1

http://stackoverflow.com/q/23369868
score: 1
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/35798398
upvote count: 1
tagged with: hql
type: Question
has comment: http://stackoverflow.com/comment/35797905
has body: guys thans for time and help i have HQL Query using case and paramater and i get a error when i set the parameters my query is: SELECT IC.Sources, IC.Total, IC.Destination, IC.Where, ICP.Date, ICP.filedirectory, ICP.filename FROM IcmA AS IC, IcmProc AS ICP WHERE IC.uniqueid = ICP.uniqueid AND IC.Sources = :Num OR IC.Destination= :Num AND CASE WHEN LENGTH(IC.Sources) = 1 OR LENGTH(IC.Destination) = 1 THEN :NBalance WHEN LENGTH(IC.Sources) &gt; 1 OR LENGTH(IC.Destination) &gt; 1 THEN :NBalance ELSE :NBalance END = :NBalance AND(DATE_FORMAT(ICP.Date, '%Y/%m/%d') &gt;= :fDate AND DATE_FORMAT(ICP.Date, '%Y/%m/%d') &lt;= :tDate) ORDER BY ICP.Date DESC Error: org.hibernate.hql.ast.tree.ParameterNode cannot be cast to org.hibernate.hql.ast.tree.SelectExpression&gt; java.lang.ClassCastException: org.hibernate.hql.ast.tree.ParameterNode cannot be cast to org.hibernate.hql.ast.tree.SelectExpression
has comment: http://stackoverflow.com/comment/35811048
has comment: http://stackoverflow.com/comment/35797220
has comment: http://stackoverflow.com/comment/35798380
downvote count: 0
favorite count: 0
type: UnansweredQuestion
has title: How to create use CASE statement inside WHERE using parameters in HQL?
has comment: http://stackoverflow.com/comment/35798698
has comment: http://stackoverflow.com/comment/35796895
answer count: 0

http://stackoverflow.com/a/33089851
answers question: http://stackoverflow.com/q/23384089
has body: Version 3.9.0 of eclipse-jetty released yesterday (2015-10/11) solves that problem: http://eclipse-jetty.github.io/changes-report.html#a3.9.0 https://github.com/eclipse-jetty/eclipse-jetty-plugin/issues/15
score: 0
type: Answer

http://stackoverflow.com/q/23404005
has body: So I've been working on this Java program where the computer asks the user if he wants to know the square of a number. If the user's answer is either 'Y' or 'y', the computer asks the user the number he wants he wants to know the square of, and prints the square of the number. Then the computer asks the user if he wants to know the square of another number. If answer is 'Y' or 'y', the computer takes a number and prints the square. The user is again asked if he wants to know the square of another number. Like this it goes on. I've also written code for cases where the user's answer is negative, or neither positive nor negative. By this, I meant cases where the user's answer is 'N' or 'n'. This program runs into a problem somewhere, and does not work from A to Z the way I want it to. See, when I run the code, the computer asks me if I want to know the square of a number, and I enter 'y'. I then get asked the number I want to know the square of. I enter the number and the computer prints out its square. Then I get asked if I want to know the square of another number. I enter 'y'. Then I am asked the number I want to know the square of and I enter a number. The computer prints the square of the number. Then the program asks if I want to know the square of another number and just ends, whereas it was supposed to take my answer. I've been working for almost 16 to 17 hours trying to find the bug, but I couldn't. Could you please maybe test the code and tell me where I went wrong? Thanks. This is the code: package looppracticea; import java.util.Scanner; public class LoopPracticeA { public static void main(String[] args) { Scanner geek = new Scanner(System.in); Scanner geek2 = new Scanner(System.in); long taken_number, taken_number2; String answer, answer2, answer_not_recognized, if_answer_is_no; answer_not_recognized = "You didn't enter any of the recognized answers."; if_answer_is_no = "'Kay. Whatever."; System.out.println("Do you want to know the square of a number? (Y/…
has title: Trouble evaluating user input
tagged with: java
downvote count: 3
type: Question
answer count: 1
has comment: http://stackoverflow.com/comment/35859752
has answer: http://stackoverflow.com/a/23404141
accepted answer: http://stackoverflow.com/a/23404141
favorite count: 0
has comment: http://stackoverflow.com/comment/35859363
has comment: http://stackoverflow.com/comment/35859445
score: -3
type: AnsweredQuestion
upvote count: 0
has comment: http://stackoverflow.com/comment/35859488
has comment: http://stackoverflow.com/comment/35859502

http://stackoverflow.com/comment/35722529
has text: possible duplicate of [Can the key in a Java property include a blank character?](http://stackoverflow.com/questions/2108103/can-the-key-in-a-java-property-include-a-blank-character)
comment on: http://stackoverflow.com/q/23329419
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35943413
comment on: http://stackoverflow.com/q/23448581
score: 0
type: Comment
type: QuestionComment
has text: No! they are unchecked.

http://stackoverflow.com/q/23370914
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23371284
tagged with: java
has title: Creating a visible grid in a JPanel
type: Question
has comment: http://stackoverflow.com/comment/35798963
answer count: 2
possible better answer: http://stackoverflow.com/a/23371286
has answer: http://stackoverflow.com/a/23371284
upvote count: 1
has comment: http://stackoverflow.com/comment/35802790
favorite count: 0
score: 0
has comment: http://stackoverflow.com/comment/35798779
downvote count: 1
has body: What I'm trying to do I want to create an API (personal one) that allows me to input a dimension (say 10x10) and it creates a visible grid with 10 squares by 10 squares, with the added 'feature' of being able to change the fill of any of the squares via a method call. Not trying to use a mouse listener or any listeners of any sort. My thought process is something like this: Have the main JPanel that holds the grid recursively add 'box' objects and reference each one with an array location. My issue isn't the main JPanel, that I've got down easily enough. My issue is the object it's adding. I can't figure out what sort of component this should be. I attempted using a JPanel but couldn't get anything to be visible. Besides, the 'grid' look wouldn't be there either. I'm guessing I'm going to have to utilize swing.Graphics or Graphics2D but every example I've found online hasn't worked out well for me. Looking for advice on using Graphics, or if there's an even better way of getting what I want, I'd gladly try it out.
has comment: http://stackoverflow.com/comment/35803272
has answer: http://stackoverflow.com/a/23371286
tagged with: swing
tagged with: graphics

http://stackoverflow.com/comment/35898782
comment on: http://stackoverflow.com/q/23424283
type: QuestionComment
has text: You've referred to an image in your question, but I can't see one. However, if the error is textual it is probably better just to copy and paste it into the question.
score: 0
type: Comment

http://stackoverflow.com/comment/35908597
type: QuestionComment
has text: Maybe you right. i think its creating a new arraylist, so maybe i should just create 1 servlet and handle it all in that?
score: 0
comment on: http://stackoverflow.com/q/23428119
type: Comment

http://stackoverflow.com/q/23440303
tagged with: mixins
answer count: 1
favorite count: 0
tagged with: ruby
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35927997
accepted answer: http://stackoverflow.com/a/23440557
downvote count: 0
type: Question
has answer: http://stackoverflow.com/a/23440557
score: 1
tagged with: java
has body: I'm reading about mixins in ruby, and am reflecting on some of the knowledge I have about java. Isn't a mixin just another member variable that responds to methods of that type? I understand that in languages like ruby, its just a set of methods that can be "Mixed in" to the class. But how is that different from a java class containing a class member variable? Thank you in advance.
has title: Why is including a class member variable in a java class not like a ruby mixin?
upvote count: 1

http://stackoverflow.com/a/23300855
has comment: http://stackoverflow.com/comment/35676945
has body: I think you should set up a JNDI data source in JBOSS instead of using Struts for connectivity. Struts is web MVC.
has comment: http://stackoverflow.com/comment/35677140
has comment: http://stackoverflow.com/comment/65474176
has comment: http://stackoverflow.com/comment/35818585
has comment: http://stackoverflow.com/comment/35670794
score: 0
has comment: http://stackoverflow.com/comment/35677106
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23300815
answers question: http://stackoverflow.com/q/23300815
type: Answer
has comment: http://stackoverflow.com/comment/65474110

http://stackoverflow.com/comment/35844389
score: 0
type: AnswerComment
has text: Poor design is a bit besides the point here, I think - given the number of errors in the example (it doesn't compile). I mentioned already the best practice of using `Future`, but I included also the idea of a static variable to at least show the minimal working example to illustrate why the existing code didn't share anything.
type: Comment
comment on: http://stackoverflow.com/a/23375579

apache-poi
tags question: http://stackoverflow.com/q/23442866
tags question: http://stackoverflow.com/q/23371888
tags question: http://stackoverflow.com/q/23339098
tags question: http://stackoverflow.com/q/23293281
tags question: http://stackoverflow.com/q/23386091
type: Tag
tags question: http://stackoverflow.com/q/23322275
tags question: http://stackoverflow.com/q/23381949
tags question: http://stackoverflow.com/q/23341805
tags question: http://stackoverflow.com/q/23371006
tags question: http://stackoverflow.com/q/23366606
tags question: http://stackoverflow.com/q/23441238
tag name: apache-poi
tags question: http://stackoverflow.com/q/23298676
tags question: http://stackoverflow.com/q/23361379
tags question: http://stackoverflow.com/q/23330156
tags question: http://stackoverflow.com/q/23306067
tags question: http://stackoverflow.com/q/23305229
tags question: http://stackoverflow.com/q/23370159
tags question: http://stackoverflow.com/q/23363949
tags question: http://stackoverflow.com/q/23388700
tags question: http://stackoverflow.com/q/23436056

http://stackoverflow.com/comment/35886375
type: Comment
comment on: http://stackoverflow.com/q/23417711
type: QuestionComment
has text: When you were using them, how were they defined?
score: 0

http://stackoverflow.com/a/23409932
has body: You can use @Profile at configuration class level: @Configuration @Profile("dev") public class DevConfig { } @Configuration @Profile("prod") public class ProdConfig { } Then you can activate your current profile in different ways. For example inside a test class: @ActiveProfiles("dev") public class DevIntegrationTest In this case you are setting current active profile to dev and only @Profile("dev") annotated class are loaded. You can also set current active profile setting a parameter to jvm: -Dspring.profiles.active="dev" So continue to using your @Import, but only class with correct profile will be loaded.
has comment: http://stackoverflow.com/comment/35871497
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/35871032
has comment: http://stackoverflow.com/comment/35872247
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/23407926

http://stackoverflow.com/q/23312309
tagged with: java
has comment: http://stackoverflow.com/comment/35691062
type: Question
has answer: http://stackoverflow.com/a/23327757
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/35691402
tagged with: sms
accepted answer: http://stackoverflow.com/a/23327757
has body: I am using the bellow code to list a unique list of people that sent me SMS. It works fine but still its a bit slow it takes 4 to 5 seconds to load and I have 650 SMS on my device any suggestion ? protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); listSMS(); } private void listSMS() { TextView tview = (TextView) findViewById(R.id.list); Uri uriSMSURI = Uri.parse("content://sms/inbox"); ContentResolver cr= this.getContentResolver(); Cursor cur = cr.query(uriSMSURI, null, null, null, null); LinkedHashSet contactList= new LinkedHashSet(); String sms = ""; while (cur.moveToNext()) { if(!contactList.contains(cur.getString(2))) { contactList.add(cur.getString(2)); sms += "From :" + getContactName(cur.getString(2),cr)+"\n"; } } cur.close(); tview.append(sms); } public static String getContactName(String num, ContentResolver cr) { Uri u = Uri.withAppendedPath(ContactsContract.PhoneLookup.CONTENT_FILTER_URI,Uri.encode(num)); String[] projection = new String[] { ContactsContract.Contacts.DISPLAY_NAME}; Cursor c = cr.query(u, projection, null, null, null); try { if (!c.moveToFirst()) return num; int index = c.getColumnIndex(ContactsContract.Contacts.DISPLAY_NAME); return c.getString(index); } finally { if (c != null) c.close(); } }
tagged with: android
upvote count: 1
has title: Slow Performance while listing SMS with the senders in android
type: AnsweredQuestion
score: 1

http://stackoverflow.com/q/23425768
type: Question
answer count: 2
upvote count: 0
possible better answer: http://stackoverflow.com/a/23425976
favorite count: 0
has body: Is it possible to get the inputStream of particular website content or it's page source into String? For instance, I want to download the whole html tag from particular website into string or xml. Is it possible?
has answer: http://stackoverflow.com/a/23425850
tagged with: http://stackoverflow.com/tag/xml
accepted answer: http://stackoverflow.com/a/23425850
downvote count: 3
score: -3
type: AnsweredQuestion
has title: How to get the page source from specific link in Java?
tagged with: java
has answer: http://stackoverflow.com/a/23425976

http://stackoverflow.com/q/23449044
type: AnsweredQuestion
tagged with: java
type: Question
has title: How to fix this grails error? What it is about?
accepted answer: http://stackoverflow.com/a/23449214
tagged with: grails
score: 0
answer count: 1
has body: I have this error and I don't know how to fix it and why it has occurred. I'm using grails 2.2.4 and jdk 1.7.0. I am obviously doing something wrong. Did I forget to do something? Hoping for some instructions. | Error 2014-05-03 21:13:11,796 [localhost-startStop-1] ERROR context.GrailsContextLoader - Error initializing the application: Error creating bean with name 'transactionManagerPostProcessor': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager': Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory': Cannot resolve reference to bean 'lobHandlerDetector' while setting bean property 'lobHandler'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'lobHandlerDetector': Invocation of init method failed; nested exception is org.springframework.jdbc.support.MetaDataAccessException: Error while extracting DatabaseMetaData; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Communications link failure The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.) Message: Error creating bean with name 'transactionManagerPostProcessor': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager': Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory': Cannot resolve reference to bean 'lobHandlerDetector' while setting bean property 'lobHandler'; nested exception is org.…
has answer: http://stackoverflow.com/a/23449214

http://stackoverflow.com/q/23328738
tagged with: java
has answer: http://stackoverflow.com/a/23348771
type: Question
has body: I have a TabsPagerAdapter which only allows me to call Fragments, so I can't call a ListFragment public class TabsPagerAdapter extends FragmentPagerAdapter { public TabsPagerAdapter(FragmentManager fm) { super(fm); } @Override public Fragment getItem(int index) { switch (index) { case 0: // Top Rated fragment activity return new InformacionFragment(); case 1: // Games fragment activity return new ProductosFragment(); case 2: // Movies fragment activity return new MoviesFragment(); } return null; } @Override public int getCount() { // get item count - equal to number of tabs return 3; }} This is ProductosFragment, where I want to set the ListFragment: public class ProductosFragment extends Fragment { @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { return inflater.inflate(R.layout.zfragment_conjunta, container, false); } } And this is the ListFragment I want to include: http://pastebin.com/AXuXWvmd
score: 0
answer count: 2
possible better answer: http://stackoverflow.com/a/23328813
tagged with: android
accepted answer: http://stackoverflow.com/a/23348771
has title: Combining ListFragment and Fragment with a TabsPagerAdapter which only accepts fragments
type: AnsweredQuestion
tagged with: android-fragments
has answer: http://stackoverflow.com/a/23328813

http://stackoverflow.com/q/23351448
favorite count: 0
has answer: http://stackoverflow.com/a/23351528
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/35762985
has comment: http://stackoverflow.com/comment/35762945
tagged with: java
downvote count: 1
type: Question
upvote count: 0
has comment: http://stackoverflow.com/comment/35772463
score: -1
has body: I'm new here and to Android, so if I'm doing anything wrong please let me know. I've been googling for help on this and I really can't find anything. My app crashes on launch and I can't figure out why! Anyways, here's my facts.xml containing a string-array of all the facts I'm trying to make it show on the app. BONUS: This app was developed by 3 guys in a school! A single bolt of lightning contains enough energy to cook 100.000 pieces of toast. Neptune was discovered in the year 1846, and it didn't complete an orbit until 2011. If you drilled a tunnel straight through the Earth and jumped in, it would take you exactly 42 minutes and 12 seconds to get to the other side. The human brain takes in 11 million bits of information every second, but is only aware of 40. A red blood cell can make a complete circuit of your body in 20 seconds. The strongest creatures on Earth are gonorrhea bacteria. They can pull 100,000 times their own body weight. Polar Bears are nearly undetectable by infrared cameras, due to their transparent fur. The temperature on the surface of Mercury exceeds 430 degrees Celcius (806 Fahrenheit) during the day, and, at night, plummets to -180 degrees Celcius (-292 Fahrenheit) A total solar eclipse only happens once every one and a half years. Butterflies taste with their hind feet, and their taste sensation works on touch – this allows them to determine whether a leaf is edible. Saturn has 150 moons. The Appollo astronauts' footprints on the moon will probably stay there for at least 100 million years. To make 1 pound (453.6 grams) of honey, bees would have to visit more than 2 million flowers. Honey is the only food that doesn't spoil. Mona Lisa does not have any eyebrows. The farthest objects we can see in space are 47 billion light years away. The largest giant squid ever recorded was 43 feet (13.1 meters) long. It would take 1,200,000 mosquitoes, each sucking once, to completely drain the average human of blood. A black bear can run 35 mph (56.3 …
has title: How can I get my Android app to show a random string from an xml document string-array?
answer count: 1

http://stackoverflow.com/q/23420042
type: Question
accepted answer: http://stackoverflow.com/a/23420179
tagged with: java
tagged with: image
score: 0
answer count: 2
tagged with: location
possible better answer: http://stackoverflow.com/a/23420117
has answer: http://stackoverflow.com/a/23420117
tagged with: jlabel
has body: I'm making a game and having a few issues. For right now I got the image/character I wanna use on the frame but it appears on top of the screen and it doesn't move.I need to be able to use coordinates to be able to place where I want to.I've looked everywhere but none of the codes look similar to mine. Also I'm very new to Java so please be specific as possible. Here's my code: First Class: import java.awt.Color; import java.awt.Dimension; import javax.swing.*; public class JumpyBoy { public static void main(String[] args) { JFrame frame = new JFrame ("Boy"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setPreferredSize (new Dimension (1000, 700)); Boy panel = new Boy(); frame.getContentPane().add(panel); frame.pack(); frame.setVisible(true); } } The image's class: import javax.swing.*; import java.awt.*; import java.awt.Dimension; public class Boy extends JPanel { JLabel Boy1; ImageIcon Boy; public Boy () { setBackground (Color.white); Boy = new ImageIcon("Boy.png"); Boy1 = new JLabel (Boy, SwingConstants.CENTER); Dimension size = Boy1.getPreferredSize(); Boy1.setBounds(200, 400, 32, 321); //right here what should I do ^ JPanel panel = new JPanel(); panel.add (Boy1); add (panel); } }
tagged with: frame
has answer: http://stackoverflow.com/a/23420179
type: AnsweredQuestion
has title: I need to set an exact location for my image but it doesn't move?

http://stackoverflow.com/a/23295699
has comment: http://stackoverflow.com/comment/35660808
downvote count: 3
has body: Try to increase the heap memory on the receiver side using the JVM arguments like below, -Xms512m -Xmx1g -XX:PermSize=512m -XX:MaxPermSize=1g
has comment: http://stackoverflow.com/comment/35660978
answers question: http://stackoverflow.com/q/23295451
score: -3
has comment: http://stackoverflow.com/comment/35660624
upvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/35662106

http://stackoverflow.com/q/23333330
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/23333999
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35738236
tagged with: spring
has title: Controller Pathvariable bind removes ending space
tagged with: spring-mvc
upvote count: 3
linked to: http://stackoverflow.com/q/3526523
has body: I was wondering why Spring @PathVariable in the Controller is removing the spaces at the end of a word. for example my ajax is sending XYZ123. When this message is bind to a String with @PathVariable the ending space is removed by Spring. While it is send to the server as the correct String with the space. The URL is send to the controller like http://mydomain.com/user/XYZ123%20 and still spring is removing the space. Is this just a bug, or is there a reason for it?
type: Question
score: 3
tagged with: java
answer count: 1

http://stackoverflow.com/comment/35837764
type: AnswerComment
comment on: http://stackoverflow.com/a/23385368
type: Comment
has text: Atleast one thing in right direction. :) By any chance do you see any performance impacts with this `CountDownLatch` solution which I have above as compared to `ReentrantReadWriteLock` one which you were suggesting?
score: 0

http://stackoverflow.com/comment/35783753
type: Comment
has text: Check the javadoc of the FrameworkWiring.refreshBundles(...) function. The algorithm is well specified there. In short: Only those bundles are refreshed that have to be refreshed (but all those bundles transitively).
type: AnswerComment
score: 2
comment on: http://stackoverflow.com/a/23361835

http://stackoverflow.com/a/23301501
type: Answer
answers question: http://stackoverflow.com/q/23296510
has body: If you want to insert data to DB, you need a transaction. In order for Spring to provide a transaction, you need to put &lt;tx:annotation-driven /&gt; to your Spring context file, and put @Transactional annotation on the method that you insert data to DB. This way, Spring initiates a transaction for you as the method execution starts, and commits it when the method execution comes to an end (or rolls it back if an exception is thrown).
downvote count: 0
score: 1
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23296510

http://stackoverflow.com/a/23351095
score: 4
answers question: http://stackoverflow.com/q/23350903
type: Answer
has comment: http://stackoverflow.com/comment/35765352
has comment: http://stackoverflow.com/comment/35763980
has comment: http://stackoverflow.com/comment/35787132
upvote count: 4
has comment: http://stackoverflow.com/comment/35766852
has body: A border is painted when setBorderPainted is set to true, otherwise not: setBorderPainted: Sets the borderPainted property. If true and the button has a border, the border is painted. The default value for the borderPainted property is true. Some look and feels might not support the borderPainted property, in which case they ignore this. Note that some look and feels may ignore this property. Update: The default look and feel is called CrossPlatformLookAndFeel. This is not a look and feel but an indicator of the default one. What you get as default depends on the platform you are using. See How to Set the Look and Feel for details. I personally loke the Nimbus Look and Feel, but I have encountered some problems with it. I am not sure if it respects setBorderPainted, but I will not be surprised if it does not.
downvote count: 0

http://stackoverflow.com/a/26552869
upvote count: 2
answers question: http://stackoverflow.com/q/23341907
has body: The simplest way to do it is to use the class Value from package jolie.runtime in jolie.jar, which allows you to navigate the data tree passed from Jolie as a map: package example; import jolie.runtime.JavaService; import jolie.runtime.Value; import jolie.runtime.ValueVector; public class NAND extends JavaService { public Boolean test( Value request ) { ValueVector vec = request.getChildren( "number" ); for( Value v : vec ) { if ( !v.boolValue() ) return false; } return true; } } I took the liberty to adapt your code to a generic array. If you'd like to have automatic conversion from a Jolie value to a Java object of a custom-defined Java class, you can use ValueConverter (from jolie.runtime.JavaService). For example, the FileService from the Jolie standard library uses it like this: public static class StartsWithRequest implements ValueConverter { private String self, prefix; private StartsWithRequest() {} public static StartsWithRequest fromValue( Value value ) { StartsWithRequest ret = new StartsWithRequest(); ret.self = value.strValue(); ret.prefix = value.getFirstChild( "prefix" ).strValue(); return ret; } public static Value toValue( StartsWithRequest p ) { Value ret = Value.create(); ret.setValue( p.self ); ret.getFirstChild( "prefix" ).setValue( p.prefix ); return ret; } } public Boolean startsWith( StartsWithRequest request ) { return request.self.startsWith( request.prefix ); } Be wary that ValueConverter is still work in progress and there is no guarantee that the API will be kept stable in future versions of Jolie, we are still working on refining it (although it should not change or at least not change much).
downvote count: 0
type: Answer
score: 2

http://stackoverflow.com/a/23421179
score: 1
upvote count: 1
has body: static CollectionFacadeSet[] setArray = new CollectionFacadeSet[5]; Array will store the objects of CollectionFacadeSet so use new setArray[0] = new CollectionFacadeSet(new HashSet&lt;String&gt;());
answers question: http://stackoverflow.com/q/23421137
type: Answer
downvote count: 0

abstract-class
tags question: http://stackoverflow.com/q/23291434
tags question: http://stackoverflow.com/q/23320882
tags question: http://stackoverflow.com/q/23428194
type: Tag
tags question: http://stackoverflow.com/q/23327033
tags question: http://stackoverflow.com/q/23441734
tags question: http://stackoverflow.com/q/23438813
tag name: abstract-class
tags question: http://stackoverflow.com/q/23302920
tags question: http://stackoverflow.com/q/23415341
tags question: http://stackoverflow.com/q/23387299
tags question: http://stackoverflow.com/q/23447403
tags question: http://stackoverflow.com/q/23452097
tags question: http://stackoverflow.com/q/23327493

http://stackoverflow.com/comment/35654400
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23292479
has text: Can you edit the question an put in the exact error message?
score: 0

http://stackoverflow.com/comment/35964693
has text: In regards to your comment I need to specify one thing - getX() in first version is called when object is displayed (60 fps) and moreover in other methods like checking if object is within the borders of a screen (if it moves) etc. So I think it will not be good to perfom mapping in getX() method... So far performance is ok but is it a good practice ? I thought that whenever I have x field, its getter should always point to x, without any mutations...
comment on: http://stackoverflow.com/a/23449695
score: 0
type: AnswerComment
type: Comment

sqlite
tags question: http://stackoverflow.com/q/23331111
tags question: http://stackoverflow.com/q/23324451
tags question: http://stackoverflow.com/q/23439802
tags question: http://stackoverflow.com/q/23356799
tags question: http://stackoverflow.com/q/23330704
type: Tag
tags question: http://stackoverflow.com/q/23355800
tags question: http://stackoverflow.com/q/23293572
tags question: http://stackoverflow.com/q/23448330
tags question: http://stackoverflow.com/q/23381695
tags question: http://stackoverflow.com/q/23416155
tags question: http://stackoverflow.com/q/23369007
tags question: http://stackoverflow.com/q/23341635
tags question: http://stackoverflow.com/q/23325745
tags question: http://stackoverflow.com/q/23365161
tags question: http://stackoverflow.com/q/23353291
tags question: http://stackoverflow.com/q/23377658
tags question: http://stackoverflow.com/q/23296794
tags question: http://stackoverflow.com/q/23303865
tags question: http://stackoverflow.com/q/23394591
tags question: http://stackoverflow.com/q/23427966
tags question: http://stackoverflow.com/q/23356051
tags question: http://stackoverflow.com/q/23349354
tags question: http://stackoverflow.com/q/23331280
tags question: http://stackoverflow.com/q/23401850
tags question: http://stackoverflow.com/q/23386883
tags question: http://stackoverflow.com/q/23313520
tags question: http://stackoverflow.com/q/23442034
tag name: sqlite
tags question: http://stackoverflow.com/q/23330128
tags question: http://stackoverflow.com/q/23370135

http://stackoverflow.com/a/23330392
has comment: http://stackoverflow.com/comment/38434300
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/38432870
has body: An app engine Key can have EITHER a unique long ID, or a unique String name - they are mutually exclusive. If you set a long ID, the name will be null. Which you decide to use for any Entity kind really depends on your use case. A benefit of using long IDs is that you can have app engine auto-generate them for you. That is, you can create your Entity without any value for its ID, and then when you save it it will be given a valid unique long ID by the datastore. If you use a String name, you must create the unique name before the Entity is saved. This is useful in some cases if you have some property on the Entity that makes for a natural fit for the unique name (for example, and SKU for a part). Also, some people generate a random UUID for the String name - this ensures that all names are globally unique, not just unique among a particular Entity kind and ancestor path.
upvote count: 2
accepted answer of: http://stackoverflow.com/q/23324685
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23324685
has comment: http://stackoverflow.com/comment/38394570
type: Answer

http://stackoverflow.com/q/23431183
score: 4
has comment: http://stackoverflow.com/comment/35911946
upvote count: 4
answer count: 2
has answer: http://stackoverflow.com/a/23431261
downvote count: 0
favorite count: 0
has title: Where is the reference in this Thread going ?
possible better answer: http://stackoverflow.com/a/23434290
has answer: http://stackoverflow.com/a/23434290
accepted answer: http://stackoverflow.com/a/23431261
type: AnsweredQuestion
tagged with: java
tagged with: multithreading
has comment: http://stackoverflow.com/comment/35911929
type: Question
linked to: http://stackoverflow.com/q/9851813
has comment: http://stackoverflow.com/comment/35911897
has body: I want to start learning Java a bit. I am about to write a pretty basic program, where I want to display a series of numbers (1,2,3,4, 5….etc) in an infinite loop. The program should quit if someone hits a specific key (Say ESCAPE key). So I thought about using Threads for those two tasks (infinite loop and the user binding). I just have a Thread for the infinite loop and this is how my Code looks like: public class LearnJava implements Runnable { private int i = 0; private boolean running = false; private Thread counter; public void start(){ running = true; counter = new Thread(this); counter.start(); } /*the stop method is not really in use yet*/ public void stop(){ running = false; try{ counter.join(); } catch (InterruptedException e){ e.printStackTrace(); } } public void run(){ while (running){ System.out.println("ThreadTest: " + i); i++; } } public LearnJava(){ } public static void main(String[] args){ LearnJava programm = new LearnJava(); programm.start(); } } Now what I don't understand in my own example is the "this" reference in my Thread. I always tried to run it with out any reference, because I didn't knew the reason for it. I just got the correct code by random to be honest. I wrote it all by myself and thought to understand it properly but obviously I am not. Can anybody explain why I needed to take the "this" reference in line: counter = new Thread(this);
has comment: http://stackoverflow.com/comment/35910552

http://stackoverflow.com/q/23450352
has body: Somewhat related question, and a year old: Do any JVM&#39;s JIT compilers generate code that uses vectorized floating point instructions? Preface: I am trying to do this in pure java (no JNI to C++, no GPGPU work, etc...). I have profiled and the bulk of the processing time is coming from the math operations in this method (which is probably 95% floating point math and 5% integer math). I've already reduced all Math.xxx() calls to an approximation that's good enough so most of the math is now floating point multiplies with a few adds. I have some code that deals with audio processing. I've been making tweaks and have already come across great gains. Now I'm looking into manual loop unrolling to see if there's any benefit (at least with a manual unroll of 2, I am seeing approximately a 25% improvement). While trying my hand at a manual unroll of 4 (which is starting to get very complicated since I am unrolling both loops of a nested loop) I am wondering if there's anything I can do to hint to the jvm that at runtime it can use vector operations (e.g. SSE2, AVX, etc...). Each sample of the audio can be calculated completely independently of other samples, which is why I've been able to see a 25% improvement already (reducing the amount of dependencies on floating point calculations). For example, I have 4 floats, one for each of the 4 unrolls of the loop to hold a partially computed value. Does how I declare and use these floats matter? If I make it a float[4] does that hint to the jvm that they are unrelated to each other vs having float,float,float,float or even a class of 4 public floats? Is there something I can do without meaning to that will kill my chance at code being vectorized? I've come across articles online about writing code "normally" because the compiler/jvm knows the common patterns and how to optimize them and deviating from the patterns can mean less optimization. At least in this case however, I wouldn't have expected unrolling the loops by 2 to ha…
favorite count: 0
has comment: http://stackoverflow.com/comment/35963904
has answer: http://stackoverflow.com/a/23456151
has answer: http://stackoverflow.com/a/40583902
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36206923
tagged with: performance
score: 21
tagged with: java
has comment: http://stackoverflow.com/comment/35971743
has comment: http://stackoverflow.com/comment/35951031
linked to: http://stackoverflow.com/q/21745619
upvote count: 21
linked to: http://stackoverflow.com/q/21738690
type: Question
tagged with: jvm-hotspot
has comment: http://stackoverflow.com/comment/35951637
linked to: http://stackoverflow.com/q/10784951
has comment: http://stackoverflow.com/comment/36003479
has comment: http://stackoverflow.com/comment/35971793
answer count: 2
downvote count: 0
has title: How can I write code to hint to the JVM to use vector operations?
has comment: http://stackoverflow.com/comment/35949633

http://stackoverflow.com/q/23317298
possible better answer: http://stackoverflow.com/a/44045660
accepted answer: http://stackoverflow.com/a/23317330
has answer: http://stackoverflow.com/a/44045660
upvote count: 5
tagged with: java
tagged with: navigation
type: Question
answer count: 2
score: 5
downvote count: 0
favorite count: 0
has body: I'm fairly new to android programming and developed an app that has a Navigation Drawer implemented. Per Google guidelines, i'd like the NavDraw to start open but am unable to do this. This is my onCreate (I guess this is where I should implement this feature, right?) protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ArrayAdapter&lt;String&gt; adapter = new ArrayAdapter&lt;String&gt;(getActionBar().getThemedContext(), android.R.layout.simple_list_item_1, menuEntries); final DrawerLayout drawer = (DrawerLayout)findViewById(R.id.drawer_layout); final ListView navList = (ListView) findViewById(R.id.drawer); getActionBar().setDisplayHomeAsUpEnabled(true); getActionBar().setHomeButtonEnabled(true); drawerToggle = new ActionBarDrawerToggle( this, drawer, R.drawable.ic_drawer, R.string.drawer_open, R.string.drawer_close ) (...)
tagged with: android
has answer: http://stackoverflow.com/a/23317330
has title: Open Navigation Drawer at startup
tagged with: drawer
tagged with: startup
type: AnsweredQuestion

http://stackoverflow.com/comment/35908663
comment on: http://stackoverflow.com/a/23429963
has text: More importantly, there is a lesson here: Just because it's in a book doesn't mean the author bothered to make sure it was working. :-)
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/23318177
tagged with: android
upvote count: 1
type: AnsweredQuestion
score: 1
tagged with: java
has body: I have brought some data from webservice in the form of json and converted into ArrayList. But when I load it into Spinner with Adapter, it is giving Unable to start activity ComponentInfo... and other execptions. I am posting my code below. &lt;Spinner android:id="@+id/spin_type" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@drawable/edittext" /&gt; LoadViolationTypes() method: public void LoadViolationTypes(){ AsyncSpinnerLoader asl = new AsyncSpinnerLoader(); asl.execute(); String res=""; try { res = asl.get(); } catch (InterruptedException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } catch (ExecutionException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } ArrayList&lt;String&gt; itemsList = new ArrayList&lt;String&gt;(); try { JSONArray array = new JSONArray(res); for (int i=0; i &lt; array.length(); i++) { String s = (String) array.get(i); itemsList.add(s); } Spinner spinner = (Spinner) findViewById(R.id.vehicle_type); ArrayAdapter&lt;String&gt; adapter = new ArrayAdapter&lt;String&gt;(this, android.R.layout.simple_spinner_item, itemsList); spinner.setAdapter(adapter); } catch (JSONException e) { e.printStackTrace(); } }
has answer: http://stackoverflow.com/a/23318222
type: Question
has title: Loading Spinner with ArrayList is giving exception of Unable to start activity ComponentInfo and app crashes
tagged with: nullpointerexception
answer count: 1
accepted answer: http://stackoverflow.com/a/23318222
downvote count: 0
favorite count: 0
tagged with: android-resources

http://stackoverflow.com/comment/35735958
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23337124
has text: Where `i` is declared?

http://stackoverflow.com/comment/44318704
score: 1
comment on: http://stackoverflow.com/a/23327024
type: AnswerComment
has text: For future readers of this Q&A you might also want to post a solution for 2.x (unless the API change in that respect has not yet stabilized, that is).
type: Comment

python
tags question: http://stackoverflow.com/q/23438983
tags question: http://stackoverflow.com/q/23436818
tags question: http://stackoverflow.com/q/23302045
tags question: http://stackoverflow.com/q/23324731
tag name: python
tags question: http://stackoverflow.com/q/23378574
tags question: http://stackoverflow.com/q/23430466
tags question: http://stackoverflow.com/q/23315842
tags question: http://stackoverflow.com/q/23317291
tags question: http://stackoverflow.com/q/23378071
tags question: http://stackoverflow.com/q/23448532
tags question: http://stackoverflow.com/q/23390273
tags question: http://stackoverflow.com/q/23318201
tags question: http://stackoverflow.com/q/23446727
tags question: http://stackoverflow.com/q/23294975
tags question: http://stackoverflow.com/q/23323073
type: Tag
tags question: http://stackoverflow.com/q/23303787
tags question: http://stackoverflow.com/q/23330462
tags question: http://stackoverflow.com/q/23357479
tags question: http://stackoverflow.com/q/23376658
tags question: http://stackoverflow.com/q/23376760
tags question: http://stackoverflow.com/q/23310776

http://stackoverflow.com/q/23443337
score: 1
tagged with: java
linked to: http://stackoverflow.com/q/17718076
type: Question
has title: Java - Check if index already exists neo4j (if clause)
accepted answer: http://stackoverflow.com/a/23444339
downvote count: 0
answer count: 1
tagged with: neo4j
has body: I'm actually building onto the question: How to check if a schema index already exists for a node&#39;s property in neo4j? I can however not find how to do the actual if clause. For example: label = DynamicLabel.label("Label"); Iterable&lt;IndexDefinition&gt; indexes = schema.getIndexes(label); for(IndexDefinition index : indexes) { if(index.equals(schema.indexFor(label).on("id"))) { // index exists on property "id" on label "Label"! } } This however isn't working!
favorite count: 0
upvote count: 1
has answer: http://stackoverflow.com/a/23444339
type: AnsweredQuestion

animation
tags question: http://stackoverflow.com/q/23319025
tags question: http://stackoverflow.com/q/23329882
type: Tag
tag name: animation
tags question: http://stackoverflow.com/q/23331476
tags question: http://stackoverflow.com/q/23452499
tags question: http://stackoverflow.com/q/23367718
tags question: http://stackoverflow.com/q/23393664
tags question: http://stackoverflow.com/q/23304277

http://stackoverflow.com/comment/35748709
has text: Dont know - I'm not using backbone. But what is the problem to replace the `%` with `%25`?
type: QuestionComment
comment on: http://stackoverflow.com/q/23343897
score: 0
type: Comment

http://stackoverflow.com/q/23327340
has title: Why am I getting a NullPointerException when I try to get data from a getter?
has comment: http://stackoverflow.com/comment/35718502
has comment: http://stackoverflow.com/comment/35731820
type: UnansweredQuestion
tagged with: swing
has comment: http://stackoverflow.com/comment/35718378
type: Question
has answer: http://stackoverflow.com/a/23327532
tagged with: java
has comment: http://stackoverflow.com/comment/35718368
has answer: http://stackoverflow.com/a/23327503
answer count: 2
has comment: http://stackoverflow.com/comment/35718388
score: 0
tagged with: nullpointerexception
has body: EDIT: ok here is my full code since you guys are asking for it : import javax.swing.*; import java.awt.*; public class Panel extends JPanel { private JTextField username_field; private JTextField skype_field; private JTextField raidcall_field; private JTextField teamspeak_field; private JComboBox server_combobox; private JComboBox levels_combobox; private JComboBox mytier_combobox; private JComboBox mydiv_combobox; private JComboBox partner_tier_combobox; private JComboBox partner_div_combobox; private JComboBox myrole_combobox; private JComboBox partner_role_combobox; private JRadioButton normal,ranked; private String region; private String tier; private String division; private String skype; private String raidcall; private String teamspeak; private String partner_role; private int mode; public Panel(AppUI.Panels panel){ String star = "*"; switch (panel) { case NORTHPANEL : setBackground(Color.getHSBColor(20,20,20)); JLabel title = new JLabel(); title.setText(" fields marked with " + star + " are required to be filled. "); title.setFont(new Font("Tahoma", Font.BOLD, 10)); add(title); break; case CENTERPANEL : setLayout(new GridBagLayout()); setBackground(Color.LIGHT_GRAY); username_field = new JTextField(10); username_field.setToolTipText("Enter your Summoner name here"); String[] servers = { "NA", "EUW", "EUNE", "TR", "BR", "LAN", "LAS", "RU", "OCE" }; server_combobox = new JComboBox<String>(servers); server_combobox.setToolTipText("Select the region your account is in"); String[] levels = {"1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16" ,"17","18","19","20","21","22","23","24","25","26","27","28","29","30"}; levels_combobox = new JComboBox<String>(levels); levels_combobox.setToolTipText("Select the level your summoner is"); addItem(this, new JLabel(" Summoner name :" + star + " ") , 0, 0, 1, 1); addItem(this, username_field ,1,0,1,1); addItem(this, new JLabel(" Summoner level :" + star + " "), 0,1,1,1); addItem(this, levels_combobox, 1,1,1…
has comment: http://stackoverflow.com/comment/35718348

http://stackoverflow.com/a/23434896
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 2
has body: the listener again reacts to them remove the listener do your processing add the listener back to the component
upvote count: 2
has comment: http://stackoverflow.com/comment/35929449
has comment: http://stackoverflow.com/comment/35938079
accepted answer of: http://stackoverflow.com/q/23434859
answers question: http://stackoverflow.com/q/23434859

http://stackoverflow.com/comment/35858931
comment on: http://stackoverflow.com/q/23402877
has text: Its a limited time trail. Could you give a link to a freeware version?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35851061
score: 0
type: Comment
type: QuestionComment
has text: 10 seconds of Googling should have led you to Wikipedia (http://en.wikipedia.org/wiki/Sigmoid_function), which has the relevant function in the first three lines.
comment on: http://stackoverflow.com/q/23399280

http://stackoverflow.com/q/23404067
accepted answer: http://stackoverflow.com/a/23404325
answer count: 1
tagged with: list
has title: write two lists of parcelables into parcel in Android
tagged with: java
has body: I have object Contact: public class Contact implements Parcelable with properties: private List&lt;EmailAttribute&gt; contact_emails_attributes = new ArrayList&lt;EmailAttribute&gt;(); private List&lt;PhoneAttribute&gt; contact_phones_attributes = new ArrayList&lt;PhoneAttribute&gt;(); EmailAttribute and PhoneAttribute implemets Parcelable. How to write contact's properties into parcel and read them ? I was looking for solution long time but I have found no solution how to write different parcelables into parcel. Thanks.
tagged with: parcelable
has answer: http://stackoverflow.com/a/23404325
score: 2
type: AnsweredQuestion
downvote count: 0
favorite count: 0
type: Question
upvote count: 2
tagged with: android
tagged with: parcel

http://stackoverflow.com/comment/35833992
comment on: http://stackoverflow.com/q/23390015
type: QuestionComment
score: 0
has text: I'm not sure what webstart apps are, is it itself being invoked via a .bat file? If so, you can add a lines, SET JAVA_HOME=(JDK Loc), and, SET JRE_HOME=(JDK Loc). If you manually run the application, as in not through an IDE, you could make a .bat file that set's the variable then executes the app.
type: Comment

http://stackoverflow.com/comment/35759242
type: Comment
type: QuestionComment
has text: You are looking at docs for spring v2, the latest release is 4, btw.
score: 0
comment on: http://stackoverflow.com/q/23349565

http://stackoverflow.com/comment/35734186
comment on: http://stackoverflow.com/a/23335905
score: 1
type: AnswerComment
type: Comment
has text: Good catch! However, this means the question should arguably be close-voted as "simple typographical error" ;)

http://stackoverflow.com/comment/35946045
score: 0
type: Comment
type: QuestionComment
has text: The program reaches to the end of try catch.
comment on: http://stackoverflow.com/q/23450043

http://stackoverflow.com/q/23416115
accepted answer: http://stackoverflow.com/a/23416577
answer count: 1
favorite count: 0
tagged with: arraylist
score: 0
tagged with: android
has body: I've been googling some on similar questions but I simply can't figure out what's causing my error(I know where the error is but I don't know how to solve it codewise).I know i might get some flak for this but if Someone could help me with a code solution I would be much thankful! My ExpandableListViewAdapter: public class ExpandableListAdapter extends BaseExpandableListAdapter { private Context context; private List&lt;String&gt; listDataHeader; private ArrayList&lt;ArrayList&lt;Question&gt;&gt; listDataChild; private LayoutInflater inflater; public ExpandableListAdapter(Context context, List&lt;String&gt; listDataHeader, ArrayList&lt;ArrayList&lt;Question&gt;&gt; listChildData) { this.context = context; this.listDataHeader = listDataHeader; this.listDataChild = listChildData; inflater = LayoutInflater.from(context); } @Override public Object getChild(int groupPosition, int childPosition) { return listDataChild.get(groupPosition).get(childPosition); } @Override public long getChildId(int groupPosition, int childPosition) { return childPosition; } @Override public View getChildView(int groupPosition, int childPosition, boolean isLastChild, View convertView, ViewGroup parent) { View view = null; if (convertView != null) view = convertView; else view = inflater.inflate(R.layout.list_item, parent, false); Question question = (Question) getChild(groupPosition, childPosition); TextView txtviewquestion = (TextView) view.findViewById(R.id.question); if (txtviewquestion != null) txtviewquestion.setText(question.getQuestion()); //***TITTA NÄRMARE PÅ KNAPPARNA****** //Button btnPositive = (Button)view.findViewById( R.id.BtnPositive ); //btnPositive.setChecked( c.getState() ); //Button btnNegative = (Button)view.findViewById( R.id.BtnNegative ); //btnNegative.setChecked( c.getState() ); return view; } @Override public int getChildrenCount(int groupPosition) { return listDataChild.get(groupPosition).size(); } @Override public Object getGroup(int groupPosition) { return this.lis…
upvote count: 1
has answer: http://stackoverflow.com/a/23416577
downvote count: 1
type: Question
has title: Need help to solve IndexOutOfBoundsException in ExpandableListView
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/35796382
score: 1
type: AnswerComment
has text: your Car inherits all methods and variables from its parent class. So, its not a MoveableObject that has those values, but a Car that happens to be a MoveableObject.
comment on: http://stackoverflow.com/a/23369609
type: Comment

http://stackoverflow.com/q/23393454
has body: With a conventional persistence unit, it is possible to inject a DataSouce via @Resource. Now, I have a composite unit and i want to know if i can have access to a DataSouce of the composite unit?
answer count: 0
has comment: http://stackoverflow.com/comment/36233307
tagged with: java
type: Question
tagged with: jakarta-ee
tagged with: jpa
score: 0
has comment: http://stackoverflow.com/comment/35840430
tagged with: eclipselink
tagged with: jpa-2.0
has title: Is it possible to have DataSource injection with composite unit?
type: UnansweredQuestion

http://stackoverflow.com/a/23374582
has comment: http://stackoverflow.com/comment/35805546
type: Answer
has comment: http://stackoverflow.com/comment/35808332
upvote count: 1
answers question: http://stackoverflow.com/q/23374181
score: 1
has comment: http://stackoverflow.com/comment/35808860
has comment: http://stackoverflow.com/comment/35808454
downvote count: 0
has comment: http://stackoverflow.com/comment/35808294
has body: why not simply change it to: if (activityLevel.equals("Choose an activity level")) noActivity(); the rest of the options are in else if blocks anyway i don't think that is a proper use for an Exception

http://stackoverflow.com/a/32813618
has body: Upcasting and downcasting are important part of Java, which allow us to build complicated programs using simple syntax, and gives us great advantages, like Polymorphism or grouping different objects. Java permits an object of a subclass type to be treated as an object of any superclass type. This is called upcasting. Upcasting is done automatically, while downcasting must be manually done by the programmer, and i'm going to give my best to explain why is that so. Upcasting and downcasting are NOT like casting primitives from one to other, and i believe that's what causes a lot of confusion, when programmer starts to learn casting objects. Polymorphism: All methods in java are virtual by default. That means that any method can be overridden when used in inheritance, unless that method is declared as final or static. You can see the example below how getType(); works according to the object(Dog,Pet,Police Dog) type. Assume you have three dogs Dog - This is the super Class. Pet Dog - Pet Dog extends Dog. Police Dog - Police Dog extends Pet Dog. public class Dog{ public String getType () { System.out.println("NormalDog"); return "NormalDog"; } } /** * Pet Dog has an extra method dogName() */ public class PetDog extends Dog{ public String getType () { System.out.println("PetDog"); return "PetDog"; } public String dogName () { System.out.println("I don't have Name !!"); return "NO Name"; } } /** * Police Dog has an extra method secretId() */ public class PoliceDog extends PetDog{ public String secretId() { System.out.println("ID"); return "ID"; } public String getType () { System.out.println("I am a Police Dog"); return "Police Dog"; } } Polymorphism : All methods in java are virtual by default. That means that any method can be overridden when used in inheritance, unless that method is declared as final or static.(Explanation Belongs to Virtual Tables Concept) Virtual Table / Dispatch Table : An object's dispatch table will contain the addresses of the object's dynamical…
has comment: http://stackoverflow.com/comment/53464440
has comment: http://stackoverflow.com/comment/53464874
has comment: http://stackoverflow.com/comment/53464718
downvote count: 1
answers question: http://stackoverflow.com/q/23414090
type: Answer
has comment: http://stackoverflow.com/comment/53464977
has comment: http://stackoverflow.com/comment/53464328
has comment: http://stackoverflow.com/comment/53464523
upvote count: 35
score: 34
has comment: http://stackoverflow.com/comment/53464685
has comment: http://stackoverflow.com/comment/53464563

http://stackoverflow.com/q/23293870
answer count: 1
has comment: http://stackoverflow.com/comment/35657742
has answer: http://stackoverflow.com/a/23293929
has body: The title kind of says the most of it but I want to connect to SQL using my Android app that I have in development so I made a sample set of code just to test the concept without using android and it worked. When I tried to use it on Android it doesn't work (connection error) is there a permission I need to request in my manifest? Any help is greatly appreciated.
tagged with: android
has comment: http://stackoverflow.com/comment/35656923
linked to: http://stackoverflow.com/q/15732853
type: UnansweredQuestion
tagged with: java
tagged with: mysql
type: Question
has comment: http://stackoverflow.com/comment/35656921
score: 0
has title: SQL connection works in normal Java but not Android
tagged with: sql

http://stackoverflow.com/q/23330193
has answer: http://stackoverflow.com/a/23330208
answer count: 1
tagged with: frame
score: 0
type: UnansweredQuestion
tagged with: swing
type: Question
has body: I'm wondering, I've been using Netbeans as a learning tool for java and for the past programs that I've made I've been using: this.dispose(); Frame2 frame2 = new frame2(); frame2.setVisible(true); Is this the best way to do it?
tagged with: java
tagged with: dispose
linked to: http://stackoverflow.com/q/9554636
has comment: http://stackoverflow.com/comment/35731551
has title: Best way to close a frame?

http://stackoverflow.com/q/23336873
tagged with: batch-file
has title: Issue while running multiple batch files from same batch file
type: UnansweredQuestion
tagged with: windows
tagged with: cmd
has body: I'm trying to call second.bat file from first.bat file(Mean to say first.bat is main file which is calling second.bat and second.bat is called one). first.bat echo Going to call second batch file call second.bat echo End of first batch file. exit 0 second.bat @echo off setLocal EnableDelayedExpansion cmd /c start /b jre\bin\java -Djava.library.path=nativelib -classpath SampleTest.jar com.test.SampleTest argument1 Here the issue is when I called the second.bat from first batch file , the second.bat file is not giving control back to the first.bat file. Its just hanging. I'm calling one Java process from second.bat file , after successful launching of that process the control should be go back to the first.bat and finish the rest of the activities of first.bat. Here the control is not coming back. Can anyone please help me that how I can achieve this scenario. Thanks In Advance.
has comment: http://stackoverflow.com/comment/35736042
has comment: http://stackoverflow.com/comment/35735831
upvote count: 1
type: Question
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/23337057
downvote count: 0
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/35735672

http://stackoverflow.com/q/23319699
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/23337820
tagged with: spring
has title: Simple Way of Display the Result in the Same Page where Query was Made - Spring App
type: AnsweredQuestion
score: 3
downvote count: 0
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/35704983
tagged with: jsp
has body: I am new user of spring and java technology. I am trying to make a simple search application which take the query in search box and display the result in another pages. The page that receive the search query is input.jsp - <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <%@taglib prefix="form" uri="http://www.springframework.org/tags/form" %> Input Form <form:form action="output.html" commandName="query" > Enter query : <form:input path="query"/> </form:form> The page that display the result is output.jsp - <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> Oputput Form Result: <c:out value="${query.result}" /> And the controller 'BaseController.java" is - @Controller public class BaseController { private SearchManager srchMgr = new SearchManager(); private static Logger logger = Logger.getLogger(BaseController.class); @RequestMapping(value = "/input.html", method = RequestMethod.GET) public void getIp(Model model) { model.addAttribute(new Query()); } @RequestMapping(value = "/output.html", method = RequestMethod.POST) public void showOutput(@ModelAttribute Query query, Model model){ model.addAttribute("query", query); } } Now I am trying to display all of the things in output.jsp in input.jsp (the search result). In order to do this what changes should I made? I have tried with placing all the code from output.jsp to input.jsp and have changed @RequestMapping too. But it did not worked.Thanks in Advance
upvote count: 3
accepted answer: http://stackoverflow.com/a/23337820

http://stackoverflow.com/a/23341099
has comment: http://stackoverflow.com/comment/35743771
accepted answer of: http://stackoverflow.com/q/23340931
score: 10
answers question: http://stackoverflow.com/q/23340931
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35748233
has body: try with ll.getHeight() should work if not, it's because android has not yet calculed its bounds, then: //inside of onCreate method should work ll.post(new Runnable() { @Override public void run() { //maybe also works height = ll.getLayoutParams().height; height = ll.getHeight(); } });
has comment: http://stackoverflow.com/comment/35748165
has comment: http://stackoverflow.com/comment/35742948
upvote count: 10
downvote count: 0
type: Answer

http://stackoverflow.com/q/23293095
favorite count: 0
has answer: http://stackoverflow.com/a/23293465
tagged with: resultset
has comment: http://stackoverflow.com/comment/35655439
has comment: http://stackoverflow.com/comment/35655707
has title: MySQL query to get Records in Result set
downvote count: 6
type: AnsweredQuestion
tagged with: java
tagged with: mysql
accepted answer: http://stackoverflow.com/a/23293465
has comment: http://stackoverflow.com/comment/35655365
type: Question
has body: I have table T1. id | name | surname 1 AA XX 2 BB YY 3 CC ZZ I want such query which will return all data of rows, where id=1 &amp; id =2
has comment: http://stackoverflow.com/comment/35655814
upvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/35655371
score: -6

http://stackoverflow.com/a/23405906
answers question: http://stackoverflow.com/q/23405212
has comment: http://stackoverflow.com/comment/35863126
score: 0
has comment: http://stackoverflow.com/comment/35865968
has comment: http://stackoverflow.com/comment/35863198
type: Answer
has comment: http://stackoverflow.com/comment/35863276
has body: It Looks like a character encoding issue. You can encode character to UTF-8 as specified in your JSP as below, Charset.forName("UTF-8").encode(myString)

http://stackoverflow.com/comment/35853948
has text: Thank you, I had figured and just turned in my project anyways, I'm sure my code would show up on windows, though I did not test it.
type: Comment
comment on: http://stackoverflow.com/a/23378552
score: 0
type: AnswerComment

http://stackoverflow.com/comment/35849331
type: Comment
score: 1
comment on: http://stackoverflow.com/q/23398257
has text: Honestly, go buy a copy of 'Java Concurrency in Practice'. This is an enormous topic that even explaining to at a high level to go about your specific task doesn't really help because of the complexity involved (in terms of Java's memory model).
type: QuestionComment

http://stackoverflow.com/comment/35863952
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23394024
has text: Hi, I have updated my question to include more information. I had already tried these ways, and I should have made that clearer.

http://stackoverflow.com/q/23369489
tagged with: java
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/23370163
upvote count: 0
linked to: http://stackoverflow.com/q/2390102
has title: How to set value to spinner in Android?
accepted answer: http://stackoverflow.com/a/23370163
answer count: 1
favorite count: 0
has body: I'm creating application for the spinner. I have two activities in my application which is Spinner in second Activity. I'm trying to pass the string value from one Activity to another Activity and that string value put it into Spinner in another Activity. I tried but I can't find proper solution. Here is my spinner code private String[] models = { " 207"," 308CC"," 308SW"," 508"," 3008"," 5008"," 308", " RCZ R"," 5008", " 207CC"}; Intent intent = getIntent(); modelString = intent.getExtras().getString("MODEL"); spinnerModels = (Spinner)findViewById(R.id.Model_spinnerTestDrive); ArrayAdapter&lt;String&gt; adapter_state = new ArrayAdapter&lt;String&gt;(this, android.R.layout.simple_spinner_item, models); adapter_state .setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spinnerModels.setAdapter(adapter_state); int spinnerPosition = adapter_state.getPosition(spinnerModels); spinnerModels.setSelection(spinnerPosition); I have already put some value into spinner. If I set this value it should be displayed in spinner.
tagged with: android
score: -1
type: AnsweredQuestion

http://stackoverflow.com/comment/35662596
type: Comment
score: 1
has text: Thank you! I tried your first suggestion and it works perfectly!
type: AnswerComment
comment on: http://stackoverflow.com/a/23294984

http://stackoverflow.com/q/23377594
has body: Imagine that I have String X. How could I call method X() in java? An example implementation (this is not my application, as this question is more theoretical and does not have a specific application in mind): I have a console line program. A scanner object is being used for input. We have 1000s of methods in our program, and we need users in our console to be able to execute these methods by name. For example (psuedocode), public static void main(String[] args) { // string X is prompted to be either doBlah, getBlah, etc... String X = keyScanner.next(); execute(X + "()"); //psuedocode for what I would like to do } public void doBlah() {} public void getBlah() {} public void letNooo() {} // etc... (just random method names, no particular pattern) How could I do this in Java, or really any language? Thank you.
score: 2
answer count: 1
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/23377637
upvote count: 2
has comment: http://stackoverflow.com/comment/35810944
has title: Call Method based on String
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35810976
tagged with: java
has comment: http://stackoverflow.com/comment/35810938
tagged with: methods
type: Question
has answer: http://stackoverflow.com/a/23377637

http://stackoverflow.com/comment/35928167
type: AnswerComment
comment on: http://stackoverflow.com/a/23440002
score: 0
type: Comment
has text: Surrender Kannan huh? I didn't ask how to compile. The .class file has already been created.

http://stackoverflow.com/comment/35948628
score: 1
has text: It could be that when you add the new panel, focus goes to that panel. The component that the listener is added to must be in focus. After adding the panel, try calling `component.requestFocus()` on the component containing the listener
comment on: http://stackoverflow.com/q/23451335
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35828030
type: Comment
type: QuestionComment
has text: why don't you put it around a try catch block and get us the Exception
score: 1
comment on: http://stackoverflow.com/q/23387241

http://stackoverflow.com/a/23435785
has body: You need to look at the actual Java API. A non-blocking connect consists of two operations: a connect(), which sends the SYN and initiates the handshake, and a finishConnect(), which tests for completion of the handshake. The handshake is asynchronous, and when it completes it triggers an OP_CONNECT for the Selector. There is no 'return false' from any connect operation in Java, but there are exceptions.
score: 0
answers question: http://stackoverflow.com/q/23435698
type: Answer

http://stackoverflow.com/a/23570912
answers question: http://stackoverflow.com/q/23329611
type: Answer
has body: I think that its a mistake to think of generating it one element at at time. Instead imagine that I generate the entire set of permissible rows {001100,101010,....etc} There are only 6!/(3!3!)=20 ways to arrange three ones and three and some of them will be excluded. Now I am going to generate a game tree by saying that a move is selecting a valid row for the next row. If I discover at some point that there are no more valid moves then i will back track and try a different move. To generate a move I randomly select a row, if its a valid move, I try to select another move, if that is impossible I backtrack, effectively doing a (random) depth first search of the game tree. public class gametree { public static ImmutableList&lt;Row&gt; allValidRows = // create a list of all valid rows. public static List&lt;Rows&gt; getValidMoves(Move parent){ //Backtracks up the //tree to the root to find the current state of the board, and returns //which ever of allValidRows are valid given the game board. } public class Move { public final Move parent; public List&lt;Rows&gt; validMoves; public final Row thisMove; public int depth=0; Move(Move parent, Row thisMove){ this.thisMove = thisMove; this.parent = parent; this.validMoves = getValidMoves(parent); Move hold=parent; while(hold!=null){ depth++; hold = parent.parent; } } } void run { //pick first move Move Root = new Move(null, Collections.Shuffle(allValidRows).get(0)); Move FinalMove = search(Root); //Something to print out the answer here } public Move search(Move move){ if(depth==5){ return Move} //If I get to row six I win. else if(move.validMoves.isEmpty()) { //If there are no valid moves, //then this move wasnt valid, to strip it from the parent's //possible moves and try again move.parent.validMoves.remove(move.thisMove); search(move.parent); } else { //pick a random valid move and create a nextMove Move nextMove = new Move(move, Collection.Shuffle(move.getValidMoves).get(0)) search(nextMove); } } The worst case for this …
score: 0

http://stackoverflow.com/comment/35771549
type: AnswerComment
comment on: http://stackoverflow.com/a/23348672
score: 0
type: Comment
has text: I viewed the demo and did not understand what to enter into the fields if I do not have a public identity, but a local 192.168.1.194 SIP server. I have it's IP-address, login (local phone number) and password.

http://stackoverflow.com/q/23420733
tagged with: websocket
tagged with: tomcat
favorite count: 0
has title: Websocket through Servlet in tomcat
has body: I am trying to implement a web socket through servlet. My app server is tomcat 7. I could find examples, where WebSocketServlet class is used. But this class is deprecated and removed in tomcat 8. I see another alternative, which is to annotate the class with the following @ServerEndpoint(value = "/websocket/test") I need helpin understanding, How will I use this annotation in servlets? Are servlets irrelevent in case of web sockets? If I create a normal class with the above annotation, and other annotation like onOpen,onClose etc, should I need to put the entry for that class in web.xml? Or are web.xmls are irrelevant too? Any hello world link will also be very helpful. Thank you. ============Edited==================== I have tried the chat example found in this link http://svn.apache.org/viewvc/tomcat/trunk/webapps/examples/WEB-INF/classes/websocket/ But when I try to invoke the socket through javascript, the events are not reaching my server at all....
has answer: http://stackoverflow.com/a/23497929
upvote count: 1
type: AnsweredQuestion
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/23497929
tagged with: servlets
type: Question
downvote count: 0
answer count: 1

http://stackoverflow.com/comment/35683018
has text: Do you know of anywhere i can read further into "Big O of n" to further my knowledge. I understand the idea behind it, but actually determining what the time case analysis is throws me off. I feel like I may be over thinking it. I am new to java, but I have completed Java 1, Java 2, and this past week finished algorithms.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23308114
type: Comment

http://stackoverflow.com/a/27667169
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23405700
upvote count: 2
type: Answer
score: 2
answers question: http://stackoverflow.com/q/23405700
type: AcceptedAnswer
has body: You can rename a file by reading the file in and saving it with the new name. Here is some sample code to get you started, you will likely need to add your own delete function in order to delete the old file: public void moveFile(String fileName, String bucket, String newFilename, String contentType) throws IOException { byte[] bytes = loadFile(bucket, fileName); ByteArrayInputStream in = new ByteArrayInputStream(bytes); saveToGcs(bucket, fileName, in, contentType); } public byte[] loadFile(String bucket, String fileName) throws IOException { GcsFilename gcsFileName = new GcsFilename(bucket, fileName); GcsInputChannel readChannel = gcsService.openReadChannel(gcsFileName, 0); InputStream in = Channels.newInputStream(readChannel); return IOUtils.toByteArray(in); } private void saveToGcs(String bucket, String filename, InputStream inputStream, String mimeType) throws IOException { GcsFilename gcsFilename = new GcsFilename(bucket, filename); GcsFileOptions options = new GcsFileOptions.Builder().mimeType(mimeType).acl("public-read").build(); GcsOutputChannel writeChannel = gcsService.createOrReplace(gcsFilename, options); BufferedOutputStream outputStream = new BufferedOutputStream(Channels.newOutputStream(writeChannel)); IOUtils.copy(inputStream, outputStream); outputStream.close(); writeChannel.close(); }

http://stackoverflow.com/a/23387433
type: Answer
has body: 174 tables are quite a lot - more than Liferay itself brings. I'd recommend to spread out your application into separately deployable plugins - they don't (technically) need to be in the same plugin, service builder allows you to use the services across different plugins. Proper dependency management should help you to isolate the functionality that you'll extract into separate applications. Declare which application needs which other application deployed before, and you can access the services cross-context. To answer your comment-question, sampling with only two projects: Create them, both with service-builder. Let's call them common-portlet and app1-portlet. Obviously, app1-portlet uses components (and services) from common-portlet. In app1-portlet, edit docroot/WEB-INF/liferay-plugin-package.properties and add the line required-deployment-contexts=common-portlet This will make sure that app1-portlet is only deployed when common-portlet is available. Also, common-service.jar, the API of common-portlet, generated with service-biulder, will automatically be put on the classpath of app1-portlet, in other words, you can call the services that you implemented in common-portlet. Assuming your more abstract portlets have a more stable interface (typically this indicates a proper architecture), changes to app1-portlet (or app2-portlet etc.) will only affect the portlet where you make a change in. Even if you have a change in common-portlet, service-builder will be relatively quick, however, on interface changes you still need to recompile everything, but that's the nature of dependencies. If you don't change your interfaces, you'll only need a redeploy.
accepted answer of: http://stackoverflow.com/q/23360851
score: 3
answers question: http://stackoverflow.com/q/23360851
upvote count: 3
has comment: http://stackoverflow.com/comment/35838321
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/35796879
comment on: http://stackoverflow.com/a/23319384
score: 0
type: AnswerComment
has text: What is the error that you are getting? Is the app crashing or simple getting a black screen?
type: Comment

http://stackoverflow.com/comment/35721671
has text: @LuiggiMendoza Sorry, I don't see how the main question is about interfaces. The OP is clearly talking about superclasses and subclasses, as clearly stated in the title and the first phrase of the post. The fact that he uses a second example with `List` and `ArrayList` may be because he is perhaps not aware that `List` is an interface.
type: Comment
comment on: http://stackoverflow.com/a/23328871
type: AnswerComment
score: 0

http://stackoverflow.com/a/23443839
answers question: http://stackoverflow.com/q/23443642
accepted answer of: http://stackoverflow.com/q/23443642
type: AcceptedAnswer
has body: Since your package name is package name is com.example.fragmentstest, change this line: android:name="com.javacodegeeks.android.fragmentstest.FragmentOne" to android:name="com.example.fragmentstest.FragmentOne" in main_activity.xml
score: 0
has comment: http://stackoverflow.com/comment/35933723
type: Answer

http://stackoverflow.com/comment/35697849
type: QuestionComment
type: Comment
has text: btw, does anyone understand the what this means "Resource leak: 'server' is never closed"?
score: 0
comment on: http://stackoverflow.com/q/23315981

http://stackoverflow.com/q/23407285
tagged with: maven
has comment: http://stackoverflow.com/comment/35872431
has title: JBoss multiple SLF4J bindings error
tagged with: java
tagged with: jboss
type: Question
answer count: 1
score: 4
linked to: http://stackoverflow.com/q/18863630
has answer: http://stackoverflow.com/a/23409554
has body: I am using JBoss 6 and am getting a multiple versions error when trying to run my application: ERROR [STDERR] SLF4J: Class path contains multiple SLF4J bindings. ERROR [STDERR] SLF4J: Found binding in [vfs:/C:/jboss-6.0.0.Final/common/lib/slf4j-jboss-logmanager.jar/org/slf4j/impl/StaticLoggerBinder.class] ERROR [STDERR] SLF4J: Found binding in [vfs:/C:/jboss-6.0.0.Final/server/default/deploy/newsroom-integration-persistence-service.war/WEB-INF/lib/slf4j-log4j12-1.6.1.jar/org/slf4j/impl/StaticLoggerBinder.class] My application declares slf4j-log4j12 in the pom but not slf4j-jboss-logmanager so have no idea why its trying to use this. This is the pom: org.slf4j slf4j-log4j12 ${org.slf4j-version} runtime Any ideas on how to resolve this? It seems to be causing 'DEBUG' level errors to be written to the console even when the level-name set in jboss-logging.xml is set to INFO!!
upvote count: 4
favorite count: 0
downvote count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/35831133
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23388809
has text: Have you added Scene3 and GameOver to manifest? Please, post LogCat output with crash stacktrace.
score: 0

http://stackoverflow.com/comment/40263450
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23321592
has text: Linking to grepcode can show that the [call](http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/6-b14/java/util/Collections.java#Collections.unmodifiableMap%28java.util.Map%29) just is a call to the [constructor](http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/6-b14/java/util/Collections.java#Collections.UnmodifiableMap) that has that parameter just sitting there with all of the other things throwing exceptions.
score: 0

sftp
tags question: http://stackoverflow.com/q/23391593
tag name: sftp
type: Tag

http://stackoverflow.com/q/23429673
tagged with: numbers
tagged with: sum
tagged with: java
score: -1
possible better answer: http://stackoverflow.com/a/71157798
type: Question
has answer: http://stackoverflow.com/a/71157798
answer count: 2
has comment: http://stackoverflow.com/comment/35907608
has answer: http://stackoverflow.com/a/23431005
favorite count: 0
has body: A perfect number is a number for which the sum of its proper divisors is exactly equal to the number. For example, the sum of the proper divisors of 28 would be 1 + 2 + 4 + 7 + 14 = 28, which means that 28 is a perfect number. A number n is called deficient if the sum of its proper divisors is less than n and it is called abundant if this sum exceeds n. As 12 is the smallest abundant number, 1 + 2 + 3 + 4 + 6 = 16, the smallest number that can be written as the sum of two abundant numbers is 24. By mathematical analysis, it can be shown that all integers greater than 28123 can be written as the sum of two abundant numbers. However, this upper limit cannot be reduced any further by analysis even though it is known that the greatest number that cannot be expressed as the sum of two abundant numbers is less than this limit. Find the sum of all the positive integers which cannot be written as the sum of two abundant numbers. import java.util.*; import java.io.File; import java.io.IOException; import java.math.BigInteger; public class helloworld { public static int[]array = new int[28124]; public static List&lt;Integer&gt; abundant = new ArrayList&lt;Integer&gt;(); public static void main(String []args) throws IOException { System.out.println("Answer: " + SumNonAbundant()); } public static int SumNonAbundant() { int sum = 0; abundant.add(12); GetAbundant(28123); for (int i = 1; i &lt;= 28123; i++) { if (checkForSum(i)) { System.out.println(i); sum+=i; } } return sum; } public static int SumOfDivisors(int num) { int sum = 0; for (int i = num - 1; i &gt; 0; i--) { if (num % i == 0) { sum += i; } } return sum; } public static void GetAbundant(int num) { for (int i = 13; i &lt;= num ; i++) { int sum = SumOfDivisors(i); if ( sum &gt; i) { System.out.println(i + " " + sum); abundant.add(i); } } } public static boolean checkForSum(int num) { int start = 0; int end = abundant.size() - 1; while (start &lt; end) { if (abundant.get(start) == num) { return false; } else if (abundant…
tagged with: perfect-numbers
downvote count: 2
accepted answer: http://stackoverflow.com/a/23431005
upvote count: 1
has title: Project Euler 23: Answer is off by 995
type: AnsweredQuestion

http://stackoverflow.com/q/23364092
tagged with: ambiguity
has answer: http://stackoverflow.com/a/23364360
answer count: 2
has answer: http://stackoverflow.com/a/23364243
accepted answer: http://stackoverflow.com/a/23364243
favorite count: 0
upvote count: 5
has title: Ambiguity error while overloading var args method and wrapper methods in java
linked to: http://stackoverflow.com/q/7689386
possible better answer: http://stackoverflow.com/a/23364360
has body: I tried to compile following code but got error static void test(long... x) { System.out.println("long..."); } static void test(Integer... x) { System.out.println("Integer..."); } public static void main(String [] args) { int no=5; test(no,no);//getting error at this point in eclipse 'The method test(long[]) is ambiguous ' } I donot know why it is ambiguous. means if I am passing an int value it should auto-box and test(Integer..x) should get called..on similar line test(long..x ) should be get called..this is my understanding..can someone explain this why it is ambiguous ?
type: AnsweredQuestion
downvote count: 0
has comment: http://stackoverflow.com/comment/35785718
type: Question
tagged with: overloading
score: 5
tagged with: java

http://stackoverflow.com/comment/35816739
has text: For example, how you can use any end character within a pattern, i'm trying to use a COMMA as the end character, so everything before that will show
type: Comment
comment on: http://stackoverflow.com/a/23380773
score: 0
type: AnswerComment

http://stackoverflow.com/q/23322418
answer count: 1
downvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/35708849
has answer: http://stackoverflow.com/a/40934335
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35716040
upvote count: 0
has comment: http://stackoverflow.com/comment/35718112
linked to: http://stackoverflow.com/q/951890
has body: I am trying to get self signed certificate for my website. I created a certificate using "Keytool" and then made following changes in conf/server.xml &lt;Connector connectionTimeout="20000" port="8080" protocol="HTTP/1.1" redirectPort="8443" /&gt; &lt;Connector SSLEnabled="true" clientAuth="false" keystoreFile="c:\tomcat\keystore\.keystore" keystorePass="changeit" maxThreads="150" port="8443" protocol="HTTP/1.1" scheme="https" secure="true" sslProtocol="TLS" /&gt; When i run the tomcat server externally and type the URL https://"localhost":8443 (No quotes around localhost) it works but when i run the tomcat server in Eclipse i get 404 error. Can anyone please help me with this. Thanks in advance. I referred to the below sites for help. http://technology-for-human.blogspot.com/2011/08/ssl-in-tomcat-under-eclipse-part-1-self.html Eclipse WTP: How do I enable SSL on Tomcat?
tagged with: java
has comment: http://stackoverflow.com/comment/69079793
tagged with: eclipse
type: Question
has comment: http://stackoverflow.com/comment/35715690
tagged with: ssl
score: -1
tagged with: tomcat
has title: Tomcat server in eclipse does not support TSL/SSL

http://stackoverflow.com/comment/35870020
score: 0
comment on: http://stackoverflow.com/q/23409358
type: Comment
has text: @home I added... but this method work perfect for me, always return that I want.
type: QuestionComment

http://stackoverflow.com/a/27194500
has body: There are two JVMs involved, one running Gradle and one running your test. When you run gradle -Dspring.profiles.active=dev test you are setting a property on the JVM running Gradle, not the JVM running your test. Gradle doesn't automatically copy system properties from its JVM to the JVM it spawns. This topic at the Gradle forums explains how to set properties on the JVM running your test, but in short you'll need something like this in your build.gradle: tasks.withType(Test) { systemProperty 'spring.profiles.active', 'dev test' } If you've set the active profile as a system property you can use this: tasks.withType(Test) { systemProperty 'spring.profiles.active', System.getProperty('spring.profiles.active') } To copy all system properties: tasks.withType(Test) { systemProperties = System.getProperties() }
answers question: http://stackoverflow.com/q/23309078
type: Answer
score: 0

http://stackoverflow.com/q/23346662
tagged with: oop
tagged with: java
has answer: http://stackoverflow.com/a/23346896
score: -1
has body: I got a NullPointerException when I execute this piece of code. Exception in thread "main" java.lang.NullPointerException at Matrixer.cellNeighborsAverage(Matrixer.java:31) at Matrixer.computeAverages(Matrixer.java:23) at Matrixer.main(Matrixer.java:75) Code: import java.util.Scanner; import java.lang.*; class Matrixer { static double[][] matrix, computedMatrix; final int rows, cols; public Matrixer(int N, int M, double[][] imatrix) { rows = N; cols = M; matrix = imatrix; computedMatrix = new double[N][M]; } public void computeAverages() { for (int i = 1; i &lt; rows - 1; i++) { for (int j = 1; j &lt; cols - 1; j++) { computedMatrix[i][j] = cellNeighborsAverage(i, j); } } } private double cellNeighborsAverage(int row, int col) { // Ignore center cell double sum = matrix[row - 1][col - 1] + matrix[row - 1][col] + matrix[row - 1][col + 1] + matrix[row][col - 1] + matrix[row][col + 1] + matrix[row + 1][col - 1] + matrix[row + 1][col] + matrix[row + 1][col + 1]; return sum / 8; } public void printComputedMatrix() { for (int i = 0; i &lt; rows; i++) { for (int j = 0; j &lt; cols; j++) { System.out.printf("%.2f", computedMatrix[i][j]); System.out.print(", "); } System.out.println(); } } public static void main(String[] args) throws NullPointerException { Scanner sc=new Scanner(System.in); try { for(int i=0;i&lt;5;i++) for(int j=0;j&lt;5;j++) matrix[i][j]=sc.nextInt(); } catch(NullPointerException e ) { Matrixer mx = new Matrixer(5, 5, matrix); mx.computeAverages(); mx.printComputedMatrix(); } } } What's the problem? And how to fix it?
type: Question
downvote count: 2
has comment: http://stackoverflow.com/comment/35753533
has comment: http://stackoverflow.com/comment/35753514
upvote count: 1
has comment: http://stackoverflow.com/comment/35753488
tagged with: arrays
answer count: 1
has title: NullPointerException when iterating over arrays
favorite count: 0
has comment: http://stackoverflow.com/comment/35753393
accepted answer: http://stackoverflow.com/a/23346896
has comment: http://stackoverflow.com/comment/35753594
type: AnsweredQuestion

http://stackoverflow.com/q/23311895
downvote count: 0
tagged with: generics
favorite count: 0
has answer: http://stackoverflow.com/a/23312215
type: UnansweredQuestion
tagged with: spring
score: 2
upvote count: 2
tagged with: java
tagged with: hibernate
type: Question
tagged with: junit4
has body: I'm using spring, hibernate and junit to setup a test class for some of my models. All of my models extend BaseModel I have the following function in my testing class: void printValidation(Set&lt;ConstraintViolation&lt;? extends BaseModel&gt;&gt; v){ Iterator&lt;ConstraintViolation&lt;? extends BaseModel&gt;&gt; it = v.iterator(); while (it.hasNext()) { ConstraintViolation&lt;? extends BaseModel&gt; violation = it.next(); l.info("Validation error {}", violation); } } I use it like so inside a test case: eModel = new Entry(); //This class extends BaseModel Set&lt;ConstraintViolation&lt;? extends BaseModel&gt;&gt; v = validator.validate(eModel); assertTrue("There should be validation errors...", v.size() &gt; 0); printValidation(v); However, I get the following message in Eclipse, and it does not seem to work: Type mismatch: cannot convert from Set&lt;ConstraintViolation&lt;Entry&gt;&gt; to Set&lt;ConstraintViolation&lt;? extends BaseModel&gt;&gt; I have a bunch of other tests, and if I make the function take &lt;Entry&gt; instead of &lt;? extends BaseEntry&gt; it works. I have a number of models I'm testing like this, and it is sort of the whole point of generics to not have to duplicate this. What am I missing here, I guess it has something to do with either what validator.validate is returning or something? ** Edited to fix inline code formatting **
has answer: http://stackoverflow.com/a/23311938
answer count: 2
has title: Java generics ? extends Clazz

http://stackoverflow.com/q/23397582
has comment: http://stackoverflow.com/comment/35848239
type: AnsweredQuestion
tagged with: paint
has body: I painted some figures using paintComponent() method: public void paintComponent(Graphics g){ super.paintComponent(g); g.setColor(Color.BLUE); g.drawRect(50, 50, 50, 50); g.drawOval(60, 60, 60, 60); //repaint(); //g.drawOval(10, 10, 10, 10); - nothing effect } But now I want to erase all these figures and paint some new figure. I don't know how i must do it? Maybe I must use repaint() method but use it wrong?
tagged with: java
has title: "paintComponent()" repaint
has answer: http://stackoverflow.com/a/23397806
upvote count: 1
tagged with: swing
downvote count: 1
type: Question
possible better answer: http://stackoverflow.com/a/23397738
has answer: http://stackoverflow.com/a/23397738
score: 0
answer count: 2
accepted answer: http://stackoverflow.com/a/23397806
favorite count: 0
tagged with: java-2d

http://stackoverflow.com/a/23326547
upvote count: 2
type: Answer
has body: Looking at the source code, the java doc tells us: Writes a string to the specified DataOutput using modified UTF-8 encoding in a machine-independent manner. First, two bytes are written to out as if by the writeShort method giving the number of bytes to follow. This value is the number of bytes actually written out, not the length of the string. Click for the source code on GrepCode.
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/23326429

http://stackoverflow.com/comment/35706558
type: Comment
type: QuestionComment
score: 2
has text: And? What's the problem?
comment on: http://stackoverflow.com/q/23321098

http://stackoverflow.com/q/23360595
linked to: http://stackoverflow.com/q/2036970
possible better answer: http://stackoverflow.com/a/23360721
linked to: http://stackoverflow.com/q/5287538
has answer: http://stackoverflow.com/a/23361543
accepted answer: http://stackoverflow.com/a/23361543
has title: Read from Object in java
has answer: http://stackoverflow.com/a/23360721
has body: Haj_Omra pr =new Promises( "Reem", 19,"10089", "italian","9/8/8" , " " ); //here i have to add information but i want user to input from object , how can i do it ? how can i use the Scanner ? i tried to put scanner inside the class but it's doesn't work ? Class Check{ public void Sc(String ID){ Scanner input = new Scanner(System.in); System.out.print("Please enter a ID: "); } please any idea ??
favorite count: 0
score: -3
type: AnsweredQuestion
upvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/35779085
type: Question
tagged with: object
has comment: http://stackoverflow.com/comment/35779909
answer count: 2
downvote count: 3
has comment: http://stackoverflow.com/comment/35778963

http://stackoverflow.com/comment/35771035
type: Comment
has text: One more note though, the definition and instantiation of zzz is inside one package, and the zzz.get(MyKeys.BKEY) code is inside a different package. I am thinking that the mapping of enums inside the HashMap is done by using addresses of the enums that change from package to package rather than constant values such as the BKEY text. Thank you for taking the time to read this long comment.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23341600

http://stackoverflow.com/comment/35725187
has text: If you're getting a handshake exception, it isn't present. You don't need to write code to tell you that.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23330635

http://stackoverflow.com/comment/35720237
score: 1
has text: ImageIcon(Strung) assumes that the Strung reference points to a file in the file system. Where is image file stored?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23328280

http://stackoverflow.com/a/43061495
answers question: http://stackoverflow.com/q/23310350
type: Answer
has body: It seems like the ArgumentCaptor is not getting initialized. When using mockito annotations, they are initialized by either Adding the MockitoAnnotations.initMocks(this); line in the setup method @Before public void setUp() throws Exception { MockitoAnnotations.initMocks(this); } Or by adding @RunWith(MockitoJUnitRunner.class) annotation to the TestClass.
upvote count: 5
score: 5
downvote count: 0

http://stackoverflow.com/a/23440286
has comment: http://stackoverflow.com/comment/35928916
has body: If the items inside the adapter is a list of Quote objects, then you could do this: class Quote { private String ticker; // create getter and setter methods here for all // the variables in the Quote class. } Get Quote using this: Quote qObj = (Quote) MainActivity.this.adapter.getItem(position); Get the ticker value like this: String tickerValue = qObj.getTicker(); // the same will apply for all other variables of the class Quote. Hope that helps!
answers question: http://stackoverflow.com/q/23439802
has comment: http://stackoverflow.com/comment/35928014
upvote count: 1
has comment: http://stackoverflow.com/comment/35928293
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35928186
has comment: http://stackoverflow.com/comment/35927955
has comment: http://stackoverflow.com/comment/35929174
type: Answer
has comment: http://stackoverflow.com/comment/35927925
downvote count: 0
has comment: http://stackoverflow.com/comment/35928315
score: 1
accepted answer of: http://stackoverflow.com/q/23439802

http://stackoverflow.com/a/23348356
has body: You are doing it a bit wrong. The philosophy with executors is that you implement the work unit as a Runnable or a Callable (instead of a Thread). Each Runnable or Callable should do one atomic piece of work which is mutually exclusive of other Runnables or Callables. Executor services internally use a pool of threads so your creating a thread group and Thread is not doing any good. Try this simple piece: ExecutorService executor = Executors.newFixedThreadPool(5);` executor.execute(new MyRunnableWorker()); public class MyRunnableWorker implements Runnable{ private String ip; private String threadName; private int threadTimeout = 10; public MyRunnableWorker(String ip){ this.ip = ip; } public MyRunnableWorker(String ip,int threadTimeout,String threadName){ this.ip = ip; this.threadTimeout = threadTimeout; this.threadName = threadName; System.out.prinln("MyRunnableWorker constructor has been called!"); } @Override public void run(){ { // do some stuff that takes time .... } } This would give you what you want. Also try to test you thread code execution using visualVM to see how threads are running and what the load distribution.
has comment: http://stackoverflow.com/comment/37040816
upvote count: 2
has comment: http://stackoverflow.com/comment/35795508
has comment: http://stackoverflow.com/comment/35795888
has comment: http://stackoverflow.com/comment/37084523
type: Answer
has comment: http://stackoverflow.com/comment/37024165
score: 2
has comment: http://stackoverflow.com/comment/35758556
has comment: http://stackoverflow.com/comment/35795703
answers question: http://stackoverflow.com/q/23345612
has comment: http://stackoverflow.com/comment/37001099
has comment: http://stackoverflow.com/comment/35794815
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/35807227
has comment: http://stackoverflow.com/comment/37072439
has comment: http://stackoverflow.com/comment/35815567
has comment: http://stackoverflow.com/comment/35807178
has comment: http://stackoverflow.com/comment/36990492
accepted answer of: http://stackoverflow.com/q/23345612
has comment: http://stackoverflow.com/comment/35795909
has comment: http://stackoverflow.com/comment/35774638

jinterface
tags question: http://stackoverflow.com/q/23291675
tags question: http://stackoverflow.com/q/23371394
type: Tag
tag name: jinterface

http://stackoverflow.com/q/23451347
has title: Pass arguments to a Process after its started
tagged with: jar
has body: Is there a way to start a Process argument and then after its been called, pass arguments to it (and read the output)? Process process void CalledOnStart() { process = new Process(); process.StartInfo.UseShellExecute = true; process.StartInfo.FileName = "cmd.exe"; //or anything, really process.Start(); } void UserInput(string input) { process.passArgument(input); //does this exist? } Thanks
score: 0
has answer: http://stackoverflow.com/a/23451378
has answer: http://stackoverflow.com/a/23451357
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35948360
tagged with: java
type: Question
tagged with: c#
answer count: 2

http://stackoverflow.com/comment/35726408
comment on: http://stackoverflow.com/a/23331636
type: AnswerComment
has text: @Java1 `\\t` v. `"\\t"` as far as the question says.
score: 0
type: Comment

http://stackoverflow.com/q/23339307
type: Question
has body: I have Developed one plugin in intellij idea, on right click on project I am getting that plugin name but it is always disable. How can I enable that plugin. This is my plugin.xml code : <add-to-group group-id="ProjectViewPopupMenuRunGroup" anchor="last"/>
score: 1
tagged with: java
tagged with: intellij-plugin
downvote count: 0
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/28133076
has title: Intellij idea plugin development : plugin not enabled on right click on project
tagged with: intellij-13
tagged with: plugins
type: AnsweredQuestion
upvote count: 1
accepted answer: http://stackoverflow.com/a/28133076

http://stackoverflow.com/q/23345037
type: Question
has comment: http://stackoverflow.com/comment/35775654
tagged with: java
tagged with: eclipse
has comment: http://stackoverflow.com/comment/35752812
has title: Restriction on org.eclipse.ui.internal.* classes
tagged with: eclipse-rcp
score: 0
has body: we are developing a Modeling Environment as a plugin for Eclipse. Within this environment it should be possible for the user to modify one of the provided perspectives, i.e. hide/show items in the Coolbar, Menubar and views. It appeared to be difficult to modify the visible Coolbar-/MenuItems when you are not developing an entire RCP-Application but only a Plugin. The only solution I was able to come up with was to add an access rule in the Java build path to make the org.eclipse.ui.internal.* packages available and then access the items with the CoolbarManager/MenuManager as in the following example: WorkbenchWindow workbenchWin = (WorkbenchWindow)PlatformUI.getWorkbench().getActiveWorkbenchWindow(); ICoolBarManager coolbarManager = workbenchWin.getCoolBarManager2(); IContributionItem[] items = coolbarManager.getItems(); for(IContributionItem item : items) { item.setVisible(false); } However, adding this access rule and then suppressing the "restriction" warnings on every call to these packages seems to a bit dirty. Hence my question: Why are these packages restricted and is there a better way to do this? Thanks, Leo
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35753783
has comment: http://stackoverflow.com/comment/35750442
has comment: http://stackoverflow.com/comment/35754187

http://stackoverflow.com/a/23348824
type: Answer
downvote count: 0
score: 1
has body: Try this: import java.text.SimpleDateFormat; import java.util.Date; import java.util.Locale; public class CustomFormattedDate { public static void main(String[] args) { Date date = new Date(); // if you use DD for Daypattern, you'll get the day of the year, e.g. 119 for the // 29th April 2014, if you want 29, the day of the month, use dd SimpleDateFormat df = new SimpleDateFormat("YYYY-dd-MMM", new Locale(System.getProperty("user.language"))); System.out.println(df.format(date)); System.out.println(getDateFormat().format(date)); } } Output 2014-29-Apr
has comment: http://stackoverflow.com/comment/35772214
accepted answer of: http://stackoverflow.com/q/23340837
answers question: http://stackoverflow.com/q/23340837
has comment: http://stackoverflow.com/comment/35772803
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35773237

http://stackoverflow.com/a/23409312
accepted answer of: http://stackoverflow.com/q/23409212
has comment: http://stackoverflow.com/comment/101284615
has comment: http://stackoverflow.com/comment/101294512
has comment: http://stackoverflow.com/comment/35869714
answers question: http://stackoverflow.com/q/23409212
type: Answer
has comment: http://stackoverflow.com/comment/101296959
has comment: http://stackoverflow.com/comment/35870190
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/35869813
type: AcceptedAnswer
downvote count: 0
has body: Assuming you're just talking about java.util.Date, it's as simple as: public static String toJson(Date date) { return "\\/Date(" + date.getTime() + "-0000)\\/"; } (That's assuming the backslashes should really be part of the string... it's not clear whether you actually want them or not, but you can remove them easily enough.) Basically the first part of the string is just the number of milliseconds since the Unix epoch, which is the value in a java.util.Date as well, as accessed via getTime(). The "0000" bit is a UTC offset, but as a java.util.Date has no concept of a time zone or an offset, you can just use 0000 and you'll end up representing the right instant in time. If you were starting with a java.util.Calendar value you could convert the offset as well, if you really wanted to.

http://stackoverflow.com/q/23342603
tagged with: battery
has answer: http://stackoverflow.com/a/23342721
tagged with: android
has answer: http://stackoverflow.com/a/23342668
answer count: 4
has comment: http://stackoverflow.com/comment/35745686
type: AnsweredQuestion
score: 2
has comment: http://stackoverflow.com/comment/35745588
possible better answer: http://stackoverflow.com/a/23342721
downvote count: 0
has comment: http://stackoverflow.com/comment/35745683
tagged with: java
accepted answer: http://stackoverflow.com/a/23343275
type: Question
has answer: http://stackoverflow.com/a/23369286
has answer: http://stackoverflow.com/a/23343275
tagged with: database
upvote count: 2
linked to: http://stackoverflow.com/q/12906083
has title: Android: Do database operations consume power?
has body: An Android app (Java) needs to update the same database record periodically. It can be done every second or every minute. Regarding only battery life, Does it make any significant difference (like shortening the battery life to half) doing it every second v/s every minute? As only CPU and memory are involved, I think it makes no difference, but I'm not sure. CPU and memory are still used by the running app &amp; other system process, anyway. Updating every second makes a simple app; caching and updating every minute (or waiting for certain condition) make code a little more complicated and error prone.
favorite count: 0

http://stackoverflow.com/q/23446558
has answer: http://stackoverflow.com/a/23447738
has body: I'm really confused about how to use a @ManyToMany child collection in my application. To demonstrate my problem I have set up an example project at https://bitbucket.org/ctombaugh/test The main problem is that the child collection is deleted when I save the parent object. The only way I can think of to circumvent this is to fetch all child collections from database and attach them to the parent object before saving, but I can't believe this is the right way. So I guess I'm doing something wrong, hopefully someone can pinpoint it and improve my understanding of how JPA works. I would like to mention upfront that this question is related to my other question, but I thought it would be best to focus on the core of the problem, remove all context, and work with a clean example project. I hope that's not a problem. parent object class Test @Entity public final class Test implements Identifiable<Integer> { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private volatile Integer id; @ManyToMany(cascade = CascadeType.MERGE, fetch = FetchType.LAZY) @JoinTable(name = "test_label", joinColumns = { @JoinColumn(name = "test") }, inverseJoinColumns = { @JoinColumn(name = "label") }) private Set<Label> labels = new HashSet<Label>(); private volatile String name = ""; @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Test test = (Test) o; if (!id.equals(test.id)) return false; return true; } @Override public int hashCode() { if (id == null) return 0; return id.hashCode(); } } child object class Label @Entity public final class Label implements Identifiable<Integer> { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private volatile Integer id; private volatile String name = ""; public Label() { } public Label(String name) { this.name = name; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Label label = …
type: UnansweredQuestion
has title: How to use a ManyToMany collection with Spring Data
tagged with: spring
tagged with: spring-mvc
has comment: http://stackoverflow.com/comment/35939934
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/35939817
has comment: http://stackoverflow.com/comment/35939557
type: Question
has comment: http://stackoverflow.com/comment/36015700
score: 0
answer count: 1
tagged with: jpa
linked to: http://stackoverflow.com/q/23410753

http://stackoverflow.com/comment/35856308
has text: Sounds interesting, how would I go about this? thanks.
type: Comment
comment on: http://stackoverflow.com/a/23402314
score: 0
type: AnswerComment

http://stackoverflow.com/comment/35837327
type: AnswerComment
type: Comment
has text: if you're already online, i was using a guide made for 0.9.9... is there anything different from that version to this? because i'm using the new one now and something seems to be different
comment on: http://stackoverflow.com/a/23390445
score: 0

http://stackoverflow.com/comment/35947232
type: Comment
comment on: http://stackoverflow.com/a/23448168
score: 0
type: AnswerComment
has text: Ooh wow! Thanks! I think that's exactly what I needed and kinda makes sense when you think about it. However there is a small issue which I'm not too sure how handle. On my tester program I have a simple constructor initialiser testing some sample variables. Since the constructor now takes two parameters, I have to pass in another, but what would I pass in?

http://stackoverflow.com/q/23392085
tagged with: encryption
has answer: http://stackoverflow.com/a/34083156
has comment: http://stackoverflow.com/comment/35841875
has body: I am getting java.security.InvalidKeyException: Invalid AES key length: 128 bytes on my line CIPHER.init(Cipher.ENCRYPT_MODE, keySpec); with CIPHER being Cipher CIPHER = Cipher.getInstance("AES"); and keySpec SecretKeySpec keySpec = new SecretKeySpec(key, "AES"); that key is a byte[] of length 128 I got through a Diffie-Hellman key exchange (though it shouldn't matter where I got it, right?), key is completely filled with nonzero bytes Why is Cipher.init(...) complaining that the key is a wrong length? This webpage clearly states that a key of length 128 is supported. What am I overlooking?
has comment: http://stackoverflow.com/comment/41340776
tagged with: aes
has answer: http://stackoverflow.com/a/23394610
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35837173
tagged with: java
has comment: http://stackoverflow.com/comment/35837276
type: Question
score: 12
answer count: 2
has title: Invalid AES key length: 128 bytes?
upvote count: 12
downvote count: 0
accepted answer: http://stackoverflow.com/a/23394610
favorite count: 0
possible better answer: http://stackoverflow.com/a/34083156

user-interface
tags question: http://stackoverflow.com/q/23374355
tags question: http://stackoverflow.com/q/23323151
tags question: http://stackoverflow.com/q/23303578
tags question: http://stackoverflow.com/q/23426051
tags question: http://stackoverflow.com/q/23414137
tags question: http://stackoverflow.com/q/23309989
tags question: http://stackoverflow.com/q/23299050
tags question: http://stackoverflow.com/q/23425051
tags question: http://stackoverflow.com/q/23300461
tags question: http://stackoverflow.com/q/23429261
tags question: http://stackoverflow.com/q/23387299
tags question: http://stackoverflow.com/q/23306565
tags question: http://stackoverflow.com/q/23450980
tags question: http://stackoverflow.com/q/23403383
tags question: http://stackoverflow.com/q/23298336
tags question: http://stackoverflow.com/q/23448278
type: Tag
tags question: http://stackoverflow.com/q/23404945
tags question: http://stackoverflow.com/q/23421325
tags question: http://stackoverflow.com/q/23432341
tags question: http://stackoverflow.com/q/23345791
tags question: http://stackoverflow.com/q/23361577
tags question: http://stackoverflow.com/q/23450479
tags question: http://stackoverflow.com/q/23296254
tags question: http://stackoverflow.com/q/23397138
tags question: http://stackoverflow.com/q/23417749
tags question: http://stackoverflow.com/q/23451224
tags question: http://stackoverflow.com/q/23359966
tags question: http://stackoverflow.com/q/23304452
tags question: http://stackoverflow.com/q/23412853
tags question: http://stackoverflow.com/q/23400648
tags question: http://stackoverflow.com/q/23305888
tags question: http://stackoverflow.com/q/23393452
tags question: http://stackoverflow.com/q/23370509
tags question: http://stackoverflow.com/q/23325133
tags question: http://stackoverflow.com/q/23436678
tags question: http://stackoverflow.com/q/23303898
tags question: http://stackoverflow.com/q/23331223
tags question: http://stackoverflow.com/q/23312520
tags question: http://stackoverflow.com/q/23350903
tags question: http://stackoverflow.com/q/23378725
tags question: http://stackoverflow.com/q/23343856
tags question: http://stackoverflow.com/q/23317213
tags question: http://stackoverflow.com/q/23331504
tags question: http://stackoverflow.com/q/23447818
tags question: http://stackoverflow.com/q/23363222
tags question: http://stackoverflow.com/q/23401205
tags question: http://stackoverflow.com/q/23437078
tags question: http://stackoverflow.com/q/23349154
tags question: http://stackoverflow.com/q/23435572
tags question: http://stackoverflow.com/q/23392464
tags question: http://stackoverflow.com/q/23322564
tags question: http://stackoverflow.com/q/23370585
tags question: http://stackoverflow.com/q/23402364
tags question: http://stackoverflow.com/q/23318208
tags question: http://stackoverflow.com/q/23440713
tags question: http://stackoverflow.com/q/23297975
tags question: http://stackoverflow.com/q/23302491
tags question: http://stackoverflow.com/q/23301364
tags question: http://stackoverflow.com/q/23418252
tags question: http://stackoverflow.com/q/23347531
tags question: http://stackoverflow.com/q/23405431
tags question: http://stackoverflow.com/q/23314005
tags question: http://stackoverflow.com/q/23324459
tags question: http://stackoverflow.com/q/23330347
tag name: user-interface
tags question: http://stackoverflow.com/q/23337656
tags question: http://stackoverflow.com/q/23430083
tags question: http://stackoverflow.com/q/23396687
tags question: http://stackoverflow.com/q/23401463
tags question: http://stackoverflow.com/q/23305319
tags question: http://stackoverflow.com/q/23406424
tags question: http://stackoverflow.com/q/23321092
tags question: http://stackoverflow.com/q/23439314
tags question: http://stackoverflow.com/q/23357518

http://stackoverflow.com/q/23410619
type: UnansweredQuestion
tagged with: skype
answer count: 0
score: 1
tagged with: java
upvote count: 1
type: Question
has title: Skype URI's in Java for Mac OSX
downvote count: 0
tagged with: macos
favorite count: 0
has body: I'm currently trying to make use of the Skype URI API, which basically should be able to open skype and instantiate a chat-conversation (which I'll fix when I make this work). I've been googling for a while now and I've also been going through the Skype URI docs, but I still haven't found the solution. I've tried to things that came up when I googled, but none of them worked. Both Runtime.getRuntime().exec( new String[] { "open" , "-a", "skype:" }) ; and try { Runtime.getRuntime().exec(new String[] {"rundll32", "url.dll,FileProtocolHandler", "skype:"}); } catch (Exception e) { } didn't work, and I don't know why, so that is my question. I'm on a Mac, so it should be able to function on a Mac. Honestly, I'm 99% sure that the second one is for Windows, so it's clear why that didn't work. But how do I make this work? This is where I got the skype: from: http://developer.skype.com/skype-uris/reference#uriSwitchFocusToSkype On the docs they do not have any examples how to do this for mac.

http://stackoverflow.com/q/23306565
has answer: http://stackoverflow.com/a/23306643
type: AnsweredQuestion
has body: I was having a hard time making a sudoku grid using textfields until i came across someones code on dreamincode, but they didnt really explain and i was wondering if anyone here could explain the cells class to me. ive been wondering about this because even if the class is empty the grid still works so im confused. thanks. import java.awt.*; import javax.swing.*; import javax.swing.border.*; public class Squares extends JPanel { public final int CELL_COUNT = 9; public Cell [] cells = new Cell[CELL_COUNT]; public Squares(){ this.setLayout(new GridLayout(3,3)); this.setBorder(new LineBorder(Color.BLACK,2)); for(int i = 0; i&lt;CELL_COUNT; i++){ cells[i] = new Cell(); this.add(cells[i]); } } public class Cell extends JTextField{ private int number; public Cell(){ } public void setNumber(int number){ this.number = number; this.setText("1"); } public int getNumber(){ return number; } } }
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/23306647
has title: Is there a point to this line of code?
type: Question
has comment: http://stackoverflow.com/comment/35680565
score: -3
answer count: 2
downvote count: 4
accepted answer: http://stackoverflow.com/a/23306647
tagged with: user-interface
has comment: http://stackoverflow.com/comment/35680628
favorite count: 0
possible better answer: http://stackoverflow.com/a/23306643

federation
tag name: federation
type: Tag
tags question: http://stackoverflow.com/q/23436713

http://stackoverflow.com/q/23343488
possible better answer: http://stackoverflow.com/a/23343621
has answer: http://stackoverflow.com/a/23343621
has title: why does this code (extraction of host-name from a URL with regular expression) fail
linked to: http://stackoverflow.com/q/161738
has comment: http://stackoverflow.com/comment/35747591
has answer: http://stackoverflow.com/a/23343584
type: AnsweredQuestion
tagged with: regex
score: 1
favorite count: 0
type: Question
upvote count: 2
answer count: 2
downvote count: 1
accepted answer: http://stackoverflow.com/a/23343584
has body: I'm trying to match a host-name from a url with regex and groups. I wrote this test in order to simulate the acceptable inputs. why does this code fails? import java.util.regex.Matcher; import java.util.regex.Pattern; public class RegexTest { public static void main(String[] args) { Pattern HostnamePattern = Pattern.compile("^https?://([^/]+)/?", Pattern.CASE_INSENSITIVE); String[] inputs = new String[]{ "http://stackoverflow.com", "http://stackoverflow.com/", "http://stackoverflow.com/path", "http://stackoverflow.com/path/path2", "http://stackoverflow.com/path/path2/", "http://stackoverflow.com/path/path2/?qs1=1", "https://stackoverflow.com/path", "https://stackoverflow.com/path/path2", "https://stackoverflow.com/path/path2/", "https://stackoverflow.com/path/path2/?qs1=1", }; for(String input : inputs) { Matcher matcher = HostnamePattern.matcher(input); if(!matcher.matches() || !"stackoverflow.com".equals(matcher.group(1))) { throw new Error(input+" fails!"); } } } }
linked to: http://stackoverflow.com/q/22697463
tagged with: java
has comment: http://stackoverflow.com/comment/35747435
linked to: http://stackoverflow.com/q/22937618

http://stackoverflow.com/comment/35881445
comment on: http://stackoverflow.com/q/23415288
has text: you'll have to create a lot of ClassLoaders. I never tried that, but you should look that way.
type: QuestionComment
type: Comment
score: 1

http://stackoverflow.com/q/23380686
has answer: http://stackoverflow.com/a/23403183
answer count: 1
tagged with: websocket
has body: I setup Glassfish 4 websever using websocket. When I connect to Glassfish through webscoket, I use VisualVM monitor it and see the live threads are increased when Glassfish get new connection. This number is also bigger, sometimes it decrease small amount (mayge GC perform) and turn increase larger amount. If my server get 1000 new connections over Websocket per minutes and 1000 new live thread appear, so my server will get trouble after 2 hours. I simulated about 30000 threads to test my server. It's ok. But if over 30000 threads, it will appear errors message: Exception in thread "main" java.lang.OutOfMemoryError: unable to create new native thread. JVM options: -Xmx:10240m -Xms:10240m How to interrupt Glassfish Websocket new live thread to prevent trouble to server?
type: UnansweredQuestion
tagged with: java
tagged with: multithreading
type: Question
has title: How to interrupt Glassfish Websocket new live thread?
tagged with: glassfish
tagged with: tyrus
score: 0

http://stackoverflow.com/comment/35899885
type: AnswerComment
has text: why you used `LinkedList`?
comment on: http://stackoverflow.com/a/23425302
type: Comment
score: 0

http://stackoverflow.com/q/23409376
has answer: http://stackoverflow.com/a/23409730
answer count: 2
downvote count: 1
has body: I created a List of boxes from the box class like such: private static final List&lt;Box&gt; shapes = new ArrayList&lt;Box&gt;(16); I have a keyevent method that calls the class to change the box size. if (Keyboard.getEventKey() == Keyboard.KEY_1 &amp;&amp; Keyboard.getEventKeyState()) { if (Box.getSize() == 0){ shapes.add(new Box(0, 463, "r")); } } For the getSize() method used here, I need to call it only for the box created. I want to basicly create the box at a certain size and use methods for only this box that was created. How can I make this new box created in my ArrayList call methods from the box class on its' own. Something like this fake code: this.box.getSize() = 1;
accepted answer: http://stackoverflow.com/a/23409423
tagged with: java
has title: How to refer to a new array object
has comment: http://stackoverflow.com/comment/35869663
upvote count: 0
tagged with: arrays
has comment: http://stackoverflow.com/comment/35869662
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23409423
favorite count: 0
has comment: http://stackoverflow.com/comment/35869723
score: -1
possible better answer: http://stackoverflow.com/a/23409730
type: Question

http://stackoverflow.com/a/23427504
downvote count: 0
has body: Because you're modifying the list while iterating on it. Note that a synchronized list only makes each of its methods, and the methods of its iterator, synchronized. Iterating on a synchronized list is still a non-atomic operation, that involves several calls to synchronized methods. If you want to make the whole iteration atomic, you have to explicitely synchronize it, using the list itself as the lock: synchronized (syList) { for (String s : syList) { s = new StringBuffer(s).reverse().toString(); } }
answers question: http://stackoverflow.com/q/23427387
type: Answer
score: 3
upvote count: 3

http://stackoverflow.com/comment/35775535
type: QuestionComment
comment on: http://stackoverflow.com/q/23358399
type: Comment
has text: From this point of view no class is immutable
score: 0

threadpool
tags question: http://stackoverflow.com/q/23357010
tags question: http://stackoverflow.com/q/23345612
type: Tag
tag name: threadpool
tags question: http://stackoverflow.com/q/23394518
tags question: http://stackoverflow.com/q/23394172
tags question: http://stackoverflow.com/q/23438879
tags question: http://stackoverflow.com/q/23409604

http://stackoverflow.com/a/24601860
type: Answer
has body: I'm a little confused. Based off of your title I think you want to prevent users from importing classes inside JavaScript. In that case this question has already been asked here, security problem with Java ScriptEngine. Some of the solutions suggested there were to look into Java SecurityManager and another user said he solves this problem by putting "importPackage = null" on the top of all scripts. On the contrary based on the contents of your script I get the feeling you are having trouble importing Java classes. If that's the case I answer that here, Use a jar in JavaScript through Java ScriptEngine Basically there is another way to import inside JavaScript that you did not show. I do it this way, pack = Packages.abc.foo.pack.name; var foo = new pack.ClassFromTheJarFile("arg1","arg2"); foo.doSomething(); var fooSister = new pack.AnotherCLassFromTheJarFile("arg1"); fooSister.doSomthingFromThisClass(); Although that example uses a package from a jar file it does not have to be from a jar and the code would still remain the same.
answers question: http://stackoverflow.com/q/23444878
score: 0

http://stackoverflow.com/q/23361320
upvote count: 2
tagged with: jemos-podam
type: AnsweredQuestion
tagged with: reflection
has title: isAccessible() returning false for public setters
tagged with: java
accepted answer: http://stackoverflow.com/a/23362713
type: Question
answer count: 1
downvote count: 0
favorite count: 0
has body: I'm using PODAM to populate my objects with some test data within some JUnit test cases. I've come across an error that doesn't make sense to me. PODAM reports this line of logging when manufacturing my objects: The setter: setId is not accessible.Setting it to accessible. However this is a security hack and your code should really adhere to Javabean standards. I get this warning for every single one of my setters while it's trying to populate an object. In this case setId() consists of the following: public void setId( int id ) { this.id = id; } Does anyone know why this error is getting flagged, as the method is public why is it getting flagged "not accessible". I have looked at the PODAM source and it is checking if the method is accessible and every time it returns false, then PODAM will set the method to be accessible before invoking it: if (!setter.isAccessible()) { LOG.warn("The setter: {} is not accessible.Setting it to accessible. " + "However this is a security hack and your code should really adhere to Javabean standards.", setter.getName()); setter.setAccessible(true); } setter.invoke(retValue, setterArg); PODAM is actually working great and populating all the fields with random data as I wanted. I am just curious as to why I am getting this error each time and if there is an issue within the code casuing it to not adhear to the standards.
score: 2
has answer: http://stackoverflow.com/a/23362713

http://stackoverflow.com/q/23352084
has body: I need to create a class that contains a lot of information (slow to initialize). I am trying to access this class from my other classes. This class should only be created once because it is slow to load and takes a lot of memory. My only idea of how to do this is to create an instance of the class in the loader class and then pass it from class to class as I switch through them. I feel like there is a better way to do this. I thought about making all the methods and variables in this class static but then I would still have to make a new object in each new class which I think would then re-initialize the object(which I don't want to do). I am not sure if there is a better way to do this... thoughts?
upvote count: 1
type: Question
tagged with: object
linked to: http://stackoverflow.com/q/16106260
tagged with: class
has comment: http://stackoverflow.com/comment/35765418
has comment: http://stackoverflow.com/comment/35764124
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/23352422
favorite count: 0
has title: Class with only one instance that is accessible from all other classes
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35764070
has comment: http://stackoverflow.com/comment/35765412
has comment: http://stackoverflow.com/comment/35764303
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/35764381

http://stackoverflow.com/q/23422782
has comment: http://stackoverflow.com/comment/35895539
has comment: http://stackoverflow.com/comment/35896398
type: Question
has comment: http://stackoverflow.com/comment/35895362
has comment: http://stackoverflow.com/comment/35896036
tagged with: character-encoding
has comment: http://stackoverflow.com/comment/35895463
score: 0
has answer: http://stackoverflow.com/a/23423811
has comment: http://stackoverflow.com/comment/35896024
has comment: http://stackoverflow.com/comment/35895613
has comment: http://stackoverflow.com/comment/35895116
answer count: 1
tagged with: url
tagged with: jsp
has title: How to read url in correct format?
has comment: http://stackoverflow.com/comment/35896251
linked to: http://stackoverflow.com/q/17919998
has comment: http://stackoverflow.com/comment/35895884
has comment: http://stackoverflow.com/comment/35895155
has body: I am trying to read a url which is throwing a string. I am storing that string in some variable and trying to print that variable on my web page using jsp. When I print my string on my web page it is giving some junk characters. How can I get the original string? Here is my jsp code: Market.jsp <%@page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8" %> JSP Page <% URL url; ArrayList<String> list1 = new ArrayList<String>(); ArrayList<String> list2 = new ArrayList<String>(); List commodity1 = null; List price1 = null; int c, p = 0; try { // get URL content String a = "http://122.160.81.37:8080/mandim/MarketWise?m=agra"; url = new URL(a); URLConnection conn = url.openConnection(); // open the stream and put it into BufferedReader BufferedReader br = new BufferedReader( new InputStreamReader(conn.getInputStream())); StringBuffer sb = new StringBuffer(); String inputLine; while ((inputLine = br.readLine()) != null) { System.out.println(inputLine); // sb.append(inputLine); String s = inputLine.replace("|", "\n"); s = s.replace("~", " "); StringTokenizer str = new StringTokenizer(s); while (str.hasMoreTokens()) { String mandi = str.nextElement().toString(); String price = str.nextElement().toString(); list1.add(mandi); list2.add(price); } } commodity1 = list1.subList(0, 10); // commodity10=list1.subList(90,100); price1 = list2.subList(0, 10); int c1 = 0; int p1 = 0; for (c1 = 0, p1 = 0; c1 < commodity1.size() && p1 < price1.size(); c1++, p1++) { String x = (String) commodity1.get(c1); String y = (String) price1.get(p1); out.println(x); out.println(y); } br.close(); //System.out.println(sb); } catch (MalformedURLException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } %> I am getting the following output à¤§à¤¾à¤¨ 1325 à¤šà¤¾à¤µà¤² 2050 à¤œà¥�à¤µà¤° 920 à¤œà¥Œ 810 à¤®à¤•à¤ˆ 1280 à¤—à¥‡à¤¹à¥‚à¤� 1420 à¤œà¥‹ 1050 à¤¬à¥‡à¤œà¤° - à¤œà¤¯ 800 à¤‰à¤¡à¤¼à¤¦ 3600 How can I achieve my desired goal? Thanks in advance
type: UnansweredQuestion
tagged with: java

http://stackoverflow.com/q/23414852
type: UnansweredQuestion
upvote count: 1
has comment: http://stackoverflow.com/comment/35900699
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/23415003
has body: I've used once a GSON library in Eclipse and it was very easy. Just added it as external library and in source file I've imported it and was able to use it just like any other class in Java. Example: Gson gson = new Gson(); //and just use it Recently I had to work with SQLIte database file, so I've downloaded JDBC driver library and added it in my Eclipse project. But I've noticed that there is kind of strange (at least for me) syntax for using it. I've imported java.sql.* but to be able to use its classes I had to do the following: Class.forName("org.sqlite.JDBC"); I know that the return value from this command is Class object (during runtime) but as you can see from the syntax it is never used. Please explain whats going on there and why I can't just use SQL package classes without invoking Class.forName first.
type: Question
answer count: 2
has title: Java JAR (library) usage
tagged with: jdbc
downvote count: 0
linked to: http://stackoverflow.com/q/6740601
has answer: http://stackoverflow.com/a/23414937
favorite count: 0

http://stackoverflow.com/comment/35816607
has text: The '+' are interpreted from left to right. In a different context, the right '+' would cause a number addition, in this case the left operand is already a string, so it just gets appended to the string.
comment on: http://stackoverflow.com/q/23380859
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23355208
has comment: http://stackoverflow.com/comment/35769877
upvote count: 1
has comment: http://stackoverflow.com/comment/35770130
possible better answer: http://stackoverflow.com/a/23355332
has comment: http://stackoverflow.com/comment/35769764
downvote count: 0
favorite count: 0
answer count: 3
has answer: http://stackoverflow.com/a/23355332
has comment: http://stackoverflow.com/comment/35770291
has comment: http://stackoverflow.com/comment/35769751
has answer: http://stackoverflow.com/a/23355255
has title: Change JButton Color on ActionPerformed
has comment: http://stackoverflow.com/comment/35770223
tagged with: swing
tagged with: jbutton
accepted answer: http://stackoverflow.com/a/23355345
tagged with: actionlistener
type: AnsweredQuestion
has body: Despite my efforts of changing the color of my buttons, and reading everywhere on how to do it, my code still does not produce the desired effect. How can I change the color of a JButton when clicked? public void generateButtons { //Global field firstBoard = new JButton[9][9]; for(int x = 0; x &lt; firstBoard.length; x++) { for(int y = 0; y &lt; firstBoard[0].length; y++) { firstBoard[x][y] = new JButton(); firstBoard[x][y].setActionCommand("0|" + (x + (firstBoard.length * y))); firstBoard[x][y].addActionListener(this); //firstBoardPanel.add(firstBoard[x][y]); } } } @Override public void actionPerformed(ActionEvent e) { if(e.getSource() instanceof JButton ) { System.out.println(parseActionCommand(((JButton)e.getSource()).getActionCommand())); ((JButton)e.getSource()).setBackground(Color.BLUE); ((JButton)e.getSource()).setContentAreaFilled(false); ((JButton)e.getSource()).setOpaque(true); } }
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/35769723
has comment: http://stackoverflow.com/comment/35770245
has answer: http://stackoverflow.com/a/23355345
type: Question
has comment: http://stackoverflow.com/comment/35769822

http://stackoverflow.com/q/23374181
has comment: http://stackoverflow.com/comment/35805846
has comment: http://stackoverflow.com/comment/35805655
favorite count: 0
has comment: http://stackoverflow.com/comment/35811011
tagged with: exception
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35810980
has body: I've been working on this program for the last week or so and have had this particular block of code running smoothly up until a little while ago. I haven't changed it at all, and all of a sudden it started throwing an exception for every option picked once the button was pushed. I've tested it for each option by putting a "System.out.println(activityMultiplier);" statement in each block, and it prints the correct value, so the item listener seems to be working. And when I select "Choose an Activity Level" (the optin which is supposed to throw an exception) the exception is thrown properly: the JOptionPane goes away once I click okay, and the JComboBox is still there so I can make another selection. However, I get the JOptionPane error message for EVERY option now, I've included the noActivity() method at the bottom so you can see what I'm calling. public void setActivity() //JComboBox { final JFrame activityWindow = new JFrame(); activityWindow.setTitle("Question No 6 of 6"); activityWindow.setLocationRelativeTo(null); JPanel activityPanel = new JPanel(); activityPanel.setLayout(new BorderLayout(10, 10)); activityPanel.setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20)); JLabel activityLabel = new JLabel("Please select your activity level:"); final JComboBox activityList = new JComboBox(activityString); activityList.setSelectedIndex(5); activityList.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { activityLevel = (String) activityList.getSelectedItem(); } }); JButton submitBtn = new JButton("Submit"); submitBtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { try { if (activityLevel.equals("Choose an activity level")) throw new Exception(); else if (activityLevel.equals("Sedentary (little or no exercise)")) { activityMultiplier = 1.2; activityWindow.dispose(); setBMR(); } else if (activityLevel.equals("Lightly active (light exercise/sports 1-3 days/week)")) { activityMultiplier = 1.375; act…
has answer: http://stackoverflow.com/a/23374582
score: 1
has comment: http://stackoverflow.com/comment/35805643
has comment: http://stackoverflow.com/comment/35804673
type: Question
has title: Java throwing exception when criteria not met
has comment: http://stackoverflow.com/comment/35805042
tagged with: java
has comment: http://stackoverflow.com/comment/35805069
has comment: http://stackoverflow.com/comment/35805672
upvote count: 1
answer count: 1
downvote count: 0

http://stackoverflow.com/q/23351734
type: UnansweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/23352847
has body: I have this program called Editor.java it is almost finish but i need to finish public void doRun(String Line). How Run should work is when you type RUN it will start the program executing at the lowest numbered line it can find. If RUN is followed by a number like 35 it should begin at the first line number it finds that is greater than or equal to the specified number. For example if I typed in : 5 LET A = 5 10 PRINT A 20 LET X = 10 30 LET Y = 20 40 PRINT X + Y 50 LET Z = X + Y * 2 60 PRINT Z 70 GOTO 90 80 LET Z = 10 90 PRINT X Y Z 100 LET P = 80 110 IF (Z &gt; 20) THEN LET P = 10 120 PRINT P RUN 15 The Output should be: X + Y = 30.0 Z : 50.0 X Y Z : 10.0 20.0 50.0 P : 10.0 This is the code I developed so far If anyone could assist it would be greatly appreciated. import java.util.Scanner; import java.io.*; public class Editor { EditLL list; HashTable commands; HashTable variables; final static String comm[] = {"LOAD", "SAVE", "RESEQUENCE", "LIST", "QUIT", "EXIT", "LET", "PRINT", "INPUT", "RUN"}; public Editor() { list = new EditLL(); commands = new HashTable(); variables = new HashTable(); for (int i = 0; i &lt; comm.length; i++) { commands.insert(comm[i], (double)i); } } public boolean processLine(String line) throws IOException { boolean retval = true; line = trimLeadingWhitespace(line); int last = line.indexOf(' '); String initial = line; if (last &gt;= 0) initial = line.substring(0, last); if (last &gt;= 0) { line = line.substring(last); line = trimLeadingWhitespace(line); } else line = ""; if (isInt(initial)) { int lineNum = Integer.parseInt(initial); list.insert(lineNum, line); } else { int key = (int)commands.getValue(initial); switch(key) { case 0: this.load(line); break; case 1: this.save(line); break; case 2: list.resequence(10); break; case 3: System.out.println(this.list); break; case 4: case 5: retval = false; break; case 6: doLet(line); // line after the word let break; case 7: print(line, variables); break; case 8: input(line); break; case 9: doRun…
has title: Editor.java assistance
score: 0
answer count: 1

http://stackoverflow.com/comment/35725081
type: Comment
type: QuestionComment
has text: post activity_main.xml
comment on: http://stackoverflow.com/q/23330645
score: 0

http://stackoverflow.com/a/23297936
downvote count: 0
upvote count: 2
has body: static variable is not an instance variable, its the same one for every instance. its a class variable so if some instance touch it, it will change for all. you can read more about static variables here
type: Answer
answers question: http://stackoverflow.com/q/23297859
score: 2

http://stackoverflow.com/comment/35906234
has text: Now the size of the object is 5 after adding due amount i want to remove the remaining two objects in the list could you please place the code how to do it
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23429089

linkedhashmap
tags question: http://stackoverflow.com/q/23415234
tags question: http://stackoverflow.com/q/23389088
tags question: http://stackoverflow.com/q/23383723
tag name: linkedhashmap
tags question: http://stackoverflow.com/q/23376375
tags question: http://stackoverflow.com/q/23415603
type: Tag

http://stackoverflow.com/q/23333092
has answer: http://stackoverflow.com/a/23333894
tagged with: android-fragmentactivity
has body: I need to know, In which fragment callback method, we should call a web service by which after come back to fragment web service should not call again. For example. I have a fragment class MyFragment.java public class MyFragment extends Fragment { @Override public void onAttach(Activity activity) { super.onAttach(activity); } @Override public void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_layout, container, false); return rootView; } } I need to know which callback method I have to call webservice to update the UI of fragment. Right Now I am calling web services from onCreateView method. but I need to know what should be best way to call web service from fragment.
answer count: 3
downvote count: 0
has title: Right Approach to Call Web Service(API) from Fragment class
favorite count: 0
has answer: http://stackoverflow.com/a/40735136
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/62186285
upvote count: 16
tagged with: java
score: 16
tagged with: web-services
type: Question
tagged with: android-fragments

http://stackoverflow.com/comment/35676179
comment on: http://stackoverflow.com/q/23302668
score: 0
has text: I'd try following this example to set `UTF-8` as the charset of the `HttpClient` object: http://stackoverflow.com/questions/4480363/android-java-utf-8-httpclient-problem
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23329340
accepted answer of: http://stackoverflow.com/q/23320407
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23320407
type: Answer
has comment: http://stackoverflow.com/comment/43098501
has body: Apparently, it's intentional. The Javadoc for the method CompletableFuture::cancel states: [Parameters:] mayInterruptIfRunning - this value has no effect in this implementation because interrupts are not used to control processing. Interestingly, the method ForkJoinTask::cancel uses almost the same wording for the parameter mayInterruptIfRunning. I have a guess on this issue: interruption is intended to be used with blocking operations, like sleep, wait or I/O operations, but neither CompletableFuture nor ForkJoinTask are intended to be used with blocking operations. Instead of blocking, a CompletableFuture should create a new CompletionStage, and cpu-bound tasks are a prerequisite for the fork-join model. So, using interruption with either of them would defeat their purpose. And on the other hand, it might increase complexity, that's not required if used as intended.
has comment: http://stackoverflow.com/comment/75792696
upvote count: 22
has comment: http://stackoverflow.com/comment/96095192
score: 22

http://stackoverflow.com/q/23362770
accepted answer: http://stackoverflow.com/a/23363237
score: 0
has body: I'm reading a txt with BuffererReader and I wonder how to give the path to my txt in BufferedReader's argument. BufferedReader input = new Bufferedreader( new FileReader(D:VI.félév\Prog gyak\Project\proba.txt)); This doesn't seem to work.
type: Question
has title: How to give path to txt to read from in java?
has answer: http://stackoverflow.com/a/23363288
answer count: 2
has comment: http://stackoverflow.com/comment/35782785
tagged with: bufferedreader
has answer: http://stackoverflow.com/a/23363237
possible better answer: http://stackoverflow.com/a/23363288
tagged with: filereader
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/q/23404517
has body: Requirements I need a polymorphic method. Argument lists in subclasses are not the same size. Arguments in subclass may be from different subtypes and I would like the compiler to perform type checking in subclasses regarding determined subtype; So list or array is not suitable as argument. Because they do not force size, or exact subtype! More details and example [The codes are for illustration, and you may find compile errors in them.] First case I need a base class with a method that accepts variable length argument list. This allows me to have a general class. For example: abstract class baseClass{ public abstract void serialize(Object... data); } Now I want to create some subclasses that are specific, so I need to have fixed size argument list in subclasses. For example something like this (but this syntax is wrong!) : class subClass1 extends baseClass{ @Override public void serialize(Object data1){ //method body... } } class subClass2 extends baseClass{ @Override public void serialize(Object data1, Object data2){ //method body... } } How should I write the subclasses? Second case In other case, my subclass would like to define the type of arguments explicitly (Because this will allow compile time checking). For example: class subClass3 extends baseClass{ @Override public void serialize(int data1){ //method body... } } class subClass4 extends baseClass{ @Override public void serialize(int data1, double data2, String data3){ //method body... } } How should I write this one?
tagged with: inheritance
score: 0
answer count: 2
tagged with: variadic-functions
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23404603
tagged with: java
has answer: http://stackoverflow.com/a/23404664
type: Question
has title: change a variable length argument list to fixed size in inheritance

http://stackoverflow.com/comment/35777009
has text: Finally this is the real solution but i forgot put getters and setters of nodeService.
comment on: http://stackoverflow.com/a/23344589
type: Comment
score: 1
type: AnswerComment

http://stackoverflow.com/a/23300561
has body: I can't run your code since you're using some classes not included. To put your buttons taking up minimal space at the bottom of the panel, I'd suggest using a BorderLayout for the Frame. So instead of GridLayout, use: setLayout(new BorderLayout()); Then add panel2 with the buttons to the bottom of the frame: add(panel2, BorderLayout.PAGE_END); Since panel is the main component, you'll want that to take up most of the space, so position it center: add(panel, BorderLayout.CENTER);
type: Answer
accepted answer of: http://stackoverflow.com/q/23300461
score: 1
has comment: http://stackoverflow.com/comment/35670465
answers question: http://stackoverflow.com/q/23300461
upvote count: 1
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/35661494
type: Comment
has text: @BheshGurung no, we should vote to close for a duplicate Q/A...
comment on: http://stackoverflow.com/q/23296081
score: 0
type: QuestionComment

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

http://stackoverflow.com/comment/35831241
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23388243
has text: With the same value it works for me. I use `XMLUnit.setNormalizeWhitespace(Boolean.TRUE);` and `XMLUnit.setIgnoreComments(Boolean.TRUE);`

http://stackoverflow.com/comment/35779271
comment on: http://stackoverflow.com/q/23360692
score: 0
has text: Assumptions while programming are horrible. Don't do it. Also, that has nothing to do with any code you wrote to find byte position which is what I'm asking about.
type: QuestionComment
type: Comment

http://stackoverflow.com/q/23362272
tagged with: java
has title: how to use Dome parser in android
has answer: http://stackoverflow.com/a/23363733
type: Question
upvote count: 0
score: -1
has answer: http://stackoverflow.com/a/23362370
answer count: 3
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23362510
tagged with: android
downvote count: 1
has body: http://www.webservicex.net/country.asmx?op=GetISD this is web service i want to parse and get code suppose if pass india then it should return. public String CountryName(String Country) { HttpClient httpclient=new DefaultHttpClient(); HttpGet htpget=new HttpGet("http://www.webservicex.net/country.asmx?op=GetISD"); try { // Execute HTTP Post Request HttpResponse response = httpclient.execute(htpget); String resp = response.getStatusLine().toString(); Toast.makeText(this, resp, 5000).show(); } catch (ClientProtocolException e) { Toast.makeText(this, "Error", 5000).show(); } catch (IOException e) { Toast.makeText(this, "Error", 5000).show(); } return code; } I am getting Response code 200 But i am Unable to do Dom Parsing please help how i will implemnt how i will get code from DOm Parsing . System.InvalidOperationException: Request format is invalid: . at System.Web.Services.Protocols.HttpServerProtocol.ReadParameters() at System.Web.Services.Protocols.WebServiceHandler.CoreProcessRequest() This Error is coming

http://stackoverflow.com/comment/35680766
type: Comment
score: 0
type: QuestionComment
has text: OFX4J doesn't give me this "20140425053117.694[+5.30:IST]" format. It gives me this "20140306075536.012" format! It would be great if you can tell me if I can achieve the pattern that I want using OFX4J itslef! @nos
comment on: http://stackoverflow.com/q/23292418

http://stackoverflow.com/comment/35667280
has text: You really should match your IE Driver version to your Selenium version.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23299320
score: 1

http://stackoverflow.com/comment/35792153
has text: Unrelated to your problem, but you certainly don't need `l2onConn.connect()`.
comment on: http://stackoverflow.com/q/23367392
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23416135
type: AnsweredQuestion
has title: comparing 2 arrays of characters in java
tagged with: java
accepted answer: http://stackoverflow.com/a/23416402
type: Question
has comment: http://stackoverflow.com/comment/35882852
tagged with: arrays
downvote count: 5
has comment: http://stackoverflow.com/comment/35883035
answer count: 3
has answer: http://stackoverflow.com/a/23416317
has comment: http://stackoverflow.com/comment/35882857
favorite count: 0
has answer: http://stackoverflow.com/a/23416402
possible better answer: http://stackoverflow.com/a/23416225
has body: I am trying to simply compare 2 arrays of Strings. The overall purpose of the code is to go through each index of the arrays and compare the two at each index(a[1] == b[1]) and add to a 3 array the number a 1 when the two arrays are the same. When finished it will print out the size of the array as the total number of times the two are the same. When i try to compare the code i get an error. I have tried commenting out and testing and it seems to have a problem with my comparison statement on line 23. import java.util.*; public class Slop { public static void main(String [] args) { // Compare the 2 Signatures String control = " 0x302E0215032648D0ABE03F7226239932B9293B157F3EECF863021503635EB910778742D88A880B867C45CFFDEC9970BC"; char[] controlArray = control.toCharArray(); //System.out.println(controlArray); String test = "0x302E021501452CB212DBE4C8B541D02D79EF140BE617875EC7021503951DB8026549B0F9AB8FDB69F355F37A5A967424"; char[] testArray = test.toCharArray(); List&lt;Integer&gt; countArray = new ArrayList&lt;Integer&gt;(); // try{ for(int i =0; i &lt; 99; i++) { //System.out.println(controlArray[i]); for(int j =0; j &lt; 99; j++) { //System.out.println(controlArray); //System.out.println(testArray[j]); if (controlArray[i] == testArray[j]) { countArray.add(1); } } } System.out.println(countArray.size()); }}} I keep getting this error Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 98 at Slop.main(Slop.java:23) Any Help would be greatly appreciated.
upvote count: 2
has answer: http://stackoverflow.com/a/23416225
has comment: http://stackoverflow.com/comment/35882907
score: -3

http://stackoverflow.com/comment/35714520
type: Comment
has text: You might want to check out [this](http://keysersblog.wordpress.com/2014/04/21/debugging-java-code-a-beginners-guide/) lightweight java debugging tutorial (full disclosure: I wrote it. It seems to fit your needs)
comment on: http://stackoverflow.com/q/23325373
score: 0
type: QuestionComment

jsf
tags question: http://stackoverflow.com/q/23347953
tags question: http://stackoverflow.com/q/23387798
type: Tag
tags question: http://stackoverflow.com/q/23450816
tags question: http://stackoverflow.com/q/23449253
tags question: http://stackoverflow.com/q/23303546
tags question: http://stackoverflow.com/q/23314782
tags question: http://stackoverflow.com/q/23359840
tags question: http://stackoverflow.com/q/23382970
tags question: http://stackoverflow.com/q/23309084
tags question: http://stackoverflow.com/q/23302108
tags question: http://stackoverflow.com/q/23291229
tags question: http://stackoverflow.com/q/23432666
tags question: http://stackoverflow.com/q/23300126
tags question: http://stackoverflow.com/q/23304986
tags question: http://stackoverflow.com/q/23400296
tags question: http://stackoverflow.com/q/23325648
tags question: http://stackoverflow.com/q/23326008
tags question: http://stackoverflow.com/q/23387709
tags question: http://stackoverflow.com/q/23290913
tags question: http://stackoverflow.com/q/23342987
tag name: jsf
tags question: http://stackoverflow.com/q/23329352
tags question: http://stackoverflow.com/q/23320828
tags question: http://stackoverflow.com/q/23444819
tags question: http://stackoverflow.com/q/23308207
tags question: http://stackoverflow.com/q/23338035
tags question: http://stackoverflow.com/q/23297398
tags question: http://stackoverflow.com/q/23334625
tags question: http://stackoverflow.com/q/23331339
tags question: http://stackoverflow.com/q/23296369
tags question: http://stackoverflow.com/q/23431420
tags question: http://stackoverflow.com/q/23429776
tags question: http://stackoverflow.com/q/23413947
tags question: http://stackoverflow.com/q/23382704
tags question: http://stackoverflow.com/q/23403197
tags question: http://stackoverflow.com/q/23331978
tags question: http://stackoverflow.com/q/23433374
tags question: http://stackoverflow.com/q/23310094
tags question: http://stackoverflow.com/q/23350773

http://stackoverflow.com/comment/35802555
type: Comment
has text: try to copy image to src folder and export jar
comment on: http://stackoverflow.com/a/23373045
score: 0
type: AnswerComment

http://stackoverflow.com/comment/35938244
type: AnswerComment
has text: you are right, I have go into the source of ClassUtils and I found that it has specified two arguments.Dose it mean that DWR3 has to work with Spring 3? Is there any solution about integration Spring4 with DWR3?
type: Comment
comment on: http://stackoverflow.com/a/23446191
score: 0

tomcat
tags question: http://stackoverflow.com/q/23291539
tags question: http://stackoverflow.com/q/23319608
tags question: http://stackoverflow.com/q/23398030
tags question: http://stackoverflow.com/q/23402643
tags question: http://stackoverflow.com/q/23292543
tags question: http://stackoverflow.com/q/23431743
tags question: http://stackoverflow.com/q/23329693
tags question: http://stackoverflow.com/q/23322231
tags question: http://stackoverflow.com/q/23425688
tags question: http://stackoverflow.com/q/23438017
tags question: http://stackoverflow.com/q/23389859
tags question: http://stackoverflow.com/q/23441692
tags question: http://stackoverflow.com/q/23303360
tags question: http://stackoverflow.com/q/23340310
tags question: http://stackoverflow.com/q/23312800
tags question: http://stackoverflow.com/q/23351082
tags question: http://stackoverflow.com/q/23382326
tags question: http://stackoverflow.com/q/23359727
tags question: http://stackoverflow.com/q/23324501
tags question: http://stackoverflow.com/q/23392318
tags question: http://stackoverflow.com/q/23305771
tags question: http://stackoverflow.com/q/23342550
tags question: http://stackoverflow.com/q/23324588
tags question: http://stackoverflow.com/q/23418736
tags question: http://stackoverflow.com/q/23424312
tags question: http://stackoverflow.com/q/23400659
tag name: tomcat
tags question: http://stackoverflow.com/q/23361757
tags question: http://stackoverflow.com/q/23427028
tags question: http://stackoverflow.com/q/23359668
tags question: http://stackoverflow.com/q/23310041
tags question: http://stackoverflow.com/q/23322418
tags question: http://stackoverflow.com/q/23342020
tags question: http://stackoverflow.com/q/23421021
tags question: http://stackoverflow.com/q/23350201
tags question: http://stackoverflow.com/q/23395178
tags question: http://stackoverflow.com/q/23312666
tags question: http://stackoverflow.com/q/23382011
tags question: http://stackoverflow.com/q/23398254
tags question: http://stackoverflow.com/q/23389044
tags question: http://stackoverflow.com/q/23422804
tags question: http://stackoverflow.com/q/23452286
tags question: http://stackoverflow.com/q/23383399
tags question: http://stackoverflow.com/q/23360088
tags question: http://stackoverflow.com/q/23354215
tags question: http://stackoverflow.com/q/23360851
tags question: http://stackoverflow.com/q/23450758
tags question: http://stackoverflow.com/q/23441433
type: Tag
tags question: http://stackoverflow.com/q/23381983
tags question: http://stackoverflow.com/q/23412463
tags question: http://stackoverflow.com/q/23393913
tags question: http://stackoverflow.com/q/23343169
tags question: http://stackoverflow.com/q/23355560
tags question: http://stackoverflow.com/q/23291743
tags question: http://stackoverflow.com/q/23415006
tags question: http://stackoverflow.com/q/23418625
tags question: http://stackoverflow.com/q/23325389
tags question: http://stackoverflow.com/q/23450402
tags question: http://stackoverflow.com/q/23365056
tags question: http://stackoverflow.com/q/23344035
tags question: http://stackoverflow.com/q/23307914
tags question: http://stackoverflow.com/q/23345997
tags question: http://stackoverflow.com/q/23420733
tags question: http://stackoverflow.com/q/23344405
tags question: http://stackoverflow.com/q/23432651
tags question: http://stackoverflow.com/q/23325648
tags question: http://stackoverflow.com/q/23452484
tags question: http://stackoverflow.com/q/23396105
tags question: http://stackoverflow.com/q/23325666
tags question: http://stackoverflow.com/q/23312183

http://stackoverflow.com/q/23377166
has title: Timer having difficulty when decreasing in minutes
favorite count: 0
tagged with: timer
type: UnansweredQuestion
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/35810385
tagged with: java
has body: Hi Im working on a timer program that counts down from 6:00 minutes. it works well (6:00, 5:59, 5:58... 5:01, 5:00, 4:59) but then after 4:59 it starts decreasing in minutes and not seconds (ex: 4:59, 3:59, 2:59) and I cant figure out why. Heres the code: //Drag Button public class event implements ActionListener { public void actionPerformed(ActionEvent e){ int count = 60; dragTimer.setText("6:00"); TimeClass tc = new TimeClass(count); dragT = new Timer(1000, tc); dragT.start(); } } public class TimeClass implements ActionListener { int counter = 60; int minute = 5; public TimeClass(int counter){ this.counter = counter; } public void actionPerformed(ActionEvent tc){ counter--; if(minute &gt; 0){ if(counter &gt;= 0) { String countString = Integer.toString(counter); String minuteString = Integer.toString(minute); String numb = minuteString + ":" + countString; dragTimer.setText(numb); } if(counter &lt; 10 || counter &lt;= 1){ String countString = Integer.toString(counter); String minuteString = Integer.toString(minute); String numb = minuteString + ":0" + countString; dragTimer.setText(numb); } if(counter &lt; 0){ int counter = 59; minute--; String countString = Integer.toString(counter); String minuteString = Integer.toString(minute); String numb = minuteString + ":" + countString; dragTimer.setText(numb); } }else{ dragT.stop(); dragTimer.setText("0:00"); Toolkit.getDefaultToolkit().beep(); } } }
type: Question
has answer: http://stackoverflow.com/a/23377225
answer count: 1
downvote count: 0

http://stackoverflow.com/q/23375299
has comment: http://stackoverflow.com/comment/35806823
upvote count: 1
answer count: 4
has answer: http://stackoverflow.com/a/23376303
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/23376248
linked to: http://stackoverflow.com/q/11743306
tagged with: jaxb
downvote count: 1
has answer: http://stackoverflow.com/a/23375503
tagged with: marshalling
type: Question
has comment: http://stackoverflow.com/comment/35806783
has body: on setting an element: element.setValue(null) it marshalls the XML to <value>null<value> I am expecting it to be: <value/> or
score: 0
has title: JAXB returns "null" string instead of null
accepted answer: http://stackoverflow.com/a/23376248
possible better answer: http://stackoverflow.com/a/23375471
has answer: http://stackoverflow.com/a/23375471
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml

http://stackoverflow.com/q/23388457
tagged with: sockets
has answer: http://stackoverflow.com/a/23393851
linked to: http://stackoverflow.com/q/2685534
has answer: http://stackoverflow.com/a/23389169
score: 1
tagged with: java
upvote count: 1
type: Question
has body: I am having java server and just one client at the time. client connects and sends card ID (blocking read on server side is suitable, because only 1 client at the time) if card doesn't exist in database it just sends back 0 and close the socket (no problem) if card does exist sends back 1 now client has to send PIN to the server, but there has to be some timeout, let's say 10s. Here i cannot use blocking read, what should i do? Socket setSoTimeout is not an option, because first read is blocking but second one should not be.
has answer: http://stackoverflow.com/a/23391793
has comment: http://stackoverflow.com/comment/35831096
has title: Java server socket data input stream read timeout
has comment: http://stackoverflow.com/comment/35830836
linked to: http://stackoverflow.com/q/804951
answer count: 3
downvote count: 0
linked to: http://stackoverflow.com/q/14225957
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/35762180
type: Comment
score: 2
has text: If you don't want to use a regex, you can check the string with the methods `.startsWith("{")` and `.endsWith("}")`.
type: QuestionComment
comment on: http://stackoverflow.com/q/23351009

http://stackoverflow.com/comment/35698784
score: 1
has text: If you no longer need the values in a resultset object you could use the same resultset object for the next query which would overwrite the old values.
comment on: http://stackoverflow.com/q/23316517
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23298241
type: Question
accepted answer: http://stackoverflow.com/a/23298878
tagged with: simpledateformat
answer count: 2
downvote count: 0
favorite count: 0
possible better answer: http://stackoverflow.com/a/23299058
has answer: http://stackoverflow.com/a/23299058
has answer: http://stackoverflow.com/a/23298878
has title: Lenient SimpleDateFormat acting strange
type: AnsweredQuestion
score: 3
upvote count: 3
tagged with: java
has body: I understand that, in order to properly validate date strings, one must make DateFormat instances non-lenient to get all ParseExceptions from malformed dates. But consider String dubiousDate = "2014-04-01"; DateFormat sdf = new SimpleDateFormat( "yyyyMMdd"); Date d; try { d = sdf.parse( dubiousDate); System.out.println( dubiousDate + " -&gt; " + d); } catch ( ParseException e) { e.printStackTrace(); System.err.println( dubiousDate + " failed"); } this will give 2014-04-01 -> Wed Dec 04 00:00:00 CET 2013 Now I can understand that the lenient calendars try to be nice and accept funny negative numbers, but this interpretation looks like the -01 is considered as month, even though it appears last, where the days are. And the -04 months become 04 days, with the minus ignored. In all leniency, why would this make sense to anyone?

lotus-designer
type: Tag
tags question: http://stackoverflow.com/q/23344615
tag name: lotus-designer

http://stackoverflow.com/q/23310140
score: 3
tagged with: java
has title: EditText with only digits. No Decimal Point
answer count: 2
downvote count: 0
favorite count: 0
possible better answer: http://stackoverflow.com/a/23310271
tagged with: android
has body: I want to have an EditText which only allows numeric inputs. It should not allow even decimal point (.) in the field. tried &lt;EditText ..... android:digits="0123456789" android:inputType="number" android:maxLength="4" ..... /&gt; But it still accepts decimal point. Any solution to this problem ?
has answer: http://stackoverflow.com/a/23310271
type: AnsweredQuestion
tagged with: android-edittext
has answer: http://stackoverflow.com/a/23310472
accepted answer: http://stackoverflow.com/a/23310472
upvote count: 3
type: Question

http://stackoverflow.com/comment/35791175
has text: sessionComposite.setLayout(new FillLayout()) - failed, no text is displayed on the StyledLabel. StyledLabel - com.jodisoft.swing.StyledLabel.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23366817

http://stackoverflow.com/q/23303787
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/23303846
has body: I was wondering if it was possible to read a file bit meaning 0's and 1's and them displaying them, in either java or python. I don't know if it possible.
tagged with: file
has title: Taking the bit of a file and displaying them
type: Question
possible better answer: http://stackoverflow.com/a/23303846
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/35675657
tagged with: bit
tagged with: python
has answer: http://stackoverflow.com/a/23303910
has comment: http://stackoverflow.com/comment/35675666
accepted answer: http://stackoverflow.com/a/23303910

libgdx
tags question: http://stackoverflow.com/q/23436578
tags question: http://stackoverflow.com/q/23405431
tags question: http://stackoverflow.com/q/23420365
tags question: http://stackoverflow.com/q/23313612
tags question: http://stackoverflow.com/q/23314348
tags question: http://stackoverflow.com/q/23384184
tag name: libgdx
tags question: http://stackoverflow.com/q/23304457
tags question: http://stackoverflow.com/q/23318661
tags question: http://stackoverflow.com/q/23439749
tags question: http://stackoverflow.com/q/23422071
tags question: http://stackoverflow.com/q/23390021
tags question: http://stackoverflow.com/q/23310616
tags question: http://stackoverflow.com/q/23402717
type: Tag
tags question: http://stackoverflow.com/q/23292355
tags question: http://stackoverflow.com/q/23394212
tags question: http://stackoverflow.com/q/23361474
tags question: http://stackoverflow.com/q/23416848
tags question: http://stackoverflow.com/q/23352506
tags question: http://stackoverflow.com/q/23291550
tags question: http://stackoverflow.com/q/23325193
tags question: http://stackoverflow.com/q/23402816
tags question: http://stackoverflow.com/q/23388946
tags question: http://stackoverflow.com/q/23351577
tags question: http://stackoverflow.com/q/23329717
tags question: http://stackoverflow.com/q/23406288
tags question: http://stackoverflow.com/q/23386271
tags question: http://stackoverflow.com/q/23355039
tags question: http://stackoverflow.com/q/23353064
tags question: http://stackoverflow.com/q/23398970
tags question: http://stackoverflow.com/q/23347980
tags question: http://stackoverflow.com/q/23362532
tags question: http://stackoverflow.com/q/23442108
tags question: http://stackoverflow.com/q/23401431
tags question: http://stackoverflow.com/q/23354475

http://stackoverflow.com/q/23402531
has comment: http://stackoverflow.com/comment/35856795
type: UnansweredQuestion
has title: Why am I getting this precision error?
score: -3
answer count: 4
has comment: http://stackoverflow.com/comment/35856715
has answer: http://stackoverflow.com/a/23402619
tagged with: java
has answer: http://stackoverflow.com/a/23402579
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/23402851
downvote count: 4
linked to: http://stackoverflow.com/q/23385867
has comment: http://stackoverflow.com/comment/35856690
linked to: http://stackoverflow.com/q/4685450
has body: This is the code i am using to calculate a percentage and round it to 2 decimal places. However, at the moment, the result comes out as 45.0% rather than 45.33% int one = 432; int rolls = 953; double test1 = 100 * one / rolls; double finalValue1 = Math.round( test1 * 100.0 ) / 100.0; Why are no decimal places showing?
has comment: http://stackoverflow.com/comment/35856938
has answer: http://stackoverflow.com/a/23402571
has comment: http://stackoverflow.com/comment/35856785
favorite count: 0

http://stackoverflow.com/comment/35674242
comment on: http://stackoverflow.com/a/23302755
type: Comment
score: 1
type: AnswerComment
has text: I think you meant statically typed, not strongly typed. And no, because Java is statically typed. All of the type information of all objects MUST exist at compile type. You could write some kind of incredibly black-magic introspection that figures out what the type it should cast to is and passes it to the function that does the casting, but a function for each cast type needs to exist, you can't dynamically produce the cast, and you're going to need totally separate pipelines for each cast type.

http://stackoverflow.com/comment/35762634
has text: I dont see the reference of it in your logs.
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23351073

http://stackoverflow.com/a/23403006
has body: You need a second conditional for this ternary expression to work. value = (a &gt; b) ? a : (b &gt; c) ? c : d; Then it would become: if (a &gt; b) { value = a; } else if (b &gt; c) { value = c; } else { value = d; } In your case: if (trackerId == TrackerName.APP_TRACKER) { t = analytics.newTracker(PROPERTY_ID); } else if (trackerId == TrackerName.GLOBAL_TRACKER) { t = analytics.newTracker(R.xml.global_tracker); } else { t = analytics.newTracker(R.xml.ecommerce_tracker); } Resources: Multiple conditions in ternary operators
downvote count: 1
has comment: http://stackoverflow.com/comment/35857718
upvote count: 12
has comment: http://stackoverflow.com/comment/35857635
answers question: http://stackoverflow.com/q/23402960
type: Answer
score: 11

http://stackoverflow.com/q/23360482
score: 1
tagged with: java
has title: AlertDialog dynamically call next dialog with buttonclick with data read from LinkedHashMap
has comment: http://stackoverflow.com/comment/35799967
upvote count: 1
type: Question
downvote count: 0
has body: I want to do something like a getNext() call on the LinkedHashMap and send the data into the create_dialog_method. I read about using Iterator on the hashmap and some counter that keeps tracks of the next position. I'm not sure how to do it codewise though. Here is the Activity for the dialogues: public class QuestionsActivity extends Activity { Map&lt;String, Boolean&gt; question_map = new LinkedHashMap&lt;String, Boolean&gt;(); //ArrayList&lt;Questions&gt; question_array = new ArrayList&lt;Metrics&gt;(); int counter = 0; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.test_layout); //false = call showRiskEvaluationDialog() on button NO //true = call showRiskEvaluationDialog() on button YES question_map.put("8. Question8?", false); question_map.put("7. Question7?", false); question_map.put("6. Question6?", false); question_map.put("5. Question5?", false); question_map.put("4. Question4?", false); question_map.put("3. Question3?", false); question_map.put("2. Question2?", false); question_map.put("1. Question1?", false); create_dialog_method("asd2313", false); // For loop to extract a question and identifier from the Map //for (Entry&lt;String, Boolean&gt; entry : question_map.entrySet()){ // create_dialog_method(entry.getKey(), entry.getValue()); //}//end for }//end onCreate() /** * Method for creating a dialog window that show question and two buttons. * @param question_param * @param identifier */ public void create_dialog_method(String question_param, final boolean identifier) { AlertDialog.Builder alert = new AlertDialog.Builder(this); alert.setTitle("Title"); alert.setMessage(question_param); alert.setPositiveButton("YES", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int whichButton) { if (identifier) showRiskEvaluationDialog(); else //**********HERE IS THE PROBLEM******** if (identifier == false); for (Entry&lt;String, Boolean&gt; entry: qu…
favorite count: 0
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/35782144
answer count: 0

http://stackoverflow.com/a/23382917
type: Answer
has comment: http://stackoverflow.com/comment/35820650
accepted answer of: http://stackoverflow.com/q/23382871
downvote count: 0
answers question: http://stackoverflow.com/q/23382871
score: 1
upvote count: 1
type: AcceptedAnswer
has body: The property name although declared private in Animal is still inherited in Cat. But, we don't have direct access to it i.e. you can't use name with the . operator like cat.name = "Jerry". But, since the method getName is declared in Animal and thus has access to the private members of Animal. Also getName is public, so we can access it in Cat. This means that we are accessing the private members of a super-class in a sub-class. This is pretty obvious. You may seem confused about it because many How the name is set to Tom: - The name is set through the public constructor of Animal. And the constructor of Cat passes the value of name to the Animal constructor, which then sets it. EDIT: When you say Cat cat = new Cat("Tom");, it means you have created only one object. An object of Cat. You haven't created an object of Animal. Although the constructor of Animal is called, it doesn't creates an instance of Animal. Int the above case, the property name belongs to the instance of Cat and not Animal.

http://stackoverflow.com/a/23378430
score: 0
type: Answer
has body: I would do it this way ArrayList&lt;SliderExample&gt; sliderExamples = new ArrayList&lt;&gt;(); public int addValues() { int sum = 0; for(SliderExample se: sliderExamples) sum += se.getValue(); return sum; } public void addTask(int taskNr) { SliderExample se = sliderExamples.get(taskNr); int value = se.getValue(); ... }
answers question: http://stackoverflow.com/q/23377898

http://stackoverflow.com/a/23475494
type: AcceptedAnswer
upvote count: 1
type: Answer
accepted answer of: http://stackoverflow.com/q/23437406
downvote count: 0
answers question: http://stackoverflow.com/q/23437406
score: 1
has body: I am surprised that such tests worked in JMockit 1.6, since it didn't have much in the way of explicit support for generics during cascaded mocking. Anyway, the changes since 1.7 were related to issue 333, which is still open. Both issues will be solved for JMockit 1.9, though.

spring-data
tags question: http://stackoverflow.com/q/23375989
tags question: http://stackoverflow.com/q/23356398
tags question: http://stackoverflow.com/q/23423464
tags question: http://stackoverflow.com/q/23403992
tags question: http://stackoverflow.com/q/23325413
tags question: http://stackoverflow.com/q/23316118
tags question: http://stackoverflow.com/q/23303987
type: Tag
tags question: http://stackoverflow.com/q/23372114
tags question: http://stackoverflow.com/q/23431535
tags question: http://stackoverflow.com/q/23430629
tag name: spring-data
tags question: http://stackoverflow.com/q/23435615
tags question: http://stackoverflow.com/q/23396645

http://stackoverflow.com/comment/35838321
comment on: http://stackoverflow.com/a/23387433
score: 0
type: AnswerComment
type: Comment
has text: How can i do that in a pratical way? What i actualy have is one liferay plugin project with several liferay portlets inside.

http://stackoverflow.com/q/23296757
has title: Artifactory not accessible
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23315989
score: 0
tagged with: artifactory
tagged with: maven
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/23296834
tagged with: eclipse
answer count: 3
has body: I don't understand the following error. I have deployed site-plugin:3.3 on the Artifactory but receiving this error message. I don't understand what it means and I'm confused by it. The Artifactory server have access to Maven repo1 through a proxy since I tested the connection to repo. it says it could not find the plugin. it fails to find the plugin at the following location. it says what it could not find was cached in the local repository.. it will not reattempt until remote repos has elapsed or updates are forced.. [ERROR] Plugin org.apache.maven.plugins:maven-site-plugin:3.3 or one of its dependencies could not be resolved: Failure to find org.apache.maven.plugins:maven-site-plugin:jar:3.3 in http://lab.computer.ip:8070/artifactory/remote-repos was cached in the local repository, resolution will not be reattempted until the update interval of remote-repos has elapsed or updates are forced -&gt; [Help 1]
has answer: http://stackoverflow.com/a/42115941

antlr4
tags question: http://stackoverflow.com/q/23359363
type: Tag
tags question: http://stackoverflow.com/q/23293758
tag name: antlr4
tags question: http://stackoverflow.com/q/23318705
tags question: http://stackoverflow.com/q/23296173

http://stackoverflow.com/a/23369587
answers question: http://stackoverflow.com/q/23369455
score: 1
has body: I believe your best option here would be to use polymorphism. Essentially, you create two methods with the same name. The only difference will be the parameters- one will take an int, and the other will take a double. For example private void printMap(int map[][]) private void printMap(double map[][]) This would allow you to call printMap with your array without needing a check on the type.
upvote count: 1
downvote count: 0
type: Answer

http://stackoverflow.com/a/23301095
has comment: http://stackoverflow.com/comment/35670641
score: 0
has comment: http://stackoverflow.com/comment/35670904
answers question: http://stackoverflow.com/q/23300821
has body: yourString.matches("(.*e.*)|(.*l.*)|(.*a.*)"; This will return true if the String contains "e", "l" or "a". ".*" in a regex matches anything any number of times. e obviously only matches e. | is logical or. wrap it all in ""and group expressions on either side of |for success. Furthermore it's important that if the regex contains the characters e, e, l and a that the string has two instances of e before it returns true. yourString.matches("(?=.*l.*)(?=.*a.*).*e.*e.*"); this matches anything with two e's, an l and an a.
type: Answer
has comment: http://stackoverflow.com/comment/35670572

http://stackoverflow.com/q/23354997
favorite count: 0
has answer: http://stackoverflow.com/a/23355147
score: 0
has comment: http://stackoverflow.com/comment/35769442
has comment: http://stackoverflow.com/comment/43842423
type: UnansweredQuestion
upvote count: 1
downvote count: 1
has body: The score is increasing until 40 using the increaseScore() method. If a boolean flag is true, the score will be reduced by 10 (so, in this case, it will be 30), and display score = 30 and grade = D in toString(). But I only can get score = 40 and grade = D in toString(). Is it possible to add return score; after score = score - 10; in findGrade()? public int increaseScore(){ score = score + 10; return score; } public char findGrade(){ if (flag) score = score - 10; char grade = 'A'; if (80&lt;=score) grade = 'A'; else if (60&lt;=score &amp;&amp; score &lt;= 79) grade = 'B'; else if (40&lt;=score &amp;&amp; score &lt;= 69) grade = 'C'; else grade ='D'; return grade; } public String toString(){ return teamName + " " + score + " " + findGrade(); }
has comment: http://stackoverflow.com/comment/35770012
tagged with: java
linked to: http://stackoverflow.com/q/2832472
has comment: http://stackoverflow.com/comment/35770867
type: Question
has title: Is it possible to return two values from findGrade()?
duplicate of: http://stackoverflow.com/q/2832472
has comment: http://stackoverflow.com/comment/35769252
answer count: 1

http://stackoverflow.com/q/23420038
has title: preparedStatement syntax error
has comment: http://stackoverflow.com/comment/35890199
has body: I recently encountered this problem with Java PreparedStatements. I have the following code: String selectSql1 = "SELECT `value` FROM `sampling_numbers` WHERE `value` &lt; (?)" ; ResultSet rs1 = con.select1(selectSql1,randNum); where the select1 method is public ResultSet select1(String sql, int randNum) { try { this.stmt = con.prepareStatement(sql); stmt.setInt(1, randNum); return this.stmt.executeQuery(sql); } catch (SQLException e) { e.printStackTrace(); return null; } } However, it keeps throwing this error: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '?)' at line 1 at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:513) at com.mysql.jdbc.Util.handleNewInstance(Util.java:411) at com.mysql.jdbc.Util.getInstance(Util.java:386) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1054) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4237) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4169) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2617) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2778) at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2828) at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2777) at com.mysql.jdbc.StatementImpl.executeQuery(StatementImpl.java:1651) at util.P_DBCon.select1(P_DBCon.java:59) at app.RandomNumberGenerator.main(RandomNumberGenerator.java:60) Exception in thread "main" java.lang.NullPointerException at app.RandomNumberGenerator.main(RandomNumberGenerator.java:64) This problem does not happen when I do the naive way of doing "...value &lt; " + randNum…
answer count: 2
has comment: http://stackoverflow.com/comment/35890392
has comment: http://stackoverflow.com/comment/35890055
accepted answer: http://stackoverflow.com/a/23420286
favorite count: 0
possible better answer: http://stackoverflow.com/a/23420353
has answer: http://stackoverflow.com/a/23420353
score: 10
upvote count: 11
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35890048
tagged with: mysql
has comment: http://stackoverflow.com/comment/35890403
downvote count: 1
tagged with: prepared-statement
type: Question
has answer: http://stackoverflow.com/a/23420286
tagged with: java

http://stackoverflow.com/comment/35915114
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23433680
has text: The downside of this approach is that JMX agent and the connectors would consume memory as well. If your application is currently critical in memory resources and you open this, you can make your app throws an OOM =\
score: 0

http://stackoverflow.com/q/23413881
upvote count: 16
score: 14
has comment: http://stackoverflow.com/comment/35878949
has answer: http://stackoverflow.com/a/23414289
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/71860032
has answer: http://stackoverflow.com/a/37840132
linked to: http://stackoverflow.com/q/19609902
tagged with: java
downvote count: 2
possible better answer: http://stackoverflow.com/a/23414165
has answer: http://stackoverflow.com/a/41730443
type: Question
has title: Understanding function to generate parentheses
tagged with: algorithm
answer count: 13
accepted answer: http://stackoverflow.com/a/23414519
has answer: http://stackoverflow.com/a/48877804
has answer: http://stackoverflow.com/a/23414218
has answer: http://stackoverflow.com/a/54161564
has answer: http://stackoverflow.com/a/23414165
has body: I have this algorithm to generate all combinations of well-formed parentheses. Can someone explain the core concept of the algorithm? I tried debugging through it, but I still can't seem to grasp the underlying concept behind the algorithm. Additionally, any general advice for how one can come up with such an algorithm for this problem, i.e how did one even get so clever to solve it this way, or what practice one has to do to reach this stage. Problem: Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses. For example, given n = 3, a solution set is: “((()))”, “(()())”, “(())()”, “()(())”, “()()()” Code: public ArrayList&lt;String&gt; generateParenthesis(int n) { ArrayList&lt;String&gt; solutions = new ArrayList&lt;String&gt;(); recursion(n, new String(), solutions); return solutions; } private void recursion(int n, String str, ArrayList&lt;String&gt; sol) { if(str.length() == 2 * n) sol.add(str); else { int left = 0; int right = 0; for(int i = 0; i &lt; str.length(); ++i) { if(str.charAt(i) == '(') left++; if(str.charAt(i) == ')') right++; } if(left == right) recursion(n, str + "(", sol); else if(right &lt; left) { if(left &lt; n) recursion(n, str + "(", sol); recursion(n, str + ")", sol); } } }
has answer: http://stackoverflow.com/a/23414378
has answer: http://stackoverflow.com/a/23414519
favorite count: 0
has answer: http://stackoverflow.com/a/72997434
has answer: http://stackoverflow.com/a/72522925
has answer: http://stackoverflow.com/a/78899724

http://stackoverflow.com/comment/35949072
comment on: http://stackoverflow.com/a/23451393
has text: Just cant use ArrayList for this assignment. I understand if you don't want to give me the answer to it, all I'm really looking for is an example of how to do it.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/23438214
has title: JavaFX WebView GetLoadWorker StateProperty reporting SUCCEEDED before page loads
tagged with: webview
has comment: http://stackoverflow.com/comment/35924076
tagged with: java
tagged with: javafx
has comment: http://stackoverflow.com/comment/105736663
score: 2
answer count: 0
downvote count: 0
type: UnansweredQuestion
has body: I want to snap a picture of a webpage using the JavaFX "snapshot" method. My problem is that the WebView doesn't load the webpage before I snap the snapshot. Putting the call to snapshot inside a listener that tests when the webview's getLoadWorker succeeds doesn't work. I get inside the "if" of the listener (see below) before the page actually loads. To demonstrate this, the following standalone code both attempts to snap the snapshot upon "success" and allows you to click a button to do the same. The button click (marked "BUTTON") works, because you click it after the webpage loads. However the automatic snapshot (marked "AUTOMATIC") produces a blank image, because for some reason the worker state is reaching "SUCCEEDED" before the page is actually loaded. Can someone tell me what I'm doing wrong with the getLoadWorker listener? Thank you for any help! import java.awt.image.RenderedImage; import java.io.File; import java.io.IOException; import java.net.MalformedURLException; import javax.imageio.ImageIO; import javafx.concurrent.Worker; import javafx.concurrent.Worker.State; import javafx.application.Application; import javafx.beans.value.ChangeListener; import javafx.beans.value.ObservableValue; import javafx.embed.swing.SwingFXUtils; import javafx.event.ActionEvent; import javafx.event.EventHandler; import javafx.scene.Group; import javafx.scene.Scene; import javafx.scene.SnapshotParameters; import javafx.scene.control.Button; import javafx.scene.image.WritableImage; import javafx.scene.layout.VBox; import javafx.scene.web.WebEngine; import javafx.scene.web.WebView; import javafx.stage.Stage; public class OpenHTML extends Application { @Override public void start(Stage primaryStage) { final VBox vbox = new VBox(2); final Button btn = new Button(); WebView webView = new WebView(); webView.setMaxWidth(600); final WebEngine webEngine = webView.getEngine(); File myHTMLFile = new File("C:/Temp/test.html"); try { webEngine.load(myHTMLFile.toURI().toURL().toString()); …
has comment: http://stackoverflow.com/comment/36129077
favorite count: 0
type: Question
upvote count: 2

http://stackoverflow.com/comment/35761156
type: Comment
type: QuestionComment
has text: No, [key and iv are different things](http://helpx.adobe.com/coldfusion/kb/strong-encryption-coldfusion-mx-7.html). `GenerateSecretKey()` is used to generate a *new* key. You already have an encryption key.
comment on: http://stackoverflow.com/q/23343446
score: 0

http://stackoverflow.com/comment/35717890
score: 0
type: Comment
type: QuestionComment
has text: @JoachimIsaksson sorry for the delay java.sql.SQLException: Can not issue data manipulation statements with executeQuery(). at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1086) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:989) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:975) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:920) at com.mysql.jdbc.StatementImpl.checkForDml(StatementImpl.java:502) at com.mysql.jdbc.StatementImpl.executeQuery(StatementImpl.java:1565)
comment on: http://stackoverflow.com/q/23325557

http://stackoverflow.com/comment/35831708
comment on: http://stackoverflow.com/q/23389044
has text: @user3564100 There is your problem. That is the IP of your router not your PC.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23432817
answer count: 1
favorite count: 0
has title: how to paint area in JAVA
has body: I have this code: public void DoDraw(Graphics g, Main_Data M_D, int x, int y){ if(x&lt;0 || y&lt;0 || x&gt;50 || y&gt;60){ return; } else if(M_D.getPix()[x][y].p_c.isEmpty()){ g.setColor(Color.red); g.drawLine(x, y, x, y); } DoDraw(g ,M_D, x+1, y); DoDraw(g ,M_D, x, y+1); DoDraw(g ,M_D, x-1, y); DoDraw(g ,M_D, x, y-1); return; } This is my problem : Exception in thread "AWT-EventQueue-0" java.lang.StackOverflowError where is mistake please??
type: UnansweredQuestion
score: -3
tagged with: paint
tagged with: java
downvote count: 3
type: Question
upvote count: 0
has comment: http://stackoverflow.com/comment/35913706
has answer: http://stackoverflow.com/a/23432961

http://stackoverflow.com/a/23307815
type: Answer
has body: There could be some format error in the json string you passed. Validate your json string. The below sample code works fine. import java.io.FileWriter; import java.io.IOException; import java.util.logging.Level; import java.util.logging.Logger; import org.json.JSONException; import org.json.JSONObject; public class Test { private static final Logger logger = Logger.getLogger(Test.class.getName()); private static final String JSON_FILE = "/home/visruth/Desktop/Visruth.txt"; public static void main(String[] args) { String jsonText = "{\"215876567\": { \"followers\": [ 2464054938, 772677937]}}"; try ( FileWriter out = new FileWriter(JSON_FILE); ) { JSONObject json = new JSONObject(jsonText); int indentFactor = 1; String prettyprintedJSON = json.toString(indentFactor); System.out.println(prettyprintedJSON); out.write(prettyprintedJSON); } catch (JSONException e) { logger.log(Level.SEVERE, e.getMessage()); } catch (IOException e) { logger.severe(e.getMessage()); } } } Assign your json text in jsonText variable and try.
upvote count: 2
has comment: http://stackoverflow.com/comment/35876564
score: 2
has comment: http://stackoverflow.com/comment/35857621
has comment: http://stackoverflow.com/comment/35857868
downvote count: 0
has comment: http://stackoverflow.com/comment/35851398
answers question: http://stackoverflow.com/q/23307328

http://stackoverflow.com/comment/35708184
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23321959
has text: Look at the [`SiftingAppender`](http://logback.qos.ch/apidocs/ch/qos/logback/access/sift/SiftingAppender.html) - you can split the output into different log files depending on some criteria.
score: 0

http://stackoverflow.com/a/23448305
score: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/23443141
answers question: http://stackoverflow.com/q/23443141
has comment: http://stackoverflow.com/comment/35942277
has comment: http://stackoverflow.com/comment/35942343
has body: No sure if this is what you want, I removed Coordinate and did everything in one class import java.awt.Dimension; import java.awt.Graphics; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import java.awt.event.MouseListener; import java.awt.image.BufferedImage; import java.awt.image.TileObserver; import java.io.IOException; import java.net.MalformedURLException; import java.net.URL; import java.util.HashMap; import java.util.Map; import javax.imageio.ImageIO; import javax.swing.AbstractAction; import javax.swing.ActionMap; import javax.swing.InputMap; import javax.swing.JComponent; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.KeyStroke; import javax.swing.Timer; import org.w3c.dom.events.EventTarget; import org.w3c.dom.events.MouseEvent; import org.w3c.dom.views.AbstractView; public class Move extends JPanel{ public static final long serialVersionUID = 1L; public static final String IMAGE_PATH = "http://mathforum.org/alejandre/magic.square/4x4grid.gif"; public static final String IMAGE_PATH_PLAYER = "http://upload.wikimedia.org/wikipedia/commons/thumb/c/c1/Square-symbol.svg/50px-Square-symbol.svg.png"; public static final int STEP = 3; public static final int TIMER_DELAY = STEP * 8; public BufferedImage bkgrndImage = null; public BufferedImage playerImage = null; public Map&lt;Direction, Boolean&gt; directionMap = new HashMap&lt;Direction, Boolean&gt;(); public int playerX = 0; public int playerY = 0; private static int xPosition = 0; private static int yPosition = 0; private String s = ""; private JLabel jlbl1 = new JLabel(""); enum Direction { UP(KeyEvent.VK_UP, 0, -1), DOWN(KeyEvent.VK_DOWN, 0, 1), LEFT(KeyEvent.VK_LEFT, -1, 0), RIGHT(KeyEvent.VK_RIGHT, 1, 0); public int keyCode; public int xDirection; public int yDirection; private Direction(int keyCode, int xDirection, int yDirection) { this.keyCode = keyCode; this.x…
type: AcceptedAnswer

http://stackoverflow.com/comment/35666557
comment on: http://stackoverflow.com/q/23298805
score: 0
type: QuestionComment
has text: And while not an error, you may want to move the `max` calculation into the same for loop where you're assigning grades to avoid having to loop twice.
type: Comment

http://stackoverflow.com/a/23395645
has comment: http://stackoverflow.com/comment/35844144
answers question: http://stackoverflow.com/q/23395624
has body: You have TextView tv = (TextView) findViewById(R.id.text); before setting the layout to the Activity. Your initialization fails tvis null. You need to set the layout to the activity first then initialize views. And when you have tv.setText("Draw the letter: " + letters[i]); you are calling setText when tv is actually null http://androidxref.com/4.4.2_r2/xref/frameworks/base/core/java/android/app/Activity.java#1884 Posting the source from the link provided by laalto. Thanks to him i corrected my post 1877 /** 1878 * Finds a view that was identified by the id attribute from the XML that 1879 * was processed in {@link #onCreate}. 1880 * 1881 * @return The view if found or null otherwise. 1882 */ 1883 public View findViewById(int id) { 1884 return getWindow().findViewById(id); 1885 } 1886 Your stacktrace does indicate the cause its not unexplained as you posted in title Caused by: java.lang.NullPointerException 04-30 14:36:45.776: E/AndroidRuntime(1558): at android.app.Activity.findViewById(Activity.java:1884) 04-30 14:36:45.776: E/AndroidRuntime(1558): at com.gmail.Sheridjohn.letterchecker.MainActivity.(MainActivity.java:23)
has comment: http://stackoverflow.com/comment/35844173
type: Answer
score: 2
downvote count: 0
upvote count: 2

http://stackoverflow.com/q/23309456
answer count: 1
has body: I have table called mpi which contains 23 columns. I have introduced the search field with button for every column where user can enter the query to fetch the records using query query="select * from mpi where Genus ='"+genus+"' Now I want to fetch records by giving keywords using LIKE %% but it is not working and not giving any records but if type type the full name it is working perfectly. Here is the code String uname=request.getParameter("uname"); String full="%"+uname+"%"; dbconn=new DatabaseConnection(); conn=dbconn.setConnection(); pstmt=conn.prepareStatement("select * from mpi where Genus LIKE ?"); pstmt.setString(1, full); res=pstmt.executeQuery Could any one tell me where is the mistake and why I am not getting the records when I use half keyword like %keyword%.
has title: Fetching records from MySQL using LIKE and %
accepted answer: http://stackoverflow.com/a/23309689
type: AnsweredQuestion
tagged with: java
tagged with: mysql
type: Question
has comment: http://stackoverflow.com/comment/35685671
has answer: http://stackoverflow.com/a/23309689
tagged with: servlets
score: 0
has comment: http://stackoverflow.com/comment/35685730

http://stackoverflow.com/comment/35683085
score: 1
has text: In what case could this scale as O(n)?
comment on: http://stackoverflow.com/q/23308091
type: Comment
type: QuestionComment

http://stackoverflow.com/a/27810861
has body: I would have loved to debug this in depth, but a nearing deadline forced me to install the Oracle Java package, which fixed the issue. A disappointing answer, but it did fix the issue permanently.
type: Answer
upvote count: 1
downvote count: 1
accepted answer of: http://stackoverflow.com/q/23305850
score: 0
answers question: http://stackoverflow.com/q/23305850
type: AcceptedAnswer

android
tags question: http://stackoverflow.com/q/23322619
tags question: http://stackoverflow.com/q/23336422
tags question: http://stackoverflow.com/q/23435427
tags question: http://stackoverflow.com/q/23339410
tags question: http://stackoverflow.com/q/23309861
tags question: http://stackoverflow.com/q/23323880
tags question: http://stackoverflow.com/q/23296132
tags question: http://stackoverflow.com/q/23449138
tags question: http://stackoverflow.com/q/23426999
tags question: http://stackoverflow.com/q/23331629
tags question: http://stackoverflow.com/q/23349805
tags question: http://stackoverflow.com/q/23391945
tags question: http://stackoverflow.com/q/23417415
tags question: http://stackoverflow.com/q/23373106
tags question: http://stackoverflow.com/q/23426797
tags question: http://stackoverflow.com/q/23317291
tags question: http://stackoverflow.com/q/23422834
tags question: http://stackoverflow.com/q/23380132
tags question: http://stackoverflow.com/q/23359745
tags question: http://stackoverflow.com/q/23348220
tags question: http://stackoverflow.com/q/23317298
tags question: http://stackoverflow.com/q/23442181
tags question: http://stackoverflow.com/q/23403949
tags question: http://stackoverflow.com/q/23291552
tags question: http://stackoverflow.com/q/23379150
tags question: http://stackoverflow.com/q/23299745
tags question: http://stackoverflow.com/q/23407487
tags question: http://stackoverflow.com/q/23341792
tags question: http://stackoverflow.com/q/23330098
tags question: http://stackoverflow.com/q/23351275
tags question: http://stackoverflow.com/q/23434706
tags question: http://stackoverflow.com/q/23430934
tags question: http://stackoverflow.com/q/23340255
tags question: http://stackoverflow.com/q/23301290
tags question: http://stackoverflow.com/q/23442034
tags question: http://stackoverflow.com/q/23447318
tags question: http://stackoverflow.com/q/23362272
tags question: http://stackoverflow.com/q/23425250
tags question: http://stackoverflow.com/q/23354475
tags question: http://stackoverflow.com/q/23305524
tags question: http://stackoverflow.com/q/23308256
tags question: http://stackoverflow.com/q/23321049
tags question: http://stackoverflow.com/q/23449426
tags question: http://stackoverflow.com/q/23364463
tags question: http://stackoverflow.com/q/23420053
tags question: http://stackoverflow.com/q/23398861
tags question: http://stackoverflow.com/q/23330128
tags question: http://stackoverflow.com/q/23388175
tags question: http://stackoverflow.com/q/23327988
tags question: http://stackoverflow.com/q/23438575
tags question: http://stackoverflow.com/q/23352603
tags question: http://stackoverflow.com/q/23293698
tags question: http://stackoverflow.com/q/23294918
tags question: http://stackoverflow.com/q/23336681
tags question: http://stackoverflow.com/q/23303223
tags question: http://stackoverflow.com/q/23298028
tags question: http://stackoverflow.com/q/23337802
tags question: http://stackoverflow.com/q/23327502
tags question: http://stackoverflow.com/q/23333130
tags question: http://stackoverflow.com/q/23445900
tags question: http://stackoverflow.com/q/23318887
tags question: http://stackoverflow.com/q/23395643
tags question: http://stackoverflow.com/q/23425981
tags question: http://stackoverflow.com/q/23427734
tags question: http://stackoverflow.com/q/23312076
tags question: http://stackoverflow.com/q/23392408
tags question: http://stackoverflow.com/q/23418553
tags question: http://stackoverflow.com/q/23297847
tags question: http://stackoverflow.com/q/23402604
tags question: http://stackoverflow.com/q/23351904
tags question: http://stackoverflow.com/q/23343012
tags question: http://stackoverflow.com/q/23325251
tags question: http://stackoverflow.com/q/23385899
tags question: http://stackoverflow.com/q/23353053
tags question: http://stackoverflow.com/q/23294959
tags question: http://stackoverflow.com/q/23329951
tags question: http://stackoverflow.com/q/23303395
tags question: http://stackoverflow.com/q/23403878
tags question: http://stackoverflow.com/q/23295654
tags question: http://stackoverflow.com/q/23300219

http://stackoverflow.com/comment/35789086
comment on: http://stackoverflow.com/a/23362302
type: Comment
has text: Thanks @Duncan. This works if the strings starts with special chars. Other cases it doesn't work.
score: 0
type: AnswerComment

http://stackoverflow.com/a/23427006
answers question: http://stackoverflow.com/q/23426325
has comment: http://stackoverflow.com/comment/35961398
has body: According to the error Error setting expression 'spa.amount' with value '[Ljava.lang.String;@10dd65e' seems that OGNL is trying to set a value of type String[] to amount property of spa bean. Reading further ognl.OgnlException: target is null for setProperty(null, "amount", [Ljava.lang.String;@10dd65e) looks like spa reference is null, so OGNL is unable to set a value to a null because it will throw a null pointer exception. To resolve the issue you should initialize the reference of spa. Next the problem arises because you use a model driven. The model driven interceptor pushes a model on top of the value stack, which is an OGNL root. And you have initialized the instance of spa. Seems that OGNL even if searches from the top of the value stack down the stack can't find the instance of spa. So, to access action properties directly you can use technique described in this answer Passing parameters to action through ModelDriven in Struts 2.3.16. The method expected by OGNL on reference of spa is public void setAmount(String[] amounts) { this.amounts = amounts; } You don't have such method and you probably not expected to receive an array of strings. But the problem is that you are doing it. Because parameters with the same name are packaged into String[]. To have different names corresponding to each iterated object you should use indexed property names. You can find an example if indexed properties in this answer Repopulate an ArrayList from JSP with Struts 2. Your properties are available directly from the model because your action is model driven and it should have a List&lt;SupplierPaymentDetails&gt; paidList that is iterated. You can use this property to populate the submitted values or use another with the same type. ModelDriven example you can learn, but it doesn't use indexed properties. To use it properly you can use this answer How to pass a Map&lt;ObjectA, List&lt;ObjectB&gt;&gt; to action in Struts 2.
has comment: http://stackoverflow.com/comment/36163924
has comment: http://stackoverflow.com/comment/35928153
has comment: http://stackoverflow.com/comment/36168106
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/35984770
accepted answer of: http://stackoverflow.com/q/23426325
has comment: http://stackoverflow.com/comment/35959511
type: Answer
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/35977445
has comment: http://stackoverflow.com/comment/35928197

http://stackoverflow.com/comment/35878110
score: 0
type: Comment
type: QuestionComment
has text: possible duplicate of [Insert to table or update if exists (MySQL)](http://stackoverflow.com/questions/4205181/insert-to-table-or-update-if-exists-mysql)
comment on: http://stackoverflow.com/q/23413743

http://stackoverflow.com/a/23435567
upvote count: 4
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/23435566
accepted answer of: http://stackoverflow.com/q/23435566
has body: Byte Buddy is a library for the runtime generation of Java classes. Its capabilities are not limited to the creation of proxy classes but the creation of proxy classes is an obvious use case. Assuming, we are dealing with the following code: @Retention(RetentionPolicy.RUNTIME) @interface MyAnnotation { } @MyAnnotation class Foo { @MyAnnotation public void bar() { } } Then we can create a subclass at runtime that overrides the bar method. The overridden implementation of the bar method is implemented to simply call its super implementation: Class&lt;?&gt; runtimeType = new ByteBuddy() .withAttribute(TypeAttributeAppender.ForSuperType.INSTANCE) .withDefaultMethodAttributeAppender(MethodAttributeAppender.ForInstrumentedMethod.INSTANCE) .subclass(Foo.class) .method(named("bar")).intercept(SuperMethodCall.INSTANCE) .make() .load(getClass().getClassLoader(), ClassLoadingStrategy.Default.WRAPPER) .getLoaded(); With the above runtime class, we can now verify the resulting type: assertNotEquals(Foo.class, runtimeType); assertThat(runtimeType.isAnnotationPresent(MyAnnotation.class)), is(true)); assertThat(runtimeType.getDeclaredMethod("bar").isAnnotationPresent(MyAnnotation.class)), is(true)); Both the type and the method are annotated by MyAnnotation despite the subclass. By calling getDeclaredMethod, we furthermore verify that the subclass actually defines a new method. Disclosure: I am the author of Byte Buddy and I wanted to provide an answer to this question that is often asked on SO in a slightly more specific context. Furthermore, I wanted to take the opportunity to create a SO tag for Byte Buddy.
score: 4

http://stackoverflow.com/q/23305119
tagged with: java
accepted answer: http://stackoverflow.com/a/23319284
has comment: http://stackoverflow.com/comment/35677990
score: 2
type: AnsweredQuestion
downvote count: 0
favorite count: 0
has body: I have written this dynamic function to find maximum packed value for knapsack problem. static int dyn(int maxItems, int maxSize) { if(maxItems &lt; 0) { return 0; } if(tab[maxItems][maxSize] != -1) { return tab[maxItems][maxSize]; } if( itemArray[maxItems].s &gt; maxSize) { result = dyn(maxItems-1,maxSize); return result; } else { result = Math.max(dyn(maxItems-1, maxSize), dyn(maxItems-1, maxSize - itemArray[maxItems].s) + itemArray[maxItems].v); tab[maxItems][maxSize] = result; return result; } } I'm calling this function from main as int x = dyn(maxItems - 1, maxSize) The itemArray structure is public class Item { int v; int s; } Every time I'm getting 0 as an answer. Please tell me where I am going wrong
type: Question
has comment: http://stackoverflow.com/comment/35678005
has title: Recursive Dynamic Programming Knapsack Solution in Java
upvote count: 2
answer count: 1
has answer: http://stackoverflow.com/a/23319284
tagged with: recursion

http://stackoverflow.com/comment/35873841
score: 0
type: Comment
has text: Where better to do that as soon as I typed in the last empty EditText symbol button becomes available?
type: AnswerComment
comment on: http://stackoverflow.com/a/23411527

http://stackoverflow.com/q/23452518
type: Question
tagged with: jstl
has comment: http://stackoverflow.com/comment/35950591
answer count: 1
has answer: http://stackoverflow.com/a/23456724
tagged with: jsp
has body: i have a question when i try to capture the value of dropdown list from jsp file to servlet. &lt;select name="extraroom"&gt; &lt;c:if test="${booking.roomType ne 'single'}"&gt; &lt;c:forEach var="i" begin="0" end="${booking.count}"&gt; &lt;option value="&lt;c:out value="${i}"/&gt;"&gt;&lt;c:out value="${i}"/&gt;&lt;/option&gt; &lt;/c:forEach&gt; &lt;/c:if&gt; &lt;/select&gt; i use Integer.parseInt(request.getParameter("extraroom")) i have many drop down lists according to different roomType. but the result in java servlet always get the value of the first dropdown lists... what should i change in servlet? Thank you.
tagged with: jdbc
score: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35953839
has title: how to get values of several dropdown lists from jsp to servlet
tagged with: java
tagged with: servlets

http://stackoverflow.com/a/23436628
has body: The MessageConsole class was not designed to be using with HTML. All the class does is add the text to the end of the Document, which in your case appears to be the last cell of the table. You can try adding an empty HTML tag to the Document when you first create the HTML. Then maybe the text will be added to this tag instead of the table cell. Maybe something like: &lt;/table&gt; &lt;p&gt;&lt;/p&gt; &lt;/body&gt; This all depends on how the Document parses the text that is inserted into the Document.
accepted answer of: http://stackoverflow.com/q/23436461
downvote count: 0
answers question: http://stackoverflow.com/q/23436461
upvote count: 2
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35920892
type: Answer
score: 2

http://stackoverflow.com/a/23376082
downvote count: 0
answers question: http://stackoverflow.com/q/23376057
score: 1
upvote count: 1
has body: There's no built-in Java collection to do this as this sounds too specific. So you need to go ahead and implement this kind of comparison yourself. As Kakarot pointed out, you can start by using two Maps, then implement the comparison yourself.
type: Answer

http://stackoverflow.com/comment/35766513
type: AnswerComment
comment on: http://stackoverflow.com/a/23352837
score: 0
type: Comment
has text: What input does the professor think will give you an output of 57918?

http://stackoverflow.com/q/23427149
has comment: http://stackoverflow.com/comment/35902746
type: UnansweredQuestion
answer count: 0
tagged with: ftp-client
type: Question
has comment: http://stackoverflow.com/comment/35903958
has title: Java FTP client probably timeout issue
tagged with: java
has body: I've a desktop application on swing which acts as a file uploader. I simply choose a folder (by "JFileChooser") having multiple files and took the files in an array. Thereafter I created an object FTPClient after that I'm using "for loop" to extract the files. In each loop I am getting the files and through FTPClient it's uploaded to the server. If the file is successfully uploaded then I'am calling a server script which takes some time (about 2 minutes) to get respond back to my controller. If the response took so long then my loop dies to execute further. Is it timeout issue? Thanks
score: 0

http://stackoverflow.com/q/23445944
has comment: http://stackoverflow.com/comment/35937700
answer count: 0
tagged with: java
tagged with: file
type: Question
has comment: http://stackoverflow.com/comment/35937781
has title: Trouble Reading Lines of a File (Java)
score: 0
has comment: http://stackoverflow.com/comment/35937732
type: UnansweredQuestion
has body: So basically I need to take a file with output such as follows: sat (model (define-fun z97 () Int 2) (define-fun z88 () Int 8) and then define the values to the variables (I.e. set z97 = 2 and z88 = 8). Now I attempted to do this using a BufferedReader to read the file line by line. But looking at the documentation it does not appear there is a way to go to the next line in a BufferedReader while keeping track of the last line, so I have no idea how to go about parsing this. Do I need to use a different class? Any advice would be appreaciated.

http://stackoverflow.com/comment/35696715
comment on: http://stackoverflow.com/q/23315524
score: 0
type: QuestionComment
type: Comment
has text: I would start by understand the source of my download. Is it a HTTP service which supports partial downloads for example? Is it a service you have written?

http://stackoverflow.com/q/23419374
upvote count: 1
downvote count: 1
tagged with: arrays
tagged with: sorting
has comment: http://stackoverflow.com/comment/35889275
accepted answer: http://stackoverflow.com/a/23419554
type: AnsweredQuestion
favorite count: 0
has title: Creating and Returning a List of Employees in Java
type: Question
has body: Good evening all. I'm just trying to create a class with a method that allows you to create a list of users, their ages, and their departments (although I haven't coded the department part yet!). I want to be able to return the list of employees SORTED by age. I haven't coded Java in a long while, and I'm a little rusty. Most of my time has been spent in Perl and C++ lately, so any help would be greatly appreciated. Thanks, guys! Here's my (broken) code: import java.util.Scanner; import java.io.*; import java.util.Arrays; import java.util.Comparator; public class Department{ public static void main(String[] args){ Scanner in = new Scanner(System.in); BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); System.out.println("How many employees?\n"); int noOfEmployees = in.nextInt(); String[][] employeeInformation; employeeInformation = new String[noOfEmployees][3]; for (int row = 0; row &lt; employeeInformation.length; row++){ System.out.print("Enter employee name: "); try { employeeInformation[0][row] = br.readLine(); } catch (IOException e) { e.printStackTrace(); } System.out.print("Enter employee age: "); try { employeeInformation[1][row] = br.readLine(); } catch (IOException e) { e.printStackTrace(); } } Arrays.sort(employeeInformation, new Comparator&lt;String[]&gt;() { public int compare(String[] entry1, String[] entry2){ String name = entry1[0]; String age = entry2[0]; return name.compareTo(age); } }); for(int i=0;i&lt;employeeInformation.length;i++){ System.out.println(employeeInformation[i][i]); } } }
answer count: 2
possible better answer: http://stackoverflow.com/a/23419574
has comment: http://stackoverflow.com/comment/35888918
has answer: http://stackoverflow.com/a/23419574
has answer: http://stackoverflow.com/a/23419554
tagged with: sample
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/35888975

http://stackoverflow.com/a/23339481
has comment: http://stackoverflow.com/comment/35740249
type: Answer
has body: You're never executing the statement: conn.prepareStatement("" + "UPDATE SEAT" + "SET reserved='1337',booked='1337',booking_time='1337'" + "WHERE plane_no='" + plane_no + "';" ); conn.commit(); You're ignoring the return value of prepareStatement, so you're not actually executing anything against the database. You should be creating a PreparedStatement using fixed SQL with parameters, specifying parameter values against that PreparedStatement, and then call PreparedStatement.executeUpdate(). So something like: public static void bookAll(String planeNo) { String sql = "UPDATE SEAT " + "SET (reserved, booked, booking_time) " + "VALUES ('1337', '1337', '1337') " + "WHERE plane_no=?"; try (Connection conn = getConnection("", ""); PreparedStatement st = conn.prepareStatement(sql)) { st.setString(1, planeNo); st.executeUpdate(); conn.commit(); } catch (SQLException ex) { System.out.println("[HELPER CLASS] SQL ERROR: " + ex.getMessage()); } } Note that this also: Uses a local variable for the connection, instead of an instance variable. You should use a separate Connection for each operation, even if it's actually pooled Uses variable names which comply with Java coding conventions Uses a try-with-resources statement to make sure everything is closed even on error Personally I wouldn't use that style of exception handling - I'd let the exception propagate up, possibly rethrowing it as an unchecked exception - but that's a different matter.
answers question: http://stackoverflow.com/q/23339433
accepted answer of: http://stackoverflow.com/q/23339433
has comment: http://stackoverflow.com/comment/35740160
downvote count: 0
score: 4
upvote count: 4
type: AcceptedAnswer

http://stackoverflow.com/comment/35851863
type: QuestionComment
has text: That *should* work. Could be something screwy with eclipse, does it work if you run maven from the command line?
score: 0
comment on: http://stackoverflow.com/q/23399383
type: Comment

http://stackoverflow.com/q/23387722
favorite count: 0
has answer: http://stackoverflow.com/a/23388479
has comment: http://stackoverflow.com/comment/35828923
tagged with: regex
answer count: 4
type: AnsweredQuestion
upvote count: 3
has answer: http://stackoverflow.com/a/23387770
has title: how to replace \$ with $ in regex java
has answer: http://stackoverflow.com/a/23388579
downvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/23387770
has answer: http://stackoverflow.com/a/23387815
tagged with: java
has comment: http://stackoverflow.com/comment/35829231
has body: I have the following String String valueExpression = "value1\\$\\$bla"; i would like it to be parsed to: value1$$bla when I try to do: valueExpression.replaceAll("\\\\$", "\\$"); I get it the same, and when I try to do: valueExpression.replaceAll("\\$", "$"); I get an error IndexOutOfBound How can I replace it in regex? The string is dynamic so I can't change the content of the string valueExpression to something static. Thanks
possible better answer: http://stackoverflow.com/a/23387815
score: 2

http://stackoverflow.com/comment/35911949
has text: Ok, so I dug into the server documentation and the message will end in a char '\u0003'. How can I check for a char to break out of the loop?
type: Comment
comment on: http://stackoverflow.com/a/23431615
score: 0
type: AnswerComment

metadata
tags question: http://stackoverflow.com/q/23381991
tags question: http://stackoverflow.com/q/23384583
tag name: metadata
tags question: http://stackoverflow.com/q/23436596
type: Tag

http://stackoverflow.com/q/23413746
has comment: http://stackoverflow.com/comment/35883353
has answer: http://stackoverflow.com/a/23414060
upvote count: 5
tagged with: java
has comment: http://stackoverflow.com/comment/35878903
has comment: http://stackoverflow.com/comment/35879108
has comment: http://stackoverflow.com/comment/35878514
has answer: http://stackoverflow.com/a/23413981
has answer: http://stackoverflow.com/a/23414136
has answer: http://stackoverflow.com/a/23413802
has comment: http://stackoverflow.com/comment/35878069
has comment: http://stackoverflow.com/comment/35881927
answer count: 5
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35879275
type: Question
has title: Radical modularity in Java
score: 3
linked to: http://stackoverflow.com/q/5013917
has body: The development team I'm a part of wrote and still maintains a codebase of pure Java spaghetti code. Most of this was implemented before I joined this team. My background is in Python/Django development and the Django community really emphasizes "pluggability" -- a feature of Django "apps" (modules) which implies mostly "one thing and one thing well", re-useability, loose coupling, and a clean, conscious API. Once the Django team I once worked in started to "get it", we pretty much had zero problems with messy, tightly-coupled masses of monolithic code. Our practice involved developing Django apps outside of the Django project in which we intended to use the app (a common practice among Django developers, from what I've gathered) Each even lived in a Git repository separate from that of the overall Django project. Now, we're presented with an opportunity to refactor much of our spaghetti code, and it seems to me that some of what I learned from the Django community should be applied here. In short, I'd like to see our new codebase developed as a series of "pluggable" modules each written under the assumption that it won't have access to other modules (except those on which it should rationally depend). I believe this should do a good job of driving home principles of proper software design to the whole team. So, what I'm advocating for is to have one separate repository per "feature" we want in our new (Spring) project. Each would have its own, independent build process and the result would be a .jar . We'd also have a repository for project-level things (JSP's, static files, etc) and its build process would produce a .war . The .jars wouldn't be placed inside the .war, but rather be treated as Gradle dependencies (the same way third-party dependencies would be.) Now I have to sell it to the boss. He's asked for some example of precedent for this plan. Obvious places to look would be open-source projects, but if a project is split across multiple repositories, it's …
favorite count: 0
has comment: http://stackoverflow.com/comment/35910138
has comment: http://stackoverflow.com/comment/35879226
downvote count: 2
has comment: http://stackoverflow.com/comment/35879504
has answer: http://stackoverflow.com/a/23414368

http://stackoverflow.com/q/23370509
has comment: http://stackoverflow.com/comment/35798039
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35798154
has comment: http://stackoverflow.com/comment/35798467
has answer: http://stackoverflow.com/a/23371008
downvote count: 1
has comment: http://stackoverflow.com/comment/35797888
has comment: http://stackoverflow.com/comment/35798357
has comment: http://stackoverflow.com/comment/35798225
tagged with: java
has comment: http://stackoverflow.com/comment/35798070
score: -1
tagged with: loops
type: Question
has comment: http://stackoverflow.com/comment/35798309
has comment: http://stackoverflow.com/comment/35798171
upvote count: 0
tagged with: user-interface
answer count: 1
has comment: http://stackoverflow.com/comment/35798281
has comment: http://stackoverflow.com/comment/35798127
has comment: http://stackoverflow.com/comment/35798006
favorite count: 0
tagged with: while-loop
has comment: http://stackoverflow.com/comment/35798412
has body: This is my coding so far - instructor asked me to create a program that creates triangles and specifies them.Here are the actual instructions for clarity: *Write a program that creates sets of random triangle sides using integer values between 3 and 13. The user will specify how many triangles they would like created by entering an integer value between 1 and 10 (you may assume that they will enter an integer in this range). For each triangle the user has requested, your program should: Generate a set of 3 random integers between 3 and 13. Display the 3 numbers Decide if the numbers represent the sides of a valid triangle. (For example, 5, 5, and 13 do NOT create a triangle). --- If the numbers do not represent a valid triangle, display an appropriate error message. --- If the numbers are valid, the program should determine, and display, the a) side classification of the triangle – equilateral, isosceles, or scalene, and b) the angle classification of the triangle – right, acute, or obtuse* // I need to figure out what to use in the while loop. I haven't written all of the coding yet, but there is an empty while loop (which im trying to use to calculate the userInput x apple and orange (yes I did use fruits as ints) // Writing all coding here: // Declaring maximum and minimum values for user input: int maxValue = 13; int minValue = 3; userInteger = (int) (maxValue * Math.random()) + minValue; userInteger2 = (int) (maxValue * Math.random()) + minValue; userInteger3 = (int) (maxValue * Math.random()) + minValue; String banana = (userInput.getText()); { while() outcomeLabel.setText("Your numbers are: " + userInteger + ", " + userInteger2 + " and " + userInteger3 + "." + "\n" + "The number of triangles requested is" + banana + "so the result is"); } int apple = (userInteger + userInteger2); int orange = (userInteger3); { if (apple == orange) outcomeLabel.setText("Your numbers are: " + userInteger + ", " + userInteger2 + " and " + userInteger3 + "." + "\n" + "The number …
has comment: http://stackoverflow.com/comment/35798494
has comment: http://stackoverflow.com/comment/35797974
tagged with: netbeans
has title: What should I use for the while loop?

http://stackoverflow.com/q/23294975
tagged with: http://stackoverflow.com/tag/csv
answer count: 1
has body: I have a TSV/CSV dataset( over 100gb) and I need to split the dataset into column datasets. An example : an input dataset of n rows and m cols need to output m datasets, each with one columns of n rows. Input 1 Dataset a b c x y z 1 v a Output 3 Datasets dataset1 : a x 1 dataset2 : b y v dataset3 : c z a
type: UnansweredQuestion
tagged with: python
has comment: http://stackoverflow.com/comment/35659675
has answer: http://stackoverflow.com/a/23295379
tagged with: java
has title: Map Reduce split dataset into columns
tagged with: mapreduce
type: Question
tagged with: dataset
score: 0

http://stackoverflow.com/q/23401913
has body: Java 8 officially introduce java.io.UncheckedIOException to JDK class libraries for lambda with Stream API, because lambda expressions can't declare its throws-clause and lambda body can't throw checked exception such as IOException. What's idiom/best practice with UncheckedIOException and Stream API? What conditions do I explicitly throw new UncheckedIOException object, and when should I catch UncheckedIOException exception?
has comment: http://stackoverflow.com/comment/35863423
tagged with: lambda
tagged with: java-8
upvote count: 13
has answer: http://stackoverflow.com/a/23402640
type: AnsweredQuestion
has title: What's idiom/best practice with UncheckedIOException and Stream API?
score: 13
type: Question
tagged with: java
accepted answer: http://stackoverflow.com/a/23402640
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/35897144
favorite count: 0
has comment: http://stackoverflow.com/comment/35870062

http://stackoverflow.com/comment/35883100
type: QuestionComment
comment on: http://stackoverflow.com/q/23415146
score: 1
has text: This is what I remember from my experience with Python. And it is not a direct answer, but it might be useful. Both user/lightweight threads and actual system threads have their uses. It boils down to this, both provide concurrency but only system threads provide parallelism. So if you're doing heavy computations you will not get any boost from using user threads, but you will from system threads. In a different situation, where you only have one CPU core and you want a server, using user threads is the only solution.
type: Comment

http://stackoverflow.com/a/23367402
has comment: http://stackoverflow.com/comment/35791695
type: Answer
has body: I would say you are overwriting your HADOOPTWO path variables with the hadoop 2.2.0 path. You can only export 1 PATH variable and if your .bashrc executes in the order you have posted above then your path should look like this /home/parallels/Development/Hadoop/hadoop-2.2.0/bin
score: 0
answers question: http://stackoverflow.com/q/23367052

http://stackoverflow.com/comment/35835512
has text: And are you open to use to Reflection APIs? You know If and Switch statements are there exactly for this kind of conditional branching of code. But if you have any specific aversion to them, well... :)
comment on: http://stackoverflow.com/q/23391186
type: QuestionComment
type: Comment
score: 2

http://stackoverflow.com/a/23342012
upvote count: 2
has comment: http://stackoverflow.com/comment/35744834
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/23341850
has comment: http://stackoverflow.com/comment/35744734
accepted answer of: http://stackoverflow.com/q/23341850
has body: in your postExecution list.setOnItemClickListener(new OnItemClickListener() { public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) { Toast.makeText(getBaseContext(),videolist.get(position).getuser(),Toast.LENGTH_SHORT).show(); } });
score: 2
downvote count: 0

http://stackoverflow.com/q/23340833
type: Question
has comment: http://stackoverflow.com/comment/35743379
has comment: http://stackoverflow.com/comment/35743873
score: 0
has body: I am new to service method in java i don't solve this problem my application, can you any solve this problem .. How can i solve this errors only ... java: textStripper.setHtmlService(htmlService); textStripper.setHtmlDocument(html); Errors: Exception in thread "main" java.lang.NoSuchMethodError: org.apache.pdfbox.util.PDFTextStripper.setHtmlService(Lpdf2html/service/intf/HTMLService;)V at pdf2html.service.impl.PDF2HTMLServiceImpl.convertPage(PDF2HTMLServiceImpl.java:60) at pdf2html.Main.main(Main.java:27) Java Result: 1 ... when track errors, i can command this line i got only text... service not working..
answer count: 1
type: UnansweredQuestion
has title: how to using service method in java?
has comment: http://stackoverflow.com/comment/35742434
has comment: http://stackoverflow.com/comment/35743444
tagged with: spring
has answer: http://stackoverflow.com/a/23353509
has comment: http://stackoverflow.com/comment/35743654
tagged with: java
linked to: http://stackoverflow.com/q/35186

http://stackoverflow.com/q/23345209
has answer: http://stackoverflow.com/a/23345529
accepted answer: http://stackoverflow.com/a/23345529
has comment: http://stackoverflow.com/comment/35751071
upvote count: 0
score: -2
has body: I have the following information String templateString = "I am %NAME% and I live in %PLACE%"; String inputString = "I am John Doe and I live in New York"; I need to write a function which will take in the above 2 strings and return a HashMap of pairs. HashMap&lt;String,String&gt; parseInputFromTemplate(templateString, inputString) { // Magic return result; } The result will have %NAME% (key) , John Doe (value) %PLACE% (key) , New York (value) Any pointers would be appreciated.
answer count: 1
tagged with: template-engine
favorite count: 0
downvote count: 2
tagged with: regex
type: AnsweredQuestion
has title: Pattern matching a string against a template string
has comment: http://stackoverflow.com/comment/35751222
tagged with: java
has comment: http://stackoverflow.com/comment/35750916
type: Question

http://stackoverflow.com/a/23312885
accepted answer of: http://stackoverflow.com/q/23311976
score: 5
has comment: http://stackoverflow.com/comment/35693216
answers question: http://stackoverflow.com/q/23311976
has body: The idea is to turn your loop into two nested loops; the outer loop sets the number of 1's, and the inner loop iterates through every combination of binary numbers with N 1's. Thus, your loop becomes: for (long i = 1; i &lt; (1L &lt;&lt; NB); i = (i &lt;&lt; 1) | 1) { long j = i; do { System.out.println(Long.toBinaryString(j)); if(checkSolution(j)) { this.add(j); // add j to solutions } j = next_of_n(j); } while (j &lt; (1L &lt;&lt; NB)); } next_of_n() is defined as: long next_of_n(long j) { long smallest, ripple, new_smallest, ones; if (j == 0) return j; smallest = (j &amp; -j); ripple = j + smallest; new_smallest = (ripple &amp; -ripple); ones = ((new_smallest / smallest) &gt;&gt; 1) - 1; return (ripple | ones); } The algorithm behind next_of_n() is described in C: A Reference Manual, 5th edition, section 7.6, while showing an example of a SET implementation using bitwise operations. It may be a little hard to understand the code at first, but here's what the book says about it: This code exploits many unusual properties of unsigned arithmetic. As an illustration: if x == 001011001111000, then smallest == 000000000001000 ripple == 001011010000000 new_smallest == 000000010000000 ones == 000000000000111 the returned value == 001011010000111 The overall idea is that you find the rightmost contiguous group of 1-bits. Of that group, you slide the leftmost 1-bit to the left one place, and slide all the others back to the extreme right. (This code was adapted from HAKMEM.) I can provide a deeper explanation if you still don't get it. Note that the algorithm assumes 2 complement, and that all arithmetic should ideally take place on unsigned integers, mainly because of the right shift operation. I'm not a huge Java guy, I tested this in C with unsigned long and it worked pretty well. I hope the same applies to Java, although there's no such thing as unsigned long in Java. As long as you use reasonable values for NB, there should be no problem.
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/35691950
upvote count: 5
type: Answer
has comment: http://stackoverflow.com/comment/35692169
has comment: http://stackoverflow.com/comment/35696428
has comment: http://stackoverflow.com/comment/35691905
has comment: http://stackoverflow.com/comment/35692327

http://stackoverflow.com/comment/35759251
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/23339308
has text: Or an unbounded task flow?
score: 0

http://stackoverflow.com/comment/35677529
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23304586
type: Comment
has text: Thanks, I think this will do the trick. Wasn't sure if there was a less "brute force" way to do it.

http://stackoverflow.com/comment/35756271
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23331903
has text: Thank you camickr, i just did not understand what you mean.

http://stackoverflow.com/comment/58070557
comment on: http://stackoverflow.com/a/23406393
type: AnswerComment
has text: In simple words .. Data Structure has attributes whereas object has attributes and state
type: Comment
score: 0

http://stackoverflow.com/comment/35722359
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23329055
has text: I see, brilliant! But what is `playerturn`?

object
tags question: http://stackoverflow.com/q/23360595
tags question: http://stackoverflow.com/q/23344271
tags question: http://stackoverflow.com/q/23432881
tag name: object
tags question: http://stackoverflow.com/q/23410599
tags question: http://stackoverflow.com/q/23294117
tags question: http://stackoverflow.com/q/23381136
tags question: http://stackoverflow.com/q/23420002
tags question: http://stackoverflow.com/q/23332416
tags question: http://stackoverflow.com/q/23336138
tags question: http://stackoverflow.com/q/23354399
tags question: http://stackoverflow.com/q/23328003
tags question: http://stackoverflow.com/q/23406290
tags question: http://stackoverflow.com/q/23428896
tags question: http://stackoverflow.com/q/23378067
tags question: http://stackoverflow.com/q/23365049
tags question: http://stackoverflow.com/q/23354230
tags question: http://stackoverflow.com/q/23352243
tags question: http://stackoverflow.com/q/23357380
tags question: http://stackoverflow.com/q/23328784
tags question: http://stackoverflow.com/q/23431511
tags question: http://stackoverflow.com/q/23352084
tags question: http://stackoverflow.com/q/23324156
tags question: http://stackoverflow.com/q/23321186
tags question: http://stackoverflow.com/q/23447525
tags question: http://stackoverflow.com/q/23354018
tags question: http://stackoverflow.com/q/23360079
tags question: http://stackoverflow.com/q/23417711
tags question: http://stackoverflow.com/q/23436329
tags question: http://stackoverflow.com/q/23316881
tags question: http://stackoverflow.com/q/23292907
tags question: http://stackoverflow.com/q/23421046
tags question: http://stackoverflow.com/q/23406307
tags question: http://stackoverflow.com/q/23328836
tags question: http://stackoverflow.com/q/23433962
tags question: http://stackoverflow.com/q/23342682
tags question: http://stackoverflow.com/q/23390145
tags question: http://stackoverflow.com/q/23366565
tags question: http://stackoverflow.com/q/23330905
tags question: http://stackoverflow.com/q/23439802
tags question: http://stackoverflow.com/q/23403383
tags question: http://stackoverflow.com/q/23374046
tags question: http://stackoverflow.com/q/23378551
tags question: http://stackoverflow.com/q/23440058
tags question: http://stackoverflow.com/q/23307423
tags question: http://stackoverflow.com/q/23296587
tags question: http://stackoverflow.com/q/23353284
type: Tag
tags question: http://stackoverflow.com/q/23392071
tags question: http://stackoverflow.com/q/23414984

http://stackoverflow.com/a/23367253
has body: The whole beauty of inheritance is that you can provide multiple implementations for a general method. The superclass and indeed any callers of the superclass only need to know the method signature, they do not need to know the exact implementation of the method, as defined in the subclass. What I'd do is make a display method inside the SportsWear class and let Jersey override it. Then you can tell SportsWear to execute the method, and the method inside Jersey will be called. //Inside Sportswear class: public String display() { //todo } //Inside Jersey class: @Override public String display() { super.display(); //todo }
score: 0
has comment: http://stackoverflow.com/comment/35793577
has comment: http://stackoverflow.com/comment/35792112
type: Answer
answers question: http://stackoverflow.com/q/23366743

string
tags question: http://stackoverflow.com/q/23332717
tags question: http://stackoverflow.com/q/23380377
tags question: http://stackoverflow.com/q/23310150
tags question: http://stackoverflow.com/q/23352243
tags question: http://stackoverflow.com/q/23375409
tags question: http://stackoverflow.com/q/23398458
tags question: http://stackoverflow.com/q/23326429
tags question: http://stackoverflow.com/q/23295654
tags question: http://stackoverflow.com/q/23396955
tags question: http://stackoverflow.com/q/23394554
tags question: http://stackoverflow.com/q/23391460
tags question: http://stackoverflow.com/q/23389503
tags question: http://stackoverflow.com/q/23307486
tags question: http://stackoverflow.com/q/23451771
tags question: http://stackoverflow.com/q/23379192
tags question: http://stackoverflow.com/q/23407666
tags question: http://stackoverflow.com/q/23415980
tags question: http://stackoverflow.com/q/23415281
tags question: http://stackoverflow.com/q/23371592
tags question: http://stackoverflow.com/q/23332146
tags question: http://stackoverflow.com/q/23406279
tags question: http://stackoverflow.com/q/23332760
tags question: http://stackoverflow.com/q/23443634
tags question: http://stackoverflow.com/q/23397829
tags question: http://stackoverflow.com/q/23309341
tags question: http://stackoverflow.com/q/23424023
tags question: http://stackoverflow.com/q/23418855
tags question: http://stackoverflow.com/q/23299532
tags question: http://stackoverflow.com/q/23328331
tags question: http://stackoverflow.com/q/23358399
tags question: http://stackoverflow.com/q/23401209
tags question: http://stackoverflow.com/q/23421306
tags question: http://stackoverflow.com/q/23328698
tags question: http://stackoverflow.com/q/23366617
tags question: http://stackoverflow.com/q/23293871
tags question: http://stackoverflow.com/q/23416554
tags question: http://stackoverflow.com/q/23435430
tags question: http://stackoverflow.com/q/23363898
tags question: http://stackoverflow.com/q/23318288
tag name: string
tags question: http://stackoverflow.com/q/23434672
tags question: http://stackoverflow.com/q/23372674
tags question: http://stackoverflow.com/q/23376928
tags question: http://stackoverflow.com/q/23296187
tags question: http://stackoverflow.com/q/23336894
tags question: http://stackoverflow.com/q/23297402
tags question: http://stackoverflow.com/q/23316755
tags question: http://stackoverflow.com/q/23325800
tags question: http://stackoverflow.com/q/23438076
tags question: http://stackoverflow.com/q/23438908
tags question: http://stackoverflow.com/q/23316089
tags question: http://stackoverflow.com/q/23331285
tags question: http://stackoverflow.com/q/23448720
tags question: http://stackoverflow.com/q/23353671
tags question: http://stackoverflow.com/q/23415890
type: Tag
tags question: http://stackoverflow.com/q/23420963
tags question: http://stackoverflow.com/q/23452416
tags question: http://stackoverflow.com/q/23387749
tags question: http://stackoverflow.com/q/23430819
tags question: http://stackoverflow.com/q/23326087
tags question: http://stackoverflow.com/q/23374600
tags question: http://stackoverflow.com/q/23428821
tags question: http://stackoverflow.com/q/23449368
tags question: http://stackoverflow.com/q/23290963
tags question: http://stackoverflow.com/q/23413955
tags question: http://stackoverflow.com/q/23392071
tags question: http://stackoverflow.com/q/23401275
tags question: http://stackoverflow.com/q/23350759
tags question: http://stackoverflow.com/q/23329910
tags question: http://stackoverflow.com/q/23430126
tags question: http://stackoverflow.com/q/23430578
tags question: http://stackoverflow.com/q/23352522
tags question: http://stackoverflow.com/q/23435888
tags question: http://stackoverflow.com/q/23437939
tags question: http://stackoverflow.com/q/23332889
tags question: http://stackoverflow.com/q/23311033
tags question: http://stackoverflow.com/q/23325931
tags question: http://stackoverflow.com/q/23339539
tags question: http://stackoverflow.com/q/23306550

http://stackoverflow.com/q/23311546
has answer: http://stackoverflow.com/a/23311639
type: UnansweredQuestion
upvote count: 1
score: 1
tagged with: java
tagged with: servlets
type: Question
tagged with: encoding
answer count: 1
downvote count: 0
tagged with: jsp
favorite count: 0
has title: encoding utf 8 java jdbc oracle
tagged with: sql
has body: Hello i have 3 projects . web application encoding utf-8 . There is servlets, jsp ,html pages etc java app project - utf8 - classes to set a jdbc connection do database oracle another java app project - also utf8 - classes with setters and getters , nothing much And here is my prolem : When i dispaly something on page all chars are fine, but when i do insert to database by my website i get "ÄÄÅ¼Åº" etc indestead of normall chars. I have no idea what to do. I can see wrong chars in my logs with insert to database so it's java problem. I use oracle sql developer, netbeans 8.0 and apache tomcat

http://stackoverflow.com/comment/35729315
has text: What have you tried so far? Have you debugged the code line-by-line to see where the value is changed from what you expect?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23333221

http://stackoverflow.com/a/23400276
upvote count: 1
answers question: http://stackoverflow.com/q/23400206
has comment: http://stackoverflow.com/comment/35853030
has comment: http://stackoverflow.com/comment/35852958
downvote count: 0
has comment: http://stackoverflow.com/comment/35852797
type: Answer
has body: First demonstrate that the task is actually CPU bound and not I/O bound. In other words, is it faster for two threads to read two files in parallel than for one thread to read two files in series? Depending on the storage media, the sizes of the files, their physical locations on the disk, and many other things, two threads could actually be slower.
score: 1

http://stackoverflow.com/q/23386274
accepted answer: http://stackoverflow.com/a/23386354
has body: I am new to Maven, we are converting ant based project into Maven project. Every thing is working fine. Additionally we need to compile source code package wise. To be more clear, we have three packages in src/main/java folder, namely dao, svc and controller. I want to compile dao first and then compile svc by giving dao reference to it, similarly compile controller by giving reference of svc only but not dao. Finally the goal is to make sure that the controllers are not using any of the dao classes, they can use svc classes only. If this condition fails, Maven build has to be failed. Please suggest.
possible better answer: http://stackoverflow.com/a/23386351
favorite count: 0
has answer: http://stackoverflow.com/a/23386351
downvote count: 0
tagged with: maven
type: Question
type: AnsweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/35826305
answer count: 2
upvote count: 1
has comment: http://stackoverflow.com/comment/35826322
tagged with: maven-3
has title: Package-wise compilation with Maven?
has answer: http://stackoverflow.com/a/23386354

http://stackoverflow.com/q/23392208
type: AnsweredQuestion
tagged with: list
has comment: http://stackoverflow.com/comment/35837481
upvote count: 2
has comment: http://stackoverflow.com/comment/35837379
tagged with: java
has body: I have an Observer that is expecting two possible objects from an observable: List&lt;Cat&gt; or List&lt;Orange&gt;, mutually exclusive. How might I distinguish which data type was passed to update(Observable observable, Object data)? I cannot use if(data instanceof List&lt;Cat&gt;) because of type erasure at runtime?
type: Question
accepted answer: http://stackoverflow.com/a/23392425
has comment: http://stackoverflow.com/comment/35837471
linked to: http://stackoverflow.com/q/1942644
has comment: http://stackoverflow.com/comment/35837440
answer count: 2
has title: How to determine the content type of a list at runtime
tagged with: casting
linked to: http://stackoverflow.com/q/4155252
downvote count: 0
has answer: http://stackoverflow.com/a/23392804
has comment: http://stackoverflow.com/comment/35837755
favorite count: 0
linked to: http://stackoverflow.com/q/271526
has comment: http://stackoverflow.com/comment/35837434
possible better answer: http://stackoverflow.com/a/23392804
has answer: http://stackoverflow.com/a/23392425
score: 2
has comment: http://stackoverflow.com/comment/35837596

http://stackoverflow.com/q/23352243
answer count: 0
type: UnansweredQuestion
tagged with: object
tagged with: java
has title: Specific instance of a vector of objects into a array of strings
has body: I am trying to convert a specific instance of my object vector into an array of strings. The object vector contains ints, doubles and string, but I only want to get one string instance of the vector to turn it into an array and I am running into issues. This is one of the things I've tried. String [] tempNameA = new String [dogParkProgramMain.infoVector.size()]; for(int x1 = 0; x1&lt;dogParkProgramMain.infoVector.size(); x1++) { tempNameA[x1] = dogParkProgramMain.infoVector.elementAt(x1).getFName().get(x1).toString(); }
type: Question
tagged with: vector
tagged with: arrays
score: 0
has comment: http://stackoverflow.com/comment/35765536
tagged with: string
has comment: http://stackoverflow.com/comment/35764383

http://stackoverflow.com/a/23367045
type: Answer
has comment: http://stackoverflow.com/comment/35791416
has comment: http://stackoverflow.com/comment/35790918
has comment: http://stackoverflow.com/comment/35790733
has body: The first line of your XML is incorrect. Change it to &lt;?xml version="1.0" encoding="UTF-8"?&gt;
answers question: http://stackoverflow.com/q/23366988
score: 0

http://stackoverflow.com/comment/35820534
score: 0
type: AnswerComment
has text: but they are graphical... let me know what and how you expect in Console based so that I can guide
comment on: http://stackoverflow.com/a/23381212
type: Comment

http://stackoverflow.com/comment/35762769
has text: sorry - mistake, didn't mean to add parameters.
score: 0
comment on: http://stackoverflow.com/q/23351285
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35765406
comment on: http://stackoverflow.com/a/23352342
type: AnswerComment
score: 0
type: Comment
has text: And what do the bits of each pixel represent exactly, color? I think I didn't totally answer your question then, since I thought you meant that each bit represented a pixel.

performance
tags question: http://stackoverflow.com/q/23417858
tags question: http://stackoverflow.com/q/23337589
tags question: http://stackoverflow.com/q/23316223
tags question: http://stackoverflow.com/q/23311802
tags question: http://stackoverflow.com/q/23391186
tags question: http://stackoverflow.com/q/23430179
tags question: http://stackoverflow.com/q/23452537
tags question: http://stackoverflow.com/q/23405511
tags question: http://stackoverflow.com/q/23360851
tags question: http://stackoverflow.com/q/23303089
tags question: http://stackoverflow.com/q/23385478
tags question: http://stackoverflow.com/q/23447882
tags question: http://stackoverflow.com/q/23437640
tags question: http://stackoverflow.com/q/23450352
tags question: http://stackoverflow.com/q/23343248
tags question: http://stackoverflow.com/q/23296473
tags question: http://stackoverflow.com/q/23448156
tag name: performance
tags question: http://stackoverflow.com/q/23414274
tags question: http://stackoverflow.com/q/23384268
tags question: http://stackoverflow.com/q/23397059
tags question: http://stackoverflow.com/q/23358877
type: Tag
tags question: http://stackoverflow.com/q/23425545
tags question: http://stackoverflow.com/q/23380377
tags question: http://stackoverflow.com/q/23348950
tags question: http://stackoverflow.com/q/23302817
tags question: http://stackoverflow.com/q/23436682

http://stackoverflow.com/a/23439210
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/35968345
answers question: http://stackoverflow.com/q/23422082
has comment: http://stackoverflow.com/comment/36223069
downvote count: 0
has body: I solved it. Thanks to Tauren Mills. I followed his advice. Have to use @InjectParam instead of @Autowired. I was able to inject spring beans by using @InjectParam instead of @Autowired annotation. However, i am not able to inject Spring Data Neo4j Repositories. When i start Neo4j community server, i get error in the console log. INFO: Root resource classes found: class com.mycompany.poc.rest.PathController May 03, 2014 6:36:55 AM com.sun.jersey.api.core.ScanningResourceConfig init INFO: No provider classes found. May 03, 2014 6:36:55 AM com.sun.jersey.server.impl.application.WebApplicationImpl _initiate INFO: Initiating Jersey application, version 'Jersey: 1.9 09/02/2011 11:17 AM' May 03, 2014 6:36:56 AM com.sun.jersey.spi.inject.Errors processErrorMessages SEVERE: The following errors and warnings have been detected with resource and/or provider classes: **SEVERE: The class com.mycompany.poc.graph.repositories.NodeObjectGraphRepository is an interface and cannot be instantiated.** 06:36:56.397 [AWT-EventQueue-0] WARN /extensions - unavailable com.sun.jersey.spi.inject.Errors$ErrorMessagesException: null at com.sun.jersey.spi.inject.Errors.processErrorMessages(Errors.java:170) ~[neo4j-desktop-2.0.2.jar:2.0.2] at com.sun.jersey.spi.inject.Errors.postProcess(Errors.java:136) ~[neo4j-desktop-2.0.2.jar:2.0.2] at com.sun.jersey.spi.inject.Errors.processWithErrors(Errors.java:199) ~[neo4j-desktop-2.0.2.jar:2.0.2]
type: Answer

http://stackoverflow.com/comment/35678706
type: Comment
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/23305468
has text: I guess you were :) I'll have to make a little switch to get into this whole functional lambda style - didn't touch it since my PPL course and scheme language. Thanks again!

http://stackoverflow.com/comment/35938279
type: AnswerComment
type: Comment
has text: As I said to reward an answerer beyond upvoting and accepting you can use the [bounty system](http://meta.stackexchange.com/a/16067).
score: 0
comment on: http://stackoverflow.com/a/23445771

http://stackoverflow.com/a/23448006
type: AcceptedAnswer
type: Answer
has body: Play is suitable for this kind of job as much as any other web-framework, anyway first you need to get some general experience on it and next... project your application i.e. with some diagram tool, finally you can start coding. The way how will you design your model(s) depends on you, personally I'd create a separate model for each data type - then collect them in one data model (not persisted) to pass it easily to the view, anyway that's just a tip of iceberg.
answers question: http://stackoverflow.com/q/23447916
accepted answer of: http://stackoverflow.com/q/23447916
has comment: http://stackoverflow.com/comment/35941771
score: 0

http://stackoverflow.com/q/23312585
downvote count: 0
tagged with: c3p0
score: 1
has comment: http://stackoverflow.com/comment/35914323
favorite count: 0
has comment: http://stackoverflow.com/comment/35821191
type: Question
tagged with: records
has title: MYSQL Records Disappear (Java, c3p0)
tagged with: mysql
upvote count: 1
tagged with: java
has comment: http://stackoverflow.com/comment/35703596
type: UnansweredQuestion
has body: I have a JavaFX application with modules, interacting with MySQL database in different aspects. Dozens of modules communicate it successfully. But the module I test adds records to a table successfully (with INSERT IGNORE ... ON DUPLICATE KEY UPDATE), then the same record is updated (UPDATE successful), and 15 minutes later this record disappears from database. id autoincrement doesn't roll back. I noticed that records, that were inserted and never experienced my update query, don't disappear. Other old records in this table remain untouched. The problematic record is affected with this query: UPDATE `order` SET `create_date` = '2014-03-20 00:00:00', `discount_coupon_id` = 0, `discount_percent_value` = 5, `comment` = '', `comment_length` = 0, `delivery_address` = 'Perm', `pay_date` = DEFAULT, `shipped_date` = DEFAULT, `delivery_date` = DEFAULT WHERE id = 407 After this query was executed, I've closed application and exited IDE, checked that record 407 is present and is updated (in HeidiSQL DB Editor). 15 minutes later I've checked for records' state and saw record 407 disappeared. Details on table updated: CREATE TABLE `order` ( `id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, `create_date` DATETIME NULL DEFAULT NULL, `customer_id` INT(10) UNSIGNED NOT NULL, `discount_coupon_id` INT(10) UNSIGNED NULL DEFAULT NULL, `discount_percent_value` FLOAT NULL DEFAULT NULL, `comment` TEXT NOT NULL, `comment_length` INT(10) UNSIGNED NOT NULL DEFAULT '0', `delivery_address` CHAR(255) NOT NULL, `pay_date` DATETIME NULL DEFAULT NULL, `shipped_date` DATETIME NULL DEFAULT NULL, `delivery_date` DATETIME NULL DEFAULT NULL, PRIMARY KEY (`id`) ) COLLATE='utf8_general_ci' ENGINE=MyISAM AUTO_INCREMENT=408; I use c3p0 connection manager with default setup. Query is called like this: try ( Connection c = m.cpdsSayt.getConnection(); Statement stmt = c.createStatement();) { stmt.executeUpdate(SQL); } I've studied similar questions like this, but found no clue to my case, as I use no PROCEDURE, …
linked to: http://stackoverflow.com/q/2362570
answer count: 0

http://stackoverflow.com/comment/35709547
type: AnswerComment
type: Comment
has text: But I have to create another .java for the server with this code?
score: 0
comment on: http://stackoverflow.com/a/23322785

http://stackoverflow.com/q/23426623
has comment: http://stackoverflow.com/comment/35903656
has comment: http://stackoverflow.com/comment/35903033
favorite count: 0
upvote count: 2
type: UnansweredQuestion
score: 2
tagged with: java
has answer: http://stackoverflow.com/a/29318413
has body: I am trying to make a con using rjdbc and rJava packages and i am getting this error: C:\Users\user\dir&gt;Rscript rjdbc.r Loading required package: methods Error : .onLoad failed in loadNamespace() for 'rJava', details: call: inDL(x, as.logical(local), as.logical(now), ...) error: unable to load shared object 'C:/Users/user/Documents/R/win-library/3.0/rJava/libs/i386/rJava.dll': LoadLibrary failure: The specified module could not be found. Error: package or namespace load failed for 'rJava' Additionally i get this pop-up error window This program can't start because jvm.dll is missing from your computer I am using java java version "1.8.0_05" Java(TM) SE Runtime Environment (build 1.8.0_05-b13) Java HotSpot(TM) Client VM (build 25.5-b02, mixed mode) R version is R version 3.0.3 (2014-03-06) -- "Warm Puppy" Copyright (C) 2014 The R Foundation for Statistical Computing Platform: i386-w64-mingw32/i386 (32-bit) and my env variables on Windows 8.1 Pro - 64-bit OS are currently JAVA_HOME = C:\Program Files (x86)\Java\jre8 path = C:\Program Files (x86)\Java\jre8\bin;C:\Program Files (x86)\Java\jdk1.8.0_05\jre\bin\server I have read tons of similar questions but still no success. Thanks for any suggestions
tagged with: rjava
tagged with: rjdbc
has answer: http://stackoverflow.com/a/23429107
type: Question
has title: R and Java - rJava error on Windows 8.1
has comment: http://stackoverflow.com/comment/35905667
tagged with: http://stackoverflow.com/tag/r
answer count: 2
downvote count: 0

http://stackoverflow.com/a/23391959
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/23387014
score: 2
has body: There is no need for a while loop. A modal JDialog will cause execution to stop in your ActionLIstener until the dialog is closed. Also, don't use the show() method to display a dialog. You should be using the setVisible(true) method.
accepted answer of: http://stackoverflow.com/q/23387014
upvote count: 2
type: AcceptedAnswer

http://stackoverflow.com/a/23432476
type: Answer
answers question: http://stackoverflow.com/q/23431535
score: 2
has body: I will try to answer your specific question, which is about the effect of Thread.sleep() on memory issues - I am sure that others will school you on how to keep Hibernate's footprint under control. I know of only one case where sleeping your application thread(s) can help avoid out of memory conditions, and that is when you are making heavy use of instances of classes that have the Object.finalize() method defined. Such instances live through two rounds of reachability tests and have to have the finalize method executed; the finalize methods of all instances are executed on a single thread as part of garbage collection. If you are creating finalizable garbage on multiple threads faster than the single finalizer thread can process, you will get an OutOfMemoryError even though you have lots of garbage available for collection. By slowing down your application threads by sleeping, you may give the finalizer thread a chance to catch up. This is almost certainly NOT your problem in this case (you have other obvious reasons for running out of heap space) and the sleep gains you nothing.
upvote count: 2
downvote count: 0

http://stackoverflow.com/q/23449603
answer count: 1
favorite count: 0
has body: I am writing a simple game, or so it seemed. I created a class that draws a Arc2D (half a circle shape), that same class will repaint the arch as the mouse move. Then I created a new class that draws ovals. This class has some simple mathematics to move the ovals on the screen. The movement of the ovals are not very important. So now that this is done I want to detect if the Oval collides with the arc(half a circle, Only the arc line) at any point. What I have attempted is making the oval a Rectangle and use the intersect method. This code is in the draw method for the arc. Arc2D temp= new Arc2D.Double(200, 200, 100, 100, angle, 180, Arc2D.OPEN); MasterOval m = new MasterOval(); Rectangle r1 = m.bounds();//This gets the bounds of the oval if(r1.intersects(temp.getBounds())) System.out.println("hit");//display if intersects For some reason I cant figure out why it will not display the word hit when it collides with the arc. Is there a way to see if they intercect? This is all code I can provide due to privacy policies. Please help.
upvote count: 2
accepted answer: http://stackoverflow.com/a/23454287
score: 2
type: AnsweredQuestion
tagged with: paint
tagged with: java
tagged with: collision-detection
type: Question
has title: Collision Detection between a Oval and Arc
has answer: http://stackoverflow.com/a/23454287
downvote count: 0

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

http://stackoverflow.com/a/23345815
score: 0
has body: set response header with status, as below: response.setStatus(httpStatus); for more info, @see http://tomcat.apache.org/tomcat-5.5-doc/servletapi/javax/servlet/http/HttpServletResponse.html#setStatus(int)
answers question: http://stackoverflow.com/q/23342945
type: Answer

http://stackoverflow.com/comment/35688096
score: 0
comment on: http://stackoverflow.com/q/23310627
type: Comment
type: QuestionComment
has text: when I open the URL on my browser I see junk characters. can you confirm that you don't have any plugin for the same?

http://stackoverflow.com/comment/35949597
has text: @DavidA Thanks for that link, that'll be my bedtime reading for tonight :D
comment on: http://stackoverflow.com/a/23451564
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/23422990
downvote count: 0
score: 19
has body: Short answer How does join() work in java? I grant you that the javadoc for join() is a little bit unclear, because it's not obvious who this refers to when you first read it. It means that the thread calling t.join() blocks until the thread t has finished its execution. If t has already finished when the current thread calls t.join(), then the current thread does not stop and just keeps going. The word this in the doc refers to t here, not to the thread that calls the method. Does it guarantee the execution before main()? [...] if no join is used, main() executes anywhere b/w the execution of threads [...] You shouldn't consider main() as a whole. Parts of main() are executed before the other threads, parts of it in parallel, and parts of it after. That's actually what start() and join() control. Let me explain below. What happens in your main() Here is the sequence of events regarding t1.start() and t1.join(). You can obviously think the same way for t3. The instructions of main() preceding t1.start() are executed t1.start() starts the thread t1 (t1.run() might not start right away.) The instructions of main() between t1.start() and t1.join() are executed in parallel(*) of the ones in t1.run(). Note: You have none in your example, so only t1.run() instructions are executed at this moment. t1.join(): if t1.run() has already finished, nothing happens and main() keeps going if t1.run() has not finished yet, the main thread stops and waits until t1.run() finishes. Then t1.run() finishes, and then main() resumes. The instructions of main() after t1.join() are executed Here you can see that: the part of main() preceding t1.start() is guaranteed to be executed before t1.run() the part of main() following t1.join() is guaranteed to be executed after t1.run() (*) see below section about parallelism What I mean by "executed in parallel" Suppose you have these 2 sets of instructions being executed in 2 threads A and B: // Thread A | // Thread B | System.out.println("A1"); | …
upvote count: 19
has comment: http://stackoverflow.com/comment/35916953
has comment: http://stackoverflow.com/comment/35896261
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23422970
has comment: http://stackoverflow.com/comment/35896358
type: Answer
has comment: http://stackoverflow.com/comment/35896110
accepted answer of: http://stackoverflow.com/q/23422970
has comment: http://stackoverflow.com/comment/36207527
has comment: http://stackoverflow.com/comment/35896175

http://stackoverflow.com/q/23372222
has comment: http://stackoverflow.com/comment/35801258
type: Question
has body: I just started learning Java and I have a problem with defining a class. I defined some variables in a class, but everywhere I wrote a command for printing a value of a string (or other variables) I got an error that says "cannot find symbol". Does that mean I can't use a print command in a class? Can you do a favor and simply explain me what to do? Here is my codes (it's just for testing): class Variable { int m = 15; boolean myb = true; double mon = 2.4; }
has answer: http://stackoverflow.com/a/23372493
tagged with: class
has comment: http://stackoverflow.com/comment/35801283
answer count: 2
downvote count: 4
favorite count: 0
has comment: http://stackoverflow.com/comment/35801287
type: UnansweredQuestion
has title: need some beginner guide about classes
has comment: http://stackoverflow.com/comment/35801189
score: -3
has answer: http://stackoverflow.com/a/23372410
tagged with: java
upvote count: 1

http://stackoverflow.com/comment/35928728
score: 0
has text: I'd love to put 5 buttons along the bottom part of the open space next to eachother, with a question showing above it
type: Comment
comment on: http://stackoverflow.com/a/23440856
type: AnswerComment

http://stackoverflow.com/comment/35780466
has text: That's correct. You could optimize that away of course, but I doubt creating those 5-element arrays is likely to be your applications' performance bottleneck.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23361248

http://stackoverflow.com/a/23391091
answers question: http://stackoverflow.com/q/23390909
score: 0
type: Answer
has body: Tried running the command prompt as admin?? I know it sounds too simple but it looks like Java doesn't have permission to listen on a ServerSocket

http://stackoverflow.com/a/23407545
upvote count: 2
answers question: http://stackoverflow.com/q/23407439
downvote count: 0
has body: If you're willing to use a third-party library, check out the Apache Commons RandomStringUtils. int count = 500000; String alphabet = "ABCD"; String randomString = RandomStringUtils.random(count, alphabet); On my laptop (MacBook Pro), it took about 20ms to generate a 500K string.
type: Answer
score: 2

http://stackoverflow.com/q/23437939
possible better answer: http://stackoverflow.com/a/23438079
has title: Android / Java Algorithm to pick out pieces of String
score: 2
has answer: http://stackoverflow.com/a/23438058
downvote count: 0
has comment: http://stackoverflow.com/comment/35923674
has body: I'm writing a Chatting Application. Right now I'm trying to save Messages of each conversation. If the user reopens the specific activity, I want the app the load the messages he has already sent. My Problem right now is following: I'm saving the conversation data in a String like this: SEND#Hey youRECEIVE#Hi how are you?SEND#I´m fine and you?RECEIVE#=) so am I... and so on. You get the concept. Is there any way to pick out the pieces of message between the, what I call "dividers" SEND# and RECEIVE#, without having to use tons of if cases? this is my code right now: if(conversation != null){ while(conversation.contains("SEND123")|| conversation.contains("RECEIVE123")){ if(conversation.startsWith("SEND123")){ String rest = conversation.substring(7); System.out.println("erste if: send: " + rest); if(rest.contains("SEND123") &amp;&amp; rest.contains("RECEIVE123")){ if(rest.indexOf("SEND123")&lt;rest.indexOf("RECEIVE123")){ String messageReady = rest.substring(0, rest.indexOf("SEND123")); conversation = rest.substring(rest.indexOf("SEND123")); System.out.println(messageReady); } if(rest.indexOf("RECEIVE123")&lt;rest.indexOf("SEND123")){ String messageReady = rest.substring(0, rest.indexOf("RECEIVE123")); conversation = rest.substring(rest.indexOf("RECEIVE123")); System.out.println(messageReady); } }else{ if(rest.contains("SEND123")){ String messageReady = rest.substring(0, rest.indexOf("SEND123")); conversation = rest.substring(rest.indexOf("SEND123")); System.out.println(messageReady); } if(rest.contains("RECEIVE123")){ String messageReady = rest.substring(0, rest.indexOf("RECEIVE123")); conversation = rest.substring(rest.indexOf("RECEIVE123")); System.out.println(messageReady); System.out.println("if contains receive: " + conversation); } if(!rest.contains("SEND123") || !rest.contains("RECEIVE123")){ conversation = rest; String messageReady = rest; System.out.println(messageReady); } } } if(conversation.startsWith("RECEIVE123")){ String rest = conversation.substring(1…
type: Question
has comment: http://stackoverflow.com/comment/35923634
has comment: http://stackoverflow.com/comment/35923773
type: AnsweredQuestion
tagged with: algorithm
has comment: http://stackoverflow.com/comment/35923726
has comment: http://stackoverflow.com/comment/35923645
tagged with: java
has answer: http://stackoverflow.com/a/23438079
upvote count: 2
answer count: 2
tagged with: string
favorite count: 0
accepted answer: http://stackoverflow.com/a/23438058
tagged with: android

http://stackoverflow.com/q/23385436
has comment: http://stackoverflow.com/comment/35825458
tagged with: java
has body: Analyze the following code: public class A { public void foo() { B b = new B(); // row#1 b.toString(); } As I understand, in row#1 class loads by classloader of class A. Consider class B: class B { C c = new C(); } Please clarify which classloader will use for loading class C. UPDATE after I get classloader of class B and write following code: classloaderOfClassB.loadClass("A") please clarify what classloader will use for all involve classes.
type: Question
score: 0
has comment: http://stackoverflow.com/comment/35825354
tagged with: osgi
answer count: 3
has comment: http://stackoverflow.com/comment/35825145
has answer: http://stackoverflow.com/a/23386843
has answer: http://stackoverflow.com/a/23385888
tagged with: classloader
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23386431
has title: which classloader uses for composition classes

http://stackoverflow.com/comment/35678626
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23304872
has text: Okay. Yes, of course! Type casting back and forth is ludricrous and and expresses a specific moment and level of frustration in the process. So, per your suggestion, I went back to what I had started with: ie; dataset.get() which returns a similar object [B@438d3c21 Just not sure what to do with it. I have tried numerous solutions from StackOverflow, all to no avail.
score: 0

http://stackoverflow.com/comment/35677228
type: AnswerComment
comment on: http://stackoverflow.com/a/23304697
has text: Yes, that is what i need, but i think its too slow to check every class every time.
score: 0
type: Comment

http://stackoverflow.com/q/23317632
has comment: http://stackoverflow.com/comment/35701347
type: Question
tagged with: union
linked to: http://stackoverflow.com/q/393968
has comment: http://stackoverflow.com/comment/35701282
score: 0
has comment: http://stackoverflow.com/comment/35701326
has title: Creating a Union of multiple sets which is affected by changes in original sets
accepted answer: http://stackoverflow.com/a/23325232
answer count: 1
has comment: http://stackoverflow.com/comment/35701309
has comment: http://stackoverflow.com/comment/35701199
has body: For an assignment I have to write a method which combines a number of sets into one set and returns it. This is easy enough, but the interface specifies that the returned set should be backed by the group of sets, that is to say that making a change to one of the subsets affects the overset. By creating a Set and using .addAll() on each of the subsets, will this result in the desired behavior? The Javadoc doesn't say if it's a shallow or deep copy.
has answer: http://stackoverflow.com/a/23325232
has comment: http://stackoverflow.com/comment/35700884
has comment: http://stackoverflow.com/comment/35701455
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35700993
tagged with: java
tagged with: set

http://stackoverflow.com/comment/35754923
type: AnswerComment
type: Comment
has text: What you are telling me to do is linked above. Please if you can get that to work I will give you 50 dollars right now. If you can get the data to still exist in groupsList after you exit the Done() method. I will paypal you 50 dollars right now
comment on: http://stackoverflow.com/a/23347358
score: 0

http://stackoverflow.com/a/23439093
upvote count: 2
score: 2
has body: Here is a code snipp that does it. It wont create a zillion String objects. I have only a smaller set of bubble chars just for demo purpose. Please tweak to your liking and no error handling has been done. public class StackOverFlow { private static int[] bubbled = {'ⓐ', 'ⓑ', 'ⓒ', 'ⓓ', 'ⓔ'}; private static int [] plain = {'a', 'b', 'c', 'd', 'e'}; private static Map&lt;Integer, Integer&gt; charMap = new HashMap&lt;&gt;(); public static void main(String[] args) { String test = "adcbbceead"; for(int i=0; i&lt;plain.length; i++) { charMap.put(plain[i], bubbled[i]); } replaceWithBuffer(test); } private static void replaceWithBuffer(String test) { System.out.println("Oginal String = " + test); StringBuilder sb = new StringBuilder(test); for(int i =0; i&lt;test.length(); i++) { int ch = sb.charAt(i); char buubledChar = (char)charMap.get(ch).intValue(); sb.setCharAt(i, buubledChar); } System.out.println("New String = " + sb.toString()); } } Output: Hope this helps :)
downvote count: 0
answers question: http://stackoverflow.com/q/23438908
type: Answer

http://stackoverflow.com/comment/35863198
type: Comment
has text: The data you get from the url might be in a specific format (may not be UTF-8), In the the JSP You have specified that char format as UTF-8. The mismatch with encoding can cause data to be displayed as junk characters.
comment on: http://stackoverflow.com/a/23405906
type: AnswerComment
score: 0

http://stackoverflow.com/comment/35932832
type: Comment
has text: Thanks for suggestions, I will report what I get to work. @peeskillet I mean I would like to "paint" the buttons basically when I hold the left mouse button and drag, so if I click on selected button it deselects it and any other selected buttons I drag over, vice versa for un-selected buttons.
comment on: http://stackoverflow.com/q/23422313
score: 0
type: QuestionComment

http://stackoverflow.com/a/23461188
upvote count: 1
answers question: http://stackoverflow.com/q/23451210
score: 1
accepted answer of: http://stackoverflow.com/q/23451210
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: Thanks for all the help. It turns out that I was calling the click handler in the wrong activity.

http://stackoverflow.com/a/23405653
accepted answer of: http://stackoverflow.com/q/23366588
type: Answer
answers question: http://stackoverflow.com/q/23366588
has comment: http://stackoverflow.com/comment/40838659
score: 6
has comment: http://stackoverflow.com/comment/40773327
has comment: http://stackoverflow.com/comment/54608124
has body: It appears that the web application was being deployed twice on the server. This caused the servlet that creates the XMPP connection to be initialized once, then destroyed, then initialized again. This sequence probably wasn't a good thing for the connection to GCM (dho..). Just make sure that the servlet is initialized only once. Check this by using loggers in place inside its init() and destroy() methods. If it is indeed called more than once, try assigning the web module to a specific virtual server for deployment. I believe this differs from web server to web server. For Glassfish, you need to do this from within the admin console (localhost:4848). This solves the bigger problem. Another problem I encountered was that the upstream messaging was not reliable at all. Sometimes multiple consecutive upstream messages from the same device worked flawlessly, only to try another one that wasn't pushed at all to the server. Haven't figured out any pattern to this problem... I'll get back if I find anything else. EDIT: Apparently there was an issue when using the implementation on a local server. Moved to a remote server (staging VPS) and the issue appears to be gone. Every message is received by the server. I'll be back if the issue persists, but I doubt it. I presume the local issue was due to either my ISP, or heck, even my local Wi-Fi connection. I don't have a complete answer as to what exactly caused this, but at least it works perfectly on the staging server.
downvote count: 0
has comment: http://stackoverflow.com/comment/54599583
has comment: http://stackoverflow.com/comment/40766557
type: AcceptedAnswer
upvote count: 6

http://stackoverflow.com/a/23379652
downvote count: 1
answers question: http://stackoverflow.com/q/23379518
has body: A more simpler approach is: if you consider that a word is something like "My pc there is ram memory" (between spaces) you could concat into your indexOf function spaces before and after the word that you are searching, like this if (sentence.indexOf(" "+ word +" ") >= 0) {
has comment: http://stackoverflow.com/comment/35823578
has comment: http://stackoverflow.com/comment/35814863
has comment: http://stackoverflow.com/comment/35815232
type: Answer
upvote count: 2
score: 1

http://stackoverflow.com/q/23391265
tagged with: jface
has body: In my tableviewer, the user can check/uncheck items. I want to disable the rows that are irrelevant for a particular selection of objects, so that the user is not able to modify these rows. It seems pretty basic, but I am having a lot of difficulty in dooing the same. Please help!
has title: Disabling a row in tableviewer in eclipse e4
tagged with: java
has comment: http://stackoverflow.com/comment/35835482
tagged with: eclipse
type: Question
has answer: http://stackoverflow.com/a/23422945
has answer: http://stackoverflow.com/a/23452393
score: 0
answer count: 2
tagged with: e4
type: UnansweredQuestion

http://stackoverflow.com/q/23319281
tagged with: java
tagged with: e-token
has comment: http://stackoverflow.com/comment/35703689
has answer: http://stackoverflow.com/a/23319677
has comment: http://stackoverflow.com/comment/35704217
type: Question
upvote count: 4
answer count: 1
downvote count: 0
score: 4
favorite count: 0
accepted answer: http://stackoverflow.com/a/23319677
linked to: http://stackoverflow.com/q/7710029
has title: Java keytool / KeyStore shows no entries for eToken
has body: Edit: This page covers eTokens start to finish. I wish I had found this before posting (I found the section on udev was unneeded) Direct: https://r3blog.nl/index.php/etoken-pro-72k/ Wayback Machine: https://web.archive.org/web/20140427063731/https://r3blog.nl/index.php/etoken-pro-72k/ Original Question: I recently initialized a Safenet (Aladdin) eToken using pkcs11-tool and generated a keypair for it. I can see the keypair when using pkcs11-tool, but Java refuses to see it either via keytool or using the KeyStore API. $pkcs11 --module /lib64/libeToken.so.8 --login -O Using slot 0 with a present token (0x0) Logging in to "one". Please enter User PIN: Private Key Object; RSA label: onekey Usage: decrypt, sign, unwrap Public Key Object; RSA 2048 bits label: onekey Usage: encrypt, verify, wrap however, using KeyTool: $ cat ../../../config description = PKCS11TestProvider - libeToken 8 name = PKCS11TestProvider library = /lib64/libeToken.so.8 $ $ keytool -keystore NONE -storetype PKCS11 -providerClass sun.security.pkcs11.SunPKCS11 -providerArg ../../../config -list Enter keystore password: Keystore type: PKCS11 Keystore provider: SunPKCS11-PKCS11TestProvider Your keystore contains 0 entries Similar results when running a short java program $ java -cp . com.test.pkcs11tester PKCS11 Token [SunPKCS11-PKCS11TestProvider] Password: $ $ $cat com/test/pkcs11tester.java package com.test; import com.sun.security.auth.callback.TextCallbackHandler; import sun.security.pkcs11.SunPKCS11; import java.security.KeyStore; import java.security.Security; import java.util.Arrays; import java.util.Enumeration; public class pkcs11tester { public static void main(String[] args) throws Exception { SunPKCS11 provider = new SunPKCS11ProviderFactory() .withDescription("PKCS11TestProvider - libeToken 8") .withName("PKCS11TestProvider") .withLibrary("/lib64/libeToken.so.8").build(); Security.addProvider(provider); KeyStore.CallbackHandlerProtection pinHandler = new KeyStore.CallbackHandlerProtection…
tagged with: pkcs#11
has comment: http://stackoverflow.com/comment/35703634
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35705078

http://stackoverflow.com/q/23366873
has comment: http://stackoverflow.com/comment/35793772
tagged with: java
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/35793551
type: Question
has comment: http://stackoverflow.com/comment/35793164
has comment: http://stackoverflow.com/comment/35793807
score: 0
has title: Not able to write file with openFileOutput
has comment: http://stackoverflow.com/comment/35791578
answer count: 1
has answer: http://stackoverflow.com/a/23367323
favorite count: 0
has body: I am trying to save some simple text in a file and then read it later. I have created files in the same app that work fine but for some reason with this one i get a FileNotFoundException when I try to use the openFileInput() method. private static final String COOKIE = "account_cookie.txt"; public void saveAccountCookie(String accountId, String expiryDate) { try { PrintWriter pw = new PrintWriter(openFileOutput(COOKIE, MODE_PRIVATE)); pw.write(accountId + " " + expiryDate); pw.close(); } catch (FileNotFoundException e) { e.printStackTrace(); } } public boolean cookieValid() { try { InputStreamReader isr = new InputStreamReader(openFileInput(COOKIE)); BufferedReader br = new BufferedReader(isr); String[] cookie = br.readLine().split(" "); br.close(); if (checkExpiry(cookie[1])) { return true; } checkTrialRequest(cookie[0]); return false; } catch (FileNotFoundException e) { return false; } catch (IOException e) { return false; } } these methods are called from an AsyncTask
type: UnansweredQuestion
tagged with: android

http://stackoverflow.com/comment/35931982
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23442230
has text: It semms you should also see this: http://stackoverflow.com/questions/513832/how-do-i-compare-strings-in-java
score: 0

http://stackoverflow.com/q/23294537
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/23294752
downvote count: 1
type: Question
has body: i'm trying to get user position, so far I'm able to get the 3 stores displayed on the map however i am unable to find my current position, this is done through and emulator, I have implemented the LocationListener method but it seems like the method (onLocationChaged) is never called, in the OnCreate method I have specified my 3 stores which display nicely on the map but not MY CURRENT LOCATION, I don't even have that "raider/round icon" at the top right to take me to my current location, I'm not sure what I'm missing. Java Code: public class LocateStore extends FragmentActivity implements LocationListener{ static final LatLng ARCADIA = new LatLng(-25.746318, 28.221322999999984); static final LatLng HATFIELD = new LatLng(-25.7487333, 28.238043199999993); static final LatLng CENTURION = new LatLng(-25.8602778, 28.189444399999957); private GoogleMap map; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_locate_store); LocationManager lm = (LocationManager) getSystemService(Context.LOCATION_SERVICE); lm.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, this); map = ((MapFragment) getFragmentManager().findFragmentById(R.id.map)).getMap(); map.setMapType(GoogleMap.MAP_TYPE_SATELLITE); Marker aracdia = map.addMarker(new MarkerOptions().position(ARCADIA).title("Arcadia").icon(BitmapDescriptorFactory.fromResource(R.drawable.marker_small))); Marker hatfield = map.addMarker(new MarkerOptions().position(HATFIELD).title("Hatfield").icon(BitmapDescriptorFactory.fromResource(R.drawable.marker_small))); Marker centurion = map.addMarker(new MarkerOptions().position(CENTURION).title("Centurion").icon(BitmapDescriptorFactory.fromResource(R.drawable.marker_small))); } @Override public void onLocationChanged(Location location) { // TODO Auto-generated method stub map.clear(); MarkerOptions mp = new MarkerOptions(); mp.position(new LatLng(location.getLatitude(), location.getLongitude())); mp.t…
score: -1
has answer: http://stackoverflow.com/a/23294594
has comment: http://stackoverflow.com/comment/35659308
answer count: 3
upvote count: 0
has answer: http://stackoverflow.com/a/23295949
favorite count: 0
has title: GOOGLE MAPS V2 - Get Current User Position
tagged with: android
accepted answer: http://stackoverflow.com/a/23294594
has answer: http://stackoverflow.com/a/23294752

http://stackoverflow.com/a/23354668
score: 2
upvote count: 2
accepted answer of: http://stackoverflow.com/q/23354359
has comment: http://stackoverflow.com/comment/35799008
has comment: http://stackoverflow.com/comment/35808290
type: AcceptedAnswer
downvote count: 0
has body: System.out.printf("%07.3f seconds", (elapsedTime / 1000f));
type: Answer
answers question: http://stackoverflow.com/q/23354359

http://stackoverflow.com/a/23439079
answers question: http://stackoverflow.com/q/23430775
upvote count: 4
accepted answer of: http://stackoverflow.com/q/23430775
downvote count: 0
score: 4
type: AcceptedAnswer
has body: This is possible using a SortingMergePolicy that will sort your documents whenever a merge occurs. Here's an example (gist). First, you create a SortingMergePolicy: boolean ascending = false; SortField idSortField = new SortField("id", SortField.Type.LONG, ascending); SortingMergePolicy sortingMP = new SortingMergePolicy( iwc.getMergePolicy(), new Sort(idSortField)); iwc.setMergePolicy(sortingMP); Then, you index your documents regularly, in whatever order you like d = new Document(); d.add(new LongField("id", 4, Field.Store.YES)); iw.addDocument(d); d = new Document(); d.add(new LongField("id", 2, Field.Store.YES)); iw.addDocument(d); You just need to force a merge before opening your IndexReader iw.forceMerge(1, true); Now, if you open an IndexReader on this, you can iterate you documents from 0 to IndexReader.maxDoc() and they will be sorted by your LongField. A few notes: This class lives in lucene-misc, you might have to add this as an additional dependency The API changed with the 4.8.0 release, requiring a Sort instead if a Sorter You can also do live sorting or offline sorting (example in the gist)
type: Answer

http://stackoverflow.com/comment/35707317
type: QuestionComment
comment on: http://stackoverflow.com/q/23312617
score: 0
has text: see if u have any problem in res folder generally u get error in R.so just re check ur all xml file.
type: Comment

http://stackoverflow.com/q/23356999
upvote count: 2
has body: I want to randomly select either 2 or 4, with 2 having probability 0.9, and 4 having probability 0.1. How do I do this?
score: -3
has comment: http://stackoverflow.com/comment/35775694
has answer: http://stackoverflow.com/a/23357059
has answer: http://stackoverflow.com/a/23357032
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35772646
has comment: http://stackoverflow.com/comment/35773336
tagged with: java
has answer: http://stackoverflow.com/a/23357061
possible better answer: http://stackoverflow.com/a/23357032
type: Question
has answer: http://stackoverflow.com/a/23357088
downvote count: 5
accepted answer: http://stackoverflow.com/a/23357059
has comment: http://stackoverflow.com/comment/35773234
has title: Random numbers (the number 2 or 4) in java
has comment: http://stackoverflow.com/comment/35773730
answer count: 4
has comment: http://stackoverflow.com/comment/35774163
favorite count: 0
has comment: http://stackoverflow.com/comment/35773602

http://stackoverflow.com/comment/35739392
comment on: http://stackoverflow.com/q/23338581
has text: @Caleryn so List<String> ret = Arrays.asList(new String[] { "0","0","0","0" }); would work however I need the number of "0"'s to be dynamic - I am sorry if I did not make this clear! "the quality of your education equals the quality of your questions" - right
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/a/23385942
answers question: http://stackoverflow.com/q/23366710
has comment: http://stackoverflow.com/comment/35837463
downvote count: 0
has body: The Stagnation termination condition only aborts the evolution if the best fitness score in the population does not improve for a certain number of consecutive generations. It does not cut-off after a fixed number of generations from the start (for that you would use the GenerationCount condition), it only kicks in when the evolution appears to have stopped making progress. So if your population is performing well (by which I take it you mean that the fitness is continuing to improve) the stagnation condition is unlikely to be triggered. If you want something different you might need to write your own TerminationCondition. It's just a single method that takes the PopulationData as an argument so that you can make decisions based on that at the end of each generation. You just need to be able to define "rotten population" in terms of the mean and/or best fitness and the number of generations so far.
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/a/23406507
upvote count: 2
has body: A data structure is only an abstraction, a special way of representing data. They are just human-made constructs, which help in reducing complexity at the high-level, i.e. to not work in the low-level. An object may seem to mean the same thing, but the major difference between objects and data structures is that an object might abstract anything. It also offers behaviour. A data structure does not have any behaviour because it is just data-holding memory. The libraries classes such as Map, List,etc. are classes, which represent data structures. They implement and setup a data structure so that you can easily work with them in your programs by creating instances of them (i.e. objects).
downvote count: 1
answers question: http://stackoverflow.com/q/23406307
type: Answer
score: 1

http://stackoverflow.com/q/23446682
has body: Hi I am a beginning programmer and I think I have a simple question but yet i can't find the answer. I hope you can help me:D I have four classes in total but what I need to solve is in class Person. I have a simple method that needs thePrice parameter from class Product. But it does not work because i can't get access to this parameter. This is the method that the Person class uses to buy a product. The budget from a person has to be greater or equal to thePrice, if not > he can not buy the product. But he can only buy the product if he has not owned the product already. public class Person{ private String name; private double budget; private ArrayList&lt;Product&gt; allPossessions; private Product theProduct; //association with class product, I have all getters and setters etc. // the method::: public boolean Buy(Product p) { if (hasProduct(null) == true) { if (budget &gt;= Product.getThePrice()) { // getTheprice does not work, how do i get this working? How do i get this parameter from class product? return true; } return false; } return false; } This is class Product where I need to have thePrice, to create the method. public abstract class Product { protected String Design; protected int yearOfPurchase; protected double thePrice; } Thank you for your time and forgive my broken english! Thank you:)
answer count: 1
has title: Get a protected attribute from another class
tagged with: associations
tagged with: attributes
type: AnsweredQuestion
type: Question
tagged with: parameters
has answer: http://stackoverflow.com/a/23446707
tagged with: java
tagged with: eclipse
has comment: http://stackoverflow.com/comment/35939072
accepted answer: http://stackoverflow.com/a/23446707
score: 0

http://stackoverflow.com/a/23304771
upvote count: 2
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/23297194
has body: As as I said in the talk, dump the structure and the reference data. These are the things you will be managing using Flyway. The application data doesn't need to be dumped. What you want is the structure and the reference data to be in sync, not the application data.
answers question: http://stackoverflow.com/q/23297194
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/35703119

http://stackoverflow.com/q/23398450
tagged with: binary-search-tree
has comment: http://stackoverflow.com/comment/35849974
has title: Binary Search Tree Cloning - Java
accepted answer: http://stackoverflow.com/a/23400408
downvote count: 1
type: AnsweredQuestion
tagged with: recursion
tagged with: clone
tagged with: java
has comment: http://stackoverflow.com/comment/35852034
score: -1
has comment: http://stackoverflow.com/comment/35852907
has comment: http://stackoverflow.com/comment/35851750
type: Question
has comment: http://stackoverflow.com/comment/35852352
upvote count: 0
has comment: http://stackoverflow.com/comment/35851570
answer count: 1
has comment: http://stackoverflow.com/comment/35852512
favorite count: 0
has comment: http://stackoverflow.com/comment/35852126
has comment: http://stackoverflow.com/comment/35853008
has comment: http://stackoverflow.com/comment/35849682
has comment: http://stackoverflow.com/comment/35851861
has body: It's a homework problem. we need to build a method in java that clones a given binary search tree through recursion, ive looked up several examples online, the problem being that the program our instructor asked us to write was in what he called the Modern method, whereby rather than checking for null in each method, a tree is constructed using Dynamic dispatch from an Interface Node, connected to two subclasses nil(representing an empty node and the necessary methods to deal with an instance of an empty Node) and Vertex, a filled node and its affiliate methods. im confused on how to structure the recursion to clone the nodes, and construct the nodes to hold the cloned info. this being homework im obviously not looking for an answer but i really need some help with this. interface Node&lt;T extends Comparable&lt;T&gt;&gt; { public int size();//return the number of values in the tree public boolean empty();//true if tree is empty nil public Node&lt;T&gt; insert(T x);// insert something into a binary search tree, return the node it was inserted into public vertex&lt;T&gt; search(T x);//search for a given value and return the vertex ( filled node ) it exists in public int depth();//returns the greatest depth of the tree public void inorder(); //public Node&lt;T&gt; Attack_of_the_clones(); } //note that insert must be used as in t = t.insert(x) class nil&lt;T extends Comparable&lt;T&gt;&gt; implements Node&lt;T&gt; //empty tree { public int size() {return 0;}// empty node, therefore of size zero public boolean empty() { return true; }//its and empty node, duh public Node&lt;T&gt; insert(T x) { return new vertex&lt;T&gt;(x); }// returns a Tpe Node for inserting a given value into a node (thereby creating a //vertex containing said inserted value) public vertex&lt;T&gt; search (T x) { return null; }//RETURNS NULL IN SEARCHING FOR A GIVE VALUE BECAUSE NODES OF TPE nIL ARE INHERENTLY empty public int depth() { return 0; } public void inorder() { System.out.print("0");} //pu…
has comment: http://stackoverflow.com/comment/35849935
has answer: http://stackoverflow.com/a/23400408
has comment: http://stackoverflow.com/comment/35853184

http://stackoverflow.com/q/23421306
has answer: http://stackoverflow.com/a/23421566
answer count: 4
type: UnansweredQuestion
score: 1
has comment: http://stackoverflow.com/comment/35892414
has comment: http://stackoverflow.com/comment/35892441
has comment: http://stackoverflow.com/comment/35892412
type: Question
has body: Let us suppose we have the following string: String s1 = "This is a very long string which needs to be broken" If the string's length is more than 30 characters, the string needs to be broken down so that each line should not contain more than 30 characters. After splitting the output should be: "This is a very long string whi ch needs to be broken" I know I can use String.split(), but it doesn't suit my requirement. What are the other possible ways to split it?
tagged with: java
has comment: http://stackoverflow.com/comment/35892757
has comment: http://stackoverflow.com/comment/35892350
has answer: http://stackoverflow.com/a/23421503
has comment: http://stackoverflow.com/comment/35892353
has answer: http://stackoverflow.com/a/28211327
has answer: http://stackoverflow.com/a/23421405
has title: Splitting a string over multiple lines?
upvote count: 6
tagged with: string
favorite count: 0
downvote count: 5
has comment: http://stackoverflow.com/comment/35892410

http://stackoverflow.com/comment/35943753
score: 0
has text: Sorry, the logcat doesn't tell us what's wrong. At this point, I'd just set a breakpoint on hasFlash/isFlashOn, and go through it to see if the resulting value matches your expectation at each step. That will tell you what you need to write in onResume()
type: Comment
comment on: http://stackoverflow.com/a/23397121
type: AnswerComment

http://stackoverflow.com/a/23311685
has comment: http://stackoverflow.com/comment/35689544
type: Answer
has body: You can use Javascript to evaluate the whole expression: ScriptEngineManager manager = new ScriptEngineManager(); ScriptEngine engine = manager.getEngineByName("JavaScript"); String exp = "((2+100)*5)*7"; System.out.println(engine.eval(exp));
answers question: http://stackoverflow.com/q/23311653
score: 0

http://stackoverflow.com/comment/35818656
type: Comment
score: 0
type: QuestionComment
has text: Which Java version you are using? If it is 1.7 change it to 1.6. It fix problem
comment on: http://stackoverflow.com/q/23381767

http://stackoverflow.com/q/23374688
tagged with: hashmap
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/35806406
has comment: http://stackoverflow.com/comment/35806495
has body: I'm using Hashmap in my code to save some datas. I'm using following code HashMap&lt;Integer,ArrayList&lt;Friends&gt;&gt; friendsHashMap = new HashMap&lt;Integer, ArrayList&lt;Friends&gt;&gt;(); ... ... ArrayList&lt;Friends&gt; friendsArrayList = new ArrayList&lt;Friends&gt;(); JSONArray jsonArray = (JSONArray) response.get("friends"); for (int i=0; i&lt;jsonArray.length(); i++){ JSONObject jsonObject = jsonArray.getJSONObject(i); Friend friend = new Friend(jsonObject); friendsArrayList.add(friend); } friendsHashMap.put(id,friendsArrayList); //Adding data to hash map Log.d("friendsHashMap",friendsHashMap.toString()); Log.d("friendsArrayList ",friendsArrayList.size()+""); //Till this line previously loaded data remain normal friendsLocationMapFragment.drawMap(friendsArrayList); //Once this line is executed the previously added data in the hashmap value changes to empty array. What mistake am I doing?
accepted answer: http://stackoverflow.com/a/23374987
has comment: http://stackoverflow.com/comment/35806125
tagged with: android
has title: Hashmap value changes during execution
has comment: http://stackoverflow.com/comment/35806205
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23374987
has comment: http://stackoverflow.com/comment/35806135
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/35806029

http://stackoverflow.com/comment/35796914
has text: @Dan Sorry for my misleading first answer, I thought there was a paren problem; however, does this error happen if you define the comparator outside `.sorted()`?
comment on: http://stackoverflow.com/a/23369943
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/66795648
score: 3
downvote count: 0
answers question: http://stackoverflow.com/q/23388468
type: Answer
upvote count: 3
has body: in Kotlin fun getMonthByNumber(monthnum:Int):String { val c = Calendar.getInstance() val month_date = SimpleDateFormat("MMMM") c[Calendar.MONTH] = monthnum-1 return month_date.format(c.time) } thank you

http://stackoverflow.com/q/23292671
tagged with: mongodb
answer count: 2
score: 0
tagged with: api
accepted answer: http://stackoverflow.com/a/23293999
has answer: http://stackoverflow.com/a/23292973
has answer: http://stackoverflow.com/a/23293999
type: AnsweredQuestion
tagged with: java
has body: I am new to mongodb java api. I am trying to perform queries to my database. I ve read the database found the collections in it and I want to retrieve characteristics of users. My code: ServerAddress serverAdr; serverAdr = new ServerAddress(".. .. .., ...); Twitter twitter = null; MongoOptions options = new MongoOptions(); options.connectionsPerHost = 10; MongoClient mongoClient = new MongoClient(.. ... ...", ...); DB db = mongoClient.getDB("trendSetters"); System.out.println("Connect to database successfully"); //JSONObject content = getJSONFromFile("user.json"); Mongo mongo = null; Set&lt;String&gt; colls = db.getCollectionNames(); mongo = new Mongo(serverAdr, options); mongo.setWriteConcern(WriteConcern.SAFE); DB db_se = mongo.getDB("iti_se"); DBCollection incollection = db_se.getCollection("cms_users_unique"); DBCollection outcollection = db_se.getCollection("cms_users_features"); for (String s : colls) { System.out.println(s); } Now I want to perform queries to retrieve from all ids the usernames for example. How is it possible to do so in java mongodb API? EDIT: What i ve tried BasicDBObject query = new BasicDBObject(); DBCursor cursor; query = new BasicDBObject("followers", new BasicDBObject("$gt", 1)); cursor = incollection.find(query); while(cursor.hasNext()){ System.out.println(cursor.next()); } However, it doesnot return nothing.
has title: Queries in java mongodb API
possible better answer: http://stackoverflow.com/a/23292973
type: Question

http://stackoverflow.com/a/23377848
has body: If you look at http://docs.oracle.com/javase/7/docs/api/java/lang/StringBuffer.html#reverse() you will see that reverse returns a new StringBuffer so change your code to sb = sb.reverse(); Also as you are using Intergers not Doubles, then why are you casting the char to a double? try int x = Character.getNumericValue(sb.charAt(i)); out += x * Math.pow(3,i);
score: 2
upvote count: 2
accepted answer of: http://stackoverflow.com/q/23377814
answers question: http://stackoverflow.com/q/23377814
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/35812137
type: Answer

http://stackoverflow.com/comment/35877634
has text: No, it's not since he doesnt show the default statement and thishow it's not the same as the if statement. the default should be used (see my answer) to get all cases which are not left, right, forward, back. In this case myFinch.quit(). AND do nor forget to mention that he requires JDK 7 or above to make sure the switch can handle strings.
comment on: http://stackoverflow.com/a/23412857
type: Comment
score: 1
type: AnswerComment

http://stackoverflow.com/q/23378451
has answer: http://stackoverflow.com/a/23389659
type: UnansweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/23378573
has comment: http://stackoverflow.com/comment/35812901
tagged with: eclipse
has body: Whenever I try to do anything with my eclipse kepler I get this error: Errors occurred during the build. Errors running builder 'Maven Project Builder' on project 'PcsOne-Persistence'. Could not calculate build plan: Plugin org.apache.maven.plugins:maven-resources-plugin:2.5 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-resources-plugin:jar:2.5 Plugin org.apache.maven.plugins:maven-resources-plugin:2.5 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-resources-plugin:jar:2.5 Could not calculate build plan: Plugin org.apache.maven.plugins:maven-resources-plugin:2.5 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-resources-plugin:jar:2.5 Plugin org.apache.maven.plugins:maven-resources-plugin:2.5 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-resources-plugin:jar:2.5 I have tried out everything under the sky to solve this issue with no success: Examples: I have tried to uninstall and reinstall eclipse. Clean and install projects. Blow up .m2 repo and update all dependencies afresh. Install Maven plugin for eclipse (shows no updates for kepler) No matter what I do I get this error which was NOT existent in the very same setup few days back. It popped up out of nowhere. What possibly could have gone wrong here? UPDATE: Here is my Pom.xml 4.0.0 com.mycomp.groupid MyProject-1.0 1.0-SNAPSHOT
score: 0
has title: General Eclipse Maven Error?
answer count: 2
tagged with: maven

http://stackoverflow.com/q/23340414
tagged with: generics
has comment: http://stackoverflow.com/comment/35742358
has comment: http://stackoverflow.com/comment/35743276
answer count: 2
has title: Java generics inheritance warning
has comment: http://stackoverflow.com/comment/35742907
downvote count: 1
has comment: http://stackoverflow.com/comment/35742843
tagged with: java
has answer: http://stackoverflow.com/a/23341175
possible better answer: http://stackoverflow.com/a/23341115
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23341115
tagged with: inheritance
favorite count: 0
upvote count: 8
type: Question
has body: The foo method in following example gives us a warning, while bar not? public class X { static class Y {} static class Z extends Y {} Y y = new Y(); &lt;T extends Y&gt; T foo() { return (T) y; // warning - Unchecked cast from X.Y to T } Z bar() { return (Z) y; // compiles fine } }
accepted answer: http://stackoverflow.com/a/23341175
linked to: http://stackoverflow.com/q/380813
has comment: http://stackoverflow.com/comment/35741777
score: 7

http://stackoverflow.com/comment/35949014
comment on: http://stackoverflow.com/a/23451677
type: AnswerComment
has text: That means a *proper* Swing based application has a combination of SwingWorker and basic Thread/Runnable for it to run *smooth*. That's just useless and the reason I paid more attention - because it was directed by JavaDoc with the basis "Swing isn't threadsafe"...
score: 0
type: Comment

http://stackoverflow.com/q/23336894
upvote count: 1
tagged with: string
favorite count: 0
has answer: http://stackoverflow.com/a/67224805
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23336949
has body: I found some code that can be used to perform a binary search on an array of integers, and I am trying to change it so that I can use it on an array of strings instead. Here is what I have so far: import edu.princeton.cs.introcs.In; import edu.princeton.cs.introcs.StdIn; import edu.princeton.cs.introcs.StdOut; import java.util.Arrays; public class BinarySearch { /** * This class should not be instantiated. */ private BinarySearch() { } /** * Searches for the integer key in the sorted array a[]. * @param key the search key * @param a the array of integers, must be sorted in ascending order * @return index of key in array a[] if present; -1 if not present */ public static int rank(String key, String[] a) { int lo = 0; int hi = a.length - 1; int steps = 0; while (lo &lt;= hi) { steps = steps + 1; // this will keep count of the number of steps needed // Key is in a[lo..hi] or not present. int mid = lo + (hi - lo) / 2; if (key &lt; a[mid]) { hi = mid - 1; } else if (key &gt; a[mid]) { lo = mid + 1; } else return mid; } return steps; } /** * Reads in a sequence of integers from the whitelist file, specified as * a command-line argument. Reads in integers from standard input and * prints to standard output those integers that do *not* appear in the file. * @param args */ public static void main(String[] args) { // read the integers from a file In in = new In("C:\\Users\\Owner\\Desktop\\EnglishWordList.txt"); String[] whitelist = in.readAllStrings(); // sort the array Arrays.sort(whitelist); // read integer key from standard input; print if not in whitelist while (!StdIn.isEmpty()) { String key = StdIn.readString(); if (rank(key, whitelist) == -1) StdOut.println(key); } } } I am getting an error in the rank() method on both if statements. It states that I cannot use the operator "&lt;" and ">" for strings, meaning that its not looking at ASCII code. How can I fix this problem? There may be other issues, but this is the only thing that is highlighted by my IDE. Please let me…
tagged with: java
type: Question
has title: Java : Binary Search for String Arrays
tagged with: arrays
score: -1
tagged with: binary-search
has answer: http://stackoverflow.com/a/23337262
downvote count: 2
answer count: 3

http://stackoverflow.com/q/23367803
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/23367967
accepted answer: http://stackoverflow.com/a/23368056
has comment: http://stackoverflow.com/comment/35804589
has comment: http://stackoverflow.com/comment/35792440
type: Question
has comment: http://stackoverflow.com/comment/35792289
answer count: 3
possible better answer: http://stackoverflow.com/a/23367871
downvote count: 5
has answer: http://stackoverflow.com/a/23367871
favorite count: 0
has answer: http://stackoverflow.com/a/23368056
has title: need to store value after passing to method for latter check
score: -4
upvote count: 1
has comment: http://stackoverflow.com/comment/35803274
has body: I am passing few values to mail method for sending the details like below private static String getTeam(String Team, List&lt;String&gt; prioritys1, String number,String description ) { StringBuilder builder1 = new StringBuilder(); for (String v : prioritys1) { if ( v == "1") { Integer cnt1 = count1.get(new Team(Team, v,number,description)); if (cnt1 == null) { cnt1 = 0; } else if (cnt1 !=0){ cnt1 = 1; mail1(Team,v,number,description); }} else if ( v == "3") { Integer cnt1 = count1.get(new Team(Team, v,number,description)); if (cnt1 == null) { cnt1 = 0; } else if (cnt1 !=0){ cnt1 = 1; mail1(Team,v,number,description); }} } return builder1.toString(); } I tried to store in arrays but it didnt worked. I after pass above parameters, i need to store the value of the number. i need to store the number so that next time while passing the parameters i need to check first whether the number is already passed or not if not then only i need to pass to mail. can any one help on this

http://stackoverflow.com/comment/35721227
score: 0
type: Comment
type: QuestionComment
has text: Yeah, for some reason nextLine would always skip stock #1 and I created another Scanner object and it fixed the problem
comment on: http://stackoverflow.com/q/23328594

http://stackoverflow.com/comment/35925461
has text: I'm open to using different synchronization primitives - but I think I have to let the tasks complete because of the resources they use, even if after one task returns true the result of the second is no longer of interest.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23438879

http://stackoverflow.com/comment/69888364
comment on: http://stackoverflow.com/a/41291310
has text: And `HttpServletRequest` is the same as `HttpContext.Current`?
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/23306915
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/23315761
accepted answer: http://stackoverflow.com/a/23315761
upvote count: 1
type: Question
has body: I am having serious version issues in Java, Lucene based search engine. I have modified and merged the code from too many sources on the internet (relied on this one the most http://ipl.cs.aueb.gr/stougiannis/bm25_2.html) which is most likely why the code is not working. Also, I have referenced lucene-analyzers-4.5.1.jar, lucence-core-4.5.1.jar,lucene-demo-4.5.1.jar, lucene-queryparser-4.5.1.jar,lucene-BM25-1.0.jar,lucene core of 2.9,2.4 (as mentioned in the instructions) and 3.0.3. this is one of the simple working codes without BM25 which i modified to include BM25 scoring and to add documents to index: import org.apache.lucene.analysis.standard.StandardAnalyzer; import org.apache.lucene.document.Document; import org.apache.lucene.document.Field; import org.apache.lucene.document.StringField; import org.apache.lucene.document.TextField; import org.apache.lucene.index.DirectoryReader; import org.apache.lucene.index.IndexReader; import org.apache.lucene.index.IndexWriter; import org.apache.lucene.index.IndexWriterConfig; import org.apache.lucene.queryparser.classic.ParseException; import org.apache.lucene.queryparser.classic.QueryParser; import org.apache.lucene.search.IndexSearcher; import org.apache.lucene.search.Query; import org.apache.lucene.search.similarities.Similarity; import org.apache.lucene.search.ScoreDoc; import org.apache.lucene.search.TopScoreDocCollector; import org.apache.lucene.store.Directory; import org.apache.lucene.store.RAMDirectory; import org.apache.lucene.util.Version; import org.apache.lucene.analysis.*; import org.apache.lucene.index.*; import org.apache.lucene.search.*; import org.apache.lucene.store.*; import org.apache.lucene.util.*; import org.apache.lucene.queryparser.*; import org.ninit.models.bm25.*;//5 import java.io.IOException; public class lucene12 { public static void main(String[] args) throws IOException, ParseException { // 0. Specify the analyzer for tokenizing text. // The same analyzer should be used for indexing and se…
tagged with: lucene
has title: Version problems and errors in Java, Lucene , BM25 based search engine
tagged with: apache
downvote count: 0
answer count: 1
favorite count: 0
tagged with: search-engine
type: AnsweredQuestion

http://stackoverflow.com/comment/35842568
type: AnswerComment
has text: :thank you friend.but i need to get value from MultipartEntity.i have updated my Question.please help me
type: Comment
comment on: http://stackoverflow.com/a/23394314
score: 0

http://stackoverflow.com/q/23422213
has body: i have written a java program which access the system file.But it is showing error java.io.FileNotFoundException: /sys/kernel/debug/usb/usbmon/6u (Permission denied) i have change the permission of 6u to 777 but it is showing same problem again and again.Any help toward this will be helpful.Thanks in advance
tagged with: java
tagged with: usb
tagged with: eclipse
has answer: http://stackoverflow.com/a/23422888
type: Question
answer count: 2
score: 0
tagged with: linux
has title: how to run eclipse as superuser in ubuntu
has answer: http://stackoverflow.com/a/76283196
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35894313

http://stackoverflow.com/q/23446640
has title: Dynamic Image size in Jasper Report
answer count: 1
has comment: http://stackoverflow.com/comment/36031750
score: 0
has answer: http://stackoverflow.com/a/23594503
type: UnansweredQuestion
tagged with: java
has body: I am trying to print a Jasper Report with a image. Image is displayed dynamically using a parameter. Image is printing fine. But I need to output the image size dynamically too. How can I pass the the image size (in inch) as a parameter and get my expected output? &lt;image&gt; &lt;reportElement uuid="a4ed8a3a-827e-494c-ba8d-7276007941c7" x="0" y="0" width="555" height="608"/&gt; &lt;imageExpression&gt;&lt;![CDATA[$P{IMAGE_LOCATION}]]&gt;&lt;/imageExpression&gt; &lt;/image&gt;
type: Question
has comment: http://stackoverflow.com/comment/35941930
tagged with: jasper-reports

http://stackoverflow.com/q/23337223
upvote count: 2
answer count: 1
downvote count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/23344249
has body: Is there a way to call MongoDB's db.repairDatabase() function from the java driver? I tried the following : db.command("repairDatabase",1); but I had an errmsg with "bad option"
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23344249
score: 1
tagged with: java
has title: java mongodb repairdatabase ()
type: Question
tagged with: mongodb

http://stackoverflow.com/a/23445440
answers question: http://stackoverflow.com/q/23444451
type: Answer
has body: Cause of the error java.lang.NoClassDefFoundError: org/aopalliance/intercept/MethodInterceptor this class is a part of spring-aop library or aopaliance, make sure you have deployed all required jars.
has comment: http://stackoverflow.com/comment/35938172
has comment: http://stackoverflow.com/comment/35937483
type: AcceptedAnswer
downvote count: 0
score: 3
accepted answer of: http://stackoverflow.com/q/23444451
upvote count: 3

http://stackoverflow.com/comment/35708965
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23322325
has text: @GoldRoger: that answer has nothing to do with this question.

http://stackoverflow.com/comment/37402135
comment on: http://stackoverflow.com/a/23353174
type: AnswerComment
has text: I know this post is old: but if you use IntelliJ IDEA you can go inside `Android > Devices|Logcat` and add a new filter (http://i.imgur.com/145dtkx.png), and filter it for `by Log Message` here you can put `FATAL EXCEPTION` (http://i.imgur.com/HpELhaU.png) so in this Box you can read all `Exceptions` which are throw by your application. With this you don't need to clear logcat and do the crash again. I think Android Studio have this option too.
type: Comment
score: 44

http://stackoverflow.com/comment/35685707
score: 0
type: AnswerComment
type: Comment
has text: I have tried it in Firefox, Chrome as well as IE9. Its working fine for me when back button is clicked or page is refreshed. Please have a look at my last edit section.
comment on: http://stackoverflow.com/a/23293284

http://stackoverflow.com/comment/35915425
has text: Yes. The shorthand for this is "structural" typing vs "nominal" typing. Even though both lambdas are functions that consume a Card and return void, one is of type `Consumer<Card>` and the other is of type `OnHandCardAddedListener`. These types are incompatible, ergo, compile-time error.
type: Comment
comment on: http://stackoverflow.com/a/23426532
type: AnswerComment
score: 0

http://stackoverflow.com/q/23384210
score: 0
tagged with: api
answer count: 1
has title: ERROR - JDBCResourceDAO A SQLException error has occurred when trying to close result set or prepared
has answer: http://stackoverflow.com/a/23384473
accepted answer: http://stackoverflow.com/a/23384473
tagged with: jdbc
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/35822773
type: Question
tagged with: wso2
has comment: http://stackoverflow.com/comment/35822904
has body: I have setup WSO2 API Manager. It works perfectly. But now I came across below errors for no reason. How can I fix these? [2014-04-30 14:30:00,674] ERROR - JDBCResourceDAO A SQLException error has occurred when trying to close result set or prepared statement org.h2.jdbc.JdbcSQLException: File not found: "/opt/wso2am-1.6.0/repository/database/WSO2CARBON_DB.lobs.db/17.t22.lob.db" [90124-140] at org.h2.message.DbException.getJdbcSQLException(DbException.java:327) at org.h2.message.DbException.get(DbException.java:167) at org.h2.message.DbException.get(DbException.java:144) at org.h2.engine.Database.openFile(Database.java:443) at org.h2.value.ValueLob.getInputStream(ValueLob.java:610) at org.h2.jdbc.JdbcResultSet.getBinaryStream(JdbcResultSet.java:1020) at org.wso2.carbon.registry.core.jdbc.dao.JDBCResourceDAO.getContentStream(JDBCResourceDAO.java:553) at org.wso2.carbon.registry.core.jdbc.dao.JDBCResourceDAO.fillResourceContentWithNoUpdate(JDBCResourceDAO.java:1239) at org.wso2.carbon.registry.core.jdbc.dao.JDBCResourceDAO.fillResource(JDBCResourceDAO.java:271) at org.wso2.carbon.registry.core.jdbc.Repository.get(Repository.java:195) at org.wso2.carbon.registry.core.jdbc.EmbeddedRegistry.put(EmbeddedRegistry.java:689) at org.wso2.carbon.registry.core.caching.CacheBackedRegistry.put(CacheBackedRegistry.java:465) at org.wso2.carbon.registry.core.session.UserRegistry.put(UserRegistry.java:657) at org.wso2.carbon.theme.mgt.util.ThemeUtil.transferAllThemesToRegistry(ThemeUtil.java:139) at org.wso2.carbon.theme.mgt.util.ThemeUtil.transferAllThemesToRegistry(ThemeUtil.java:125) at org.wso2.carbon.theme.mgt.util.ThemeUtil.transferAllThemesToRegistry(ThemeUtil.java:125) at org.wso2.carbon.theme.mgt.util.ThemeUtil.loadResourceThemes(ThemeUtil.java:175) at org.wso2.carbon.theme.mgt.internal.TenantThemeMgtServiceComponent.activate(TenantThemeMgtServiceComponent.java:53) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(N…

http://stackoverflow.com/comment/35825625
has text: i'm not able to implement my decodeTask, could you help me? code is adapted.
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23341241

http://stackoverflow.com/q/23329020
answer count: 2
has title: JFrame displaying white when I place while loop
favorite count: 0
type: UnansweredQuestion
has body: I have added a while loop that will change between players as seen in the code below. Before I add this while loop it displays the grid, buttons, etc but when I add this loop the panel is just plain white. I have no idea why. import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.GridLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Random; import javax.security.auth.x500.X500Principal; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.SwingUtilities; import org.omg.CORBA.PRIVATE_MEMBER; public class Game { boolean p1; private int counterY1 = 515, counterY2 = 515, counterY3 = 515, counterY4 = 515; boolean playerTurn = true; boolean playerTurn2 = false; boolean moveLoop = true; public void moveC1Up() { counterY1 -= 51 * diceRoll(); } public void moveC2Up() { counterY2 -= 51 * diceRoll(); } public void moveC3Up() { counterY3 -= 51 * diceRoll(); } public void moveC4Up() { counterY4 -= 51 * diceRoll(); } public int diceRoll() { int randGen = (int)(Math.random()*1) + 1; System.out.print(randGen); return randGen; } private JButton moveC1But, moveC2But, rollDiceButton; private JLabel amountRolledLabel; public Game() { JFrame window = new JFrame ("Main Game"); final JPanel firstPanel = new JPanel(new GridLayout(3,1)) { public void paintComponent(Graphics g) { Graphics2D g2d = (Graphics2D) g; super.paintComponent(g2d); int width = getWidth() / 3; int height = getHeight() / 11; for (int i = 0; i &lt; 4; i++) { g.drawLine(i * width, 0, i * width, getHeight()); } for (int i = 0; i &lt; 11; i++) { g.drawLine(0, i * height, getWidth(), i * height); } g.setColor(Color.DARK_GRAY); g.drawOval(220, counterY1, 40, 40); g.fillOval(220, counterY1, 40, 40); g.drawOval(300, counterY2, 40, 40); g.fillOval(300, counterY2, 40, 40); g.setColor(Color.LIGHT_GRAY); g.drawOval(41…
has answer: http://stackoverflow.com/a/23329055
tagged with: java
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/35721659
type: Question
has answer: http://stackoverflow.com/a/23329134
tagged with: jpanel
score: 0

http://stackoverflow.com/comment/35788733
type: Comment
type: QuestionComment
has text: any exception will halt the program immediately :)
score: 1
comment on: http://stackoverflow.com/q/23365869

http://stackoverflow.com/comment/35676801
type: Comment
comment on: http://stackoverflow.com/a/23304171
score: 0
has text: also, there has to be *some* kind of "name" or better yet, place, that the JVM needs in order to get to the object! I mean how else would it work? It needs some sort of <identifier> as stated so that it knows where in the memory it should look for it does it not?
type: AnswerComment

http://stackoverflow.com/q/23315109
tagged with: javafx-8
type: UnansweredQuestion
upvote count: 1
downvote count: 1
type: Question
tagged with: java
tagged with: javafx
has body: I've seen JavaFX8 has a DatePicker built-in. The thing is that I only need the calendar, without the textField. There's a way I can access only the Calendar view without the DatePicker or I have to make my own custom control?
score: 0
tagged with: custom-controls
answer count: 1
favorite count: 0
has title: JavaFX8 Calendar
has answer: http://stackoverflow.com/a/23342585

http://stackoverflow.com/a/23343721
upvote count: 1
has comment: http://stackoverflow.com/comment/35748266
downvote count: 0
has comment: http://stackoverflow.com/comment/35747992
answers question: http://stackoverflow.com/q/23343202
type: Answer
has body: If you know the fourth word in each line is supposed to be the version number just grab that word and get the first character. If its not necessarily the fourth word try using indexOf() on the line and then get the character before that, that is if you know for sure each line is set up this way. I meant to say if each line is known to have the format you showed above you should be able to use IndexOf() on the decimal. AAAAAA B Version 5(.)0.1 Or use split() to split white space and get each word parts = line.split(" ");
score: 1

http://stackoverflow.com/a/23330541
score: 6
upvote count: 6
has comment: http://stackoverflow.com/comment/35724472
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23330516
type: Answer
answers question: http://stackoverflow.com/q/23330516
has body: Just a guess, but centers has 1000 elements, and you only set 5 of them. Maybe the other 995 are null, giving you a HashSet with one more element than you expect (null). You can easily test this by printing the contents though: for (String s : uniqueCenters) { System.out.println("Got element: " + s); }
downvote count: 0

http://stackoverflow.com/q/23358239
linked to: http://stackoverflow.com/q/25441531
has title: Receive Android activity events from outside the activity?
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/23358369
upvote count: 3
tagged with: android
tagged with: events
has body: Is there a way for us to receive events such as onResume, onWindowFocusChanged, etc., from outside the activity? I would like to run some code when these events are raised in another class, which only has a reference to the activity. EDIT: In my case, I can't modify the Activity class, or override it in a subclass.
tagged with: android-activity
favorite count: 0
downvote count: 0
possible better answer: http://stackoverflow.com/a/23358369
type: AnsweredQuestion
score: 3
has answer: http://stackoverflow.com/a/24192945
tagged with: java
accepted answer: http://stackoverflow.com/a/24192945

http://stackoverflow.com/q/23356382
has body: Here I'm getting error while inserting the data to the database. I'm not getting any error until insert statement in Oracle or after that statement. package com.socket; import java.util.ArrayList; import java.io.Serializable; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.*; import java.sql.*; import oracle.jdbc.*; public class Message implements Serializable { private static final long serialVersionUID = 1L; public String type, sender, content, recipient; public Message(String type, String sender, String content, String recipient) { this.type = type; this.sender = sender; this.content = content; this.recipient = recipient; } @Override public String toString() { SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss"); Calendar cal = Calendar.getInstance(); String Current = sdf.format(cal.getTime()); String Content1 = content + Current; Connection conn = null; String driverName = "oracle.jdbc.OracleDriver"; String url = "jdbc:oracle:thin:@172.16.0.35:1521:orcl"; String username = "itn"; //SET USERNAME String password = "itn"; //SET PASSWORD try { if (conn == null) { Class.forName(driverName); conn = DriverManager.getConnection(url, username, password); String Query = "INSERT INTO ENTRIES (SERIALNO, TYPE, SENDER, CONTENT, TIMER, RECIPIENT, CREATEDON) VALUES ((Select max(SERIALNO)+1 from ENTRIES), '" + type + "', '" + sender + "', '" + content + "', TO_DATE('" + Current + "', 'DD/MM/YYYY HH24:MI:SS'), '" + recipient + "', TO_DATE('" + Current + "', 'DD/MM/YYYY HH24:MI:SS'))"; System.out.println(Query); Statement st = conn.createStatement(); st.executeUpdate("Query"); st.close(); } } catch (Throwable t) { System.out.println("error in setRepositoryConnection : " + t); //logger.log("Unable to set connection ", "Repository.java", "Repository", t, Logger.CRITICAL); } return "{type='" + type + "', sender='" + sender + "', contentx='" + Content1 + "', recipient='" + recipient + "'}"; } }
has title: Error in setRepositoryConnection : java.sql.SQLException: ORA-00900: invalid SQL statement
has answer: http://stackoverflow.com/a/23356511
downvote count: 2
upvote count: 1
type: Question
tagged with: ora-00900
tagged with: java
has comment: http://stackoverflow.com/comment/35771657
score: -1
has comment: http://stackoverflow.com/comment/35771693
tagged with: sql
answer count: 1
has comment: http://stackoverflow.com/comment/35771703
favorite count: 0
type: UnansweredQuestion
tagged with: jdbc

http://stackoverflow.com/comment/35918308
has text: +1 you should be put an [answer here too another repaint()](http://stackoverflow.com/questions/23434550/keyboard-not-inputing-anything-java)
score: 1
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23434769

http://stackoverflow.com/a/23448284
answers question: http://stackoverflow.com/q/23448238
has body: Use this way- import java.util.HashMap; public class NgramModel { private HashMap&lt;String,Integer&gt; ngram; public NgramModel() { ngram = new HashMap &lt;String, Integer&gt;(); ngram.put("aa", 2); } public HashMap&lt;String,Integer&gt; getValue() { return ngram; } } OR import java.util.HashMap; public class NgramModel { private HashMap&lt;String,Integer&gt; ngram = new HashMap &lt;String, Integer&gt;(); public NgramModel() { ngram.put("aa", 2); } public HashMap&lt;String,Integer&gt; getValue() { return ngram; } } Because, inside your constructor you are creating another local variable and defining it and not defining the class level member variable itself.
score: 0
type: Answer

http://stackoverflow.com/q/23313938
tagged with: tree
score: 1
has answer: http://stackoverflow.com/a/25106700
tagged with: java
answer count: 1
downvote count: 0
favorite count: 0
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/2241513
has title: LEVEL BY LEVEL of a Tree with Java
has comment: http://stackoverflow.com/comment/35694587
upvote count: 1
has body: How can I get all the elements of a Tree? public static &lt;E&gt; PositionList&lt;E&gt; width(Tree&lt;E&gt; t){ //I've initialized a queue and a PositionList&lt;E&gt; Queue&lt;E&gt; aux = new NodeQueue&lt;E&gt;(); PositionList&lt;E&gt; positionAux = new NodePositionList&lt;E&gt;(); Position&lt;E&gt; pointer = t.root(); ... but then I don't know how to continue... Example: 1 | | 2 3 | | | | 4 5 6 7 Return a list [1,2,3, 4, 5, 6, 7]
type: Question

http://stackoverflow.com/comment/35808141
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23370092
has text: Are you saying no listener works, or is it that the key listener does work but it blocks the mouse listener?
score: 0

http://stackoverflow.com/comment/35835192
comment on: http://stackoverflow.com/a/23390571
type: Comment
has text: I would agree, being helpful to new members is the right way tp go imo as well
score: 0
type: AnswerComment

http://stackoverflow.com/comment/35765412
has text: See [this fine answer](http://stackoverflow.com/a/16106598/256196) for a discussion/explanation and simple code to do what you need. I would close this question as a duplicate, excerpt you don't explicitly ask for a singleton.
comment on: http://stackoverflow.com/q/23352084
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/35722861
comment on: http://stackoverflow.com/q/23329611
has text: Replace "in a row" with consecutively as I suggested in my edit.
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/36009148
has text: I solved the problem. Error was that the mTextView not given a id
comment on: http://stackoverflow.com/q/23449426
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23364360
type: Answer
upvote count: 3
downvote count: 1
has body: Variable arity comes last in determining the most specific method. The rules to determine which vararg method applies when there are several are defined in JLS 15.12.2.4 - here is an extract: One variable arity member method named m is more specific than another variable arity member method of the same name if either: [...] One member method has k parameters and the other has n parameters, where n ≥ k, and: The types of the parameters of the first method are U1, ..., Uk-1, Uk[]. The types of the parameters of the other method are T1, ..., Tn-1, Tn[]. For all j from 1 to n, Uj &lt;: Tj In your case, k = n, and U1[] = int[] and T1[] = long[] so the determination can be made if int &lt;: long or the opposite. In other words, the type taken into account is not int[] vs. long[] but int vs long. And it happens that int &lt;: long so the int... method should be chosen and it should compile. Conclusion: The code should (and does) compile fine with Java 7 but would not compile with Java 5 or 6. The code below prints int with Java 7: public class Test1 { public static void main(String[] args) { new Test1().m(1, 2); } int m(int... i) { System.out.println("int"); return 0; } long m(long... i) { System.out.println("long"); return 0; } }
score: 2
answers question: http://stackoverflow.com/q/23364092
has comment: http://stackoverflow.com/comment/35787113

http://stackoverflow.com/comment/35856881
comment on: http://stackoverflow.com/q/23402604
has text: I have tried both webview and the above uri method.The browser doesnt open the webpage.
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/23365852
tagged with: android
has body: I want to convert a string hex like 'a-f' in android with edittext. I have code like this. if(spinB1.getSelectedItem().equals("Desimal") &amp;&amp; spinB2.getSelectedItem().equals("Heksa")){ h = 0; h2 = ""; try { //String h4 = etB1.getText().toString(); h2 = Integer.toHexString(u); //String h3 = Integer.toString(Integer.parseInt(h4, 2),16); etB2.setText(("" + h2)); }catch(Exception e){ e.printStackTrace(); } } When I run this code, and I filled edit text with string like 'a-f' this code didn't work, but with number 0-9 it works. I always get this error: 04-29 08:54:58.330: E/AndroidRuntime(1650): FATAL EXCEPTION: main 04-29 08:54:58.330: E/AndroidRuntime(1650): Process: com.uzay.convv, PID: 1650 04-29 08:54:58.330: E/AndroidRuntime(1650): java.lang.NumberFormatException: Invalid int: "f" 04-29 08:54:58.330: E/AndroidRuntime(1650): at java.lang.Integer.invalidInt(Integer.java:137) 04-29 08:54:58.330: E/AndroidRuntime(1650): at java.lang.Integer.parse(Integer.java:374) 04-29 08:54:58.330: E/AndroidRuntime(1650): at java.lang.Integer.parseInt(Integer.java:365) 04-29 08:54:58.330: E/AndroidRuntime(1650): at java.lang.Integer.parseInt(Integer.java:331) 04-29 08:54:58.330: E/AndroidRuntime(1650): at com.uzay.convv.Sixth$1.onClick(Sixth.java:60) 04-29 08:54:58.330: E/AndroidRuntime(1650): at android.view.View.performClick(View.java:4424) 04-29 08:54:58.330: E/AndroidRuntime(1650): at android.view.View$PerformClick.run(View.java:18383) 04-29 08:54:58.330: E/AndroidRuntime(1650): at android.os.Handler.handleCallback(Handler.java:733) 04-29 08:54:58.330: E/AndroidRuntime(1650): at android.os.Handler.dispatchMessage(Handler.java:95) 04-29 08:54:58.330: E/AndroidRuntime(1650): at android.os.Looper.loop(Looper.java:137) 04-29 08:54:58.330: E/AndroidRuntime(1650): at android.app.ActivityThread.main(ActivityThread.java:4998) 04-29 08:54:58.330: E/AndroidRuntime(1650): at java.lang.reflect.Method.invokeNative(Native Method) 04-29 08:54:58.330: E/AndroidRuntime(1650): at java.lang.r…
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/23365929
accepted answer: http://stackoverflow.com/a/23365897
tagged with: java
downvote count: 3
has answer: http://stackoverflow.com/a/23365929
upvote count: 1
tagged with: eclipse
type: Question
has comment: http://stackoverflow.com/comment/35788587
score: -2
answer count: 3
has title: how to convert string format to hex
has answer: http://stackoverflow.com/a/23365897
favorite count: 0
has answer: http://stackoverflow.com/a/23366281

http://stackoverflow.com/a/23430469
upvote count: 1
type: Answer
has body: You have to configure project job and modify Build Triggers, choose Build periodically and set the Schedule field. Moreover the Goals and oprtions field has to be set "clean leslie"
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/23428868
answers question: http://stackoverflow.com/q/23428868
type: AcceptedAnswer

http://stackoverflow.com/comment/35836858
score: 0
type: Comment
type: QuestionComment
has text: You can use DataModel (for datatable) and inside it you can implement fetch mechanism
comment on: http://stackoverflow.com/q/23387541

http://stackoverflow.com/q/23421818
has answer: http://stackoverflow.com/a/26037685
tagged with: hbase
has comment: http://stackoverflow.com/comment/35955669
has comment: http://stackoverflow.com/comment/35924217
has title: loading 1GB data into hbase taking 1 hour
possible better answer: http://stackoverflow.com/a/36977547
has body: I want to load 1GB (10 Million Records) CSV file into Hbase. I wrote Map-Reduce Program for it. My Code is working fine but taking 1 hour to complete. Last Reducer is taking more than half an hour time. Could anyone please help me out? My Code is as follows: Driver.Java package com.cloudera.examples.hbase.bulkimport; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.Path; import org.apache.hadoop.hbase.HBaseConfiguration; import org.apache.hadoop.hbase.KeyValue; import org.apache.hadoop.hbase.client.HTable; import org.apache.hadoop.hbase.io.ImmutableBytesWritable; import org.apache.hadoop.hbase.mapreduce.HFileOutputFormat; import org.apache.hadoop.mapreduce.Job; import org.apache.hadoop.mapreduce.lib.input.FileInputFormat; import org.apache.hadoop.mapreduce.lib.input.TextInputFormat; import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat; /** * HBase bulk import example * Data preparation MapReduce job driver * * args[0]: HDFS input path * args[1]: HDFS output path * args[2]: HBase table name * */ public class Driver { public static void main(String[] args) throws Exception { Configuration conf = new Configuration(); /* * NBA Final 2010 game 1 tip-off time (seconds from epoch) * Thu, 03 Jun 2010 18:00:00 PDT */ // conf.setInt("epoch.seconds.tipoff", 1275613200); conf.set("hbase.table.name", args[2]); // Load hbase-site.xml HBaseConfiguration.addHbaseResources(conf); Job job = new Job(conf, "HBase Bulk Import Example"); job.setJarByClass(HBaseKVMapper.class); job.setMapperClass(HBaseKVMapper.class); job.setMapOutputKeyClass(ImmutableBytesWritable.class); job.setMapOutputValueClass(KeyValue.class); job.setInputFormatClass(TextInputFormat.class); HTable hTable = new HTable(conf, args[2]); // Auto configure partitioner and reducer HFileOutputFormat.configureIncrementalLoad(job, hTable); FileInputFormat.addInputPath(job, new Path(args[0])); FileOutputFormat.setOutputPath(job, new Path(args[1])); job.waitForCompletion(true); // Load generate…
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35893898
has comment: http://stackoverflow.com/comment/35896736
tagged with: java
has comment: http://stackoverflow.com/comment/35969161
tagged with: mapreduce
type: Question
tagged with: hadoop
has answer: http://stackoverflow.com/a/23872146
accepted answer: http://stackoverflow.com/a/23872146
score: 5
tagged with: hadoop2
upvote count: 6
answer count: 3
downvote count: 1
has comment: http://stackoverflow.com/comment/35902642
has comment: http://stackoverflow.com/comment/35895735
favorite count: 0
has comment: http://stackoverflow.com/comment/35952656
has answer: http://stackoverflow.com/a/36977547

http://stackoverflow.com/a/23380375
has comment: http://stackoverflow.com/comment/37006244
downvote count: 0
has comment: http://stackoverflow.com/comment/35815749
score: 3
type: Answer
accepted answer of: http://stackoverflow.com/q/23380303
answers question: http://stackoverflow.com/q/23380303
upvote count: 3
has comment: http://stackoverflow.com/comment/35815796
has body: try this ... private ReentrantLock lock; private Condition isZero; public SimpleSemaphore (int permits, boolean fair) { mPermits = permits; lock = new ReentrantLock(fair); isZero = lock.newCondition(); }
type: AcceptedAnswer

http://stackoverflow.com/q/23364792
answer count: 1
linked to: http://stackoverflow.com/q/713550
has comment: http://stackoverflow.com/comment/35786700
has comment: http://stackoverflow.com/comment/35786945
tagged with: maven
type: AnsweredQuestion
tagged with: project-folder
score: 0
tagged with: java
has title: read / write Files in project folder
has comment: http://stackoverflow.com/comment/35792278
type: Question
has comment: http://stackoverflow.com/comment/35786625
has body: Hi I was wondering how to access files in the project folder in java/maven, i have thought about using src/main/resources, but i have been told it is a bad idea to write to files in this directory, and should only be used in configuration for the project, So i have created a new non source folder but i was wondering if there is a way to access this file in java without giving an absolute path, as i need to use it in different env. any help or other suitable suggestions would be great here thanks. i will be writing to the files at runtime. EDIT: i am using this to acces the file: private static final String ACTUAL_VALUES ="verification/actualCounterValues.csv"; where verification is a folder i have created in my project
has answer: http://stackoverflow.com/a/23364924
tagged with: file-io
accepted answer: http://stackoverflow.com/a/23364924
tagged with: io

http://stackoverflow.com/comment/35949090
score: 0
comment on: http://stackoverflow.com/q/23451640
type: Comment
type: QuestionComment
has text: I don't want to learn a dead feature, not do I want to waste time on it. So what do you recommend for [GUI instead of Swing](http://stackoverflow.com/questions/5828625/if-swing-is-deprecated-what-is-the-alternative) then? @BoratSagdiyev Are you referring to JSR for 7?

http://stackoverflow.com/q/23416943
tagged with: java
has comment: http://stackoverflow.com/comment/35884513
has comment: http://stackoverflow.com/comment/36436010
type: Question
has comment: http://stackoverflow.com/comment/35884500
accepted answer: http://stackoverflow.com/a/23709325
has comment: http://stackoverflow.com/comment/35900076
has comment: http://stackoverflow.com/comment/36435464
score: 0
tagged with: comparator
has answer: http://stackoverflow.com/a/23709325
answer count: 1
has title: Comparator of a generic class
has comment: http://stackoverflow.com/comment/36435937
has comment: http://stackoverflow.com/comment/35884658
tagged with: generics
has comment: http://stackoverflow.com/comment/36435984
has comment: http://stackoverflow.com/comment/35885601
has body: I have a generic class : class Card&lt;T extends Enum&lt;T&gt; &amp; Rank&gt; implements Comparable&lt;Card&lt;T&gt;&gt; Rank is java interface. I'm trying to make a Comparator instance in the Card class. public final static Comparator&lt;Card&gt; comparator = new Comparator&lt;Card&gt;() { ... } The previous line has a warning. Card is a raw type. References to generic type Card should be parameterized How can I declare the generic type of the Card class ?
type: AnsweredQuestion

android-widget
tags question: http://stackoverflow.com/q/23413480
type: Tag
tag name: android-widget
tags question: http://stackoverflow.com/q/23340255

http://stackoverflow.com/a/23301902
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23301867
has body: Get the old value first and concatenate. lblSource.setText(lblSource.getText() + functionChain);
type: Answer
accepted answer of: http://stackoverflow.com/q/23301867
upvote count: 4
score: 4

http://stackoverflow.com/q/23431535
type: AnsweredQuestion
tagged with: java
tagged with: multithreading
tagged with: spring-data
type: Question
has answer: http://stackoverflow.com/a/23431693
has answer: http://stackoverflow.com/a/23432007
has comment: http://stackoverflow.com/comment/35911406
accepted answer: http://stackoverflow.com/a/23432007
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/35911213
possible better answer: http://stackoverflow.com/a/23432476
tagged with: jpa
has body: I am running a utility class as a java application. The class read a csv file with 5 million records and tries to save about 125k records in database. Half way through i got heap space error. Full file takes about 5-6 hours to run. Does adding thread.sleep method help with cleaning up resources considering this is run as a java application? I am using spring data jpa to insert after every 1k rows. String strLine; List&lt;Provider&gt; providers = new ArrayList&lt;Provider&gt;(); int count = 0; while ((strLine = br.readLine()) != null) { String[] providerDetails = strLine.split(",(?=([^\"]*\"[^\"]*\")*[^\"]*$)"); if (providerDetails[31].substring(1, (providerDetails[31].length() - 1)).equals("MD") || providerDetails[31].substring(1, (providerDetails[31].length() - 1)).equals("DC")) { count++; // add provider to repository providers.add(convertToProvider(providerDetails)); if (count % 1000 == 0) { providerRepository.save(providers); providers.clear(); Thread.sleep(2000); } } } Are there any other optimizations i can do to fix memory issue. I am using eclipse and have given it plenty of memory -Xms128m -Xmx1536m -XX:MaxPermSize=768m -XX:-UseGCOverheadLimit
has answer: http://stackoverflow.com/a/23432476
tagged with: spring
has title: Does Thread.sleep reduce memory issues with reading and saving a big file

http://stackoverflow.com/comment/35848964
has text: Your `else {` and the `return` inside the `else {` is redundant.
type: Comment
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/23398154

http://stackoverflow.com/a/23387774
downvote count: 0
type: Answer
has body: Your Java model is going to look something like the following. A Part class that holds onto a list of other Part instances as well as some other data. @XmlRootElement @XmlAccessorType(XmlAccessType.FIELD) public class Part { @XmlElement(name="Part_Number"); private String partNo; @XmlElement(name="part") private List&lt;Part&gt; parts; } You may find the following articles from my blog helpful: http://blog.bdoughan.com/2011/06/using-jaxbs-xmlaccessortype-to.html http://blog.bdoughan.com/2012/07/jaxb-and-root-elements.html Namespace Qualification Since your XML document is namespace qualified you are going to need to factor this into your mapping metadata. I would recommend doing this with the package level @XmlSchema annotation. http://blog.bdoughan.com/2010/08/jaxb-namespaces.html
upvote count: 1
answers question: http://stackoverflow.com/q/23385941
score: 1
accepted answer of: http://stackoverflow.com/q/23385941
type: AcceptedAnswer

http://stackoverflow.com/a/23345173
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23345083
has body: Because when you catch you call continue and the loops goes straight to the next iteration. EDIT: silly me, you need to call hasNextInt() before any call to nextInt(). You probably exhausted the input and thus the same exception gets thrown over and over. Note that hasNextInt() will block if you are using the input stream. That will basically simulate a program that "waits" for user input.
has comment: http://stackoverflow.com/comment/35750961

http://stackoverflow.com/a/23708134
type: Answer
upvote count: 1
score: 1
has body: You can decrypt the data in Java with just the encrypted file text.enc and the key file key.bin, but you have two problems: openssl rand can output the value of a null byte or a newline character at any position, which will effectively truncate your password since the contents of -pass file: are read for just the first line of string data. The default key derivation is not that good. Read this question and answer over at security.stackexchange. There is more info about the key derivation in this answer. However, here is Ruby code that decrypts the file, which you can translate into Java: require 'openssl' enc = File.read('text.enc', :encoding =&gt; 'ASCII-8BIT') # OpenSSL's own file format salt = enc[8..15] ciphertext = enc[16..-1] k = File.read('key.bin', :encoding =&gt; 'ASCII-8BIT') k = k.split(0.chr)[0] # truncate at null byte like openssl would have done k = k.split("\n")[0] # truncate at newline like openssl would have done # Key and IV derivation d = OpenSSL::Digest::MD5.new d0 = d.digest(k + salt) d1 = d.digest(d0 + k + salt) # Compare this to the output when you use the -p argument to openssl enc puts "salt=#{salt.unpack('H*')[0].upcase}" puts "key=#{d0.unpack('H*')[0].upcase}" puts "iv =#{d1.unpack('H*')[0].upcase}" # Decrypt the ciphertext cipher = OpenSSL::Cipher.new('AES-128-CBC') cipher.decrypt cipher.key = d0 cipher.iv = d1 plaintext = cipher.update(ciphertext) + cipher.final puts plaintext
downvote count: 0
answers question: http://stackoverflow.com/q/23405759

http://stackoverflow.com/q/23382846
has title: Adding elements to a list
favorite count: 0
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/35820156
downvote count: 1
has answer: http://stackoverflow.com/a/23384153
tagged with: list
tagged with: algorithm
tagged with: java
answer count: 5
has comment: http://stackoverflow.com/comment/35820706
has comment: http://stackoverflow.com/comment/35820211
has answer: http://stackoverflow.com/a/23383075
has comment: http://stackoverflow.com/comment/35820391
tagged with: arrays
accepted answer: http://stackoverflow.com/a/23384153
has body: I have a list of some elements. List&lt;Integer&gt; list = new ArrayList&lt;Integer&gt;(); Assume the list contains values as below: 0,0,0,0,0,1,1,1,1,2,2,2,2,2,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4 How do I add a dummy element (E.g. -1) as a separator before each of the group? he result should be -1,0,0,0,0,0,-1,1,1,1,1,-1,2,2,2,2,2,-1,3,3,3,3,3,3,3,3,-1,4,4,4,4,4,4,4 How do I do that efficiently?
has answer: http://stackoverflow.com/a/23383213
possible better answer: http://stackoverflow.com/a/23383075
has comment: http://stackoverflow.com/comment/35820420
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23383711
has comment: http://stackoverflow.com/comment/35824854
has answer: http://stackoverflow.com/a/23383062
score: 1

http://stackoverflow.com/a/23460921
has comment: http://stackoverflow.com/comment/35968773
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35979189
downvote count: 0
has comment: http://stackoverflow.com/comment/35970463
accepted answer of: http://stackoverflow.com/q/23448848
answers question: http://stackoverflow.com/q/23448848
type: Answer
has body: you must call it with the right path if your path is like DrawOvalApplet\build\classes\drawovalapplet\DrawOvalInputs.class and your .html is in DrawOvalApplet\build\DrawOvalInputs.html call it ... ... much better your .html is in DrawOvalApplet\build\classes\DrawOvalInputs.html call it ... ... result : applet running You can call htmlconverter and let do it for you java -jar htmlconverter.jar -gui Result DrawOvalInputs.html
score: 2
upvote count: 2

http://stackoverflow.com/comment/44548783
type: AnswerComment
score: 0
type: Comment
has text: A simplified setting (I cannot give more details, sorry): consider 2 files, a file A that contains name,number-pairs, and a file B that contains numbers. We now count per name the amount of numbers that appear in file B. First, both types are converted to (number,content) key-value pairs. Then only matching number are kept. Then, they are projected to (name, number) key-value pairs and the amount of distinct numbers is calculated.
comment on: http://stackoverflow.com/a/27996217

http://stackoverflow.com/q/23298249
has title: Send email to myself using SMTP and Apache Camel
upvote count: 3
type: UnansweredQuestion
has body: I am trying to write an Apache Camel route for sending email to myself, based on Part 4 of this tutorial: https://camel.apache.org/tutorial-example-reportincident.html from("file://target/subfolder") .setHeader("subject", constant("new incident reported")) .convertBodyTo(String.class) // send the email .to("smtp://myID@localhost?password=&amp;to=myname@mycompany.com"); But I'm getting this, and no email in my inbox: 395 [main] DEBUG org.apache.camel.example.reportincident. ReportIncidentRoutesTest - Routing Rules are: [EventDrivenConsumerRoute[Endpoint[direct:start] -&gt; Delegate(Delegate(Pipeline[DeadLetterChannel[Delegate(setHeader(org.apache. camel.file.name, BeanExpression[bean:org.apache.camel.example.reportincident. FilenameGenerator@244aeb52 method: generateFilename])), RecipientList[log:org.apache.camel.DeadLetterChannel?level=error]], DeadLetterChannel[Delegate(sendTo(Endpoint[velocity:MailBody.vm])), RecipientList[log:org.apache.camel.DeadLetterChannel?level=error]], DeadLetterChannel[Delegate(sendTo(Endpoint[file://target/subfolder])), RecipientList[log:org.apache.camel.DeadLetterChannel?level=error]]]))], EventDrivenConsumerRoute[Endpoint[file://target/subfolder] -&gt; Delegate(Delegate(Pipeline[DeadLetterChannel[Delegate(setHeader(To, myname@mycompany.com)), RecipientList[log:org.apache.camel.DeadLetterChannel? level=error]], DeadLetterChannel[Delegate(setHeader(subject, new incident reported)), RecipientList[log:org.apache.camel.DeadLetterChannel?level=error]], DeadLetterChannel[Delegate(org.apache.camel.processor. ConvertBodyProcessor@6e79839), RecipientList[log:org.apache.camel.DeadLetterChannel?level=error]], DeadLetterChannel[Delegate(sendTo(Endpoint[smtp://myID@localhost? password=&amp;to=myname@mycompany.com])), RecipientList[log:org.apache.camel.DeadLetterChannel?level=error]]]))]] I'm not sure why, or how I can fix this problem. I also seem to be getting these warnings when I run the test: [WARNING] The POM for com.sun.xml.fastinfoset:FastInfo…
type: Question
score: 3
linked to: http://stackoverflow.com/q/4856307
has comment: http://stackoverflow.com/comment/35733497
tagged with: java
has comment: http://stackoverflow.com/comment/35728018
tagged with: apache-camel
has comment: http://stackoverflow.com/comment/35748693
tagged with: routes
downvote count: 0
answer count: 1
tagged with: smtp
linked to: http://stackoverflow.com/q/1822425
favorite count: 0
has comment: http://stackoverflow.com/comment/35742391
has answer: http://stackoverflow.com/a/23338113
has comment: http://stackoverflow.com/comment/35749936
has comment: http://stackoverflow.com/comment/35749725

http://stackoverflow.com/comment/35767549
type: QuestionComment
has text: Unfortunately guys, this is an example taken from my basic Java practices. No arguments can be done on whether practice A or B is better, or why this code is sampled; it's all dictatorially asserted that "here is an example, tell me what it does". Welcome to the American CS education.
score: 0
comment on: http://stackoverflow.com/q/23353468
type: Comment

http://stackoverflow.com/comment/134116524
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/70563213
has text: @Veswanth did you manage to catch it?

http://stackoverflow.com/comment/35898025
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/23424258
has text: Yes I understood your point. Indeed before creating this specific question I looked for similar question. At the end I find out that there are people precisely looking for exporting sklearn classifiers (without retraining) to Java codebase, such as this [one](http://stackoverflow.com/questions/17511968/python-scikit-learn-exporting-trained-classifier). Therefore I decided to loosen the requirements and accept the possibility of completely retraining my models ;)

http://stackoverflow.com/a/23434130
accepted answer of: http://stackoverflow.com/q/23433830
answers question: http://stackoverflow.com/q/23433830
type: AcceptedAnswer
has body: You are passing a custom layout in your ArrayAdapter. Here you should pass the resource id of the textview on which you want to show the text. Thats why it is giving this error. Just call the adapter this way. listview = (ListView) findViewById(R.id.listview); adapter = new ArrayAdapter&lt;String&gt;(MainActivity.this, R.layout.activity_main,R.id.tvname ); here R.id.tvname is the id of one of the textview in your activity_main.xml. Or you can create the custom adapter.
score: 0
type: Answer

http://stackoverflow.com/q/23394948
has title: How to deploy an application consisting of a front-end and back-end on one storage device
score: -1
tagged with: mysql
type: Question
answer count: 1
has comment: http://stackoverflow.com/comment/35842890
has body: I need to submit some software to the university I attend and this software must be runnable from a storage device. The software was designed with an MVC architectural structure and was implemented using Java for the frontend and MySQL CE for the backend. The bulk of my experience has been with front-end java development in Eclipse so I am quite uncertain about how to go about deployment when there is a database involved. This is actually the first 'real' application ive written which involves a database and my first attempt at implementing the the MVC pattern. Im only a student at this point so please bear with me. This is what I know: I can compress my java files into a jar and deploy it no problem (this I have done before) To get this program to work I had to include a MySQL connector so this must be provided but it seems like this will all be part of the compressed jar (I obviously have some uncertainties surrounding deployment, sorry) I wrote two scripts, one to create my database and one to populate it with test data and these must be provided somehow. Whoever is running my software must obviously have a MySQL CE version running on their system so this must be somehow provided I have searched around for a solution but I study by distance, so I don't really have any source of guidance aside from the awesome people on stackoverflow and the less helpful google search. Possible solutions in my head: somehow write an installer/configuration file similar to what is provided with commercial software (this is not my optimal choice due to the fact that I have 2 more weeks till submission and I am prepping for exams but if it is the only way please point me in the right direction .. its something I will need to know soon anyway) On my searches through Stack Overflow I saw something which suggested that another version of MySQL - MySQL lite or something similar, could be used in these situations (again not optimal due to the amount of rework involved, but if its got to b…
downvote count: 1
tagged with: deployment
favorite count: 0
upvote count: 0
accepted answer: http://stackoverflow.com/a/23395252
tagged with: backend
has comment: http://stackoverflow.com/comment/35842997
tagged with: model-view-controller
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23395252
tagged with: java

http://stackoverflow.com/comment/35847097
has text: Thank you all for your comments, I just added some code.
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23396700

http://stackoverflow.com/comment/35671571
comment on: http://stackoverflow.com/q/23301442
score: 0
type: QuestionComment
has text: Am using Oracle database only...
type: Comment

http://stackoverflow.com/q/23436086
upvote count: 1
type: Question
downvote count: 0
favorite count: 0
has body: I am using EJB 2.1 and weblogic 10.3. Am facing an issue with transactionality and am trying to configure my connection factory to ActiveMQXAConnectionFactory. I have setup my weblogic using this link. http://amadei.com.br/blog/index.php/connecting-weblogic-and-activemq I am using an MDB listener
type: UnansweredQuestion
has title: How to configure a connection factory in Foreign JMS Server in weblogic 10.3 to avtiveMQXAConnectionFactory
answer count: 0
score: 1
tagged with: java

http://stackoverflow.com/comment/35772707
has text: This wouldn't compile. Generic array creation is not allowed.
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/23356872
type: Comment

http://stackoverflow.com/q/23352876
has answer: http://stackoverflow.com/a/23352984
upvote count: 3
tagged with: java
has title: Searching a Min Binary Heap
answer count: 5
tagged with: algorithm
downvote count: 0
type: UnansweredQuestion
tagged with: logic
tagged with: heap
score: 3
has answer: http://stackoverflow.com/a/23352913
has answer: http://stackoverflow.com/a/23352975
favorite count: 0
has answer: http://stackoverflow.com/a/23353099
type: Question
has comment: http://stackoverflow.com/comment/35765651
has answer: http://stackoverflow.com/a/23353302
has body: I have to simply present an algorithm not in code, but in words to find the maximum value in a min binary heap. I argued that because a min binary heap contains the highest value at the bottom, if you begin your search at the end of the index rather than the beginning, you will find it right away rather than searching from the beginning. Does this make any sense in practice and theory? Thank you!

http://stackoverflow.com/a/23357991
has comment: http://stackoverflow.com/comment/35774368
upvote count: 4
score: 4
answers question: http://stackoverflow.com/q/23357919
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23357919
has body: @Override public void paintComponents(Graphics g) { System.out.println("CALLED"); super.paintComponents(g); Should be: @Override public void paintComponent(Graphics g) { System.out.println("CALLED"); super.paintComponent(g); Respect the paint chain. Don't override any method but paintComponent(Graphics) for any JComponent.
type: Answer

http://stackoverflow.com/comment/35912160
type: QuestionComment
comment on: http://stackoverflow.com/q/23432078
score: 0
has text: possible duplicate of [Java Generics type conversion puzzle](http://stackoverflow.com/questions/10555773/java-generics-type-conversion-puzzle)
type: Comment

http://stackoverflow.com/a/23380847
type: Answer
score: 7
upvote count: 7
has body: -Dmaven.test.skip=true is designed not to even compile the unit tests. If you want to build them but not run them, you could use the skipTests flag: mvn clean install -DskipTests=true or in its shorthand version: mvn clean install -DskipTests See also maven's documentation on skipping tests for the full details.
answers question: http://stackoverflow.com/q/23380808
downvote count: 0

http://stackoverflow.com/q/23397664
has comment: http://stackoverflow.com/comment/35848563
has comment: http://stackoverflow.com/comment/35848429
has answer: http://stackoverflow.com/a/23398429
has comment: http://stackoverflow.com/comment/35848783
answer count: 5
tagged with: android
has comment: http://stackoverflow.com/comment/35848496
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35848053
has answer: http://stackoverflow.com/a/66831683
has comment: http://stackoverflow.com/comment/35848189
tagged with: java
has comment: http://stackoverflow.com/comment/35849073
has comment: http://stackoverflow.com/comment/35848755
type: Question
has comment: http://stackoverflow.com/comment/35848132
has comment: http://stackoverflow.com/comment/35848695
has answer: http://stackoverflow.com/a/23398752
has comment: http://stackoverflow.com/comment/35849026
accepted answer: http://stackoverflow.com/a/23398752
has comment: http://stackoverflow.com/comment/35848885
has answer: http://stackoverflow.com/a/23406249
score: 5
has comment: http://stackoverflow.com/comment/35849246
possible better answer: http://stackoverflow.com/a/23398429
upvote count: 5
tagged with: closures
downvote count: 0
has answer: http://stackoverflow.com/a/23398767
tagged with: arraylist
has comment: http://stackoverflow.com/comment/35848217
has body: I have an AsyncTask that takes in context (used onPostExecute) and runs doInBackground to return an ArrayList of objects from a server. When I execute this I can see that doInBackground runs fine, however it is not passing the result on to onPostExecute. After much searching, I have yet to find an answer of how to return an ArrayList of objects in an AsyncTask. This is the object I'm creating in doInBackground and using onPostExecute: public class ServerTimeCard { public String eventNameInput; Boolean isLocation, isImage, isVoice; public ServerTimeCard(String eventNameInput, boolean isLocation, boolean isImage, boolean isVoice) { this.eventNameInput = eventNameInput; this.isLocation = isLocation; this.isImage = isImage; this.isVoice = isVoice; } } I'm executing the AsyncTask with new LoadFriendCards(context).execute(); in onCreate. Expected Output: doInBackground should return an ArrayList to onPostExecute Current Output: The ArrayList&lt;ServerTimeCard&gt; in onPostExecute has a size of zero when the same arraylist in doInBackground has a larger size. The following is the AsyncTask code. public class LoadFriendCards extends AsyncTask&lt;Void, Void, ArrayList&lt;ServerTimeCard&gt;&gt; { Context context; ArrayList&lt;ServerTimeCard&gt; result; public LoadFriendCards(Context context) { this.context = context; } @Override protected ArrayList&lt;ServerTimeCard&gt; doInBackground(Void... voids) { result = new ArrayList&lt;ServerTimeCard&gt;(); // ...a bunch of data retrieval goes on here... // querying parse for object info // adding a new object to the local ArrayList for all in db for (String friend : friendsListNames) { ParseQuery&lt;ParseObject&gt; query = ParseQuery.getQuery("TestObject"); query.whereEqualTo("accountName", friend+"@gmail.com"); query.findInBackground(new FindCallback&lt;ParseObject&gt;() { public void done(List&lt;ParseObject&gt; objects, ParseException e) { if (e == null) { for (ParseObject cardInfo : objects) { ServerTimeCard item = new ServerTime…
has comment: http://stackoverflow.com/comment/35848581
has title: Asynctask ArrayList object not passing from doInBackground to onPostExecute
has comment: http://stackoverflow.com/comment/35848971
has comment: http://stackoverflow.com/comment/35848622
has comment: http://stackoverflow.com/comment/35848600
favorite count: 0
tagged with: android-asynctask

http://stackoverflow.com/q/23354414
has answer: http://stackoverflow.com/a/23378335
score: 0
has comment: http://stackoverflow.com/comment/35769044
has comment: http://stackoverflow.com/comment/35789891
has comment: http://stackoverflow.com/comment/35812187
answer count: 3
has comment: http://stackoverflow.com/comment/35812245
has comment: http://stackoverflow.com/comment/35768587
has answer: http://stackoverflow.com/a/23354529
accepted answer: http://stackoverflow.com/a/23378335
tagged with: synchronization
possible better answer: http://stackoverflow.com/a/23354440
has comment: http://stackoverflow.com/comment/35768887
has answer: http://stackoverflow.com/a/23354440
has comment: http://stackoverflow.com/comment/35768631
has comment: http://stackoverflow.com/comment/35769753
has comment: http://stackoverflow.com/comment/35796912
type: AnsweredQuestion
tagged with: java
has body: Is there such thing as a "non-blocking lock" in Java? By that, I mean is there a way to retain the properties of synchronization (atomic protection and memory visibility - the latter can come later, BUT the first is the most important thing I'm looking for right now) but also have multiple threads not have to wait for the monitor of the object? What I'm looking for - just to be clear - is not CAS operations, but an implementation of, say, the synchronized keyword, or ReentrantLock that works like a Semaphore BUT with actual synchronization semantics that doesn't block threads to perform a certain action like invocations getters and setters.
has comment: http://stackoverflow.com/comment/35768388
has comment: http://stackoverflow.com/comment/35769277
has title: Non-blocking synchronizers?
type: Question
tagged with: nonblocking
has comment: http://stackoverflow.com/comment/35810352
tagged with: concurrency
has comment: http://stackoverflow.com/comment/35768242

http://stackoverflow.com/a/23314731
type: Answer
has comment: http://stackoverflow.com/comment/35695366
has comment: http://stackoverflow.com/comment/35695540
has comment: http://stackoverflow.com/comment/35695300
has comment: http://stackoverflow.com/comment/35695511
has body: Your Scanner is taking in a String instead of the variable. Instead of Scanner scan = new Scanner("empFile"); Try Scanner scan = new Scanner(empFile); From the docs Scanner(String source) Constructs a new Scanner that produces values scanned from the specified string. You're currently scanning the string "empFile" instead of the actual file currently.
has comment: http://stackoverflow.com/comment/35695440
has comment: http://stackoverflow.com/comment/35695319
answers question: http://stackoverflow.com/q/23314711
has comment: http://stackoverflow.com/comment/35695613
has comment: http://stackoverflow.com/comment/35695284
accepted answer of: http://stackoverflow.com/q/23314711
score: 0
has comment: http://stackoverflow.com/comment/35695656
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35695315

http://stackoverflow.com/a/23296708
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/23296041
has body: How Hibernate works with your bean depends on how you annotated it. If you annotate instance variables then Hibernate will use direct injection and bypass your Set methods. Otherwise, it will use your Set methods. Could it be that it is incorrectly converting your property name to a Set method name? Try changing the property name to something simpler (without that series of capital letters), and ensure that the case of the property in your projection is correct.
has comment: http://stackoverflow.com/comment/35690183
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/35663019

http://stackoverflow.com/q/23434161
score: 0
upvote count: 1
downvote count: 1
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/23436176
linked to: http://stackoverflow.com/q/2856835
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35916059
has comment: http://stackoverflow.com/comment/35916051
has title: disadvantage of using tmp variable while travessing for loop
has answer: http://stackoverflow.com/a/23436176
has body: I am doing some performance optimization for my java application and I am confuse about using the tmp variable to remove the method invocation in loop termination. Here is my situation: Vector myVector = new Vector(); // some code for (int i=0;i&lt;myVector.size();i++){ //some code here; } I want to use int tmp = myVector.size(); for(int i=0;i&lt;tmp;i++){ //some code here } What would be negative impact of using second scenario ? My application is pretty large and I am not sure when and where myVector is being updated.
has comment: http://stackoverflow.com/comment/35916144
type: Question
has comment: http://stackoverflow.com/comment/35917357
has comment: http://stackoverflow.com/comment/35916203
linked to: http://stackoverflow.com/q/1208320
tagged with: java
has comment: http://stackoverflow.com/comment/35916902
has comment: http://stackoverflow.com/comment/35916009

http://stackoverflow.com/comment/35681514
has text: Thanks for your answer. I just started "eclipse.exe" - > "New Android Application" - > it created new project with first activity and xml "Hello World", I didnt change anything and just run application and put results to analyzer and it show me this graph. I have tried it on other (older) version of Android device and leak was lower, but it is still too much for nearly empty application. There have to be be something - maybe it loads some default templates and I should delete it when I start new project. Now I only edit src folder, res folder and AndroidManifest.xml - anything else is default.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23291060

http://stackoverflow.com/q/23416123
has comment: http://stackoverflow.com/comment/35883121
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/35883025
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/23416294
upvote count: 1
tagged with: jsp
tagged with: web
has title: Using Spring MVC with twitter bootstrap
favorite count: 0
has answer: http://stackoverflow.com/a/23416325
accepted answer: http://stackoverflow.com/a/23416325
tagged with: spring
has body: I've viewed other questions on here relating to the topic, and am still having trouble using the twitter bootstrap with my Spring Web application. From my understanding these two should not be too complex to use together, that you should be able to place the css, js folders in your project and link them pretty simply. I've viewed the following, which both seem to use it differently: http://duckranger.com/2012/07/spring-mvc-and-twitter-bootstrap-customizing-the-input-fields/ https://github.com/priyatam/springmvc-bootstrap-showcase This is what my file hierarchy looks like: in my index.jsp file I am trying to link it: Fantastic Log-In page <link rel="stylesheet" href="<c:url value="/resources/css/bootstrap.css" />"/> But obviously I am doing something wrong because I get the following warning: WARN PageNotFound - No mapping found for HTTP request with URI [/SpringJDBC/resources/css/bootstrap.css] in DispatcherServlet with name 'dispatcherServlet' I am very new to spring development so a lot of this doesn't fully come across. I would appreciate any tips on how to get bootstrap working with my spring web application. Thank you.
downvote count: 0
possible better answer: http://stackoverflow.com/a/23416294
tagged with: twitter-bootstrap
type: AnsweredQuestion

http://stackoverflow.com/q/23393995
has body: I have a subclass of 'HorizontalScrollView' in which there are variable size images. I want to show two buttons left and right just below HorizontalScrollView. On clicking left button the horizontalscollView should scroll left by size of first non visible image on left side so now this image is visible and same with right button. I also want the respective button to disappear if end of the list is reached on that side. Can someone help me in doing this
type: Question
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/27815944
tagged with: android
has title: buttons for scrolling left and right in HorizontalScrollView in android
type: UnansweredQuestion
tagged with: scroll
upvote count: 1
tagged with: horizontal-scrolling
tagged with: android-layout
score: 1
tagged with: java

http://stackoverflow.com/q/23396421
favorite count: 0
has answer: http://stackoverflow.com/a/23396433
has title: When to use .length vs .length()
type: AnsweredQuestion
has body: Ok so I have this code: public class Test { public static void main(String[] args) { String[] people = {"Bob", "Billy", "Jim"}; int sum = 0; for(int i = 0; i &lt; people.length; i++) { sum += people[i].length(); } } } My question is why people[i].length() is .length() and not .length. I thought to get the length of an array you use .length and not .length(). Do you use .length() because you are trying to get the length of a string and not an array? P.S. I am a beginner, so this may seem very obvious to you, but it isn't to me.
linked to: http://stackoverflow.com/q/23730092
tagged with: java
downvote count: 3
possible better answer: http://stackoverflow.com/a/23398098
linked to: http://stackoverflow.com/q/8720220
has answer: http://stackoverflow.com/a/23398098
duplicate of: http://stackoverflow.com/q/23730092
accepted answer: http://stackoverflow.com/a/23396433
type: Question
upvote count: 12
score: 9
answer count: 3
has answer: http://stackoverflow.com/a/23438747
tagged with: arrays

http://stackoverflow.com/comment/35942688
comment on: http://stackoverflow.com/a/23448270
type: AnswerComment
score: 0
has text: And i need it for outgoing calls. Any one share your ideas.
type: Comment

http://stackoverflow.com/comment/35870579
type: QuestionComment
type: Comment
score: 2
comment on: http://stackoverflow.com/q/23409778
has text: try just `count(//Formulas/yyy)`

http://stackoverflow.com/q/23328280
tagged with: swing
tagged with: java
has comment: http://stackoverflow.com/comment/35720237
tagged with: eclipse
has comment: http://stackoverflow.com/comment/35722237
has body: So i've recently decided to up my game and try to learn how to use the fabled Eclipse IDE. So far so good, I love it for many reasons, but i've encountered one simple issue. I added an image to a JLabel using the ImageIcon format like I used to when I was learning Java using the JGRASP IDE, only the problem is, the image won't display at all in Eclipse. There is just an empty panel. When I switch over to JGRASP, despite the fact that the image is far too large for the display area, it definitely displays at least partially, unlike in Eclipse. My question is, why could this be? I have the .jpg file located in the src folder of my project, so that isn't the issue(I used the same folder when I loaded the project into JGRASP). Do I need to define a pathway when using Eclipse or is there something else I could be missing? Anyways, here is my code so far, bare bones as it is. This is just a fun project that i'm working on for practice to keep GUIs fresh in my mind and to try some new things: import java.awt.*; import java.awt.event.*; import javax.swing.*; /** * @author Pat * */ public class GameProject extends JFrame { private Font f1 = new Font("ComicSans", Font.BOLD, 40); private Font f2 = new Font("ComicSans", Font.BOLD, 32); private Font f3 = new Font("ComicSans", Font.BOLD, 18); private ImageIcon gamer = new ImageIcon("Game_Collage.jpg"); public GameProject() { setTitle("Welcome To Fuego's Game Rater"); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setLayout(new GridLayout(3,0)); JPanel introPnl = new JPanel(); JPanel gamePicPnl = new JPanel(); JPanel rbPnl = new JPanel(); JTextArea welcomeLbl = new JTextArea("Welcome to my game rater. Here, you will select a" + " favorite genre of video game based on several categories." + " Once selected, you will be prompted to input your favorite" + " title from that specific genre.", 3, 40); welcomeLbl.setFont(f3); welcomeLbl.setForeground(Color.blue); welcomeLbl.setLineWrap(true); welcomeLbl.setWrapStyleWord(true); welcomeLb…
type: Question
has comment: http://stackoverflow.com/comment/35721393
tagged with: image
score: 0
has comment: http://stackoverflow.com/comment/35720509
has comment: http://stackoverflow.com/comment/35720759
has title: Differences in displaying images on a JLabel using different IDEs, Eclipse vs JGRASP
answer count: 0
has comment: http://stackoverflow.com/comment/35720445
has comment: http://stackoverflow.com/comment/35720785
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35720985
tagged with: embedded-resource

http://stackoverflow.com/comment/35687846
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23301364
score: 0
has text: @camickr It does work, but if you append text to it with display.append(string) then the text gets added to the bottom which may or not be on screen at the time. In my code it automatically scrolls with the text, ie what you append to the area is always on screen

http://stackoverflow.com/comment/35847028
comment on: http://stackoverflow.com/q/23396924
has text: I thought about editing this, but the time it takes would not be worth the two points
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35848132
has text: what is the output if you put your log statement just before the `return result` in the doInBackground method?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23397664

http://stackoverflow.com/q/23306550
type: Question
has body: I'm writing android java application (minSdkVersion 15) to get university timetable from php-site through api in json format. After decompressing content with InflaterInputStream i got a byte array in UTF-8 encoding and want to convert it to string to map to objects via Jackson/GSON or some other library. Unfortunatelly constructing string from a little more than 4.000.000 bytes long array takes about 10 minutes. String result = new String(resultArray, "UTF-8"); I found this article (http://java-performance.info/inefficient-byte-to-string-constructor/) which probably have some solution to this problem but can't understand it. May be there is some better way of such conversion?
score: 0
answer count: 2
tagged with: string
has title: Slow byte[] to String constructor
tagged with: constructor
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/35680910
has answer: http://stackoverflow.com/a/23306612
has answer: http://stackoverflow.com/a/59008211
tagged with: java
has comment: http://stackoverflow.com/comment/35681261

http://stackoverflow.com/comment/35820612
has text: Actually it got changed in JDK1.7 JLS http://docs.oracle.com/javase/specs/jls/se7/html/jls-5.html#jls-5.5, Java 7 allows unboxing of Object to primitive
type: Comment
score: 1
comment on: http://stackoverflow.com/a/23382933
type: AnswerComment

http://stackoverflow.com/q/23400764
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/23400917
type: Question
upvote count: 2
answer count: 3
favorite count: 0
has body: consider this example I have interface interface FSClient String getMeData() and classes implementing it class MockFSClient implements FSClient { public String getMeData() { return “I am mock”; } } class RestFSClient implements FSClient { public String getMeData() { final String data = // from web service return data; } } and a manager which looks like class FSManager { private FSClient fsclient; @Autowired public void FSManager(@Nonnull final FSClient fsClient) { this.fsclient = fsClient; } } I want to instantiate fsclient based on a system property com.fs.mock=true meaning if com.fs.mock=true, fsclient should be MockFSClient else fsClient should be RestFSClient How can I do that? Why do I need it? so that I can decouple and do testing Please help, I am new to Spring
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35853794
tagged with: spring
has title: Spring Dependency Injection: How to Instantiate Class based on system property?
has answer: http://stackoverflow.com/a/23406476
has answer: http://stackoverflow.com/a/23400941
score: 2
has comment: http://stackoverflow.com/comment/35853847

http://stackoverflow.com/comment/35853727
type: QuestionComment
comment on: http://stackoverflow.com/q/23399852
score: 0
has text: Ok thanks for pointing me in the right direction! I had to stop for the night to go to work. I'm a lowly bartender trying to learn this stuff in my spare time so people like you are helping me a ton!
type: Comment

http://stackoverflow.com/comment/35737276
score: 0
type: Comment
type: QuestionComment
has text: **independent** = If you modify the elements of nestedArraylist those of nestedArraylistCopy should not change **same** = If you modify a PointF in one of the ArrayLists in nestedArraylist, then the corresponding PointF in the ArrayLists in nestedArraylistCopy should change.
comment on: http://stackoverflow.com/q/23337321

http://stackoverflow.com/comment/35726021
type: AnswerComment
has text: @DanCallahan: You need the try/catch regardless as to whether this is an assignment or not. Just don't simply ignore the exception as you're doing. That catch is important, and if it catches a critical error, your program needs to be notified and needs to respond to it, if in the very least printing out the stack trace. An example is posted above. I have no idea if it fits with your assignment requirements or not since we haven't seen them.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23331348

compare
tags question: http://stackoverflow.com/q/23372962
tags question: http://stackoverflow.com/q/23320805
tag name: compare
tags question: http://stackoverflow.com/q/23429799
type: Tag
tags question: http://stackoverflow.com/q/23356688

http://stackoverflow.com/a/23376714
type: Answer
answers question: http://stackoverflow.com/q/23376518
downvote count: 0
score: 1
has body: Judging by the naming convention and the contract of Array#sort, SLOPE_ORDER is a static final member of the Point class that you are using. Specifically, it's a comparator that can be passed to the sort method. To answer your question, nothing interesting will happen. Arrays.sort(temp, points[0].SLOPE_ORDER); will evaluate points[0].SLOPE_ORDER as the reference to the object and use its value as an argument to perform the sorting without needing to look at points[0] ever again (at least not in order to get SLOPE_ORDER. If SLOPE_ORDER is both static and final, this can be replaced with Arrays.sort(temp, Point.SLOPE_ORDER); the result will be exactly the same and the code is much easier to understand.
upvote count: 1

http://stackoverflow.com/comment/35941035
comment on: http://stackoverflow.com/a/23446889
score: 0
type: Comment
has text: see the logic..initially you are calling this method. productListView(); so it directly goes to the method and displaying null exception. remove that method and display the listview and adapter in postExecute
type: AnswerComment

http://stackoverflow.com/q/23307192
type: AnsweredQuestion
has body: I have a method to initialize a linkedList and another one to run some recursive function over that list. However, in this similified example, I get an error trying to add a vertex to the linkedlist. import java.io.*; import java.util.*; public class Bla&lt;T&gt;{ private LinkedList&lt;T&gt; resultList; public LinkedList&lt;T&gt; experiment(T vertex){ LinkedList&lt;T&gt; resultList = new LinkedList&lt;T&gt;(); return experimentRecursive(vertex); } public LinkedList&lt;T&gt; experimentRecursive(T vertex){ resultList.add(vertex); return resultList; } public static void main (String args[]){ Bla &lt;String&gt; hello= new Bla&lt;String&gt;(); System.out.println(hello.experiment("A")); } }
accepted answer: http://stackoverflow.com/a/23307210
downvote count: 2
type: Question
possible better answer: http://stackoverflow.com/a/23307221
score: -2
tagged with: java
has answer: http://stackoverflow.com/a/23307221
has title: Initialize linkedlist in another method, null pointer exception
has comment: http://stackoverflow.com/comment/35681564
has answer: http://stackoverflow.com/a/23307213
answer count: 3
upvote count: 0
has answer: http://stackoverflow.com/a/23307210
favorite count: 0
has comment: http://stackoverflow.com/comment/35681627

mousehover
tags question: http://stackoverflow.com/q/23405431
tag name: mousehover
type: Tag

http://stackoverflow.com/q/23314412
has answer: http://stackoverflow.com/a/35799695
accepted answer: http://stackoverflow.com/a/25808409
score: 4
type: AnsweredQuestion
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/65606833
has answer: http://stackoverflow.com/a/27874705
type: Question
upvote count: 4
has answer: http://stackoverflow.com/a/58852749
downvote count: 0
has answer: http://stackoverflow.com/a/50207481
has answer: http://stackoverflow.com/a/25808409
has body: I am completely new in Hibernate and got such an stacktrace: hql> from TracksEntity [2014-04-26 21:13:45] org.hibernate.MappingException: Unable to load class [ model.TracksEntity] declared in Hibernate configuration <mapping/> entry [2014-04-26 21:13:45] java.lang.ClassNotFoundException: model.TracksEntity 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) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:259) at org.hibernate.internal.util.ReflectHelper.classForName(ReflectHelper.java:192) at org.hibernate.cfg.Configuration.parseMappingElement(Configuration.java:2188) at org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.java:2139) at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:2119) at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:2072) at org.hibernate.cfg.Configuration.configure(Configuration.java:2045) at com.intellij.hibernate.remote.impl.RemoteConfigurationImpl.configure(RemoteConfigurationImpl.java:57) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:483) at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:323) at sun.rmi.transport.Transport$1.run(Transport.java:178) at sun.rmi.transport.Transport$1.run(Transport.java:175) at java.security.AccessController.doPrivileged(Native Method) at sun.rmi.transport.Transport.serviceCall(Transport.java:174) at sun.rmi.transport.tcp.TCPTr…
answer count: 10
possible better answer: http://stackoverflow.com/a/23314572
has answer: http://stackoverflow.com/a/29416749
has answer: http://stackoverflow.com/a/23314572
favorite count: 0
has title: Hibernate: Unable to load class declared in Hibernate configuration <mapping/> entry
has answer: http://stackoverflow.com/a/45372355
has answer: http://stackoverflow.com/a/63734410

http://stackoverflow.com/comment/35660184
score: 0
type: Comment
type: QuestionComment
has text: ref http://stackoverflow.com/questions/13592123/can-i-run-a-jar-file-without-jdk
comment on: http://stackoverflow.com/q/23293742

http://stackoverflow.com/q/23415807
has title: spring3 setIgnoreUnknownFields
score: 0
has comment: http://stackoverflow.com/comment/35882952
type: UnansweredQuestion
tagged with: spring
has body: I have a hidden field "tmpFileId" in the form which I don't want to bind to the model. I want to get it using http servlet request's getParameter request. So I did this in my controller: @InitBinder public void initBinder(WebDataBinder binder) { binder.setIgnoreUnknownFields(false); } But whether I set it true or false as the parameter for setIgnoreUnknownFields I am getting the error "Invalid property 'tmpFileId' of bean class [tms.TrainingInstructor]: Bean property 'tmpFileId' is not readable or has an invalid getter method: Does the return type of the getter match the parameter type of the setter?" From the documentation: public void setIgnoreUnknownFields(boolean ignoreUnknownFields) Set whether to ignore unknown fields, that is, whether to ignore bind parameters that do not have corresponding fields in the target object. Default is "true". Turn this off to enforce that all bind parameters must have a matching field in the target object. Note that this setting only applies to binding operations on this DataBinder, not to retrieving values via its BindingResult. See Also: bind(org.springframework.beans.PropertyValues) So now I am not sure whether I am doing things all right. From the text "Note that this setting only applies to binding operations on this DataBinder, not to retrieving values via its BindingResult", does it mean that it will work only for binding while get (ie the rendering jsp from model) and not post (ie from jsp to model)? Thanks PS: my jsp &lt;form:form method="post" action="addEditTrainingInstructor" commandName="trainingInstructor"&gt; &lt;form:hidden path="id" /&gt; &lt;form:hidden path="tmpFileId" /&gt; &lt;/form:form&gt; my controller @RequestMapping(value="/addEditTrainingInstructor", params="create", method=RequestMethod.POST) public String addEditTrainingInstructor(@ModelAttribute("trainingInstructor")TrainingInstructor instructor, BindingResult result, HttpSession session, HttpServletRequest request) { Integer classID = (Integer) sessi…
tagged with: spring-mvc
has comment: http://stackoverflow.com/comment/35883506
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/35885501
type: Question

http://stackoverflow.com/comment/35675254
has text: @Guardanis so EVERY item varies? Then you might have to keep the size of the list down and remove items, when they're not in sight. Then when the items comes in sight again, you add them back ind and remove the old ones... that way you'd keep the list tiny and crisp...
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23303248

http://stackoverflow.com/a/23437891
has comment: http://stackoverflow.com/comment/35924164
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/23437839
has comment: http://stackoverflow.com/comment/35923975
has comment: http://stackoverflow.com/comment/35923759
has comment: http://stackoverflow.com/comment/35923523
upvote count: 1
has comment: http://stackoverflow.com/comment/35923449
has body: You can give a reference to an interface if you create an anonymous class. Runnable run = new Runnable() { }. The methods from your interface will be stored in your variable. This isnt instiansiating an interface, rather giving the methods contained in your interface some kind of reference. public Runnable run() { return new Runnable() { public void run() { } }; } This also applies for abstract classes. Usually, you cant directly create an instance of an abstract class new A();, but anonymous classes allow you to create a subclass of a sort, that allows you to override the methods that require a body. Creating an anonymous class is similar to creating a subclass in some ways. You have access to protected variables, and can also declare new methods. If your interface only contains 1 method, you cpuld also use lambda expressions Runnable run = () -&gt; { }
has comment: http://stackoverflow.com/comment/35924320
type: Answer

http://stackoverflow.com/comment/35861142
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23392938
has text: Cheers edi9999, we are all already using docx4j for doing the swapping on template parameters on the word document. What we were actually after was something to display (and edit) the word doc in the browser. Oh yeah and to add to the fun, it's got to be free. Got a horrible feeling we are gubbed :)

http://stackoverflow.com/q/23372437
has answer: http://stackoverflow.com/a/23372511
possible better answer: http://stackoverflow.com/a/23372509
has answer: http://stackoverflow.com/a/23372509
has body: i've a Navigation Drawer and i would like that when i click on an item of the listview this change color. So i've this xml code. &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/navigation_drawer" android:layout_width="match_parent" android:layout_height="match_parent"&gt; &lt;FrameLayout android:id="@+id/container" android:layout_width="match_parent" android:layout_height="match_parent"/&gt; &lt;ListView android:id="@+id/listview" android:layout_width="240dp" android:layout_height="match_parent" android:layout_gravity="start" android:choiceMode="singleChoice" android:textColor="@drawable/test" android:divider="@null" android:dividerHeight="0dp" android:background="#2F2F2F"/&gt; &lt;/android.support.v4.widget.DrawerLayout&gt; Test code is &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;selector xmlns:android="http://schemas.android.com/apk/res/android"&gt; &lt;item android:state_selected="true" android:color="@android:color/black"/&gt; &lt;item android:state_focused="true" android:color="@android:color/black"/&gt; &lt;item android:state_pressed="true" android:color="@android:color/black"/&gt; &lt;item android:color="@android:color/black"/&gt; &lt;/selector&gt; But when i click remain the default color and not change in black. Why? Where is the problem and how can i fix it? Thanks in advance.
tagged with: android
tagged with: http://stackoverflow.com/tag/xml
accepted answer: http://stackoverflow.com/a/23372511
score: 0
has comment: http://stackoverflow.com/comment/35801435
linked to: http://stackoverflow.com/q/2907335
type: AnsweredQuestion
tagged with: java
type: Question
has title: Set color item listview xml
answer count: 2

http://stackoverflow.com/a/23442235
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/37701686
upvote count: 3
has comment: http://stackoverflow.com/comment/37325875
answers question: http://stackoverflow.com/q/23441643
score: 3
accepted answer of: http://stackoverflow.com/q/23441643
has body: I run the following command and it got worked bin/flume-ng agent –conf ./conf/ -f conf/flume.conf -Dflume.root.logger=DEBUG,console -n TwitterAgent

http://stackoverflow.com/q/23335514
type: Question
accepted answer: http://stackoverflow.com/a/23335905
tagged with: sorting
score: 0
has body: Basically I have two comparators (Comparator1 and Comparator2) with slightly different implementations. Both should sort a list in descending order of the lengths of the row's name. Comparator2 does not seem to work with java7/java8. Comparator1 works always. Both works with java 1.6 implementation or if I set -Djava.util.Arrays.useLegacyMergeSort=true. If the problem exists in Comparator2, java should throw IllegalArgumentException, but no exceptions are thrown. This is stated in java documentation as "The sorting algorithm used by java.util.Arrays.sort and (indirectly) by java.util.Collections.sort has been replaced. The new sort implementation may throw an IllegalArgumentException if it detects a Comparable that violates the Comparable contract" Is this a bug in JRE or is there something wrong with Comparator2? public class Main { public static void main(String[] args) { Row row1 = new Row("AAAA"); Row row2 = new Row("BBB"); Row row3 = new Row("CC"); Row row4 = new Row("D"); List&lt;Row&gt; list1 = new ArrayList&lt;Row&gt;(); list1.add(row2); list1.add(row3); list1.add(row1); list1.add(row4); System.out.println("Before sorting:"); System.out.println(""); print(list1); Collections.sort(list1, new Comparator2()); System.out.println("After sorting with comparator2:"); System.out.println(""); print(list1); Collections.sort(list1, new Comparator1()); System.out.println("After sorting with comparator1:"); System.out.println(""); print(list1); } private static void print(List&lt;Row&gt; list) { for (Row row : list) { System.out.println(row.name); } } } public class Row { String name; public Row(String name) { this.name = name; } public int getLength() { return name.length(); } } public class Comparator1 implements Comparator&lt;Row&gt; { @Override public int compare(Row o1, Row o2) { Integer length1 = o1.getLength(); Integer length2 = o2.getLength(); return -1 * length1.compareTo(length2); } } public class Comparator2 implements Comparator&lt;Row&gt; { @Override public …
tagged with: java-7
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/23335905
has title: Java 8 Collections.sort - Simple typo
has comment: http://stackoverflow.com/comment/35733307
tagged with: java-8
type: AnsweredQuestion
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/35733318
downvote count: 1

terrain
tags question: http://stackoverflow.com/q/23344081
type: Tag
tag name: terrain

http://stackoverflow.com/a/23354526
score: 0
has body: This should do the job question was a little vague also this will only break the condition at the beginning of each iteration if timepassed > 5s. long timestamp = System.currentTimeMillis(); for(int i=0; i&lt;payloadList.size() &amp;&amp; (System.currentTimeMillis() - timestamp) &lt; 5000; i++){ ... }
type: Answer
answers question: http://stackoverflow.com/q/23354384

http://stackoverflow.com/q/23395108
has answer: http://stackoverflow.com/a/23395266
type: Question
answer count: 2
tagged with: jstl
has title: jsp using the variable class type
has comment: http://stackoverflow.com/comment/35843635
tagged with: jsp
has answer: http://stackoverflow.com/a/23395596
has comment: http://stackoverflow.com/comment/35843136
accepted answer: http://stackoverflow.com/a/23395596
score: 0
possible better answer: http://stackoverflow.com/a/23395266
type: AnsweredQuestion
tagged with: java
has body: I am new to advance JAVA. i have a 3 pseudu(getters/setters) java classes whose variables are Class name: users variables : int userID , String Name , String email Class name: answers variables : int answerID , String answer , users user In my jsp page , i am using JSTL tags (where answers a = new answers) when i am trying &lt;c:out value = "${a.answer}"/&gt; works fine when i am trying &lt;c:out value = "${a.answerID}"/&gt; works fine However , when i am trying to get variable of answers class i.e users email like &lt;c:out value = "${a.user}"/&gt; it fails My question is: how can i use "user" to get his ID , name and email?

http://stackoverflow.com/q/23412053
tagged with: java
has comment: http://stackoverflow.com/comment/35877553
has comment: http://stackoverflow.com/comment/35875140
type: Question
has body: My application is sifting through a M3U playlist and generating a Windows batch file (copy_files.bat) using the following command: printWriter = new PrintWriter("copy_files.bat", "UTF-8"); It generates the appropriate batch file that mostly works, but fails to copy some files that have foreign characters in their filenames. The same behavior occurs when using Java's built in function for copying files (few files cannot be found on the system due to filename character encoding). Please advise!
tagged with: character-encoding
score: 0
tagged with: batch-file
has comment: http://stackoverflow.com/comment/35883009
has title: How to take notice of filenames in different locale in Java
answer count: 1
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35885425
has answer: http://stackoverflow.com/a/23847861
tagged with: printwriter
has comment: http://stackoverflow.com/comment/35883115

http://stackoverflow.com/q/23360361
tagged with: ws-addressing
downvote count: 0
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/24365198
type: AnsweredQuestion
tagged with: cxf
score: 1
tagged with: java
tagged with: reference-parameters
has comment: http://stackoverflow.com/comment/35975243
upvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/24365198
has title: How to add wsa reference parameters to cxf client call?
has body: I understand how to simply add the "standard" ws addressing headers to a cxf client call: JaxWsProxyFactoryBean factory = ...; factory.getFeatures().add(new WSAddressingFeature()); But I don't understand exactly how I could add wsa reference parameters so that the soap header of the message looks like this: &lt;soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wsa="http://www.w3.org /2005/08 /addressing" xmlns:ns1=... &gt; &lt;soap:Header&gt; &lt;wsa:To&gt;...&lt;/wsa:To&gt; &lt;wsa:Action&gt;...&lt;/wsa:Action&gt; &lt;wsa:MessageID&gt;...&lt;/wsa:MessageID&gt; &lt;ns1:Country wsa:IsReferenceParameter="true"&gt;xx&lt;/ns1:Country&gt; &lt;ns1:Brand wsa:IsReferenceParameter="true"&gt;x&lt;/ns1:Brand&gt; &lt;/soap:Header&gt; ... How can I add this headers within a cxf client call? kind regards, soilworker

http://stackoverflow.com/q/23364843
type: UnansweredQuestion
score: 0
tagged with: web-applications
tagged with: java
has answer: http://stackoverflow.com/a/23365180
type: Question
has title: What encoding should be used when we make a downloadable file from a J2EE Modern Web App?
answer count: 2
tagged with: encoding
has body: I 'm working on Mac Os with Eclipse Kepler on a JSF java project . How to make a file downloadable for a Windows, Mac Os, Linux environements without misinterpreted characters because of encoding and plat-forms ? Do we need to check which os the client use to adapt encoding with user-agent parsing ? If you use UTF-8 , it will be ok on Unix Based Os, but how to make it open simply in windows with excel? I write this code to export in UTF-8. But it will misinterpreted é &amp; è in Excel. FacesContext fc = FacesContext.getCurrentInstance(); ExternalContext ec = fc.getExternalContext(); ec.responseReset(); ec.setResponseContentType("text/csv"); ec.setResponseCharacterEncoding("UTF-8"); String fileName = "CleanOmicsTracer_Tableau_"+type+".csv"; ec.setResponseHeader("Content-Disposition", "attachment; filename=\"" + fileName + "\""); // Now you can write the InputStream of the file to the above OutputStream the usual way. BufferedOutputStream csvOut = new BufferedOutputStream(ec.getResponseOutputStream()); BufferedWriter csvWriter = new BufferedWriter(new OutputStreamWriter(csvOut, "UTF-8")); csvWriter.append("Etude;Identifiant Analyse;Numero d'inclusion;Identifiant Prelevement;Identifiant Extrait;Technologie;Service;Sous-analyses;Categorie;Date Enregistrement\n"); for (AnalyseDispatcher aAnalyse : viewedListAnalyse) { // somethings is your List&lt;Something&gt; csvWriter .append(toCsvField(aAnalyse.getSample().getParticipant().getProject().getStudy_name())) .append(';') .append(toCsvField("A"+aAnalyse.getId())) .append(';').append(toCsvField(aAnalyse.getSample().getParticipant().getId_study())) .append('\n'); } csvWriter.flush(); csvWriter.close(); csvOut.close(); fc.responseComplete(); }
has comment: http://stackoverflow.com/comment/35786806
has comment: http://stackoverflow.com/comment/35786761
has comment: http://stackoverflow.com/comment/35787427
tagged with: http://stackoverflow.com/tag/csv
has answer: http://stackoverflow.com/a/23365944

http://stackoverflow.com/comment/35793062
has text: Containers will automatically re-validate itself when a new component has been added. so you don't need to re-validate it by your self, just try the code before saying and down voting (by the way its not me who downvoted your answer).
type: Comment
comment on: http://stackoverflow.com/a/23367902
type: AnswerComment
score: 0

http://stackoverflow.com/comment/35844249
has text: @Rogue - I know what you mean. Map is a key, object pair. But let's say two people have the same name, can I get the index of both?
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23395571

http://stackoverflow.com/comment/35760392
score: 0
has text: @user2864740 well, it depends on the context of the question. If we're talking about web applications, Java is purely server side code, while JavaScript is client side code.
type: Comment
comment on: http://stackoverflow.com/a/23350001
type: AnswerComment

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

http://stackoverflow.com/a/60936638
type: Answer
score: 1
answers question: http://stackoverflow.com/q/23308193
has body: I would suggest using anyMatch. Example:- return someObjects.stream().anyMatch(obj -&gt; some_condition_met; ); You can refer this post for understanding anyMatch:- https://beginnersbook.com/2017/11/java-8-stream-anymatch-example/
upvote count: 2
downvote count: 1

eclipse
tags question: http://stackoverflow.com/q/23311616
tags question: http://stackoverflow.com/q/23418169
tags question: http://stackoverflow.com/q/23426902
tags question: http://stackoverflow.com/q/23447318
tags question: http://stackoverflow.com/q/23317163
tags question: http://stackoverflow.com/q/23442621
tag name: eclipse
tags question: http://stackoverflow.com/q/23333031
tags question: http://stackoverflow.com/q/23446901
tags question: http://stackoverflow.com/q/23369600
tags question: http://stackoverflow.com/q/23293871
tags question: http://stackoverflow.com/q/23399383
tags question: http://stackoverflow.com/q/23292355
tags question: http://stackoverflow.com/q/23348943
tags question: http://stackoverflow.com/q/23445963
tags question: http://stackoverflow.com/q/23343012
tags question: http://stackoverflow.com/q/23418625
tags question: http://stackoverflow.com/q/23439843
tags question: http://stackoverflow.com/q/23421021
tags question: http://stackoverflow.com/q/23452881
tags question: http://stackoverflow.com/q/23345781
tags question: http://stackoverflow.com/q/23443493
tags question: http://stackoverflow.com/q/23293456
tags question: http://stackoverflow.com/q/23334846
tags question: http://stackoverflow.com/q/23311209
tags question: http://stackoverflow.com/q/23338870
tags question: http://stackoverflow.com/q/23385683
tags question: http://stackoverflow.com/q/23433667
tags question: http://stackoverflow.com/q/23378979
tags question: http://stackoverflow.com/q/23451210
tags question: http://stackoverflow.com/q/23420819
tags question: http://stackoverflow.com/q/23356731
tags question: http://stackoverflow.com/q/23418351
tags question: http://stackoverflow.com/q/23396495
tags question: http://stackoverflow.com/q/23389044
tags question: http://stackoverflow.com/q/23361049
tags question: http://stackoverflow.com/q/23323107
tags question: http://stackoverflow.com/q/23333817
tags question: http://stackoverflow.com/q/23376659
tags question: http://stackoverflow.com/q/23329279
tags question: http://stackoverflow.com/q/23389221
tags question: http://stackoverflow.com/q/23452286
tags question: http://stackoverflow.com/q/23378451
tags question: http://stackoverflow.com/q/23358638
tags question: http://stackoverflow.com/q/23383399
tags question: http://stackoverflow.com/q/23419544
tags question: http://stackoverflow.com/q/23328277
tags question: http://stackoverflow.com/q/23367650
tags question: http://stackoverflow.com/q/23418907
tags question: http://stackoverflow.com/q/23308856
tags question: http://stackoverflow.com/q/23325648
tags question: http://stackoverflow.com/q/23299045
tags question: http://stackoverflow.com/q/23437569
tags question: http://stackoverflow.com/q/23330353
tags question: http://stackoverflow.com/q/23291060
tags question: http://stackoverflow.com/q/23396169
tags question: http://stackoverflow.com/q/23329580
tags question: http://stackoverflow.com/q/23378974
tags question: http://stackoverflow.com/q/23435572
tags question: http://stackoverflow.com/q/23351573
tags question: http://stackoverflow.com/q/23422213
tags question: http://stackoverflow.com/q/23294304
tags question: http://stackoverflow.com/q/23393923
tags question: http://stackoverflow.com/q/23316781
tags question: http://stackoverflow.com/q/23387616
tags question: http://stackoverflow.com/q/23445777
tags question: http://stackoverflow.com/q/23327920
tags question: http://stackoverflow.com/q/23294612
tags question: http://stackoverflow.com/q/23324219
tags question: http://stackoverflow.com/q/23434187
tags question: http://stackoverflow.com/q/23408722
tags question: http://stackoverflow.com/q/23298348
tags question: http://stackoverflow.com/q/23330317
tags question: http://stackoverflow.com/q/23406288
tags question: http://stackoverflow.com/q/23319479
tags question: http://stackoverflow.com/q/23340646
tags question: http://stackoverflow.com/q/23313060
tags question: http://stackoverflow.com/q/23309608
tags question: http://stackoverflow.com/q/23384866
tags question: http://stackoverflow.com/q/23324894

http://stackoverflow.com/q/23428896
tagged with: java
has title: Logic error resulting in inability to print given output
answer count: 2
tagged with: logic
score: 0
has body: When running this program, it does not print the encryption or decryption outputs, and prints the user prompt to enter a message, but does not actually allow for input. import java.util.*; public class CaesarShiftTester { public static void main(String [] args) { String alphabet[] = {"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"}; Scanner in = new Scanner(System.in); System.out.print("Do you wish to:\n[1]Encrypt\n[2]Decrypt\n\n"); while (!in.hasNextInt()) { System.out.println("\nPlease enter an integer value: "); in.nextLine(); } int decision = in.nextInt(); System.out.println(); if(decision == 1) { System.out.println("Enter an integer value between 1-25 by which you desire to shift your message: "); while (!in.hasNextInt()) { System.out.print("\nPlease enter an integer value"); in.nextLine(); } int shift = in.nextInt(); if(shift &gt; 25 || shift &lt; 1) { shift = 0; } System.out.println(); System.out.println("Enter a phrase you wish to encrypt: "); while (!in.hasNextLine()) { in.nextLine(); } String entry= in.nextLine(); entry = entry.toLowerCase(); System.out.println(CaesarShiftEncryption.encrypt(alphabet, entry, shift)); } else { System.out.println("Enter an integer value between 1-25 by which you desire to shift your message: "); while (!in.hasNextInt()) { System.out.print("\nPlease enter an integer value: "); in.nextLine(); } int shift = in.nextInt(); if(shift &gt; 25 || shift &lt; 1) { shift = 0; } System.out.println(); System.out.println("Enter a phrase you wish to decrypt: "); while (!in.hasNextLine()) { in.nextLine(); } String entry= in.nextLine(); entry = entry.toLowerCase(); System.out.println(CaesarShiftDecryption.decrypt(alphabet, entry, shift)); } } } This class calls to these two classes: public class CaesarShiftDecryption { public static String decrypt(String str[], String in, int shift) { String decryption = ""; for(int i = 0; i &lt; in.length…
tagged with: input
has answer: http://stackoverflow.com/a/23429298
tagged with: java.util.scanner
has answer: http://stackoverflow.com/a/23429206
type: UnansweredQuestion
type: Question
tagged with: object

http://stackoverflow.com/q/23327241
tagged with: gwt
accepted answer: http://stackoverflow.com/a/23327345
downvote count: 0
answer count: 1
tagged with: smartgwt
favorite count: 0
has body: I have the same problem, that is mentioned here. The problem got missunderstood and I don't have the privileg to comment so I created this question. He wants to delete a DynamicForm out of an SectionStackSection object. my situation is the following: I added some DynamicForm objects to the SectionStackSection by using the setFields(FormItem... fields) method and I also added a Button to delete this FormItem out of the SectionStackSection. The problem's the same. Also Tried DynamicForm.removeFromParent(), but the parent object is null in DynamicForm. EDIT: That's how my SectionStack is build: SectionStack SectionStackSection DynamicForm df1 // added via SectionStackSection.addItem(df1) Button btn1 // added via DynamicForm.addChild(btn1) ClickHandler ch1 FormItem[] fiList1 // added via DynamicForm.setFields(fiList1) DynamicForm df2 // added via SectionStackSection.addItem(df2) Button btn2 // added via DynamicForm.addChild(btn2) ClickHandler ch2 FormItem[] fiList2 // added via DynamicForm.setFields(fiList2) // ... some more DynamicForm objects added DynamicForm dfX Button btnX ClickHandler chX FormItem[] fiListX SectionStackSection // ... // ... By pressing btn1 for example, df1 should be deleted. The SectionStackSection should be stil shown.
linked to: http://stackoverflow.com/q/22896848
has answer: http://stackoverflow.com/a/23327345
has title: SMARTGWT - delete DynamicForm from SectionStackSection
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
type: Question

executorservice
tags question: http://stackoverflow.com/q/23398044
type: Tag
tags question: http://stackoverflow.com/q/23394172
tags question: http://stackoverflow.com/q/23409604
tag name: executorservice
tags question: http://stackoverflow.com/q/23345612
tags question: http://stackoverflow.com/q/23394518

http://stackoverflow.com/q/23294959
upvote count: 1
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/23295006
tagged with: futuretask
has answer: http://stackoverflow.com/a/23295006
tagged with: java
has comment: http://stackoverflow.com/comment/35661161
downvote count: 1
accepted answer: http://stackoverflow.com/a/23295002
type: Question
has title: Application crashes when UI thread waits for AsyncTask
has body: I am creating an application in Android in which whenever a user receives new Text message (SMS) it is first sent on server and if server replies true the Broadcast is aborted else we Broadcast it. Now the problem is we can not communicate with server on UI thread, so to overcome this problem we have to use some kind of thread to perform background operations, therefore I am using AsyncTask to communicate with server. Here is my code: Android App: public class IncomingSms extends BroadcastReceiver { // Get the object of SmsManager final SmsManager sms = SmsManager.getDefault(); public static String message; public void onReceive(final Context context, Intent intent) { // Retrieves a map of extended data from the intent. final Bundle bundle = intent.getExtras(); String senderNum; try { if (bundle != null) { final Object[] pdusObj = (Object[]) bundle.get("pdus"); for (int i = 0; i &lt; pdusObj.length; i++) { SmsMessage currentMessage = SmsMessage .createFromPdu((byte[]) pdusObj[i]); String phoneNumber = currentMessage .getDisplayOriginatingAddress(); senderNum = phoneNumber; message = currentMessage.getDisplayMessageBody(); CallServer callServer = new CallServer(); callServer.execute(); Log.d("textmsg", callServer.getStatus().toString()); /* while (callServer.getStatus().toString() == "RUNNING") { //Log.d("textmsg", "working in loop"); } */ if(callServer.get() == "true") abortBroadcast(); Log.d("textmsg", callServer.getStatus().toString() + "done"); // Show Alert Toast toast = Toast.makeText(context, "senderNum: " + senderNum + ", message: " + message, Toast.LENGTH_LONG); toast.show(); } // end for loop } // bundle is null } catch (Exception e) { Log.e("SmsReceiver", "Exception smsReceiver" + e); } } private class CallServer extends AsyncTask&lt;String, String, String&gt; { @SuppressLint("NewApi") protected String doInBackground(String... arg0) { Socket socket = null; DataOutputStream dataOutputStream = null; DataInputStream dataInputStream = null; try { socket = new …
score: 0
answer count: 2
favorite count: 0
tagged with: android-asynctask
has answer: http://stackoverflow.com/a/23295002
tagged with: multithreading
tagged with: android

http://stackoverflow.com/a/23399926
has comment: http://stackoverflow.com/comment/49784593
score: 22
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23399865
has body: This can be tricky simply changing the "advertised" encoding does not make up for the fact that there are bytes in the file that cannot be understood using a UTF-8 interpretation. In Ant you will need to update the javac task to add an encoding like, &lt;javac ... encoding="utf-8"&gt; Make sure that the file encoding in Eclipse is also UTF-8 because some cp1252 characters do not directly map into UTF-8 either. You will probably want to maintain your entire project using a single encoding. Otherwise the compiler will be seeing different encodings when it only expects one.
type: Answer
answers question: http://stackoverflow.com/q/23399865
upvote count: 22
downvote count: 0

http://stackoverflow.com/comment/65732357
type: Comment
has text: @CartesianTheater I maintain a project which ports learned models to a low level programming language like C, Java or JavaScript. But it's under active development. Anyway, you find it here: [https://github.com/nok/sklearn-porter](https://github.com/nok/sklearn-porter)
type: AnswerComment
comment on: http://stackoverflow.com/a/23442944
score: 0

http://stackoverflow.com/comment/35726115
type: Comment
has text: You rightfully pointed out "..for those complex needs". It could've been accomplished using Design Patterns, but that is moot. So, there are no other gotchas regarding creating multiple child injectors concurrently across threads?
comment on: http://stackoverflow.com/a/23330752
type: AnswerComment
score: 0

http://stackoverflow.com/q/23370159
has comment: http://stackoverflow.com/comment/35823561
has body: I have a problem with HSSFWorkbook object. I have a XLS template, where first row is dark gray, and next rows are light gray. During generation of the report, I want to change the background color of few cells (works perfectly) for red/blue. But after calling: HSSFCellStyle style = workbook.createCellStyle(); style.setFillBackgroundColor(...) or: HSSFCellStyle style = workbook.getCellStyleAt(0) [default style of the workbook] style.setFillBackgroundColor(...) the styles of whole sheet is lost. The header becomes violet, and the rest cells becomes dark-dark-gray. I love violets, but I need my colours from the XLS not being changed. In short - styles from my XLS template are not being preserved after I change style of one cell in the way described above. I'm out of ideas. Please help. Mateusz
has comment: http://stackoverflow.com/comment/35823211
upvote count: 1
tagged with: excel
type: Question
has comment: http://stackoverflow.com/comment/35799273
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35828695
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/35799067
linked to: http://stackoverflow.com/q/2803841
has answer: http://stackoverflow.com/a/23389039
has comment: http://stackoverflow.com/comment/35823393
downvote count: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/23389039
favorite count: 0
has comment: http://stackoverflow.com/comment/35823502
has title: Apache poi HSSFWorkbook overwrites styles from the XLS template
tagged with: apache-poi

http://stackoverflow.com/comment/35944945
score: 0
type: Comment
type: QuestionComment
has text: for better help sooner post an SSCCE/MCVE short, runnable, compilable with hardcoded path to C:\, then is possible to suggest if the problem is in model or in renderer only
comment on: http://stackoverflow.com/q/23449367

http://stackoverflow.com/comment/35893342
score: 0
type: AnswerComment
has text: String url = "https://irctc.co.in"; final HttpParams httpParams = new BasicHttpParams(); HttpConnectionParams.setConnectionTimeout(httpParams,1000); URL obj = new URL(url); HttpsURLConnection con = (HttpsURLConnection) obj.openConnection(); con.setConnectTimeout(100); con.setReadTimeout(100); HttpClient client = new DefaultHttpClient(httpParams); HttpUriRequest request = new HttpGet(url); HttpResponse response = client.execute(request); System.out.println(response.toString());
type: Comment
comment on: http://stackoverflow.com/a/23421465

http://stackoverflow.com/comment/35698149
comment on: http://stackoverflow.com/a/23316200
score: 0
type: AnswerComment
type: Comment
has text: Use the hashCode() method on each String, then you have two numbers that are produced in a way that the same string produces the same number.

http://stackoverflow.com/q/23298805
favorite count: 0
type: UnansweredQuestion
downvote count: 1
has comment: http://stackoverflow.com/comment/35666332
has answer: http://stackoverflow.com/a/23298846
tagged with: java
score: -1
has body: I'm currently trying to create a java application that creates an array to store 20 test grades from random numbers between 0-100. Then I want to calc/print the highest/average score. This is what I have so far but I keep getting errors. Any help? import java.util.Random; public class ComputerGrades { public static void main(String[] args) { Random r = new Random(); int total = 0; int[] studentGrades = new int[20]; for ( int i=0; i&lt;20; i++ ) { studentGrades[i] = r.NextInt(); System.out.printf("%d", studentGrades[i]); total+= studentGrades[i]; } int max = studentGrades[0]; for ( int i=1; i&lt;20; i++ ) { if(studentGrades[i] &gt; max) max=studentGrades[i]; } System.out.printf("\nThe average is %d", total/20); System.out.printf("\nThe highest grades is %d", max); } }
has comment: http://stackoverflow.com/comment/35666557
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/35666506
upvote count: 0
has answer: http://stackoverflow.com/a/23298869
has title: Java test gradebook

http://stackoverflow.com/a/23301724
score: 1
downvote count: 1
accepted answer of: http://stackoverflow.com/q/23301701
answers question: http://stackoverflow.com/q/23301701
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35671836
has comment: http://stackoverflow.com/comment/35671897
has body: Static initialization blocks run when the JVM first sees a mention of the class. That is, when the class gets loaded. You don't need to create an instance, but you do need to mention/reference the class in some way. There are a number of ways you can do this that will do the trick.
upvote count: 2
type: Answer

http://stackoverflow.com/q/23314111
type: UnansweredQuestion
upvote count: 1
has title: Missing fields when merging PDF by using iText
has comment: http://stackoverflow.com/comment/35697599
tagged with: java
tagged with: itext
downvote count: 1
linked to: http://stackoverflow.com/q/20656540
type: Question
answer count: 1
score: 0
tagged with: http://stackoverflow.com/tag/pdf
favorite count: 0
has body: I use OpenOffice to create odt file,create form fields in this file, and save odf file as PDF file. Then use itext to fill data into pdf files.Every form field showing in each pdf. But when I merger pdf files, all form fields missing. Please help. Code of set fields: FileOutputStream fos = new FileOutputStream(outpath); PdfReader reader= new PdfReader(templateinputsream); PdfStamper stamp = new PdfStamper(reader, fos); AcroFields form = stamp.getAcroFields(); setField(form, fieldsMap); private void setField(AcroFields form, Map&lt;String, String&gt; map) { Iterator&lt;Entry&lt;String, String&gt;&gt; it = map.entrySet().iterator(); while (it.hasNext()) { Entry&lt;String, String&gt; entry = it.next(); String key = entry.getKey(); String value = entry.getValue(); try { form.setField(key, value); } catch (IOException e) { e.printStackTrace(); } catch (DocumentException e) { e.printStackTrace(); } } } Code of merge pdf: private void mergePdf(List&lt;String&gt; files, String savepath) { try { List&lt;InputStream&gt; pdfs = new ArrayList&lt;InputStream&gt;(); for (int i = 0; i &lt; files.size(); i++) { pdfs.add(new FileInputStream(files.get(i))); } OutputStream output = new FileOutputStream(savepath); Document document = new Document(new PdfReader(files.get(0)).getPageSize(1)); concatPDFs(document, pdfs, output); } catch (IOException e) { e.printStackTrace(); } } public static void concatPDFs(Document document, List&lt;InputStream&gt; streamOfPDFFiles, OutputStream outputStream) { try { List&lt;InputStream&gt; pdfs = streamOfPDFFiles; List&lt;PdfReader&gt; readers = new ArrayList&lt;PdfReader&gt;(); int totalPages = 0; Iterator&lt;InputStream&gt; iteratorPDFs = pdfs.iterator(); while (iteratorPDFs.hasNext()) { InputStream pdf = iteratorPDFs.next(); PdfReader pdfReader = new PdfReader(pdf); readers.add(pdfReader); totalPages += pdfReader.getNumberOfPages(); } PdfWriter writer = PdfWriter.getInstance(document, outputStream); document.open(); PdfContentByte cb = writer.getDir…
has answer: http://stackoverflow.com/a/23323677
linked to: http://stackoverflow.com/q/15925616

http://stackoverflow.com/a/23348847
answers question: http://stackoverflow.com/q/23342987
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/23342987
score: 1
upvote count: 1
has body: There are many ways to achieve it. You can make your managed bean request scoped . You can set the values to null in the backing bean , after submit. You can use resetValues (set to true) attribute of the p:ajax component. You can use the p:resetInput component inside your p:commandButton You can use the method RequestContext.getCurrentInstance().reset("reference to the component to reset") in your backing bean. There are examples of these methods on Primefaces - ShowCase, search for ResetInput under Misc.

http://stackoverflow.com/q/23367487
score: -1
has body: I have a list of objects, and inside these objects I have another list. I would like to know if there's a simple way to load a list of those lists inside the object. I want to choose a parameter from the object (userCode for example), and I want that list to return all the lists from all the objects with the matching userCode. If anyone could help me, I'll be forever grateful. Thank you
has answer: http://stackoverflow.com/a/23367838
has comment: http://stackoverflow.com/comment/35791921
type: Question
upvote count: 0
tagged with: arrays
has title: How to load a list from a list inside an object in Java
favorite count: 0
tagged with: arraylist
has comment: http://stackoverflow.com/comment/35791835
answer count: 3
has answer: http://stackoverflow.com/a/23367668
type: UnansweredQuestion
tagged with: dictionary
downvote count: 1
tagged with: java
has answer: http://stackoverflow.com/a/23368224

http://stackoverflow.com/a/23375912
has comment: http://stackoverflow.com/comment/35811915
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23375700
type: Answer
has comment: http://stackoverflow.com/comment/35808367
upvote count: 6
has body: Try using @PrepareForTest at the class level of your test, not at method level. @RunWith(PowerMockRunner.class) @PrepareForTest(SecureRandom.class) public class ExampleClassTest { ... } Edit: In order to invoke the mock, you need to do the following: 1) Add the ExampleClass to the PrepareForTest annotation: @RunWith(PowerMockRunner.class) @PrepareForTest({SecureRandom.class, ExampleClass.class}) public class ExampleClassTest { ... } 2) Mock the constructor call for SecureRandom: SecureRandom mockRandom = Mockito.mock(SecureRandom.class); PowerMockito.whenNew(SecureRandom.class).withNoArguments().thenReturn(mockRandom); A working example is given below: @RunWith(PowerMockRunner.class) @PrepareForTest({SecureRandom.class, ExampleClass.class}) public class ExampleClassTest { private ExampleClass example = new ExampleClass(); @Test public void aTest() throws Exception { SecureRandom mockRandom = Mockito.mock(SecureRandom.class); PowerMockito.whenNew(SecureRandom.class).withNoArguments().thenReturn(mockRandom); Mockito.when(mockRandom.nextInt(Mockito.anyInt())).thenReturn(3, 0); example.method(); } }
score: 6
accepted answer of: http://stackoverflow.com/q/23375700

http://stackoverflow.com/q/23366880
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/23366950
type: UnansweredQuestion
has title: Get a value from a formula
has comment: http://stackoverflow.com/comment/35790456
has answer: http://stackoverflow.com/a/23366937
has body: I was trying a formula in java to get until th value of 'g' is exactly 1 but i have error "java.lang.NullPointerException" in a specific line. Please help. Here is my code : int k1; //input from user int j,g; int[] f; for (j = 1; j &lt; 224; j++) { f[j] = (1 +(224*j)) / k1; //java.lang.NullPointerException is here g = (k1*f[j]) % 224; if (g==1) { break; } }
has comment: http://stackoverflow.com/comment/35790447
tagged with: java
has comment: http://stackoverflow.com/comment/35790458
has comment: http://stackoverflow.com/comment/35790529
type: Question
has answer: http://stackoverflow.com/a/23366927

http://stackoverflow.com/comment/35824704
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23385471
has text: @MSalters: It allocates as a percentage of RAM. If you have enough RAM to justify 10GB of virtual address space, then "literally megabytes" of page tables is a drop in the ocean. If you have so little RAM that a few megabytes is at all significant, you'll be using less virtual, and thus need less for page tables. It's maybe not *ideal*, but it doesn't matter in any appreciable way.

http://stackoverflow.com/q/23376375
has comment: http://stackoverflow.com/comment/35808733
linked to: http://stackoverflow.com/q/1625814
has answer: http://stackoverflow.com/a/23376422
has body: I have a code populating a listView: JSONArray data = responseData.getJSONArray("data"); String[] values = new String[data.length()];//I wanna get rid of this LinkedHashMap&lt;String, String&gt; helpData = new LinkedHashMap(); for (int i = 0; i &lt; data.length() ; i++) { String header = data.getJSONObject(i).getString("glossary_header"); String description = data.getJSONObject(i).getString("gloassary_description"); helpData.put(header, description); values[i] = header; Log.d("mylog", "counter" + i); } ArrayAdapter&lt;String&gt; adapter = new ArrayAdapter&lt;String&gt;(getActivity(), android.R.layout.simple_list_item_1, values); setListAdapter(adapter); I want to pass the keys to Arrayadapter, I was hoping to find a getKeys() method that could magically return an array of key from the map. KeySet() was close but did not work, what is the proper way to do this. I don't want to use string array. I want to have my pair values together.
type: Question
has title: How to get the keys from a LinkedHasMap?
tagged with: android
possible better answer: http://stackoverflow.com/a/23376422
has answer: http://stackoverflow.com/a/23376767
has comment: http://stackoverflow.com/comment/35808899
score: 0
has comment: http://stackoverflow.com/comment/35808831
answer count: 3
has answer: http://stackoverflow.com/a/23376488
tagged with: linkedhashmap
has comment: http://stackoverflow.com/comment/35808952
tagged with: java
tagged with: http://stackoverflow.com/tag/json
accepted answer: http://stackoverflow.com/a/23376767
has comment: http://stackoverflow.com/comment/35808785
type: AnsweredQuestion

http://stackoverflow.com/q/23386545
has answer: http://stackoverflow.com/a/74665532
has answer: http://stackoverflow.com/a/71198754
has body: I have imported one project into Android Studio but I got the error: Could not find com.android.support:support-v4:19.1.0. Where could I find this file? I have imported the project using Gradle. I have the Android Studio version 0.5.7 the last android sdk and java 1.7u55.
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/23451765
type: Question
upvote count: 4
has answer: http://stackoverflow.com/a/23387081
has answer: http://stackoverflow.com/a/30912941
downvote count: 0
has answer: http://stackoverflow.com/a/23386897
has answer: http://stackoverflow.com/a/23578487
score: 4
favorite count: 0
answer count: 9
tagged with: sdk
tagged with: android
has answer: http://stackoverflow.com/a/24173435
possible better answer: http://stackoverflow.com/a/23450681
accepted answer: http://stackoverflow.com/a/23387081
tagged with: android-studio
has answer: http://stackoverflow.com/a/23450681
has title: Android Studio doesn't find com.android.support:support-v4:19.1.0

http://stackoverflow.com/comment/35768465
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23354326
has text: @singularhum - Did add already. Also it is a RadioGroup which consists of RadioButtons, so I assumed that using `getCheckedRadioButtonId()` is the correct way of adding it into an IF Statement. Because if I were to use the `getChecked()`, all the button would go to the same page instead of different options going to different activities.
score: 0

http://stackoverflow.com/comment/35839038
type: QuestionComment
comment on: http://stackoverflow.com/q/23393000
has text: Why do you want to kill it?
score: 0
type: Comment

http://stackoverflow.com/a/23307570
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/35682367
has comment: http://stackoverflow.com/comment/35682311
has body: [a-zA-Z0-9\(\)\-]* matches strings containing characters a to z, A to Z, 0 to 9, (, )and -. Those last three characters are escaped by a preceding backslash because they have a special meaning when used in a regex (although, in this case, escaping is not necessary. See hwnd's comment).
downvote count: 0
answers question: http://stackoverflow.com/q/23307486
type: Answer

http://stackoverflow.com/q/23380077
type: UnansweredQuestion
tagged with: swing
has title: Getting Labels a name with a label
tagged with: java
tagged with: jpanel
downvote count: 1
type: Question
has body: This panel class is suppose to print out "Course Info" Yet when I do try to print it out on the GUI, the gui frame shows up but not the Panel. So I feel the panel code is the problem, how to get the "Course Info" to appear? And if the label is working correctly, why when I post the label to the gui, it just shows another blank Frame? Panel: import javax.swing.*; import java.awt.*; public class TopPanel extends JPanel { public TopPanel(){ JPanel panel = new JPanel(); JLabel Crse = new JLabel("Course Info"); Crse.setFont(new Font("Serif", Font.PLAIN, 14)); panel.add(Crse); } } GUI code: import javax.swing.*; import java.awt.*; public class CourseGUI extends JFrame { public CourseGUI() { super("CourseGUI Frame"); JPanel topPanel = new JPanel(); topPanel.setBackground(java.awt.Color.WHITE); Dimension d = new Dimension(800,600); topPanel.setPreferredSize(d); this.setLayout(new BorderLayout()); this.add(topPanel, BorderLayout.NORTH); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.setSize(800,600); //JPanel tp = new TopPanel(); //this.add(tp.BorderLayout.North); JPanel panel = new TopPanel(); this.add(panel, BorderLayout.SOUTH); this.setVisible(true); } public static void main(String[] args) { new CourseGUI(); } }
upvote count: 0
score: -1
has answer: http://stackoverflow.com/a/23380166
answer count: 1
favorite count: 0
tagged with: jlabel
tagged with: jframe

http://stackoverflow.com/comment/35683544
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23308363
has text: @SimonC wrong idea withpossible side effects (everything inside run() can kill ....)
score: 0

http://stackoverflow.com/q/23375515
type: UnansweredQuestion
downvote count: 2
type: Question
has comment: http://stackoverflow.com/comment/35807305
tagged with: java
has body: Here is my code: import java.util.Scanner; import java.io.*; public class Warning { public static void main (String[] args)throws IOException { int creditHrs; double qualityPts; double gpa; String name; // Set up scanner to input file Scanner inFile = new Scanner(new File("c:\\students.dat")); System.out.println ("\n Students on Academic Warning\n"); // Process the input file, one token at a time try { while (inFile.hasNext()) { // Get the credit hours and quality points and // determine if the student is on warning. If so, // display the student's name. name = inFile.next(); creditHrs = Integer.parseInt(inFile.next()); qualityPts = Double.parseDouble(inFile.next()); gpa = qualityPts / creditHrs; if(gpa &lt; 2.0) { System.out.println(name); } } } //insert catch statements catch(FileNotFoundException e) { } catch(NumberFormatException e) { } inFile.close(); } } The error is: error: exception FileNotFoundException is never thrown in body of corresponding try statement Why am I getting this? I would think that it not throwing the exception is a good thing and why would it have to tell me that, you know? I really dont understand this.
score: 0
answer count: 2
has title: I'm getting an error: "exception FileNotFoundException is never thrown in body of corresponding try statement" and cannot figure out why
favorite count: 0
linked to: http://stackoverflow.com/q/22613423
tagged with: exception
has answer: http://stackoverflow.com/a/23375563
tagged with: io
has answer: http://stackoverflow.com/a/23375568
has comment: http://stackoverflow.com/comment/35807176
upvote count: 2

http://stackoverflow.com/q/23371457
has comment: http://stackoverflow.com/comment/35881800
tagged with: odbc
has comment: http://stackoverflow.com/comment/35849674
downvote count: 0
tagged with: ms-access
has title: How to resolve "Invalid string or buffer length" after calling resultset.getString() connection from java to access mdb
favorite count: 0
has body: I am having some trouble with my java app querying an Access DB (.mdb). I am getting this error: [Microsoft][ODBC Driver Manager] Invalid string or buffer length but only when attempting to call resultset.getString("xxx") on certain rows. About half of the rows that I am querying process just fine but the other half give me this error. It seems like a problem with the data in the row itself but I can't quite figure out what would cause this.
type: UnansweredQuestion
tagged with: jdbc
answer count: 0
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/35801191
type: Question
score: 3
has comment: http://stackoverflow.com/comment/35839179

http://stackoverflow.com/a/23437763
answers question: http://stackoverflow.com/q/23437722
score: 0
has body: If Arrays.sort won't compile, you're Doing It Wrong. In any case, you need to define custom Comparator&lt;LibraryBook&gt; objects that each compare the relevant field, and then sort using those. If you're going to keep multiple data structures anyway, might as well make them SortedSets instead of plain arrays.
type: Answer

http://stackoverflow.com/q/23355780
has body: This is how I want my app to look like. Trouble is, if I drag the JLabel with the "Hello, I'm Myra" over another JLabel (whose icon is the speech bubble), rather than superimposing or layering, NetBeans shifts the JLabels to be adjacent. How do I superimpose ie. place the text JLabel on top of another JLabel? Do note, I'm using NetBeans. It doesn't allow me to edit much of the JFrame or JLabel code.
tagged with: jpanel
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/23356033
has answer: http://stackoverflow.com/a/23355828
tagged with: jlabel
type: UnansweredQuestion
has title: Layering text over JLabel
tagged with: netbeans
tagged with: java
tagged with: swing
type: Question

http://stackoverflow.com/a/23434769
answers question: http://stackoverflow.com/q/23434714
has comment: http://stackoverflow.com/comment/35918760
type: Answer
has comment: http://stackoverflow.com/comment/35927615
score: 3
upvote count: 3
has body: The general way to do most Swing drawing is via passive graphics. This means: Do the drawing itself in the paintComponent(Graphics g) method of a JPanel or JComponent. In your MouseListener change the state of some of the fields of the class. In your mouseClicked method you are setting the state of some local variables, and I recommend that you instead make your x and y fields, not local. Then when the mouse listener is done making changes, call repaint() on the JPanel. Then in the paintComponent method, use those fields that were changed in the mouse listener to do your drawing. Don't forget to call the super's paintComponent method in your paintComponent override. Don't forget to read tutorials on Swing Graphics to get the fine points. Edit For example, please have a look at a small graphics program that I created for an answer to another recent question. The drawing occurs in the main class, SpaceShip, which extends JPanel. I add an anonymous inner MouseAdapter class for my Mouse Listener, and inside of the MouseAdapter, I call a method called moveIt, passing in the MouseEvent object. MouseAdapter myMouseAdapter = new MouseAdapter() { public void mousePressed(MouseEvent evt) { moveIt(evt); count = count + 1; } @Override public void mouseDragged(MouseEvent evt) { moveIt(evt); } }; addMouseListener(myMouseAdapter); addMouseMotionListener(myMouseAdapter); } All moveIt(MouseEvent evt) does is to change the state of two fields, myX and myY, and then calls repaint() on the current class: public void moveIt(MouseEvent evt) { myY = evt.getY() - sprite.getHeight() / 2; myX = evt.getX() - sprite.getWidth() / 2; repaint(); } And then in the class's paintComponent method, I first call the super's paintComponent to allow it to erase any previous old out of date images, then I paint a background image, background, then I draw a sprite that uses the myX and myY variables to tell it where to draw, then I draw some yellow rectangles at locations that are determined by the JPanel'…
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/35918308
accepted answer of: http://stackoverflow.com/q/23434714

http://stackoverflow.com/comment/35883910
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23401578
has text: I am pretty sure that it is. Whenever I used @Async I always had a task executor

http://stackoverflow.com/q/23320002
tagged with: methods
type: Question
has answer: http://stackoverflow.com/a/23320612
answer count: 2
score: -1
tagged with: class
has body: I want to create a program for a simple game. The game has 3 classes: Player: contains player details like username, family name and last name Nimsys: the system containing all the methods for the game functions, can have up to 100 players NimGame: 1 game is played by 2 players only Question: I have created the 3 classes but I don't know how to link the classes together. How do I add a player name using Scanner and StringTokenizer to separate the username, family name and last name? Should my main method be in NimGame class? In my code, when I call NimPlayer.addPlayer(), it has error message that the method addPlayer is undefined for type NimPlayer. Please help how to use method addPlayer?? So far my code looks like this: public class NimGame { int currentStoneCount, stoneRemovalUpperBound; private NimPlayer player1, player2; public static void main (String [] args) { System.out.println ("Welcome to Nim"); System.out.println("\n&gt;"); **NimPlayer.addPlayer();** } public class NimPlayer { String userName, givenName, familyName, newFamilyName, newGivenName; int gamesPlayed, gamesWon, gamesLost; /*Constructor*/ public NimPlayer (String userName, String givenName, String familyName, String newFamilyName, String newGivenName) { this.userName = userName; this.givenName = givenName; this.familyName = familyName; this.newFamilyName = newFamilyName; this.newGivenName = newGivenName; } } import java.util.Scanner; java.util.StringTokenizer; public class Nimsys { public static void addPlayer() { Scanner keyboard = new Scanner (System.in); String [ ] player = new String [100]; //an array of 100 players for (int i = 0; i &lt; 100; i++) { boolean isInArray = false; String NimPlayer = keyboard.next(); String delimiters = " add player, "; //add player, comma and blank space StringTokenizer nameFactory = new StringTokenizer (NimPlayer, delimiters); String userName = nameFactory.nextToken(); String familyName = nameFactory.nextToken(); String givenName = nameFactory.nextToken(); if (…
downvote count: 1
favorite count: 0
has title: Can I call a method which I create in another class in my current class in java?
type: UnansweredQuestion
upvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/23320038

http://stackoverflow.com/a/23304145
has comment: http://stackoverflow.com/comment/35676303
upvote count: 3
has comment: http://stackoverflow.com/comment/35676280
accepted answer of: http://stackoverflow.com/q/23304104
has comment: http://stackoverflow.com/comment/35676521
has comment: http://stackoverflow.com/comment/35677123
type: Answer
downvote count: 1
has comment: http://stackoverflow.com/comment/35677286
answers question: http://stackoverflow.com/q/23304104
has body: If I understand your question correctly, you can (mis)use Java's Stack Trace system to determine the caller. Put something like this in the constructor of an object: try { throw new Exception(); } catch (Exception ex) { String s = ex.getStackTrace()[1].getClassName(); System.out.println(s); } I doub't that's EXACTLY what you are looking for, but, if you play around with it a bit, I think you'll find what you want.
has comment: http://stackoverflow.com/comment/35676739
has comment: http://stackoverflow.com/comment/35676332
has comment: http://stackoverflow.com/comment/35676589
has comment: http://stackoverflow.com/comment/35680993
has comment: http://stackoverflow.com/comment/35676710
has comment: http://stackoverflow.com/comment/35676228
score: 2
has comment: http://stackoverflow.com/comment/35676703
has comment: http://stackoverflow.com/comment/35679912
has comment: http://stackoverflow.com/comment/35676765
has comment: http://stackoverflow.com/comment/36009649
has comment: http://stackoverflow.com/comment/35677182
has comment: http://stackoverflow.com/comment/35679763
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35676515

http://stackoverflow.com/q/23418133
downvote count: 0
has title: Parallel Sequence Alignment Algorithm
type: Question
tagged with: string-matching
tagged with: parallel-processing
has answer: http://stackoverflow.com/a/23418325
accepted answer: http://stackoverflow.com/a/23418325
has comment: http://stackoverflow.com/comment/47610281
tagged with: algorithm
tagged with: java
tagged with: sequence-alignment
has body: I am working on implementing an efficient sequence alignment algorithm using parallelism in Java. I want to return all the possible positions of the sequence. Can you guys suggest an algorithm for which this is doable? I have looked into the Needem-Wunsch an Smith-Waterman but I am looking for something a little less complex but that still is efficient. I have just started working with parallelism so it cannot be too complex. Thanks.
upvote count: 2
answer count: 1
favorite count: 0
type: AnsweredQuestion
score: 2

http://stackoverflow.com/comment/35703083
has text: Thank you very much, I really find it.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23318796
score: 0

http://stackoverflow.com/q/23398399
favorite count: 0
has comment: http://stackoverflow.com/comment/35849533
has body: I've created a simple Java application that tries to read in a file, and complete an action on the file. Problem: Upon requesting the file with the absolute path I get an FileNotFoundException. public static void main(String... args) throws Exception { String path = "/Users/kentandersen/Downloads/greendaoprotobuf-master/test"; File files = new File(path); System.out.println(files.getAbsoluteFile()); System.out.print(files.canRead() + "\n"); //Error occurs here. String[] fileNames = new Scanner(files, "UTF-8").useDelimiter("\\A").next().split("\n"); } Below are the logs. /Users/kentandersen/Downloads/greendaoprotobuf-master/test true Exception in thread "main" java.io.FileNotFoundException: /Users/kentandersen/Downloads/greendaoprotobuf-master/test (No such file or directory) at java.io.FileInputStream.open(Native Method) at java.io.FileInputStream.&lt;init&gt;(FileInputStream.java:120) at java.util.Scanner.&lt;init&gt;(Scanner.java:654) Process finished with exit code 1 The logs clearly state that I can read those files, and then Scanner runs and says it doesn't exist. I can copy the absolute path in the logs and CD to that location, and it takes me there. I'm using Intellij 13.
score: 1
has answer: http://stackoverflow.com/a/23398518
accepted answer: http://stackoverflow.com/a/23398518
has comment: http://stackoverflow.com/comment/35850088
has title: Cant read files - java.io.FileNotFoundException: (No such file or directory)
type: Question
has comment: http://stackoverflow.com/comment/35850357
type: AnsweredQuestion
tagged with: filenotfoundexception
has comment: http://stackoverflow.com/comment/35850332
tagged with: java
has comment: http://stackoverflow.com/comment/35850023
upvote count: 1
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/35850408

http://stackoverflow.com/a/23424295
upvote count: 2
accepted answer of: http://stackoverflow.com/q/23424023
answers question: http://stackoverflow.com/q/23424023
has body: Try this one mysite\.com/(\d{4}/\d{2}/\d{2}/)? here ? means zero or more occurance Note: use escape character \. for dot match because .(dot) is already used in regex Sample code : String[] webContents = new String[] { "mysite.com/myimage.png", "mysite.com/1234/12/12/myimage.png" }; for (String webContent : webContents) { String text = webContent.replaceAll("mysite\\.com/(\\d{4}/\\d{2}/\\d{2}/)?", String.valueOf("mysite.com/abc/")); System.out.println(text); } output: mysite.com/abc/myimage.png mysite.com/abc/myimage.png
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 2

http://stackoverflow.com/a/23397538
has comment: http://stackoverflow.com/comment/35847716
answers question: http://stackoverflow.com/q/23397449
has body: You could do System.out.println(Integer.decode(s));
type: Answer
has comment: http://stackoverflow.com/comment/35847931
score: 5
upvote count: 5
downvote count: 0
has comment: http://stackoverflow.com/comment/35847829

http://stackoverflow.com/comment/35891918
comment on: http://stackoverflow.com/a/23421070
score: 0
type: Comment
has text: Thank you very much, I assumed the @Test was not important because of the appearance of the text in eclipse. I appreciate the quick response.
type: AnswerComment

http://stackoverflow.com/q/23350904
type: Question
upvote count: 0
tagged with: runtime
answer count: 1
favorite count: 0
tagged with: batch-file
has body: how do i get output from a batch file, but also give input to a batch file? My Q. is self-explanitory. Like i made a small code to run a batch file: Process process = Runtime.getRuntime().exec("(my file)");. but now what?
tagged with: windows
type: UnansweredQuestion
tagged with: process
has answer: http://stackoverflow.com/a/23350922
downvote count: 1
tagged with: java
has title: How to get output and give input from/to batch file using java
score: -1

http://stackoverflow.com/a/23335298
answers question: http://stackoverflow.com/q/23335200
has comment: http://stackoverflow.com/comment/41873491
has body: Make the following modifications to your code: @Autowired private FilterChainProxy filterChainProxy; @Before public void setUp() { MockitoAnnotations.initMocks(this); this.mockMvc = webAppContextSetup(wac).dispatchOptions(true).addFilters(filterChainProxy).build(); }
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 8
upvote count: 8
has comment: http://stackoverflow.com/comment/41872582
accepted answer of: http://stackoverflow.com/q/23335200
has comment: http://stackoverflow.com/comment/52107588

storage
tag name: storage
tags question: http://stackoverflow.com/q/23395973
type: Tag

http://stackoverflow.com/q/23354648
has comment: http://stackoverflow.com/comment/35768664
upvote count: 0
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/35768871
has body: This is my savemap method. public void savemap (File file,ArrayList&lt;Cell&gt; obstacles) { if (file == null) { if (chooser == null) chooser = createChooser(); chooser.setDialogType(JFileChooser.SAVE_DIALOG); int r = chooser.showDialog(this, null); if (r != JFileChooser.APPROVE_OPTION) return; file = chooser.getSelectedFile(); } /** * For obstacles added to the program: * Simple parsing of relevant data into txt file for easy reading. * Rows will be written like so: * * 50 25 b * 51 25 b * 52 25 b * 34 28 n * . * . * * Column, followed by row, followed by type of obstacle. * Assumption: Only one obstacle per cell. Should be a relatively simple extension for multiple obstacles per cell. */ try { Writer writer = new BufferedWriter(new OutputStreamWriter( new FileOutputStream(file), "utf-8")); for(int i = 0; i &lt; obstacles.size(); i++) { Cell currentCell = obstacles.get(i); writer.write(Integer.toString(currentCell.c)); writer.write(" "); writer.write(Integer.toString(currentCell.r)); writer.write(" "); if(currentCell.isBlocked()) writer.write(blockedChar); else if(currentCell.isGoal()) writer.write(goalChar); else if(currentCell.hasNest()) writer.write(nestChar); writer.write("\n"); } writer.close(); } how do i take in arraylist and file in the parameter of my save map method? when i take it in like this, an error happens saying that file is not resolve as a variable and Arraylist are not resolve as variables. item = menu.add(new JMenuItem("Save Map...")); item.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ AntsControlPanel.this.savemap(file,ArrayList&lt;Cell&gt; obstacles); } } ); here is the part where i declare file and arraylist. public class AntsControlPanel extends JPanel{ private Ants ants; private JPanel panel = new JPanel(); private JButton timerButton = new JButton("\u25BA"); private JSlider speedSlider; private JComboBox patternComboBox; private JComboBox sizeComboBox; private JTextField stat = null; private JFileChoo…
has comment: http://stackoverflow.com/comment/35768747
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35768949
tagged with: java
downvote count: 2
tagged with: file
type: Question
score: -2
has answer: http://stackoverflow.com/a/23354905
has comment: http://stackoverflow.com/comment/35768910
has comment: http://stackoverflow.com/comment/35769005
has title: how do i take in arraylist and file into my action performed savemap method?
tagged with: arraylist
has comment: http://stackoverflow.com/comment/35768718
accepted answer: http://stackoverflow.com/a/23354905

http://stackoverflow.com/comment/35687525
type: Comment
has text: You're storing things inside a LinkedHashSet in memory, without ever removing anything from it. That's probably where the memory problem comes from.
comment on: http://stackoverflow.com/q/23310245
score: 0
type: QuestionComment

http://stackoverflow.com/comment/35850915
comment on: http://stackoverflow.com/a/23398865
type: Comment
has text: Well, I didn't check the list , but from what I've read, "java/util/Objects" is available on Android: http://developer.android.com/reference/java/util/Objects.html . so... is this list is of all 1.7 new classes? wonder how many of them are supported and how many aren't.
score: 0
type: AnswerComment

http://stackoverflow.com/q/23355634
has comment: http://stackoverflow.com/comment/35770432
has comment: http://stackoverflow.com/comment/35770625
upvote count: 1
downvote count: 1
tagged with: text
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/23356101
type: Question
score: 0
favorite count: 0
has title: How can i extract specific terms from string lines in Java?
accepted answer: http://stackoverflow.com/a/23356101
answer count: 3
has comment: http://stackoverflow.com/comment/35770665
has comment: http://stackoverflow.com/comment/35770464
has comment: http://stackoverflow.com/comment/35770326
has comment: http://stackoverflow.com/comment/35770564
has answer: http://stackoverflow.com/a/23356026
has body: I have a serious problem with extracting terms from each string line. To be more specific, I have one csv formatted file which is actually not csv format (it saves all terms into line[0] only) So, here's just example string line among thousands of string lines: (split() doesn't work.!!! ) test.csv "31451 CID005319044 15939353 C8H14O3S2 beta-lipoic acid C1C[S@](=O)S[C@@H]1CCCCC(=O)O " "12232 COD05374044 23439353 C924O3S2 saponin CCCC(=O)O " "9048 CTD042032 23241 C3HO4O3S2 Berberine [C@@H]1CCCCC(=O)O " I want to extract "beta-lipoic acid" ,"saponin" and "Berberine" only which is located in 5th position. You can see there are big spaces between terms, so that's why I said 5th position. In this case, how can I extract terms located in 5th position for each line? One more thing: the length of whitespace between each of the six terms is not always equal. the length could be one, two, three, four, or five, or something like that. Because the length of whitespace is random, I can not use the .split() function. For example, in the first line I would get "beta-lipoic" instead "beta-lipoic acid.**
possible better answer: http://stackoverflow.com/a/23355945
has comment: http://stackoverflow.com/comment/35770471
has answer: http://stackoverflow.com/a/23355945

http://stackoverflow.com/comment/35836022
type: Comment
score: 0
comment on: http://stackoverflow.com/a/23391431
type: AnswerComment
has text: I agree that this pattern is good from a design stand point. But " At runtime, you can set this field with the exact implementation that you need at that time " - to do this we will need a conditional branching based on level correct?

http://stackoverflow.com/q/23347318
tagged with: instantiation
has comment: http://stackoverflow.com/comment/35761436
has comment: http://stackoverflow.com/comment/35756196
score: 0
answer count: 2
upvote count: 1
downvote count: 1
has answer: http://stackoverflow.com/a/23347390
tagged with: generics
favorite count: 0
has comment: http://stackoverflow.com/comment/35754699
has answer: http://stackoverflow.com/a/23347703
accepted answer: http://stackoverflow.com/a/23347703
possible better answer: http://stackoverflow.com/a/23347390
type: AnsweredQuestion
tagged with: java
has title: How do I pass the "T" argument to as a method parameter using Java generics?
type: Question
has body: I’m using JBoss 7.1.3 with Java 6. I’m having trouble trying to figure out what I need to substitute for “???” in the below code to get my method to work properly. What I want is to instantiate an instance of my “T” class, invoking the generic constructor each time I instantiate the class. Below is the method … public class MyClass&lt;T extends AbstractModel&gt; { public void myMethod() { … final HashMap&lt;String, String&gt; data = new HashMap&lt;String, String&gt;(); final T item = getInstance(???, data); } private T getInstance(final Class&lt;T&gt; class1, final HashMap&lt;String, String&gt; data) { T retObj = null; try { Constructor ct = class1.getDeclaredConstructor(HashMap.class); Object[] argList = new Object[1]; argList[0] = data; retObj = (T) ct.newInstance(argList); } catch (Exception e) { } // try return retObj; } // getInstance here is the constructor for my abstract model class … public abstract class AbstractDIDOModel { protected HashMap&lt;String, String&gt; data; AbstractModel(final HashMap&lt;String, String&gt; data) { this.data = data; }

http://stackoverflow.com/comment/35775503
type: QuestionComment
has text: @OlegEstekhin right before operations 1, 2 and 3 the index is checked to be positive anyway I counted zero bound checks as eliminated, though it would be nonsense if JIT generate two equal checks one after another.
comment on: http://stackoverflow.com/q/23358351
score: 0
type: Comment

applet
tags question: http://stackoverflow.com/q/23304277
tags question: http://stackoverflow.com/q/23409824
tags question: http://stackoverflow.com/q/23342292
tags question: http://stackoverflow.com/q/23334776
tags question: http://stackoverflow.com/q/23382949
tags question: http://stackoverflow.com/q/23407719
tags question: http://stackoverflow.com/q/23333596
tags question: http://stackoverflow.com/q/23402933
tags question: http://stackoverflow.com/q/23439843
tags question: http://stackoverflow.com/q/23365305
tags question: http://stackoverflow.com/q/23420819
tags question: http://stackoverflow.com/q/23380802
tags question: http://stackoverflow.com/q/23439318
tags question: http://stackoverflow.com/q/23385949
tags question: http://stackoverflow.com/q/23358370
tags question: http://stackoverflow.com/q/23416272
type: Tag
tags question: http://stackoverflow.com/q/23448848
tag name: applet
tags question: http://stackoverflow.com/q/23347042
tags question: http://stackoverflow.com/q/23350350
tags question: http://stackoverflow.com/q/23303259
tags question: http://stackoverflow.com/q/23449720
tags question: http://stackoverflow.com/q/23367567
tags question: http://stackoverflow.com/q/23331223
tags question: http://stackoverflow.com/q/23343749
tags question: http://stackoverflow.com/q/23396527
tags question: http://stackoverflow.com/q/23428838
tags question: http://stackoverflow.com/q/23452165
tags question: http://stackoverflow.com/q/23439732
tags question: http://stackoverflow.com/q/23317126
tags question: http://stackoverflow.com/q/23393697
tags question: http://stackoverflow.com/q/23435362
tags question: http://stackoverflow.com/q/23451335
tags question: http://stackoverflow.com/q/23406044
tags question: http://stackoverflow.com/q/23434158
tags question: http://stackoverflow.com/q/23295241
tags question: http://stackoverflow.com/q/23365183
tags question: http://stackoverflow.com/q/23327752
tags question: http://stackoverflow.com/q/23431963
tags question: http://stackoverflow.com/q/23302344

http://stackoverflow.com/a/23443850
type: Answer
has body: You are checking t1.getAssignedString() is null , you need to check t1!=null. For the case of t2 also.
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/23443820
downvote count: 0

http://stackoverflow.com/q/23381887
downvote count: 0
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
tagged with: subreport
type: UnansweredQuestion
upvote count: 1
has comment: http://stackoverflow.com/comment/36147145
score: 1
tagged with: java
tagged with: datasource
has body: I have report with 2 sub-reports in which the XML is: Its as per this linK Link to create subreport <?xml version="1.0" encoding="UTF-8" standalone="yes"?> Funding 50 55210 530 250 Person To Person 75 78000 780 350 Load Float 30 3000 0 0 9535789377931 17-APR-2014 <Time>18:04:35 Funding Fund Success 100 2 1 0003466476 Service Provider Fee A/C 0000000000 2 C 9535789377931 17-APR-2014 <Time>18:04:35 Funding Fund Success 100 2 1 0007923578 Service Provider Commission A/C 0000000000 1 C The jrxml of main report is: <?xml version="1.0" encoding="UTF-8"?> <jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="TransactionReport" pageWidth="842" pageHeight="595" orientation="Landscape" columnWidth="802" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="5f706135-d62b-4d94-a8ec-8d2f0d137aa9"> <property name="ireport.zoom" value="1.0"/> <property name="ireport.x" value="0"/> <property name="ireport.y" value="0"/> <parameter name="Subreport_1" class="net.sf.jasperreports.engine.JasperReport"/> <parameter name="Subreport_2" class="net.sf.jasperreports.engine.JasperReport"/> /Report <reportElement x="0" y="0" width="187" height="67" uuid="325d0803-5a7b-4f06-a809-8c8a3e83bf8c"/> <subreportParameterExpression> $P{XML_DATA_DOCUMENT} </subreportParameterExpression> $P{Subreport_1} <reportElement x="0" y="0" width="197" height="66" uuid="3064bea5-2e7f-4cfc-ae02-3745703af1b0"/> <subreportParameterExpression> $P{XML_DATA_DOCUMENT} </subreportParameterExpression> $P{Subreport_2} </jasperReport> The jrxml of sub-report 1: <?xml version="1.0" encoding="UTF-8"?> <jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://ja…
type: Question
tagged with: jasper-reports
has answer: http://stackoverflow.com/a/23398706
has comment: http://stackoverflow.com/comment/36233666
has title: In Jasper report how to create report pdf using subreport for XML datasource
answer count: 1

http://stackoverflow.com/q/23327920
accepted answer: http://stackoverflow.com/a/23351450
downvote count: 0
favorite count: 0
has body: It's a while since I met such puzzling issue. I'm having a class that references another one sitting in another package in the same application, that is, NOT in another jar archive file. The including class is learnintouch-rest/src/test/java/com/thalasoft/learnintouch/rest/acceptance/AbstractControllerTest.java The included class is /home/stephane/dev/java/projects/learnintouch-rest/src/test/java/com/thalasoft/learnintouch/rest/config/WebTestConfiguration.java Under Eclipse there is no issue and no compilation error in the editor. But running a Maven build gives a compilation error: mvn clean test-compile -Pacceptance [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:testCompile (default-testCompile) on project learnintouch-rest: Compilation failure: Compilation failure: [ERROR] /home/stephane/dev/java/projects/learnintouch-rest/src/test/java/com/thalasoft/learnintouch/rest/acceptance/AbstractControllerTest.java:[16,46] cannot find symbol [ERROR] symbol: class WebTestConfiguration [ERROR] location: package com.thalasoft.learnintouch.rest.config [ERROR] /home/stephane/dev/java/projects/learnintouch-rest/src/test/java/com/thalasoft/learnintouch/rest/acceptance/AbstractControllerTest.java:[21,116] cannot find symbol [ERROR] symbol: class WebTestConfiguration Here is the code of the including class: @RunWith(SpringJUnit4ClassRunner.class) @Transactional @WebAppConfiguration @ContextConfiguration(classes = { ApplicationConfiguration.class, WebSecurityConfig.class, WebConfiguration.class, WebTestConfiguration.class }) public abstract class AbstractControllerTest { This abstract test class is sitting under the acceptance test directory, which mandates the explicit activation of the -Pacceptance profile when running the Maven command. The default profile does not run this acceptance test, but only some integration test. One thing to note, is that this abstract class looks like the one abstract class used in the integration test. Here is the i…
answer count: 3
has answer: http://stackoverflow.com/a/27709895
type: AnsweredQuestion
tagged with: maven
score: 11
tagged with: spring
type: Question
tagged with: java
upvote count: 11
tagged with: eclipse
possible better answer: http://stackoverflow.com/a/27709895
has title: Maven compile gives: Cannot find symbol - For a class sitting in the same app
has answer: http://stackoverflow.com/a/23351450
has answer: http://stackoverflow.com/a/23328039

http://stackoverflow.com/comment/35722252
type: Comment
score: 1
comment on: http://stackoverflow.com/q/23329352
has text: **TL;DR**. This is far too much code. Narrow it down to an SSCCE.
type: QuestionComment

http://stackoverflow.com/a/23357329
has body: at the end these both have same elements(MonitorComponent).. they are pointing to same objects in memory.. You have to make clone of every MonitorComponent inside the list.. You will need to iterate on the items, and clone them one by one, putting the clones in your result arraylist as you go. public static List&lt;MonitorComponent&gt; cloneList(List&lt;MonitorComponent&gt; list) { List&lt;MonitorComponent&gt; clone = new ArrayList&lt;MonitorComponent&gt;(list.size()); for(MonitorComponent item: list) clone.add(item.clone()); return clone; } For that to work, obviously, you will have to get your MonitorComponent object to implement the Cloneable interface, and the clone() method.
upvote count: 1
score: 1
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/23357297

jpanel
tags question: http://stackoverflow.com/q/23315087
tags question: http://stackoverflow.com/q/23326829
tags question: http://stackoverflow.com/q/23348989
tags question: http://stackoverflow.com/q/23384327
tags question: http://stackoverflow.com/q/23436424
tags question: http://stackoverflow.com/q/23355780
tags question: http://stackoverflow.com/q/23420908
tags question: http://stackoverflow.com/q/23399724
tags question: http://stackoverflow.com/q/23369447
tags question: http://stackoverflow.com/q/23341355
tags question: http://stackoverflow.com/q/23298336
tags question: http://stackoverflow.com/q/23299326
type: Tag
tags question: http://stackoverflow.com/q/23439512
tags question: http://stackoverflow.com/q/23329033
tags question: http://stackoverflow.com/q/23330385
tags question: http://stackoverflow.com/q/23309375
tags question: http://stackoverflow.com/q/23329020
tags question: http://stackoverflow.com/q/23432620
tags question: http://stackoverflow.com/q/23434550
tags question: http://stackoverflow.com/q/23303898
tags question: http://stackoverflow.com/q/23416202
tags question: http://stackoverflow.com/q/23379850
tags question: http://stackoverflow.com/q/23375995
tags question: http://stackoverflow.com/q/23378755
tags question: http://stackoverflow.com/q/23323085
tags question: http://stackoverflow.com/q/23422775
tags question: http://stackoverflow.com/q/23432629
tags question: http://stackoverflow.com/q/23396048
tags question: http://stackoverflow.com/q/23380077
tags question: http://stackoverflow.com/q/23314005
tags question: http://stackoverflow.com/q/23355447
tags question: http://stackoverflow.com/q/23306218
tags question: http://stackoverflow.com/q/23398214
tag name: jpanel
tags question: http://stackoverflow.com/q/23370241
tags question: http://stackoverflow.com/q/23315416
tags question: http://stackoverflow.com/q/23411332
tags question: http://stackoverflow.com/q/23300461
tags question: http://stackoverflow.com/q/23372393
tags question: http://stackoverflow.com/q/23358362
tags question: http://stackoverflow.com/q/23308363
tags question: http://stackoverflow.com/q/23403555
tags question: http://stackoverflow.com/q/23357919
tags question: http://stackoverflow.com/q/23445375
tags question: http://stackoverflow.com/q/23450850

http://stackoverflow.com/q/23312518
answer count: 0
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question
has comment: http://stackoverflow.com/comment/35822201
tagged with: ios
has body: We are sending Unicode strings in JSON. but IOS automatically converts character into their Unicodes, due to which it is converting in codes like : \U0928 Now the issue is from JAVA side its being converted into Object where it crashes because of Capital U in to Unicodes and Giving Error " Invalid JSON Escape sequence ". We tried to use stringByReplacingOccurenceOfString Method to replace \U with \u, but event though it is not sending \u.
downvote count: 0
tagged with: unicode
favorite count: 0
has title: iOS - JAVA - JSON - Invalid JSON escape sequence for unicode
tagged with: unicode-escapes
type: UnansweredQuestion
upvote count: 1

http://stackoverflow.com/a/23576768
score: 2
downvote count: 0
has body: The method you follow now WOULD be the best method. I have been using the same in my application and it works fine in production. I have the same use case as yours. But you need to release your root application module using Configuration.releaseRootApplicationModule(appMod, true); not Configuration.releaseRootApplicationModule(appMod, false); Reason: http://www.jobinesh.com/2011/12/some-tips-on-application-module-usage.html Do I need some how to release the application module at the end of the application? Is it necessary? It IS NECESSARY. Calling createRootApplicationModule() will use a connection from your connection pool and if you do not release it properly your application can crash at some point of time due to connection unavailability. I would suggest following this post :http://andrejusb.blogspot.in/2013/03/optimizing-long-running-adf-operations.html and create a AM for your scheduler.
upvote count: 2
answers question: http://stackoverflow.com/q/23365231
type: Answer

http://stackoverflow.com/q/23451173
upvote count: 3
type: Question
accepted answer: http://stackoverflow.com/a/23451458
type: AnsweredQuestion
tagged with: java
downvote count: 3
has title: How to move and object in a straight line with consistent speed
has comment: http://stackoverflow.com/comment/35948123
answer count: 1
has body: I am trying to move a circle in a straight line. But my Code is not giving expected results. I m using mouseMotionListener to constantly get the target points and x_pos and y_pos are co-ordinated for my circle. I am using trigonometric function sin cos and atan, to move the object in straight line --its a logic i have seen here from a question posted on stack overflow-- but it is not giving me the expected results, am i doing something wrong plz help: import java.awt.Graphics; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.awt.event.MouseMotionListener; import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import java.util.logging.Level; import java.util.logging.Logger; import javax.imageio.ImageIO; import javax.swing.JPanel; import java.awt.*; import javax.swing.*; public class Snake extends JPanel { static Snake snake = new Snake(); static Co_Ordinates co = new Co_Ordinates(); static int x_pos = 10, y_pos = 500; static int slope; int delta_x,delta_y; double direction; double x_inc,y_inc; public Snake() { } @Override protected void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2d=(Graphics2D)g; g2d.setColor(Color.green); g2d.fillArc(x_pos, y_pos, 20, 20, 0, 360); try { Thread.sleep(10); } catch (Exception e) { } /*if(x_pos==co.x_Cur){ if(co.y_Cur&gt;=y_pos) y_pos++; else if(co.y_Cur&lt;=y_pos) y_pos--; } else if(y_pos==co.y_Cur){ if(co.x_Cur&gt;=x_pos) x_pos++; else if(co.x_Cur&lt;=x_pos) x_pos--; } */ //slope=((co.y_Cur - y_pos) / (co.x_Cur - x_pos)); //y_pos = slope*x_pos+y_pos; //x_pos++; //System.out.println("..."); if(x_pos!=co.x_Cur&amp;&amp;y_pos!=co.y_Cur){ int delta_x = co.x_Cur - x_pos; int delta_y = co.y_Cur - y_pos; direction = Math.atan(delta_y / delta_x); // Math.atan2(deltaY, deltaX) does the same thing but checks for deltaX being zero to prevent divide-by-zero exceptions double speed = 5.0; x_inc …
favorite count: 0
score: 0
linked to: http://stackoverflow.com/q/18732605
has answer: http://stackoverflow.com/a/23451458

http://stackoverflow.com/q/23311774
tagged with: database
has title: rs.next returns only one result in java
score: 0
tagged with: sql
answer count: 1
has answer: http://stackoverflow.com/a/23311796
type: UnansweredQuestion
tagged with: java
has body: I am attempting to run following code : ResultSet rs=DatabaseConnection.executeQuery("Select * from csr where c_No="+this.c_No); if(rs.next()){ ob_id=rs.getInt("ID"); } ResultSet rs1=DatabaseConnection.executeQuery("Select * from cs_details"); if(rs1.next()){ cs_id=rs1.getInt("cs_Id"); DatabaseConnection.executeUpdate("Insert into transact (ob_ID, cs_ID, quant) values("+this.ob_id+", "+this.cs_id+", 0)"); } In this code, ob_id returns only one value from database which is true. But second query returns multiple rows from which I need to keep only a single column value i.e. cs_id (every time). But while executing this code, it takes only first cs_id value in database &amp; insert only one record in "transact" table. I need to insert all records with respective values of cs_id. How to solve this problem???
type: Question

http://stackoverflow.com/q/23336862
tagged with: spring
has title: ScheduledTimerTask prevent overlap
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/35741739
has comment: http://stackoverflow.com/comment/35740026
type: UnansweredQuestion
has body: I'm using spring's ScheduledTimerTask to schedule some tasks to schedule some tasks. <property name="timerTask" ref="someScheduler" /> <property name="timerTask" ref="anotherScheduler" /> How to make sure anotherScheduler won't execute when someScheduler is being executed?
has comment: http://stackoverflow.com/comment/35739826
tagged with: spring-scheduled
answer count: 0
type: Question

http://stackoverflow.com/q/23325760
tagged with: version
tagged with: jpa
downvote count: 0
tagged with: unique
favorite count: 0
accepted answer: http://stackoverflow.com/a/24354873
possible better answer: http://stackoverflow.com/a/23346684
has body: i have an entity with a unique name. In my example i save two persons with the same name. At the second time comes an "EntityExists" (Unique) Exception, that was the expected behavior. After it i changed name and set the "ID" to null. Than i try to persist it again but i get "org.apache.openjpa.persistence.EntityExistsException: Attempt to persist detached object "com.Person@1117a20". If this is a new instance, make sure any version and/or auto-generated primary key fields are null/default when persisting. without the version it works but i find no solution to "reset" the version number. Can someone help me? Update: My new problem is, that i have a base entity an two pcVersionInit (look at my answer at bottom) i can't override it, i tried it in base and normal entity what is the best practise now instead of "override" the value in pcVersionInit ? Copy Constructor?" public class Starter{ private static EntityManager em; public static void main(String[] args) { em = Persistence.createEntityManagerFactory("openjpa") .createEntityManager(); Person p1 = new Person("TEST"); savePerson(p1); Person p2 = null; try{ p2 = new Person("TEST"); savePerson(p2); }catch(Exception e){ p2.setId(null); p2.setName(p2.getName()+"2"); em.persist(p2); } } private static void savePerson(Person person){ em.getTransaction().begin(); em.persist(person); em.getTransaction().commit(); } } Person.class: @Entity public class Person implements Serializable{ @Id @GeneratedValue(strategy = GenerationType.SEQUENCE,generator="seqGenerator") @SequenceGenerator(name="seqGenerator",sequenceName="personSeq") private Long id; @Version private Long version; @Column(nullable=true, unique=true) private String name; public Person(String name) { this.name = name; } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public Long getVersion() { return version; } public void setVersion(Long ve…
upvote count: 2
has answer: http://stackoverflow.com/a/23346684
has title: Save entity after unique constraint exception
type: AnsweredQuestion
score: 2
tagged with: java
tagged with: openjpa
type: Question
has answer: http://stackoverflow.com/a/24354873
answer count: 2

http://stackoverflow.com/comment/35722409
type: AnswerComment
score: 0
type: Comment
has text: No, this doesn't seem to work either. I have noticed though that the last element in the arraylist is the one that gets printed multiple times.
comment on: http://stackoverflow.com/a/23329415

http://stackoverflow.com/comment/35916890
type: Comment
type: QuestionComment
has text: @JonSkeet: how can I argue with you? So changed. I also have to add to the original poster that you'll want to cut back on empty lines. One empty line in a row is enough. Any more than that also reduces your code's readability. Again the equation here is: improved code readability and improved clarity of question == improved odds of getting decent answers. Good luck!
comment on: http://stackoverflow.com/q/23434597
score: 3

http://stackoverflow.com/comment/35938776
type: Comment
has text: Or you can also study Groovy and Grails and make your life a lot easier. :)
comment on: http://stackoverflow.com/a/23446541
type: AnswerComment
score: 0

http://stackoverflow.com/comment/35813499
type: Comment
comment on: http://stackoverflow.com/q/23378965
has text: You forgot the closing bracket of the main method before starting the next method.
score: 0
type: QuestionComment

http://stackoverflow.com/q/23392236
accepted answer: http://stackoverflow.com/a/23392237
downvote count: 0
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/23392237
has body: I created an user whit XXX username from java code. Because it was done with wrong permission and I can't see it from web interface, I delete directly from database. After that if I try to create the same user I got the following exeception: com.liferay.portal.GroupFriendlyURLException What could gone wrong?
has title: Liferay exception on user creation com.liferay.portal.GroupFriendlyURLException
tagged with: programmatically-created
tagged with: liferay
score: 5
answer count: 1
favorite count: 0
upvote count: 5
type: AnsweredQuestion

http://stackoverflow.com/q/23411206
score: 1
tagged with: java
tagged with: hibernate
upvote count: 1
has body: what mechanisms one can use to compress following ? Since I am using multiple databases I want it to be under the hood like how hibernate handle using Dialects. @Lob @Type(type = "org.hibernate.type.TextType") private String data; or @Lob private byte[] data;
type: Question
tagged with: persistence
has title: how to compress text and image files using hibernate?
has answer: http://stackoverflow.com/a/23411289
answer count: 1
downvote count: 0
tagged with: lob
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/35782633
type: Comment
comment on: http://stackoverflow.com/q/23356265
score: 0
has text: And my other question? Can you see the full request to OSRM in your log? Try to execute it in your browser.
type: QuestionComment

http://stackoverflow.com/comment/35743015
has text: yes I am using. I am not having an exception till this related sql command is executed.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23340608

http://stackoverflow.com/q/23352281
upvote count: 1
downvote count: 1
type: Question
tagged with: hashmap
accepted answer: http://stackoverflow.com/a/23352362
has body: I have the following HashMap which I want to iterate over and print the values. How can I do that in Spring? HashMap&lt;Integer, HashMap&lt;String, String&gt;&gt; hm = new HashMap&lt;Integer, HashMap&lt;String, String&gt;&gt;();
possible better answer: http://stackoverflow.com/a/23353109
has answer: http://stackoverflow.com/a/23353109
score: 0
answer count: 2
has title: Iterating HashMap of HashMap in JSP in a Spring Application
tagged with: jsp
favorite count: 0
linked to: http://stackoverflow.com/q/1835683
duplicate of: http://stackoverflow.com/q/1835683
tagged with: spring
has answer: http://stackoverflow.com/a/23352362
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35764488
tagged with: java

http://stackoverflow.com/comment/35654771
type: AnswerComment
has text: You mean using indexOf?
type: Comment
comment on: http://stackoverflow.com/a/23292672
score: 0

http://stackoverflow.com/comment/35727628
score: 0
type: AnswerComment
has text: i also tried that but still it was an wrong output it gives me an Month = 21
type: Comment
comment on: http://stackoverflow.com/a/23332270

jboss6.x
tag name: jboss6.x
type: Tag
tags question: http://stackoverflow.com/q/23439883

http://stackoverflow.com/a/23432130
answers question: http://stackoverflow.com/q/23432078
score: 3
has body: This was part of the type inference feature improvement in Java 8, where it works. In Java 8, the type argument can be inferred from the context where the expression is used. Here it is being used in an assignment expression to a ImmutableSet&lt;MyInterface&gt; variable. This was not true in Java 7. In Java 7, you can do ImmutableSet&lt;MyInterface&gt; a = ImmutableSet.&lt;MyInterface&gt;of(new MyInterface() { }); to explicitly set the type argument.
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 3
accepted answer of: http://stackoverflow.com/q/23432078

http://stackoverflow.com/comment/35857698
type: AnswerComment
has text: Can you actually post the entire unit test? I want to see how you configured this test to run within the Spring Application context?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23400585

http://stackoverflow.com/q/23438806
tagged with: java
type: Question
tagged with: ejb
has body: I use Apache Tomee+ 1.5.0, eclipse and MySql 5.6.17. I have some simple registration form for users, and I check if email is already used in this DAO: @Stateless @Local(UserDaoLocal.class) public class UserDaoBean extends GenericDaoBean&lt;User, Integer&gt; implements UserDaoLocal{ @Override public User findByEmail(String email){ try{ Query q = em.createNamedQuery("findByEmail"); q.setParameter("email", email); return (User) q.getSingleResult(); }catch(NoResultException e){ return null; } } } In class User I have this NamedQuery: @NamedQuery(name = "findByEmail", query = "SELECT u FROM User u WHERE u.emailAddress like :email") And finally, there is a servlet RegisterServlet : public class RegisterServlet extends HttpServlet { private static final long serialVersionUID = 1L; private static Logger log = Logger.getLogger(RegisterServlet.class); @EJB private UserDaoLocal userDao; in which I check if email is already used with this code: if(userDao.findByEmail(email)!=(null)){ //notify user that email is already used } else { //create new User userDao.persist(user); } First registration works good, gets persisted in database and everything is OK, but if I try to register next user, it gives me this error: java.lang.IllegalStateException: Bean 'UserDaoBean' has been undeployed.: org.apache.openejb.core.ivm.BaseEjbProxyHandler.getBeanContext(BaseEjbProxyHandler.java:563) org.apache.openejb.core.ivm.BaseEjbProxyHandler.isValidReference(BaseEjbProxyHandler.java:321) org.apache.openejb.core.ivm.BaseEjbProxyHandler.invoke(BaseEjbProxyHandler.java:219) com.sun.proxy.$Proxy75.findByEmail(Unknown Source) servlet.RegisterServlet.doPost(RegisterServlet.java:138) javax.servlet.http.HttpServlet.service(HttpServlet.java:641) javax.servlet.http.HttpServlet.service(HttpServlet.java:722) org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305) org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) org.apache.cata…
has comment: http://stackoverflow.com/comment/39916135
tagged with: apache-tomee
has comment: http://stackoverflow.com/comment/35948607
tagged with: dao
score: 0
answer count: 1
tagged with: openejb
accepted answer: http://stackoverflow.com/a/25973141
has comment: http://stackoverflow.com/comment/35926011
has comment: http://stackoverflow.com/comment/36005383
has answer: http://stackoverflow.com/a/25973141
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36258239
has title: java.lang.IllegalStateException: Bean '...' has been undeployed

http://stackoverflow.com/a/23317954
type: Answer
accepted answer of: http://stackoverflow.com/q/23317567
has comment: http://stackoverflow.com/comment/35701438
answers question: http://stackoverflow.com/q/23317567
score: 2
downvote count: 0
upvote count: 2
has body: There is a collision between your activity Menu and the actual view.Menu. Instead of calling Menu.class do com.appname.appname.Menu.class Intent x = new Intent(this, com.appname.appname.Menu.class); startActivity(x); Or rename your activity.
type: AcceptedAnswer

http://stackoverflow.com/a/23374947
has comment: http://stackoverflow.com/comment/35806361
type: Answer
answers question: http://stackoverflow.com/q/23374852
upvote count: 6
score: 6
has body: Your url is very long. In theory that shouldn't cause any problems, but there's a practical limit that depends on the server and proxies that you use. Send the data on the body of the request and not on the url.
has comment: http://stackoverflow.com/comment/35806267
downvote count: 0

http://stackoverflow.com/a/23308025
answers question: http://stackoverflow.com/q/23307914
has comment: http://stackoverflow.com/comment/35682963
has comment: http://stackoverflow.com/comment/35683149
has comment: http://stackoverflow.com/comment/35683260
has comment: http://stackoverflow.com/comment/35683047
has comment: http://stackoverflow.com/comment/35683273
has comment: http://stackoverflow.com/comment/35683196
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/35682927
has comment: http://stackoverflow.com/comment/35702535
has comment: http://stackoverflow.com/comment/35682894
has comment: http://stackoverflow.com/comment/35682941
has comment: http://stackoverflow.com/comment/35682896
has body: You have 2 ways to work around this problem: option 1. Change the action to read as below: Option 2. Change web.xml as below: /html/SelectBeer.do
type: Answer
has comment: http://stackoverflow.com/comment/35683008
upvote count: 1
has comment: http://stackoverflow.com/comment/35683141
has comment: http://stackoverflow.com/comment/35697992
has comment: http://stackoverflow.com/comment/35682860
has comment: http://stackoverflow.com/comment/35683325
score: 1
has comment: http://stackoverflow.com/comment/35682944
has comment: http://stackoverflow.com/comment/35682968
has comment: http://stackoverflow.com/comment/35682959
accepted answer of: http://stackoverflow.com/q/23307914
has comment: http://stackoverflow.com/comment/35683113

http://stackoverflow.com/q/23337504
score: 3
accepted answer: http://stackoverflow.com/a/23337776
downvote count: 0
has answer: http://stackoverflow.com/a/40233188
favorite count: 0
has comment: http://stackoverflow.com/comment/35736585
tagged with: linux
possible better answer: http://stackoverflow.com/a/23337632
has title: How to call shellscript in java program?
has answer: http://stackoverflow.com/a/23337632
has comment: http://stackoverflow.com/comment/35736623
type: AnsweredQuestion
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/23337776
has comment: http://stackoverflow.com/comment/35736992
has comment: http://stackoverflow.com/comment/35736699
type: Question
has body: How to call shellscript in java program? String sCommandString="sh /home/admin/ping.sh"; Process p = Runtime.getRuntime().exec(sCommandString);
answer count: 3

http://stackoverflow.com/comment/97693510
type: AnswerComment
has text: I think this is the simplest answer. This can also be done with the property `spring.mvc.throw-exception-if-no-handler-found=true`. You can also disable the original warning by adding the property `logging.level.org.springframework.web.servlet.PageNotFound=ERROR`
score: 0
type: Comment
comment on: http://stackoverflow.com/a/46566325

http://stackoverflow.com/a/23306913
has comment: http://stackoverflow.com/comment/35681283
type: Answer
has comment: http://stackoverflow.com/comment/35681355
has comment: http://stackoverflow.com/comment/35681422
has body: A JTextField can be set uneditable using setEditable(false). You could also use JLabels.
has comment: http://stackoverflow.com/comment/35681435
has comment: http://stackoverflow.com/comment/35681392
score: 0
has comment: http://stackoverflow.com/comment/35681205
has comment: http://stackoverflow.com/comment/35681421
answers question: http://stackoverflow.com/q/23306824
has comment: http://stackoverflow.com/comment/35681319

http://stackoverflow.com/a/23319037
has comment: http://stackoverflow.com/comment/35703327
has body: Your logic is wrong when the stack already has a head. I think the new head must point to old head (via .next). I'm bit confused, are you implementing a LIFO or FIFO stack? For a LIFO else { Node node = new Node(custPair, null); node.next = head; head = node; size++; } For a LIFO Stack, you really don't need a tail.
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35703274
type: Answer
score: 0
answers question: http://stackoverflow.com/q/23318996
accepted answer of: http://stackoverflow.com/q/23318996

http://stackoverflow.com/a/28287970
answers question: http://stackoverflow.com/q/23385765
downvote count: 0
type: Answer
has body: Bit-wise operations maybe are not most intuitive at first glance but once you got it you'll see that they're quite easy to understand. I'll try to explain what this code does on a example of 172.16.0.1/23 as a netspec string. Part1 - CIDR to binary The goal is to make a binary representation of a subnet mask from a given CIDR prefix length. CIDR prefix length is just a number of 1 bits in a subnet mask. The first line final int bits = 32 - Integer.parseInt(netspec.substring(netspec.indexOf('/')+1)); finds CIDR prefix length by getting the index of / and parsing the integer that succeeds it (23 in my example). This number is subtracted from 32 to get a number of 0 in a subnet mask — those bits are also called host bits. In this example we know that we're dealing with /23 prefix and that it's subnet mask should look like: n represents network (16 bits for class B network), s represents subnet, h represents host. For us network and subnet bits are functionally the same, but I made a distinction just to be precise. Our interest is just in host bits (number of it). nnnnnnnn nnnnnnnn sssssssh hhhhhhhh 11111111 11111111 11111110 00000000 The easiest way to make this is to have a 32bit binary number of all 1s and 'fill' the last 9 bits with 0. This is where the second line comes in: You can ignore the bits == 32 check since it is not that relevant and probably is there just as a optimization. //final int mask = (bits == 32) ? 0 : 0xFFFFFFFF - ((1 &lt;&lt; bits)-1); final int mask = 0xFFFFFFFF - ((1 &lt;&lt; 9)-1); 0xFFFFFFFF will give you 32bit binary number of all 1s. 1 shifted left 9 bits (1 &lt;&lt; bits) will give you 512 and 512 - 1 in binary is 111111111: 1 &lt;&lt; 9 10 00000000 - 1 1 -------------------------------------------------- 1 11111111 When you subtract those values you will get the subnet mask in binary: 0xFFFFFFFF = 11111111 11111111 11111111 11111111 - (1 &lt;&lt; 9)-1 = 1 11111111 -------------------------------------------------- 11111111 11111111 1111…
score: 2
upvote count: 2

http://stackoverflow.com/comment/35882624
score: 0
type: Comment
type: QuestionComment
has text: What do you know about `PermGen`? How do objects end up there? Once you answer these questions you will be able to work out easily how to fill `PermGen` for your testing.
comment on: http://stackoverflow.com/q/23415288

http://stackoverflow.com/comment/35688437
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23310540
has text: i found out that s is null. Please see updated question. But can't fugure out why.
type: AnswerComment

http://stackoverflow.com/tag/pdf
tags question: http://stackoverflow.com/q/23304525
tags question: http://stackoverflow.com/q/23384348
tags question: http://stackoverflow.com/q/23343128
tags question: http://stackoverflow.com/q/23423479
tags question: http://stackoverflow.com/q/23396542
tags question: http://stackoverflow.com/q/23294401
tags question: http://stackoverflow.com/q/23409357
type: Tag
tag name: pdf
tags question: http://stackoverflow.com/q/23411189
tags question: http://stackoverflow.com/q/23353146
tags question: http://stackoverflow.com/q/23314111
tags question: http://stackoverflow.com/q/23422496
tags question: http://stackoverflow.com/q/23377520
tags question: http://stackoverflow.com/q/23369838
tags question: http://stackoverflow.com/q/23423211
tags question: http://stackoverflow.com/q/23337096

http://stackoverflow.com/q/23452176
tagged with: java
has comment: http://stackoverflow.com/comment/35949919
type: Question
has comment: http://stackoverflow.com/comment/35960997
answer count: 1
has comment: http://stackoverflow.com/comment/35949858
has comment: http://stackoverflow.com/comment/35949822
has comment: http://stackoverflow.com/comment/35950016
score: 0
has title: Android explictly free memory without calling System.GC
has comment: http://stackoverflow.com/comment/35955233
has body: I have an Android App, in which I have below class containing fields of both native (C++) objects wrapped with JNI, and other java objects: class MyClass { Node nativeNode; // containing Native objects wrapped using NDK and JNI long otherVars; // some java instances public void dispose() { freeNativeNode(); } } In my app, I continuously create instances of MyClass: for(int i=0;i&lt;1000;i++) { MyClass obj = new MyClass(); ... obj.freeNativeNode(); // Here, free native resources (A) //System.gc(); // Here explicitly collect memory (B) } The app crashes when i is bigger than some number, e.g. when i>400 or i>450. Since I have freed the native memory explicitly as in line (A) above, so I think there should be no memory leak, and java shall use garbage collection to revoke the memory. But the app crashes, and I suspect it might be a memory leak problem. As I know, it is possible to free the managed memory in Java by calling: System.GC(); I tried to call this in (B) above, however, the app crashes more often, and say when i > 60, it already crashes. My questions are: [1] Should I call System.GC() explicitly? As many have different opinions on calling this ourselves, and some say this is not a good practice. [2] How do I elegantly free the memory in the loop to avoid crash? Edit: I understand it is less appropriate to print full log here, but it might be useful to get the whole picture for troubleshooting the problem. From the log, it seems to be not a memory leak problem, but one of my colleague believes so, and I have no strong evidence showing this is NOT, :) The tombstone log: debuggerd: 2014-05-01 23:56:47 Build fingerprint: 'htc_asia_hk/endeavoru/endeavoru:4.1.1/JRO03C/128187.28:user/release-keys' pid: 31725, tid: 31725, name: com.cityu.scm &gt;&gt;&gt; com.cityu.scm &lt;&lt;&lt; signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 00000003 r0 000ff7ff r1 ffffffff r2 00000000 r3 ffffffff r4 00000110 r5 553b36f8 r6 00000008 r7 00000000 r8 00000000 r9 48ce1c44 sl 40c…
has comment: http://stackoverflow.com/comment/35949853
tagged with: c++
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35977630
tagged with: garbage-collection
has comment: http://stackoverflow.com/comment/35949996
tagged with: android-ndk
has comment: http://stackoverflow.com/comment/35949934
has comment: http://stackoverflow.com/comment/35949945
has comment: http://stackoverflow.com/comment/35949930
has answer: http://stackoverflow.com/a/23478074
tagged with: java-native-interface

http://stackoverflow.com/q/23411583
has comment: http://stackoverflow.com/comment/35874023
has title: Gson fromJson/Deserialize to instance
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/23419590
has body: code first. Gson gson = new Gson(); // 1. ClassA a = gson.fromJson(json, ClassA.class) gson.fromJson(jsonB, a)// make jsonB to a // 2. ClassB b = new ClassB(); b.setXXX(xxx); b.setYYY(yyy); ...... gson.fromJson(json, b)// make json to b Is this possible ? how ? EDIT // JSON A { "name":"wener" } // JSON B { "age":22 } // CLASS A class A { String name; Integer age; } // // A a = gson.fromJson(JsonA, A.class) // try to do somgthing like this // this part is what I want to do. gson.fromJson(JsonB, a) // then assert a.getName().equals("wener") assert a.getAge().equals(22) So, just need something like this. fromJsonToInstance(String, Object);
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35889221
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: gson
accepted answer: http://stackoverflow.com/a/23419590
type: Question

http://stackoverflow.com/comment/35849920
type: Comment
comment on: http://stackoverflow.com/a/23398629
type: AnswerComment
score: 0
has text: you're missing a `)` after `scripts.entrySet()`. I can't edit due to not changing up to 6 chars

http://stackoverflow.com/comment/35900441
has text: sure. thanks. i'll keep trying..!!
type: QuestionComment
comment on: http://stackoverflow.com/q/23425134
type: Comment
score: 0

http://stackoverflow.com/q/23425938
has title: When defining Vector<?> is useful?
type: Question
tagged with: generic-type-argument
has comment: http://stackoverflow.com/comment/35900589
has answer: http://stackoverflow.com/a/23426106
score: -2
tagged with: raw-types
has comment: http://stackoverflow.com/comment/35901362
has body: When following container will be useful Vector&lt;?&gt; wilcardVector; if only I can do with this is to create new container wilcardVector = new Vector&lt;String&gt;(); or to add null value wilcardVector.add(null); Trying to add some other types or pass with different generic method fails when compiling. So what is it for?
possible better answer: http://stackoverflow.com/a/23425985
downvote count: 2
answer count: 2
has answer: http://stackoverflow.com/a/23425985
favorite count: 0
type: AnsweredQuestion
upvote count: 0
accepted answer: http://stackoverflow.com/a/23426106
tagged with: java

http://stackoverflow.com/q/23421046
has title: changing a boolean value between multiple classes
favorite count: 0
has answer: http://stackoverflow.com/a/23422413
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35894728
has body: So, my assignment is to make multiple "animal" classes and run them on a blank drawing panel. Each animal moves in a specific way and when they overlap with a different animal, the "invading" animal wins while the other animal is removed. My teacher told me to use a boolean that would return true (animal dies) if two animals crossed on the same coordinates and returned false on all other occasions. I set a boolean method "isSameLoc()" on the Animal class that automatically returns false, but I don't know how to switch the value to true when animals overlap in the main client class. Any kind of advice is appreciated. I also apologize in advance as I'm about to post 6 different classes on here so this will get kind of long. I don't know if there's an easier way to do this so, again, I'm sorry. Animal class: import java.awt.Color; import java.awt.Point; public abstract class Animal { private String type; public Animal(String type, String name, Point location, Color color) { super(); this.type = type; this.name = name; this.location = location; this.color = color; } public String getType() { return type; } public void setType(String type) { this.type = type; } public String getName() { return name; } public void setName(String name) { this.name = name; } public Color getColor() { return color; } public void setColor(Color color) { this.color = color; } private String name; private Point location; private Color color; private boolean sameLoc = false; public boolean isSameLoc() { return sameLoc; } public abstract String toString(); public abstract void move (); public Point getLocation() { return location; } public void setLocation(Point location) { this.location = location; } } AnimalSimulator: import java.awt.Color; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Point; public class AnimalSimulator { public static void main(String[] args) { DrawingPanel forest = new DrawingPanel(720, 640); Graphics2D pen = forest.getGraphics(); Animal [] animals = …
tagged with: java
has comment: http://stackoverflow.com/comment/35894420
type: Question
tagged with: object
tagged with: eclipse
tagged with: class
tagged with: boolean
score: 0
upvote count: 1
answer count: 1
downvote count: 1

http://stackoverflow.com/a/23362225
type: Answer
has body: A start with MongoDB would be to parse each message for hashtags the user used and put these into a sub-array of the document. Example status update: Peter April 29th 2014 12:28:34 Hello friends, I visited the #tradeshow in #washington and drank a delicious #coffee This message would look like this in MongoDB: { author: "Peter", date: ISODate("2014-04-29 12:28:34"), text: "Hello friends, I visited the #tradeshow in #washington and drank a delicious #coffee", hashtags: [ "tradeshow", "washington", "coffee" ] } When you then create an index on db.collection.hashtags you can quickly search for all messages which include one of these hashtags. You likely want to order and limit the results by date so the user sees the most recent results first. When you make it a compound index which also includes the date, you can also speed that up. How to implement "trending" topics is a quite complex question. It is also very subjective depending on what you would consider "trending". The exact algorithms Twitter or Facebook use to determine which topics are trending or not is not public. According to various social media analysts they also change them frequently, so we can assume that they are quite complex by now. That means we can not help you to come up with an algorithm on your own. But when you already have an algorithm in mind to calculate the "trendyness" of a hashtag, we could help you to find a good implementation.
answers question: http://stackoverflow.com/q/23341373
upvote count: 27
accepted answer of: http://stackoverflow.com/q/23341373
downvote count: 0
score: 27
type: AcceptedAnswer

http://stackoverflow.com/comment/35869088
type: Comment
type: QuestionComment
score: 2
has text: why anyone has voted -1? this is a reasonable question.
comment on: http://stackoverflow.com/q/23408756

http://stackoverflow.com/comment/35808600
has text: I used a utility called [Restoration](http://download.cnet.com/Restoration/3000-2094_4-10322950.html) in the past to try to find deleted files, but it looks like Eclipse overwrote your file, so you're almost certainly not going to get it back. (I have no idea why this would happen to you, it's not like you were using Emacs or anything.)
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23376262

http://stackoverflow.com/q/23440507
has body: I am trying t o make sure that the .class file am selected is being generated fro the latest src file. Build is triggered by another mechanism. Hence I want to double check this before executing my task. Currently I am planning to compare the last modified time of src and class fle to make sure that class is being created after the src modification time. I want to know if this is the proper way of doing this? Or there are any other alternatives? I am trying to copy a class file from its location. My application is not going to compile src and generate class files. It just copies a required class file from target to dest. Before making the copy operation, but i want to ensure that class file am copying is the latest one.
answer count: 2
has comment: http://stackoverflow.com/comment/35932638
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/23452780
has comment: http://stackoverflow.com/comment/35928385
has comment: http://stackoverflow.com/comment/35931377
score: 2
upvote count: 2
has answer: http://stackoverflow.com/a/23443268
type: UnansweredQuestion
type: Question
tagged with: java
has title: Is Comparing last modified time stamp of src and class file is the best way to make sure that class file is the latest one?
tagged with: sonarqube

http://stackoverflow.com/a/23330612
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23330570
has comment: http://stackoverflow.com/comment/35724839
type: Answer
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/23330570
has body: This issue has already been discussed at Stack overflows from deep recursion in Java?: Increasing the stack size will only serve as a temporary bandage ... what you really want is tail call elimination, and Java does not have this for various reasons.

http://stackoverflow.com/a/23420328
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35890739
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/23419553
has body: As noted in my comments, you're mis-using inheritance in that the ClockView class should not extend ClockBuilder. ClockView will hold ClockBuilder instances and thus there is a "has-a" relationship here, not an "is-a" relationship. Also and again, your ClockBuilder class has a "pseudo-constructor", a method with the same name as the class, including capitalization, but which is not truly a constructor since it returns something. Get rid of it. Either use an appropriate method with an appropriate method name or a true constructor. Also, you're using JTextFields in a very non-JTextField way, where you seem to display the text but not let the user edit it. In this situation, better to use JLabels placed into a GridLayout-using JPanel. Better still, if all you want to do is display a list of clock times, then I would use a JList, one with a custom renderer that displays the appropriate time of the clock with a surrounding title border.
accepted answer of: http://stackoverflow.com/q/23419553
upvote count: 1

http://stackoverflow.com/q/23434148
upvote count: 1
has title: Check overflow in power implementation
has answer: http://stackoverflow.com/a/23468790
type: Question
has comment: http://stackoverflow.com/comment/35917417
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/35917207
favorite count: 0
has comment: http://stackoverflow.com/comment/35916728
has comment: http://stackoverflow.com/comment/35916166
type: UnansweredQuestion
has body: It's a common interview question to implement the power function. I'm wondering what the fastest way is to find out if overflow happens (using log function is too slow). Is it a good way to say double tempMult= aAbs*aAbs; if (tempMult &gt;= aAbs) tempAnswer = pow(tempMult, bAbs / 2); else //overflow
has comment: http://stackoverflow.com/comment/35917096
has comment: http://stackoverflow.com/comment/35916477
tagged with: pow
tagged with: overflow
score: 1
tagged with: java

http://stackoverflow.com/a/23378282
upvote count: 1
has body: The problem is (likely) that you retrieve the java.sql.Date from the database, in which case it won't have time information. The number of milliseconds returned by getTime then represents midnight in your timezone. But when you create the GregorianCalendar, it will have hours, minutes, seconds and milliseconds. So when you compare for the current day, the GregorianCalendar will always have milliseconds greater that the SQL Date. To fix that, you can call the set method on the Calendar to zero out the hours, minutes, seconds and milliseconds. Better suggestion is to use DateMidnight in JodaTime, or if you have Java 8, it's new built in clone of JodaTime.
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/23378012
score: 1

http://stackoverflow.com/q/23366988
has answer: http://stackoverflow.com/a/23367435
score: 0
has title: how to parse xml using DOM in java
has answer: http://stackoverflow.com/a/23367058
has answer: http://stackoverflow.com/a/23367045
has comment: http://stackoverflow.com/comment/35790765
tagged with: parsing
tagged with: http://stackoverflow.com/tag/xml
has body: i use this code to parse a xml data in java but give me a errors: Informations info=new Informations(); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setRequestMethod("GET"); conn.setRequestProperty("Accept", "application/XML"); String xml=""; xml = readUrl(conn); DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder db = dbf.newDocumentBuilder(); InputSource is = new InputSource(); is.setCharacterStream(new StringReader(xml)); Document dom = db.parse(is); Element root = dom.getDocumentElement(); NodeList items = root.getElementsByTagName("deal"); //----titre NodeList titre = dom.getElementsByTagName("titre"); Element line = (Element) titre.item(0); info.setTitre(getCharacterDataFromElement(line)); System.out.println("Titre: " + info.getTitre()); //----reduction NodeList reduction = dom.getElementsByTagName("reduction"); line = (Element) reduction.item(0); info.setReduction(getCharacterDataFromElement(line)); System.out.println("Reduction: " + info.getReduction()); this is the xml data: <xml version="1.0" encoding="UTF-8"> Occasion 0000-00-00 00:00:00 2014-04-30 00:00:00 25.93 A4 its give me this errors in this part in the code : Document dom = db.parse(is); this is the error: [Fatal Error] :2069:1: XML document structures must start and end within the same entity. org.xml.sax.SAXParseException: XML document structures must start and end within the same entity. at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(Unknown Source) at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(Unknown Source) thanks for any help.
has comment: http://stackoverflow.com/comment/35791384
answer count: 4
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/23367045
tagged with: dom
has answer: http://stackoverflow.com/a/23367679
type: Question
tagged with: xml-parsing
has comment: http://stackoverflow.com/comment/35790639
accepted answer: http://stackoverflow.com/a/23367058
has comment: http://stackoverflow.com/comment/35790896

http://stackoverflow.com/comment/35701599
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23318038
has text: Check this post: http://stackoverflow.com/questions/4526585/imageview-drawable-id-in-android

android-viewpager
tag name: android-viewpager
tags question: http://stackoverflow.com/q/23304467
type: Tag
tags question: http://stackoverflow.com/q/23426634
tags question: http://stackoverflow.com/q/23420817
tags question: http://stackoverflow.com/q/23429076

http://stackoverflow.com/q/23380663
score: 0
has comment: http://stackoverflow.com/comment/35822354
tagged with: android
has comment: http://stackoverflow.com/comment/35821595
has answer: http://stackoverflow.com/a/23384027
type: Question
type: AnsweredQuestion
has body: This is XML Parser Class: public class XMLParser { // constructor public XMLParser() { } /** * Getting XML from URL making HTTP request * * @param url * string * */ public String getXmlFromUrl(String url) { String xml = null; try { HttpClient httpClient = new DefaultHttpClient(); HttpContext localContext = new BasicHttpContext(); HttpGet httpGet = new HttpGet(url); HttpResponse response = httpClient.execute(httpGet, localContext); HttpEntity entity = response.getEntity(); xml = getASCIIContentFromEntity(entity); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } catch (ClientProtocolException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } // return XML return xml; } // Parsing the XML content and retrieve DOM element in the XML. private String getASCIIContentFromEntity(HttpEntity entity) throws IllegalStateException, IOException { InputStream in = entity.getContent(); StringBuffer out = new StringBuffer(); int n = 1; while (n > 0) { byte[] b = new byte[4096]; n = in.read(b); if (n > 0) out.append(new String(b, 0, n)); } return out.toString(); } public Document getDomElement(String xml) { Document doc = null; DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); try { DocumentBuilder db = dbf.newDocumentBuilder(); InputSource is = new InputSource(); is.setCharacterStream(new StringReader(xml)); doc = db.parse(is); } catch (ParserConfigurationException e) { Log.e("Error: ", e.getMessage()); return null; } catch (SAXException e) { Log.e("Error", e.getMessage()); return null; } catch (IOException e) { Log.e("Error", e.getMessage()); return null; } return doc; } /** * Getting node value * * @param elem * element */ public final String getElementValue(Node elem) { Node child; if (elem != null) { if (elem.hasChildNodes()) { for (child = elem.getFirstChild(); child != null; child = child .getNextSibling()) { if (child.getNodeType() == Node.TEXT_NODE) { return child.getNodeValue(); } } } } return ""; } // Retrieve each …
tagged with: java
has title: Unable to get Value when i do XMl Parsing in android
has comment: http://stackoverflow.com/comment/35821791
accepted answer: http://stackoverflow.com/a/23384027
answer count: 1
has comment: http://stackoverflow.com/comment/35822123

http://stackoverflow.com/q/23442064
linked to: http://stackoverflow.com/q/3585034
has comment: http://stackoverflow.com/comment/35932418
type: Question
has title: HQL query throws classCastException
has comment: http://stackoverflow.com/comment/35931327
answer count: 1
score: 0
has comment: http://stackoverflow.com/comment/35930965
has comment: http://stackoverflow.com/comment/35930886
tagged with: sql
has comment: http://stackoverflow.com/comment/35930949
has comment: http://stackoverflow.com/comment/35930829
has comment: http://stackoverflow.com/comment/35930754
has body: I am implementing an exists function which checks if entities with a given Id are present in a DB: protected boolean[] _exists(final Serializable... ids) { //initlialize final boolean[] ret = new boolean[ids.length]; final StringBuilder sb = new StringBuilder("select id FROM " + getEntityMedaData(this.modelAdaptor.getDbModelClass()).getEntityName() + " obj " ); sb.append(" WHERE obj.id in (:ids) "); LOG.debug("query = " + sb.toString() ); final Query query = getSession().createQuery(sb.toString()); query.setParameterList("ids", ids); final List&lt;Serializable&gt; results = query.list(); //exception occurs here System.out.println(results); LOG.debug("number of ids found = " + results.size() ); final Set&lt;Serializable&gt; idsFoundSet = new HashSet&lt;&gt;(results); for(int i=0 ;i&lt; ids.length;i++){ if(idsFoundSet.contains(ids[i])){ ret[i]=true; } } return ret; } I invoke this table by passing the table's primary key. Note that the primary key is a composite primary key. But then it throws an exception at query.list(): java.lang.ClassCastException: mypkg.NodePK cannot be cast to java.lang.String at org.hibernate.type.descriptor.java.StringTypeDescriptor.unwrap(StringTypeDescriptor.java:39) at org.hibernate.type.descriptor.sql.VarcharTypeDescriptor$1.doBind(VarcharTypeDescriptor.java:57) at org.hibernate.type.descriptor.sql.BasicBinder.bind(BasicBinder.java:93) at org.hibernate.type.AbstractStandardBasicType.nullSafeSet(AbstractStandardBasicType.java:280) at org.hibernate.type.AbstractStandardBasicType.nullSafeSet(AbstractStandardBasicType.java:275) at org.hibernate.type.ComponentType.nullSafeSet(ComponentType.java:358) at org.hibernate.param.NamedParameterSpecification.bind(NamedParameterSpecification.java:66) at org.hibernate.loader.hql.QueryLoader.bindParameterValues(QueryLoader.java:609) at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1874) at org.hibernate.loader.Loader.executeQueryStatement(Loader.java:1835) at org.hibernate.loader.Loader.exe…
linked to: http://stackoverflow.com/q/10754777
has comment: http://stackoverflow.com/comment/35930897
has answer: http://stackoverflow.com/a/23445307
has comment: http://stackoverflow.com/comment/35931028
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35931118
tagged with: java
tagged with: hibernate
accepted answer: http://stackoverflow.com/a/23445307
tagged with: orm

http://stackoverflow.com/q/23327033
has comment: http://stackoverflow.com/comment/35718072
tagged with: abstract-class
tagged with: abstract
downvote count: 1
answer count: 1
has body: I'm attempting to do the following to my classes below... Modify your super Vehicle class to make it abstract. Modify the Motorized class by giving it an abstract method called "normalizedPower()" which returns a double. normalizedPower will be calculated differently for cars and trucks. For Automobiles, the normalized power is the horsepower divided by 150. For Trucks, the normalized power is based on number of wheels. For trucks with fewer than 12 wheels, the normalized Power is horsepower divided by 250. For trucks with 12 or more wheels, the normalized power is horsepower divided by 400. Code: abstract class Vehicle implements Comparable&lt;Vehicle&gt; //changed to abstract { String description; String idNumber; int numWheels; public Vehicle(String aDescription, String aIdNumber, int aNumWheels) { description = aDescription; idNumber = aIdNumber; numWheels = aNumWheels; } void setDescription (String aDescription) { description = aDescription; } void setIdNumber (String aIdNumber) { idNumber = aIdNumber; } void setNumWheels (int aNumWheels) { numWheels = aNumWheels; } public String getDescription() { return description; } public String getIdNumber() { return idNumber; } public int getNumWheels() { return numWheels; } public String toString() { String result= String.format("ID: %s Description: %s Wheels: %d",idNumber,description,numWheels); return result; } @Override public int compareTo(Vehicle other) { return description.compareTo(other.getDescription()); } } class humanPowered extends Vehicle { int calories; public humanPowered(String aDescription, String aIdNumber, int aNumWheels, int aCalories) { super(aDescription,aIdNumber,aNumWheels); calories = aCalories; } void setCalories (int aCalories) { calories = aCalories; } public int getCalories() { return calories; } public String toString() { String result= String.format("ID: %s Description: %s Wheels: %d Calories per Hour: %d",idNumber,description,numWheels, calories); return result; } } abstract class Motoriz…
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35719547
has comment: http://stackoverflow.com/comment/35717809
upvote count: 0
has comment: http://stackoverflow.com/comment/35717992
has comment: http://stackoverflow.com/comment/35717929
tagged with: java
has title: Abstract Class Issue with Assignment
tagged with: methods
type: Question
has comment: http://stackoverflow.com/comment/35717913
has answer: http://stackoverflow.com/a/23327896
score: -1

http://stackoverflow.com/comment/35914767
type: QuestionComment
has text: Forgot to mention about the catch.. see edit!
score: 0
comment on: http://stackoverflow.com/q/23433442
type: Comment

http://stackoverflow.com/a/23359468
has comment: http://stackoverflow.com/comment/35777107
has comment: http://stackoverflow.com/comment/35777438
type: Answer
has comment: http://stackoverflow.com/comment/35777015
upvote count: 10
has comment: http://stackoverflow.com/comment/35787829
has body: If you define packages try to think about modularity. Which types do address one aspect of your software making up a module with clean boundaries? Which other types define another module which do depend on other modules? Packages in Java seam to be hierarchical but they are not. Never the less, make sub-packages depend on super-packages only and never the other way around. It is ok to have sub-packages which do not depend on super-packages. And do not create technical packages like all my DAOs or all my Controllers. One major driving aspect for a package is the degree of cohesion the types inside the package do have. Another is the layering of your application. My approach is: start by putting everything into a single package first. When your application evolves, identify the modules and repackage them. Try to keep dependencies between packages low. Check that either types of the same package do depend on each other or they address the same aspect / share related responsibilities.
answers question: http://stackoverflow.com/q/23359340
downvote count: 0
has comment: http://stackoverflow.com/comment/35787477
has comment: http://stackoverflow.com/comment/35777039
score: 10
has comment: http://stackoverflow.com/comment/35777230

http://stackoverflow.com/q/23432192
accepted answer: http://stackoverflow.com/a/23538607
tagged with: jdbc
has comment: http://stackoverflow.com/comment/35977489
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36017609
score: 1
tagged with: java
upvote count: 1
tagged with: jdbctemplate
type: Question
downvote count: 0
has body: Found the solution, see bellow* I'm trying to execute a stored function, via SimpleJdbcCall (using java + jpa) but I can't execute, it shows: [Request processing failed; nested exception is org.springframework.jdbc.UncategorizedSQLException: CallableStatementCallback; uncategorized SQLException for SQL [{? = call PK_BACKOFFICE.SET_PROFESSIONAL(?, ?, ?, ?, ?, ?, ?, ?, ?, ?)}]; SQL state [null]; error code [17004]; Invalid column type; nested exception is java.sql.SQLException: Invalid column type] with root cause java.sql.SQLException: Invalid column type Here's my code: dataSource = this.getDataSource(); SimpleJdbcCall caller = new SimpleJdbcCall(dataSource) .withCatalogName("pk_backoffice_api_ui") .withFunctionName("set_professional_main") .declareParameters( new SqlOutParameter("result",OracleTypes.BOOLEAN), new SqlParameter("i_id_institution", OracleTypes.NUMERIC), new SqlParameter("i_id_prof", OracleTypes.NUMERIC), new SqlParameter("i_first_name", OracleTypes.VARCHAR), new SqlParameter("i_nick_name", OracleTypes.VARCHAR), new SqlParameter("i_gender", OracleTypes.VARCHAR), new SqlParameter("i_id_category", OracleTypes.NUMERIC), new SqlParameter("i_id_lang", OracleTypes.NUMERIC), new SqlParameter("i_flg_state", OracleTypes.VARCHAR), new SqlParameter("i_commit_at_end", OracleTypes.BOOLEAN), new SqlOutParameter("o_id_prof", OracleTypes.INTEGER), new SqlOutParameter("o_error", OracleTypes.STRUCT, "T_ERROR_OUT")); MapSqlParameterSource params = new MapSqlParameterSource() .addValue("i_id_institution", 2790) .addValue("i_id_prof", 7020000363724L) .addValue("i_first_name", "teste") .addValue("i_nick_name", "nicknameteste") .addValue("i_gender", "f").addValue("i_id_category", 20) .addValue("i_id_lang", 1).addValue("i_flg_state", "A") .addValue("i_commit_at_end", true); Integer res = caller.executeFunction(Integer.class, params); Map out = caller.execute(params); int idprof = (int) out.get("o_id_prof"); //getting out parameter? // para obter o erro - caso haja // (com.ale…
tagged with: boolean
has comment: http://stackoverflow.com/comment/35913337
tagged with: stored-functions
answer count: 1
has title: Stored Function - Sending/Receiving Boolean - BD
favorite count: 0
has answer: http://stackoverflow.com/a/23538607

http://stackoverflow.com/a/23432930
has comment: http://stackoverflow.com/comment/35913727
accepted answer of: http://stackoverflow.com/q/23432886
upvote count: 1
answers question: http://stackoverflow.com/q/23432886
type: AcceptedAnswer
has body: you can use this System.out.printf("%02d%n", n); and String.format("%02d", minutes);
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/q/23440400
type: Question
tagged with: native
has answer: http://stackoverflow.com/a/23452824
has title: How to resolve?. Exception in thread "main" java.lang.UnsatisfiedLinkError: Can't find dependent libraries
answer count: 1
downvote count: 0
favorite count: 0
tagged with: exception
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35928277
score: 1
tagged with: java
upvote count: 1
has body: Hi I have added the native libraries to my project but I am getting exception as. Exception in thread "main" java.lang.UnsatisfiedLinkError: Can't find dependent libraries. I have added the native libraries like this. Right click on the Project. Select Properties. Click on RUN. In VM Options TYPE -Djava.library.path="[dir]". Press Ok. In NEATBEANS IDE my method is like this. static{ // System.out.println("inside the static intializer"); System.loadLibrary("SBXPCJavaProxy"); // System.load("D:\\bio-metric\\SBXPC_CORE_130330\\SBXPCJavaProxy.dll"); } I added like this. -Djava.library.path="D:\bio-metric\SBXPC_CORE_130330"

http://stackoverflow.com/q/23439015
answer count: 2
downvote count: 1
tagged with: arrays
favorite count: 0
possible better answer: http://stackoverflow.com/a/23439075
has answer: http://stackoverflow.com/a/23439075
has comment: http://stackoverflow.com/comment/35925521
type: AnsweredQuestion
upvote count: 0
type: Question
has comment: http://stackoverflow.com/comment/35925534
tagged with: java
has body: Is it possible to set two String[] equal to each other while one has been returned (method has been returned containing a String[])? Example: Returned array>>>>>>>>>>>Array I want set equal to the returned array authorArray[x].getAuthor() == authorArray[x]
score: -1
has answer: http://stackoverflow.com/a/23439166
accepted answer: http://stackoverflow.com/a/23439166
has title: Setting String arrays equal to each other

http://stackoverflow.com/comment/35765584
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23352420
has text: @Makoton As the explanation in my code states, whitespaces are accounted for. I suggest you do exactly as I described in my previous comment and show me if the output for the strings you provided is different. If you have different strings, you **have** to show their structure to us.

http://stackoverflow.com/comment/35685961
type: Comment
score: 1
has text: It is worth noting that what you describe is known as a mesh network, a network in which everyone is connected to everyone. yes, mesh networks work, but they don't scale well (For example, with hundreds of clients), and all peers need to properly configure their NAT's / Firewalls. https://en.wikipedia.org/wiki/Mesh_networking
type: QuestionComment
comment on: http://stackoverflow.com/q/23297376

http://stackoverflow.com/comment/35957092
type: AnswerComment
comment on: http://stackoverflow.com/a/23444117
type: Comment
has text: I **don't** get a `FileNotFoundException`, so they are found. I really don't understand what I'm doing wrong here. The Server can start up, the Client can start up, but when I call a remote method from Client to Server it crashes because of a failed handshake.
score: 0

http://stackoverflow.com/q/23400902
tagged with: binary
has comment: http://stackoverflow.com/comment/35856990
type: UnansweredQuestion
has body: I want to convert a binary fraction into decimal.Consider binary number 1101.1110. I know the manual method of conversion and i can put in the form of program, but i am not able to separate the fractional part from the number. I need to separate it because the method of conversion differs after the point. while converting decimal to binary the fractional part can be separated this way: double num=12.23; int fraction=num-(long)num; can u help me. Thanks in advance.
tagged with: java
downvote count: 2
type: Question
linked to: http://stackoverflow.com/q/3481828
score: -2
has answer: http://stackoverflow.com/a/23401017
has title: conversion of binary fraction to decimal in java
answer count: 3
upvote count: 0
has comment: http://stackoverflow.com/comment/35854726
has comment: http://stackoverflow.com/comment/35853931
has answer: http://stackoverflow.com/a/23401255
has answer: http://stackoverflow.com/a/32200892
favorite count: 0

http://stackoverflow.com/comment/35847248
comment on: http://stackoverflow.com/a/23395099
type: Comment
has text: @MattImmer when you initiates ExecutorService executor = Executors.newFixedThreadPool(5); it will capture the requirement that it should allocate 5 threads but it wont block the threads at this moment. When you give work (runnable ) it will allocate the thread if required . so you have given one work ( which is nothing still considered as work) and java allocate the thread . Now the thread awaiting for work.
type: AnswerComment
score: 0

http://stackoverflow.com/a/23448908
score: 1
has comment: http://stackoverflow.com/comment/35946157
answers question: http://stackoverflow.com/q/23448848
has comment: http://stackoverflow.com/comment/35945498
has comment: http://stackoverflow.com/comment/35944053
has comment: http://stackoverflow.com/comment/35968860
downvote count: 0
has body: Use the class file and the actual file path and name. For example: if the class file is located in the same folder as your HTML file.
type: Answer
has comment: http://stackoverflow.com/comment/35946172
upvote count: 1
has comment: http://stackoverflow.com/comment/35945466
has comment: http://stackoverflow.com/comment/35944077

http://stackoverflow.com/a/23432746
has comment: http://stackoverflow.com/comment/38310640
has comment: http://stackoverflow.com/comment/38360313
has comment: http://stackoverflow.com/comment/38312182
has comment: http://stackoverflow.com/comment/45203202
has comment: http://stackoverflow.com/comment/38102076
has body: That only happens in Windows. https://github.com/spring-projects/spring-boot/issues/773 Update: should be fixed now.
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/38094098
upvote count: 3
answers question: http://stackoverflow.com/q/23432651
has comment: http://stackoverflow.com/comment/43419256
downvote count: 1
has comment: http://stackoverflow.com/comment/38357541
has comment: http://stackoverflow.com/comment/43431097
has comment: http://stackoverflow.com/comment/45200565

http://stackoverflow.com/q/23344725
has comment: http://stackoverflow.com/comment/35750081
possible better answer: http://stackoverflow.com/a/23344901
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/23344836
tagged with: java
has answer: http://stackoverflow.com/a/23344811
score: 6
has comment: http://stackoverflow.com/comment/35750315
has comment: http://stackoverflow.com/comment/35749959
type: Question
has comment: http://stackoverflow.com/comment/35750134
has title: Partial read of xml file
upvote count: 6
linked to: http://stackoverflow.com/q/1345293
tagged with: gosu
tagged with: file-io
linked to: http://stackoverflow.com/q/7373567
has answer: http://stackoverflow.com/a/23344902
accepted answer: http://stackoverflow.com/a/23344902
has body: I need to read the first 15 lines from about 100 XML files that are up to 200,000 lines long. Is there a way to use something like BufferedReader to do this efficiently? The steps outlined in this question use DocumentBuilder.parse(String); this tries to parse the entire file at once. EDIT: The first 15 elements contain metadata about the file (page names, last edited dates, etc) that I would like to parse into a table.
has comment: http://stackoverflow.com/comment/35749870
has comment: http://stackoverflow.com/comment/35750462
has comment: http://stackoverflow.com/comment/35750189
favorite count: 0
tagged with: parsing
has answer: http://stackoverflow.com/a/23344901
has answer: http://stackoverflow.com/a/23345448
answer count: 5
has comment: http://stackoverflow.com/comment/35749910

http://stackoverflow.com/a/23415657
downvote count: 0
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/23415603
answers question: http://stackoverflow.com/q/23415603
score: 1
upvote count: 1
has body: The method traverses all the keys currently in LinkedHashMap: for (String s : Pairs.keySet()) { If the value associated with this key within the map equals to the passed argument, we save this key inside the list matchedNames: if (phoneticName.equals(Pairs.get(s))) { matchedNames.add(s); } And then we return the list of keys, whose values equals to the passed argument phoneticName.

http://stackoverflow.com/comment/106870811
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/53521859
has text: Unclear why this has been down-voted, it worked for me and I always prefer to use an existing library than rolling my own solution.

http://stackoverflow.com/comment/35689594
comment on: http://stackoverflow.com/q/23311616
has text: In the directory where eclipse puts the compiler output, does that class exist?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35786710
type: Comment
has text: i appologize for the wrong formats , please check the question now i have put the pom in it
comment on: http://stackoverflow.com/q/23364297
score: 0
type: QuestionComment

http://stackoverflow.com/q/23434537
type: UnansweredQuestion
has title: jaxws:wsgen: goal not generating stubs
tagged with: maven
tagged with: web-services
answer count: 0
downvote count: 0
score: 1
tagged with: java
tagged with: wsimport
type: Question
upvote count: 1
has body: I am trying to build a web service client. I am using maven 3.0.5 to manage my project and I would like to use the wsimport goal to generate my client stubs. I have read through examples of how to configure the pom to achieve this here. When I run an mvn clean install my stubs are not generated. Below is my pom and an excerpt from the output of running mvn -X clean install. I am trying to use the org.jvnet.jax-ws-commons version of the plugin since the org.codehaus.mojo version is old. Can somebody tell me what I am doing wrong? Thank you. Here is my pom: <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> 4.0.0 org.group.app ProjectName war 1.0-SNAPSHOT ProjectName Maven Webapp http://maven.apache.org junit junit 3.8.1 test com.sun.xml.ws jaxws-rt 2.2.8 ProjectName org.jvnet.jax-ws-commons jaxws-maven-plugin 2.3 basic generate-sources wsimport src/main/webapp/WEB-INF/classes/client_support http://localhost:8080/wsdlLocation src/main/webapp/WEB-INF/classes/ true 2.1 Here is part of the output from running an mvn -X clean install: [INFO] ------------------------------------------------------------------------ [INFO] Building ProjectName Maven Webapp 1.0-SNAPSHOT [INFO] ------------------------------------------------------------------------ [DEBUG] Resolving plugin version for org.jvnet.jax-ws-commons:jaxws-maven-plugin [DEBUG] Could not find metadata org.jvnet.jax-ws-commons:jaxws-maven-plugin/maven-metadata.xml in local (/home/michael/.m2/repository) [DEBUG] Skipped remote update check for org.jvnet.jax-ws-commons:jaxws-maven-plugin/maven-metadata.xml, locally cached metadata up-to-date. [DEBUG] Resolved plugin version for org.jvnet.jax-ws-commons:jaxws-maven-plugin to 2.3.1-b03 from repository central (http://repo.maven.apache.org/maven2, releases) Here is an excerpt from my tomcat log file for when I try to deploy t…
favorite count: 0

http://stackoverflow.com/q/23396048
has title: ImageIcon not Showing up in JPanel
has answer: http://stackoverflow.com/a/23396114
has comment: http://stackoverflow.com/comment/35845078
linked to: http://stackoverflow.com/q/10961749
has comment: http://stackoverflow.com/comment/35853125
tagged with: jframe
type: UnansweredQuestion
tagged with: swing
type: Question
tagged with: java
linked to: http://stackoverflow.com/q/22744920
tagged with: jpanel
linked to: http://stackoverflow.com/q/22947294
answer count: 1
score: 0
has body: I'm just trying to load in 9 identical .gif's of doges. That's all I wanna do. Please help! It's for a project of a modified version of tic-tac-toe, and for some reason I can't get the images to appear in my window. Help! package jerryTacToe; import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.io.IOException; class picture extends JPanel { /** * */ private static final long serialVersionUID = 1L; ImageIcon doge; public picture() throws IOException { doge = new ImageIcon("dogeRotates.gif", null); JPanel panel = new JPanel(); JLabel label = new JLabel("", doge, JLabel.CENTER); panel.add(label, BorderLayout.CENTER); } public void paintComponent(Graphics g) { ((Icon) g).paintIcon(this, g, 10, 10); /* Graphics2D g2 = (Graphics2D) g; Line2D line = new Line2D.Float(100, 100, 250, 260); g2.draw(line);*/ } public void changeDoge(boolean human) throws IOException { if(human) doge = new ImageIcon("./dogeIntensifies.gif", null); else doge = new ImageIcon("./ferociousDoge.gif", null); } } class Closer extends WindowAdapter { public void windowClosing(WindowEvent e) { System.out.println("much derp"); System.exit(0); } } public class Gui extends JFrame implements ActionListener, MouseListener { /** * */ private static final long serialVersionUID = 1L; boolean human; JButton goSecond; picture centerCenter; picture topLeft; picture topCenter; picture topRight; picture centerLeft; picture centerRight; picture bottomLeft; picture bottomCenter; picture bottomRight; public void mouseClicked(MouseEvent e){ if(e.getSource()==topLeft || e.getSource()==topCenter ||e.getSource()==topRight || e.getSource()==centerLeft ||e.getSource()==centerCenter ||e.getSource()==centerRight || e.getSource()==bottomLeft ||e.getSource()==bottomCenter ||e.getSource()==bottomRight) { /* * Call the AI here. * * * hello? * yes, this is doge. * */ } } public void mouseEntered(MouseEvent e){} public void mouseExited(MouseEvent e){} public void mousePressed(MouseEvent e){} public void mouse…
tagged with: imageicon

http://stackoverflow.com/q/23291190
downvote count: 0
has comment: http://stackoverflow.com/comment/35780537
tagged with: java
score: 6
type: Question
has comment: http://stackoverflow.com/comment/35734214
has body: I am developing a flashlight App in which there is a normal flashlight in one activity and strobe light in one activity. Now I am acquiring the camera in onCreate of Flashlight activity. But when I am oving to strobe activity, i need to release the camera acquired by FlashLight activity. I dont want to release the camera in onPause of FlashLight activity because that would stop the camera even if user presses the home button. I want to release the camera only when user goes to strobe activity or else he exits the app by back button. Also I want to reacquire the camera if the user is coming back to flashlight activity from strobe activity. Is their anyway to do this.?
tagged with: camera
upvote count: 6
accepted answer: http://stackoverflow.com/a/23428449
has comment: http://stackoverflow.com/comment/35757034
has answer: http://stackoverflow.com/a/23405424
has title: Is there any way to release a camera from different activity after acquiring it from a different activity.?
has answer: http://stackoverflow.com/a/23428449
favorite count: 0
has answer: http://stackoverflow.com/a/23335779
tagged with: android
tagged with: flashlight
has answer: http://stackoverflow.com/a/23471816
answer count: 4
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/23335779

http://stackoverflow.com/a/23296684
type: Answer
answers question: http://stackoverflow.com/q/23296519
score: 0
has body: I guess you could set multiple brake-points on the lines that you want to debug, and go from one to anoter with F7.

http://stackoverflow.com/comment/35747230
score: 0
type: QuestionComment
has text: Since your writing binary data to the device, do you know that your using the correct endian (big vs little)? Are you getting the correct number of bytes back?
type: Comment
comment on: http://stackoverflow.com/q/23333975

http://stackoverflow.com/comment/35744299
type: AnswerComment
has text: Completely true. This is a point where reading about Just In Time compilation ( http://en.wikipedia.org/wiki/Just-in-time_compilation ) is useful.. which does change depending on the JVM. JIT "is compilation done during execution of a program – at run time – rather than prior to execution".
type: Comment
score: 1
comment on: http://stackoverflow.com/a/23341464

http://stackoverflow.com/q/23357350
has title: How to resolve exception "weblogic.application.ModuleException: Context path '' is already in use by the module: / application"?
has comment: http://stackoverflow.com/comment/35890528
favorite count: 0
has body: I have gone through the Question: [weblogic.application.ModuleException: Context path &#39;&#39; is already in use by the module: / application: and followed as answer of the question says; but still getting the same exception: **&gt; Deployment failed. The message was: weblogic.application.ModuleException: Context path '/socketss-war' is already in use by the module: /Socketss-war application: Socketss D:\NetBeansProjects\Socketss\Socketss-war\nbproject\build-impl.xml:1056: The module has not been deployed. See the server log for details.** Any guidance or suggestion would be highly appreciable. Thank you!
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/35067006
linked to: http://stackoverflow.com/q/16033609
score: 1
tagged with: java
linked to: http://stackoverflow.com/q/22049332
upvote count: 1
has comment: http://stackoverflow.com/comment/35805266
type: Question
has comment: http://stackoverflow.com/comment/35813671
answer count: 2
tagged with: weblogic
tagged with: ejb
has comment: http://stackoverflow.com/comment/35837914
downvote count: 0
has answer: http://stackoverflow.com/a/27129488

http://stackoverflow.com/comment/83131480
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23384089
has text: Check if you have this problem: https://github.com/eclipse-jetty/eclipse-jetty-plugin/issues/6
score: 0

http://stackoverflow.com/q/23435400
tagged with: android-virtual-device
score: 1
favorite count: 0
type: Question
tagged with: android
has title: "Run as Android Application" doesn't work
has comment: http://stackoverflow.com/comment/35918925
has answer: http://stackoverflow.com/a/23435545
tagged with: java
upvote count: 1
answer count: 1
has body: I installed the ADT (Android Developer Tools) plugins for eclipse and directed it to the correct Android APK files. I also have Android Virtual Device set up. Nothing happens when I click "run as android application," but my AVD runs fine and is actually very responsive. This is all Java in eclipse by the way. Right click the pic, and open it in a new tab to see the larger version. EDIT: Fixed, all I had to do was click run dropdown menu on eclipse, then click run again :)
linked to: http://stackoverflow.com/q/4600891
has comment: http://stackoverflow.com/comment/35941444
has comment: http://stackoverflow.com/comment/35918397
accepted answer: http://stackoverflow.com/a/23435545
has comment: http://stackoverflow.com/comment/35919156
type: AnsweredQuestion
downvote count: 0

http://stackoverflow.com/tag/xml
tags question: http://stackoverflow.com/q/23437191
tags question: http://stackoverflow.com/q/23329691
tags question: http://stackoverflow.com/q/23372437
tags question: http://stackoverflow.com/q/23312053
tags question: http://stackoverflow.com/q/23395648
tags question: http://stackoverflow.com/q/23337948
tags question: http://stackoverflow.com/q/23387707
tags question: http://stackoverflow.com/q/23329923
tags question: http://stackoverflow.com/q/23333323
tags question: http://stackoverflow.com/q/23433032
tags question: http://stackoverflow.com/q/23313680
tags question: http://stackoverflow.com/q/23381486
tags question: http://stackoverflow.com/q/23452823
tags question: http://stackoverflow.com/q/23407535
tags question: http://stackoverflow.com/q/23360997
tags question: http://stackoverflow.com/q/23431905
tags question: http://stackoverflow.com/q/23351036
type: Tag
tags question: http://stackoverflow.com/q/23360839
tags question: http://stackoverflow.com/q/23330319
tags question: http://stackoverflow.com/q/23405377
tags question: http://stackoverflow.com/q/23449671
tags question: http://stackoverflow.com/q/23314255
tags question: http://stackoverflow.com/q/23381887
tags question: http://stackoverflow.com/q/23322619
tags question: http://stackoverflow.com/q/23348114
tags question: http://stackoverflow.com/q/23369653
tags question: http://stackoverflow.com/q/23345928
tags question: http://stackoverflow.com/q/23395643
tags question: http://stackoverflow.com/q/23297847
tags question: http://stackoverflow.com/q/23435182
tags question: http://stackoverflow.com/q/23330645
tags question: http://stackoverflow.com/q/23451530
tags question: http://stackoverflow.com/q/23320696
tags question: http://stackoverflow.com/q/23397394
tags question: http://stackoverflow.com/q/23345010
tags question: http://stackoverflow.com/q/23413997
tags question: http://stackoverflow.com/q/23407622
tags question: http://stackoverflow.com/q/23394987
tags question: http://stackoverflow.com/q/23424040
tags question: http://stackoverflow.com/q/23436329
tags question: http://stackoverflow.com/q/23316329
tags question: http://stackoverflow.com/q/23343161
tags question: http://stackoverflow.com/q/23396965
tags question: http://stackoverflow.com/q/23382088
tags question: http://stackoverflow.com/q/23326757
tags question: http://stackoverflow.com/q/23302037
tags question: http://stackoverflow.com/q/23445340
tags question: http://stackoverflow.com/q/23360942
tags question: http://stackoverflow.com/q/23323266
tags question: http://stackoverflow.com/q/23425768
tags question: http://stackoverflow.com/q/23350907
tags question: http://stackoverflow.com/q/23446263
tags question: http://stackoverflow.com/q/23349805
tags question: http://stackoverflow.com/q/23339799
tags question: http://stackoverflow.com/q/23293286
tags question: http://stackoverflow.com/q/23375299
tags question: http://stackoverflow.com/q/23426477
tags question: http://stackoverflow.com/q/23342020
tags question: http://stackoverflow.com/q/23320192
tags question: http://stackoverflow.com/q/23403878
tags question: http://stackoverflow.com/q/23431700
tags question: http://stackoverflow.com/q/23386414
tags question: http://stackoverflow.com/q/23349802
tags question: http://stackoverflow.com/q/23380420
tag name: xml
tags question: http://stackoverflow.com/q/23342308
tags question: http://stackoverflow.com/q/23304492
tags question: http://stackoverflow.com/q/23344725
tags question: http://stackoverflow.com/q/23359869
tags question: http://stackoverflow.com/q/23313158
tags question: http://stackoverflow.com/q/23443642
tags question: http://stackoverflow.com/q/23378629
tags question: http://stackoverflow.com/q/23334989
tags question: http://stackoverflow.com/q/23430794
tags question: http://stackoverflow.com/q/23375845
tags question: http://stackoverflow.com/q/23409778
tags question: http://stackoverflow.com/q/23309263
tags question: http://stackoverflow.com/q/23366988
tags question: http://stackoverflow.com/q/23295495

http://stackoverflow.com/a/23305333
type: Answer
has body: The structure of your valid() method should be like following: //loop-start if (condition is satified) return true; // loop-end return false; In Java (unlike VB) you cannot assign values to methods. You cannot instantiate a method as well.
has comment: http://stackoverflow.com/comment/35679395
score: 1
has comment: http://stackoverflow.com/comment/35679062
upvote count: 1
has comment: http://stackoverflow.com/comment/35678557
has comment: http://stackoverflow.com/comment/35678478
has comment: http://stackoverflow.com/comment/35678426
answers question: http://stackoverflow.com/q/23305271
downvote count: 0
has comment: http://stackoverflow.com/comment/35678525

pdfbox
tag name: pdfbox
tags question: http://stackoverflow.com/q/23326562
tags question: http://stackoverflow.com/q/23401402
tags question: http://stackoverflow.com/q/23377520
type: Tag

http://stackoverflow.com/a/23309689
has body: It works (apart from the missing parentheses) and the approach with a prepared statement is entirely correct. However I have seen a couple of code pieces like that, and always the problem lay with variables mix-up or not closing, or simple oversight. Better declare as close as possible. try (ResultSet res = pstmt.executeQuery()) { while (res.next()) { .. } } // Automatically closes res. Also handle the life-cycle of pstmt correctly, with closing.
accepted answer of: http://stackoverflow.com/q/23309456
type: Answer
score: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23309456

http://stackoverflow.com/a/23375373
score: 0
answers question: http://stackoverflow.com/q/23375276
type: Answer
has body: There are many ways to do it. Do you control creation of these buttons? If yes, create a factory and attach a listener before returning the object Otherwise, you may traverse swing tree and check for instance of JButton and attach on a match You can also think about ActionMap/InputMap approach where an action can be stored and invoked based on the focus policy. Also, you may extend JButton....

http://stackoverflow.com/comment/35948710
comment on: http://stackoverflow.com/q/23450758
type: Comment
has text: Not sure if it is the problem or not, but your base-package does not need the .* at the end.
score: 0
type: QuestionComment

http://stackoverflow.com/comment/35740280
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23339407
has text: Can you try to save the excel as csv and then open the csv file in notepad using the open with option. Then add the information to your post that would help.

http://stackoverflow.com/comment/35744620
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23339309
has text: So I tried adding the `Thread.sleep(1000);` line that you suggested, and that makes the program 'pause' for a second between each set of prints in the console- which is what it should do, but the 'stop' button that I've added to my GUI still doesn't do anything...

http://stackoverflow.com/comment/35860034
has text: I'ved tried what everybody recommended and in the file it is still printing out in a solid line.
score: 0
comment on: http://stackoverflow.com/q/23404352
type: Comment
type: QuestionComment

embedded-tomcat-7
type: Tag
tag name: embedded-tomcat-7
tags question: http://stackoverflow.com/q/23339954

http://stackoverflow.com/comment/35796257
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23369761
score: 0
has text: But if i want to get the first "tr" and the last "tr"?

http://stackoverflow.com/comment/35893107
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23421483
has text: Yes I trying both but am not getting error on that particular given time .. here am attached my code please check import java.io.IOException;
type: AnswerComment

http://stackoverflow.com/q/23382583
has answer: http://stackoverflow.com/a/29811627
type: UnansweredQuestion
tagged with: android
answer count: 4
score: 4
type: Question
tagged with: java
linked to: http://stackoverflow.com/q/18421274
has answer: http://stackoverflow.com/a/23382901
upvote count: 4
has body: When I try to run my progrm, it works, but when I look at the console, it states that it Could not find appcompat_v7.apk. How do I try to answer this? I just imported most of my resources. This is what happens when I do this: Properties > Android > Library add the android-support-v7-appcompat [2014-04-30 16:28:38 - appcompat_v7] Could not find appcompat_v7.apk! [2014-04-30 16:28:38 - finalssample1] Starting activity com.example.finalssample1.MainActivity on device emulator-5554 [2014-04-30 16:28:40 - finalssample1] ActivityManager: Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.example.finalssample1/.MainActivity } [2014-04-30 16:28:40 - finalssample1] ActivityManager: Warning: Activity not started, its current task has been brought to the front
has answer: http://stackoverflow.com/a/25687232
downvote count: 0
has comment: http://stackoverflow.com/comment/35819672
has answer: http://stackoverflow.com/a/23383871
has comment: http://stackoverflow.com/comment/35819914
favorite count: 0
has title: Could not find appcompat_v7.apk

http://stackoverflow.com/a/23327577
type: AcceptedAnswer
has body: This seems like a good fit for the factory method pattern. Try something like this: public abstract class MyAbstractClass { protected String greeting; public void run() { doSomething(); } public abstract void doSomething(); public abstract MyAbstractClass makeClass(); } public class MyClass1 extends MyAbstractClass { public MyClass1() { this.greeting = "Hello, World!"; } @Override public void doSomething() { System.out.println(greeting); } @Override public MyAbstractClass makeClass() { return new MyClass1(); } } Then, whenever you need to create a specific instance just call makeClass() in a single implementation of the main() method located in the place you consider most convenient, for instance in MyAbstractClass: MyAbstractClass mac = new MyClass1(); MyAbstractClass obj = mac.makeClass(); The last line will return an appropriate instance depending on the class used for instantiating the concrete object.
has comment: http://stackoverflow.com/comment/35719188
has comment: http://stackoverflow.com/comment/35719125
type: Answer
score: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23327493
has comment: http://stackoverflow.com/comment/35718992
answers question: http://stackoverflow.com/q/23327493
upvote count: 2

http://stackoverflow.com/a/23337820
downvote count: 0
answers question: http://stackoverflow.com/q/23319699
type: Answer
score: 1
upvote count: 1
has body: It's pretty simple. All you need to do is to return the same page while returning the result. Now there should be a question in your mind that when the first time you are visiting(before searching anything) what will be displayed in that page! Just use a null check parameter to see wheather the result is null(at the first time visit). If the result is null, then don't show anything. That's all you need to do!
accepted answer of: http://stackoverflow.com/q/23319699
type: AcceptedAnswer

http://stackoverflow.com/q/23364857
favorite count: 0
has comment: http://stackoverflow.com/comment/35786762
has comment: http://stackoverflow.com/comment/35786774
upvote count: 2
possible better answer: http://stackoverflow.com/a/23365629
downvote count: 2
has answer: http://stackoverflow.com/a/23365629
has comment: http://stackoverflow.com/comment/35786687
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35786853
has answer: http://stackoverflow.com/a/23364980
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/35786779
has answer: http://stackoverflow.com/a/23366094
type: Question
has title: how to convert string data into json?
has comment: http://stackoverflow.com/comment/35786885
has body: here string data values comes from shell script code.i need to show this resultant values in json format Runtime rt = Runtime.getRuntime(); Process pr = rt.exec(new String[]{"/home/admin/institutestatus.sh"}); BufferedReader input = new BufferedReader(new InputStreamReader(pr.getInputStream())); String line = ""; while ((line = input.readLine()) != null) { Gson gson =new Gson(); System.out.println(gson.toJson(line)); } } catch (Exception e) { System.out.println(e.toString()); e.printStackTrace(); }
has comment: http://stackoverflow.com/comment/35787003
score: 0
answer count: 3
accepted answer: http://stackoverflow.com/a/23366094
tagged with: shell

http://stackoverflow.com/q/23345822
has answer: http://stackoverflow.com/a/27895280
answer count: 3
has title: Running AutoIT script on Selenium Grid
has comment: http://stackoverflow.com/comment/52585685
has body: How can I run an AutoIT script over a Selenium Grid set up? I have the .exe file on all machines but need to have the Selenium Script to call this to run on each node of the grid, is this possible?
favorite count: 0
has answer: http://stackoverflow.com/a/23345959
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/44191400
tagged with: selenium-grid2
upvote count: 2
tagged with: internet-explorer-11
score: 1
tagged with: java
tagged with: internet-explorer-10
tagged with: autoit
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/23635861

http://stackoverflow.com/comment/35804567
has text: Missed this requirement =) Thanks for pointing that, @BheshGurung
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23373788
type: AnswerComment

http://stackoverflow.com/q/23291070
downvote count: 0
has answer: http://stackoverflow.com/a/23291249
favorite count: 0
tagged with: timer
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35652185
upvote count: 1
has comment: http://stackoverflow.com/comment/35652125
has comment: http://stackoverflow.com/comment/35652086
score: 1
tagged with: java
has body: I learning about the Timer class package testing; import java.io.*; import java.security.*; import javax.xml.bind.DatatypeConverter; import java.lang.*; import java.awt.*; import javax.swing.*; import java.awt.event.*; import java.awt.image.BufferedImage; import javax.imageio.ImageIO; public class Testing extends JPanel { public static void main(String[] args) { Timer timer = new Timer(5000, new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { // Output function System.out.println("HowareYou"); // function to be run after 5 seconds } }); timer.setRepeats(false); // Only execute once timer.start(); // Go go go! } } Why doesnt the output function execute 5 seconds after the start of the program , instead it never executes ???
type: Question
tagged with: debugging
has answer: http://stackoverflow.com/a/23291096
has title: Timer class not working
has comment: http://stackoverflow.com/comment/35652815
has answer: http://stackoverflow.com/a/23292146
answer count: 3

http://stackoverflow.com/comment/76836080
type: Comment
score: 0
has text: So, there is no such a way of doing upcasting to call the method's parent?
type: AnswerComment
comment on: http://stackoverflow.com/a/34917315

http://stackoverflow.com/q/23414892
tagged with: apache-commons-net
score: 5
has title: Java FTPClient (apache commons) storefile() successfully uploads file, then times out..?
accepted answer: http://stackoverflow.com/a/23416083
possible better answer: http://stackoverflow.com/a/31860830
downvote count: 0
has answer: http://stackoverflow.com/a/31860830
favorite count: 0
tagged with: ftp
type: AnsweredQuestion
type: Question
has body: Here's some code I have to upload a file to an FTP server: private boolean ftpSend(byte[] fileBytes, String filename, HashMap&lt;String, String&gt; endpointAddressData) throws Exception { boolean success = false; String login = endpointAddressData.get("user"); String hostname = endpointAddressData.get("host"); String password = endpointAddressData.get("password"); String portString = endpointAddressData.get("port"); int port = (portString == null) ? 21 : Integer.parseInt(portString); FTPClient ftpClient = new FTPClient(); ByteArrayInputStream inputStream = null; try { ftpClient.setConnectTimeout(10000); ftpClient.connect(hostname, port); int reply = ftpClient.getReplyCode(); if(!FTPReply.isPositiveCompletion(reply)) { ftpClient.disconnect(); throw new Exception("FTP server " + hostname + " refused connection."); } if (password != null) { ftpClient.login(login, password); } else { ftpClient.user(login); } logger_.debug("FTP - Writing: " + ftpClient.printWorkingDirectory() + "/" + filename + " on host " + endpointAddressData.get("host")); inputStream = new ByteArrayInputStream(fileBytes); success = ftpClient.storeFile(filename, inputStream); inputStream.close(); success = success &amp;&amp; ftpClient.completePendingCommand(); logger_.debug("FTP - Completed: " + ftpClient.printWorkingDirectory() + "/" + filename + " on host " + endpointAddressData.get("host")); ftpClient.disconnect(); } catch (Exception ex) { success = false; logger_.error("An error occurred during FTP upload to " + endpointAddressData.get("host") + ".", ex); } finally { if (ftpClient.isConnected()) { ftpClient.abort(); ftpClient.disconnect(); } if (inputStream != null) { inputStream.close(); } return success; } } When I run it with some test data, the upload clearly completes successfully (here's the FTP server log): (000009)01/05/2014 12:13:09 PM - (not logged in) (127.0.0.1)&gt; USER ###### (000009)01/05/2014 12:13:09 PM - (not logged in) (127.0.0.1)&gt; 331 Password required for ###### (000009)01/0…
upvote count: 5
tagged with: java
has answer: http://stackoverflow.com/a/23416083
answer count: 2

http://stackoverflow.com/comment/36029301
has text: I have tried the example you indicated but still the maven dependency could not provide OlapConnection class. I updated the code
comment on: http://stackoverflow.com/a/23392302
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/36025633
comment on: http://stackoverflow.com/a/23390176
has text: what I would the slideshow to connect to facedetector is that, I want to have keep track how many secs a person looking at the words(as a score), and possible store that data.
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/35719675
has text: Actually, you only need to iterate up to the square root of the number because any factor > sqrt(n) has a cofactor <= sqrt(n). Also, after checking for divisibility by 2 you need only check potential factors which are odd, so you can iterate from 3 to sqrt(n) with increments of 2.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23326709
type: Comment

http://stackoverflow.com/a/23442007
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23441734
type: Answer
upvote count: 1
downvote count: 1
answers question: http://stackoverflow.com/q/23441734
has body: Consider a private variable, private String name; and its getter/setter which are ofcourse public. Now every class has access to getter/setter which in its implementation uses private variable. That's the purpose of private variables, not accessing it directly from other classes. Your case is similar where in private validator is being accessed by selfValidate() method. By their signature, selfValidate() is accessible to subclasses. To answer your question about whether validator object will be different in case of non-static or not, then every class that accesses it will create a new instance of that object.

http://stackoverflow.com/comment/35779346
type: Comment
comment on: http://stackoverflow.com/q/23359840
has text: You sure you're running the code you think you're running? Ie, if debug do you see the user actually having a description?
score: 0
type: QuestionComment

http://stackoverflow.com/comment/35710150
has text: You want to act on multiple instances of multiple classes, and synchronizing the structures you access isn't sufficient? Buy without referencing the instances you need to access? And in a multi-threaded environment, rendering thread locals useless?
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23323061
type: QuestionComment

http://stackoverflow.com/q/23405055
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35861286
has title: Eclipse throws "Unable to create new native thread.". How to fix it?
type: Question
accepted answer: http://stackoverflow.com/a/23405588
score: 0
has comment: http://stackoverflow.com/comment/35862623
answer count: 2
tagged with: java
has answer: http://stackoverflow.com/a/23405588
tagged with: eclipse
possible better answer: http://stackoverflow.com/a/26253641
has answer: http://stackoverflow.com/a/26253641
has body: I have a problem with Eclipse configuration and very often it throws me a message "Unable to create new native thread." and I'm prompted to restart Eclipse. I saw that there are many topics about this, but i did find anything to help me to solve my problem. I use: Eclipse Java EE IDE for Web Developers. Version: Juno Service Release 2 Build id: 20130225-0426 Windows 7 Ultimate Processor: Intel Core(TM) 2 Duo CPU T5870 @ 2.20 GHz Memory (RAM): 4.00 GB System Type: 64-bit Operating System My eclipse.ini file: -startup plugins/org.eclipse.equinox.launcher_1.3.0.v20120522-1813.jar --launcher.library plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.200.v20120913-144807 -product org.eclipse.epp.package.jee.product --launcher.defaultAction openFile --launcher.XXMaxPermSize 256M -showsplash org.eclipse.platform --launcher.XXMaxPermSize 256m --launcher.defaultAction openFile -vm F:/Oracle/Middleware/jdk160_29/bin/javaw.exe -vmargs -Dosgi.requiredJavaVersion=1.5 -Dhelp.lucene.tokenizer=standard -server -XX:PermSize=256m -XX:MaxPermSize=256m -Xss2m -Xms1G -Xmx1G -XX:MaxGCPauseMillis=10

http://stackoverflow.com/comment/35842526
type: Comment
has text: I think I will use system property in java but how do I get the value from ant? In Java, I have System.setProperty("out", pwd); In Ant, How do I do <sysproperty key="pwd" value="out"/>? How to pass it into <jvmarg value="-Djavax.net.ssl.keyStorePassword=${pwd}"/>??
type: AnswerComment
comment on: http://stackoverflow.com/a/23376376
score: 0

http://stackoverflow.com/comment/35977617
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23433218
has text: This is just a shot in the dark, but perhaps your findByTarget query should start as `SELECT OBJECT(n) FROM NodeBase n`. And `t0.ID = ?` is simply the SQL generated for the :targetID parameter.
type: Comment

http://stackoverflow.com/a/23382745
score: 3
upvote count: 3
answers question: http://stackoverflow.com/q/23382380
downvote count: 0
has comment: http://stackoverflow.com/comment/35819985
has comment: http://stackoverflow.com/comment/35820094
has body: You can't get the columns from the stack trace. What you can do is using intermediate variables, so that you have each method call on a different line: UriBuilder builder = uriInfo.getBaseUriBuilder(); builder = builder.path(objectA); builder = builder.path(objectB); URI uri = builder.build(); This is painful, but it can temporarily help finding the problem, then you can put it back as it was.
type: Answer

http://stackoverflow.com/comment/35947741
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23450980
has text: Okay. Im new to this sorry. :)
score: 0

http://stackoverflow.com/comment/35941137
has text: As far as I can tell, this bug is the result of java 7 using a new sort method by default. The solution is either to use JRE 6, or to update all your libraries (to the latest version) so that they are compatible with java 7. If neither of those work, please post more code.
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/23447228

http://stackoverflow.com/q/23424706
type: AnsweredQuestion
tagged with: java
downvote count: 1
type: Question
upvote count: 0
has comment: http://stackoverflow.com/comment/35898614
has comment: http://stackoverflow.com/comment/35899126
tagged with: jsp
score: -1
tagged with: servlets
has title: Jsp reloading page not working
has answer: http://stackoverflow.com/a/23425033
answer count: 1
linked to: http://stackoverflow.com/q/3177733
tagged with: web
has comment: http://stackoverflow.com/comment/35898687
favorite count: 0
has body: i have signup page when i first submitting the data in form action i am sending it to a servlet before submiting my url is **Localhost:\Shop ** &lt;form action="signup" method="post"&gt; and in this servlet i have businesses logic after submitting it i am forwarding it to my index page by ` request.getrequestdispatcher("index.jsp").forward(request,response); now my URL is localhost:\Shop\SignUp now when i refresh this page it gives me warning Confirmation Form Resolution How do i avoid this problem ????
linked to: http://stackoverflow.com/q/2047122
has comment: http://stackoverflow.com/comment/35898786
accepted answer: http://stackoverflow.com/a/23425033
tagged with: web-development-server

http://stackoverflow.com/comment/35862595
score: 0
type: AnswerComment
has text: The Launcher gives me an error: "Could not create the Java Virtual Machine"
type: Comment
comment on: http://stackoverflow.com/a/23405588

http://stackoverflow.com/q/23349802
has answer: http://stackoverflow.com/a/23349892
type: UnansweredQuestion
tagged with: android
downvote count: 2
tagged with: java
has title: Convert text file all data to xml format in java
has body: I have a text file and i need to convert this text file all data in xml format to make more readable. Text file how can i convert it in xml format. Any java library or any way that i can do it.
has answer: http://stackoverflow.com/a/23350586
type: Question
answer count: 2
upvote count: 0
score: -2
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0

http://stackoverflow.com/q/23391520
has comment: http://stackoverflow.com/comment/35836480
linked to: http://stackoverflow.com/q/2422468
tagged with: servlets
type: Question
score: 5
has comment: http://stackoverflow.com/comment/35836497
has title: null values getting in servlet using request.getParameter from jsp
tagged with: jsp
has answer: http://stackoverflow.com/a/23391700
has body: I have a jsp form as below, First Name: Last Name: Gender: Male FeMale Address : City: College: --- Please Select --- XYZ Branch: --- Please Select --- ABC Mobile Number: Email_ID: Password: Re-Enter Password: Profile Picture: Continue Then this calls my servlet which is coded as below: package Client_Controller; import CommonData.ComData; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.tomcat.util.http.fileupload.FileItemFactory; import org.apache.tomcat.util.http.fileupload.disk.DiskFileItemFactory; import org.apache.tomcat.util.http.fileupload.servlet.ServletFileUpload; import java.util.*; import java.sql.*; import java.util.logging.Level; import java.util.logging.Logger; import java.util.regex.Matcher; import java.util.regex.Pattern; import javax.servlet.RequestDispatcher; import org.apache.tomcat.util.http.fileupload.FileItem; import org.apache.tomcat.util.http.fileupload.FileUploadException; public class Registration extends HttpServlet { protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=UTF-8"); PrintWriter out = response.getWriter(); try { String f_name = request.getParameter("firstname"); String l_name = request.getParameter("lastname"); String gender = request.getParameter("gender"); String address = request.getParameter("address"); String city = request.getParameter("city"); String college = request.getParameter("college"); String branch = request.getParameter("branch"); String mobile = request.getParameter("mobilenumber"); String email = request.getParameter("email"); String password = request.getParameter("password"); String filePath = request.getParameter("file").toString(); Class.forName(…
accepted answer: http://stackoverflow.com/a/23391700
has comment: http://stackoverflow.com/comment/35836496
has comment: http://stackoverflow.com/comment/35836424
has answer: http://stackoverflow.com/a/23391702
favorite count: 0
duplicate of: http://stackoverflow.com/q/2422468
upvote count: 5
has comment: http://stackoverflow.com/comment/35836649
has answer: http://stackoverflow.com/a/24159938
answer count: 4
type: AnsweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/23392011
tagged with: java
has comment: http://stackoverflow.com/comment/35836423
possible better answer: http://stackoverflow.com/a/24159938

http://stackoverflow.com/q/23371776
has body: Ok i try it again I can run the command: wmic product where name="my application" get installLocation JAWIN seems to me like a possibility to avoid Runtime.getRuntime.exe solutions Does anybody allready worked with jawin to connect to the WMI and find out the InstallLocation of an application? I do not want to read any RegKeys but check how to get this information over WMI. Thanks for any answer..
has comment: http://stackoverflow.com/comment/35805103
has title: Using jawin instead of wmic
tagged with: windows
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35800709
tagged with: java
type: Question
score: 0

http://stackoverflow.com/comment/35726912
type: Comment
has text: from just the code posted here, you don't check whether the letters are correct or not. Also, make sure you take into account repeated letters
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23331164

http://stackoverflow.com/comment/35671961
type: Comment
score: 0
comment on: http://stackoverflow.com/q/23301858
has text: Crash log from logcat if you may..
type: QuestionComment

http://stackoverflow.com/q/23302817
tagged with: java
has comment: http://stackoverflow.com/comment/35673978
accepted answer: http://stackoverflow.com/a/23302937
has title: More efficient for an Java Array
has comment: http://stackoverflow.com/comment/35673946
type: Question
has answer: http://stackoverflow.com/a/23302937
tagged with: arrays
score: 0
has comment: http://stackoverflow.com/comment/35673936
answer count: 1
has comment: http://stackoverflow.com/comment/35673944
has comment: http://stackoverflow.com/comment/35673860
type: AnsweredQuestion
tagged with: performance
has body: I have an assignment, in which we have to create a directory which stores names and an extension number. In the first part we have to store the information in just an Array. We have to be able to add an entry to the Array and also initially read a .txt file and store it in the Array. Finally it has to print the Array. I was just wondering what would be more efficient because I only started learning code the last few months and this is difficult for me. 1) Would it be better to first create an Array of size [9999] (because that is the max number of entries the directory could have because everyone has a unique four digit number). I have an INT called count which keeps a count of what the last Array[x] to be added so when I call a method like addEntry, it will add the Entry to [X+1]. The problems with this be is that from what I have read, Arrays are huge and it could have performance problems. Also I have to be able to make a 'lookup' method which should be able to search the Array for someones number by entering their name. My other option: 2) When the file is read, it counts how many lines the file has (each entry will be on its own line) then creates an Array of the number of lines in the text file. Whenever I want to add a new Entry, I copy the Array into an ArrayList, then back to an Array with the new Entry added. However I also read that copying arrays is not so good too and in a realistic view, if someone was to use this directory they could be adding entries every day. Aslong as I store in an Array and print the Array into a table it is all good, but what would be the best way to make the actual Array when you don't know the size? (Yes I know I can use ArrayList but its specifically said not to) Also how would you go about deleting an Entry in the Array, if I use my way there would be a missing entry at Array[x] where x got deleted. Thanks in advance for any replies.

http://stackoverflow.com/a/23302479
score: 1
has body: Instances of classes in Java are created by calling a constructor using the new keyword: Main main = new Main(); public void Main () { } however is not a constructor, but a instance method (which, in your example, never gets called). public class Main { public static void main(String[] args) { Main main = new Main(); // create instance main.Main(); // call method 'Main' new Main().Main(); // or both at once } public Main() { // this is the (default) constructor } public void Main() { // this is an instance method (whose name 'should' start lowercase } }
downvote count: 0
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/23302396

http://stackoverflow.com/comment/35844319
type: QuestionComment
has text: @ErikAllik And I have only types sout and pressed "TAB" which was automatically converted to System.out.println(""); and my cursor was already in between the double-quotes. :) Thanks.
comment on: http://stackoverflow.com/q/23395178
type: Comment
score: 0

http://stackoverflow.com/q/23293072
has comment: http://stackoverflow.com/comment/35656931
has answer: http://stackoverflow.com/a/23293279
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35657382
tagged with: java
has answer: http://stackoverflow.com/a/41694229
accepted answer: http://stackoverflow.com/a/23293279
has comment: http://stackoverflow.com/comment/35658016
type: Question
score: 20
possible better answer: http://stackoverflow.com/a/41694229
upvote count: 20
downvote count: 0
has comment: http://stackoverflow.com/comment/35655737
tagged with: hazelcast
has comment: http://stackoverflow.com/comment/35655858
answer count: 3
has comment: http://stackoverflow.com/comment/35655529
has comment: http://stackoverflow.com/comment/35655578
has comment: http://stackoverflow.com/comment/35655790
has answer: http://stackoverflow.com/a/78553354
favorite count: 0
has comment: http://stackoverflow.com/comment/35660002
has title: Suddenly I'm getting "Hazelcast instance is not active!"
has comment: http://stackoverflow.com/comment/35659708
has body: My application is running for months and working very well. Then suddenly I get the following error: com.hazelcast.core.HazelcastInstanceNotActiveException: Hazelcast instance is not active! at com.hazelcast.spi.impl.ProxyServiceImpl$ProxyRegistry.&lt;init&gt;(ProxyServiceImpl.java:220) at com.hazelcast.spi.impl.ProxyServiceImpl$ProxyRegistry.&lt;init&gt;(ProxyServiceImpl.java:207) at com.hazelcast.spi.impl.ProxyServiceImpl$1.createNew(ProxyServiceImpl.java:69) at com.hazelcast.spi.impl.ProxyServiceImpl$1.createNew(ProxyServiceImpl.java:67) at com.hazelcast.util.ConcurrencyUtil.getOrPutIfAbsent(ConcurrencyUtil.java:47) at com.hazelcast.spi.impl.ProxyServiceImpl.getDistributedObject(ProxyServiceImpl.java:101) at com.hazelcast.instance.HazelcastInstanceImpl.getDistributedObject(HazelcastInstanceImpl.java:285) at com.hazelcast.instance.HazelcastInstanceImpl.getLock(HazelcastInstanceImpl.java:183) at com.hazelcast.instance.HazelcastInstanceProxy.getLock(HazelcastInstanceProxy.java:77) at br.com.xyz.lock.hazelcast.HazelcastLockManager.lock(HazelcastLockManager.java:37) at br.com.xyz.lock.hazelcast.LockManagerFacade.lock(LockManagerFacade.java:24) at br.com.xyz.recebe.negocio.NProcessadorMensagemRecebida.processamentoLock(NProcessadorMensagemRecebida.java:85) at br.com.xyz.recebe.negocio.NProcessadorMensagemRecebida.processaArquivo(NProcessadorMensagemRecebida.java:74) at br.com.xyz.recebe.processador.ProcessadorBase.processaArquivo(ProcessadorBase.java:75) at br.com.xyz.recebe.processador.ProcessadorXml.processaArquivo(ProcessadorXml.java:16) at br.com.xyz.recebe.processador.ProcessadorFacade.processaArquivo(ProcessadorFacade.java:34) at br.com.xyz.recebe.mail.pdes.ProcessadorPDESMeRecebida.processar(ProcessadorPDESMeRecebida.java:77) at gov.sefaz.util.pdes.ProcessadorDiretorioEntradaSaidaDaemon.processar(ProcessadorDiretorioEntradaSaidaDaemon.java:575) at gov.sefaz.util.pdes.ProcessadorDiretorioEntradaSaidaDaemon.varrerDiretorioUsingStrategy(ProcessadorDiretorioEntradaS…

http://stackoverflow.com/a/28912333
has comment: http://stackoverflow.com/comment/73956687
downvote count: 5
has body: Type the following commands in order. $ ps -ef | grep -i java $ kill -9 3361
upvote count: 2
score: -3
type: Answer
answers question: http://stackoverflow.com/q/23432651
has comment: http://stackoverflow.com/comment/110635604

http://stackoverflow.com/q/23428642
has answer: http://stackoverflow.com/a/23428699
upvote count: 1
has body: In my app users can register, that users can post workouts and comments on workouts. I design following resources and URIs: USERS /users /users/{id} WORKOUTS /workouts /workouts/{id} COMMENTS /workouts{id}/comments /workouts{id}/comments/{id} Since /workouts URI returns timeline, I tried to map user's workouts like /workouts?user=userId I don´t know how distinguish between get all collection and get collection filtered by @QueryParam, because: @GET @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Practicas getPracticas() { List&lt;Practica&gt; listaPracticas = practicaDao.getPracticas(); Practicas practicas = new Practicas(); practicas.setPracticas(listaPracticas); return practicas; } @GET @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Practicas getPracticasUsuario(@QueryParam("idUsuario") int idUsuario) { List&lt;Practica&gt; listaPracticas = practicaDao.getPracticasByUser(idUsuario); Practicas practicas = new Practicas(); practicas.setPracticas(listaPracticas); return practicas; } throw following exception: org.glassfish.jersey.server.model.ModelValidationException: Validation of the application resource model has failed during application initialization. [[FATAL] A resource model has ambiguous (sub-)resource method for HTTP method GET and input mime-types as defined by @Consumes and @Produces annotations at Java methods public com.sporty.model.Practicas com.sporty.resource.PracticasResource.getPracticas() and public com.sporty.model.Practicas com.sporty.resource.PracticasResource.getPracticasUsuario(int) at matching regular expression /practicas. These two methods produces and consumes exactly the same mime-types and therefore their invocation as a resource methods will always fail.; source='org.glassfish.jersey.server.model.RuntimeResource@1cc465f'] Is solution add another level on URI like /workouts/search?user=userId? Is a problem derived from a poor URI design? Thanks in advance
type: Question
tagged with: jersey
downvote count: 0
accepted answer: http://stackoverflow.com/a/23428699
tagged with: uri
answer count: 1
has title: jersey @GET collection and @GET collection filtered by @QueryParam
favorite count: 0
tagged with: rest
type: AnsweredQuestion
score: 1
tagged with: java

http://stackoverflow.com/q/23294401
has comment: http://stackoverflow.com/comment/35660925
has comment: http://stackoverflow.com/comment/35660125
tagged with: encryption
type: Question
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23304754
linked to: http://stackoverflow.com/q/1131116
has body: In the code below, I grab an existing pdf file, encrypt it and then output the encrypted file. My problem is that the outputted file does not work properly. It creates a file of zero bytes. I tried the same code with a simple text file "sample.txt" and it worked fine. The outputted file was created with encryption. Can anyone tell me what I may be doing wrong? Does it work differently with PDF files? public void encryptFile() throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, CertificateException, KeyStoreException, IOException { FileInputStream fis = new FileInputStream("c:\\sample.pdf"); FileOutputStream fos = new FileOutputStream("c:\\sample_encrypted"); Cipher c = Cipher.getInstance("RSA/ECB/OAEPWithSHA-1AndMGF1Padding"); c.init(Cipher.ENCRYPT_MODE, getSapPublicCertificate().getPublicKey()); CipherOutputStream cos = new CipherOutputStream(fos, c); byte[] buf = new byte[2048]; int read; while ((read = fis.read(buf)) != -1) { cos.write(buf, 0, read); } fis.close(); cos.flush(); cos.close(); } EDIT I should mention that I tried the same thing above but without any cipher/cipherOutPutStream and the new cloned file was generated properly. The code is below. So I would tend to believe its an issue with Cipher or CipherOutputStream. But then again, as mentioned before, it all worked fine with a simple text file. byte[] buffer = new byte[2048]; int read; while ((read = fis.read(buffer)) != -1) { fos.write(buffer, 0, read); } EDIT2 Content of method getCertficate() public Certificate getSapPublicCertificate() throws IOException, CertificateException, KeyStoreException, NoSuchAlgorithmException { char[] password = "mypass".toCharArray(); String alias = "myalias"; FileInputStream fIn = new FileInputStream(keystoreSapCertificate); KeyStore keystore = KeyStore.getInstance("JKS"); keystore.load(fIn, password); Certificate cert = keystore.getCertificate(alias); return cert; }
tagged with: java
has answer: http://stackoverflow.com/a/23304754
answer count: 1
has title: Writing an encrypted PDF file using Cipher RSA
score: 0
tagged with: http://stackoverflow.com/tag/pdf

http://stackoverflow.com/q/23305717
type: AnsweredQuestion
upvote count: 0
has answer: http://stackoverflow.com/a/23305787
has comment: http://stackoverflow.com/comment/35678946
score: -3
type: Question
tagged with: java
has title: Im getting null pointer exception in my object array
has answer: http://stackoverflow.com/a/23305764
accepted answer: http://stackoverflow.com/a/23305764
answer count: 2
possible better answer: http://stackoverflow.com/a/23305787
tagged with: arrays
favorite count: 0
downvote count: 3
has body: So, I'm creating an array of seats on an airplane, with the traits seat number, seat type, and passenger. First off..here is my code making the seat object in a separate class: public class Seat { private int seatNumber; private String passenger; private String seatType; public Seat(int seatNumber, String seatType, String passenger){ seatNumber=this.seatNumber; seatType=this.seatType; passenger=this.passenger; } public int getSeatNumber() { return seatNumber; } public String getPassenger() { return passenger; } public String getSeatType() { return seatType; } In my main class I have: import javax.swing.*; import java.awt.*; import java.awt.List; import java.util.*; public class AirplaneReservation { public static Seat []seatList= new Seat[12]; public void SeatList(){ for (int i=0; i&lt;seatList.length; i++){ seatList[i]= new Seat(i, null, null); } Seat seat1 = new Seat(1, "First Class", "Collins"); seatList[0]=seat1; Seat seat2 = new Seat(2, "First Class", "null"); seatList[1]=seat2; Seat seat3 = new Seat(3, "First Class", "Faivre"); seatList[2]=seat3; Seat seat4 = new Seat(4, "First Class", "Kinnard"); seatList[3]=seat4;; Seat seat5 = new Seat(5, "Coach", "null"); seatList[4]=seat5; Seat seat6 = new Seat(6, "Coach", "null"); seatList[5]=seat6; Seat seat7 = new Seat(7, "Coach", "Morgans"); seatList[6]=seat7; Seat seat8 = new Seat(8, "Coach", "Rohan"); seatList[7]=seat8; Seat seat9 = new Seat(9, "Coach", "Shatrov"); seatList[8]=seat9; Seat seat10 = new Seat(10, "Coach", "Sword"); seatList[9]=seat10; Seat seat11 = new Seat(11, "Coach", "null"); seatList[10]=seat11; Seat seat12 = new Seat(12, "Coach", "Tuckness"); seatList[11]=seat12; } public static void main (String [] args){ System.out.println("Seat\tPassenger"); System.out.println(seatList[0].getSeatNumber()); I found that many people were having the problem of not making the arrays with non-null objects, but when I try the block of code that I think does that, I still get a null pointer exception. Exception in thr…
has comment: http://stackoverflow.com/comment/35678935

http://stackoverflow.com/a/23422735
has comment: http://stackoverflow.com/comment/49961930
has comment: http://stackoverflow.com/comment/49961997
type: Answer
score: 19
upvote count: 19
has body: Add something like if (!hasProperty('mainClass')) { ext.mainClass = 'com.foo.acme.Main' } to your build.gradle. It will tell Gradle plugin what class to use when starting your application. Perhaps that should be customizable in the UI but I cannot see it now.
has comment: http://stackoverflow.com/comment/35906003
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23418954
accepted answer of: http://stackoverflow.com/q/23418954
has comment: http://stackoverflow.com/comment/35907706
has comment: http://stackoverflow.com/comment/35904101

http://stackoverflow.com/comment/35721561
has text: is the picture your code?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23328955

http://stackoverflow.com/a/23390740
score: 8
has body: If I read the Java docs correctly, you're looking for the start method of the match object: String line = "000 1 This is my message"; Pattern p = Pattern.compile("\\p{L}"); Matcher m = p.matcher(line); if (m.find()) { System.out.println(m.start()); }
upvote count: 9
downvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23390612
type: Answer
answers question: http://stackoverflow.com/q/23390612

http://stackoverflow.com/comment/35879611
comment on: http://stackoverflow.com/a/23414389
type: AnswerComment
has text: The example code does not show a for-in loop as the enhanced loop, but good points about the for-in enhanced loop.
type: Comment
score: 1

http://stackoverflow.com/comment/35699402
score: 0
type: AnswerComment
type: Comment
has text: @decal Yeah, seems like a network error. (Put your stack traces and other code in edits to your question, they're easier to read.) Try pinging your server.
comment on: http://stackoverflow.com/a/23316754

http://stackoverflow.com/q/23340713
has title: How to get system time zone configuration
type: UnansweredQuestion
has body: Is there a way to get the System timezone configuration on which the JVM is running? I would like to get the format in a human readable format like Europe/London and 09:50:07.
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/23340754
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/23340783

http://stackoverflow.com/q/23370463
has comment: http://stackoverflow.com/comment/35797654
has comment: http://stackoverflow.com/comment/35797584
score: 0
has answer: http://stackoverflow.com/a/23370925
tagged with: exception
has title: the next() method in the Scanner doen't wait for input
type: UnansweredQuestion
answer count: 4
has comment: http://stackoverflow.com/comment/35797667
has body: i wrote this line (String str = sc.next();) like 10 times in my code, and all of them work ok except for one that doesn't wait for my input and immediately throws an exception "java.util.NoSuchElementException" ! does any one have an idea why that could happen ?? private static Matrix GetRationalMatrix(int[] size) throws Exception { Scanner sc = new Scanner(System.in); MathVector[] matrix = new MathVector[size[0]]; for(int i = 0 ; i &lt; size[0] ; i++) { MathVector vector = null; String str = sc.nextLine(); str = str.replaceAll("[ \t]+", " "); String[] splitStr = str.split(" "); Scalar[] scalarVector = new Scalar[size[1]]; for(int j = 0 ; j &lt; splitStr.length ; j++) { String[] tmp = splitStr[j].split("/"); try { scalarVector[j] = new Rational(Integer.parseInt(tmp[0]), Integer.parseInt(tmp[1])); } catch(Exception e){ sc.close(); throw new Exception("Please enter values properly: a/b were a,b are integers!"); } } vector = new MathVector(size[1], scalarVector); matrix[i] = new MathVector(vector); } Matrix ans = new Matrix(size[0], matrix); sc.close(); return ans; } in size[0] the number of rows and in size[1] number of columns , both will be positive integers
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/23370729
has answer: http://stackoverflow.com/a/23370593
has answer: http://stackoverflow.com/a/23370555

http://stackoverflow.com/q/23293759
answer count: 4
favorite count: 0
tagged with: fxml
possible better answer: http://stackoverflow.com/a/23294859
has comment: http://stackoverflow.com/comment/35657569
downvote count: 0
has comment: http://stackoverflow.com/comment/35657302
has answer: http://stackoverflow.com/a/23294859
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35657063
has comment: http://stackoverflow.com/comment/35657963
has answer: http://stackoverflow.com/a/23295205
accepted answer: http://stackoverflow.com/a/23295205
tagged with: java
tagged with: scenebuilder
tagged with: javafx
has body: I'm creating rich ui application and I use FXML within FXML and every part have separate controllers. I decided to follow this tutorial and use my fxml as component. So I use class as a controller and component. Everything seems to be working but I hit a wall when I try to put methods into my class/controller. I edited my FXML so I don't put controller directly into it. But using class itself. this is where the problematic line is <fx:root fx:id="profilePane" onMouseClicked="#select" onMouseEntered="#hoverOver" onMouseExited="#hoverOut" type="javafx.scene.layout.Pane" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1">...etc every method is red saying that Controller is not defined on root component well I know that I removed that part from my fxml. But how would it work on tutorial that I follow? Here is my component class what I work with imports etc.. public class FxmlProfilePanel extends Pane implements Initializable{ @FXML private ToggleButton toggleButton; @FXML private Pane profilePane; private FadeTransition fadeTransition=new FadeTransition(Duration.millis(500),toggleButton); /** * Initializes the controller class. */ @Override public void initialize(URL url, ResourceBundle rb) { // TODO System.out.println("Is fx thread?:"+Platform.isFxApplicationThread()); } public FxmlProfilePanel(){ FXMLLoader fxmlLoader=new FXMLLoader(getClass().getResource("/bitcompile/ecps/fxml/FxmlProfilePanel.fxml")); fxmlLoader.setRoot(this); fxmlLoader.setController(this); try { fxmlLoader.load(); } catch (IOException ex) { Logger.getLogger(FxmlProfilePanel.class.getName()).log(Level.SEVERE, null, ex); } } public void hoverOver(MouseEvent event){ Platform.runLater(() -> { if(!toggleButton.isSelected()){ toggleButton.setText("Select profile"); fadeTransition.setFromValue(0); fadeTransition.setToValue(1.0); fadeTransition.play(); }else{ toggleButton.setText("Deselect profile"); fadeTransition.setFromValue(0); fadeTransition.setToValue(1.0); fadeTransition.play();…
has comment: http://stackoverflow.com/comment/35657781
type: Question
has answer: http://stackoverflow.com/a/55118839
has comment: http://stackoverflow.com/comment/35658076
score: 4
has title: JavaFX FXML doesn't see my controller methods correctly "Controller is not defined on root component" when using fxml as component within fxml
has answer: http://stackoverflow.com/a/45666760
upvote count: 4

http://stackoverflow.com/q/23429502
has comment: http://stackoverflow.com/comment/35907453
favorite count: 0
accepted answer: http://stackoverflow.com/a/23429760
upvote count: 2
downvote count: 2
has comment: http://stackoverflow.com/comment/35907091
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23429760
tagged with: java
has title: java function to find the sum of two lists
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/35907356
possible better answer: http://stackoverflow.com/a/23429788
score: 0
has body: everybody I wrote a code to solve this problem : Write a Java function Sum2List that takes two lists L1 and L2 of the same size and returns list L that contains the sum of data inside the corresponding nodes of lists L1 and L2 ex : l1 = {1,2,3} l2 = {4,5,6} l = l1 + l2 =&gt; {5,7,9} my code is : public class Test { public static List Sum2List (List l1 , List l2){ List l = new List(); ListNode lNode = new ListNode(0,null); l.first = lNode; ListNode p = l1.first; ListNode q = l2.first; for (p = l1.first; p.next!=null; p=p.next,q=q.next){ lNode.data = p.data + q.data; if (p.next != null) lNode.next = new ListNode(0,null); } return l; } public static void main (String[] args){ List l1= new List(); ListNode node4 = new ListNode(4,null); ListNode node3 = new ListNode(3,node4); ListNode node2 = new ListNode(2,node3); ListNode node1 = new ListNode(1,node2); l1.first = node1; List l2= new List(); ListNode node8 = new ListNode(8,null); ListNode node7 = new ListNode(7,node8); ListNode node6 = new ListNode(6,node7); ListNode node5 = new ListNode(5,node6); l2.first = node5; List l = Sum2List(l1,l2); for(ListNode p = l.first; p.next !=null; p=p.next){ System.out.println(p.data); } } } The problem is that the output is ( 10 ) , While it must be a list contain => 5,7,9 So , where is the mistake in the code ??
has answer: http://stackoverflow.com/a/23429788
has comment: http://stackoverflow.com/comment/35907119

http://stackoverflow.com/a/23442909
type: Answer
has comment: http://stackoverflow.com/comment/35959447
score: 36
accepted answer of: http://stackoverflow.com/q/23439780
downvote count: 1
upvote count: 37
answers question: http://stackoverflow.com/q/23439780
has body: For the particular example of NavigableSet.descendingIterator(), I think the simplest way is to use NavigableSet.descendingSet() instead. But given you are probably interested in the more general case, the following seems to work: import java.util.Iterator; import java.util.Spliterator; import java.util.Spliterators; import java.util.TreeSet; import java.util.stream.Stream; import java.util.stream.StreamSupport; public class Streams { public static void main(String... args) { TreeSet&lt;String&gt; set = new TreeSet&lt;&gt;(); set.add("C"); set.add("A"); set.add("B"); Iterator&lt;String&gt; iterator = set.descendingIterator(); int characteristics = Spliterator.DISTINCT | Spliterator.SORTED | Spliterator.ORDERED; Spliterator&lt;String&gt; spliterator = Spliterators.spliteratorUnknownSize(iterator, characteristics); boolean parallel = false; Stream&lt;String&gt; stream = StreamSupport.stream(spliterator, parallel); stream.forEach(System.out::println); // prints C, then B, then A } } In short, you have to create a Spliterator from the Iterator first using one of the static methods in Spliterators. Then you can create a Stream using the static methods in StreamSupport. I don't have that much experience with creating Spliterators and Streams by hand yet, so I can't really comment on what the characteristics should be or what effect they will have. In this particular simple example, it didn't seem to matter whether I defined the characteristics as above, or whether I set it to 0 (i.e. no characteristics). There is also a method in Spliterators for creating a Spliterator with an initial size estimate - I suppose in this particular example you could use set.size(), but if you want to handle arbitrary Iterators I guess this won't be the case. Again, I'm not quite sure what effect it has on performance.
has comment: http://stackoverflow.com/comment/66876097
type: AcceptedAnswer

http://stackoverflow.com/tag/json
tags question: http://stackoverflow.com/q/23376375
tags question: http://stackoverflow.com/q/23373407
tags question: http://stackoverflow.com/q/23351595
tags question: http://stackoverflow.com/q/23373345
tags question: http://stackoverflow.com/q/23442919
tags question: http://stackoverflow.com/q/23307387
tags question: http://stackoverflow.com/q/23392857
tags question: http://stackoverflow.com/q/23301124
tags question: http://stackoverflow.com/q/23311648
tags question: http://stackoverflow.com/q/23374392
tags question: http://stackoverflow.com/q/23297724
tags question: http://stackoverflow.com/q/23438174
tags question: http://stackoverflow.com/q/23364857
tags question: http://stackoverflow.com/q/23368014
tags question: http://stackoverflow.com/q/23426843
tags question: http://stackoverflow.com/q/23292543
tags question: http://stackoverflow.com/q/23304396
tags question: http://stackoverflow.com/q/23330492
tags question: http://stackoverflow.com/q/23318213
tags question: http://stackoverflow.com/q/23295671
tags question: http://stackoverflow.com/q/23340840
tags question: http://stackoverflow.com/q/23307933
tags question: http://stackoverflow.com/q/23343150
tags question: http://stackoverflow.com/q/23438546
type: Tag
tags question: http://stackoverflow.com/q/23297685
tags question: http://stackoverflow.com/q/23441095
tags question: http://stackoverflow.com/q/23322818
tags question: http://stackoverflow.com/q/23290877
tags question: http://stackoverflow.com/q/23401431
tags question: http://stackoverflow.com/q/23374968
tags question: http://stackoverflow.com/q/23301290
tags question: http://stackoverflow.com/q/23415266
tags question: http://stackoverflow.com/q/23429017
tags question: http://stackoverflow.com/q/23380182
tags question: http://stackoverflow.com/q/23300755
tags question: http://stackoverflow.com/q/23379003
tags question: http://stackoverflow.com/q/23337589
tags question: http://stackoverflow.com/q/23304047
tags question: http://stackoverflow.com/q/23446851
tags question: http://stackoverflow.com/q/23316377
tags question: http://stackoverflow.com/q/23436329
tags question: http://stackoverflow.com/q/23298201
tags question: http://stackoverflow.com/q/23326350
tags question: http://stackoverflow.com/q/23363801
tags question: http://stackoverflow.com/q/23393438
tags question: http://stackoverflow.com/q/23310056
tag name: json
tags question: http://stackoverflow.com/q/23310500
tags question: http://stackoverflow.com/q/23307328
tags question: http://stackoverflow.com/q/23430519
tags question: http://stackoverflow.com/q/23296132
tags question: http://stackoverflow.com/q/23356564
tags question: http://stackoverflow.com/q/23420873
tags question: http://stackoverflow.com/q/23425250
tags question: http://stackoverflow.com/q/23356922
tags question: http://stackoverflow.com/q/23442440
tags question: http://stackoverflow.com/q/23432214
tags question: http://stackoverflow.com/q/23388369
tags question: http://stackoverflow.com/q/23410157
tags question: http://stackoverflow.com/q/23322250
tags question: http://stackoverflow.com/q/23322585
tags question: http://stackoverflow.com/q/23304253
tags question: http://stackoverflow.com/q/23411583
tags question: http://stackoverflow.com/q/23344099
tags question: http://stackoverflow.com/q/23382167
tags question: http://stackoverflow.com/q/23297402
tags question: http://stackoverflow.com/q/23394760
tags question: http://stackoverflow.com/q/23411874
tags question: http://stackoverflow.com/q/23357335
tags question: http://stackoverflow.com/q/23358824
tags question: http://stackoverflow.com/q/23365618
tags question: http://stackoverflow.com/q/23396321
tags question: http://stackoverflow.com/q/23309710
tags question: http://stackoverflow.com/q/23304250
tags question: http://stackoverflow.com/q/23312518
tags question: http://stackoverflow.com/q/23290843
tags question: http://stackoverflow.com/q/23296213
tags question: http://stackoverflow.com/q/23291015
tags question: http://stackoverflow.com/q/23380285

http://stackoverflow.com/q/23366674
has answer: http://stackoverflow.com/a/23367881
answer count: 4
score: 2
downvote count: 0
tagged with: dynamic
tagged with: java
tagged with: webdriver
type: Question
has title: Selenium Webdriver - Find dynamic id from li/a
tagged with: find
has answer: http://stackoverflow.com/a/41171020
upvote count: 2
has answer: http://stackoverflow.com/a/23366864
has body: I am trying to select a value(Bellevue) from a li(it looks like a dropdown but it isn't).The problem is that its id changes everytime the page loads. Here is a screenshot: This time the id is: ui-id-23,but the number,23,will be changed next time so this will not work.If I expand the &lt;a id="ui-id-23..." I get the name 'Bellevue' but every character surrounded by &lt; strong > &lt; /strong > mark-up. I can't find it after it's classname because both values from li have the same class,ui-menu-item. I tried after xpath:"//a[contains(text(),'Bellevue')]" but I get the error:Unable to locate element... Do you know any solution for this?I am using Selenium Webdriver in Java and TestNG. Thanks! Update So I managed to find that element by using: WebElement value = driver.findElements(By.cssSelector("a[id^='ui-id-']")).get(3); value.click(); . but in my application i am using page objects and i look after elements using @FindBy(how.HOW.....).Do you know how I can use .get(3) with @FindBy?
has answer: http://stackoverflow.com/a/23367476
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/a/23440818
has comment: http://stackoverflow.com/comment/35928817
downvote count: 0
answers question: http://stackoverflow.com/q/23440796
has comment: http://stackoverflow.com/comment/35928902
has comment: http://stackoverflow.com/comment/35928937
type: Answer
has comment: http://stackoverflow.com/comment/35929234
has comment: http://stackoverflow.com/comment/35929067
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/35928953
has comment: http://stackoverflow.com/comment/35929014
has comment: http://stackoverflow.com/comment/35929048
has comment: http://stackoverflow.com/comment/35929170
has comment: http://stackoverflow.com/comment/35928773
has comment: http://stackoverflow.com/comment/35928560
has comment: http://stackoverflow.com/comment/35928996
has comment: http://stackoverflow.com/comment/35928945
has comment: http://stackoverflow.com/comment/35928610
has comment: http://stackoverflow.com/comment/35928968
has comment: http://stackoverflow.com/comment/35928978
has body: Always use some logical and meaningful column names. Don't make it too short that you can't differentiate it. Put spaces before SET, WHERE and each comma. Try to put all in single string. "UPDATE Leave_Table SET J=?, F=?, M=?, A=?, M=?, J=?, Ju=?, Au=?, Se=?, O=?, N=?, D=? WHERE LeaveType=?" --EDIT-- the error is: java.sql.SQLException: Syntax error: Stopped parse at Dec(id104) There is no column name D. Try with Dec instead of D "UPDATE Leave_Table SET J=?, F=?, M=?, A=?, M=?, J=?, Ju=?, Au=?, Se=?, O=?, N=?, Dec=? WHERE LeaveType=?"
has comment: http://stackoverflow.com/comment/35928839
has comment: http://stackoverflow.com/comment/35928872
has comment: http://stackoverflow.com/comment/35929309
has comment: http://stackoverflow.com/comment/35929124
has comment: http://stackoverflow.com/comment/35928905
has comment: http://stackoverflow.com/comment/35928990
has comment: http://stackoverflow.com/comment/35929305

http://stackoverflow.com/comment/35757793
has text: The encoded objects differ on the PC and on Android, even though the objects are identical.
comment on: http://stackoverflow.com/a/23331502
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/23449242
accepted answer: http://stackoverflow.com/a/23450319
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/35953034
tagged with: swing
linked to: http://stackoverflow.com/q/6112469
tagged with: jbutton
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35944710
has body: Ok, I am sorry I am repeating questions that have already been asked but I have searched and searched and searched and nobody's answers seemed to have helped me... I tried the following questions: JButton "stay pressed" after click in Java Applet JButton stays pressed when focus stolen by JOptionPane (I apologize if I'm just being dumb.. it is hard to relate to my code) I have tried everything: using another thread to handle all the stuff, changing the JFrame to a JDialog as apparently they are "modal" so it would work independently. But that didn't seem to work either. I am stuck now so I am using my last resource (asking Stack Overflow). What I am trying to do is get the user to enter some numbers in a textfield (4,2,7) then they press a JButton "Calculate Mean" and it finds the mean of the numbers and displays it in a JOptionPane message. When the user closes the JOptionPane dialog box they should be able to edit the numbers and do it again but the "Calculate Mean" button stays pressed and the user can't do anything but close the window. Even pressing the Tab key doesn't change anything. Does anyone know why this is? My code is down below: PLEASE FORGIVE ME IF MY CODE IS HARD TO READ! I spent a very long time trying to indent it all correctly and I also tried to make it as short as possible by taking out any bits unrelated to the question. I was unsure which bits to take out so there still might be some unnecessary bits... I am sorry for my messy code but this is the code: package MathsProgram_II; import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.ArrayList; import java.util.Arrays; public class Mean implements Runnable { JFrame meanFrame = new JFrame(); //I tried changing this to dialog JPanel meanPanel = new JPanel(new GridBagLayout()); JLabel enterNums = new JLabel("Enter Numbers: "); JTextField txtNums = new JTextField(20); JButton calculate = new JButton("Calculate Mean"); boolea…
has comment: http://stackoverflow.com/comment/35944300
score: 1
has comment: http://stackoverflow.com/comment/35954147
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/23450319
type: Question
linked to: http://stackoverflow.com/q/12500494
has title: JButton stays pressed after a JOptionPane is displayed

http://stackoverflow.com/q/23443444
answer count: 2
downvote count: 0
has body: i'm trying to use logback in my project but there is some problem . when i run my code it gives me this: SLF4J: Class path contains multiple SLF4J bindings. SLF4J: Found binding in [jar:file:/home/mostafa/.m2/repository/org/slf4j/slf4j-log4j12/1.7.2/slf4j-log4j12-1.7.2.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: Found binding in [jar:file:/home/mostafa/.m2/repository/ch/qos/logback/logback-classic/1.1.1/logback-classic-1.1.1.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation. SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory] log4j:WARN No appenders could be found for logger (com.project.Test). log4j:WARN Please initialize the log4j system properly. log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info. my logback.xml is under resources folder: $ tree sample |-- pom.xml `-- src `-- main |-- java | |-- resources | `-- logback.xml and my project structure is :
favorite count: 0
has answer: http://stackoverflow.com/a/23444435
possible better answer: http://stackoverflow.com/a/23443526
has answer: http://stackoverflow.com/a/23443526
tagged with: logging
type: AnsweredQuestion
upvote count: 3
tagged with: java
accepted answer: http://stackoverflow.com/a/23444435
type: Question
score: 3
has comment: http://stackoverflow.com/comment/35932989
has title: Can not find logback.xml in resources folder
tagged with: logback
has comment: http://stackoverflow.com/comment/35932937
tagged with: slf4j

annotations
tags question: http://stackoverflow.com/q/23366238
type: Tag
tags question: http://stackoverflow.com/q/23301070
tags question: http://stackoverflow.com/q/23448925
tags question: http://stackoverflow.com/q/23344165
tags question: http://stackoverflow.com/q/23449671
tags question: http://stackoverflow.com/q/23381253
tags question: http://stackoverflow.com/q/23437044
tags question: http://stackoverflow.com/q/23313481
tags question: http://stackoverflow.com/q/23300403
tag name: annotations
tags question: http://stackoverflow.com/q/23398515
tags question: http://stackoverflow.com/q/23336172
tags question: http://stackoverflow.com/q/23411163

http://stackoverflow.com/a/23393756
type: Answer
score: 0
has body: When overriding the transitions for button 1, call your 'slidein' animation. When you press button 2, call your 'slideout' animation which is the reverse of slidein. i.e slide in would have: fromYDelta="-100%" toYDelta="0%" And slide out would have: fromYDelta="0%" toYDelta="-100%"
answers question: http://stackoverflow.com/q/23392991

http://stackoverflow.com/q/23310616
tagged with: android
has answer: http://stackoverflow.com/a/23347774
accepted answer: http://stackoverflow.com/a/23325480
has body: I am developing a game in libgdx, I want to do a global highscore table. I tried to find some tutorials about this subject and I coudn't find even one that explain step by step how to do that on libgdx platform - (android).
has comment: http://stackoverflow.com/comment/35708461
type: AnsweredQuestion
tagged with: libgdx
has comment: http://stackoverflow.com/comment/35714130
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/23325480
answer count: 2
has title: How to do a global highscore table in my Libgdx game?
score: 0
possible better answer: http://stackoverflow.com/a/23347774

http://stackoverflow.com/q/23334901
type: Question
score: 0
tagged with: liferay
has title: Display time format on Liferay wiki comment must be in 24 format
answer count: 1
has answer: http://stackoverflow.com/a/23344471
type: UnansweredQuestion
has body: I want to display time display of my wiki comment is in 24 format. how to do it as if i comment on my wiki it displaying "custom_comment posted on 1:00pm" but it must be display "custom_comment posted on 13:00"
tagged with: java

http://stackoverflow.com/q/23309998
has comment: http://stackoverflow.com/comment/35687253
type: Question
has answer: http://stackoverflow.com/a/23310165
accepted answer: http://stackoverflow.com/a/23310165
has body: i want to implement method s such as : given 2 int values, returns true if either of them is in the range 10..20 inclusive. simple answer is: public boolean s(int a, int b) { return (a &gt; 9 &amp;&amp; a &lt; 21) || (b &gt; 9 &amp;&amp; b &lt; 21); } but how implement without duplicated use of pattern (x &gt; 9 &amp;&amp; x &lt; 21) and without new method? has a recursive solution?
has comment: http://stackoverflow.com/comment/35686476
score: 0
possible better answer: http://stackoverflow.com/a/23310119
has comment: http://stackoverflow.com/comment/35686558
upvote count: 1
has comment: http://stackoverflow.com/comment/35686904
has comment: http://stackoverflow.com/comment/35687208
answer count: 4
favorite count: 0
has title: implementing a method that returns true if all argument is in the range
has comment: http://stackoverflow.com/comment/35687156
has comment: http://stackoverflow.com/comment/35686459
downvote count: 1
has comment: http://stackoverflow.com/comment/35687050
tagged with: recursion
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35686987
has comment: http://stackoverflow.com/comment/35686920
has answer: http://stackoverflow.com/a/23310119
tagged with: refactoring
tagged with: java
has comment: http://stackoverflow.com/comment/35687100
has answer: http://stackoverflow.com/a/23310102
has comment: http://stackoverflow.com/comment/35687187
has comment: http://stackoverflow.com/comment/35687123
has comment: http://stackoverflow.com/comment/35686881
has answer: http://stackoverflow.com/a/23310255

http://stackoverflow.com/a/23362769
answers question: http://stackoverflow.com/q/23317012
accepted answer of: http://stackoverflow.com/q/23317012
score: 1
downvote count: 0
type: AcceptedAnswer
has body: Problem solved. After I enabled logging, it becomes clear that my data includes rows where value were missing in the 4rd column, so I added the null check if (fields[4] != null) and it worked. Also I get rid of array to list convertion and usage of TextArrayWritable custom class Mapper: @Override public void map(Object key, Text value, Context context) throws IOException, InterruptedException { String[] fields = value.toString().split("\\t", -1); for (int i = 0; i &lt; fields.length; ++i) { if ("".equals(fields[i])) fields[i] = null; } if (fields[4] != null) { System.out.println(fields[0]); System.out.println(fields[4]); context.write(new Text(fields[0]),new Text(fields[4])); } } } Reducer: public class SongsReducer extends Reducer&lt;Text, Text, Text, Text&gt; { public void reduce(Text key, Iterable&lt;Text&gt; values, Context context) throws IOException, InterruptedException { boolean first = true; StringBuilder songs = new StringBuilder();; for (Text val : values){ if (!first) songs.append(","); first=false; songs.append(val.toString()); } context.write(key, new Text(songs.toString())); } }
type: Answer
upvote count: 1

http://stackoverflow.com/comment/35825061
comment on: http://stackoverflow.com/a/23369774
type: Comment
score: 0
type: AnswerComment
has text: What do you mean with "I dont need to load two pictues into the buffer"?

http://stackoverflow.com/q/23369634
tagged with: spring-3
score: 1
tagged with: java
has body: I am new to Spring and having a basic question related to the Spring 3 MVC controller class. I have this below method in my controller: @RequestMapping("/index") public String listContacts(Map<String, Object> map) { map.put("contacts", new EmployeeForm()); map.put("contactList", employeeService.listEmployee()); return "contacts"; } In the JSP file, I an accessing the contactList using this below piece of code: <c:forEach items="${contactList}" var="contact"> ${contact.lastname}, ${contact.firstname} ${contact.email} ${contact.telephone} delete </c:forEach> My confusion: I have not added that contactList in a session or request attribute in my controller class, then how am I able to access the same in JSP file using ${contactList} ? Please clarify.
has answer: http://stackoverflow.com/a/23370665
upvote count: 1
has answer: http://stackoverflow.com/a/23369666
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/23370665
downvote count: 0
has title: Spring 3.x MVC Controller:Adding attribute to Request/Session
accepted answer: http://stackoverflow.com/a/23369666
tagged with: jsp
favorite count: 0
tagged with: spring
tagged with: spring-mvc
type: AnsweredQuestion

http://stackoverflow.com/q/23391088
has answer: http://stackoverflow.com/a/23393313
has answer: http://stackoverflow.com/a/23432140
tagged with: soap
upvote count: 1
tagged with: web-services
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23432140
tagged with: java
tagged with: lotus-domino
linked to: http://stackoverflow.com/q/23344373
type: Question
has comment: http://stackoverflow.com/comment/35838971
answer count: 2
has comment: http://stackoverflow.com/comment/35837813
has comment: http://stackoverflow.com/comment/35836303
downvote count: 0
score: 1
favorite count: 0
has title: Array of object parameter in Java Webservice Provider
has comment: http://stackoverflow.com/comment/35836146
has comment: http://stackoverflow.com/comment/35835875
possible better answer: http://stackoverflow.com/a/23393313
has body: My provider must have an array of object as input parameter, according to the WSDL: This is the generated method: public void protoModificaProtocollo(...,...,...,Titolario[] classifica,....) { How to get the input values of this array (always returns null). EDIT This is the xsd schema of the method to provide: <import schemaLocation="TipoVerso.xsd" namespace="http://regione.toscana.it/rfc205/interpro.TipoVerso"/> <import schemaLocation="Anagrafica.xsd" namespace="http://regione.toscana.it/rfc205/interpro.Anagrafica"/> <import schemaLocation="Titolario.xsd" namespace="http://regione.toscana.it/rfc205/interpro.Titolario"/> and this is the xsd schema of Titolario <?xml version="1.0" encoding="UTF-8"?> Here the SOAP message sent: <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:int="http://regione.toscana.it/rfc205/interpro" xmlns:int1="http://regione.toscana.it/rfc205/interpro.protoModificaProtocollo" xmlns:int2="http://regione.toscana.it/rfc205/interpro.Titolario" xmlns:int3="http://regione.toscana.it/rfc205/interpro.Anagrafica"> <soapenv:Header/> <soapenv:Body> <int:protoModificaProtocollo> <int1:numero>140</int1:numero> <int1:anno>2014</int1:anno> <int1:verso>P</int1:verso> <int1:oggetto>test</int1:oggetto> <int1:classifica> <int2:codice>34</int2:codice> <int2:descrizione>test description</int2:descrizione> </int1:classifica> </int:protoModificaProtocollo> </soapenv:Body> </soapenv:Envelope> In the provider, this is the method: public void protoModificaProtocollo(int numero, int anno, TipoVerso verso, String oggetto, Titolario[] classificazione, Anagrafica[] ufficio, ResponseProtocolloHolder protocollo_resp, ResponseErrorHolder response_msg_err) { ... some stuff here ... System.out.println("getCodice():" + classificazione[0].getCodice()); <-- THIS LINE ALWAYS RETURNS NULL Notice that, in input parameters, if I change Titolario[] classificazione with Titolario classificazione my debug line prints: 34 UPDATE 2 TIA Simon, here pastebin …

http://stackoverflow.com/comment/35699362
score: 0
has text: `org.springframework.web.client.ResourceAccessException: I/O error on PUT request for "http://localhost:8080/url/to/rest/api":localhost:8080 failed to respond; nested exception is org.apache.http.NoHttpResponseException: localhost:8080 failed to respond at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:543) at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:489) at org.springframework.web.client.RestTemplate.exchange(RestTemplate.java:431)`
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/23316754

http://stackoverflow.com/a/23399405
score: 0
type: Answer
has body: I would start with one of the many open source libraries which does MapReduce already. They could use RMI but might not mention it because they might not consider it important to MapReduce. You can use Java RMI, or a wide number transports, to implement Map Reduce. There is a lot more to MapReduce than having a transport. but RMI is fine.
answers question: http://stackoverflow.com/q/23399368

http://stackoverflow.com/comment/35774464
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23344225
has text: Hi @EricStein, yes I looked at that, but I think it seems to be not the same problem... Interestingly, I see the same problem, if I do for example a second GET request after I received the former Exceptions.
score: 0

http://stackoverflow.com/q/23411023
tagged with: nullpointerexception
answer count: 3
has body: I have a line in my Java code: a.b=c; Where a, b &amp; c all are objects. When the line will throw NullPoinnterException? When a is null, b is null or c is null or which combination of it is null?
has title: a.b=c; when it will throw NullPointerException? where a, b & c all are objects
has comment: http://stackoverflow.com/comment/35872810
possible better answer: http://stackoverflow.com/a/23411066
has answer: http://stackoverflow.com/a/23411066
accepted answer: http://stackoverflow.com/a/23411373
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35873000
has comment: http://stackoverflow.com/comment/35872806
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/23411373
has answer: http://stackoverflow.com/a/23411348
score: 0

http://stackoverflow.com/comment/37534058
has text: I've tested and both these fragments sort by modified date. Accordingly I've flagged to close as typo/unreproducible.
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23440299

http://stackoverflow.com/a/23445958
score: 2
has comment: http://stackoverflow.com/comment/35942632
upvote count: 2
has body: You can use System.getProperty("user.dir") and find the directory from which the program is run. If you look at the docs, you will get the description below: user.dir User's current working directory SSCCE: public class Ideone { public static void main (String[] args) throws java.lang.Exception { System.out.println(System.getProperty("user.dir")); } }
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23445777
answers question: http://stackoverflow.com/q/23445777
type: Answer

http://stackoverflow.com/q/23314029
has comment: http://stackoverflow.com/comment/35694018
tagged with: java
type: Question
has title: java.util.regex Validating Phone numbers
has answer: http://stackoverflow.com/a/23314319
tagged with: validation
answer count: 1
has body: I am trying to validate a phone number input from a user(in my project). This is the method I created trying to validate it and also give them 3 tries to enter a valid format. However what ever I cannot get it to return the prompt that tells them to re enter the number it just runs it true or false. Where am I going wrong. public static boolean getPhoneInput(String phone) { int count =0; String input, inputString = phone; input = JOptionPane.showInputDialog( phone ); String pattern="(\\d-)?(\\d{3}-)?\\d{3}-\\d{4}"; Pattern p = Pattern.compile(pattern); Matcher m = p.matcher(inputString); while ((phone != null &amp;&amp; input.length() == 0) &amp;&amp; (count &lt;2)){ input = JOptionPane.showInputDialog("No input was detected \n" + phone); count++;} if (count==2){ JOptionPane.showMessageDialog(null, " Sorry due to errors your order cannot be processed. GOODBYE."); System.exit(0); { } } return false;} I tried to use an example I found and modify it for my program. I am unsure how to get the Boolean type to return a message if they leave the field blank or in an invalid format. I was able to get everything working like a charm within my code using the getPhoneInput() method, however is there a way to return something other than a true or false with a Boolean. I understand that is what it was built to do, but once I have the correct format i want the number written to a txt file. as it works now instead of logging a number with the users name it just tells me that their phone number matched the required format or that it did not with a true or false.
tagged with: regex
accepted answer: http://stackoverflow.com/a/23314319
has comment: http://stackoverflow.com/comment/35693954
score: 0
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35694078

http://stackoverflow.com/q/23415172
has body: I am passing 3 ints from MainActivity to main and displaying them in separate Textviews. When I click button to go to next activity, it shows the last passed int in the last textview. Pressing the back button on my smartphone, it resets the last textview to 0 and shows the correct value for the second textview. Then pressing the back button again, it resets the second textview to 0 and shows the correct value for the first textview. Code inside OnCreate method at MainActivity.java: Intent sendX = new Intent(MainActivity.this, main.class); sendX.putExtra("x", x); startActivity(sendX); Intent sendY = new Intent(MainActivity.this, main.class); sendY.putExtra("y", y); startActivity(sendY); Intent sendZ = new Intent(MainActivity.this, main.class); sendZ.putExtra("z", z); startActivity(sendZ); Code inside OnCreate method at main.class: Intent getX = getIntent(); x = getX.getIntExtra("x", 0); Intent getY = getIntent(); y = getY.getIntExtra("y", 0); Intent getZ = getIntent(); z = getZ.getIntExtra("z", 0); TextView test1 = (TextView)findViewById(R.id.testx); test1.setText(Integer.toString(x)); TextView test2 = (TextView)findViewById(R.id.testy); test2.setText(Integer.toString(y)); TextView test3 = (TextView)findViewById(R.id.testz); test3.setText(Integer.toString(z));
tagged with: android
type: AnsweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/23415248
accepted answer: http://stackoverflow.com/a/23415248
score: 0
has title: Passing ints into other activity causes strange behavior
answer count: 1

http://stackoverflow.com/q/23412704
upvote count: 1
tagged with: swing
score: 1
tagged with: java
type: Question
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/23412817
favorite count: 0
has title: How can a component on a panel alert other components outside the panel when a value changes?
type: UnansweredQuestion
has body: I am writing a Swing program in which all panels are declared as separate classes and a JFrame that holds the panels. The input panel has a subpanel that has a number of buttons on it. When when one of those buttons is clicked and a value is calculated, I would like to pass that value back to the JFrame holding the input panel, so that the value can be used in a number of other calculations. I know that I can just use the JFrame ActionListener to be directly responsible for the buttons on the sub panel, but that seems to violate either portability, encapsulation, or both. I want the sub panel to be able to work on its own and let the JFrame using it be aware when a certain value changes. I would prefer to keep the value as a primitive, but if only an object works, I can go with that. The program has already been written as one class and it worked fine, but a beast to edit. When I was done, I realized that it was a mistake not to break it down into six panels each as their own class. A lesson for future projects. So, I am rewriting it and running into the problem that the JFrame is dependent on knowing when one of its panels (actually a panel on that panel) recalculates a value. The value calculation isn't a problem, but the JFrame needs to know when it changes. I hope that is clear. It seemed pretty clear to me! :-) The following code is a simplification of what I'm trying to do. import java.awt.BorderLayout; import java.awt.event.*; import javax.swing.*; public class ChangeState extends JFrame { // This is to receive the value when changed in ButtonPanel private JTextField answer = new JTextField(5); private InputPanel inputPanel = new InputPanel(); public ChangeState() { setDefaultCloseOperation(EXIT_ON_CLOSE); add(inputPanel, BorderLayout.CENTER); add(answer, BorderLayout.SOUTH); pack(); setVisible(true); } public static void main(String[] args) { ChangeState mf = new ChangeState(); } } class InputPanel extends JPanel { private ButtonPanel buttonPanel = new Butto…

http://stackoverflow.com/comment/35718520
score: 0
comment on: http://stackoverflow.com/q/23327434
type: QuestionComment
type: Comment
has text: There are many ways. For example `std:array<int, 5> foo;`

http://stackoverflow.com/comment/35871526
has text: You loose not null information where exactly? Your primary key column cannot possibly be null right now. Your Foreign key might be nullable but then if it is, you have no problem in loosing the not null information. So.. where exactly that is a problem?
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23410150

http://stackoverflow.com/comment/35683401
type: AnswerComment
type: Comment
score: 0
comment on: http://stackoverflow.com/a/23308127
has text: For the OneToMany and ManyToOne, conceptually the same training class can be part of many training course but it is not aware that it is indeed part of many training courses. I guess in the programming model, may be the OneToMany should suffice.

http://stackoverflow.com/q/23372573
has comment: http://stackoverflow.com/comment/35801863
has body: While trying to compute the square root of a BigInteger using BINARY SEARCH method,I was stuck in between as to how to comapre two BigIntegers for satisfying comparison operation. Like, I wanted to check for equality,greater than or lesser than conditions between two BigInteger variables. Here is the wrong piece of code with rough idea of as to what I want to perform.Any efforts to resolve the issue would be appreciated. public static BigInteger squareroot(BigInteger bi){ //BigInteger bkl; BigInteger low,high,mid; low=ONE; high=bi.add(ZERO); while(low&lt;=high) { mid =(low.add(high)).divide(new BigInteger("2")); if(mid.multiply(mid).equals(bi)) return mid; if(mid.multiply(mid) &gt; bi) high = mid -1 ; else low = mid + 1; } return mid; }
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/35801906
has answer: http://stackoverflow.com/a/23373039
has comment: http://stackoverflow.com/comment/35802355
tagged with: biginteger
upvote count: 2
tagged with: java
answer count: 2
possible better answer: http://stackoverflow.com/a/23373039
downvote count: 1
has comment: http://stackoverflow.com/comment/35801810
tagged with: comparison-operators
has answer: http://stackoverflow.com/a/23372616
has comment: http://stackoverflow.com/comment/35802341
has comment: http://stackoverflow.com/comment/35801776
tagged with: binary-search
has comment: http://stackoverflow.com/comment/35801722
accepted answer: http://stackoverflow.com/a/23372616
type: AnsweredQuestion
has title: Relational Operation on two BigIntegers in Java
linked to: http://stackoverflow.com/q/4407839
has comment: http://stackoverflow.com/comment/35801837
score: 1

http://stackoverflow.com/a/23389869
answers question: http://stackoverflow.com/q/23388983
score: 1
accepted answer of: http://stackoverflow.com/q/23388983
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/35834178
has body: I would be tempted to go the simplest way: final String faultyHtml = "Link: click here etc etc"; final String domain = "http://www.google.fr"; final String fixedHtml = faultyHtml.replace("href=\"/", "href=\"" + domain + "/"); text.setText(Html.fromHtml(fixedHtml)); text.setMovementMethod(LinkMovementMethod.getInstance()); (all occurrences would be added the same domain though)
upvote count: 1

event-handling
tag name: event-handling
tags question: http://stackoverflow.com/q/23438999
type: Tag

http://stackoverflow.com/q/23397394
tagged with: http://stackoverflow.com/tag/xml
possible better answer: http://stackoverflow.com/a/23397514
tagged with: java
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/23397514
tagged with: admob
has answer: http://stackoverflow.com/a/23397816
type: AnsweredQuestion
has body: I've searched on Google and stackoverflow, I browsed all the questions and answers and nothing seems to work for me.. The ad is still showing up at the bottom of my activity.. Does anyone know what i am doing wrong? public class MainActivity extends Activity { String[] myItems; RelativeLayout RelLay; @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.menu); RelLay = (RelativeLayout) findViewById (R.id.RelLay); AdView ad = (AdView) findViewById(R.id.ad); AdView adView = new AdView(this.getApplicationContext()); adView = new AdView(this); adView.setAdSize(AdSize.SMART_BANNER); adView.setAdUnitId("ca-app-pub-5045823047142424/5834743995"); RelLay.addView(adView, 0); AdRequest adRequest = new AdRequest.Builder().build(); adView.loadAd(adRequest); populateListView(); registerClickCallBack(); } my xml: &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:ads="http://schemas.android.com/apk/res-auto" android:id="@+id/RelLay" android:layout_width="fill_parent" android:layout_height="match_parent" &gt; &lt;ListView android:id="@+id/listView" android:layout_width="wrap_content" android:layout_height="400dp" android:layout_alignParentTop="true" &gt; &lt;/ListView&gt; &lt;com.google.android.gms.ads.AdView android:id="@+id/ad" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_alignParentBottom="true" ads:adSize="SMART_BANNER" android:layout_below="@id/listView" ads:adUnitId="ca-app-pub-5045823047142424/5834743995" android:layout_weight="1"/&gt; &lt;/RelativeLayout&gt; and when it shows up at the top of the activity i get an error like this: 04-30 16:17:57.787: E/eglCodecCommon(1468): **** ERROR unknown type 0x0 (glSizeof,72) glUtilsParamSize: unknow param 0x00000b44 glUtilsParamSize: unknow param 0x00000bd0 **** ERROR unknown type 0x0 (glSizeof,72) glUtilsParamSize…
accepted answer: http://stackoverflow.com/a/23397816
type: Question
has title: Can't get admobs ad to show up at the bottom
tagged with: android
has answer: http://stackoverflow.com/a/23397853

http://stackoverflow.com/comment/35694333
score: 0
type: Comment
type: QuestionComment
has text: After your second edit I have to admit that actually the answer suggesting `BigDecimal` seems to be exactly what you need. The problem you face there has to do with floating point precision, it's nothing about formatting results or anything. Try `1000.0 * 0.123 / 0.123` and you will not have the problem with getting `999.99999` as a result. However, you say you have the code done but maybe someone could do it better - how about you provide us the code and we can look if we can improve it?
comment on: http://stackoverflow.com/q/23313411

http://stackoverflow.com/comment/35740184
comment on: http://stackoverflow.com/q/23339407
score: 0
type: Comment
type: QuestionComment
has text: It seems to be only "working" when I use ";" as the separator though

http://stackoverflow.com/comment/35846701
comment on: http://stackoverflow.com/q/23396700
score: 1
type: Comment
type: QuestionComment
has text: Could you share some code, so that we could better see what's going on in your code.

http://stackoverflow.com/comment/35849371
comment on: http://stackoverflow.com/a/23398365
type: Comment
has text: cheers then mate. I just thought that there might be something equivalent to %n but thank you.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/35659530
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23295026
type: AnswerComment
has text: Cheers! Enjoy testing!

http://stackoverflow.com/comment/35948175
score: 2
comment on: http://stackoverflow.com/q/23451240
type: Comment
type: QuestionComment
has text: This isn't skeleton code, this is a blank class. If it took you an hour and a half to write an empty class...

http://stackoverflow.com/a/23378661
type: Answer
has comment: http://stackoverflow.com/comment/35812987
answers question: http://stackoverflow.com/q/23378157
has body: It's about thread issue.. when I tried to run it in Event Dispatch Thread, it runs fine.. you may learn about EDT from this discussion: Why do I need Swing Utilities and how do I use it? note: I hope others might found better solution for this though.. import java.io.IOException; import java.net.URL; import javax.sound.sampled.AudioInputStream; import javax.sound.sampled.AudioSystem; import javax.sound.sampled.Clip; import javax.sound.sampled.DataLine; import javax.sound.sampled.LineUnavailableException; import javax.sound.sampled.UnsupportedAudioFileException; import javax.swing.SwingUtilities; public class Driver { @SuppressWarnings("empty-statement") public static void main(String[] args) { try { URL url = new URL("http://api.voicerss.org/?KEY=b1a362bc35014e9c9dcd8d3536aac7ad&amp;SRC=Your%20a%20fag&amp;HL=en-gb&amp;C=WAV&amp;F=48khz_16bit_stereo"); AudioInputStream sound = AudioSystem.getAudioInputStream(url); DataLine.Info info = new DataLine.Info (Clip.class, sound.getFormat()); final Clip clip = (Clip)AudioSystem.getLine(info); clip.open(sound); clip.setFramePosition(0); SwingUtilities.invokeLater(new Runnable() { @Override public void run() { clip.start(); } }); } catch (IOException | LineUnavailableException | UnsupportedAudioFileException e) { e.printStackTrace(); } } }
score: 0

http://stackoverflow.com/a/52232488
score: 2
downvote count: 0
upvote count: 2
answers question: http://stackoverflow.com/q/23408111
type: Answer
has body: Seems like this is an issue with the installer. You can specify your Java installation by passing it with a parameter like this: *GLASSFISH_INSTALLER_NAME* -j *YOUR_JAVA_INSTALLATION_PATH_TO_JDK* Example: ogs-3.1.2.2-windows.exe -j "C:\Program Files\Java\jdk1.7.0_80" Simply go to the location of the installer on command prompt and type above. This method worked perfectly for me.

arrays
tags question: http://stackoverflow.com/q/23438076
tags question: http://stackoverflow.com/q/23345232
tags question: http://stackoverflow.com/q/23318415
tags question: http://stackoverflow.com/q/23300687
tags question: http://stackoverflow.com/q/23326798
tags question: http://stackoverflow.com/q/23299407
tags question: http://stackoverflow.com/q/23365618
tags question: http://stackoverflow.com/q/23440058
tags question: http://stackoverflow.com/q/23443772
tags question: http://stackoverflow.com/q/23396321
tags question: http://stackoverflow.com/q/23439015
tags question: http://stackoverflow.com/q/23431835
tags question: http://stackoverflow.com/q/23402244
tags question: http://stackoverflow.com/q/23391342
tags question: http://stackoverflow.com/q/23305271
tags question: http://stackoverflow.com/q/23337800
tags question: http://stackoverflow.com/q/23299972
type: Tag
tags question: http://stackoverflow.com/q/23378802
tags question: http://stackoverflow.com/q/23330735
tags question: http://stackoverflow.com/q/23424247
tags question: http://stackoverflow.com/q/23434240
tags question: http://stackoverflow.com/q/23327434
tags question: http://stackoverflow.com/q/23401293
tags question: http://stackoverflow.com/q/23297066
tags question: http://stackoverflow.com/q/23442292
tags question: http://stackoverflow.com/q/23432886
tags question: http://stackoverflow.com/q/23330419
tags question: http://stackoverflow.com/q/23395040
tags question: http://stackoverflow.com/q/23333922
tags question: http://stackoverflow.com/q/23377979
tags question: http://stackoverflow.com/q/23420942
tags question: http://stackoverflow.com/q/23348971
tags question: http://stackoverflow.com/q/23331198
tags question: http://stackoverflow.com/q/23296778
tags question: http://stackoverflow.com/q/23408084
tags question: http://stackoverflow.com/q/23419281
tags question: http://stackoverflow.com/q/23447623
tags question: http://stackoverflow.com/q/23310545
tags question: http://stackoverflow.com/q/23305881
tags question: http://stackoverflow.com/q/23447922
tags question: http://stackoverflow.com/q/23439570
tags question: http://stackoverflow.com/q/23332889
tags question: http://stackoverflow.com/q/23371856
tags question: http://stackoverflow.com/q/23367487
tags question: http://stackoverflow.com/q/23392037
tags question: http://stackoverflow.com/q/23451036
tags question: http://stackoverflow.com/q/23351595
tags question: http://stackoverflow.com/q/23302933
tags question: http://stackoverflow.com/q/23368232
tags question: http://stackoverflow.com/q/23432881
tags question: http://stackoverflow.com/q/23377113
tags question: http://stackoverflow.com/q/23377085
tags question: http://stackoverflow.com/q/23378204
tags question: http://stackoverflow.com/q/23324347
tags question: http://stackoverflow.com/q/23392857
tags question: http://stackoverflow.com/q/23330383
tags question: http://stackoverflow.com/q/23352223
tags question: http://stackoverflow.com/q/23416135
tags question: http://stackoverflow.com/q/23327015
tags question: http://stackoverflow.com/q/23292197
tags question: http://stackoverflow.com/q/23445252
tags question: http://stackoverflow.com/q/23443413
tags question: http://stackoverflow.com/q/23446074
tags question: http://stackoverflow.com/q/23329813
tags question: http://stackoverflow.com/q/23321213
tags question: http://stackoverflow.com/q/23378383
tags question: http://stackoverflow.com/q/23420044
tags question: http://stackoverflow.com/q/23417313
tags question: http://stackoverflow.com/q/23419374
tags question: http://stackoverflow.com/q/23298877
tags question: http://stackoverflow.com/q/23334619
tags question: http://stackoverflow.com/q/23422253
tags question: http://stackoverflow.com/q/23302860
tags question: http://stackoverflow.com/q/23310235
tags question: http://stackoverflow.com/q/23311341
tags question: http://stackoverflow.com/q/23409376
tags question: http://stackoverflow.com/q/23347516
tags question: http://stackoverflow.com/q/23405466
tags question: http://stackoverflow.com/q/23327417

webbrowser-control
type: Tag
tag name: webbrowser-control
tags question: http://stackoverflow.com/q/23409824

http://stackoverflow.com/comment/35698604
has text: @AbhishekRanjan Well, that was just example. I usually define `@Transactional(readOnly = true)` before `class` and then if I need I define `@Transactional(readOnly = false)` before method.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23316344

http://stackoverflow.com/comment/35916203
has text: @user3580294 thank you for your suggestion. I will go through that.
comment on: http://stackoverflow.com/q/23434161
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23349274
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/23347529
has body: Have successfully discovered why this wasn't working: I was incorrectly mapping to my hello view in my servlet, it was loading the page but was not correctly loading the model, hence why there were no variables being displayed
downvote count: 0
has comment: http://stackoverflow.com/comment/35758685
type: Answer

twilio
tag name: twilio
tags question: http://stackoverflow.com/q/23318189
type: Tag

http://stackoverflow.com/comment/35847462
comment on: http://stackoverflow.com/a/23396669
type: AnswerComment
has text: FYI - Here would be a better way to map this use case that takes into account the key/foreign key aspect: http://stackoverflow.com/a/23397293/383861
score: 0
type: Comment

http://stackoverflow.com/comment/45878573
type: Comment
has text: another option is help4j.com it provides source as well.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/23346366

http://stackoverflow.com/q/23294212
tagged with: primitive-types
tagged with: arraylist
accepted answer: http://stackoverflow.com/a/23295744
possible better answer: http://stackoverflow.com/a/23294323
type: Question
has comment: http://stackoverflow.com/comment/35657591
has answer: http://stackoverflow.com/a/23294488
has body: I need to create a Java array list (precisly, a vector) that contain more than one primitive types. For example, I would like to see in every vector's row about this: row[0] --&gt; "str1", 5, "str2", "str3", 3.5, 6, "str4"...etc... row[1] --&gt; "str5", 6, "str6", "str7", 5.3, 8, "str8"...etc... Can you help me? Thanks!! :)
score: 0
has answer: http://stackoverflow.com/a/23295744
tagged with: java
answer count: 5
has title: ArrayList and more primitive types togheter in Java
has answer: http://stackoverflow.com/a/23294535
has comment: http://stackoverflow.com/comment/35657582
has answer: http://stackoverflow.com/a/23294378
tagged with: vector
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23294323

http://stackoverflow.com/a/23326349
upvote count: 1
has comment: http://stackoverflow.com/comment/35716379
downvote count: 0
answers question: http://stackoverflow.com/q/23326274
score: 1
has body: Java 8 made the process a lot simpler: //field in a manager class ScheduledExecutorService es = Executors.newScheduledThreadPool(10); //Schedule a task es.schedule(() -&gt; { /* contents of a runnable */ }, 0, TimeUnit.SECONDS); Otherwise, you can still just use an anonymous runnable with the Scheduler: es.schedule(new Runnable() { public void run() { /* do what you need */ } }, 0, TimeUnit.SECONDS); However, as you specified, you will still need to do something for a returned value. There isn't really much that you can do, aside from use something from either a state manager, or to execute relevant methods within your runnable.
type: Answer
has comment: http://stackoverflow.com/comment/35716339

http://stackoverflow.com/comment/35725920
comment on: http://stackoverflow.com/q/23331280
has text: oh thank you for the link, i havent try that yet,the article really interesting, surely ill read it. thank ranjit
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/35740772
comment on: http://stackoverflow.com/a/23334076
type: AnswerComment
has text: I would choose just one font used on Win and on Mac without the problem and add it to your application to be used for the rendering. Can't say which exactly font is fine in your case.
score: 0
type: Comment

http://stackoverflow.com/a/23339721
has body: That's very easy, just define them in your config file, then you can retrieve from the actor system from inside your actor: getContext().system().settings().config().getString("appId") You can also create an extension to make loading config values easier, and to encapsulate all config values in one place, an example is given in the official Akka docs
type: Answer
has comment: http://stackoverflow.com/comment/35771788
has comment: http://stackoverflow.com/comment/35821516
score: 0
answers question: http://stackoverflow.com/q/23334345

http://stackoverflow.com/comment/35674858
score: 0
type: Comment
has text: Hi, I have done the import, normally I just highlight the error and the import appears but not in this case, anyway I'm getting errors after clicking the snippet box now: 04-25 17:24:05.486: E/AndroidRuntime(1300): at com.google.android.gms.maps.GoogleMap$10.e(Unknown Source), i wanted to post the entire logcat on the original post but Stackoverflow gives errors of formatting, anyway any ideas?
comment on: http://stackoverflow.com/a/23302728
type: AnswerComment

http://stackoverflow.com/q/23319608
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35704699
has comment: http://stackoverflow.com/comment/35709824
has comment: http://stackoverflow.com/comment/35704175
has body: My apllication is deployed on Tomcat 6 with Java 6, I want to restrict the SSL protocol to use only TLSv1.1. According to Java 6 documentation JCE isn't supporting TLSv1.1 while Java 7 does. Upgrade my Java version isn't acceptable. There is any providers that implements TLSv1.1 protocol that I can integrate to my java? Since it's production system I am looking for quick and safe fix. I thought to front end my application server with apache web server at the same host(which supports TLSv1.1 through openssl) and use him as a proxy server. Unfortunately my physical resources are low. Any other ideas are welcome. Thanks.
has comment: http://stackoverflow.com/comment/35704721
has answer: http://stackoverflow.com/a/23322957
tagged with: java
type: Question
upvote count: 4
has comment: http://stackoverflow.com/comment/35704573
has comment: http://stackoverflow.com/comment/35704380
tagged with: ssl
score: 4
tagged with: tomcat
has comment: http://stackoverflow.com/comment/35704192
downvote count: 0
answer count: 1
tagged with: cryptography
has comment: http://stackoverflow.com/comment/35704548
has comment: http://stackoverflow.com/comment/35704735
favorite count: 0
has title: Extend Java 6 with TLSv1.1 support
has comment: http://stackoverflow.com/comment/35705461

http://stackoverflow.com/comment/35790548
has text: Are you sure you can't upgrade any of this?
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23366761

http://stackoverflow.com/q/23421041
accepted answer: http://stackoverflow.com/a/23421070
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23421080
has answer: http://stackoverflow.com/a/23421070
score: 1
upvote count: 1
tagged with: unit-testing
type: Question
tagged with: junit4
tagged with: java
has title: How to run all tests in junit
tagged with: eclipse
has body: I am trying to learn junit testing in eclipse and i have tried to start off with something simple. I wrote a basic program with 2 methods, an add and subtract method which both take 2 arguments. So I tried testing the add function only, with a test that looked like this import static org.junit.Assert.*; import org.junit.Test; public class addtest { @Test public void testAdd() { class1 calc = new class1(); int expected = 7; int actual = class1.add(3, 4); assertEquals("adding 3 and 4 ", expected, actual); expected = 15; actual = class1.add(5, 10); assertEquals("adding 5 and 10 ", expected, actual); } } and it was working as i wanted. But then when i tried to implement the second test for subtraction, i noticed that it never seemed to test that section. I even tried having a second test method in case my subtraction method was incorrect. This is what i have for my latest test. import static org.junit.Assert.*; import org.junit.Test; public class addtest { @Test public void testAdd() { class1 calc = new class1(); int expected = 7; int actual = class1.add(3, 4); assertEquals("adding 3 and 4 ", expected, actual); expected = 15; actual = class1.add(5, 10); assertEquals("adding 5 and 10 ", expected, actual); } public void testMinus() { class1 calc = new class1(); int expected = 0; int actual = class1.add(12, 4); assertEquals("subtracting 4 from 12", expected, actual); } } I noticed that the test testMinus never does anything, whether the assert is true of not. Is there something wrong with my implementation? I have tried running the source folder as a junit test already, nothing was fixed. Thanks a lot for any help EDIT: I tried commenting out the first test, so that my test function has only testMinus inside it, and now it is testing the second method. Is there a reason the program stops testing after going through the first method?
possible better answer: http://stackoverflow.com/a/23421080
answer count: 2
tagged with: junit
downvote count: 0
favorite count: 0

http://stackoverflow.com/q/23304452
tagged with: timer
tagged with: jframe
type: AnsweredQuestion
tagged with: java
has title: How would i stop my timer?
type: Question
tagged with: actionlistener
has body: So i made a timer class for a game ive created and i already have the start button action set to start the timer, but i am a bit confused as to how to stop the timer and to reset it back to 0. Would be great if anyone could give any solutions to my problem. import javax.swing.*; import java.awt.*; import java.awt.event.*; public class MyTimer extends Panel { private JLabel timeDisplay; private JButton resetButton; private JButton startButton; private JButton stopButton; Timer timer; public MyTimer(){ MyTimer timer; startButton = new JButton("Start Timer"); stopButton = new JButton("Stop Timer"); timeDisplay = new JLabel("...Waiting..."); resetButton = new JButton("Reset Timer"); this.add(resetButton); this.add(startButton); this.add(stopButton); this.add(timeDisplay); event e = new event(); startButton.addActionListener(e); event1 c = new event1(); stopButton.addActionListener(c); event2 d = new event2(); resetButton.addActionListener(d); } public class event implements ActionListener{ public void actionPerformed(ActionEvent e){ int count = 0; timeDisplay.setText("Elapsed Time in Seconds: " + count); TimeClass tc = new TimeClass(count); timer = new Timer(1000, tc); timer.start(); } } public class TimeClass implements ActionListener{ int counter; public TimeClass(int counter){ this.counter = counter; } public void actionPerformed(ActionEvent e){ counter++; timeDisplay.setText("Elapsed Time in Seconds: " + counter); } } class event1 implements ActionListener{ public void actionPerformed (ActionEvent c){ timer.stop(); } } class event2 implements ActionListener{ public void actionPerformed (ActionEvent d){ timer.restart(); } } } EDIT Ok so i have the stop button doing what it needs to do perfectly, but the reset button has a problem. it pauses the timer for a second before resuming to count up from where it was paused, ex: it would pause at 4 seconds for a second before continuing to 5, 6, etc. Any suggestions? import javax.swing.*; import java.awt.*; import java.awt.ev…
answer count: 2
has answer: http://stackoverflow.com/a/23304479
possible better answer: http://stackoverflow.com/a/23304481
has answer: http://stackoverflow.com/a/23304481
score: 0
accepted answer: http://stackoverflow.com/a/23304479
tagged with: user-interface

http://stackoverflow.com/a/23357175
answers question: http://stackoverflow.com/q/23357122
score: 0
type: Answer
has body: You are looking for so called Threads. They can be used in various ways in Java: http://docs.oracle.com/javase/tutorial/essential/concurrency/ In case of the GUI you also have to use the SwingUtilities with invokeNow/invokeLater to update the GUI from within a thread.

http://stackoverflow.com/comment/35884981
type: AnswerComment
score: 0
has text: The way you just described it, is how I thought it was currently written. I believed it to be: Server waits for connections from clients, client connects, the client sends msg, the server grabs msg using getInput, and sends it to all clients via, print message. I literally think the code is working because I am getting the input to appear in the other client windows, but it will only show up if i type a message first and hit enter in the window. So if I have 3 clients open. I type '1' in first, the other windows will not print out '1' unless i type a message first and hit enter. is this
type: Comment
comment on: http://stackoverflow.com/a/23414599

http://stackoverflow.com/q/23332315
tagged with: ide
favorite count: 0
has comment: http://stackoverflow.com/comment/36757967
has comment: http://stackoverflow.com/comment/36757954
accepted answer: http://stackoverflow.com/a/23892684
has comment: http://stackoverflow.com/comment/36758003
has comment: http://stackoverflow.com/comment/36784818
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36758241
has body: I am using Spring Tool Suite Version: 3.5.0.RELEASE Build Id: 201404011851, which is based on Eclipse. The auto-correct works great, but it is annoying on some cases. The worst case is when I type "new" followed by a space and STS replaces with "newEmail". I do know how to turn the auto-correction off, but what I really want is to just remove the new->newEmail entry from the list. Thank you
score: 1
tagged with: java
upvote count: 1
type: Question
has title: Eclipse/STS auto-correcting "new" as "newEmail"
has comment: http://stackoverflow.com/comment/36757987
has answer: http://stackoverflow.com/a/23892684
has comment: http://stackoverflow.com/comment/36758315
tagged with: sts-springsourcetoolsuite
tagged with: eclipse
tagged with: springsource
answer count: 1
downvote count: 0

http://stackoverflow.com/a/23440092
type: Answer
upvote count: 3
has body: You can secure your RESTful Web services using one of the following methods to support authentication, authorization, or encryption: Updating the web.xml deployment descriptor to define security configuration. See Securing RESTful Web Services Using web.xml Using the javax.ws.rs.core.SecurityContext interface to implement security programmatically. See Securing RESTful Web Services Using SecurityContext. Applying annotations to your JAX-RS classes. See Securing RESTful Web Services Using Annotations.. Using Jersey OAuth libraries to sign and verify requests. For more information about using and installing the OAuth libraries, see the Jersey and OAuth wiki at: https://wikis.oracle.com/display/Jersey/OAuth Securing RESTful Web Services Using web.xml You secure RESTful Web services using the web.xml deployment descriptor as you would for other Java EE Web applications. For complete details, see "Developing Secure Web Applications" in Programming Security for Oracle WebLogic Server. For example, to secure your RESTful Web service using basic authentication, perform the following steps: Define a for each set of RESTful resources (URIs) that you plan to protect. Use the element to define the type of authentication you want to use and the security realm to which the security constraints will be applied. Define one or more security roles using the tag and map them to the security constraints defined in step 1. For more information, see "security-role" in Programming Security for Oracle WebLogic Server. To enable encryption, add the <user-data-constraint> element and set the <transport-guarantee> subelement to CONFIDENTIAL. For more information, see "user-data-constraint" in Programming Security for Oracle WebLogic Server. For more details, Example 5-1 Securing RESTful Web Services Using Basic Authentication RestServlet com.sun.jersey.spi.container.servlet.ServletContainer RestServlet /* <web-resource-collection> Orders /orders GET POST </web-resource-collection> admin BASIC…
answers question: http://stackoverflow.com/q/23440059
score: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/35951112

http://stackoverflow.com/comment/35989784
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23444400
has text: Kindly send me decryption code in JAVA too as the link you have provided contains only encrypted code.

http://stackoverflow.com/q/23291243
tagged with: java
type: Question
answer count: 1
tagged with: jpa
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/23291353
has title: JPA - Is there a mechanism for mapping a column value to a value object?
score: 1
upvote count: 1
has body: Is there a JPA mechanism to automatically convert column values like String, Integer, etc to a Value Object like my MyDate? In my case for every field which represents a MyDate there's code in the getter an setter to convert from Integer to MyDate and visa versa. This code duplication increases out of proportion. The following looks like I'm looking for. MyDate is not an Entity but a Value Object. @Column (name = "d_end") private MyDate dEnd;
accepted answer: http://stackoverflow.com/a/23291353
type: AnsweredQuestion

http://stackoverflow.com/comment/35881324
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23377240
has text: Should not happend. Cannot explain you that :s
score: 0

http://stackoverflow.com/q/23376106
has title: trying to display a 0 in the terny operator in Java with conditional statements
favorite count: 0
linked to: http://stackoverflow.com/q/23375049
has comment: http://stackoverflow.com/comment/35808700
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35808357
duplicate of: http://stackoverflow.com/q/23375049
has comment: http://stackoverflow.com/comment/35808226
has comment: http://stackoverflow.com/comment/35808500
has comment: http://stackoverflow.com/comment/35808678
score: -4
has body: Hi I am trying to display the 0 when time.get(calendar.MINUITE) 1 - 9 the time for min reads 1 2 3 4 5 6 7 8 9 then 10 11 12 13 the time diplays fine when going 10 and up but I have a conditional statement saying when the time is less the 10, display a 0 in front of the current number. I understand system.out.format, but I can not add this to a terny operator this is my java Calendar time = Calendar.getInstance(); int min = 1;//time.get(Calendar.MINUTE); int hour = time.get(Calendar.HOUR_OF_DAY); int blank = Integer.parseInt("0"); int hourOfDay = ((hour &gt; 12) ? (hour - 12) : hour); int zero = ((min &gt; 9 ) ? min : blank+min); System.out.println("The time is " + hourOfDay + ":" + zero ); so lets say the time is 6:1 how will I make it display the 0 in front of the one, but then when 10 - 59 appears for min, the 0 wont be in front of the number like 6:030. Unless there is a conditional format system.out I can add in when there is less than 10
has comment: http://stackoverflow.com/comment/35808399
type: Question
tagged with: jakarta-ee
tagged with: java
has comment: http://stackoverflow.com/comment/35808322
downvote count: 4
has comment: http://stackoverflow.com/comment/35808910
has answer: http://stackoverflow.com/a/23376305
upvote count: 0
answer count: 1

http://stackoverflow.com/comment/35760464
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23350001
type: AnswerComment
has text: @LuiggiMendoza Oh, so you agree that Java is *not necessarily* a server side language?

http://stackoverflow.com/comment/35920249
type: Comment
comment on: http://stackoverflow.com/a/23436129
score: 1
type: AnswerComment
has text: @learner: It's *better*, in that you can make sure that you synchronize all access to the static fields. But it sounds like you need to differentiate between *variables* and *objects*. Both `mPaw` and `myDog` are variables. Both can have a reference to the same object, but the object will only be garbage collected when there are no *live* references left. If one variable goes out of scope (or whatever), that has no bearing whatsoever on other variables which happen to refer to the same object.

http://stackoverflow.com/q/23324952
answer count: 2
downvote count: 0
favorite count: 0
has title: How to test flyway migration?
type: UnansweredQuestion
upvote count: 6
tagged with: java
score: 6
tagged with: integration-testing
type: Question
tagged with: testing
has answer: http://stackoverflow.com/a/23334520
has answer: http://stackoverflow.com/a/79393911
has body: Usually migration script is simple like adding new column or so and if applications if deployed then everything is ok. but sometimes there is some complex logic involved that should be tested. what is the recommended approach?
tagged with: database-testing
tagged with: flyway

http://stackoverflow.com/q/23303069
has answer: http://stackoverflow.com/a/23303173
score: 0
answer count: 1
has body: I am a new newbie learning Android development following the tutorial on developer.android.com. The putExtra() method of class Intent returns a value of Intent object. But the code of the tutorial is intent.putExtra(EXTRA_MESSAGE, message);. If so, the method can not return a value. Can you tell me why? Thank you very much.
has title: Does putExtra() method of class Intent return a value of Intent object?
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/35674393
tagged with: android-intent
has comment: http://stackoverflow.com/comment/35674258
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/35676623

http://stackoverflow.com/comment/35921054
type: Comment
score: 0
type: AnswerComment
has text: worth saying I don't think it's lying, but I don't think the OS is either because I usually end up swapping. So I'm thinking there must be more memory allocated elsewhere for some reason.
comment on: http://stackoverflow.com/a/23436513

http://stackoverflow.com/q/23320882
has answer: http://stackoverflow.com/a/23320976
favorite count: 0
tagged with: abstract-class
has title: Abstract classes cannot be instantiated
type: Question
has answer: http://stackoverflow.com/a/23320914
has answer: http://stackoverflow.com/a/23320923
answer count: 6
score: -1
has body: Abstract classes cannot be instantiated. Then in public void paint(Graphics g){ } what is the g ? Is it not an object? If yes then what are the differences between this and the ones that can be instantiated ?
downvote count: 1
has answer: http://stackoverflow.com/a/23320924
tagged with: java
has comment: http://stackoverflow.com/comment/35706257
has answer: http://stackoverflow.com/a/23320906
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23320909
upvote count: 0
linked to: http://stackoverflow.com/q/16532704

http://stackoverflow.com/comment/44462425
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23390793
has text: See: http://leoplay.com/content/custom-logical-expression-filter-apache-shiro
score: 0

http://stackoverflow.com/comment/35890035
score: 0
has text: This question solicits opinions, rather than answers. Thus, my opinion: I tend to structure my code to avoid nasties like the above. My `onCreateView()` and 'onCreate()` methods usually just contain the layout inflation and member assignments (`findViewById()`). Data is loaded in methods such as `updateCustomerList()` or `updateProductList()`, which contain the various adapter assignments, or interact with the `LoaderManager`. I tend to call those in `onResume()` to always have the latest UI. If adapters are used in various fragments, I use interfaces to create callbacks, etc...
comment on: http://stackoverflow.com/q/23418556
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35732144
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23334336
has text: possible duplicate of [What is a stack trace, and how can I use it to debug my application errors?](http://stackoverflow.com/questions/3988788/what-is-a-stack-trace-and-how-can-i-use-it-to-debug-my-application-errors)

http://stackoverflow.com/q/23313411
tagged with: rounding-error
has title: Java numbers, "human" rounding
linked to: http://stackoverflow.com/q/3730019
score: 0
answer count: 3
linked to: http://stackoverflow.com/q/1359817
linked to: http://stackoverflow.com/q/11284938
has comment: http://stackoverflow.com/comment/35694719
has comment: http://stackoverflow.com/comment/35692765
has answer: http://stackoverflow.com/a/23314129
linked to: http://stackoverflow.com/q/7906996
has comment: http://stackoverflow.com/comment/35693688
has comment: http://stackoverflow.com/comment/35692620
possible better answer: http://stackoverflow.com/a/23313610
has comment: http://stackoverflow.com/comment/35694333
linked to: http://stackoverflow.com/q/153724
has comment: http://stackoverflow.com/comment/35694807
has body: I bet there was a similar question here on SO, I just could not find it. The question is about fixing java math inaccuracy, when I get for example a number like 235.00000002 or 9875.999999997. Sure as a hell, for a human these two actually mean 235 and 9876, when a certain accuracy threshold is given, let's call it "5 zeros or nines". But it's not only about the digits to the right of the decimal point, the same rule should also apply to numbers like 23500000001.0 and 5699999999.0 Any ideas/libraries? Update: Looks like I was wrong saying it's a known topic and a matter of minutes until someone pops up with a known library. So here is the logic I expect: For a given number when N consecutive zeroes or nines are encountered in its string representation, then these zeroes and nines are rounded together with the rest of the number to the right of the rightmost "0" or "9". Foe example, when N=5, then the number 239999995.546 becomes 240000000.0, the number 34.0000007 becomes 34 as well as 340000.007 becomes 340000. Update 2: That's what happens when in a hurry or paying not enough attention to the question. Sorry. I'm talking about "human" rounding. A good example would be comparing the output of df and df -h on a linux box. As for "inaccuracy" I was talking about, please run the following code: double d = 1000.0; double mult = 0.12351665; System.out.println(d * mult / mult); The response is definitely not the one you'd show in a shopping cart. In my case the situation is even worse, it's not only the money I deal with, it can be anything - percentage, big numbers, small fractions, and all of them as a result of relatively heavy math computations. So I'm talking about the rounding that makes sense for a human. I'm already done with the code, but there is still a chance that someone did it better.
type: AnsweredQuestion
tagged with: rounding
tagged with: java
has answer: http://stackoverflow.com/a/23314211
has comment: http://stackoverflow.com/comment/35698198
has comment: http://stackoverflow.com/comment/35694496
accepted answer: http://stackoverflow.com/a/23314211
has comment: http://stackoverflow.com/comment/35693441
type: Question
has comment: http://stackoverflow.com/comment/35694316
has comment: http://stackoverflow.com/comment/35692783
has comment: http://stackoverflow.com/comment/35692702
has answer: http://stackoverflow.com/a/23313610
has comment: http://stackoverflow.com/comment/35694593
has comment: http://stackoverflow.com/comment/35692659

http://stackoverflow.com/comment/35949816
type: Comment
comment on: http://stackoverflow.com/a/23449948
score: 0
type: AnswerComment
has text: Thanks. One last thing, is it possible to determine the child class programmatically so I can remove the `Class<T> klass` function param?

http://stackoverflow.com/comment/35801111
score: 0
type: Comment
type: QuestionComment
has text: i don't think the question you point to is a duplicate of this one. My question is, should I worry about spurious wakeups when using java.util.concurrent.* classes? which should have a YES or NO answer. The linked question does gives me new information so thank you
comment on: http://stackoverflow.com/q/23372154

http://stackoverflow.com/comment/66314345
score: 0
type: Comment
type: QuestionComment
has text: @MarkHanlon Did you ever get a solution to this. Am looking for something similar.
comment on: http://stackoverflow.com/q/23392938

http://stackoverflow.com/q/23296768
type: Question
has title: How to get WMQ Explorer to work with WMQ AMS
has body: I am trying to get the Quick Start for AMS working with the MQ Explorer So now I have users Bob and Alice on Linux, and user Exp (to run the explorer on) on Windows and Linux On Windows, Exp has the following defined: Directory of C:\Users\Exp \AMS 04/23/2014 01:22 PM &lt;DIR&gt; . 04/23/2014 01:22 PM &lt;DIR&gt; .. 04/23/2014 01:22 PM 465 Exp_Java_Cert.cer 04/16/2014 12:35 PM 173 keystore.conf 04/23/2014 01:21 PM 1,243 keystore.jks 3 File(s) 1,881 bytes 2 Dir(s) 20,714,684,416 bytes free C:\Users\Exp \AMS&gt;keytool -list -v -keystore keystore.jks Enter keystore password: ***************** WARNING WARNING WARNING ***************** * The integrity of the information stored in the keystore * * has NOT been verified! In order to verify its integrity, * * you must provide the srckeystore password. * ***************** WARNING WARNING WARNING ***************** Keystore type: jks Keystore provider: IBMJCE Your keystore contains 1 entry Alias name: Exp_java_cert Creation date: Apr 23, 2014 Entry type: keyEntry Certificate chain length: 1 Certificate[1]: Owner: CN=Exp, O=IBM, C=GB Issuer: CN=Exp, O=IBM, C=GB Serial number: 535820c6 Valid from: 4/23/14 1:21 PM until: 7/22/14 1:21 PM Certificate fingerprints: MD5: 37:AD:43:F2:6C:1F:BF:3C:9A:73:41:74:0F:C9:EC:E3 SHA1: FE:5D:E2:93:B7:7E:9D:B0:B4:DB:21:C3:81:4A:C9:96:B9:F9:5A:C4 ******************************************* ******************************************* C:\Users\Exp \AMS&gt; In the Linux machine, with user Alice I see the following certs: [root@mmclnt1 .mqs]# runmqakm -cert -details -db /home/alice/.mqs/alicekey.kdb -pw passw0rd -label Bob_Cert Label : Bob_Cert Key Size : 1024 Version : X509 V3 Serial : 636a9d70e1ef80c8 Issuer : CN=bob,O=IBM,C=GB Subject : CN=bob,O=IBM,C=GB Not Before : April 6, 2014 5:30:42 PM EDT Not After : April 7, 2015 5:30:42 PM EDT Public Key 30 81 9F 30 0D 06 09 2A 86 48 86 F7 0D 01 01 01 05 00 03 81 8D 00 30 81 89 02 81 81 00 C8 CD 97 DF 18 C4 00 0D 64 E3 4D E8 02 76 1D 18 9A BA 2F F9 B3 23 …
upvote count: 1
has comment: http://stackoverflow.com/comment/35665417
answer count: 1
favorite count: 0
tagged with: ibm-mq
has comment: http://stackoverflow.com/comment/35665120
has answer: http://stackoverflow.com/a/23361635
accepted answer: http://stackoverflow.com/a/23361635
tagged with: keystore
tagged with: encryption
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
tagged with: certificate

http://stackoverflow.com/comment/35686693
has text: Glad it helped. Feel free to upvote/accept. As per your solution, it should work, and indeed the performance would be worse since you can not guarantee HashMap O(1) complexity on very big inputs, assuming that list can be very very long (say, billions of items)
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23309690

http://stackoverflow.com/a/23412678
has comment: http://stackoverflow.com/comment/35881942
has comment: http://stackoverflow.com/comment/35878205
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35881875
score: 1
has body: If you want to copy the text only when the button status is hit, then you can do: status.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent pE) { orders.setText(get.getText()); } }); If you want to copy from Server Frame to Client frame or the opposite, you need to pass destination component to parent class in constructor: JTextArea destTextArea; public superclass(String string, JTextArea pDestTextArea) { destTextArea = pDestTextArea; } .... public void actionPerformed(ActionEvent event){ if ((event.getSource() == status) &amp;&amp; (destTextArea != null)) { destTextArea.setText(get.getText()); } } Then to create your Client and Server: super("CLIENT", null); super("SERVER", orders); or: super("CLIENT", orders); super("SERVER", null);
has comment: http://stackoverflow.com/comment/35881682
has comment: http://stackoverflow.com/comment/35877094
has comment: http://stackoverflow.com/comment/35877173
accepted answer of: http://stackoverflow.com/q/23410381
type: Answer
answers question: http://stackoverflow.com/q/23410381
upvote count: 1
has comment: http://stackoverflow.com/comment/35876875
has comment: http://stackoverflow.com/comment/35881721
has comment: http://stackoverflow.com/comment/35882216
has comment: http://stackoverflow.com/comment/35878657
downvote count: 0
has comment: http://stackoverflow.com/comment/35882063

http://stackoverflow.com/comment/35901623
score: 0
comment on: http://stackoverflow.com/q/23426465
type: Comment
has text: Okay, I've changed the name of the class. How could I get separate methods to run using this switch statement?
type: QuestionComment

http://stackoverflow.com/q/23305727
accepted answer: http://stackoverflow.com/a/23305832
has comment: http://stackoverflow.com/comment/35678997
has answer: http://stackoverflow.com/a/23305886
has title: Java Relative Path Issue
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23305832
has answer: http://stackoverflow.com/a/23305813
tagged with: java
type: Question
has body: I am facing an issue while trying to resolve a file path using relative paths in Java. I am not sure where I am failing at. Could you please help me out? Thanks! @Test public void testObjectNotNull() throws Exception{ FileReader fileReader = new FileReader(getClass().getResource("./JavaPractice/resources/tests/codeeval/fileReaderTest.txt").toString()); assertNotNull(fileReader); } Exception: java.lang.NullPointerException at components.com.codeeval.FileReader.FileReaderTest.testObjectNotNull(FileReaderTest.java:13) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) Directory Structure: JavaPractice --resources.tests.codeeval.fileReaderTest.txt (File that I am trying to access) --tests.components.com.codeeval.FileReader.FileReaderTest.java (junit which is trying to access the above file)
tagged with: relative-path
score: 0
answer count: 3
possible better answer: http://stackoverflow.com/a/23305813
linked to: http://stackoverflow.com/q/2860616

http://stackoverflow.com/q/23376928
has comment: http://stackoverflow.com/comment/35809767
has comment: http://stackoverflow.com/comment/35809819
has comment: http://stackoverflow.com/comment/35838815
answer count: 2
tagged with: string
has title: Java - string split error
favorite count: 0
has body: I'm trying to split a string and return each sub-string to an array in Java (easier in c#) but the compiler is not having it. I keep getting an index out of bounds error when I try to call the value of any string in the array indexed higher than 0. Here's the code I'm using: public class hello { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int setter = 3000; String num = in.next(); String[] numbers = num.split(" "); int j = numbers.length; for (int i =0; i &lt; numbers.length ; i++) { System.out.println(numbers[i]); } System.out.println(j); Even the length of the array being returned is 1.
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35810015
has comment: http://stackoverflow.com/comment/35810624
downvote count: 4
upvote count: 0
has answer: http://stackoverflow.com/a/23377037
tagged with: java
score: -4
type: Question
tagged with: split
has answer: http://stackoverflow.com/a/23394961

http://stackoverflow.com/q/23331319
answer count: 2
has answer: http://stackoverflow.com/a/23851787
has body: I'm having problem why this Hibernate query fails (provided that other model queries work fine): UserRoles u = (UserRoles) this.commonDAO.querySingleResult("SELECT u FROM UserRoles u where username = :id", QueryParams.c().add("id", user.getId())); When checked u is null Where doing a SQL query, SELECT role_name, username FROM user_roles WHERE username = 'johnsmith'; returns the row.
has answer: http://stackoverflow.com/a/23332561
score: 0
has comment: http://stackoverflow.com/comment/35725948
tagged with: sql
has comment: http://stackoverflow.com/comment/35727077
has title: Hibernate querySingleResult not returning results
possible better answer: http://stackoverflow.com/a/23332561
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23851787
has comment: http://stackoverflow.com/comment/35725850
tagged with: java
tagged with: hibernate
type: Question

http://stackoverflow.com/q/23325769
tagged with: android
score: 1
possible better answer: http://stackoverflow.com/a/23332404
favorite count: 0
has answer: http://stackoverflow.com/a/23332404
has comment: http://stackoverflow.com/comment/35715524
type: Question
answer count: 2
has body: below is my code for media player. It doesn't start again after I stop. How to solve this? Even though I have called the prepare method before calling the start method. Also why doesn't the music stop playing even after I exit the programme. Please advice. public class MainActivity extends Activity { Button play,pause,stop; CheckBox c1,c2,c3; MediaPlayer song1,song2,song3; AlertDialog.Builder builder; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); play=(Button)findViewById(R.id.button1); pause=(Button)findViewById(R.id.button2); stop=(Button)findViewById(R.id.button3); c1=(CheckBox)findViewById(R.id.checkBox1); c2=(CheckBox)findViewById(R.id.checkBox2); c3=(CheckBox)findViewById(R.id.checkBox3); song1=MediaPlayer.create(this, R.raw.finalcountdown); song2=MediaPlayer.create(this, R.raw.invincible); song3=MediaPlayer.create(this, R.raw.somewhereibelong); builder=new AlertDialog.Builder(this); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } public void start(View view) throws IllegalStateException, IOException { if(c1.isChecked()) { if(!song1.isPlaying()) { song1.prepare(); song1.start(); } else{ song1.start(); } } if(c2.isChecked()) { if(!song2.isPlaying()) { song2.prepare(); song2.start(); } else{ song2.start(); } } if(c3.isChecked()) { if(!song3.isPlaying()) { song3.prepare(); song3.start(); } else{ song3.start(); } } else{ builder.setMessage("Please mark a checkbox"); } } public void stop(View view) { if(c1.isChecked()) song1.stop(); else if (c2.isChecked()) song2.stop(); else if (c3.isChecked()) song3.stop(); else builder.setMessage("Error message "); } public void pause(View view) { if(c1.isChecked()) { song1.pause(); } else if(c2.isChecked()) { song2.pause(); } else if(c3.isChecked()) { song3.pause(); } else builder.setMessage("…
tagged with: startup
accepted answer: http://stackoverflow.com/a/23332368
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/35715784
has title: Media player not starting after stopping
downvote count: 0
tagged with: media-player
has comment: http://stackoverflow.com/comment/35716676
has answer: http://stackoverflow.com/a/23332368
type: AnsweredQuestion

http://stackoverflow.com/q/23365985
score: 1
has comment: http://stackoverflow.com/comment/35788792
favorite count: 0
has comment: http://stackoverflow.com/comment/35790406
has title: SWT: catch event shell to full-screen mode
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35789463
has answer: http://stackoverflow.com/a/23367018
has comment: http://stackoverflow.com/comment/35790316
tagged with: java
tagged with: swt
has body: How can I catch set full-screen mode event? SWT.Resize does not catch this event. thanks.
upvote count: 1
has comment: http://stackoverflow.com/comment/35789846
type: Question
tagged with: fullscreen
has comment: http://stackoverflow.com/comment/35789002
downvote count: 0
answer count: 1

http://stackoverflow.com/comment/35927449
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23440067
has text: Hi everyone ! i came across a issue where i am spending like more than one week to fix the conflict, currently i can pass record to the mysql database, and and once i check the respond from Google chrome javascript console view (CTRL + SHIFT + I) the i just saw Error: depicts at once and goes to invisible state, and from other hand i am receiving an error message stating that throw Error('No module: ' + name); i got no idea how to fix it, expecting form some guidelines lines in order to fix this issue

http://stackoverflow.com/comment/35741086
comment on: http://stackoverflow.com/q/23339404
type: Comment
has text: Thanks for your answer, I already made an implementation with the configuration object and methods like configuration.setAcousticModelPath etc. and it worked great. But now I need to use the outOfGrammarProbability property of the flatLinguist component as explain in this post: http://stackoverflow.com/questions/16994980/keyword-or-keyphrase-spotting-with-sphinx4/16996733#16996733 Can I do that without configuration file?
score: 0
type: QuestionComment

inheritance
tags question: http://stackoverflow.com/q/23311574
tags question: http://stackoverflow.com/q/23374077
tags question: http://stackoverflow.com/q/23369312
tags question: http://stackoverflow.com/q/23340414
tags question: http://stackoverflow.com/q/23342613
tags question: http://stackoverflow.com/q/23307108
tags question: http://stackoverflow.com/q/23377088
tags question: http://stackoverflow.com/q/23315636
tags question: http://stackoverflow.com/q/23329904
tags question: http://stackoverflow.com/q/23419206
tags question: http://stackoverflow.com/q/23299580
tags question: http://stackoverflow.com/q/23447403
tags question: http://stackoverflow.com/q/23366743
tag name: inheritance
tags question: http://stackoverflow.com/q/23333062
tags question: http://stackoverflow.com/q/23399919
tags question: http://stackoverflow.com/q/23377604
tags question: http://stackoverflow.com/q/23411163
tags question: http://stackoverflow.com/q/23407467
type: Tag
tags question: http://stackoverflow.com/q/23437156
tags question: http://stackoverflow.com/q/23318849
tags question: http://stackoverflow.com/q/23437839
tags question: http://stackoverflow.com/q/23449782
tags question: http://stackoverflow.com/q/23452097
tags question: http://stackoverflow.com/q/23309219
tags question: http://stackoverflow.com/q/23349656
tags question: http://stackoverflow.com/q/23442026
tags question: http://stackoverflow.com/q/23443007
tags question: http://stackoverflow.com/q/23300935
tags question: http://stackoverflow.com/q/23325830
tags question: http://stackoverflow.com/q/23449685
tags question: http://stackoverflow.com/q/23305166
tags question: http://stackoverflow.com/q/23398841
tags question: http://stackoverflow.com/q/23362900
tags question: http://stackoverflow.com/q/23365049
tags question: http://stackoverflow.com/q/23404517
tags question: http://stackoverflow.com/q/23313365
tags question: http://stackoverflow.com/q/23335629
tags question: http://stackoverflow.com/q/23353468

http://stackoverflow.com/comment/35824989
comment on: http://stackoverflow.com/a/23384880
score: 0
type: AnswerComment
has text: +1 Exactly. If the interrupted status gets reset due to an `InterruptedException` being thrown, just set it again by calling `interrupt()`.
type: Comment

http://stackoverflow.com/q/23350392
type: AnsweredQuestion
has body: I tested this Java code which executed WQL query into PowerShell: import java.io.BufferedReader; import java.io.File; import java.io.InputStream; import java.io.InputStreamReader; /** * Operations for executing Windows Powershell Scripts from Java. * * @author Brian Thorne */ public class Sample { public static void main(String[] args) throws Exception { executePSCommand("Get-WmiObject Win32_Processor"); } /** * Executes a Powershell command. * * @param command the command * @return the result as String. * @throws Exception if an error occurs */ public static String executePSCommand(String command) throws Exception { String cmd = "cmd /c powershell -ExecutionPolicy RemoteSigned -noprofile -noninteractive " + command; return exec(cmd); } /** * Executes a Powershell script. * * @param scriptFilename the filename of the script * @param args any arguments to pass to the script * @return the result as String. * @throws Exception if an error occurs */ public static String executePSScript(String scriptFilename, String args) throws Exception { if (!new File(scriptFilename).exists()) throw new Exception("Script file doesn't exist: " + scriptFilename); String cmd = "cmd /c powershell -ExecutionPolicy RemoteSigned -noprofile -noninteractive -file \"" + scriptFilename + "\""; if (args != null &amp;&amp; args.length() &gt; 0) cmd += " " + args; return exec(cmd); } /** * Executes a batch file. If you want to call Powershell from the batch file you need to do it using this syntax: powershell -ExecutionPolicy RemoteSigned -NoProfile * -NonInteractive -File c:/temp/script.ps1 * * @param batchFilename the filename of the batch file * @param params any parameters to pass to the batch file * @return the result as String. * @throws Exception if an error occurs */ public static String executeBatchFile(String batchFilename, String params) throws Exception { if (!new File(batchFilename).exists()) throw new Exception("Batch file doesn't exist: " + batchFilename); String cmd = "cmd /c \"" + …
tagged with: java
upvote count: 1
downvote count: 1
tagged with: wmi
type: Question
has answer: http://stackoverflow.com/a/23350696
tagged with: powershell
tagged with: powershell-2.0
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/23350696
favorite count: 0
has title: Execute WQL with Java using PowerShell

http://stackoverflow.com/a/23343951
has comment: http://stackoverflow.com/comment/35792585
has body: Your getter/setter names don't follow the Java bean naming conventions (or maybe the do). For PropertyDescriptor, according to the javadoc Note that the property name should start with a lower case character, which will be capitalized in the method names. they should be public String getAPlaceAt() { return aPlaceAt; } public void setAPlaceAt(String aPlaceAt) { this.aPlaceAt = aPlaceAt; } The error message is kind of misleading. The introspector will try to find getAPlaceAt and then isAPlaceAt. It will report the last thing it tried but failed. You can avoid such mistakes by generating setters/getters through the IDE.
upvote count: 6
answers question: http://stackoverflow.com/q/23343732
has comment: http://stackoverflow.com/comment/35786233
type: Answer
has comment: http://stackoverflow.com/comment/35785256
has comment: http://stackoverflow.com/comment/35748520
has comment: http://stackoverflow.com/comment/35763972
downvote count: 0
score: 6
has comment: http://stackoverflow.com/comment/35748545

http://stackoverflow.com/comment/35675367
comment on: http://stackoverflow.com/q/23303659
score: 1
has text: something looks strange abot this code `nextInt((87)+13)`
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23437839
type: Question
has answer: http://stackoverflow.com/a/23437884
has comment: http://stackoverflow.com/comment/35923322
has comment: http://stackoverflow.com/comment/35923366
tagged with: java
tagged with: inheritance
has body: I am given a set of interfaces and have to create a class that implements these interfaces, however, I am confused about the return type for the interfaces that have references to other interfaces. // Implement class C below so that the code compiles. None of the methods may return null. // You may define supplementary classes (inner-classes or "regular" classes) if you wish. // Note that C is a subclass of Object, and it implements only X and Y -- you cannot change this. abstract class A { abstract void q (); } interface Y { int p (int j); A me (); } interface X { void m (Object o); X n (); } class C implements X, Y { // Write your code here -- make all methods public (otherwise, // the compiler will not consider the interfaces to be "implemented")! @Override public int p(int j) { // TODO Auto-generated method stub return 0; } @Override public A me() { // TODO Auto-generated method stub return null; } @Override public void m(Object o) { // TODO Auto-generated method stub } @Override public X n() { // TODO Auto-generated method stub return null; } } What am I suppose to return for the methods that have an interface for a return type? I am confused because you can't instantiate interfaces so what am I suppose to return?
score: 0
has answer: http://stackoverflow.com/a/23437891
answer count: 2
has title: What to return if a method returns an interface?
has comment: http://stackoverflow.com/comment/35923370
tagged with: generics
type: UnansweredQuestion
tagged with: interface
has comment: http://stackoverflow.com/comment/35923464

http://stackoverflow.com/q/23431247
accepted answer: http://stackoverflow.com/a/23500757
has comment: http://stackoverflow.com/comment/35910441
has body: I wanted to conduct an asynchronous call in Java API Servlet. I used this at the top of my class @WebServlet(name="asyncServlet2",value = {"/async"},asyncSupported = true,urlPatterns="/async") My intention is since the API call will be a longer process that it can display whether the process kicked off or not instantly, rather than when completed. I couldn't figure out which functionality of the Java Servlet 3.0 will let me display the message instantly. Thanks for your help!
tagged with: asynchronous
has comment: http://stackoverflow.com/comment/35910935
type: AnsweredQuestion
score: 0
has answer: http://stackoverflow.com/a/23500757
type: Question
tagged with: java
tagged with: servlets
has comment: http://stackoverflow.com/comment/35910706
answer count: 1
has title: JAVA API Servlet Asynchronous Call

http://stackoverflow.com/comment/35712405
has text: In particular, [Joachim's answer](http://stackoverflow.com/a/2506509/758280).
comment on: http://stackoverflow.com/q/23324189
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23378869
answers question: http://stackoverflow.com/q/23378857
score: 1
upvote count: 1
downvote count: 0
has body: Because if the writer is null, its already closed. As its within a finally block, its always going to be the last thing called, so to make sure that the writer closed correctly you check that it isn't already done further up in the code, and if not (writer != null) close it off.
type: Answer

http://stackoverflow.com/a/23362349
type: Answer
score: 1
has body: try this // check if string is exist in array if(array.Contains("YourString")) { // if contain then u can use this or do operations Response.Write("YourString is available in array"); } this will help you
upvote count: 1
downvote count: 0
answers question: http://stackoverflow.com/q/23350592

http://stackoverflow.com/q/23408637
type: Question
score: -2
downvote count: 3
upvote count: 1
answer count: 1
favorite count: 0
tagged with: android
has answer: http://stackoverflow.com/a/23408776
tagged with: audio
accepted answer: http://stackoverflow.com/a/23408776
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35869331
has title: Recording sound of music app
tagged with: java
has body: I am developing android musical piano application. in which i am using soundpool to play audios but how can i record sound so that user can sing and record his own voice along with recording music beats

http://stackoverflow.com/q/23427708
accepted answer: http://stackoverflow.com/a/23427983
type: AnsweredQuestion
has body: This feed method is supposed to first increase the energy state and decrease hungry state, use a dumplings meal (which can be purchased in the shop) then see that the item purchased from the shop, is a positive number or greater than 0. Then ensure that hungry and energy states do not go out of bounds (if it does print warning statements). If it reaches the border of 100 then start increment overfeed, every time method is executed, if overfeed is greater than 4 then execute die method(). If it meets criteria running feed method will print Eating... and I have ate enough(...) statements. @Override protected void feed() { decHungry(10); incEnergy(10); shop.useDumplingsMEAL(); do { if (shop.dumplingsMEAL &lt;= 0) { JOptionPane.showMessageDialog(null, "You cannot eat right now, You need to purchase item in the shop"); } else if (hungry &lt;= 0 &amp;&amp; energy &gt;= 100) { System.out.print("\nI have ate enough! My hungry state is " + hungry + " and my energy state is " + energy + "." ); overfeed++; while (overfeed&gt;4) { die(); System.out.println("You have overfed me."); } } else { System.out.println("\nEating..."); System.out.println("I've just ate dumplings, my current energy state is " + energy +" and hungry state is " + hungry + "."); overfeed = 0; } }
downvote count: 2
tagged with: loops
has comment: http://stackoverflow.com/comment/35903698
has answer: http://stackoverflow.com/a/23427983
type: Question
has comment: http://stackoverflow.com/comment/35903757
score: -2
tagged with: java
has answer: http://stackoverflow.com/a/23427839
has comment: http://stackoverflow.com/comment/35903745
answer count: 3
upvote count: 0
has title: java loop logic issue
favorite count: 0
has comment: http://stackoverflow.com/comment/35903761
has comment: http://stackoverflow.com/comment/35903778
possible better answer: http://stackoverflow.com/a/23427839
has answer: http://stackoverflow.com/a/23427863

http://stackoverflow.com/comment/35721310
comment on: http://stackoverflow.com/a/23328499
has text: I don't know why you got -1. I can use these algorithms on my work. Thanks for your attention too.
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/35977488
comment on: http://stackoverflow.com/a/23393701
type: Comment
has text: I need to add Autowired in addition to InjectMocks in exportService and it works !
score: 1
type: AnswerComment

indexoutofboundsexception
tags question: http://stackoverflow.com/q/23442320
tags question: http://stackoverflow.com/q/23355003
tags question: http://stackoverflow.com/q/23395982
tag name: indexoutofboundsexception
tags question: http://stackoverflow.com/q/23431065
tags question: http://stackoverflow.com/q/23293060
tags question: http://stackoverflow.com/q/23333221
tags question: http://stackoverflow.com/q/23403447
tags question: http://stackoverflow.com/q/23424544
tags question: http://stackoverflow.com/q/23439983
type: Tag

http://stackoverflow.com/comment/35742689
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23340918
has text: can u write some code

http://stackoverflow.com/comment/113028124
type: AnswerComment
type: Comment
has text: Hi, I am also facing same issue and stumbled upon this question. Will it be okay if you let me know what approach you took to resolve this issue?
score: 0
comment on: http://stackoverflow.com/a/55759692

http://stackoverflow.com/comment/35776995
type: Comment
type: QuestionComment
score: 0
has text: possible duplicate of [How to retrieve more than 100 results using Twitter4j](http://stackoverflow.com/questions/18800610/how-to-retrieve-more-than-100-results-using-twitter4j)
comment on: http://stackoverflow.com/q/23341215

http://stackoverflow.com/q/23304457
score: 0
tagged with: android
has title: Project created by libgdx is not working on android
has body: I am using the latest libgdx version (0.9.9) and latest version of ADT (Build: v22.6.2-1085508) with SDK Tolls version 22.6.2 and SDK platform-tools version 19.0.1 and SDK Build version 19.0.3. my program runs fine on Desktop but when i want to emulate it on android it gives me error(unfortunately, BirdEscape has stopped). My desktop is 64bit and I have armeabi and armeabi-v7a in root directory of android. please look at here: https://www.dropbox.com/s/cdogyhbxj3x8kyh/Capture.PNG setting for device is this: https://www.dropbox.com/s/ogk7hlv5oeat036/capturesetting.PNG 04-25 18:14:18.383: D/dalvikvm(1198): Trying to load lib /data/app-lib/com.Solijon.BirdEscape.android-1/libgdx.so 0xb3d03bb8 04-25 18:14:18.423: D/dalvikvm(1198): Added shared lib /data/app-lib/com.Solijon.BirdEscape.android-1/libgdx.so 0xb3d03bb8 04-25 18:14:18.423: D/dalvikvm(1198): No JNI_OnLoad found in /data/app-lib/com.Solijon.BirdEscape.android-1/libgdx.so 0xb3d03bb8, skipping init 04-25 18:14:18.503: D/AndroidRuntime(1198): Shutting down VM 04-25 18:14:18.503: W/dalvikvm(1198): threadid=1: thread exiting with uncaught exception (group=0xb3a3fba8) 04-25 18:14:18.523: E/AndroidRuntime(1198): FATAL EXCEPTION: main 04-25 18:14:18.523: E/AndroidRuntime(1198): Process: com.Solijon.BirdEscape.android, PID: 1198 04-25 18:14:18.523: E/AndroidRuntime(1198): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.Solijon.BirdEscape.android/com.Solijon.BirdEscape.android.AndroidLauncher}: com.badlogic.gdx.utils.GdxRuntimeException: Libgdx requires OpenGL ES 2.0 04-25 18:14:18.523: E/AndroidRuntime(1198): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2195) 04-25 18:14:18.523: E/AndroidRuntime(1198): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245) 04-25 18:14:18.523: E/AndroidRuntime(1198): at android.app.ActivityThread.access$800(ActivityThread.java:135) 04-25 18:14:18.523: E/AndroidRuntime(1198): at android.app.ActivityThread$H.handleMess…
type: UnansweredQuestion
type: Question
tagged with: libgdx
tagged with: java
tagged with: adt
has answer: http://stackoverflow.com/a/23304694
tagged with: android-emulator
answer count: 1

http://stackoverflow.com/a/23748579
has body: Finally, I got this working (Thanks for the amazing inputs). below are the changes I made : public void findLines(String aFileName) { List&lt;Integer&gt; a = new ArrayList&lt;Integer&gt;(); List&lt;Integer&gt; b = new ArrayList&lt;Integer&gt;(); Pattern regexp = Pattern.compile("(if|else|while).*"); Matcher exp1 = regexp.matcher("if|else|while"); Path path = Paths.get(aFileName); try ( BufferedReader reader = Files.newBufferedReader(path, ENCODING); LineNumberReader lineReader = new LineNumberReader(reader); ){ String line = null; while ((line = lineReader.readLine()) != null) { exp1.reset(line); if(exp1.find()) { int l= lineReader.getLineNumber(); b.add(l); } else {int l= lineReader.getLineNumber(); a.add(l); } } System.out.println(a); System.out.println(b); } catch (IOException ex){ ex.printStackTrace(); } The input file is same and the output is : [1, 2, 3, 4, 6, 7, 8, 10, 11, 12, 13] [5, 9]
accepted answer of: http://stackoverflow.com/q/23422225
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23422225
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/comment/35790455
has text: Which version of Asterisk are you using? In some version (like 11) you need to use WebRTC Breaker, which can be set under the expert settings.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23348672
score: 0

http://stackoverflow.com/comment/35685662
has text: @user3575347 That's what I said. You should start with `javacc.` But the database already implements those standards, so you already have a tool for validation, and unless you are a professional compiler writer, the tool you write almost certainly won't implement those standards correctly, so all you will have is a tool that passes some invalid SQL, fails some valid SQL, and in short is entirely unfit for purpose. It's clear that whoever has given you this assignment radically underestimates its complexity, and doesn't know what a correct solution would look like.
type: QuestionComment
comment on: http://stackoverflow.com/q/23307835
type: Comment
score: 0

http://stackoverflow.com/q/23350436
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/23353893
answer count: 1
tagged with: quickbooks-online
tagged with: quickbooks
has title: How to get request token and secret in OAuth 1.0a
tagged with: oauth
has answer: http://stackoverflow.com/a/23353893
has body: I'm trying to get oAuth working for accessing QuickBooks Online. I have a QuickBooks login/connect button embedded on a page that triggers the whole oAuth process. When it's clicked, a window pops up that is directed towards my apps getRequestToken endpoint. The handler (servlet) issues a request to the QuickBooks oAuth request token API, and it gets back: Request Token Request Token Secret Authorization URL So I have the response send a redirect to the Authorization URL. The pop up window now displays a QuickBooks login, after which there is a request to authorize my app with the users account. Once that's done, the pop up window is redirected to my apps getAccessToken endpoint (the callback URL that I included when calling the request token API). From there, I obviously have to send a request to the QuickBooks oAuth access token API to get an access token and access secret, but apparently I need to supply: Request Token Request Token Secret oauth_verifier The oauth_verifier is provided as a parameter in the callback to my getAccessToken endpoint, as well as an oauth_token, but I don't understand how to get hold of the request token and request token secret from here. Am I supposed to have my getRequestToken endpoint store them somewhere once they're retrieved. I'd prefer not to, but is this the only way to do it?
score: 0
type: AnsweredQuestion

http://stackoverflow.com/a/23424819
has comment: http://stackoverflow.com/comment/35900872
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/35902597
has body: binderFieldGroupPersonalDetails.setBuffered(true); // A button to commit the buffer button.addComponent(new Button("OK", new ClickListener() { @Override public void buttonClick(ClickEvent event) { try { binder.commit(); Notification.show("Thanks!"); } catch (CommitException e) { Notification.show(e.getMessage()); } } }));
upvote count: 1
answers question: http://stackoverflow.com/q/23423476
type: Answer

http://stackoverflow.com/comment/135351961
type: QuestionComment
comment on: http://stackoverflow.com/q/23432651
has text: Because it can't. Stop a spring application that has been started by the "start" goal. see here https://docs.spring.io/spring-boot/docs/1.4.1.RELEASE/maven-plugin/stop-mojo.html
score: 0
type: Comment

http://stackoverflow.com/q/23434890
type: Question
has comment: http://stackoverflow.com/comment/35917399
has body: I have a method which should wait for the user to input a string to indicate which direction the player wants to move. private static void makeMoves(java.awt.Point playerPosition, java.awt.Point snakePosition) { Scanner scanner = new java.util.Scanner(System.in); String move = scanner.next(); switch (move.charAt(0)) { case 'h': if (playerPosition.y == 0) { playerPosition.y = 9; } else { playerPosition.y = Math.max(0, playerPosition.y - 1); } moveSnake(playerPosition, snakePosition); break; case 'u': if (playerPosition.y == 9) { playerPosition.y = 0; } else { playerPosition.y = Math.min(9, playerPosition.y + 1); } moveSnake(playerPosition, snakePosition); break; case 'l': if (playerPosition.x == 0) { playerPosition.x = 9; } else { playerPosition.x = Math.max(0, playerPosition.x - 1); } moveSnake(playerPosition, snakePosition); break; case 'r': if (playerPosition.x == 39) { playerPosition.x = 0; } else { playerPosition.x = Math.min(39, playerPosition.x + 1); } moveSnake(playerPosition, snakePosition); break; } scanner.close(); } It always throws Exception in thread "main" java.util.NoSuchElementException at java.util.Scanner.throwFor(Scanner.java:907) at java.util.Scanner.next(Scanner.java:1416) at ZZZZZnake.makeMoves(ZZZZZnake.java:52) at ZZZZZnake.main(ZZZZZnake.java:45) According to the API the Scanner.next() should block but is not waiting for the user to input a direction. What am I missing?
score: 0
has answer: http://stackoverflow.com/a/23434957
answer count: 1
has comment: http://stackoverflow.com/comment/35917379
accepted answer: http://stackoverflow.com/a/23434957
type: AnsweredQuestion
tagged with: java.util.scanner
tagged with: java
has title: Scanner.next() not blocking

http://stackoverflow.com/comment/35708271
score: 0
has text: where is the question?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23322087

http://stackoverflow.com/comment/35843347
score: 0
comment on: http://stackoverflow.com/q/23395178
type: Comment
type: QuestionComment
has text: Never thought about it, but I am pretty sure, that the tomcat will simply create a ServletContect instance while deploying the web-app. The concrete implementation is made within org.apache.catalina.core.ApplicationContextFacade

http://stackoverflow.com/q/23294051
type: Question
has comment: http://stackoverflow.com/comment/35918513
has body: I want to apply a simple rotationX animation when a group expands/collapses on an ExpandableListView. The code below works in first two expands but after two/three/five times does not play the defined animation. The strange thing is that the first time that I expand /collapse it works perfect! ExpandableListview exp = new ExpandableListview(context); // set adapter code LayoutTransition transition = new LayoutTransition(); Animator appearAnim = ObjectAnimator.ofFloat(null, "rotationX", 90f,0f).setDuration(transition.getDuration(LayoutTransition.APPEARING)); transition.setAnimator(LayoutTransition.APPEARING, appearAnim); // I also tried first argument equals DISSAPEARING, CHANGING, etc exp.setLayoutTransition(transition); Any idea?? Is this approach totally wrong??? I have to notice at this point that this is not a duplicate! I am looking for a solution that will be approached with LayoutTransition class / methods.
has comment: http://stackoverflow.com/comment/35891338
has title: LayoutTransition animation on ExpandableListview does not work properly
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/35871339
has comment: http://stackoverflow.com/comment/35876076
favorite count: 0
has comment: http://stackoverflow.com/comment/35901491
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35901519
tagged with: android
has answer: http://stackoverflow.com/a/23466005
tagged with: expandablelistview
score: 2
tagged with: android-animation
tagged with: java
has comment: http://stackoverflow.com/comment/35877660

http://stackoverflow.com/q/23384243
accepted answer: http://stackoverflow.com/a/23390870
has comment: http://stackoverflow.com/comment/35824391
type: AnsweredQuestion
tagged with: jena-rules
score: 0
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/23390870
tagged with: jena
has comment: http://stackoverflow.com/comment/35823303
has body: This is the code I have written but the new built-in does not seem to work. I get the error: Exception in thread "main" com.hp.hpl.jena.reasoner.rulesys.impl.LPRuleSyntaxException: Syntax error in backward rule: matematica Unknown builtin operation mysum Can anyone tell me where the error is? Here is my code: package JenaRules; import java.io.BufferedReader; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; import java.util.List; import org.semanticweb.owlapi.model.OWLOntologyCreationException; import org.semanticweb.owlapi.model.OWLOntologyStorageException; import com.hp.hpl.jena.graph.Node; import com.hp.hpl.jena.query.Query; import com.hp.hpl.jena.query.QueryExecution; import com.hp.hpl.jena.query.QueryExecutionFactory; import com.hp.hpl.jena.query.QueryFactory; import com.hp.hpl.jena.query.ResultSet; import com.hp.hpl.jena.query.ResultSetFormatter; import com.hp.hpl.jena.rdf.model.InfModel; import com.hp.hpl.jena.rdf.model.Model; import com.hp.hpl.jena.rdf.model.ModelFactory; import com.hp.hpl.jena.rdf.model.Resource; import com.hp.hpl.jena.reasoner.Reasoner; import com.hp.hpl.jena.reasoner.rulesys.*; import com.hp.hpl.jena.reasoner.rulesys.builtins.BaseBuiltin; import com.hp.hpl.jena.util.FileManager; import com.hp.hpl.jena.vocabulary.RDFS; import com.hp.hpl.jena.vocabulary.ReasonerVocabulary; public class RulesOntology_MT { public static void main(String[] args) throws OWLOntologyStorageException, OWLOntologyCreationException, IOException { BuiltinRegistry.theRegistry.register(new BaseBuiltin() { @Override public String getName() { return "mysum"; } @Override public int getArgLength() { return 2; } @Override public boolean bodyCall(Node[] args, int length, RuleContext context) { checkArgs(length, context); BindingEnvironment env = context.getEnv(); Node n1 = getArg(0, args, context); Node n2 = getArg(1, args, context); if (n1.isLiteral() &amp;&amp; n2.isLiteral()) { Object v1 = n1.getLit…
tagged with: eclipse
has title: Custom builtin in Jena
tagged with: built-in
answer count: 1

http://stackoverflow.com/comment/35798747
comment on: http://stackoverflow.com/a/23367203
type: AnswerComment
has text: Thanks for your efforts you are like a swing genius!!. I want to ask a question, according to you which book or tutorial is helpful to learn swings. If swing is outdated which UI is currently using for corejava and tell me any online tutorial or book.
type: Comment
score: 0

http://stackoverflow.com/comment/35828782
type: QuestionComment
has text: @Sumit see the link to the project page embedded in my comment. You'll find all versions of the software there, the complete changelog and more.
comment on: http://stackoverflow.com/q/23387031
score: 0
type: Comment

http://stackoverflow.com/q/23450093
has title: DOM...Exception in thread "main"
has body: When i tried running this code I get this error..I don't know where i went wrong Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0 at nventaire.test.main(test.java:10) > import org.w3c.dom.*; import javax.xml.parsers.*; public class test { public static void main(String[] args) throws Exception { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder parser = factory.newDocumentBuilder(); Document doc = parser.parse(args[0]); Element racine = doc.getDocumentElement(); NodeList nl = racine.getElementsByTagName("joueur"); for (int i = 0; i &lt; nl.getLength(); ++i) { Element joueur = (Element) nl.item(i); NodeList listedenoms = joueur.getElementsByTagName("nom"); Element nom = (Element) listedenoms.item(0); System.out.println(nom.getFirstChild().getNodeValue()); } } thaks
tagged with: java
tagged with: dom
type: Question
has comment: http://stackoverflow.com/comment/35945823
has answer: http://stackoverflow.com/a/23450269
score: 0
answer count: 2
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/35945795
has answer: http://stackoverflow.com/a/23450112
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/35894758
type: Comment
has text: You might have to slightly adapt your Android.mk - the Android Makefile, so it produces a binary. The binary usually has no special ending behind the file name. Using adb push you can put it on your device, adb shell, chmod to make it executable and then you should be able to start it from commandline.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/23404153

video
tags question: http://stackoverflow.com/q/23351657
type: Tag
tags question: http://stackoverflow.com/q/23401849
tags question: http://stackoverflow.com/q/23396687
tag name: video

http://stackoverflow.com/q/23399764
has comment: http://stackoverflow.com/comment/35851908
has answer: http://stackoverflow.com/a/23400511
has answer: http://stackoverflow.com/a/23399975
upvote count: 0
has comment: http://stackoverflow.com/comment/35851958
tagged with: compiler-errors
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35851917
tagged with: java
has body: I have to write a program to play a game of poker between two 'human' players. I have the main method (dealer) set up to ask for the first player's bet but I haven't been able to figure out how to call upon the Deck class to the deal method. I tried deck.deal(), etc. but nothing seems to go through. Ill post the classes that are involved below and I've taken note of where the code should call upon the deck in the Dealer class public class Dealer { private Deck deck; private Player[] players; private String n; Scanner scan = new Scanner(System.in); public static final int NUMBER_OF_PLAYERS = 2; /** * Default constructor - creates and populates the Player array and the * Deck object. */ public Dealer() { players = new Player[ NUMBER_OF_PLAYERS ]; //IMPORTANT players is the array deck = new Deck(); // populate the array of players } // constructor /** * Outermost level of abstraction for the poker game */ public void play() { System.out.println("Welcome to Poker!"); //Getting First Names System.out.println("\nEnter first player's name: "); String name = scan.nextLine(); players[0] = new Player(name); players[0].getName(name); //Getting Second Name System.out.println("Enter second player's name: "); name = scan.nextLine(); players[1] = new Player(name); players[1].getName(name); //First Player Goes System.out.println(players[0].getName(n) + "'s Turn\n"); //Bet System.out.println("Enter bet: "); int bet = players[0].getBet(); //IMPORTANT players is the array and can call Player method as own //Able to bet? while(!players[0].bet(bet) || !players[1].bet(bet)) { bet = 20; if(!players[0].bet(bet) || !players[1].bet(bet)) { bet = 1; } } //Draw Cards/Deck //*****NEED TO DEAL CARDS HERE***** //*****DEAL AN ARRAY OF CARD[5] TO EACH PLAYERS[0] AND [1]****** //Compare //Add to winner //Add to loser //Winner Goes ^^ } // method play } public class Deck { private int pointer = 0; // indicates the current position in the deck. // This should begin with 0 (the first call) // and incre…
type: Question
has comment: http://stackoverflow.com/comment/35851858
score: -2
has title: Dealing Cards Through a Single Array
answer count: 2
downvote count: 2
has comment: http://stackoverflow.com/comment/35851899
has comment: http://stackoverflow.com/comment/35852001
has comment: http://stackoverflow.com/comment/35851939
has comment: http://stackoverflow.com/comment/35851974
favorite count: 0

http://stackoverflow.com/comment/35779232
has text: Hm, it doesn't have it!
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/23357374
score: 0

http://stackoverflow.com/comment/35769394
has text: Surround it with a try-catch and tell me the exception that is thrown. Provide the stack trace.
comment on: http://stackoverflow.com/a/23354176
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/35817140
type: AnswerComment
comment on: http://stackoverflow.com/a/23380950
type: Comment
has text: @vermaraj it depends whether you want the first 32 or last 32 characters . suppse you enter : `4234234242342342@345345345345344444` it matches your condition of 16 chars before @ and 18 chars after @ but putting the third condtion of 32 chars which 32 chars you would like to keep ?
score: 0

persistence
tags question: http://stackoverflow.com/q/23432871
tags question: http://stackoverflow.com/q/23396965
tags question: http://stackoverflow.com/q/23435735
tags question: http://stackoverflow.com/q/23347670
tag name: persistence
type: Tag
tags question: http://stackoverflow.com/q/23411206

web
tags question: http://stackoverflow.com/q/23416123
tags question: http://stackoverflow.com/q/23387185
tags question: http://stackoverflow.com/q/23413453
tags question: http://stackoverflow.com/q/23421099
tags question: http://stackoverflow.com/q/23310408
type: Tag
tags question: http://stackoverflow.com/q/23429776
tag name: web
tags question: http://stackoverflow.com/q/23317405
tags question: http://stackoverflow.com/q/23423476
tags question: http://stackoverflow.com/q/23312828
tags question: http://stackoverflow.com/q/23413835
tags question: http://stackoverflow.com/q/23428292
tags question: http://stackoverflow.com/q/23407185
tags question: http://stackoverflow.com/q/23327074
tags question: http://stackoverflow.com/q/23424706
tags question: http://stackoverflow.com/q/23400247
tags question: http://stackoverflow.com/q/23316280
tags question: http://stackoverflow.com/q/23342133

http://stackoverflow.com/comment/35844602
type: Comment
comment on: http://stackoverflow.com/a/23395893
score: 0
type: AnswerComment
has text: Ok, I appreciate you taking time to answer my question. But I don't believe this actually responds to my question which is whether "instanceof" is slower.

http://stackoverflow.com/comment/35670409
comment on: http://stackoverflow.com/a/23300709
type: AnswerComment
has text: @Cruncher Good idea, but I have not found any collisions :-(
type: Comment
score: 0

http://stackoverflow.com/a/23443709
accepted answer of: http://stackoverflow.com/q/23439085
has comment: http://stackoverflow.com/comment/62532092
answers question: http://stackoverflow.com/q/23439085
type: Answer
score: 2
upvote count: 2
has body: The most common cause for issues like this is a missing region specification when initializing the client, see section To create and initialize an Amazon EC2 client within Create an Amazon EC2 Client for details: Specifically, step 2 only creates an EC2 client without specifying the region explicitly: 2) Use the AWSCredentials object to create a new AmazonEC2Client instance, as follows: amazonEC2Client = new AmazonEC2Client(credentials); This yields a client talking to us-east-1 - surprisingly, the AWS SDKs and the AWS Management Console use different defaults even as outlined in step 3, which also shows how to specify a different endpoint: 3) By default, the service endpoint is ec2.us-east-1.amazonaws.com. To specify a different endpoint, use the setEndpoint method. For example: amazonEC2Client.setEndpoint("ec2.us-west-2.amazonaws.com"); The AWS SDK for Java uses US East (N. Virginia) as the default region if you do not specify a region in your code. However, the AWS Management Console uses US West (Oregon) as its default. Therefore, when using the AWS Management Console in conjunction with your development, be sure to specify the same region in both your code and the console. [emphasis mine] The differing defaults are easy to trip over, and the respective default in the AWS Management Console has in fact changed over time - as so often in software development, I recommend to always be explicit about this in your code to avoid such subtle error sources.
has comment: http://stackoverflow.com/comment/62620434
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/23402577
has answer: http://stackoverflow.com/a/23450510
accepted answer: http://stackoverflow.com/a/23450510
tagged with: android
downvote count: 0
has comment: http://stackoverflow.com/comment/35857900
has title: Does it violate the MVC pattern's separation of concerns if a model class contains a static method whose parameters are instances of a View object?
type: Question
tagged with: model-view-controller
type: AnsweredQuestion
tagged with: separation-of-concerns
score: 1
has body: public static Intent prepare( EditText to, EditText cc, EditText subject, EditText content ){ Intent preparedIntent = new Intent( Intent.ACTION_SEND ); preparedIntent.setType( "plain/text" ); preparedIntent.putExtra(Intent.EXTRA_EMAIL, new String[ ] { to.getText().toString( ) }); preparedIntent.putExtra(Intent.EXTRA_CC, new String[ ] { cc.getText( ).toString( ) }); preparedIntent.putExtra(Intent.EXTRA_SUBJECT,subject.getText().toString()); preparedIntent.putExtra(Intent.EXTRA_TEXT,content.getText().toString()); return preparedIntent;} Does it violate the MVC pattern's separation of concerns if a model class contains a static method whose parameters are instances of a View object? I'm trying to research whether it is not a proper implementation of the MVC pattern's separation of concerns if I choose to provide a static helper method in my Email.java class that is used for returning an instance of an intent within the scope of the email client's activity class. The reasons for me questioning this design decision is that even though an intent is not an instance of View however I am passing objects that are instances of View objects within the scope of the Email.java (model) class. Therefore, assuming I am not conforming to the MVC pattern, would changing the parameter types to String and having each instance of View return an object of type string by calling its viewObject.getText().toString() within the parameter construct everytime I wish to invoke the Email.prepare( .....) method then allow for conformity to the MVC pattern by utilizing proper separation of concerns? Here is a link to the code if it better helps in possibly forming an answer. The two classes in question are the EmailActivity.java file in the activities package and the Email.java file in the models package. Thank you for any input by the way ahead of time. I was just curious about this. It is obviously not a major issue and more minor but I am trying to learn design patters. I know the general answer…
tagged with: java
has comment: http://stackoverflow.com/comment/35859664
upvote count: 1
has comment: http://stackoverflow.com/comment/35859212
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/35946494

http://stackoverflow.com/q/23307977
has body: I have two classes: class TrainingCourse { Integer id; @OneToMany(cascade = CascadeType.ALL, fetch=FetchType.EAGER) @JoinTable(name = "TrainingCourseClass", joinColumns = { @JoinColumn(name = "CourseID") }, inverseJoinColumns = { @JoinColumn(name = "ClassID") }) private Set&lt;TrainingClass&gt; trainingClasses; } class TrainingClass { Integer id; } In the database they are mapped using a join table. So this is a unidirectional relationship. From the UI, when a TrainingCourse is created, a list of previously created TrainingClasses are selected from the UI. Now if I create the TrainingCourse, then it automatically updates the associated TrainingClasses also. But trainingClass is independent of TrainingCourse and can exist independently. So TrainingClasses are created and updated separately from the TrainingCourse. So saving the TrainingCourse should save data in the TrainingCourse table and it will also save the association in the join Table TrainingCourseClass. Nothing should happen in the table TrainingClass. However if I add these to the columns: nullable=false, updatable=false and CascadeType.REMOVE @OneToMany(cascade = CascadeType.REMOVE, fetch=FetchType.EAGER) @JoinTable(name = "TrainingCourseClass", joinColumns = { @JoinColumn(name = "CourseID", nullable=false, updatable=false) }, inverseJoinColumns = { @JoinColumn(name = "ClassID", nullable=false, updatable=false) }) private Set&lt;TrainingClass&gt; trainingClasses; Then the problem is fixed ie creating trainingCourse doesn't update the trainingClass table. Now I am not 100% sure whether it is the right solution or how it is working to solve the problem. There is also another thing called MappedBy. I am not sure whether this is relevant here. I just used it as a guess and it is working. Moreover, this seems to be really a many-to-many relationship ie The same class can belong to many courses and one course can include many classes. But one-to-many relationship is also working. This is not very convincing. The…
type: Question
accepted answer: http://stackoverflow.com/a/23308127
score: 0
has answer: http://stackoverflow.com/a/23308127
answer count: 1
has title: hibernate many-to-many relationship updating unexpectingly
type: AnsweredQuestion
tagged with: java
tagged with: hibernate

http://stackoverflow.com/comment/35917564
comment on: http://stackoverflow.com/a/23434957
score: 0
type: Comment
has text: But with each call of the method I recreat it by calling `Scanner scanner = new java.util.Scanner(System.in);` or not?
type: AnswerComment

http://stackoverflow.com/comment/35662628
type: Comment
comment on: http://stackoverflow.com/a/23296546
score: 0
type: AnswerComment
has text: one more thing i want to ask that i have data also to show.. it is only showing images.. i want to show data also that is stored in HASH MAP ARRAY.. how to manipulate it..??

http://stackoverflow.com/a/23325873
type: Answer
answers question: http://stackoverflow.com/q/23325745
has body: I believe user can subscribe to multiple shops, and one shop can have multiple users subscribed to it. In this case, it is best to use map table with shop_id from shop table and user_id from user table. ( keep the foreign key constraints) . For each subscription ,this table will keep an entry, hence no comma separated string is necessary.
score: 0

http://stackoverflow.com/comment/35799667
type: Comment
has text: Actually the repackaging might fail as in certain cases the jar might be referenced from the JVM and cannot be saved.
comment on: http://stackoverflow.com/a/23370909
type: AnswerComment
score: 0

http://stackoverflow.com/comment/35726488
score: 0
has text: Thank you SOO much! You helped a lot. It did work, but I had to change some things to keep the .hasNextLine() from running infinitely.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23327185

http://stackoverflow.com/comment/35902540
comment on: http://stackoverflow.com/a/23427059
has text: Why don't use `FlowLayout`?
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/a/23320121
type: Answer
score: 2
has body: What you are asking for is referred to as an embedded database, as opposed to a database server. Besides JavaDB/Apache Derby mentioned in the correct answer by Lesya, another choice would be H2. Both are built in pure Java and can be bundled with your app. While both H2 and Derby are good options, you might find H2 is easier to learn, configure, and bundle.
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23320023
answers question: http://stackoverflow.com/q/23320023
upvote count: 2
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35705732

http://stackoverflow.com/q/23414984
has answer: http://stackoverflow.com/a/23415074
possible better answer: http://stackoverflow.com/a/23415074
has title: Java overriding compareTo method for Arrays.sort()
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/23415316
has comment: http://stackoverflow.com/comment/35880491
type: Question
accepted answer: http://stackoverflow.com/a/23415133
tagged with: object
has body: I am trying to override the compareTo method to be able to use Arrays.sort() But when i do this it seems like it is not working. I dont get any error back but i have a tester that tests and gives an error back. I am supposed to compare the 'totalsales' from the items being compared Here is the compare to method comparing two ItemSales Items @Override public int compareTo(ItemSales item) { return Double.compare(item.totalSales, this.totalSales); } Here is the tester testing this, ofcourse theres much more besides this, but everything else works even clone(). ItemSales item = new ItemSales(); ItemSales newItem = new ItemSales(10.0, 50, 50.0); ItemSales secondItem = (ItemSales) newItem.clone(); ItemSales[] myItems = { secondItem, item, newItem }; ItemSales[] myItems = { secondItem, item, newItem }; Arrays.sort(myItems); if ( myItems[0].getTotalSales() == 860.0 &amp;&amp; myItems[1].getTotalSales() == 870.0) { System.out.println("ItemSalesDemo.main() - sorted, this is correct"); } else { System.out.println("ItemSalesDemo.main() - "); System.out.println("ItemSalesDemo.main() ------------------------"); System.out.println("ItemSalesDemo.main() - Error -"); System.out.println("ItemSalesDemo.main() ------------------------"); System.out.println("ItemSalesDemo.main() - item and newItem should have been equal"); System.out.println("ItemSalesDemo.main() - "); System.exit(-1); } As you may know i get the "item and newItem should have been equal" error
tagged with: comparable
has answer: http://stackoverflow.com/a/23415133
score: 0
has comment: http://stackoverflow.com/comment/35880731
answer count: 3

http://stackoverflow.com/a/23387669
upvote count: 3
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/23386243
has body: I've just found it out by myself. The template in the question is correct. The only thing I need to do is register the built-in StringRenderer before rendering the template: STGroup group = new STGroupFile("my_template.stg"); group.registerRenderer(String.class, new StringRenderer());
score: 3

http://stackoverflow.com/comment/35898756
comment on: http://stackoverflow.com/q/23423552
score: 0
type: Comment
has text: Are you really working on Eclispe 3.7.x?
type: QuestionComment

http://stackoverflow.com/comment/35905892
score: 0
type: Comment
has text: The finding of keywords means that I should have a list of keywords..which is basically what I want to do. I can restrict the set (food, office items maybe 99% correct), but then what I need to do is a list of items, to check that my list of items is correct and then use it to get the item from the sentences. Redundant, but maybe I can solve the problem : apple -> half apple -> a sliced half apple.
comment on: http://stackoverflow.com/a/23428080
type: AnswerComment

http://stackoverflow.com/a/23322300
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/23322239
downvote count: 0
has body: Try with Class#getName() public static &lt;T extends LivingThing&gt; T getData(Class&lt;T&gt; clazz, Object otherParam) { if (Cat.class.getName().equals(clazz.getName())) { System.out.println("cat"); // do something and return a new Cat } ... } or try with Class#equals() if (Cat.class.equals(clazz)) {..}
score: 1
has comment: http://stackoverflow.com/comment/35708647

http://stackoverflow.com/a/23449125
upvote count: 10
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/23443219
score: 10
has body: Guava's Lists.reverse(List) returns a reversed view of the original list, without doing any copying.

http://stackoverflow.com/q/23347743
has comment: http://stackoverflow.com/comment/35755651
has answer: http://stackoverflow.com/a/23348156
tagged with: agents-jade
answer count: 4
has comment: http://stackoverflow.com/comment/35755881
favorite count: 0
upvote count: 2
has body: I am experiencing a problem in Java (Eclipse) regarding the usage of dlls. Until now, I am experiencing the following problem: Uncaught Exception for agent SomeAgent java.lang.UnsatisfiedLinkError: SomePackage.SomeClass.SomeNativeMethod(II)Z [...] at jade.core.behaviours.Behaviour.actionWrapper(Behaviour.java:344) at jade.core.Agent$ActiveLifeCycle.execute(Agent.java:1532) at jade.core.Agent.run(Agent.java:1471) at java.lang.Thread.run(Thread.java:745) I don't know if this will help to figure out the problem, but I am also using JADE in this project... EDIT (28/04/2014): The dll which I am trying to use is a custom one (was created by an ex-employee from the company where I work). The curious thing about this problem is that I have 2 java projects which perform similar tasks. One of this projects runs perfectly, while the other one is experiencing the UnsatisfiedLinkError. About the paths: I've created a specific folder for the dlls which is contained in the workspace folder, but not inside the project folder (in other words, the same folder where bin, src, bibs, settings, etc. are). This folder's configuration is equal for the both projects I have. Also, I've already tested the System.out.println(System.getProperty("java.library.path") method and the right path is returned on both cases. EDIT (29/04/2014): Just added some additional information regarding the error messages. I am starting to think that the problem may be related to the JADE usage...
type: UnansweredQuestion
score: 2
has comment: http://stackoverflow.com/comment/35755701
tagged with: dll
tagged with: java-native-interface
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/23355362
has answer: http://stackoverflow.com/a/23398566
has title: java.lang.UnsatisfiedLinkError - Native method issue
downvote count: 0
has answer: http://stackoverflow.com/a/23348440

http://stackoverflow.com/comment/35726549
type: Comment
has text: @SerenaHamilton David is referring to the algorithm described in this answer, not to the algorithm in your question. You can topologically sort by doing a simple DFS in time O(n + m)
comment on: http://stackoverflow.com/a/23330569
type: AnswerComment
score: 0

http://stackoverflow.com/comment/39031833
comment on: http://stackoverflow.com/q/23349805
score: 0
type: Comment
type: QuestionComment
has text: I did spend a lot of time to make this work, if you give me more info on how you are trying to make this work I might be able to help

http://stackoverflow.com/q/23430932
type: Question
tagged with: math
has comment: http://stackoverflow.com/comment/35910019
has answer: http://stackoverflow.com/a/23431056
score: 0
has title: unexpected behavior of java loops
has answer: http://stackoverflow.com/a/23430956
has answer: http://stackoverflow.com/a/23431195
answer count: 4
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35910335
has answer: http://stackoverflow.com/a/23431297
accepted answer: http://stackoverflow.com/a/23431297
tagged with: java
has body: I got a problem like this:- A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 × 99. Find the largest palindrome made from the product of two 3-digit numbers. to solve the problem I wrote a program like this: public void palindrome(){ int n=0; for (int i = 100; i &lt; 999; i++) { // I belive that largest palindrome is between 100 and 999 for (int j = 100; j &lt;999; j++) { n=i*j; if(n&gt;100000){ if(n/100000==n%10){ if(n/10000-(n/100000)*10==(n%100)/10){ if(n/1000-(n/10000)*10==(n%1000)/100){ System.out.println(n); } } } } } } } but out put is this :- 580085 if I changed the loops like this for (int i = 900; i &lt; 999; i++) { // I belive that largest palindrome is between 900 and 999 for (int j = 900; j &lt;999; j++) { then it get the correct answer, I can not understand the behavior of this program ? can anyone explain ?
possible better answer: http://stackoverflow.com/a/23431056

http://stackoverflow.com/a/23768524
type: Answer
answers question: http://stackoverflow.com/q/23435182
score: 0
has body: There was an issue with the Eclipse IDE. Moved over to Android Studio and it worked like a charm without any problems.

http://stackoverflow.com/q/23353979
type: AnsweredQuestion
tagged with: java
tagged with: struts-1
has body: In struts 1.x is that allowed for two browser (in this case two sessions) operate on the same actionForm one after another and in the action class get the updated actionForm updated by another session?
type: Question
score: 0
accepted answer: http://stackoverflow.com/a/23354095
answer count: 1
linked to: http://stackoverflow.com/q/3215988
has answer: http://stackoverflow.com/a/23354095
has title: Obtain the formbean updated by other session in struts 1.x

javafx
tags question: http://stackoverflow.com/q/23375681
tags question: http://stackoverflow.com/q/23440980
tags question: http://stackoverflow.com/q/23355831
tags question: http://stackoverflow.com/q/23350953
tags question: http://stackoverflow.com/q/23313755
type: Tag
tags question: http://stackoverflow.com/q/23319051
tags question: http://stackoverflow.com/q/23438214
tags question: http://stackoverflow.com/q/23399283
tags question: http://stackoverflow.com/q/23412224
tags question: http://stackoverflow.com/q/23377301
tags question: http://stackoverflow.com/q/23317777
tags question: http://stackoverflow.com/q/23325133
tags question: http://stackoverflow.com/q/23324349
tags question: http://stackoverflow.com/q/23293742
tags question: http://stackoverflow.com/q/23305086
tags question: http://stackoverflow.com/q/23343856
tags question: http://stackoverflow.com/q/23363222
tags question: http://stackoverflow.com/q/23344042
tags question: http://stackoverflow.com/q/23300774
tags question: http://stackoverflow.com/q/23303087
tags question: http://stackoverflow.com/q/23306305
tags question: http://stackoverflow.com/q/23418555
tags question: http://stackoverflow.com/q/23306651
tags question: http://stackoverflow.com/q/23397703
tags question: http://stackoverflow.com/q/23315109
tag name: javafx
tags question: http://stackoverflow.com/q/23422822
tags question: http://stackoverflow.com/q/23424542
tags question: http://stackoverflow.com/q/23449932
tags question: http://stackoverflow.com/q/23394547
tags question: http://stackoverflow.com/q/23378725
tags question: http://stackoverflow.com/q/23329832
tags question: http://stackoverflow.com/q/23367750
tags question: http://stackoverflow.com/q/23359605
tags question: http://stackoverflow.com/q/23414737
tags question: http://stackoverflow.com/q/23409138
tags question: http://stackoverflow.com/q/23368039
tags question: http://stackoverflow.com/q/23349527
tags question: http://stackoverflow.com/q/23351657
tags question: http://stackoverflow.com/q/23436894
tags question: http://stackoverflow.com/q/23358641
tags question: http://stackoverflow.com/q/23374004
tags question: http://stackoverflow.com/q/23410412
tags question: http://stackoverflow.com/q/23325488
tags question: http://stackoverflow.com/q/23426939
tags question: http://stackoverflow.com/q/23424487
tags question: http://stackoverflow.com/q/23398824
tags question: http://stackoverflow.com/q/23291993
tags question: http://stackoverflow.com/q/23296241
tags question: http://stackoverflow.com/q/23322276
tags question: http://stackoverflow.com/q/23401849
tags question: http://stackoverflow.com/q/23297118
tags question: http://stackoverflow.com/q/23293759
tags question: http://stackoverflow.com/q/23447301

http://stackoverflow.com/a/23345971
upvote count: 1
has comment: http://stackoverflow.com/comment/35752265
downvote count: 0
score: 1
has body: Note: this turned out not to be the issue in this case, but if you're reading this question because you've faced the same symptom, it could be the issue for you... According to my understanding of the Java spec, this means that the following constructor should be implicitly inserted by the compiler public MyApplication() { super(); } That's only the case if it's a public class. From section 8.8.9 of the JLS: The default constructor has the same accessibility as the class (§6.6). So if your class is declared as having any access other than public, the constructor won't be public either. You haven't shown your class declaration, but the first thing you should check is that it's public.
type: Answer
has comment: http://stackoverflow.com/comment/35752200
answers question: http://stackoverflow.com/q/23345776

http://stackoverflow.com/a/23425652
has comment: http://stackoverflow.com/comment/35902157
type: Answer
has comment: http://stackoverflow.com/comment/35904601
has comment: http://stackoverflow.com/comment/35901844
upvote count: 1
has comment: http://stackoverflow.com/comment/35904417
has comment: http://stackoverflow.com/comment/35900208
score: 1
has body: Each time you write to a socket, you add between 5 and 15 micro-seconds. For buffered output, this occurs when you flush() the data. Note: if you don't have a buffered output, it will be performed on every write() and the flush() won't do anything. Fortunately the OS expects applications to make more calls than is optimal so the it uses Nagle's algorithm by default to groups portions of the data writing into a larger packets. Note: not only does the OS do this but some network adapter do this by default too. In short, don't flush() too often but unless tens of micros-seconds add up to something which matters to you, you might not notice the difference. e.g. if you do 100 flushes you might add a milli-second.
has comment: http://stackoverflow.com/comment/35900117
has comment: http://stackoverflow.com/comment/35904281
accepted answer of: http://stackoverflow.com/q/23425545
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23425545
downvote count: 0

http://stackoverflow.com/q/23377427
answer count: 2
has comment: http://stackoverflow.com/comment/35810677
has comment: http://stackoverflow.com/comment/35810714
has title: Does ConcurrentHashmap size() method count null keys?
has answer: http://stackoverflow.com/a/23377511
has body: Lets say I have a concurrenthashmap with some keys and values that are not null. Later these keys can become null, then what happens? Are they automatically removed from concurrenthashmap or do they stay there as null? Does the size() method count them?
type: UnansweredQuestion
tagged with: maps
has answer: http://stackoverflow.com/a/23378619
score: 0
tagged with: java
type: Question

http://stackoverflow.com/q/23331279
has body: This is very new thing for me. I am just wondering If we could send the ProtoBuf serialized data from java application to Web application (javascript) and de-serialize there. I am using TCP/IP connection in websocket to connect java application to javascript. I have been looking at https://github.com/dcodeIO/ProtoBuf.js/ but they are using node.js ,which is not in my case. Thank you
type: UnansweredQuestion
type: Question
tagged with: java
score: 0
has title: ProtoBuf from java application to web application
answer count: 1
tagged with: javascript
has answer: http://stackoverflow.com/a/24175042
tagged with: protocol-buffers

http://stackoverflow.com/comment/35706857
comment on: http://stackoverflow.com/a/23321228
type: Comment
score: 1
has text: o is the starting position in destination array
type: AnswerComment

http://stackoverflow.com/q/23404540
accepted answer: http://stackoverflow.com/a/23404700
tagged with: arrays
tagged with: button
score: -2
favorite count: 0
has title: How to put array of buttons in the left of the frame
has answer: http://stackoverflow.com/a/23405309
downvote count: 2
has answer: http://stackoverflow.com/a/23404700
possible better answer: http://stackoverflow.com/a/23405309
type: AnsweredQuestion
has body: I'm working in a project of Air-lain class I want to create a array of buttons to reserve seat. I do the array but I don't know how to put it in the left of the frame. it is be in the whole of frame int x=0; for (int j=0 ; j&lt;100 ;j++) { a[x][j]=new JButton(); a[x][j].setBackground(Color.GREEN); contentPane.add(a[x][j]); x++; if(x==5) x=0; } also how can I put a names for the column and row out side the buttons
tagged with: java
type: Question
answer count: 2
upvote count: 0

http://stackoverflow.com/comment/35728034
comment on: http://stackoverflow.com/a/23332503
type: AnswerComment
has text: sorry about that one, didn't catch all typos when typing here i'll change thank you!
score: 0
type: Comment

http://stackoverflow.com/a/23473059
type: Answer
answers question: http://stackoverflow.com/q/23390011
score: 3
has body: Ah it seems that it has to do something with using an older iText version. I've updated to iText 5.5.0 and it seems to work now. I still had to remove any &lt;br&gt; and &lt;hr&gt; tags thou. //using iText 5.5.0 and XMLWorker 5.5.0 @FXML private HTMLEditor htmlEditor; @FXML private void handleButtonAction(ActionEvent event) { final Document document = new Document(); PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("D:/test/loremipsum.pdf")); document.open(); String htmlString = htmlEditor.getHtmlText(); htmlString = htmlString.replace("&lt;br&gt;", ""); htmlString = htmlString.replace("&lt;br/&gt;", ""); htmlString = htmlString.replace("&lt;br /&gt;", ""); htmlString = htmlString.replace("&lt;hr&gt;", "&lt;p&gt;&lt;/p&gt;"); htmlString = htmlString.replace("&lt;hr/&gt;", "&lt;p&gt;&lt;/p&gt;"); htmlString = htmlString.replace("&lt;hr /&gt;", "&lt;p&gt;&lt;/p&gt;"); StringReader in = new StringReader(htmlString); try { final Paragraph test = new Paragraph(); XMLWorkerHelper.getInstance().parseXHtml(new ElementHandler() { @Override public void add(final Writable w) { if (w instanceof WritableElement) { List&lt;Element&gt; elements = ((WritableElement) w).elements(); for (Element e : elements) { test.add(e); } } } }, in); document.add(test); } catch (IOException | DocumentException e) { System.out.println(e.toString()); System.out.println(e.getMessage()); } document.close(); }
upvote count: 3
accepted answer of: http://stackoverflow.com/q/23390011
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/40603384

http://stackoverflow.com/comment/35687976
has text: dear i have updated in my post whatever i am getting in output
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23310627

http://stackoverflow.com/q/23360531
has answer: http://stackoverflow.com/a/23361249
score: 0
has comment: http://stackoverflow.com/comment/35779146
type: UnansweredQuestion
tagged with: android
has body: This is an ExpandableListView layout for my project that I am currently working on right now. I'm having problems with the child ArrayList. I want to be able to click on each dishes and leads to me a new page. I tried using intent but it cant work. This is my Java class code. public class Menupage extends ExpandableListActivity { private static final String arrGroupElements[] = { "Main","Pasta","Pizza", "Salads", "Sides", "Desserts", "Soups", "Beverages" }; /** 014 * strings for child elements 015 */ private static final String arrChildElements[][] = { { "Fish &amp; Chips","Lamb Chop", "Cajun Fish", "Chicken Chop"}, { "Spaghetti Bolognese ","Spaghetti Carbonara", "Spaghetti Aglio Olio" }, { "Hawaiian Pizza","Simply Cheese Pizza", "Classic Pepperoni" }, { "Chicken Salad","Potatoes Salad", "Greek Salad" }, { "Garlic Bread" ,"Criss Cross Fries", "Hot &amp; Sweet Wings" }, { "Banana Boat Ice Cream ","Strawberry Shortcake", "Chocolate Lava" }, { "Cream of Mushroom Soup","Chicken &amp; Veg Soup", "Tomato Soup" }, { "Coffee","Tea", "Juices" }, }; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.article_screen); setListAdapter(new ExpandableListAdapter(this)); } public class ExpandableListAdapter extends BaseExpandableListAdapter { private Context myContext; public ExpandableListAdapter(Context context) { myContext = context; } @Override public Object getChild(int groupPosition, int childPosition) { return null; } @Override public long getChildId(int groupPosition, int childPosition) { return 0; } @Override public View getChildView(int groupPosition, int childPosition, boolean isLastChild, View convertView, ViewGroup parent) { if (convertView == null) { LayoutInflater inflater = (LayoutInflater) myContext .getSystemService(Context.LAYOUT_INFLATER_SERVICE); convertView = inflater.inflate(R.layout.child_item_layout, null); } TextView yourSelection = (TextView) convertView .findViewById(R.id.articleConte…
has title: ExpandableListView child array elements to a new page with an Intent
tagged with: expandablelistview
tagged with: java
type: Question
answer count: 1

http://stackoverflow.com/comment/35710611
type: QuestionComment
comment on: http://stackoverflow.com/q/23323266
has text: @ErikAllik Does that have some effect on my problems?
score: 0
type: Comment

http://stackoverflow.com/a/23375110
score: 1
has body: You can simply use String.format(pattern,data) with pattern %02d % represents start of pattern 2 means that input should be written as at least two characters __ 0 but if input is shorter than two characters fill rest with 0 _a -> 0a d is short from digit which all means that digit passed digit should be written using two characters and in case there would be empty space (number is too short like 0, 1, 2 till 9) fill space before it with 0. More at Formatter documentation Demo: String formatted = String.format("%02d:%02d", 4,2); System.out.println(formatted); Output: 04:02
answers question: http://stackoverflow.com/q/23375049
upvote count: 1
type: Answer
downvote count: 0

http://stackoverflow.com/comment/35869245
score: 0
type: Comment
has text: @ ZouZou – What can I do to fix it?
comment on: http://stackoverflow.com/a/23409137
type: AnswerComment

http://stackoverflow.com/comment/35813341
has text: So that's what I thought. You can't do this before your num is not initialized, " private final int TOTALNUMS = nums.length; ". Put the assignment in the constructor.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23378802

http://stackoverflow.com/comment/35785338
type: Comment
type: QuestionComment
has text: @Hirak i want to print with sleep.thread()
score: 0
comment on: http://stackoverflow.com/q/23364083

http://stackoverflow.com/a/38364939
upvote count: 12
downvote count: 0
type: Answer
has body: Let me share a basic Logcat analysis for when you meet a Force Close (when the app stops working). DOCS The basic tool from Android to collect/analyze logs is the logcat. HERE is the Android's page about logcat If you use android Studio, you can also check this LINK. Capturing Basically, you can MANUALLY capture logcat with the following command (or just check AndroidMonitor window in AndroidStudio): adb logcat There's a lot of parameters you can add to the command which helps you to filter and display the message that you want... This is personal... I always use the command below to get the message timestamp: adb logcat -v time You can redirect the output to a file and analyze it in a Text Editor. Analyzing If you app is Crashing, you'll get something like: 07-09 08:29:13.474 21144-21144/com.example.khan.abc D/AndroidRuntime: Shutting down VM 07-09 08:29:13.475 21144-21144/com.example.khan.abc E/AndroidRuntime: FATAL EXCEPTION: main Process: com.example.khan.abc, PID: 21144 java.lang.NullPointerException: Attempt to invoke virtual method 'void android.support.v4.app.FragmentActivity.onBackPressed()' on a null object reference at com.example.khan.abc.AudioFragment$1.onClick(AudioFragment.java:125) at android.view.View.performClick(View.java:4848) at android.view.View$PerformClick.run(View.java:20262) at android.os.Handler.handleCallback(Handler.java:815) at android.os.Handler.dispatchMessage(Handler.java:104) at android.os.Looper.loop(Looper.java:194) at android.app.ActivityThread.main(ActivityThread.java:5631) 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:959) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:754) 07-09 08:29:15.195 21144-21144/com.example.khan.abc I/Process: Sending signal. PID: 21144 SIG: 9 This part of the log shows you a lot of information: When the issue happened: 07-09 08:29:13.475 It is important to c…
score: 12
answers question: http://stackoverflow.com/q/23353173

http://stackoverflow.com/comment/78559022
type: AnswerComment
comment on: http://stackoverflow.com/a/35191749
type: Comment
has text: I'd be happy to, but not sure if it was the sort of thing that was wanted in the light-weight HK2 package - it also pulls in another dependency that actually does the annotation scanning. It may be a bit until I find enough free cycles to put together a pull request.
score: 1

http://stackoverflow.com/a/23363426
type: Answer
answers question: http://stackoverflow.com/q/23359056
upvote count: 1
has body: You can get the property values in jsp by propertyplaceholder and using spring tag in jsp: In your context xml: &lt;!-- PropertyPlaceHolder --&gt; &lt;util:properties id="propertyConfigurer" location="WEB-INF/test/someProps.properties"/&gt; &lt;context:property-placeholder properties-ref="propertyConfigurer"/&gt; In your jsp: &lt;%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %&gt; ... &lt;spring:eval expression="@propertyConfigurer.getProperty('your.property1')" /&gt;
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/35809317
has comment: http://stackoverflow.com/comment/35809820

http://stackoverflow.com/a/23397025
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/35846885
downvote count: 0
answers question: http://stackoverflow.com/q/23396980
type: Answer
has body: Integer division will result in a zero value when the numerator is less than the denominator. You should declare percentage as a float or a double. int percentage; ... ... ... percentage = array[elements] / sum; and you will need to cast the division operation in your case to preserve the value: percentage = (double)array[elements] / sum;

http://stackoverflow.com/comment/35806353
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23374954
has text: I can post a example on using the HashSet and overriding equals() and hashcode() for your reference

http://stackoverflow.com/comment/36718126
comment on: http://stackoverflow.com/a/23517682
score: 0
type: AnswerComment
has text: This does violate that final rule unfortunately, otherwise it is a fantastic solution. Would there be a way to correct this issue?
type: Comment

http://stackoverflow.com/q/23438566
favorite count: 0
has comment: http://stackoverflow.com/comment/35925009
has title: Using private constructors for factory methods?
tagged with: immutability
downvote count: 0
tagged with: private-constructor
type: UnansweredQuestion
type: Question
score: 3
has answer: http://stackoverflow.com/a/23438623
tagged with: java
has body: Let's say I'm building an immutable Yahtzee scorecard class: public final class Scorecard { private Map&lt;Category, Integer&gt; scorecard = new HashMap&lt;Category, Integer&gt;(); public Scorecard() { // Instantiates a new empty scorecard } private Scorecard(Map&lt;Category, Integer&gt; scorecard) { this.scorecard = scorecard; } public Scorecard withScore(Category category, int[] roll) { newScorecard = new HashMap&lt;Category, Integer&gt;(scorecard); // Pretend that this is a deep-copy newScorecard.put(category, calculateScoreFromRoll(roll)); return new Scorecard(newScorecard); } public int getScore(Category category) { return scorecard.get(category); } } Basically I don't want to expose the internals of the class. If I didn't have a private constructor then I would need to use a public constructor with a Map argument just like the private one (and I could essentialy lose the withScore() method too) in order to allow scoring. But is this a valid way of doing factory methods?
has answer: http://stackoverflow.com/a/23438618
has comment: http://stackoverflow.com/comment/35941360
upvote count: 3
answer count: 2
has comment: http://stackoverflow.com/comment/35931230

http://stackoverflow.com/a/23293619
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/38786798
has comment: http://stackoverflow.com/comment/35657447
type: Answer
has comment: http://stackoverflow.com/comment/35657345
has comment: http://stackoverflow.com/comment/35657606
has body: No, as said, it is not safe. Being not safe, Android exposes a single thread model that ensures UI is not modified by different threads at the same time. It is done on purpose to avoid such issues. Yes I think it is okay, because it is another thread :) Also take a look at runOnUiThread()
has comment: http://stackoverflow.com/comment/35657726
has comment: http://stackoverflow.com/comment/35657570
has comment: http://stackoverflow.com/comment/35657482
answers question: http://stackoverflow.com/q/23293498
has comment: http://stackoverflow.com/comment/35656968
score: 0

http://stackoverflow.com/comment/35811788
comment on: http://stackoverflow.com/q/23367752
score: 0
has text: Yeap, you need to handle each one of them. Which one is being thrown right now? You can use a generic exception to discover.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35761035
type: Comment
type: QuestionComment
has text: Sergej as I said before, you first have to adapt your adapters constructor to accept one items array instead of three arrays. Only if that is ok you can implement a getFilter() method. Meanwhile you will have been reading this forum and have found todays post http://stackoverflow.com/questions/23339478/android-listview-with-custom-adapter-search-not-working There you see how the items array is called <Users> and how the class Users is declared. You have to do that also. Make your adapter first work (without filtering) in this way. You have to adapt a lot of code in the adapter but it is easy.
score: 0
comment on: http://stackoverflow.com/q/23341241

http://stackoverflow.com/a/23307370
score: 4
upvote count: 4
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/23307324
has body: Try this to add two weeks. long date = System.currentTimeMillis() + 14 * 24 * 3600 * 1000; Date newDate = new Date(date);

http://stackoverflow.com/q/23413131
downvote count: 0
possible better answer: http://stackoverflow.com/a/23413168
favorite count: 0
has answer: http://stackoverflow.com/a/23413168
accepted answer: http://stackoverflow.com/a/23413159
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
type: Question
has body: I am learning java. I am getting a lot of errors when I try to keep the methods, which I am trying to invoke, inside the main method. I am trying to declare a couple of variables x,y. However, I want to invoke the math operations when specific methods are called, such as addMethod, subtractMethod, so on. When I try to include the methods within the public method, I am getting an error. package exampleclass; public class MathLearning { //declaring variables static int x = 9; static int y = 2; public static void main(String[] args) { int resu=0; additMethod(resu); subtMethod(resu); multMethod(resu); divMethod(resu); private static void divMethod(int resu) { resu = x+y; System.out.println(resu); } private static void multMethod(int resu) { resu = x-y; System.out.println(resu); } private static void subtMethod(int resu) { resu = x*y; System.out.println(resu); } private static void additMethod(int resu) { resu = x/y; System.out.println(resu); } } } When I keep the methods outside the main method, I do not get an error. package exampleclass; public class MathLearning { //declaring variables static int x = 9; static int y = 2; public static void main(String[] args) { int resu=0; additMethod(resu); subtMethod(resu); multMethod(resu); divMethod(resu); } private static void divMethod(int resu) { resu = x+y; System.out.println(resu); } private static void multMethod(int resu) { resu = x-y; System.out.println(resu); } private static void subtMethod(int resu) { resu = x*y; System.out.println(resu); } private static void additMethod(int resu) { resu = x/y; System.out.println(resu); } }
has comment: http://stackoverflow.com/comment/35876857
has comment: http://stackoverflow.com/comment/35876928
has title: error while calling a java Method
answer count: 2
has answer: http://stackoverflow.com/a/23413159

http://stackoverflow.com/comment/35892583
type: Comment
comment on: http://stackoverflow.com/q/23420954
score: 0
type: QuestionComment
has text: the following is the server log:

http://stackoverflow.com/q/23330200
has title: Cannot find symbol: KeyStore.TrustedCertificateEntry
tagged with: x509
type: Question
has comment: http://stackoverflow.com/comment/35723825
tagged with: java
has answer: http://stackoverflow.com/a/23330635
accepted answer: http://stackoverflow.com/a/23330635
has answer: http://stackoverflow.com/a/23330496
has body: I'm trying to load the trusted certificates on a OS X/Java 7 system. According to Java's Class KeyStore, there is a KeyStore.TrustedCertificateEntry type. The following code: KeyStore ks = KeyStore.getInstance(KeyStore.TrustedCertificateEntry); Produces the following error: HttpsCiphers.java:34: error: cannot find symbol KeyStore ks = KeyStore.getInstance(KeyStore.TrustedCertificateEntry); ^ symbol: variable TrustedCertificateEntry location: class KeyStore I'm importing both KeyStore and TrustedCertificateEntry. How does one utilize TrustedCertificateEntry or load the trusted certificate store? $ java -version java version "1.7.0_07" Java(TM) SE Runtime Environment (build 1.7.0_07-b10) Java HotSpot(TM) 64-Bit Server VM (build 23.3-b01, mixed mode) $ system_profiler SPSoftwareDataType Software: System Software Overview: System Version: OS X 10.8.5 (12F45) Kernel Version: Darwin 12.5.0 ...
has comment: http://stackoverflow.com/comment/35724253
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/35724150
tagged with: keystore
has comment: http://stackoverflow.com/comment/35724203
possible better answer: http://stackoverflow.com/a/23330496
type: AnsweredQuestion

http://stackoverflow.com/comment/35945223
type: Comment
has text: I think you have the concept of inheritance confused... you don't use inheritance unless there's a logical reason for doing it. Also you don't instantiate an employee they way you set it up... if you wanna use a scanner and input info you should do it in the main program fx and simply set the field values with it there after creating the employee object.
comment on: http://stackoverflow.com/q/23449685
score: 0
type: QuestionComment

http://stackoverflow.com/a/23435450
accepted answer of: http://stackoverflow.com/q/23398637
has body: I solved the issue...kind of...by creating my own custom TcpConnector, TcpMessageDispatcher, and TcpMessageDispatcherFactory classes, as per Ian Gil Ragudo's suggestion And here is how I define my connector: &lt;spring:bean id="dispatcherFactory" class="com.mycompany.mule.tcp.MyTcpMessageDispatcherFactory"/&gt; &lt;spring:bean id="protocol" class="org.mule.transport.tcp.protocols.DirectProtocol"/&gt; &lt;custom-connector name="myTcpConn" class="com.mycompany.mule.tcp.MyTcpConnector" &gt; &lt;spring:property name="dispatcherFactory" ref="dispatcherFactory" /&gt; &lt;spring:property name="tcpProtocol" ref="protocol"/&gt; &lt;spring:property name="keepAlive" value="true"/&gt; &lt;spring:property name="keepSendSocketOpen" value="true"/&gt; &lt;spring:property name="reuseAddress" value="true"/&gt; &lt;/custom-connector&gt; &lt;tcp:endpoint connector-ref="myTcpConn" exchange-pattern="one-way" host="0.0.0.0" port="8081" name="TcpEndpoint" responseTimeout="10000" doc:name="TCP"/&gt; Unfortunately because of the visibility of the methods and instance variables, I had to resolve to copy+pasta the classes, update the casts, and only edited this bit in the MyTcpMessageDispatcher class: @Override protected synchronized void doDispatch(MuleEvent event) throws Exception { Socket socket = connector.getSocket(endpoint); try { dispatchToSocket(socket, event); } catch (SocketException e) { System.err.println(e.toString()); socket.close(); throw e; } finally { connector.releaseSocket(socket, endpoint); } } Known issue: When the external application to which the outbound endpoint goes down, and then comes back up, I seems to lose one message, even with transactions configured. It seems that it still successfully writes to the socket one last time before throwing socket write exceptions.
answers question: http://stackoverflow.com/q/23398637
type: AcceptedAnswer
score: 0
type: Answer

http://stackoverflow.com/comment/35843134
comment on: http://stackoverflow.com/a/23348098
score: 0
type: AnswerComment
has text: @user3451524 you ask for con 1 and do not close it, then you ask for con 2, so con 1 and 2 are open at the same time, the DB thinks you are doing two different things / there are tow clients
type: Comment

http://stackoverflow.com/a/23377370
has comment: http://stackoverflow.com/comment/35810857
accepted answer of: http://stackoverflow.com/q/23374955
upvote count: 2
answers question: http://stackoverflow.com/q/23374955
type: AcceptedAnswer
downvote count: 0
has body: I am really not sure about that but you should try to attach the Context, which in a Fragment is the parent activity: adapter = new BaseInflaterAdapter&lt;CardItemDataMultiple&gt;(getActivity(), new CardInflaterMultiple()); Then, receive this context with something as follows: public class BaseInflaterAdapter&lt;T&gt; extends BaseAdapter { private Context m_context; private List&lt;T&gt; m_items = new ArrayList&lt;T&gt;(); private IAdapterViewInflater&lt;T&gt; m_viewInflater; public BaseInflaterAdapter(Context context, IAdapterViewInflater&lt;T&gt; viewInflater) { m_context = context; m_viewInflater = viewInflater; } public BaseInflaterAdapter(Context context, List&lt;T&gt; items, IAdapterViewInflater&lt;T&gt; viewInflater) { m_context = context; m_items.addAll(items); m_viewInflater = viewInflater; } // other stuff... @Override public View getView(int pos, View convertView, ViewGroup parent) { return m_viewInflater != null ? m_viewInflater.inflate(m_context, pos, convertView, parent) : null; } }
type: Answer
score: 2

http://stackoverflow.com/q/23356006
has comment: http://stackoverflow.com/comment/35771019
downvote count: 3
has body: I am currently learning Java and I have a tricky question that I couldn't answer... So I started developping a Shopping cart with the possibility to add and remove items, but then came to my mind what if intead of removing the item itself I ask to remove the item created the same way? Explaination : ShoppingCart cart = new ShoppingCart(); Item.item = new Item("corn flakes", 500); cart.addItem(item); cart.removeItem(new Item("corn flakes", 500)); System.out.println(cart.itemCount()); // Supposed to display 0 Well here if I execute the code, it will display "1" instead of "0". The question is how do I get this to work? Here's the code of ShoppingCart ` public class ShoppingCart { List items; public ShoppingCart() { this.items = new ArrayList&lt;Item&gt;(); } public void addItem(Item item) { this.items.add(item); } public void removeItem(Item item) { this.items.remove(item); } public int itemCount() { return this.items.size(); } public int totalPrice() { int sum = 0; for(Item item : items) sum += item.getPrice(); return sum; } } ` Thanks :)
has comment: http://stackoverflow.com/comment/35770998
type: Question
has answer: http://stackoverflow.com/a/23356047
has title: Remove object in List based on content
has comment: http://stackoverflow.com/comment/35770980
answer count: 2
upvote count: 0
possible better answer: http://stackoverflow.com/a/23356157
has comment: http://stackoverflow.com/comment/35770960
has answer: http://stackoverflow.com/a/23356157
accepted answer: http://stackoverflow.com/a/23356047
favorite count: 0
has comment: http://stackoverflow.com/comment/35770996
has comment: http://stackoverflow.com/comment/35771027
has comment: http://stackoverflow.com/comment/35770990
score: -3
type: AnsweredQuestion
tagged with: list
tagged with: java

http://stackoverflow.com/comment/35912041
type: QuestionComment
has text: I managed to successfully launch it by complete fluke, I opted to use process builder, and the actual path of the ps1 file needed to be in quotations, which mine wasn't. I also used 'p.getOutputStream().close();' as the problem seemed to be that powershell first reads all input from it's input stream before continuing. I wanted to run it as a background process so it wasnt essential that powershell was displayed. Tried your solution which also worked so great for anyone else looking at this !
comment on: http://stackoverflow.com/q/23428253
score: 0
type: Comment

http://stackoverflow.com/comment/35894331
score: 0
has text: @MadProgrammer can u help me for the same?
type: Comment
comment on: http://stackoverflow.com/q/23421952
type: QuestionComment

http://stackoverflow.com/a/23442524
upvote count: 1
score: 1
has body: H2 works out of the box. Just create a new project in the terminal. Otherwise, to your listing: I think you should change db.default.url="jdbc:h2:databases/test" to db.default.url="jdbc:h2:mem:play" don't need to create lib directories. It's all handeled by the build in dependency mgmt sbt Just use the model objects and call save/update. No need to call start/shutdown you are in a framework, it's all there ready for you... I think you should start reading the documentation from the beginning to the end and examine the example applications. It's all there what you are looking for.
has comment: http://stackoverflow.com/comment/35946410
has comment: http://stackoverflow.com/comment/35961232
has comment: http://stackoverflow.com/comment/35948339
answers question: http://stackoverflow.com/q/23434988
has comment: http://stackoverflow.com/comment/35932580
downvote count: 0
has comment: http://stackoverflow.com/comment/35938598
type: Answer

http://stackoverflow.com/q/23331137
tagged with: java
type: Question
answer count: 1
has answer: http://stackoverflow.com/a/23509390
accepted answer: http://stackoverflow.com/a/23509390
score: 0
tagged with: text
has title: LWJGL Text cusotom rendering crashing with EXCEPTION_ACCESS_VIOLATION
tagged with: lwjgl
type: AnsweredQuestion
has body: So I was writing my own font/text renderer for an LWJGL code, but It has these weird lag spikes when running and the letters randomly change into another letter before reverting to what it was before, does anyone know what is wrong with my code. public class RenderFont extends EntityBase{ String text; String Font; String filename; Texture string[] = new Texture[200]; int TextureStringLen = 0; public RenderFont(int x, int y, int size, String text, String font) { super(x, y, size, size*2, null); this.Text=text; this.Font=font; this.GenerateTextureArray(); } public RenderFont(int x, int y, int size,String text) { super(x, y, size, size*2, null); this.Text=text; this.Font="default"; this.GenerateTextureArray(); } public void GenerateTextureArray(){ this.TextureStringLen=0; for(int i = 0; i&lt;this.Text.length(); i++){ if(Character.isUpperCase(this.Text.substring(i,i+1).charAt(0))){ this.filename = "uppercase/"+Text.substring(i,i+1); }else{ if(Character.isLowerCase(this.Text.substring(i, i+1).charAt(0))){ this.filename = "lowercase/" + Text.substring(i,i+1); }else{ this.filename = "other/" + Text.substring(i, i+1); } } if(this.Text.substring(i,i+1).equals(":")){ this.filename = "other/colon"; } try { this.string[i] = AssortedTools.GetTextureError(this.Font+"/"+this.filename); } catch (IOException e) { this.string[i] = AssortedTools.GetTexture("null"); } this.TextureStringLen+=1; } } @Override public void Draw(){ for(int i = 0; i&lt;this.TextureStringLen; i++){ this.string[i].bind(); glBegin(GL_QUADS); glTexCoord2f(0,0); glVertex2d(this.topleftx+(i*this.Width*0.7),this.toplefty); glTexCoord2f(1,0); glVertex2d(this.toprightx+(i*this.Width*0.7),this.toprighty); glTexCoord2f(1,1); glVertex2d(this.bottomleftx+(i*this.Width*0.7),this.bottomlefty); glTexCoord2f(0,1); glVertex2d(this.bottomrightx+(i*this.Width*0.7),this.bottomrighty); glEnd(); } } public void SetText(String str){ this.Text = str; this.GenerateTextureArray(); } public String GetText(){ return this.Text; } public …
tagged with: rendering

http://stackoverflow.com/q/23431387
has comment: http://stackoverflow.com/comment/35914006
type: Question
has comment: http://stackoverflow.com/comment/35912127
has body: First off, this is my first Android/Java sockets project! Take a look at the method below. My goal is to receive multi-line text (actually xml in a wrapper) from a socket connection. I am trying to read each line and concatenate it to a string and pass it back to the messageReceived method for further processing. The reading and concatenation is working just fine however the code never executes beyond the s = mBufferIn.readLine() while loop? If I set a breakpoint on the conditional testing the value of mServerMessage, it never gets this far, even though mServerMessage contains everything that has been sent from the server. If I remove the while loop and set the value of mServerMessage to that of mBufferIn.readLine(), each line is sent to the UI thread successfully but I need to have the entire packet sent to the messageReceived method at once. What must I do to get this corrected? Update I have modified the while loop in the run() method to check for the end of the message as per the suggestion below. This is working as it should as the concatenation stops when the ETX char is found in the message however the IF conditional is never executed. Could this have something to do with the AsyncTask? I have posted my ConnectTask class that resides within the MainActivity task as this is how I am connecting to the socket. MainActivity public class ConnectTask extends AsyncTask&lt;String, String, TcpClient&gt; { @Override protected TcpClient doInBackground(String... message) { mTcpClient = new TcpClient(new TcpClient.OnMessageReceived() { @Override //implement the messageReceived method public void messageReceived(String message) { //this method calls the onProgressUpdate publishProgress(message); } }); mTcpClient.run(); return null; } @Override protected void onProgressUpdate(String... values) { super.onProgressUpdate(values); //do something with received message } } TcpClient Class public void run() { mRun = true; try { InetAddress serverAddr = InetAddress.getByName(SERVER…
tagged with: android
has comment: http://stackoverflow.com/comment/35910911
has comment: http://stackoverflow.com/comment/35911158
tagged with: sockets
answer count: 1
has title: Concatenate String from BufferedReader and Pass to UI Thread
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/23431615
type: UnansweredQuestion

http://stackoverflow.com/comment/35684522
score: 0
type: Comment
type: QuestionComment
has text: before editing it was like this(127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6) now I have edited with this (127.0.0.1 localhost static.98.35.ebonenet.com) and its running.. thanks.
comment on: http://stackoverflow.com/q/23307260

http://stackoverflow.com/q/23430819
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/35909812
tagged with: string
has comment: http://stackoverflow.com/comment/35909702
linked to: http://stackoverflow.com/q/16729045
has comment: http://stackoverflow.com/comment/35909613
linked to: http://stackoverflow.com/q/513832
has body: public class Foo { public static void main(String[] args) { foo(); bar(); } public static void foo() { String s = "str4"; String s1 = "str" + s.length(); System.out.println("(s==s1)" + (s1 == s)); } public static void bar() { String s = "str4"; String s1 = "str" + "4"; System.out.println("(s==s1)" + (s1 == s)); } } OUTPUT (s==s1)false (s==s1)true At String s1 = "str" + s.length(); the value of s1=str4 but it turns out to be false at next sysout statement during double equal (==) check */
has title: At String s1 = "str" + s.length(); the value of s1=str4 but it turns out to be false at next sysout statement during equality check
favorite count: 0
has comment: http://stackoverflow.com/comment/35909865
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35909601
type: Question
has comment: http://stackoverflow.com/comment/35909861
has answer: http://stackoverflow.com/a/23430838
has comment: http://stackoverflow.com/comment/35909799
upvote count: 5
tagged with: java
has comment: http://stackoverflow.com/comment/35909649
linked to: http://stackoverflow.com/q/16771122
has comment: http://stackoverflow.com/comment/35909745
score: 5

http://stackoverflow.com/q/23325129
tagged with: thread-safety
tagged with: forkjoinpool
tagged with: concurrency
score: 0
has answer: http://stackoverflow.com/a/23325182
answer count: 1
has title: Threadsafe within a thread?
type: UnansweredQuestion
tagged with: multithreading
has comment: http://stackoverflow.com/comment/35714116
has comment: http://stackoverflow.com/comment/35714071
type: Question
has body: I'm writing a program, in Java, to simulate a molecular algorithm. As the molecular algorithm inherently uses concurrency (you can have as many chemical reactions going as needed, as long as you have the chemicals and concentrations to supply them), it requires me to use concurrency. However, I recently found out that the package I was using for my graph structures is not threadsafe. I have an ArrayList of graphs set up for each thread. During computation, a thread modifies its own ArrayList and some of the graphs within it, but I have no code allowing one thread to modify the ArrayList or graphs of any other thread, until it recieves the two ArrayLists from its child threads. To accomplish this, I'm using ForkJoinPool (My understanding of this is, and please correct me if I'm wrong, is that it divides the task up among two threads which divide the task up among two threads... When the calculations are done in the leaf threads, they return up to their parent thread, and so on, until the roots children return up to it, and the root, if ForkJoinTask, returns the result). Needless to say, the notable exception to what I want happening is worksteeling. My question, therefore is, if, with the exceptions of worksteeling and a child thread returning to a parent thread, if no threads interact with any other threads, can a nonthreadsafe object be used in a concurrent application?
has comment: http://stackoverflow.com/comment/35789926
has comment: http://stackoverflow.com/comment/35714094
tagged with: java

regex
tags question: http://stackoverflow.com/q/23412070
tags question: http://stackoverflow.com/q/23314029
tags question: http://stackoverflow.com/q/23417609
tags question: http://stackoverflow.com/q/23345209
tags question: http://stackoverflow.com/q/23350997
tags question: http://stackoverflow.com/q/23435888
tags question: http://stackoverflow.com/q/23373739
tag name: regex
tags question: http://stackoverflow.com/q/23447936
tags question: http://stackoverflow.com/q/23300821
tags question: http://stackoverflow.com/q/23326261
tags question: http://stackoverflow.com/q/23331359
tags question: http://stackoverflow.com/q/23325800
tags question: http://stackoverflow.com/q/23343488
tags question: http://stackoverflow.com/q/23319894
tags question: http://stackoverflow.com/q/23436501
tags question: http://stackoverflow.com/q/23353671
tags question: http://stackoverflow.com/q/23300265
tags question: http://stackoverflow.com/q/23339665
tags question: http://stackoverflow.com/q/23347107
tags question: http://stackoverflow.com/q/23385407
tags question: http://stackoverflow.com/q/23312339
tags question: http://stackoverflow.com/q/23432040
tags question: http://stackoverflow.com/q/23350759
tags question: http://stackoverflow.com/q/23436943
tags question: http://stackoverflow.com/q/23385880
tags question: http://stackoverflow.com/q/23403386
tags question: http://stackoverflow.com/q/23387722
tags question: http://stackoverflow.com/q/23377325
tags question: http://stackoverflow.com/q/23357446
tags question: http://stackoverflow.com/q/23429330
tags question: http://stackoverflow.com/q/23362799
tags question: http://stackoverflow.com/q/23374131
tags question: http://stackoverflow.com/q/23396344
tags question: http://stackoverflow.com/q/23370278
tags question: http://stackoverflow.com/q/23314692
tags question: http://stackoverflow.com/q/23384013
tags question: http://stackoverflow.com/q/23380715
tags question: http://stackoverflow.com/q/23307486
tags question: http://stackoverflow.com/q/23317740
tags question: http://stackoverflow.com/q/23319224
tags question: http://stackoverflow.com/q/23332146
tags question: http://stackoverflow.com/q/23414259
tags question: http://stackoverflow.com/q/23365967
tags question: http://stackoverflow.com/q/23369697
tags question: http://stackoverflow.com/q/23424023
tags question: http://stackoverflow.com/q/23310056
tags question: http://stackoverflow.com/q/23366586
tags question: http://stackoverflow.com/q/23365491
tags question: http://stackoverflow.com/q/23390612
tags question: http://stackoverflow.com/q/23351009
tags question: http://stackoverflow.com/q/23435430
tags question: http://stackoverflow.com/q/23380918
tags question: http://stackoverflow.com/q/23310408
tags question: http://stackoverflow.com/q/23427540
tags question: http://stackoverflow.com/q/23351926
tags question: http://stackoverflow.com/q/23390436
tags question: http://stackoverflow.com/q/23447256
tags question: http://stackoverflow.com/q/23365251
tags question: http://stackoverflow.com/q/23332760
tags question: http://stackoverflow.com/q/23320116
tags question: http://stackoverflow.com/q/23346119
tags question: http://stackoverflow.com/q/23448720
tags question: http://stackoverflow.com/q/23381248
type: Tag
tags question: http://stackoverflow.com/q/23420963
tags question: http://stackoverflow.com/q/23428821
tags question: http://stackoverflow.com/q/23449368

http://stackoverflow.com/comment/35823225
has text: what is Driver.getInstance()? because i get the error:`Driver cannot be resolved`.it is not from something i didn't import.
type: AnswerComment
comment on: http://stackoverflow.com/a/23384358
score: 0
type: Comment

http://stackoverflow.com/q/23354067
tagged with: java
type: Question
tagged with: jakarta-ee
tagged with: ejb
has body: I have a Java EE project that instantiates an instance of an object from a dependent project. That dependent project now wants to create and inject its own EJB into one of its classes. The dependent project doesn't reference the parent project, but should run inside of the parent project's container. When I deploy the parent project, I see the message in the log that my service bean has been discovered along with the rest of the beans in the parent project: 2014-04-28T21:30:56.240-0400|INFO: EJB5181:Portable JNDI names for EJB DependentProjectServiceBean etc. But then when I try to inject that bean in the dependent project using the @EJB annotation, nothing happens (it's just left as null). I've been trying to figure out how to configure these projects properly so that I can use EJB and JPA in the dependent project, but I feel like I don't know the right search terms, since none of the things I find seem like they address this issue. I'm including the same Maven dependencies in the dependent project as I do in the parent project, and Eclipse seems cool with the annotations; they just don't seem to DO anything once deployed. How do I enable EJB and JPA in my dependency project? Edit: Here is a rough outline of the code I'm working with. Parent public class ParentProjectClass { @EJB ParentServiceBean psb; public void cat(){ psb.doStuff(); //no problems SomeDependentClass sdc = new SomeDependentClass(); sdc.baz(); } } Dependent Project public class SomeDependentClass { private AnotherDependentClass adc; public SomeDependentClass(){ adc = new AnotherDependentClass(); } public void baz(){ adc.foo(); } } public class AnotherDependentClass { @EJB DependentProjectServiceBean dpsb; foo(){ dpsb.bar(); //NULL POINTER EXCEPTION } } @Stateless public class DependentProjectServiceBean { public void bar(){ //bar } }
tagged with: glassfish
accepted answer: http://stackoverflow.com/a/23362469
has title: How do I enable EJB injection in dependent projects
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/23362469
tagged with: maven
type: AnsweredQuestion

http://stackoverflow.com/q/23441531
has comment: http://stackoverflow.com/comment/35929873
score: 0
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/14998726
has comment: http://stackoverflow.com/comment/35929810
tagged with: http://stackoverflow.com/tag/html
answer count: 1
has answer: http://stackoverflow.com/a/23441644
has title: I am trying to parse the html from a website, but some of the data stored in a table is not showing up
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35929786
has body: I am trying to get the html code from the website: http://www.phila.gov/water/swmap/Parcel.aspx?parcel_id=544393 using the following code: public class URLGetter { private URL url; private HttpURLConnection connection; public URLGetter(String url) throws MalformedURLException { try { this.url = new URL(url); URLConnection connection2 = this.url.openConnection(); connection = (HttpURLConnection) connection2; } catch (IOException E) { } } public ArrayList&lt;String&gt; getContents() { ArrayList&lt;String&gt; contents = new ArrayList&lt;String&gt;(); try { Scanner in = new Scanner(connection.getInputStream()); while (in.hasNextLine()) { contents.add(in.nextLine()); } } catch (Exception e) { } return contents; } } Using the very simple testing method: public class URLTester { public static void main(String[] args) throws MalformedURLException { URLGetter get = new URLGetter("http://www.phila.gov/water/swmap/Parcel.aspx?parcel_id=544393/print/textversion.html"); ArrayList&lt;String&gt; list = get.getContents(); for(String s : list){ System.out.println(s); } } } I print the html. All of it goes smoothly, except for printing out the data in the tables (inside of the ) brackets. Instead of the various values which should be appearing, for example PERUTO ANGELO CHARLES III, every single value has inside of it &amp;nbsp. I really don't know why it does this. Looking over the textthat I get by doing this, nothing else is wrong. edit: I've used this code on other websites and always been able to get the information I need. From this site I get all the information I need, except for the table values.

http://stackoverflow.com/comment/35760358
type: AnswerComment
comment on: http://stackoverflow.com/a/23350107
type: Comment
has text: Blast! Back to the drawing board.
score: 0

http://stackoverflow.com/comment/35845293
type: Comment
comment on: http://stackoverflow.com/a/23390714
score: 0
type: AnswerComment
has text: I mean a remote CI server. Team City at least, and some others I believe, can perform a remote build. I'm not an expert on the feature, but I believe that IntelliJ ships your changes to team city without a check in, and it then does the build and test for you, performing a commit if everything works. Check out the support page on the subject for more info: http://confluence.jetbrains.com/display/TCD7/Pre-Tested+%28Delayed%29+Commit

http://stackoverflow.com/a/23419217
upvote count: 5
has comment: http://stackoverflow.com/comment/35888723
has comment: http://stackoverflow.com/comment/35888649
downvote count: 0
has comment: http://stackoverflow.com/comment/35888817
answers question: http://stackoverflow.com/q/23419192
type: Answer
has body: You can't call findViewById() until you've called setContentView().
has comment: http://stackoverflow.com/comment/35888829
score: 5

http://stackoverflow.com/q/23310617
tagged with: jpa
downvote count: 0
has body: At Hibernate 4.3 Ejb3Configuration class was removed. This class was commonly used for creating hibernate configuration file from a persistence unit (persistence.xml file) to SchemaExport tool. As a simple alternative to export schema to .sql file I'm using the following code: public static void export(String persistenceUnit, String exportFileName) { Map&lt;String, String&gt; hash = new HashMap&lt;String, String&gt;(); hash.put("hibernate.hbm2ddl.auto", "create-drop"); EntityManagerFactory factory = Persistence.createEntityManagerFactory( persistenceUnit, hash); org.hibernate.jpa.internal.EntityManagerFactoryImpl hibFactory = (org.hibernate.jpa.internal.EntityManagerFactoryImpl) factory; SessionFactoryImpl hibSessionFactory = hibFactory.getSessionFactory(); SchemaExport schema = ReflectUtils.getPrivateFieldValue( hibSessionFactory, "schemaExport"); schema.setOutputFile(exportFileName); schema.setFormat(false); schema.setDelimiter(";"); schema.drop(true, false); schema.create(true, false); } At this piece of code, i'm basically using schemaexport object created by HibernateSessionFactoryImpl. The drawback is that every time it´s executed the database schema is recreated. Is there any other simple way to use SchemaExporTool with Hibernate 4.3 and JPA? It seems that the real question is how to create Hibernate Configuration Object from a persistenceunit?
score: 4
has comment: http://stackoverflow.com/comment/62110554
answer count: 1
has answer: http://stackoverflow.com/a/24905475
favorite count: 0
tagged with: hibernate-4.x
type: UnansweredQuestion
has title: How to use SchemaExportTool with JPA and Hibernate 4.3
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/62108930
linked to: http://stackoverflow.com/q/22733631
type: Question
upvote count: 4

http://stackoverflow.com/q/23307914
has comment: http://stackoverflow.com/comment/35682724
tagged with: eclipse
tagged with: servlets
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: tomcat
favorite count: 0
has answer: http://stackoverflow.com/a/23308025
type: Question
has body: I made a servlet app in Eclipse with tomcat 6. I send some info from a form to a servlet. I get the error - Firefox can't find the file at /C:/workspace-jee/Beer-v1/WebContent/html/SelectBeer.do. How do I fix this problem ? Related info is given below. Please tell me if you need more info. HTML page - Insert title here Beer Selection Page Select beer characteristics Color: light amber brown dark Web.xml - <?xml version="1.0" encoding="UTF-8"?> Beer-v1 index.html index.htm index.jsp default.html default.htm default.jsp BeerSelect BeerSelect com.example.web.BeerSelect BeerSelect /SelectBeer.do Servlet BeerSelect actually exists and has correct code. Tomcat startup logs - I guess they call this catalina or something. Apr 27, 2014 10:00:00 AM org.apache.catalina.core.AprLifecycleListener init INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jre7\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;....more paths here. Apr 27, 2014 10:00:00 AM org.apache.coyote.http11.Http11Protocol init INFO: Initializing Coyote HTTP/1.1 on http-8080 Apr 27, 2014 10:00:00 AM org.apache.catalina.startup.Catalina load INFO: Initialization processed in 878 ms Apr 27, 2014 10:00:00 AM org.apache.catalina.core.StandardService start INFO: Starting service Catalina Apr 27, 2014 10:00:00 AM org.apache.catalina.core.StandardEngine start INFO: Starting Servlet Engine: Apache Tomcat/6.0.39 Apr 27, 2014 10:00:00 AM org.apache.coyote.http11.Http11Protocol start INFO: Starting Coyote HTTP/1.1 on http-8080 Apr 27, 2014 10:00:00 AM org.apache.jk.common.ChannelSocket init INFO: JK: ajp13 listening on /0.0.0.0:8009 Apr 27, 2014 10:00:00 AM org.apache.jk.server.JkMain start INFO: Jk running ID=0 time=0/32 config=null Apr 27, 2014 10:00:00 AM org.apache.catalina.startup.Catalina start INFO: Server startup in 532 ms EDIT - My project structure inside eclipse jee:
has title: Servlet example - File not found
tagged with: java
upvote count: 1
answer count: 1
accepted answer: http://stackoverflow.com/a/23308025
has comment: http://stackoverflow.com/comment/35682752

http://stackoverflow.com/a/23422144
downvote count: 0
has comment: http://stackoverflow.com/comment/36058479
has comment: http://stackoverflow.com/comment/36058604
has comment: http://stackoverflow.com/comment/36139496
upvote count: 2
has body: Yes, this does work. I used the same way for an android application of mine. You can just use Object-Input/Output-Streams. Unfortunately, i cannot provide any code atm, because I am at work, and the code is on my home pc ;) I will update this post later on and provide you an example =) So finally I found some time for this: This is the code on the server side. It receives a login String, and returns a boolean value and a String: @POST @Path("/login/{id}") @Consumes("application/xml") public StreamingOutput login(@PathParam("id") int id, InputStream is) { String login[] = null; ObjectInputStream ois = null; try { ois = new ObjectInputStream(is); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } try { login = (String[]) ois.readObject(); } catch (ClassNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } this.login[0] = login[0]; this.login[1] = login[1]; return new StreamingOutput() { public void write(OutputStream outputStream) throws IOException, WebApplicationException { login(outputStream); } }; } public void login(OutputStream os) { boolean result = false; connect(); ResultSet rs = null; try { PreparedStatement ps = dbconn .prepareStatement("Select password from supervisor where username = '" + login[0] + "'"); rs = ps.executeQuery(); rs.next(); String password = rs.getString("password"); login[0] = password; if (login[1].equals(password)) { result = true; } } catch (SQLException e) { login[0] = e.toString(); } try { ObjectOutputStream oos = new ObjectOutputStream(os); oos.writeObject(result); oos.writeObject(login); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } Now this is the code I wrote for my device: ObjectOutputStream oos = null; String[] login = { "xxxxxxxx", "xxxxxxxx" }; URL url = new URL( "http://xxxxxxx.xxxxxxxxx.xxxxxxxxxxx.com/xxxxx/login/1"); try { // creates a HTTP co…
accepted answer of: http://stackoverflow.com/q/23421967
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23421967
has comment: http://stackoverflow.com/comment/36139579
has comment: http://stackoverflow.com/comment/36140793
has comment: http://stackoverflow.com/comment/36139727
has comment: http://stackoverflow.com/comment/36071653
has comment: http://stackoverflow.com/comment/36139397
has comment: http://stackoverflow.com/comment/36104684
type: Answer
has comment: http://stackoverflow.com/comment/35893965
has comment: http://stackoverflow.com/comment/36139498
score: 2

http://stackoverflow.com/comment/35901113
comment on: http://stackoverflow.com/q/23426040
has text: Your while loop compares 'diceCounter' to 'numberOfDice' but you are incrementing a variable called 'dicecounter' so the conditions of the while comparrison don't change and presumably it never finishes.
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/23397050
has answer: http://stackoverflow.com/a/23397109
downvote count: 2
has title: Combine 2 "System.out.format" statements into 1
has body: How to combine following System.out.format statements into 1, so that it prints: 1a. Longest string: 'sentence', Size: '8' My code: System.out.format("1a. Longest string: '%s'",longestString); System.out.format(", Size: '%s'%n",tokens.length); Thank you.
upvote count: 1
type: AnsweredQuestion
tagged with: format
tagged with: java
accepted answer: http://stackoverflow.com/a/23397109
has answer: http://stackoverflow.com/a/23397096
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/23397096
score: -1
favorite count: 0

http://stackoverflow.com/comment/35855341
comment on: http://stackoverflow.com/q/23401644
type: Comment
type: QuestionComment
has text: Hah, OK, I assumed that was a typo. Yeah, casting `float` to `float` does nothing.
score: 2

http://stackoverflow.com/a/23406334
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/23406207
answers question: http://stackoverflow.com/q/23406207
has body: remove the else of line 10. fileToDel.delete() must be executed anycase.
score: 4
upvote count: 4

http://stackoverflow.com/comment/35871032
has text: Yes, I'm familiar with this solution. Actually this question was just raised in a tech-talk in which I explained about `@Configuration` and that's the answer I gave. But I wonder if there's a way to do it with a simple `if`. There's something in profiles that people don't like usually. It's less clear.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23409932

http://stackoverflow.com/comment/35694360
comment on: http://stackoverflow.com/a/23314241
type: Comment
has text: ohhh!!!!!what ur suggesting is,i use another variable or the 'this' keyword??
type: AnswerComment
score: 0

http://stackoverflow.com/q/23389931
score: 0
tagged with: client-server
has comment: http://stackoverflow.com/comment/35833286
has answer: http://stackoverflow.com/a/23390491
answer count: 1
has comment: http://stackoverflow.com/comment/35833057
tagged with: sockets
linked to: http://stackoverflow.com/q/10131377
has comment: http://stackoverflow.com/comment/35833289
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35833266
has body: I create a simple game with high scores..I have a simple txt file of all the scores. Now I need that this file will be shared on the server side, if I understand it well. I found this solution Multipe client to one server but cant realy understand what I need to do.
type: Question
tagged with: java
has title: Multipe client to one server, Java

http://stackoverflow.com/comment/38432870
score: 0
type: Comment
has text: Either longs or Strings let you set the value beforehand. In that case, it is up to you to ensure uniqueness. However, only Long IDs let you leave the value null, which will then cause AppEngine to auto-generate it on first save. You can't have a String ID that you leave null - app-engine will throw an error when you try to save. Thus, the difference IS that AppEngine will only auto-generate Long IDs, not Strings (and by definition, "auto-generate" means the system does it for you, not the programmer).
type: AnswerComment
comment on: http://stackoverflow.com/a/23330392

http://stackoverflow.com/comment/35949234
type: Comment
comment on: http://stackoverflow.com/a/23451675
score: 0
type: AnswerComment
has text: java programming from problem analysis to program design

http://stackoverflow.com/comment/36045385
type: Comment
comment on: http://stackoverflow.com/a/23451783
has text: I doubt there will be any additional built-in support. Doing manual referencing is pretty straight forward, and it would be hard to do it in a general way without making it pretty much the equivalent to using DBRefs.
score: 0
type: AnswerComment

http://stackoverflow.com/q/23417123
upvote count: 1
answer count: 1
tagged with: recursion
tagged with: algorithm
accepted answer: http://stackoverflow.com/a/23417186
type: AnsweredQuestion
downvote count: 0
score: 1
has title: adding return case to recursive function
has body: When it comes to recursion, here is where I struggle, I know the edge case for when the function should be true, but because I have to add a return false statement as well, and somewhere deep in the call stack, it does become true(which is the whole point of examining!), I want the final outcome to be true, and for the recursion to stop. But eventually, it finds its way to the return false, simply because its the last thing the function does. public boolean isPathHelper(Node node, String input){ if(node.accept == true){ return true; }else{ if(input.length() == 0){ return false; } isPathHelper(getNextState(node, input.charAt(0) -'0'), input.substring(1)); return false; } How do I deal with this scenario? I know global variables can help, but I was hoping there's a gap in my knowledge instead.
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/35884736
has answer: http://stackoverflow.com/a/23417186
tagged with: java

http://stackoverflow.com/a/23432574
score: 1
type: AcceptedAnswer
downvote count: 0
has body: If the purpose is to create the same layout as in Google Play consider using DrawerLayout. Here is an example That layout allows you even easily change fade color and alpha via setScrimColor method. The default color is #99000000
accepted answer of: http://stackoverflow.com/q/23431905
type: Answer
answers question: http://stackoverflow.com/q/23431905
upvote count: 1

http://stackoverflow.com/comment/35938066
has text: And remember to use more descriptive titles
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23446084

http://stackoverflow.com/q/23303259
has comment: http://stackoverflow.com/comment/35685888
has answer: http://stackoverflow.com/a/23303366
linked to: http://stackoverflow.com/q/23189650
downvote count: 0
score: 1
has body: I am attempting to connect to an SQL database using a JApplet. However, I get a SecurityException: com.mysql.jdbc.CommunicationsException: Communications link failure due to underlying exception: ** BEGIN NESTED EXCEPTION ** java.net.SocketException MESSAGE: java.security.AccessControlException: access denied ("java.net.SocketPermission" "162.243.229.150:3306" "connect,resolve") STACKTRACE: java.net.SocketException: java.security.AccessControlException: access denied ("java.net.SocketPermission" "162.243.229.150:3306" "connect,resolve") at com.mysql.jdbc.StandardSocketFactory.unwrapExceptionToProperClassAndThrowIt(StandardSocketFactory.java:407) at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:268) at com.mysql.jdbc.MysqlIO.&lt;init&gt;(MysqlIO.java:271) at com.mysql.jdbc.Connection.createNewIO(Connection.java:2771) at com.mysql.jdbc.Connection.&lt;init&gt;(Connection.java:1555) at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:285) at java.sql.DriverManager.getConnection(DriverManager.java:664) at java.sql.DriverManager.getConnection(DriverManager.java:270) at me.nrubin29.cubesorter.MySQL.setup(MySQL.java:24) at me.nrubin29.cubesorter.MySQL.access$100(MySQL.java:8) at me.nrubin29.cubesorter.MySQL$1.run(MySQL.java:35) at java.lang.Thread.run(Thread.java:744) ** END NESTED EXCEPTION ** Last packet sent to the server was 1 ms ago. at com.mysql.jdbc.Connection.createNewIO(Connection.java:2847) at com.mysql.jdbc.Connection.&lt;init&gt;(Connection.java:1555) at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:285) at java.sql.DriverManager.getConnection(DriverManager.java:664) at java.sql.DriverManager.getConnection(DriverManager.java:270) at me.nrubin29.cubesorter.MySQL.setup(MySQL.java:24) at me.nrubin29.cubesorter.MySQL.access$100(MySQL.java:8) at me.nrubin29.cubesorter.MySQL$1.run(MySQL.java:35) at java.lang.Thread.run(Thread.java:744) Exception in thread "Thread-38" java.lang.NullPointerException …
tagged with: securityexception
tagged with: swing
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/12298556
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/35720845
has comment: http://stackoverflow.com/comment/35692010
answer count: 3
tagged with: japplet
upvote count: 1
tagged with: applet
linked to: http://stackoverflow.com/q/608387
favorite count: 0
has answer: http://stackoverflow.com/a/23330999
has answer: http://stackoverflow.com/a/23303390
accepted answer: http://stackoverflow.com/a/23303390
possible better answer: http://stackoverflow.com/a/23303366
has title: Connect to SQL with JApplet

http://stackoverflow.com/comment/35818140
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23303687
has text: Could this be a problem http://support.microsoft.com/kb/2653857 considering that I am not allowed to make any changes to SQL Server 2008 ?

http://stackoverflow.com/q/23359727
type: UnansweredQuestion
tagged with: spring-mvc
tagged with: java
has body: I want to better understand how Tomcat handles requests and why my specific issue may be happening. I am trying to enhance my existing Spring MVC web application with the Netflix Hystrix framework. This involves adding a hystrix-specific servlet to handle requests ending with /hystrix.stream. Based on the logs (below), this mapping works and the request is being forwarded to the correct servlet. However, the exception that is thrown does not occure in the servlet. I have also tried extending the servlet to add additional logging - but it appears that no methods in the servlet are called. The exception seems to be happening because of some inner working on Tomcat that I am not aware of. Here is a snippet from my web.xml (note that the rest of my application works fine - this is just concerning requests for /hystrix.stream): HystrixMetricsStreamServlet HystrixMetricsStreamServlet com.netflix.hystrix.contrib.metrics.eventstream.HystrixMetricsStreamServlet HystrixMetricsStreamServlet /hystrix.stream When I navigate to loalhost:8080/web-app/hystrix.stream I am forwarded to the Tomcat 404 Error. The following exception appears in tomcat's log file: 2014-04-16 15:53:22 DEBUG AuthenticatorBase:419 - Security checking request GET /web-app/hystrix.stream 2014-04-16 15:53:22 DEBUG WebappClassLoader:1582 - loadClass(com.netflix.hystrix.contrib.metrics.eventstream.HystrixMetricsStreamServlet, false) 2014-04-16 15:53:22 DEBUG WebappClassLoader:1598 - Returning class from cache 2014-04-16 15:53:22 DEBUG RealmBase:617 - No applicable constraints defined 2014-04-16 15:53:22 DEBUG AuthenticatorBase:501 - Not subject to any constraint 2014-04-16 15:53:22 DEBUG [localhost]:449 - Processing ErrorPage[errorCode=404, location=/404.htm] 2014-04-16 15:53:22 DEBUG Http11Processor:986 - Error parsing HTTP request header java.io.EOFException: Unexpected EOF read on the socket at org.apache.coyote.http11.InternalInputBuffer.parseRequestLine(InternalInputBuffer.java:99) at org.apache.coyote.http…
tagged with: servlets
type: Question
has comment: http://stackoverflow.com/comment/35805419
has comment: http://stackoverflow.com/comment/42050369
downvote count: 0
answer count: 1
tagged with: tomcat
favorite count: 0
upvote count: 8
has title: Tomcat EOFException: Unexpected EOF read on the socket
has answer: http://stackoverflow.com/a/26797115
score: 8

http://stackoverflow.com/a/23649146
downvote count: 0
type: Answer
has body: ended up compiling kafka client 0.7.2 with scala 2.10, was not hard, everything works.
accepted answer of: http://stackoverflow.com/q/23441433
score: 1
answers question: http://stackoverflow.com/q/23441433
upvote count: 1
type: AcceptedAnswer

http://stackoverflow.com/q/23357752
tagged with: spring
has comment: http://stackoverflow.com/comment/37212489
has body: I am having trouble getting a spring-AOP pointcut to work when one of the parameters is a vararg. Given the below code I would have expected the pointcut to be triggered on both calls from my test, however it is not called in either case. I have other aspects working on other methods in the same class, so I know it is not a problem with my testing or spring setups - it appears isolated to this method and the only thing unique about it is the vararg. Method declaration: SearchResults getRelation(final ClmUserContextFactory contextFactory, final CloudObjectId objectId, final Class&lt;? extends CloudClass&gt;... relationClasses) throws BmcClientException; Pointcut declaration: @Around(value = "execution(com.a.b.SearchResults " + "com.a.b.BmcClmRestJsonClient.getRelation(com.a.b.ClmUserContextFactory, com.a.b.CloudObjectId, Class&lt;? extends com.a.b.CloudClass&gt;...))" + " &amp;&amp; args(contextFactory, objectId, relationClasses)", argNames = "jp,contextFactory,objectId,relationClasses") private SearchResults getRelationVarargs(ProceedingJoinPoint jp, ClmUserContextFactory contextFactory, CloudObjectId objectId, Class&lt;? extends CloudClass&gt;[] relationClasses) throws Throwable {...} Calls from test: bmcClmRestJsonClient.getRelation(contextFactory, objectId, new Class[] { CloudClass.class }); bmcClmRestJsonClient.getRelation(contextFactory, objectId); EDIT: I can confirm that if I remove the vararg part of the definition (ie remove all '...' and '[]') from the pointcut and method definitions it works, so it definitely appears to be something to do with those. It also does not work if I replace the '...' with '[]'.
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/23443376
score: 1
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/23400835
tagged with: aspectj
answer count: 2
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/36009315
tagged with: spring-aop
tagged with: variadic-functions
has title: Spring AOP pointcut not working with varargs
has answer: http://stackoverflow.com/a/23400835
has answer: http://stackoverflow.com/a/23443376
upvote count: 1
has comment: http://stackoverflow.com/comment/37465627

http://stackoverflow.com/q/23324427
has body: My goal is to check a big list of domains as fast as possible. The method InetAddress.getByName() seems to be a little bit slow for me. In PHP there's gethostbyname('www.example.com')which seems to work faster. Is there an equivalent in Java which is faster? or is there a way to speed it up?
type: AnsweredQuestion
tagged with: java
type: Question
answer count: 1
downvote count: 0
score: 1
favorite count: 0
has answer: http://stackoverflow.com/a/23324691
has title: Is there a faster method for a NSLookup than InetAddress.getByName()?
upvote count: 1
accepted answer: http://stackoverflow.com/a/23324691

http://stackoverflow.com/comment/35704917
comment on: http://stackoverflow.com/a/23319964
type: Comment
type: AnswerComment
has text: Thank you ..... Next time i would be clear with my question sorry.
score: 0

junit
tags question: http://stackoverflow.com/q/23397949
type: Tag
tags question: http://stackoverflow.com/q/23410738
tags question: http://stackoverflow.com/q/23299143
tags question: http://stackoverflow.com/q/23355246
tags question: http://stackoverflow.com/q/23360092
tags question: http://stackoverflow.com/q/23374169
tags question: http://stackoverflow.com/q/23387616
tags question: http://stackoverflow.com/q/23384726
tag name: junit
tags question: http://stackoverflow.com/q/23297147
tags question: http://stackoverflow.com/q/23420798
tags question: http://stackoverflow.com/q/23398736
tags question: http://stackoverflow.com/q/23451886
tags question: http://stackoverflow.com/q/23298843
tags question: http://stackoverflow.com/q/23336485
tags question: http://stackoverflow.com/q/23324819
tags question: http://stackoverflow.com/q/23364989
tags question: http://stackoverflow.com/q/23310350
tags question: http://stackoverflow.com/q/23295014
tags question: http://stackoverflow.com/q/23431676
tags question: http://stackoverflow.com/q/23341147
tags question: http://stackoverflow.com/q/23390337
tags question: http://stackoverflow.com/q/23396740
tags question: http://stackoverflow.com/q/23442467
tags question: http://stackoverflow.com/q/23447386
tags question: http://stackoverflow.com/q/23354603
tags question: http://stackoverflow.com/q/23421041
tags question: http://stackoverflow.com/q/23297830
tags question: http://stackoverflow.com/q/23363212
tags question: http://stackoverflow.com/q/23417353
tags question: http://stackoverflow.com/q/23375700

http://stackoverflow.com/a/23428503
answers question: http://stackoverflow.com/q/23428115
type: Answer
has comment: http://stackoverflow.com/comment/35905194
score: 0
has body: In the second page where you are trying to retrieve the values, I think String mobile_No = request.getParameter("mobile_No"); Should be String mobile_No = request.getAttribute("mobile_No");

http://stackoverflow.com/a/23398260
upvote count: 2
type: Answer
has body: You are using public and static keywords for a variable declared at the method. They are allowed only for classes/methods/interfaces/annotations/class members, but not for local variables.
answers question: http://stackoverflow.com/q/23397722
score: 2
downvote count: 0

http://stackoverflow.com/comment/35860235
type: Comment
score: 0
type: AnswerComment
has text: Is `ConcurrentHashMap` the same, for the most part, as `HashMap`, just with concurrency considerations?
comment on: http://stackoverflow.com/a/23404192

http://stackoverflow.com/q/23329135
favorite count: 0
has answer: http://stackoverflow.com/a/23329160
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/32572029
has answer: http://stackoverflow.com/a/31615745
score: 13
answer count: 4
upvote count: 13
tagged with: java
has title: How do you set both port and thread pool using embedded jetty, v 9.1.0
type: Question
has answer: http://stackoverflow.com/a/34898698
downvote count: 0
tagged with: embedded-jetty
has body: I'm using jetty 9.1.0, embedded, and would like to set both port and ThreadPool. I see a constructor for each, but don't see how to use one of those, and then any way to set the other. doing this Server server = new Server(9090); or Server server = new Server(new QueuedThreadPool(100, 10)); but there's no setPort or setThreadPool on Server.

http://stackoverflow.com/comment/35790990
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23366900
has text: Are you trying to create a list with a generic type of the field?
score: 0

http://stackoverflow.com/comment/35886014
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23417749
has text: Maybe [`DISPOSE_ON_CLOSE`](http://docs.oracle.com/javase/6/docs/api/javax/swing/WindowConstants.html#DISPOSE_ON_CLOSE) can help.
score: 1

http://stackoverflow.com/comment/35906724
score: 1
type: QuestionComment
has text: Not really. Remove the `LinearLayout` from the xml you posted, that isn't supposed to be there. Then, in the adapter's `instantiateItem()` method, for position 0 get a reference to the `LayoutInflater`(you'll need to pass the `Context` in the adapter) and inflate and return a xml layout that holds the previously removed `LinearLayout`(along with the range bar).
type: Comment
comment on: http://stackoverflow.com/q/23429076

http://stackoverflow.com/q/23432629
has comment: http://stackoverflow.com/comment/35912984
upvote count: 1
tagged with: swing
has title: how to put JavaFX in JPanel?
type: Question
has comment: http://stackoverflow.com/comment/35913046
tagged with: actionlistener
type: AnsweredQuestion
tagged with: java
tagged with: jpanel
has answer: http://stackoverflow.com/a/23435001
has body: I have a swing program and i am trying to incorporate a JavaFX bar graph in my program. How can I put it in a JPanel? or Is there a way to put this code in a ActionListerner? So I can run it after pressing a button. public static void start(Stage stage) { String judge1 = "Judge 1"; String judge2 = "Judge 2"; String judge3 = "Judge 3"; final CategoryAxis xAxis = new CategoryAxis(); final NumberAxis yAxis = new NumberAxis(); final BarChart&lt;String,Number&gt; bc = new BarChart&lt;String,Number&gt;(xAxis,yAxis); xAxis.setLabel("Judges"); yAxis.setLabel("Run"); XYChart.Series series1 = new XYChart.Series(); series1.setName("Run 1"); series1.getData().add(new XYChart.Data(judge1, 1)); series1.getData().add(new XYChart.Data(judge2, 3)); series1.getData().add(new XYChart.Data(judge3, 2)); XYChart.Series series2 = new XYChart.Series(); series2.setName("Run 2"); series2.getData().add(new XYChart.Data(judge1, 5)); series2.getData().add(new XYChart.Data(judge2, 4); series2.getData().add(new XYChart.Data(judge3, 4)); Scene scene = new Scene(bc,800,600); bc.getData().addAll(series1, series2); stage.setScene(scene); stage.show(); }
downvote count: 4
has comment: http://stackoverflow.com/comment/35913001
answer count: 1
has comment: http://stackoverflow.com/comment/35916486
has comment: http://stackoverflow.com/comment/35913630
has comment: http://stackoverflow.com/comment/35913003
accepted answer: http://stackoverflow.com/a/23435001
favorite count: 0
tagged with: javafx-2
has comment: http://stackoverflow.com/comment/35913403
score: -3

http://stackoverflow.com/a/23465962
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23452034
type: Answer
accepted answer of: http://stackoverflow.com/q/23452034
has body: You need to find the folder named ".android" and delete it. Probably it's in your home dir. To check it try ls -la ~/.android To remove it: rm -rf ~/.android Then restart eclipse.
score: 0

http://stackoverflow.com/comment/35779549
score: 1
comment on: http://stackoverflow.com/a/23359015
type: AnswerComment
type: Comment
has text: That has nothing to do with what I just said. You should reread it.

http://stackoverflow.com/comment/35952779
type: Comment
has text: I still don't understand what exactly the purpose of the timer is, and what it should do.
comment on: http://stackoverflow.com/a/23413308
score: 0
type: AnswerComment

http://stackoverflow.com/comment/35885266
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23404153
has text: The executable created by ndk-build is non-static. It produces a .so file. Not sure how to run this

http://stackoverflow.com/q/23398978
type: Question
answer count: 2
tagged with: swing
has answer: http://stackoverflow.com/a/23400095
score: 0
tagged with: java
has body: I have a JList that uses a list model to add strings of text to the JList. I am having trouble figuring out how to update a selected listModel. I am able to select the listModel String (I have verified that what ever I select returns correctly) but I am unable to figure out how to update the listModel string I select. Any help with this would be greatly appreciated. Is there a updateElement(variable) or something I could use to accomplish this? String string1 = "hello"; String string2 = "goodbye"; String myItem = jlst.getSelectedValue(); // myItem is the string returned listModel.addElement(string1 + string2); // adds a new element is there anyway to update myItem so string1 and string 2 become apart of the myItem string ?
tagged with: defaultlistmodel
possible better answer: http://stackoverflow.com/a/23400095
has title: Java updating listmodel string
tagged with: string
type: AnsweredQuestion
tagged with: jlist
has answer: http://stackoverflow.com/a/23399355
accepted answer: http://stackoverflow.com/a/23399355

http://stackoverflow.com/comment/35776328
score: 0
type: Comment
has text: @Dimitri I agree with you regarding atomicity. But here first we need to check if the variable is null, then we need to populate it. So read and update are two different operations, How AtomicRefernce will maintain these two operation as atomic.
comment on: http://stackoverflow.com/a/23358418
type: AnswerComment

http://stackoverflow.com/comment/35806205
type: Comment
type: QuestionComment
has text: yeah. There is no problem with the value that is added to the hashmap at the point. The previously added value of a key changes to emty array.
comment on: http://stackoverflow.com/q/23374688
score: 0

http://stackoverflow.com/q/23380632
upvote count: 3
tagged with: java
tagged with: mysql
type: Question
has comment: http://stackoverflow.com/comment/56446307
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/35816413
has body: I want to print the result of mysql GROUP_CONCAT in java and it return blob. But when I do resultset.getBlob("columnname") its throwing sql exception. so how to go about it or I need to resultset.getBytes("columnname");
has comment: http://stackoverflow.com/comment/35816174
tagged with: sql
has comment: http://stackoverflow.com/comment/91748877
has answer: http://stackoverflow.com/a/76992792
has title: print result of GROUP_CONCAT in java
favorite count: 0
type: UnansweredQuestion
score: 3

http://stackoverflow.com/comment/35934204
type: AnswerComment
score: 0
type: Comment
has text: Semaphore has a fairness parameter, ensuring that the threads are executed in FIFO order - so I would not call that random. Apart from that: if you like to have perfect control over execution and only one thread is executing at the same time, then I am wondering why you use Concurrency/Threads at all?! A simple timer based single threaded code would also be an option.
comment on: http://stackoverflow.com/a/23443295

http://stackoverflow.com/a/23326409
type: Answer
has body: It seems like there could be a regex answer to this. I initially was trying to solve this through regex, but could not solve for situations like 'AAAzzA'. So I came up with this answer below, which can handle both 'AAAAA' and 'AAAzzA'. This may not be the best answer, but I guess it works. The basic idea is to find the last index of 'AA' occurrence and split string by that index: String myWord = "AAAAAzzA"; String source = "AA"; String target = "BB"; int lastIndex = -1; if ((lastIndex = myWord.lastIndexOf(source)) &gt;= 0) { String f = myWord.substring(0, lastIndex); String b = myWord.substring(lastIndex + target.length() &gt;= myWord .length() ? myWord.length() : lastIndex + target.length(), myWord.length()); myWord = f + target + b; } System.out.println(myWord);
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/23325800
upvote count: 1

http://stackoverflow.com/q/23407869
has comment: http://stackoverflow.com/comment/35868368
type: Question
score: 0
has comment: http://stackoverflow.com/comment/35869556
tagged with: resultset
tagged with: oracle-database
tagged with: jdbc
answer count: 0
type: UnansweredQuestion
has body: pst=con.prepareStatement("Select * from stu_extra where stu_id like 'Kul7Dub514'"); rs=pst.executeQuery(); while(rs.next()) { stclasscombo.setSelectedItem(rs.getString(2)); for(int i=3;i&lt;10;i++) System.out.println(rs.getString(i)); if(rs.getString(10).equals("PCM")) { PCM.setSelected(true); } else if(rs.getString(10).equals("PCB")) { PCB.setSelected(true); } else if(rs.getString(10).equals("PCMB")) { PCMB.setSelected(true); } if(rs.getString(11).equals("true")) { NEET.setSelected(true); } if(rs.getString(12).equals("true")) { IPCC.setSelected(true); } act_fee.setText(Integer.toString(rs.getInt(13))); conc.setText(Integer.toString(rs.getInt(14))); tot_fee.setText(Integer.toString(rs.getInt(15))); no_instl.setText(Integer.toString(rs.getInt(16))); } the code is returning with an exhausted result set error the first values is obtained i.e at column 2 but the later values are not retrieved Please Help...
has title: Exhausted Resultset in java jdbc
linked to: http://stackoverflow.com/q/3502005
has comment: http://stackoverflow.com/comment/35866852
tagged with: java

http://stackoverflow.com/a/47768641
answers question: http://stackoverflow.com/q/23371938
score: 8
has comment: http://stackoverflow.com/comment/90962933
downvote count: 0
has body: What @Herrbert74 suggested it surely working fine, but sometimes it's better to not add a @SuppressWarnings("ConstantConditions") to an entire method (if it's not trivial), a better approach could be to use //noinspection ConstantConditions on the warned line. Those are my rules of thumb: Use @SuppressWarnings("ConstantConditions") when the method is simple Use //noinspection ConstantConditions when the method is complex and you need to remove the warning only on a specific line
upvote count: 8
type: Answer
has comment: http://stackoverflow.com/comment/114923429

http://stackoverflow.com/q/23383723
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/23383796
favorite count: 0
has answer: http://stackoverflow.com/a/23383845
type: UnansweredQuestion
tagged with: dictionary
has title: java: LinkedHashMap containsKey=true but get returns null
tagged with: java
has body: i have this weird problem: iterating over the keyset of a linkedhashmap, the get returns null on certain keys: ... System.out.println("Map: "+wildCardSummaryKey); try { rowKeys = wildCardSummaryKey.keySet().iterator(); while (rowKeys.hasNext()) { String rowKey = (String) rowKeys.next(); ProcessTables.Counter counter = (ProcessTables.Counter) wildCardSummary.get(rowKey); System.out.println("key='"+rowKey+"', containsKey="+wildCardSummaryKey.containsKey(rowKey)+", value="+counter); System.out.println("count: "+counter.getCount()); } } catch(NullPointerException e) { e.printStackTrace(); } the output is (manually formatted for better readability): Map: { abc:abc vpn:Klant:Stichting BlaBla College:Stichting BlaBla College=com.my.ProcessTables$Counter@54deac, abc:abc uni/nni:Klant:CA BlaBla F &amp; O BV:CA BlaBla F &amp; O BV=com.my.ProcessTables$Counter@43e6ee5f, abc:abc vpn:Klant:CA BlaBla F &amp; O BV:CA BlaBla F &amp; O BV=com.my.ProcessTables$Counter@6e2bc1cc, abc:abc uni/nni:Klant:Stichting BlaBla College:Stichting BlaBla College=com.my.ProcessTables$Counter@7ac07095 } key='abc:abc vpn:Klant:Stichting BlaBla College:Stichting BlaBla College', containsKey=true, value=null java.lang.NullPointerException at com.my.ProcessTables.getData(ProcessTables.java:1166) at com.my.ProcessTables.processRequest_getData(ProcessTables.java:1629) at com.my.ProcessTables.processRequest(ProcessTables.java:81) line 1166 is this line: System.out.println("count: "+counter.getCount()); so: although the iterator gives me the key i cannot get the value object from the map! what is going on? any ideas? thanks! frank
upvote count: 1
downvote count: 1
type: Question
tagged with: linkedhashmap

http://stackoverflow.com/comment/35816656
type: Comment
type: QuestionComment
has text: 1) Java GUIs might have to work on a number of platforms, on different screen resolutions & using different PLAFs. As such they are not conducive to exact placement of components. To organize the components for a robust GUI, instead use layout managers, or [combinations of them](http://stackoverflow.com/a/5630271/418556), along with layout padding & borders for [white space](http://stackoverflow.com/q/17874717/418556). 2) See [Should I avoid the use of set(Preferred|Maximum|Minimum)Size methods in Java Swing?](http://stackoverflow.com/q/7229226/418556) (Yes.)
score: 0
comment on: http://stackoverflow.com/q/23372890

http://stackoverflow.com/comment/35721361
comment on: http://stackoverflow.com/a/23328813
type: Comment
has text: i'm really not sure about your problem but did you import android.support.v4.app.Fragment in ConjuntaFragment. and also did you try to just directly Show conjunctaFragment as i recommended earlier?
score: 0
type: AnswerComment

http://stackoverflow.com/comment/35652815
score: 0
comment on: http://stackoverflow.com/q/23291070
type: Comment
type: QuestionComment
has text: Alright, I wasn't paying attention on whether it was a java.util.Timer or a swing timer.

http://stackoverflow.com/a/23293880
answers question: http://stackoverflow.com/q/23293750
has comment: http://stackoverflow.com/comment/35657040
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/35657350
has body: 1.You should set the setonCheckedChangeListener() ,like this cb1.setOnCheckedChangeListener(this); In your Activity checkout public class checkout extends Activity implements OnCheckChangedListener Implement here @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { Object tag=buttonView.getTag(); //could be integer, or primitive datatype //just make sure of type-casting if ( isChecked ) { // perform logic, reduce value in final table or such } } 2.Next set tag to checkbox, for more reference see here setTag(Object) cb1.setTag(anyObject); which can be used to get some value on object to perform any operation ,which in this case is to reduce value in final table.
score: 1
has comment: http://stackoverflow.com/comment/35656989
has comment: http://stackoverflow.com/comment/35657271
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23293750
downvote count: 0

http://stackoverflow.com/comment/35791833
type: Comment
type: QuestionComment
has text: What's wrong with "other"? I think the concept of other would be represented by a subclass of `Vehicle` that doesn't add any funcitonality. Or, it could even be just the `Vehicle` class itself.
comment on: http://stackoverflow.com/q/23367491
score: 0

c++
tags question: http://stackoverflow.com/q/23367650
tags question: http://stackoverflow.com/q/23363371
tags question: http://stackoverflow.com/q/23417810
tags question: http://stackoverflow.com/q/23320878
tags question: http://stackoverflow.com/q/23295830
tags question: http://stackoverflow.com/q/23322490
tags question: http://stackoverflow.com/q/23299337
tags question: http://stackoverflow.com/q/23349811
tags question: http://stackoverflow.com/q/23291224
tags question: http://stackoverflow.com/q/23418114
tags question: http://stackoverflow.com/q/23295355
tags question: http://stackoverflow.com/q/23452176
type: Tag
tags question: http://stackoverflow.com/q/23327434
tags question: http://stackoverflow.com/q/23330419
tags question: http://stackoverflow.com/q/23318849
tags question: http://stackoverflow.com/q/23349656
tags question: http://stackoverflow.com/q/23398227
tags question: http://stackoverflow.com/q/23323648
tags question: http://stackoverflow.com/q/23363903
tags question: http://stackoverflow.com/q/23414274
tags question: http://stackoverflow.com/q/23321837
tags question: http://stackoverflow.com/q/23306722
tags question: http://stackoverflow.com/q/23326616
tags question: http://stackoverflow.com/q/23388629
tags question: http://stackoverflow.com/q/23333062
tags question: http://stackoverflow.com/q/23360770
tags question: http://stackoverflow.com/q/23368272
tags question: http://stackoverflow.com/q/23401138
tag name: c++
tags question: http://stackoverflow.com/q/23405365

http://stackoverflow.com/comment/35893642
comment on: http://stackoverflow.com/a/23422008
type: AnswerComment
score: 0
type: Comment
has text: M trying. i will let u know.

http://stackoverflow.com/comment/35837440
type: QuestionComment
comment on: http://stackoverflow.com/q/23392208
type: Comment
score: 0
has text: @Mendoza This will only inform you if the object falls under that hierarchy, not if its exactly that type

http://stackoverflow.com/q/23308254
tagged with: command-line
type: Question
upvote count: 1
has comment: http://stackoverflow.com/comment/35683865
tagged with: java
has title: Split a file into a test file and a training file using Weka
has answer: http://stackoverflow.com/a/23315638
downvote count: 0
has body: I found the following code, which distributes the examples as 75% training and 25% test data: java weka.filters.supervised.instance.StratifiedRemoveFolds -i full.arff -o train.arff -c last -N 4 -F 1 -V java weka.filters.supervised.instance.StratifiedRemoveFolds -i full.arff -o test.arff -c last -N 4 -F 1 But, I need to split the data such that 70% are used to train and 30% are used for testing. How do I do this? I don't want the split to be randomized.
type: UnansweredQuestion
tagged with: weka
answer count: 1
score: 1
has comment: http://stackoverflow.com/comment/35683789
favorite count: 0

http://stackoverflow.com/comment/35834437
comment on: http://stackoverflow.com/q/23390612
score: 0
type: Comment
type: QuestionComment
has text: The indexOf can't receive "T" because it's a example, if the message starts with other letter it will not works.

timer
tags question: http://stackoverflow.com/q/23313974
tag name: timer
tags question: http://stackoverflow.com/q/23291070
type: Tag
tags question: http://stackoverflow.com/q/23313773
tags question: http://stackoverflow.com/q/23407835
tags question: http://stackoverflow.com/q/23304452
tags question: http://stackoverflow.com/q/23413177
tags question: http://stackoverflow.com/q/23303898
tags question: http://stackoverflow.com/q/23296958
tags question: http://stackoverflow.com/q/23377166
tags question: http://stackoverflow.com/q/23353545
tags question: http://stackoverflow.com/q/23343404
tags question: http://stackoverflow.com/q/23445137
tags question: http://stackoverflow.com/q/23308363
tags question: http://stackoverflow.com/q/23432801
tags question: http://stackoverflow.com/q/23435493

http://stackoverflow.com/comment/35854834
type: QuestionComment
comment on: http://stackoverflow.com/q/23401332
has text: @JamesMassey I have to run a `scheduled job`
score: 0
type: Comment

http://stackoverflow.com/comment/35845913
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23394711
has text: thanks. as i saw this code i should not extends startUp,menu and gameply as Application i should add them the next fxml file .is it true ?
score: 0

http://stackoverflow.com/q/23398637
tagged with: java
tagged with: mule
has title: Mule ESB 3.4.0 CE: Redeliver message through TCP Endpoint upon Socket Exception
upvote count: 2
answer count: 1
favorite count: 0
tagged with: sockets
has body: I have an application that required persistent TCP connections. So I set some appropriate attributes on the Tcp connector to support this. The issue I am having is if an external application goes down, and restarts, Mule will continue trying to send the messages to the socket and not try to re-establish connection. &lt;mule ...&gt; &lt;tcp:connector name="tcpConn" doc:name="TCP connector" keepAlive="true" keepSendSocketOpen="true" reuseAddress="true" validateConnections="true"&gt; &lt;reconnect-forever frequency="2000" /&gt; &lt;tcp:direct-protocol payloadOnly="true"/&gt; &lt;/tcp:connector&gt; &lt;flow name="ExampleFlow1" doc:name="ExampleFlow1"&gt; &lt;vm:inbound-endpoint exchange-pattern="one-way" path="msg.in" doc:name="VM"&gt; &lt;vm:transaction action="ALWAYS_BEGIN"/&gt; &lt;/vm:inbound-endpoint&gt; &lt;tcp:outbound-endpoint exchange-pattern="one-way" host="127.0.0.1" port="50002" responseTimeout="10000" doc:name="TCP"/&gt; &lt;/flow&gt; &lt;flow name="example1" doc:name="example1"&gt; &lt;tcp:inbound-endpoint exchange-pattern="one-way" host="0.0.0.0" port="50001" responseTimeout="10000" doc:name="TCP"/&gt; &lt;vm:outbound-endpoint exchange-pattern="one-way" path="msg.in" doc:name="VM"&gt; &lt;/vm:outbound-endpoint&gt; &lt;/flow&gt; &lt;/mule&gt; Here is my error log: ERROR 2014-04-30 17:11:35,436 [[chatroomexample].connector.VM.mule.default.receiver.04] org.mule.exception.DefaultMessagingExceptionStrategy: ******************************************************************************** Message : Failed to route event via endpoint: DefaultOutboundEndpoint{endpointUri=tcp://127.0.0.1:50002, connector=TcpConnector { name=tcpConn lifecycle=start this=198bdbc numberOfConcurrentTransactedReceivers=4 createMultipleTransactedReceivers=true connected=true supportedProtocols=[tcp] serviceOverrides=&lt;none&gt; } , name='endpoint.tcp.127.0.0.1.50002', mep=ONE_WAY, properties={}, transactionConfig=Transaction{factory=null, action=INDIFFERENT, timeout=0}, deleteUnaccepted…
score: 2
type: AnsweredQuestion
downvote count: 0
tagged with: tcp
type: Question
has answer: http://stackoverflow.com/a/23435450
accepted answer: http://stackoverflow.com/a/23435450

http://stackoverflow.com/q/23313680
has title: A button wont show up
has body: I have this xml: &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context="com.gelasoft.answeringball.MainActivity$PlaceholderFragment" &gt; &lt;ImageView android:id="@+id/sphereIcon" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentTop="true" android:layout_centerHorizontal="true" android:contentDescription="@string/magicBallDescr" android:src="@drawable/ic_launcher" /&gt; &lt;LinearLayout android:id="@+id/table" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_below="@+id/sphereIcon" android:orientation="horizontal" &gt; &lt;TextView android:id="@+id/txtAnswer" android:layout_width="wrap_content" android:layout_height="wrap_content" /&gt; &lt;EditText android:id="@+id/launch_codes" android:layout_width="match_parent" android:layout_height="106dp" android:hint="@string/textHint" android:inputType="text" /&gt; &lt;Button android:id="@+id/btnAsk" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="@string/btnAskQ" /&gt; &lt;/LinearLayout&gt; &lt;/RelativeLayout&gt; Everything is perfect, but the button won't show up. What am I missing here? I know that is something basic even for a beginner, but I find it hard to understand as a newbie in the xml world.
has answer: http://stackoverflow.com/a/23313799
tagged with: android
tagged with: android-activity
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
upvote count: 2
downvote count: 1
has comment: http://stackoverflow.com/comment/35693325
accepted answer: http://stackoverflow.com/a/23313799
type: Question
tagged with: android-fragments
score: 1
has comment: http://stackoverflow.com/comment/35693324
tagged with: java
has comment: http://stackoverflow.com/comment/35693281
answer count: 1
favorite count: 0

http://stackoverflow.com/a/23417158
type: AcceptedAnswer
downvote count: 0
upvote count: 5
type: Answer
has comment: http://stackoverflow.com/comment/35890618
has comment: http://stackoverflow.com/comment/35885064
score: 5
accepted answer of: http://stackoverflow.com/q/23417036
has body: The purpose of the throws keyword is for when it is not correct to use a try block to handle the exception within the method itself. When your code throws a checked exception, you must either use a try block to catch it, or use the throws keyword on your method to advertise the fact that it throws an exception to any method that may call it, so that it in turn must either use a try block to catch it or use the throws keyword to pass the buck. You cannot do both (unless you're dealing with more than one exception.) It's a design decision you have to make. Either the method you're writing knows how to handle the exception and does so, or it doesn't and it throws the exception to its callers.
answers question: http://stackoverflow.com/q/23417036

http://stackoverflow.com/q/23445652
tagged with: jsch
score: 0
has comment: http://stackoverflow.com/comment/35937292
tagged with: ssh
tagged with: unix
answer count: 0
type: UnansweredQuestion
tagged with: java
has body: I am working on running a shell script from Java. I was able to ssh successfully to a server using JSCH using the steps mentioned [here]. Now my requirement is, I need to ssh to server1 , and then ssh to server2 from server1. After ssh to server2, I need to do su - user. After su, I need to run a shell script by passing parameters. So I need steeps to login to server2 after connecting to server1 from java. Once ssh into server2, do su and run script. Any help please suggested.
has comment: http://stackoverflow.com/comment/35939052
tagged with: channel-api
type: Question
linked to: http://stackoverflow.com/q/4412238
has comment: http://stackoverflow.com/comment/35937174
has title: SSH to Remote server from another server in Java

xml-deserialization
tags question: http://stackoverflow.com/q/23360997
tag name: xml-deserialization
type: Tag

http://stackoverflow.com/q/23446603
accepted answer: http://stackoverflow.com/a/23457957
type: AnsweredQuestion
score: 3
has title: Conversion to Dalvik format failed: Unable to execute dex: Multiple dex files define Lcom/squareup/okhttp/Address;
upvote count: 3
tagged with: java
type: Question
answer count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/35939060
has answer: http://stackoverflow.com/a/23457957
tagged with: sdk
has answer: http://stackoverflow.com/a/23446687
tagged with: android
has comment: http://stackoverflow.com/comment/35939036
favorite count: 0
has body: I've seen this question asked about 100 times on StackOverflow, but this isn't a one answer that solves them all. Here is my build path: However I still get: [2014-05-03 11:44:33 - Dex Loader] Unable to execute dex: Multiple dex files define Lcom/squareup/okhttp/Address; [2014-05-03 11:44:33 - Untappd] Conversion to Dalvik format failed: Unable to execute dex: Multiple dex files define Lcom/squareup/okhttp/Address; What is the best and easiest way to solve this issue? I got it when i tried to manually add a new version of Aviary SDK to my project by deleting the old project and adding the new one. I've tried cleaning and rebuilding and it doesn't work.
has comment: http://stackoverflow.com/comment/35939056
possible better answer: http://stackoverflow.com/a/23446687
has comment: http://stackoverflow.com/comment/35939021

http://stackoverflow.com/comment/36033611
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23347310
has text: @Niko That sounds like a new question for stackoverflow.

http://stackoverflow.com/a/23349781
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23348950
type: Answer
score: 5
upvote count: 5
has body: As as matter of style, I generally recommend not using exception handlers for regular control flow. I can see the argument for using it here, though, as the design of Future requires you to 'unwrap' the original exception. Rethrowing an exception should be substantially less expensive than throwing a new exception, as the stack trace has already been populated. There may still be more overhead with your first approach, but if your application is throwing so many exceptions that the impact becomes noticable, then you likely have bigger problems. If it's really a concern for you, the only way you'll get a meaningful answer is to measure the difference yourself. But, again, exceptions should only be thrown in exceptional cases; they should be uncommon by design. Even if you double the cost of exception handling, the cost is merely 2n instead of n. If you're throwing so many exceptions that your application's performance is suffering noticeably, a simple factor of two probably isn't going to make or break you. So use whichever style you find more readable.
accepted answer of: http://stackoverflow.com/q/23348950

http://stackoverflow.com/a/23355366
has comment: http://stackoverflow.com/comment/35770395
has comment: http://stackoverflow.com/comment/35769953
answers question: http://stackoverflow.com/q/23355301
has comment: http://stackoverflow.com/comment/35770955
has comment: http://stackoverflow.com/comment/35770361
has comment: http://stackoverflow.com/comment/35769857
has comment: http://stackoverflow.com/comment/35771585
has comment: http://stackoverflow.com/comment/35770991
score: 0
has body: This is not the problem with versions during compilation. It is due to the missing packages. Classpath doesn't have com.sun.rasign package and Base64Encoder class file Note : When you try to compile Java 1.4 source with Java 1.6 compiler. You may get into problems when any changes have been made to the Java API. See @Leos Literak comment, very useful one.
type: Answer
has comment: http://stackoverflow.com/comment/35770287

http://stackoverflow.com/comment/35824144
type: Comment
comment on: http://stackoverflow.com/a/23385028
has text: it still doesnt like this line new Intent(mActivity.getApplicationContext(),Checklist.this);
type: AnswerComment
score: 0

http://stackoverflow.com/q/23362759
type: AnsweredQuestion
tagged with: java
has title: How to efficiently use arguments within methods in java?
tagged with: loops
tagged with: methods
accepted answer: http://stackoverflow.com/a/23362982
type: Question
has answer: http://stackoverflow.com/a/23362982
score: 0
answer count: 1
has body: Im fairly new to Java , and OOP in general hence many concepts in Java dont make complete sense even though the API is thorough. I have made a small calculator code , however I want to learn how to achieve the same product using arguments within method, samples would be prime. import java.io.IOException; import java.util.Scanner; public class Ga { static Scanner input = new Scanner(System.in); public static void main(String[] args) throws IOException { System.out.println("First number:"); float i = input.nextInt(); System.out.println("Choose operator +, -, *, /"); char s = input.next().charAt(0); System.out.println("Second number:"); float z = input.nextInt(); switch (s) { case '+': System.out.println("Result= "+(i+z)); System.in.read(); break; case '-': System.out.println("Result= "+(i-z)); System.in.read(); break; case '*': System.out.println("Result= "+(i*z)); System.in.read(); break; case '/': System.out.print("Result= "+(i/z)); System.in.read(); break; } } }
tagged with: exception
has comment: http://stackoverflow.com/comment/35783024
has comment: http://stackoverflow.com/comment/35782744
linked to: http://stackoverflow.com/q/890966

http://stackoverflow.com/a/23355241
has comment: http://stackoverflow.com/comment/35769799
has comment: http://stackoverflow.com/comment/35770074
type: Answer
score: 1
upvote count: 1
has body: Logging output always helps. There are a few problems here. this chops a byte in half String raw_DeviceId = sb.substring(37, 1040); this line assumes each cell size is 2 charatcers , they arent most are 3 characters some are 4. byte firstNibble = Byte.parseByte(hexStr.substring(2*i,2*i+1),16); // [x,y) try cleaning up the input a bit first public static byte[] HexStringToByteArray(String hexStr) { System.out.println(hexStr); // log our input make sure it is what we think it is. byte bArray[] = new byte[hexStr.length() /3 ]; int index = 0; for (String cell : hexStr.split(" ")) { byte firstNibble = Byte.parseByte(cell.substring(0,1),16); // [x,y) byte secondNibble = Byte.parseByte(cell.substring(1,2),16); byte finalByte = (byte)((secondNibble) | (firstNibble &lt;&lt; 4 )); // bit-operations only with numbers, not bytes. bArray[index++] = finalByte; } return bArray; }
has comment: http://stackoverflow.com/comment/35769654
has comment: http://stackoverflow.com/comment/35769711
has comment: http://stackoverflow.com/comment/35769848
answers question: http://stackoverflow.com/q/23354999
has comment: http://stackoverflow.com/comment/35769795
has comment: http://stackoverflow.com/comment/35769676
downvote count: 0

http://stackoverflow.com/comment/35695129
has text: This does not look like a CSV to me - more like a SCSV (if there were such a thing as semicolon separated value file).
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23314692

http://stackoverflow.com/q/23392241
tagged with: out-of-memory
type: UnansweredQuestion
score: -2
linked to: http://stackoverflow.com/q/3261513
has comment: http://stackoverflow.com/comment/35848204
has comment: http://stackoverflow.com/comment/35864119
has comment: http://stackoverflow.com/comment/35839151
duplicate of: http://stackoverflow.com/q/3261513
tagged with: java
downvote count: 3
has comment: http://stackoverflow.com/comment/35837563
has comment: http://stackoverflow.com/comment/35837530
upvote count: 1
tagged with: tomcat7
has body: I am looking for a code which will deliberately crash my Tomcat Server. EDIT (moved from comments) I did this but it still doesnot crash ArrayList list = new ArrayList(); for (int i = 0; i &lt; Integer.MAX_VALUE; i++) { list.add(new Object()); } I have tried static Lists, HashMaps but I am still not able to cause java.lang.OutOfMemoryError: Java heap space Thanks
type: Question
tagged with: jvm-crash
has comment: http://stackoverflow.com/comment/35839162
has answer: http://stackoverflow.com/a/23392442
has comment: http://stackoverflow.com/comment/35837627
answer count: 1
has title: Can any one tell me how to crash tomcat deliberately with java out of heap exception
has comment: http://stackoverflow.com/comment/35837680
favorite count: 0
has comment: http://stackoverflow.com/comment/35838687
tagged with: static

http://stackoverflow.com/comment/35918827
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/23435518
type: Comment
has text: @user3580294 You just specify that you create a 2D array but you don't specify the length of the sub arrays. So you can do something like `a[0] = new int[3]; a[1] = new int[4];`. It can be pretty useful when you don't know the length of the subarrays, like in this [case](http://stackoverflow.com/questions/23324347/convert-list-of-arraylist-of-objects-into-object/23324401#23324401) per example. =)

http://stackoverflow.com/comment/35724985
type: Comment
comment on: http://stackoverflow.com/a/23330635
has text: Thanks EJP. "... or a String argument naming an explicit keystore type." - what type is used for "trusted certificates"?
score: 0
type: AnswerComment

http://stackoverflow.com/a/23389785
accepted answer of: http://stackoverflow.com/q/23388700
score: 0
type: AcceptedAnswer
has body: You can use Hash Map for this. Create a class that first reads the headers(i.e username, password etc...) then the data, and map them together. public HashMap&lt;String, String&gt; variables = new HashMap&lt;String, String&gt;(); variables.put("Username", "//div[@username]"); variables.put("Password", "//div[@password]"); You can add as many elements as you want to a hash map. Take a look at apache-poi for reading data from Excel and parsing it to the Hash map.
type: Answer
answers question: http://stackoverflow.com/q/23388700

http://stackoverflow.com/comment/35706341
comment on: http://stackoverflow.com/a/23320846
type: AnswerComment
has text: Yes. Strings have a natural ordering, which is the lexicographic order. All the other basic types (Integer, Long, Double, Date, etc.) also have a natural ordering, so that you can easily compare complex objects by their fields. See http://docs.oracle.com/javase/7/docs/api/java/lang/String.html#compareTo%28java.lang.String%29
type: Comment
score: 0

gmail
type: Tag
tags question: http://stackoverflow.com/q/23423007
tags question: http://stackoverflow.com/q/23424003
tag name: gmail

http://stackoverflow.com/comment/35704983
score: 0
has text: in `POST` method handler return to `input.jsp` instead of `output.jsp`.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23319699

http://stackoverflow.com/a/23405298
answers question: http://stackoverflow.com/q/23403950
type: Answer
has comment: http://stackoverflow.com/comment/35861750
score: 2
downvote count: 0
upvote count: 2
has body: A Hashmap only has one value for each key, so this will not be possible. You would need a Multimap for this (as in Guava for example), or a Map to a List of values.
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23403950

http://stackoverflow.com/comment/35729787
score: 0
type: AnswerComment
type: Comment
has text: @Java1 what looks simple in this ? imo split was simpler
comment on: http://stackoverflow.com/a/23332847

http://stackoverflow.com/comment/35695264
score: 0
type: Comment
type: QuestionComment
has text: wat do u mean? I tried changing it to Scanner scan = new Scanner(empFile); but I got an error.
comment on: http://stackoverflow.com/q/23314711

http://stackoverflow.com/a/23386034
has comment: http://stackoverflow.com/comment/35825915
downvote count: 0
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/23385326
has comment: http://stackoverflow.com/comment/35826483
type: Answer
has body: The data you have is not valid JSON, as it's in this format: x,y,z ... even though x, y and z are all JSON arrays, the actual string itself is not a JSON array. JSONArray parses no further than it needs to, to read what it deems valid JSON, and stops parsing after that. You need to put the data in valid JSON format: [x,y,z] then you can parse it with JSONArray. If your input is always this invalid JSON, you could correct it like so: JSONArray ja = (JSONArray) JSONSerializer.toJSON("[" + badJsonString + "]"); EDIT: you're using a 4-year old, no-longer-supported fork of the original json.org Java library rather than the supported, up to date, original json.org Java library, so I've changed the code snippet to match. EDIT: looking at your data, it's not valid JSON data even after the arrays. You have: valid JSON array, valid JSON array,empty valid JSON array,,empty valid JSON array, empty valid JSON array,no data,no data,no data,no data,no data,text without quotes,text without quotes,text without quotes,text without quotes This couldn't be parsed by any JSON parser. If your data is really in this format, you need to combine a JSON parser with your own parser, e.g. while (stillDataToRead) { if (nextChar == '[') { parseJSONArrayAndAdvanceTheCursor(); ignoreCommaAndAdvanceTheCursor(); } else if (nextChar == ',') { recordABlankField(); } else { readAnUnquotedStringUpToTheNextComma(); } } Alternatively... get that data in proper JSON format! [[{"id":"id","name":"","age":"","desig":"salary","dept":""}], [{"id":"id","name":"","age":"","desig":"salary","dept":""}],[],[], [],null,null,null,null,null,"ABC","ABC","XYZ",false,"Hello"]
has comment: http://stackoverflow.com/comment/35826735

http://stackoverflow.com/comment/35833065
type: AnswerComment
type: Comment
has text: Yes inside controller accept String parameter and when you post data to controller convert your binary data into a base64 encoded string and post to that controller. inside controller you could decode that string into binary. you could find lot of link on net about use of Base64 in java.
comment on: http://stackoverflow.com/a/23389774
score: 0

http://stackoverflow.com/a/23432399
answers question: http://stackoverflow.com/q/23421099
has body: There seems to be a bit of confusion about some of the configuration options here. To start with, the expired-url attribute is not relevant, since you are treating multiple logins as an error. It only applies if you permit a second login which will then cause the first to be "expired". Check out the documentation for the namespace configuration. The session-authentication-error-url attribute doesn't apply here either. To quote from the manual: The second login will then be rejected. By “rejected”, we mean that the user will be sent to the authentication-failure-url if form-based login is being used. If the second authentication takes place through another non-interactive mechanism, such as “remember-me”, an “unauthorized” (402) error will be sent to the client. If instead you want to use an error page, you can add the attribute session-authentication-error-url to the session-management element. So it is only used if something like remember-me authentication is used.
score: 0
has comment: http://stackoverflow.com/comment/35913710
type: Answer
has comment: http://stackoverflow.com/comment/35914461

http://stackoverflow.com/a/23335122
has comment: http://stackoverflow.com/comment/35747044
has body: Do away with startsendingdata() and startgettingdata(). In the onPostExecute() of the tasks initiate the start of the next task. Now you are sure a task is finished before starting a new one. For instance you could start a timer which executes the next task.
score: 0
has comment: http://stackoverflow.com/comment/35752421
answers question: http://stackoverflow.com/q/23331742
type: Answer

http://stackoverflow.com/q/23451175
answer count: 1
downvote count: 0
favorite count: 0
type: UnansweredQuestion
tagged with: maven
tagged with: spring
has answer: http://stackoverflow.com/a/28239785
tagged with: java
has title: Spring Jersey: java.lang.NoSuchMethodError: org.glassfish.jersey.server.ServerProperties.getValue?
type: Question
tagged with: jersey
score: 4
upvote count: 4
has body: My web.xml looks like InventoryApplication org.glassfish.jersey.servlet.ServletContainer InventoryApplication /rest/* org.springframework.web.context.ContextLoaderListener contextConfigLocation classpath:applicationContext.xml and endpoint as @Component @Path("/hello") public class HelloResource { @GET public void hello() { System.out.println("REQUEST RECEIVED"); } } when I deploy this using cargo as mvn:cargo:run, I see error as [INFO] [talledLocalContainer] May 03, 2014 5:09:59 PM org.apache.catalina.core.StandardWrapperValve invoke [INFO] [talledLocalContainer] SEVERE: Allocate exception for servlet com.yahoo.pryme_services.inventory.services.InventoryApplication [INFO] [talledLocalContainer] java.lang.NoSuchMethodError: org.glassfish.jersey.server.ServerProperties.getValue(Ljava/util/Map;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Class;)Ljava/lang/Object; [INFO] [talledLocalContainer] at org.glassfish.jersey.servlet.WebComponent.<init>(WebComponent.java:315) [INFO] [talledLocalContainer] at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:169) [INFO] [talledLocalContainer] at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:359) [INFO] [talledLocalContainer] at javax.servlet.GenericServlet.init(GenericServlet.java:158) [INFO] [talledLocalContainer] at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1284) [INFO] [talledLocalContainer] at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1197) [INFO] [talledLocalContainer] at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:864) [INFO] [talledLocalContainer] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:134) [INFO] [talledLocalContainer] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122) [INFO] [talledLocalContainer] at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501) [INFO] [talledLo…

http://stackoverflow.com/q/23372154
downvote count: 0
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/35801216
has comment: http://stackoverflow.com/comment/35800951
has comment: http://stackoverflow.com/comment/35801111
tagged with: synchronization
has answer: http://stackoverflow.com/a/23372352
upvote count: 2
tagged with: multithreading
linked to: http://stackoverflow.com/q/3168430
answer count: 1
has title: When should I worry about spurious wakeups when using java.util.concurrent classes
tagged with: java
has comment: http://stackoverflow.com/comment/35800998
has body: I know that if I call Object.wait() I have to account for spurious wakeups so I should wrap the wait in a while loop that checks if my actual terminating condition was reached. But in cases where I use java.util.concurrent.* classes should I still worry about that? I am using a java.util.concurrent.BlockingQueue and I want to know if when I do queue.take() I should expect that sometimes take() will stop blocking because of a spurious wakeup (InterruptedException) and not because it actually read something from the queue. In other words, if spurious wakeups are a risk, I need to catch the InterruptedException INSIDE a while loop that actually checks for termination. If they are not, then I should probably leave InterruptedExceptions break the main-loop and stop processing when I get one Or in code @Override public void run() { while(running()) { try { queue.take(); } catch (InterruptedException exc) { log.warn("Spurious wakeup, ignore and try again"); } } } vs @Override public void run() { try { while(running()) { queue.take(); } } catch (InterruptedException exc) { log.error("Some other reason for InterruptedException, finish thread"); } }
accepted answer: http://stackoverflow.com/a/23372352
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35801165

http://stackoverflow.com/comment/35729556
comment on: http://stackoverflow.com/q/23333299
type: Comment
type: QuestionComment
has text: see http://stackoverflow.com/questions/4750131/make-java-properties-available-across-classes
score: 0

http://stackoverflow.com/q/23439878
tagged with: java
has comment: http://stackoverflow.com/comment/35927055
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/23439929
has comment: http://stackoverflow.com/comment/35927036
has comment: http://stackoverflow.com/comment/35927029
downvote count: 4
answer count: 2
has comment: http://stackoverflow.com/comment/35927017
has title: Expected ')' (using netbeans)
has body: try { if (txtID.getText().isEmpty() || txtLname.getText().isEmpty() || txtFname.getText().isEmpty() || txtMname.getText().isEmpty() || jTextField1.getText().isEmpty() || jTextField2.getText().isEmpty() || jTextField3.getText().isEmpty()) { JOptionPane.showMessageDialog(null, "Fill Up All The Fields"); } else { if (btnReg.getText().equals("REGISTER")) { stm.execute("insert into tblregular(ID, LNAME, FNAME, MNAME, VLEAVE, SLEAVE, TOTAL) values" + "('" + txtID.getText().trim() + "'" + ",'" + txtLname.getText().trim().toUpperCase() + "'" + ",'" + txtFname.getText().trim().toUpperCase() + "'" + ",'" + txtMname.getText().trim().toUpperCase() + "'" + ",'" + jTextField1.getText().trim().toUpperCase() + "'" + ",'" + jTextField2.getText().trim().toUpperCase() + "'" + ",'" + jTextField3.getText().trim().toUpperCase() + "'" JOptionPane.showMessageDialog(null, "Registration Successfull"); } else { txtID.setText(""); txtLname.setText(""); txtFname.setText(""); txtMname.setText(""); jTextField1.setText(""); jTextField2.setText(""); txtMname.setText(""); } } } catch (Exception e) { System.out.println(e); } In the line + ",'"+jTextField3.getText().trim().toUpperCase()+"'"- it says Expected ')' what is my error there? what to do, what to add, what to remove, i can't help my self out. please help me out.
favorite count: 0
has comment: http://stackoverflow.com/comment/35927039
type: UnansweredQuestion
score: -3
has answer: http://stackoverflow.com/a/23439930
tagged with: netbeans

http://stackoverflow.com/q/23400102
answer count: 2
has title: How do I apply an if statement condition to every element on an arraylist?
linked to: http://stackoverflow.com/q/18410035
favorite count: 0
has comment: http://stackoverflow.com/comment/35852443
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23400151
has comment: http://stackoverflow.com/comment/35852437
has comment: http://stackoverflow.com/comment/35852465
tagged with: java
score: -4
upvote count: 1
has body: Basically I want to know how to apply an if condition to every element of an arraylist. Here's my code. System.out.println("Type positive integers less than 40: "); ArrayList&lt;Integer&gt; inRay = new ArrayList&lt;Integer&gt;(); Scanner sc = new Scanner(System.in); while (sc.hasNext()) { inRay.add(sc.nextInt()); } //this is where the problem starts// int i; if (inRay.get(i) &gt; 40) { System.out.println("You had one job."); System.exit(0); } I would like to apply an if condition where if a value in the array list is over 40, it exits.
type: Question
duplicate of: http://stackoverflow.com/q/18410035
tagged with: if-statement
downvote count: 5
has answer: http://stackoverflow.com/a/23400153
tagged with: arraylist

http://stackoverflow.com/comment/52065846
type: AnswerComment
comment on: http://stackoverflow.com/a/32019244
type: Comment
has text: This didn't affect my logger at all. I used `setLevel(logger, Level.ERROR);` and logger.debug statements still printed. My log4j2.xml file is at http://pastebin.com/fcbV2mTW
score: 3

http://stackoverflow.com/q/23374473
tagged with: java
has comment: http://stackoverflow.com/comment/35806284
has comment: http://stackoverflow.com/comment/35807338
tagged with: sorting
type: UnansweredQuestion
type: Question
linked to: http://stackoverflow.com/q/38461016
has comment: http://stackoverflow.com/comment/35815303
answer count: 0
has body: I have been trying to sort a linked list and all has been to no avail. The format of my sort are: for sorting by firstname, by age, any other number by lastname. I have posted my code snippet below. But each time I run my program, I get error saying "This file cannot be accessed because another process is using the file" I will appreciate your contribution. All of my other codes runs perfectly without problems. I am very sure of that. The sorting is the only problem I have. Many thanks public void sort(int order) { switch(order){ case 1: Node tempVar; for (Node cur = head; cur != null; cur = cur.next) { for (Node cux = head; cux != null; cux = cux.next) { if(compareByFN(cur, cux)==1) { tempVar = cux; cux= cur; cur = tempVar; } } } break; case 2: Node tempVar3; for (Node cur = head; cur != null; cur = cur.next) { for (Node cux = head; cux != null; cux = cux.next) { if(compareByAge(cur, cux)==1) { tempVar3 = cux; cux= cur; cur = tempVar3; } } } break; default: Node tempVar2; for (Node cur = head; cur != null; cur = cur.next) { for (Node cux = head; cux != null; cux = cux.next) { if(compareByLN(cur, cux)==1) { tempVar2 = cux; cux= cur; cur = tempVar2; } } } break; } } private int compareNulls(Node event1, Node event2) { if (event1 == null &amp;&amp; event2 == null) return 0; else if (event1 == null ) { return -1; } else { return 1; } } private int compareByFN(Node event1, Node event2) { int comp = event1.data.getFn().compareTo(event2.data.getFn()); if (event1 == null || event2 == null) return compareNulls(event1, event2); else if (comp==0) return 0; else if (comp&lt;0) return -1; else return 1; } private int compareByLN(Node event1, Node event2) { int comp = event1.data.getLn().compareTo(event2.data.getLn()); if (event1 == null || event2 == null) return compareNulls(event1, event2); else if (comp==0) return 0; else if (comp&lt;0) return -1; else return 1; } private int compareByAge(Node event1, Node event2) { return compare(event1.data.getDob(), event2.data.getDob()); …
has comment: http://stackoverflow.com/comment/66453847
score: 0
has title: How to Sort a user Defined LinkedList
tagged with: linked-list

large-files
tags question: http://stackoverflow.com/q/23375286
type: Tag
tag name: large-files
tags question: http://stackoverflow.com/q/23438265

http://stackoverflow.com/comment/35749064
has text: if the length of white could be one, two, three or four five etc, what will happen on beta-lipoic acid. There is a space there. any other way to determine the space within the word or it is the delimiter.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23342296

http://stackoverflow.com/a/23386605
type: Answer
answers question: http://stackoverflow.com/q/23386517
upvote count: 1
downvote count: 0
score: 1
has body: In other words, can you write server program that that contains client connecting to itself? The answer is yes, surely. All integration tests do this running in-process server and connecting to it.

http://stackoverflow.com/comment/35947084
has text: Perhaps it's the fact that your code is locking on your `Console` object, so you can either read a line from your `Console` object or write a line to it. Are you handling in/out through the `System.in` and `System.out` or through your own `Console` object?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23450400

http://stackoverflow.com/a/23438229
has body: You probably meant to add the existing instance of Listener as a listener, but you are using a new instance instead. Try changing: canvas.addKeyListener(new Listener()); to: canvas.addKeyListener(this); EDIT: I assumed that the key listener did not work. But there is a problem with GLEventListener listener. The problem with image that is not displayed is that GLEventListener registered on yet another instance of Listener. The image is loaded, but display() is called on a different (not visible) frame. The first time it works because initial loadImage(); is executed from init(). You actually have three frames allocated and registered for different tasks. Try to get rid of a static frame to simplify things. For example add a constructor: public Listener() { GLProfile glp = GLProfile.getDefault(); GLCapabilities caps = new GLCapabilities(glp); GLCanvas canvas = new GLCanvas(caps); setSize(300, 300); add(canvas); setVisible(true); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); canvas.addGLEventListener(this); canvas.addKeyListener(this); FPSAnimator animator = new FPSAnimator(canvas, 60); animator.start(); } Refactor the main to: public static void main(String[] args) { new Listener(); } And get rid of a static frame: //static JFrame frame = new JFrame();
has comment: http://stackoverflow.com/comment/35928233
score: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23438120
accepted answer of: http://stackoverflow.com/q/23438120
type: Answer
has comment: http://stackoverflow.com/comment/35924603

http://stackoverflow.com/q/23396700
tagged with: java
has comment: http://stackoverflow.com/comment/35846701
type: Question
has comment: http://stackoverflow.com/comment/35846698
tagged with: processing
tagged with: canvas
tagged with: 3d
has comment: http://stackoverflow.com/comment/35846767
has body: my question is about the order of items that are shown on Processing. When I execute processing, it shows the text above the rectangle, but when I use HTML to show the same processing.pde file, it shows the text behind the rectangle! I was wondering if anyone can help me in this matter or tell me how to change the sequence of items in Processing. Thank you. (unfortunately, I could not post an image because of my low reputation.) PFont f; void setup() { size(300, 300, P3D); f = createFont("Arial",16,true); // Arial, 16 point, anti-aliasing on textFont(f,11); rectMode(CENTER); } void draw() { pushMatrix(); stroke(255); fill(255); rect(80, 150, 100, 30); fill(0); text ("TesT", 80, 138); popMatrix(); } and the HTML code that run this is:
upvote count: 1
tagged with: http://stackoverflow.com/tag/html
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/35846830
has comment: http://stackoverflow.com/comment/35847250
has title: Controlling the sequence in Processing (HTML and Processing show items in different order!)
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35847097
has answer: http://stackoverflow.com/a/23397546
score: 1
accepted answer: http://stackoverflow.com/a/23397546

http://stackoverflow.com/comment/35950349
type: QuestionComment
comment on: http://stackoverflow.com/q/23448848
has text: **UPDATE:** Upon reviewing the Netbeans page for applet creation(Below), I have attempted all formats of what was presented, in JApplet and Applet formats, with JDKs 1.8 and 1.7 in consideration that perhaps something was amiss or corrupted. Both JDKs were reinstalled just in case, yet still nothing has functioned. https://netbeans.org/kb/docs/web/applets.html
score: 0
type: Comment

http://stackoverflow.com/q/23401463
has comment: http://stackoverflow.com/comment/35854949
has answer: http://stackoverflow.com/a/23401519
type: UnansweredQuestion
tagged with: swing
tagged with: jtextfield
downvote count: 1
tagged with: java
score: -1
type: Question
has comment: http://stackoverflow.com/comment/35855007
has body: import javax.swing.*; import javax.swing.table.DefaultTableModel; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; public class GUI extends JFrame{ String [] col = {"Last Name", "First Name", "HKID", "Student ID", "Final Exam Score"}; String [][] data = new String [1][5]; public JFrame j; public JPanel p; public JLabel search; public JTextField s; public JButton enter; public JButton NEW; public JButton unedit; public JButton update; public JButton exam; public DefaultTableModel model = new DefaultTableModel(data, col);; public JTable jt = new JTable(model); public GUI(){ setVisible(true); setSize(600,400); setTitle("Student Record Management System"); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); p = new JPanel(); search = new JLabel("Search: "); s = new JTextField(" "); enter = new JButton("Enter"); enter.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ enterPressed(); } }); p.add(search); p.add(s); p.add(enter); NEW = new JButton("Edit"); NEW.setBounds(10,10,20,20); NEW.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ updatePressed(); } }); p.add(NEW); unedit = new JButton("Unedit"); unedit.setBounds(70,80,20, 20); unedit.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ uneditPressed(); } }); p.add(unedit); update = new JButton("Add Student"); update.setBounds(50,40,20,20); update.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ NEWpressed(); } }); p.add(update); jt.setEnabled(false); jt.setAutoCreateRowSorter(true); jt.setPreferredScrollableViewportSize(new Dimension(500,300)); jt.setFillsViewportHeight(true); jt.setBackground(Color.GRAY); jt.setAlignmentY(BOTTOM_ALIGNMENT); JScrollPane jps = new JScrollPane(jt); p.add(jps); add(p); } public void NEWpressed(){ model.addRow(new Object[]{" ", " ", " ", " ", " "}); } public void updatePressed(){ jt.setEnabled(true); } public void une…
upvote count: 0
answer count: 1
tagged with: user-interface
has comment: http://stackoverflow.com/comment/35859051
has comment: http://stackoverflow.com/comment/35854964
tagged with: jtable
has title: Asking what is wrong with enterPressed method?
has comment: http://stackoverflow.com/comment/35854953
favorite count: 0

http://stackoverflow.com/comment/36240986
comment on: http://stackoverflow.com/a/23355163
has text: Yes, I guess if you want to fall back you would need to do something like that. But it becomes more complicated as you would need to adjust the other Matcher. You could possibly use `find(index)`, `start()` and `end()`.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/35688969
has text: @tom, its ok to go with storing it in session, but my scenario is different in which two servers are talking through URL redirect thus the session of one server is different from that of other,what I am actually trying to do is a SSO(Single Sign Out), with some way that I am able to validate the token signature in other server without communicating with the server which generated the number or storing it in database.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23298136
type: QuestionComment

http://stackoverflow.com/comment/35801632
has text: Possible duplicate http://stackoverflow.com/questions/7849539/comparison-method-violates-its-general-contract-java-7-only
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23372535

http://stackoverflow.com/a/23327111
has body: That time is how long the thread has been alive, consider using a separate variable for timing. You can always initialize it to SystemClock.currentThreadTimeMillis() and deduct SystemClock.currentThreadTimeMillis() whenever you want to display the value
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/36512374
answers question: http://stackoverflow.com/q/23327082

http://stackoverflow.com/comment/35769847
has text: 902 1553 1504 3005 100..this is what has been written to my destination file. with your pre appended text... is that your expected o/p what i am getting ?
comment on: http://stackoverflow.com/a/23355070
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/35767808
comment on: http://stackoverflow.com/q/23354103
has text: I've used println's in ClassB through the building of all the objects. Then I used println(arrayOfObjects.size()) in ClassA to insure it showed up. Short of using a println in the while loop above (which JTable does for me) I don't know where else to check. Thats how and why I posted the code I did. Is there something else you'd reccomend?
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/35903225
type: AnswerComment
comment on: http://stackoverflow.com/a/23426626
type: Comment
has text: No, anybody can use the app but if you want to use it, you have to connect to your QuickBooks (via oAUTH) account using the connect to QuickBooks button on the app home page. A HTTP session keeps track of the access token/secret for subsequent requests to the API, but the session expires after 30 minutes of inactivity. It just means that my clients have a QuickBooks username/password already, and so I don't have to make them come up with more usernames/passwords and have the server manage them. The user can disconnect too, but I want the tokens to expire in case they forget to disconnect.
score: 0

http://stackoverflow.com/q/23302096
tagged with: linkedhashset
favorite count: 0
has body: Consider the following SSCCE: public static void main(String[] args) { LinkedHashSet&lt;String&gt; set1 = new LinkedHashSet&lt;&gt;(); set1.add("Bob"); set1.add("Tom"); set1.add("Sam"); LinkedHashSet&lt;String&gt; set2 = new LinkedHashSet&lt;&gt;(); set2.add("Sam"); set2.add("Bob"); set2.add("Tom"); System.out.println(set1); System.out.println(set2); System.out.println(set1.equals(set2)); } This prints: [Bob, Tom, Sam] [Sam, Bob, Tom] true Yet if you change LinkedHashSet to LinkedList: public static void main(String[] args) { LinkedList&lt;String&gt; set1 = new LinkedList&lt;&gt;(); set1.add("Bob"); set1.add("Tom"); set1.add("Sam"); LinkedList&lt;String&gt; set2 = new LinkedList&lt;&gt;(); set2.add("Sam"); set2.add("Bob"); set2.add("Tom"); System.out.println(set1); System.out.println(set2); System.out.println(set1.equals(set2)); } it produces: [Bob, Tom, Sam] [Sam, Bob, Tom] false My question is one of clarification. Can someone help make sense of this? Why would a LinkedHashSet be considered equals whereas the same LinkedList would not? I'm assuming the definition of List and Set plays a role, but I'm not sure. Basically, I'm saying if you consider the Sets to be the same, wouldn't you consider the Lists to be the same too? And vice-versa (assuming no duplicate elements)?
tagged with: equals
accepted answer: http://stackoverflow.com/a/23302116
score: 11
upvote count: 11
type: AnsweredQuestion
tagged with: linked-list
tagged with: java
tagged with: collections
type: Question
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/23302116
has title: LinkedHashSet .equals() vs LinkedList .equals() with same elements but different order
possible better answer: http://stackoverflow.com/a/42707949
has answer: http://stackoverflow.com/a/42707949

http://stackoverflow.com/comment/35688150
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23310627
has text: i dont have any plugin when i run same code on console it print actual value
score: 0

http://stackoverflow.com/comment/35795925
has text: I think it's very difficult case. Like a magic for me.
comment on: http://stackoverflow.com/q/23369595
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/q/23299143
has comment: http://stackoverflow.com/comment/35734757
tagged with: jndi
tagged with: java
has body: My purpose - create test for DAO layer. My Hibernate config has datasourse specified throught JNDI. Also I use Jboss 5.1 so transaction lookup is necessary. java:jdbc/MysqlDS org.hibernate.transaction.JTATransactionFactory org.hibernate.transaction.JBossTransactionManagerLookup To make test I need bind these things. Todo this I create class util to bind. Full code below public class RegisteringJNDIWithDataSource { public static final String JNDI_MY_DS = "java:jdbc/MysqlDS"; private static final String MYSQL_USER = "user"; private static final String MYSQL_PASS = "pass"; private static final String MYSQL_HOST = "localhost"; public static String CTX_INITIAL_CONTEXT_FACTORY = "org.jnp.interfaces.NamingContextFactory"; public static String CTX_URL_PKG_RPEFIXES = "org.jboss.naming"; private void startRegistry() throws NamingException, RemoteException { System.out.println(LocateRegistry.getRegistry()); Registry reg = LocateRegistry.createRegistry(1099); NamingServer server = new NamingServer(); NamingContext.setLocal(server); System.out.println("RMI registry Stared."); } public InitialContext createInitialContextContext() throws NamingException { System.setProperty(Context.URL_PKG_PREFIXES, CTX_URL_PKG_RPEFIXES); System.setProperty(Context.INITIAL_CONTEXT_FACTORY, CTX_INITIAL_CONTEXT_FACTORY); InitialContext initialContextcontext = new InitialContext(); return initialContextcontext; } /** * Registry the following JNDIs * * @throws RemoteException * @throws NamingException */ public void registrate() throws RemoteException, NamingException { startRegistry(); InitialContext ic; ic = createInitialContextContext(); String[] cxts = JNDI_MY_DS.split("/"); String inCxt = cxts[0]; createSubcontext(ic, inCxt); for (int i = 1; i < cxts.length - 1; i++) { // if the data source name is like java:/comp/mysqldatasource // this takes care of creating subcontexts in jndi inCxt = inCxt + "/" + cxts[i]; createSubcontext(ic, inCxt); } ic.rebind(JNDI_MY_DS, createMysqlDataSource("db_name"));…
tagged with: jboss
type: Question
has comment: http://stackoverflow.com/comment/35683180
score: 0
tagged with: junit
has comment: http://stackoverflow.com/comment/35734520
tagged with: initial-context
has comment: http://stackoverflow.com/comment/35667167
answer count: 0
type: UnansweredQuestion
has title: Exception when I try create JNDI Subcontext from JUnit

http://stackoverflow.com/q/23368240
has answer: http://stackoverflow.com/a/23368662
score: 0
has comment: http://stackoverflow.com/comment/35833323
has comment: http://stackoverflow.com/comment/35835316
has comment: http://stackoverflow.com/comment/35832643
has comment: http://stackoverflow.com/comment/35800453
has comment: http://stackoverflow.com/comment/35832723
tagged with: android
tagged with: http://stackoverflow.com/tag/html
has comment: http://stackoverflow.com/comment/35836287
has body: StackOverflowers! I load some text from a webpage. Everything works fine, and shows up in the TextViews. But, when the blogs on the webpage have some words with special characters like an: é or something. My Textview show characters like these: Á©.. Can anybody tell what I need to import, call or something like that to show everything tidy? Thanks, UPDATE 1 + 2: TextView intro_text = (TextView) item_view.findViewById(R.id.item_intro); intro_text.setText(Html.fromHtml(current_post.get_intro())); current_post.get_intro() is the adres where the loaded text is. :-) Because I use a listview with many rows.. EDIT: public class connectTask extends AsyncTask&lt;String, String, String&gt; { @SuppressWarnings({ "deprecation" }) @Override protected String doInBackground(String... message) { Log.v("Correct Load", "Starting "); URL u; InputStream is = null; DataInputStream dis; String s; try { Log.v("Connecting..."); u = new URL("http://......."); is = u.openStream(); dis = new DataInputStream(new BufferedInputStream(is)); Log.v("Connected"); try { while ((s = dis.readLine()) != null) { if (s.contains("post_wrapper")) { for (int i = 0; i &lt; j; i++) { while ((s = dis.readLine()) != null) { if (s.contains("post_intro")) { break; } } if (s != null) { s = dis.readLine(); Log.v("Intro", s); intro[i] = s.substring(s.indexOf("&lt;p&gt;") + 3, s.indexOf("&lt;/p&gt;")); Log.e("Intro", "Found intro:" + intro[i]); } } } } } catch (Exception e) { e.printStackTrace(); } } catch (MalformedURLException mue) { System.out.println("Ouch - a MalformedURLException happened."); mue.printStackTrace(); System.exit(1); } catch (IOException ioe) { System.out.println("Oops- an IOException happened."); ioe.printStackTrace(); System.exit(1); } finally { try { if (is != null) is.close(); } catch (IOException { } } return null; } This is the read/received part.
has comment: http://stackoverflow.com/comment/35835179
tagged with: utf-8
tagged with: textview
has comment: http://stackoverflow.com/comment/35832789
has comment: http://stackoverflow.com/comment/35835165
has comment: http://stackoverflow.com/comment/35836748
has comment: http://stackoverflow.com/comment/35832642
has comment: http://stackoverflow.com/comment/35800387
has comment: http://stackoverflow.com/comment/35833033
has comment: http://stackoverflow.com/comment/35794039
has comment: http://stackoverflow.com/comment/35833976
has answer: http://stackoverflow.com/a/23391247
has comment: http://stackoverflow.com/comment/35793300
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35820725
has comment: http://stackoverflow.com/comment/35832663
tagged with: java
has comment: http://stackoverflow.com/comment/35832595
has title: TextViews with utf-8 and special characters
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/23368662
accepted answer: http://stackoverflow.com/a/23391247

http://stackoverflow.com/q/23369600
has answer: http://stackoverflow.com/a/23370148
type: Question
has comment: http://stackoverflow.com/comment/35795969
has answer: http://stackoverflow.com/a/23369792
has comment: http://stackoverflow.com/comment/35796139
score: 0
has comment: http://stackoverflow.com/comment/35796557
answer count: 3
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/35795993
favorite count: 0
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/35796575
has body: I am making a game on android and I wanted to use a loop in a onClickListener to display a dialog which is stored in String.xml I set some code but the app crashes, there are no error in eclipse but I don't know what's wrong. So plz help check the code. I will show the code which I can run without crash(with onClickListener ,without the loop) and the wrong code which caused the crash(with the loop I wrote, I guess somethings wrong there) The one that don't crash package com.group5.littlered; import android.app.Activity; import android.content.Intent; import android.media.MediaPlayer; import android.os.Bundle; import android.view.View; import android.view.Window; import android.view.WindowManager; import android.widget.Button; import android.widget.TextView; public class Scene1 extends Activity{ MediaPlayer wovleshowling; MediaPlayer bgm; @Override public void onBackPressed(){} @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); //Remove title bar this.requestWindowFeature(Window.FEATURE_NO_TITLE); //Remove notification bar this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); setContentView(R.layout.activity_scene1); Intent intent = getIntent(); Button next = (Button) findViewById(R.id.wtf); next.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub } } ); //BGM bgm = MediaPlayer.create(Scene1.this, R.raw.unsettledthoughts); bgm.setLooping(true); bgm.start(); //wovleshowling wovleshowling = MediaPlayer.create(Scene1.this, R.raw.wolveshowling); wovleshowling.setLooping(false); wovleshowling.start(); } } The one that crashed : package com.group5.littlered; import android.app.Activity; import android.content.Intent; import android.media.MediaPlayer; import android.os.Bundle; import android.view.View; import android.view.Window; import android.view.WindowManager…
has comment: http://stackoverflow.com/comment/35796267
tagged with: onclicklistener
has answer: http://stackoverflow.com/a/23369900
has comment: http://stackoverflow.com/comment/35796338
tagged with: java
has title: App crashes when intent a new activity
tagged with: loops
tagged with: eclipse

http://stackoverflow.com/comment/35718673
comment on: http://stackoverflow.com/a/23327345
score: 0
type: AnswerComment
type: Comment
has text: Won't that delete the SectionStackSection out of the SectionStack?

http://stackoverflow.com/q/23339895
tagged with: jpa
downvote count: 0
answer count: 1
favorite count: 0
has body: I have the following situation. public class TestExecution { private Collection&lt;TestExecutionTag&gt; testExecutionTags; } public class TestExecutionTag { private Tag tag; } public class Tag { private String name; } What I now want to do is to perform following query using standard JPA Criteria API, something like: Select test executions (TestExecution) which don't have associated any of the tags (Tag) with name field value in provided list. I would describe it as Select testExecution WHERE testExecution.testExecutionTag.tag.name NOT IN (&lt;ArrayList of String values&gt;). Is something like this possible? EDIT: I'm sorry I didn't specify it correctly, since I thought it's irrelevant. The whole goal was actually to select test executions with specific tags but from them exclude those which contain other tags.
has answer: http://stackoverflow.com/a/23358753
linked to: http://stackoverflow.com/q/5115422
has comment: http://stackoverflow.com/comment/35772664
type: AnsweredQuestion
score: 1
tagged with: java
has title: JPA Criteria API - how to select like "field not in"
tagged with: criteria-api
upvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/23358753
linked to: http://stackoverflow.com/q/1578644
has comment: http://stackoverflow.com/comment/35740775

http://stackoverflow.com/q/23356807
has comment: http://stackoverflow.com/comment/35772695
has body: How can I instantiate an array of object of a Generic Class? I was implementing a Hash Table in Java. The Generic Class to be instantiated: class GenericLinkedList&lt;T&gt; { // Generic Class Codes Here } Hash Table Class: public class HashTable { private GenericLinkedList[] table; // Generic Class Instantiation private static final int SIZE = 50; public HashTable() { this.table = new GenericLinkedList[SIZE]; for(int i = 0; i &lt; SIZE; i++) this.table[i] = new GenericLinkedList(); } }
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/35772306
has answer: http://stackoverflow.com/a/23356872
score: 0
linked to: http://stackoverflow.com/q/18581002
answer count: 3
has answer: http://stackoverflow.com/a/23357114
tagged with: generics
has answer: http://stackoverflow.com/a/23403731
favorite count: 0
linked to: http://stackoverflow.com/q/529085
accepted answer: http://stackoverflow.com/a/23357114
has title: Instantiating an array of Generic Class
possible better answer: http://stackoverflow.com/a/23403731
upvote count: 1
tagged with: collections
downvote count: 1
type: AnsweredQuestion

http://stackoverflow.com/a/23399577
type: Answer
accepted answer of: http://stackoverflow.com/q/23399485
upvote count: 4
answers question: http://stackoverflow.com/q/23399485
downvote count: 0
has body: Label doesn't wrap, so long text is hidden, or you have to make the form ultra wide use HTML JText Area has the same issue unless you define a number of columns, and I want to fill the space available. A set number of columns won't resize. use word and line wrap A set number of columns won't resize. and together with "I also don't really want to have scroll bars" put JTextArea to JScrollPane, to disable JScrollBars, set null for Borders from JScrollPane JTextPane wraps but as far as I can tell it won't turn red unless you get into the whole way over complicated StyledDocument bit. I don't want to do anything more complicated than change the text color so this seems like overkill. use HighLighter, but nothing clear from posted description about your issue with StyledDocument
score: 4
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35851880

http://stackoverflow.com/comment/35949936
type: AnswerComment
score: 0
has text: @j_random_hacker Yeah, I just did that and made an edit. Thanks for the heads up. Nonetheless, much of what I've said still is quite applicable. I think the hardest part may be deciding which rotation angles will fit to the grid.
type: Comment
comment on: http://stackoverflow.com/a/23452206

http://stackoverflow.com/comment/35761804
comment on: http://stackoverflow.com/q/23339746
has text: Just a note that you shouldn't be starting new projects on Alfresco Explorer unless there are circumstances beyond your control that require you to do so. Use Alfresco Share instead.
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/q/23317380
has answer: http://stackoverflow.com/a/23323177
tagged with: persistence.xml
type: Question
accepted answer: http://stackoverflow.com/a/23323177
tagged with: jpa
score: 0
has title: Still getting PersistenceException: No Persistence provider for EntityManager
answer count: 1
tagged with: entitymanager
has body: I get such an exception after deploying my application: Caused by: javax.persistence.PersistenceException: No Persistence provider for EntityManager named JavaAcademyUnit at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:85) at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:54) at com.bogdankobylinsky.javaacademy.dao.impl.jpa.UserJPADAO.<init>(UserJPADAO.java:13) , which fails on this line: private EntityManager em = Persistence.createEntityManagerFactory("JavaAcademyUnit").createEntityManager(); JPA configuration descriptor persistance.xml file is located in the right place: ./WEB-INF/classes/META-INF/persistence.xml and contains: org.hibernate.jpa.HibernatePersistenceProvider jdbc/__JavaAcademy <exclude-unlisted-classes>false</exclude-unlisted-classes> <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/> <property name="hibernate.hbm2ddl.auto" value="update"/> pom.xml contains: mysql mysql-connector-java 5.1.6 org.hibernate hibernate-core 4.3.1.Final org.hibernate hibernate-entitymanager 4.3.1.Final org.hibernate.javax.persistence hibernate-jpa-2.0-api 1.0.1.Final Thanks for any help!
type: AnsweredQuestion
tagged with: java
tagged with: hibernate

http://stackoverflow.com/q/23377496
has comment: http://stackoverflow.com/comment/35812042
tagged with: android
answer count: 1
has title: Toggling Icons In ActionBarActivity
tagged with: android-actionbar-compat
has comment: http://stackoverflow.com/comment/35810894
has answer: http://stackoverflow.com/a/23378307
has comment: http://stackoverflow.com/comment/35811881
type: AnsweredQuestion
tagged with: android-appcompat
tagged with: java
type: Question
has body: I'm building an Android app using the AppCompat_v7 library and I'm having troubles with the action bar. I have an AppBarActivity which extends ActionBarActivity - I'm using the same actionbar for all of my activities. MainActivity extends AppBarActivity. I've defined four actionbar icons, two of which I'd like to be displayed at a time. I've been careful to define my own namespace, ie. app:showAsAction="always"/&gt; In my app, I toggle the visibility of these icons in onPrepareOptionsMenu() MenuItem contactOn = menu.findItem(R.id.contact_toggle_button_on); MenuItem contactOff = menu.findItem(R.id.contact_toggle_button_off); contactOn.setVisible(!useContacts); contactOn.setEnabled(!useContacts); contactOff.setVisible(useContacts); contactOff.setEnabled(useContacts); Do I need to specify a namespace here somehow? Because it doesn't seem that these methods are doing anything, except, curiously, rearranging their names in the overflow list. Also, only three of the four buttons show up there, which I don't understand either but I expect that's a different problem. UPDATE: posting code &amp; xml @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu items for use in the action bar MenuInflater inf = new MenuInflater(this); inf.inflate(R.menu.main, menu); return true; } @Override public boolean onPrepareOptionsMenu(Menu menu) { MenuItem contactOn = menu.findItem(R.id.contact_toggle_button_on); MenuItem contactOff = menu.findItem(R.id.contact_toggle_button_off); contactOn.setVisible(!useContacts); contactOn.setEnabled(!useContacts); contactOff.setVisible(useContacts); contactOff.setEnabled(useContacts); MenuItem locationOn = menu.findItem(R.id.location_toggle_button_on); MenuItem locationOff = menu.findItem(R.id.location_toggle_button_off); locationOn.setVisible(useLocation); locationOn.setEnabled(useLocation); locationOff.setVisible(!useLocation); locationOff.setEnabled(!useLocation); return true; } And the XML &lt;menu xmlns:android="http://schemas.…
accepted answer: http://stackoverflow.com/a/23378307
score: 0

http://stackoverflow.com/comment/35848533
comment on: http://stackoverflow.com/q/23397690
score: 1
type: Comment
has text: What is the exception? PLease add that to your question.
type: QuestionComment

http://stackoverflow.com/a/23445771
has comment: http://stackoverflow.com/comment/35938279
has comment: http://stackoverflow.com/comment/35938087
has body: You can do something like this: String[] array = new String[] { "A", "B", "C" }; int previousId = 0; // Loop through all the Strings in the array for(int i = 0; i &lt; array.length; i++) { // Get the text from the array String text = array[i]; // Create a new EditText EditText editText = new EditText(context); // To add the Rules for the position of the views later on we need to define an id. // In this case I assign the index in the array as Id, but in your app you should define // ids in values/ids.xml like this: &lt;item name="firstEditText" type="id" /&gt; and use these editText.setId(i + 1); // Set the text for the new EditText editText.setText(text); // Create the LayoutParams RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); // Add the rules where to place the view. if(i == 0) { // The first EditText will be placed at the top of the parent. params.addRule(RelativeLayout.ALIGN_PARENT_TOP); } else { // All EditTexts after the first one are placed below the previous one. params.addRule(RelativeLayout.BELOW, previousId); } // We save the id of this EditText so we can position the next EditText below it. previousId = editText.getId(); // Add the view to your layout - in this case a RelativeLayout - with the LayoutParams we defined above relativeLayout.addView(editText, params); }
has comment: http://stackoverflow.com/comment/35938164
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/23445459
has comment: http://stackoverflow.com/comment/35939451
has comment: http://stackoverflow.com/comment/35938397
has comment: http://stackoverflow.com/comment/35940162
has comment: http://stackoverflow.com/comment/35938232
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/35939172
has comment: http://stackoverflow.com/comment/35940564
has comment: http://stackoverflow.com/comment/35939372
accepted answer of: http://stackoverflow.com/q/23445459
has comment: http://stackoverflow.com/comment/35939287
has comment: http://stackoverflow.com/comment/35939568
has comment: http://stackoverflow.com/comment/35939842
type: Answer
has comment: http://stackoverflow.com/comment/35940846
has comment: http://stackoverflow.com/comment/35939140
has comment: http://stackoverflow.com/comment/35940744
has comment: http://stackoverflow.com/comment/35939660

http://stackoverflow.com/q/23313412
answer count: 1
has comment: http://stackoverflow.com/comment/47879312
linked to: http://stackoverflow.com/q/29395281
tagged with: android
favorite count: 0
score: 2
has answer: http://stackoverflow.com/a/51290843
tagged with: root
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35698849
downvote count: 1
tagged with: su
has body: I use the following code to take screenshot on a rooted device: sh = Runtime.getRuntime().exec("su", null,null); os = sh.getOutputStream(); os.write(("/system/bin/screencap -p " + "/sdcard/img.jpg" + "\n").getBytes("ASCII")); os.flush(); os.close(); sh.waitFor(); myBitmap = BitmapFactory.decodeFile("/sdcard/img.jpg"); As i want to take screenshots frequently, I don't want to first save it to the file and then read the bytes. Is there a better way to get the screenshot bitmap directly? I just wan't to eliminate this unnecessary delay. Thanks a lot! Update: The screencap.cpp code can be viewed here. Also, it mentions this: "usage: %s [-hp] [-d display-id] [FILENAME]\n" " -h: this message\n" " -p: save the file as a png.\n" " -d: specify the display id to capture, default %d.\n" "If FILENAME ends with .png it will be saved as a png.\n" "If FILENAME is not given, the results will be printed to stdout.\n" Please help me out. Thanks!
upvote count: 3
tagged with: java
tagged with: screen-capture
has title: Android: Screencap to bytes directly - Skip saving to file
has comment: http://stackoverflow.com/comment/35705196
type: Question

http://stackoverflow.com/comment/35879661
type: Comment
has text: Indeed. Your answer, however, uses apostrophes instead of quotation marks, which is why it doesn't even compile, and you forgot to convert the string to lowercase.
score: 0
comment on: http://stackoverflow.com/a/23412857
type: AnswerComment

http://stackoverflow.com/comment/35898108
comment on: http://stackoverflow.com/a/23301105
score: 0
type: AnswerComment
type: Comment
has text: It seems the tests don't actually work, which is confusing me. So the first test, createListOfVideos, fails but all the others just give errors. The errors seem to occur because of: VideoFile videoFile = videoList.get(0); which means that it can't return the element at said index?

http://stackoverflow.com/a/24296964
has body: i think one of the best solution is store it in session in your jsp Page you try it like this.. ArrayList lst = new ArrayList(); lst.add("test1"); lst.add("test2"); session.setAttribute("list", lst); in your servlet... HttpSession session = request.getSession(); Arraylist lst = (ArrayList) session.getAttribute("lst");
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23311554

http://stackoverflow.com/q/23388014
tagged with: multithreading
upvote count: 1
has comment: http://stackoverflow.com/comment/35840635
has title: Why yield method in java does not release the lock?
has comment: http://stackoverflow.com/comment/35829840
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/23388432
type: Question
answer count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/35829560
favorite count: 0
linked to: http://stackoverflow.com/q/6979796
has body: I have some doubt regarding the yield method in java. Because when we are using it like Thread.yield() then the thread goes to the runnable state and give chance to the other thread to run but the thread which call yield is not releasing the lock. So , only threads except those who are waiting for the lock to release will run . So , when and in which scenario this yield method is useful.
has answer: http://stackoverflow.com/a/23390630
has comment: http://stackoverflow.com/comment/35829578
has comment: http://stackoverflow.com/comment/35829746
type: UnansweredQuestion

http://stackoverflow.com/a/23304754
has comment: http://stackoverflow.com/comment/35844149
answers question: http://stackoverflow.com/q/23294401
type: Answer
accepted answer of: http://stackoverflow.com/q/23294401
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/35865651
type: AcceptedAnswer
downvote count: 0
has body: You need to use hybrid encryption. You cannot encrypt large files using RSA. I do wonder though how you handle your errors or what you do when your program doesn't finish; issues like these should be caught by the Java runtime system. The file handling is not different between text files and PDF files, it's just the size that is different. Hybrid encryption comes down to: Generate fully random symmetric key (e.g. AES-128); Encrypt the file, e.g. using AES-CBC with zero IV; Encrypt the symmetric key with RSA-OAEP or RSA-PKCS#1; Send or store the ciphertext and the encrypted symmetric key; Decryption goes like this: Retrieve the ciphertext and the RSA encrypted symmetric key; Decrypt the symmetric key using the private key; Decrypt the ciphertext.

http://stackoverflow.com/a/26041355
answers question: http://stackoverflow.com/q/23407055
downvote count: 0
has body: I ultimately just slapped this in my web.xml: default /static/* The default just seems to hand back whatever is there with an appropriate mime type based on the filename extension, so that's fine.
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/40793274
score: 1
has comment: http://stackoverflow.com/comment/40793427
has comment: http://stackoverflow.com/comment/40793147

http://stackoverflow.com/a/23382122
type: Answer
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/23381939
answers question: http://stackoverflow.com/q/23381939
type: AcceptedAnswer
downvote count: 0
has body: I am not sure if there is a java implementation for it, but you can find the implementation for your algorithm here: http://en.wikibooks.org/wiki/Algorithm_Implementation/Strings/Levenshtein_distance#Java good luck :)
has comment: http://stackoverflow.com/comment/39801588

http://stackoverflow.com/a/23414368
type: Answer
has body: Every component is in its own jar, but the jars are not contained in the war ? How should that work ? Even third party libs are included in the war. Except for those that are provided by the container. Regarding the jsp stuff: Can I serve JSPs from inside a JAR in lib, or is there a workaround?
score: 0
answers question: http://stackoverflow.com/q/23413746

http://stackoverflow.com/comment/35737963
score: 0
type: AnswerComment
type: Comment
has text: Also make sure that you insert them in the order you specified (i.e) `Height,Weight third field BMI`
comment on: http://stackoverflow.com/a/23335051

http://stackoverflow.com/comment/35840016
type: AnswerComment
score: 0
type: Comment
has text: Sorry but I still didn't get you as it says nothing about how to show and disappear indicator on reaching respective ends. The indicator lets assume is a button
comment on: http://stackoverflow.com/a/23393460

http://stackoverflow.com/comment/35861292
has text: My code does not throw the exceptions, it calls LDAP servers using JNDI. When an error is returned from the LDAP server, JNDI reports it as an javax.naming.NamingException (or subclass)
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23346502

http://stackoverflow.com/q/23412660
tagged with: java
has comment: http://stackoverflow.com/comment/35901409
type: Question
score: 0
linked to: http://stackoverflow.com/q/21739578
tagged with: log4j
type: UnansweredQuestion
has title: Disabling debug spring logs for console
tagged with: spring
has comment: http://stackoverflow.com/comment/35877602
has body: I want to get rid off DEBUG logs of spring for console.What I have done yet: log4j.appender.CONSOLE.Threshold=INFO I have set rootLogger to INFO level But still I am getting these spring debug logs.How to get rid of this?
has comment: http://stackoverflow.com/comment/35896705
answer count: 0

http://stackoverflow.com/a/23355439
upvote count: 4
downvote count: 0
has comment: http://stackoverflow.com/comment/35771068
type: AcceptedAnswer
score: 4
has comment: http://stackoverflow.com/comment/35770013
answers question: http://stackoverflow.com/q/23330492
has comment: http://stackoverflow.com/comment/35771491
accepted answer of: http://stackoverflow.com/q/23330492
has body: Thanks to Sotirios, I've resolved my issue. I'm not sure why this resolved it, but it did. I simply put the following in my servlet-context.xml: &lt;mvc:annotation-driven/&gt; That's it. That's all it took, and now Spring is returning the JSON representation of object that I expected.
type: Answer

http://stackoverflow.com/comment/35710457
has text: Since now you have at least 10 reputation points you should be able to add links to your question.
comment on: http://stackoverflow.com/q/23323170
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/35191749
has body: FYI, I was so frustrated with the reliance on the inhabitant files rather than having the capability for runtime scanning of annotated classes, I wrote this project: https://github.com/VA-CTT/HK2Utilities Since Eclipse / Maven / inhabitant runtime generators wouldn't play nice, it was nearly impossible to debug code that made use of HK2 in eclipse without runtime scanning. The HK2Utilities package is available in central: gov.va.oia HK2Utilities 1.4.1 To use it, you just call: ServiceLocator locator = HK2RuntimeInitializer.init("myName", false, new String[]{"my.package.one", "my.package.two"}); This will scan the runtime classpath for classes in the packages listed, and automatically populate the service locator with them. You don't ever have to generate inhabitant files with this model - and in practice, I found it to be faster performing than the inhabitant processing code as well (not that the performance matters much for this one-time operation) ---edit--- I still maintain this code - the current release is: net.sagebits HK2Utilities 1.5.2 And the project location is now: https://github.com/darmbrust/HK2Utilities
score: 5
upvote count: 5
downvote count: 0
has comment: http://stackoverflow.com/comment/78479163
has comment: http://stackoverflow.com/comment/68135307
answers question: http://stackoverflow.com/q/23402814
type: Answer
has comment: http://stackoverflow.com/comment/78559022

http://stackoverflow.com/q/23441650
linked to: http://stackoverflow.com/q/22651670
has comment: http://stackoverflow.com/comment/35938850
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/23442001
has comment: http://stackoverflow.com/comment/35930063
type: UnansweredQuestion
has body: How to show the content in the dropdowlist in java script, I try the code but the content not show... this the code below to how to show the content... Dropdownlist1: &lt;select name="zone" onchange="this.form.submit();"&gt; &lt;% Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Connection connection1 = DriverManager.getConnection("jdbc:odbc:register"); Statement statement2 = connection1.createStatement(); ResultSet resultset2 = statement2.executeQuery("select zone from landamount"); %&gt; &lt;option&gt;--Select--&lt;/option&gt; &lt;% while (resultset2.next()) {%&gt; &lt;option&gt;&lt;%= resultset2.getString(1)%&gt; &lt;/option&gt; &lt;% }%&gt; &lt;/select&gt;
has comment: http://stackoverflow.com/comment/35937112
tagged with: java
has comment: http://stackoverflow.com/comment/35929993
has title: How to show the content in the dropdownlist
type: Question
has comment: http://stackoverflow.com/comment/35930974
tagged with: jsp

http://stackoverflow.com/a/23296840
type: Answer
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/35662915
answers question: http://stackoverflow.com/q/23296778
has comment: http://stackoverflow.com/comment/35662824
downvote count: 0
has body: You can try: int[][] array2 = new int[array1.length][array1[0].length]; assuming that your array will always be square and that you don't have dimensions of 0.
has comment: http://stackoverflow.com/comment/35662987

http://stackoverflow.com/q/23380334
has answer: http://stackoverflow.com/a/23380376
upvote count: 0
has title: How can this recursive code can be understood?
favorite count: 0
has comment: http://stackoverflow.com/comment/35815708
has answer: http://stackoverflow.com/a/23380388
has answer: http://stackoverflow.com/a/23380378
has body: int j(int i) { if (i==0) return 2; return i*j(i-1); } calling j(4) gives 48. I feel like I do understand the code, but don't know how 48 was achieved. This is how I interpret it, int j(4){ 4 is not equal to 0 so it won't return 2 4*j(i-1) = 4*j(3) then i go back to the top and repeat 3*j(2) 2*j(1) 1*j(0) now i return 2. This is where am lost, i'm not quite sure what to do after this step and how the answer to j(4) is 48.
score: -2
answer count: 4
has comment: http://stackoverflow.com/comment/35815728
tagged with: return
possible better answer: http://stackoverflow.com/a/23380372
has comment: http://stackoverflow.com/comment/35815693
downvote count: 2
has answer: http://stackoverflow.com/a/23380372
type: AnsweredQuestion
tagged with: recursion
accepted answer: http://stackoverflow.com/a/23380378
tagged with: java
type: Question
tagged with: int

http://stackoverflow.com/q/23390178
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/23390301
answer count: 3
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/23390476
type: UnansweredQuestion
tagged with: multithreading
has answer: http://stackoverflow.com/a/23390986
has title: Java communication between threads
has comment: http://stackoverflow.com/comment/35833829
tagged with: pipe
score: 1
tagged with: java
has body: I am writing a program to demonstrate the distance vector routing algorithm. This program creates multiple routers and their routing table. Each router is its own thread using a two-dimensional array. I need to have the threads send their tables to one another. I am not sure how to communicate between these threads. I looked into sockets but am not listening on any ports. I am not sure how to use pipes or if this is the best option or not. Any suggestions would be helpful.

sensors
type: Tag
tag name: sensors
tags question: http://stackoverflow.com/q/23400722

http://stackoverflow.com/comment/35708974
type: QuestionComment
comment on: http://stackoverflow.com/q/23322490
has text: is it possible to create an Element without filling all inner-elements?
score: 0
type: Comment

http://stackoverflow.com/comment/35698050
comment on: http://stackoverflow.com/a/23316148
type: Comment
type: AnswerComment
has text: what is meaning of `aa`?
score: 0

http://stackoverflow.com/comment/35745569
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23340770
has text: As far as I can read it should be possible to call loadXML("filename.xml") from inside PApplet to read XML data in Processing.

http://stackoverflow.com/q/23363212
answer count: 9
has answer: http://stackoverflow.com/a/23779918
has answer: http://stackoverflow.com/a/41957541
has answer: http://stackoverflow.com/a/71466604
has answer: http://stackoverflow.com/a/37828823
has answer: http://stackoverflow.com/a/63596359
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/35592708
has answer: http://stackoverflow.com/a/35592708
tagged with: java
tagged with: easymock
type: Question
upvote count: 27
accepted answer: http://stackoverflow.com/a/23779918
has answer: http://stackoverflow.com/a/52106170
downvote count: 0
has comment: http://stackoverflow.com/comment/121096222
has answer: http://stackoverflow.com/a/51447485
has answer: http://stackoverflow.com/a/55494677
score: 27
has title: PowerMock ECLEmma coverage issue
tagged with: junit
favorite count: 0
has body: We are using EasyMock and PowerMock with JUnit. The coverage tool used is ECLEmma. With EasyMock, it shows the coverage properly in green (as covered). However, for the code that is unit tested with PowerMock, the coverage is shown in red (uncovered). Have read similar questions on the web. However, just wanted to check if there is a solution for this. Thanks Venkatesh
linked to: http://stackoverflow.com/q/52064126

http://stackoverflow.com/comment/35721829
type: Comment
has text: Same result... mmm i took a photo of the part where the look and feel is set to the main class... Does it help? http://imgur.com/TQ1Cs7V
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23328955

http://stackoverflow.com/q/23392318
possible better answer: http://stackoverflow.com/a/23392429
has answer: http://stackoverflow.com/a/23392559
has answer: http://stackoverflow.com/a/23392429
score: 0
tagged with: java
has body: I'm very new to java/tomcat, and wondering if it is possible to make a java servlet for tomcat that will start when tomcat itself starts, i.e. independently of any request received, and which will keep running till tomcat stops? Furthermore, could such a servlet have unlimited access to the machine on which it is running, or is it essentially sandboxed by tomcat? I already have something similar in Python, where a main process running with root privileges starts a sub-thread that contains a simple web server. Any requests coming in are then able to make changes to the machine as root, on basis of the root privileges. The motivation is to speak to a microcontroller via a browser-based GUI available over an intranet (so security is not an issue, it just seems like a very easy way of allowing people to remotely control lab equipment). I'm curious if this could be done in the java/tomcat ecosystem...
accepted answer: http://stackoverflow.com/a/23392559
has comment: http://stackoverflow.com/comment/35864642
tagged with: servlets
answer count: 3
type: AnsweredQuestion
has title: running java servlets as independent process
has answer: http://stackoverflow.com/a/23392584
tagged with: tomcat
has comment: http://stackoverflow.com/comment/35837676
type: Question

http://stackoverflow.com/comment/35915883
has text: @Martin I have deleted the earlier post and will be posting a new question for the same.
score: 0
comment on: http://stackoverflow.com/q/23433667
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23447916
upvote count: 0
answer count: 1
favorite count: 0
tagged with: rest
has title: How to build a comprehensive website that has many components with play 2 with Java
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23448006
tagged with: playframework-2.0
has body: I have many websites build with Liferay. The reason I used Liferay or portlet based framework is that the nature of the websites. Usually, each page page display multiple content coming from different providers using rest web services. For example, the home page will display news coming from new provider, videos coming from other provider, and music coming from another provider, and so on, I guess you got the idea. I usually design a portlet for each content provider and reuse them as needed. Now coming to my question, I would like to use play 2 with Java to build such websites and from what I have understood so far is that I need to have a model that contains all of these data and send it to my template to be rendered. For example, /index will send the request to the controller.index() and then I have to populate a model that includes all the data: news, videos, and music, then return OK(template(model)) to send the model to the template to be rendered. The problems I see with this way is that The model will be huge which includes all kinds of data structure, and since content retrieval is different from one content type to the other it will make the code very complex and I can kiss reusalbilty goodbye. Perhaps there is another way to build this, or maybe I didn't understand Play very well and Play is not suitable for this kind of websites. I think I'm not the first one who faced this before and I will appreciate your kind help. Please note that I'm not looking to start a debate on X vs Y, I just want to understand how to use play to build a website with rich content. Thanks, Iyad
tagged with: java
downvote count: 2
tagged with: web-services
type: Question
score: -2
accepted answer: http://stackoverflow.com/a/23448006
tagged with: liferay

http://stackoverflow.com/comment/35877539
type: Comment
type: QuestionComment
has text: can u paste code here for at com.example.chowpalv21.SmsViewActivity.onCreateView(SmsViewActivity.java:121)
score: 0
comment on: http://stackoverflow.com/q/23413480

http://stackoverflow.com/q/23428622
type: AnsweredQuestion
has body: I am currently learning Java and for my inner classes practice, I played aroud the following code: public class DataStructure { // Create an array private final static int SIZE = 15; private int[] arrayOfInts = new int[SIZE]; public DataStructure() { // fill the array with ascending integer values for (int i = 0; i &lt; SIZE; i++) { arrayOfInts[i] = i; } } public void printEven() { // Print out values of even indices of the array DataStructureIterator iterator = this.new EvenIterator(); while (iterator.hasNext()) { System.out.print(iterator.next() + " "); } System.out.println(); } interface DataStructureIterator extends java.util.Iterator&lt;Integer&gt; { } // Inner class implements the DataStructureIterator interface, // which extends the Iterator&lt;Integer&gt; interface private class EvenIterator implements DataStructureIterator { // Start stepping through the array from the beginning private int nextIndex = 0; public boolean hasNext() { // Check if the current element is the last in the array return (nextIndex &lt;= SIZE - 1); } public Integer next() { // Record a value of an even index of the array Integer retValue = Integer.valueOf(arrayOfInts[nextIndex]); // Get the next even element nextIndex += 2; return retValue; } public void setNextIndex(int i){ nextIndex=i; } } public void print(DataStructureIterator iterator) { // Print out values of odd indices of the array //iterator = this.new EvenIterator(); iterator.setNextIndex(1);//**This line giving me compiler error that setNextIndex is undefined for type DataStructure.DataStructureIterator ** while (iterator.hasNext()) { System.out.print(iterator.next() + " "); } System.out.println(); } public EvenIterator createNewObject(){ return this.new EvenIterator(); } public static void main(String s[]) { // Fill the array with integer values and print out only // values of even indices DataStructure ds = new DataStructure(); System.out.println("Even Index"); ds.printEven(); System.out.println("Odd Index"); ds.print(ds…
upvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/23428775
type: Question
answer count: 2
score: -1
has title: Java - Need help to solve a bug
tagged with: inner-classes
tagged with: java
downvote count: 1
has comment: http://stackoverflow.com/comment/35905350
has answer: http://stackoverflow.com/a/23428775
possible better answer: http://stackoverflow.com/a/23428672
has answer: http://stackoverflow.com/a/23428672

http://stackoverflow.com/comment/35686817
type: AnswerComment
comment on: http://stackoverflow.com/a/23310119
type: Comment
has text: @user230137 I think we have to code for generic solutions that fits for all possibilities.
score: 0

http://stackoverflow.com/a/23428751
answers question: http://stackoverflow.com/q/23428407
has body: That's right. A gray color is just a color with same value in three color's components (red, green, blue). Although you only need one value to determine the color (because red, green and blue components have the same value), at image loading that value is assign to all three color components. If you get the value for each pixel of the image, you must obtain the same value for three color's components for the same pixel x,y. For alpha component, as it's a grayscale image, is correct it be at 255.
score: 0
type: Answer

http://stackoverflow.com/q/23427561
score: 0
answer count: 3
upvote count: 1
downvote count: 1
has answer: http://stackoverflow.com/a/23427880
favorite count: 0
tagged with: exception
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23427649
tagged with: java
tagged with: error-handling
has comment: http://stackoverflow.com/comment/35903512
linked to: http://stackoverflow.com/q/1457863
linked to: http://stackoverflow.com/q/352780
type: Question
tagged with: try-catch
has answer: http://stackoverflow.com/a/23428820
has body: I came to know from question that when some Error like NoClassDefFoundError occurs in Java This is a pretty critical error, as the program cannot be initiated by the JVM. Then: try { //statements } catch (NoClassDefFoundError e) { // catching NoClassDefFoundError e.printStackTrace(); //do something when Error occurred } catch(Error e){ // catching Error e.printStackTrace(); //do something when Error occurred }catch (Exception e) { e.printStackTrace(); //do something when Exception occurred } Questions: Does it have any significance by catching Error in try catch block as program will not be initiated by the JVM, will these block will ever execute? If not then why catching mechanism for Error is allowed in Java. If yes then when and how?
has title: Is there any significance by catching Error(not Exception) as the program will not be initiated by the JVM
has comment: http://stackoverflow.com/comment/35903998

http://stackoverflow.com/q/23351137
tagged with: game-engine
possible better answer: http://stackoverflow.com/a/23351288
downvote count: 0
has body: I'm making an application and I require some help please. In flash, gameLoops can be either made with an enterFrame, or timer. I am new to Java so please forgive me arrogance. From researching I've seen people using timers. Now I Have a tile based game, where if the user clicks on a grid (It's 30*21) the player will go to that grid. Here is what I've come up with for(int i = 0; i&lt;30; i++) { for(int j = 0; j&lt;21; j++) { if(e.getSource()==JbGrid[i][j]) { MOUSE_X = j; MOUSE_Y = i; System.out.println("Mouse X: "+MOUSE_X+" Mouse Y: "+MOUSE_Y); moveToSquare(); } } } } public void moveToSquare() { if( BPOS_X &lt; MOUSE_X ) { BPOS_X +=2; } if( BPOS_X &gt; MOUSE_X ) { BPOS_X -=2; } } Now the problem is that the game doesn't physically show the red block moving towards the MOUSE_X position, this is because the page isn't being refreshed. Is there a way I can implement a gameLoop in to my code. It's just that most people implement it at the start, and I never knew about "gameLoops" before I started my project. Can someone please point my in the right direction if(player clicks square) activate loop move player to Mouse_X Thank you.
has answer: http://stackoverflow.com/a/23351255
accepted answer: http://stackoverflow.com/a/23351255
favorite count: 0
upvote count: 1
type: AnsweredQuestion
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/23351288
type: Question
answer count: 2
has title: Java. "Game Loop" theory assistance

http://stackoverflow.com/a/23302100
has body: You can't change the underlying collection from inside a for-each loop, you'll need a while loop or an actual iterator instead. It doesn't work with a for-each loop because removing (or adding) elements means the loop won't know what element to show next anymore. I don't know about removeContent() or removeChild() but that's why detach() was throwing that exception.
accepted answer of: http://stackoverflow.com/q/23302037
answers question: http://stackoverflow.com/q/23302037
score: 5
upvote count: 5
has comment: http://stackoverflow.com/comment/35672690
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/a/23300107
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/23299972
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23299972
type: AcceptedAnswer
type: Answer
has body: As long as you can guarantee that channel is always in a reasonable character range (for example alphanumeric), changing the channel.length() + 2 to channel.length() + 4 should be sufficient.

http://stackoverflow.com/comment/35816007
has text: Instead of T.class, you have to pass it as Class<T> class everywhere you need to know the class of the generic type.
comment on: http://stackoverflow.com/a/23380368
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/35723681
has text: +1. You just missed to say that this is not a nerdy big ranch android crash error :).
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23330110

http://stackoverflow.com/a/23422122
answers question: http://stackoverflow.com/q/23422083
type: AcceptedAnswer
type: Answer
upvote count: 2
has comment: http://stackoverflow.com/comment/35894076
score: 0
downvote count: 2
has body: Try String a=val[0]; //Ensure value is 000 not OOO a = a.replaceAll("[\n\r]", ""); if(a.trim().equals(b.trim())){ //toDO }
accepted answer of: http://stackoverflow.com/q/23422083
has comment: http://stackoverflow.com/comment/35893928

http://stackoverflow.com/comment/35910601
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23420483
type: Comment
has text: You would have to use regular expression to see if there are any operators.G through the documentation of the contains, indexof and matches method and you will understand what needs to be done

http://stackoverflow.com/q/23452734
downvote count: 0
has title: Openshift Postgresql connection error:
favorite count: 0
tagged with: postgresql
has comment: http://stackoverflow.com/comment/35956497
has answer: http://stackoverflow.com/a/23456134
has body: Edited: I checked the log file, and the URL message is: Cannot create JDBC driver of class 'org.postgresql.Driver' for connect URL 'postgresql://adminxxxxxxx:xxxxxxxxx@10.1o.1o.10:5432' I get the following error with postgres on openshift (9.x) java.sql.SQLException: No suitable driver java.sql.DriverManager.getDriver(DriverManager.java:278) My URL is ${OPENSHIFT_POSTGRESQL_DB_URL} This exact build works on my local host (different URL, of course), and I can see the openshift jar in the correct place in the war file Any ideas?
upvote count: 2
type: UnansweredQuestion
score: 2
tagged with: java
has comment: http://stackoverflow.com/comment/35950844
has comment: http://stackoverflow.com/comment/35956149
type: Question
answer count: 1

http://stackoverflow.com/a/23311196
downvote count: 0
answers question: http://stackoverflow.com/q/23311129
has comment: http://stackoverflow.com/comment/35689956
has comment: http://stackoverflow.com/comment/115185298
type: Answer
has comment: http://stackoverflow.com/comment/35689400
upvote count: 2
has body: Look at the JavaDoc what Color.getColor() says: Finds a color in the system properties. The argument is treated as the name of a system property to be obtained. The string value of this property is then interpreted as an integer which is then converted to a Color object. If the specified property is not found or could not be parsed as an integer then null is returned. Parameters: nm - the name of the color property Returns: the Color converted from the system property. "Red" is not defined as system property.
score: 2
has comment: http://stackoverflow.com/comment/35688877
has comment: http://stackoverflow.com/comment/35689846

http://stackoverflow.com/a/51394904
has body: Sharing my experience with the twin IDs after 4 years - JMSMessageID is a header property set by the JMS Provider. It happens at runtime when the message is being sent to the Queue. But JMSCorrelationID is a header property that can be set by the users to correlate the same message across different JMS Providers. Quoting from Oracle Documentation - A JMSCorrelationID can hold one of the following: A provider-specific message ID An application-specific String A provider-native byte[] value In some cases, an application (made up of several clients) needs to use an application-specific value for linking messages. For instance, an application may use JMSCorrelationID to hold a value referencing some external information. Application-specified values must not Start with the 'ID:' prefix; this is reserved for provider-generated message ID values.
answers question: http://stackoverflow.com/q/23299147
downvote count: 0
type: Answer
upvote count: 3
score: 3

http://stackoverflow.com/q/23450325
has comment: http://stackoverflow.com/comment/35946843
score: 0
has body: just having some issues with the distance calculation in a Traveling Salesman optimized nearest neighbor solution I have been working on in the past week or so in my free time. Basically, what is happening is when I get my result printed, the "total" it calculates (encompassing the total distance traveled over the trip) is returned incorrectly compared to the solution given in a functioning checker applet. However, it isn't returning incorrectly in any immediately obvious way. It is always within about +/- 300km of the answer. Sometimes is is a larger result than it should be, sometimes it is lower. I have tried hard coding the final step to loop back to the first town, which is in the current iteration of the code, and it made things closer, but with the same behaviour occurring. Here is a rundown of the issue and what I have done: - I have an input file, which contains 160 lines, with each pair of lines being the latitude and longitude of a random town in Ireland, for 80 town - This input file is then used in the creation of an identity matrix of size [80][80] using a haversine function in the main method where each element is the distance from town i to j. You can assume that this part is correctly calculated. - The haversine class takes the radius of the earth to be 6378.1km and calculates distances correctly as tested in other problems. - This identity matrix is then passed into the TSP method for calculation. Here is the source code that is causing issues, I am sure it is happening somewhere in here and not in my main method or haversine, I just cannot pin point it: //Main calculation method that takes in the adjacency matrix public void tsp(double[][] adjacency_matrix) { int last = 0; int count = 0; //Array that will store if a town has been previously visited, first town will be visited from the start boolean[] visited = new boolean[numberOfNodes]; //Creates an element variable which takes in the current town were at on the stack //also creates a shortest va…
has title: Travelling Salesman distance miscalculations
tagged with: traveling-salesman
answer count: 0
type: UnansweredQuestion
tagged with: nearest-neighbor
has comment: http://stackoverflow.com/comment/35946687
tagged with: algorithm
tagged with: java
has comment: http://stackoverflow.com/comment/35958953
type: Question
has comment: http://stackoverflow.com/comment/35946621
has comment: http://stackoverflow.com/comment/35969578

http://stackoverflow.com/comment/35942163
comment on: http://stackoverflow.com/a/23447887
score: 1
type: AnswerComment
has text: Yeah, it's a pretty serious problem. Thankfully, it won't affect numerical comparisons. It will affect code like `cardQueen.compareTo(cardOne)`, making the theoretical card game believe that a queen is worth less than a 1.
type: Comment

http://stackoverflow.com/q/23295127
has comment: http://stackoverflow.com/comment/35660466
tagged with: java
type: Question
has title: Reflection: Throws java.lang.NullPointerException
has comment: http://stackoverflow.com/comment/35659521
has answer: http://stackoverflow.com/a/23296944
has body: 1.for (Field field : fields) { 2. if (p.contains(field.getName())) { 3. if(field.getType().toString().split("[.]")[2].equals("String")) 4. callableStatement.setString(field.getName(), field.get(obj).toString()); 5. else if(field.getType().toString().split("[.]")[2].equals("Integer")) 6. callableStatement.setInt(field.getName(), (int)field.get(obj)); 7. System.out.println(field.get(obj).toString()); 8. } 9.} This is my code. Using reflection I fetch the data from the class object and in the above loop, I set parameters for the procedure input. However, it saves some integer values and throws java.lang.NullPointerException for some on line number 7. These values are accepted: this.DI_StDate = Common.getDateStamp(date); // Integer this.DI_StTime = Common.getTimeStamp(date); // Integer From Common.java public static Integer getDateStamp(Date d) { return Integer.parseInt(requiredDate.format(d)); } public static Integer getTimeStamp(Date d) { return Integer.parseInt(requiredTime.format(d)); } These throws the exception: this.FileOpsId = new Integer(1); // Integer this.FileTypeOpsId = 1; // Integer Please suggest where I am going wrong. These are my class members: public class DIConnect { public Integer PROC_ID; public String APIKey; public String Username; public String pwd; public String StreamKey; public Integer DI_StDate; public Integer DI_StTime; public String FileNamePath; public Integer FileOpsTypeId; public String ConfigLabel; public Integer FileOpsId; public Integer End_Date; public Integer End_Time; public DIConnect(String FileNamePath, String ConfigLabel, Integer FileOpsTypeId, Integer StartDate, Integer StartTime) { this.FileNamePath = FileNamePath; this.ConfigLabel = ConfigLabel; this.FileOpsTypeId = FileOpsTypeId; this.DI_StDate = StartDate; // accepted this.DI_StTime = StartTime; // accepted this.FileOpsId = new Integer(1); // NOT ACCEPTED } } This is the call in the main() method. DIConnect DIC = new DIConnect(filePath, "File", 1, Common.getDateStamp(date),…
has answer: http://stackoverflow.com/a/23295435
upvote count: 2
answer count: 3
has comment: http://stackoverflow.com/comment/35659385
has comment: http://stackoverflow.com/comment/35659942
has comment: http://stackoverflow.com/comment/35659588
has comment: http://stackoverflow.com/comment/35659860
favorite count: 0
has answer: http://stackoverflow.com/a/23358614
accepted answer: http://stackoverflow.com/a/23358614
possible better answer: http://stackoverflow.com/a/23295435
score: 2
type: AnsweredQuestion
downvote count: 0
tagged with: reflection

http://stackoverflow.com/a/23338113
has comment: http://stackoverflow.com/comment/35749555
has comment: http://stackoverflow.com/comment/35748920
has comment: http://stackoverflow.com/comment/35749393
has comment: http://stackoverflow.com/comment/35749857
has comment: http://stackoverflow.com/comment/35749769
has comment: http://stackoverflow.com/comment/35750151
has comment: http://stackoverflow.com/comment/35844755
has comment: http://stackoverflow.com/comment/35750379
answers question: http://stackoverflow.com/q/23298249
has comment: http://stackoverflow.com/comment/35749417
has comment: http://stackoverflow.com/comment/35751355
has body: The DEBUG and WARN messages can just be ignored. Following route definition worked for me using Camel v2.12.3: from("file://target/subfolder") .log("Working on file ${header.CamelFileName}") .setHeader("subject", simple("New incident: ${header.CamelFileName}")) .to("MY_ID@smtp://localhost?password=MY_PASSWORD&amp;to=myname@mycompany.com"); After starting the route, you should see a message such as Working on file XXX in the log. Perhaps not the Camel routing is the problem but the SMTP server on localhost. Try to send an email to your SMTP server using another email client and check if you receive any email. An example how to do this using a bash shell on MacOS can be found here. Please, check if your SMTP server on localhost uses the default port. If not, add the port to the URI such as localhost:MY_PORT. For SMTP the default is 25, for SMTPS this is 465. The active port can be checked using telnet such as telnet SERVERNAME 25. The SMTP server may not be the problem but the reading of the files. Check if the files in the target/subfolder are readable and not locked by Camel, i.e. check if there is no fileName.camelLock file. Finally, verify that your route keeps running and doesn't stop before all your files are scanned, see http://camel.apache.org/running-camel-standalone-and-have-it-keep-running.html for more information about that. To summarize my answer: Start small, split large routes into small ones and test them separately. EDIT: The most recent source code of tutorial-example-reportincident can be found here: https://github.com/apache/camel/tree/master/examples/camel-example-reportincident.
has comment: http://stackoverflow.com/comment/35750039
downvote count: 0
has comment: http://stackoverflow.com/comment/36666761
has comment: http://stackoverflow.com/comment/35751103
has comment: http://stackoverflow.com/comment/35751016
has comment: http://stackoverflow.com/comment/35749495
has comment: http://stackoverflow.com/comment/35754755
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/36651953
has comment: http://stackoverflow.com/comment/35751847
upvote count: 2
has comment: http://stackoverflow.com/comment/35750733

http://stackoverflow.com/comment/35726959
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/23328187
type: Comment
has text: Yes, you can ignore the delete part, but two scenarios to keep in mind: make sure that you never recreate the Manager again (e.g. your app was closed and opened again, but the system decided that the process can be reused), and if you use tools to look for memory leaks, they will complain. They don't care about extreme cases of Android process management, so they will be satisfied with the most naïve `delete`.

http://stackoverflow.com/q/23355365
downvote count: 2
accepted answer: http://stackoverflow.com/a/23355731
has comment: http://stackoverflow.com/comment/35770156
type: AnsweredQuestion
tagged with: android-layout
has comment: http://stackoverflow.com/comment/35770229
tagged with: java
possible better answer: http://stackoverflow.com/a/23355654
has answer: http://stackoverflow.com/a/23355731
type: Question
upvote count: 0
score: -2
has answer: http://stackoverflow.com/a/23355706
has title: Clickable layout with inner views behavior issue
linked to: http://stackoverflow.com/q/5546514
answer count: 3
tagged with: android
has answer: http://stackoverflow.com/a/23355654
has body: I am testing creating a compound view, so I started with a Linear Layout containing a ImageView and a TextView. These LinearLayout will represent a view similar to a partial list, and I made it clickable. The inner Views of the layout have selectors as its color (TextView) and image (ImageView). In the API 19 (KitKat), the click behavior is ok (screenshot 1) but on API 15 and API 10 (screenshot 2), the click didn't changed the selector state. The code of each 'list item' is: &lt;LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@drawable/listitem_login" android:clickable="true" android:gravity="center" android:orientation="horizontal" android:padding="15dp"&gt; &lt;ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginRight="10dp" android:src="@drawable/signin_signup_icon_facebook" /&gt; &lt;TextView style="?android:attr/textAppearanceMedium" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Facebook" android:textColor="@color/option_text_color" /&gt; &lt;/LinearLayout&gt; EDIT: I used the touch listener approach. If someday I find a best solution (without Java code), I edit here. My approach, based on the answers (adding the a View.OnTouchListener to the LinearLayouts): @Override public boolean onTouch(View view, MotionEvent motionEvent) { ViewGroup container = (ViewGroup) view; boolean pressed; if (motionEvent.getAction() == MotionEvent.ACTION_DOWN) pressed = true; else if (motionEvent.getAction() == MotionEvent.ACTION_UP) pressed = false; else return false; for (int i = 0; i &lt; container.getChildCount(); i++) { container.getChildAt(i).setPressed(pressed); } return false; } In an old 2.3 Android the code runs a bit slowly but works too.
favorite count: 0
linked to: http://stackoverflow.com/q/21273510

http://stackoverflow.com/a/23357646
type: Answer
score: 8
has comment: http://stackoverflow.com/comment/35835297
has comment: http://stackoverflow.com/comment/35815755
has comment: http://stackoverflow.com/comment/35815678
has body: I suspect the problem isn't spamScore being null - it's the value in the map being null, because you haven't populated the map. You're then trying to unbox that null reference to an int, and that fails. So think of your code like this: Integer startingScoreReference = spamScore.get(name); int startingScore = startingScoreReference.intValue(); Now obviously if startingScoreReference is null (which it will be if there's no entry for name in your map) then the second line will cause a NullPointerException. So basically you need to either ensure that your map will always contain an entry for name, or you need to handle the case where there's no such entry. For example, you might want: Integer mapValue = spamScore.get(name); int startingScore = mapValue == null ? 0 : mapValue.intValue(); (The intValue() call could be a cast to int instead, depending on your preference.)
has comment: http://stackoverflow.com/comment/35773768
answers question: http://stackoverflow.com/q/23357584
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/35773974
accepted answer of: http://stackoverflow.com/q/23357584
upvote count: 8

http://stackoverflow.com/a/23411415
downvote count: 0
type: Answer
has body: Not by default. There is a huge amount of ways to get an image without reading a file really, so it would not make much sense to store a useless string (I can't see a use for it). HOWEVER You can make your own ImageIconExt class with the info and check using instanceof. OR Use reflection to get the private location or filename fields in ImageIcon. Note - this is hacky and the fields are transient.
accepted answer of: http://stackoverflow.com/q/23411093
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/23411093
type: AcceptedAnswer

http://stackoverflow.com/q/23393087
has title: How to deallocate a static block in java?
has comment: http://stackoverflow.com/comment/35839194
has answer: http://stackoverflow.com/a/23393240
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35839201
has comment: http://stackoverflow.com/comment/35839229
downvote count: 7
type: Question
tagged with: java
accepted answer: http://stackoverflow.com/a/23393240
has comment: http://stackoverflow.com/comment/35839282
has comment: http://stackoverflow.com/comment/35839137
has comment: http://stackoverflow.com/comment/35839132
upvote count: 0
has body: I need to deallocate a static block. In my project i have to use a static block. Once i am login to project it works fine. After i am logout my application. Static block still have the same value. Sample code: public class Demo { public static String a; static { a = "Test"; } }
answer count: 1
score: -7
favorite count: 0

http://stackoverflow.com/q/23303225
score: 0
has comment: http://stackoverflow.com/comment/35674556
has answer: http://stackoverflow.com/a/23303356
has body: I need to find the min, max, and average of the balances. I have done this before using for loops, but never with a while loop. Is there a way to pull the min max and average straight from the array without interfering with the while loop perhaps? 10 Helene 1000 Jordan 755 Eve 2500 Ken 80 Andrew 999 David 1743 Amy 12 Sean 98 Patrick 7 Joy 14 where 10 is the number of accounts import java.util.*; import java.io.*; import java.util.Arrays; public class bankaccountmain { public static void main(String[] args) throws FileNotFoundException { Scanner inFile = null; try { inFile = new Scanner(new File("account.txt")); ; } catch (FileNotFoundException e) { System.out.println("File not found!"); System.exit(0); } int count = 0; int accounts = inFile.nextInt(); String[] names = new String[accounts]; int[] balance = new int[accounts]; while (inFile.hasNextInt()) { inFile.next(); names[count] = inFile.next(); inFile.nextInt(); balance[count] = inFile.nextInt(); count++; } System.out.println(Arrays.toString(names)); System.out.println(Arrays.toString(balance)); } }
has answer: http://stackoverflow.com/a/23304905
has title: Finding the min max and average of an array
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35674554
has comment: http://stackoverflow.com/comment/35674649
tagged with: java
type: Question
tagged with: average
answer count: 2
tagged with: min
tagged with: max
tagged with: arrays

http://stackoverflow.com/q/23326447
tagged with: media-player
has title: Getting a white screen when playing
tagged with: android
downvote count: 0
answer count: 0
type: UnansweredQuestion
has body: I used the below code to play a video. But when I run the program, it gives a white screen. Please advice. I have used the media player to play the video. When I use video view its playing without a problem: MediaPlayer mediaPlayer; SurfaceView surfaceView; SurfaceHolder surfaceHolder; boolean pausing=false; VideoView mVideoView; Button play,stop; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_video); getWindow().setFormat(PixelFormat.UNKNOWN); // VideoView m=(VideoView)findViewById(R.id.videoView1); // String uriPath="android.resource://com.example.videoplayerthurs/"+R.raw.a; // Uri uri=Uri.parse(uriPath); // m.setVideoURI(uri); // m.requestFocus(); // m.start(); surfaceView = (SurfaceView) findViewById(R.id.surfaceView1); play=(Button)findViewById(R.id.button1); stop=(Button)findViewById(R.id.button2); play.setOnClickListener(new Button.OnClickListener(){ @Override public void onClick(View view) { // TODO Auto-generated method stub // VideoView mVideoView= (VideoView)findViewById(R.id.videoView1); // String uriPath="android.resource://lk.sliit.androidvideoplayer/"+R.raw.a; // // Uri uri=Uri.parse(uriPath); // mVideoView.setVideoURI(uri); // mVideoView.requestFocus(); // mVideoView.start(); mediaPlayer=MediaPlayer.create(VideoActivity.this, R.raw.a); surfaceHolder=surfaceView.getHolder(); surfaceHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS); mediaPlayer.setDisplay(surfaceHolder); mediaPlayer.start(); } }); }
type: Question
score: 1
tagged with: java
tagged with: android-videoview
upvote count: 1
favorite count: 0

http://stackoverflow.com/q/23361694
type: UnansweredQuestion
tagged with: ebean
tagged with: playframework-2.0
answer count: 0
type: Question
has comment: http://stackoverflow.com/comment/35781963
tagged with: java
has comment: http://stackoverflow.com/comment/35781872
score: 0
tagged with: playframework
linked to: http://stackoverflow.com/q/14795220
has body: I want to clear a @Lob field from a Model. In the model I have something like this for the image field: @Lob public byte[] image; If I do something like this: theModel.image = null; theModel.update(); It doesn't remove the data from the field. I find this useful because not every time the model is updated (from a form) an image will be submited to modify the existing one. But, what can I do to remove the image when needed? Is there an in-framework way to do this? WIll I have to update it "manually" (i.e.: sql...)?
has title: How to clear @Lob field from database
linked to: http://stackoverflow.com/q/3748

http://stackoverflow.com/comment/35771718
comment on: http://stackoverflow.com/q/23356338
score: 0
type: Comment
type: QuestionComment
has text: Have u copied jar in WEB-INF or WEB-INF/lib?

http://stackoverflow.com/comment/35753066
has text: Makes sense, but how can I add something in my program while the song is playing that'll check if(milliseconds>0 and milliseconds<1000) then show "jingle" ?
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23346135

http://stackoverflow.com/q/23346385
tagged with: spring-social
has answer: http://stackoverflow.com/a/23427748
linked to: http://stackoverflow.com/q/17732858
answer count: 1
tagged with: facebook
tagged with: spring-mvc
linked to: http://stackoverflow.com/q/17110874
type: UnansweredQuestion
score: 0
tagged with: java
type: Question
has body: I'm writing a Facebook APP that need access to user e-mail and publish to timeline. I found these two links: How to specify OAuth2 scope with spring-social-security SocialAuthenticationFilter? spring social get user email while authenticate telling me to use scope and defaultScope properties of: org.springframework.social.facebook.security.FacebookAuthenticationService But none of the two solutions is working. The application uses spring-social-samples like starting point: @Configuration @EnableSocial public class FacebookConfig implements SocialConfigurer { @Inject private DataSource dataSource; @Override public void addConnectionFactories(ConnectionFactoryConfigurer cfConfig, Environment env) { final FacebookConnectionFactory fbcf = new FacebookConnectionFactory(env.getProperty("facebook.appKey"), env.getProperty("facebook.appSecret")); fbcf.setScope(env.getProperty("facebook.scope")); cfConfig.addConnectionFactory(fbcf); } /** * Singleton data access object providing access to connections across all * users. */ @Override public UsersConnectionRepository getUsersConnectionRepository(ConnectionFactoryLocator connectionFactoryLocator) { JdbcUsersConnectionRepository repository = new JdbcUsersConnectionRepository(dataSource, connectionFactoryLocator, Encryptors.noOpText()); repository.setConnectionSignUp(new SimpleConnectionSignUp()); return repository; } public UserIdSource getUserIdSource() { return new UserIdSource() { @Override public String getUserId() { return SecurityContext.getCurrentUser().getId(); } }; } @Bean @Scope(value = "request", proxyMode = ScopedProxyMode.INTERFACES) public Facebook facebook(ConnectionRepository repository) { Connection&lt;Facebook&gt; connection = repository.findPrimaryConnection(Facebook.class); return connection != null ? connection.getApi() : null; } @Bean public CanvasSignInController canvasSignInController(ConnectionFactoryLocator connectionFactoryLocator, UsersConnectionRepository usersConnectionRepository, Environment env) {…
has title: Use of scope property for Facebook authentication

http://stackoverflow.com/a/23397977
accepted answer of: http://stackoverflow.com/q/23397622
downvote count: 0
score: 1
has body: There are two problems in your code: The + operator is allowed for primitive numeric types only. In this line of code: Sum.sum(new double[] {0,1,2} + {2,2,3}); You're trying to apply + operator for double[] variables, which is not allowed, thus getting the exception. Since the method already accepts 2 arguments double[], then send both double[]s by separating them using comma ,.: Sum.sum(new double[] {0,1,2}, new double[] {2,2,3}); This line of code: int[] s = new double[a.length]; You cannot initialize an array of primitive type with an array of another primitive type. int[] and double[] are complete different classes. So, instead change the type declaration for your variable: double[] s = new double[a.length]; More info: The Java Tutorial. Operators The Java Tutorial. Primitive Data Types The Java Tutorial. Arrays
upvote count: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23397622
type: Answer

http://stackoverflow.com/comment/36982599
type: QuestionComment
comment on: http://stackoverflow.com/q/23446147
has text: "Doesn't work" is not helpful. Please describe what exactly doesn't work, what error messages you saw or what lead you to conclude it's not working, and what steps you tried to debug the issue yourself.
score: 0
type: Comment

http://stackoverflow.com/a/23363356
has body: public static String escapePath(String path) { return path.replace("\\", "\\\\"); } The \ is doubled since it must be escaped in those strings also. Anyway, I think you should use System.getProperty("file.separator"); instead of \. Also the java.io.File has a few methods useful for file-system paths.
upvote count: 23
has comment: http://stackoverflow.com/comment/35784322
answers question: http://stackoverflow.com/q/23363241
type: Answer
has comment: http://stackoverflow.com/comment/76814080
score: 21
downvote count: 2
has comment: http://stackoverflow.com/comment/35784085

http://stackoverflow.com/a/23419255
has body: Using the table data you gave us, you can easily get all the text in one fell swoop: String html = " The first text I want. The second text I want "; Document doc = Jsoup.parse(html); System.out.println("test: " + doc.text()); With the output: test: The first text I want. The second text I want I think you need to restrict your select to the TR and ignore everything after it, so make it something like // get the TRs Elements elements = doc.select("tr"); // iterate through the TRs for (Element element: elements){ System.out.println(element.text()); }
downvote count: 0
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/23415192

http://stackoverflow.com/a/23382565
score: 1
answers question: http://stackoverflow.com/q/23378071
has comment: http://stackoverflow.com/comment/36449732
downvote count: 0
has body: You could using pywin32 library for Python on Windows.Here is some code that copies a file to the clipboard, and reading it from the clipboard: import win32clipboard with open('input.wav','rb') as input: wav = input.read() win32clipboard.OpenClipboard() win32clipboard.EmptyClipboard() win32clipboard.SetClipboardData(win32clipboard.CF_WAVE, wav) file_from_clipboard = win32clipboard.GetClipboardData(win32clipboard.CF_WAVE) with open('output.wav','wb') as output: output.write( file_from_clipboard ) If you want to insert into the clipboard only the path, you can do so: path = 'Path to wav file' win32clipboard.OpenClipboard() win32clipboard.EmptyClipboard() win32clipboard.SetClipboardText( path, win32clipboard.CF_TEXT) #Get text from clipboard path_from_clip = win32clipboard.GetClipboardData(win32clipboard.CF_TEXT) print path_from_clip Or, even more simply, you can use pyperclip. Pyperclip is cross-platform module for accessing the clipboard in Python: import pyperclip pyperclip.copy('Path to wav file') #Get text from clipboard print pyperclip.paste()
has comment: http://stackoverflow.com/comment/36449788
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/35888016

http://stackoverflow.com/q/23408556
has comment: http://stackoverflow.com/comment/35869091
upvote count: 1
has comment: http://stackoverflow.com/comment/35868087
score: 1
tagged with: java
has title: Java: Restricting visibility in large projects
has comment: http://stackoverflow.com/comment/35868192
has comment: http://stackoverflow.com/comment/35870155
type: Question
has body: How can I manage (=restrict) visibility in large Java projects? More specifically: Given the features "Big-A", "Big-B", some sub-features "Little-A-1", "Little-A-2" and some sub-sub-features "Tiny-A-1-I" and "Tiny-A-1-II". With the "Little-A-" features being sub-features of "Big-A" and the "Tiny-A-1-" features being sub-features of "Little-A-1". There are classes and methods in "Little-A-1" which need to be visible for its enclosing feature "Big-A" and all its (sub-)sub-features, but not for "Big-B". Other classes and methods should only be visible for "Little-A-1" and its sub-features, but not for "Big-A" and not for "Little-A-2". And of course "Tiny-A-1-I" has classes and methods, too, which should only be visible within "Tiny-A-1-I" but not for "Tiny-A-1-II", or only within "Little-A-1" and its sub-features, but not for "Little-A-2" and so on. In short: I have a large hierarchy of features and need to restrict visibility to parts of that hierarchy. How can this be done in Java, given that the built-in visibilities are not powerful enough for that? Is there any Java built-in feature that can be used for that? Or any external project? (Or an Eclipse plugin, at least?) I looked at Annotation processors, but it seems they are not powerful enough, too, as they have no access to the actual code. Only to its static structure. Given that Java is used for many big projects, I guess there has to be some solution to that problem. I am probably not the only one having that problem. The ideal solution would allow me to apply it step wise feature by feature and not require that I have to adapt all the code at once, as that is not possible for me. (Lack of time and resources.) And integration into Eclipse (showing errors when an invisible element is accessed) would be nice, too. :-)
downvote count: 0
tagged with: visibility
favorite count: 0
has comment: http://stackoverflow.com/comment/35870328
answer count: 0
has comment: http://stackoverflow.com/comment/35871265
type: UnansweredQuestion

http://stackoverflow.com/q/23346115
upvote count: 12
downvote count: 0
has comment: http://stackoverflow.com/comment/35752681
tagged with: rest
has answer: http://stackoverflow.com/a/23362994
answer count: 1
favorite count: 0
score: 12
tagged with: spring
has title: Spring RestTemplate connection reset
has body: I'm trying to consume a REST service with Spring facilities following this guide but I'm having a problem with the connection. I want to access with GET method the REST service http://date.jsontest.com/ I've written this piece of code to consume the service package pack; import static org.junit.Assert.assertTrue; import java.util.HashMap; import java.util.Map; import javax.annotation.Generated; import org.junit.Test; import org.springframework.web.client.RestTemplate; import com.fasterxml.jackson.annotation.JsonAnyGetter; import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; public class RestUtilityTest { @JsonInclude(JsonInclude.Include.NON_NULL) @JsonPropertyOrder({ "time", "milliseconds_since_epoch", "date" }) public class DateTime { @JsonProperty("time") private String time; @JsonProperty("milliseconds_since_epoch") private Integer milliseconds_since_epoch; @JsonProperty("date") private String date; private Map&lt;String, Object&gt; additionalProperties = new HashMap&lt;String, Object&gt;(); @JsonProperty("time") public String getTime() { return time; } @JsonProperty("time") public void setTime(String time) { this.time = time; } @JsonProperty("milliseconds_since_epoch") public Integer getMilliseconds_since_epoch() { return milliseconds_since_epoch; } @JsonProperty("milliseconds_since_epoch") public void setMilliseconds_since_epoch(Integer milliseconds_since_epoch) { this.milliseconds_since_epoch = milliseconds_since_epoch; } @JsonProperty("date") public String getDate() { return date; } @JsonProperty("date") public void setDate(String date) { this.date = date; } @JsonAnyGetter public Map&lt;String, Object&gt; getAdditionalProperties() { return this.additionalProperties; } @JsonAnySetter public void setAdditionalProperty(String name, Object value) { this.additionalProperties.put(name, value); } } @T…
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23362994
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/35774852
has comment: http://stackoverflow.com/comment/35757179
has comment: http://stackoverflow.com/comment/35764745

http://stackoverflow.com/q/23315087
favorite count: 0
has body: How can I properly add a JPanel that is defined in the "RoomSystem.Java" code? The ERROR: Exception in thread "main" java.lang.NullPointerException at java.awt.Container.addImpl(Unknown Source) at java.awt.Container.add(Unknown Source) at hotelManagement.MainSystem.&lt;init&gt;(MainSystem.java:68) at hotelManagement.MainSystem.main(MainSystem.java:129) Line 68: getMainPanel().add(roomPanel, "Rooms"); Full Code: MainSystem.Java: package hotelManagement; import java.awt.CardLayout; import java.awt.GridLayout; 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; public class MainSystem extends JFrame{ /** * */ private static final long serialVersionUID = 1L; private JFrame mainFrame; private JPanel mainPanel; private static JPanel roomPanel; private JPanel btnPanel; private JButton btnRoom; private JButton btnCustomer; private JButton btnOrder; private JButton btnSearch; private CardLayout cLayout; private JLabel lblUpdate; public MainSystem(){ mainFrame = new JFrame("Hotel Management System"); mainFrame.setSize(500,300); mainFrame.setLayout(new GridLayout(2,0)); btnRoom = new JButton("Room Editor"); btnRoom.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { getCLayout().show(getMainPanel(), "Orders"); System.out.println("You clicked Rooms"); } }); btnCustomer = new JButton("Customer Editor"); btnOrder = new JButton("Order"); btnSearch = new JButton("Search"); lblUpdate = new JLabel("Instructions/details will go here."); btnPanel = new JPanel(); btnPanel.add(btnRoom); btnPanel.add(btnCustomer); btnPanel.add(btnOrder); btnPanel.add(btnSearch); btnPanel.add(lblUpdate); setMainPanel(new JPanel()); setCLayout(new CardLayout()); getMainPanel().setLayout(getCLayout()); getMainPanel().add(btnPanel, "Buttons"); getMainPanel().add(roomPanel, "Rooms"); mainFrame.add(getMainPanel()); mainFrame.setVisible(true); mainFra…
tagged with: jframe
tagged with: panels
tagged with: swing
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/23315221
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23315202
tagged with: java
tagged with: jpanel
score: -1
possible better answer: http://stackoverflow.com/a/23315202
answer count: 2
upvote count: 0
has title: JPanel Issue : java.lang.NullPointerException
accepted answer: http://stackoverflow.com/a/23315221

http://stackoverflow.com/comment/35942477
type: AnswerComment
score: 0
type: Comment
has text: I use Tomcat with Weld or I can use JBoss
comment on: http://stackoverflow.com/a/23395667

http://stackoverflow.com/comment/35850190
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23398629
type: AnswerComment
has text: @VinceEmigh WADR, after `equals(name)`?

http://stackoverflow.com/comment/35924234
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23438100
has text: @EJP: It's correct that the OS is responsible for thread scheduling. Unless I completely misread it OP doesn't care about scheduling though, he just want's to get Java to saturate all cores. Which definitely *is* possible. So I don't think this answer is very helpful regarding the OPs problem.
type: AnswerComment

http://stackoverflow.com/comment/35887844
comment on: http://stackoverflow.com/a/23418655
has text: The platform can adjust the backlog up or down. The minimum backlog is at least five, not zero.
type: AnswerComment
type: Comment
score: 1

http://stackoverflow.com/a/23364324
type: AcceptedAnswer
downvote count: 0
upvote count: 8
accepted answer of: http://stackoverflow.com/q/23360770
type: Answer
score: 8
answers question: http://stackoverflow.com/q/23360770
has body: The official API is available here: Type Description Interfaces. You can use it from C++ directly but I suggest you use .NET (C# in my sample) with an extra tool that Microsoft has written long time ago (mine is dated 1997), named TLBINF32.DLL. It's also a COM object but is Automation (VBScript, Javascript, VB/VBA) and .NET compatible. You can find TLBINF32.DLL googling for it (this link seems to work today: tlbinf32.dll download, make sure you get the .ZIP file, not what they call the "fixer"...). Note it's a 32-bit DLL so your program must be compiled as 32-bit to be able to use it. I don't know of any 64-bit version but how to use it a with 64-bit client is described here: tlbinf32.dll in a 64bits .Net application How to use this library is explained in detail here in this december 2000 MSDN magazine's article: Inspect COM Components Using the TypeLib Information Object Library. It's VB (not .NET) oriented, but it's quite easy to translate in .NET terms. Here is a sample console app in C# that just dumps all type info from a type lib (here MSHTML.TLB): class Program { static void Main(string[] args) { TypeLibInfo tli = new TypeLibInfo(); tli.ContainingFile = @"c:\windows\system32\mshtml.tlb"; foreach (TypeInfo ti in tli.TypeInfos) { Console.WriteLine(ti.Name); // etc... } } }
has comment: http://stackoverflow.com/comment/85874457
has comment: http://stackoverflow.com/comment/131507178
has comment: http://stackoverflow.com/comment/131508597

http://stackoverflow.com/q/23315876
downvote count: 2
tagged with: collections
has comment: http://stackoverflow.com/comment/35697502
has comment: http://stackoverflow.com/comment/35697589
tagged with: java
has comment: http://stackoverflow.com/comment/35697581
has comment: http://stackoverflow.com/comment/35697634
type: Question
upvote count: 0
score: -2
answer count: 1
has title: Create split option in blackjack (java)
has answer: http://stackoverflow.com/a/23316227
favorite count: 0
has body: I am currently creating a Java implementation of black jack that is not allowed to use java.util.Collections. I am having trouble creating a split option in the game. The split option, for anyone not familiar with blackjack (or 21), means that if the dealer hands the player two cards that are the same, the player can choose to split them into two separate hands. I have the code showing the Deal method &amp; the Hit method; I do not know how to implement the split method correctly. Here's the Deal() method: public static void Deal() { String choice = "#"; //Player Goes First, play until Player or Dealer reaches 21, //Busts or both Player and Dealer decide to STAY while(choice.charAt(0) != '2' &amp;&amp; DealerTot &lt; 21 &amp;&amp; PlayerTot &lt; 21 &amp;&amp; PlayerStay == false ) { System.out.println("Dealers asks " + PlayerN + ", Do you want a HIT or will you STAY?"); System.out.println("(1)Hit\n(2)Stay\n(3)Split\n(4)Quit"); choice = in.nextLine(); switch(choice.charAt(0)) { case '1' : System.out.println(PlayerN + " requests a HIT.\n"); Hit(PLAYER); break; case '2' : System.out.println(PlayerN + " decides to STAY.\n"); PlayerStay = true; ShowHand(PLAYER); break; case '3' ://SPLIT METHOD INCOMPLETE /////toDo ShowHand(PLAYER); break; case '4' : break; default : System.out.println("Invalid input!"); choice = "INVALIDINPUT"; break; } //char ; //If invalid input skip Dealer events and go back to player if(!choice.equals("INVALIDINPUT")) { //Dealer Only Draws if Player Not Busted if(PlayerTot &lt; 21) { if(DealerTot &lt; HouseLimit) { System.out.println("The Dealer decides to take a card."); Hit(DEALER); } else { System.out.println("The Dealer decides to STAY."); DealerStay = true; ShowHand(DEALER); } }//close if for Player Not Busted }//close if for invalid choice }//close while true loop }//close function Here's the Hit() method: public static void Hit(int ANYONE) { DRAW(ANYONE); if(ANYONE == PLAYER) { if(PlayerTot &gt; 21) { for(int x = 0; x &lt; MaximumHSize; x++) {…
type: UnansweredQuestion

http://stackoverflow.com/comment/35937388
comment on: http://stackoverflow.com/q/23445493
has text: I looked at the cookies the website sets, and it appears that it uses CloudFlare, which sets a `__cfduid` cookie. You might have to [handle this cookie](http://www.hccp.org/java-net-cookie-how-to.html).
type: QuestionComment
type: Comment
score: 2

http://stackoverflow.com/q/23349923
downvote count: 0
tagged with: java
tagged with: eclipse
type: Question
has body: I am building a real time program with RTSJ and having trouble running my code with jamaicaVM in the terminal. I have written my code in eclipse and have installed the jamaicavm tools into my eclipse. It is currently in the already installed software. Now I want to call jamaicavm filename and run my file but I am having trouble launching the aicas license provider, so that I can run the file. Any thoughts? my update-site-jamaica6 folder is in my java project's folder.
has title: How to launch aicas license provider ? and call files with jamaicaVM?
score: 4
tagged with: rtsj
tagged with: real-time
answer count: 1
favorite count: 0
type: UnansweredQuestion
tagged with: jamaicavm
upvote count: 4
has answer: http://stackoverflow.com/a/37976878

http://stackoverflow.com/q/23343896
upvote count: 1
type: Question
has title: CXF: generated WSDL vs. original WSDL
tagged with: wsdl
downvote count: 0
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41638279
tagged with: web-services
has body: I have a question regarding WSDLs generated from CXF. From what I understood is that the WSDL that’s published by CXF is generated from JAX-WS/JAXB. I have a WSDL file with the following content: ... &lt;xsd:complexType name="Scenario" mixed="true"&gt; &lt;xsd:sequence&gt; &lt;xsd:element name="Description" type="xsd:anyURI" minOccurs="0"/&gt; &lt;xsd:any namespace="##other" minOccurs="0" maxOccurs="unbounded" processContents="lax"/&gt; &lt;/xsd:sequence&gt; &lt;xsd:anyAttribute namespace="##other" processContents="lax"/&gt; &lt;/xsd:complexType&gt; ... After I generated my classes and deployed the service I checked the interface in my browser (with ?wsdl). Much to my surprise it looked considerably different: a "choice" has been added, processContents is changed, etc. ... &lt;xsd:complexType mixed="true" name="Scenario"&gt; &lt;xsd:sequence&gt; &lt;xsd:choice maxOccurs="unbounded" minOccurs="0"&gt; &lt;xsd:element name="Description" type="xsd:string"/&gt; &lt;xsd:any namespace="##other" processContents="lax"/&gt; &lt;xsd:choice&gt; &lt;/xsd:sequence&gt; &lt;xsd:anyAttribute namespace="##other" processContents="skip"/&gt; &lt;/xsd:complexType&gt; ... I am especially interested in this additional choice that’s been added? Is it maybe because of the "xsd:any"?
answer count: 0
tagged with: cxf
score: 1
tagged with: java
tagged with: jaxb

http://stackoverflow.com/comment/35762146
score: 0
type: AnswerComment
type: Comment
has text: Try the second one mate.
comment on: http://stackoverflow.com/a/23351047

http://stackoverflow.com/a/23359047
has body: To parse a String into Json element and get an object structure JsonElement jelement = new JsonParser().parse(jsonLine); JsonObject jobject = jelement.getAsJsonObject(); To get an object, use: JsonObject anObject = jobject.getAsJsonObject("object_name"); To get an array, use: JsonArray jarray = anObject.getAsJsonArray("array_name"); To get a String value, use: String result = anObject.get("property_name").toString();
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23358824
type: Answer
score: 7
upvote count: 7
accepted answer of: http://stackoverflow.com/q/23358824

http://stackoverflow.com/q/23302505
type: Question
score: 0
answer count: 1
has body: I have 3 markers of the location of stores, each with its own position (latitude and longitude),I would like to click on a marker so that it opens up the standard Google MAPS with direction FROM where the current user is TO the destination of the clicked marker, now getting user position is OK, clicking on a marker to display snippet OK but how do I click on the snippet pop out ("click here for directions") to open up Google MAPS that come standard with an Android phone to navigate? Jave: static final LatLng ARCADIA = new LatLng(-25.746318, 28.221322999999984); static final LatLng HATFIELD = new LatLng(-25.7487333, 28.238043199999993); static final LatLng CENTURION = new LatLng(-25.8602778, 28.189444399999957); private GoogleMap map; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_locate_store); LocationManager lm = (LocationManager) getSystemService(Context.LOCATION_SERVICE); lm.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, this); map = ((MapFragment) getFragmentManager().findFragmentById(R.id.map)).getMap(); //map.setMapType(GoogleMap.MAP_TYPE_SATELLITE); map.setMyLocationEnabled(true); map.animateCamera( CameraUpdateFactory.zoomTo( 5.0f ) ); Marker aracdia = map.addMarker(new MarkerOptions().position(ARCADIA).title("Arcadia") .snippet("Cnr Beatrix &amp; Hamilton Street\n Contacts:\nTel: 076 7533 123\n click-for-directions") .icon(BitmapDescriptorFactory.fromResource(R.drawable.marker_small))); Marker hatfield = map.addMarker(new MarkerOptions().position(HATFIELD).title("Hatfield").icon(BitmapDescriptorFactory.fromResource(R.drawable.marker_small))); Marker centurion = map.addMarker(new MarkerOptions().position(CENTURION).title("Centurion").icon(BitmapDescriptorFactory.fromResource(R.drawable.marker_small)));
has title: Marker To Open Google MAPS Direction
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23302728
tagged with: android
tagged with: java

http://stackoverflow.com/q/23423078
score: 10
tagged with: mapreduce
has answer: http://stackoverflow.com/a/23423538
accepted answer: http://stackoverflow.com/a/23423538
possible better answer: http://stackoverflow.com/a/41708178
has body: I want to learn how to use the Java 8 syntax with streams and got a bit stuck. It's easy enough to groupingBy when you have one key for every value. But what if I have a List of keys for every value and still want to categorise them with groupingBy? Do I have to break it into several statements or is there possibly a little stream magic that can be done to make it simpler. This is the basic code: List&lt;Album&gt; albums = new ArrayList&lt;&gt;(); Map&lt;Artist, List&lt;Album&gt;&gt; map = albums.stream().collect(Collectors.groupingBy(this::getArtist)); It works great if there is only one Artist for every Album. But I must return a List since an Album can have many Artists. Album and Artist are used for illustration of course, I have real-world types.. There's probably a simple solution but I haven't found it in a while so I'm calling on the collective brain this site represents to solve it. :) A complex solution is also welcome in case a simple one doesn't exist. In Album class or as an utility method taking an Album as argument: Artist getArtist(); // ok List&lt;Artist&gt; getArtist(); // Not ok, since we now have many "keys" for every Album Cheers, Mikael Grev
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/41708178
has title: Java 8 grouping by from one-to-many
upvote count: 10
tagged with: grouping
has answer: http://stackoverflow.com/a/48426577
answer count: 4
type: AnsweredQuestion
tagged with: java-stream
tagged with: java-8
type: Question
has answer: http://stackoverflow.com/a/58110774
has comment: http://stackoverflow.com/comment/35896164
tagged with: java

http://stackoverflow.com/comment/35942723
comment on: http://stackoverflow.com/a/23439748
has text: The "how" is an implementation detail that you don't need to know. However, having a timestamp on the cached query results and a last-updated timestamp for each table would not be an unreasonable way to support this functionality. Another option would be to invalidate all cache entries that are affected by each update as it occurs.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/35886466
score: 0
type: AnswerComment
has text: I'm sorry, I'm afraid I don't follow. Does `String.startsWith()` not work? Or do you mean that you have to have the program figure out the prefixes?
type: Comment
comment on: http://stackoverflow.com/a/23417783

http://stackoverflow.com/q/23322276
accepted answer: http://stackoverflow.com/a/23664918
downvote count: 0
score: 1
tagged with: java
tagged with: scenebuilder
tagged with: javafx
has comment: http://stackoverflow.com/comment/35933524
has body: picture1: picture2: picture3: Note: Button1 is in Tab1 and Button2 is in Tab2 In Java Scene Builder 2.0 Editor i added 2 tab on my hierarchy. When i click the Button2 for edit (in picture1) then the Editor switch to tab1 (in picture1) Button2 is in Tab2 but when i click it then tab switch to tab1 why? Is this a bug in Scene Builder 2.0? or am i set wrong the hierarchy (in picture3)?
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/23664918
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/35933401
tagged with: hierarchy
type: AnsweredQuestion
has title: Java Scene Builder 2.0, Tab2 is switch to Tab1 in editor?
tagged with: components

http://stackoverflow.com/comment/35672522
has text: More than I have used it recently, it is a matter of logic... the only way the exception may be thrown when `e.detach` is invoked if if `inactiveDocList` is a reference to the original children list (instead of a copy) AND `e.detach` removes the node from such a list.
type: Comment
comment on: http://stackoverflow.com/a/23302112
score: 0
type: AnswerComment

jsp
tags question: http://stackoverflow.com/q/23438234
tags question: http://stackoverflow.com/q/23310627
tags question: http://stackoverflow.com/q/23333488
tags question: http://stackoverflow.com/q/23420515
tags question: http://stackoverflow.com/q/23354062
tags question: http://stackoverflow.com/q/23428119
tags question: http://stackoverflow.com/q/23321450
tags question: http://stackoverflow.com/q/23338390
tags question: http://stackoverflow.com/q/23382227
tags question: http://stackoverflow.com/q/23405212
tags question: http://stackoverflow.com/q/23413928
tags question: http://stackoverflow.com/q/23357074
tags question: http://stackoverflow.com/q/23311554
tags question: http://stackoverflow.com/q/23360153
tags question: http://stackoverflow.com/q/23384089
tags question: http://stackoverflow.com/q/23424799
tags question: http://stackoverflow.com/q/23353423
tags question: http://stackoverflow.com/q/23353960
tags question: http://stackoverflow.com/q/23347312
tags question: http://stackoverflow.com/q/23382102
tags question: http://stackoverflow.com/q/23416123
tags question: http://stackoverflow.com/q/23401627
tags question: http://stackoverflow.com/q/23330579
tags question: http://stackoverflow.com/q/23327511
tags question: http://stackoverflow.com/q/23436973
tags question: http://stackoverflow.com/q/23375134
tags question: http://stackoverflow.com/q/23451639
tags question: http://stackoverflow.com/q/23311546
tags question: http://stackoverflow.com/q/23421460
tags question: http://stackoverflow.com/q/23358079
tags question: http://stackoverflow.com/q/23393617
tags question: http://stackoverflow.com/q/23362680
tags question: http://stackoverflow.com/q/23441108
tags question: http://stackoverflow.com/q/23364083
tags question: http://stackoverflow.com/q/23380923
tags question: http://stackoverflow.com/q/23336903
tags question: http://stackoverflow.com/q/23425134
tags question: http://stackoverflow.com/q/23353185
tags question: http://stackoverflow.com/q/23381603
tags question: http://stackoverflow.com/q/23442737
tags question: http://stackoverflow.com/q/23325223
tags question: http://stackoverflow.com/q/23448497
tags question: http://stackoverflow.com/q/23412507
tags question: http://stackoverflow.com/q/23360178
tags question: http://stackoverflow.com/q/23324093
tags question: http://stackoverflow.com/q/23430577
tags question: http://stackoverflow.com/q/23356519
tags question: http://stackoverflow.com/q/23343679
tags question: http://stackoverflow.com/q/23336562
tags question: http://stackoverflow.com/q/23359056
tags question: http://stackoverflow.com/q/23367995
tags question: http://stackoverflow.com/q/23379835
tags question: http://stackoverflow.com/q/23440517
tags question: http://stackoverflow.com/q/23333817
tags question: http://stackoverflow.com/q/23383993
tags question: http://stackoverflow.com/q/23410704
tags question: http://stackoverflow.com/q/23315680
tags question: http://stackoverflow.com/q/23312105
type: Tag
tags question: http://stackoverflow.com/q/23306783
tags question: http://stackoverflow.com/q/23407934
tags question: http://stackoverflow.com/q/23340918
tags question: http://stackoverflow.com/q/23290913
tags question: http://stackoverflow.com/q/23415240
tags question: http://stackoverflow.com/q/23449174
tags question: http://stackoverflow.com/q/23324904
tags question: http://stackoverflow.com/q/23418964
tags question: http://stackoverflow.com/q/23405399
tags question: http://stackoverflow.com/q/23386029
tags question: http://stackoverflow.com/q/23452518
tags question: http://stackoverflow.com/q/23386259
tags question: http://stackoverflow.com/q/23346692
tags question: http://stackoverflow.com/q/23426325
tags question: http://stackoverflow.com/q/23415037
tags question: http://stackoverflow.com/q/23302023
tags question: http://stackoverflow.com/q/23420941
tags question: http://stackoverflow.com/q/23320828
tags question: http://stackoverflow.com/q/23406244
tags question: http://stackoverflow.com/q/23378727
tags question: http://stackoverflow.com/q/23319699

http://stackoverflow.com/q/23338628
score: -2
accepted answer: http://stackoverflow.com/a/23339232
downvote count: 3
has comment: http://stackoverflow.com/comment/35738899
answer count: 3
upvote count: 1
has answer: http://stackoverflow.com/a/23339230
has title: Add numbers in JAVA
favorite count: 0
has comment: http://stackoverflow.com/comment/35738722
has comment: http://stackoverflow.com/comment/35738521
tagged with: addition
has comment: http://stackoverflow.com/comment/35739290
has body: How do I add the deposit numbers? Do I need some kind of loop (I´m new to JAVA)?. public class BankAccount { public static void main(String[] args) { BankAccount account = new BankAccount(); account.deposit(1000, "Deposit 1"); account.deposit(2000, "Deposit 2"); System.out.println("Balance: " + account.getBalance()); account.deposit(3000, "Deposit 3"); account.deposit(4000, "Deposit 4"); System.out.println("Balance: " + account.getBalance()); } private int currentBalance = 0; private int getBalance() { int finalBalance = depositAmount + currentBalance; return finalBalance; } private int depositAmount; public void deposit(int depositAmount) { this.depositAmount = depositAmount; } } Result should be: Balance: 3000 Balance: 10000
has comment: http://stackoverflow.com/comment/35738507
has comment: http://stackoverflow.com/comment/35739216
has comment: http://stackoverflow.com/comment/35739281
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23338696
tagged with: numbers
tagged with: java
possible better answer: http://stackoverflow.com/a/23339230
type: Question
has answer: http://stackoverflow.com/a/23339232

http://stackoverflow.com/comment/35812523
type: AnswerComment
type: Comment
has text: @user3586916 I've added onto my answer a deep copy utility method for a 2-D double[][] array. Hopefully that helps.
comment on: http://stackoverflow.com/a/23376558
score: 0

http://stackoverflow.com/q/23418387
answer count: 1
has comment: http://stackoverflow.com/comment/35887145
favorite count: 0
has answer: http://stackoverflow.com/a/23418477
has comment: http://stackoverflow.com/comment/35887131
has body: I'm sorry if this is already asked but here is my question. I would like to create a function where the parameter that the user inputs can be any variable type, similar to System.out.println(). That being said how would I create that method? public static void example(String, int, double, etc.) { //Code here }
tagged with: parameters
type: AnsweredQuestion
upvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/35887098
has comment: http://stackoverflow.com/comment/35887112
type: Question
has title: How to create a method with a parameter that can be any type of variable?
score: -1
has comment: http://stackoverflow.com/comment/35887213
accepted answer: http://stackoverflow.com/a/23418477
tagged with: function
has comment: http://stackoverflow.com/comment/35887135
downvote count: 1

http://stackoverflow.com/comment/35902580
comment on: http://stackoverflow.com/a/23427059
score: 0
type: AnswerComment
type: Comment
has text: not for this task i meant. FlowLayout is just fine, just not suitable for this task.

http://stackoverflow.com/comment/35871339
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23294051
has text: Would you please post your layout file?

http://stackoverflow.com/comment/35871421
comment on: http://stackoverflow.com/q/23401602
has text: Don't create a custom TableModel. The DefaultTableModel supports all the functionalilty you require. You can dynamically add/remove rows or change the data in any cell of the table.
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/a/23446011
upvote count: 1
has body: The Mn variable is defined inside the else if block. Hence when you are accessing it inside the for loop, it does not find its declaration. Insetad you should move the declaration int Mn = 0 at the beginning the method and assign it to 10 inside the else if
score: 1
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/23445956

http://stackoverflow.com/q/23352590
tagged with: java
possible better answer: http://stackoverflow.com/a/23361670
has answer: http://stackoverflow.com/a/32257859
has comment: http://stackoverflow.com/comment/35770373
upvote count: 2
has comment: http://stackoverflow.com/comment/35765177
tagged with: sql
has answer: http://stackoverflow.com/a/23361670
downvote count: 0
favorite count: 0
linked to: http://stackoverflow.com/q/6410452
answer count: 3
tagged with: oracle-database
tagged with: jdbc
tagged with: spring
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24539949
accepted answer: http://stackoverflow.com/a/24539949
has body: im trying to execute oracle stored procedure using SimpleJDBCCall, all tables and stored procedures are in restaurant schema, table looks like: CREATE TABLE STAFF ( STAFF_ID NUMBER(5), STAFF_FIRST_NAME VARCHAR2(10 BYTE) NOT NULL, STAFF_LAST_NAME VARCHAR2(20 BYTE) NOT NULL, STAFF_ROLE VARCHAR2(20 BYTE) NOT NULL, STAFF_OTHER_DETAILS VARCHAR2(50 BYTE) ); my type package: CREATE OR REPLACE PACKAGE Staff_Types AS TYPE Staff_Collection IS TABLE OF Staff%ROWTYPE; END Staff_Types; my access package: CREATE OR REPLACE PACKAGE Staff_TAPI AS FUNCTION getAllStaff RETURN Staff_Types.Staff_Collection; END Staff_TAPI; CREATE OR REPLACE PACKAGE BODY Staff_Tapi AS FUNCTION getAllStaff RETURN Staff_Types.Staff_Collection IS all_staff Staff_Types.Staff_Collection; BEGIN SELECT * BULK COLLECT INTO all_staff FROM Staff; RETURN all_staff; END; END Staff_Tapi; Java Access: @Component @Qualifier("staffJdbcDAO") public class StaffJDBCDAO implements StaffDAO { JdbcTemplate jdbcTemplate; SimpleJdbcCall getAllMembersSP; @Autowired @Qualifier("dataSource") DataSource dataSource; @Autowired @Qualifier("jdbcTemplate") public void setJdbcTemplate(JdbcTemplate jdbcTemplate) { this.jdbcTemplate = jdbcTemplate; initializeStoredProceduresCalls(); } private void initializeStoredProceduresCalls() { getAllMembersSP = new SimpleJdbcCall(jdbcTemplate); getAllMembersSP.withCatalogName("Staff_Tapi"); getAllMembersSP.withFunctionName("getAllStaff"); getAllMembersSP.declareParameters( new SqlOutParameter("return", Types.OTHER, "Staff_Types.Staff_Collection", new SqlReturnStructArray&lt;&gt;( new StaffMapper() ) ) ); getAllMembersSP.compile(); } @Override public List&lt;Staff&gt; getAllMembers() { Staff[] staff = getAllMembersSP.executeFunction(Staff[].class,new HashMap&lt;String,Object&gt;() ); return Arrays.asList(staff); } } mapping class: public class StaffMapper implements StructMapper&lt;Staff&gt; { @Override public STRUCT toStruct(Staff staff, Connection connection, String typeName) throws SQLException {…
has title: Getting pl/sql array of struct from stored procedure using JdbcSimpleCall
type: Question

http://stackoverflow.com/comment/35685791
has text: Are you sure the jar file you have contains the class you need? How are you deploying?
comment on: http://stackoverflow.com/q/23309614
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/23417161
has comment: http://stackoverflow.com/comment/35884890
type: Question
answer count: 2
downvote count: 0
possible better answer: http://stackoverflow.com/a/23417267
has answer: http://stackoverflow.com/a/23417253
has body: Assume I have a class with two methods method1 and method2. I have made both of these methods synchronized. Assume a class calls method1 and the same time a different class calls method2. Will both these methods execute at the same time?
has title: Will both method execute at same time
favorite count: 0
tagged with: synchronization
has comment: http://stackoverflow.com/comment/35884843
upvote count: 1
accepted answer: http://stackoverflow.com/a/23417253
type: AnsweredQuestion
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/23417267

http://stackoverflow.com/a/23354326
has comment: http://stackoverflow.com/comment/35768150
downvote count: 0
has comment: http://stackoverflow.com/comment/35768778
score: 1
has body: Your errors are caused by these lines modechoice1 = (RadioGroup) findViewById(R.id.textmode); modechoice2 = (RadioGroup) findViewById(R.id.animationmode); modechoice3 = (RadioGroup) findViewById(R.id.imagemode); sizechoice1 = (RadioGroup) findViewById(R.id.normal); sizechoice2 = (RadioGroup) findViewById(R.id.extended); textmode, animationmode, etc. are all RadioButtons defined in your xml layout. So when you are doing (RadioGroup) findViewById(R.id.textmode);, that does not work because you cannot convert a RadioButton to a RadioGroup. Instead get the RadioGroup and call getCheckedRadioButtonId on that: RadioGroup modechoice = (RadioGroup) findViewById(R.id.modeselection); RadioGroup sizechoice = (RadioGroup) findViewById(R.id.textsizeselection); int modeChoiceId = modechoice.getCheckedRadioButtonId(); int sizeChoiceId = sizechoice.getCheckedRadioButtonId(); // An example, not sure about your logic. if (modeChoiceId == R.id.textmode &amp;&amp; sizeChoiceId == R.id.normal){ } Also note that getCheckedRadioButtonId returns an ID of the selected RadioButton, not an index. The syntax highlighting of variables do not denote whether they work or not, or whether they are recognized or not. I believe you're referring to the differences between the syntax highlighting of a local or instance variable. Since you defined aboutBtn and startBtn as local variables, they are not highlighted in blue, just like the variable called local in the image above. If you define them like the variable field in the image above, they will be highlighted in blue denoting an instance variable. All this assuming you know the difference between the two. The image above is the syntax coloring preferences which can be found in: Window -> Preferences - Java -> Editor -> Syntax Coloring
has comment: http://stackoverflow.com/comment/35768830
has comment: http://stackoverflow.com/comment/35768709
answers question: http://stackoverflow.com/q/23354109
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23354109
upvote count: 1
has comment: http://stackoverflow.com/comment/35768184
has comment: http://stackoverflow.com/comment/35768465
has comment: http://stackoverflow.com/comment/35768335
type: Answer
has comment: http://stackoverflow.com/comment/35768720

http://stackoverflow.com/comment/35863276
has text: how i will get know what format is it and why this is displaying right data on my console
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23405906
score: 0

http://stackoverflow.com/a/23301809
answers question: http://stackoverflow.com/q/23301754
type: Answer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/35673429
has comment: http://stackoverflow.com/comment/35672102
type: AcceptedAnswer
has body: This is because the line above your switch statement has key.nextInt() *. The scanner reads the integer, but it leaves the end-of-line character '\n' in the buffer. You need to consume that '\n' character somehow, before the key.nextLine(); inside the switch statement returns some relevant data to you. To fix this problem, insert key.nextLine(); in front of the switch statement. * don't ask me how I know that :-)
has comment: http://stackoverflow.com/comment/35672324
accepted answer of: http://stackoverflow.com/q/23301754
upvote count: 1
has comment: http://stackoverflow.com/comment/35673210

http://stackoverflow.com/comment/35890505
comment on: http://stackoverflow.com/q/23415658
type: Comment
type: QuestionComment
has text: When I click on the "Update Employee Information" button on the Manager Log In screen, it switches to a different screen. I enter the information in and press ok, which updates the employee's information stored in an Access database and goes back to the Manager Log In screen. I have each screen in a different class. When it gets back to the Manager screen though, the JList has every name twice, which I am not able to fix. I'm not sure if that makes any more sense?
score: 0

http://stackoverflow.com/q/23419433
has title: Netty hello world example not working
tagged with: exception
tagged with: netty
has answer: http://stackoverflow.com/a/23420784
accepted answer: http://stackoverflow.com/a/23420784
type: AnsweredQuestion
tagged with: java
type: Question
has body: I have following code to echo input received by Netty- import io.netty.buffer.ByteBuf; import io.netty.channel.ChannelHandlerContext; import io.netty.channel.SimpleChannelInboundHandler; public class MyHandler extends SimpleChannelInboundHandler{ @Override protected void channelRead0(ChannelHandlerContext ctx, Object msg) throws Exception { ByteBuf in = (ByteBuf) msg; try { System.out.println(in.toString(io.netty.util.CharsetUtil.US_ASCII)); } finally { in.release(); } } } I am invoking it as follows- try { ServerBootstrap b = new ServerBootstrap(); // (2) b.group(bossGroup, workerGroup) .channel(NioServerSocketChannel.class) // (3) .childHandler(new ChannelInitializer&lt;SocketChannel&gt;() { // (4) @Override public void initChannel(SocketChannel ch) throws Exception { ch.pipeline().addLast(new MyHandler()); } }) .option(ChannelOption.SO_BACKLOG, 128) // (5) .childOption(ChannelOption.SO_KEEPALIVE, true); // (6) // Bind and start to accept incoming connections. ChannelFuture f = b.bind(port).sync(); // (7) // Wait until the server socket is closed. // In this example, this does not happen, but you can do that to gracefully // shut down your server. f.channel().closeFuture().sync(); } finally { workerGroup.shutdownGracefully(); bossGroup.shutdownGracefully(); } When I send a curl request to this Netty server, while I do see system.out working (I can see the curl request in console) I get this exception- May 01, 2014 6:25:01 PM io.netty.channel.DefaultChannelPipeline$TailHandler exceptionCaught WARNING: An exceptionCaught() event was fired, and it reached at the tail of the pipeline. It usually means the last handler in the pipeline did not handle the exception. io.netty.util.IllegalReferenceCountException: refCnt: 0, decrement: 1 at io.netty.buffer.AbstractReferenceCountedByteBuf.release(AbstractReferenceCountedByteBuf.java:102) at io.netty.buffer.WrappedByteBuf.release(WrappedByteBuf.java:819) at io.netty.buffer.SimpleLeakAwareByteBuf.release(SimpleLeakAwareByteBuf…
score: 0
answer count: 1

http://stackoverflow.com/q/23397142
has answer: http://stackoverflow.com/a/23409204
accepted answer: http://stackoverflow.com/a/23409204
has body: I'm trying to run a QuickBooks Online batch job using the Java SDK v2.2.1 with ipp v3: public int updateQuickBooks(BatchOperation batch) { OAuthAuthorizer oauth = new OAuthAuthorizer( consumerKey, consumerSecret, accessToken, accessTokenSecret); assert(oauth != null); Context context = new Context(oauth, QuickBooks.APP_TOKEN, ServiceType.QBO, realmID); assert(context != null); DataService service = new DataService(context); assert(service != null); LOG.info("Executing QuickBooks batch operation for " + batch.getBIds().size() + " invoices"); service.executeBatch(batch); ...and the stack trace for the error: java.lang.NullPointerException at com.intuit.ipp.interceptors.ConnectionInterceptor.getRetryHandler(ConnectionInterceptor.java:212) at com.intuit.ipp.interceptors.ConnectionInterceptor.execute(ConnectionInterceptor.java:85) at com.intuit.ipp.interceptors.IntuitInterceptorProvider.executeRequestInterceptors(IntuitInterceptorProvider.java:76) at com.intuit.ipp.interceptors.IntuitInterceptorProvider.executeInterceptors(IntuitInterceptorProvider.java:62) at com.intuit.ipp.services.DataService.executeBatch(DataService.java:387) at ie.search4less.quickbooks.InvoiceGenerator.updateQuickBooks(InvoiceGenerator.java:120) at ie.search4less.quickbooks.FileUploadServlet.doPost(FileUploadServlet.java:79) at javax.servlet.http.HttpServlet.service(HttpServlet.java:637) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1166) at com.google.appengine.api.socket.dev.DevSocketFilter.doFilter(DevSocketFilter.java:74) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157) at com.google.appengine.tools.development.ResponseRewriterFilter.doFilter(ResponseRewriterFilter.java:127) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157) at com.google.a…
type: AnsweredQuestion
tagged with: java
type: Question
tagged with: intuit-partner-platform
tagged with: quickbooks
score: 0
has title: QuickBooks Online Java SDK DataService executeBatch() causing NullPointerException
linked to: http://stackoverflow.com/q/20211933
answer count: 1
tagged with: quickbooks-online

nullable
tag name: nullable
type: Tag
tags question: http://stackoverflow.com/q/23410150

http://stackoverflow.com/a/75423256
score: -4
has body: As of 2023 the above do not seem to work (or I will say at least did not seem to work for me), what did work was the following import org.slf4j.LoggerFactory; import ch.qos.logback.classic.Level; import ch.qos.logback.classic.Logger; import ch.qos.logback.classic.LoggerContext; final LoggerContext loggerContext = (LoggerContext) LoggerFactory.getILoggerFactory(); final Logger logger = loggerContext.exists(org.slf4j.Logger.ROOT_LOGGER_NAME); // give it your logger name final Level newLevel = Level.toLevel("ERROR", null); // give it your log level logger.setLevel(newLevel); If you want to see how to do this on a per request basis see my comment on post Change priority level in log4j per request
downvote count: 4
upvote count: 0
has comment: http://stackoverflow.com/comment/134355345
answers question: http://stackoverflow.com/q/23434252
type: Answer
has comment: http://stackoverflow.com/comment/133081839

http://stackoverflow.com/a/23443349
has comment: http://stackoverflow.com/comment/35933555
type: Answer
upvote count: 1
has body: I decided i would post my finished class here in case anyone wanted it for reference. public class Degree extends Number implements Comparable&lt;Degree&gt;{ float degreeFloat; public Degree(){ degreeFloat = 0; } public Degree(float degrees){ this.set(degrees); } public Degree(int degrees){ this.set(degrees); } public Degree(Degree degrees){ this.set(degrees); } @Override public int intValue() { return (int)degreeFloat; } @Override public long longValue() { return (long)degreeFloat; } @Override public float floatValue() { return degreeFloat; } @Override public double doubleValue() { return (double)degreeFloat; } @Override public int compareTo(Degree compTo) { if(compTo.get() &gt; degreeFloat) return 1; else if(compTo.get() &lt; degreeFloat) return -1; else return 0; } public Boolean equals(Degree compTo){ if(degreeFloat == compTo.get()) return true; else return false; } public float get(){ return degreeFloat; } public void set(Degree setTo){ this.degreeFloat = setTo.get(); } public void set(float setTo){ this.degreeFloat = setNormalise(setTo); } public void set(int setTo){ this.degreeFloat = setNormalise((float)setTo); } public void set(double setTo){ this.degreeFloat = setNormalise((float)setTo); } public float setNormalise(float setTo){ float value = setTo; while(setTo &gt; 360f) setTo -= 360F; while(setTo &lt; 0f) setTo += 360f; return value; } }
answers question: http://stackoverflow.com/q/23442563
has comment: http://stackoverflow.com/comment/35933651
downvote count: 0
score: 1

http://stackoverflow.com/comment/35945106
type: Comment
comment on: http://stackoverflow.com/a/23449756
has text: OK then how do I print that?
score: 0
type: AnswerComment

http://stackoverflow.com/a/23302663
upvote count: 1
answers question: http://stackoverflow.com/q/23302023
has body: I think the best thing to do is probably install a Tomcat 7 test box and put your application on it as is. Get it working on 7 and then replace even the production box of the old version with Tomcat 7. When I did that, I also had an issue with tags moving from Tomcat 5.5 to Tomcat 7, but a simpler one. I had to change: &lt;jsp:param name="UserID" value="&lt;%=request.getParameter("UserID")%&gt;" /&gt; to: &lt;jsp:param name="UserID" value='&lt;%=request.getParameter("UserID")%&gt;' /&gt; Double quotes to single where I was printing a request parameter into an attribute value and obviously had to use double quotes in the code inside the attribute value. Either way works in Tomcat 5.5, but only the second works in 7.
downvote count: 0
score: 1
type: Answer

http://stackoverflow.com/q/23348971
answer count: 2
score: -2
tagged with: arrays
has answer: http://stackoverflow.com/a/23349146
duplicate of: http://stackoverflow.com/q/5554734
tagged with: int
downvote count: 2
tagged with: random
has comment: http://stackoverflow.com/comment/35758003
has answer: http://stackoverflow.com/a/23349061
favorite count: 0
tagged with: exception
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35758721
linked to: http://stackoverflow.com/q/5554734
upvote count: 0
has title: Java Array index out of bounds while making a string
has body: I was making a code that makes some unique integers in a string and i suddenly ran into an exception and i don't quite get what is the problem here, because i was almost done. And now what is happening i don't know. Here's my code: String[] res = new String[12]; int[] ia = {1, 6, 9}; int[] ai = {97, 79, 8}; int[] a = new int[10]; for(int i = 0; i &lt; a.length; i++){ a[i] = (ia[new Random().nextInt(3)] ^ (ai[new Random().nextInt(3)] * i)); for(int j = 0; j &lt; res.length; j++){ if(a[i] &gt;= j){ res[j * i] = "J:" + (a[i] * a[new Random().nextInt(10)]); //exception } else if(a[i] &lt;= j){ res[j * i] = "J:" + (-(a[i] * a[new Random().nextInt(10)])); } } } Here is the exception that is thrown: Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 12 at testy.main(unique.java:15)
tagged with: java
has comment: http://stackoverflow.com/comment/35757933
type: Question

http://stackoverflow.com/comment/133800980
score: 0
has text: After I updated the dependencies in the Projects build.gradle it worked again. I don't know what in detail it fixed.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23353291

http://stackoverflow.com/q/23448891
has answer: http://stackoverflow.com/a/23453980
tagged with: java
score: 0
answer count: 1
has body: I am trying to get Total Storage and Available Storage of BOX user but i didn't found anything on BOX android API I found it is possible for Dropbox here is solution for Dropbox but didn't found anything related to BOX android api.
tagged with: android
linked to: http://stackoverflow.com/q/14853410
tagged with: box-api
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23453980
has title: how to get available space in BOX android api?
type: Question

http://stackoverflow.com/comment/35678161
score: 0
type: QuestionComment
has text: You should write an answer to your question showing what you had to change to fix it. It is perfectly fine to accept your own answer.
type: Comment
comment on: http://stackoverflow.com/q/23301581

http://stackoverflow.com/comment/35778231
type: AnswerComment
has text: The dir is created when you package the WAR. Extract the WAR and look if the dependency is in.
type: Comment
comment on: http://stackoverflow.com/a/23357374
score: 0

http://stackoverflow.com/a/23450788
has comment: http://stackoverflow.com/comment/35948979
has comment: http://stackoverflow.com/comment/35947315
has body: class SerializableClass implements Serializable You just implement the interface. Java never demands a Serial ID; if you don't provide one it's determined at runtime. You can also extend a serializable class: class AnotherSerializableClass extends SerializableClass Java classifies a class as Serializable if it either implements Serializable itself or extends a class which implements Serializable. Since MyClass extends JFrame which implements Serializable, your class is serializable.
upvote count: 4
has comment: http://stackoverflow.com/comment/35947397
has comment: http://stackoverflow.com/comment/35947384
has comment: http://stackoverflow.com/comment/35949002
type: AcceptedAnswer
downvote count: 0
score: 4
has comment: http://stackoverflow.com/comment/35948656
has comment: http://stackoverflow.com/comment/35947724
accepted answer of: http://stackoverflow.com/q/23450771
type: Answer
has comment: http://stackoverflow.com/comment/35947358
has comment: http://stackoverflow.com/comment/35947416
has comment: http://stackoverflow.com/comment/35947301
has comment: http://stackoverflow.com/comment/35947411
answers question: http://stackoverflow.com/q/23450771
has comment: http://stackoverflow.com/comment/35947285

http://stackoverflow.com/a/23407687
upvote count: 2
answers question: http://stackoverflow.com/q/23406831
has body: This is the issue you are relating to: https://jira.mongodb.org/browse/SERVER-12266 which applies since 2.5.4. It seems this behaviour is unlikely to change due to this issue being marked as "works as designed". The last comment being: I spoke to Scott Hernandez about this today, and he explained the new strictness around empty modifiers is intended to alert users that were inadvertently sending over empty updates. Instead you should have your code to put: append("$setOnInsert", {}). Into an if statement to detect its setting.
score: 2
accepted answer of: http://stackoverflow.com/q/23406831
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/comment/35747123
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/23342534
type: Comment
has text: `foo[4]` should be `bar[4]`. But apart from that, this wouldn't work either, because if you're splitting by two whitespaces and you have four whitespaces in a row, it would result in one element more. So your index `4` is also incorrect. I mean... the requirement is not detailed enough.

http://stackoverflow.com/q/23378533
has comment: http://stackoverflow.com/comment/35812750
possible better answer: http://stackoverflow.com/a/23378606
linked to: http://stackoverflow.com/q/3481828
tagged with: java
has answer: http://stackoverflow.com/a/23378606
tagged with: split
answer count: 2
has title: Splitting an inputted string by comma and space
has comment: http://stackoverflow.com/comment/35812763
tagged with: arrays
tagged with: string
score: 0
has answer: http://stackoverflow.com/a/23378576
accepted answer: http://stackoverflow.com/a/23378576
tagged with: input
has body: while(scan.hasNext()){ String line = scan.next(); String[] tempArray = line.split(",\\s*"); for (int i=0; i&lt;3; i++){ System.out.println(tempArray[i]); } My input file looks like: A, 0, 3 C, 2, 2 BB, 3, 3 DA, -3, 0 ED, 2, -2 It returns A, then gives me an error. What gives?
has comment: http://stackoverflow.com/comment/35812747
type: AnsweredQuestion
type: Question

http://stackoverflow.com/a/46240441
answers question: http://stackoverflow.com/q/23405724
score: 0
type: Answer
has body: This is how I solved this, inlcuding Xalan and Serializer Download xalan-j2-2.7.0.jar & serializer-2.7.0.jar Update build.xml to include these jars in path <pathelement location="../xmltask-v1.14.jar"/> <pathelement path="../xalan-j2-2.7.0.jar"/> <pathelement path="../serializer-2.7.0.jar"/> This should get it running.

http://stackoverflow.com/comment/35790617
type: QuestionComment
comment on: http://stackoverflow.com/q/23366817
has text: So you now use a layout?
score: 0
type: Comment

http://stackoverflow.com/comment/35801516
comment on: http://stackoverflow.com/a/23372410
type: AnswerComment
has text: second code cant be executed, because of trying to acces non static object form static context
score: 0
type: Comment

http://stackoverflow.com/comment/35845956
score: 0
comment on: http://stackoverflow.com/q/23396495
type: Comment
type: QuestionComment
has text: @Tanis.7x No each activity contains a different layout, and it would make my app much much much more attractive and productive

deserialization
type: Tag
tags question: http://stackoverflow.com/q/23351595
tags question: http://stackoverflow.com/q/23391101
tags question: http://stackoverflow.com/q/23295671
tag name: deserialization
tags question: http://stackoverflow.com/q/23351748
tags question: http://stackoverflow.com/q/23444132

http://stackoverflow.com/comment/35922972
score: 2
type: Comment
type: QuestionComment
has text: What is `payments[]`? And why do you never use the items in `payments2[]`? Perhaps you are confusing yourself with poor variable names.
comment on: http://stackoverflow.com/q/23437643

http://stackoverflow.com/comment/35711829
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23323455
has text: when "setMaxBackupEvents()" should called ?

http://stackoverflow.com/a/23380115
downvote count: 0
answers question: http://stackoverflow.com/q/23379913
type: Answer
has body: Depends what the implementation of REST you are using. In case of jersey [JAX-RS] 2.5.1 onward it is auto generate - check the link - https://jersey.java.net/documentation/latest/wadl.html
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/35891618

http://stackoverflow.com/q/23327747
score: 1
tagged with: java
has body: The goal is to return an iterable collection values from an inorder tree traversal. My inorder traversal method adds all of the necessary Positions into an ArrayList (named 'positions'), and I then loop through this list of positions, accessing the values within that position object and adding them to a second ArrayList (named 'returned') which is returned. I checked the java docs and ArrayList implements Iterable, so returning it should be no problem. I'm getting an error stating that the two are not compatible. Below is the code in question: /** Returns an iterable collection of the keys of all entries stored in the * map (in inorder). */ public Iterable&lt;K&gt; keySet() { ArrayList&lt;Position&lt;Entry&lt;K,V&gt;&gt;&gt; positions = new ArrayList&lt;Position&lt;Entry&lt;K,V&gt;&gt;&gt;(); ArrayList&lt;K&gt; returned = new ArrayList&lt;K&gt;(); if(!isEmpty()) inorder(root(), positions); for(int i = 0; i &lt; positions.size(); i++){ Position&lt;Entry&lt;K,V&gt;&gt; pos = positions.get(i); K key = pos.element().getKey(); returned.add(key); } return returned; } And here's the error I'm getting: error: incompatible types: ArrayList&lt;K&gt; cannot be converted to Iterable&lt;K&gt; return returned; ^
upvote count: 1
has comment: http://stackoverflow.com/comment/35719264
type: Question
downvote count: 0
has comment: http://stackoverflow.com/comment/35724611
tagged with: iterable
has comment: http://stackoverflow.com/comment/35719522
tagged with: arraylist
has comment: http://stackoverflow.com/comment/35719805
favorite count: 0
has comment: http://stackoverflow.com/comment/35719339
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35719221
linked to: http://stackoverflow.com/q/3959892
has comment: http://stackoverflow.com/comment/35719749
has title: Returning an Iterable collection
answer count: 0

http://stackoverflow.com/q/23349546
tagged with: transactions
score: 1
tagged with: java
tagged with: execution-time
downvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/23361725
tagged with: neo4j
favorite count: 0
has title: Using ExecutionEngine#execute(String) outside of a Transaction?
has body: I just spent ten minutes figuring out why my unit test working against the test database was taking around 25 seconds to finish a simple query. The reason was, apparently, that I had forgotten to wrap a call to ExecutionEngine#execute(String) in a Transaction. I didn't know that was supposed to be possible. Hmm. My code looked something like this: ... @Before public void before() { db = new TestGraphDatabaseFactory().newImpermanentDatabase(); /* create all the test nodes and rels */ } @After public void after() { db.shutdown(); } @Test public void testAllTheThings() { /* build the cypher query */ Iterable&lt;Map&lt;String, Object&gt;&gt; result = engine.execute(cypher); /* assert all the things */ } ... The confusing part here is that execute() returns at once and the following statements gets executed. But, the test stalls for about 25 seconds before successfully terminating. Changing the statement to the following works as expected, without any lag: ... try (Transaction transaction = db.beginTx()) { Iterable&lt;Map&lt;String, Object&gt;&gt; result = engine.execute(cypher); } ... What is actually happening here? Why is this possible to do?
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23361725
upvote count: 1
type: Question

http://stackoverflow.com/q/23351595
upvote count: 2
has title: Deserializing 2D array of objects JSON to Java
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23351979
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: gson
downvote count: 1
type: Question
tagged with: arrays
has body: I'm using GSON to deserialize my JSON string. It seems to choke when attempting to deserialize a 2D array of objects. Here's the bit: { . .. ... "states": [ {"SPAWNINGPHASE": [{"name": "STATEA", "duration": 4}, {"name": "STATEB", "duration": 4}]}, {"ALIVEPHASE": [{"name": "STATEA", "duration": 5}, {"name": "STATEB", "duration": 4}]} ] } The above is a part of a bigger JSON. I get Expected BEGIN_ARRAY but was BEGIN_OBJECT I've looked over my JSON, but I don't see where it's incorrect Group g=gson.fromJson(configFile, Group.class); That's what I use to start the read. Is this not enough to process the string for the 2D array? In Group.class I tried both public State[][] states; and public List&lt;List&lt;State&gt;&gt; states; Everything else seems to deserialize fine. Do I have to use this (below)? Type collectionType = new TypeToken&lt;Collection&lt;Integer&gt;&gt;(){}.getType(); Collection&lt;Integer&gt; ints2 = gson.fromJson(json, collectionType);
accepted answer: http://stackoverflow.com/a/23351979
answer count: 1
tagged with: deserialization
favorite count: 0

http://stackoverflow.com/q/23452337
has comment: http://stackoverflow.com/comment/35953881
has title: How to write Apache-CXF post Rest Service Client with multiple Parameters
score: 0
tagged with: cxf
tagged with: java
has comment: http://stackoverflow.com/comment/35955703
answer count: 0
type: UnansweredQuestion
has body: I need to invoke a Rest POST API with multiple parameters. Following is the signature of post rest api @POST @Consumes({"application/json" }) @Produces("application/json") @Path("/service/postEmployeeBatch") Response postEmployeeBatch(Employee employee, Organization org); Following is the Rest Client code List&lt;Object&gt; providers = new ArrayList&lt;Object&gt;(); ObjectMapper mapper = new ObjectMapper(); JacksonJsonProvider provider = new JacksonJsonProvider(); provider.setMapper(mapper); providers.add(provider); WebClient client = WebClient.create("http://test.com:8080/EmployeeService", providers); client.path("service/postEmployeeBatch/"); client.type("application/json").accept("application/json"); Employee emp = ... Organization org = .... //Response r = client.post(emp, org); I am not clear how to invoke WebClient.post with multiple input parameters. I appreciate any help or direction on this,
tagged with: rest
type: Question

search-engine
type: Tag
tag name: search-engine
tags question: http://stackoverflow.com/q/23306915

http://stackoverflow.com/comment/35813670
type: Comment
type: QuestionComment
has text: The error is self-explanatory: You have to implement `actionPerformed(java.awt.event.ActionEvent)` method
comment on: http://stackoverflow.com/q/23379081
score: 5

http://stackoverflow.com/comment/35829339
has text: do you want to remove the xml header ? http://stackoverflow.com/questions/2678299/a-simple-way-to-remove-headers-from-xml-files http://stackoverflow.com/questions/2133395/remove-xml-declaration-from-the-generated-xml-document-using-java
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/23387915

http://stackoverflow.com/q/23452621
has answer: http://stackoverflow.com/a/23523868
accepted answer: http://stackoverflow.com/a/23523868
tagged with: cloud
answer count: 1
has title: Add Security Groups to Instance in Openstack
score: 0
has body: I am trying to use Apache JClouds to add/remove a particular Security Group to some instances (which are already running) in a zone. I know that this can be done using the Nova-CLI. Could some one point out how this is done using jclouds? The documentation doesnt really say all that much.
tagged with: jclouds
tagged with: openstack
type: AnsweredQuestion
tagged with: java
type: Question

http://stackoverflow.com/comment/35862330
type: QuestionComment
comment on: http://stackoverflow.com/q/23405399
has text: Could you post the action class?
score: 0
type: Comment

http://stackoverflow.com/comment/35917207
has text: You are right Durandal, the check has to be done before calling pow
comment on: http://stackoverflow.com/q/23434148
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35791812
comment on: http://stackoverflow.com/a/23367239
type: AnswerComment
score: 0
type: Comment
has text: Ok thanks. I cannot send a screenshot because of the separation of environs. I cannot change the layout of my parent composite because its already cready and is populated with other components. All I need is for my panel to stretch to hold the label.

http://stackoverflow.com/q/23441423
has title: need to write this code by not using 0?0 form?
upvote count: 1
linked to: http://stackoverflow.com/q/798545
has answer: http://stackoverflow.com/a/23441515
type: Question
has answer: http://stackoverflow.com/a/23441605
has comment: http://stackoverflow.com/comment/35929591
answer count: 3
has comment: http://stackoverflow.com/comment/35929645
has comment: http://stackoverflow.com/comment/35929827
favorite count: 0
has answer: http://stackoverflow.com/a/23441474
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35929602
has comment: http://stackoverflow.com/comment/35929672
downvote count: 6
score: -5
tagged with: java
has body: public static void main(String args[]){ System.out.println(countDigitX(8888,8)); } public static intcountDigitX(int n, int x) { return n==0?0:(n%10==x?1:0)+countDigitX(n/10,x); } }//end of class

http://stackoverflow.com/q/23352480
tagged with: flowlayoutpanel
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23352601
type: Question
answer count: 2
tagged with: swing
tagged with: border-layout
has comment: http://stackoverflow.com/comment/35764972
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/23352601
has answer: http://stackoverflow.com/a/23352554
has title: How to adjust components in Java Swing Layouts?
has body: I have been trying to make a Java Swing GUI in Eclipse Window Builder. After much of toil, I have been able to get to this. What I did was make a JFrame, add a BorderLayout to it. I added two panels in the north and south positions of this layout. I added a few buttons in the bottom panel. My question is from the top panel. This panel has a Flow Layout, and has two more panels. The left panel has buttons which are at the right place. The right panel is itself not at the right place. I want the right panel to be aligned to the right side of the parent window (and the left panel should stay on the left) - so ultimately there will be some space between the right and left panels. That is both the right and the left panels should be right and left aligned) and there should be space between them, because I want 4 buttons to the left, and 2 buttons to the right side of my screen. In the right panel, the two rightmost button among the two buttons should be right aligned, and there should be some space between both the buttons. I am providing the source code. I will be grateful if somebody can help/guide me to achieve what I want. SOURCE CODE:- import javax.swing.JFrame; import javax.swing.JButton; import java.awt.BorderLayout; import javax.swing.JPanel; import java.awt.FlowLayout; import javax.swing.SwingConstants; import javax.swing.BoxLayout; import javax.swing.JLabel; public class ParentFrame extends JFrame { public ParentFrame() { getContentPane().setLayout(new BorderLayout(50, 50)); JPanel parentPanel_bottom = new JPanel(); getContentPane().add(parentPanel_bottom, BorderLayout.SOUTH); JButton btnInstr = new JButton("1"); parentPanel_bottom.add(btnInstr); JButton btnCourse = new JButton("2"); parentPanel_bottom.add(btnCourse); JButton btnModule = new JButton("3"); parentPanel_bottom.add(btnModule); JButton btnDays = new JButton("4"); parentPanel_bottom.add(btnDays); JButton btnXtra = new JButton("5"); parentPanel_bottom.add(btnXtra); JPanel parentPanel_top = new JPanel(…
tagged with: layout-manager
possible better answer: http://stackoverflow.com/a/23352554

http://stackoverflow.com/comment/35662681
score: 0
type: Comment
has text: @nikis Thank you, I am used to such comparators because my employer often ask for exotic and overly complex comparison strategies, this here is just very simplified ;-)
type: AnswerComment
comment on: http://stackoverflow.com/a/23296701

http://stackoverflow.com/comment/35884315
type: QuestionComment
comment on: http://stackoverflow.com/q/23415894
has text: What is the last size you call write() with? If it's zero, you probably shouldn't do that. If it's some positive number much smaller than the minimum buffer size, having that be invalid would seem like a bit of a platform bug, but perhaps you could fix it by zero-padding out to the minimum buffer size and delivering that.
score: 0
type: Comment

http://stackoverflow.com/a/23327452
has comment: http://stackoverflow.com/comment/35718565
score: 2
has body: std::vector&lt;int&gt; foo(5); Don't use int[], this is ok if the size of your array is fixed (you do not need new, just int a[5]; ), but if it is variable, than it is a pain because you need to remember to disallocate it.
downvote count: 0
type: Answer
upvote count: 2
answers question: http://stackoverflow.com/q/23327434

http://stackoverflow.com/comment/35780088
comment on: http://stackoverflow.com/q/23360692
type: QuestionComment
score: 0
has text: @user3580294 I was given an assignment (on a job interview) to do this: upload text file through browser, find unique words in that file, their byte positions/distances, and more stuff in there as well, but that is the essence of that task.
type: Comment

http://stackoverflow.com/comment/35907328
type: AnswerComment
comment on: http://stackoverflow.com/a/23429558
has text: oh wait.. i meant automatically sorry :( my english are pretty bad
type: Comment
score: 0

http://stackoverflow.com/comment/35679261
score: 1
has text: Please edit your question to remove all code not absolutely essential for answering the question (ie most of it). See [SSCCE](http://sscce.org)
comment on: http://stackoverflow.com/q/23305769
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23302221
tagged with: java
has answer: http://stackoverflow.com/a/23302320
type: Question
tagged with: jodatime
has title: MongoDB Date Search In Java returning zero results
tagged with: mongodb
answer count: 1
downvote count: 0
accepted answer: http://stackoverflow.com/a/23302320
favorite count: 0
upvote count: 3
has body: I have a list of files in a GridFS that I am attempting to query by date. The sample document looks like the following: { "_id" : ObjectId("52e431d3e84f6fa18c53c808"), "chunkSize" : NumberLong(262144), "length" : NumberLong(13021), "md5" : "0eb01f0d266f4bf4764d4ffc7e70a7ed", "filename" : "120_1390686674383", "contentType" : null, "uploadDate" : ISODate("2014-01-25T21:51:15.049Z"), "aliases" : null } I am attempting to get the "most recent" according to timestamp by doing the following: DateTime dt = new DateTime(queryObj.getTime()); //org.joda.DateTime BasicDBObject sort = new BasicDBObject(); sort.put("uploadDate", -1); BasicDBObject query = new BasicDBObject(); query.put("uploadDate", new BasicDBObject("$gte", dt)); DBCursor cursor = fileStore.getFileList(query, sort); If I simply sort the fileStore I get numerous records back and I can enumerate via the cursor. However, whenever I try to use $gte or $lte I get zero results. Is there a missing step?
type: AnsweredQuestion
score: 3

http://stackoverflow.com/comment/35775517
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23358263
has text: Not input type. can you post the entire tag from that xml for WifiOnOffValue ?

http://stackoverflow.com/comment/35674209
type: AnswerComment
has text: The jfxrt.jar should work on both windows and linux, since it just redirects to the underlying native code. This is how we deploy our app to windows and linux. However, you may run into issues running with different JRE versions. If you intend to distribute, you have to package a JRE with your app or control the version of Java on the user's machine, or package using the JavaFX ant tasks. Packaging JavaFX in Java 7 is a pain. Upgrade to Java 8 if you can.
type: Comment
comment on: http://stackoverflow.com/a/23299895
score: 1

http://stackoverflow.com/q/23307959
has comment: http://stackoverflow.com/comment/35695059
type: UnansweredQuestion
has body: I"m working on a Client-Server chat program for a university project and I have little programming background. I've made 3 classes: ChatClient, ChatServer and ChatServerThread. I can currently have multiple clients connected and talking to the server at any time. Although one of the requirements that I'm having the most difficulty is this: "Any message typed from 1 client is sent to all other clients" and also "Both sent and received messages should be displayed". I've spent the last few nights just trying to get this extra bit of functionality working but have had no luck. I've been reading and looking around for a while but I have lots of difficulty adapting online examples to my work. I've read that I should be creating a list of sockets and then iterate through the list and send data to everyone in the list, which makes sense in my head but gives me a headache when I try implementing it. Any help with this would be very greatly appreciated. Extra points if anyone can give me some insight on how I could encrypt the sent data. ChatClient import java.net.*; import java.io.*; public class ChatClient { private Socket socket = null; private DataInputStream console = null; private DataOutputStream streamOut = null; private String myName = null; private BufferedReader StreamIn = null; private String response = null; public ChatClient(String serverName, int serverPort) { try { console = new DataInputStream(System.in); System.out.println("What is your name?"); myName = console.readLine(); System.out.println(myName + " &lt;" + InetAddress.getLocalHost() + "&gt; "); } catch (IOException ioe) { System.out.println("Unexpected exception: " + ioe.getMessage()); } System.out.println("Establishing connection. Please wait ..."); try { socket = new Socket(serverName, serverPort); System.out.println("Connected: " + socket); StreamIn = new BufferedReader(new InputStreamReader(socket.getInputStream())); streamOut = new DataOutputStream(socket.getOutputStream()); streamOut.writeUTF(":"…
linked to: http://stackoverflow.com/q/22287439
has comment: http://stackoverflow.com/comment/35682908
answer count: 0
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/35682794
has title: Java: Client-Server, chat broadcasting
linked to: http://stackoverflow.com/q/22737970
tagged with: chat
score: 0
tagged with: client-server
has comment: http://stackoverflow.com/comment/35683000

http://stackoverflow.com/a/23369692
score: 0
has body: This is impossible. A few things you can do are: Method overloading. You can make methods with the same name, as long as they have different parameters. E.g.: private void printMap(int map[][]) {...} private void printMap(double map[][]) {...} You can then call printMap with either and int[][] or a double[][] as the argument, and it will execute the corresponding method. Make it accept a Number[][]: private void printMap(Number map[][]) {...}
type: Answer
answers question: http://stackoverflow.com/q/23369455

http://stackoverflow.com/comment/35683614
comment on: http://stackoverflow.com/a/23308429
type: Comment
score: 0
type: AnswerComment
has text: math.h i have include in the header

http://stackoverflow.com/q/23396030
has answer: http://stackoverflow.com/a/23496352
accepted answer: http://stackoverflow.com/a/23496352
tagged with: jsp
has title: How to handle buttons with same value but different names in Spring
score: 0
answer count: 3
possible better answer: http://stackoverflow.com/a/23396350
tagged with: spring-mvc
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23396350
tagged with: java
has body: I have a table that is dynamically created that has rows of movies. It has a title column, a media type column, a rating column, and a column that contains a "view" button. When one of these view buttons is clicked, I would like to go to a page that contains all the details of that movie by sending the title to the controller so I can query for it in mySql. The problem is that for all these buttons, the value is always going to be "view". So my solution is to make the name of the button different as shown in the code below (this is the raw html generated from the jsp): title type rating title1 DVD R title2 DVD R title3 BLU-RAY PG-13 I could then use a parameterMap to figure out which view was pressed. That is messy and Spring has to have some way of being able to do this. I thought something like this would work in the controller: @RequestMapping("someAction", params = "mediaType.{title}=view") public ModelAndView loadPage(String title) { // use title to query mysql // build Model // return ModelAndView } However this doesn't work. Is there something that I can use in Spring that would be simpler and cleaner like above instead of getting the parameterMap from the request?
type: Question
has answer: http://stackoverflow.com/a/23396653

http://stackoverflow.com/comment/35661997
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23296405
type: Comment
has text: [paintComponent documentation link](http://docs.oracle.com/javase/7/docs/api/javax/swing/JComponent.html#paintComponent(java.awt.Graphics))

http://stackoverflow.com/a/33006301
answers question: http://stackoverflow.com/q/23366918
type: Answer
has body: Add an asset folder in your project and call your html url from there e.g. wvSite.loadUrl("file:///android_asset/dream-html5/api/Distance2html.html")
score: 0

http://stackoverflow.com/comment/35822604
has text: What you could do is: After check for suspend check cancel flag, if true - break. On cancel wake the suspend object.
comment on: http://stackoverflow.com/a/23371354
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/139108457
type: Comment
comment on: http://stackoverflow.com/a/78899724
score: 0
type: AnswerComment
has text: Checkout: https://dev.to/akhilpokle/generate-parentheses-understanding-call-stack-and-backtracking-solving-apple-interview-question-43g9

http://stackoverflow.com/comment/35893208
type: AnswerComment
type: Comment
has text: This does not give the answer as expected.
score: 1
comment on: http://stackoverflow.com/a/23421503

http://stackoverflow.com/q/23436056
favorite count: 0
type: AnsweredQuestion
tagged with: apache-poi
accepted answer: http://stackoverflow.com/a/23455573
tagged with: java
has title: Where is HWPFDocument located? I can't find it in the POI project
type: Question
score: 9
upvote count: 9
tagged with: apache
downvote count: 0
has body: Currently using: org.apache.poi poi 3.10-FINAL I'm trying to write a simple program to get the word count of doc/x files. But some reason it is not able to find that specific method. Is it in another package or something? I've been googling and they are all pointing me to that pom.
answer count: 1
has answer: http://stackoverflow.com/a/23455573

http://stackoverflow.com/a/23418010
has comment: http://stackoverflow.com/comment/35886947
has comment: http://stackoverflow.com/comment/35947790
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/35972726
has body: Add this line: awardDate.setFireNullValues(true); This was added in GWT 2.5.
accepted answer of: http://stackoverflow.com/q/23402723
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23402723
has comment: http://stackoverflow.com/comment/35893957
has comment: http://stackoverflow.com/comment/35893307
has comment: http://stackoverflow.com/comment/35888169
type: Answer
has comment: http://stackoverflow.com/comment/35892872

http://stackoverflow.com/q/23303445
tagged with: layout-manager
linked to: http://stackoverflow.com/q/17874717
score: 0
tagged with: japplet
answer count: 1
linked to: http://stackoverflow.com/q/5621338
has body: I am currently working on an assignment and need to create basic controls (buttons) for the Mandelbrot set that will operate as a JApplet. The graphics is initialised in the init() method and a method which draws the Mandelbrot is called in start(). The problem is, I have searched high and low and cannot figure out how to add a GUI to my applet because I don't explicitly add the mandelbrot to a JPanel , and.. I have no room left it seems to add a GUI because the Mandelbrot takes up the entire JFrame. I had one idea which was to set the size of the JFrame, set the size of the Mandelbrot graphic to only be say 4/5 of the whole frame, and add buttons to the remaining portion? Does that sound like a good solution?
type: UnansweredQuestion
tagged with: swing
tagged with: graphics
tagged with: java
has title: Graphics and applets
type: Question
has answer: http://stackoverflow.com/a/23309297

http://stackoverflow.com/q/23416248
has answer: http://stackoverflow.com/a/23416367
answer count: 3
has answer: http://stackoverflow.com/a/23416815
tagged with: command-line
has comment: http://stackoverflow.com/comment/35883036
score: 0
accepted answer: http://stackoverflow.com/a/23417396
type: AnsweredQuestion
tagged with: java
has title: Can't load in txt file on the command line
has comment: http://stackoverflow.com/comment/35883044
type: Question
has body: I am unable to load in a txt file on the command line but in eclipse it loads fine. Below is the code that loads in the file. try{ BufferedReader in = new BufferedReader(new FileReader("piratewords.txt")); int count = 0; while (in.ready()) { //while there is another line in the input file game.puzzles[count] = in.readLine(); //get line of data count++; //Increment CWID counter } in.close(); } catch(IOException e){ System.out.println("Error during reading/writing"); }
possible better answer: http://stackoverflow.com/a/23416367
has answer: http://stackoverflow.com/a/23417396

http://stackoverflow.com/q/23381514
has comment: http://stackoverflow.com/comment/35818255
has comment: http://stackoverflow.com/comment/35818343
has comment: http://stackoverflow.com/comment/35818763
upvote count: 3
favorite count: 0
type: UnansweredQuestion
has body: I'm developing a Maven plugin. From inside that plugin I want to get the list of goals for the current execution and make decisions based on whether a particular goal was called (install or deploy, for example). How do I do that?
tagged with: maven
has comment: http://stackoverflow.com/comment/35818263
has comment: http://stackoverflow.com/comment/35818526
has title: Maven plugin development - how to get list of goals
tagged with: mojo
downvote count: 0
answer count: 0
tagged with: java
type: Question
score: 3

http://stackoverflow.com/q/23332416
upvote count: 0
has answer: http://stackoverflow.com/a/23332507
favorite count: 0
has comment: http://stackoverflow.com/comment/35727956
answer count: 3
has comment: http://stackoverflow.com/comment/35727971
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23332515
has comment: http://stackoverflow.com/comment/35728002
tagged with: java.util.scanner
has comment: http://stackoverflow.com/comment/35727987
downvote count: 3
score: -3
type: Question
tagged with: object
has body: I'm having a bit of trouble trying to get my code to read a .dat file and use its contents to fill in the information. I am not too sure if my code below is the correct way on doing this. The code won't run, but it will compile? Any thoughts I am using a macbook with Dr. Java. UPDATE: So it's not the code, but was the software... just downloaded another java program, thank you all for the help i wouldn't have figured it out on my own! import java.io.File; import java.io.*; import java.util.Scanner; import java.io.FileNotFoundException; public class Pay { public static void main (String [] args) throws Exception{ File file = new File("c:\\rate.dat"); Scanner input = new Scanner(file); // I was not too sure if the last two lines are the correct ways to call the .dat file int id; String last; String first; double h![enter image description here][1]oursWorked; double rate; double total; for (int count = 1; count &lt;= 4; count++) { //the file only needs to be ran 4 times System.out.println("Employee I.D.: "); id = input.nextInt(); System.out.println("Last Name: "); last = input.next(); System.out.println("First Name: "); first = input.next(); System.out.println("Hours Worked: "); hoursWorked = input.nextDouble(); System.out.println("Hourly Rate: "); rate = input.nextDouble(); total = totalPay (hoursWorked, rate); System.out.println("\nEmployee ID :" + id); System.out.println("\nLast Name :" + last); System.out.println("\nFirst Name :" + first); System.out.println("\nHours Worked :" + hoursWorked); System.out.println("\nPay Rate :" + rate); System.out.println("\nTotal Pay :" + total); } } //Total Pay public static double totalPay (double time, double r) { double total = 0.0; if (time &lt;= 40.0) { total = (time * r); } else if (time &gt; 40.0) { total = (((time - 40) * (r * 1.5)) + (40 * r)); } return total; } } the rate.dat file contains: 1 Washington Geroge 45 30 210 Jackson Andrew 55 20.5 299 Obama Barak 10 20 405 Reagan Ronald 59 40
has answer: http://stackoverflow.com/a/23332503
tagged with: java
has title: java I/O & exceptions
has comment: http://stackoverflow.com/comment/35727925
has comment: http://stackoverflow.com/comment/35727991
has comment: http://stackoverflow.com/comment/35727906

http://stackoverflow.com/a/23391982
score: 0
answers question: http://stackoverflow.com/q/23391852
has body: Your main method needs to be in the Date class as your file name represents the class name. Your code should be as follows: public class Date{ public byte day; public byte month; public short year; public static void main(String[] args){ Date date = new Date(); date.day = 15; System.out.println(date.day); } }
type: Answer
has comment: http://stackoverflow.com/comment/35837819

http://stackoverflow.com/q/23380285
tagged with: rest
answer count: 1
tagged with: jersey-1.0
has title: Http get request on web-service not working
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/35816865
accepted answer: http://stackoverflow.com/a/23380510
has comment: http://stackoverflow.com/comment/35816982
type: Question
tagged with: jersey
has body: I send a get request to this url: http://localhost:8180/GoogleMapsErp/EQUI/000001 I get this error: SEVERE: Servlet /GoogleMapsLoadingTest threw load() exception com.sun.jersey.spi.inject.Errors$ErrorMessagesException at com.sun.jersey.spi.inject.Errors.processErrorMessages(Errors.java:170) at com.sun.jersey.spi.inject.Errors.postProcess(Errors.java:136) at com.sun.jersey.spi.inject.Errors.processWithErrors(Errors.java:199) at com.sun.jersey.server.impl.application.WebApplicationImpl.initiate(WebApplicationImpl.java:795) at com.sun.jersey.server.impl.application.WebApplicationImpl.initiate(WebApplicationImpl.java:790) at com.sun.jersey.spi.container.servlet.ServletContainer.initiate(ServletContainer.java:491) at com.sun.jersey.spi.container.servlet.ServletContainer$InternalWebComponent.initiate(ServletContainer.java:321) at com.sun.jersey.spi.container.servlet.WebComponent.load(WebComponent.java:605) at com.sun.jersey.spi.container.servlet.WebComponent.init(WebComponent.java:207) at com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:376) at com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:559) at javax.servlet.GenericServlet.init(GenericServlet.java:160) at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1274) at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1186) at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1081) at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5033) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5320) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549) at java.util.concurrent.FutureTask.run(FutureTask.java:262) at java.util.concurrent.ThreadPoolExecutor.runWorker(Th…
upvote count: 1
has comment: http://stackoverflow.com/comment/35819989
has answer: http://stackoverflow.com/a/23380510
favorite count: 0
linked to: http://stackoverflow.com/q/23356678

http://stackoverflow.com/comment/35940846
type: AnswerComment
score: 0
type: Comment
has text: Perfect! Thank you Xaver :) No convenience whatsoever. I apologize for taking so much of your time. Thank you thank you. You're the best Xaver. Thank you so much!!
comment on: http://stackoverflow.com/a/23445771

http://stackoverflow.com/comment/35766501
type: Comment
type: QuestionComment
has text: One way would be to store the attribute in session, make the redirect and in the other page use the attribute, then remove it from session.
comment on: http://stackoverflow.com/q/23353423
score: 0

http://stackoverflow.com/comment/35682533
score: 2
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23307737
has text: And what's your concrete question?

http://stackoverflow.com/a/23332631
has body: i think that Java supports \p{Punct} which removes all punctuation characters
answers question: http://stackoverflow.com/q/23332146
has comment: http://stackoverflow.com/comment/85492159
has comment: http://stackoverflow.com/comment/35728443
upvote count: 3
downvote count: 1
has comment: http://stackoverflow.com/comment/85491968
type: Answer
score: 2

http://stackoverflow.com/a/23306887
answers question: http://stackoverflow.com/q/23306791
has comment: http://stackoverflow.com/comment/35681396
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/35681532
score: 1
has comment: http://stackoverflow.com/comment/35681483
accepted answer of: http://stackoverflow.com/q/23306791
has comment: http://stackoverflow.com/comment/35681444
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/35681436
has comment: http://stackoverflow.com/comment/35681506
has comment: http://stackoverflow.com/comment/35681522
has body: classpath:employee.cfg.xml org.hibernate.cfg.AnnotationConfiguration ${jdbc.dialect} true You have defined the session factory bean in you context file. During the application bootstrap, the spring context is loaded and this session factory bean is initialized by spring as a singleton instance. <context:annotation-config /> <context:component-scan base-package="com.employee" /> @Autowired private SessionFactory sessionFactory; And since you have enabled the annotation-config and component-scan and declared @Autowired in your DAOImp, this is the reason Spring knows the place to inject the session factory bean properly. This configuration is enabled the transaction manager annotation. Example: @Transactional public void addEmployee(EmployeeForm employee){...} Here is the suggestion. Transactional annotation is better to be placed in service layer instead of DAO layer. You need to make sure the annotation is placed on the concrete class unless you use the interface-proxy in your component-scan. This piece of configuration is set the transaction manager bean which lets transaction manager knows which session factory it needs to manage with. Therefore the configuration of bean id="transactionManager" sets the transaction manager with the proper hibernate session factory. tx:annotation-driven configuration enables the annotation-based transaction manager in code level. Hope the explanation is helpful for you. :)
has comment: http://stackoverflow.com/comment/35681356

http://stackoverflow.com/a/23349396
has comment: http://stackoverflow.com/comment/35759333
has comment: http://stackoverflow.com/comment/35759205
has comment: http://stackoverflow.com/comment/35759134
type: Answer
has comment: http://stackoverflow.com/comment/35759683
has comment: http://stackoverflow.com/comment/35759858
upvote count: 2
has comment: http://stackoverflow.com/comment/35759633
has comment: http://stackoverflow.com/comment/35759248
has comment: http://stackoverflow.com/comment/35759374
has body: Use the diamond operator: private &lt;T&gt; T createInstance(Class&lt;T&gt; concreteClass){ return concreteClass.newInstance(); } //usage Integer i = instanceWithThatMethod.createInstance(Integer.class); To pass "arguments", you have to get the Constructor of the class matching the desired parameter types, and invoke the call on that one, like this: private &lt;T&gt; T createInstance(Class&lt;T&gt; concreteClass, String stringArg){ return concreteClass.getConstructor(String.class).newInstance(stringArg); } //usage SomeClass s = createInstance(SomeClass, "testString"); //equals SomeClass s = new SomeClass("testString"); //where SomeClass HAS to serve: public SomeClass(String s){ ... }
has comment: http://stackoverflow.com/comment/35760921
score: 2
answers question: http://stackoverflow.com/q/23349329
downvote count: 0

http://stackoverflow.com/q/23331932
has comment: http://stackoverflow.com/comment/35727508
tagged with: java
has comment: http://stackoverflow.com/comment/35727851
downvote count: 5
has comment: http://stackoverflow.com/comment/35727023
answer count: 2
upvote count: 0
has answer: http://stackoverflow.com/a/43885880
favorite count: 0
has comment: http://stackoverflow.com/comment/35726968
has answer: http://stackoverflow.com/a/23331956
type: UnansweredQuestion
has title: java regexp " [_A-Za-z0-9-\\+]+ " what dose the "\\+"mean in it?
linked to: http://stackoverflow.com/q/1545751
has comment: http://stackoverflow.com/comment/35727741
linked to: http://stackoverflow.com/q/22937618
has comment: http://stackoverflow.com/comment/35728407
has body: java regexp, what dose the "\+"mean in " [_A-Za-z0-9-\+]+ "? I know + means one or more than one, so what doese \+ mean?
has comment: http://stackoverflow.com/comment/35727099
type: Question
has comment: http://stackoverflow.com/comment/35727783
has comment: http://stackoverflow.com/comment/35727710
score: -5

http://stackoverflow.com/a/23404074
has comment: http://stackoverflow.com/comment/35865728
type: Answer
has body: Make sure if you use a builder helper class like that you initialize it before the loop. That said, UriBuilder is a perfect solution for your problem, it's a helper class for building or manipulating url's. Below is an example for you: Uri.Builder builder = new Uri.Builder(); builder.scheme("http") .authority("yehki.epagestore.in") .appendPath("app_api") .appendPath("order.php") .appendQueryParameter("customer_id", customer_id) .appendQueryParameter("address_id", address_id); for (int i = 0; i &lt; carts.length(); i++) { builder.appendQueryParameter("products["+i+"][productName]", cartList.get(i).get((Const.TAG_PRODUCT_NAME))); builder.appendQueryParameter("products["+i+"][productId]", cartList.get(i).get((Const.TAG_PRODUCT_ID))); builder.appendQueryParameter("products["+i+"][quantity]", cartList.get(i).get((Const.TAG_QUANTITY))); builder.appendQueryParameter("products["+i+"][unit]", cartList.get(i).get((Const.TAG_UNIT))); builder.appendQueryParameter("products["+i+"][unitPrice]", cartList.get(i).get((Const.TAG_RETAIL_PRICE))); } String myUrl = builder.build().toString();
has comment: http://stackoverflow.com/comment/35895777
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/35861217
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23403949
downvote count: 0
has comment: http://stackoverflow.com/comment/35860581
accepted answer of: http://stackoverflow.com/q/23403949
has comment: http://stackoverflow.com/comment/35891988

http://stackoverflow.com/comment/35919593
has text: Thank you for the answer. I removed the singleton pattern and now it seems to work better. However I still think that the usage of wait/notify in my code is wrong/ugly. And also there is still a problem: if the DB is empty and I call the servlet with two threads, two identical users are added to the DB.
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/23435830

http://stackoverflow.com/comment/35854751
has text: Give us some sample cases. It's unclear what you want.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23401274
score: 0

http://stackoverflow.com/a/23419344
downvote count: 0
type: Answer
has body: Not sure I understand, but wouldn't this solve your issue? public class Question1c{ public static void main (String[] args){ int[] arr = {1, 9, 3, 4, 5, 6}; boolean product = isDecreasing(arr); System.out.println(product); } public static boolean isDecreasing (int[] numbers){ for (int i = 0; i &lt; numbers.Length; i++){ if (i == 0) continue; if (numbers[i - 1] &gt;= numbers[i]) return false; } return true; } } You're essentially just aiming to check that the previous item in the array isn't greater than or equal to the current item in the array, aren't you?
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/23419281

http://stackoverflow.com/a/23365522
has body: Use the TreeSet constructor that receives a custom Comparator, and implement a Comparator that sorts the string differently. Here's an example (untested, check the code before using): TreeSet&lt;String&gt; t = new TreeSet&lt;String&gt;(new Comparator&lt;String&gt;() { public int compare(String s1, String s2) { int spaceIndex1 = s1.indexOf(' '); int spaceIndex2 = s2.indexOf(' '); return Integer.parseInt(s1.substring(spaceIndex1 + 1)).compareTo(Integer.parseInt(s2.spaceIndex2 + 1)); } });
has comment: http://stackoverflow.com/comment/35787867
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/23365307
has comment: http://stackoverflow.com/comment/35788234
upvote count: 1

http://stackoverflow.com/q/23368039
tagged with: java
tagged with: javafx
has answer: http://stackoverflow.com/a/32767599
type: UnansweredQuestion
tagged with: drop-down-menu
has body: I'm using this java SimpleSwingBrowser example to display a html dropdown box like this with the javaFx webEngine: value 1 value 2 value 3 You can find a complete example here. When I run this example, I'm not able to choose a value from the dropdown menu with the mouse (it works if I use the keyboard). It appears that the mouse events do not make it through to the jfx scene. Is it possible to display a dropdown menu that reacts in the usual way to mouse events?
has comment: http://stackoverflow.com/comment/35797436
tagged with: javafx-webengine
has title: Html dropdown box in javaFx webEngine
has comment: http://stackoverflow.com/comment/53376605
type: Question
answer count: 1
has comment: http://stackoverflow.com/comment/35829193
score: 0

http://stackoverflow.com/a/23439102
answers question: http://stackoverflow.com/q/23438879
has comment: http://stackoverflow.com/comment/35925887
score: 3
downvote count: 0
has body: try Using ExecutorCompletionService ... something like ExecutorService pool = Executors.newFixedThreadPool(2); ExecutorCompletionService&lt;Result&gt; completionService = new ExecutorCompletionService&lt;Result&gt;(pool); completionService.submit(new SlowTaskA()); completionService.submit(new SlowTaskB()); Future&lt;Result&gt; future; try { future = completionService.take(); Result currentResult=null; try { currentResult = future.get(); } catch (ExecutionException e) { // TODO Auto-generated catch block e.printStackTrace(); } // got the 1st result in obj currentResult, return true or obj return true; } catch (InterruptedException e1) { e1.printStackTrace(); }
type: Answer
upvote count: 3

http://stackoverflow.com/q/23451809
has comment: http://stackoverflow.com/comment/35950081
upvote count: 2
has comment: http://stackoverflow.com/comment/35950044
has title: A* algorithm that takes account velocity
tagged with: racing
linked to: http://stackoverflow.com/q/6589064
has comment: http://stackoverflow.com/comment/35950156
answer count: 1
downvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/23452206
type: UnansweredQuestion
has body: I'm developing a racing game like http://harmmade.com/vectorracer/ and I have implemented the A* algorithm to use for the AI players. The algorithm is working fine for 1-tile movements, but I don't want the AI players to only move 1 tile at a time (by using only their adjacent points), I need them to be able to accelerate and decelerate when they are closing in on a turn. Their next positions should depend on their previous one, just like Vector Racer. public boolean createRoute() { // The list where the points will be added in reverse order (from finish_point) ArrayList&lt;Track_Point&gt; path = new ArrayList&lt;&gt;(); // The list where the unchecked points will be stored ArrayList&lt;Track_Point&gt; open = new ArrayList&lt;&gt;(); // The list where the checked points will be stored ArrayList&lt;Track_Point&gt; closed = new ArrayList&lt;&gt;(); // The starting point is always added as the first point to be checked open.add(starting_point); Track_Point current; while (true) { current = null; // If all points from the open list have been removed (be being checked), it means that there isn't a possible path from the starting to the finish point if (open.isEmpty()) { System.out.println("no route available"); return false; } // Selects the point with the lowest F value from the open list for (Track_Point temp : open) { temp.show(); if (current == null || temp.getF() &lt; current.getF()) { current = temp; } } // If the current point has reached the finish point, break the loop to construct the path if (current.equals(finish_point)) { break; } // Removes the current point (with the lowest F value) from the open list open.remove(current); // Adds the current point (with the lowest F value) to the closed list closed.add(current); ArrayList&lt;Track_Point&gt; possible_points = createNextPossibleTrackPoints(current); //Sets the parent of the possible points for (Track_Point tp : possible_points) { if (!tp.equals(current)) { tp.setParent(current); } } for (Track_Point possibl…
has comment: http://stackoverflow.com/comment/35949239
tagged with: a-star
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/35950191
type: Question
tagged with: algorithm

http://stackoverflow.com/comment/35883118
comment on: http://stackoverflow.com/q/23413589
type: QuestionComment
type: Comment
has text: @user3521471 just started typing haha
score: 0

http://stackoverflow.com/comment/35916016
type: Comment
has text: I agree, bundling your own wordlist / dictionary seems like the best approach. There are a ton of free wordlists available for download if you just search with Google. I don't know any way to access the Android keyboard's dictionary. Requiring a network connection to be able to validate a word also sounds unacceptable to me.
type: AnswerComment
comment on: http://stackoverflow.com/a/23428491
score: 0

http://stackoverflow.com/a/23397614
score: 8
upvote count: 8
has body: In your persistence.xml change the line &lt;persistence-unit name="myPersistenceUnit" transaction-type="JTA"&gt; to &lt;persistence-unit name="myPersistenceUnit" transaction-type="RESOURCE_LOCAL"&gt; Also it would probably be best if you create a datasource bean in your Spring configuration instead of using implicitly in persistence.xml (that way you can easily switch datasources with Spring profiles) Check out this tutorial for details To fix your deployment issues on Glassfish, see this and this link. From those links one suggestion is to set the version in your web.xml to 2.4 and the other suggestion is to do perform a whole bunch of steps to get Spring to actually play with transaction-type="JTA".
type: Answer
has comment: http://stackoverflow.com/comment/35857836
has comment: http://stackoverflow.com/comment/115220343
answers question: http://stackoverflow.com/q/23396645
has comment: http://stackoverflow.com/comment/35859077
accepted answer of: http://stackoverflow.com/q/23396645
downvote count: 0
has comment: http://stackoverflow.com/comment/35858547
has comment: http://stackoverflow.com/comment/35858407
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/115122721
has comment: http://stackoverflow.com/comment/35849365

http://stackoverflow.com/comment/65948677
score: 0
type: Comment
has text: I've renamed `class test` to `class EmployeeAddress` in the question.
comment on: http://stackoverflow.com/a/23309507
type: AnswerComment

http://stackoverflow.com/comment/35686558
type: Comment
type: QuestionComment
has text: Except this will return true if either of the arguments is in the range, not if both are. For both to be in the range you need to replace `||` with `&&`.
score: 0
comment on: http://stackoverflow.com/q/23309998

http://stackoverflow.com/comment/35797154
has text: If that's the issue, try something like `echo "password" | sudo gksu`. Follow this answer to get the `stdout` and `stderr`: http://stackoverflow.com/questions/882772/capturing-stdout-when-calling-runtime-exec/882795#882795
type: Comment
comment on: http://stackoverflow.com/q/23369169
score: 0
type: QuestionComment

http://stackoverflow.com/a/23391280
has comment: http://stackoverflow.com/comment/35835542
score: 2
has comment: http://stackoverflow.com/comment/35835462
has body: Try this: public &lt;T extends Number&gt; List&lt;T&gt; getList(List&lt;Number&gt; list) { List&lt;T&gt; otherList = new ArrayList&lt;T&gt;(); for(Number n : list) { otherList.add((T) n); } return otherList; } This code may throw ClassCastException for some cases, for example when one of the Numbers in argument cannot be cast to the type intended by context where you call this method, like this: List&lt;Number&gt; argument = new ArrayList&lt;Number&gt;(); argument.add(5.0); List&lt;Integer&gt; list = getList(argument);
has comment: http://stackoverflow.com/comment/35835936
has comment: http://stackoverflow.com/comment/35836027
answers question: http://stackoverflow.com/q/23391177
downvote count: 0
has comment: http://stackoverflow.com/comment/35836249
upvote count: 2
has comment: http://stackoverflow.com/comment/35836120
has comment: http://stackoverflow.com/comment/35835697
type: Answer

http://stackoverflow.com/q/23434726
tagged with: data-management
has comment: http://stackoverflow.com/comment/35917152
has body: I know it is always better to operate data in memory instead of file. Currently, I am putting all incoming data in a static ArrayList, and when that ArrayList has more than 80 entries, my program will save the contents of this ArrayList to a file and clear up this array for the next wave of coming data. I wonder if it's better (or worse) to use Vector instead of ArrayList. If there is difference, which is better/worse? And in which case? Here is my relevant code: public class Exchange () { private static ArrayList&lt;String&gt; datain = new ArrayList&lt;String&gt; (); public static void addData(String s) { datain.add(s); } public static boolean checkSize() { if (datain.size() &gt;= 80) return true; else return false; } public static void writeData() throws FileNotFoundException { PrintWriter pw = new PrintWriter(new File ("myfile.txt")); for (int i = 0; i &lt; datain.size(); i++) { pw.println(datain.get(i); } pw.close(); } public static void clear() { datain = new ArrayList&lt;String&gt;(); } } P.S. This approach currently works fine, I am just wondering whether using vector will be better for this case. Also, if you see any bad design, feel free to point it out. Thanks!
type: AnsweredQuestion
has title: Data operation in memory
tagged with: java
has comment: http://stackoverflow.com/comment/35917181
has comment: http://stackoverflow.com/comment/35917282
possible better answer: http://stackoverflow.com/a/23434898
type: Question
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/35919643
tagged with: vector
has comment: http://stackoverflow.com/comment/35917281
accepted answer: http://stackoverflow.com/a/23434754
has comment: http://stackoverflow.com/comment/35917186
tagged with: arraylist
has comment: http://stackoverflow.com/comment/35917209
has comment: http://stackoverflow.com/comment/35917102
has comment: http://stackoverflow.com/comment/35917240
has answer: http://stackoverflow.com/a/23434898
has answer: http://stackoverflow.com/a/23434754

http://stackoverflow.com/comment/35987122
score: 0
type: Comment
has text: Perfect! I just tried it out, but I was already very confident after reading your explanation. What do you think would be the best approach to continue? The simple work-around you suggested is fine, but I'd prefer to install a ClassLoader that finds classes in my bundle without having to look at the stack trace. Writing my own ClassLoader implementation for this purpose feels like re-inventing the wheel...
comment on: http://stackoverflow.com/a/23470861
type: AnswerComment

http://stackoverflow.com/comment/35695553
score: 0
type: Comment
has text: I'm facing n issue with `getApplicationContext` it says `Cannot make a static reference to the non-static method getApplicationContext() from the type ContextWrapper`
type: AnswerComment
comment on: http://stackoverflow.com/a/23314859

http://stackoverflow.com/q/23408434
type: UnansweredQuestion
tagged with: android
upvote count: 1
tagged with: java
has comment: http://stackoverflow.com/comment/35867886
has comment: http://stackoverflow.com/comment/35867919
tagged with: eclipse
has comment: http://stackoverflow.com/comment/35891022
downvote count: 1
has comment: http://stackoverflow.com/comment/35867868
type: Question
has title: Tried adding database file to assets folder and modifying the sqliteopenhelper class but still application force closes on the phone
answer count: 1
has answer: http://stackoverflow.com/a/23411153
score: 0
has comment: http://stackoverflow.com/comment/35873061
favorite count: 0
has body: I wanted to load a database along with my apk file.But the application force closes on my phone despite adding the database to the assets folder and modyfying the sqliteopenhelper The sqliteopenhelper class public class openingclass extends SQLiteOpenHelper { public openingclass(Context c) { super(c,Db_NAME, null, DB_VERSION); } public void createDataBase() { boolean dbExist; try { dbExist = checkDataBase(); } catch (SQLiteException e) { e.printStackTrace(); throw new Error("database dose not exist"); } if(dbExist){ //do nothing - database already exist }else{ try { copyDataBase(); } catch (IOException e) { e.printStackTrace(); throw new Error("Error copying database"); } //By calling this method and empty database will be created into the default system path //of your application so we are gonna be able to overwrite that database with our database. this.getReadableDatabase(); } } /** * Check if the database already exist to avoid re-copying the file each time you open the application. * @return true if it exists, false if it doesn't */ private boolean checkDataBase(){ SQLiteDatabase checkDB = null; try{ String myPath = DB_PATH +"/"+ Db_NAME; checkDB = SQLiteDatabase.openDatabase(myPath, null, SQLiteDatabase.OPEN_READONLY); }catch(SQLiteException e){ //database does't exist yet. throw new Error("database does't exist yet."); } if(checkDB != null){ checkDB.close(); } return checkDB != null ? true : false; } /** * Copies your database from your local assets-folder to the just created empty database in the * system folder, from where it can be accessed and handled. * This is done by transfering bytestream. * */ private void copyDataBase() throws IOException{ //copyDataBase(); //Open your local db as the input stream InputStream myInput = c1.getAssets().open(Db_NAME); // Path to the just created empty db String outFileName = DB_PATH +"/"+ Db_NAME; File databaseFile = new File(DB_PATH); // check if databases folder exists, if not create one and its subfolders if (!databa…

arraylist
tags question: http://stackoverflow.com/q/23297786
tags question: http://stackoverflow.com/q/23377325
tags question: http://stackoverflow.com/q/23302933
tags question: http://stackoverflow.com/q/23365049
tags question: http://stackoverflow.com/q/23420313
tags question: http://stackoverflow.com/q/23324347
tags question: http://stackoverflow.com/q/23429715
tags question: http://stackoverflow.com/q/23313289
tags question: http://stackoverflow.com/q/23297720
tags question: http://stackoverflow.com/q/23437762
tags question: http://stackoverflow.com/q/23296627
tags question: http://stackoverflow.com/q/23386189
tags question: http://stackoverflow.com/q/23372710
tags question: http://stackoverflow.com/q/23400715
tags question: http://stackoverflow.com/q/23419725
tags question: http://stackoverflow.com/q/23351771
tags question: http://stackoverflow.com/q/23451385
tags question: http://stackoverflow.com/q/23300264
tags question: http://stackoverflow.com/q/23419361
tags question: http://stackoverflow.com/q/23350592
tags question: http://stackoverflow.com/q/23407558
tags question: http://stackoverflow.com/q/23449779
tags question: http://stackoverflow.com/q/23384369
tags question: http://stackoverflow.com/q/23405399
tags question: http://stackoverflow.com/q/23327417
tags question: http://stackoverflow.com/q/23354399
tags question: http://stackoverflow.com/q/23328003
tags question: http://stackoverflow.com/q/23294212
tags question: http://stackoverflow.com/q/23354648
tags question: http://stackoverflow.com/q/23329173
tags question: http://stackoverflow.com/q/23369882
tags question: http://stackoverflow.com/q/23425089
tags question: http://stackoverflow.com/q/23434726
tags question: http://stackoverflow.com/q/23328391
tags question: http://stackoverflow.com/q/23352144
tags question: http://stackoverflow.com/q/23333823
tags question: http://stackoverflow.com/q/23410920
tags question: http://stackoverflow.com/q/23415688
tags question: http://stackoverflow.com/q/23412697
tags question: http://stackoverflow.com/q/23397664
tags question: http://stackoverflow.com/q/23391177
tags question: http://stackoverflow.com/q/23348220
tags question: http://stackoverflow.com/q/23427387
tags question: http://stackoverflow.com/q/23338545
tags question: http://stackoverflow.com/q/23356968
tags question: http://stackoverflow.com/q/23377901
tags question: http://stackoverflow.com/q/23430934
tags question: http://stackoverflow.com/q/23355777
tags question: http://stackoverflow.com/q/23351493
tags question: http://stackoverflow.com/q/23440896
tags question: http://stackoverflow.com/q/23447492
tags question: http://stackoverflow.com/q/23299050
tags question: http://stackoverflow.com/q/23324156
tags question: http://stackoverflow.com/q/23402367
tags question: http://stackoverflow.com/q/23304663
tags question: http://stackoverflow.com/q/23421275
tags question: http://stackoverflow.com/q/23369867
tags question: http://stackoverflow.com/q/23349354
tags question: http://stackoverflow.com/q/23310471
tags question: http://stackoverflow.com/q/23371592
tags question: http://stackoverflow.com/q/23342988
tags question: http://stackoverflow.com/q/23316881
tags question: http://stackoverflow.com/q/23340408
tags question: http://stackoverflow.com/q/23304550
tags question: http://stackoverflow.com/q/23426972
tags question: http://stackoverflow.com/q/23443963
tags question: http://stackoverflow.com/q/23303635
tags question: http://stackoverflow.com/q/23349210
tags question: http://stackoverflow.com/q/23334896
tags question: http://stackoverflow.com/q/23338581
tags question: http://stackoverflow.com/q/23380962
tags question: http://stackoverflow.com/q/23328836
tags question: http://stackoverflow.com/q/23337653
tags question: http://stackoverflow.com/q/23328345
tags question: http://stackoverflow.com/q/23377464
tags question: http://stackoverflow.com/q/23294175
tags question: http://stackoverflow.com/q/23427074
tags question: http://stackoverflow.com/q/23377044
tags question: http://stackoverflow.com/q/23452647
tags question: http://stackoverflow.com/q/23351445

http://stackoverflow.com/comment/35723148
comment on: http://stackoverflow.com/a/23329055
type: Comment
has text: 1) What is the underlying logic of this game as I am not familiar with it? Put this information as an edit to your question. 2) If you have code that is not working, show your latest code iteration as an edit to your original post and give the details on what is now wrong. Also note that `booleanVariable = !booleanVariable;` should work fine for toggling the state of a boolean variable.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/35800194
has text: @Braj me too, by voting this question to close as duplicate.
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23371729

http://stackoverflow.com/a/23294517
score: 7
upvote count: 8
has body: CloseableHttpClient hc = HttpClients.custom() .setHttpProcessor(HttpProcessorBuilder.create().build()) .build(); The code snippet above demonstrates how to create an HttpClient instance with an empty (no-op) protocol processor, which guarantees no request headers will ever be added to outgoing messages executed by such client
has comment: http://stackoverflow.com/comment/35663413
downvote count: 1
answers question: http://stackoverflow.com/q/23291209
type: Answer
has comment: http://stackoverflow.com/comment/44521002

http://stackoverflow.com/comment/35739315
type: Comment
has text: I am trying to get push notification. Using this link http://www.push-notification.org/#doc. But when I try to send a notification using their server. It always shows device offline.
comment on: http://stackoverflow.com/a/23338614
score: 0
type: AnswerComment

http://stackoverflow.com/comment/35740969
comment on: http://stackoverflow.com/q/23326829
score: 0
has text: the setup looks a bit weird: what do you _really_ want to achieve by calling ruin from the background thread and let then let that method add tens of thousands of components (which is a lot, there might be alternatives like using a table/list f.i.) by switching back to the EDT and wait?
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23340099
answers question: http://stackoverflow.com/q/23339905
has body: You can get files by getting output after executing ls -d /etc/*-release. And then work with them via Java File. See also: ls command How To Execute Shell Command From Java
has comment: http://stackoverflow.com/comment/35747958
score: 0
type: Answer

http://stackoverflow.com/comment/35878319
type: QuestionComment
has text: What is line 121 of SmsViewActivity.java:121?
type: Comment
score: 0
comment on: http://stackoverflow.com/q/23413480

http://stackoverflow.com/comment/35834189
comment on: http://stackoverflow.com/q/23390356
type: Comment
type: QuestionComment
has text: http://www.gwtproject.org/doc/latest/DevGuideCodingBasicsJSNI.html and http://stackoverflow.com/questions/15795607/call-java-from-javascript-jsni might help
score: 0

http://stackoverflow.com/q/23308193
has comment: http://stackoverflow.com/comment/83164679
has answer: http://stackoverflow.com/a/23308206
has answer: http://stackoverflow.com/a/40943438
has body: When using external iteration over an Iterable we use break or return from enhanced for-each loop as: for (SomeObject obj : someObjects) { if (some_condition_met) { break; // or return obj } } How can we break or return using the internal iteration in a Java 8 lambda expression like: someObjects.forEach(obj -&gt; { //what to do here? })
has answer: http://stackoverflow.com/a/66061916
has answer: http://stackoverflow.com/a/60144433
possible better answer: http://stackoverflow.com/a/36843825
has answer: http://stackoverflow.com/a/36843825
has comment: http://stackoverflow.com/comment/35697889
has answer: http://stackoverflow.com/a/23308251
score: 433
favorite count: 0
has answer: http://stackoverflow.com/a/75961124
has comment: http://stackoverflow.com/comment/35683146
linked to: http://stackoverflow.com/q/20746429
has comment: http://stackoverflow.com/comment/137311439
has answer: http://stackoverflow.com/a/31023295
has title: Break or return from Java 8 stream forEach?
tagged with: lambda
answer count: 15
has answer: http://stackoverflow.com/a/30603313
tagged with: foreach
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26648598
accepted answer: http://stackoverflow.com/a/23308251
tagged with: java-8
downvote count: 1
has answer: http://stackoverflow.com/a/32566745
type: Question
has answer: http://stackoverflow.com/a/40490130
has answer: http://stackoverflow.com/a/27242349
tagged with: java
has answer: http://stackoverflow.com/a/48095123
has answer: http://stackoverflow.com/a/60936638
upvote count: 434

http://stackoverflow.com/comment/35736066
type: QuestionComment
has text: `K` is one char, How you are going to add these characters in the array?
score: 0
comment on: http://stackoverflow.com/q/23337148
type: Comment

http://stackoverflow.com/comment/67076070
type: Comment
has text: this line has one error .. in this line FileInputStream in = new FileInputStream(sourceDir + file.getName()); it should be FileInputStream in = new FileInputStream(sourceDir+File.separator + file.getName());
score: 4
type: AnswerComment
comment on: http://stackoverflow.com/a/23346890

http://stackoverflow.com/q/23307273
tagged with: line-segment
score: 0
tagged with: graphics2d
has title: Draw a line in JPanel given co-ordinates of 2 points
has comment: http://stackoverflow.com/comment/35784925
has comment: http://stackoverflow.com/comment/36045205
has comment: http://stackoverflow.com/comment/35769928
has comment: http://stackoverflow.com/comment/35715886
has body: I would like to plot the line, preferably a dashed segment at a time. Given the co-ordinates of the 2 end points, we can find the equation of the line right? And hence deduce all points(pixels) that lie on this line? But i'm having trouble with plotting a segment at a time and finally reaching the 2nd end point and erasing the previous segments. It should look like we start plotting from (0,0) towards (5,5) and in the process we show the segment (0,0)->(1,1) then make this disappear and show the segment (1,1)->(2,2) and so on and finally show just the pixel at (5,5) public class pracDraw extends JFrame { private Color red=Color.red; public int i; private Color white = Color.white; JPanel pr=new JPanel(); JTextField t=new JTextField(); JTextField t1=new JTextField(); JTextField t2=new JTextField(); JTextArea ta=new JTextArea(); pracDraw(){ setTitle("Practise"); setSize(500,500); setVisible(true); setDefaultCloseOperation(EXIT_ON_CLOSE); add(t); add(t1); add(pr); } public void paint(Graphics g){ g.setColor(Color.BLACK); g.drawLine(100, 100, 200, 200); Graphics2D g2 = (Graphics2D) g; g.setColor(Color.BLUE); g.drawLine(200, 200, 350, 375); t.setBounds(390, 370, 10, 10); t.setBackground(Color.RED); t.setEnabled(false); Thread t5=new Thread(){ public void run() { for(;;){ int x,y,x1=200,y1=200,x2=400,y2=400,t_x,t_y,slope; slope=(y2-y1)/(x2-x1); //slope=1 int c=(y1-(slope*x1)); //c=0 for(i=200;i&lt;375;i+=20){ if(i==(slope*i+c)){ t1.setBounds(i,i, 10, 10); t1.setBackground(Color.RED); t1.setEnabled(false); } try { sleep(1000); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } } }; t5.start(); if(i&gt;375){ t5.stop(); t1.setBackground(Color.GREEN); } } public static void main(String args[]){ pracDraw p=new pracDraw(); } }
answer count: 0
tagged with: pixel
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/35689601
has comment: http://stackoverflow.com/comment/35682020
tagged with: plot
type: Question

http://stackoverflow.com/a/23528217
has body: it looks like you are modifying the preference temporary. to save the prefrences and be sure it remains the same, use sharedPreferencesTurbo
has comment: http://stackoverflow.com/comment/36646768
score: 0
accepted answer of: http://stackoverflow.com/q/23433283
answers question: http://stackoverflow.com/q/23433283
type: Answer
has comment: http://stackoverflow.com/comment/36640078
type: AcceptedAnswer

http://stackoverflow.com/comment/35942528
has text: Well it fixed the problem with the immediate Sorry no book found with title name but now no matter what input i put (even if that book exists with that name ) it still gives me this answer : Sorry no book found with title name. Could you point me to where that problem is?
comment on: http://stackoverflow.com/a/23446336
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/39115355
has body: It Throw Because your hibernate-commons-annotations-4.0.1.Final.jar is Invalid Or Corrupted. Follow the Steps: Note : .m2 Folder is Hidden by Default. UnHide the Folder. Step 1:Delete all the Content in .m2/repository Folder. Step 2:Restart Your Eclipse. Step 3:Maven->Update Project .Checked- Force Update of Snapshots/Releases. Step 4:Run as Maven Clean. Step 5:Run as Maven Install. Step 6: Clean Project. Step 7 : Run Your Project. I Hope you Find your Solution Here.. Thanks..
score: 6
answers question: http://stackoverflow.com/q/23310474
downvote count: 0
type: Answer
upvote count: 6

http://stackoverflow.com/q/23294754
has comment: http://stackoverflow.com/comment/35658865
accepted answer: http://stackoverflow.com/a/23297126
type: AnsweredQuestion
tagged with: java
tagged with: hibernate
type: Question
score: 0
answer count: 1
has title: Purpose of having custom annotations
has answer: http://stackoverflow.com/a/23297126
tagged with: spring
has body: Some projects using of custom annotations as below. For example as below. Please explain me when should I take decision to have custom annotations. Role of @Target &amp; @Retention annotation attributes is it better to use import java.lang.annotation.Target and import java.lang.annotation.Retention or hibernate specific annotations as below @Entity @Table(name = "creditCard") @CreditCardEntity public class CreditCard implements java.io.Serializable {} import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; import org.hibernate.validator.ValidatorClass; @Target( { ElementType.TYPE }) @Retention(RetentionPolicy.RUNTIME) public @interface CreditCardEntity {} }

http://stackoverflow.com/comment/35672151
has text: Yeah, effectively. Same with the top & bottom margins. The left and right margins are quite consistent, given screen width doesn't change much. But then again, the graphical preview says that Nexus 10 will have a super-small, high up scroll view, when in reality it's virtually normal sized, and near-correctly positioned, so I don't know if the graphical preview just sucks ass.
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23300909
type: Comment

http://stackoverflow.com/comment/35860446
type: Comment
type: QuestionComment
has text: It seems to me no difference except relative path in jdbc and absolute in localhost!
comment on: http://stackoverflow.com/q/23403875
score: 0

http://stackoverflow.com/a/23413607
has comment: http://stackoverflow.com/comment/35879138
type: Answer
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/35882599
answers question: http://stackoverflow.com/q/23413493
has body: If I modified your first for loop slightly, you'll get a similar time: int alength = a.length; // pre-compute a.length start = System.currentTimeMillis(); for (int i = 0; i &lt; alength; i++) { a[i] += i; } $ java Test 8 millis with i&lt;a.length 6 millis with i&gt;=0
has comment: http://stackoverflow.com/comment/35879195
upvote count: 2

http://stackoverflow.com/q/23383169
type: Question
accepted answer: http://stackoverflow.com/a/23383313
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/35820808
answer count: 3
possible better answer: http://stackoverflow.com/a/23383338
has title: How to add element in ArrayList<? extends SomeType> via a method
has answer: http://stackoverflow.com/a/23383338
tagged with: arraylist
has comment: http://stackoverflow.com/comment/35820791
has answer: http://stackoverflow.com/a/23383415
has answer: http://stackoverflow.com/a/23383313
tagged with: generics
has body: i want to add element extending Type to ArrayList. ArrayList&lt;? extends Type&gt; i defined a method as below public &lt;T extends Type&gt; void addItem(T itemToAdd, Class&lt;?&gt; classType) { ArrayList&lt;? extends Type&gt; allItems = getAllItems(classType); allItems.add(itemToAdd); } T itemToAdd is error. because i can't add someother type. i thought but i don't know to mention it and its error! How to add the item via a method call?
score: 0

http://stackoverflow.com/a/23421614
score: 0
has body: As your object of StringBuilder is not shared with other threads , you can use that..
answers question: http://stackoverflow.com/q/23421372
type: Answer

http://stackoverflow.com/a/23439929
has body: you need to complete the string you are passing to stm.execute() as well as the semicolon needed after that statement. that string is missing a closing paren for the values of the insert..
downvote count: 0
answers question: http://stackoverflow.com/q/23439878
type: Answer
upvote count: 1
score: 1

http://stackoverflow.com/comment/36233307
type: Comment
comment on: http://stackoverflow.com/q/23393454
has text: it seems that the problem is not the injection of datasource via @Resource declaration but my composite unit that does not work! I made another post for this specific problem : [Why the datasource not found in a composite unit?](http://stackoverflow.com/questions/23477112/why-the-datasource-not-found-in-a-composite-unit)
score: 0
type: QuestionComment

http://stackoverflow.com/comment/35918712
type: QuestionComment
has text: @nKn Hey, Sorry that was when I was debugging. It can't keep running even I throw wait() away.
comment on: http://stackoverflow.com/q/23435427
score: 0
type: Comment

http://stackoverflow.com/comment/35774607
has text: Can you check with a debugger what does String value contains and print it here? It could have non-digit chars
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/23357884

http://stackoverflow.com/comment/35902614
score: 1
comment on: http://stackoverflow.com/q/23427090
type: Comment
type: QuestionComment
has text: possible duplicate of [What is the difference between NoClassDefFoundError and ClassNotFoundException?](http://stackoverflow.com/questions/1457863/what-is-the-difference-between-noclassdeffounderror-and-classnotfoundexception)

http://stackoverflow.com/q/23364297
upvote count: 6
has title: Getting an error that cannot create entityManager while trying to use Spring Data JPA with Spring Boot
has comment: http://stackoverflow.com/comment/35786378
has comment: http://stackoverflow.com/comment/35786035
has comment: http://stackoverflow.com/comment/35786521
has comment: http://stackoverflow.com/comment/35786710
tagged with: spring-data-jpa
favorite count: 0
has comment: http://stackoverflow.com/comment/35786584
has comment: http://stackoverflow.com/comment/35786611
type: UnansweredQuestion
score: 6
tagged with: spring
has body: I am currently working on a POC to use Spring Boot with Spring Data JPA. I want to fetch a record from the db using Spring Data JPA. I am getting the below error Error creating bean with name 'bookRepository': Cannot create inner bean '(inner bean)' of type [org.springframework.orm.jpa.SharedEntityManagerCreator] while setting bean property 'entityManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#2': Cannot resolve reference to bean 'entityManagerFactory' while setting constructor argument; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'entityManagerFactory' is defined Here are my configration class: package com.boot.configration; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.context.annotation.ComponentScan; import org.springframework.data.jpa.repository.config.EnableJpaRepositories; @EnableAutoConfiguration @ComponentScan @EnableJpaRepositories public class ApplicationStarter { public static void main (String[] args) { SpringApplication.run(ApplicationStarter.class, args); } } Below is my reposatory package com.boot.configration; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.repository.query.Param; import org.springframework.stereotype.Repository; @Repository public interface BookRepository extends JpaRepository<Book, String> { public Iterable<Book> findBooksByAuthor(@Param("author") String author); } And this is my controller @RestController public class BookController { @Autowired protected BookRepository bookRepository; @RequestMapping(value = "/isbn") @ResponseBody public String book() { Book book = bookRepository.findOne("2222222"); return "Book Name is = " + book.getTitle()+ " " + "Author is = " + book.getAuthor(); } } In the POM.xml i have the following dependencies: 4.0.0 BOOT…
has comment: http://stackoverflow.com/comment/35786017
tagged with: spring-boot
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/65420536
has comment: http://stackoverflow.com/comment/35787049
type: Question
has answer: http://stackoverflow.com/a/23368902
has comment: http://stackoverflow.com/comment/35786501
answer count: 2

http://stackoverflow.com/comment/35899150
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23389040
has text: Well, [its documented](http://docs.oracle.com/javase/7/docs/api/javax/swing/SwingWorker.html) (look at the “Workflow” section). It might be started by any thread but usually you stuff them with data from the UI before starting them so you start them from the EDT. But it’s possible that a background task starts another worker…

http://stackoverflow.com/comment/35730215
type: Comment
comment on: http://stackoverflow.com/a/23333777
has text: why would these methods be static?
score: 0
type: AnswerComment

http://stackoverflow.com/a/23387799
answers question: http://stackoverflow.com/q/23386902
has body: If you are using spring security, you can have your own implementation of SecurityContextRepository (By default this is HttpSessionSecurityContextRepository) to persist the session content in database. In this way when user presents his cookie the security framework filter (SecurityContextPersistentFilter) will look at your database for the session. Hence, even when server is down the context is still available in database and is loaded during next user request after server restart. If session persistence is not an option, you may have to deploy a cluster of servers with session replication strategy.
score: 0
type: Answer

http://stackoverflow.com/a/23417371
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/35918087
has comment: http://stackoverflow.com/comment/35908868
answers question: http://stackoverflow.com/q/23417222
has comment: http://stackoverflow.com/comment/35886384
upvote count: 2
accepted answer of: http://stackoverflow.com/q/23417222
type: AcceptedAnswer
has body: That stack trace leads me to believe you are spinning on the console/tty trying to read input. Or perhaps from a file. My recollection of Sbt is that it doesn't support multiple commands at once from the command line (compile and run). You have run all these as separate commands and it works? How about putting into a script and exec'ing that.
type: Answer
has comment: http://stackoverflow.com/comment/35915548
has comment: http://stackoverflow.com/comment/35908610

http://stackoverflow.com/q/23345629
has answer: http://stackoverflow.com/a/23346502
has title: How can I extract an "error code" number from a JNDI NamingException?
tagged with: apacheds
has comment: http://stackoverflow.com/comment/35751980
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/35752092
tagged with: jndi
type: UnansweredQuestion
tagged with: ldap
tagged with: exception
linked to: http://stackoverflow.com/q/3421643
has comment: http://stackoverflow.com/comment/35751902
has comment: http://stackoverflow.com/comment/35751736
type: Question
has body: I have some code that proxies LDAP messages. The code implements handlers of ApacheDS by calling LDAP servers using JNDI. When an error is returned from the LDAP server, JNDI reports it as an javax.naming.NamingException (or subclass) like: AuthenticationException: [LDAP: error code 49 - Invalid Credentials] On the other hand we need to return an answer to the client through the ApacheDS sink using an error code enum: ResultCodeEnum resultCodeEnum = ResultCodeEnum.getResultCode(errorCode); ldapResult.setResultCode(resultCodeEnum); How can I extract the "error code" number from the JNDI javax.naming.NamingException? (of course I can always parse the 'error code' from NamingException.explanation, if a number is found in explanation, but I'm looking for a library solution)
answer count: 1
has comment: http://stackoverflow.com/comment/35752215

http://stackoverflow.com/q/23378662
has title: Eclipse not allowing me to make an android project [Ubuntu]
tagged with: java
has comment: http://stackoverflow.com/comment/35812991
type: Question
tagged with: adt
tagged with: ubuntu
tagged with: eclipse
score: 0
has comment: http://stackoverflow.com/comment/35812928
has body: Im runnning Ubuntu 14.04 LTS with Eclipse Platform Version: 3.8.1 [Back-Story] I've been using Ubuntu on this Laptop since version 13.04 and have been making android apps without problem ever since, then when I updated to Ubuntu 14.04 (from 13.10) Eclipse Hung on the start-up at "Loading Workbench" to which a solution on the site was run it as: eclipse -clean This made Eclipse start up again without problem, but now Android tools and ADT was missing. I tried reinstalling it, and this is where my problem really begins. [Problem] After reinstalling the ADT plugin from Google and restarting (as well as re-importing my workspace) Android does not appear as an option for a new project. There is also no SDk button or Android Virtual Machine button in the interface. I've looked high and low for answers but havent came across anyone with this problem. Ive tried reinstalling, purging, woving workspaces, restarting eclipse, but nothing worked. Is there some way to re-enable it?
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/35840023
answer count: 0

http://stackoverflow.com/a/23388944
accepted answer of: http://stackoverflow.com/q/23388915
upvote count: 9
downvote count: 0
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/23388915
has body: An int value starting with a zero is considered to be a octal number (having numbers from 0 - 7) similar to hexadecimal numbers. Hence your value: 0125 is equal to: 1 * 82 + 2 * 81 + 5 * 80 == 64 + 16 + 5 == 85 Don't try to represent a phone-number as an int. Instead use a String and validate it using a regex expression. If you combine both, you may as well represent a phone number by its own type like: public class PhoneNumber { private final String number; public PhoneNumber(String number) { if (number == null || !number.matches("\\d+([-]\\d+)?")) { throw new ..... } this.number = number; } } The regex is just an example matching phone numbers like: 1234 or 0123-45678.
score: 9

http://stackoverflow.com/q/23444819
answer count: 1
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23448245
tagged with: jsf
accepted answer: http://stackoverflow.com/a/23448245
tagged with: java
type: Question
has title: Is it possible to make pagination, having elements listed with forEach in a Toggleable Panel
tagged with: primefaces
score: 0
has body: I would like to have 10 agencies per page, where every single one is in a Toogleable Panel. The code of my page up to moment is: &lt;c:forEach items="#{agencyBean.agencyList}" var="agency"&gt; &lt;p:fieldset legend="${agency.tUser.name}" toggleable="true" toggleSpeed="500"&gt; &lt;p:ajax event="toggle" listener="#{fieldsetBean.handleToggle}" update="growl" /&gt; &lt;h:panelGrid columns="2" cellpadding="3" cellspacing="1"&gt; &lt;p:graphicImage value="#{agencyBean.image}"&gt; &lt;f:param name="agencyId" value="#{agency.tUser.id}" /&gt; &lt;/p:graphicImage&gt; &lt;h:panelGrid columns="2" cellpadding="3" cellspacing="1" border="1"&gt; Name: &lt;h:outputText value="${agency.tUser.name}" /&gt; Phone:&lt;h:outputText value="${agency.tUser.phone}" /&gt; &lt;/h:panelGrid&gt; &lt;/h:panelGrid&gt; &lt;/p:fieldset&gt; &lt;/c:forEach&gt; But all object from database are listed and it is not user friendly. Can you advice me how to split them on different pages? Thanks in advance!

http://stackoverflow.com/comment/35908120
has text: I am sooooo sory sir.need some sleep
type: Comment
comment on: http://stackoverflow.com/a/23429273
score: 0
type: AnswerComment

http://stackoverflow.com/comment/35856593
type: Comment
type: QuestionComment
has text: java implicitly treat every data type as a int. See [this](http://www.studytonight.com/java/type-casting-in-java.php)
score: 0
comment on: http://stackoverflow.com/q/23402289

http://stackoverflow.com/comment/35709139
has text: [What have you tried?](http://stackoverflow.com/search?q=aes+java+javascript) What is this "differences in compatibility" problem?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23321049

http://stackoverflow.com/comment/35772364
type: QuestionComment
type: Comment
has text: So you have a single project containing EJB and hibernate and persistence.xml right? Can you post the structure of your project? Another question... did you also verify if the JNDI "jdbc/HospitalityDataSource" is available in your server?
score: 0
comment on: http://stackoverflow.com/q/23356637

http://stackoverflow.com/a/23412320
type: AcceptedAnswer
has body: If your inner class is associated to an instance of your outer class, you wouldn't be able to do that. IOW, if your inner class is not a static inner class, then it really doesn't make sense to create your inner class alone, right? On the other hand, you can change your inner class to a static inner class. But you have to be careful if this is what you need since you are basically saying that the static inner class is not dependent on any one instance of the outer class. Check this out: https://stackoverflow.com/a/70358/2231632
upvote count: 3
has comment: http://stackoverflow.com/comment/35875395
type: Answer
has comment: http://stackoverflow.com/comment/35876165
score: 3
has comment: http://stackoverflow.com/comment/35875873
downvote count: 0
has comment: http://stackoverflow.com/comment/35875729
accepted answer of: http://stackoverflow.com/q/23412231
answers question: http://stackoverflow.com/q/23412231

http://stackoverflow.com/q/23339954
tagged with: embedded-tomcat-7
type: Question
downvote count: 0
tagged with: servlets
score: 3
has title: Embeded Tomcat with webapp directory within the classpath/jar
favorite count: 0
answer count: 0
tagged with: scala
type: UnansweredQuestion
tagged with: jetty
has body: So I have a Java application that use to be packaged as a war and then deployed to Tomcat, but now I have it setup so it all runs straight from a jar file using embedded Jetty as follows: class JettyServer extends ServerTrait { val server = new Server() val connector = new ServerConnector(server) connector.setPort(BigSenseServer.config.options("httpPort").toInt) server.setConnectors(Array(connector)) val context = new ServletContextHandler() context.setContextPath(BigSenseServer.webRoot) context.addServlet(new MasterServlet().getClass, "/*") context.addEventListener(new InitLoggingListener()) context.addEventListener(new DBUpdateListener()) val fileContext = new WebAppContext() fileContext.setContextPath(BigSenseServer.contentRoot) fileContext.setResourceBase(BigSenseServer.getClass.getResource("/io/bigsense/web").toExternalForm) val handlers = new HandlerCollection() handlers.setHandlers(Array( fileContext, context, new DefaultHandler())) server.setHandler(handlers) override def startServer() { server.start server.join } override def stopServer() { server.stop } } The webroot is /bigsense/api and the contentRoot is /static. In this configuration, static files like CSS and Javascript are served from the /io/bigsense/web package (kept in src/main/resources in SBT). In my original, the context-root was /bigsense and the servlet was mapped to api/*, so all the static content could be served directly from /bigsense/{js,css,whatever}. I couldn't figure out how to get Jetty to do the same thing, but the current setup listed above works fine and I adjusted all my templates to get that static path from the same config object (which has a backend in a property file). I want to create an embedded Tomcat implementation as well and I've read several guides, but they all seem to want a real webapp base directory. I can't find any examples which either just map a servlet directory without a webapp base or take the webapp base from the classpath (in a jar) instead of a real physic…
upvote count: 3
tagged with: java

http://stackoverflow.com/a/23319698
upvote count: 2
has body: The events come from two different sources when it is a JDialog. I updated your window closed method to provide a stack trace like this: private void formWindowClosed(java.awt.event.WindowEvent evt) { Exception e = new Exception(); e.printStackTrace(); System.out.println("formWindowClosed"); } And you can tell in the stack traces where the events originate: java.awt.AWTEventMulticaster.windowClosed and the other from java.awt.Window.processWindowEvent. Hope this helps. Full stack output: formWindowClosing : Are you sure you want to quit? java.lang.Exception at JavaApplication1.formWindowClosed(JavaApplication1.java:25) at JavaApplication1.access$0(JavaApplication1.java:24) at JavaApplication1$1.windowClosed(JavaApplication1.java:10) at java.awt.AWTEventMulticaster.windowClosed(Unknown Source) at java.awt.Window.processWindowEvent(Unknown Source) at javax.swing.JDialog.processWindowEvent(Unknown Source) at java.awt.Window.processEvent(Unknown Source) at java.awt.Component.dispatchEventImpl(Unknown Source) at java.awt.Container.dispatchEventImpl(Unknown Source) at java.awt.Window.dispatchEventImpl(Unknown Source) at java.awt.Component.dispatchEvent(Unknown Source) at java.awt.EventQueue.dispatchEventImpl(Unknown Source) at java.awt.EventQueue.access$200(Unknown Source) at java.awt.EventQueue$3.run(Unknown Source) at java.awt.EventQueue$3.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source) at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source) at java.awt.EventQueue$4.run(Unknown Source) at java.awt.EventQueue$4.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source) at java.awt.EventQueue.dispatchEvent(Unknown Source) at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForFilter(Unkn…
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23319579
answers question: http://stackoverflow.com/q/23319579
type: Answer
score: 2

http://stackoverflow.com/comment/37324716
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23426043
has text: yes i am playing sounds with soundpool ,and also their is an option to play background music which i am playing with mediaplayer,now problem is that if background music is playing and sound pool also play sound how do i record both sound.

http://stackoverflow.com/comment/35946121
score: 0
type: AnswerComment
type: Comment
has text: @user3600078 You should have `test.class` and the XML file at the same folder.
comment on: http://stackoverflow.com/a/23450112

http://stackoverflow.com/comment/36032741
score: 1
has text: I'm not sure if this is just intended as an example, but you should *never* submit password information over GET, as it will get cached and inspected.
comment on: http://stackoverflow.com/q/23442919
type: Comment
type: QuestionComment

javascript
tags question: http://stackoverflow.com/q/23382931
tags question: http://stackoverflow.com/q/23306868
tags question: http://stackoverflow.com/q/23296203
tags question: http://stackoverflow.com/q/23361224
tags question: http://stackoverflow.com/q/23334037
tags question: http://stackoverflow.com/q/23400247
tags question: http://stackoverflow.com/q/23349747
tags question: http://stackoverflow.com/q/23425811
tags question: http://stackoverflow.com/q/23299320
tags question: http://stackoverflow.com/q/23435493
tags question: http://stackoverflow.com/q/23337179
tags question: http://stackoverflow.com/q/23444878
tags question: http://stackoverflow.com/q/23413388
tags question: http://stackoverflow.com/q/23380695
tags question: http://stackoverflow.com/q/23366918
tags question: http://stackoverflow.com/q/23425185
tags question: http://stackoverflow.com/q/23406716
tags question: http://stackoverflow.com/q/23371389
tags question: http://stackoverflow.com/q/23387185
tag name: javascript
tags question: http://stackoverflow.com/q/23356956
tags question: http://stackoverflow.com/q/23374852
tags question: http://stackoverflow.com/q/23334049
tags question: http://stackoverflow.com/q/23410157
tags question: http://stackoverflow.com/q/23420515
tags question: http://stackoverflow.com/q/23331279
tags question: http://stackoverflow.com/q/23390109
tags question: http://stackoverflow.com/q/23378071
tags question: http://stackoverflow.com/q/23380851
tags question: http://stackoverflow.com/q/23389948
tags question: http://stackoverflow.com/q/23311554
tags question: http://stackoverflow.com/q/23408521
tags question: http://stackoverflow.com/q/23446147
tags question: http://stackoverflow.com/q/23375134
type: Tag
tags question: http://stackoverflow.com/q/23298786
tags question: http://stackoverflow.com/q/23356100
tags question: http://stackoverflow.com/q/23440067
tags question: http://stackoverflow.com/q/23381133
tags question: http://stackoverflow.com/q/23378867
tags question: http://stackoverflow.com/q/23297474
tags question: http://stackoverflow.com/q/23334543
tags question: http://stackoverflow.com/q/23425134
tags question: http://stackoverflow.com/q/23291626
tags question: http://stackoverflow.com/q/23441674
tags question: http://stackoverflow.com/q/23342620
tags question: http://stackoverflow.com/q/23328448
tags question: http://stackoverflow.com/q/23392938
tags question: http://stackoverflow.com/q/23423007
tags question: http://stackoverflow.com/q/23348769
tags question: http://stackoverflow.com/q/23392857
tags question: http://stackoverflow.com/q/23367449
tags question: http://stackoverflow.com/q/23346839
tags question: http://stackoverflow.com/q/23340918
tags question: http://stackoverflow.com/q/23335169
tags question: http://stackoverflow.com/q/23354831
tags question: http://stackoverflow.com/q/23303603
tags question: http://stackoverflow.com/q/23409357
tags question: http://stackoverflow.com/q/23324904
tags question: http://stackoverflow.com/q/23299100
tags question: http://stackoverflow.com/q/23448209
tags question: http://stackoverflow.com/q/23426843
tags question: http://stackoverflow.com/q/23415037
tags question: http://stackoverflow.com/q/23373525
tags question: http://stackoverflow.com/q/23378727
tags question: http://stackoverflow.com/q/23301460
tags question: http://stackoverflow.com/q/23340840
tags question: http://stackoverflow.com/q/23423526
tags question: http://stackoverflow.com/q/23402338
tags question: http://stackoverflow.com/q/23291882
tags question: http://stackoverflow.com/q/23406136
tags question: http://stackoverflow.com/q/23316206
tags question: http://stackoverflow.com/q/23319341
tags question: http://stackoverflow.com/q/23411189
tags question: http://stackoverflow.com/q/23321049
tags question: http://stackoverflow.com/q/23360423

http://stackoverflow.com/q/23420315
tagged with: int
score: 0
has title: Do I have to create integers for a counter that calls a method?
has answer: http://stackoverflow.com/a/23420351
accepted answer: http://stackoverflow.com/a/23420351
possible better answer: http://stackoverflow.com/a/23420375
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23420375
tagged with: java
tagged with: methods
type: Question
answer count: 2
has body: The question is: Complete the method occursMoreTimes based on the requirements in its comment. /** *Returns true if the number of times val1 occurs in the array is strictly greater *than the number of times val2 occurs in the array. Otherwise, return false. *If you wish, you can call the findNumberOf method you wrote above. **/ My answer was this: public boolean occursMoreTimes(int[] arr, int val1, int val2){ if(findNumberOf(arr, val1) &gt; findNumberOf(arr, val2)){ return true } else {return false; } } But the answer key declared an int for the method call I wrote inside the if statement, like this: public boolean occursMoreTimes(int[] arr, int val1, int val2){ int countVal1 = findNumberOf(arr, val1); int countVal2 = findNumberOf(arr, val2); if(countVal1 &gt; countVal2){ return true } else {return false; } } Would my answer work fine? Is there an advantage to declaring a method call as an int?
tagged with: arrays

http://stackoverflow.com/a/23371286
score: 2
downvote count: 0
upvote count: 2
answers question: http://stackoverflow.com/q/23370914
type: Answer
has comment: http://stackoverflow.com/comment/35802848
has body: Try below sample code using JLabel JPanel panel = new JPanel(new GridLayout(10, 10)); JLabel[] labels = new JLabel[20]; Color[] colors = new Color[] { Color.GREEN, Color.RED, Color.BLUE }; Random random = new Random(); for (int i = 0; i &lt; labels.length; i++) { JLabel label = new JLabel(); label.setBackground(colors[random.nextInt(colors.length)]); label.setOpaque(true); panel.add(label); labels[i] = label; } snapshot:

http://stackoverflow.com/q/23414259
has title: Match a character to regex
type: Question
has body: I want to duplicate all consonants characters in a String. As an example: Hello, how do you do? would become: HHellllo, hhoww ddo yyouu ddo? So far here's what I've came up with. char[] charArray = "Hello, how do you do?".toCharArray(); String pattern = "[BbCcDdFfGgHhJjKkLlMmNnPpQqRrSsTtVvWwXxZz]"; StringBuffer sb = new StringBuffer(); for(char c : charArray){ String theChar = "" + c; if(theChar.matches(pattern)){ sb.append(c); } sb.append(c); } System.out.println(sb.toString()); It works but I'm sure there's a better way to use regex for this. I just don't feel that it's efficient to create a String for each character each time I need to use matches().
has answer: http://stackoverflow.com/a/23414382
upvote count: 2
answer count: 3
has answer: http://stackoverflow.com/a/23414374
accepted answer: http://stackoverflow.com/a/23414374
has answer: http://stackoverflow.com/a/23414405
favorite count: 0
possible better answer: http://stackoverflow.com/a/23414405
tagged with: regex
score: 2
type: AnsweredQuestion
downvote count: 0
tagged with: java

http://stackoverflow.com/q/23323183
type: AnsweredQuestion
tagged with: java
type: Question
score: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/35710353
answer count: 1
downvote count: 1
has body: I have the following: mPaintRefernce.getColor() How would I retrieve the RGB values in the range of 0-255, so Red = 200, Blue = 120 etc?
favorite count: 0
tagged with: android
has title: How to get RGB values from the Paint object
has answer: http://stackoverflow.com/a/23323211
accepted answer: http://stackoverflow.com/a/23323211

http://stackoverflow.com/comment/35771321
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23350887
type: QuestionComment
has text: Can you show us your server?

http://stackoverflow.com/comment/35873969
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23411527
has text: @Lal : Yup. I was aware of TextWatcher. Thanks anyway. :)
type: AnswerComment

http://stackoverflow.com/a/23331040
has comment: http://stackoverflow.com/comment/35725781
type: AcceptedAnswer
has body: The error message is telling you what's wrong: Your image path is wrong. The image path must be given relative to the class files location.
answers question: http://stackoverflow.com/q/23331000
accepted answer of: http://stackoverflow.com/q/23331000
type: Answer
has comment: http://stackoverflow.com/comment/35725389
has comment: http://stackoverflow.com/comment/35725475
score: 0
has comment: http://stackoverflow.com/comment/35726031

http://stackoverflow.com/comment/35679190
type: Comment
has text: Braj's made it mute. And I've looked into JMF before it. Normally posting here is a last resort. I just can't seem to find the proper file, or if I have found it, how to set it up. :/ Suppose that might just because I'm a noobish college student.
type: AnswerComment
comment on: http://stackoverflow.com/a/23304815
score: 0

http://stackoverflow.com/q/23291224
has title: Encrypting a string in Java and decrypting it in C++. crypto++
type: Question
has comment: http://stackoverflow.com/comment/35677492
accepted answer: http://stackoverflow.com/a/23291297
has comment: http://stackoverflow.com/comment/35659083
answer count: 1
tagged with: encryption
has body: I need to encrypt a string in Java and decrypt it in C++. I've seen C++ has a Crypto++ library and Java has JCE. The algorithm is AES/ECB/NOPADDING String is "12345690123456" for nopadding issue in java. Key is byte []key=new byte[]{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; 16 byte. These are same condition in java and c++. Below is java code. import javax.crypto.*; import javax.crypto.spec.*; public class etest { public static void main(String[] args) { // TODO Auto-generated method stub encryp ec=new encryp(); String name="1234567890123456"; System.out.println(name); try { System.out.println(ec.encrypt(name)); // System.out.println(ec.decrypt(ec.encrypt(name))); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } } class encryp { // public static String key = "abcdefgh12345678"; static byte []key=new byte[]{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; public static String encrypt(String message) throws Exception { SecretKeySpec skeySpec = new SecretKeySpec(key, "AES"); Cipher cipher = Cipher.getInstance("AES/ECB/NOPADDING"); cipher.init(Cipher.ENCRYPT_MODE, skeySpec); byte[] encrypted = cipher.doFinal(message.getBytes()); return byteArrayToHex(encrypted); // return encrypted; } public static String decrypt(String encrypted) throws Exception { // use key coss2 SecretKeySpec skeySpec = new SecretKeySpec(key, "AES"); Cipher cipher = Cipher.getInstance("AES"); cipher.init(Cipher.DECRYPT_MODE, skeySpec); byte[] original = cipher.doFinal(hexToByteArray(encrypted)); String originalString = new String(original); return originalString; } public static byte[] hexToByteArray(String hex) { if (hex == null || hex.length() == 0) { return null; } byte[] ba = new byte[hex.length() / 2]; for (int i = 0; i &lt; ba.length; i++) { ba[i] = (byte) Integer .parseInt(hex.substring(2 * i, 2 * i + 2), 16); } return ba; } /** * * @param ba * byte[] * @re…
has answer: http://stackoverflow.com/a/23291297
tagged with: c++
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35683976
tagged with: java
score: 0
linked to: http://stackoverflow.com/q/23271602

http://stackoverflow.com/a/23427632
has comment: http://stackoverflow.com/comment/35916170
has body: There is nothing wrong with your code just try to register again with GCM by opening the app again. I have the same problem when I first install the app I was getting the same error but when I open app again I got registered
answers question: http://stackoverflow.com/q/23427391
score: 0
type: Answer

http://stackoverflow.com/a/23319609
upvote count: 3
accepted answer of: http://stackoverflow.com/q/23319581
answers question: http://stackoverflow.com/q/23319581
type: AcceptedAnswer
has body: Below is a compiled (potentially incomplete) list which includes some of the most common interfaces and their corresponding meanings. Hopefully this helps! Takes no arguments: Called a Supplier Takes a single int, double, or long argument: Called either IntXX LongXX DoubleXX Takes two arguments: Called a BiXX Takes two arguments of the same type: Called a binaryOperator Takes two arguments of which the first is a reference type and the second is a primitive type: Called an ObjXXConsumer Returns void: Called a Consumer Returns an int, long, or double: Called either XXToIntYY XXToLongYY XXToDoubleYY Returns a boolean: Called a Predicate Otherwise, it's simply called a Function Please feel free to add more information to this answer or any identifiers that I missed.
has comment: http://stackoverflow.com/comment/35705503
type: Answer
downvote count: 1
score: 2

http://stackoverflow.com/a/23342910
downvote count: 1
has comment: http://stackoverflow.com/comment/35747124
type: Answer
answers question: http://stackoverflow.com/q/23342549
has body: In user interfaces there is the concept of 'focus'. Only the component currently holding the focus directly receives key events. This is how for example, when typing, one text box on screen responds and not any other. After frame.add(object);, add: object.setFocusable(true); object.requestFocusInWindow(); Also, the addKeyListener(this); call is in quite the wrong place. It will add another key listener every time it paints the component. It should be called only once, ideally in the constructor of the panel.
score: 2
upvote count: 3

http://stackoverflow.com/comment/35655676
comment on: http://stackoverflow.com/q/23292617
has text: I imagine that when large sets of data (in millions) are used, it would have a great impact on performance
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23423464
has title: Exact case insensitive match in spring-data mongo
has answer: http://stackoverflow.com/a/25332502
has answer: http://stackoverflow.com/a/23442172
favorite count: 0
type: UnansweredQuestion
tagged with: spring-data-mongodb
tagged with: spring
has answer: http://stackoverflow.com/a/27819633
answer count: 4
score: 14
downvote count: 0
tagged with: java
tagged with: spring-data
type: Question
has answer: http://stackoverflow.com/a/55000276
tagged with: mongodb
has body: I am using spring data with mongo, and a repository. Eg: @Query("{ 'userName' : ?0 }") public User findByUsername(String username); I want to make this case insensitive. I have used the following queries: "{'userName' : { $regex : ?0, $options: 'i' } }" This works, but it not only matches testUser, but also estUser. I also tried "{'userName' : { $regex : ^?0$, $options: 'i' } }" But this cannot parse the query, because it tries to insert quotes in the regex. com.mongodb.util.JSONParseException: ({ $regex : ^"testUser"$, $options: 'i' } ^ I get the same kind of problems if I try to use a /.../i regex. Is there any solution for this, without having to use mongoTemplate, or constructing the regex myself?
has comment: http://stackoverflow.com/comment/35900931
upvote count: 14

http://stackoverflow.com/a/23301149
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23300821
has body: If you want to match any string that contains two or more e's, anywhere in the string, this regex would do it: .*e.*e.* But extending this to look for other characters, that could be anywhere in the string relative to those two e's, isn't trivial. You can do it with a lookahead: (?=.*l)(?=.*a).*e.*e.* which matches if, at some point in the source string, the matcher can find all of the patterns .*l, .*a, and .*e.*e.* starting from that point. This will tell if there's one l, one a, and at least two e's, in any order. (If you want to look for, say, two l's, then something like this will work:) (?=.*l.*l)(?=.*a).*e.*e.* However, this requires that the matcher perform three scans starting at each point in the regex. That's why I believe problems like this are better solved with a loop: eCount = 0; aCount = 0; lCount = 0; for (int i = 0; i &lt; s.length(); i++) { switch(s.charAt(i)) { case 'e': eCount++; break; case 'a': aCount++; break; case 'l': lCount++; break; } } if (eCount &gt;= 2 &amp;&amp; aCount &gt;= 1 &amp;&amp; lCount &gt;= 1) { ... } More verbose, but overall I think more efficient.
accepted answer of: http://stackoverflow.com/q/23300821
type: AcceptedAnswer

http://stackoverflow.com/comment/77435293
score: 0
type: AnswerComment
type: Comment
has text: I think my crash is also due to mutithreading. I'm doing several `db.close()` in a service, but there is a websocket handler thread which in an incoming message also calls `getWritableDatabase()`, tries to delete an item from the DB, and then also calls `db.close()`. Before the websocket handler reaches the `db.delete()` the service has most likely called `db.close()` in its `db` variable, which caused the websockets thread to operate on a closed database connection.
comment on: http://stackoverflow.com/a/37562940

http://stackoverflow.com/comment/35902870
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23426256
type: Comment
has text: yes with my code you can only set your list data, but if you want to dynamically add item to your list you should create [DefaultListModel](http://docs.oracle.com/javase/7/docs/api/javax/swing/DefaultListModel.html) and set your JList with it. like `DefaultListModel listmodel=new DefaultListModel(); listmodel.addElement("YOUR NEW DATA"); jList1.setModel(listmodel);`

http://stackoverflow.com/q/23371174
favorite count: 0
has comment: http://stackoverflow.com/comment/35799054
has answer: http://stackoverflow.com/a/23371280
has answer: http://stackoverflow.com/a/23371402
score: 2
has answer: http://stackoverflow.com/a/23371293
type: UnansweredQuestion
tagged with: java
has title: Polymorphism: Least cumbersome way to assign data fields?
type: Question
has body: I'm currently taking a Java course and have a question about polymorphism. Given public class A { private int a1; public A(){} public A(int a1) { this.a1 = a1;} } class B extends A { private int b1; public B() {} public B(int b1, int a1) { super(a1); this.b1 = b1; } } class C extends B { private int c1; public C(){} public C(int c1, int b1, int a1) { super(b1, a1); this.c1 = c1; } } What would be the best way to assign to fields a1, b1, and c1, all in one swoop? My first guess would be to make an instance of C and call its three-arg constructor. But what happens when each class contains 10s or 100s of data fields? Wouldn't this approach mean calling constructors with huge numbers of arguments, like C(arg1, arg2, ..., arg100), setting k of C's fields, then making a call to B(arg1, arg2, ..., arg100-k), and so on, all the way up to the top? Is there a better way to proceed?
has comment: http://stackoverflow.com/comment/35799079
upvote count: 2
answer count: 3
downvote count: 0

http://stackoverflow.com/a/23394127
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/23393107
has body: You can add many listeners to the JFrame using JFrame's Properties -&gt; Events and Properties (Bindings can help you sometimes too). If you don't get what you need, just place your code into the constructor or - if it's a lot - make private method you call in the ctor. I mostly prefer a private method than putting all into ctor, but that's really something of your choice. Example: public class Example extends javax.swing.JFrame { public Example() { initComponents(); // This is generated by NB - do NOT remove! addListeners(); // add listeners here } /** * Adds listeners to the frame */ private void addListeners() { // Add your listeners here as usual this.addWindowListener(new WindowListener() { @Override public void windowOpened(WindowEvent e) { /* ... */ } /* Other methods of WindowListener ... */ }); } /* ... */ } Just one thing here: Add your listeners after initComponents() - that's the generated method witch initializes all components - otherwise some components may not be ready.
has comment: http://stackoverflow.com/comment/35842335
has comment: http://stackoverflow.com/comment/35848160
upvote count: 1
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/35870250
has comment: http://stackoverflow.com/comment/35842546
accepted answer of: http://stackoverflow.com/q/23393107

servlets
tags question: http://stackoverflow.com/q/23424706
tags question: http://stackoverflow.com/q/23303246
tags question: http://stackoverflow.com/q/23310350
tags question: http://stackoverflow.com/q/23414307
tags question: http://stackoverflow.com/q/23356200
tags question: http://stackoverflow.com/q/23390438
tags question: http://stackoverflow.com/q/23309002
tags question: http://stackoverflow.com/q/23319262
tags question: http://stackoverflow.com/q/23371719
tags question: http://stackoverflow.com/q/23339954
tags question: http://stackoverflow.com/q/23291347
tags question: http://stackoverflow.com/q/23333323
tags question: http://stackoverflow.com/q/23328111
tags question: http://stackoverflow.com/q/23381486
tags question: http://stackoverflow.com/q/23400659
tags question: http://stackoverflow.com/q/23391520
tags question: http://stackoverflow.com/q/23333006
tags question: http://stackoverflow.com/q/23361068
tags question: http://stackoverflow.com/q/23442634
tags question: http://stackoverflow.com/q/23422081
tags question: http://stackoverflow.com/q/23359727
tags question: http://stackoverflow.com/q/23431247
tags question: http://stackoverflow.com/q/23435735
tags question: http://stackoverflow.com/q/23341601
tags question: http://stackoverflow.com/q/23304111
tags question: http://stackoverflow.com/q/23353773
tags question: http://stackoverflow.com/q/23439705
tags question: http://stackoverflow.com/q/23399076
tags question: http://stackoverflow.com/q/23425216
tags question: http://stackoverflow.com/q/23344957
tags question: http://stackoverflow.com/q/23341166
tags question: http://stackoverflow.com/q/23374852
tags question: http://stackoverflow.com/q/23414194
tags question: http://stackoverflow.com/q/23451880
tags question: http://stackoverflow.com/q/23451530
tags question: http://stackoverflow.com/q/23432214
tags question: http://stackoverflow.com/q/23312950
tags question: http://stackoverflow.com/q/23398254
tags question: http://stackoverflow.com/q/23333005
tags question: http://stackoverflow.com/q/23354062
tags question: http://stackoverflow.com/q/23422650
tags question: http://stackoverflow.com/q/23299230
tags question: http://stackoverflow.com/q/23428119
tags question: http://stackoverflow.com/q/23439363
tags question: http://stackoverflow.com/q/23338390
tags question: http://stackoverflow.com/q/23382227
tags question: http://stackoverflow.com/q/23320898
tags question: http://stackoverflow.com/q/23382167
tags question: http://stackoverflow.com/q/23413388
tags question: http://stackoverflow.com/q/23311554
tags question: http://stackoverflow.com/q/23424799
tags question: http://stackoverflow.com/q/23353960
tags question: http://stackoverflow.com/q/23382102
tags question: http://stackoverflow.com/q/23304339
tags question: http://stackoverflow.com/q/23354215
tags question: http://stackoverflow.com/q/23366238
tags question: http://stackoverflow.com/q/23436973
tags question: http://stackoverflow.com/q/23310219
tags question: http://stackoverflow.com/q/23311546
tags question: http://stackoverflow.com/q/23298786
tags question: http://stackoverflow.com/q/23441108
tags question: http://stackoverflow.com/q/23427208
tags question: http://stackoverflow.com/q/23428243
tags question: http://stackoverflow.com/q/23361894
tags question: http://stackoverflow.com/q/23309456
tags question: http://stackoverflow.com/q/23353185
tags question: http://stackoverflow.com/q/23442737
tags question: http://stackoverflow.com/q/23393420
tags question: http://stackoverflow.com/q/23324093
tags question: http://stackoverflow.com/q/23443471
tags question: http://stackoverflow.com/q/23310813
tags question: http://stackoverflow.com/q/23357650
tags question: http://stackoverflow.com/q/23409851
tags question: http://stackoverflow.com/q/23440517
tags question: http://stackoverflow.com/q/23333817
tags question: http://stackoverflow.com/q/23426988
tags question: http://stackoverflow.com/q/23292132
tags question: http://stackoverflow.com/q/23420733
tags question: http://stackoverflow.com/q/23411724
tags question: http://stackoverflow.com/q/23452484

http://stackoverflow.com/a/23294984
has comment: http://stackoverflow.com/comment/35662596
accepted answer of: http://stackoverflow.com/q/23294604
answers question: http://stackoverflow.com/q/23294604
has body: Your problem is right there: ball.ballMove(width, height, 20, 5); Since this is a loop, every time it's called you make it move in the same direction. You're inverting the speed at the end of ballmove if it hits a wall but it doesn't matter because next time you call it, the ball still moves towards +20, +5. My suggestion is to add the speed parameters when you create your instance of ball and have the ballmove update its own speed. ball.ballMove(width, height); Other suggestion: Put your collision check before actually moving the ball. That way you can make sure you're not going in the wrong direction before actually moving it. Now, another problem is that in your main, you're calling the run() method of your runnable. Run gets executed on the current thread. You'd need to do something like this: Thread t = new Thread(main); t.start(); To do drawings and calculations independently of the JFrame.
type: AcceptedAnswer
downvote count: 0
score: 1
type: Answer
upvote count: 1

http://stackoverflow.com/q/23344800
answer count: 1
tagged with: java
type: AnsweredQuestion
downvote count: 0
score: 1
favorite count: 0
has title: JSpinner returns default value instead of typed one
type: Question
has answer: http://stackoverflow.com/a/23346118
accepted answer: http://stackoverflow.com/a/23346118
tagged with: jspinner
upvote count: 1
has body: I have a JSpinner with SpinnerNumberModel (1, Double.MIN_VALUE, Double.MAX_VALUE, 0.01) If I type directly to JSpinner - 1000, click OK in some dialog, and get spinner.getValue() it will return '1' instead of 1000. If I type 1000 and change focus to somewhere else like clicking on JDialog's emty space and read value after that it will be correct=1000. If I will change values with spinner's arrows - value will be correct too. How to fix Jspinner so it will support typing values without changing focus to somewhere else first before getting it's value? Java JDK 1.6.0_23
tagged with: swing

http://stackoverflow.com/q/23425979
tagged with: java
tagged with: web-applications
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/35900690
has comment: http://stackoverflow.com/comment/35900900
has comment: http://stackoverflow.com/comment/35900857
has comment: http://stackoverflow.com/comment/35900745
has answer: http://stackoverflow.com/a/23429001
has comment: http://stackoverflow.com/comment/35900784
answer count: 1
downvote count: 0
has body: Actually , what i want to invoke is a service method, so some people are saying that with regular reflection , how can one load autowired elements? I am new to spring framework. I am working on web application designed using Spring-hibernate framework. So in one case i saved class name and method name in DB. And now i want to invoke method via reflection: Class cls = Class.forName("com.xyz.pqr.Invest"); Object obj = cls.newInstance(); //call the printIt method Method method = cls.getDeclaredMethod("exec", noparams); method.invoke(obj, null); by fetching class name and method name from DB. But its not fulfilling my purpose. Kindly tell how to invoke method via reflection using spring . I googled it out and something like to implement ApplicationContextAware i found. But not clear idea. Actually , what i want to invoke is a service method, so some people are saying that with regular reflection , how can one load autowired elements? Invest is a service class , in that we have api exec to process some data public void exex(int a, int b, String c){**} thanks
favorite count: 0
has title: error in reflection in Spring
type: UnansweredQuestion
tagged with: spring
tagged with: reflection
score: 1

http://stackoverflow.com/a/23442759
score: 0
type: AcceptedAnswer
has body: Well, I am answering my own question. Unlike C++, Java seems strict about loop-control variable statements. Putting in lambda function in any form gives error. So, what I did instead was to use single for-loop with two loop control variables, like this. // Single for-loop for (int i=1, j=2; i&lt;10; i=(++j==10) ? i+1 : i, j=(j==10) ? 2 : j) System.out.format("%dx%d=%2d%c",j,i,i*j,(j==9) ? '\n' : ' '); Since it could be done the same with C++, I got curious and compared both methods in C++ source and their assembly code. Here is the C++ code (indented for better readability but...), and // 1. Using lambda function for (int i=1; i&lt;10; [](int i) {for (int j=2; j&lt;10; ++j) printf("%dx%d=%2d ",j,i,i*j);}(i++)) printf("\n"); // 2. Using single for-loop for (int i=1, j=2; i&lt;10; i=(++j==10) ? i+1 : i, j=(j==10) ? 2 : j) printf("%dx%d=%2d%c",j,i,i*j,(j==9) ? '\n' : ' '); here is the assembly (NetBeans-MinGW gcc generated). The one with lambda function generates smaller code than the single for-loop with multiple ternary operators. ! // 1. Using lambda function ! for (int i=1; i&lt;10; [](int i) {for (int j=2; j&lt;10; ++j) printf("%dx%d=%2d ",j,i,i*j);}(i++)) printf("\n"); main(int, char**)() main(int, char**)+22: movl $0x1,-0xc(%ebp) main(int, char**)+29: jmp 0x40172a &lt;main(int, char**)+65&gt; main(int, char**)+31: movl $0x40a06f,(%esp) main(int, char**)+38: call 0x408248 &lt;printf(char const*, ...)&gt; main(int, char**)+43: mov -0xc(%ebp),%edx main(int, char**)+46: incl -0xc(%ebp) main(int, char**)+49: lea -0x15(%ebp),%eax main(int, char**)+52: mov %edx,(%esp) main(int, char**)+55: mov %eax,%ecx main(int, char**)+57: call 0x4016a0 &lt;operator()(int) const&gt; main(int, char**)+62: sub $0x4,%esp main(int, char**)+65: cmpl $0x9,-0xc(%ebp) main(int, char**)+69: setle %al main(int, char**)+72: test %al,%al main(int, char**)+74: jne 0x401708 &lt;main(int, char**)+31&gt; ! ! // 2. Using single for-loop ! for (int i=1, j=2; i&lt;10; i=(++j==10) ? i+1 : i, j=(j==10) ?…
type: Answer
accepted answer of: http://stackoverflow.com/q/23418114
answers question: http://stackoverflow.com/q/23418114

http://stackoverflow.com/a/23369943
answers question: http://stackoverflow.com/q/23369717
has comment: http://stackoverflow.com/comment/35796866
type: Answer
upvote count: 4
has comment: http://stackoverflow.com/comment/35796914
downvote count: 0
has comment: http://stackoverflow.com/comment/81793378
has body: For a reason I don't understand, type inference fails in the second case. But you can give the type of t List&lt;Trade&gt;trades = otrades.stream()//******* .sorted(Comparator.comparing( (Trade t) -&gt; t.getMeta().getTradeDate()) .thenComparing(t -&gt; t.getName())) .collect(Collectors.toList())); In your example, the compiler finds that t is something else that a Trade (probably Object). That's why the method getMeta() cannot be found.
score: 4
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23369717
has comment: http://stackoverflow.com/comment/35796770

http://stackoverflow.com/comment/35848158
comment on: http://stackoverflow.com/q/23397572
has text: Actually I just spoke to somebody about it. It was more about efficiency issue and trying to run away from an `N^2` algorithm
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35862861
type: QuestionComment
comment on: http://stackoverflow.com/q/23405399
has text: @A5l-lE5 updated with getter and setter
score: 0
type: Comment

http://stackoverflow.com/comment/35824950
type: Comment
comment on: http://stackoverflow.com/a/23366376
type: AnswerComment
has text: Thanks for a great job! Well, I just see the documentation also contains in chapter 9 the description of all algorithms with their parameters. But you are right it is really confusing...
score: 0

http://stackoverflow.com/a/23307382
upvote count: 1
has body: Despite the fact that your methods are annotated with Transactional, they are not. Spring transactions are proxy-based. That means that Spring intercepts calls from one Spring bean to another Spring bean, thanks to proxies, and starts/commits a transaction is this other bean's method is transactional. Spring can't intercept method calls from one object to this same object. So you actually have one transaction for each call to your repositories. That's why your Location is detached.
type: AcceptedAnswer
downvote count: 0
score: 1
type: Answer
accepted answer of: http://stackoverflow.com/q/23303987
answers question: http://stackoverflow.com/q/23303987

http://stackoverflow.com/a/23348291
score: 2
downvote count: 0
has body: Simplest answer you need an SQL database of some sort to save the data, although without your code listed you will not get a specific answer. Learn to use SQL Lite within the application before moving onto connecting to a DB through an internet connection. This helped me during university: Head over to http://www.edumobile.org/android/android-development/mini-notepad/.
answers question: http://stackoverflow.com/q/23348220
upvote count: 2
type: Answer

http://stackoverflow.com/comment/35686397
type: Comment
type: QuestionComment
has text: @Jahed org.json.simple,all of them
comment on: http://stackoverflow.com/q/23309710
score: 0

http://stackoverflow.com/comment/36085619
comment on: http://stackoverflow.com/a/23384891
type: AnswerComment
score: 0
type: Comment
has text: Note that it's not just about syntactically incorrect URLs. For example, `http://exámple.com/ /foo` is a valid URL (not a valid URI as per old RFCs though) which works with `java.net.URL` but breaks `java.net.URI`.

http://stackoverflow.com/comment/35738869
score: 0
type: Comment
has text: @feuerball - This article will help you map the namespace qualification: http://blog.bdoughan.com/2010/08/jaxb-namespaces.html
type: AnswerComment
comment on: http://stackoverflow.com/a/23337033

http://stackoverflow.com/a/23398772
has body: You may want to simply use the assertTrue() methods with 2 args: Assert.assertTrue("File "+file.getAbsoluePath()+"does not exist", file.exists());
score: 5
type: Answer
downvote count: 2
upvote count: 7
answers question: http://stackoverflow.com/q/23398736

http://stackoverflow.com/comment/35820473
comment on: http://stackoverflow.com/q/23382326
type: QuestionComment
type: Comment
has text: Such exception typically means that there was Exception thrown in `static` block of class. Please check that.
score: 1

http://stackoverflow.com/comment/35899160
has text: @BonzaiThePenguin Why do things in a slow, dirty way when the API provides a direct way? This sort of tricks is what gets you to http://thedailywtf.com
comment on: http://stackoverflow.com/q/23425022
score: 1
type: QuestionComment
type: Comment

http://stackoverflow.com/q/23416848
tagged with: android
has comment: http://stackoverflow.com/comment/35922015
has title: libgdx android failed on launch
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/24989035
answer count: 1
tagged with: android-emulator
tagged with: libgdx
type: UnansweredQuestion
tagged with: eclipse
score: 3
has body: This is my first time using libgdx and I would like to try the default application provided after the setup gdx-setup-ui. It runs fine when I hit the run button on eclipse as it has shown [2014-05-01 21:40:14 - my-gdx-game-android] Uploading my-gdx-game-android.apk onto device 'emulator-5554' [2014-05-01 21:40:15 - my-gdx-game-android] Installing my-gdx-game-android.apk... [2014-05-01 21:40:16 - my-gdx-game-android] Success! [2014-05-01 21:40:16 - my-gdx-game-android] Starting activity com.me.mygdxgame.MainActivity on device emulator-5554 [2014-05-01 21:40:16 - my-gdx-game-android] ActivityManager: WARNING: linker: libdvm.so has text relocations. This is wasting memory and is a security risk. Please fix. [2014-05-01 21:40:16 - my-gdx-game-android] ActivityManager: Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.me.mygdxgame/.MainActivity } but on the emulator it said unfortunately, my LibGDX Game has stopped. These are shown in the logCat: 05-01 17:02:04.936: D/dalvikvm(2034): Trying to load lib /data/app-lib/com.me.mygdxgame-1/libgdx.so 0xb103cb78 05-01 17:02:04.936: D/dalvikvm(2034): Added shared lib /data/app-lib/com.me.mygdxgame-1/libgdx.so 0xb103cb78 05-01 17:02:04.936: D/dalvikvm(2034): No JNI_OnLoad found in /data/app-lib/com.me.mygdxgame-1/libgdx.so 0xb103cb78, skipping init 05-01 17:02:04.936: D/AndroidRuntime(2034): Shutting down VM 05-01 17:02:04.936: W/dalvikvm(2034): threadid=1: thread exiting with uncaught exception (group=0xb0d34b20) 05-01 17:02:04.996: E/AndroidRuntime(2034): FATAL EXCEPTION: main 05-01 17:02:04.996: E/AndroidRuntime(2034): Process: com.me.mygdxgame, PID: 2034 05-01 17:02:04.996: E/AndroidRuntime(2034): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.me.mygdxgame/com.me.mygdxgame.MainActivity}: com.badlogic.gdx.utils.GdxRuntimeException: Libgdx requires OpenGL ES 2.0 05-01 17:02:04.996: E/AndroidRuntime(2034): at android.app.ActivityThread.performLaunchActivity(A…
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/35890785
type: Question
has comment: http://stackoverflow.com/comment/35889277
linked to: http://stackoverflow.com/q/22703940

http://stackoverflow.com/q/23451530
answer count: 1
tagged with: jsp
favorite count: 0
has comment: http://stackoverflow.com/comment/35948731
has body: I have a TLD (Tag Library Descriptor) file in my WEB-INF folder in my J2EE web project. I copied the TLD file from my textbook. In Eclipse EE, near the taglib line, it gives me the error: The markup in the document preceding the root element must be well-formed. The XML/TLD file: <?xml version="1.0" encoding="ISO-8859-1" ?> < taglib xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd" version="2.0"> 1.2 DiceFunctions rollIt foo.DiceRoller int rollDice() </taglib> How can I resolve this error?
tagged with: http://stackoverflow.com/tag/xml
upvote count: 3
has answer: http://stackoverflow.com/a/23451544
score: 1
downvote count: 2
has comment: http://stackoverflow.com/comment/35948714
type: Question
has title: Why is this XML producing a "...must be well-formed" validation error?
type: AnsweredQuestion
tagged with: java
tagged with: servlets
accepted answer: http://stackoverflow.com/a/23451544

http://stackoverflow.com/comment/35675399
type: AnswerComment
score: 0
has text: Thank you for your nice answer. That's very heavy stuff! I don't know if I can afford the time to dig through this. But I think this would be the right way to narrow down the bug.
type: Comment
comment on: http://stackoverflow.com/a/23303359

http://stackoverflow.com/q/23434625
tagged with: java
has comment: http://stackoverflow.com/comment/35917205
has comment: http://stackoverflow.com/comment/35916997
has body: I have a Serialized object that is stored in an "index.dat" file, im reading this serialized file using this code: try { FileInputStream fileIn = new FileInputStream("index.dat"); ObjectInputStream in = new ObjectInputStream(fileIn); Object obj = null; while( (obj = in.readObject()) != null ){ Word w = (Word) obj; System.out.println(w.getWord()); System.out.println("_____"); } in.close(); fileIn.close(); } catch (IOException i) { } catch (ClassNotFoundException ex) { } Now is there anyway to edit the retrieved object(in this case its obj) and save it in the same position?
has comment: http://stackoverflow.com/comment/35917237
has comment: http://stackoverflow.com/comment/35918608
has comment: http://stackoverflow.com/comment/35917028
has comment: http://stackoverflow.com/comment/35916943
type: UnansweredQuestion
has title: Java edit Serializable edit objects in file
has comment: http://stackoverflow.com/comment/35917383
score: 2
has comment: http://stackoverflow.com/comment/35917095
has comment: http://stackoverflow.com/comment/35917020
answer count: 0
downvote count: 0
favorite count: 0
tagged with: serialization
has comment: http://stackoverflow.com/comment/35917276
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/35917063
has comment: http://stackoverflow.com/comment/35918919
has comment: http://stackoverflow.com/comment/35916987
has comment: http://stackoverflow.com/comment/35917344

http://stackoverflow.com/comment/35787369
type: AnswerComment
type: Comment
has text: I don't understand your last question, sorry) What is your goal? Which collections do you want to save objects?
comment on: http://stackoverflow.com/a/23360827
score: 0

http://stackoverflow.com/q/23413493
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/35877642
type: Question
has title: Why second loop is faster than first
score: 0
answer count: 3
tagged with: for-loop
linked to: http://stackoverflow.com/q/504103
has comment: http://stackoverflow.com/comment/35877626
has comment: http://stackoverflow.com/comment/35877598
has body: Why second loop is faster than first here. public class Test2 { public static void main(String s[]) { long start, end; int[] a = new int[2500000]; int length = a.length; start = System.nanoTime(); for (int i = 0; i &lt; length; i++) { a[i] += i; } end = System.nanoTime(); System.out.println(end - start + " nano with i &lt; a.length "); int[] b = new int[2500000]; start = System.nanoTime(); for (int i = b.length - 1; i &gt;= 0; i--) { b[i] += i; } end = System.nanoTime(); System.out.println(end - start + " nano with i &gt; = 0"); } } Output is 6776766 nano with i &lt; a.length 5525033 nano with i &gt; = 0 update - I have update the question according to the suggestion but I still see the difference in time. first loop is taking more time then second loop.
has answer: http://stackoverflow.com/a/23413578
has answer: http://stackoverflow.com/a/23413648
has answer: http://stackoverflow.com/a/23413607
has comment: http://stackoverflow.com/comment/35877789
has comment: http://stackoverflow.com/comment/35877767

http://stackoverflow.com/a/28883633
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23327538
type: Answer
has body: Ok, I just needed to wait proper GF4 release for java 8. This all works for now.
score: 0
accepted answer of: http://stackoverflow.com/q/23327538

http://stackoverflow.com/q/23352764
has comment: http://stackoverflow.com/comment/38963220
has answer: http://stackoverflow.com/a/25089513
upvote count: 2
answer count: 1
favorite count: 0
has title: Apache InternalHttpClient: Determining local port number
tagged with: apache-httpclient-4.x
type: UnansweredQuestion
has body: I am trying to debug http client request. I need to get the local port number that was used when the connection was made. I can use the HttpClientContext to get the connection, and retrieve the local port when the connection is successful. However, in cases where the IOExceptions are thrown, I get a ConnectionShutdownException when retrieving the local port number. Any clue on how I can obtain the local port number for all http requests in case of error.
score: 2
downvote count: 0
tagged with: java
type: Question

http://stackoverflow.com/a/23385553
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/57836468
answers question: http://stackoverflow.com/q/23385434
downvote count: 5
has comment: http://stackoverflow.com/comment/70120649
upvote count: 31
has body: Take a look on this: https://github.com/amirmehdizadeh/JalaliCalendar The code looks nice, maven based project, a lot of unit tests.
has comment: http://stackoverflow.com/comment/58297596
has comment: http://stackoverflow.com/comment/113027562
has comment: http://stackoverflow.com/comment/58299460
type: Answer
has comment: http://stackoverflow.com/comment/94218301
accepted answer of: http://stackoverflow.com/q/23385434
has comment: http://stackoverflow.com/comment/58297818
score: 26

http://stackoverflow.com/comment/35920628
comment on: http://stackoverflow.com/q/23422225
has text: Perfect, did what you said and it works fine :) I believe this would be an optimized version of my code. I had one small question, if you could help me. How do I know, what pattern was found at what line? It does give me line number 5 and 9, is there a function which would tell me whether it found `if, else or while` and on what line number?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35822246
has text: How did you compile it ?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23383993

http://stackoverflow.com/q/23354236
has comment: http://stackoverflow.com/comment/35867455
has body: I have a java play application that I am trying to deploy to heroku using git push heroku master the application has deployed in the past but now does not compile during the deployment process. I get package com.mongodb does not exist. It compiles just fine using... play compile I have read... http://www.scala-sbt.org/release/docs/Getting-Started/Library-Dependencies.html#managed-dependencies and other similar posts and have made adjustments to my build.sbt file in the libraryDependencies section. Below is the relevant section. libraryDependencies ++= Seq( javaJdbc, javaEbean, cache, "org.mongodb" % "mongo-java-driver" % "2.12.0" ) Any ideas why it works using play compile and not in the deployment process to heroku? Thanks for any suggestions.
favorite count: 0
tagged with: playframework-2.0
answer count: 0
downvote count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35867518
tagged with: heroku
has comment: http://stackoverflow.com/comment/35867791
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/35806085
type: Question
tagged with: mongodb
has comment: http://stackoverflow.com/comment/35839351
has title: play for java: app compiles using play compile but not when pushing to heroku; unresolved mongodb lib
upvote count: 1

json4s
tags question: http://stackoverflow.com/q/23423774
tag name: json4s
type: Tag

http://stackoverflow.com/comment/48473333
comment on: http://stackoverflow.com/q/23331950
score: 0
has text: timeOut is wait time for response(Timeout timeOut = new Timeout(5, TimeUnit.SECONDS))
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/66150960
type: Comment
has text: What are u doing with the file in JNI ? Since, I am getting the same exception while using Jni code
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25576541

image
tags question: http://stackoverflow.com/q/23400648
tags question: http://stackoverflow.com/q/23331835
tags question: http://stackoverflow.com/q/23351068
tags question: http://stackoverflow.com/q/23350872
tags question: http://stackoverflow.com/q/23438120
tags question: http://stackoverflow.com/q/23420042
tags question: http://stackoverflow.com/q/23341799
tags question: http://stackoverflow.com/q/23449784
tags question: http://stackoverflow.com/q/23328280
tags question: http://stackoverflow.com/q/23352223
tags question: http://stackoverflow.com/q/23345048
tags question: http://stackoverflow.com/q/23410560
tags question: http://stackoverflow.com/q/23397120
tags question: http://stackoverflow.com/q/23409847
tags question: http://stackoverflow.com/q/23428179
tags question: http://stackoverflow.com/q/23433866
tags question: http://stackoverflow.com/q/23451335
tags question: http://stackoverflow.com/q/23428407
tags question: http://stackoverflow.com/q/23434916
tags question: http://stackoverflow.com/q/23440388
tags question: http://stackoverflow.com/q/23420908
tags question: http://stackoverflow.com/q/23320508
tag name: image
tags question: http://stackoverflow.com/q/23357492
tags question: http://stackoverflow.com/q/23372890
tags question: http://stackoverflow.com/q/23345068
tags question: http://stackoverflow.com/q/23363949
tags question: http://stackoverflow.com/q/23313974
tags question: http://stackoverflow.com/q/23394750
type: Tag
tags question: http://stackoverflow.com/q/23327104

http://stackoverflow.com/q/23312957
linked to: http://stackoverflow.com/q/13360867
favorite count: 0
tagged with: ftp
answer count: 0
type: UnansweredQuestion
upvote count: 1
has comment: http://stackoverflow.com/comment/35825972
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/35821023
type: Question
tagged with: docx4j
downvote count: 0
has body: I have an application which saves .docx files to a FTP server. To store the file on the FTP server the FTP client needs the InputStream of the file, but here comes the problems. I use docx4j to save the text I want to a temp file on the file system, after that I get the InputStream of that file and stores it on the FTP server. But when I try to open it says that it is corrupted. Here is my sample code: public void setText(String text) throws BusinessException { //My utility class, used for ftp processes(such as storing, deleting files FtpProcesses ftp = new FtpProcesses(Consts.ADMIN_FTP_USERNAME, UserType.ADMIN); String filePath = ftp.getFileFolderRelativePath(FileType.ARTICLE, String.valueOf(this.getVersionsCount()), String.valueOf(this.getId())); File outputFile; InputStream stream; Text fileText; R run; P paragraph; ObjectFactory factory = Context.getWmlObjectFactory(); try { outputFile = File.createTempFile("tempFile", ".docx"); paragraph = factory.createP(); run = factory.createR(); fileText = factory.createText(); fileText.setValue(text); run.getContent().add(fileText); paragraph.getContent().add(run); WordprocessingMLPackage word = WordprocessingMLPackage.createPackage(); word.getMainDocumentPart().addObject(paragraph); word.save(outputFile); stream = new FileInputStream(outputFile); ftp.uploadFile(filePath, stream); } catch (IOException | Docx4JException e) { e.printStackTrace(); throw new BusinessException(Errors.FILE_UPLOAD_ERROR); } } So as you can see I getting the InputStream directly after saving the file. Is there some other way for getting it with docx4j so that it can be saved properly on the ftp?
has comment: http://stackoverflow.com/comment/35869314
has comment: http://stackoverflow.com/comment/35861610
has comment: http://stackoverflow.com/comment/35824828
has title: Getting InputStream of a .docx file using docx4j

service
tags question: http://stackoverflow.com/q/23329003
tag name: service
tags question: http://stackoverflow.com/q/23338203
tags question: http://stackoverflow.com/q/23428292
type: Tag
tags question: http://stackoverflow.com/q/23440323

http://stackoverflow.com/a/23305764
type: AcceptedAnswer
has body: Your main() method is accessing the static seatList field, which has not been populated (SeatList() has not been called yet). seatList should probably be made non-static, and accessed via a getter method, to enforce that the object is fully initialized before it's used. or make SeatList() static and call it from a static initializer to ensure that it's called.
has comment: http://stackoverflow.com/comment/35679106
score: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/23305717
has comment: http://stackoverflow.com/comment/35679154
answers question: http://stackoverflow.com/q/23305717
has comment: http://stackoverflow.com/comment/35679068

relative-path
type: Tag
tags question: http://stackoverflow.com/q/23305727
tag name: relative-path
tags question: http://stackoverflow.com/q/23351285

http://stackoverflow.com/q/23385478
has body: I've built a model of the solar system in Java. In order to determine the position of a planet it does do a whole lot of computations which give a very exact value. However I am often satisfied with the approximate position, if that could make it go faster. Because I'm using it in a simulation speed is important, as the position of the planet will be requested millions of times. Currently I try to cache the position of a planet throughout its orbit and then use those coordinates over and over. If a position in between two values is requested I perform a linear interpolation. This is how I store values: for(int t=0; t&lt;tp; t++) { listCoordinates[t]=super.coordinates(ti+t); } interpolator = new PlanetOrbit(listCoordinates,tp); PlanetOrbit has the interpolation code: package cometsim; import org.apache.commons.math3.util.FastMath; public class PlanetOrbit { final double[][] coordinates; double tp; public PlanetOrbit(double[][] coordinates, double tp) { this.coordinates = coordinates; this.tp = tp; } public double[] coordinates(double julian) { double T = julian % FastMath.floor(tp); if(coordinates.length == 1 || coordinates.length == 0) return coordinates[0]; if(FastMath.round(T) == T) return coordinates[(int) T]; int floor = (int) FastMath.floor(T); if(floor&gt;=coordinates.length) floor=coordinates.length-5; double[] f = coordinates[floor]; double[] c = coordinates[floor+1]; double[] retval = f; retval[0] += (T-FastMath.floor(T))*(c[0]-f[0]); retval[1] += (T-FastMath.floor(T))*(c[1]-f[1]); retval[2] += (T-FastMath.floor(T))*(c[2]-f[2]); return retval; } } You can think of FastMath as Math but faster. However, this code is not much of a speed improvement over calculating the exact value every time. Do you have any ideas for how to make it faster?
has comment: http://stackoverflow.com/comment/35825275
tagged with: java
has title: Fast interpolation between a collection of points
type: Question
has comment: http://stackoverflow.com/comment/35825093
answer count: 1
has answer: http://stackoverflow.com/a/23386016
has comment: http://stackoverflow.com/comment/35824974
has comment: http://stackoverflow.com/comment/35824900
score: 0
accepted answer: http://stackoverflow.com/a/23386016
type: AnsweredQuestion
tagged with: performance

http://stackoverflow.com/comment/117155529
has text: `PEMWriter` is depricated. So, Use `JcaPEMWriter` instead.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23426528
type: AnswerComment

http://stackoverflow.com/a/23353297
has body: You have to call that method on an object of Rectangle. Because, perimeter() is an instance method, so you have to call on an instance. If perimeter() is a static method, then you can call it with Class, like Rectangle.perimeter(r1); int r1Perimeter = r1.perimeter(r1); And there is no need to pass the Rectangle object there, define perimeter() method like below public int perimeter(){ int p = 2*length + 2* width; return p; }
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/23353284
accepted answer of: http://stackoverflow.com/q/23353284
upvote count: 2
type: AcceptedAnswer

http://stackoverflow.com/q/23433470
has comment: http://stackoverflow.com/comment/35926467
has title: Object is persisted without call the save() method on Session object
type: AnsweredQuestion
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/35915364
answer count: 1
score: 0
has body: I have a problem with Hibernate 4.2.3 and JPA 2.0. The objects are persisted without call the save() method on the Session object from Hibernate. This is my Bean: package com.elver.ichante.business.beans; import com.elver.ichante.business.items.Collateral; import com.elver.ichante.business.items.Status; import com.elver.ichante.business.items.LoanType; import com.elver.ichante.business.util.LoanUtil; import org.hibernate.annotations.LazyCollection; import org.hibernate.annotations.LazyCollectionOption; import javax.persistence.*; import javax.validation.constraints.NotNull; import java.io.Serializable; import java.util.Calendar; import java.util.GregorianCalendar; import java.util.List; import java.util.ArrayList; /** * Created by Elver on 3/26/14. */ @Entity @Table public class Loan implements Serializable{ private static final long serialVersionUID = 43847384358452043L; //Todo Function to calculate the amount needed to complete the full payment. //Constructor /** * Deafult Construtor */ public Loan(){} public Loan(Double amount, LoanType tipo, Double amountPago) { this.amount = amount; this.loanType = tipo; this.creationDate = new GregorianCalendar(); this.finishedDate = new GregorianCalendar(); finishedDate.add(GregorianCalendar.DAY_OF_MONTH, 45); this.status = Status.ALDIA; payments = LoanUtil.getPagos(this, amountPago); collaterals = new ArrayList&lt;Collateral&gt;(); } public Loan(Double amount, LoanType tipo, Double amountPago, GregorianCalendar creationDate) { this.amount = amount; this.loanType = tipo; this.creationDate = creationDate; this.finishedDate = new GregorianCalendar(); finishedDate.add(GregorianCalendar.DAY_OF_MONTH, 45); this.status = Status.ALDIA; payments = LoanUtil.getPagos(this, amountPago); collaterals = new ArrayList&lt;Collateral&gt;(); } /* Fields */ private Integer id; private Client client; private Double amount; private Calendar creationDate; private Calendar finishedDate; private List&lt;Payment&gt; payments = new ArrayList&lt;Paymen…
has answer: http://stackoverflow.com/a/23433523
accepted answer: http://stackoverflow.com/a/23433523
type: Question

http://stackoverflow.com/q/23291229
has answer: http://stackoverflow.com/a/23291535
tagged with: jsf-2
answer count: 1
has comment: http://stackoverflow.com/comment/35665796
has body: I'm a newbie in Java and JSF and trying to create a test page using JSF template, <ui:include> and <ui:insert>. As a result I get only <ui:insert> blocks on the page, but <ui:include> is not rendered. Could someone advise what's wrong here? Here's my template main_template.xhtml: <?xml version="1.0" encoding="UTF-8"?> <h:head> Title Here </h:head> <h:body> <ui:include src="header.xhtml"/> <ui:insert name="menu">Menu string</ui:insert> <ui:insert name="content">Main Content</ui:insert> </h:body> Here's index.xhtml: <ui:composition template="WEB-INF/templates/main_template.xhtml" xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://xmlns.jcp.org/jsf/facelets" xmlns:h="http://xmlns.jcp.org/jsf/html"> <ui:define name="menu"> Menu will be here </ui:define> <ui:define name="content"> New content here Blah blah </ui:define> </ui:composition> ..and header.xhtml: <ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://xmlns.jcp.org/jsf/facelets" xmlns:h="http://xmlns.jcp.org/jsf/html"> Header page Include page blah blah lorem ipsum </ui:composition>
type: UnansweredQuestion
tagged with: include
tagged with: jsf
score: 0
tagged with: java
has title: JSF <include> doesn't work in template
type: Question

http://stackoverflow.com/a/23433406
score: 2
downvote count: 0
has body: Primitives and generics aren't really compatible. You'll either need a Integer[] (gross) or sort should take a int[].
answers question: http://stackoverflow.com/q/23433376
has comment: http://stackoverflow.com/comment/35914401
has comment: http://stackoverflow.com/comment/35914475
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/35914384

http://stackoverflow.com/comment/35660078
has text: Thanks for the tips, it will help me to improve the algorithm.
type: AnswerComment
comment on: http://stackoverflow.com/a/23293861
score: 0
type: Comment

http://stackoverflow.com/comment/35839756
has text: @user3585596 What do you mean by "it didn't work." Based on the code snippet you show above, it should be working in the sense that your Scene1 Activity will be destroyed. Where is the `onClick` method called from? Are you in the context of an Activity or are you inside something else that overrides `finish()`?
comment on: http://stackoverflow.com/a/23393216
type: AnswerComment
type: Comment
score: 0

http://stackoverflow.com/q/23316180
tagged with: java
score: -1
type: Question
has title: Storing local data for java application
answer count: 2
upvote count: 0
has answer: http://stackoverflow.com/a/23316200
favorite count: 0
type: UnansweredQuestion
has body: My friend challenged me to make a java application just like the "love test" mobile app. If you aren't familiar with this app you input two names(yours and someone else's) and it gives you the percentage of "compatibility". I want the random percentages to get saved so when they input the same names again it will display the same number.
downvote count: 1
has answer: http://stackoverflow.com/a/23316215

http://stackoverflow.com/comment/36757987
type: Comment
comment on: http://stackoverflow.com/q/23332315
has text: reinstalling != restart
score: 0
type: QuestionComment

http://stackoverflow.com/comment/35854020
type: QuestionComment
type: Comment
has text: possible duplicate of [Invalid Escape Sequence in Java](http://stackoverflow.com/questions/8612270/invalid-escape-sequence-in-java)
comment on: http://stackoverflow.com/q/23396665
score: 0

http://stackoverflow.com/a/23410815
type: Answer
has comment: http://stackoverflow.com/comment/35872905
has comment: http://stackoverflow.com/comment/35873775
has comment: http://stackoverflow.com/comment/35872890
has comment: http://stackoverflow.com/comment/35874350
upvote count: 4
answers question: http://stackoverflow.com/q/23410738
downvote count: 0
has body: Have you looked at JUnit assumptions ? useful for stating assumptions about the conditions in which a test is meaningful. A failed assumption does not mean the code is broken, but that the test provides no useful information. The default JUnit runner treats tests with failing assumptions as ignored (which seems to meet your criteria for ignoring these tests).
score: 4

http://stackoverflow.com/q/23447403
has answer: http://stackoverflow.com/a/23447489
has title: Java: Use Static methods of Parent Class in Child Class
type: Question
score: 3
has comment: http://stackoverflow.com/comment/35940469
has body: I'm trying to refactor my code by using a BaseComponentType class and inheriting from this in my ElectricalComponentType class (and similar child classes), as follows: BaseComponentType.java public abstract class BaseComponentType { public static BaseComponentType findByUid ( Class klass, String uid ) { return new Select().from( klass ).where( "uid = ?", uid ).executeSingle(); } } ElectricalComponentType.java public class ElectricalComponentType extends BaseComponentType { public static ElectricalComponentType findByUid( String uid ) { return (ElectricalComponentType) findByUid( ElectricalComponentType.class, uid ); } } What I need to do is call ElectricalComponentType.findByUid( 'a1234' ) but it would be great if I did not have to define findByUid in the ElectricalComponentType class and instead could inherit this functionality from the BaseComponentType. You'll notice that two things stand in the way: I need the ElectricalComponentType class in the findByUid parent method. I need to return ElectricalComponentType object (or whatever the child class object is) instead of a BaseComponentType class object. Is there a way to do this?
tagged with: java
tagged with: static-methods
has comment: http://stackoverflow.com/comment/35940745
has answer: http://stackoverflow.com/a/23447725
downvote count: 0
tagged with: inheritance
favorite count: 0
has comment: http://stackoverflow.com/comment/35940593
tagged with: abstract-class
has comment: http://stackoverflow.com/comment/35940441
has comment: http://stackoverflow.com/comment/35940781
answer count: 4
has answer: http://stackoverflow.com/a/23449948
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23447769
upvote count: 3
has comment: http://stackoverflow.com/comment/35940702
possible better answer: http://stackoverflow.com/a/23447489
linked to: http://stackoverflow.com/q/10291949
has comment: http://stackoverflow.com/comment/35940637
accepted answer: http://stackoverflow.com/a/23449948

http://stackoverflow.com/comment/35872788
type: Comment
type: AnswerComment
has text: yea sir i have tried and i am using hMap3 only so mistakenly i have print here and the way you are telling me its not printing....both class are servlet so because of that is there any problem...?
comment on: http://stackoverflow.com/a/23410721
score: 0

http://stackoverflow.com/q/23415986
score: 1
accepted answer: http://stackoverflow.com/a/23416244
favorite count: 0
type: AnsweredQuestion
tagged with: netbeans
has body: Is there a way in NetBeans that while you are debugging a Java program to modify or check the value that a function or variable returns. The same way you can use the console in Matlab. I'm not speaking about the usual debugging tools variable windows etc. Example I want to break at a method in car class and input &gt;car.getMileage() and get.. &gt;car.getMileage() &gt;2500 or &gt;car.setMileage(100) &gt;car.getMileage() &gt;100
tagged with: java
upvote count: 1
type: Question
possible better answer: http://stackoverflow.com/a/23416129
has answer: http://stackoverflow.com/a/23416244
answer count: 2
has comment: http://stackoverflow.com/comment/35882532
has answer: http://stackoverflow.com/a/23416129
downvote count: 0
has comment: http://stackoverflow.com/comment/35882670
has comment: http://stackoverflow.com/comment/35882595
has title: Debugging console input using NetBeans
has comment: http://stackoverflow.com/comment/35882485

http://stackoverflow.com/a/23341158
upvote count: 1
answers question: http://stackoverflow.com/q/23339388
has body: What you want is called coreference resolution. Stanford CoreNLP does that already. I couldn't find a demo of it is done programatically, but if you are running the precompiled executable you need to add dcoref to the list of annotators like this: java -cp &lt;all jars&gt; edu.stanford.nlp.pipeline.StanfordCoreNLP -annotators tokenize,ssplit,pos,lemma,ner,parse,dcoref -file input.txt
downvote count: 0
type: Answer
score: 1

http://stackoverflow.com/q/23292406
downvote count: 1
type: Question
has title: Passing an int value from class to another and storing it in an array in Java
score: -1
has answer: http://stackoverflow.com/a/23292481
upvote count: 0
favorite count: 0
answer count: 5
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23292494
has answer: http://stackoverflow.com/a/23292661
has body: I have got 2 classes in my java program, the first class contains a textfield in which i am getting the users input.I am trying to pass an int value from one textfield (users input) and store this value in an array that is contained in another class. Class 1 This is the first class were i am getting the data from a textfield if (SubmitButton.equals(e.getSource())) { int input = Integer.parseInt(textField1.getText()); myClass2.setAge(input ); } Class 2 This is the class I am trying to store the data from the users input from class 1 into an array public int setAge(int input) { return input; } //this is where i am trying to store the value int[] Age = {input}; For some reason the "input" cannot be resolved to a variable Can some one help please?
has answer: http://stackoverflow.com/a/23292438
tagged with: java
has answer: http://stackoverflow.com/a/23292612

2d-games
tags question: http://stackoverflow.com/q/23294175
type: Tag
tags question: http://stackoverflow.com/q/23420844
tag name: 2d-games

http://stackoverflow.com/comment/35764995
comment on: http://stackoverflow.com/q/23352522
has text: this is a correct output! You are outputting the date not the string! If you want to output the date object you have to apply the formatter on that object
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/23367548
accepted answer of: http://stackoverflow.com/q/23367052
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35792166
downvote count: 0
type: Answer
has body: What I've done in similar situations where I have to have multiple, conflicting environments is to encapsulate them into functions: function my-hadoop-env { #Hadoop variables - my version export HADOOPTWO_INSTALL=/home/parallels/Development/Hadoop/hadoop-trunk/trunk2/hadoop-dist/target/hadoop-3.0.0-SNAPSHOT export PATH=$PATH:$HADOOPTWO_INSTALL/bin export PATH=$PATH:$HADOOPTWO_INSTALL/sbin export HADOOP_MAPRED_HOME=$HADOOPTWO_INSTALL export HADOOP_COMMON_HOME=$HADOOPTWO_INSTALL export HADOOP_HDFS_HOME=$HADOOPTWO_INSTALL export YARN_HOME=$HADOOPTWO_INSTALL export HADOOP_COMMON_LIB_NATIVE_DIR=$HADOOPTWO_INSTALL/lib/native export HADOOP_OPTS="$HADOOP_OPTS -Djava.library.path=$HADOOPTWO_INSTALL/lib/" } function hadoop-env { #Hadoop variables - version 2.2.0 export HADOOP_INSTALL=/home/parallels/Development/Hadoop/hadoop-2.2.0 export PATH=$PATH:$HADOOP_INSTALL/bin export PATH=$PATH:$HADOOP_INSTALL/sbin export HADOOP_MAPRED_HOME=$HADOOP_INSTALL export HADOOP_COMMON_HOME=$HADOOP_INSTALL export HADOOP_HDFS_HOME=$HADOOP_INSTALL export YARN_HOME=$HADOOP_INSTALL export HADOOP_COMMON_LIB_NATIVE_DIR=$HADOOP_INSTALL/lib/native export HADOOP_OPTS="$HADOOP_OPTS -Djava.library.path=$HADOOP_INSTALL/lib/" } Then when opening a shell, execute the appropriate my-hadoop-env or hadoop-env function to pull in the environment you want in that shell. If you're feeling crafty you can even make them modify PS1 so it's clear which one your'e in.
upvote count: 3
answers question: http://stackoverflow.com/q/23367052
has comment: http://stackoverflow.com/comment/35792243
score: 3

http://stackoverflow.com/q/23374039
has body: Could anyone give an example of how one activity would launch another in android? Building my first android app thanks. Thanks
tagged with: java
has answer: http://stackoverflow.com/a/23374076
type: Question
answer count: 2
score: -7
favorite count: 0
tagged with: android
downvote count: 7
has title: One Activity to Launch another?
has comment: http://stackoverflow.com/comment/35804743
upvote count: 0
has answer: http://stackoverflow.com/a/23374090
type: UnansweredQuestion

http://stackoverflow.com/comment/35858488
has text: As soon as d goes out of scope, if the object referenced by d is not reachable anymore, then it becomes eligible to GC. You seem to be obsessed about memory usage. Don't. The Java garbage collector works well. Learn OO design. And anyway, if that's not clear anough yet, you shouldn't create a MyDialog instance anyway.
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/23403465

http://stackoverflow.com/comment/35814598
score: 0
has text: Have a look at java.util.PriorityQueue. It's not a set, but it does keep elements arranged in order and makes pruning easy.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23378906

http://stackoverflow.com/q/23300815
has title: Access denied to user MySQL Java Openshift
tagged with: openshift
type: AnsweredQuestion
tagged with: java
has body: I am using Openshift and installed Tomcat 7 (JBoss EWS 2.0) and Mysql 5.5. My application is based on Struts 2 where i have provided database connectivity details in struts.xml. now after giving details like host and password. it still not able to connect. i have two concerns. 1-- How to debug when using the deployed application. I can see the log but its not detailed. both the application and database in is openshift and have added catridge of Jboss and mysql. is it sufficient?? 2.-- How to use openshift db from my locally deployed application. it says unable to connect.
tagged with: mysql
tagged with: jboss
type: Question
has answer: http://stackoverflow.com/a/23300855
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/23300855

http://stackoverflow.com/a/23439075
downvote count: 0
has body: I think you're looking for System.arraycopy, which you can use to copy the contents of one array into another: String[] source = /* ... the new data ... */; String[] destination = /* ... array returned by getAuthor() ... */; System.arraycopy(source, 0, destination, 0, source.length); This assumes that the destination array already exists (is non-null), and has the same length.
score: 1
has comment: http://stackoverflow.com/comment/35927500
answers question: http://stackoverflow.com/q/23439015
upvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/35926939

http://stackoverflow.com/a/23361678
accepted answer of: http://stackoverflow.com/q/23360975
answers question: http://stackoverflow.com/q/23360975
type: Answer
has body: You just have to bind an execution of the plugin to a phase (e.g. "install" in your example): my-profile maven-release-plugin 2.4.1 install prepare <updateWorkingCopyVersions>false</updateWorkingCopyVersions>
score: 2
downvote count: 0
upvote count: 2
has comment: http://stackoverflow.com/comment/35781761
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35782071
has comment: http://stackoverflow.com/comment/35780745

http://stackoverflow.com/q/23390612
linked to: http://stackoverflow.com/q/18304804
type: Question
upvote count: 4
has comment: http://stackoverflow.com/comment/35834523
has comment: http://stackoverflow.com/comment/35834275
has comment: http://stackoverflow.com/comment/35834437
has comment: http://stackoverflow.com/comment/35834598
has body: I need to get position of the first letter in a string. Follow a basic example. The first letter is T, So I need to know the position of T, for that I can use indexOf("T"). I would like to get the first letter by regex instead to add the letter hard-coded (T). Thanks in advance. public class RegexMatches { public static void main(String args[]) { String line = "000 1 This is my message"; int first = line.indexOf("T"); line = line.substring(first, line.length()); System.out.println(line); } }
favorite count: 0
answer count: 3
has answer: http://stackoverflow.com/a/23390700
has comment: http://stackoverflow.com/comment/35834516
linked to: http://stackoverflow.com/q/8938498
has title: How to get position of the first letter in a string
has answer: http://stackoverflow.com/a/23390754
tagged with: regex
has answer: http://stackoverflow.com/a/23390740
possible better answer: http://stackoverflow.com/a/23390700
has comment: http://stackoverflow.com/comment/35834329
has comment: http://stackoverflow.com/comment/35834394
has comment: http://stackoverflow.com/comment/35834488
downvote count: 2
linked to: http://stackoverflow.com/q/2615749
score: 2
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/23390740

http://stackoverflow.com/a/23329059
downvote count: 0
has comment: http://stackoverflow.com/comment/35723869
has comment: http://stackoverflow.com/comment/35723440
has body: You should constantly ask for the inputstream of the client.. put it in the loop that always accept for the client input.. example: public static class ThreadSer extends Thread { private Socket s; public ThreadSer(Socket s) { this.s = s; } @Override public void run() { try { String response = "This is the IP: " + s.getLocalAddress() + " that has come via port: " + s.getLocalPort() + "\r\n"; ObjectInputStream input = new ObjectInputStream(s.getInputStream()); while(true) { Object object = input.readObject(); if(object instanceof String) { String command = ((String) object).trim(); if(command.equals("stop")) break; } } s.close(); } catch (IOException e) { System.err.println(e); } }}}
has comment: http://stackoverflow.com/comment/35723611
upvote count: 2
type: Answer
answers question: http://stackoverflow.com/q/23328914
score: 2
has comment: http://stackoverflow.com/comment/35723426

http://stackoverflow.com/comment/35731240
score: 0
type: AnswerComment
has text: if its working now you can accept the answer :) also open a new post for a new problem and i will try helping you there
comment on: http://stackoverflow.com/a/23321081
type: Comment

http://stackoverflow.com/comment/35822594
comment on: http://stackoverflow.com/a/23380950
type: AnswerComment
type: Comment
score: 0
has text: I think @stema has given the perfect answer for this. please vote me up instead of voting down, because he/she has understand the problem at first ..

http://stackoverflow.com/q/23334150
has answer: http://stackoverflow.com/a/23334289
answer count: 3
has answer: http://stackoverflow.com/a/23334340
favorite count: 0
has title: Java Object graph validation
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23334255
upvote count: 1
has body: I have java object Map&lt;Integer, SortedMap&lt;Integer, Pair&lt;Integer, String&gt;&gt;&gt; data. I am passing this object to recursive method to build objects of each key in the above map. Please see the example below. For ex, &lt;1 - &lt;1, Pair&lt;1, 'A'&gt;&gt; &lt;2 - &lt;1, Pair&lt;1, 'A'&gt;&gt; &lt;2, Pair&lt;2, 'B'&gt;&gt; I want to check the circular dependency on the above map. Please see the example below. &lt;9994 - &lt;1, Pair&lt;9995, 'X'&gt;&gt; &lt;2, Pair&lt;2, 'B'&gt;&gt; &lt;9995 - &lt;1, Pair&lt;9994, 'Y'&gt;&gt; &lt;2, Pair&lt;2, 'B'&gt;&gt; Above 9994 contains 9995 and 9995 contains 9994. This is invalid and should error out the programme. Can anyone suggest me the best way to perform this validation? Thanks. private static Boolean validate( Map> input, Set object) throws Exception { Boolean result = true; for (Pair cal : input.values()) { if (!object.add(cal.left)) return false; result = validate(get(cal.left), object); } return result; }
tagged with: recursion
score: 1
tagged with: java
type: Question
downvote count: 0

http://stackoverflow.com/comment/56062421
type: Comment
score: 8
has text: Part of the problem with `Random` is it is unnecessarily `synchronized`; even if you create one per-thread, it will not be as performant as `ThreadLocalRandom`.
type: AnswerComment
comment on: http://stackoverflow.com/a/23396067

http://stackoverflow.com/a/23401309
answers question: http://stackoverflow.com/q/23401274
type: Answer
downvote count: 0
has body: If I understand your question correctly, all you need is // return selection; return (selection &gt; 0 &amp;&amp; selection &lt;= price.length) ? price[selection-1] : 0; As another example, // That ternary could also be written as if (selection &gt; 0 &amp;&amp; selection &lt;= price.length) { return price[selection-1]; } return 0;
score: 1
upvote count: 1

http://stackoverflow.com/a/23385639
downvote count: 0
has comment: http://stackoverflow.com/comment/35881161
has comment: http://stackoverflow.com/comment/35880075
upvote count: 2
answers question: http://stackoverflow.com/q/23385052
has body: You can see this in Java, or C if you have multiple threads using a library which is not thread safe. In this situation, you some times get the right value and sometimes you get half right and sometimes you get non-sense. If you add a printf e.g. System.out.printf() or any IO or sleep() or step through the code using debugging, this really slows down your application so each thread spends a very small percentage of it's time in the library and thus indirectly avoids conflicts. Are you using multiple threads? Is the library/methods you are calling thread safe?
type: Answer
score: 2

http://stackoverflow.com/comment/35676799
has text: It seems you would need to scrape the Java API and the code files in your directories to find this information.
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23304483

http://stackoverflow.com/comment/35944908
has text: Instead of telling us that you've got "3 errors", why won't you tell us what are the errors you're getting? It may be all Greek to you but the error messages are there for a purpose.
type: Comment
comment on: http://stackoverflow.com/q/23449685
type: QuestionComment
score: 4

http://stackoverflow.com/q/23378071
score: 0
tagged with: python
tagged with: cmd
has answer: http://stackoverflow.com/a/23382565
has comment: http://stackoverflow.com/comment/35811818
tagged with: clipboard
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35880990
tagged with: java
has title: Copy WAV file to clipboard
type: Question
has comment: http://stackoverflow.com/comment/35845531
answer count: 1
tagged with: javascript
has body: I would like to copy a local WAV file to my clipboard using Java, Javascript, Python, or using the Windows command line. Basically I am open to ANY way to copy a WAV file to my clipboard, but those are my preferred languages for doing it. Most preferably Javascript. Please help! Thanks!

http://stackoverflow.com/a/23418119
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23418062
has comment: http://stackoverflow.com/comment/35886632
type: Answer
has body: Try this one or just use google with "java swing tutorial" or "java awt tutorial": http://zetcode.com/tutorials/javaswingtutorial/firstprograms/
has comment: http://stackoverflow.com/comment/35886832
has comment: http://stackoverflow.com/comment/35886725
has comment: http://stackoverflow.com/comment/38858032
has comment: http://stackoverflow.com/comment/35886686
answers question: http://stackoverflow.com/q/23418062
score: 0

http://stackoverflow.com/q/23391688
upvote count: 1
tagged with: design-patterns
accepted answer: http://stackoverflow.com/a/23397578
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35836591
tagged with: network-protocols
tagged with: network-programming
score: 1
tagged with: java
type: Question
has body: what are good design patterns to decide what method to call on a server based on the current connection state? Let’s say a server receives messages, and based on the current state it has to decide what to do. The obvious idea would be to use a enum: enum State{LISTEN, SYN_REC, ESTABLISHED}; State state = State.LISTEN; void msgReceived(Object msg){ if(state==State.LISTEN){ /* … */ } else if(state == State.SYN_REC){ /* … */ } else if(state == State.ESTABLISHED){ /* … */ } } This is very ugly code. Next idea was to make the enum provide a handle-method: enum State { LISTEN{ public void handle(Object msg){ /* … */ } }, SYN_REC{ public void handle(Object msg){ /* … */ } }, ESTABLISHED{ public void handle(Object msg){ /* … */ } }; public abstract void handle(Object msg); }; State state = State.LISTEN; void msgReceived(Object msg){ state.handle(msg); } looks much cleaner than the first idea, but is also problematic. The enum does not have access to attributes and methods defined on the server level. One would have to pass in all variables necessary for handle. Is there any cleaner way to do this, I would like to avoid having to define additional public classes for this?
answer count: 1
downvote count: 0
has title: Design Pattern, handle messages based on state
favorite count: 0
has answer: http://stackoverflow.com/a/23397578
has comment: http://stackoverflow.com/comment/35836631

http://stackoverflow.com/comment/35678807
has text: Why is 500k rows a problem? Can you move the group by to the outer query and change the having to a where so it filters first?
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23298165

http://stackoverflow.com/comment/35926628
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23439576
has text: I do, but this cut off counter is just bugging be a lot :)

http://stackoverflow.com/comment/35775740
comment on: http://stackoverflow.com/a/23296944
has text: One small thing, i will fail with `NullPointerException` instead of `ClassCastException`. The class cast exception would be if you have not numeric type. As is delivered from `Number` then it is unboxed via calling `.intValue()` and this raise NPE.
type: AnswerComment
type: Comment
score: 0

http://stackoverflow.com/q/23449280
type: AnsweredQuestion
score: 1
has comment: http://stackoverflow.com/comment/35947923
tagged with: java
has answer: http://stackoverflow.com/a/23449308
has body: I am facing a bit problem as I am a newbe in Java. I made two frame, the first one's name is test and the second one is Login. In the test Jframe, there are three buttons. The third one which name is "Admin" is for taking me to the second frame. How can I make the third buttonwork to take me to the second frame without closing the first frame? Thanks in advance. import javax.swing.*; import javax.swing.JButton; import javax.swing.JFrame; import java.awt.*; import java.awt.event.*; public class test extends JFrame { private static final int width = 600, height = 480; private static final int buttonWidth = 200, buttonHeight = 100; static JFrame frame; static JButton button; static JButton button2; static JButton button3; public static void main(String[] args) { createWindow(); createButtons(); addEverything(); frame.setVisible(true); } private static void createWindow() { frame = new JFrame("Welcome to Easy Hire"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(width, height); } private static void createButtons() { button = new JButton("Hire A Taxi"); button.setLocation(0, 0); button2 = new JButton("User Login"); button2.setLocation(200, 0); button3 = new JButton("Admin"); button3.setLocation(400, 0); } private static void addEverything() { addButtons(); } private static void addButtons() { frame.getContentPane().setLayout(null); frame.getContentPane().add(button); frame.getContentPane().add(button2); frame.getContentPane().add(button3); button.setSize(200,50); button2.setSize(200,50); button3.setSize(200,50); } }
type: Question
upvote count: 2
linked to: http://stackoverflow.com/q/9554636
answer count: 1
downvote count: 1
favorite count: 0
has title: How to link this frame with another frame when I click a button that opens another frame?- Java
tagged with: jframe
accepted answer: http://stackoverflow.com/a/23449308
tagged with: swing

http://stackoverflow.com/a/23300421
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/23299001
downvote count: 0
has body: You need to actually send something, all you have done in the Java class is retrieved the InetAddress and opened a socket? You need to actually do something like send a packet... Start by reading this : http://developer.android.com/reference/java/net/Socket.html Then work your way through some of these examples: http://examples.javacodegeeks.com/android/core/socket-core/android-socket-example/ Also you should make sure you add another (this time generic) error catcher, as those exceptions you handle are not the only two that could happen when playing with sockets/connection.
type: Answer

http://stackoverflow.com/a/23414382
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/23414259
type: Answer
has body: String class has a builtin method, replaceAll(), for just such an occasion. String sb = input.replaceAll("([BbCcDd...])", "$1$1"); The $1 means "whatever was in the parentheses in the pattern".
upvote count: 1

http://stackoverflow.com/comment/35750436
has text: You **can't have** two files with the same name and same extension. If the file is open, you'll get an error, else it's overwritten by the new one.
type: Comment
comment on: http://stackoverflow.com/q/23345048
score: 0
type: QuestionComment

http://stackoverflow.com/q/23324782
upvote count: 42
has title: How to use Java's lambda expressions to print an array?
score: 41
accepted answer: http://stackoverflow.com/a/23324805
has answer: http://stackoverflow.com/a/23324886
has answer: http://stackoverflow.com/a/50190245
tagged with: lambda
tagged with: java-8
possible better answer: http://stackoverflow.com/a/39684419
has body: How can I achieve the following array print using Java 8's lambda expressions? int[] values = new int[16]; // Populate values for (int value : values) { System.out.println(Integer.toUnsignedString(value, 16)); }
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/39684419
has comment: http://stackoverflow.com/comment/35713589
has answer: http://stackoverflow.com/a/23324805
tagged with: java
has answer: http://stackoverflow.com/a/23325329
has answer: http://stackoverflow.com/a/49596096
downvote count: 1
answer count: 7
favorite count: 0
has answer: http://stackoverflow.com/a/69418415

http://stackoverflow.com/comment/35861460
comment on: http://stackoverflow.com/a/23395837
score: 0
has text: Ah - i see your problem. Use the "long version" of the for loop. E.g. `for(int i=0; i < deletePeople.size(); i++) { Person p = deletePeople.get(i);}`
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/35882595
has text: @user758114 try a [`Logger`](http://docs.oracle.com/javase/8/docs/api/java/util/logging/Logger.html) or a debugger.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23415986

http://stackoverflow.com/comment/38696799
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23318644
has text: Multi-catch is supported, only JDK7 feature not supported by Android is try-with-resources
score: 11

http://stackoverflow.com/q/23361577
upvote count: 1
score: 1
tagged with: java
tagged with: database
tagged with: sqlexception
has answer: http://stackoverflow.com/a/23361726
type: Question
has title: how to insert value in ms access using java
tagged with: user-interface
downvote count: 0
tagged with: ms-access
has body: try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); con1=DriverManager.getConnection("jdbc:odbc:MyDatabase"); st1=con1.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY); System.out.println("Connect database in BallMoves1.java ......."); /*the below line giving error*/ rs1 = st1.executeQuery("insert into highscore" + " (score) " + "values('"+score+"')"); System.out.println("Score is inserted.."); System.out.println("Score......."+score); }catch(Exception e){ e.printStackTrace();} /*highscore is table and attributes of table are (sid,score). the resulting error is: Connect database in BallMoves1.java ....... java.sql.SQLException: No ResultSet was produced at sun.jdbc.odbc.JdbcOdbcStatement.executeQuery(JdbcOdbcStatement.java:258) at BallMoves1.move(BallMoves1.java:378) at BallMoves1.run(BallMoves1.java:223) at java.lang.Thread.run(Thread.java:744)*/
has comment: http://stackoverflow.com/comment/35780645
answer count: 1
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/a/23441105
type: Answer
has body: The string returned by the interceptor is the result code, which is used by the framework to build and execute result with such name configured to the action config. You have used &lt;result name="Myjsp"&gt;/MyJsp.jsp &lt;/result&gt; So, this result is available to the interceptor, which is working on action invocation and returns a result code. The interceptor stack continues invocation (and at the top action is executed) if you call actionInvocation.invoke(), which returns a result code from the invoked stack. You can also stop invoking a stack and return a result code immediately.
score: 0
answers question: http://stackoverflow.com/q/23439271

http://stackoverflow.com/comment/100069806
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23386074
has text: @mohamadaligharat Assuming that you have made sure that your own software is correct, why don't you report a bug to the ICU team instead of commenting here? This is a 5 year old question and you can't expect that anyone here will feel responsible for your problems.
score: 0

http://stackoverflow.com/q/23377809
has answer: http://stackoverflow.com/a/23377969
upvote count: 2
has comment: http://stackoverflow.com/comment/35811329
answer count: 2
downvote count: 1
favorite count: 0
possible better answer: http://stackoverflow.com/a/23377855
tagged with: text
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23377969
has body: I am new to programming and for my class we were given an assignment where in java eclipse, we had to write a program that selects a text file(notepad) which has four numbers and computes it's average. We are required to use different methods and I am stuck, I researched everywhere and could not find anything, this is as far as I got and I don't know if I am at all close, the "getTheAverage" method is my issue. import java.io.BufferedReader; import java.io.IOException; import java.io.FileReader; import javax.swing.JFileChooser; import javax.swing.JOptionPane; public class Week04 { public static void main(String[] args) throws IOException { String theFile; theFile = getTheFileName(); double theAverage; theAverage = getTheAverage(theFile); displayTheResult(theAverage,"The average is; "); } public static String getTheFileName(){ String theFile; JFileChooser jfc = new JFileChooser(); jfc.showOpenDialog(null); return theFile = jfc.getSelectedFile().getAbsolutePath(); } public static double getTheAverage(String s) throws IOException{ double theAverage = 0; FileReader fr = new FileReader(s); BufferedReader br = new BufferedReader(fr); String aLine; while ( (aLine = br.readLine()) != null) { theAverage = Double.parseDouble(s); } return theAverage; } public static void displayTheResult(double x, String s){ JOptionPane.showMessageDialog(null,s + x); } }
has answer: http://stackoverflow.com/a/23377855
has title: Computing a text file
score: 1
tagged with: java
tagged with: file
type: Question

http://stackoverflow.com/a/23416030
score: 0
type: Answer
has body: Not sure what you mean by \\s it's since you're not using regular expressions there. The following check should work: String comment = dogParkProgramMain.infoVector.elementAt(x).getComment(); if (comment == null || comment.trim().isEmpty()) { System.out.println("Blank"); } trim() function will remove all leading and trailing spaces from the string meaning that if your string only contains spaces it would end up empty after trim. This code will check for any number of spaces as opposed to only one space mentioned in your question.
accepted answer of: http://stackoverflow.com/q/23415890
answers question: http://stackoverflow.com/q/23415890
type: AcceptedAnswer

http://stackoverflow.com/comment/35833682
score: 1
comment on: http://stackoverflow.com/q/23390195
has text: What is your problem exactly? To execute HTTP requests from android, you can take a look at this post: http://stackoverflow.com/questions/3505930/make-an-http-request-with-android
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23415234
has body: LinkedHashMap Declared as such: public class Search { private LinkedHashMap&lt;String, String&gt; Pairs; What is readSurnames() Method actually doing in reference to the LinkedHashMap? Is an inputStream just basicaly a file, such as a txt file? It is this line of code particularly confusing me: Pairs.put(currentLine, processName(currentLine)); ReadSurnames: /** * Reads the surnames from the InputStream that was supplied on object * creation */ public void readSurnames() { String currentLine; Scanner scanner = new Scanner(inputStream); while (scanner.hasNext()) { currentLine = scanner.nextLine(); Pairs.put(currentLine, processName(currentLine)); } try { inputStream.close(); scanner.close(); } catch (IOException e) { System.err .println("An error occured closing the input stream and scanner"); } } Process Name: /** * Takes an initial name and processed to produce a phonetic version that * can be compared against other processed names * * @param name * The original name unprocessed name * @return The phonetic equivalent of the input name */ public String processName(String name) { name = processNonAlphabetic(name); name = processDiscardedLetters(name); name = processEquivalentLetters(name); name = processDuplicateEquivalentLetters(name); return name; }
upvote count: 1
has answer: http://stackoverflow.com/a/23415284
tagged with: linkedhashmap
score: 1
tagged with: java
tagged with: inputstream
type: Question
has comment: http://stackoverflow.com/comment/35880979
answer count: 1
downvote count: 0
has title: LinkedHashMap: function in method?
has comment: http://stackoverflow.com/comment/35880989
has comment: http://stackoverflow.com/comment/35880927
has comment: http://stackoverflow.com/comment/35880937
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/35714046
score: 1
has text: Post your code. Debugging code is hard without your code.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23324759

http://stackoverflow.com/a/23355828
has comment: http://stackoverflow.com/comment/35771054
has comment: http://stackoverflow.com/comment/35771147
upvote count: 1
has comment: http://stackoverflow.com/comment/35771135
type: Answer
has comment: http://stackoverflow.com/comment/35771130
downvote count: 0
has body: Netbeans won't let you add components to a JLabel, it doesn't see them as a valid Container. This won't be easily achieved using component labels, as the icon placement is outside of your control. A better solution might be to use a custom component, such as a JPanel and manually draw the speech bubble image yourself, then using a combination of Border and LayoutManager it would allow you to add other components to it This is a very basic example... import java.awt.Color; import java.awt.Dimension; import java.awt.EventQueue; import java.awt.Font; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.GridLayout; import java.awt.image.BufferedImage; import java.io.IOException; import javax.imageio.ImageIO; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; import javax.swing.border.EmptyBorder; public class SpeechBubble { public static void main(String[] args) { new SpeechBubble(); } public SpeechBubble() { EventQueue.invokeLater(new Runnable() { @Override public void run() { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) { } SpeechBubblePane bubble = new SpeechBubblePane(); JLabel hello = new JLabel("Hello, I'm Myra"); hello.setFont(hello.getFont().deriveFont(28f)); hello.setForeground(Color.CYAN); JLabel message = new JLabel(" What would you like to know today? "); message.setFont(message.getFont().deriveFont(22f)); message.setForeground(Color.WHITE); bubble.setLayout(new GridLayout(2, 1)); bubble.add(hello); bubble.add(message); JFrame frame = new JFrame("Testing"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.getContentPane().setBackground(Color.BLACK); frame.add(bubble); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); } }); } public class SpeechBubbleP…
has comment: http://stackoverflow.com/comment/35771024
score: 1
answers question: http://stackoverflow.com/q/23355780

http://stackoverflow.com/q/23342774
favorite count: 0
tagged with: objectify
type: UnansweredQuestion
tagged with: google-app-engine
has answer: http://stackoverflow.com/a/23343943
has answer: http://stackoverflow.com/a/23345767
score: 1
tagged with: java
has body: I wanted to know if I can make a query to a class father and his son in the same query. @Entity public class Blog { @Getter @Setter @Id String id; @Getter @Setter int popularity; } @Entity public class Post { @Id @Getter @Setter String id; @Getter @Setter String title; @Getter @Setter long published; @Getter @Setter String locale; @Getter @Setter @Load private Ref&lt;Blog&gt; parent; // or @Parent? } This would be possible? -> Query list type Post > filter locale "Post" > order published "Post" > order popularity "Blog" Thanks.
has answer: http://stackoverflow.com/a/23598047
type: Question
tagged with: google-cloud-datastore
has title: Query with Objectify, parent and children
answer count: 3
upvote count: 1
downvote count: 0

http://stackoverflow.com/comment/35930303
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23441742
has text: @Braj via code......if not possible via code, then through external libraries........
type: Comment

http://stackoverflow.com/q/23313487
has title: Graphics2D stroke spikes on Java
tagged with: text
has body: I'm having a problem with graphics 2d stroke, it seems no one has this problem since I have searched for something alike and no results. Here is the image. As you can see, there are spikes on my stroke, I don't want those. Here is my code. The class is extended to JButton and the method is paintComponent. Graphics2D g2d = (Graphics2D)g2.create(); TextLayout tl = new TextLayout(getText(), getFont(), g2d.getFontRenderContext()); Shape to = tl.getOutline(null); int x = (getSize().width-to.getBounds().width)/2; int y = (getSize().height+(to.getBounds().height-8))/2; System.out.println(to.getBounds().height); g2d.translate(x, y); g2d.setStroke(new BasicStroke(15.0f)); g2d.setColor(new Color(155,155,155)); g2d.draw(to); g2d.dispose(); When lowering the stroke thickness, the spike goes smaller too.
has comment: http://stackoverflow.com/comment/35697594
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/31574168
upvote count: 3
tagged with: java
tagged with: outline
tagged with: stroke
type: Question
tagged with: graphics
score: 3
accepted answer: http://stackoverflow.com/a/31573921
has comment: http://stackoverflow.com/comment/35693025
answer count: 2
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/35694003
has comment: http://stackoverflow.com/comment/35694742
has answer: http://stackoverflow.com/a/31573921
possible better answer: http://stackoverflow.com/a/31574168
has comment: http://stackoverflow.com/comment/35695434

http://stackoverflow.com/comment/35718045
type: Comment
has text: store the return value of file.delete() in a boolean and check the boolean instead of invoking delete twice.
score: 0
comment on: http://stackoverflow.com/q/23326833
type: QuestionComment

http://stackoverflow.com/q/23294304
tagged with: eclipse
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/35658088
type: UnansweredQuestion
has body: This is my code. When i execute at a time it gives below error. Initial SessionFactory creation failed.org.hibernate.HibernateException: Dialect class not found: org.hibernate.dialect.MySQL5InnoDBDialectt package com.bis.stock; import org.hibernate.SessionFactory; import org.hibernate.cfg.Configuration; public class HibernateUtil { private static SessionFactory sessionFactory = buildSessionFactory(); private static SessionFactory buildSessionFactory() { try { //Create the SessionFactory from hibernate.cfg.xml sessionFactory = new Configuration().configure("hibernate/Hibernate.cfg.xml").buildSessionFactory(); return new Configuration() .configure() .buildSessionFactory(); } catch (Throwable ex) { System.err.println("Initial SessionFactory creation failed." + ex); throw new ExceptionInInitializerError(ex); } } public static SessionFactory getSessionFactory() { return sessionFactory; } }
tagged with: java
tagged with: hibernate
type: Question
has title: Dialect class not found. \when using hibernate
has answer: http://stackoverflow.com/a/23294582
has comment: http://stackoverflow.com/comment/35657983

http://stackoverflow.com/comment/35767014
type: AnswerComment
comment on: http://stackoverflow.com/a/23352795
type: Comment
has text: i wonder, why exactly 534 (and yeah, it's not working)?.. well, ok, thanks for navigating)
score: 0

http://stackoverflow.com/comment/35893998
type: AnswerComment
comment on: http://stackoverflow.com/a/23421465
has text: Tried this and it is giving me complete response... String url1 = "http://irctc.co.in/"; URL obj = new URL(url1); URLConnection con = obj.openConnection(); con.setConnectTimeout(0); con.setReadTimeout(0); InputStreamReader input = new InputStreamReader(con.getInputStream()); BufferedReader in = new BufferedReader(input); String inputLine; String fullline = ""; while ((inputLine = in.readLine()) != null) { fullline = fullline.concat(inputLine); } System.out.println(fullline);
type: Comment
score: 0

http://stackoverflow.com/comment/35768838
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23354703
has text: Good point about the use of private variables. However, I don't think he's working with instances though, just based on the structure of his question. It looks like he wants to do ClassA.SOMETHING which is where he's getting `static` from.
type: AnswerComment

http://stackoverflow.com/q/23344398
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23345202
score: 0
tagged with: java
type: Question
tagged with: caching
has answer: http://stackoverflow.com/a/23345202
answer count: 1
tagged with: neo4j
has title: Setting Neo4j cache
has body: I'm using Neo4j 1.9.4 for a project and I run into a strange behavior : I have this piece of code that works well. I've set the classpath with a ivy file and all is ok. public static void main(String[] args) { // the cache providers ArrayList&lt;CacheProvider&gt; cacheList = new ArrayList&lt;CacheProvider&gt;(); System.out.println("Creating db configuration"); cacheList.add(new SoftCacheProvider()); // the kernel extensions LuceneKernelExtensionFactory lucene = new LuceneKernelExtensionFactory(); List&lt;KernelExtensionFactory&lt;?&gt;&gt; extensions = new ArrayList&lt;KernelExtensionFactory&lt;?&gt;&gt;(); extensions.add(lucene); // the database setup GraphDatabaseFactory gdbf = new GraphDatabaseFactory(); gdbf.setKernelExtensions(extensions); gdbf.setCacheProviders(cacheList); GraphDatabaseService db = gdbf.newEmbeddedDatabase("/tmp/test"); } The problem is when I try to change cacheList.add(new SoftCacheProvider()) into cacheList.add(new WeakCacheProvider()) I get the following error : java.lang.IllegalArgumentException: No provider for cache type 'soft'. Cache providers are loaded using java service loading where they register themselves in resource (plain-text) files found on the class path under META-INF/services/org.neo4j.kernel.impl.cache.CacheProvider. This missing provider may have been caused by either such a missing registration, or by the lack of the provider class itself. at org.neo4j.kernel.InternalAbstractGraphDatabase.create(InternalAbstractGraphDatabase.java:356) at org.neo4j.kernel.InternalAbstractGraphDatabase.run(InternalAbstractGraphDatabase.java:252) at org.neo4j.kernel.EmbeddedGraphDatabase.&lt;init&gt;(EmbeddedGraphDatabase.java:106) at org.neo4j.graphdb.factory.GraphDatabaseFactory$1.newDatabase(GraphDatabaseFactory.java:88) at org.neo4j.graphdb.factory.GraphDatabaseBuilder.newGraphDatabase(GraphDatabaseBuilder.java:207) at org.neo4j.graphdb.factory.GraphDatabaseFactory.newEmbeddedDatabase(GraphDatabaseFactory.java:69) at ttt.App.main(App.j…

http://stackoverflow.com/comment/35726399
comment on: http://stackoverflow.com/a/23331624
has text: That's not true at all, and I feel that it could be made a bit more apparent by pushing `p` into the `else` clause. If `first` is `null`, we only assign the reference we create to it. If it isn't, then we're okay.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/35916759
has text: @ Steven Magana-Zook Thank you for being so helpful. I changed the method problems to return a string called s. so in order to have it grab each line should something like this work? String s = scanner.nextLine(); then return s? will this just return each line when the method is invoked? so if I add jl.setText(s); onclick of the JButton this should be fine?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23433789
score: 0

http://stackoverflow.com/q/23346966
has comment: http://stackoverflow.com/comment/35754010
type: UnansweredQuestion
tagged with: double
has body: I am working on a small app to deposit and withdraw funds from a bank account. The program is running mostly fine, but I am getting strange output from some of the transactions with a lot of trailing decimals. I am randomly generating doubles that should only have 2 decimals, so I'm not sure where they are coming from. C:\Users\Jon\Documents\Class\Java&gt;java SavingsAccountTest Balance: 62.0 Deposit Count: 0 Withdraw Count: 0 Annual Interest Rate: 0.09 Service Charges: 0.0 Active: false Withdraw first, then deposit using randomly generated amounts. Balance: 62.0 Withrdaw: Deposit: 8.76 35.43 Your account is inactive due to: Insufficient Funds ***Unable to complete withdrawal.*** Balance: 97.43 Withrdaw: Deposit: 16.83 3.98 Balance: 84.58000000000001 Withrdaw: Deposit: 99.44 35.2 Your account is inactive due to: Insufficient Funds ***Unable to complete withdrawal.*** Press enter to continue. C:\Users\Jon\Documents\Class\Java&gt; The issue is with the second transaction, beginning the third set of transactions with a balance of 84.58000000000001. Here is the code for my main class. import java.util.Random; import java.util.Scanner; public class SavingsAccountTest { public static void main(String[] args) { Random rand = new Random(); double[] depositArray = {(double)rand.nextInt(10001)/100, (double)rand.nextInt(10001)/100, (double)rand.nextInt(10001)/100}; double[] withdrawArray = {(double)rand.nextInt(10001)/100, (double)rand.nextInt(10001)/100, (double)rand.nextInt(10001)/100}; SavingsAccount account = new SavingsAccount((double)rand.nextInt(101), (double)(rand.nextInt(10)+1)/100.0); System.out.print(account.toString()); System.out.println("\n\n\tWithdraw first, then deposit using\n\trandomly generated amounts."); for (int i = 0; i &lt; 3; i++) { System.out.println("\nBalance: " + account.getBalance()); System.out.print("Withrdaw:\t\tDeposit:\n" + withdrawArray[i] + "\t\t\t" + depositArray[i] + "\n\n"); account.withdraw(withdrawArray[i]); account.deposit(depositArra…
has comment: http://stackoverflow.com/comment/35754049
has answer: http://stackoverflow.com/a/23347393
score: 2
has answer: http://stackoverflow.com/a/23351249
upvote count: 3
tagged with: java
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/35754281
has comment: http://stackoverflow.com/comment/35754360
linked to: http://stackoverflow.com/q/1661273
has comment: http://stackoverflow.com/comment/35754017
tagged with: floating-point-precision
has comment: http://stackoverflow.com/comment/35754091
tagged with: random
answer count: 3
has title: Error with Random.nextDouble math
has answer: http://stackoverflow.com/a/23347158
has comment: http://stackoverflow.com/comment/35754604
favorite count: 0

http://stackoverflow.com/comment/35901317
score: 0
type: Comment
type: QuestionComment
has text: What Java application do you try to open? Open http://download.oracle.com/otndocs/products/javafx/2/samples/Ensemble/index.html : does the console open for this?
comment on: http://stackoverflow.com/q/23306305

http://stackoverflow.com/a/67171905
type: Answer
answers question: http://stackoverflow.com/q/23394535
score: 0
has body: Post increment x++; x += 1; Post decrement x--; x -=1; Pre increment : ++x; Pre decrement : --x; According to the Head First Java: Difference between x++ and ++x : int x = 0; int z = ++x; Produces: x is 1, x is 1 in x = 0; int z = x++; Produces: x is 1, z is 0

http://stackoverflow.com/q/23428243
has comment: http://stackoverflow.com/comment/35904631
accepted answer: http://stackoverflow.com/a/23429109
tagged with: servlets
score: 0
has comment: http://stackoverflow.com/comment/35904688
answer count: 2
has body: I am trying to create a small web application for a bank as part of learning servlets and jsps. The following servlet is giving the following error. Can anyone explain? Code: protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html"); String dbURL = request.getServletContext().getInitParameter("dbURL"); String userName = request.getServletContext().getInitParameter("userName"); String passWord = request.getServletContext().getInitParameter("password"); System.out.println("dbURL = " + dbURL); System.out.println("userName = " + userName); System.out.println("passWord = " + passWord); Connection connection = null; PreparedStatement preparedStatement = null; ResultSet rs = null; boolean isValid = false; String empName = (String) request.getAttribute("userName"); System.out.println("empName = " + empName); String empPassCode = (String) request.getAttribute("password"); System.out.println("empPassCode = " + empPassCode); try { connection = DriverManager.getConnection(dbURL, userName, passWord); String query = "select password from t_employees where emp_name = ?"; preparedStatement = connection.prepareStatement(query); preparedStatement.setString(1, empName); rs = preparedStatement.executeQuery(); while (rs.next()) { String passCode = rs.getString("password"); System.out.println("passCode = " + passCode); if (empPassCode != null &amp;&amp; empPassCode.equals(passCode)) { isValid = true; } } if (isValid) { request.getRequestDispatcher("emp-welcome.jsp"); } else { request.getRequestDispatcher("login-error.jsp"); } } catch (SQLException ex) { ex.printStackTrace(); } } JBoss Error: 16:59:56,167 INFO [stdout] (http--127.0.0.1-8080-2) empName = null 16:59:56,167 INFO [stdout] (http--127.0.0.1-8080-2) empPassCode = null 16:59:56,185 ERROR [stderr] (http--127.0.0.1-8080-2) java.sql.SQLException: No suitable driver found for "jdbc:mysql://localhost:3306/bank_db" 16:59:56,323 ERROR [stde…
has comment: http://stackoverflow.com/comment/35904803
has title: Why the following servlet gives "No suitable driver found error"?
linked to: http://stackoverflow.com/q/1911253
duplicate of: http://stackoverflow.com/q/1911253
has answer: http://stackoverflow.com/a/23429109
has answer: http://stackoverflow.com/a/23428568
tagged with: java
tagged with: mysql
linked to: http://stackoverflow.com/q/5616898
possible better answer: http://stackoverflow.com/a/23428568
type: Question
type: AnsweredQuestion

http://stackoverflow.com/a/23381338
downvote count: 0
answers question: http://stackoverflow.com/q/23380770
type: Answer
upvote count: 3
has body: I quite understand the algorithm of your code. Unfortunately, I don't see anything wrong with the snippet that you posted. That's why you should always use Unit Tests while you code. :) Unit test the setProtectedSquares() Unit test the testCheckWhite() Unit test the testcCheckBlack() Unit test THEN REFACTOR the for(Square s : ChessBoard.BOARD_SQUARES) {...} These will help you in the long run. However, if you want to solve (hopefully) things quicker, use the debugger mode from your IDE.
score: 3
accepted answer of: http://stackoverflow.com/q/23380770
type: AcceptedAnswer

heap-memory
tag name: heap-memory
tags question: http://stackoverflow.com/q/23316223
tags question: http://stackoverflow.com/q/23359868
tags question: http://stackoverflow.com/q/23433567
tags question: http://stackoverflow.com/q/23381104
tags question: http://stackoverflow.com/q/23401318
tags question: http://stackoverflow.com/q/23371377
tags question: http://stackoverflow.com/q/23334018
type: Tag
tags question: http://stackoverflow.com/q/23296361
tags question: http://stackoverflow.com/q/23315999

http://stackoverflow.com/a/23349351
score: 0
upvote count: 1
downvote count: 1
answers question: http://stackoverflow.com/q/23349296
type: Answer
has comment: http://stackoverflow.com/comment/35778486
has body: Try Amazon AWS, the performance is according to the hardware you rent. And don't underestimate using your own hardware, if you can afford it.

http://stackoverflow.com/a/23402644
upvote count: 1
type: AcceptedAnswer
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/23401520
has body: You need to register the listener with your spinner like below code if you are implementing the OnItemSelectedListener like you are doing in the code provided by you. then register the listener like this spinner.setOnItemSelectedListener(this); or if you are creating a new class implementing the OnItemSelectedListener interface. then you can register that class with your spinner view like this spinner.setOnItemSelectedListener(new MyCustomListener()); private class MyCustomListener implements OnItemSelectedListener { @Override public void onItemSelected(AdapterView&lt;?&gt; arg0, View arg1, int arg2, long arg3){ // Write your logic what you want to do on selecting the item } @Override public void onNothingSelected(AdapterView&lt;?&gt; arg0) { } }
type: Answer
answers question: http://stackoverflow.com/q/23401520

osx-mavericks
type: Tag
tags question: http://stackoverflow.com/q/23411637
tag name: osx-mavericks

http://stackoverflow.com/a/23350906
has comment: http://stackoverflow.com/comment/35806647
type: AcceptedAnswer
has body: I think you want make this You can use @JsonProperty("MyClassAbc") So you can rename the "RootName" class MyInterfaceList{ @JsonProperty("MyClassAbc") private List&lt;MyClass&gt; list; public List&lt;MyClass&gt; getList(){ return list; } public void setList(List&lt;MyClass&gt; list){ this.list =list; } }
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/23350018
answers question: http://stackoverflow.com/q/23350018
upvote count: 1
score: 1

http://stackoverflow.com/q/23393657
accepted answer: http://stackoverflow.com/a/23393957
has title: Bug in Eclipse? org.eclipse.jdt.internal.compiler.lookup.ArrayBinding cannot be cast to org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding
has body: The following obviously incorrect code (inspired by @dexter's answer to a question of mine): Class&lt;? extends Exception&gt;[] exceptions; try { // some stuff here } catch (exceptions[0] e) { // some more stuff here } causes Eclipse to frequently pop up a dialog box titled "Problem Occurred" with the following message: 'Building workspace' has encountered a problem. Errors occurred during the build. The dialog offers the following 'Details': Errors occurred during the build. Errors running builder 'Java Builder' on project 'test'. org.eclipse.jdt.internal.compiler.lookup.ArrayBinding cannot be cast to org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding Eclipse does place red squiggles under exceptions[0], but if I mouse over them, it doesn't have any error associated with them. Instead, it also places a red (x) in the very top of the margin and squiggles the first letter of the first line in the file (the p in package ...) and if I mouse over that, I get: Internal compiler error: java.lang.ClassCastException: org.eclipse.jdt.internal.compiler.lookup.ArrayBinding cannot be cast to org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding at org.eclipse.jdt.internal.compiler.ast.TryStatement.verifyDuplicationAndOrder (TryStatement.java:1191) Is this a bug in Eclipse? If so, what's the best place to report it? Also (to make this question it useful to someone who runs into the same issue), is there a good way to locate the source of such a build error, if it's buried somewhere deep in the code? The only information I get from the error messages is the project name in the details of the dialog, which may not be too helpful if there are many other problems with the project (taking over someone else's work, for example). Are there other places, where I can find more information about the exact location of this error, like at least a file-name?
has answer: http://stackoverflow.com/a/56538889
linked to: http://stackoverflow.com/q/23188913
answer count: 3
downvote count: 0
possible better answer: http://stackoverflow.com/a/56538889
favorite count: 0
upvote count: 2
has answer: http://stackoverflow.com/a/23393957
score: 2
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/23393946
tagged with: eclipse
type: Question

http://stackoverflow.com/q/23355831
has body: I'm making a game in JavaFX and my professor gave us a minimal game engine that includes a KeyManager convenience class with a method for checking if a key is pressed. The only problem with this is that this then checks if a key is pressed during each iteration of the game loop. At 60fps, this means that even quickly and lightly typing a key detects it as being pressed several times in a row. This sends objects flying to the sides of the screen way too quickly. I've been trying to set up a setOnKeyReleased handler for the game, but I can't seem to get it to work. I think my problem is that I'm not adding it to the right node, but I've tried everything in my game. I've tried game.getScene().setOnKeyReleased etc, primaryStage.getScene().setOnKeyReleased, and the same for every node I have in the game. I don't have anything clickable in the game, so I don't see how the focus can change or anything. The game will have objects move based on the key pressed, but I'm just trying to get it to print to the console for testing to figure out where it works: primaryStage.getScene().setOnKeyReleased(new EventHandler &lt;KeyEvent&gt;() { public void handle(KeyEvent k) { System.out.println(k.getCode().toString()); }//handle });//setOnKeyReleased I've literally hit a brick wall and can't figure it out. I've tried several guides and suggestions online to no avail. Thanks for your help.
upvote count: 1
answer count: 1
has answer: http://stackoverflow.com/a/23356396
favorite count: 0
has title: Unable to get setOnKeyReleased to work in JavaFX
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
tagged with: javafx
accepted answer: http://stackoverflow.com/a/23356396
type: Question

http://stackoverflow.com/comment/35817301
comment on: http://stackoverflow.com/q/23380377
has text: @looser: There is no guarantee gc happens as on request. Compiler may ignore the request.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35687050
comment on: http://stackoverflow.com/q/23309998
type: Comment
type: QuestionComment
has text: you change the method signature that may come from an interface or super class...
score: 0

http://stackoverflow.com/q/23434252
score: 159
answer count: 10
has answer: http://stackoverflow.com/a/47306625
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23846361
has answer: http://stackoverflow.com/a/23434603
has answer: http://stackoverflow.com/a/65151249
tagged with: log4j2
has comment: http://stackoverflow.com/comment/35916198
accepted answer: http://stackoverflow.com/a/23434603
has answer: http://stackoverflow.com/a/75423256
type: Question
linked to: http://stackoverflow.com/q/3837801
linked to: http://stackoverflow.com/q/24158273
has answer: http://stackoverflow.com/a/79068119
tagged with: java
possible better answer: http://stackoverflow.com/a/44678752
has answer: http://stackoverflow.com/a/41717213
has answer: http://stackoverflow.com/a/44678752
has title: Programmatically change log level in Log4j2
has body: I'm interested in programmatically changing the log level in Log4j2. I tried looking at their configuration documentation but that didn't seem to have anything. I also tried looking in the package: org.apache.logging.log4j.core.config, but nothing in there looked helpful either.
has answer: http://stackoverflow.com/a/49535283
upvote count: 159
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/32019244

http://stackoverflow.com/comment/35884294
has text: Just what I was looking for. I still have more string literals than i'd like, but this definitely cuts down on the boilerplate and brittle String-concatenation code. Thanks.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23398391
type: AnswerComment

http://stackoverflow.com/comment/35706198
has text: Not really an answer, but: Could you try and use `@SessionScoped` instead of the `@Scope` annotation? Does this work with other session scoped beans? Also I would expect `@ManagedBean instead of the component annotation. Which framework do you use for the beans?
type: QuestionComment
comment on: http://stackoverflow.com/q/23320828
score: 0
type: Comment

http://stackoverflow.com/q/23295373
has body: Is there any function/method that I can use that'll add lines to the devices build.prop? For example there is a build.prop line - pm.sleep_mode=1 And I want that line to be added to my device's build.prop when I click a button. How can I achieve this? Have searched but it only come sup with scripts?:S
upvote count: 1
tagged with: line
type: AnsweredQuestion
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/23297633
tagged with: eclipse
tagged with: class
type: Question
has title: Any way to add lines to build.prop upon clicking button?
answer count: 1
accepted answer: http://stackoverflow.com/a/23297633
downvote count: 0
favorite count: 0
tagged with: android

http://stackoverflow.com/comment/35927632
comment on: http://stackoverflow.com/q/23440143
has text: Pick single number from only one array.
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/35931617
score: 0
comment on: http://stackoverflow.com/q/23442467
type: Comment
type: QuestionComment
has text: @perencia so JMockit can't mock methods which has calls to native functions. Am I right?

http://stackoverflow.com/comment/35834980
score: 0
has text: i am using java -1.6.0_45
comment on: http://stackoverflow.com/q/23387091
type: Comment
type: QuestionComment

minecraft
tags question: http://stackoverflow.com/q/23317405
tags question: http://stackoverflow.com/q/23357584
type: Tag
tags question: http://stackoverflow.com/q/23305335
tags question: http://stackoverflow.com/q/23322293
tags question: http://stackoverflow.com/q/23302651
tag name: minecraft
tags question: http://stackoverflow.com/q/23372989

http://stackoverflow.com/q/23357005
has comment: http://stackoverflow.com/comment/35772968
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23358418
score: 3
has comment: http://stackoverflow.com/comment/35775399
has comment: http://stackoverflow.com/comment/35772785
has comment: http://stackoverflow.com/comment/35772866
has body: I have written a Servlet named AbcServlet.java, In this I have a Static String field called cacheSeller. It is being populated in the init and doGet method of the servlet. And it is cleared by a CacheSellerClearThread.java shown below: AbcServlet.java public class AbcServlet extends HttpServlet { private static String cacheSeller = null; @Override public void init() throws ServletException { super.init(); cacheSeller = populateCacheSeller(); } /** * As soon as multiple requests are coming doGet is being called */ @Override public void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { synchronized (this.getClass()) { if (cacheSeller == null) { cacheSeller = populateCacheSeller(); } } } private String populateCacheSeller() { String fetchItFromSomewhere = "";// some logic to fetch the sting return fetchItFromSomewhere; } public static synchronized void clearCacheSeller() { cacheSeller = null; } } CacheSellerClearThread.java /** * This thread is clearing the string field cacheSeller of AbcServlet * */ public class CacheSellerClearThread extends Thread { public void run() { while (true) { try { Thread.sleep(2000L); } catch (InterruptedException e) { e.printStackTrace(); } //Here it is clearing the static string field cacheSeller of AbcServlet AbcServlet.clearCacheSeller(); } } } if you look at the code, cacheSeller value is being read and modified in the doGet method. All the request threads will execute the doGet, at the same time CacheSellerClearThread will be clearing its value after every 2 sec. So to maintain the data integrity of cacheSeller value, I use synchronization. I need a suggestion that Is there any other way to achieve this without using explicit synchronization in the clearCacheSeller method and without applying explicit class level locking in the Servlet. (I mean to say using any advanced concurrent APIs like atomic reference or any other you can suggest.) I have written the new implementation using AtomicRef…
upvote count: 3
tagged with: multithreading
type: Question
has comment: http://stackoverflow.com/comment/35773204
tagged with: java
has title: Servlet static field exposed through a method -- Need Data Integrity
answer count: 2
has comment: http://stackoverflow.com/comment/35774657
has answer: http://stackoverflow.com/a/23358979
downvote count: 0
has comment: http://stackoverflow.com/comment/35772663

http://stackoverflow.com/comment/35870626
type: Comment
comment on: http://stackoverflow.com/a/23409704
score: 2
has text: @user2250333 If you use data structures that relies on hashcode to store the objects, you should be consistent with your class. As a rule of thumb, if you override equals, override hashcode (and vice-versae).
type: AnswerComment

http://stackoverflow.com/a/23398243
type: AcceptedAnswer
has body: So, the issue was that the URI didn't have the "http://" part. Once I added that, it all worked! :D
type: Answer
accepted answer of: http://stackoverflow.com/q/23397690
answers question: http://stackoverflow.com/q/23397690
score: 0

http://stackoverflow.com/comment/35809240
has text: I believe Narshorm was originally developed to allow implementation of a pure java web browser that could execute Javascript as appropriate.
type: Comment
score: 0
comment on: http://stackoverflow.com/a/23349804
type: AnswerComment

http://stackoverflow.com/comment/35717005
comment on: http://stackoverflow.com/a/23325121
type: Comment
has text: use `Double#compareTo()` method. for e.g. `Double.valueOf(1.2).compareTo(Double.valueOf(2.2))`
type: AnswerComment
score: 0

http://stackoverflow.com/q/23366532
tagged with: mysql
has body: When I am writing aggregate functions like SUM,SUB,MAX in mySQL query it is taking more time when for the data is gathering from multiple tales for performing aggregate functions. Is there any way to pre calculate those aggregate functions and use it in my query for better performence? For example: select sum(t1.col1),sum(t2.col1) from tab1 join on tab2
type: Question
has comment: http://stackoverflow.com/comment/35789776
has comment: http://stackoverflow.com/comment/35789943
type: UnansweredQuestion
has title: Pre calculating aggregate functions performance improvementation when using Aggregate Functions
answer count: 0
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/39772726

http://stackoverflow.com/a/23291297
answers question: http://stackoverflow.com/q/23291224
type: Answer
has comment: http://stackoverflow.com/comment/35658092
has comment: http://stackoverflow.com/comment/35661015
has body: I'd have to see the encryption code to be sure, but I expect that it works on the actual data image, and not characters. And the actual data image of a "1234567890123456" is quite different in a Java String (where each character is 16 bits) and a C++ std::string (where each character is 8 bits, at least in all but the most exotic machines).
score: 0
accepted answer of: http://stackoverflow.com/q/23291224
type: AcceptedAnswer

http://stackoverflow.com/a/23452617
type: Answer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23452537
score: 10
answers question: http://stackoverflow.com/q/23452537
has comment: http://stackoverflow.com/comment/35951716
type: AcceptedAnswer
upvote count: 10
has comment: http://stackoverflow.com/comment/35951623
has body: Edit: @StephenC is right, the JLS is a much better place to find an answer for something of this nature. Here is a link to the enhanced for loop in the language specification. In there you will find that there are a few different types of for statements it generates but none of them would call the method more than 1 time. Simple test shows that the method is only called once public class TestA { public String [] theStrings; public TestA() { theStrings = new String[] {"one","two", "three"}; for(String string : getTheStrings()) { System.out.println(string); } } public String[] getTheStrings() { System.out.println("get the strings"); return theStrings; } public static void main(String [] args) { new TestA(); } } Output: get the strings one two three So essentially they are the same thing. The only thing that may be beneficial about the 2nd would be if you want to use the array outside the for loop. Edit You got me curious about how the java compiler handled this so using the code above I decompiled the class file and heres what the result is public class TestA { public TestA() { String as[]; int j = (as = getTheStrings()).length; for(int i = 0; i &lt; j; i++) { String string = as[i]; System.out.println(string); } } public String[] getTheStrings() { System.out.println("get the strings"); return theStrings; } public static void main(String args[]) { new TestA(); } public String theStrings[] = { "one", "two", "three" }; } As you can see the compiler simply restructured your for loop into a standard loop! It also further proves that in fact they are exactly the same after the compiler gets through with it.

http://stackoverflow.com/a/53947109
has body: catch NullPointerException will not throw Exception try { Double no_of_leaves_form=Double.parseDouble(leaveapplyform.getNo_of_leaves()); }catch(NullPointerException e) { }
answers question: http://stackoverflow.com/q/23387429
type: Answer
score: 0

http://stackoverflow.com/a/37260567
type: Answer
has body: I've had this problem when running spring boot app from netbeans 8.1 on Mac. The java process was not terminated when I hit red square button in netbeans so when I relaunched the app I always get "bind exception, adress already in use" thing. This is known bug. The solution was to add spring-boot:run command to run goals of project... ...and also if you get "No plugin found for prefix 'spring-boot' in the current project and in the plugin groups" you might need to add this to dependencies: org.springframework.boot spring-boot-starter-parent 1.3.5.RELEASE spring-releases https://repo.spring.io/libs-release spring-releases https://repo.spring.io/libs-release
score: 0
answers question: http://stackoverflow.com/q/23432651

http://stackoverflow.com/comment/35745200
has text: I tried instantiating the XSSFWorkbook instead of using the factory, but it's the same delay (and it's actually more like 30 seconds).
comment on: http://stackoverflow.com/q/23330156
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23339945
has comment: http://stackoverflow.com/comment/35742539
type: Question
has comment: http://stackoverflow.com/comment/35741009
tagged with: properties-file
has comment: http://stackoverflow.com/comment/35740977
has answer: http://stackoverflow.com/a/23342517
downvote count: 0
has body: I have a property file(.properties) which is having some values that needs to be updated in the database. I can specify key with delimiter '#' like table_name#column_name#where_clause_column#where_value = value_to_be_updated Above will generate an update like(logic to generate update statement is written in Java by me) update table_name set column_name = value_to_be_updated where where_clause_column = where_value It is working fine. I want to know if this actually is the right way to go about it or is there any better way to do the same?
has title: Updating database with values in properties file in Java
answer count: 3
has comment: http://stackoverflow.com/comment/35741446
favorite count: 0
upvote count: 2
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23341384
tagged with: properties
score: 2
tagged with: java
has comment: http://stackoverflow.com/comment/35741221
has answer: http://stackoverflow.com/a/23340142

http://stackoverflow.com/a/23411216
answers question: http://stackoverflow.com/q/23409778
downvote count: 0
type: Answer
score: 2
has body: The problems all stem from the namespaces. Firstly, XPath evaluation is only defined over namespace-well-formed XML, so you need to ensure that the aa and cc prefixes are properly mapped to namespace URIs in the XML. Secondly, you need to parse the XML into a DOM tree using a namespace-aware parser (for what I can only assume are historical reasons, DocumentBuilderFactory is not namespace-aware by default). DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); dbf.setValidating(false); dbf.setNamespaceAware(true); DocumentBuilder db = dbf.newDocumentBuilder(); Document doc = db.parse(new FileInputStream(new File(fileArray[i].toString()))); Now you have a proper namespace-well-formed DOM tree you need to handle the namespaces correctly in the XPath. You need to define a NamespaceContext telling the XPath how to relate prefixes and namespace URIs. Annoyingly there's no default implementation of this interface available in the core Java libraries but there are third-party implementations such as Spring's SimpleNamespaceContext, or it's only three methods to implement it yourself. With a SimpleNamespaceContext: XPathFactory factory = XPathFactory.newInstance(); XPath xpath = factory.newXPath(); SimpleNamespaceContext nsCtx = new SimpleNamespaceContext(); xpath.setNamespaceContext(nsCtx); nsCtx.bindNamespaceUri("x", "http://www.w3.org/2001/XMLSchema-instance"); With this context in place you can now select namespaced nodes in your XPath expression: String expression = "count(//Formulas/x:yyy)"; (the prefixes you use are the ones in the NamespaceContext, not necessarily the ones in the original XML source). While some DOM parsers and XPath implementations might let you get away with parsing non-namespace-aware and omitting the prefixes in the XPath expressions, this is an implementation detail and the behaviour is not defined by the specifications. It might work in one version but fail in another, or behave differently if you add additional JARs to your proje…
upvote count: 2

http://stackoverflow.com/a/23386843
score: 0
type: Answer
has body: OSGi will use the class loader of class B to load class C. So for example if B and C reside in the same bundle but C is in an internal package it will still work. The reason is that when class B is loaded by the class loader of class A it will delegate to the classloader of the bundle where B resides. So B will be loaded with the class loader of the bundle it resides in.
answers question: http://stackoverflow.com/q/23385436

http://stackoverflow.com/comment/35872217
score: 0
type: AnswerComment
has text: I was thinking the same, but in that case why the writeObject method ask for an object instead of a Serializable?
type: Comment
comment on: http://stackoverflow.com/a/23410393

http://stackoverflow.com/comment/35715090
comment on: http://stackoverflow.com/a/23325689
type: AnswerComment
has text: Sorry, that's not it. Both of these are set to 1.8
score: 0
type: Comment

http://stackoverflow.com/a/28071581
has body: When you handle the object creation for yourself like in: registry.addInterceptor(new LocaleInterceptor()); there is no way the Spring container can manage that object for you and therefore make the necessary injection into your LocaleInterceptor. Another way that could be more convenient for your situation, is to declare the managed @Bean in the @Configuration and use the method directly, like so: @EnableWebMvc @Configuration public class WebConfig extends WebMvcConfigurerAdapter { @Bean public LocaleInterceptor localeInterceptor() { return new LocaleInterceptor(); } @Override public void addInterceptors(InterceptorRegistry registry) { registry.addInterceptor( localeInterceptor() ); } }
type: Answer
has comment: http://stackoverflow.com/comment/54002638
has comment: http://stackoverflow.com/comment/90275477
upvote count: 19
score: 19
answers question: http://stackoverflow.com/q/23349180
downvote count: 0
has comment: http://stackoverflow.com/comment/98768586

http://stackoverflow.com/comment/35893134
has text: I have the impression that [this other answer](http://stackoverflow.com/a/9855113/697630) might help.
type: Comment
comment on: http://stackoverflow.com/q/23421739
type: QuestionComment
score: 0

http://stackoverflow.com/q/23348539
favorite count: 0
tagged with: abstract
type: Question
accepted answer: http://stackoverflow.com/a/23348602
has body: A class automatically becomes abstract class when any of its method declared as abstract. I take this point in some blog. Can someone explain me Why entire class becomes abstract when we use only one abstract method.?
score: -1
has comment: http://stackoverflow.com/comment/35757109
downvote count: 1
has answer: http://stackoverflow.com/a/23348636
has answer: http://stackoverflow.com/a/23348598
tagged with: oop
tagged with: java
has answer: http://stackoverflow.com/a/23348602
answer count: 5
has title: abstract method in class
has answer: http://stackoverflow.com/a/23348772
possible better answer: http://stackoverflow.com/a/23348636
type: AnsweredQuestion
upvote count: 0
has answer: http://stackoverflow.com/a/23348639

http://stackoverflow.com/comment/35885288
type: QuestionComment
comment on: http://stackoverflow.com/q/23417279
has text: @MartinCarney It is 500
score: 0
type: Comment

http://stackoverflow.com/comment/51124336
type: Comment
comment on: http://stackoverflow.com/a/23431672
has text: Just to close a loop here: in Eclipse this bug was deliberately inserted just to mimic the behavior of javac. This has been reverted soon after the javac bug was fixed (see the references in the answer).
score: 1
type: AnswerComment

http://stackoverflow.com/comment/35908127
type: Comment
comment on: http://stackoverflow.com/a/23422413
type: AnswerComment
has text: I don't know what you are trying to achieve by having that call in the `ToString`?
score: 0

http://stackoverflow.com/comment/35831312
has text: It seems like you have some fundamental holes in your understanding of threading but I don't really have time to go through them now. Take a look at `SwingWorker` and just use that to do the work, it will handle all this for you.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23388349

http://stackoverflow.com/a/23339026
has comment: http://stackoverflow.com/comment/35739305
type: Answer
answers question: http://stackoverflow.com/q/23338962
has body: Simply have an boolean variable . Store the result of first query in the variable . if(value==true){ // Run the 2nd query } Hope this helps!
has comment: http://stackoverflow.com/comment/35739420
score: 0

http://stackoverflow.com/comment/77372356
comment on: http://stackoverflow.com/q/23385746
score: 0
type: Comment
type: QuestionComment
has text: Possible duplicate of [How do you get the past tense of a verb?](https://stackoverflow.com/questions/9520501/how-do-you-get-the-past-tense-of-a-verb)

http://stackoverflow.com/comment/35933524
type: QuestionComment
comment on: http://stackoverflow.com/q/23322276
type: Comment
has text: @skombijohn i think this is a bug or a version conflict. I still not solved it :/
score: 0

http://stackoverflow.com/a/23452058
type: Answer
has comment: http://stackoverflow.com/comment/35959577
answers question: http://stackoverflow.com/q/23449779
has comment: http://stackoverflow.com/comment/35949921
score: 0
has body: It would appear that you are not clearing the old values with each loop iteration to your setResult method. I can't say for certain since you have not posted the code for your AtBat class, but I would take a look at that method.
has comment: http://stackoverflow.com/comment/35959171

http://stackoverflow.com/a/23357920
score: 0
has body: Use regular expression to find if there are two of the same characters next to each other. Just check: https://stackoverflow.com/a/4725079/2182503
answers question: http://stackoverflow.com/q/23357692
type: Answer

http://stackoverflow.com/comment/35774371
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23350630
has text: bu it will inflate when i use layout inflator . i want to have only one button and below that all of the list is created .

http://stackoverflow.com/comment/35862195
has text: your approach is fine, try to lower the delay a bit as er your taste. And emulator does not give you a true picture of performance. try it on a real device.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23405511
score: 1

http://stackoverflow.com/comment/35770245
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/23355208
type: Comment
has text: I'll have to wait to get home before I can see if I can find a way around it, but at least we narrowed it down

http://stackoverflow.com/comment/35656268
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23291575
type: Comment
has text: @okiharaherbst Regarding traversing the array backwards seems like the easy choice, as we have to implement a minimum scalar product. We'll stick into that although that doesn't answer the question, but thanks.

http://stackoverflow.com/a/23405349
has body: If you can get the property using property tag then you should pass it to the JS function as parameter. For example populate('&lt;s:property value="#member.name"/&gt;');
type: Answer
upvote count: 1
score: 1
accepted answer of: http://stackoverflow.com/q/23402338
answers question: http://stackoverflow.com/q/23402338
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/105902314
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23456826
has text: @salyh is the messages array in messagesAdded only triggered on new messages event? (as opposed to messages deleted etc)

http://stackoverflow.com/comment/35897748
type: AnswerComment
comment on: http://stackoverflow.com/a/23424258
type: Comment
score: 0
has text: I guess that for linear classifiers should be easy since they expose just a set of coefficients, but probably it will be more complicated for non-linear ones. Anyway the question was about the best Java library for this scope that also is published in maven? I can afford to retrain the entire set classifiers if the results are going to be the same.

static
tags question: http://stackoverflow.com/q/23310633
tags question: http://stackoverflow.com/q/23323676
tags question: http://stackoverflow.com/q/23433376
tags question: http://stackoverflow.com/q/23429937
tags question: http://stackoverflow.com/q/23412650
tags question: http://stackoverflow.com/q/23364153
tags question: http://stackoverflow.com/q/23392241
tags question: http://stackoverflow.com/q/23297859
tags question: http://stackoverflow.com/q/23397722
tags question: http://stackoverflow.com/q/23404845
tags question: http://stackoverflow.com/q/23441734
tags question: http://stackoverflow.com/q/23445956
tags question: http://stackoverflow.com/q/23385493
tags question: http://stackoverflow.com/q/23318443
tags question: http://stackoverflow.com/q/23301701
tags question: http://stackoverflow.com/q/23323880
tag name: static
tags question: http://stackoverflow.com/q/23404521
tags question: http://stackoverflow.com/q/23356200
tags question: http://stackoverflow.com/q/23357207
tags question: http://stackoverflow.com/q/23359791
type: Tag
tags question: http://stackoverflow.com/q/23436096

http://stackoverflow.com/comment/35897099
comment on: http://stackoverflow.com/a/23423652
score: 0
type: Comment
has text: (Note the `for ...;`. I find it more eye frapping to use `for ... {}` Or better; `ListItem p = head; while (p.next!= null) { p = p.next; }`)
type: AnswerComment

http://stackoverflow.com/a/23425823
has body: There is no reason to flush unless: you want the peer to receive the data as soon as possible you've sent a buffered request and you're now going to read the response. In other cases it is better to allow the buffer, the Nagle algorithm, and the TCP receive window work their magic.
type: Answer
answers question: http://stackoverflow.com/q/23425545
score: 1
upvote count: 1
downvote count: 0

http://stackoverflow.com/a/23565963
type: Answer
has body: I would try to create some sort of proxy between event producers and event consumers: class EventProducer{ @Inject private Event&lt;EventObject&gt; event; public void produce(){ event.fire(new EventObject()); } } Proxy: class EventsProxy{ @Inject private Event&lt;EventObjectForY&gt; event_1; @Inject private Event&lt;EventObjectForF&gt; event_2; void observe(@Observes EventObject){ if(eventObjectEligibleForF()){ EventObjectForF f = copyEventObjectToEventObjectForF(); event_2.fire(f); } EventObjectForY y = copyEventObjectToEventObjectForY(); event_2.fire(y); } } Consumer: class EventConsumer{ public consume(@Observes EventObjectForY obj){ } } But please remember that this is just pseudo-code.
answers question: http://stackoverflow.com/q/23386874
score: 0

http://stackoverflow.com/a/23376280
upvote count: 0
score: -1
has body: You can write it using PrintWriter class PrintWriter printWriter = new PrintWriter(System.out); printWriter.write("Hello"); printWriter.flush(); printWriter.close();
has comment: http://stackoverflow.com/comment/35808581
has comment: http://stackoverflow.com/comment/35808741
type: Answer
has comment: http://stackoverflow.com/comment/35808713
has comment: http://stackoverflow.com/comment/35808630
downvote count: 1
answers question: http://stackoverflow.com/q/23376184

http://stackoverflow.com/comment/35762131
type: Comment
comment on: http://stackoverflow.com/q/23350872
type: QuestionComment
has text: Thanks! I will look more into it tomorrow!
score: 0

http://stackoverflow.com/q/23445126
type: AnsweredQuestion
tagged with: escaping
accepted answer: http://stackoverflow.com/a/23455247
tagged with: java
possible better answer: http://stackoverflow.com/a/23445626
upvote count: 1
has answer: http://stackoverflow.com/a/23445626
has body: delimiter is | escaping character is \ and string is for example "A|B\|C\\|D\\\|E|\\\\F" I want to get array: {"A", "B|C\", "D\|E", "\\F"} So delimiter can be escaped but escaping character can be also escaped. Does somebody know how to parse this in Java ? Thanks. Edit: I created this terribly looking solution. At least It works perfectly and It is possible to define escaping character, delimiter and if empty string should be removed easily. SOLUTION (Eggyal posted better one, look down): private List&lt;String&gt; parseString(String string, String delimiter, boolean removeEmpty) { String escapingChar = "\\"; String escapingCharInRegexp = "\\\\"; boolean begined = false; List&lt;String&gt; parsed = new ArrayList&lt;String&gt;(); List&lt;Integer&gt; begins = new ArrayList&lt;Integer&gt;(); List&lt;Integer&gt; ends = new ArrayList&lt;Integer&gt;(); List&lt;Integer&gt; delimitersPositions = new ArrayList&lt;Integer&gt;(); List&lt;String&gt; explodedParts = new ArrayList&lt;String&gt;(); int i; for(i = 0; i &lt; string.length(); i++) { if( ( string.substring(i, i+1).equals(escapingChar) || string.substring(i, i+1).equals(delimiter) ) &amp;&amp; !begined ) { begins.add(i); begined = true; if( i + 1 == string.length() ) { begined = false; ends.add(i+1); } } else if( ( !string.substring(i, i+1).equals(escapingChar) &amp;&amp; !string.substring(i, i+1).equals(delimiter) &amp;&amp; begined ) ) { begined = false; ends.add(i); } else if( begined &amp;&amp; string.substring(begins.get(begins.size()-1), i).indexOf(delimiter) != -1 ) { begined = false; ends.add(i); begined = true; begins.add(i); } if( ( i + 1 == string.length() &amp;&amp; begined ) ) { begined = false; ends.add(i+1); } } List&lt;Integer&gt; toRemove = new ArrayList&lt;Integer&gt;(); for( i = 0; i &lt; begins.size(); i++ ) { if( string.substring(begins.get(i), ends.get(i)).indexOf(delimiter) == -1 ) { toRemove.add(i); } } for( i = 0; i &lt; toRemove.size(); i++ ) { begins.remove(toRemove.get(i)-i); ends.remove(to…
type: Question
has answer: http://stackoverflow.com/a/23445451
downvote count: 0
has title: Split string which contains escaped delimiters
answer count: 3
has answer: http://stackoverflow.com/a/23455247
score: 1
tagged with: delimiter
favorite count: 0
tagged with: parsing

http://stackoverflow.com/comment/35827870
score: 0
type: Comment
has text: Tried on multiple devices, same problem.
type: QuestionComment
comment on: http://stackoverflow.com/q/23366588

http://stackoverflow.com/q/23434158
tagged with: super
has answer: http://stackoverflow.com/a/37770807
has comment: http://stackoverflow.com/comment/35916107
accepted answer: http://stackoverflow.com/a/37770807
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35917275
has title: What is use of super.paint(g)?
tagged with: java
possible better answer: http://stackoverflow.com/a/23434215
type: Question
downvote count: 0
has answer: http://stackoverflow.com/a/23434301
has body: Can someone explain me what is the use of super.paint(g) where, g is a Graphics variable in Applets or awt or swings or in Java. I have done research and found that it is used to override but what is the use of this override? I am a beginner. If possible can you explain the difference between paint(g) and super.paint(g) with a small example or please help me with this code? /* Let us consider this code This has only one paint declaration i.e; subclass's paint method declaration, no declaration for superclass's paint function... when we explicitly call superclass's paint function what is the use of super.paint(g) and is it going to use superclass's paint declaration?? */ import java.awt.*; import java.applet.*; /* &lt;applet code="superpaintDemo" height=768 width=1366&gt; &lt;/applet&gt; */ class superpaintDemo extends Applet { public void paint(Graphics g) { super.paint(g); g.drawString("This is Demo",200,200); } }
tagged with: applet
tagged with: awt
has comment: http://stackoverflow.com/comment/35917097
upvote count: 8
answer count: 3
has answer: http://stackoverflow.com/a/23434215
favorite count: 0
score: 8
tagged with: paint

http://stackoverflow.com/comment/35737042
comment on: http://stackoverflow.com/q/23337589
has text: We'll need more to go on than that. Wheres the code? Are you using ObjectMapper? Do you have one class? A number of classes? Are you manually deserialising? What are the rules? Whats the data structure? One approach would be to have different classes with different JsonIgnoreProperties annotations but without any information couldn't say.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23310161
downvote count: 0
has comment: http://stackoverflow.com/comment/35686833
type: Answer
has body: Debug this, and split up some calls. For instance, you have return (List&lt;Company&gt;)sessionFactory.getCurrentSession().createCriteria(Company.class).list(); Create the criteria, then get the session, then get the list, or whatever. You can test for null at each point, or you can just step through it in a debugger at that point and find out which one results in null. One problem with long lists of calls like that is not only crashing if you get a null, but not knowing which call caused the problem when you do.
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/23310041

http://stackoverflow.com/comment/35755224
comment on: http://stackoverflow.com/q/23347529
score: 0
type: Comment
type: QuestionComment
has text: You need to show us the spring controller you are using

http://stackoverflow.com/comment/35845979
score: 0
type: Comment
type: QuestionComment
has text: They need to be different? Or they have something identical? You could fix it by passing different data to activity using intents
comment on: http://stackoverflow.com/q/23396495

http://stackoverflow.com/comment/35875255
type: QuestionComment
type: Comment
has text: Why not just make the new stage modal?
score: 1
comment on: http://stackoverflow.com/q/23410412

spring
tags question: http://stackoverflow.com/q/23412408
tags question: http://stackoverflow.com/q/23364056
tags question: http://stackoverflow.com/q/23325190
tags question: http://stackoverflow.com/q/23369634
tags question: http://stackoverflow.com/q/23448351
tags question: http://stackoverflow.com/q/23359730
tags question: http://stackoverflow.com/q/23452749
tags question: http://stackoverflow.com/q/23323535
tags question: http://stackoverflow.com/q/23305771
tags question: http://stackoverflow.com/q/23317792
tags question: http://stackoverflow.com/q/23401301
tags question: http://stackoverflow.com/q/23333330
tags question: http://stackoverflow.com/q/23432813
tags question: http://stackoverflow.com/q/23417699
tags question: http://stackoverflow.com/q/23440103
tags question: http://stackoverflow.com/q/23339153
tags question: http://stackoverflow.com/q/23414138
tags question: http://stackoverflow.com/q/23381799
tags question: http://stackoverflow.com/q/23348106
tags question: http://stackoverflow.com/q/23343404
tags question: http://stackoverflow.com/q/23441482
tags question: http://stackoverflow.com/q/23446558
tags question: http://stackoverflow.com/q/23425979
tags question: http://stackoverflow.com/q/23314294
tags question: http://stackoverflow.com/q/23439084
tags question: http://stackoverflow.com/q/23416657
tags question: http://stackoverflow.com/q/23324897
tags question: http://stackoverflow.com/q/23383633
tags question: http://stackoverflow.com/q/23429814
tags question: http://stackoverflow.com/q/23348341
tags question: http://stackoverflow.com/q/23362646
tags question: http://stackoverflow.com/q/23369672
tags question: http://stackoverflow.com/q/23407622
tags question: http://stackoverflow.com/q/23431535
tags question: http://stackoverflow.com/q/23430629
tags question: http://stackoverflow.com/q/23352281
tags question: http://stackoverflow.com/q/23427502
tags question: http://stackoverflow.com/q/23383831
tags question: http://stackoverflow.com/q/23322231
tags question: http://stackoverflow.com/q/23305118
tags question: http://stackoverflow.com/q/23420268
tags question: http://stackoverflow.com/q/23316280
tags question: http://stackoverflow.com/q/23349180
tags question: http://stackoverflow.com/q/23359950
tags question: http://stackoverflow.com/q/23342940
tags question: http://stackoverflow.com/q/23326278
tags question: http://stackoverflow.com/q/23381486
tags question: http://stackoverflow.com/q/23352590
tags question: http://stackoverflow.com/q/23344346
type: Tag
tags question: http://stackoverflow.com/q/23312800
tags question: http://stackoverflow.com/q/23435720
tags question: http://stackoverflow.com/q/23341811
tags question: http://stackoverflow.com/q/23406136
tags question: http://stackoverflow.com/q/23359797
tags question: http://stackoverflow.com/q/23423552
tags question: http://stackoverflow.com/q/23304219
tags question: http://stackoverflow.com/q/23327336
tags question: http://stackoverflow.com/q/23325743
tags question: http://stackoverflow.com/q/23435335
tags question: http://stackoverflow.com/q/23341319
tags question: http://stackoverflow.com/q/23391775
tags question: http://stackoverflow.com/q/23336821
tags question: http://stackoverflow.com/q/23435615
tags question: http://stackoverflow.com/q/23445830
tags question: http://stackoverflow.com/q/23386902
tags question: http://stackoverflow.com/q/23418084
tags question: http://stackoverflow.com/q/23341054
tags question: http://stackoverflow.com/q/23348458
tags question: http://stackoverflow.com/q/23395662
tags question: http://stackoverflow.com/q/23294956
tags question: http://stackoverflow.com/q/23396645
tags question: http://stackoverflow.com/q/23391732
tags question: http://stackoverflow.com/q/23304111
tags question: http://stackoverflow.com/q/23340546
tags question: http://stackoverflow.com/q/23301499
tags question: http://stackoverflow.com/q/23320747
tags question: http://stackoverflow.com/q/23395314
tags question: http://stackoverflow.com/q/23434139
tags question: http://stackoverflow.com/q/23336240

http://stackoverflow.com/comment/35874954
type: Comment
type: QuestionComment
has text: It can consist of whitespace as well
comment on: http://stackoverflow.com/q/23412070
score: 0

http://stackoverflow.com/comment/35884027
type: Comment
has text: I have another Question, what if another class method is called from thread 1 class and i have to transfer queue value of that third class to thread 2?
comment on: http://stackoverflow.com/a/23413506
type: AnswerComment
score: 0

http://stackoverflow.com/a/23358033
answers question: http://stackoverflow.com/q/23355800
type: Answer
has comment: http://stackoverflow.com/comment/35776120
has comment: http://stackoverflow.com/comment/36822679
has comment: http://stackoverflow.com/comment/36809671
has body: This will return the average salary that DICK perceived, per year (not a specific year but all years): cursor5 = SQLiteDb.rawQuery("SELECT avg(salary) FROM " + TABLE_NAME + " WHERE user = '" + USER_ID + "' GROUP BY year", null);
has comment: http://stackoverflow.com/comment/35775929
has comment: http://stackoverflow.com/comment/36820624
has comment: http://stackoverflow.com/comment/36820911
has comment: http://stackoverflow.com/comment/35776199
has comment: http://stackoverflow.com/comment/36823193
has comment: http://stackoverflow.com/comment/36823286
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36822519
accepted answer of: http://stackoverflow.com/q/23355800
has comment: http://stackoverflow.com/comment/36808242
score: 0
has comment: http://stackoverflow.com/comment/36823062

http://stackoverflow.com/comment/35890418
comment on: http://stackoverflow.com/a/23419523
has text: Still has noise. really weird
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/35855554
score: 0
comment on: http://stackoverflow.com/q/23401709
has text: Might this also throw a `ConcurrentModificationException` because you're modifying the list without using the iterator's methods?
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23398208
has body: public static void isMatchHelper(String input, String pattern, boolean ret){ if(pattern.length() == 0 &amp;&amp; input.length() == 0){ ret = true; } else if(pattern.length() == 0){ ret = false; } else if(input.length() == 0){ ret = true; } if(pattern.length() == 0 || input.length() == 0){ return; } else if(pattern.charAt(0) == input.charAt(0)){ isMatchHelper(input.substring(1), pattern.substring(1), ret); } if(pattern.charAt(0) == '.'){ isMatchHelper(input, pattern.substring(1), ret); } if(pattern.charAt(0) == '*'){ if(pattern.length() &gt; 1){ int countMatches = 0; char compareWith = pattern.charAt(countMatches + 1); while( countMatches != input.length() &amp;&amp; input.charAt(countMatches) == compareWith){ countMatches++; } isMatchHelper(input.substring(countMatches), pattern.substring(2), ret); } else{ ret = true; } } if(pattern.charAt(0) != input.charAt(0)){ isMatchHelper(input, pattern.substring(1), ret); } } Ive tried input where it enters the first input, and ret is true, but then again, the value of ret when I check it is still false. I know this probably has to do with pass by value, I tried passing a Boolean Object, and using the Boolean.FALSE, or Boolean.TRUE, that didn't work. I passed a boolean array with 1 parameter, and that worked. My question is now more or a less a conceptual one, to improve my understanding, I'd like to know why the boolean didn't work as planned. Is this a pass by value concern, or something else? I must admit, at some point I thought using Boolean vs boolean might be the fix. I look forward to your help.
upvote count: 1
has comment: http://stackoverflow.com/comment/35848977
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/35849063
type: Question
has comment: http://stackoverflow.com/comment/35849078
has title: Why am I not able to change the value of the boolean variable in this method
tagged with: algorithm
downvote count: 0
has answer: http://stackoverflow.com/a/23398263
answer count: 1
accepted answer: http://stackoverflow.com/a/23398263
score: 1
favorite count: 0

http://stackoverflow.com/q/23310295
tagged with: stm
tagged with: transactions
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/23377864
upvote count: 1
has body: I am new to Deuce STM and was wondering how do I go about implementing a queue using Deuce STM. Here is my current working implementation - The Node class contains two fields - value and pointer to the next field. public class STMQueue { Node head, tail; public STMQueue() { Node sentinel = new Node(-1); tail = sentinel; head = sentinel; } @Atomic public void enq(int x) { Node node = new Node(x); tail.next = node; tail = node; } @Atomic public int deq() throws EmptyException{ Node node = head.next; if(node == null) { throw new EmptyException(); } int retVal = node.value; head = node; return retVal; } } Is this the correct way of implementing it? Do we have to manually throw a Transaction Exception? If this is correct, then how do we measure the number of transactions aborted or retried?
answer count: 1
favorite count: 0
has title: Queue Using Deuce STM
tagged with: atomic
downvote count: 0
type: UnansweredQuestion
tagged with: multithreading
type: Question

http://stackoverflow.com/comment/35744427
comment on: http://stackoverflow.com/q/23340255
has text: @kEN That's what it was.. I was trying to run it on an emulator that didn't support a high enough API.. Thanks!
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23415561
tagged with: algorithm
score: 1
tagged with: java
type: Question
answer count: 1
downvote count: 0
tagged with: dynamic-programming
favorite count: 0
has comment: http://stackoverflow.com/comment/36537663
has title: Memoized Rod Cutting Algorithm
has body: I'm trying to implement memoized version of recursive rod cutting algorithm. Here is my code (I implemented it from Cormen's pseudo code) public class simpleMemoized { //finds maximum of two given integers public static int max(int a, int b) { return (a &gt; b) ? a : b; } public static int MemoizedCutRod(int price, int lenght) { int[] r = new int[lenght + 1]; for (int i = 1; i &lt;= lenght; i++) { r[i] = 0; } return MemoizedCutRodAux(price, lenght, r); } public static int MemoizedCutRodAux(int price, int lenght, int[] r) { int[] priceTable = new int[11]; priceTable[1] = 1; priceTable[2] = 5; priceTable[3] = 8; priceTable[4] = 9; priceTable[5] = 10; priceTable[6] = 17; priceTable[7] = 17; priceTable[8] = 20; priceTable[9] = 24; priceTable[10] = 30; if (r[lenght] &gt;= 0) { return r[lenght]; } if (lenght == 0) { return 0; } int q = 0; for (int i = 1; i &lt;= lenght; i++) { q = max(q, priceTable[i] + MemoizedCutRodAux(price, lenght, r)); r[lenght] = q; } return q; } All outputs of this code are 0. But non memorized version of this code is working. What is the problem with it? Here is the working code: public class Simple { //finds maximum of two given integers public static int max(int a, int b) { return (a &gt; b) ? a : b; } public static int cormenCutRod(int price, int lenght) { int[] priceTable = new int[11]; priceTable[1] = 1; priceTable[2] = 5; priceTable[3] = 8; priceTable[4] = 9; priceTable[5] = 10; priceTable[6] = 17; priceTable[7] = 17; priceTable[8] = 20; priceTable[9] = 24; priceTable[10] = 30; if (lenght == 0) { return 0; } int q = 0; for (int i = 1; i &lt;= lenght; i++) { q = max(q, priceTable[i] + cormenCutRod(price, lenght - i)); } return q; }
type: UnansweredQuestion
upvote count: 1
has answer: http://stackoverflow.com/a/23758079

http://stackoverflow.com/a/23393497
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23393305
type: Answer
has body: You need to wire the mock service into the exportService object. If you have a setter for the service member variable then do this: exportService.setService(serviceMock);// add this line. exportService.export(); If you don't have a setter you will need to perform the wiring before calling export. Options for this include: Set the value of the service member variable using reflection. Write a test-only version of the Service and use a test-only version of the spring configuration xml files. Something else (that I have never done and thus don't know about).
has comment: http://stackoverflow.com/comment/35840848
upvote count: 1
has comment: http://stackoverflow.com/comment/35882929
downvote count: 1
answers question: http://stackoverflow.com/q/23393305
has comment: http://stackoverflow.com/comment/35843233

http://stackoverflow.com/a/23419399
answers question: http://stackoverflow.com/q/23419342
has body: Use a FilenameFilter object in conjunction with a regular expression to retrieve a list of the matching files in your temp folder. Then sort the result list using a custom comparator so that all files with the same 'file' part but different 'timestamp' parts are next to each other (to simplify the generation of the _1, _2, ... versions). Then iterate through your result list, renaming/moving files appropriately. Here's a sample filename filter that uses a regular expression to match file names: public class REFilenameFilter implements FilenameFilter { /** The regular expression to use when matching file names. */ final String regularExpression; /** * Constructor. * * @param expression the regular expression to use when matching file names. */ public REFilenameFilter(final String expression) { regularExpression = expression; } /** * Returns true if the file matches the regular expression. * * @param dir the directory containing the file. * @param name the name of the file. * @return true if the name of the file matches the regular expression, otherwise false. */ public boolean accept(final File dir, final String name) { // return true if the name matches the regular expression return name.matches(regularExpression); } } Here's a sample comparator (assuming your timestamp is just a long): public class TempFileComparator implements Comparator&lt;File&gt; { public int compare(final File file1, final File file2) { String[] parts1 = file1.getName().split("_"); String[] parts2 = file2.getName().split("_"); int comp = parts1[1].compareTo(parts2[1]); if(comp == 0) { Long timestamp1 = Long.parseLong(parts1[0]); Long timestamp2 = Long.parseLong(parts2[0]); comp = timestamp1.compareTo(timestamp2); } return comp; } }
score: 0
type: Answer

http://stackoverflow.com/q/23293848
type: Question
has comment: http://stackoverflow.com/comment/35657340
score: 0
has comment: http://stackoverflow.com/comment/35657539
tagged with: focus
has comment: http://stackoverflow.com/comment/35657767
answer count: 1
tagged with: jinternalframe
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23294730
has body: In my application I have 3 classes that extends JInternalframe. One is MainFrame. Suppose Mainframe has four JTextFields. TF1, TF2, TF3, TF4. When the MainFrame is opened TF1 got focus by default. Now user will press enter and go to TF2. In the next step depending on a condition Another JInternalFrame SubFrame_1 or SubFrame_2 will get opened as a floating window. SubFrame_1 has four different TextFields. TF5, TF6, TF7, TF8. Again TF5 got focus by default. Some calculations will be done here and when user presses enter in TF8 SubFrame_1 will be disposed. And the MainFrame should regain focus in TF3. The same condition may be applied to SubFrame_2. But when SubFrame_1 is disposed TF3 never gain focus. More horrible thing is that sometimes the MainFrame does not get focused when the SubFrame is disposed. How can I get rid of this issue? I've tried all sort of function requestFocusInWindow(), requestFocus(), grabFocus() etc. Please help.
tagged with: java
has comment: http://stackoverflow.com/comment/35657616
has title: JTextfield Focus between two JInternalFrame
tagged with: jtextfield

http://stackoverflow.com/q/23310585
has body: I have a problem when i am getting request parameter from exposed service and setting it to another Service, i get an error. I have tried other ways to solve this problem but i am not getting the desired output. This is the most solvable way. but i have encountered An unknown host error. I know it will give me an error. but i dunno how to resolve it. public void process(Exchange arg0) throws Exception { id = arg0.getIn().getHeader("id", String.class); id_type = arg0.getIn().getHeader("id_type",String.class) ; Aurl = EmpRestURIConstants.API_URL_PATH+id+EmpRestURIConstants.IN_BETWEEN_URL+id_type+EmpRestURIConstants.API_URL_PARAMS; System.out.println(Aurl); } }).removeHeaders("*").setHeader(Exchange.HTTP_METHOD, constant("GET")).setHeader(Exchange.HTTP_URI, simple(Aurl)) .to("http://dummyHost?bridgeEndpoint=true&amp;throwExceptionOnFailure=false") I get this Error. java.net.UnknownHostException: dummyHost at java.net.AbstractPlainSocketImpl.connect(Unknown Source) at java.net.PlainSocketImpl.connect(Unknown Source) at java.net.SocksSocketImpl.connect(Unknown Source) at java.net.Socket.connect(Unknown Source) at java.net.Socket.connect(Unknown Source) at java.net.Socket.&lt;init&gt;(Unknown Source) at java.net.Socket.&lt;init&gt;(Unknown Source) at org.apache.commons.httpclient.protocol.DefaultProtocolSocketFactory.createSocket(DefaultProtocolSocketFactory.java:80) at org.apache.commons.httpclient.protocol.DefaultProtocolSocketFactory.createSocket(DefaultProtocolSocketFactory.java:122) at org.apache.commons.httpclient.HttpConnection.open(HttpConnection.java:707) at org.apache.commons.httpclient.MultiThreadedHttpConnectionManager$HttpConnectionAdapter.open(MultiThreadedHttpConnectionManager.java:1361) at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:387) at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:171) at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397) at…
tagged with: proxy
score: 0
has answer: http://stackoverflow.com/a/23311214
type: UnansweredQuestion
tagged with: http
tagged with: java
has answer: http://stackoverflow.com/a/23313647
tagged with: apache-camel
type: Question
has title: Apache Camel proxy Unknownhost Error
answer count: 2

http://stackoverflow.com/comment/36451850
score: 0
type: Comment
has text: Your explanation why `Foo.Type` cannot be resolved makes sense. And I also think that this is probably a bug, so I filed a report with the Eclipse team: https://bugs.eclipse.org/bugs/show_bug.cgi?id=435143. Let's see what they say. If they acknowledge it, your answer was spot on and you'll get the √ ! ;)
comment on: http://stackoverflow.com/a/23717144
type: AnswerComment

http://stackoverflow.com/q/23302171
has title: ORM with joins, logic and performance interrogations (using JPA and Spring)
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35888037
tagged with: spring
has body: I have three tables : groups, users, and group_members. The groups table is bond to a Group class, users with the User class and group_members is used to model the many-to-many relationship between them. Here's what the group_members looks like id | user_id | group_id ---+---------+--------- Now let's say I want to add a member to a group knowing the group id and the user id. I have two methods: either I get the group using its id, I update his member list and save the group or I create a SQL request that directly updates group_members. Here, the second method seems less time consuming, but I have to write a specific SQL request, while with the first one I can let JPA make the job. Here's my question: is it more relevant to use the first or the second method and why? Isn't there a method so that I can let JPA do the work, without performing more requests than the second solution? Thanks.
has answer: http://stackoverflow.com/a/23409127
score: 3
downvote count: 0
tagged with: java
tagged with: orm
type: Question
tagged with: jpa
tagged with: database
upvote count: 3
answer count: 2
has answer: http://stackoverflow.com/a/23354597

http://stackoverflow.com/comment/35810551
type: QuestionComment
has text: So all of the variables on the right side of the equation are ints?
comment on: http://stackoverflow.com/q/23377377
score: 0
type: Comment

http://stackoverflow.com/q/23394233
tagged with: spring
tagged with: jakarta-ee
has body: I want to create session in Spring. but i don't want to use HttpSession session is there any other easy way in Spring. Thanks in advance.
tagged with: session
tagged with: java
has comment: http://stackoverflow.com/comment/35841259
type: Question
answer count: 1
score: 0
has answer: http://stackoverflow.com/a/23394561
has title: How to create session in Spring
type: UnansweredQuestion

http://stackoverflow.com/q/23366241
accepted answer: http://stackoverflow.com/a/23366376
has body: Using the withProperty method of the executing routine you can set several parameters of an algorithm i.e. for NSGA-II NondominatedPopulation result = new Executor() .withProblem("UF1") .withAlgorithm("NSGAII") .withMaxEvaluations(10000) .withProperty("populationSize", 50) .withProperty("sbx.rate", 0.9) .withProperty("sbx.distributionIndex", 15.0) .run(); The documentation says Each algorithm deﬁnes its own parameters. Refer to the API documentation for the exact parameter keys. Any parameters not explicitly deﬁned using the withProperty methods will be set to their default values. But I can not find these keys within NSGAII class. Can you give me a link to it. Thanks in advance
tagged with: evolutionary-algorithm
has title: Algorithm parameter keys of MOEA framework
type: AnsweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/23366376
tagged with: algorithm
answer count: 1
score: 0

http://stackoverflow.com/q/23333434
tagged with: file-io
has answer: http://stackoverflow.com/a/23333540
has comment: http://stackoverflow.com/comment/35729769
favorite count: 0
accepted answer: http://stackoverflow.com/a/23333540
has answer: http://stackoverflow.com/a/23333528
upvote count: 2
tagged with: sockets
answer count: 4
possible better answer: http://stackoverflow.com/a/23333495
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23333495
linked to: http://stackoverflow.com/q/15107104
tagged with: java
tagged with: http
type: Question
has body: I am currently trying to read in data from a server response. I am using a Socket to connect to a server, creating a http GET request, then am using a Buffered Reader to read in data. Here is what the code looks like compacted: Socket conn = new Socket(server, 80); //Request made here BufferedReader inFromServer = new BufferedReader(new InputStreamReader(conn.getInputStream())); String response; while((response = inFromServer.readLine()) != null){ System.out.println(response); } I would like to read in the data, instead of as a String, as a byte array, and write it to a file. How is this possible? Any help is greatly appreciated, thank you.
score: 2
downvote count: 0
has answer: http://stackoverflow.com/a/23333507
has title: How do you read from an InputStream in Java and convert to byte array?

http://stackoverflow.com/comment/35805654
comment on: http://stackoverflow.com/q/23374669
has text: Yup, multiple times. Unfortunately, to no avail.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35936278
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23429838
has text: Nice work thanks a lot ! I guess I was a bit bold wanting to do this with regex... I already have some of my code using regex and I didn't want to mix it with string operations. But this works great ! I changed a little bit of the code because it didn't work with : "(word1 OR word6) AND ((word2 AND word3) AND word4) AND word5" Here is what I changed : `for (Range r : ranges) { if (i >= r.getStart()) return !r.isInside(i); }` To : `for (Range r : ranges) { if (r.isInside(i)) { return false; } }`

http://stackoverflow.com/a/23385477
answers question: http://stackoverflow.com/q/23385471
type: Answer
has body: It turns out that on a modern computer architecture that uses virtual memory addressing (where the "memory space" an application sees does not actually relate to memory that's actually physically allocated), it really doesn't matter how much of this virtual "memory space" is given to an application upon startup. It doesn't mean that this much memory has been allocated by the system. If an application sees a virtual address space 10GB large all it signals to the app is that it may use memory addresses up to 10GB if it wants. However, memory is not actually allocated in physical RAM until it is actually written to, and this is done on a page-by-page basis, where a page is a 4kB section of memory. The virtual address space, is just that - completely virtual until actually used. Let's say an application is given 10GB of address space and it starts using some of it. As a "fresh" - previously untouched - page of this virtual memory is first written to, the system will, on a low level, "map" this virtual page to a section of physical memory, then write it. But that application itself does not have to worry about such details, it just acts as if it has full access to a virtual area of memory. In the case of Java applications, it's not the application itself but Java that is allocated that address space, and Java simply requests a huge address space by default - the amount it requests is calculated relative to the physical memory size, but not because it has any need to be conservative, but just for practicality - an application is probably not going to want enough heap size to totally bring a server to its knees, so it's operating on the assumption it won't. As I said above this does not mean that this much is "allocated" or that the system has had to expend many resources doing so.
score: 8
downvote count: 0
upvote count: 8

http://stackoverflow.com/q/23422225
has body: I have written a program to parse a text file which contains a sample C program with if, else and while condition. I have 2 ArrayLists and my program will parse through the file. I'm using Matcher and have specified pattern Strings in Pattern.compile(). I am trying to draw a control flow graph for a particular program; however, I'm just finding the nodes for now and will link them up later. Here is my code: //import static LineMatcher.ENCODING; import java.io.BufferedReader; import java.io.IOException; import java.io.LineNumberReader; import java.nio.charset.Charset; import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.util.ArrayList; import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; public final class CFG { public void findLines(String aFileName) { List&lt;Integer&gt; a = new ArrayList&lt;Integer&gt;(); List&lt;Integer&gt; b = new ArrayList&lt;Integer&gt;(); // int [] a = new int[10000]; // int [] b = new int[10000]; Pattern regexp = Pattern.compile("if|else|while"); Matcher exp1 = regexp.matcher("if"); Matcher exp2 = regexp.matcher("else"); Matcher exp3 = regexp.matcher("while"); Path path = Paths.get(aFileName); try (BufferedReader reader = Files.newBufferedReader(path, ENCODING); LineNumberReader lineReader = new LineNumberReader(reader);) { String line = null; while ((line = lineReader.readLine()) != null) { // exp1.reset(line); //reset the input int counter = 1; if (exp1.find()) { int l = lineReader.getLineNumber(); b.add(l); } if (exp2.find()) { int l = lineReader.getLineNumber(); b.add(l); } if (exp3.find()) { int l = lineReader.getLineNumber(); b.add(l); } else { int l = lineReader.getLineNumber(); a.add(l); } } // counter++; System.out.println(a); System.out.println(b); } catch (IOException ex) { ex.printStackTrace(); } } final static Charset ENCODING = StandardCharsets.UTF_8; public static void main(String... arguments) { CFG lineMatche…
has comment: http://stackoverflow.com/comment/35916716
favorite count: 0
has answer: http://stackoverflow.com/a/23748579
has comment: http://stackoverflow.com/comment/35920731
upvote count: 8
has comment: http://stackoverflow.com/comment/35917295
has comment: http://stackoverflow.com/comment/35919837
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23745174
score: 7
tagged with: java
tagged with: matcher
accepted answer: http://stackoverflow.com/a/23748579
has answer: http://stackoverflow.com/a/23745054
downvote count: 1
type: Question
tagged with: text-parsing
has comment: http://stackoverflow.com/comment/35918797
has comment: http://stackoverflow.com/comment/35920628
possible better answer: http://stackoverflow.com/a/23745054
has comment: http://stackoverflow.com/comment/37151039
has comment: http://stackoverflow.com/comment/35894543
has comment: http://stackoverflow.com/comment/35894815
answer count: 3
has comment: http://stackoverflow.com/comment/35919994
has title: pattern.compile help java program
has comment: http://stackoverflow.com/comment/35916788
has comment: http://stackoverflow.com/comment/35920354

http://stackoverflow.com/comment/35824399
type: Comment
comment on: http://stackoverflow.com/q/23385056
has text: I am assuming you don't want the books to be considered equal by author and title except in this particular use case? Would it really be that bad to consider a book the same if author and title are the same in all cases? I think it depends on your design.
score: 0
type: QuestionComment

http://stackoverflow.com/comment/35899384
type: QuestionComment
has text: i tried, but no use. And came back to the jsp-servlet mechanism to store it. but i want to directly sore to the datastore with reading it.
comment on: http://stackoverflow.com/q/23421460
score: 0
type: Comment

http://stackoverflow.com/q/23295264
has answer: http://stackoverflow.com/a/23295602
downvote count: 0
has body: In the observer design pattern I know we have to register the observer with the subject. But i have noticed that in some implementations the subject instance is send through the observer class and then the object of observer is send to Subject class using the instance of subject. See the example below public class Observer1 extends Observer { public Observer1(Subject subject) { this.subject = subject; this.subject.attach(this); } @Override public void update() { System.out.println("Observer1: " + Integer.toBinaryString(subject.getState())); } } My question is does the Observer class need to have the subject instance? I thought Observer was totally decoupled from the subject Could someone give me a good implementation of Observer design pattern or any resources
tagged with: design-patterns
has comment: http://stackoverflow.com/comment/35659795
type: AnsweredQuestion
score: 3
has title: Coupling observer with subject
tagged with: java
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/23295602
has answer: http://stackoverflow.com/a/23295476
accepted answer: http://stackoverflow.com/a/23295476
upvote count: 3
favorite count: 0

http://stackoverflow.com/comment/35659582
comment on: http://stackoverflow.com/a/23292532
type: Comment
has text: @mobeirn When you deal some cards, you often deal N random cards at a time, not always all 52.
score: 0
type: AnswerComment

http://stackoverflow.com/a/23331156
answers question: http://stackoverflow.com/q/23325476
has body: You could create separate indexes, as follows: Books Reviews In the Reviews index, you could also have the book id and use that to look up the Reviews for the particular book.
type: Answer
score: 0

http://stackoverflow.com/a/23383797
answers question: http://stackoverflow.com/q/23341744
has body: while clicking in jComboBox2 after removing all items from, the selected item will be null. Please check null or item count before perfoming the activity. Sample code is given private void jComboBox2ActionPerformed(java.awt.event.ActionEvent evt) { System.out.println("Combo Item Selected"); comboitem = jComboBox2.getSelectedItem(); if(null==comboitem) return ; combos = comboitem.toString(); System.out.println(combos); objcombo.SearchProject(this, combos); }
type: Answer
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/35984255
accepted answer of: http://stackoverflow.com/q/23341744
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/35877129
type: QuestionComment
score: 0
has text: @prabugp if you just want to install the jar, then, an empty pom will suffice ? Anyway, I don't see why is it necessary just to install a 3rd party artifact.
comment on: http://stackoverflow.com/q/23413094
type: Comment

http://stackoverflow.com/comment/35815317
comment on: http://stackoverflow.com/q/23380047
score: 0
has text: http://stackoverflow.com/questions/307964/countdown-timer-in-jsp-servlets check this
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35737527
type: Comment
comment on: http://stackoverflow.com/a/23338059
has text: Thanks, I'll try this. Seems like a hack though, is this the recommended way to do it?
type: AnswerComment
score: 0

http://stackoverflow.com/comment/35931643
type: Comment
has text: Okay thanks. get and set it is.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/23442563

http://stackoverflow.com/a/23351777
score: 1
upvote count: 1
type: AcceptedAnswer
has body: I think there is no problem with persistence.xml , but conflict between java-ee- jar and another jar that contains the javax.persistence.* packages. you need to modify java-ee jar or make sure to have only a single version of the javax.persistence.* packages in the classpath.
accepted answer of: http://stackoverflow.com/q/23351573
answers question: http://stackoverflow.com/q/23351573
type: Answer
has comment: http://stackoverflow.com/comment/35786193
has comment: http://stackoverflow.com/comment/35786315
downvote count: 0

http://stackoverflow.com/q/23322564
upvote count: 2
tagged with: swing
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/35709445
type: Question
has comment: http://stackoverflow.com/comment/35709133
linked to: http://stackoverflow.com/q/23287329
has title: How to make the image scale its size automatically according to the parent JLabel's size, in Netbeans GUI Builder?
has answer: http://stackoverflow.com/a/23322723
downvote count: 0
answer count: 1
tagged with: image-scaling
accepted answer: http://stackoverflow.com/a/23322723
score: 2
tagged with: user-interface
has comment: http://stackoverflow.com/comment/35714111
has body: BACKGROUND:- I am required to make a Swing GUI using Netbeans GUI Builder. The first sub-task is to display an image in the entire background. I have followed a tutorial to get that done. I have basically made a JFrame, set its layout to GridBagLayout and then added a transparent (by unchecking the opaque property) JPanel to it. (Question 1) After that I added a JLabel to the JFrame, Removed its text and added an image to it. (Question 2) QUESTIONS:- First, when I add the JPanel, it does not show its resize handles. I Googled a bit and found this tutorial, in which it can be seen that when they create a JPanel, it automatically shows its resize handles, which can be dragged to resize it. But mine doesn't (screenshot below) So is there some property or something which can be adjusted so that I can resize it? Because my intention is to use this transparent panels to contain components (buttons etc.) on the background, so it should elapse the entire screen/window/JFrame parent. Second, since the image I am using has some 1024x768 dimensions, so it appears to be way bigger than its parent components. Since I am a noob and I am not sure if the size of the background image needs to be adjusted by somehow measuring the pixel width and pixel height of the parent and then converting the actual image's size to that size in some program like Adobe Photoshop. But I am sure there must a more practical way to do that. I want the image to automatically resize itself according to the size of the parent when it is initially placed on on its parent JLabel. How can I do that? Please tell me the easiest way, preferably in the GUI Builder. I also want to ensure that the image size, its parent JLabel's size, JPanel's size will all adjust to the frame when the I change the size of the window later when using this application, or if there is a way to disable the sizing of the window completely. EDIT1 @Braj /* * To change this license header, choose License Headers in Project Properties. * …
favorite count: 0
has comment: http://stackoverflow.com/comment/35714511
tagged with: netbeans
linked to: http://stackoverflow.com/q/23312520

http://stackoverflow.com/comment/35731425
comment on: http://stackoverflow.com/q/23334503
has text: Have you tried using `\b`...alot...
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35723298
comment on: http://stackoverflow.com/a/23329675
score: 0
type: Comment
has text: I ended up figuring it out. In 2.2.0 the .jar files are in the /shared/hadoop/ folder
type: AnswerComment

http://stackoverflow.com/a/23448548
type: Answer
score: 6
upvote count: 6
has comment: http://stackoverflow.com/comment/35942899
has body: For strings there is: "jimbo".contains("jim"); // true Check the documentation for String. There is also startsWith, endsWith and matches (which uses regular expressions).
answers question: http://stackoverflow.com/q/23448532
accepted answer of: http://stackoverflow.com/q/23448532
type: AcceptedAnswer
downvote count: 0

methods
tags question: http://stackoverflow.com/q/23362759
tags question: http://stackoverflow.com/q/23299532
tags question: http://stackoverflow.com/q/23398574
tags question: http://stackoverflow.com/q/23353284
tags question: http://stackoverflow.com/q/23364566
tags question: http://stackoverflow.com/q/23328698
tags question: http://stackoverflow.com/q/23331517
tag name: methods
tags question: http://stackoverflow.com/q/23315095
tags question: http://stackoverflow.com/q/23447922
tags question: http://stackoverflow.com/q/23318484
tags question: http://stackoverflow.com/q/23330875
tags question: http://stackoverflow.com/q/23344271
tags question: http://stackoverflow.com/q/23323676
tags question: http://stackoverflow.com/q/23420315
tags question: http://stackoverflow.com/q/23403383
tags question: http://stackoverflow.com/q/23312236
tags question: http://stackoverflow.com/q/23359791
tags question: http://stackoverflow.com/q/23431835
type: Tag
tags question: http://stackoverflow.com/q/23442044
tags question: http://stackoverflow.com/q/23405400
tags question: http://stackoverflow.com/q/23418800
tags question: http://stackoverflow.com/q/23410266
tags question: http://stackoverflow.com/q/23419281
tags question: http://stackoverflow.com/q/23426465
tags question: http://stackoverflow.com/q/23426155
tags question: http://stackoverflow.com/q/23327033
tags question: http://stackoverflow.com/q/23354230
tags question: http://stackoverflow.com/q/23350454
tags question: http://stackoverflow.com/q/23410599
tags question: http://stackoverflow.com/q/23420044
tags question: http://stackoverflow.com/q/23320002
tags question: http://stackoverflow.com/q/23374740
tags question: http://stackoverflow.com/q/23452793
tags question: http://stackoverflow.com/q/23323880
tags question: http://stackoverflow.com/q/23353908
tags question: http://stackoverflow.com/q/23377594
tags question: http://stackoverflow.com/q/23339211
tags question: http://stackoverflow.com/q/23418715

http://stackoverflow.com/a/26271900
has body: Hi if you want to get the exception message using MEL you can also (in a Catch Exception Strategy) use the following expression. #[exception.cause.message]
type: Answer
answers question: http://stackoverflow.com/q/23343361
downvote count: 0
score: 3
upvote count: 3

http://stackoverflow.com/comment/35907356
has text: Im as curious as the above poster, why are you using this setup. Can't you just use the normal list implementations?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23429502
score: 0

http://stackoverflow.com/a/23340390
score: 2
answers question: http://stackoverflow.com/q/23336792
has comment: http://stackoverflow.com/comment/35746952
accepted answer of: http://stackoverflow.com/q/23336792
has comment: http://stackoverflow.com/comment/35747199
upvote count: 2
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35746573
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/35741911
has comment: http://stackoverflow.com/comment/35746305
has body: You should implement org.springframework.security.saml.userdetails.SAMLUserDetailsService and plug it into the samlAuthenticationProvider bean. In case user doesn't exist you should throw UsernameNotFoundException exception, otherwise just populate and return data from your DB. On top of that you should implement your own org.springframework.security.web.authentication.AuthenticationFailureHandler and plug it into samlWebSSOProcessingFilter bean. This implementation will be called with the UsernameNotFoundException sent as a parameter and you can then redirect the user to the correct sign-up page as a reaction to it.

http://stackoverflow.com/comment/35894815
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/23422225
has text: @lpiepiora is right, but you also need to change your regex. The simplest to work is something like `.*(if|else|while).*`. But this will give you incorrect results if the line contains variables with names like the operators (diff,...).

http://stackoverflow.com/a/23376045
upvote count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/35808301
type: Answer
score: 1
has body: This LineChart constructor takes the serieses of the chart as one of its arguments. You can construct the series first, then construct the LineChart. First convert your Float[] to a List List&lt;XYChart.Data&lt;Int,Float&gt;&gt; seriesData = new ArrayList&lt;&gt;(); for(int i=0;i&lt;data.length;++i) seriesData.add(new XYChart.Data(i,data[i])); Then construct your LineChart XYChart.Series&lt;Int,Float&gt; series = new XYChart.Series&lt;&gt;(); series.getData().addAll(seriesData); LineChart&lt;Int,Float&gt; chart = new LineChart&lt;&gt;(...axes...,FXCollections.observableArrayList(series)); As brian suggests, you can also add more series, or add another series, after the chart has been created by using the XYChart.getData() method and adding your data there.
answers question: http://stackoverflow.com/q/23375681

http://stackoverflow.com/q/23350873
has answer: http://stackoverflow.com/a/23350952
score: 0
answer count: 2
has title: Why are cardlayout keys passed as Objects?
has body: java.awt.CardLayout.addLayoutComponent(Component comp, Object constraints) "The object specified by constraints must be a string" from the docs.oracle documentation. So Why does this method take an object as argument if the object must be a string? The question is nagging me because it leads me to hope that there is an easy way to use enums as keys for a cardlayout. public class MainWindow extends JPanel { private CardLayout cards = new CardLayout(); public MainWindow() { setLayout(cards); cards.addLayoutComponent(new FirstComp(), MyEnum.LONG_ANNOYING_NAME_ONE); cards.addLayoutComponent(new SecondComp(), MyEnum.LONG_ANNOYING_NAME_TWO); cards.addLayoutComponent(new ThirdComp(), MyEnum.LONG_ANNOYING_NAME_THREE); /** * notice no .toString() call on enums. Is there a way to define my * enum class so that this functionality is possible? **/ } public void showMethod(MyEnum show) { cards.show(this, MyEnum); } } public enum MyEnum { LONG_ANNOYING_NAME_ONE, LONG_ANNOYING_NAME_TWO, LONG_ANNOYING_NAME_THREE }
type: UnansweredQuestion
tagged with: swing
tagged with: enums
tagged with: java
has answer: http://stackoverflow.com/a/23351177
type: Question
tagged with: cardlayout

http://stackoverflow.com/comment/35828168
type: Comment
comment on: http://stackoverflow.com/a/23387254
score: 2
type: AnswerComment
has text: OP probably only have a JRE and cannot compile any code. And here is some shorter code by the way: `System.getProperties().list(System.out);`.

http://stackoverflow.com/q/23317978
tagged with: java
upvote count: 1
tagged with: swing
has comment: http://stackoverflow.com/comment/35701685
tagged with: boxlayout
type: Question
has answer: http://stackoverflow.com/a/23318033
linked to: http://stackoverflow.com/q/7229226
has title: Chat layout with BoxLayout manager
has body: Box layout seems to be quite suitable for the needs of typical chat layout like the one I've made in InkScape. I have based the structure like this: MainFrame Chat JPanel - BoxLayout.Y_AXIS Message list - ScrollablePanel the list - BoxLayout.Y_AXIS Text field - Just a text field Now the only problem I seem to have is, that in the inital phase, the space is divided 50% to 50% between text field and the message list. However, if the message area is filled, as you can see in the image above and I try to resize the chat window, everything goes well: So: I want the textarea to keep the same size, even when message container is empty. There must be a method to be called to simulate me resizing the window so that the panels update properly. Here is the chat panel: public class ChatPanel extends JPanel { private BoxLayout layout; private TextField input; private MessageList messages; public ChatPanel() { layout = new BoxLayout(this, BoxLayout.Y_AXIS); setLayout(layout); //Create message list messages = new MessageList(); messages.appendTo(this); //Create text field input = new TextField(); add(input); } public void addMessage(String message) { messages.addMessage(message); } public void appendTo(JFrame frame) { frame.getContentPane().add(this); } } And here is the messageList: public class MessageList extends JPanel { public MessageList() { setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); } public void addMessage(String message) { JLabel lb = new JLabel(); lb.setText(message); add(lb); validate(); } public void appendTo(JPanel frame) { frame.add(new JScrollPane(this)); } }
has comment: http://stackoverflow.com/comment/35701675
answer count: 1
downvote count: 0
accepted answer: http://stackoverflow.com/a/23318033
has comment: http://stackoverflow.com/comment/35701448
favorite count: 0
has comment: http://stackoverflow.com/comment/35701900
has comment: http://stackoverflow.com/comment/35701694
type: AnsweredQuestion
score: 1

http://stackoverflow.com/q/23381231
type: Question
has comment: http://stackoverflow.com/comment/35940575
has body: i am doing an application in eclipse which is Position localization for smart phone based on wifi signal, briefly three reference points (routers) need to be used to find my device location and each router has to have a fixed coordinates, i want to use if and if else to select only three routers among the existing Wifi signals and given them a coordinates. i tried to do it in this way but i did not work? if (SSID = router name) // where SSID is the router user name in eclipse { int x1 = 0; int x2 = 0; } any suggestions please ? thank you
has answer: http://stackoverflow.com/a/23381358
tagged with: if-statement
upvote count: 0
has comment: http://stackoverflow.com/comment/35817275
linked to: http://stackoverflow.com/q/513832
answer count: 3
has answer: http://stackoverflow.com/a/23381290
favorite count: 0
type: UnansweredQuestion
has title: if and if else in eclipse for names
tagged with: android
downvote count: 1
tagged with: java
score: -1
tagged with: eclipse
has answer: http://stackoverflow.com/a/23381308

http://stackoverflow.com/comment/35921243
score: 0
comment on: http://stackoverflow.com/q/23436868
type: Comment
type: QuestionComment
has text: `Arrays.sort` is a void method, also there is no sort method that takes a String as parameter.

http://stackoverflow.com/a/23419007
score: 1
upvote count: 2
has comment: http://stackoverflow.com/comment/35888426
downvote count: 1
has body: Let the server handle all chats. Make your own "protocols" so your client sends a package containing both the message and destination (user). This can be done with either sending Strings with information you can parse or whole objects. This way it's also pretty easy to create groups with certain users in, all handled by the server.
type: Answer
answers question: http://stackoverflow.com/q/23418965

http://stackoverflow.com/q/23373117
downvote count: 0
accepted answer: http://stackoverflow.com/a/23374913
favorite count: 0
has body: I use -XX:OnOutOfMemoryError=\"kill -9 %p\". It works for most of out of memory cases, but it doesn't kill the process for java.lang.OutOfMemoryError: unable to create new native thread.
answer count: 1
has title: -XX:OnOutOfMemoryError doesn't work for java.lang.OutOfMemoryError: unable to create new native thread
upvote count: 1
has answer: http://stackoverflow.com/a/23374913
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35803271
score: 1
tagged with: java
tagged with: memory
type: Question

http://stackoverflow.com/q/23378482
tagged with: java
has comment: http://stackoverflow.com/comment/35820014
has title: Redraw issues in SWT Canvas
has comment: http://stackoverflow.com/comment/35821557
has comment: http://stackoverflow.com/comment/35820779
has comment: http://stackoverflow.com/comment/35820637
tagged with: canvas
answer count: 0
downvote count: 0
type: UnansweredQuestion
score: 1
has comment: http://stackoverflow.com/comment/35819999
favorite count: 0
has comment: http://stackoverflow.com/comment/35820407
type: Question
has body: I am displaying a sequence of images in SWT Canvas using a TimerTask to redraw to the canvas every 5 seconds. It all works well but when I move some window over the canvas area, it starts getting all messy before it moves to the next image in sequence. Can I avoid this ? This is the Canvas cnvs = new Canvas(customContainer,SWT.NO_REDRAW_RESIZE| SWT.DOUBLE_BUFFERED); I am drawing the image inside the paint listener this way int index=0; if(curImg>=0&amp;&amp;curImg&lt;3) curImg++; else curImg=0; Image img = imgs[curImg]; if(curImg==3){ index=curImg-1; img=imgs[index]; } e.gc.drawImage(img, 0, 0, img.getImageData().width, img.getImageData().height, 0, 0, cnvs.getSize().x, cnvs.getSize().y); TimerTask function: public TimerTask startTask() { return new TimerTask() { @Override public void run() { // TODO Auto-generated method stub if(!UIManager.getShell().getDisplay().isDisposed()){ UIManager.getShell().getDisplay().asyncExec(new Runnable() { @Override public void run() { if(!cnvs.isDisposed()) cnvs.redraw(); } }); } } }; }; and this is how it's invoked timer=new Timer(); timer.schedule(MainUI.compositeInstallationProgresslatest.startTask(),1000,5000); Thanks for ur help !
has comment: http://stackoverflow.com/comment/35821454
tagged with: swt
upvote count: 1
tagged with: refresh
has comment: http://stackoverflow.com/comment/35819921

http://stackoverflow.com/q/23375644
has answer: http://stackoverflow.com/a/23377783
downvote count: 0
favorite count: 0
has body: I am pretty new to android studio and have a question that I can't seem to solve. I am parsing some XML from a website using a for loop to get each element. My question is how do I pause it on the first iteration through the for loop, so that it won't continue to the next until this button is clicked? Here is my for loop: try { URL url = new URL("http://www.website.xml"); DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder db = dbf.newDocumentBuilder(); Document doc = db.parse(new InputSource(url.openStream())); doc.getDocumentElement().normalize(); NodeList nodeList = doc.getElementsByTagName("patient_order"); /** Assign textview array length by arraylist size */ patientName = new TextView[nodeList.getLength()]; patientID = new TextView[nodeList.getLength()]; medicine = new TextView[nodeList.getLength()]; dosage = new TextView[nodeList.getLength()]; refillsRemaining = new TextView[nodeList.getLength()]; for (int i = 0; i &lt; nodeList.getLength(); i++) { Node node = nodeList.item(i); patientName[i] = new TextView(this); patientID[i] = new TextView(this); medicine[i] = new TextView(this); dosage[i] = new TextView(this); refillsRemaining[i] = new TextView(this); Element fstElmnt = (Element) node; NodeList nameList = fstElmnt.getElementsByTagName("patientName"); Element nameElement = (Element) nameList.item(0); nameList = nameElement.getChildNodes(); patientName[i].setText("Patient: " + ((Node) nameList.item(0)).getNodeValue()); NodeList websiteList = fstElmnt.getElementsByTagName("patientID"); Element websiteElement = (Element) websiteList.item(0); websiteList = websiteElement.getChildNodes(); patientID[i].setText("ID: " + ((Node) websiteList.item(0)).getNodeValue()); NodeList medicineList = fstElmnt.getElementsByTagName("medicine"); Element medicineElement = (Element) medicineList.item(0); medicineList = medicineElement.getChildNodes(); medicine[i].setText("RX: " + ((Node) medicineList.item(0)).getNodeValue()); NodeList dosageList = fs…
type: UnansweredQuestion
tagged with: android
has title: pausing a for loop unless button is clicked in android studio
linked to: http://stackoverflow.com/q/11989589
has comment: http://stackoverflow.com/comment/35807427
score: 1
upvote count: 1
has answer: http://stackoverflow.com/a/23376009
type: Question
tagged with: android-layout
tagged with: android-fragments
tagged with: java
answer count: 2

http://stackoverflow.com/a/23450389
type: Answer
upvote count: 1
score: 1
accepted answer of: http://stackoverflow.com/q/23449995
has comment: http://stackoverflow.com/comment/35946725
answers question: http://stackoverflow.com/q/23449995
type: AcceptedAnswer
downvote count: 0
has body: The javadoc for Part.write() mentions that: The file is created relative to the location as specified in the MultipartConfig My understanding is that for Glassfish, if you don't specify the location, it defaults to the value of: getServletContext().getAttribute("javax.servlet.context.tempdir") Which is probably the extra path that you see. Try specifying the location in the @MultipartConfig annotation, e.g.: @MultipartConfig(location="/somepath") You could set the location to the value of the temp dir, and then just pass the bare filename to the write() method.
has comment: http://stackoverflow.com/comment/35946786
has comment: http://stackoverflow.com/comment/35946528
has comment: http://stackoverflow.com/comment/35946724

http://stackoverflow.com/comment/35812170
type: QuestionComment
comment on: http://stackoverflow.com/q/23378157
type: Comment
score: 0
has text: Accidentally deleted it when getting rid of printlns. The problem persists with it there.

http://stackoverflow.com/comment/35843543
type: AnswerComment
score: 0
type: Comment
has text: Why would I need years months and days ? I am checking for java.sql.time
comment on: http://stackoverflow.com/a/23395008

http://stackoverflow.com/q/23418907
has answer: http://stackoverflow.com/a/23418950
answer count: 2
has title: Why doesn't my Manifest file declare a java package?
score: 0
tagged with: android
has answer: http://stackoverflow.com/a/23419039
has body: I can't seem to find an answer to this, so I guess I'll ask it myself. No matter what I try, Eclipse claims that my AndroidManifest.xml file doesn't declare a java package. Here's my code: <?xml version="1.0" encoding="utf-8"?> <uses-sdk android:minSdkVersion="10" android:targetSdkVersion="19" /> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> Maybe someone can find the problem, and suggest a solution. I'd gladly appreciate it.
type: AnsweredQuestion
tagged with: java
tagged with: eclipse
possible better answer: http://stackoverflow.com/a/23418950
accepted answer: http://stackoverflow.com/a/23419039
type: Question

http://stackoverflow.com/q/23342940
has title: ApplicationListener in Spring Security 3
answer count: 0
type: UnansweredQuestion
tagged with: spring
tagged with: spring-mvc
has comment: http://stackoverflow.com/comment/35747497
tagged with: java
type: Question
has body: I extended ApplicationListener with my own code. In previous versions of Spring Security (e.g. Spring Security 2) there was no need to configure anything to intercept the authentication. But now, I upgraded to SSecurity 3.2 and I cannot make that this class works. I put a breakpoint in the class, but after a log success the control does not stop in this class, and I get some exceptions. My question is: Do I need to configure something in my application-context? I put this: &lt;b:bean id="userAuthenticationListener" class="my.app.security.UserAuthenticationEventListener"/&gt; and nothing more. I saw in other posts things like &lt;security:http use-expressions="true" auto-config="true"&gt; &lt;security:intercept-url pattern="..."/&gt; &lt;security:form-login authentication-failure-handler-ref="authFailureHandler" authentication-success-handler-ref="authSuccessHandler"/&gt; &lt;security:logout success-handler-ref="logoutSuccessHandler" invalidate-session="true"/&gt; &lt;security:session-management session-fixation-protection="newSession"/&gt; But I'm not sure if my code is getting deprecated. If somebody could please give me some lines of where to read, I would be grateful.
tagged with: spring-security
has comment: http://stackoverflow.com/comment/35746823
score: 0
has comment: http://stackoverflow.com/comment/35746692

http://stackoverflow.com/q/23352049
type: Question
has comment: http://stackoverflow.com/comment/35764534
type: AnsweredQuestion
has body: as the title says, I need to pass some strings from the current Activity (C) to a static ArrayList that was created in the first Activity (P). If I rotate the screen (C) before getting to the first Activity (P), all strings from previous Activity (C) are lost, but the main Activity ArrayList (P) still lives. If I get to the first Activity without any state change (a rotation), it all saves into the static ArrayList. What's wrong, why all arraylists (C) except the first one (P) are lost? This is in my onCreate() method. Bundle b = new Bundle(); b = getIntent().getExtras(); if (b != null) { myList = b.getStringArrayList("list"); currentFile = b.getString("current"); previousFile = b.getString("previousFile"); } My code to create a new Activity: Bundle b = new Bundle(); b.putString("current", currentFile); b.putString("previousFile", getPreviousFile()) b.putStringArrayList("list", myList); Intent i = new Intent(MainActivity.this, str); i.putExtras(b); startActivity(i);
tagged with: java
possible better answer: http://stackoverflow.com/a/23352485
answer count: 2
has title: How to add strings into an arraylist from a previous Activity
score: 0
tagged with: android
accepted answer: http://stackoverflow.com/a/23352753
has answer: http://stackoverflow.com/a/23352485
has comment: http://stackoverflow.com/comment/35764608
has comment: http://stackoverflow.com/comment/35764638
has answer: http://stackoverflow.com/a/23352753

http://stackoverflow.com/q/23393597
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/23400634
score: 0
has comment: http://stackoverflow.com/comment/35843281
has answer: http://stackoverflow.com/a/23393720
favorite count: 0
tagged with: jframe
has body: My Code is rather long but it's not the whole thing I'm worried about. This is in Java. The class with the issue is located here: http://pastebin.com/5G6QLLBf The entire code can be posted or e-mailed if needed. When I run the program, my current method of checking mouse location relative to JPanels in a 2D array I have set up on click is with a function of: (Evt.getLocationOnScreen().x - (Correction from the distance of panels to edge of JFrame) - evt.GetX() - (The Distance between panels))/(The width of the panels) with it being the same for y (with a few different numbers) to get 2 integer values equal to that JPanel's position in the array. However, when the window/JFrame is moved via dragging the top bar, it fails to properly find the panel because one of the constants fails to be correct. How do I correct for window movement? or at least get a value for the amount of window shift?
type: UnansweredQuestion
tagged with: swing
has comment: http://stackoverflow.com/comment/35855105
has title: How to change coordinates based on window movement?
tagged with: mouselistener
tagged with: java
upvote count: 1
downvote count: 1

http://stackoverflow.com/comment/35715715
has text: True, didn't think about that! so you have to split before you replace then
type: Comment
comment on: http://stackoverflow.com/a/23326004
score: 0
type: AnswerComment

http://stackoverflow.com/comment/35853184
type: QuestionComment
comment on: http://stackoverflow.com/q/23398450
has text: will do. i would upvote as well but my rep is nonexistant.
score: 0
type: Comment

http://stackoverflow.com/q/23408899
tagged with: android-fragments
tagged with: java
answer count: 2
upvote count: 1
downvote count: 0
favorite count: 0
has body: i created a tab layout with swipeable views, and each tab is a fragment. so when i place a viewflipper i changed the tabs to fragment activity, so an error in the adapter class says cannot convert FollowerFragments() to fragment. any help? Adapter class: public Fragment getItem(int index) { switch (index) { case 0: // Followers fragment activity return new FollowersFragment(); case 1: // Best fragment activity return new BestSellingFragment(); case 2: // Hot fragment activity return new HotDealsFragment(); } return null; } Followerfragment class : public class FollowersFragment extends FragmentActivity { public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_followers, container, false); return rootView; } ViewFlipper flipper; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); //Getting View Flipper from main.xml and assigning to flipper reference variable flipper=(ViewFlipper)findViewById(R.id.viewFlipper1); flipper.setAutoStart(true); flipper.setFlipInterval(500); } }
possible better answer: http://stackoverflow.com/a/23408936
accepted answer: http://stackoverflow.com/a/23409353
tagged with: android
has title: Android problems with fragment and fragmentActivity
has answer: http://stackoverflow.com/a/23408936
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23409353
score: 1
type: Question

http://stackoverflow.com/comment/38822873
score: 0
type: Comment
has text: @JG: Sure. Here's an article I wrote that has model classes and GUI classes - [Qlocktwo with Java Swing](http://java-articles.info/articles/?p=555)
type: QuestionComment
comment on: http://stackoverflow.com/q/23330385

http://stackoverflow.com/q/23350759
has answer: http://stackoverflow.com/a/23351063
has title: Change all non-alphanumerics to a +
has comment: http://stackoverflow.com/comment/35761652
answer count: 1
has body: I'm currently in a bit of a pickle. I have a text box the user enters an address into, which is then sent as part of a url. Currently, the solution I have works well with a single word - say "Brighton". But, if the user wants to add more detail to the query - say, a street address, I run into issues. 32 Sydney Street, Brighton, The City of Brighton and Hove BN1 4EP, UK What would be the best way to change it to - I think a regex would do it, but I've always struggled with them. 32+Sydney+Street+Brighton+The+City+of+Brighton+and+Hove+BN1+4EP+UK I'm currently doing this - which I think is messy, and well, just not good programming. It'd get even more gross if I add conditionals for '++' String[] strArray = str.split(" "); int strSize = strArray.length; // Puts the split array back together, and add a plus between the words str = ""; for (int i = 0; i &lt; strSize; i++) { if (i &lt; (strSize - 1)) str += strArray[i] + "+"; else str += strArray[i]; } return str; All the ways I'm thinking of run the risk of having two ++ in a row (which would invalidate the url), or are really 'gross' code. Thanks for your time
tagged with: string
favorite count: 0
has comment: http://stackoverflow.com/comment/35761567
score: 0
tagged with: regex
accepted answer: http://stackoverflow.com/a/23351063
has comment: http://stackoverflow.com/comment/35761574
has comment: http://stackoverflow.com/comment/35761511
tagged with: string-formatting
upvote count: 1
downvote count: 1
type: AnsweredQuestion
tagged with: alphanumeric
tagged with: java
has comment: http://stackoverflow.com/comment/35761614
type: Question

http://stackoverflow.com/a/23370456
has body: UPDATE: The way to read in an InputStream/Reader is somethink like while ((myString = readClient.readLine()) != null) { System.out.println(myString); } this way the loop will exit when the connection is closed. Also, move the try/catch outside the loop, or do some error control. If you get an exception, you do not want to just try get again in the loop. UPDATE2: In case my comment was not clear enough, over your updated code do String line; while ((line = readClient.readLine()) != null) { System.out.println("Client says - " + line); } Just one read per iteration, at the while, so the loop can exit if line is null (that means the connection has been closed).
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/35797552
has comment: http://stackoverflow.com/comment/35798558
has comment: http://stackoverflow.com/comment/35797652
has comment: http://stackoverflow.com/comment/35798622
has comment: http://stackoverflow.com/comment/35797625
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23370383
accepted answer of: http://stackoverflow.com/q/23370383
type: Answer

http://stackoverflow.com/q/23333368
possible better answer: http://stackoverflow.com/a/23333629
has answer: http://stackoverflow.com/a/23333629
has body: I was trying to run the Hello World RMI example from the Oracle page, but I keep getting errors. the error I keep getting is Server exception: java.rmi.NoSuchObjectException: no such object in table java.rmi.NoSuchObjectException: no such object in table at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:275) at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:252) at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:378) at sun.rmi.registry.RegistryImpl_Stub.bind(Unknown Source) at example.hello.Server.main(Server.java:26) Here is the code as taken directly from the site that I used: The Hello Interface: package example.hello; import java.rmi.Remote; import java.rmi.RemoteException; public interface Hello extends Remote { String sayHello() throws RemoteException; } This is what my server class: package example.hello; import java.rmi.registry.Registry; import java.rmi.registry.LocateRegistry; import java.rmi.RemoteException; import java.rmi.server.UnicastRemoteObject; public class Server implements Hello { public Server() {} public String sayHello() { return "Hello, world!"; } public static void main(String args[]) { try { Server obj = new Server(); Hello stub = (Hello) UnicastRemoteObject.exportObject(obj,0); // Bind the remote object's stub in the registry Registry registry = LocateRegistry.getRegistry("localhost"); registry.bind("Hello", stub); System.err.println("Server ready"); } catch (Exception e) { System.err.println("Server exception: " + e.toString()); e.printStackTrace(); } } } Client code: package example.hello; import java.rmi.registry.LocateRegistry; import java.rmi.registry.Registry; public class Client { private Client() {} public static void main(String[] args) { String host = "localhost"; try { Registry registry = LocateRegistry.getRegistry(host); Hello stub = (Hello) registry.lookup("Hello"); String response = stub.sayHello(); System.out.println("response: " + response); } catch (Exception e)…
has comment: http://stackoverflow.com/comment/35729523
type: AnsweredQuestion
score: 2
upvote count: 2
tagged with: rmi
tagged with: java
has answer: http://stackoverflow.com/a/23336853
type: Question
accepted answer: http://stackoverflow.com/a/23336853
linked to: http://stackoverflow.com/q/645208
answer count: 2
has title: RMI no such object exception
downvote count: 0
favorite count: 0

http://stackoverflow.com/comment/35669366
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23300471
score: 0
has text: You'll need to create a new `listNode` for each sum and append it to `l`. Do you really intend to sum every element of `L1` with every element of `L2`?

http://stackoverflow.com/q/23361068
tagged with: scribe
answer count: 1
has comment: http://stackoverflow.com/comment/35784830
tagged with: google-plus
has answer: http://stackoverflow.com/a/23362362
has comment: http://stackoverflow.com/comment/35779978
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35784687
has body: I'm using scribe java ( https://github.com/fernandezpablo85/scribe-java/blob/master/src/test/java/org/scribe/examples/GoogleExample.java) to sign in on GooglePlus. I use 2 servlet, one for the login, the other it's the callback. When I call the signin's servlet, it's ok, but when Google Plus redirects me to the callback servlet, I got a nullPointer Exception. This error is caused by session's attribute, because i use this session attribute to store my tokens. I do a setAttribute in my servlet login and I do a getAttribute in the callback, but it's null. My code is as bellow : Servlet login : protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String API_KEY = "******************"; String API_SECRET = "**********"; String SCOPE = "https://www.googleapis.com/auth/plus.stream.read"; InfosGooglePlus infos = new InfosGooglePlus(); infos.setApiKey(API_KEY); infos.setApiSecret(API_SECRET); infos.setScope(SCOPE); String redirect = Channel.getChannel().getUrl(); if (Util.notEmpty(request.getParameter("redirect"))) { redirect = URLDecoder.decode(request.getParameter("redirect")); } request.getSession().setAttribute("redirectGooglePlus", redirect); OAuthService service = new ServiceBuilder().provider(GoogleApi.class).apiKey(API_KEY).apiSecret(API_SECRET).scope(SCOPE) .callback("http://127.0.0.1:8080/cci/callbackGooglePlus").build(); Token requestToken = service.getRequestToken(); String token = requestToken.getToken(); String tokenSecret = requestToken.getSecret(); request.getSession().setAttribute("token", token); request.getSession().setAttribute("tokenSecret", tokenSecret); request.getSession().setAttribute("requestToken", requestToken); request.getSession().setAttribute("infosGooglePlus", infos); response.sendRedirect(service.getAuthorizationUrl(requestToken)); } And my callback servlet : InfosGooglePlus infos = (InfosGooglePlus) request.getSession().getAttribute("infosGooglePlus"); String redirect = Channel…
has comment: http://stackoverflow.com/comment/35780170
tagged with: java
has title: NullPointerException in servlet GooglePlus
tagged with: servlets
type: Question
has comment: http://stackoverflow.com/comment/35780207
tagged with: jsp
score: 0

http://stackoverflow.com/q/23406006
answer count: 2
has comment: http://stackoverflow.com/comment/35863610
type: UnansweredQuestion
has title: Find and print the product of all the entries in array
has answer: http://stackoverflow.com/a/23406111
tagged with: java
has body: Okay I have tried to write a simple Java code in BlueJ, that finds and prints the product of all the entries in data such as if data is {1,2,3,4} then the result will be 24. And my code is below: public class Product { public static int[] product(int[] a) { int [] s = new int[a.length]; for (int i =0; i&lt; a.length; i++) s[i] = a[i]*a[i]; return s; //the definition of your method... } public static void main(String[] args) { //calling the method to seek if compiles int[] results = Product.product(new int[] { 1,2,3,4 }); //printing the results System.out.println(java.util.Arrays.toString(results)); } } The above code is giving me the square of each number, which is not what I want to have, somehow I have modify the code that the result will be 24 but I couldn't figure it out, anyone knows how to do it?
has comment: http://stackoverflow.com/comment/35863824
has answer: http://stackoverflow.com/a/23406098
type: Question
has comment: http://stackoverflow.com/comment/35863299
score: 0

http://stackoverflow.com/comment/35895870
type: Comment
comment on: http://stackoverflow.com/a/23423142
has text: This works perfectly and exactly what I wanted, thanks a lot Andrei
score: 0
type: AnswerComment

http://stackoverflow.com/comment/35723256
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23329910
has text: How can I find unique strings using a hashmap?

http://stackoverflow.com/a/23331863
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35727651
has comment: http://stackoverflow.com/comment/35727075
has comment: http://stackoverflow.com/comment/35727207
type: Answer
has comment: http://stackoverflow.com/comment/35726808
has comment: http://stackoverflow.com/comment/35727053
has comment: http://stackoverflow.com/comment/35727101
has comment: http://stackoverflow.com/comment/35727242
has comment: http://stackoverflow.com/comment/35727137
has comment: http://stackoverflow.com/comment/35727042
has comment: http://stackoverflow.com/comment/35727309
score: 2
has comment: http://stackoverflow.com/comment/35727571
downvote count: 0
has comment: http://stackoverflow.com/comment/35727012
has comment: http://stackoverflow.com/comment/35727274
has comment: http://stackoverflow.com/comment/35727341
has comment: http://stackoverflow.com/comment/35727300
accepted answer of: http://stackoverflow.com/q/23331845
has comment: http://stackoverflow.com/comment/35727210
answers question: http://stackoverflow.com/q/23331845
upvote count: 2
has body: Your constructor requires you to pass in an existing TicTac as a parameter. In the code you show, you're trying to create a TicTac without doing so. As @MadProgrammer points out, requiring a TicTac to create a TicTac creates something of a catch-22 situation: How can you ever create one without having one first? If, for some reason, you do need to create a TicTac with a reference to an existing TicTac, you need to create an additional constructor with no parameters (as your compiler is suggesting) to create the first one: public TicTac() { } (more accurately, your constructor can take parameters, it just cant require a TicTac): class TicTac { public TicTac(int size) { } public TicTac(TicTac otherTicTac) { } ... } //elsewhere: TicTac first = new TicTac(5); //or just TicTac first = new TicTac() TicTac second = new TicTac(first); However, I'm guessing that you don't really need a TicTac(TicTac otherTicTac) constructor (if so, tell me why), and that you're trying to do so as a result of a misunderstanding about how constructors work - in which case this might be a helpful read, for starters.
has comment: http://stackoverflow.com/comment/35727493
has comment: http://stackoverflow.com/comment/35727364

http://stackoverflow.com/comment/35912671
type: Comment
comment on: http://stackoverflow.com/a/23339703
type: AnswerComment
has text: Yes I have testingLineMapper which will refer to custom class. I am use @Value("#{jobParameters['resource']}") private String resource; to inject. Unfortunately there is error occurs.
score: 0

http://stackoverflow.com/q/23334619
downvote count: 1
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23334691
has answer: http://stackoverflow.com/a/23334648
has comment: http://stackoverflow.com/comment/35732080
tagged with: java
tagged with: mysql
has comment: http://stackoverflow.com/comment/35731641
type: Question
has comment: http://stackoverflow.com/comment/35731668
has comment: http://stackoverflow.com/comment/35731729
has body: I'm getting this error: Information:Using javac 1.8.0 to compile java sources Information:java: Errors occurred while compiling module 'HelloWorld' Information:Compilation completed with 2 errors and 0 warnings in 6 sec Information:2 errors Information:0 warnings C:\Users\Raj\IdeaProjects\HelloWorld\src\CopyCharacters.java Error:(18, 29) java: cannot find symbol symbol: variable c location: class CopyCharacters Error:(21, 30) java: cannot find symbol symbol: variable c location: class CopyCharacters I'm doing practice from this doc, Now as i run my program using intellij idea IDE it's giving me this error.. and here is my source code: import java.io.*; public class CopyCharacters { public static void main(String[] args) throws IOException{ FileReader inputstream=null; FileWriter outputstream=null; try{ inputstream=new FileReader("D://raj.txt"); outputstream=new FileWriter("D://raj1.txt"); int c; while((c=inputstream.read())!=-1){ outputstream.write(c); } }finally{ if(inputstream!=c){ inputstream.close(); } if(outputstream!=c){ outputstream.close(); } } } } EDITED: According to @I wish i could think a good's answer it's working but it's showing new error: Exception in thread "main" java.lang.ClassNotFoundException: ArrayDemo 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) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:259) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:116)
has comment: http://stackoverflow.com/comment/35731654
tagged with: intellij-idea
tagged with: arrays
has answer: http://stackoverflow.com/a/23334874
accepted answer: http://stackoverflow.com/a/23334691
possible better answer: http://stackoverflow.com/a/23334637
score: 0
has answer: http://stackoverflow.com/a/23334637
answer count: 4
favorite count: 0
has title: I'm getting error in my program
upvote count: 1

http://stackoverflow.com/a/23337053
score: 0
has comment: http://stackoverflow.com/comment/35902181
has comment: http://stackoverflow.com/comment/35884494
has body: When your running from command prompt after compiling your class use this java -classpath .;mysql-connector-java-5.0.8-bin.jar Version Keep both jar and java file in same directory and try. use ";" instead of ":" as mentioned above.include package name if any.I have tested its working.
type: Answer
has comment: http://stackoverflow.com/comment/35917823
has comment: http://stackoverflow.com/comment/35918077
answers question: http://stackoverflow.com/q/23330160

http://stackoverflow.com/comment/35750733
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23338113
has text: @La-comadreja That's strange. Check if you have access to the Maven repository, see http://mvnrepository.com/artifact/org.apache.camel/camel-core/2.12.3
type: AnswerComment

http://stackoverflow.com/comment/59928593
has text: @ObedMarsh You don't need stream headers inside a loop. I really have no idea what you're talking about. Who or what is 'they' in your various comments?
type: Comment
comment on: http://stackoverflow.com/a/23431119
score: 0
type: AnswerComment

http://stackoverflow.com/comment/35673200
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23302401
has text: @qqilihq:I said "POSSIBLE"

http://stackoverflow.com/q/23323107
has answer: http://stackoverflow.com/a/23323125
downvote count: 1
has body: So,whenever i try to use set onclicklistener and try to run it on the emulator it show an error message saying the application has stopped .When i take that portion of the code out it starts working. This is my code:(Mainactivity.java file) package com.example.android_project_thenewboston; import android.support.v7.app.ActionBarActivity; import android.support.v7.app.ActionBar; import android.support.v4.app.Fragment; import android.os.Bundle; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.os.Build; import android.widget.Button; import android.widget.TextView; public class MainActivity extends ActionBarActivity { int counter; Button add, sub; TextView display; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); counter = 0; add = (Button) findViewById(R.id.bAdd); sub = (Button) findViewById(R.id.bSub); display = (TextView) findViewById(R.id.tDisplay); add.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { // TODO Auto-generated method stub counter++; display.setText("Your grand total is " +counter); } }); sub.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { // TODO Auto-generated method stub counter--; display.setText("Your grand total is " +counter); } }); if (savedInstanceState == null) { getSupportFragmentManager().beginTransaction() .add(R.id.container, new PlaceholderFragment()).commit(); } } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return 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 Androi…
tagged with: java
tagged with: eclipse
type: Question
has comment: http://stackoverflow.com/comment/35710207
score: 0
tagged with: android
answer count: 1
favorite count: 0
has title: The setOnclicklistener method not working
type: UnansweredQuestion
upvote count: 1

http://stackoverflow.com/a/24365321
has body: Probable reason for this maybe your page doesn't read image at once and needs some time to read it..you can solve this problem by giving it a delay of some time..you can do this by &lt;%TimeUnit.SECONDS.sleep(5); %&gt; It will add a delay of 5 seconds(you can change it accoriding to your needs) before the page loads..So your page will get sufficient time to read and form image on your page and you will not have to refresh the page again to display it..I was also facing same problem as yours and adding this statement solved it.
answers question: http://stackoverflow.com/q/23324093
score: 0
type: Answer

http://stackoverflow.com/comment/35858610
comment on: http://stackoverflow.com/a/23389040
has text: @Holger one little doubt here still: update the UI in EDT only, ok, but passing around UI components in other threads, to read their states, values and so on... is all ok? Right?
type: AnswerComment
score: 0
type: Comment

tcp
tags question: http://stackoverflow.com/q/23439375
type: Tag
tags question: http://stackoverflow.com/q/23377444
tags question: http://stackoverflow.com/q/23295451
tags question: http://stackoverflow.com/q/23398637
tags question: http://stackoverflow.com/q/23410894
tags question: http://stackoverflow.com/q/23355181
tags question: http://stackoverflow.com/q/23435698
tags question: http://stackoverflow.com/q/23418965
tags question: http://stackoverflow.com/q/23321247
tags question: http://stackoverflow.com/q/23387091
tag name: tcp
tags question: http://stackoverflow.com/q/23418621

interpreter
tags question: http://stackoverflow.com/q/23320878
tag name: interpreter
tags question: http://stackoverflow.com/q/23417218
type: Tag

servlet-3.0
tags question: http://stackoverflow.com/q/23342308
tag name: servlet-3.0
type: Tag

http://stackoverflow.com/q/23329342
score: 4
tagged with: postgresql
favorite count: 0
answer count: 0
tagged with: uuid
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35722388
linked to: http://stackoverflow.com/q/17969431
has title: Hibernate findByParam UUID
tagged with: java
tagged with: hibernate
type: Question
upvote count: 4
has body: I am editing existing project. My task is transform Integer primary keys to UUIDs. I have already edited database, but now I have problem with Hibernate. In this function: public List&lt;ResearchGroup&gt; getResearchGroupsWhereMember(Person person, int limit) { String hqlQuery = "from ResearchGroup researchGroup " + "where researchGroupId in (select rgm.id.researchGroupId from ResearchGroupMembership rgm where id.personId = :personId) " + "order by researchGroup.title"; getHibernateTemplate().setMaxResults(limit); List&lt;ResearchGroup&gt; list = getHibernateTemplate().findByNamedParam(hqlQuery, "personId", person.getPersonId()); getHibernateTemplate().setMaxResults(0); return list; } I get: org.postgresql.util.PSQLException: ERROR: operator does not exist: uuid = bytea Hint: No operator matches the given name and argument type(s). You might need to add explicit type casts. Person id is java.util.UUID object. @Type(type="pg-uuid") I think there is problem with findByNamedParamFunction(). How can it be replaced?
downvote count: 0

http://stackoverflow.com/comment/35959950
score: 0
has text: It will only run the first command, I expect it to start up two programs.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23449598

http://stackoverflow.com/a/23379820
type: Answer
has body: Camera.PictureCallback's method onPictureTaken is called asynchronously (see takePicture), your app should wait for it to be called.
answers question: http://stackoverflow.com/q/23315562
accepted answer of: http://stackoverflow.com/q/23315562
score: 0
type: AcceptedAnswer

http://stackoverflow.com/q/23369611
type: AnsweredQuestion
score: 1
tagged with: java
has title: creating zip file to byte array
type: Question
tagged with: zipoutputstream
downvote count: 0
answer count: 1
has body: I'm trying to read create a zip file out of a list of file paths. I wanted to have the zip file as a byte array so that i can return it as a ResponseEntity object back to the web page. the problem is when i tried FileOutputStream it works. I tried ByteArrayOutputStream the zip file is corrupted. below is the code //FileOutputStream bos = new FileOutputStream("C:\\files\\zipfile.zip"); ByteArrayOutputStream bos = new ByteArrayOutputStream(); ZipOutputStream zos = new ZipOutputStream(bos); ArrayList&lt;String&gt; filepaths = getAllFiles(); byte[] contents = null; for(String path : filepaths) { File pdf = new File(path); FileInputStream fis = new FileInputStream(pdf); ZipEntry zipEntry = new ZipEntry(path.substring(path.lastIndexOf(File.separator)+1)); zos.putNextEntry(zipEntry); byte[] buffer = new byte[1024]; int len; while ((len = fis.read(buffer)) &gt; 0) { zos.write(buffer,0,len); } fis.close(); zos.closeEntry(); zos.flush(); } contents = new byte[bos.size()]; contents = bos.toByteArray(); zos.close(); bos.close(); for the 1st 2 line that you see above, if i use ByteArrayOutputStream, the zip file is seems corrupted. But if i use FileOutputstream i'm unable to open the zip file and it's content. here is how I send back the zip byte array to the webpage. All these codes happen inside a spring controller method HttpHeaders headers = new HttpHeaders(); headers.setContentType(MediaType.parseMediaType("application/zip")); headers.setContentDispositionFormData(zipfileNm, zipfileNm); ResponseEntity&lt;byte[]&gt; response = new ResponseEntity&lt;byte[]&gt;(contents, headers, HttpStatus.OK); return response;
favorite count: 0
has answer: http://stackoverflow.com/a/23369995
tagged with: http://stackoverflow.com/tag/zip
upvote count: 1
tagged with: spring
accepted answer: http://stackoverflow.com/a/23369995

http://stackoverflow.com/comment/35917276
type: Comment
comment on: http://stackoverflow.com/q/23434625
score: 0
type: QuestionComment
has text: so i have to read in the "entire" file, then create a new one?

http://stackoverflow.com/comment/35754829
comment on: http://stackoverflow.com/a/23346419
has text: won't it lead to automatic update of table `b` (that has foreign key) when object `a` is committed ?
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/23386689
tagged with: spring-amqp
upvote count: 3
tagged with: message-queue
answer count: 1
downvote count: 0
accepted answer: http://stackoverflow.com/a/23388360
favorite count: 0
tagged with: rabbitmq
has answer: http://stackoverflow.com/a/23388360
has title: Send message to arbitrary vhost / exchange with RabbitMQ / Spring AMQP
type: AnsweredQuestion
score: 3
tagged with: java
has body: I use RabbitMQ and Spring AMQP to send messages. I have this snippet: rabbitTemplate.convertAndSend(exchange, key, object); This works when I operate on a single VHOST. I have to receive messages from 1 queue and resend them to N exchanges (on many different VHOSTs). How can I do it in Spring AMQP (ver 1.2)? Is there anything better than manually defined &lt;rabbit:connection-factory&gt; (for each VHOST) and related elements in my xml context?
type: Question

http://stackoverflow.com/a/23377209
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/23366686
has body: Found the solution. Simply ran the connection to the database in a separate thread using AsyncTask
answers question: http://stackoverflow.com/q/23366686
score: 0

http://stackoverflow.com/q/23398718
has body: I'm trying to write a simple program that will ask for the user to enter a number in-between 1 and 10, then display the number. Now I have gotten part to work where if the number is outside of the range it asks again, but I can't seem to get it to ask again if anything aside from a number is inputted, such as % or hello. The source code: (Cut out the top) public static void main(String[] args){ int number; //For holding the number String stringInput; //For holding the string values until converted //------------------// //Introducing the user JOptionPane.showMessageDialog(null, "This is a program that will ask \n" + "you to enter a number in-between \n" + "1-10, if the number is not within \n" + "the parameters, the program will repeat."); //---------------------// //Get input from the user stringInput = JOptionPane.showInputDialog("Enter number."); number = Integer.parseInt(stringInput); //-----------------// //Checking the number while (number &gt; 10 || number &lt; 0){ stringInput = JOptionPane.showInputDialog("That number is not within the \n" + "allowed range! Enter another number."); number = Integer.parseInt(stringInput); } //-------------------// //Displaying the number JOptionPane.showMessageDialog(null, "The number you chose is " + number + "."); //-------------// //Closing it down System.exit(0); } The main problem is the: number = Integer.parseInt(stringInput); I can't seem to convert the data values properly. I already thought of something like using an if statement to determine if the number is an integer, but I couldn't figure out how to check. I wish I could do: if (number == Integer) As you can see I am still extremely new to Java, any help is appreciated, thanks for taking the time to read.
type: Question
possible better answer: http://stackoverflow.com/a/23399362
tagged with: text-parsing
has answer: http://stackoverflow.com/a/23399362
score: 1
tagged with: java
answer count: 2
upvote count: 1
has answer: http://stackoverflow.com/a/23398757
accepted answer: http://stackoverflow.com/a/23398757
favorite count: 0
tagged with: joptionpane
type: AnsweredQuestion
downvote count: 0
has title: Converting JOptionPane input to integer
tagged with: swing

http://stackoverflow.com/comment/35665597
comment on: http://stackoverflow.com/q/23298390
has text: an instance of `Main extends Applet` is also an instance of `Applet` (and ultimately an instance of `Object`).
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35912596
comment on: http://stackoverflow.com/q/23431905
score: 0
type: Comment
type: QuestionComment
has text: thanks! you can provide the same as an answer and i will be happy to accept it :)

http://stackoverflow.com/a/23361560
type: Answer
has body: Characters are represented with 8 bits. hence to form 128 bit key, create a string having 16 chars (16*8=128), e.g. "abcdefgh12345678". to mask this key as base64, you may use Apache commons-codec Base64.encodeBase64... @see http://commons.apache.org/proper/commons-codec/apidocs/org/apache/commons/codec/binary/Base64.html
downvote count: 0
score: 7
answers question: http://stackoverflow.com/q/23361224
upvote count: 7

http://stackoverflow.com/comment/35932045
has text: probably. best way to find out is by trying ;)
comment on: http://stackoverflow.com/q/23442921
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23400703
type: UnansweredQuestion
score: 0
has answer: http://stackoverflow.com/a/23401777
tagged with: java
has body: I am using smartGwt 4.0, ListGrid allows us to add multiple columns with auto generated checkbox selection. I am using below property to get checkboxs for each record in the grid, listGrid.setSelectionAppearance(SelectionAppearance.CHECKBOX); I have many columns in the ListGrid so it comes with horizontal scrollbar, when i try to scroll to the right side, the selection checkbox column gets scrolled and after verifying mutil column values user has to scroll all the way left to select the record, this is bit annoying, is there a way to freez the checkbox column in ListGrid...?
type: Question
answer count: 1
tagged with: listgrid
tagged with: checkbox
tagged with: smartgwt
has title: Smartgwt ListGrid auto generated selection checkbox column freezing

http://stackoverflow.com/a/23331619
has body: This depends entirely on the framework you are using, at the very basic level, you will need some kind of trigger which allows you to periodically update the position of the sprite with some kind of delta In Swing, the simplest approach would be to use a javax.swing.Timer which allows you to fire an event at regular intervals, but which are triggered within the Event Dispatching Thread, reducing possible thread contamination and dirty paints import java.awt.BorderLayout; import java.awt.Dimension; import java.awt.EventQueue; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Point; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.image.BufferedImage; import java.io.IOException; import javax.imageio.ImageIO; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.Timer; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; public class SimpleSprite { public static void main(String[] args) { new SimpleSprite(); } public SimpleSprite() { EventQueue.invokeLater(new Runnable() { @Override public void run() { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) { } JFrame frame = new JFrame("Testing"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setLayout(new BorderLayout()); frame.add(new AnimationPane()); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); } }); } public class AnimationPane extends JPanel { private BufferedImage dalek; private Point dalekPoint; private int deltaX = 1; public AnimationPane() { dalekPoint = new Point(); try { dalek = ImageIO.read(getClass().getResource("/dalek.png")); dalekPoint.y = (200 - dalek.getHeight()) / 2; } catch (IOException ex) { ex.printStackTrace(); } Timer timer = new Timer(40, new ActionListener() { @Override public void actionPerformed(ActionEven…
answers question: http://stackoverflow.com/q/23331476
type: AcceptedAnswer
downvote count: 0
score: 1
type: Answer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/23331476

http://stackoverflow.com/q/23352592
tagged with: java-native-interface
downvote count: 0
tagged with: http://stackoverflow.com/tag/c
has comment: http://stackoverflow.com/comment/35765936
has title: Redirecting STDIN and STDOUT of C program in Android
has body: I am trying to port a C program to android using JNI. I have been able to set up the program and get java and c working fine together. The problem is I need to be able to use STDIN since the C program reads input from STDIN and returns a response through STDOUT (C program is a server-client application). I don't know if it is worth mentioning but the C program uses STDIN_FILENO file descriptor for reading input from STDIN. How do I read from STDOUT and WRITE to STDIN using Java? I did some research and found some vague explanation at the following link: https://groups.google.com/forum/#!topic/android-ndk/Brm6jPr4C0Y that I don't understand. Here's is the C code https://github.com/unekwu/kemi/blob/master/jni/dnscat/dnscat.c#L1270 More Details The C program is usually run from command line like dnscat --dns &lt;ip&gt; &lt;port&gt; After which it starts listening for messages from the user. Normally entered from stdin. Now in my Android app, I'm able to run it with JNI by calling main and different name and passing ann array of strings to it. I'v verify the program starts up correcting. The problem is how I'll send the messages to the program since there's no stdin on android.
favorite count: 0
has answer: http://stackoverflow.com/a/23420295
possible better answer: http://stackoverflow.com/a/23404153
tagged with: android
has answer: http://stackoverflow.com/a/23404153
accepted answer: http://stackoverflow.com/a/23420295
linked to: http://stackoverflow.com/q/27091001
type: AnsweredQuestion
upvote count: 5
tagged with: java
has comment: http://stackoverflow.com/comment/35884940
has comment: http://stackoverflow.com/comment/35865128
tagged with: android-ndk
type: Question
has comment: http://stackoverflow.com/comment/35765423
answer count: 2
score: 5

http://stackoverflow.com/comment/35920949
type: Comment
has text: The only other running java process is JVisualVM... and OS X and visualvm agree with the process id of netbeans. Are these literally the only 2 places java could be consuming memory?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23436513

http://stackoverflow.com/q/23384311
has answer: http://stackoverflow.com/a/23384371
type: AnsweredQuestion
has body: The javadoc for URL's .toURI() method mentions that it can throw a URISyntaxException if: [...] this URL is not formatted strictly according to to RFC2396 and cannot be converted to a URI. However, I have so far unsuccessfully tried to trigger this exception. What is more, you need to "pass" the URL constructor tests anyway. So, does there exist an example of a valid URL which is not a valid URI?
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/23384891
has title: An example of URL which cannot be converted .toURI()?
answer count: 2
tagged with: uri
downvote count: 0
tagged with: url
accepted answer: http://stackoverflow.com/a/23384891
favorite count: 0
score: 8
upvote count: 8
possible better answer: http://stackoverflow.com/a/23384371

http://stackoverflow.com/comment/35741143
has text: That's okay then. Because tape-and-string prototype code *never* ends up being deployed into production. Ever. ;-) (But... it is still easier to use a `PreparedStatement`, just for your own convenience and sanity.)
comment on: http://stackoverflow.com/q/23339433
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/q/23425514
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23426256
tagged with: java
tagged with: swing
type: Question
has body: I have a problem with Jlist. I want to make an DB select and put result string into a Jlist. My select is working, and i can view result in console, but how can I put it into my list? ... private JList list; ... final JList list = new JList(); list.setBounds(71, 111, 246, 79); panelSelect.add(list); ... try { connectionUtility.openConnection(); String select = "SELECT ID_UN,NUME_UN,ADRESA_UN FROM UNIVER"; connectionUtility.stm = connectionUtility.conn.prepareStatement(select); PreparedStatement pst = (PreparedStatement) connectionUtility.stm; ResultSet rs = pst.executeQuery(select); while (rs.next()) { String univid = rs.getString("ID_UN"); String univname = rs.getString("NUME_UN"); String univadresse = rs.getString("ADRESA_UN"); String label[] = {univid, univname, univadresse}; //here I need to do something to put the elements into list // list.addItem ... ??? //here I view selected data in console and works 100% System.out.println("univid : " + univid); System.out.println("univname : " + univname); System.out.println("univadresse : " + univadresse); }
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/23426256
tagged with: jlabel
possible better answer: http://stackoverflow.com/a/23426070
has comment: http://stackoverflow.com/comment/35900719
has answer: http://stackoverflow.com/a/23426070
has title: How to populate a Jlist

http://stackoverflow.com/a/23326632
score: 1
upvote count: 1
has body: you can use AMQP.Queue.PurgeOk queuePurge(java.lang.String queue) "See queuePurge: http://www.rabbitmq.com/amqp-0-9-1-quickref.html#queue.purge"
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/23325743

http://stackoverflow.com/comment/35865669
has text: Thanks, that's what I was looking for! There seems to be a lot new in Java8 to explore :)
type: AnswerComment
comment on: http://stackoverflow.com/a/23407107
score: 0
type: Comment

http://stackoverflow.com/q/23320267
score: 3
tagged with: numbers
tagged with: java
possible better answer: http://stackoverflow.com/a/23320288
type: Question
has answer: http://stackoverflow.com/a/23320288
answer count: 2
tagged with: casting
downvote count: 0
has answer: http://stackoverflow.com/a/23320280
favorite count: 0
has title: How to cast numbers (like int) to "Number"?
accepted answer: http://stackoverflow.com/a/23320280
upvote count: 3
has body: This could be basic question but I could not find something useful. Question is: How to convert double or int value to Number type ( to be more specific oracle.jbo.domain.Number) I tried the following: for integer values int i=9; Integer y=new Integer(i); oracle.jbo.domain.Number num=(oracle.jbo.domain.Number)y; for float values double i=9.5; Double y=new Double(i); oracle.jbo.domain.Number num=(oracle.jbo.domain.Number)y; But I always get incompatible types error in both cases: Type 'oracle.jbo.domain.Number' incompatible with 'java.lang.Integer' and Type 'oracle.jbo.domain.Number' incompatible with 'java.lang.Double' if the conversion did not work, then how to simply create Number object in java
type: AnsweredQuestion

http://stackoverflow.com/q/23337470
tagged with: algorithm
answer count: 1
score: 0
upvote count: 1
downvote count: 1
favorite count: 0
has title: Floor of a value in BST
tagged with: tree
type: AnsweredQuestion
has body: Given a value and a BST , we need to find the largest number which is just smaller or equal to the given value , i.e. , the floor of the value. For example, 1 4 7 9 12 13 43 45 is the given inOrder traversal of the BST and we are given a value 15 . So floor(15) = 13 , floor(10) = 9 , etc. I was doing inOrder traversal and maintaining a previous node and if the value is between data of previous and root node then returnt that value as floor. However, it doesn't work for all cases. Also since it is a BST we dont need to do complete traversal , we can make use of BST property. But I am not able to convert my logic into code. So can anyone please help with it? Preferably in Java. We need to use it in our project in which we are sort of creating a new language based on Java.
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/23341239
accepted answer: http://stackoverflow.com/a/23341239

http://stackoverflow.com/a/23446202
has comment: http://stackoverflow.com/comment/35941796
upvote count: 2
type: Answer
answers question: http://stackoverflow.com/q/23440517
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/35941466
has body: The problem is that your &lt;form&gt; has enctype="multipart/form-data". You should only add that attribute in &lt;form&gt; when trying to upload a file. Since in your current page you don't need to upload a file, just remove it and everything will work perfectly: &lt;form action="trial.jsp" method="POST" &gt; &lt;table&gt; &lt;tr&gt; &lt;td class="entry"&gt; &lt;!-- rest of your HTML code --&gt; &lt;/form&gt; In case you want/need to add file upload functionality to your current page, then please refer to How to upload files to server using JSP/Servlet? in order to solve these problems (I won't reinvent the wheel in this answer).

http://stackoverflow.com/comment/35737234
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23337653
has text: You have no method to add a Customer to a customerlist (since customerlist is private within BankLogic).
score: 0

http://stackoverflow.com/q/23440323
type: Question
has body: I have a problem trying to figure out the best way to complete a simple app following the Android best practises. Here is the scenario: 1) I have an activity where the user enters something, its then send to a background Service 2) The background service performs some checks on the input and spawns a new AsyncTask to process the input. 3) The asynctask updates a Status Hashmap in the service with its progress and status 4) There is an second activity that binds to the Service to display a list of currently running tasks from the service and their progresses. The idea is that even if this activity is closed the service will continue to run the tasks and when the activity is reopened the refreshed stats will be shown. I have problems in 3 and 4. What is the best way to communicate to the Service from within the AsyncTask's onProgressUpdate method and at the same time update the listing activity if its opened, if its not opened its simpler, just update the service tracking maps and when the activity is opened it will read them and update. Im not sure what is the standart approach to handle "Events" of that sort. Do you have to use a Broadcast listener and subscriber or its too much for this simple purpose?
has comment: http://stackoverflow.com/comment/35928697
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/35928795
tagged with: service
tagged with: android-asynctask
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/35928581
tagged with: java
has answer: http://stackoverflow.com/a/23441230
has title: Android service and asynctask communication

http://stackoverflow.com/a/25576541
downvote count: 0
answers question: http://stackoverflow.com/q/23370836
has body: I was having the same error. For me the problem was that I was not closing the file (file.close()) in JNI code.
has comment: http://stackoverflow.com/comment/66150960
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/comment/35703169
type: Comment
has text: Datastore also has transactions. If you don't need text search you would normally never use the Search API.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23317616

http://stackoverflow.com/comment/35837736
has text: In UsersLocation.java you have defined "public void setUserId(User user)" then it would expect a User not a org.brickred.socialauth.Profile. How does your User.java class looks like ? May be you have to populate you User object from the Profile. It's your design I only have to assume without seeing your code.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23392221
type: AnswerComment

http://stackoverflow.com/q/23311418
has comment: http://stackoverflow.com/comment/35689375
has comment: http://stackoverflow.com/comment/35690004
has comment: http://stackoverflow.com/comment/35690510
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35689209
tagged with: java.util.scanner
has comment: http://stackoverflow.com/comment/35689556
has comment: http://stackoverflow.com/comment/35689262
type: Question
has comment: http://stackoverflow.com/comment/35689108
has comment: http://stackoverflow.com/comment/35689156
tagged with: java
has answer: http://stackoverflow.com/a/23312033
has comment: http://stackoverflow.com/comment/35689551
score: 0
has comment: http://stackoverflow.com/comment/35689498
has title: Exception in thread "main" java.util.InputMismatchException at nextInt, next
has comment: http://stackoverflow.com/comment/35690137
answer count: 1
has comment: http://stackoverflow.com/comment/35690196
has body: This error has come up when I try to run this: public class gift1 { public static void main(String[] args) throws IOException{ //declare and initialize scanner to read from gift1.in Scanner scan = new Scanner(new File("gift1.in")); //declare and initialize PW to write result PrintWriter out = new PrintWriter(new File("gift1.out")); int np = scan.nextInt(); List&lt;String&gt; people = new ArrayList&lt;String&gt;(); for(int o = 1; o&lt;np; o++) { people.add(scan.next()); } Map&lt;String, Integer&gt; monReceived = new HashMap&lt;String, Integer&gt;(); for(String person : people) { monReceived.put(person, 0); } Map&lt;String, Integer&gt; Initial = new HashMap&lt;String, Integer&gt;(); for(int i = 0; i &lt; np; i++) { String person = scan.next(); int amount = scan.nextInt(); int giveto = scan.nextInt(); Initial.put(person, amount); int amountGift = 0; if(giveto &gt; 0) { amountGift = (amount/giveto); monReceived.put(person, monReceived.get(person) + (amountGift%giveto)); } for(int j = 0; j &lt; giveto; j++) { String receivers = scan.next(); monReceived.put(receivers, monReceived.get(receivers) + (amountGift - amountGift%giveto)); } } for(String person : people) { out.println(person + " " + (monReceived.get(person) - Initial.get(person))); } out.close(); System.exit(0); } } do you know why this is? Do i need to add a try/catch? that is the only thought I have had. I have considered changing and using a BufferedReader but that reduces functionality that I need. What is the problem with my code? Thanks, Sam. More details: It says the errors are at: at java.util.Scanner.throwFor(Scanner.java:909) at java.util.Scanner.next(Scanner.java:1530) at java.util.Scanner.nextInt(Scanner.java:2160) at java.util.Scanner.nextInt(Scanner.java:2119) at gift1.main(gift1.java:24) so I assume it is to do with the scanner but I can't see a problem hence I thought I should try try/catch but it hasn't worked as Ive done it.` edit:the input data is shown below: the first line is an int so I don't…
tagged with: exception
accepted answer: http://stackoverflow.com/a/23312033

http://stackoverflow.com/comment/35857517
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23400585
type: AnswerComment
has text: Yes, I added the ** to the end of the stacktrace. Before, the code above used eclipseLink as persistent data layer, I have to change it for hibernate. To test production mode, I choose to add an SQL script to generate schema and I configure hibernate to only validate schema in the spring context : hibernate.hbm2ddl.auto -> validate

http://stackoverflow.com/q/23389815
has title: Paypal Reauth failing- DCC_REAUTHORIZATION_NOT_ALLOWED
type: UnansweredQuestion
tagged with: java
tagged with: paypal
type: Question
has comment: http://stackoverflow.com/comment/35832842
score: 0
tagged with: api
answer count: 1
has body: We are facing issue while doing reauth with Paypal API's.Please help if someone has encountered with this error. We have created one authorization few days back and now we are trying to do the re-auth for this using following authorization= Authorization.get(accessToken, "8EU99222SR844720V"); Amount amount = new Amount(); amount.setCurrency("USD").setTotal("10"); authorization.setAmount(amount); Authorization reauthorization = authorization.reauthorize(accessToken); We are getting this error: SEVERE: Error code : 500 with response : {"name":"**DCC_REAUTHORIZATION_NOT_ALLOWED","message":"Reauthorization not allowed for this product**.","information_link":"https:// developer.paypal.com/webapps/developer/docs/api/#DCC_REAUTHORIZATION_NOT_ALLOWED","debug_id":"2d9b8f10ed53c"} Exception in thread "main" com.paypal.core.rest.PayPalRESTException: Error code : 500 with response : {"name":"DCC_REAUTHORIZATION_NOT_ALLOWED","message":"Reauthorization not allowed for this product.","information_link":"https:// developer.paypal.com/webapps/developer/docs/api/#DCC_REAUTHORIZATION_NOT_ALLOWED","debug_id":"2d9b8f10ed53c"} at com.paypal.core.rest.PayPalResource.execute(PayPalResource.java:329) at com.paypal.core.rest.PayPalResource.configureAndExecute(PayPalResource.java:245) at com.paypal.core.rest.PayPalResource.configureAndExecute(PayPalResource.java:191) at com.paypal.api.payments.Authorization.reauthorize(Authorization.java:387) at com.paypal.api.payments.Authorization.reauthorize(Authorization.java:366) at com.paypal.api.payments.AuthorizationTestCase.testGetAuthorization(AuthorizationTestCase.java:87) at com.paypal.api.payments.AuthorizationTestCase.main(AuthorizationTestCase.java:66) Caused by: com.paypal.exception.HttpErrorException: Error code : 500 with response : {"name":"DCC_REAUTHORIZATION_NOT_ALLOWED","message":"Reauthorization not allowed for this product.","information_link":"https:// developer.paypal.com/webapps/developer/docs/api/#DCC_REAUTHORIZATION_NOT_ALLOWED","…
has answer: http://stackoverflow.com/a/23394369
tagged with: rest

jetty-9
tag name: jetty-9
type: Tag
tags question: http://stackoverflow.com/q/23394716

http://stackoverflow.com/comment/35890739
comment on: http://stackoverflow.com/a/23420328
type: AnswerComment
score: 0
has text: I understand the relationships now after reading the links you shared with me. I'm not quite there on understanding what you mean with the constructor but I'll research it further to try a get a better understanding. I also understand that I am using JTextFields in a strange way, it's simply how my lecturer did it in an example he gave us in class. I'll try using a JLabel or JList instead.
type: Comment

http://stackoverflow.com/a/23302127
accepted answer of: http://stackoverflow.com/q/23301702
type: Answer
answers question: http://stackoverflow.com/q/23301702
has body: If your purpose is just print , then you don't need to store and don't required String[] content .. Just read the line and validate the line falls in particular pattern. Move the condition to while loop. while (inputStream.hasNext()) { String content = inputStream.nextLine(); // Move the condition and check with content variable. if ( content.matches("^\\d{3}\\.\\d{1}\\.\\d{1}\\.\\d{1}\\:\\d{4}")) { System.out.println(content); } else { System.out.println("Not Valid"); } } In case your purpose is store the content . When you don't know the size / number of lines up ahead like this case , use List to store which can grow dynamically as required. Like List&lt;String&gt; contents = new ArrayList&lt;String&gt;() And add the valid line with in valid condition like this. contents.add(content);
score: 0
type: AcceptedAnswer

http://stackoverflow.com/q/23329352
has body: SelectionsBean package sessiontracking; import java.io.Serializable; import java.util.HashMap; import java.util.Set; import java.util.TreeSet; import javax.faces.bean.ManagedBean; import javax.faces.bean.SessionScoped; @ManagedBean( name="selectionsBean" ) @SessionScoped public class SelectionsBean implements Serializable { // map of topics to book titles private static final HashMap< String, Double > booksMap = new HashMap< String, Double >(); double total; // initialize booksMap static { booksMap.put( "java", 19.99 ); booksMap.put( "cpp", 29.99 ); booksMap.put( "iphone", 32.99 ); booksMap.put( "android", 15.99 ); } // end static initializer block // stores individual user's selections private Set< String > selections = new TreeSet< String >(); private String selection; // stores the current selection // return number of selections public int getNumberOfSelections() { return selections.size(); } // end method getNumberOfSelections // returns the current selection public String getSelection() { return selection; } // end method getSelection // store user's selection public void setSelection( String topic ) { selection = booksMap.get( topic ); selections.add( selection ); } // end method setSelection // return the Set of selections public String[] getSelections() { return selections.toArray( new String[ selections.size() ] ); } // end method getSelections } // end class SelectionsBean index.html: <h:head> Topic Selection Page </h:head> <h:body> Welcome to Sessions! You have made #{selectionsBean.numberOfSelections} selection(s) Make a Selection and Press Submit <h:form> <h:selectOneRadio id="topicSelectOneRadio" required="true" requiredMessage="Please choose a book, then press Submit" value="#{selectionsBean.selection}"> <f:selectItem itemValue="java" itemLabel="Java How to Program"/> <f:selectItem itemValue="cpp" itemLabel="How to C++"/> <f:selectItem itemValue="iphone" itemLabel="Learn All About iPhone"/> <f:selectItem itemValue="android" itemLabel="Everything to l…
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/35722734
score: 0
has title: Creating a Shopping Cart in Java. Confused on using Hashmap
has comment: http://stackoverflow.com/comment/35722247
has comment: http://stackoverflow.com/comment/35722252
type: UnansweredQuestion
tagged with: http://stackoverflow.com/tag/html
tagged with: jsf
answer count: 0

http://stackoverflow.com/comment/35976055
type: Comment
comment on: http://stackoverflow.com/a/23454870
score: 0
type: AnswerComment
has text: @Peter: Thanks for the help. To suspend B => ProducerTemplate producerTemplate = camelContext.createProducerTemplate(); producerTemplate.sendBody("controlbus:language:simple", "${camelContext.suspendRoute(" + "B" + ", 5, " + TimeUnit.SECONDS + ")}"); To resume A => ProducerTemplate producerTemplate = camelContext.createProducerTemplate(); producerTemplate.sendBody("controlbus:route?routeId=" + "A" + "&action=resume", null); But once suspended, B can not be resumed? any idea..

http://stackoverflow.com/a/23348598
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23348539
has body: Once a method is abstract, it is declared to have no implementation. How would you suggest the VM instantiate an instance of that class?

http://stackoverflow.com/comment/35771937
type: AnswerComment
score: 0
type: Comment
has text: @Dillis put everything in your spring xml
comment on: http://stackoverflow.com/a/23356453

http://stackoverflow.com/comment/52440574
score: 0
comment on: http://stackoverflow.com/q/23450131
type: Comment
type: QuestionComment
has text: oh yeah...sorry..I forgot to put that piece of code in the parameter of the loadUrl method

http://stackoverflow.com/comment/35858397
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23403442
has text: If you are using `curName` variable as String, then why are you passing it as string again in `sendKeys()`

http://stackoverflow.com/a/23436506
upvote count: 1
has comment: http://stackoverflow.com/comment/35921133
type: Answer
downvote count: 0
has body: Its a poor choice because you are counting on one thread catching an interrupted exception every time. Exceptions are a high overhead mechanism for IPC. There may be more reasons but this is enough to get it yanked out of production code.
answers question: http://stackoverflow.com/q/23436454
score: 1
has comment: http://stackoverflow.com/comment/35922823

http://stackoverflow.com/q/23361362
has answer: http://stackoverflow.com/a/23361430
accepted answer: http://stackoverflow.com/a/23361430
has title: Processing and heap size
type: AnsweredQuestion
downvote count: 0
has comment: http://stackoverflow.com/comment/35780990
linked to: http://stackoverflow.com/q/4401396
type: Question
tagged with: processing
score: 1
tagged with: java
has body: I'm trying to run the first example of augmented reality in Processing. Upon hitting the run button I get the following message: [0] "Error occurred during initialization of VM" [1] "Could not reserve enough space for object heap" Error: Could not create the Java Virtual Machine. Error: A fatal exception has occurred. Program will exit. The sketch is run on a computer with 8GB of RAM, Processing (x86) and I've increased the maximum available memmory to 2048MB in the preferences, but it still doesn't work. How can I resolve this?
has comment: http://stackoverflow.com/comment/35780229
upvote count: 1
answer count: 1
favorite count: 0

http://stackoverflow.com/q/23446727
answer count: 1
tagged with: porting
has body: I have written an RTMPS client a while back and needed it for my Django application but since Java and Python don't play well without using system calls (I don't want to use Jython) I wanted to rewrite the application in Python. Would it work if I ported it as if to Python from Java? Of course we have to take into account the obvious things like multiple constructors have to be done differently in Python. Are there any other things that would not make it work in Python? I am doing this because Java is so memory heavy and hoping that moving in into Python would reduce memory footprint and thus allow my web app to use it.
favorite count: 0
tagged with: django
tagged with: python
accepted answer: http://stackoverflow.com/a/23446886
type: AnsweredQuestion
tagged with: java
downvote count: 2
type: Question
has comment: http://stackoverflow.com/comment/35939297
has title: Porting an app from Java to Python
score: -2
has answer: http://stackoverflow.com/a/23446886
upvote count: 0

http://stackoverflow.com/q/23360690
has comment: http://stackoverflow.com/comment/35779151
tagged with: android
has answer: http://stackoverflow.com/a/23360838
accepted answer: http://stackoverflow.com/a/23360838
has title: Parsing data makes my app crash--Why?
type: AnsweredQuestion
has body: So I am making an app that takes data from a webpage as text, parses it into data structures, and then displays it in a table. The trouble is, I wrote the code that creates the data structures and places the data in a table, but now, the app crashes when I run it. Here is the relevant code: protected void onPostExecute(String result) { String s1 = makeReadable(result); ArrayList &lt;OfferRequest&gt; al = makeStructures(s1); makeRows(al); } } public String makeReadable(String input){ String result = input.replace("~~", "[empty]"); String result2 = result.replace("~", ""); String result3 = result2.replace("&lt;", ""); String result4 = result3.replace("&gt;", ""); return result4; } public ArrayList &lt;OfferRequest&gt; makeStructures(String input){ OfferRequest or; ArrayList &lt;OfferRequest&gt; orList = new ArrayList &lt;OfferRequest&gt;(); String [] items = input.split ("\n"); String [] splitItems; for(int i = 0; i &lt; items.length; i++){ splitItems = items[i].split("|"); int id = Integer.parseInt(splitItems[0]); int isOffer = Integer.parseInt(splitItems[1]); boolean isOffer2 = (isOffer != 0); int units = Integer.parseInt(splitItems[2]); double price = Double.parseDouble(splitItems[3]); String currency = splitItems[4]; String created = splitItems[5]; String specs = splitItems[6]; String comment = splitItems[7]; String companyName = splitItems[8]; String category = splitItems[9]; String itemName = splitItems[10]; String user = splitItems[11]; String toBeDelivered = splitItems[12]; String lastUpdated = splitItems[13]; or = new OfferRequest(id, isOffer2, units, price, currency, created, specs, comment, companyName, category, itemName, user, toBeDelivered, lastUpdated); orList.add(or); } return orList; } public void makeRows(ArrayList &lt;OfferRequest&gt; input){ TableRow t; TextView t1, t2, t3, t4, t5, t6, t7, t8; for (int i = 0; i &lt; input.size(); i++){ t1 = new TextView(this); t2 = new TextView(this); t3 = new TextView(this); t4 = new TextView(this); t5 = new TextV…
upvote count: 0
tagged with: java
type: Question
answer count: 2
score: -1
possible better answer: http://stackoverflow.com/a/23360874
has answer: http://stackoverflow.com/a/23360874
has comment: http://stackoverflow.com/comment/35779175
downvote count: 1
favorite count: 0

http://stackoverflow.com/a/23452393
has body: The rows may not be disabled, but if you do not want the users to modify the values of the row that could be achieved using the EditingSupport in JFace. The canEdit() method in EditingSupport class determines if the cell can be edited. eg., class MyEditingSupport extends EditingSupport { ... @Override protected boolean canEdit(Object element) { return condition_to_determine_if_the_row_should_be_disabled; } ... } Here is a good article on using EditingSupport for tables.
has comment: http://stackoverflow.com/comment/36120162
answers question: http://stackoverflow.com/q/23391265
score: 0
type: Answer

http://stackoverflow.com/comment/35948360
score: 1
comment on: http://stackoverflow.com/q/23451347
has text: You'll have to use some sort of [Inter-Process Communication](https://en.wikipedia.org/wiki/Inter-process_communication). It really depends on the process you are starting.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23328719
downvote count: 0
has answer: http://stackoverflow.com/a/23348351
has body: Assume I have a StringBuffer with values "1 \n 2 \n 3 \n...etc" where \n is a line break. How would I add these values to an existing CSV file as a column using Java? Specifically, this would be the last column. For example, let's say I have a CSV file that looks like this: 5, 2, 5 2, 3, 1 3, 5, 2 .. etc. The output should look like this given the StringBuffer after using the method to add the column to the csv file: 5, 2, 5, 1 2, 3, 1, 2 3, 5, 2, 3 .. etc. I also plan to add columns with 1000s of values so I am looking for something that does not have high memory consumption. Thanks ahead of time. Edit: Columns may be different sizes. I see people saying to add it at the end of each line. The problem is, it will add the values to the wrong columns and I cannot have that happen. I thank you all for your suggestions though as they were very good. Edit 2: I have received critique about my use of StringBuffer and yes, I agree, if this problem were isolated, I would also suggest StringBuilder. The context of this problem is a program that has synchronized threads (acting as scenarios) collecting response times given a range of concurrent threads. The concurrent threads execute concurrent queries to a database and once the query has been executed, the result is appended to a StringBuffer. All the response times for each synchronized thread is appended to a StringBuffer and written to a CSV document. There can be several threads with the same response time. I can use StringBuilder but then I would have to manually synchronize the threads appending the response times and in my case, I do not think it would make too much of a difference in performance and would add an unnecessary amount of code. I hope this helps and I once again, thank you all for your concerns and suggestions. If after reading this, you are still not convinced that I should use StringBuffer, then I ask that we please take this discussion offline. Edit 3: I have figured out how to go around the issue of ad…
tagged with: http://stackoverflow.com/tag/csv
has comment: http://stackoverflow.com/comment/35725274
answer count: 1
has comment: http://stackoverflow.com/comment/35721063
favorite count: 0
has comment: http://stackoverflow.com/comment/35721117
has title: Adding column to CSV file with StringBuffer values (Java)
accepted answer: http://stackoverflow.com/a/23348351
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35721127
has comment: http://stackoverflow.com/comment/35721079
has comment: http://stackoverflow.com/comment/35757357
score: 3
has comment: http://stackoverflow.com/comment/35721222
upvote count: 3
tagged with: java
tagged with: stringbuffer
type: Question
has comment: http://stackoverflow.com/comment/35721872
has comment: http://stackoverflow.com/comment/35725382
has comment: http://stackoverflow.com/comment/35725216

http://stackoverflow.com/q/23345160
answer count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/35750830
favorite count: 0
has answer: http://stackoverflow.com/a/23345481
has body: I am having trouble reading the first word of a text file. If the first word equals 'Circle' I want to create a new Circle object in my array. FileInputStream fileIn = new FileInputStream("shapeFile.txt"); Scanner scan = new Scanner(fileIn); while(scan.hasNextLine()) { String shape = scan.next(); if(shape.equals("Circle")) { myShapes.addShape(new Circle(scan.nextInt(), scan.nextInt(), scan.nextInt(), Color.RED)); } } I am getting the following error for the above code, pointing to the line String shape = scan.next(); Exception in thread "main" java.util.NoSuchElementException at java.util.Scanner.throwFor(Scanner.java:862) at java.util.Scanner.next(Scanner.java:1371) at shapes.ShapeManagement.main(ShapeManagement.java:151) Java Result: 1 If anyone could help me resolve this I would be most grateful.
linked to: http://stackoverflow.com/q/13729294
has comment: http://stackoverflow.com/comment/35750775
type: AnsweredQuestion
tagged with: java.util.scanner
possible better answer: http://stackoverflow.com/a/23345481
has answer: http://stackoverflow.com/a/23345524
upvote count: 3
tagged with: java
has title: Java - Reading first word of text file
type: Question
score: 3
has comment: http://stackoverflow.com/comment/35750948
has comment: http://stackoverflow.com/comment/35750736
accepted answer: http://stackoverflow.com/a/23345524

http://stackoverflow.com/a/28768637
answers question: http://stackoverflow.com/q/23333031
upvote count: 2
has body: you can try it with the java-comment-preprocessor: java -jar ./jcp-6.0.0.jar --i:/sourceFolder --o:/resultFolder -ef:none --r source
type: Answer
has comment: http://stackoverflow.com/comment/82939858
score: 2
downvote count: 0

http://stackoverflow.com/a/23324642
score: 0
has body: Now, the update looks like this. public CounselInfoEntity editTo(CounselInfoEntity model) { CounselInfoEntity entity = id(model.getId()); List&lt;? extends Attribute&lt;CounselInfoEntity, ?&gt;&gt; editAttrs = Lists.&lt;Attribute&lt;CounselInfoEntity, ?&gt;&gt;newArrayList(CounselInfoEntity_.name, CounselInfoEntity_.address, CounselInfoEntity_.education, CounselInfoEntity_.phone, CounselInfoEntity_.QQ, CounselInfoEntity_.remark, CounselInfoEntity_.school, CounselInfoEntity_.age, CounselInfoEntity_.sex); BeanHelper.merge(entity, model, BeanHelper.skipNullOrEmpty(model, editAttrs)); if (model.getClassIntention() != null) { entity.setClassIntention(classService.id(model.getClassIntention().getId())); } return entity; } Here is BeanHelper package me.wener.practices.web.common.util; import com.google.common.collect.Lists; import java.lang.reflect.Field; import java.util.List; import javax.persistence.metamodel.Attribute; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.reflect.FieldUtils; @Slf4j public class BeanHelper { /** * 获取 bean 的属性,如果属性不存在或发生异常返回null */ public static Object tryGetProperty(Object bean, String attrName) { Object property = null; try { Field field = FieldUtils.getField(bean.getClass(), attrName, true); property = field.get(bean); } catch (Exception e) { if (log.isErrorEnabled()) log.error("Exception when get property " + attrName + " on " + bean, e); } return property; } public static &lt;T, A extends Attribute&lt;T, ?&gt;&gt; Object tryGetProperty(T bean, A attr) { return tryGetProperty(bean, attr.getName()); } public static &lt;T, A extends Attribute&lt;T, ?&gt;&gt; boolean trySetProperty(T bean, A attr, Object value) { return trySetProperty(bean, attr.getName(), value); } public static boolean trySetProperty(Object bean, String attrName, Object value) { boolean failed = false; try { // 对于 chain 的 setter 方法, 必须要使用 force access. Field field = FieldUtils.getField(bean.getClass(), attrName, true); field.set(bean, value); } catch (Exce…
type: Answer
answers question: http://stackoverflow.com/q/23319055
accepted answer of: http://stackoverflow.com/q/23319055
type: AcceptedAnswer

http://stackoverflow.com/q/23399994
type: AnsweredQuestion
tagged with: java
tagged with: jboss
has comment: http://stackoverflow.com/comment/35852306
score: -1
tagged with: eclipse
type: Question
has title: UnsupportedClassVersionError Deploying webapp in Tomcat 7
accepted answer: http://stackoverflow.com/a/23400015
upvote count: 0
answer count: 1
has body: I'm deploying a webapp in Tomcat7 which was built by Eclipse using Java Oracle 1.7. I'm receiving this error which seems to indicate that different Java versions are being used. However when I run java -version I get 'java version "1.7.0_51"' which is the same version as the compilation version. It should be noted that this web app works fine in the eclipse tomcat server nenvironment, but doesn't seem to work when deploying in the main tomcat installation. 01-May-2014 00:37:46 org.apache.catalina.startup.HostConfig deployWAR INFO: Deploying web application archive /var/lib/tomcat7/webapps/prov.war log4j:WARN No appenders could be found for logger (org.jboss.resteasy.plugins.server.servlet.ConfigurationBootstrap). log4j:WARN Please initialize the log4j system properly. log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info. 01-May-2014 00:37:47 org.apache.catalina.core.StandardContext listenerStart SEVERE: Exception sending context initialized event to listener instance of class org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap java.lang.UnsupportedClassVersionError: uk/co/alexjking/prov/ProvClustererWebApp/ClusterHandler : Unsupported major.minor version 51.0 (unable to load class uk.co.alexjking.prov.ProvClustererWebApp.ClusterHandler) at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2840) at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1160) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1668) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1546) at org.jboss.resteasy.plugins.server.servlet.ConfigurationBootstrap.processScannedResources(ConfigurationBootstrap.java:384) at org.jboss.resteasy.plugins.server.servlet.ConfigurationBootstrap.createDeployment(ConfigurationBootstrap.java:181) at org.jboss.resteasy.plugins.server.servlet.ListenerBootstrap.createDeployment(ListenerBootstrap.java:32)…
favorite count: 0
tagged with: maven
has answer: http://stackoverflow.com/a/23400015
tagged with: tomcat7
downvote count: 1

http://stackoverflow.com/comment/35772664
type: QuestionComment
comment on: http://stackoverflow.com/q/23339895
has text: Thanks for reply! Actually I did, I tried exactly that. Still not working :-( Would it be helpful if I posted the generated JPQL query? Unfortunately I think it wouldn't be helpful to past the whole code since it's very complex and complicated. My goal: select those test executions that have certain tags but exclude those with some other, kind like a +tag1 +tag2 -mustNotBePresentTag. I have Predicate with the desired tags and the exact query that you linked concatenated with builder.and(). Do you see any mistake?
score: 0
type: Comment

http://stackoverflow.com/comment/35703418
score: 0
type: Comment
type: QuestionComment
has text: Seems like `MjpegInputStream result` param to `onPostExecute` is `Null` .
comment on: http://stackoverflow.com/q/23319128

eval
tags question: http://stackoverflow.com/q/23444878
type: Tag
tag name: eval

http://stackoverflow.com/a/23319302
type: Answer
answers question: http://stackoverflow.com/q/23319262
has body: I think you have typo, you set value in session but trying to read from request. make these two calls in sync, use either session or request.
score: 0

http://stackoverflow.com/q/23449174
has body: Is it possible to use one result set to query another result set in JSP? Given code: Resultset rs1=(execute some query); Resultset rs2=(use rs1 to query);
has comment: http://stackoverflow.com/comment/35943936
type: Question
score: 0
answer count: 1
tagged with: jsp
type: UnansweredQuestion
has title: Use one result set to query another result set in JSP
has comment: http://stackoverflow.com/comment/35944107
has answer: http://stackoverflow.com/a/23449275
tagged with: java

http://stackoverflow.com/comment/35665479
type: Comment
has text: Good catch, @moinul - didn't notice that one :-).
comment on: http://stackoverflow.com/a/23298323
type: AnswerComment
score: 0

http://stackoverflow.com/q/23392649
upvote count: 2
answer count: 1
has title: How to build the C code of OpenJDK 8 src.zip /launcher/
favorite count: 0
type: AnsweredQuestion
score: 2
accepted answer: http://stackoverflow.com/a/29691301
has body: I have downloaded the JDK 8.20: https://jdk8.java.net/download.html In there is a src.zip, which looks like an example for embedding, but there is no makefile or other build script. The directory /launcher/ contains the files: defines.h emessages.h java.c java.h java_md.h java_md_common.c java_md_solinux.c java_md_solinux.h jli_util.c jli_util.h main.c manifest_info.h parse_manifest.c splashscreen.h splashscreen_stubs.c version_comp.c version_comp.h wildcard.c wildcard.h I made this little build.sh-script: # -m32 = 32bit for embedding # -I. for fake jvm.h, because it does not exist and fails on including it otherwise options="-m32 -I/root/openjdk8/jdk1.8.0_20/include/ -I/root/openjdk8/jdk1.8.0_20/include/linux/ -I." echo "COMPILE java.c" gcc -c java.c -o java.o $options echo "COMPILE java_md_common.c" gcc -c java_md_common.c -o java_md_common.o $options echo "COMPILE java_md_solinux.c" gcc -c java_md_solinux.c -o java_md_solinux.o $options echo "COMPILE jli_util.c" gcc -c jli_util.c -o jli_util.o $options echo "COMPILE main.c" gcc -c main.c -o main.o $options echo "COMPILE parse_manifest.c" gcc -c parse_manifest.c -o parse_manifest.o $options echo "COMPILE splashscreen_stubs.c" gcc -c splashscreen_stubs.c -o splashscreen_stubs.o $options echo "COMPILE version_comp.c" gcc -c version_comp.c -o version_comp.o $options echo "COMPILE wildcard.c" gcc -c wildcard.c -o wildcard.o $options These errors occur: ./build.sh COMPILE java.c java.c: In function âContinueInNewThreadâ: java.c:1885:29: error: storage size of âargs1_1â isnât known COMPILE java_md_common.c java_md_common.c: In function âProgramExistsâ: java_md_common.c:67:17: error: storage size of âsbâ isnât known java_md_common.c:70:26: error: âS_IEXECâ undeclared (first use in this function) java_md_common.c:70:26: note: each undeclared identifier is reported only once for each function it appears in java_md_common.c: In function âJLI_ReportErrorMessageSysâ: java_md_common.c:155:21: error: âerrnoâ undeclared (first u…
downvote count: 0
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/29691301

http://stackoverflow.com/comment/35831953
comment on: http://stackoverflow.com/q/23370449
has text: @apangin What do you mean to recompile tgose classes? Is there a way I can include them in my source code and have them picked up instead of the official ones?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35695655
type: QuestionComment
type: Comment
has text: and WHY do you want to convert a double into an int ? f.e. the value 3,4 would be represented as an int as 3. why first convert something into double, then into int
score: 0
comment on: http://stackoverflow.com/q/23314910

http://stackoverflow.com/comment/35953339
type: Comment
has text: Try looking at the .log file in the workspace .metadata directory to see if there is an error message.
score: 0
comment on: http://stackoverflow.com/q/23449412
type: QuestionComment

http://stackoverflow.com/q/23309002
tagged with: web-services
answer count: 1
tagged with: java
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24081231
tagged with: servlets
has title: Jersey Web Service sends 415 status code
linked to: http://stackoverflow.com/q/23356678
has comment: http://stackoverflow.com/comment/35780736
type: Question
tagged with: http-status-codes
has body: I have created a webservice using jersey for my Jave EE web application created using servlets.I find that I get a 415 error code. I usually either redirect to another servlet or to a jsp which is technically a servlet in my app.Which mime-type should I use? SEVERE: A message body reader for Java class javax.servlet.http.HttpServletRequest, and Java type interface javax.servlet.http.HttpServletRequest, and MIME media type application/octet-stream was not found. The registered message body readers compatible with the MIME media type are: application/octet-stream -&gt; com.sun.jersey.core.impl.provider.entity.ByteArrayProvider com.sun.jersey.core.impl.provider.entity.FileProvider com.sun.jersey.core.impl.provider.entity.InputStreamProvider com.sun.jersey.core.impl.provider.entity.DataSourceProvider com.sun.jersey.core.impl.provider.entity.RenderedImageProvider */* -&gt; com.sun.jersey.core.impl.provider.entity.FormProvider com.sun.jersey.core.impl.provider.entity.StringProvider com.sun.jersey.core.impl.provider.entity.ByteArrayProvider com.sun.jersey.core.impl.provider.entity.FileProvider com.sun.jersey.core.impl.provider.entity.InputStreamProvider com.sun.jersey.core.impl.provider.entity.DataSourceProvider com.sun.jersey.core.impl.provider.entity.XMLJAXBElementProvider$General com.sun.jersey.core.impl.provider.entity.ReaderProvider com.sun.jersey.core.impl.provider.entity.DocumentProvider com.sun.jersey.core.impl.provider.entity.SourceProvider$StreamSourceReader com.sun.jersey.core.impl.provider.entity.SourceProvider$SAXSourceReader com.sun.jersey.core.impl.provider.entity.SourceProvider$DOMSourceReader com.sun.jersey.json.impl.provider.entity.JSONJAXBElementProvider$General com.sun.jersey.core.impl.provider.entity.XMLRootElementProvider$General com.sun.jersey.core.impl.provider.entity.XMLListElementProvider$General com.sun.jersey.core.impl.provider.entity.XMLRootObjectProvider$General com.sun.jersey.core.impl.provider.entity.EntityHolderReader com.sun.jersey.json.im…
has comment: http://stackoverflow.com/comment/35780602
has comment: http://stackoverflow.com/comment/35780918
tagged with: jersey-1.0
score: 0
has comment: http://stackoverflow.com/comment/35780001

http://stackoverflow.com/comment/35726219
has text: Thank you! i've solved the problem! I used my original clickListener and just added the touchup and touchdown methods to it. Works great! Thanks for you help!
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23329717
type: QuestionComment

http://stackoverflow.com/a/23315711
type: Answer
accepted answer of: http://stackoverflow.com/q/23315416
score: 2
upvote count: 2
has body: that requires swapping out the current, visible JPanel with another Have a look at CardLayout for a complete example of how to do it properly.
has comment: http://stackoverflow.com/comment/35697936
has comment: http://stackoverflow.com/comment/35699174
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23315416

spring-mvc
tags question: http://stackoverflow.com/q/23369634
tags question: http://stackoverflow.com/q/23428115
tags question: http://stackoverflow.com/q/23448351
tags question: http://stackoverflow.com/q/23452749
tags question: http://stackoverflow.com/q/23317792
tags question: http://stackoverflow.com/q/23333330
tags question: http://stackoverflow.com/q/23440103
tags question: http://stackoverflow.com/q/23348106
tags question: http://stackoverflow.com/q/23446558
tags question: http://stackoverflow.com/q/23348341
tags question: http://stackoverflow.com/q/23369672
tags question: http://stackoverflow.com/q/23415364
tags question: http://stackoverflow.com/q/23322231
tags question: http://stackoverflow.com/q/23420268
tags question: http://stackoverflow.com/q/23316280
tags question: http://stackoverflow.com/q/23349180
tags question: http://stackoverflow.com/q/23359950
tags question: http://stackoverflow.com/q/23342940
tags question: http://stackoverflow.com/q/23381486
tags question: http://stackoverflow.com/q/23326350
tags question: http://stackoverflow.com/q/23344346
tags question: http://stackoverflow.com/q/23435720
tags question: http://stackoverflow.com/q/23448255
tags question: http://stackoverflow.com/q/23423552
tags question: http://stackoverflow.com/q/23341319
tags question: http://stackoverflow.com/q/23391775
tags question: http://stackoverflow.com/q/23346385
tags question: http://stackoverflow.com/q/23359727
tags question: http://stackoverflow.com/q/23386902
tags question: http://stackoverflow.com/q/23418084
tags question: http://stackoverflow.com/q/23396645
tags question: http://stackoverflow.com/q/23340546
tags question: http://stackoverflow.com/q/23403764
tags question: http://stackoverflow.com/q/23320747
tags question: http://stackoverflow.com/q/23303413
tags question: http://stackoverflow.com/q/23333299
tags question: http://stackoverflow.com/q/23390946
tags question: http://stackoverflow.com/q/23312666
tags question: http://stackoverflow.com/q/23438234
tags question: http://stackoverflow.com/q/23422066
tags question: http://stackoverflow.com/q/23409026
tags question: http://stackoverflow.com/q/23448817
tags question: http://stackoverflow.com/q/23349565
tag name: spring-mvc
tags question: http://stackoverflow.com/q/23406457
tags question: http://stackoverflow.com/q/23365967
tags question: http://stackoverflow.com/q/23343674
tags question: http://stackoverflow.com/q/23358367
tags question: http://stackoverflow.com/q/23411874
tags question: http://stackoverflow.com/q/23389948
tags question: http://stackoverflow.com/q/23343745
tags question: http://stackoverflow.com/q/23349064
tags question: http://stackoverflow.com/q/23449902
tags question: http://stackoverflow.com/q/23447095
tags question: http://stackoverflow.com/q/23418775
tags question: http://stackoverflow.com/q/23340433
tags question: http://stackoverflow.com/q/23306791
tags question: http://stackoverflow.com/q/23366238
tags question: http://stackoverflow.com/q/23446015
tags question: http://stackoverflow.com/q/23371928
tags question: http://stackoverflow.com/q/23359668
tags question: http://stackoverflow.com/q/23324290
tags question: http://stackoverflow.com/q/23349871
type: Tag
tags question: http://stackoverflow.com/q/23396100
tags question: http://stackoverflow.com/q/23421460
tags question: http://stackoverflow.com/q/23413009
tags question: http://stackoverflow.com/q/23311616
tags question: http://stackoverflow.com/q/23414314
tags question: http://stackoverflow.com/q/23336903
tags question: http://stackoverflow.com/q/23357024
tags question: http://stackoverflow.com/q/23431328
tags question: http://stackoverflow.com/q/23416639
tags question: http://stackoverflow.com/q/23391629
tags question: http://stackoverflow.com/q/23448497
tags question: http://stackoverflow.com/q/23342308
tags question: http://stackoverflow.com/q/23373345
tags question: http://stackoverflow.com/q/23359056
tags question: http://stackoverflow.com/q/23414609
tags question: http://stackoverflow.com/q/23335200

http://stackoverflow.com/q/23447228
accepted answer: http://stackoverflow.com/a/23447887
has comment: http://stackoverflow.com/comment/35941082
has comment: http://stackoverflow.com/comment/35940135
has body: Disclaimer: I saw the thread about transitivity of comparison functions, but I don't think mine are bad/I dont see mistake in them So I wrote a simulation of rabbits and wolfs - there is a set amount of wolves and rabbits in the beginning, rabbits run away from wolfs and wolfs chase rabbits, when they meet in the same block rabbit gets killed and simulation ends when there are no rabbits left. For small boards, up till about 32x32 all is ok, but for 64+ I get the following error while running. Also, here are my 3 comparison functions: lBlocks are JLabels, hare/wolf/killer are icons public synchronized boolean isEmpty(int x, int y){ if(!(lBlocks[x][y].getIcon() instanceof Icon)) return true; return false; } public synchronized boolean isWolf(int x, int y){ if(!(lBlocks[x][y].getIcon() instanceof Icon)) return false; if(lBlocks[x][y].getIcon().equals(hare)||lBlocks[x][y].getText().equals("h")||isEmpty(x,y)) return false; return true; } public synchronized boolean isHare(int x, int y){ if(!(lBlocks[x][y].getIcon() instanceof Icon)) return false; if(isEmpty(x,y)||isWolf(x,y)) return false; return true; } Exception in thread "AWT-EventQueue-0" java.lang.IllegalArgumentException: Comparison method violates its general contract! at java.util.TimSort.mergeLo(TimSort.java:747) at java.util.TimSort.mergeAt(TimSort.java:483) at java.util.TimSort.mergeCollapse(TimSort.java:410) at java.util.TimSort.sort(TimSort.java:214) at java.util.TimSort.sort(TimSort.java:173) at java.util.Arrays.sort(Arrays.java:659) at java.util.Collections.sort(Collections.java:217) at javax.swing.SortingFocusTraversalPolicy.enumerateAndSortCycle(SortingFocusTraversalPolicy.java:136) at javax.swing.SortingFocusTraversalPolicy.getFocusTraversalCycle(SortingFocusTraversalPolicy.java:110) at javax.swing.SortingFocusTraversalPolicy.getFirstComponent(SortingFocusTraversalPolicy.java:435) at javax.swing.LayoutFocusTraversalPolicy.getFirstComponent(LayoutFocusTraversalPolicy.java:166) at javax.swing.SortingFocu…
tagged with: java
tagged with: comparison
has comment: http://stackoverflow.com/comment/35940880
has answer: http://stackoverflow.com/a/23447887
has comment: http://stackoverflow.com/comment/35940927
linked to: http://stackoverflow.com/q/16078578
answer count: 1
has title: Exception in thread "AWT-EventQueue-0" java.lang.IllegalArgumentException: Comparison method violates its general contract
has comment: http://stackoverflow.com/comment/35940817
has comment: http://stackoverflow.com/comment/35940578
score: 0
has comment: http://stackoverflow.com/comment/35940613
has comment: http://stackoverflow.com/comment/35941137
has comment: http://stackoverflow.com/comment/35941014
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35940063
tagged with: equals
tagged with: multithreading
linked to: http://stackoverflow.com/q/11441666
tagged with: swing
type: Question

http://stackoverflow.com/comment/35890721
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23420179
has text: add boy1 to the boy panel? but i dont have a boy panel.Boy is the image itself. i did the null thing and image doesnt show up anymore. im guessing its because of this.
score: 0

http://stackoverflow.com/q/23335674
tagged with: datetime
score: 2
has answer: http://stackoverflow.com/a/23366722
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/19855761
has title: Group by calendar week in jOOQ
linked to: http://stackoverflow.com/q/20703229
answer count: 2
tagged with: sql
has answer: http://stackoverflow.com/a/50034909
downvote count: 0
has body: I use this field in GROUP BY to get monthly reports: trunc(date(SOME_TIMESTAMP), DatePart.MONTH).as("month") Also works the same way for daily or yearly reports. But how can I do weekly reports? There is no DatePart.WEEK.
favorite count: 0
tagged with: jooq
upvote count: 2
type: UnansweredQuestion

http://stackoverflow.com/q/23393305
downvote count: 0
favorite count: 0
possible better answer: http://stackoverflow.com/a/23393701
linked to: http://stackoverflow.com/q/2457239
has comment: http://stackoverflow.com/comment/35839764
has title: mock resource in service java (mockito)
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23393497
score: 1
upvote count: 1
type: Question
has body: I am doing some tests for the class Export I need to mock a method so I made a mockito (I am new to Mockito) public Class ExportServiceImpl implements ExportService{ @Autowired Service service public void export(){ String exportString = service.getPath(); domoreStuff() .... } And public Class ServiceImpl implements Service(){ public String getPath(){ return "thePath"; } } I need to mock the getPath() method so I did in the TestNG public class ExportTestNG(){ public textExport(){ Service serviceMock = Mockito.mock(Service.class); Mockito.when(serviceMock.getData()).thenReturn("theNewPath"); System.out.println("serviceMock.getData() : " + serviceMock.getData()); // prints "theNewPath", OK exportService.export(); // the getData() is not the mockito one } } I may have not correclt mockito and I may not have understood how it works. Any idea ?
tagged with: java
accepted answer: http://stackoverflow.com/a/23393497
answer count: 2
has answer: http://stackoverflow.com/a/23393701
tagged with: mockito

http://stackoverflow.com/q/23425099
has title: Android can't add search button to options menu
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23425558
score: 1
tagged with: java
type: Question
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/23425238
possible better answer: http://stackoverflow.com/a/23425238
tagged with: android
has answer: http://stackoverflow.com/a/23425558
has body: I am following this Tutorial but I can't get a simple search button to show up on the options menu. Code: main_activity_actions.xml &lt;menu xmlns:android="http://schemas.android.com/apk/res/android" &gt; &lt;!-- Search, should appear as action button --&gt; &lt;item android:id="@+id/action_search" android:icon="@drawable/ic_action_search" android:title="@string/action_search" android:showAsAction="ifRoom" /&gt; &lt;!-- Settings, should always be in the overflow --&gt; &lt;item android:id="@+id/action_settings" android:title="@string/action_settings" android:showAsAction="never" /&gt; &lt;/menu&gt; Added this to MainActivity.java public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.main_activity_actions, menu); return super.onCreateOptionsMenu(menu); } App loads OK but no icons show up, I have downloaded standard icons and placed them in each of the drawable folders. Any ideas why is it not working? Not sure if related but the tutorial states "The icon attribute requires a resource ID for an image. The name that follows @drawable/ must be the name of a bitmap image you've saved in your project's res/drawable/ directory. For example, "@drawable/ic_action_search" refers to ic_action_search.png." But I didn't have folder res/drawable/ just res/drawable-hdpi, res/drawable-ldpi ... Shold I create another folder res/drawable/ if so which icon should go in it (the official icon set I downloaded had all the res/drawable-hdpi ones but no res/drawable/)
favorite count: 0
upvote count: 1

http://stackoverflow.com/q/23386271
has answer: http://stackoverflow.com/a/26277679
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/35899474
type: UnansweredQuestion
has title: NetBeans 8.0 Gradle Plug-in (for LibGDX)
tagged with: netbeans
score: 3
has comment: http://stackoverflow.com/comment/35839619
upvote count: 3
tagged with: java
has body: I wanted to start using LibGDX but since they switcher to gradle recently I folowed their guides. According to those,I installed the plugin Gradle support on NetBeans 8.0 and when I try to open a Gradle Project I get the error: Failed to load Gradle Project:test and when i go to the stacktrace, i get this Issue 1 Requested project: C:\Users\Halo\Downloads\test Stack trace: org.gradle.tooling.GradleConnectionException: Could not run build action using Gradle distribution 'http://services.gradle.org/distributions/gradle-1.10-all.zip'. at org.gradle.tooling.internal.consumer.ResultHandlerAdapter.onFailure(ResultHandlerAdapter.java:55) at org.gradle.tooling.internal.consumer.async.DefaultAsyncConsumerActionExecutor$1$1.run(DefaultAsyncConsumerActionExecutor.java:57) at org.gradle.internal.concurrent.DefaultExecutorFactory$StoppableExecutorImpl$1.run(DefaultExecutorFactory.java:64) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:744) at org.gradle.tooling.internal.consumer.BlockingResultHandler.getResult(BlockingResultHandler.java:46) at org.gradle.tooling.internal.consumer.DefaultBuildActionExecuter.run(DefaultBuildActionExecuter.java:43) at org.netbeans.gradle.model.GenericModelFetcher.getModels(GenericModelFetcher.java:166) at org.netbeans.gradle.project.model.NbGradle18ModelLoader$ProjectModelFetcher.getModels(NbGradle18ModelLoader.java:374) at org.netbeans.gradle.project.model.NbGradle18ModelLoader.loadModels(NbGradle18ModelLoader.java:79) at org.netbeans.gradle.project.model.GradleModelLoader.loadModelWithProgress(GradleModelLoader.java:496) at org.netbeans.gradle.project.model.GradleModelLoader.access$600(GradleModelLoader.java:57) at org.netbeans.gradle.project.model.GradleModelLoader$6.run(GradleModelLoader.java:364) at org.netbeans.gradle.project.tasks.GradleDaemonManager.runNonBlockingGradleTask(GradleDaemonM…
type: Question
tagged with: libgdx

http://stackoverflow.com/q/23432651
tagged with: maven
has answer: http://stackoverflow.com/a/70972082
tagged with: spring
has answer: http://stackoverflow.com/a/47937956
has answer: http://stackoverflow.com/a/23432746
answer count: 22
has answer: http://stackoverflow.com/a/77523382
has answer: http://stackoverflow.com/a/61372195
type: UnansweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/74335671
has answer: http://stackoverflow.com/a/46594258
score: 55
has answer: http://stackoverflow.com/a/28912333
linked to: http://stackoverflow.com/q/23553018
has answer: http://stackoverflow.com/a/63718932
has answer: http://stackoverflow.com/a/51885549
has answer: http://stackoverflow.com/a/60076261
has comment: http://stackoverflow.com/comment/40447308
has comment: http://stackoverflow.com/comment/135351961
type: Question
has answer: http://stackoverflow.com/a/32801969
has comment: http://stackoverflow.com/comment/108570039
tagged with: spring-boot
has answer: http://stackoverflow.com/a/43952621
has answer: http://stackoverflow.com/a/59952967
has answer: http://stackoverflow.com/a/27416379
has body: I can successfully start spring-boot with mvn spring-boot, the documentation mentions to gracefully exit the application hit ctrl-c. Terminate batch job (Y/N)? Y The maven process does terminate but Tomcat is still running and I can still hit the web-page. When I try to start spring-boot again it fails to start Tomcat because the port is in use. . ____ _ __ _ _ /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \ ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \ \\/ ___)| |_)| | | | | || (_| | ) ) ) ) ' |____| .__|_| |_|_| |_\__, | / / / / =========|_|==============|___/=/_/_/_/ :: Spring Boot :: (v1.1.0.BUILD-SNAPSHOT) 2014-05-02 12:13:57.666 INFO 6568 --- [ main] Example : Starting Example on challenger with PID 6568 (E:\workspace\SpringBoot\target\cla sses started by steven in E:\workspace\SpringBoot) 2014-05-02 12:13:57.707 INFO 6568 --- [ main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWeb ApplicationContext@11ecab7c: startup date [Fri May 02 12:13:57 EDT 2014]; root of context hierarchy 2014-05-02 12:13:58.097 INFO 6568 --- [ main] o.s.b.f.s.DefaultListableBeanFactory : Overriding bean definition for bean 'beanNameViewResolver': replacing [Root bean : class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.boot.autoconfi gure.web.ErrorMvcAutoConfiguration$WhitelabelErrorViewConfiguration; factoryMethodName=beanNameViewResolver; initMethodName=null; destroyMethodName=(inferred); defined in class pat h resource [org/springframework/boot/autoconfigure/web/ErrorMvcAutoConfiguration$WhitelabelErrorViewConfiguration.class]] with [Root bean: class [null]; scope=; abstract=false; laz yInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration$WebMvcAuto ConfigurationAdapter; factoryMethodName=beanNa…
has answer: http://stackoverflow.com/a/70690926
has answer: http://stackoverflow.com/a/50555721
has title: Terminating mvn spring-boot:run doesn't stop tomcat
has answer: http://stackoverflow.com/a/47984346
linked to: http://stackoverflow.com/q/26547532
downvote count: 0
has answer: http://stackoverflow.com/a/56650041
upvote count: 55
linked to: http://stackoverflow.com/q/6204003
tagged with: tomcat
has answer: http://stackoverflow.com/a/37260567
favorite count: 0
has answer: http://stackoverflow.com/a/28260806
has answer: http://stackoverflow.com/a/32056350

http://stackoverflow.com/comment/35929355
comment on: http://stackoverflow.com/q/23441208
score: 0
has text: i am getting an encrypted string which i convert it to base64 encoded string and then decrypt it
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23373959
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/23373739
has body: Change your regex pattern to "\\b(?![A-Z]{2}[0]{4})[A-Z]{2}[0-9]{4}\\b"
score: 0
accepted answer of: http://stackoverflow.com/q/23373739

http://stackoverflow.com/a/23432611
upvote count: 4
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23431963
answers question: http://stackoverflow.com/q/23431963
score: 4
type: AcceptedAnswer
has body: You can't add a frame to an applet, but you can add an applet to a frame: import javax.swing.*; import javax.swing.event.*; import java.awt.*; import java.awt.event.*; public class AppletBasic extends JApplet { /** * Create the GUI. For thread safety, this method should * be invoked from the event-dispatching thread. */ private void createGUI() { JLabel appletLabel = new JLabel( "I'm a Swing Applet" ); appletLabel.setHorizontalAlignment( JLabel.CENTER ); appletLabel.setFont(new Font("Serif", Font.PLAIN, 36)); add( appletLabel ); setSize(400, 200); } @Override public void init() { try { SwingUtilities.invokeAndWait(new Runnable() { public void run() { createGUI(); } }); } catch (Exception e) { System.err.println("createGUI didn't successfully complete: " + e); } } public static void main(String[] args) { JApplet applet = new AppletBasic(); applet.init(); JFrame frame = new JFrame("Applet in Frame"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.add( applet ); frame.pack(); frame.setLocationRelativeTo( null ); frame.setVisible( true ); applet.start(); } }
type: Answer

http://stackoverflow.com/comment/39025426
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23349805
score: 0
has text: Thank you, but i gave up with it, it don't work on most device, even with non-rooted you can see my other problem here: [link](http://stackoverflow.com/questions/25073520/android-backupmanager-backupagent-not-work-on-root-device)

http://stackoverflow.com/comment/35782561
type: QuestionComment
comment on: http://stackoverflow.com/q/23362249
has text: @vikingsteve OK I am just going to try it.
score: 0
type: Comment

http://stackoverflow.com/q/23314789
has comment: http://stackoverflow.com/comment/35695717
has body: I'm new to using sets and for one of the exercise to learn how to use sets, I have been given a template file "SetInt" and a completed test file "TestSetInt". I know that I should use retainAll() and addAll() but the test class has asked me to write methods. Anyone have any idea how to write these two methods? Any help would be appreciated. SetInt is the file which I have to add methods to and goes as follows: public class SetInt { int[] setArray = new int[52]; public void add(int a) { if (a &lt; setArray.length-2) { setArray[a] = a; } } /* add a to the set in the correct position *@param a the value to be added **/ public SetInt intersection(SetInt anySet) { return anySet; } /* returns the set of integers common to both * the set passed in as an argument and the set the * method is called on * @param anySet - the set to be intersected * @return a set containing the result of the intersection */ public SetInt union(SetInt anySet) { return anySet; } /* returns the set of integers which are in either the * set passed in as an argument or the set the method * is called on * @param anySet - one of the sets in the union * @return a set containing the result of the union */ } Here is TestSetInt, a file provided for me which I have to run to see if my methods work correctly: public class TestSetInt { public TestSetInt() { SetInt test1 = new SetInt(); SetInt test2 = new SetInt(); // adding numbers to the 2 sets for(int i = 2; i&lt;49;i=i+3) { test1.add(i); } System.out.println(); for(int i = 2; i&lt;49;i=i+4) { test2.add(i); } System.out.println(); // testing intersection SetInt interx = new SetInt(); interx=test2.intersection(test1); // testing union SetInt unionx = test1.union(test2); } public static void main (String args[]) { TestSetInt practice = new TestSetInt(); } }
answer count: 1
has title: How to write a intersection and union methods for sets in Java
favorite count: 0
has comment: http://stackoverflow.com/comment/35695624
tagged with: set-intersection
upvote count: 1
has answer: http://stackoverflow.com/a/23315576
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: set
type: Question
accepted answer: http://stackoverflow.com/a/23315576
downvote count: 0
tagged with: set-union

http://stackoverflow.com/comment/35706200
has text: It may be, that your request is returning way too much data. Try to narrow the search criteria or exclude large columns (blobs, clobs, etc).
comment on: http://stackoverflow.com/q/23319741
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35715405
score: 0
type: QuestionComment
has text: Unfortunately not, I need this as a reference point for other calculations.
type: Comment
comment on: http://stackoverflow.com/q/23325207

http://stackoverflow.com/a/31574168
score: 0
type: Answer
has body: Try this Stroke stroke = new BasicStroke(1, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, 0, null, 0); g2.setStroke(stroke); Like Franz just said this is one of those unruly behaviors of JOIN_MITER. a mitered join will extend far beyond the actual intersection of the lines.
answers question: http://stackoverflow.com/q/23313487

http://stackoverflow.com/comment/36409423
has text: Didn't work for me either. After adding SDK 1.9.3 in the dropins folder, when I restarted Eclipse and located the SDK in the local resources for updates, Eclipse reported that it was not a valid repository
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23578030
type: Comment

http://stackoverflow.com/comment/35664158
type: QuestionComment
type: Comment
has text: @kiruwka The device is a Motorla Atrix phone running Android 2.3.6. My app supports Android 2.2.
score: 0
comment on: http://stackoverflow.com/q/23296187

http://stackoverflow.com/comment/35892193
has text: @mark o'connor this is not duplicate(i already added xalan-2.7.1.jar but issue not resolved)
comment on: http://stackoverflow.com/q/23405724
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35848239
type: Comment
has text: It help for me repaint(); super.paintComponent(g);. But is it be correctly?
comment on: http://stackoverflow.com/q/23397582
score: 0
type: QuestionComment

http://stackoverflow.com/comment/36371682
type: AnswerComment
comment on: http://stackoverflow.com/a/23293565
score: 0
type: Comment
has text: Qualifier is a standard UML element and the most of the tools should somehow support it. It is however tool-specific. My example was prepared with Enterprise Architect. Which tool do you use? Have you tried to simply search in help? Qualifier is a property of the association end, so it should be somewhere in the association's properties dialog.

http://stackoverflow.com/comment/35691417
has text: Are the answers to the linked question clear enough or should I elaborate?
type: QuestionComment
comment on: http://stackoverflow.com/q/23312489
score: 0
type: Comment

http://stackoverflow.com/a/51919935
score: 0
type: Answer
has body: while(!Assets.manager.update()) { System.out.println(Assets.manager.getProgress()*100+"%"); } According to your codes, it will only prints out when the assetmanager is not 100% loaded. Try remove the condition and it will actually prints from 0 directly to 1 due to loading of only one texture.
answers question: http://stackoverflow.com/q/23442108

http://stackoverflow.com/q/23352144
has comment: http://stackoverflow.com/comment/35764170
has comment: http://stackoverflow.com/comment/35764194
tagged with: arraylist
has comment: http://stackoverflow.com/comment/35764159
has answer: http://stackoverflow.com/a/23352190
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/35764307
has answer: http://stackoverflow.com/a/23352291
has comment: http://stackoverflow.com/comment/35764184
has comment: http://stackoverflow.com/comment/35764269
has body: How do I find the size of an ArrayList in Java? I do not mean the number of elements, but the number of indexes. public static void main(String[] args) { ArrayList hash = new ArrayList(5); System.out.println(hash.size()); } Prints out "0." Using: System.out.println(hash.toArray().length); Also prints out a "0." I have looked in http://docs.oracle.com/javase/7/docs/api/java/util/ArrayList.html but I do not see a method that will help me. Is my ArrayList reverting to a size of 0 if I do not add anything to it? EDIT The assignment is to create a hash table using ArrayList. I am supposed to create a hash function using the formula double hashkey = Math.floor(hash.size()*(Math.E*key-Math.floor(Math.E*key))); Where key is an integer. hashkey then becomes the index where the value will be stored. I am using hash.size() as a placeholder at the moment, but that value should be the capacity of my ArrayList.
has answer: http://stackoverflow.com/a/23359839
type: UnansweredQuestion
tagged with: java
has title: Length of ArrayList in Java
type: Question
has comment: http://stackoverflow.com/comment/35764176
has comment: http://stackoverflow.com/comment/35764249

http://stackoverflow.com/comment/35717564
type: Comment
type: QuestionComment
has text: The error really does speak for itself.
comment on: http://stackoverflow.com/q/23326902
score: 0

http://stackoverflow.com/comment/35743444
score: 0
type: Comment
type: QuestionComment
has text: Is this post written in English or is it some other language I don't know yet?
comment on: http://stackoverflow.com/q/23340833

http://stackoverflow.com/comment/35745909
score: 0
comment on: http://stackoverflow.com/q/23340837
has text: I need it in general and not for table
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/35973358
has text: Why? Paint is, generally, pretty efficent
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/23377627

http://stackoverflow.com/a/23377392
score: 4
type: AcceptedAnswer
type: Answer
has body: You are performing integer division in Java, where math done using ints must yield an int, so the division truncates anything beyond the decimal point. This means that in Java, -2 / 5 is 0. It's not enough that the target of the assignment is a double. One of the operands must be double (or float) to force floating-point arithmetic. Cast one of the operands to the / operator to a double to force floating-point arithmetic. slope2 = ( (double) (yVals[i+2] - originY) / (xVals[i+2] - originX));
upvote count: 4
accepted answer of: http://stackoverflow.com/q/23377377
answers question: http://stackoverflow.com/q/23377377
downvote count: 0

http://stackoverflow.com/a/23436889
has comment: http://stackoverflow.com/comment/70824240
accepted answer of: http://stackoverflow.com/q/23436713
answers question: http://stackoverflow.com/q/23436713
type: AcceptedAnswer
downvote count: 0
has body: Ok, I figured it out. It is neccessary to use one of LogicalTime interface implementations, for example using TimeFactory: LogicalTime time = _ambassador.getTimeFactory().makeFinal(); calling timeAdvanceRequest() will send request to RTI. The, if time was advanced, the timeAdvanceGrant() will be called on federate. Further info here.
upvote count: 2
type: Answer
score: 2

http://stackoverflow.com/q/23370225
upvote count: 2
answer count: 3
has title: How to sort groups and children Expandable listview in Android?
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/40546048
has answer: http://stackoverflow.com/a/23370658
type: UnansweredQuestion
tagged with: android
score: 2
has answer: http://stackoverflow.com/a/23370865
has body: I have two tables in mysql which bind 'Categories' and 'products' through ids 'id_catprods' and 'ID_Cat'. So far so good, I'm working on Android with "ExpandableListView" with a custom adapter and everything works fine but can not find the solution to sort the categories with their products. Can anyone help me? Json results: { "productos": [{ "id_catprods": "1", "id_oferta": "197", "id_producto": "1", "nombr_cat": "Bocatas", "id_cat": "1", "nombre_producto": "Lomo", "precio": "4", "actions": [] }, { "id_catprods": "2", "id_oferta": "197", "id_producto": "2", "nombr_cat": "Pizzas", "id_cat": "2", "nombre_producto": "Serranito", "precio": "4", "actions": [] }], "errorCode": 0, "errorString": "Todo correcto" } Main code: // DownloadJSON AsyncTask private class DownloadJSON extends AsyncTask&lt;Void, Void, Void&gt; { String givemeurl; public DownloadJSON(String url) { this.givemeurl = id_oferta; } @Override protected void onPreExecute() { super.onPreExecute(); mProgressDialog = new ProgressDialog(Category.this); mProgressDialog.setMessage("Cargando..."); mProgressDialog.setIndeterminate(false); mProgressDialog.show(); } @Override protected Void doInBackground(Void... params) { // Create an array arraylist = new ArrayList&lt;HashMap&lt;String, String&gt;&gt;(); // Retrieve JSON Objects from the given URL address jsonobject = JSONfunctions .getJSONfromURL("http://file.php"); if(jsonobject != null){ try { // Locate the array name in JSON jsonarray = jsonobject.getJSONArray("productos"); for (int i = 0; i &lt; jsonarray.length(); i++) { HashMap&lt;String, String&gt; map = new HashMap&lt;String, String&gt;(); jsonobject = jsonarray.getJSONObject(i); // Retrive JSON Objects map.put("nombr_cat", jsonobject.getString("nombr_cat")); map.put("nombre_producto", jsonobject.getString("nombre_producto")); map.put("id_cat", jsonobject.getString("id_cat")); arraylist.add(map); } } catch (JSONException e) { Log.e("Error", e.getMessage()); //e.printStackTrace(); } catch (Exception e) { L…
tagged with: java
tagged with: expandablelistview
type: Question
has comment: http://stackoverflow.com/comment/74431445
tagged with: expandablelistadapter

http://stackoverflow.com/comment/69512632
type: Comment
has text: Hi, the method setReuseAddress() seems to be unavailable now.
score: 0
comment on: http://stackoverflow.com/a/23316826
type: AnswerComment

http://stackoverflow.com/comment/35900784
type: Comment
comment on: http://stackoverflow.com/q/23425979
has text: Is the method accessible? What is the signature of the `exec` method? What is the `Invest` class? The information you provided is very insufficient for us to help. You may want to add more info
type: QuestionComment
score: 0

http://stackoverflow.com/a/23306643
type: Answer
score: 0
answers question: http://stackoverflow.com/q/23306565
has body: Cells a inner class which extends JTextField. All what it really does is sets/gets a number and displays it. this may be confusing : public Cell [] cells = new Cell[CELL_COUNT]; What he is doing here is creating a array of type Cells. Like you have array of integers, or strings, this one has a type Cell. Here, he initializing each element of the array cells: cells[i] = new Cell(); and this adds it to the grid (notice it extends jpanel): this.add(cells[i]);

http://stackoverflow.com/comment/35695586
comment on: http://stackoverflow.com/q/23314426
has text: Thanks,but file can include empty line or not a format of straight line i must check them.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35725265
has text: 0 + 0 - 10 < 0. And it has to be positive
comment on: http://stackoverflow.com/q/23331009
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/comment/35824741
type: QuestionComment
comment on: http://stackoverflow.com/q/23326829
has text: @kleopatra, I switched to installing the panel in the scrollpane first and then building it, and that made everything work. Magic. If I cared more about everything appearing at once, I'd probably do some crazy manual buffering, but I don't care nearly that much.
score: 0
type: Comment

http://stackoverflow.com/a/23341600
type: Answer
has comment: http://stackoverflow.com/comment/35770964
upvote count: 3
has comment: http://stackoverflow.com/comment/35771035
answers question: http://stackoverflow.com/q/23340730
score: 3
downvote count: 0
has body: Map &lt;MyKeys, Clazz&gt; zzz = new HashMap&lt;MyKeys, String&gt;(); // this means it won't return null, the value is initialized zzz.put(MyKeys.BKEY, new Clazz()); // this is confusing part ... somevalues might be null zzz.get(MyKeys.BKEY).setValues(someValues); Clazz xxx = zzz.get(MyKeys.BKEY); //definitely won't return null are you sure its the hashmap returning null, and not the result of the getValues(), of the clazz put into hashmap. YOu have an error elsewhere, try the below in a web based compiler : import java.util.HashMap; import java.util.Map; public class HelloWorld{ public static class Clazz { public String val; public void setValues(String someValues){ val=someValues; } } public enum MyKeys { AKEY, BKEY, CKEY; } public static void main(String[] args ){ Map&lt;MyKeys, Clazz&gt; zzz = new HashMap&lt;MyKeys, Clazz&gt;(); // this means it won't return null, the value is initialized zzz.put(MyKeys.BKEY, new Clazz()); // this is confusing part ... somevalues might be null zzz.get(MyKeys.BKEY).setValues("someValues"); Clazz xxx = zzz.get(MyKeys.BKEY); System.out.println(xxx.val); } }

http://stackoverflow.com/comment/35765622
type: Comment
score: 0
type: AnswerComment
has text: ok, Im sorry, my english is not so good so i do not know how to explain it better.
comment on: http://stackoverflow.com/a/23352342

http://stackoverflow.com/comment/35771813
has text: No need to call newInstance();
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/23356519
type: Comment

http://stackoverflow.com/q/23358824
answer count: 1
has answer: http://stackoverflow.com/a/23359047
has title: How to access a specific element from JSON output with Gson
favorite count: 0
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35775896
upvote count: 3
downvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/23359047
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: gson
score: 2
has body: I need to access only the value of "formatted_address" : "4 Place du Louvre, 75001 Paris, France" attribute. Please help me how to do this with com.google.gson.Gson and java Without maintaining seperate POJO class for the entire structure. { "results": [{ "address_components": [{ "long_name": "4", "short_name": "4", "types": ["street_number"] }, { "long_name": "Place du Louvre", "short_name": "Place du Louvre", "types": ["route"] }, { "long_name": "Paris", "short_name": "Paris", "types": ["locality", "political"] }, { "long_name": "Paris", "short_name": "75", "types": ["administrative_area_level_2", "political"] }, { "long_name": "Île-de-France", "short_name": "IDF", "types": ["administrative_area_level_1", "political"] }, { "long_name": "France", "short_name": "FR", "types": ["country", "political"] }, { "long_name": "75001", "short_name": "75001", "types": ["postal_code"] }], "formatted_address": "4 Place du Louvre, 75001 Paris, France", "geometry": { "location": { "lat": 48.8600425, "lng": 2.3412674 }, "location_type": "ROOFTOP", "viewport": { "northeast": { "lat": 48.86139148029149, "lng": 2.342616380291502 }, "southwest": { "lat": 48.8586935197085, "lng": 2.339918419708498 } } }, "types": ["street_address"] }], "status": "OK" } I am expecting a solution as below but with gson. final JSONObject jso = results.getJSONObject(i); formattedAddress = jso.getString("formatted_address"));

http://stackoverflow.com/q/23444979
favorite count: 0
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/35935978
has body: When I created my new project, I set my minimium SDK version API to 14 (4.0 IceCreamSandwich). The Target API 19(4.4 KitKat). Compile API 19(4.4 KitKat). In starting my project this way I'm getting the error "R cannot be resolved to variable". So I went ahead and fixed the issue by regenerating my R.java and BuildConfig.java files by going to Project->clean. My R.java and BuildConfig.java is now generated. My error "R cannot be resolved to variable" is now gone. Here's my problem. When I add a new object, button, textview etc.. and try and set the contentview or findviewbyid to the object that I created in my XML file it's not finding it, I'm getting the error "splash cannot be resolved or is not a field"? In order to find the item, I have to edit my R.java file (which is something I know I shouldn't do). After I do this and run the project on the emulator I'm getting an error So here's my question, how do I get my id's to show up in the R.java file without having to manually edit it? How do I get rid of the "splash cannot be resolved or is not a field" error? without messing around with my R.java file? Thanks
answer count: 0
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/35962854
type: Question
has title: Cannot be resolved or is not a field error?
downvote count: 0
score: 1

http://stackoverflow.com/a/23339559
accepted answer of: http://stackoverflow.com/q/23339496
answers question: http://stackoverflow.com/q/23339496
has comment: http://stackoverflow.com/comment/35742180
score: 2
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: The addContact and removeContact methods are utility method to add to/remove from the private List&lt;Contact&gt; contacts; They are not the dao alternatives. They just populate the entities. To persist/delete from actual database, you will anyways need to write DAO methods.
upvote count: 2

http://stackoverflow.com/comment/35857908
score: 0
has text: Why code an applet? If it is due to spec. by teacher, please refer them to [Why CS teachers should stop teaching Java applets](http://programmers.blogoverflow.com/2013/05/why-cs-teachers-should-stop-teaching-java-applets/).
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23402933

http://stackoverflow.com/q/23306310
answer count: 1
has title: How to start service whenever a new application is launched?
tagged with: java
has body: I want to run a service, whenever a new application is started on android device. I'm building a behaviour based anti-virus for android systems. It works by collecting system call traces of applications. Everything is fine, except, how do I schedule the service to run so that it covers all application. One way is, I schedule to run it at specific intervals. However, more logical is to run it every time a new app is launched. The service once launched will collect the system call data for the running application (I use strace program for that) send the data over network to remote server, which does all processing, and terminate. Any hints on how I can accomplish this (run service when new app starts) pro-grammatically (yes I've extensively searched before posting this question) ? I'm not quite experienced on android. Are there any other ways to strace all application installed on android, whenever they run?
has answer: http://stackoverflow.com/a/23306570
downvote count: 0
type: UnansweredQuestion
score: 1
type: Question
tagged with: android
favorite count: 0
upvote count: 1

http://stackoverflow.com/comment/46555906
type: AnswerComment
comment on: http://stackoverflow.com/a/29008147
type: Comment
score: 1
has text: Nope, they are using the latest version (7.0) of Google Play Services library. I just checked in my android SDK and it is available to the general public now!

http://stackoverflow.com/comment/35740178
type: AnswerComment
has text: Did you try exactly like, long ans = (long)listRes.get(0); ?
type: Comment
comment on: http://stackoverflow.com/a/23339500
score: 0

http://stackoverflow.com/a/28144781
has body: I realize that this is rather old/late, but for anyone that has run into this issue and stumbles upon this (like me), I believe the solution here is that the etsy lib should be declared as aar in the pom.xml: com.etsy.android.grid library 1.0.5 aar support-v4 com.android.support
answers question: http://stackoverflow.com/q/23414142
upvote count: 2
type: Answer
score: 2
downvote count: 0

http://stackoverflow.com/comment/35818786
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/23370551
has text: Thanks, this works. Your previous hint with `"[^\\]"` for only baskslashes does not work, but `"[^\\\\]"` works.
score: 0

http://stackoverflow.com/a/23403800
has comment: http://stackoverflow.com/comment/35858959
has comment: http://stackoverflow.com/comment/35859312
has comment: http://stackoverflow.com/comment/35859013
downvote count: 0
score: 1
has body: Since it's a static method (class method), you can call it in two ways: NameOfClass.printClass(); or NameOfClass someInstance = new NameOfClass(...); // create instance someInstance.printClass(); Why? Because class methods doesn't need an instance of the class to be called, so you can call it with only using the name of the class (first way). But Java also provides the feature to call the static method using an instance of the class.
answers question: http://stackoverflow.com/q/23403783
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23403783
upvote count: 1
type: Answer

http://stackoverflow.com/a/23305325
has body: Add produces = "text/plain" to your @RequestMapping annotation.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23305120

http://stackoverflow.com/comment/35810464
has text: @Fllo How would you suggest I change it?
score: 0
comment on: http://stackoverflow.com/q/23374955
type: Comment
type: QuestionComment

http://stackoverflow.com/a/31573921
has body: Have you tried using a BasicStroke with JOIN_BEVEL or JOIN_ROUND? The default join you are using is JOIN_MITER, which may be responsible for those ugly (cool?) spikes.
score: 1
answers question: http://stackoverflow.com/q/23313487
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23313487
type: Answer
upvote count: 1

http://stackoverflow.com/q/23359487
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/35777178
score: 0
tagged with: imageicon
has comment: http://stackoverflow.com/comment/35777130
has comment: http://stackoverflow.com/comment/35777044
tagged with: jlabel
answer count: 0
type: UnansweredQuestion
has body: I'm trying to create a JLabel using an ImageIcon, but am having trouble reading the original png from disk. Here is how I have my project set up: The .java file I'm working with (AboutJDialog) is here: And here is where I store my image: According to my understanding, the following code should be working (this is just a snippet obviously, just looking at the filepath right now): image = new ImageIcon((ImageIO.read(getClass().getResourceAsStream("/MergeHero.IMAGE/dynamsoft_logo_black.png")))); //imports the image JLabel lbl = new JLabel(image); //puts the image into a jlabel this.getContentPane().add(lbl);
tagged with: embedded-resource
tagged with: swing
has title: Adding ImageIcon to JDialog, file path exception

http://stackoverflow.com/q/23435143
linked to: http://stackoverflow.com/q/20389255
tagged with: audio-streaming
duplicate of: http://stackoverflow.com/q/20389255
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23435253
accepted answer: http://stackoverflow.com/a/23435246
has title: How to use files from source package (what's the path?)
type: Question
possible better answer: http://stackoverflow.com/a/23435253
answer count: 2
tagged with: filepath
score: 0
tagged with: java
has body: Ok, the title may not be exactly correct, but here is what I mean by that: I have a class with a method that looks like this: package chess; import java.io.*; import sun.audio.*; public class SoundPlayer { public static void Play(String AudioFile) throws Exception { // open the sound file as a Java input stream InputStream in = new FileInputStream(AudioFile); // create an audiostream from the inputstream AudioStream audioStream = new AudioStream(in); // play the audio clip with the audioplayer class AudioPlayer.player.start(audioStream); } } What I want to do, is to compile a .wav file inside the .jar along all the .java files, and be able to play it with this method. To do this on batch, all I had to do was type the file name, and it used the current directory. I tried that here and it didn't work. So, my final question: What do I need to type before "/sound.wav" to have my program reffer to it from the source directory? Sorry if I didn't make it clear. I have searched around, but I guess I didn't know what exactly to search for on google, because I didn't find any explanation.
has answer: http://stackoverflow.com/a/23435246

http://stackoverflow.com/comment/35927084
comment on: http://stackoverflow.com/a/23439748
has text: How cache recognizes something changes in DB? Does it use timestamp?
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/23370505
has answer: http://stackoverflow.com/a/54827631
type: AnsweredQuestion
tagged with: mouselistener
tagged with: java
tagged with: jfreechart
type: Question
has title: chartMouseListener and MouseListener
has answer: http://stackoverflow.com/a/23373088
accepted answer: http://stackoverflow.com/a/23373088
tagged with: mouseevent
score: 0
answer count: 2
tagged with: mouseclick-event
has body: Why at first works chartMouseClicked (JFreeChart library), and already then mouseClicked? boolean isDoubleClicked = false; chartPanel.addMouseListener(new MouseListener() { @Override public void mouseClicked(MouseEvent me) { if (me.getClickCount() == 2 &amp;&amp;) { isDoubleClicked = true; } } @Override public void mousePressed(MouseEvent me) {} @Override public void mouseReleased(MouseEvent me) {} @Override public void mouseEntered(MouseEvent me) {} @Override public void mouseExited(MouseEvent me) {} }); chartPanel.addChartMouseListener(new ChartMouseListener() { @Override public void chartMouseClicked(ChartMouseEvent cme) { if (isDoubleClicked) System.out.println("Double clicked!"); } @Override public void chartMouseMoved(ChartMouseEvent cme) {} }); So, System.out.println("Double clicked!"); not works. How to correct it?
possible better answer: http://stackoverflow.com/a/54827631

http://stackoverflow.com/q/23391350
tagged with: fragmenttransaction
type: UnansweredQuestion
score: 6
tagged with: fragment
tagged with: android-fragments
tagged with: java
has body: I am making a news app where I have a fragment that holds all the news in a list and another fragment that have videos list. When you touch a new it will call a method from the activity named openNewsCont that will replace the current fragment with another one. The proble I am having is when I call that method I get a blank screen, I have looked many other codes but I couldn't find the solution for my problem. Here is the method I call from the MainActivity.java public void openNewsCont(String text) { android.support.v4.app.FragmentManager fm = getSupportFragmentManager(); android.support.v4.app.FragmentTransaction ft = fm.beginTransaction(); ft.replace(R.id.pager, new NewsContent() ); ft.addToBackStack(null); ft.commit(); fm.executePendingTransactions(); } Here is the Tab1.java that hold the news and calls the method from the MainActivity.java package com.example.link_test; import android.os.Bundle; import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; import android.widget.LinearLayout; public class Tab1 extends Fragment { public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { final View android = inflater.inflate(R.layout.tab1, container, false); LinearLayout newLink = (LinearLayout) android.findViewById(R.id.news1); newLink.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { String text = "Text from fragment"; MainActivity ma = (MainActivity) getActivity(); ma.openNewsCont(text); } }); return android; } } And here is the fragment that should be called and shows a blank screen NewsContent.java package com.example.link_test; import android.os.Bundle; import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; public class NewsContent extends Fragment { @Override public View onCreateView(LayoutInflat…
has answer: http://stackoverflow.com/a/54826939
type: Question
has answer: http://stackoverflow.com/a/23411599
downvote count: 0
favorite count: 0
answer count: 3
tagged with: android
has title: Android: Getting white screen with fragment transaction
has answer: http://stackoverflow.com/a/36744233
upvote count: 6

http://stackoverflow.com/a/23307394
score: 8
answers question: http://stackoverflow.com/q/23307324
downvote count: 0
upvote count: 8
type: Answer
has body: Use Calendar Date date = ... Calendar c = Calendar.getInstance(); c.setTime(date); c.add(Calendar.WEEK_OF_MONTH, 2); date = c.getTime();

http://stackoverflow.com/a/23320774
has body: The URL that are you using in order to do the POST request is wrong, simply because when you have to do a specific request to a form you should use the web page that is present in the form tag, in this case "authentication.php". So the code will be: package jsouptest; import org.jsoup.Connection; import org.jsoup.Jsoup; import org.jsoup.nodes.Document; public class JsouptTest { public static void main(String[] args) throws Exception { Connection.Response loginForm = Jsoup.connect("https://www.desco.org.bd/ebill/login.php") .method(Connection.Method.GET) .execute(); Document document = Jsoup.connect("https://www.desco.org.bd/ebill/authentication.php") .data("cookieexists", "false") .data("username", "32007702") .data("login", "Login") .cookies(loginForm.cookies()) .post(); System.out.println(document); } } This one correctly retrieves the web page that you want.
upvote count: 40
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/23320498
score: 40
answers question: http://stackoverflow.com/q/23320498

http://stackoverflow.com/comment/35723176
has text: You need to show the actual stack trace and identify the statement in the program at which the exception is thrown.
comment on: http://stackoverflow.com/q/23329580
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23323677
has comment: http://stackoverflow.com/comment/35730007
has body: I see three possible problems: [1.] There is a known problem with forms generated using OpenOffice: appearances are missing! (Actually, somebody should tell the OpenOffice developers to fix this). You can solve this by adding the following line: fields.setGenerateAppearances(true); See FillDataSheet for the full example. [2.] You are making the same mistake as described in "Duplicate questions" versus "RTFM" As documented, using PdfWriter throws away all interactive features. As you don't flatten your document, the fields remain interactive, so by chosing PdfWriter instead of PdfCopy, you deliberately throw away the fields... [3.] When you use PdfCopy, make sure you use the latest version of iText, because concatenating of forms has been implemented only recently. See https://stackoverflow.com/a/20659958/1622493 to find an almost exact copy of your question.
type: Answer
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/35743937
has comment: http://stackoverflow.com/comment/35727069
has comment: http://stackoverflow.com/comment/35741293
answers question: http://stackoverflow.com/q/23314111
downvote count: 0

http://stackoverflow.com/a/23353929
downvote count: 0
answers question: http://stackoverflow.com/q/23353908
type: Answer
upvote count: 2
score: 2
has body: You don't need anything there. Get rid of the dots. Change this: int thisTotalMinutes = ??.getMinutes() + (??.getHours() * 60); to this: int thisTotalMinutes = getMinutes() + (getHours() * 60); Or use this if you desire, but I see no need to clutter the code with this in this situation.

http://stackoverflow.com/a/26373539
downvote count: 0
score: 1
has body: I encountered the same issue before, but in order to use onBehalfOfContentOwner parameter with the API, your CMS account must first have access to the Partner API. To enable Partner API and see it in your API options, you need to be whitelisted for that API. You need to contact support or an account manager from youtube to get whitelisted.
upvote count: 1
answers question: http://stackoverflow.com/q/23335399
type: Answer

http://stackoverflow.com/comment/35910074
has text: If you could archive your project and provide a link where we can download it, it would be easier to reproduce and search for a fix.
type: Comment
comment on: http://stackoverflow.com/q/23430629
type: QuestionComment
score: 0

http://stackoverflow.com/comment/35950829
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23452680
type: AnswerComment
has text: Which still isn't true. Collections that need to have unique values do not have to use `hashCode()`.

http://stackoverflow.com/comment/35656997
type: AnswerComment
comment on: http://stackoverflow.com/a/23293279
type: Comment
score: 0
has text: I currently using the version 3.1.5. I think it was solved after version 3. Do you know how to recover from that error?

http://stackoverflow.com/q/23393452
has title: Validate textfield input in GUI
score: 0
tagged with: java
accepted answer: http://stackoverflow.com/a/23393643
has body: I have two text fields and they must add up to 100 when submit is clicked, if I put in correct values into text field there's no error but if I leave the text field blank or put a letter in it the error handling isn't right. Any ideas? submit.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (validation == true) { int numA = Integer.parseInt(aTextField.getText()); int numB = Integer.parseInt(aTextField.getText()); int sum = numA + numB; if (sum == 100) { validation = true; System.out.println("success"); } else { JOptionPane.showMessageDialog(createFrame, "A and B must add up to 100"); validation = false; } } this is the error int numA = Integer.parseInt(aTextField.getText());
type: Question
linked to: http://stackoverflow.com/q/14319064
answer count: 2
tagged with: validation
tagged with: user-interface
has comment: http://stackoverflow.com/comment/35839776
has answer: http://stackoverflow.com/a/23393643
possible better answer: http://stackoverflow.com/a/23393543
has answer: http://stackoverflow.com/a/23393543
type: AnsweredQuestion

http://stackoverflow.com/comment/35727042
score: 2
type: AnswerComment
comment on: http://stackoverflow.com/a/23331863
has text: @ConorWatt Why do you need `in`? What's it's purpose?
type: Comment

http://stackoverflow.com/a/23446741
has body: Your printResults method declares that it maight throw an exception of a type ArithmeticException. In order for that to happen something needs to go wrong inside the method, for instance if your b param would be zero an exception would be thrown. If you want to throw exception explicitly you need to use throw statement like this in your method throw new ArithmeticException();
type: Answer
score: 0
answers question: http://stackoverflow.com/q/23446710

http://stackoverflow.com/comment/35858780
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23403715
has text: Yes. Non static (instance) methods can run simultaneously on different instances
score: 0

http://stackoverflow.com/a/26722932
has body: I had the same problem and solved it by running : easy_install distribute
answers question: http://stackoverflow.com/q/23445427
score: 0
type: Answer
upvote count: 1
downvote count: 1

http://stackoverflow.com/a/23357697
type: Answer
has comment: http://stackoverflow.com/comment/35830040
answers question: http://stackoverflow.com/q/23356235
has comment: http://stackoverflow.com/comment/35829477
has comment: http://stackoverflow.com/comment/36093034
score: 0
has comment: http://stackoverflow.com/comment/35819273
has body: You could have a look at these answers to get an impression of the meaning of top's output. You can use a script to roughly report what uses your swap space. To my knowledge Linux' swap system is not that straightforward. The kernel first swaps out inactive memory, probably other application's memory, to give GF enough resources. This will not be instantly swapped back in when GF is terminated. You could try to swapoff -a to force Linux to swap things back in, but remember to re-enable it via swapon -a. The VIRT space due to top's manpage: The total amount of virtual memory used by the task. It includes all code, data and shared libraries plus pages that have been swapped out and pages that have been mapped but not used. I doubt that the OS reports on memory usage are that good in order to debug your Java application. You should have a look into your JVM's memory with tools like JVisualVM (part of Oracle's JDK). Observe the progress of memory usage for a relevant period of time. Further you can try to analyze a heap dump with a tool like the Eclipse Memory Analyzer (MAT). MAT has some nice reports that can help to find memory leaks. If your application's memory usage constantly grows it seems to have a leak. Otherwise it would simply have not enough memory available.

http://stackoverflow.com/comment/35667999
type: Comment
has text: hey, thanks for the right path. This is what I got in stack trace: java.lang.OutOfMemoryError: Java heap space Dumping heap to java_pid1880.hprof ... Heap dump file created [2373197265 bytes in 109.742 secs]. I don't know from where that much amount of data (around 2GB) is comming. I even tried: -Xmx2048m -XX:+HeapDumpOnOutOfMemoryError -XX:-UseGCOverheadLimit
comment on: http://stackoverflow.com/a/23299030
score: 0
type: AnswerComment

http://stackoverflow.com/a/23300225
type: Answer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/35669608
has body: You need to use ZipOutputStream instead of FileOutputStream.
accepted answer of: http://stackoverflow.com/q/23300114
upvote count: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23300114
has comment: http://stackoverflow.com/comment/35711700
has comment: http://stackoverflow.com/comment/35671743

http://stackoverflow.com/comment/36029100
has text: What container and version are you using?
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23414194

http://stackoverflow.com/q/23298676
has comment: http://stackoverflow.com/comment/35667666
has comment: http://stackoverflow.com/comment/35670533
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/23300117
has comment: http://stackoverflow.com/comment/35667115
has body: I'm new to JAVA. I have a requirement to load multiple files in a specific folder into an excel xlsx (not xls file because the input files have more than 65k records) file different sheets. Below is the code that I wrote. The xlsx file is getting corrupted, it is not opening. Can you please help? public class twotxttoxlsx{ public static void main(String[]args){ try{ File folder = new File("C:/txttoxls/"); File[] listOfFiles = folder.listFiles(); XSSFWorkbook workbook=new XSSFWorkbook(); for (File file : listOfFiles) { if (file.isFile()) { String thisline; ArrayList&lt;String&gt; al = null; ArrayList&lt;ArrayList&lt;String&gt;&gt; arlist = new ArrayList&lt;ArrayList&lt;String&gt;&gt;(); XSSFSheet sheet = workbook.createSheet(file.getName()); FileInputStream fis = new FileInputStream(file); System.out.println("Got here"); BufferedReader br = new BufferedReader(new InputStreamReader(fis)); while ((thisline = br.readLine()) != null) { al = new ArrayList&lt;String&gt;(); String strar[] = thisline.split("#"); for (int j = 0; j &lt; strar.length; j++) { for (int k = 0; k &lt; arlist.size(); k++) { ArrayList&lt;String&gt; ardata = (ArrayList&lt;String&gt;) arlist.get(k); XSSFRow row = sheet.createRow((short) k); for (int p = 0; p &lt; ardata.size(); p++) { XSSFCell cell = row.createCell((short) p); cell.setCellValue(ardata.get(p).toString()); } } al.add(strar[j]); } arlist.add(al); } fis.close(); FileOutputStream fileOut = new FileOutputStream("C:/txttoxls/Test.xlsx"); workbook.write(fileOut); fileOut.flush(); fileOut.close(); br.close(); } } System.out.println("Your excel file has been generated!"); } catch ( Exception ex ) { System.out.println(ex); } } } Edited on 4/27: working code but performance issue exists. import java.io.*; import java.util.ArrayList; import org.apache.poi.xssf.usermodel.XSSFSheet; import org.apache.poi.xssf.usermodel.XSSFWorkbook; import org.apache.poi.xssf.usermodel.XSSFRow; import org.apache.poi.xssf.usermodel.XSSFCell; public class createXLSXfil…
tagged with: apache-poi
upvote count: 3
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35669353
has title: XLSX file getting corrupted when trying to write data into multiple sheets in JAVA
tagged with: excel
type: Question
score: 3
tagged with: java

http://stackoverflow.com/comment/35681992
type: QuestionComment
has text: @Lav Yes, there is a [project to backport JSR 310](http://www.threeten.org/) (the spec for java.time) to Java 7. I do not know anything about its success or progress. I believe you could build your desired String using Joda-Time library, by calling the `getZone` method on a DateTime object.
comment on: http://stackoverflow.com/q/23292418
score: 0
type: Comment

http://stackoverflow.com/q/23380377
tagged with: string
linked to: http://stackoverflow.com/q/599161
favorite count: 0
linked to: http://stackoverflow.com/q/231051
has comment: http://stackoverflow.com/comment/35895569
linked to: http://stackoverflow.com/q/17646509
tagged with: memory-leaks
has comment: http://stackoverflow.com/comment/35830526
has answer: http://stackoverflow.com/a/23380506
has comment: http://stackoverflow.com/comment/35823085
has comment: http://stackoverflow.com/comment/35895281
has comment: http://stackoverflow.com/comment/35815927
linked to: http://stackoverflow.com/q/7114661
tagged with: jvm
has body: Consider a sample piece of code. public void testString() { int i = 0; while(i &lt; 100000000) { String s ="Hi hello bye" +i; i++; } } In each iteration, a new String is created and its value is no longer needed for the next iteration. I tried printing the memory consumed pre and post this testString() functionality. Here are their values. Before invoking testString(): Total Memory: 91684864 (87.4375 MB) Max Memory: 1360855040 (1297.8125 MB) Free Memory: 72163552 (68.82052612304688 MB) After invoking testString(): Total Memory: 424280064 (404.625 MB) Max Memory: 1360855040 (1297.8125 MB) Free Memory: 171766816 (163.80960083007812 MB). I see a large amount of memory being used and am afraid JVM Heap may go out of bounds due to the current way of handling Strings. The String generated for iteration 1 is no longer needed in iteration 2 and its storage space can be freed. I believe that is not happening here. I tried using StringBuffer and StringBuilder objects and there seems a very marginal improvement in the memory usage. Kindly assist me a better and optimal approach.
has title: How to efficiently manage memory using Strings?
has comment: http://stackoverflow.com/comment/35816143
has answer: http://stackoverflow.com/a/23386594
has comment: http://stackoverflow.com/comment/35815790
downvote count: 2
has answer: http://stackoverflow.com/a/23380571
has comment: http://stackoverflow.com/comment/35817301
has answer: http://stackoverflow.com/a/23381410
has comment: http://stackoverflow.com/comment/35815817
has answer: http://stackoverflow.com/a/23380502
score: 25
type: AnsweredQuestion
tagged with: performance
has answer: http://stackoverflow.com/a/23386909
accepted answer: http://stackoverflow.com/a/23380506
tagged with: java
has comment: http://stackoverflow.com/comment/35815959
has answer: http://stackoverflow.com/a/23387996
linked to: http://stackoverflow.com/q/13531004
type: Question
possible better answer: http://stackoverflow.com/a/23386909
upvote count: 27
has comment: http://stackoverflow.com/comment/35826221
has comment: http://stackoverflow.com/comment/35839883
has comment: http://stackoverflow.com/comment/35895199
answer count: 7

http://stackoverflow.com/a/23299463
downvote count: 0
has comment: http://stackoverflow.com/comment/35691622
type: Answer
has comment: http://stackoverflow.com/comment/35693321
has comment: http://stackoverflow.com/comment/35693932
score: 1
answers question: http://stackoverflow.com/q/23299050
has comment: http://stackoverflow.com/comment/35693840
has comment: http://stackoverflow.com/comment/35690753
has body: you need to call setModel() on comobox obect. comboBox.setModel(new DefaultComboBoxModel&lt;&gt;(aRooms.toArray(new String[aRooms.size()]))); see doc here
has comment: http://stackoverflow.com/comment/35693773
has comment: http://stackoverflow.com/comment/35691694
upvote count: 1

http://stackoverflow.com/comment/35808991
type: Comment
type: QuestionComment
score: 0
has text: Not sure, but it seems the adapter is not attached to the context which should be `getActivity()` inside a fragment..
comment on: http://stackoverflow.com/q/23374955

http://stackoverflow.com/comment/35667683
has text: Making the method `boolToText` static is probably a good idea. Also typo "Feild".
comment on: http://stackoverflow.com/a/23299536
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/23379962
has answer: http://stackoverflow.com/a/23393247
tagged with: maven
linked to: http://stackoverflow.com/q/7293408
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/23637117
has comment: http://stackoverflow.com/comment/35816646
type: Question
has comment: http://stackoverflow.com/comment/35838408
has body: I needed to change my project to Java 1.7. This causes an error that lots of folks are seeing: org.apache.maven.surefire.util.SurefireReflectionException: java.lang.reflect.InvocationTargetException; nested exception is java.lang.reflect.InvocationTargetException: null ... Caused by: java.lang.UnsupportedClassVersionError: com/.../AppTest : Unsupported major.minor version 51.0 I've seen the many pages saying to configure the maven-surefire-plugin jvm, but this isn't working for me. Also, my default java IS 1.7, so I don't understand why this should be needed anyway. $ java -version java version "1.7.0_45" Java(TM) SE Runtime Environment (build 1.7.0_45-b18) Java HotSpot(TM) 64-Bit Server VM (build 24.45-b08, mixed mode) $ javac -version javac 1.7.0_45 Also on OS X I thought we're not supposed to be using variables and symlinks, the javahome subsystem is supposed to keep this all sorted out. $ javahome /Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home Attempts and errors: Attempted Fix 1: maven-surefire-plugin ${env.JAVA_HOME_7}/bin/java Error 1: /bin/sh: ${env.JAVA_HOME_7}/bin/java: bad substitution Attempted Fix 2: org.apache.maven.plugins maven-surefire-plugin 2.9 ${jdk.home}/bin/java Error 2: /bin/sh: ${jdk.home}/bin/java: bad substitution Questions: Java 7 is the default, so why should I need to do anything? On OSX, what is the "best practice" for maven? The second failure seems really odd, shouldn't ${jdk.home} be almost "hardwired" in maven? How did Maven get so broken? It puts surefire in the mix, I didn't. And they have directives for setting Java 1.7. So how could this even happen? Is it being worked on? I eventually did find a workaround: # I'd rather not put this in my .profile export JAVA_HOME=`javahome` # Then in pom.xml I put: ${env.JAVA_HOME}/bin/java
has answer: http://stackoverflow.com/a/23637117
has title: Stock Maven surefire "Java 7" fixes not working on Mac, workaround, trying to understand
answer count: 2
accepted answer: http://stackoverflow.com/a/23393247
upvote count: 1
has comment: http://stackoverflow.com/comment/35839846
tagged with: macos
favorite count: 0

http://stackoverflow.com/comment/35692932
comment on: http://stackoverflow.com/q/23313177
type: Comment
type: QuestionComment
score: 0
has text: I mean to build a new query `"select <columns> from where <new condition>"` and execute it again.

http://stackoverflow.com/a/23350271
type: Answer
has comment: http://stackoverflow.com/comment/35760576
has body: This does not really make sense what you are doing there. The playerTurn variable has local scope, which means that it won't be "saved" between two clicks. It should have another scope, e.g. be a private field of the containing class. Furthermore you are checking in both conditions whether playerTurn is true. The else branch will never be used. Edit: You should also use println, as it is possible that a simple print won't result in a flush of the stream.
has comment: http://stackoverflow.com/comment/35760556
has comment: http://stackoverflow.com/comment/35760530
has comment: http://stackoverflow.com/comment/35760635
score: 0
answers question: http://stackoverflow.com/q/23350229

http://stackoverflow.com/comment/35825965
type: QuestionComment
has text: you also don't need the `WHERE 1` part.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23386116

http://stackoverflow.com/comment/35706453
type: Comment
has text: It seams you need `spring-orm` dependency ** org.springframework spring-orm 3.1.1.RELEASE **
score: 0
comment on: http://stackoverflow.com/q/23321046
type: QuestionComment

http://stackoverflow.com/q/23316347
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/3066590
has comment: http://stackoverflow.com/comment/35699166
tagged with: java
upvote count: 1
tagged with: observer-pattern
tagged with: swing
has comment: http://stackoverflow.com/comment/35698691
accepted answer: http://stackoverflow.com/a/23323254
has comment: http://stackoverflow.com/comment/35698527
downvote count: 1
type: Question
has title: update() call from Observable not called
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/35700290
favorite count: 0
has answer: http://stackoverflow.com/a/23323254
has body: I have an Observer which my Window class. I have a Model class that extends Observable containing an ImagePanel class, and a Controller class. I do add to my Model instance the window. My problem is : I do a print before model.notifyObservers(), it works, another print after this call, it works too. But the print inside the update() of my Observer method doesn't show up? From my controller I call this setImage method: public void setImage(File file) { try { image = ImageIO.read(file); fileName = file.getPath(); } catch (IOException e) { e.printStackTrace(); } width = image.getWidth(); height = image.getHeight(); imageType = image.getType(); pixels = new int[width * height]; image.getRGB(0, 0, width, height, pixels, 0, width); this.setLocation(1000, 500); System.out.println("ALRIGHT2"); model.change(); if (model.hasChanged()) { System.out.println("ALRIGHT5"); model.notifyObservers(); System.out.println("ALRIGHT6"); } } This is the update method of my Observer: public void update(Observable o, Object arg) { System.out.println("ALRIGHT3"); image_panel.repaint(); scrollPaneImage.repaint(); } And I did this in my Observer constructor: model.addObserver(this); What's wrong? I assume that the image I chose thanks to a JFileChooser doesn't update because this method is not called...

http://stackoverflow.com/q/23447301
type: Question
has comment: http://stackoverflow.com/comment/35941280
has title: JavaFX TableView Custom selection model
has body: I have a table view with a custom cell factory to have a checkbox. I want to bind selection between a checkbox and a selected row. ( select a row manually) The problems are 1) I can't manage to get the row when a change occurs, I can get a cell index that doesn't correspond to anything. 2) If I manually select index 0, it does a strange selection ( grey vs blue, different then when you click)
upvote count: 1
linked to: http://stackoverflow.com/q/21402124
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35940979
answer count: 0
has comment: http://stackoverflow.com/comment/35941547
downvote count: 0
score: 1
tagged with: java
tagged with: javafx
has comment: http://stackoverflow.com/comment/35940381

http://stackoverflow.com/a/23420983
answers question: http://stackoverflow.com/q/23420908
score: 0
type: AcceptedAnswer
type: Answer
has body: @niiraj874u is correct. You want 2 classes. One for the boy and one for the rock. Generally speaking, different nouns should become different classes. Each noun, a boy and a rock in this case, will have different actions (functions) to perform: the boy will jump, the rock will roll (I guess). And these functions should be encapsulated into the separate classes depending on which object does which action.
accepted answer of: http://stackoverflow.com/q/23420908

http://stackoverflow.com/comment/35670628
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23300876
has text: I have updated this and simplified hugely due to feedback on my answer

http://stackoverflow.com/q/23424958
favorite count: 0
has title: Does java.io.FileWriter buffer bytes before writing to the output stream
has comment: http://stackoverflow.com/comment/35899327
type: AnsweredQuestion
tagged with: bufferedwriter
accepted answer: http://stackoverflow.com/a/23425538
linked to: http://stackoverflow.com/q/6108043
tagged with: java
tagged with: filewriter
tagged with: fileoutputstream
type: Question
downvote count: 0
has answer: http://stackoverflow.com/a/23425854
score: 4
upvote count: 4
has body: As per java docs, In general, a Writer sends its output immediately to the underlying character or byte stream. Unless prompt output is required, it is advisable to wrap a BufferedWriter around any Writer whose write() operations may be costly, such as FileWriters and OutputStreamWriters. For example, PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter("foo.out"))); will buffer the PrintWriter's output to the file. Without buffering, each invocation of a print() method would cause characters to be converted into bytes that would then be written immediately to the file, which can be very inefficient. But the following code appears as though FileWriter also buffers bytes before flushing to the output stream. import java.io.File; import java.io.FileWriter; import java.io.IOException; public class TestFileWriter { /** * @param args * @throws IOException */ public static void main(String[] args) throws IOException { FileWriter fileWriter= new FileWriter("test.txt"); File file=new File("test.txt"); for (int i=0; i&lt;1000; i++) { fileWriter.write("a very long string, a very long string, a very long string, a very long string, a very long string\n"); if(i%50 == 0) System.out.print("file size=" + file.length()+","); } fileWriter.close(); System.out.println("file size=" + file.length()); } } Output :- file size=0,file size=0,file size=8192,file size=8192,file size=16384,file size=24576,file size=24576,file size=32768,file size=32768,file size=40960,file size=49152,file size=49152,file size=57344,file size=57344,file size=65536,file size=73728,file size=73728,file size=81920,file size=81920,file size=90112,file size=99000 Why isn't the data being written to the file as and when it is being written ?
answer count: 2
tagged with: file-io
possible better answer: http://stackoverflow.com/a/23425854
has answer: http://stackoverflow.com/a/23425538

http://stackoverflow.com/a/23364107
accepted answer of: http://stackoverflow.com/q/23315617
score: 0
type: AcceptedAnswer
type: Answer
has body: Why are you assigning shop.products = products; shouldn't you do shop.products.add(products); ?
answers question: http://stackoverflow.com/q/23315617

http://stackoverflow.com/a/23318226
has body: This is a different approach that automatically returns a blank String if there isn't a 5th word: String word = input.replaceAll("^\\s*(\\S+\\s+){4}(\\S+)?.*", "$1"); Solutions that rely on split() would need an extra step of checking the resulting array length to prevent getting an ArrayIndexOutOfBoundsException if there are less than 5 words.
score: 1
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/23318166
upvote count: 1

http://stackoverflow.com/q/23440395
has body: Now this bothers me. Why do I need to create an enum than creating a normal java class? what extra advantage it gives me? I really do not understand enums. Now I saw this code in stackoverflaw itself. enum Cats { FELIX(2), SHEEBA(3), RUFUS(7); private int mAge; Cats(int age) { mAge = age; } public int getAge() { return mAge; } } And I wonder why it is an enum than a class... please explain this to me. Thanks in advance. update: I need this for a airplane management in a airport. It was hard to figure out where to put an enum.And that's it.
tagged with: class
upvote count: 3
score: 0
has comment: http://stackoverflow.com/comment/35928081
downvote count: 3
has title: What is the difference between creating an enum than a just java class?
answer count: 1
has comment: http://stackoverflow.com/comment/35927928
duplicate of: http://stackoverflow.com/q/9969690
linked to: http://stackoverflow.com/q/9850525
favorite count: 0
linked to: http://stackoverflow.com/q/9969690
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23440487
has comment: http://stackoverflow.com/comment/35927998
has comment: http://stackoverflow.com/comment/35928022
linked to: http://stackoverflow.com/q/15734225
tagged with: java
has comment: http://stackoverflow.com/comment/35928086
has comment: http://stackoverflow.com/comment/35928040
has comment: http://stackoverflow.com/comment/35928018
type: Question
tagged with: enums
has comment: http://stackoverflow.com/comment/35927973

http://stackoverflow.com/comment/35823064
score: 1
has text: @BrassApparatus Indeed, the general rule is if you change a variable to point to a different object only that variable is changed (like changing the address in your address book), this always involves an `=` and may involve a `new` (but may not and the new is hidden with strings) . On the other hand if you use a method on an object (like sending a parcel to to house to which you have an address) then everywhere that object is visible will see the change (this always involves a `.` to a method that is a setter (or otherwise changes the object))
comment on: http://stackoverflow.com/q/23383303
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35763893
score: 0
type: AnswerComment
type: Comment
has text: Thanks. Is there a way/method/function for a developer to tell the `SessionFactory` which kind of session to use ? A made up example - `SessionFactory.setCurrentDefinition(String mode)`. Here mode can be "same old session" or "brand new session".
comment on: http://stackoverflow.com/a/23351235

http://stackoverflow.com/a/23470403
score: 3
has comment: http://stackoverflow.com/comment/36053596
accepted answer of: http://stackoverflow.com/q/23444238
answers question: http://stackoverflow.com/q/23444238
has comment: http://stackoverflow.com/comment/36057683
upvote count: 3
has comment: http://stackoverflow.com/comment/36038276
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36009606
type: Answer
downvote count: 0
has body: Just by looking at the API, have you tried this? Event.Reminders reminders = new Event.Reminders(); reminders.setUseDefault(false); List&lt;EventReminder&gt; listEventReminder = new ArrayList&lt;EventReminder&gt;(); listEventReminder.add(reminder); reminders.setOverrides(listEventReminder); event.setReminders(reminders); System.out.println("Is null? = " + event.getReminders());

http://stackoverflow.com/comment/35819168
comment on: http://stackoverflow.com/q/23382102
type: Comment
type: QuestionComment
has text: Show us the folder structure and web.xml content, please.
score: 1

http://stackoverflow.com/comment/35894808
has text: @EdwinDalorzo, because of my application concerns, conversion between, object and xml or json can be a performance hit and this process is very frequently happening. The other problem is, those objects which are supposed to send, are stored in the application (some time persistence POJO, cahed objected). Therefore, serialization is required.
comment on: http://stackoverflow.com/q/23421967
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23406606
answers question: http://stackoverflow.com/q/23406445
has body: if accepts a boolean value, not a double. Something like: public boolean stopAtRange(double number, double current, double accuracy) { if(Math.abs(current-number) &lt;= accuracy) { return true; } return false; }
score: 0
type: Answer

http://stackoverflow.com/q/23296627
tagged with: collections
type: Question
has answer: http://stackoverflow.com/a/23296701
has answer: http://stackoverflow.com/a/23296721
tagged with: sorting
tagged with: arraylist
tagged with: comparator
answer count: 2
possible better answer: http://stackoverflow.com/a/23296721
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/23296701
has title: Sorting an ArrayList<String> with custom Comparator
type: AnsweredQuestion
has body: I am trying to sort an ArrayList&lt;String&gt; using custom Comparator. My requirement is that XX String should be the first String, others should follow natural ordering. I need : [XX, XX, 1, 5, 9, A, D, G, Q, Z] What I am getting is [1, 5, 9, A, D, G, Q, Z, XX, XX] Following is my code: public class Test { public static void main(String[] args) { List&lt;String&gt; list = new ArrayList&lt;String&gt;(); list.add("Z"); list.add("5"); list.add("D"); list.add("G"); list.add("XX"); list.add("9"); list.add("Q"); list.add("XX"); list.add("1"); list.add("A"); Collections.sort(list, new CustomComparator()); System.out.println(list); } } class CustomComparator implements Comparator&lt;String&gt; { @Override public int compare(String o1, String o2) { if(o2.equals("XX")) { return -1; } return o1.compareTo(o2); } } EDIT: if i change comparator logic to: @Override public int compare(String o1, String o2) { if(o2.equals("XX")) { return 1; } return o1.compareTo(o2); } I am getting : [1, XX, 9, A, Q, XX, 5, D, G, Z] Please let me know how to proceed. Thanks in advance.
score: 1
tagged with: java
upvote count: 1

http://stackoverflow.com/q/23444267
has title: Drawing lines on top of image without using AlphaComposite
has comment: http://stackoverflow.com/comment/35934607
tagged with: paintcomponent
favorite count: 0
has body: I am currently having lots of difficulty in one of my assignments. The task for this assignment is to create an aviation radar, VOR, with java's GUI features. When the user presses either the left/right arrow on their keyboard, the circular radar should rotate, and a needle in the middle of the radar should move left/right. I am very close to finishing, but I am stuck on one part. I drew an image of the radar, and I attempted to draw a line on top of it. However, I was only successful when I was able to make all JPanels transparent. This causes a problem because it is difficult to see what I drew on top of it. So, my question is, how would I draw it on top of the radar image without making everything transparent? Below is my code public class finalVORGUI extends JPanel{ private JPanel rotationPanel; private JPanel needle; private JPanel attributes; private int degrees; private String CurrentRadial; private int x; private int y1; private int y2; final int WIDTH = 600; final int HEIGHT = 600; private ImageIcon radar = new ImageIcon("image/vor1.png"); /** * The constructor for the class * It's going to set the dimension of the program to 600x600, the * background is going to be white (in order to blend in with the * vor image), and it is going to add in the VOR radar and a radial * indicator that will let the user know which radial he/she is on */ public finalVORGUI(){ JLayeredPane lp = new JLayeredPane(); lp.setPreferredSize(new Dimension(WIDTH, HEIGHT)); setBackground(Color.white); lp.setLayout(null); lp.setFocusable(true); lp.addKeyListener(new KeyboardListener()); rotationPanel = new JPanel(); rotationPanel = new TurningCanvas(); needle = new JPanel(); needle = new DrawNeedle(); attributes = new JPanel(); attributes = new DrawAttributes(); lp.add(rotationPanel, Integer.valueOf(1)); lp.add(needle, Integer.valueOf(2)); lp.add(attributes, Integer.valueOf(3)); needle.setBounds(100,0, needle.getPreferredSize().width, needle.getPreferredSize().height); rotationPanel.setB…
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35939627
has comment: http://stackoverflow.com/comment/35945916
answer count: 0
downvote count: 0
tagged with: drawimage
score: 1
tagged with: java
tagged with: swing
has comment: http://stackoverflow.com/comment/35934822
type: Question
has comment: http://stackoverflow.com/comment/35935501
has comment: http://stackoverflow.com/comment/35935103
upvote count: 1
has comment: http://stackoverflow.com/comment/35935376

http://stackoverflow.com/a/23452374
answers question: http://stackoverflow.com/q/23452286
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/23452286
downvote count: 0
has body: Please do these steps to troubleshoot your issue. In eclipse go to Windows>Preferences>Server>Run Time Environments. Now please check following things make sure apache tomcat 7 is there. If this is present make sure that the path specified in "Tomcat installation directory" there is still a tomcat at that path. If above two are good then delete the runtime and re add your tomcat as runtimes. I hope this helps you fix your problem :).
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/comment/35765105
score: 0
type: AnswerComment
has text: What I could do is make the DataProvider in the Stub factory be static, and put a setter on the DataProviderStub. Then the test can at least have access to the values. It's ugly, but functional. Do you see a problem there? Or, of course, if anybody has anything better...
type: Comment
comment on: http://stackoverflow.com/a/23349031

http://stackoverflow.com/q/23413498
has comment: http://stackoverflow.com/comment/43684320
tagged with: maven
possible better answer: http://stackoverflow.com/a/23415737
tagged with: maven-surefire-plugin
accepted answer: http://stackoverflow.com/a/23413946
type: AnsweredQuestion
score: 2
has title: maven surefire plugin does not inject system properties
downvote count: 0
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/23413946
has comment: http://stackoverflow.com/comment/35877794
has answer: http://stackoverflow.com/a/23415737
has comment: http://stackoverflow.com/comment/35877712
upvote count: 2
answer count: 2
has body: This is how I set the values org.apache.maven.plugins maven-surefire-plugin 2.17 spring.active.profiles Test <systemPropertyVariables> <spring.active.profiles>development</spring.active.profiles> </systemPropertyVariables> The test fails @Test public void testGetProfile() throws Exception { assertEquals("development", System.getProperty("spring.active.profiles")); } I see java.lang.AssertionError: Expected :development Actual :null What am I missing here?
favorite count: 0

http://stackoverflow.com/comment/35932136
type: Comment
score: 1
has text: @Holger: I know, it *shouldn't* be applicable. But check again my blockquoted section: *"Certain argument expressions that contain implicitly typed lambda expressions (§15.27.1) or inexact method references (§15.13.1) are ignored by the applicability tests, because their meaning cannot be determined until a target type is selected."* Maybe, the applicability section is simply skipped for *implicitly* typed lambda expressions
type: AnswerComment
comment on: http://stackoverflow.com/a/23431672

http://stackoverflow.com/comment/35742624
type: QuestionComment
comment on: http://stackoverflow.com/q/23337735
has text: So you have to rethink your coordinate system. If minX = 0, then maxX must be as wide as the gamefield. If minX = -1 * (gameField.width / 2), then maxX has to be gameField.width / 2.
score: 0
type: Comment

http://stackoverflow.com/a/23383075
upvote count: 1
type: Answer
downvote count: 0
score: 1
has body: You just need to keep track of the previous values and iterate through the list. List&lt;Integer&gt; origList = getListHowever(); List&lt;Integer&gt; spacedList = new ArrayList&lt;Integer&gt;(); int bufferElement = -1; int currVal; int lastVal = Integer.MIN_VALUE; // or some default value that is unlikely to be in the list for (int i=0; i&lt;origList.size(); i++) { currVal = origList.get(i); if (lastVal != currVal) { spacedList.add(bufferElement); } spacedList.add(currVal); lastVal = currVal; } The same methodology could be followed as items are added to the original list. Either keep track of the last value added or peek at the last element.
answers question: http://stackoverflow.com/q/23382846
has comment: http://stackoverflow.com/comment/35820902

http://stackoverflow.com/a/23385378
type: Answer
has comment: http://stackoverflow.com/comment/35824721
has body: You can do import java.util.Comparator; public class Book { String author; String title; int id; public boolean equals(Object o) { return id == ((Book) o).id; } //getters and setters //other methods } class BookComparator implements Comparator&lt;Book&gt;{ @Override public int compare(Book o1, Book o2) { if(o1.getAuthor() == o2.getAuthor() &amp;&amp; o1.getTitle() == o2.getTitle()) return 0; return 1; } } and then you can do something like Set&lt;Book&gt; lSet = new TreeSet&lt;Book&gt;(new BookComparator()); lSet.addAll(list1); lSet.addAll(list2);
answers question: http://stackoverflow.com/q/23385056
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/35825449
has comment: http://stackoverflow.com/comment/35827005
score: 0
has comment: http://stackoverflow.com/comment/35825348
has comment: http://stackoverflow.com/comment/35825074
has comment: http://stackoverflow.com/comment/35825198

http://stackoverflow.com/comment/35932560
has text: @Poomrokc .Again Updated. Finally This Will Work :-)
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23443074

http://stackoverflow.com/comment/35782995
score: 0
has text: You can also refers to : http://stackoverflow.com/questions/15833184/java-blob-image-display
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23362667

http://stackoverflow.com/comment/35685905
type: Comment
comment on: http://stackoverflow.com/a/23295079
has text: there is a probleam its not working in devlopment mode but work on tomcat .
score: 0
type: AnswerComment

http://stackoverflow.com/comment/35823107
has text: You can not pass a datatype as an argument to a method, you can only pass the value of that datatype.
comment on: http://stackoverflow.com/q/23384369
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23415989
has comment: http://stackoverflow.com/comment/35882925
score: 0
has comment: http://stackoverflow.com/comment/35882785
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35883131
type: Answer
has comment: http://stackoverflow.com/comment/35882685
has body: math.pow(a,b) means a^b and math.sqrt(a) is the square root of a. you don't understand the java method or the mathematical logic in your content?
accepted answer of: http://stackoverflow.com/q/23415863
downvote count: 1
answers question: http://stackoverflow.com/q/23415863

http://stackoverflow.com/a/23400095
upvote count: 2
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/23398978
type: Answer
has body: I am having trouble figuring out how to update a selected listmodel. Read the section from the Swing tutorial on How to Use Lists. It has a working example that shows you how to dynamically add/remove elements from the DefaultListModel based on a user interaction with the GUI.

http://stackoverflow.com/a/23431275
answers question: http://stackoverflow.com/q/23429230
upvote count: 1
downvote count: 0
score: 1
type: Answer
has body: I assume you are using java.util.logging. From the j.u.l.FileHandler documentation: Normally the "%u" unique field is set to 0. However, if the FileHandler tries to open the filename and finds the file is currently in use by another process it will increment the unique number field and try again. This will be repeated until FileHandler finds a file name that is not currently in use. If there is a conflict and no "%u" field has been specified, it will be added at the end of the filename after a dot. (This will be after any automatically added generation number.) Opening multiple file handlers within the same process also has the same effect. Add lines to log the result of java.lang.management.ManagementFactory.getRuntimeMXBean().getName() and java.lang.management.ManagementFactory.getRuntimeMXBean().getStartTime() so you can identify the JVMs that are creating the log files. You are either creating too many filehandlers pointing to the same location or you are starting multiple instances of your app. You might want to look at the LogManager documentation which will explain alternate ways to configure your log settings.

http://stackoverflow.com/q/23347042
has comment: http://stackoverflow.com/comment/35754644
has comment: http://stackoverflow.com/comment/35754713
type: UnansweredQuestion
has title: How to draw continuous enemies in java 2D
has comment: http://stackoverflow.com/comment/35754168
has comment: http://stackoverflow.com/comment/35754555
tagged with: 2d
tagged with: java
has comment: http://stackoverflow.com/comment/35754745
has answer: http://stackoverflow.com/a/23348108
type: Question
has body: I'm creating a battleship game with a ship at the bottom of the screen moving left and right. The ship shoots projectiles straight up at bombs dropping from the sky. The objective is to have a continous flow of bombs dropping down at the player to shoot at and avoid. So far I have only delt with drawing like this: public static Bomb b1, b2; private Image image, Battleship, Background, Bomb; @Override public void start() { bg1 = new Background(0, 0); ship = new Ship(); b1 = new Bomb(340, -100); b2 = new Bomb(700, -100); Thread thread = new Thread(this); thread.start(); } @Override public void run() { while (true) { ship.update(); ArrayList projectiles = ship.getProjectiles(); for(int i = 0; i &lt; projectiles.size(); i++){ Projectile p = (Projectile) projectiles.get(i); if(p.isVisible() == true){ p.update(); }else{ projectiles.remove(i); } } b1.update(); b2.update(); bg1.update(); bg2.update(); repaint(); try { Thread.sleep(17); } catch (InterruptedException e) { e.printStackTrace(); } } } @Override public void paint(Graphics g) { g.drawImage(Background, bg1.getBgX(), bg1.getBgY(), this); ArrayList projectiles = ship.getProjectiles(); for(int i = 0; i &lt; projectiles.size(); i++){ Projectile p = (Projectile) projectiles.get(i); g.setColor(Color.BLACK); g.fillRect(p.getX(), p.getY(), 5, 10); } g.drawImage(Battleship, ship.getCenterX() + 230, ship.getCenterY() -23, this); g.drawImage(Bomb, b1.getCenterX() - 20, b1.getCenterY() - 19, this); g.drawImage(Bomb, b2.getCenterX() - 20, b2.getCenterY() - 19, this); g.setFont(font); g.setColor(Color.BLACK); g.drawString(text, 650, 30); g.drawString(Integer.toString(score), 720, 30); } So everything i draw is there at the start how would I add bombs continuously?
tagged with: applet
score: 0
tagged with: android
has comment: http://stackoverflow.com/comment/35755702
answer count: 1

http://stackoverflow.com/a/23395272
score: 1
downvote count: 0
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/23384099
has body: IIRC, you can use XPath to do something like this: @FindBy(how=How.XPATH,using = "(//a[contains(@class, 'ui-id-')])[2]") where the final [2] specifies the second element returned by the previous XPath. (sorry, I'm working from memory - I haven't tested this specific XPath)

http://stackoverflow.com/comment/35798879
type: AnswerComment
type: Comment
has text: yess thanks. actually I did String banana = (userInput.getText()); and apple = (userInteger + userInteger2); but yeah
comment on: http://stackoverflow.com/a/23371086
score: 0

http://stackoverflow.com/q/23314866
possible better answer: http://stackoverflow.com/a/23314914
accepted answer: http://stackoverflow.com/a/23314941
has answer: http://stackoverflow.com/a/23314899
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/35695525
type: Question
answer count: 6
has title: How to process specific rows in a two dimensional array
has answer: http://stackoverflow.com/a/23314941
score: 0
has body: public class OutputRowsandColumns { public static void main(String[] args) { int cols = 10; int rows = 10; int[][] myArray = new int[cols][rows]; // Two nested loops allow us to visit every spot in a 2D array. // For every column I, visit every row J. for (int i = 0; i &lt; cols; i++) for (int j = 0; j &lt; rows; j++) myArray[i][j] = 0; } } Here is the code I have so far, My question is; How do I process specific even and odd rows to set all even rows to 0 and all odd rows to 1.
has comment: http://stackoverflow.com/comment/35695548
has answer: http://stackoverflow.com/a/23314914
has answer: http://stackoverflow.com/a/23314912
has comment: http://stackoverflow.com/comment/35695533
has answer: http://stackoverflow.com/a/23315303
has answer: http://stackoverflow.com/a/23314946

http://stackoverflow.com/comment/35736053
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/23337148
has text: Why 50? What about the remaining places in the array, what value will they have?

http://stackoverflow.com/comment/35940774
type: Comment
has text: I did not entered any Input Everything happen on its own
comment on: http://stackoverflow.com/q/23447536
score: 0
type: QuestionComment

http://stackoverflow.com/comment/35772463
type: Comment
type: QuestionComment
has text: Thanks :) Sorry I don't understand the lingo, what's a stack trace? I'll remove the blocks of commented code now.
score: 0
comment on: http://stackoverflow.com/q/23351448

http://stackoverflow.com/comment/35726432
score: 0
type: QuestionComment
type: Comment
has text: @Code-Guru, it did, but it seemed it didn't understand my accent. is there another way?
comment on: http://stackoverflow.com/q/23331629

http://stackoverflow.com/a/73457022
upvote count: 3
has body: I also have the same issue in my spring boot application. All the tutorials and threads I found told me to use spring.jpa.properties.hibernate.generate_statistics=true but it was not working. Then I added hibernate.properties file to the resource folder and inside the file add hibernate.generate_statistics=true Then I restart my spring boot app and it works like a charm. So I guess there is some bug/issue in some specific spring boot version(I was using 2.2.13) where the generate_statistics would not be taken by hibernate from spring.jpa.properties. Btw, all the other properties like format_sql is working by setting up in spring.jpa.properties
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/139520690
answers question: http://stackoverflow.com/q/23353803
score: 3

substring
tags question: http://stackoverflow.com/q/23320180
tags question: http://stackoverflow.com/q/23415980
tags question: http://stackoverflow.com/q/23379908
type: Tag
tags question: http://stackoverflow.com/q/23332343
tags question: http://stackoverflow.com/q/23401508
tag name: substring
tags question: http://stackoverflow.com/q/23363898

http://stackoverflow.com/q/23451050
has body: I need to place a divider after nth element in the list view that is generated from a mysqli cursor. I created custom adapter that tries to do that, like this: MyAdapter extends CursorAdapter { ... blablabla yadayadayada ... @Override public View newView(Context context, Cursor cursor, ViewGroup parent) { final View view; int pos = cursor.getPosition(); int beforeLast = GameData.totalPlayers-1; if (pos == beforeLast) { view = mInflater.inflate(R.layout.player_details_divider, parent, false); } else { view = mInflater.inflate(R.layout.player_details, parent, false); } return view; } } So as you can see its supposed to inflate different view for an element on a position totalPlayers-1. It works great when number is small enough: 1 through 6. But when its bigger it just stops working. I tried debugging the thing and I noticed that it renders 6 items - this is how much list elements fits on the screen - and goes through the loop 6 times incrementing pos to 5. Then it stops. When I start scrolling the list, it runs the loop again, incrementing pos to 6 and then it stops. No matter how many elements there are it just never increments pos to 7 (although all data are present in the list, so cursor must be iterated to the end). Any ideas why it behaves like this? What is it I am not understanding/doing wrong?
tagged with: divider
tagged with: listview
has answer: http://stackoverflow.com/a/23451251
has title: Android ListView - divider after nth element
answer count: 1
favorite count: 0
tagged with: android
tagged with: android-cursor
upvote count: 1
accepted answer: http://stackoverflow.com/a/23451251
type: AnsweredQuestion
score: 1
tagged with: java
type: Question
downvote count: 0

http://stackoverflow.com/q/23330737
type: Question
answer count: 2
accepted answer: http://stackoverflow.com/a/23330818
has answer: http://stackoverflow.com/a/23330758
possible better answer: http://stackoverflow.com/a/23330758
has body: I am currently trying to build a simple program and have not covered action listeners as of yet, currently i am learning Swing/GUIs. I am attempting to display various images display every few seconds when a button is clicked, kind of like a slide show display. The problem i have is how to actually stop the slide show? I have button that when clicked i would like to be able to stop the slide show but i am not able to click it when the display is running. I am not sure if the code below is correct, the thread interrupted is there just to ensure it the program doesn't stop/get stuck. startSlide.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent actionEvent) { try{ Thread.sleep(5000); Thread.interrupted(); } catch (java.lang.InterruptedException ie){ System.out.println(ie); } } });
has answer: http://stackoverflow.com/a/23330818
type: AnsweredQuestion
score: 0
tagged with: java
has title: How to stop a thread sleeping via an action/button click?

http://stackoverflow.com/a/23449777
answers question: http://stackoverflow.com/q/23444706
score: 2
downvote count: 0
type: AcceptedAnswer
has body: I "cleaned" your code a little bit and changed the Array to check duplicate random numbers to an ArrayList. It's not the fastest solution, but it should work. The problem is that you don't get out of the for loop until the whole program exits. As geoand described above, RandInt == NA[k] will never be true, because RandInt will always be &lt;= 19, so no new random number will be generated. So there are two wrong things in the code. When you want to learn more about faster checking for duplicate entries, maybe this will help you: http://javarevisited.blogspot.de/2012/02/how-to-check-or-detect-duplicate.html I hope I could help you. :) static String[] places = {"Man Utd", "Arsenal", "Aston Villa", "Chelsea", "Everton", "Fulham", "Liverpool", "Man City", "Newcastle", "Norwich", "QPR", "Reading", "Southampton", "Stoke", "Sunderland", "Swansea", "Spurs", "West Brom", "West ham", "Wigan"}; static int[] NA = new ArrayList&lt;Integer&gt;(5); static Random rand = new Random(); static int RandInt = 0; static int player = 1; public static void main(String[] args) { while (player &lt; 5) { RandInt = rand.nextInt(places.length); for (int i = 0; i &lt;= NA.size(); i++) { if (RandInt == NA.get(i)) { RandInt = rand.nextInt(places.length); } else { NA.add(RandInt); break; } } System.out.println("player " + player + " is managing " + places[RandInt]); player++; } System.exit(0); }
upvote count: 2
accepted answer of: http://stackoverflow.com/q/23444706
type: Answer

http://stackoverflow.com/q/23294540
upvote count: 3
tagged with: java
type: Question
has title: How to extract the digest algorithm from a X509Certificate
score: 3
accepted answer: http://stackoverflow.com/a/23361016
has body: I can extract the OID and the name of the signature algorithm from a X509Certificate instance such as "SHA256WithRSA" but how do i extract the name of the digest algorithm like e.g. "SHA256". Is there a way beside a string splitting for "with" or a fixed mapping of the OID's? Side question: Would it be safe to split for "with"?
answer count: 1
downvote count: 0
favorite count: 0
tagged with: x509certificate
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23361016

http://stackoverflow.com/comment/35896888
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/23423695
has text: An arraylist would work. You could also use a LinkedList BTW.
type: Comment

http://stackoverflow.com/a/23330496
answers question: http://stackoverflow.com/q/23330200
downvote count: 0
has comment: http://stackoverflow.com/comment/35725443
has body: According to getInstance() method Javadoc (the one that accepts String), you should use it with one of the possible values: jceks - The proprietary keystore implementation provided by the SunJCE provider; jks - The proprietary keystore implementation provided by the SUN provider; pkcs12 - The transfer syntax for personal identity information as defined in PKCS #12; Information taken from here. For me it sounds like you're misusing KeyStore.TrustedCertificateEntry class as it seems to be intended to be used with getEntry()/setEntry() methods.
type: Answer
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/35724541
has comment: http://stackoverflow.com/comment/35724619

http://stackoverflow.com/comment/35700406
score: 0
type: Comment
has text: Oh this works! So am I correct to assume that the method that has the same name as the class name is run whenever that object is created?
comment on: http://stackoverflow.com/a/23317391
type: AnswerComment

http://stackoverflow.com/comment/35654231
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23292183
has text: In my current organization, its all about releasing new versions of the software and the business folks run the show. So I have a batch application that takes 8 hrs and the SLA they want is for 4 hrs. Its single threaded. Could you give me a simple example of how the executor framework could be used?
type: AnswerComment

http://stackoverflow.com/q/23359803
score: 0
tagged with: hql
type: Question
tagged with: java
tagged with: hibernate
tagged with: sql
has body: I have a table Users and another table called Transactiopn. One user has multiple transaction. I'm trying to write an HQL to get the list of all Users and his latest transaction. How do I write this? Latest transaction means the one with max value of id. If I write something like select name, transaction.amount from Users I get an error illegal attempt to dereference collection [{synthetic-alias}{non-qualified-property-ref}trIP Attribute] with element property reference this is because transaction is a list in User table. I need to select from Users itself since there are other related referenced columns. So how do I take the last transaction amount? I can try to translate a normal SQL query if someone can help me with that.
answer count: 1
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23360010
has title: HQL querying issue in One to Many Case

http://stackoverflow.com/comment/35688183
comment on: http://stackoverflow.com/q/23310573
has text: @user3575279 yeah, that is what I "surmised"; my problem was with wearing blinders ;)
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35939660
has text: Awesome. I will test out the LayoutParams and see if I can get it in the meantime. Big thanks again for the help Xaver!
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23445771

http://stackoverflow.com/comment/36757954
score: 0
type: Comment
type: QuestionComment
has text: Have you tried reinstalling STS ?
comment on: http://stackoverflow.com/q/23332315

http://stackoverflow.com/comment/35936049
comment on: http://stackoverflow.com/a/23444782
type: Comment
has text: You have understood the code wrong. The while loop only gets executed once because the for loop executes 5 times. You don't have to take my word for it, you just need to run the code and see for yourself
score: 0
type: AnswerComment

http://stackoverflow.com/comment/35703791
score: 0
comment on: http://stackoverflow.com/q/23319210
type: Comment
type: QuestionComment
has text: @WarrenDew. I appreciate & thank for your attention. My applications are web based, and no browser is involved. All communications are between web applications runs on servers. No browser at all. You mean, sockets are used only when browser (web pages, jsp, html, js) communicates with the server web application ? If it is so, web sockets cannot be used for my requirement. I dont have much knowledge of them. before I start, I am observing possibilities. Once again thanks

http://stackoverflow.com/a/23430235
has body: You could check if you can make String B with String A's characters than you could do it like this: System.out.println("First string"); String firstInput = geek.nextLine().toLowerCase(); System.out.println("Second string"); String secondInput = geek.nextLine().toLowerCase(); char[] secondInputCharacters = secondInput.toCharArray(); boolean contains = true; for(int i = 0; i &lt; secondInputCharacters.length; ++i) { if(firstInput.indexOf(secondInputCharacters[i]) &lt; 0) contains = false; } What this does is: read the 2 strings and transform them to lowercase take the characters of the second string iterate over those characters for each character, if it doesn't exist in the first string, than it should return false
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23430126

http://stackoverflow.com/comment/35708545
type: Comment
score: 2
type: QuestionComment
comment on: http://stackoverflow.com/q/23322239
has text: You should consider a polymorphic interface where each `LivingThing` has a getData method classes like `Cat` override. It's a much cleaner approach. Using `instanceof` is code smell.

http://stackoverflow.com/comment/35810694
type: AnswerComment
comment on: http://stackoverflow.com/a/23330150
score: 0
type: Comment
has text: Fixed unprecise statement about heap allocation.

http://stackoverflow.com/q/23397130
answer count: 0
type: UnansweredQuestion
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/35847718
has comment: http://stackoverflow.com/comment/35847357
has comment: http://stackoverflow.com/comment/35888836
type: Question
has comment: http://stackoverflow.com/comment/35847276
tagged with: jboss
has body: I'm trying to start a Spring application with new JBOSS EAP 6.1 (it works fine with old Jboss AS 4.2). When I deploy my application I get a lot of INFO like the following: 13:03:31,948 INFO [org.hibernate.service.jdbc.connections.internal.ConnectionProviderInitiator] (ServerService Thread Pool -- 63) HHH000130: Instantiating explicit connection provider: org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl 13:03:31,948 INFO [org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl] (ServerService Thread Pool -- 63) HHH000402: Using Hibernate built-in connection pool (not for production use!) 13:03:31,949 INFO [org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl] (ServerService Thread Pool -- 63) HHH000115: Hibernate connection pool size: 20 13:03:31,949 INFO [org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl] (ServerService Thread Pool -- 63) HHH000006: Autocommit mode: false 13:03:31,949 INFO [org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl] (ServerService Thread Pool -- 63) HHH000401: using driver [oracle.jdbc.OracleDriver] at URL [jdbc:oracle:thin:@myserver:1521:db] 13:03:31,950 INFO [org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl] (ServerService Thread Pool -- 63) HHH000046: Connection properties: {user=my_user, password=****, release_mode=on_close} 13:03:32,818 INFO [org.hibernate.dialect.Dialect] (ServerService Thread Pool -- 63) HHH000400: Using dialect: org.hibernate.dialect.Oracle10gDialect 13:03:32,942 INFO [org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory] (ServerService Thread Pool -- 63) HHH000397: Using ASTQueryTranslatorFactory I know they aren't ERROR, or WARN, but it keeps looping forever. How can I disable this validation or whatever hibernate is trying to do during the app deploy? Following my session bean definition: <bean id="sessionFactory" cl…
has comment: http://stackoverflow.com/comment/35847399
score: 0
has comment: http://stackoverflow.com/comment/35851848
has title: Disabling hibernate validation - Hibernate 4.2, Spring 3.2, JBOSS EAP 6.1
tagged with: jdbc
tagged with: spring
has comment: http://stackoverflow.com/comment/35847192
has comment: http://stackoverflow.com/comment/35852821
has comment: http://stackoverflow.com/comment/35853379

http://stackoverflow.com/q/23376086
tagged with: android
tagged with: menu
has body: My application uses fragments, action bar, and a navigation drawer. When I switch between fragments my menu items become broken and no longer function. I have tried a variety of things that may fix the problem but to no avail. In my Fragment onCreate I have setHasOptionsMenu(true);. This is my onCreateOptionsMenu: @Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { Log.d("Log", "Inflating Menu"); menu.clear(); inflater.inflate(R.menu.blank, menu); super.onCreateOptionsMenu(menu, inflater); } This is my simple onOptionsItemSelected: @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.mySearch: Log.d("Log", "Implementing Search Method"); search(); return true; case R.id.action_settings: //do something return true; } return super.onOptionsItemSelected(item); } In each Fragment's menu I use menu.Clear(); to prevent a pile up of Menu Items while switching between Fragments. The menu runs the selected function just fine when the Fragment is selected for the first time, but after switching to another Fragment and back again Menu Item clicks do nothing.
downvote count: 0
score: 1
tagged with: java
type: Question
tagged with: android-fragments
has answer: http://stackoverflow.com/a/23376378
upvote count: 1
linked to: http://stackoverflow.com/q/23177213
answer count: 1
favorite count: 0
has title: Android - Switching between fragments; Menu Item problems
type: UnansweredQuestion

http://stackoverflow.com/comment/35804425
has text: use a TimerTask. Be aware that to touch the ui you need to post on the ui thread queue
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23374060

http://stackoverflow.com/comment/36820723
comment on: http://stackoverflow.com/a/23905806
score: 0
type: Comment
has text: That doesn't seem to help unfortunately.
type: AnswerComment

http://stackoverflow.com/comment/35741013
type: Comment
comment on: http://stackoverflow.com/a/23339951
score: 0
type: AnswerComment
has text: @PeterPenzov This is just a convenience given by API. If you want to do it yourself, you can list all files within `etc` folder and add only those which ends with `release`, in a `for loop`. I don't think you can further optimize this.

http://stackoverflow.com/a/23320733
type: Answer
score: 0
accepted answer of: http://stackoverflow.com/q/23320627
answers question: http://stackoverflow.com/q/23320627
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35706024
has body: I solved it using a duplicate LinkedHashSet. LinkedHashSet&lt;String&gt; tweets_set = new LinkedHashSet&lt;String&gt;(tweets); System.out.println("Before: "+tweets); //replace stopword for (String word : tweets_set) { if (stopwords.contains(word)) { tweets.remove(word); } }

http://stackoverflow.com/q/23309326
has comment: http://stackoverflow.com/comment/35686716
has comment: http://stackoverflow.com/comment/35685230
accepted answer: http://stackoverflow.com/a/23309975
has answer: http://stackoverflow.com/a/23321031
has body: I run this code: public static void main(String[] args) throws Exception { boolean a = false; boolean b = true; xor(a,a); xor(a,b); xor(b,a); xor(b,b); } public static void xor(boolean a , boolean b){ System.out.println(a + "\t" + b + "\t" + (a != b)); } and got this output : false false false false true true true false true true true false UPDATE as you know nand truth-table is : false false true false true true true false true true true false how to return nand only using = or != operators without conditional || and &amp;&amp;?
upvote count: 2
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/35685215
downvote count: 10
type: Question
has answer: http://stackoverflow.com/a/23309336
has answer: http://stackoverflow.com/a/65093751
has answer: http://stackoverflow.com/a/23309975
score: -8
possible better answer: http://stackoverflow.com/a/23309336
has title: Implement nand only by = and !=
tagged with: boolean
has comment: http://stackoverflow.com/comment/35685493
answer count: 4
favorite count: 0
has comment: http://stackoverflow.com/comment/35687319

http://stackoverflow.com/q/23374233
score: 11
has body: This question might sound a little bit stupid, but there's a lack of documentation. In order to hash strings in Android, we can use MessageDigest, which is from java.security package. However, the basic setup is like the following: MessageDigest.getInstance( "SHA-512" ); Which is not cool, therefore: Can we know which algorithms are available on the current device? What does it depend on? Android SDK? Java SDK? This is painful in Android, because of the segmentation we've to handle... Why the hell don't we have a Constant / Enum for that string??? Aren't them common for the whole world? I hope you can answer both of my questions. Thanks.
has comment: http://stackoverflow.com/comment/35804951
type: AnsweredQuestion
tagged with: java
upvote count: 11
has title: Which hashing algorithms are available in Android?
possible better answer: http://stackoverflow.com/a/39276977
type: Question
downvote count: 0
has comment: http://stackoverflow.com/comment/35805284
has answer: http://stackoverflow.com/a/23374345
favorite count: 0
has comment: http://stackoverflow.com/comment/35804870
tagged with: security
has answer: http://stackoverflow.com/a/23455539
accepted answer: http://stackoverflow.com/a/23455539
tagged with: android
answer count: 4
has answer: http://stackoverflow.com/a/39276977
has answer: http://stackoverflow.com/a/69951121
tagged with: hash

http://stackoverflow.com/comment/35895133
score: 1
has text: So you say when you type "java soap" or even better "java web services" into Google, you get a blank page? I would use a different browser then.
comment on: http://stackoverflow.com/q/23422756
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35750820
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/23344530
type: Comment
has text: the method belongs to SceneImpl.java

http://stackoverflow.com/q/23329813
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23329879
tagged with: java
downvote count: 2
has answer: http://stackoverflow.com/a/23329860
has title: Issue with array Searching element
type: Question
possible better answer: http://stackoverflow.com/a/23329858
has answer: http://stackoverflow.com/a/23329858
score: -2
tagged with: arrays
has comment: http://stackoverflow.com/comment/35723319
has answer: http://stackoverflow.com/a/23329907
accepted answer: http://stackoverflow.com/a/23329860
upvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/35723284
has comment: http://stackoverflow.com/comment/35723104
answer count: 4
has body: I have been trying to search an array with the inputted value from the user. For example, if the user wants to search for the number 10 in the array, it will find the location of the element 10 and print it out. I do not know what I am doing wrong. Please help me. Thank you. Here is what I have: import java.util.Arrays; import java.lang.Object.*; import java.util.Scanner; public class DeleteElements { public static void main(String[] args) { Scanner input = new Scanner(System.in); int del = 0; boolean check; int intArray[] = {10,20,30,40,50}; System.out.print("The array consists of: "); for (int i = 0; i &lt; intArray.length; i++) { System.out.print(intArray[i] + ", "); } System.out.print("\nWhich number should be removed for the list? "); del = input.nextInt(); System.out.println("Number to delete: " + del); if(intArray.length == del){ check = true; System.out.println("Good"); }else{ check = false; System.out.println("Bad"); } while (check == true){ for(int i = 0; i &lt; intArray.length; i++){ if (intArray[i] == del){ System.out.println("Number found at index: " + i); } } System.out.println("Number not found!"); } } }

http://stackoverflow.com/q/23391101
tagged with: serialization
type: UnansweredQuestion
has title: Unable de-serialize object from DB4O
tagged with: enums
tagged with: java
has body: does anybody experience this kind of exception during reading object from DB4O? Or can you please explain what can goes wrong? It seems to me it has problem with de-serialization of Enum object but don't understand why since I tried on sample project to serialize/de-serialize same object and it works fine. Thanks in advance. Exception in thread "main" com.db4o.ext.Db4oException: JDKField java.lang.String:name at com.db4o.reflect.jdk.JdkField.handleException(JdkField.java:82) at com.db4o.reflect.jdk.JdkField.set(JdkField.java:64) at com.db4o.internal.reflect.StrictFieldAccessor.set(StrictFieldAccessor.java:17) at com.db4o.internal.FieldMetadata.set(FieldMetadata.java:830) at com.db4o.internal.FieldMetadata.activate(FieldMetadata.java:641) at com.db4o.internal.handlers.StandardReferenceTypeHandler$2.processAspect(StandardReferenceTypeHandler.java:92) at com.db4o.internal.metadata.MarshallingInfoTraverseAspectCommand.processAspect(MarshallingInfoTraverseAspectCommand.java:52) at com.db4o.internal.metadata.StandardAspectTraversalStrategy.traverseAllAspects(StandardAspectTraversalStrategy.java:24) at com.db4o.internal.ClassMetadata.traverseAllAspects(ClassMetadata.java:2118) at com.db4o.internal.handlers.StandardReferenceTypeHandler.traverseAllAspects(StandardReferenceTypeHandler.java:256) at com.db4o.internal.handlers.StandardReferenceTypeHandler.activateAspects(StandardReferenceTypeHandler.java:95) at com.db4o.internal.handlers.StandardReferenceTypeHandler.activate(StandardReferenceTypeHandler.java:118) at com.db4o.internal.Handlers4.activate(Handlers4.java:300) at com.db4o.internal.ClassMetadata.instantiateFields(ClassMetadata.java:1355) at com.db4o.internal.ClassMetadata.activate(ClassMetadata.java:1289) at com.db4o.internal.ClassMetadata.instantiate(ClassMetadata.java:1247) at com.db4o.internal.marshall.UnmarshallingContext.read(UnmarshallingContext.java:70) at com.db4o.internal.ObjectReference.read(ObjectReference.java:306) at com.db4o.internal.ObjectReference.read…
has answer: http://stackoverflow.com/a/23567041
type: Question
has answer: http://stackoverflow.com/a/72902265
has answer: http://stackoverflow.com/a/26330233
score: 0
answer count: 3
tagged with: deserialization
tagged with: db4o

http://stackoverflow.com/a/23391964
type: Answer
has body: Make DateUse a public class, and make it before the Date class. Save the file as DateUse.java and compile it with javac DateUse.java The DateUse class contains the main method, not Date.
downvote count: 0
answers question: http://stackoverflow.com/q/23391852
score: 1
has comment: http://stackoverflow.com/comment/35836930
has comment: http://stackoverflow.com/comment/35837944
upvote count: 1

http://stackoverflow.com/comment/35938214
type: AnswerComment
comment on: http://stackoverflow.com/a/23446176
score: 0
type: Comment
has text: @Java-questions, Don't use a static variable for the JLabel.

http://stackoverflow.com/q/23383399
has title: Spring / Eclipse project suddenly logs everything
accepted answer: http://stackoverflow.com/a/23385855
upvote count: 1
tagged with: spring
tagged with: logging
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: eclipse
type: Question
downvote count: 0
has answer: http://stackoverflow.com/a/23385855
tagged with: tomcat
answer count: 1
has body: I am using this setup: Spring Tool Suite Version: 3.5.0.RELEASE Build Id: 201404011654 ​JAVA 1.7.51 I am developing a Spring project and everything is working fine. I have standard configurations for logging. But if I run my project on my tomcat in the IDE it logs everything. Including all JARs which I am using. Doesn't matter if it is Hibernate / Spring / Apache CFX or Standard TLS Debug outputs. Everthing is written in the console :( for example: 496130 [pool-1-thread-1] DEBUG org.apache.cxf.phase.PhaseInterceptorChain - Invoking handleMessage 496139 [pool-1-thread-1] DEBUG org.hibernate.engine.transaction.internal.jdbc.JdbcTransaction - disabling autocommit Here is my logback: <?xml version="1.0" encoding="UTF-8"?> <!-- configuration file for LogBack (slf4J implementation)> <configuration scan="true" scanPeriod="30 seconds"> true <jmxConfigurator/> %-5level %logger{0} - %msg%n <!--<logger name="org.hibernate" level="debug"/> --> <!-- Uncomment and add your logger here: <logger name="org.springframework.samples.service.service" level="debug"/> --> <appender-ref ref="console"/> Maybe someone can help me! Thanks a lot!
favorite count: 0

http://stackoverflow.com/comment/35674991
comment on: http://stackoverflow.com/a/23303456
score: 0
type: Comment
has text: The second approach is recursive and will cause a Stackoverflow exception if the value of option is 1 or 2.
type: AnswerComment

http://stackoverflow.com/comment/35883553
type: Comment
comment on: http://stackoverflow.com/a/23412883
score: 0
type: AnswerComment
has text: Sorry but `score1` is not displayed anymore now that you have minimized code size. Which was expected since you shall ask one question for each issue, so you may need to ask a new question on StackOverflow with another minimized code (I can't answer you with this code)

http://stackoverflow.com/comment/35930515
has text: thanks , but how can i show each image in first frame (i mean if i have 6 part of image like my image in the top i show all images in the first image )
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/23441300

http://stackoverflow.com/comment/35687253
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23309998
has text: @طاهر OK I have updated it in my post. It was not clear from your question that you can't change the method signature or you are doing refactoring but now its clear to all.
score: 0

http://stackoverflow.com/q/23319025
type: Question
has comment: http://stackoverflow.com/comment/35703261
tagged with: graphics
tagged with: java
has comment: http://stackoverflow.com/comment/35703478
score: 0
has title: Java Graphics Updating Too Fast
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/23319267
tagged with: animation
has body: I have searched the problem, but everyone seems to have problems with graphics updating too slow. To present my situation: I have a JFrame which I set to full screen, by using a compatible display mode. Within the JFrame I have a couple of JPanels and JButtons... On one of JPanels I am drawing moving objects that need to be updated. I am updating the graphics like this : validate and repaint the JFrame, then revalidate and repaint the corresponding JPanel. The graphics are updating too fast. (I need to mention that on the JPanel I am overriding the paintComponent method). I have tried to use BufferStrategy on the JFrame, however this will prevent me from showing the JPanels and JButtons (have no idea why). I also take this oppurtunity to ask some of you guys if you can give a clear distinction between paint, validate, repaint, revalidate, invalidate, etc... all the tutorials barely scratch the surface.
has comment: http://stackoverflow.com/comment/35703342
accepted answer: http://stackoverflow.com/a/23319267
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35703530
upvote count: 1
has comment: http://stackoverflow.com/comment/35703247
tagged with: swing
linked to: http://stackoverflow.com/q/22283462
downvote count: 1

http://stackoverflow.com/comment/35692524
score: 0
has text: I don't understand the question. You want to provide a class and let Spring manage its lifecycle for you (which is the common behavior) or you want to define how the class should be generated and let Spring manage this logic when autowiring it?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23313262

http://stackoverflow.com/a/60699622
downvote count: 0
type: Answer
upvote count: 1
has body: I needed to return ResponseEntity&lt;Void&gt; (with custom response status) instead of setting custom response status on HttpServletResponse (from endpoint method param). ex: http://shengwangi.blogspot.com/2016/02/response-for-get-post-put-delete-in-rest.html
score: 1
answers question: http://stackoverflow.com/q/23349871

http://stackoverflow.com/comment/35784273
comment on: http://stackoverflow.com/a/23360967
type: AnswerComment
score: 0
type: Comment
has text: Do you generate OneElem and TwoElem from xsd or do you use it from any kind of dependency?

http://stackoverflow.com/comment/35726148
type: Comment
type: QuestionComment
has text: You need some kind of trigger that updates the position from where it is to where you want it to be and the repaint the component, ensuring that you are using the current coordinates to paint the sprite
score: 0
comment on: http://stackoverflow.com/q/23331476

http://stackoverflow.com/q/23386118
answer count: 1
downvote count: 0
has title: UsbInterface claim fails
favorite count: 0
tagged with: usb4java
has answer: http://stackoverflow.com/a/23407235
tagged with: interface
type: AnsweredQuestion
tagged with: java
tagged with: winusb
has body: I got a Problem: I'm using usb4java on my windows 8 laptop. I got an Infrared Remote Controller plugged in, in my usb port. Now I want to access this Controller.I got the following example code(There are no Exceptions programmed and NullPointers are not handled, because I just want see if my code works): public class IRController_Test { /** * @param args the command line arguments * @throws javax.usb.UsbException */ public static void main(String[] args) throws UsbException { UsbServices usbServ = UsbHostManager.getUsbServices(); UsbHub hub = usbServ.getRootUsbHub(); List&lt;UsbDevice&gt; list = hub.getAttachedUsbDevices(); UsbDevice device = null; for(UsbDevice dev : list){ if(dev.getUsbDeviceDescriptor().idVendor() == (short)0x0755 &amp;&amp; dev.getUsbDeviceDescriptor().idProduct() == (short)0x2026){ device = dev; System.out.println("Found the port!!"); }else{ System.out.println("Not the port!"); } } UsbConfiguration config = device.getActiveUsbConfiguration(); List&lt;UsbInterface&gt; listInf = config.getUsbInterfaces(); UsbInterface inter = listInf.get(0); inter.claim(); } So, it finds the port but when i call "inter.claim()", I get this Exception: Exception in thread "main" javax.usb.UsbPlatformException: USB error 12: Can't open device Bus 002 Device 003: ID 0755:2026: Operation not supported or unimplemented on this platform at org.usb4java.javax.ExceptionUtils.createPlatformException(ExceptionUtils.java:39) at org.usb4java.javax.AbstractDevice.open(AbstractDevice.java:226) at org.usb4java.javax.AbstractDevice.claimInterface(AbstractDevice.java:406) at org.usb4java.javax.Interface.claim(Interface.java:102) at org.usb4java.javax.Interface.claim(Interface.java:93) at IRController_Test.main(IRController_Test.java:48) Java Result: 1 BUILD SUCCESSFUL (total time: 0 seconds) I installed via Zadig a WinUSB (v6.1.7600.16385) driver,but there is still this error.Is there someone who can help me? Thanks for every help :)
type: Question
tagged with: usb
score: 4
upvote count: 4
accepted answer: http://stackoverflow.com/a/23407235
has comment: http://stackoverflow.com/comment/35841250

http://stackoverflow.com/comment/35666930
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23299051
has text: Why isn't it fast enough?

http://stackoverflow.com/a/23330009
type: Answer
upvote count: 3
has body: You can use a Set which, by definition, does not contain duplicates: String centers[]; ... List&lt;String&gt; centerList = Arrays.asList(centers); Set&lt;String&gt; uniqueCenters = new HashSet&lt;String&gt;(); uniqueCenters.addAll(centerList); uniqueCenters.remove(null); Integer numberOfUniqueStrings = uniqueCenters.size();
score: 3
has comment: http://stackoverflow.com/comment/35724499
accepted answer of: http://stackoverflow.com/q/23329910
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23329910

http://stackoverflow.com/a/23431261
type: Answer
answers question: http://stackoverflow.com/q/23431183
upvote count: 5
has body: Notice that you've implemented the Runnable interface? When you say new Thread(this) you're saying "Create a new Thread which will run my class when started" Take a peek at the documentation for Thread, and you'll see a constructor which takes a Runnable.
accepted answer of: http://stackoverflow.com/q/23431183
score: 5
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/35759031
comment on: http://stackoverflow.com/q/23345295
type: QuestionComment
type: Comment
has text: Have you read the source code? The class starts with 5 screenfuls of implementation "Overview". From my reading, it still uses the segmented locking approach. Memory footprint is (quoting the same Overview) "about the same or better than java.util.HashMap".
score: 2

http://stackoverflow.com/q/23363241
tagged with: backslash
downvote count: 0
tagged with: string
score: 15
favorite count: 0
has title: escaping backslash in java string literal
has comment: http://stackoverflow.com/comment/35783829
linked to: http://stackoverflow.com/q/14183248
type: UnansweredQuestion
has body: I am using Java for a while and come up with this problem: I use hard-coded paths in windows like "D:\Java-code\JavaProjects\workspace\eypros\src" The problem is that I need to escape the backslash character in order to use it with string. So I manually escape each backslash: "D:\\Java-code\\JavaProjects\\workspace\\eypros\\src" Is there a way to automatically take the unescaped path and return an escaped java string. I am thinking that maybe another container besides java string could do the trick (but I don't know any). Any suggestions?
has comment: http://stackoverflow.com/comment/35783576
has comment: http://stackoverflow.com/comment/35783548
duplicate of: http://stackoverflow.com/q/14183248
tagged with: escaping
has comment: http://stackoverflow.com/comment/35783896
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/23363356
upvote count: 15
linked to: http://stackoverflow.com/q/1701839
answer count: 1

http://stackoverflow.com/comment/35665870
type: AnswerComment
score: 0
type: Comment
has text: You should add that your second solution works only in Java>=1.7
comment on: http://stackoverflow.com/a/23298476

http://stackoverflow.com/comment/44834171
comment on: http://stackoverflow.com/a/23366580
score: 0
type: AnswerComment
has text: Thank you for your reply, I may end up implementing this as it would be quite nice for user experience also.
type: Comment

http://stackoverflow.com/comment/36570945
type: QuestionComment
has text: Simple answer: Let the JVM (Hotspot optimizer) detect that the calculation is redundant and can be eliminated. This has the advantage of not wasting resources in the case it is not redundant. By the way, starting with Java 8 every `Map` supports `putIfAbsent` which addresses this use-case.
score: 0
comment on: http://stackoverflow.com/q/23431760
type: Comment

http://stackoverflow.com/comment/43820272
has text: @Gopalan: I am assuming this is the correct answer. Please click the tick mark to the left if so. Since you did not reply to Pankaj, I will downvote your question, but will happily undownvote once you reply to me (either to accept the question or to explain that this is not the answer).
comment on: http://stackoverflow.com/a/23424479
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/a/23358063
type: Answer
upvote count: 1
has body: While the /** comment starter is for javadoc, technically they are actually the same from the compilers point of view. A comment is a comment is a comment. The important part here is that /** is /* with an extra asterisk added.
answers question: http://stackoverflow.com/q/23357887
downvote count: 0
score: 1

http://stackoverflow.com/comment/35864161
has text: Works now, just a typo I made.
comment on: http://stackoverflow.com/a/23406074
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/23300709
downvote count: 0
has comment: http://stackoverflow.com/comment/35675714
has comment: http://stackoverflow.com/comment/35670592
has comment: http://stackoverflow.com/comment/35670646
score: 3
answers question: http://stackoverflow.com/q/23300276
has comment: http://stackoverflow.com/comment/35670042
upvote count: 3
has comment: http://stackoverflow.com/comment/35670409
has comment: http://stackoverflow.com/comment/35670199
type: Answer
has comment: http://stackoverflow.com/comment/35669869
has body: Without any outside intervention which you aren't showing us, this isn't possible. This invocation m_test = C_ObjectUtil.defaultIfNull( test, "" ); pushes the value that test holds and the value of the reference to the String literal "" on the stack. The method is invoked, consuming those two references. Then this is invoked public static &lt;T&gt; T defaultIfNull( T object, T defaultObject ) { return ( object == null ) ? defaultObject : object; } the value from test, ie. null, is bound to object and the value of the reference to the String is bound to defaultObject. The conditional operator is executed and defaultObject is returned, ie. the non-null String. That is assigned to m_test in the calling code. Nothing can intercept these steps in your code. Not another thread, not any proxying mechanism (it's a static method invoked directly), not anything I can think of. Your error is elsewhere. (I'll delete or edit this answer if you post new details that will help identify the true issue.)

http://stackoverflow.com/comment/35886558
comment on: http://stackoverflow.com/q/23417858
has text: The point is that you're _missing the forest for the trees_, focusing on something insignificant when the major performance hit is the fact you're printing a line.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23308228
has answer: http://stackoverflow.com/a/23308229
has body: What is the output of the following code: int x = 2; x += x++ * x++ * x++; System.out.println(x); I understand that ++variableName is pre-increment operator and the value of variableName is incremented before it is used in the expression whereas variableName++ increments its value after the expression is executed. What I want to know is - how does this logic apply here?
has comment: http://stackoverflow.com/comment/35698042
type: Question
accepted answer: http://stackoverflow.com/a/23308229
has title: How are java increment statements evaluated in complex expressions
tagged with: post-increment
upvote count: 4
downvote count: 0
answer count: 1
favorite count: 0
tagged with: operator-precedence
score: 4
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/13369393
tagged with: java

http://stackoverflow.com/comment/35936455
has text: my bad..Actually I wanted to hide my app name but unfortunately I forgot to change the clipme to appname. If that is only the problem I am going to the right direction and about the intent service class, it is in the main package
type: Comment
comment on: http://stackoverflow.com/a/23444095
score: 0
type: AnswerComment

http://stackoverflow.com/a/23343680
has body: Permission problem. Probably you run this java file as a different user from a browser. An error report file with more information is saved as: # /tmp/hs_err_pid306.log What does this error say?
has comment: http://stackoverflow.com/comment/35752225
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23343155

http://stackoverflow.com/comment/35858763
score: 0
type: Comment
has text: @JBNizet or just a `PrintWriter` and avoid the wrapping hassle? :)
comment on: http://stackoverflow.com/a/23403622
type: AnswerComment

http://stackoverflow.com/comment/35788977
comment on: http://stackoverflow.com/a/23364370
type: Comment
has text: Thanks for your answer. Sadly in this case I can't use **application.conf**, because the connection must be created on the fly. The connection settings are not known until that exact moment. I removed **Class.forName**, and it actually makes no difference, because, as you said, it is not needed.
score: 0
type: AnswerComment

http://stackoverflow.com/q/23435427
has comment: http://stackoverflow.com/comment/35918720
has title: A thread that will keep running?
has comment: http://stackoverflow.com/comment/35918626
has comment: http://stackoverflow.com/comment/35918758
type: AnsweredQuestion
downvote count: 0
possible better answer: http://stackoverflow.com/a/23435719
score: 1
has comment: http://stackoverflow.com/comment/35918635
tagged with: java
has answer: http://stackoverflow.com/a/23435719
type: Question
answer count: 2
accepted answer: http://stackoverflow.com/a/23435699
has comment: http://stackoverflow.com/comment/35918542
has comment: http://stackoverflow.com/comment/35918712
has body: I am writing some Android code, Here is the structure: (Pseudo) public class AThread extends Thread { public void run() { int i = 0; while(true){ i++; System.out.println(i); } } } Then I new a instance of AThread class and call the start() method. My question is: The int i doesn't seem to keep adding in the while loop. Why is the reason and how can I make the thread keep running the task written in the while loop. Because I am running some real-time analysis function... Here is the actual one I wrote: int i = 0; running = true; while(running) { i++; System.out.println(i); if((lines = bufferedReader.readLine()) != null) { System.out.println("analyzing"); // read two lines per time. result = filter(lines, bufferedReader.readLine()); if(!result[0].equals("emp")) { System.out.println("x: " + result[0] + " " + "y: " + result[1]); System.out.println(MainActivity.analysisKeyPress.classify(Integer.valueOf(result[0]), Integer.valueOf(result[1]), "0")); System.out.println("insert into db.."); MainActivity.dbhelper.addKeyLog(getCurrentRunningService(), result[0], result[1]); } } } It seems that the int i won't increase till there are several lines for BufferedReader to read.
has comment: http://stackoverflow.com/comment/35918415
has comment: http://stackoverflow.com/comment/35918658
has answer: http://stackoverflow.com/a/23435699
upvote count: 1
tagged with: android
has comment: http://stackoverflow.com/comment/35918655
favorite count: 0
has comment: http://stackoverflow.com/comment/35918441
has comment: http://stackoverflow.com/comment/35918628

http://stackoverflow.com/comment/35745622
has text: @Gimby , GlassFish Server 4.0
comment on: http://stackoverflow.com/q/23342279
score: 0
type: QuestionComment
type: Comment

jdbc
tags question: http://stackoverflow.com/q/23301060
tags question: http://stackoverflow.com/q/23318100
tags question: http://stackoverflow.com/q/23358079
tags question: http://stackoverflow.com/q/23340768
tags question: http://stackoverflow.com/q/23441350
tags question: http://stackoverflow.com/q/23341087
tags question: http://stackoverflow.com/q/23293280
tags question: http://stackoverflow.com/q/23422799
tags question: http://stackoverflow.com/q/23353773
tags question: http://stackoverflow.com/q/23381825
tags question: http://stackoverflow.com/q/23445096
tags question: http://stackoverflow.com/q/23424170
tags question: http://stackoverflow.com/q/23316477
tags question: http://stackoverflow.com/q/23336240
tags question: http://stackoverflow.com/q/23324466
tags question: http://stackoverflow.com/q/23300276
tags question: http://stackoverflow.com/q/23404294
tags question: http://stackoverflow.com/q/23354062
tags question: http://stackoverflow.com/q/23432192
tags question: http://stackoverflow.com/q/23447910
tags question: http://stackoverflow.com/q/23437192
tags question: http://stackoverflow.com/q/23370243
tags question: http://stackoverflow.com/q/23309263
type: Tag
tags question: http://stackoverflow.com/q/23307964
tags question: http://stackoverflow.com/q/23341997
tags question: http://stackoverflow.com/q/23358993
tags question: http://stackoverflow.com/q/23339433
tags question: http://stackoverflow.com/q/23291743
tags question: http://stackoverflow.com/q/23295981
tags question: http://stackoverflow.com/q/23415006
tags question: http://stackoverflow.com/q/23433259
tags question: http://stackoverflow.com/q/23363505
tags question: http://stackoverflow.com/q/23347968
tags question: http://stackoverflow.com/q/23360122
tags question: http://stackoverflow.com/q/23371457
tags question: http://stackoverflow.com/q/23316517
tags question: http://stackoverflow.com/q/23356382
tags question: http://stackoverflow.com/q/23333019
tags question: http://stackoverflow.com/q/23300752
tags question: http://stackoverflow.com/q/23366686
tags question: http://stackoverflow.com/q/23375923
tags question: http://stackoverflow.com/q/23301442
tags question: http://stackoverflow.com/q/23414852
tags question: http://stackoverflow.com/q/23452518
tags question: http://stackoverflow.com/q/23407869
tags question: http://stackoverflow.com/q/23404339
tags question: http://stackoverflow.com/q/23448861
tags question: http://stackoverflow.com/q/23434616
tags question: http://stackoverflow.com/q/23369818
tags question: http://stackoverflow.com/q/23351278
tags question: http://stackoverflow.com/q/23347852
tags question: http://stackoverflow.com/q/23404114
tags question: http://stackoverflow.com/q/23306819
tags question: http://stackoverflow.com/q/23373020
tag name: jdbc
tags question: http://stackoverflow.com/q/23339223
tags question: http://stackoverflow.com/q/23431612
tags question: http://stackoverflow.com/q/23384210
tags question: http://stackoverflow.com/q/23434988
tags question: http://stackoverflow.com/q/23352590
tags question: http://stackoverflow.com/q/23397130
tags question: http://stackoverflow.com/q/23303687
tags question: http://stackoverflow.com/q/23303206

http://stackoverflow.com/a/23369784
has body: You can create your own class extending ArrayList with will block all remove methods like in example public class NoDeleteArray extends ArrayList{ @Override public boolean remove(Object o) { return super.remove(o); //To change body of generated methods, choose Tools | Templates. } @Override public boolean removeAll(Collection c) { return false; } @Override public Object remove(int index) { return null; } @Override protected void removeRange(int fromIndex, int toIndex) { } @Override public boolean retainAll(Collection c) { return false; } } here all remove methods are covering original methods and does nothing. you can also perform some verification to check if object can be deleted from collection for example @Override public Object remove(int index) { MyClass tmp = (MyClass) get(index); if (tmp.isDeletable()) { return super.remove(index); } else { return null; } }
answers question: http://stackoverflow.com/q/23369595
score: 0
type: Answer

http://stackoverflow.com/comment/35827248
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23385941
has text: Not doing your homework. Does that XML really need to be like this? Having a part containing parts? Or is is it more like a partlist?

http://stackoverflow.com/q/23386494
has body: I've got an Eclipse RCP application and a strange behaviour while using a wizard page. Following situation: I've got a wizard page which is part of a multi-page-wizard. At this page I override the createContent(...) method to create my widgets, etc. After creating my widgets 2 private methods addListeners() and init() are called which initializes my widgets out of the model and add some listeners (e.g. a ModifyListener). The obscure behaviour is the following: When I first call init() and after that call addListeners() everything works fine. But if I do it the vice versa I got a NullPointerException in the WizardDialog.updateButtons() method which is part of RCP framework: There is a variable called currentPage as the following code excerpt shows. This variable causes the NPE mentioned above. If I do it the right way, the variable is correctly set. ... if (backButton != null) { backButton.setEnabled(currentPage.getPreviousPage() != null); } ... I don't get this behaviour. Can someony explain it to me? Within the 2 private methods mentioned above no framework-calls are done. Maybe it's some timing issue? Best regards, AnarchoEnte
tagged with: eclipse-rcp
score: 0
has comment: http://stackoverflow.com/comment/35830560
tagged with: jface
has comment: http://stackoverflow.com/comment/35827150
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35827877
tagged with: swt
has title: Eclipse RCP - Strange behaviour using a Wizard
tagged with: java
has comment: http://stackoverflow.com/comment/35829750
has comment: http://stackoverflow.com/comment/35827000
type: Question
has comment: http://stackoverflow.com/comment/35829685

spring-security
tags question: http://stackoverflow.com/q/23421099
tags question: http://stackoverflow.com/q/23303413
tags question: http://stackoverflow.com/q/23383481
tags question: http://stackoverflow.com/q/23346097
tags question: http://stackoverflow.com/q/23350083
type: Tag
tags question: http://stackoverflow.com/q/23412463
tags question: http://stackoverflow.com/q/23423550
tags question: http://stackoverflow.com/q/23415680
tags question: http://stackoverflow.com/q/23314902
tags question: http://stackoverflow.com/q/23447901
tags question: http://stackoverflow.com/q/23433373
tags question: http://stackoverflow.com/q/23336770
tags question: http://stackoverflow.com/q/23417699
tags question: http://stackoverflow.com/q/23383633
tags question: http://stackoverflow.com/q/23348341
tags question: http://stackoverflow.com/q/23359950
tags question: http://stackoverflow.com/q/23342940
tags question: http://stackoverflow.com/q/23295616
tags question: http://stackoverflow.com/q/23316872
tags question: http://stackoverflow.com/q/23358367
tags question: http://stackoverflow.com/q/23340433
tag name: spring-security
tags question: http://stackoverflow.com/q/23336792
tags question: http://stackoverflow.com/q/23448255

http://stackoverflow.com/comment/35781402
comment on: http://stackoverflow.com/a/23361941
score: 0
has text: JLabel is an ImageObserver, which should allow it to respond to changes in the icons loading state. Might be a good idea to use a MediaTracker to test it, as a suggestion
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/35937411
score: 1
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23445711
has text: `newMap.keySet().removeAll(oldMap.keySet())` I guess this is significantly simpler, isn't it?

http://stackoverflow.com/q/23450400
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35946479
has comment: http://stackoverflow.com/comment/35946602
has answer: http://stackoverflow.com/a/23450737
type: Question
has comment: http://stackoverflow.com/comment/35946597
score: 0
accepted answer: http://stackoverflow.com/a/23450737
has comment: http://stackoverflow.com/comment/35946560
answer count: 1
has comment: http://stackoverflow.com/comment/35946516
has comment: http://stackoverflow.com/comment/35946646
has comment: http://stackoverflow.com/comment/35946587
has comment: http://stackoverflow.com/comment/35946502
tagged with: java
has comment: http://stackoverflow.com/comment/35947084
has title: BufferedReader.readline() blocks output
has body: I created a console chatapplication, that waits for user input with bufferedreader.readline() and should print chat messages from the partner simultaneously. But after readline() was invoked, no output is possible. Waiting for messages and Sending Messages is realized in different threads. public class MsgReader implements Runnable { private Socket connection; private final Console con; public MsgReader(Socket sock, Console con) { this.connection = sock; this.con = con; this.run(); } @Override public void run() { InputStream is = null; try { is = connection.getInputStream(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } BufferedReader in = new BufferedReader(new InputStreamReader(is)); try { System.out.println("asdf"); while (true) { String ss = in.readLine(); // System.out.println((char)in.read()); // System.out.println("asdf"); // con.write(ss); // con.write(ss); Thread.sleep(500); } } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } public class MsgWriter implements Runnable { private Socket connection; private final Console con; public MsgWriter(Socket sock, Console con) { this.connection = sock; this.con = con; this.run(); } @Override public void run() { OutputStream os = null; try { os = connection.getOutputStream(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } OutputStreamWriter osw = new OutputStreamWriter(os); BufferedWriter bw = new BufferedWriter(osw); try { char in = ' '; boolean running = true; while (true) { String ss=In.inString2(""); if(ss.equals("")){ System.out.println("enter your message: "); //String s = con.readLine(); String s=In.inString2(""); bw.write(s+"\n"); bw.flush(); System.out.println("sent"); } if(ss.equals("x")){ break; } Thread.sleep(500); } } catch (IOException e) { // TODO Auto-generated catch block System.out.println("fail "); e.…

http://stackoverflow.com/q/23420313
has comment: http://stackoverflow.com/comment/35890610
tagged with: java
accepted answer: http://stackoverflow.com/a/23424127
has title: JAVA Assigning integer from readFile into 2 dimensional array
answer count: 1
downvote count: 0
score: 1
favorite count: 0
tagged with: arraylist
has body: I'm trying to store integers into 2 dimensional array. I have Buffered Reader which read my CityFile (Contain city coordinate) and return int x and y while !line.isEmpty (No problem with this) I want to store this 2 integers (x and y) into multidimensional arraylist as a city coordinate (Need help here) **Actually I am trying to create a city matrix, which contains all x and y integers that is available in my cityFile (Euclidean2d). My FileReader class public static ArrayList cities = new ArrayList(); . . } else if (readingCoordinates) { items = line.split("(\\s)+"); assert( cities.size() + 1 == Integer.parseInt(items[0])); x = Integer.parseInt(items[1]); y = Integer.parseInt(items[2]); City city = new City(x, y); addCity(city); . . . } } public static void addCity(City city) { cities.add(city); } My Point class public class City { int x; int y; public City (int x, int y){ this.x = x; this.y = y; } public int getX(){ return this.x; } public int getY(){ return this.y; } @Override public String toString(){ return getX()+", "+getY(); } } Then i store the point in Arraylist of cities in my FileReader class. So in my Arraylist of cities like below cities[city(x,y), city(x,y), city (x,y), ....] My Question here, Can I manipulate this cities array to Create new Matrix [2 dimensional array] in city[i][j] my current code is not working, public double[][] cityMatrix() { double[][] cityMatrix = new double[FileReader.cities.size()][2]; for (int i = 0; i &lt; FileReader.cities.size(); i++) cityMatrix[i][0] = getX(); for (int i = 0; i &lt; FileReader.cities.size(); i++) cityMatrix[i][1] = getY(); return cityMatrix; } I hope my question is clear. If not, kindly let me know so that i could make it clear again. Please help. Thank you.
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23424127
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/35890778

http://stackoverflow.com/a/23326975
score: 4
downvote count: 0
has body: I think there's typically hardware support on most modern processors for doing floating-point powers, but not integers. Because of that, for a general power, it's actually faster to do Math.power with a double and then convert it back to an int. However, in this case there's a faster way to do it for ints. Since you're doing a power of 2, you can just use the bitwise left-shift operator instead: int levelMeal = 5*(1&lt;&lt;(level-1)); As Rhymoid pointed out in his comment, that expression can be further simplified to remove the 1: int levelMeal = 5&lt;&lt;(level-1);
type: Answer
has comment: http://stackoverflow.com/comment/35717701
answers question: http://stackoverflow.com/q/23326902
upvote count: 4

http://stackoverflow.com/a/23359042
has comment: http://stackoverflow.com/comment/35809461
has comment: http://stackoverflow.com/comment/55228110
has comment: http://stackoverflow.com/comment/35818940
score: 0
answers question: http://stackoverflow.com/q/23358112
type: Answer
has comment: http://stackoverflow.com/comment/35778562
has comment: http://stackoverflow.com/comment/35820509
has body: For a view you are scaling, you can set the "invariant" point that should not move using setPivotX() and setPivotY(). When I use a ScaleGestureDetector, I use the focus point for this. For example: @Override public boolean onScaleBegin(ScaleGestureDetector detector) { ... mScaledView.setPivotX(detector.getFocusX()); mScaledView.setPivotY(detector.getFocusY()); ... I'm not sure if you want to do this with all of the children, or just the parent view, in your case, but usually you just need to do this to a single "parent" view and it will work properly for the children of that view. Related to this, I didn't quite understand why you're passing the scaling factor down to each child when scaling the parent view will scale all of its children too. Maybe you just need to add a single FrameLayout (or some other ViewGroup descendent) into your HorizontalScrollView that hosts the children and then just scale that (after setting its pivot appropriately)? Updated re comment Given that you only want to scale the views in the pinched region between the fingers, I believe you have a couple options, depending on your app: 1) Dynamically add just those views to an intermediate FrameLayout which gets scaled and has its pivot set, leaving the non-scaled views as direct children of the HorizontalScrollView; or 2) Passing down the focus point to each scaled child view after first adjusting for the child's position. For example, assuming your DrawView either directly or indirectly inherits from android.view.View, which I would strongly recommend, then you can do something like: for (int i = start; i &lt;= last; i++) { LinearLayout ll = (LinearLayout)pp.getChildAt(i); DrawView view = (DrawView)ll.findViewById(R.id.drawview); view.setScaleX(mScaleFactor); view.setScaleY(mScaleFactor); view.setPivotX(detector.getFocusX() - view.getLeft()); // Note: minus, not plus... view.setPivotY(detector.getFocusY() - view.getTop()); view.invalidate(); }
has comment: http://stackoverflow.com/comment/35820352
has comment: http://stackoverflow.com/comment/35818293

filereader
tags question: http://stackoverflow.com/q/23376385
tags question: http://stackoverflow.com/q/23433789
tag name: filereader
tags question: http://stackoverflow.com/q/23304663
tags question: http://stackoverflow.com/q/23298648
type: Tag
tags question: http://stackoverflow.com/q/23343202
tags question: http://stackoverflow.com/q/23362770

http://stackoverflow.com/comment/35907481
type: QuestionComment
has text: Could you check the jboss logs for any errors/exceptions? I can't think of anything else.
comment on: http://stackoverflow.com/q/23425523
score: 0
type: Comment

http://stackoverflow.com/q/23372456
has body: I am making an application in Java Swing and I have to use buttons there. I have a button and I have set background image of JButton using ImageIcon. I have made this image using Photoshop When I click on the button then its default color is shown. I am also setting background color to white but this is not solving my problem. How to remove default color of button?
type: Question
has answer: http://stackoverflow.com/a/23372685
upvote count: 1
answer count: 1
favorite count: 0
linked to: http://stackoverflow.com/q/10861852
tagged with: colors
downvote count: 3
has comment: http://stackoverflow.com/comment/35801483
type: UnansweredQuestion
tagged with: swing
tagged with: jbutton
has title: Removing default look of JButton in Swing
score: -2
tagged with: java

http://stackoverflow.com/a/23298174
has comment: http://stackoverflow.com/comment/35665285
type: Answer
has body: It looks like your problem is that the sendMessage function should be included in your MainActivity instead of nested in your fragment. The debug line: java.lang.IllegalStateException: Could not find a method sendMessage(View) in the activity class com.example.myfirstapp.MainActivity for onClick handler on view class android.widget.Button shows that the application is looking in your MainActivity class for this method.
score: 0
answers question: http://stackoverflow.com/q/23298045

http://stackoverflow.com/comment/35883842
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23416531
has text: this idea makes absolutely no logical sense and shows a fundamental misunderstand / lack of comprehension of the reason the enum construct exists

http://stackoverflow.com/comment/35937370
comment on: http://stackoverflow.com/a/23445679
has text: @Abhinav : any comments?
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/23303821
downvote count: 2
tagged with: maven
has comment: http://stackoverflow.com/comment/35685075
tagged with: java
has comment: http://stackoverflow.com/comment/35675724
type: Question
has comment: http://stackoverflow.com/comment/35676016
favorite count: 0
has answer: http://stackoverflow.com/a/23310464
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/35675768
has title: Can maven change package declarations when compiling a project?
has comment: http://stackoverflow.com/comment/35675818
has body: Well, I have googled this topic many times and I haven't found an answer yet: Can maven change the package declarations right before compiling a project? My objective is have project A, which is an API, all in one package, and each project B and C will use the same dependency on eclipse. My objective is that once maven is about to compile the project, the package declarations get changed to that project's specific package and then it compiles the project. This is useful because I have many projects using the same API and I keep making changes to the API itself to suit my needs, but it's a pain to have to go trough every project and change it all again. If you have any idea how to do this, and, more importantly, if it is possible, let me know please. Thanks in advance!
upvote count: 2
type: UnansweredQuestion

http://stackoverflow.com/comment/35693293
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23313365
has text: @OliCharlesworth I'm refactoring an old code and faced this. Your question gave me idea, that such an odd code can be result of poor architecture of classes. Perhaps base can be split in two different classes. If I fail with this idea, I will write another one question with architecture description of my problem. Thanks for the link!
score: 0

http://stackoverflow.com/comment/35762836
has text: @wutzebaer I have edited once. I tested the second one. Its working.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23351047
type: AnswerComment

http://stackoverflow.com/a/23406298
score: 1
upvote count: 1
has body: It deletes only your content, because you don't delete the directories. Add at the end of your directoryroutine the command to delete your directory too. if (fileToDel.isDirectory()) { if (fileToDel.list().length &gt; 0) { for (String s : fileToDel.list()) { deleteCat(catName + "/" + s); } } fileToDel.delete(); //delete directory } else ... Also have a look at the apache commons-io lib (http://commons.apache.org/proper/commons-io/apidocs/org/apache/commons/io/FileUtils.html#deleteDirectory(java.io.File))
answers question: http://stackoverflow.com/q/23406207
downvote count: 0
type: Answer

http://stackoverflow.com/comment/35691151
comment on: http://stackoverflow.com/q/23312455
has text: Sorry, i don't know what you mean. What you mean with render loop? The video starts by itself, and to pause it you have to click a button, same for resuming.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23307260
has title: $ bin/hadoop namenode -format STARTUP_MSG: host = java.net.UnknownHostException:
linked to: http://stackoverflow.com/q/6307244
type: Question
has comment: http://stackoverflow.com/comment/35684593
tagged with: configuration
tagged with: java
linked to: http://stackoverflow.com/q/6484275
tagged with: hadoop
answer count: 3
has answer: http://stackoverflow.com/a/34746829
downvote count: 0
has answer: http://stackoverflow.com/a/23309278
has comment: http://stackoverflow.com/comment/35684522
favorite count: 0
has comment: http://stackoverflow.com/comment/35684228
has answer: http://stackoverflow.com/a/23308906
has body: I'm currently learning Hadoop by http://tecadmin.net/steps-to-install-hadoop-on-centosrhel-6/ in the 5th step when I apply this command $ bin/hadoop namenode -format I get following error I also have checked these links for resolving my problem "hadoop namenode -format" returns a java.net.UnknownHostException java.net.UnknownHostException: Invalid hostname for server: local I don't know where is domain name in the configuration files for replacing it by localhost. also I went to /etc/hosts file and replaced text by localhost.. still I haven't resolve the problem please someone help me.
score: 2
upvote count: 2
type: UnansweredQuestion

http://stackoverflow.com/a/23424338
has comment: http://stackoverflow.com/comment/35898001
has comment: http://stackoverflow.com/comment/35897973
has body: Given that you use an Object array (Boolean rather than boolean), just fill the first n with Boolean.TRUE and the rest with Boolean.FALSE do Collections.shuffle(Arrays.asList(yourArray)) And you're all set. See: Collections.shuffle(list), Arrays.asList(array)
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/23424247
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/35898029

http://stackoverflow.com/comment/35705148
has text: From where are your calling `renderLevelBackground()` method? Please provide minimal code to analyze it.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23319653
score: 0

http://stackoverflow.com/a/23419159
accepted answer of: http://stackoverflow.com/q/23417279
answers question: http://stackoverflow.com/q/23417279
type: Answer
upvote count: 3
score: 3
type: AcceptedAnswer
downvote count: 0
has body: The problem is likely that getWidth() in closePol is called outside the scope of the paintComponent method, so the current width is is not yet taken into account (or may still be zero), which could happen due a a few reasons. As a general rule, when painting, you will want to call getWidth()/getHeight() in the paint[Component]() method. For example when expanding the frame, if getWidth() is not called with the method, the new width will not be taken into account, and there will be no dynamic resizing of the graphic (if that's what you want. You will also want to consider overriding getPreferredSize() when doing custom painting, as to give the panel some sizing hints.

http://stackoverflow.com/comment/35862102
type: QuestionComment
has text: @prakash, that doesn't work. eclipse forces me to change the screenUpdate method, and when i do that, it doesn't work either.
comment on: http://stackoverflow.com/q/23405371
score: 0
type: Comment

http://stackoverflow.com/comment/35885916
has text: Yes, the file names are manipulated as a string.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23417663

http://stackoverflow.com/a/23452552
type: Answer
upvote count: 2
has body: There are literally dozens of ways this might be achieved. You could use: Swing Timer The Timing Framework Trident java-universal-tween-engine The last three are animation engines. Personally, I use the Timing Framework, but that's more to do with what I'm familiar with and my needs at the time. You'll probably need to do a lot of custom painting to get this to work, take a look at: Custom Painting 2D Graphics For more details
answers question: http://stackoverflow.com/q/23452499
score: 2
downvote count: 0

http://stackoverflow.com/comment/35719397
type: Comment
score: 0
type: AnswerComment
has text: Thanks for the help! but what if I want to do it in Jframe way? Because I don't want to create an applet so I didn't extends Japplet or create init(). But the ide complains "you need to extends applet" Is anywhere in my code telling it I'm creating an applet? I dont want to :(
comment on: http://stackoverflow.com/a/23327802

http://stackoverflow.com/a/23435345
has comment: http://stackoverflow.com/comment/35918401
upvote count: 1
answers question: http://stackoverflow.com/q/23435289
type: Answer
downvote count: 0
score: 1
has body: You have to either keep the TCP connection alive, to be able to send an update later or you can use something like UDP (which also comes with its own problems, like packet loss or double receiving) but doesn't require a "connection" like TCP does. This is your problem here: Client client = (Client)obj; sc.close(); You're closing the connection on the client as soon as they connect.
has comment: http://stackoverflow.com/comment/35918467

http://stackoverflow.com/a/23313597
upvote count: 1
accepted answer of: http://stackoverflow.com/q/23313520
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: Profile your code to see where the time is really spent and whether any change really helps. Wrap several hundred inserts in a database transaction to avoid waiting for disk I/O on each insert. Use prepared SQL statements to avoid recompiling the same SQL over and over again. Do not convert your StringBuilder to string for each iteration - you need the value only after the loop. Possibly several other micro optimizations such as avoiding allocs and caching values whenever possible.
answers question: http://stackoverflow.com/q/23313520
has comment: http://stackoverflow.com/comment/35693013
score: 1

http://stackoverflow.com/comment/35833962
score: 0
type: QuestionComment
type: Comment
has text: @user3589431 you need to use the URI not the namespace literal
comment on: http://stackoverflow.com/q/23390299

http://stackoverflow.com/comment/35933815
comment on: http://stackoverflow.com/a/23443384
type: AnswerComment
score: 0
type: Comment
has text: oh the jdk/bin path was not in the PATH variable, so javac -version didn't work. But I added it to the environment variable and then javac -version gives this: javac 1.8.0_05 However, building with ant still doesn't work.

http://stackoverflow.com/a/23325933
type: Answer
score: 2
upvote count: 2
has body: The trouble with trying to get a subclass from a superclass is you don't know what subclass it is. You could do an instanceof check first before casting and that would avoid the ClassCastException, but that is nasty. Ideally you should have your methods return objects that are as high up the hierarchy as possible but if you need a method that belongs to a subclass then that should be the return type of the method. EDIT: Your more information is a little vague, but this is legal: public class MyClass { public MyClass getNewMyClass(){ return new MyClass(); } } public class MySubClass extends MyClass{ @Override public MySubClass getNewMyClass() { return new MySubClass(); } }
has comment: http://stackoverflow.com/comment/35715684
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23325830
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23325830

http://stackoverflow.com/comment/35725190
type: Comment
score: 0
has text: yes, i set all 3 streams. With sending do you mean BufferedWriter.newLine()? or maybe BufferedWriter.write(char c)? Sorry if the questions sounds stupid, i will try both
type: AnswerComment
comment on: http://stackoverflow.com/a/23330952

http://stackoverflow.com/a/23380007
downvote count: 0
type: Answer
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/23379900
accepted answer of: http://stackoverflow.com/q/23379900
has body: you are getting json as response need to stringify it. &lt;script&gt; function getData() { $.post("MyServlet", { query : "Wolf of wall street", choice : "M" }, function(response) { alert("hello" + JSON.stringify(response)); }); } &lt;/script&gt;
type: AcceptedAnswer

http://stackoverflow.com/comment/35742451
score: 0
type: Comment
type: QuestionComment
has text: little bit better, but after 30-40 play speedX will be 0 or really near to zero.
comment on: http://stackoverflow.com/q/23337735

http://stackoverflow.com/comment/35698445
has text: I mount system by this, it is okay? "mount -o rw,remount /system"
score: 1
comment on: http://stackoverflow.com/a/23316396
type: AnswerComment
type: Comment

rest
tags question: http://stackoverflow.com/q/23443585
tags question: http://stackoverflow.com/q/23361629
tags question: http://stackoverflow.com/q/23391016
tags question: http://stackoverflow.com/q/23343897
tags question: http://stackoverflow.com/q/23307933
tags question: http://stackoverflow.com/q/23365525
tags question: http://stackoverflow.com/q/23346115
tags question: http://stackoverflow.com/q/23363631
tags question: http://stackoverflow.com/q/23431084
tags question: http://stackoverflow.com/q/23342550
tags question: http://stackoverflow.com/q/23350887
tags question: http://stackoverflow.com/q/23428642
tags question: http://stackoverflow.com/q/23414203
tags question: http://stackoverflow.com/q/23393438
tags question: http://stackoverflow.com/q/23451402
tags question: http://stackoverflow.com/q/23377272
tags question: http://stackoverflow.com/q/23397540
tags question: http://stackoverflow.com/q/23358248
tags question: http://stackoverflow.com/q/23349119
tags question: http://stackoverflow.com/q/23343341
tags question: http://stackoverflow.com/q/23418208
tags question: http://stackoverflow.com/q/23356678
tags question: http://stackoverflow.com/q/23301733
tags question: http://stackoverflow.com/q/23379913
tags question: http://stackoverflow.com/q/23452337
tags question: http://stackoverflow.com/q/23447916
type: Tag
tags question: http://stackoverflow.com/q/23344225
tags question: http://stackoverflow.com/q/23305120
tags question: http://stackoverflow.com/q/23380285
tags question: http://stackoverflow.com/q/23340321
tags question: http://stackoverflow.com/q/23298308
tags question: http://stackoverflow.com/q/23389815
tags question: http://stackoverflow.com/q/23421967
tags question: http://stackoverflow.com/q/23294502
tag name: rest
tags question: http://stackoverflow.com/q/23337052
tags question: http://stackoverflow.com/q/23373345
tags question: http://stackoverflow.com/q/23297147
tags question: http://stackoverflow.com/q/23442919
tags question: http://stackoverflow.com/q/23297685
tags question: http://stackoverflow.com/q/23316589
tags question: http://stackoverflow.com/q/23440059
tags question: http://stackoverflow.com/q/23340951
tags question: http://stackoverflow.com/q/23318189

http://stackoverflow.com/comment/35687319
score: 0
comment on: http://stackoverflow.com/q/23309326
type: Comment
type: QuestionComment
has text: It makes me want to give up using Stack Overflow when people do things like this.

http://stackoverflow.com/q/23373022
accepted answer: http://stackoverflow.com/a/23389405
score: -1
tagged with: logic
has comment: http://stackoverflow.com/comment/35803439
has comment: http://stackoverflow.com/comment/35803466
answer count: 1
favorite count: 0
has title: Slick2d/LWJGL - Making a simple pong game issues
has answer: http://stackoverflow.com/a/23389405
tagged with: pong
type: AnsweredQuestion
has body: This is my class: public class Play extends BasicGameState{ public int state; private Input in; private int rh = 100, rw = 10;//racket - Width , Height private boolean left;//trye if the ball is going left Ball b;//the ball Guy p1,p2;//the players public Play(int state) { this.state = state; } @Override public void init(GameContainer gc, StateBasedGame sbg) throws SlickException { Resources.init(); b = new Ball(); b.w = 20; b.h = 20; b.x = 800 / 2 - (b.w / 2); b.y = 600 / 2 - (b.h / 2); p1 = new Guy(); p2 = new Guy(); p1.x = 10; p2.x = 780;//idk why 790 did not work p1.y = 600 / 2 - (rh / 2); p2.y = p1.y; left = true; b.ny = 0; } @Override public void render(GameContainer gc, StateBasedGame sbg, Graphics g) throws SlickException {//just render g.fillRect(p1.x, p1.y, rw, rh); g.fillRect(p2.x, p2.y, rw, rh); g.fillRect(b.x, b.y, b.w, b.h); //g.drawImage(Resources.racket, p1.x, p1.y); //g.drawImage(Resources.racket, p2.x, p2.y); //g.drawImage(b.i , b.x , b.y); debug(); } @Override public void update(GameContainer gc, StateBasedGame sbg, int delta) throws SlickException { in = gc.getInput();//update input if(Keyboard.isKeyDown(Keyboard.KEY_W)) {//update racket coordinates if keys are down p1.y += delta * .1f; } if(Keyboard.isKeyDown(Keyboard.KEY_S)) { p1.y += delta * .1f; } if(Keyboard.isKeyDown(Keyboard.KEY_UP)) { p2.y -= delta * .1f; } if(Keyboard.isKeyDown(Keyboard.KEY_DOWN)) { p2.y += delta * .1f; } if(left) {//collision detection (including setting angle to the ball if it doesnt hit the exact center of the racket) if(b.x &lt;= p1.x + rw &amp;&amp; b.y &lt;= p1.y + rh &amp;&amp; b.y &gt;= p1.y) { if(b.y + b.h == p1.x + (rh / 2)) { b.ny = 0; } else if(b.y + b.h &lt; p1.x + (rh / 2)) { int d = p1.y + (rh / 2) - b.y; b.ny = - d / 500; } else if(b.y + b.h &gt; p1.x + (rh / 2)) { int d = p1.y + rh - b.y; b.ny = d / 500; } left = false; } } else { if(b.x &gt;= p2.x + rw &amp;&amp; b.y &lt;= p2.y + rh &amp;&amp; b.y &gt;= p2.y) { if(b.y + b.h == p2.x + (rh / 2)) { b.ny = 0…
tagged with: java
tagged with: slick2d
tagged with: lwjgl
downvote count: 1
type: Question
upvote count: 0
has comment: http://stackoverflow.com/comment/35831325

http://stackoverflow.com/comment/35707218
has text: You can make your life easier by using a `Map<String, Integer> amounts` to hold all the amounts. Then use e.g. `amounts.get("Diamond")` to get the respective amount from the map. This way you can also use builtin sorting functions etc.
comment on: http://stackoverflow.com/q/23321428
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23345481
answers question: http://stackoverflow.com/q/23345160
has body: The reason your likely getting this exception is because scan.hasNextLine() can return true even if there are no tokens on that line. If you call scan.next() when there are no tokens after the marker, you will get the java.util.NoSuchElementException you are seeing. So, swap out scan.hasNextLine() for scan.hasNext(). Alternatively you could swap out scan.next() for scan.nextLine() and then check whether the first word in that line was the one you are looking for. This could potentially be faster for files with large numbers of lines. I hope this helps. Link to the Scanner API for reference.
upvote count: 4
downvote count: 0
score: 4
type: Answer

3d
tags question: http://stackoverflow.com/q/23446714
type: Tag
tags question: http://stackoverflow.com/q/23396700
tags question: http://stackoverflow.com/q/23426099
tag name: 3d
tags question: http://stackoverflow.com/q/23448052
tags question: http://stackoverflow.com/q/23375980
tags question: http://stackoverflow.com/q/23298861
tags question: http://stackoverflow.com/q/23402716

http://stackoverflow.com/comment/35887516
comment on: http://stackoverflow.com/q/23417786
score: 0
type: Comment
type: QuestionComment
has text: Unless you can provide actual [runnable example that demonstrates your problem](https://stackoverflow.com/help/mcve) will be guessing at best

http://stackoverflow.com/q/23382167
answer count: 1
has answer: http://stackoverflow.com/a/23382359
tagged with: ajax
score: 0
accepted answer: http://stackoverflow.com/a/23382359
has title: Ajax send JSON array to servlet
type: Question
type: AnsweredQuestion
tagged with: java
has body: I made a table that sums rows and columns of a table. But now I want to calculate the sum in Servlet.I'm sending the array of columns and rows with JSON to Servlet. Everything works ok. But the problem now is, How can I calculate the sum of rows and columns in servlet and send back? This is my code: $(document).on('change',function(){ var columnValues={}, rowValues={}; $("#sum_table tr").each(function(rowIndex){ $("td input", $(this)).each(function(colIndex){ var value=$(this).val(); // indexes need +1 to get the row number, because // the indexes are 0-based. if (undefined===columnValues[colIndex+1]){ columnValues[colIndex+1]=[]; } if (undefined===rowValues[rowIndex+1]){ rowValues[rowIndex+1]=[]; } rowValues[rowIndex+1].push(value); columnValues[colIndex+1].push(value); }); }); // send data to server $.ajax({ url: 'ServletPost', type: 'post', data: {rows:rowValues, columns:columnValues}, dataType: 'json', success: function(data){ // insert your server-calculated data to dom var rows = data.rows, columns = data.columns; // insert your server-calculated data to dom $("td.total").each(function(rowIndex){ $(this).text(rows[rowIndex+1]); }); $("tr.totalCol td").each(function(columnIndex){ $(this).text(columns[columnIndex+1]); }); } }); }); Thank You in Advance!
tagged with: http://stackoverflow.com/tag/json
tagged with: servlets

http://stackoverflow.com/comment/91304896
score: 1
type: AnswerComment
has text: @andreikashin The textbox in view `android.R.layout.simple_spinner_dropdown_item` has a textview whose id is `android.R.id.text1`. This is android standard spinner dropdown with standard textbox. For more information on how and what the android spinner is take a look here https://android.googlesource.com/platform/frameworks/base/+/c80f952/core/res/res/layout/simple_spinner_dropdown_item.xml
comment on: http://stackoverflow.com/a/23371043
type: Comment

http://stackoverflow.com/comment/35860854
type: AnswerComment
score: 0
type: Comment
has text: You use `new XMLDecoder(new BufferedReader(new FileReader(filename)))`
comment on: http://stackoverflow.com/a/23404649

http://stackoverflow.com/comment/35656947
has text: Instead of posting yourself what have you done, simply mark the question that helped you most as accepted. You can achieve this by clicking on the 'tick' under the points of the answer that helped you most. There's neither the need of changing your title to `[SOLVED]`.
type: Comment
comment on: http://stackoverflow.com/a/23293458
score: 0
type: AnswerComment

http://stackoverflow.com/a/23310914
score: 0
answers question: http://stackoverflow.com/q/23310871
has body: About the first "problem" with the order: A hash map does not guarantee a specific order. More presicely the order doesn't even have to be constant over the time. You would have to use something else instead.
type: Answer
has comment: http://stackoverflow.com/comment/35688240
has comment: http://stackoverflow.com/comment/35688298

http://stackoverflow.com/comment/35945958
type: Comment
type: AnswerComment
has text: Of course I am not sure at the moment, but I think so. That's why I wrote let's see how it works.
score: 0
comment on: http://stackoverflow.com/a/23448463

http://stackoverflow.com/comment/57070412
type: QuestionComment
has text: Possible duplicate of [Unclear SecurityException when using Android Service Backup (Cloud Backup)](http://stackoverflow.com/questions/12456310/unclear-securityexception-when-using-android-service-backup-cloud-backup)
comment on: http://stackoverflow.com/q/23442181
type: Comment
score: 1

http://stackoverflow.com/a/23451925
type: Answer
accepted answer of: http://stackoverflow.com/q/23451886
has body: The @Before annotation is required before the setup method for JUnit 4 @Before public void setUp() { ... }
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/23451886
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/23371007
has comment: http://stackoverflow.com/comment/35798662
has comment: http://stackoverflow.com/comment/53632279
has body: The problem is that getPhysicalNumberOfCells has a different meaning of what I was thinking. getPhysicalNumberOfCells returns the number of cell in a row that have a content. In fact POI stores for each row only the data added into exel, for example if you have data in columns 0,3,5, getPhysicalNumberOfCells will return always 3, beacause 3 is the number of "filled" cells. To achive the purpose of get the logical numeber of cell in a row we use: getLastCellNum() According whit documentation, this method gets the index of the last cell. This value is increased BY ONE, so in the example above, whit maximum index of 5 will be 6.. I think this has been done to simplify iteration over rowcell. Moreover, there is a method getLastCellNum that show first cell index. An example inspired from official documentation: short minColIdx = row.getFirstCellNum(); short maxColIdx = row.getLastCellNum(); for(short colIdx=minColIdx ; colIx&lt;maxColIdx ; colIdx++) { Cell cell = row.getCell(colIx); //get value of cell }
upvote count: 7
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23371006
answers question: http://stackoverflow.com/q/23371006
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/35815960
score: 7
has comment: http://stackoverflow.com/comment/35816064
has comment: http://stackoverflow.com/comment/35799813

http://stackoverflow.com/comment/35843187
type: QuestionComment
has text: @ChuckB http://pastebin.com/6A6ufW8T Here is a simple piece of code that shows how it can be used. (Usually the EventListener would be in a different class).
comment on: http://stackoverflow.com/q/23394518
score: 0
type: Comment

http://stackoverflow.com/q/23327115
tagged with: aop
has answer: http://stackoverflow.com/a/23327450
answer count: 2
has title: Aspect Oriented Programming in Java WITHOUT AspectJ?
has comment: http://stackoverflow.com/comment/35718403
has comment: http://stackoverflow.com/comment/35718264
has comment: http://stackoverflow.com/comment/35719534
favorite count: 0
score: 13
has body: ok this question's never been asked before on the web so here goes: I'm learning Java (beginner-intermediate level) and I decided to go ahead of class programme by trying out Aspect-Oriented programming. Now this thing's supposed to be easy to learn (at least that's the web consensus) so much so that the "aspects" are said to be slightly modified versions of the standard classes, so my question is: if aspects are basically classes, WHY do we have to install AspectJ to do AOP in Java? as that just adds an extra layer of complexity making the concept even harder to grasp. What I want is to be able to write an aspect without using AspectJ (or any other add-on), in other words I wanna do AOP using only BASIC Java &amp; its standard java classes. is it possible and if so, how must I write these classes?
type: UnansweredQuestion
upvote count: 14
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/23327629
tagged with: java

http://stackoverflow.com/comment/35701268
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23317567
has text: Is it worth it to refactor Menu to something like MenuScreen?
score: 0

http://stackoverflow.com/q/23388629
answer count: 1
has comment: http://stackoverflow.com/comment/35835782
has comment: http://stackoverflow.com/comment/35835222
tagged with: c++
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23410343
has body: I have been through so many forum posts on similar issues, but I feel like I've seen it all. In short I have Native code through the wonders of JNI, accessed by Java. The code worked fine before I started using JAVA packages. I have followed all forum posts about ensuring the Javah cmd runs in the correct folder, and have successfully built my DLL. I have ensured that the package in which the wrapper is contained is present in the names of the C++ functions. Due to the size of the project I will simply show an example of this code. NOTE all the code (DLL's, JVM C++ Compiler) operates in 32-bit, and the target is a PC running windows 8.1. All my Java Code is contained in the package: package com.optin.executableContainer.client; So in my Java wrapper class, I load the DLL(32-bit) expressly as follows static { System.load("C:\\JNITests\\JNIBridge.dll"); } I know this loads the DLL as without the DLL in that folder I get the "Cannot load library" Run-time error. The header code used, generated by the javah -jni command is JNIEXPORT void JNICALL Java_com_optin_executableContainer_client_COMControl_setControlBackColor (JNIEnv *, jobject, jlong); The asscociated C++ code contained within a .cpp file is: JNIEXPORT void JNICALL Java_com_optin_executableContainer_client_COMControl_setControlBackColor (JNIEnv *env, jobject obj, jlong color) { printf("\nHello World\n"); } There are no errors when I compile this with Visual Studio 2010. I have verified that this function exists within the targeted DLL, by using DLL export viewer which sees the function name as: void __stdcall Java_com_optin_executableContainer_client_COMControl_setControlBackColor(struct JNIEnv_ *,class _jobject *,__int64) However when I run this code, in the Eclipse IDE, I get the dreaded Exception in thread "main" java.lang.UnsatisfiedLinkError: com.optin.executableContainer.client.COMControl.setControlBackColor(J)V at com.optin.executableContainer.client.COMControl.setControlBackColor(Native Method) If I hav…
tagged with: java
has title: Yet another JNI related java.lang.UnsatisfiedLinkError
has comment: http://stackoverflow.com/comment/35837848
type: Question
has answer: http://stackoverflow.com/a/23410343
has comment: http://stackoverflow.com/comment/35842425
has comment: http://stackoverflow.com/comment/35843640
tagged with: java-native-interface
score: 0

http://stackoverflow.com/a/23300162
has body: It appears that this is an ArrayList (or another type of list). ArrayLists do not function as normal arrays, and can not be accessed as such. Try this: navDrawerItems.add(0, incidentItem); Helpful ArrayList Documentation: http://docs.oracle.com/javase/7/docs/api/java/util/ArrayList.html
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23299862

http://stackoverflow.com/q/23346145
has title: OutOfMemoryError: Java heap space gradle compiling android
downvote count: 1
has answer: http://stackoverflow.com/a/23523554
favorite count: 0
has comment: http://stackoverflow.com/comment/35752538
has answer: http://stackoverflow.com/a/23359993
tagged with: android
accepted answer: http://stackoverflow.com/a/23359993
has body: i was compiling an android app with gradle in my VPS and i got this error: Running gradle assembleRelease on builds/2014428_12146137 Note: in order to honour the org.gradle.jvmargs and/or org.gradle.java.home values specified for this build, it is necessary to fork a new JVM. To avoid the slowdown associated with this extra process, you might want to consider running Gradle with the daemon enabled. Please see the user guide chapter on the daemon at http://gradle.org/docs/1.4/userguide/gradle_daemon.html. BUILD FAILED Total time: 3.798 secs { [Error: Command failed: java.lang.OutOfMemoryError: Java heap space at java.util.ArrayList.&lt;init&gt;(ArrayList.java:144) at org.codehaus.groovy.reflection.GeneratedMetaMethod$DgmMethodRecord.loadDgmInfo(GeneratedMetaMethod.java:193) at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.registerMethods(MetaClassRegistryImpl.java:155) at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.&lt;init&gt;(MetaClassRegistryImpl.java:83) at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.&lt;init&gt;(MetaClassRegistryImpl.java:61) at groovy.lang.GroovySystem.&lt;clinit&gt;(GroovySystem.java:29) at org.gradle.api.internal.AbstractClassGenerator.generate(AbstractClassGenerator.java:100) at org.gradle.api.internal.ClassGeneratorBackedInstantiator.newInstance(ClassGeneratorBackedInstantiator.java:36) at org.gradle.initialization.DefaultGradleLauncherFactory.doNewInstance(DefaultGradleLauncherFactory.java:126) at org.gradle.initialization.DefaultGradleLauncherFactory.newInstance(DefaultGradleLauncherFactory.java:99) at org.gradle.initialization.DefaultGradleLauncherFactory.newInstance(DefaultGradleLauncherFactory.java:46) at org.gradle.launcher.exec.InProcessGradleLauncherActionExecuter.execute(InProcessGradleLauncherActionExecuter.java:38) at org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:45) at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.jav…
upvote count: 4
possible better answer: http://stackoverflow.com/a/23523554
type: AnsweredQuestion
score: 3
tagged with: java
tagged with: gradle
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/35752489

http://stackoverflow.com/comment/102158579
type: AnswerComment
has text: You should test your solution before posting it, there is a copy/past error and a typo in Calendar
comment on: http://stackoverflow.com/a/29600880
type: Comment
score: 0

http://stackoverflow.com/comment/35684371
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23298979
has text: @MartinJames I just thought that it would be a good idea to pass some gaps between all threads. I don't know whether I've implemented this thing correctly or not.

http://stackoverflow.com/a/23295309
has body: private Map&lt;Integer,Map&lt;Integer,Integer&gt;&gt; transition = new HashMap&lt;Integer, Map&lt;Integer, Integer&gt;&gt;(); for(Map.Entry&lt;Integer,Map&lt;Integer,Integer&gt;&gt; entryMap : transition.values()) { final Integer outerKey = entryMap.getKey(); for (Map.Entry&lt;Integer, Integer&gt; entry : entryMap.getValue().entrySet()) { final Integer innerKey = entry.getKey(); final Integer innerValue = entry.getValue(); } }
answers question: http://stackoverflow.com/q/23295046
type: Answer
score: 0

http://stackoverflow.com/q/23302698
favorite count: 0
answer count: 9
has answer: http://stackoverflow.com/a/68050699
has answer: http://stackoverflow.com/a/45836501
possible better answer: http://stackoverflow.com/a/32088787
tagged with: shapes
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/39060715
tagged with: math
tagged with: java
has title: Java check if two rectangles overlap at any point
score: 23
has answer: http://stackoverflow.com/a/32125492
downvote count: 1
upvote count: 24
type: Question
tagged with: selection
has comment: http://stackoverflow.com/comment/35673528
has comment: http://stackoverflow.com/comment/103056085
has answer: http://stackoverflow.com/a/29324250
has answer: http://stackoverflow.com/a/44120001
tagged with: contain
has answer: http://stackoverflow.com/a/23302818
has answer: http://stackoverflow.com/a/28546611
accepted answer: http://stackoverflow.com/a/29324250
has body: I have multiple rectangles and one special rectangle: the selection rect. I want to check for each rectangle if the rectangle contains at least one point which is inside the selection rectangle. Here is an image for clarity:
has answer: http://stackoverflow.com/a/32088787

http://stackoverflow.com/comment/35732350
type: QuestionComment
comment on: http://stackoverflow.com/q/23334968
has text: its the same problem with all local-running java apps (with are not web applications). I relied to much on system.out which is not available most of the times
score: 0
type: Comment

http://stackoverflow.com/comment/35868729
has text: I've seen this thread. I assumed his problem was just as he stated, where his files are being removed shortly after a successful upload. Though the common issue of a chmod after upload is still evident. I really hope there is some sort of work around someone knows about.
score: 0
comment on: http://stackoverflow.com/q/23391593
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36627872
score: 0
type: Comment
has text: @Misha Can you post a link to your GitHub? I like following people and looking at their project ;)
comment on: http://stackoverflow.com/a/23400893
type: AnswerComment

http://stackoverflow.com/a/23354170
score: 3
upvote count: 3
has body: You are violating Swing Threading rules by trying to change Swing state in a background thread.. Use a Swing Timer as this will likely solve your problem. new Timer(750, new ActionListener() { public void actionPerformed(ActionEvent e) { contentPane.setBackground((Color.getHSBColor((c/360), 1, 1)); contentPane.repaint(); c= (c &gt;= 360) ? 1 : c + 5; } }).start(); Edit or better: import java.awt.Color; import java.awt.Dimension; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.*; @SuppressWarnings("serial") public class BackgroundColorChange extends JPanel { private static final int PREF_W = 400; private static final int PREF_H = PREF_W; private static final int TIMER_DELAY = 75; public BackgroundColorChange() { new Timer(TIMER_DELAY, new ActionListener() { private int c = 1; @Override public void actionPerformed(ActionEvent arg0) { setBackground(Color.getHSBColor((float) c / 360, 1f, 1f)); repaint(); c = (c &gt;= 360) ? 1 : c + 5; } }).start(); } @Override public Dimension getPreferredSize() { return new Dimension(PREF_W, PREF_H); } private static void createAndShowGui() { BackgroundColorChange mainPanel = new BackgroundColorChange(); JFrame frame = new JFrame("BackgroundColorChange"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.getContentPane().add(mainPanel); frame.pack(); frame.setLocationByPlatform(true); frame.setVisible(true); } public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { public void run() { createAndShowGui(); } }); } }
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23354143
answers question: http://stackoverflow.com/q/23354143
type: Answer

http://stackoverflow.com/comment/35888369
type: Comment
comment on: http://stackoverflow.com/q/23418879
type: QuestionComment
has text: You can enhance your question, but putting a little context around why you need to know this information. Are you trying to debug slow performance, or memory usage?
score: 0

http://stackoverflow.com/comment/35936299
type: Comment
comment on: http://stackoverflow.com/a/23429838
type: AnswerComment
has text: Sorry I had a bit of trouble writing this comment ^^
score: 0

http://stackoverflow.com/comment/35947614
has text: You could do `throw new Error()` after the `exit`. That will make the compiler happy and is actually sort of meaningful.
comment on: http://stackoverflow.com/q/23446477
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35730907
score: 2
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23332251
has text: possible duplicate of [Apostrophe in Email Address throwing Exception](http://stackoverflow.com/questions/23298246/apostrophe-in-email-address-throwing-exception)

http://stackoverflow.com/q/23313262
favorite count: 0
linked to: http://stackoverflow.com/q/17819752
linked to: http://stackoverflow.com/q/16534728
tagged with: spring
answer count: 4
has body: I'm in the process of moving some Xml-Based spring config over to Java-based. Previously, I've consciously mixed Xml &lt;bean class='foo' /&gt; declarations with @Component mappings on a case-by-case basis, as a means of documenting non-obvious beans. A typical use case would be if I'm declaring beans that will modify the behaviour of spring itself, I'll declare these explicitly, rather than let them be discovered, purely to improve the clarity of the config file. However, often these beans will need a degree of @Autowiring. If I new the bean up myself within a Java config, I become responsible for performing this wiring -- which is pointless. Is there a pure Java configuration option that explicitly provides a class back to Spring, and let's it manage the instantiation? ie: Given the class: public class MyFunkySpringBean implements InitializingBean { @Autowired Foo foo; } In XML config, this would be declared as simply as: &lt;bean class="MyFunkySpringBean" /&gt; Is there an equivalent in Java syntax, where I can explicitly declare the bean class to Spring, but not be responsible for providing the actual instance -- leaving that to Spring. Eg: @Configuration public class MyAppConfig { // Explictly provide the class, not the instance to Spring @Bean public MyFunkySpringBean funkyBean; // No instance -- it's up to Spring to build } To be clear, I don't want to have to do this: @Configuration public class MyAppConfig { @Bean public MyFunkySpringBean funkyBean() { MyFunkySpringBean bean = new MyFunkySpringBean(); bean.foo = new Foo(); // other dependencies go here return bean; } } Does facility like this exist within Spring?
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/51478649
has answer: http://stackoverflow.com/a/23317130
type: Question
has comment: http://stackoverflow.com/comment/35822589
has comment: http://stackoverflow.com/comment/35822305
has answer: http://stackoverflow.com/a/23316214
upvote count: 5
tagged with: java
has title: Spring Java config : Specify class only
has answer: http://stackoverflow.com/a/23313435
score: 5
has comment: http://stackoverflow.com/comment/35692573
has answer: http://stackoverflow.com/a/51478649
has comment: http://stackoverflow.com/comment/35692524
downvote count: 0
possible better answer: http://stackoverflow.com/a/23313435

http://stackoverflow.com/comment/35674704
comment on: http://stackoverflow.com/q/23302642
type: Comment
type: QuestionComment
has text: I'm not familiar with the MIPS instruction set, but looking [here](http://www.mrc.uidaho.edu/mrc/people/jff/digital/MIPSir.html) it appears that the offset is an immediate value, and can't be a register. That gives you two options: if you can use `r` as your offset, that makes the most sense. Otherwise add the index value to the address of `r` using another register, and use `lw` with this value as source and a 0 offset.
score: 1

http://stackoverflow.com/comment/35861286
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23405055
score: 0
has text: You should try to upgrade your JDK and Eclipse.

http://stackoverflow.com/a/23333893
has comment: http://stackoverflow.com/comment/63335665
accepted answer of: http://stackoverflow.com/q/23329127
type: Answer
answers question: http://stackoverflow.com/q/23329127
has comment: http://stackoverflow.com/comment/67826551
downvote count: 0
score: 11
has comment: http://stackoverflow.com/comment/63313578
has comment: http://stackoverflow.com/comment/36730236
has body: Using MULTISET for nested collections with jOOQ 3.15 Starting from jOOQ 3.15, you can use the standard SQL MULTISET operator to nest collections, and to abstract over the below SQL/XML or SQL/JSON serialisation format. Your query would look like this: List<Location> locations ctx.select( LOCATION.NAME, LOCATION.PLAYER, multiset( select(LOCATION2PLAYER.PLAYER_ID) .from(LOCATION2PLAYER) .where(LOCATION2PLAYER.LOCATION_ID.eq(LOCATION.LOCATION_ID)) ).as("invitedPlayers") ) .from(LOCATION) .fetchInto(Location.class); If your DTOs were immutable (e.g. Java 16 records), you can even avoid using reflection for mapping, and map type safely into your DTO constructors using constructor references and the new jOOQ 3.15 ad-hoc conversion feature. List<Location> locations ctx.select( LOCATION.NAME, LOCATION.PLAYER, multiset( select(LOCATION2PLAYER.PLAYER_ID) .from(LOCATION2PLAYER) .where(LOCATION2PLAYER.LOCATION_ID.eq(LOCATION.LOCATION_ID)) ).as("invitedPlayers").convertFrom(r -> r.map(Record1::value1)) ) .from(LOCATION) .fetch(Records.mapping(Location::new)); See also this blog post for more details about MULTISET Using SQL/XML or SQL/JSON for nested collections with jOOQ 3.14 Starting from jOOQ 3.14, it's possible to nest collections using SQL/XML or SQL/JSON, if your RDBMS supports that. You can then use Jackson, Gson, or JAXB to map from the text format back to your Java classes. For example: List<Location> locations ctx.select( LOCATION.NAME, LOCATION.PLAYER, field( select(jsonArrayAgg(LOCATION2PLAYER.PLAYER_ID)) .from(LOCATION2PLAYER) .where(LOCATION2PLAYER.LOCATION_ID.eq(LOCATION.LOCATION_ID)) ).as("invitedPlayers") .convertFrom(r -> r.map(Records.mapping(Pla) ) .from(LOCATION) .fetch(Records.mapping(Location::new)); In some database products, like PostgreSQL, you could even use SQL array types using ARRAY_AGG() and skip using the intermediate XML or JSON format. Note that JSON_ARRAYAGG() aggregates empty sets into NULL, not into an empty []. If that's a problem, use COALE…
has comment: http://stackoverflow.com/comment/67825464
has comment: http://stackoverflow.com/comment/36720162
type: AcceptedAnswer
upvote count: 11

http://stackoverflow.com/q/23361313
tagged with: java
has title: Oracle 9i does not add as sysdba in JDBC connection String?
type: Question
has body: I am trying to connect oracle9i using jdbc (ojdbc5.jar and ojdbc6.jar). But jdbc connection string is not appending as sysdba at the end of connection string. But when i do same thing using oracle10/11, It works fine. This is connection string for 9i jdbc:oracle:thin:@(DESCRIPTION =(ADDRESS_LIST =(ADDRESS = (PROTOCOL = TCP)(HOST = 172.168.1.123)(PORT = 1521)))(CONNECT_DATA = (SRVR=DEDICATED) (SID = abcd))) Please help me to solve the issue. Thanks, Anjali
tagged with: oracle9i
has answer: http://stackoverflow.com/a/23362974
score: 0
answer count: 2
accepted answer: http://stackoverflow.com/a/30623012
linked to: http://stackoverflow.com/q/10101517
tagged with: oracle-database
has answer: http://stackoverflow.com/a/30623012
has comment: http://stackoverflow.com/comment/35780477
possible better answer: http://stackoverflow.com/a/23362974
type: AnsweredQuestion

http://stackoverflow.com/comment/35857487
has text: I think everyone is missing the point of the actual question. I just want to know about the `? :`. I've edited the example.
score: 0
comment on: http://stackoverflow.com/q/23402960
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23443219
upvote count: 8
has comment: http://stackoverflow.com/comment/35932757
tagged with: unmodifiable
has answer: http://stackoverflow.com/a/23445187
has comment: http://stackoverflow.com/comment/35932729
tagged with: collections
has answer: http://stackoverflow.com/a/23449125
has body: I am trying to reverse an unmodifiable list. However i have tried to achieve it but Is it possible to update or reverse and unmodifiable list? I know we can do it with Google Immutable List import java.util.*; public class ImmutableList { public static void main(String args[]) { String[] mylist = {"Apple","Orange","Mango","Kiwi","Banana"}; List reverselist = new ArrayList(); List&lt;String&gt; strList = Arrays.asList(mylist); List&lt;String&gt; unmodifiableList = Collections.unmodifiableList(strList); for(int i=unmodifiableList.size();i&gt;0;i--) { reverselist.add(unmodifiableList.get(i-1)); } List&lt;String&gt; reverse = Collections.unmodifiableList(reverselist); System.out.println(reverse); } } In the above program I am just traversing in unmodifable list from back and putting them in an array after that adding that array to new unmodifiable list. Can we do it in better way in terms of optimisation?
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23445187
tagged with: java
possible better answer: http://stackoverflow.com/a/23449125
has answer: http://stackoverflow.com/a/23443370
type: Question
downvote count: 0
answer count: 3
has comment: http://stackoverflow.com/comment/35932667
favorite count: 0
score: 8
has title: How to reverse an unmodifiable List in java

http://stackoverflow.com/a/23342098
score: 1
answers question: http://stackoverflow.com/q/23341335
has body: Implementing a TableCellRenderer is the way to go. getTableCellRendererComponent can return any Swing component. So your question boils down to "how to show a string with multiple formats" and "how to change the cursor". To show a string with multiple formats, you can use html in a single JLabel, use multiple JLabels in a JPanel or use a JEditorPane. Setting a Handcursor boils down to a call to setCursor, which is available on all JComponents.
upvote count: 1
downvote count: 0
type: Answer

http://stackoverflow.com/a/23430382
has body: Why not use an event hub? public interface EventHub { void subscribe(String eventName, EventHandler handler); void publish(String eventName, Object context); } public interface EventHandler { void onEvent(Object context); } The EventHub is a singleton which is injected into both frames. public class Frame1 extends JFrame { public Frame1(final EventHub hub) { Button button = new Button("click-me"); button.addAddActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { // for this simple event, the context is null. In the future, // more complex events might need some contextual info hub.publish("myCustomEvent", null); } }); super.add(button); } } public class Frame2 extends JFrame { public Frame2(EventHub hub) { hub.subscribe("myCustomEvent", new EventHandler() { public void onEvent(Object context) { System.out.println("Button was clicked"); } }); } } This means that the publish is de-coupled from the subscribe. It also means that you can have many listeners for a single event.
score: 1
answers question: http://stackoverflow.com/q/23429832
upvote count: 1
downvote count: 0
type: Answer

http://stackoverflow.com/a/23318405
type: AcceptedAnswer
downvote count: 0
upvote count: 2
has comment: http://stackoverflow.com/comment/35702533
type: Answer
has body: I think you're misunderstanding the concepts behind Model-View-Controller. At some point, the components are going to have to interact with each other, because they have to pass information between them. The point is to decouple the interaction from the implementation of the result. In other words, the view should have some standard interface that lets the model/controller notify it it needs updating, and the model/controller should have some standard interface that the view uses to inform it of user input, but neither should care how the other goes about handling those events. In theory, a perfect MVC implementation would let you switch out any one of the components for a completely different implementation as long as it stuck to the same interface and everything would work exactly as expected. In your case, I would design things such that there is a game-engine class which has a method such as this: int makeMove(row, column) Where row and column are coordinates on the board, and the returned int represents the player (X = 0, O = 1 or similar. You could even use an enum to be more explicit``) whose turn it was, so that the GUI can update the appropriate square with that player's icon. The game engine would then expect the view to have at least these two methods: void setPlayerTurn(int player) Which tells the GUI that it should update the display on whose turn it is (same player as above) void setPlayerWon(int player, rows, columns) Which tells the GUI that a player was victorious, and that it should update the three squares identified with rows and columns as being the ones that made a player win, and player is the same player number as above so that it can display the appropriate status message. The game logic, including tracking the state of the board and whose turn it is can then all be self contained inside the game class, and all the GUI is doing is relaying information from the user to the game, and from the game to the user. You could theoretically swap out …
score: 2
accepted answer of: http://stackoverflow.com/q/23318208
answers question: http://stackoverflow.com/q/23318208

http://stackoverflow.com/a/23324915
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/23322275
has comment: http://stackoverflow.com/comment/35801253
has body: As said in API docs: WordToHtmlConverter doesn't create images or links to them. This can be changed by overriding AbstractWordConverter.processImage(Element, boolean, Picture) method. How to override method you can found here: I need Apache POI Pictures converted from a word document to a html file You can try using DOCX 2 XHTML converter based on Apache POI XWPF: XWPFDocument 2 XHTML Also you can use Apache Tika, built on top of Apache POI. An example that included in Alfresco can be found here: HTMLRenderingEngine There are also many other converters.
score: 4
has comment: http://stackoverflow.com/comment/57757321
has comment: http://stackoverflow.com/comment/36104369
upvote count: 4

http://stackoverflow.com/q/23380132
type: Question
has comment: http://stackoverflow.com/comment/35815513
has comment: http://stackoverflow.com/comment/35815738
has comment: http://stackoverflow.com/comment/35815565
has title: Unable to start eclipse even after changing the config.ini file
score: 0
tagged with: android
has comment: http://stackoverflow.com/comment/35815460
has body: I have been having trouble starting eclipse since this morning. I have had a look at log files and made changes to config.ini file manually by referring to some solutions provided by StackOverflow, but had no luck. Here is my config.ini file #This configuration file was written by:org.eclipse.equinox.internal.frameworkadmin.equinox.EquinoxFwConfigFileParser #Fri Dec 06 17:08:13 WST 2013 equinox.use.ds=true eclipse.buildId=M20130204-1200 osgi.bundles=reference\:file\:org.eclipse.equinox.simpleconfigurator_1.0.301.v20120914- 163612.jar@1\:start org.eclipse.equinox.simpleconfigurator.configUrl=file\:org.eclipse.equinox.simpleconfigurat or/bundles.info eclipse.product=com.android.ide.eclipse.adt.package.product osgi.splashPath=platform\:/base/plugins/com.android.ide.eclipse.adt.package osgi.framework.extensions= osgi.bundles.defaultStartLevel=4 eclipse.application=org.eclipse.ui.ide.workbench eclipse.p2.data.area=@config.dir/../p2/ osgi.bundles=org.eclipse.equinox.common@2:start,org.eclipse.update.configurator@3:start,org.eclipse.core.runtime@start Please help me solve this problem.
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35815419
has comment: http://stackoverflow.com/comment/35815591
has comment: http://stackoverflow.com/comment/35815559
tagged with: configuration
tagged with: java
has comment: http://stackoverflow.com/comment/35815360
tagged with: eclipse

class
tags question: http://stackoverflow.com/q/23440395
tags question: http://stackoverflow.com/q/23418252
tags question: http://stackoverflow.com/q/23352084
tags question: http://stackoverflow.com/q/23305769
tags question: http://stackoverflow.com/q/23360079
tags question: http://stackoverflow.com/q/23311574
tags question: http://stackoverflow.com/q/23382871
tags question: http://stackoverflow.com/q/23421046
tags question: http://stackoverflow.com/q/23304483
tags question: http://stackoverflow.com/q/23412231
tags question: http://stackoverflow.com/q/23353284
tags question: http://stackoverflow.com/q/23434916
tags question: http://stackoverflow.com/q/23315636
tags question: http://stackoverflow.com/q/23449209
tags question: http://stackoverflow.com/q/23423852
tags question: http://stackoverflow.com/q/23414873
tags question: http://stackoverflow.com/q/23366743
tags question: http://stackoverflow.com/q/23420908
tags question: http://stackoverflow.com/q/23318932
tags question: http://stackoverflow.com/q/23413198
tags question: http://stackoverflow.com/q/23410096
tags question: http://stackoverflow.com/q/23330905
tags question: http://stackoverflow.com/q/23372222
tags question: http://stackoverflow.com/q/23413574
type: Tag
tags question: http://stackoverflow.com/q/23339799
tags question: http://stackoverflow.com/q/23307750
tags question: http://stackoverflow.com/q/23395513
tags question: http://stackoverflow.com/q/23378422
tags question: http://stackoverflow.com/q/23317360
tags question: http://stackoverflow.com/q/23357252
tags question: http://stackoverflow.com/q/23426465
tags question: http://stackoverflow.com/q/23293262
tags question: http://stackoverflow.com/q/23446478
tag name: class
tags question: http://stackoverflow.com/q/23444859
tags question: http://stackoverflow.com/q/23320002
tags question: http://stackoverflow.com/q/23418800
tags question: http://stackoverflow.com/q/23374740
tags question: http://stackoverflow.com/q/23295373

http://stackoverflow.com/q/23417858
tagged with: performance
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/35886781
type: Question
has comment: http://stackoverflow.com/comment/35886216
has answer: http://stackoverflow.com/a/23451322
has title: Does the Java optimizer memoize calculated values?
tagged with: fizzbuzz
has body: Which fizzbuzz implementation is more efficient? public static void fizzBuzz1(int n) { boolean fizzed, buzzed; for(int i = 1; i &lt;= n; i++) { fizzed = buzzed = false; if(i % 3 == 0) fizzed = true; if(i % 5 == 0) buzzed = true; if(fizzed &amp;&amp; buzzed) System.out.println("FizzBuzz"); else if(fizzed) System.out.println("Fizz"); else if(buzzed) System.out.println("Buzz"); else System.out.println(i); } } public static void fizzBuzz2(int n) { for(int i = 1; i &lt;= n; i++) { if(i % 3 == 0 &amp;&amp; i % 5 == 0) System.out.println("FizzBuzz"); else if(i % 3 == 0) System.out.println("Fizz"); else if(i % 5 == 0) System.out.println("Buzz"); else System.out.println(i); } }
tagged with: optimization
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/23418095
has comment: http://stackoverflow.com/comment/35886713
has comment: http://stackoverflow.com/comment/35886608
has comment: http://stackoverflow.com/comment/35886856
favorite count: 0
has comment: http://stackoverflow.com/comment/35886488
has comment: http://stackoverflow.com/comment/35948357
has comment: http://stackoverflow.com/comment/35886439
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35886558
score: 3

http://stackoverflow.com/comment/35889069
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23419394
has text: equal.vol is integer. its value from 0 to 9
score: 0

http://stackoverflow.com/q/23375304
tagged with: netty
upvote count: 1
type: AnsweredQuestion
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/23379942
type: Question
has body: From these notes: Netty will never call a ChannelHandler's methods concurrently, unless the ChannelHandler is annotated with @Sharable. This is regardless of the type of handler methods - inbound, outbound, or life cycle event handler methods. I have no problem with that. My question is, however, if it is possible for two different messages to be read/processed from the same channel at the same time, at different stages of the pipeline. For instance, consider the following pipeline (ChannelInboundHandlers only): +-----------+ | Handler 2 | +-----------+ ^ | +-----------+ | Handler 1 | +-----------+ ^ | +-----------+ | I/O read | +-----------+ I understand that only one thread, at most, may be calling the methods from Handler 1, unless it is Sharable. But, can a thread be processing a message in Handler 2 while another thread is processing a message for the same channel in Handler 1? Or is the channel selected only when the current message reaches the end of the pipeline?
downvote count: 0
has title: Are concurrent reads possible in Netty 4?
answer count: 1
has answer: http://stackoverflow.com/a/23379942
favorite count: 0
tagged with: multithreading

http://stackoverflow.com/a/23301190
score: 0
type: Answer
has body: When I was working on a procedural architecture generation system at university for my dissertation I created small, extremely easily read and parsed binary files for calculated data. This meant that the data could be read in within an acceptable amount of time, despite being quite a large amount of data... I would suggest doing the same for your animations... It might be of value storing maybe five seconds of animation per file and then caching each of these as they are about to be required... Also, how large are your arrays, you could increase the amount of memory your JVM is able to allocate if it's not maximum array size, but maximum memory limitations you're hitting. I hope this helps and isn't just my ramblings...
answers question: http://stackoverflow.com/q/23301091

http://stackoverflow.com/q/23340408
tagged with: sorting
tagged with: arraylist
has comment: http://stackoverflow.com/comment/35741965
has answer: http://stackoverflow.com/a/23341643
has answer: http://stackoverflow.com/a/23340978
has comment: http://stackoverflow.com/comment/35741762
upvote count: 7
downvote count: 1
has comment: http://stackoverflow.com/comment/35741964
favorite count: 0
linked to: http://stackoverflow.com/q/11907273
linked to: http://stackoverflow.com/q/6321180
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35743083
score: 6
answer count: 4
has answer: http://stackoverflow.com/a/23340681
linked to: http://stackoverflow.com/q/203030
tagged with: java
has comment: http://stackoverflow.com/comment/35742329
type: Question
has comment: http://stackoverflow.com/comment/35742902
has answer: http://stackoverflow.com/a/23340634
has comment: http://stackoverflow.com/comment/35742834
has body: I have an ArrayList in Java with a huge amount of files (~40.000 files). I need to sort these files ascending/descending by their date. Currently, I use a simple Collections.sort(fileList, new FileDateComparator()); where FileDateComparator is public class FileDateComparator implements Comparator&lt;File&gt; { @Override public int compare(File o1, File o2) { if(o1.lastModified() &lt; o2.lastModified()) return -1; if(o1.lastModified()==o2.lastModified()) return 0; return 1; } } Sorting takes up up a too long time for me, like 20 seconds or more. Is there a more efficient way to realize this? I already tried Apache I/O LastModifiedFileComparator as comparator, but it seems to be implemented the same way, since it takes the same time.
has title: Fast sort by date of huge file ArrayList

http://stackoverflow.com/comment/35818851
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/23368062
type: Comment
has text: You can start with the getMethod() in Class http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/7-b147/java/lang/Class.java?av=f

http://stackoverflow.com/a/23382517
has comment: http://stackoverflow.com/comment/35820550
has comment: http://stackoverflow.com/comment/35820552
has comment: http://stackoverflow.com/comment/35820664
has comment: http://stackoverflow.com/comment/35820445
downvote count: 0
has comment: http://stackoverflow.com/comment/35820668
has comment: http://stackoverflow.com/comment/35820597
answers question: http://stackoverflow.com/q/23382380
has comment: http://stackoverflow.com/comment/35820129
has comment: http://stackoverflow.com/comment/35820171
type: Answer
has comment: http://stackoverflow.com/comment/35820769
has comment: http://stackoverflow.com/comment/35820630
upvote count: 3
has body: Reverse engineering this for Java would be pretty painful. In theory you could analyse the original source and work out which expression(s) could throw such an exception. If you have this as an issue, it is highly likely your lines are too complicated/dense. Most IDEs make it really easy to refactor expressions to extract portions of code. This will give you more resolution of where an exception was thrown. Another solution to this specific problem is to have methods with @NotNull and the IDE can detect which arguments could be null, but should never be. URI uri = uriInfo.getBaseUriBuilder().path(objectA) .path(/*highlighted*/objectB).build(); The IDE can warn you that you are passing a variable to a method which can't take a null If you do this, you will pick up these bugs much earlier and it make it easier to fix. (The IDE comes with some quick fixes) Note: generally speaking a incorrectly passed null argument the API should throw a NullPointerException IMHO, however often an IllegalArgumentException is thrown somewhat inconsistently. As I see it, an argument for IllegalArgumentException is that; IllegalArgumentException is something you might expect the application to catch. Catching NullPointerException really smells. The handling of a invalid null is expected to be the same as other incorrect arguments such as a length of -1 IMHO passing null to a method which doesn't accept a null is a programming bug, not a matter of happening to provide an incorrect input.
has comment: http://stackoverflow.com/comment/35820410
score: 3
has comment: http://stackoverflow.com/comment/35820677
has comment: http://stackoverflow.com/comment/35820031

http://stackoverflow.com/a/23352468
score: 0
answers question: http://stackoverflow.com/q/23352254
has body: Just do some changes Server side: public void run() { try { BufferedReader read = new BufferedReader(new InputStreamReader( this.client.getInputStream())); while (true) { System.out.println("Client says - " + read.readLine()); } } catch (IOException e) { e.printStackTrace(); } } Client side: use PrintWriter instead of BufferedWriter that provide print new line functionality and auto flush property. this.write = new PrintWriter(new OutputStreamWriter(this.socket.getOutputStream()), true); .... public void actionPerformed(ActionEvent e) { System.out.println(this.text.getText()); try { writer.write(this.text.getText()); writer.println(); } catch (Exception e1) { e1.printStackTrace(); } }
type: Answer

http://stackoverflow.com/a/23323057
answers question: http://stackoverflow.com/q/23322676
has body: The problem is that you are trying to talk to a server whose SSL Certificate has expired. The reason you are getting the exception is because the Java SSL code is checking the certificate chain, and has noticed the problem. A SSL certificate that has expired is not trustworthy ... and is not trusted by the default certificate validator. I can not renew the certificate ... Renewing the certificate is up to the owner of the website. If that is not you, then there is nothing you can do ... apart from bypassing validation of the certificate, which is bad for SSL connection security.
has comment: http://stackoverflow.com/comment/35711102
type: Answer
score: 8
downvote count: 0
has comment: http://stackoverflow.com/comment/92147843
upvote count: 8

http://stackoverflow.com/q/23304022
downvote count: 1
tagged with: java
score: -1
type: Question
tagged with: robotics
upvote count: 0
answer count: 1
favorite count: 0
has body: I am new to finch and Java code and I'm trying to make finch moves either left or right by its sensors. Hopefully someone can help. if(suzie.isFinchLevel()) { suzie.saySomething("Moving forward"); suzie.sleep(1000); while (!suzie.isObstacle()){ suzie.setWheelVelocities(100,100); if(suzie.isObstacleLeftSide()){ //turn right suzie.setWheelVelocities(100,0,2000); } else if (suzie.isObstacleRightSide()){ suzie.setWheelVelocities(0,100,2000); //turn left } } }
has answer: http://stackoverflow.com/a/23463618
type: UnansweredQuestion
has title: Finch obstacle sensors is not working in java
tagged with: finch

http://stackoverflow.com/comment/35744045
type: Comment
has text: Thanks for your answer i did that and i have now this exception: Grave: Exception lors de l'envoi de l'évènement contexte initialisé (context initialized) à l'instance de classe d'écoute (listener) org.springframework.web.context.ContextLoaderListener org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'facturesController': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.gestion.service.FactureService
comment on: http://stackoverflow.com/a/23341073
type: AnswerComment
score: 0

http://stackoverflow.com/a/59149720
has body: private static void move(File sourceFile, File destFile) { if (sourceFile.isDirectory()) { File[] files = sourceFile.listFiles(); assert files != null; for (File file : files) move(file, new File(destFile, file.getName())); if (!sourceFile.delete()) throw new RuntimeException(); } else { if (!destFile.getParentFile().exists()) if (!destFile.getParentFile().mkdirs()) throw new RuntimeException(); if (!sourceFile.renameTo(destFile)) throw new RuntimeException(); } } works for me
score: 4
upvote count: 4
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/23346922

http://stackoverflow.com/a/23422529
type: Answer
downvote count: 0
score: 1
has body: As of java 1.5, you need to use something like the code below for proxy before openConnection: System.setProperty("http.proxyHost", "proxy.****.com"); System.setProperty("http.proxyPort", "####"); Authenticator authenticator = new Authenticator() { public PasswordAuthentication getPasswordAuthentication() { return (new PasswordAuthentication("user", "pwd".toCharArray())); } }; Authenticator.setDefault(authenticator);
has comment: http://stackoverflow.com/comment/35894986
answers question: http://stackoverflow.com/q/23422300
upvote count: 1

http://stackoverflow.com/q/23328975
upvote count: 4
favorite count: 0
has title: Java equivalent for C++ operator overloading
has comment: http://stackoverflow.com/comment/35721537
has answer: http://stackoverflow.com/a/23328989
linked to: http://stackoverflow.com/q/1686699
possible better answer: http://stackoverflow.com/a/23329008
tagged with: operator-overloading
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35721889
has answer: http://stackoverflow.com/a/23329008
linked to: http://stackoverflow.com/q/18550771
linked to: http://stackoverflow.com/q/77718
tagged with: java
has comment: http://stackoverflow.com/comment/35722489
has body: Consider the class public class Complex { private double x; private double y; public Complex(double x , double y) { this.x = x; this.y = y; } } That represents a Complex number x + y*i , where i is the imaginary part. I have the following main : public static void main(String args[]) { Complex p1 = new Complex(1 , 2); // ok Complex p2 = new Complex(3 , 4); // ok Complex p3 = p1 + p2; // Not ok , doesn't compile } The third line Complex p3 = p1 + p2; doesn't compile , since there is no operator overloading in Java . It would have worked in C++ . Any way around this (in Java) ? Much appreciated
has comment: http://stackoverflow.com/comment/35721500
type: Question
has answer: http://stackoverflow.com/a/23329594
downvote count: 2
accepted answer: http://stackoverflow.com/a/23329594
has comment: http://stackoverflow.com/comment/35722513
has comment: http://stackoverflow.com/comment/35721541
answer count: 3

http://stackoverflow.com/comment/35734737
type: Comment
comment on: http://stackoverflow.com/a/23336304
type: AnswerComment
has text: Hi Harmlezz, in each situation, i do some works and i want they run in timeout is 5s.
score: 0

http://stackoverflow.com/a/23376248
has body: JAXB does not marshal a null value as: null By default it will not marshal the element. If you annotate it with @XmlElement(nillable=true) the xsi:nil attribute will be used. For More Information http://blog.bdoughan.com/2012/04/binding-to-json-xml-handling-null.html
has comment: http://stackoverflow.com/comment/35869981
accepted answer of: http://stackoverflow.com/q/23375299
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/23375299
score: 1
upvote count: 1

http://stackoverflow.com/comment/35686716
score: 2
has text: You asked one thing, then changed your question to ask something else entirely. That's not really appropriate. At worst it invalidates all the answers and results in unjustified downvotes of those answers, and most likely a few downvotes for you as well. Either you should ask them as separate questions, or you should start by asking what you actually want to know.
type: QuestionComment
comment on: http://stackoverflow.com/q/23309326
type: Comment

http://stackoverflow.com/a/29811627
upvote count: 6
downvote count: 1
has body: In Eclipse: - Right click on your project - Properties -Java Build Path - then under "Projects" tab, select "android-support-v7-appcompat" and click "remove". You don't need it there. Solved the problem for me :)
score: 5
answers question: http://stackoverflow.com/q/23382583
type: Answer

http://stackoverflow.com/a/23306476
has body: put this four lines in onCreateView() of Placeholderfragment class of yours and see if that helps.... scanBtn = (Button)findViewById(R.id.scan_button); formatTxt = (TextView)findViewById(R.id.scan_format); contentTxt = (TextView)findViewById(R.id.scan_content); scanBtn.setOnClickListener(this);
answers question: http://stackoverflow.com/q/23305501
score: 0
type: Answer

http://stackoverflow.com/comment/35868713
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23407235
has text: I've found sth. about disabling driver signing in Windows 8/8.1 Maybe this will help: http://www.nicstorey.co.uk/planeplotter/Disable%20Win%208%20Driver%20Signing
type: Comment

http://stackoverflow.com/q/23416202
has body: So I am making a simple paint program, and I have two panels. The first panel is center right and is the canvas. The other, docked on the right and is to hold tool buttons, but it currently has only a clear button. The thing is when I start clicking on the canvas, the clear button is painted on it as a result. Any idea what I am missing? public class Paint extends JFrame implements ActionListener { private Canvas canvas; private JButton clear; private JPanel tools; Paint(){ canvas= new Canvas(); add(canvas,BorderLayout.CENTER); clear= new JButton("Clear"); clear.addActionListener(this); tools= new JPanel(); tools.add(clear); add(tools,BorderLayout.WEST); } public void actionPerformed(ActionEvent e){ if(e.getSource()==clear){ canvas.clear(); } } public static void main(String[] args) { Paint paint=new Paint(); paint.setSize(1000,800); paint.setVisible(true); paint.setDefaultCloseOperation(EXIT_ON_CLOSE); } } Canvas: public class Canvas extends JPanel { private int x= -10; private int y= -10; private boolean clear=false; Canvas(){ addMouseListener(new MouseAdapter(){ @Override public void mousePressed(MouseEvent e){ x=e.getX(); y=e.getY(); draw(); } }); addMouseMotionListener(new MouseMotionAdapter(){ @Override public void mouseDragged(MouseEvent e){ x=e.getX(); y=e.getY(); draw(); } }); } @Override public void paintComponent(Graphics g){ if(clear){ super.paintComponent(g); clear=false; } else{ g.fillOval(x,y,4,4); } } public void draw(){ this.repaint(); } public void clear(){ clear=true; repaint(); } }
tagged with: swing
type: AnsweredQuestion
tagged with: paint
score: 1
tagged with: java
upvote count: 1
type: Question
tagged with: graphics
downvote count: 0
has answer: http://stackoverflow.com/a/23418380
tagged with: jpanel
answer count: 1
favorite count: 0
has title: Unwanted button painting on Panel
accepted answer: http://stackoverflow.com/a/23418380

http://stackoverflow.com/comment/35688157
has text: always call `super.paintComponent()` at the very first line of overridden `paintComponent()` method.
comment on: http://stackoverflow.com/q/23309601
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/102016250
type: AnswerComment
type: Comment
has text: Why not use while loop instead; which has no limits. There is a limit to how many function calls can be made before returning. As each function call permits the OS to store state before entering the function
comment on: http://stackoverflow.com/a/23346962
score: 0

http://stackoverflow.com/comment/35666851
score: 0
type: Comment
type: QuestionComment
has text: Please change your question to use a minimal example of your problem.
comment on: http://stackoverflow.com/q/23299050

http://stackoverflow.com/comment/35766546
comment on: http://stackoverflow.com/q/23353468
has text: What do you expect it to print?
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/q/23382512
has comment: http://stackoverflow.com/comment/35819531
type: Question
has body: I'm implementing a game in Java, using the classes shown below to control the game logic. I try to be very clear when explaining my question. GamePanel I use this class to start the game loop with a thread (only game loop) public void run() { init(); //initialize gamePanel components // game loop while (running) { start = System.nanoTime(); gameManager.update(); KeyInput.update(); MouseInput.update(); gameManager.draw(graphic); Graphics g2 = getGraphics(); g2.drawImage(image, 0, 0, null); g2.dispose(); elapsed = System.nanoTime() - start; wait = targetTime - elapsed / 1000000; if (wait &lt; 0) wait = 5; try { Thread.sleep(wait); } catch (Exception e) { e.printStackTrace(); } } GameManager I made this class to control each aspect of the game as (update,graphics) private void loadState(int state) { if (state == States.MENU.getValue()) gameState = new Menu(this); else if (state == States.GAME.getValue()) gameState = new Game(this); else if (state == States.PATHSELECT.getValue()) gameState = new SelectPath(this); } public void update() { if (gameState != null) gameState.update(); } public void draw(java.awt.Graphics2D graphic) { if (gameState != null) gameState.draw(graphic); else { JOptionPane.showMessageDialog(null, JOptionPane.ERROR_MESSAGE); } } Gamestate GameState is an abstract class that receives, as a constructor parameter, an instance of GameManager and it has abstract methods implemented in each GameState (Menu,Game,MultiPlayer,etc..) this class has these abstract methods: controller() -> that verify the state logic update() -> in case of the currentState is a MultyPlayer , this method call the update method of the class Player , etc... draw(Graphics g) -> draw to screen the objects of the currentState I thought of making a utility class singleton that implements all the draw() of each state, but it is very nasty to insert all in a single class. Example: instead of calling gameState.draw(graphic); I call Render.getRenderInstance().draw(graphic,gameState); this…
score: 10
answer count: 1
favorite count: 0
has title: separate logic and GUI in java
upvote count: 10
type: AnsweredQuestion
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/23383219
accepted answer: http://stackoverflow.com/a/23383219

http://stackoverflow.com/q/23348150
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35756326
tagged with: swing
has answer: http://stackoverflow.com/a/23348968
downvote count: 1
tagged with: java
has title: how to call the method repaint() after a certain time
score: -1
tagged with: eclipse
type: Question
tagged with: graphics
upvote count: 0
has comment: http://stackoverflow.com/comment/35756892
has body: I want to renew the toolTip so i thought in using the repaint method , to repaint the frame every 30 seconds but it doesn't work . can someone helpme.. GrphicsTut Method import java.awt.Color; import java.awt.Font; import java.awt.Graphics; import java.awt.Image; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.Timer; import javax.swing.ImageIcon; import javax.swing.JFrame; public class GrphicsTut extends JFrame{ Timer timer; Image image; Image image2; int x1,y1,x2,y2; Font fonte = new Font("TimesRoman ",Font.BOLD,100); public GrphicsTut(){ MouseListenerJ bkg = new MouseListenerJ(); this.setTitle("Remember g for Graphics"); this.setSize(600,500); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.setVisible(true); this.addMouseMotionListener(bkg); this.addMouseListener(bkg); this.add(bkg); } public void paint(Graphics gr){ gr.setFont(fonte); gr.setColor(Color.black); gr.drawLine(35,35, 410, 110); gr.drawLine(410,110, 310, 410); ImageIcon i=new ImageIcon("image/1005511030.jpg"); image=i.getImage(); gr.drawImage(image, 35, 35,null); gr.drawImage(image, 400, 100,null); gr.drawImage(image, 300, 400,null); repaint(); } public static void main(String[] args) { new GrphicsTut(); } } and here the method for MouseListner package Carte; import java.awt.Graphics; import java.awt.Image; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.awt.event.MouseMotionListener; import javax.swing.ImageIcon; import javax.swing.JOptionPane; import javax.swing.JPanel; public class MouseListenerJ extends JPanel implements MouseListener, MouseMotionListener { public MouseListenerJ(){} public void paint(Graphics g){} @Override public void mouseClicked(MouseEvent me) { // TODO Auto-generated method stub if(me.getX()&gt;=35 &amp;&amp; me.getX()&lt;=70 &amp;&amp; me.getY()&gt;=35 &amp;&amp;me.getY()&lt;=70){ //JOptionPane.showMessageDialog(null,"Que voulez vous faire"); new Carte1(); } } @Override public void mouseEn…
answer count: 1
tagged with: repaint

http://stackoverflow.com/a/43437825
upvote count: 2
type: Answer
answers question: http://stackoverflow.com/q/23363804
score: 2
has body: I'd like to offer you the manual approach to serialising your class. public static final class TcpPacket { public byte [] toByteArray() { ByteBuffer b = ByteBuffer.allocate(4 * 2); return b.putInt(source).putInt(destination).array(); } public static TcpPacket fromByteArray(byte [] bytes) { if (bytes.length &lt; 8) throw new IllegalArgumentException("not enough bytes"); ByteBuffer b = ByteBuffer.wrap(bytes); int source = b.getInt(); int destination = b.getInt(); return new TcpPacket(source, destination); } } Adding a toByteArray and static fromByteArray methods would get you what you want and has the following benefits: Very small representation, only 8 bytes, could in theory be smaller with variable length encoding of the integers Doesn't expose your application to Java serialisation security issues, as clearly you are going to be deserialising data from a network connection. If you require a serializing more complex data structures I would very strongly recommend you choose a well established serialization library such as google protocol buffers (my personal weapon of choice) or one of the many others that don't suffer from the security nightmare that is Java serialization.
downvote count: 0

http://stackoverflow.com/a/23498687
answers question: http://stackoverflow.com/q/23417650
score: 0
type: Answer
has body: Null ... carries special meaning. Whenever you find yourself saying this, it should be a red flag that your design merits re-thinking, as null by definition carries no meaning. Lets step back and look at your requirements (feel free to update the question with better descriptions of your intent if this is inaccurate): Absence: Indicates we've nothing to do here at all null: Indicates a "special value", such as DEFAULT or FALLBACK, which should be handled specially Value: A "normal" value, including the empty string, that can be handled directly This is not an unusual problem, (particularly when working with nullable database columns, as I think you are) and Optional can quite successfully represent this, but we need to structure it better. While we can't avoid NULLs in databases, we can strive to restrict their scope to the minimal code surrounding our database access behavior, and expose it no further than that. We conceptually do this by converting nullable fields to Optionals, as you know. So col VARCHAR NULL should always be converted into Java as an Optional&lt;String&gt; col as soon as possible. But now we need to represent the absence case, such as when we SELECT col FROM table LIMIT 1 and get nothing back from our query. Obviously, this should be handled differently than if we get back a NULL. We have a couple of choices, but they all boil down to wrapping our Optional&lt;String&gt; in another layer somehow. In many cases you can simply use a List or other Collection. By passing back a non-null collection we can generally handle the absent case trivially, as our code will simply not enter whatever loop would otherwise process the data if the List is empty. So List&lt;Optional&lt;String&gt;&gt; is one option. If that's not possible, and you really want to limit the behavior to one-or-none, such as in the LIMIT 1 example above, simply wrap it in another Optional, i.e. Optional&lt;Optional&lt;String&gt;&gt;. This clearly conveys the difference between absence o…
upvote count: 1
downvote count: 1

http://stackoverflow.com/q/23292808
has title: Java - panel is the same size as frame
tagged with: java
has answer: http://stackoverflow.com/a/23293181
has comment: http://stackoverflow.com/comment/35655045
has comment: http://stackoverflow.com/comment/35655082
score: 0
linked to: http://stackoverflow.com/q/7229226
answer count: 3
favorite count: 0
linked to: http://stackoverflow.com/q/21375255
type: UnansweredQuestion
has body: I'm totally new at Java, and I'm trying to write my first program.. But I've already run into the first problem that I can't seem to find the answar to at google. I have made a JFrame and a JPanel inside of it. I want the panel to be a specific size, but when I try to set the size of the panel, it doesn't work, and the panel just fits the size of the frame. package proj; import javax.swing.*; import java.awt.*; class Program { Program() { JFrame frame = new JFrame("Mit program"); frame.setDefaultCloseOperation(frame.EXIT_ON_CLOSE); frame.setVisible(true); frame.setSize(600, 400); frame.setResizable(false); JPanel panel = new JPanel(); panel.setVisible(true); panel.setSize(100,100); // &lt;- Why doesn't this work? panel.setBorder(BorderFactory.createLineBorder(Color.black)); frame.add(panel); } } public class Proj { public static void main(String[] args) { new Program(); } }
has answer: http://stackoverflow.com/a/23292945
upvote count: 1
tagged with: swing
downvote count: 1
has answer: http://stackoverflow.com/a/23292952
type: Question

http://stackoverflow.com/comment/62477160
comment on: http://stackoverflow.com/q/23398154
type: QuestionComment
has text: Possible duplicate of [Understanding how recursive functions work](http://stackoverflow.com/questions/25676961/understanding-how-recursive-functions-work)
type: Comment
score: 2

http://stackoverflow.com/comment/35668528
comment on: http://stackoverflow.com/q/23300019
has text: SEVERE: Catalina.start LifecycleException:
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/35798721
has text: Could you like elaborate a little on your code? Like what are the types of banana and apple, how where they initiated etc.. This question really has no answer because if you did declare banana as a String and apple as an int, then you cannot multiply them
comment on: http://stackoverflow.com/q/23370978
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35886193
score: 0
comment on: http://stackoverflow.com/q/23414314
type: Comment
has text: @mabbas I also just posted a link to the SQL code that creates the underlying tables in the database. Does this help?
type: QuestionComment

http://stackoverflow.com/q/23423007
tagged with: javascript
tagged with: google-apps-script
answer count: 1
has body: I got mail from 2013.01.01 and back for about 20 users. It's Apps for Business. I have super admin privilege. I know how to do this i Apps Script, but it will only do it for me (the logged in user). I would like to do it for all those 20 users. Since i can't to it with Apps Script, i Probably have to do it with a real application? I know a little Java, and I think i could host it on App Engine. But could someone point me in to the right direction codewise, is there any one that have done this before, and do you know if the code is available?
type: UnansweredQuestion
tagged with: google-app-engine
tagged with: gmail
score: 0
has title: Delete mail in Gmail domain level multiple users
type: Question
has answer: http://stackoverflow.com/a/23463005
tagged with: java

http://stackoverflow.com/a/23302283
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23302193
has body: test.replaceAll("This","").replaceAll("this", "")
upvote count: 1
downvote count: 1

http://stackoverflow.com/a/23324079
has body: According to BufferedOutputStream JavaDoc, Closes this output stream and releases any system resources associated with the stream. Closing outputStream would close the underlying outputstream. This is also proven in the source code of BufferedOutputStream's close() method. public void close() throws IOException { try { flush(); } catch (IOException ignored) { } out.close(); }
answers question: http://stackoverflow.com/q/23324033
upvote count: 1
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/a/23365555
answers question: http://stackoverflow.com/q/23365305
has body: According to your question "Entry point for java applet". The life cycle of an applet is: init start stop destroy So the entry point of an applet is init
score: 0
accepted answer of: http://stackoverflow.com/q/23365305
has comment: http://stackoverflow.com/comment/35816568
type: AcceptedAnswer
type: Answer
upvote count: 1
downvote count: 1

http://stackoverflow.com/a/23426721
downvote count: 0
answers question: http://stackoverflow.com/q/23426465
has body: You can't define method in another method. Change your code to this: public class Interface { private void run() { Scanner console = new Scanner(System.in); Store store1 = new Store(); // MUST DO THIS int demandRate, option, end; double setupCost, unitCost, inventoryCost; double sellingPrice, optimalOrder; String name; do { System.out.println("Enter product data (0), Show product data (1), Show product strategy (2), Exit program (9)."); option = console.nextInt(); switch(option) { case 0: enterData(); break; case 1: break; case 2: break; case 9: System.out.println("You chose to exit the program."); break; default: System.out.println("Please choose a valid option."); } } while (option != 9); } private static void enterData() { int demandRate, option, end; double setupCost, unitCost, inventoryCost; double sellingPrice, optimalOrder; Scanner console = new Scanner(System.in); System.out.println("Product name between 3 &amp; 10 characters long: "); String name = console.nextLine(); while ((name.length() &lt; 3) || (name.length() &gt; 10)) { System.out.println("Please put in a name between 3 &amp; 10 characters long."); name = console.nextLine(); } name = name.toLowerCase(); System.out.println("Demand rate: "); demandRate = console.nextInt(); while (demandRate &lt;= 0) { System.out.println("Please put in a positive integer."); demandRate = console.nextInt(); } System.out.println("Setup cost: "); setupCost = console.nextDouble(); while (setupCost &lt;= 0) { System.out.println("Please put in a positive number."); setupCost = console.nextInt(); } System.out.println("Unit cost: "); unitCost = console.nextDouble(); while (unitCost &lt;= 0) { System.out.println("Please put in a positive number."); unitCost = console.nextInt(); } System.out.println("Inventory cost: "); inventoryCost = console.nextDouble(); while (inventoryCost &lt;= 0) { System.out.println("Please put in a positive number."); inventoryCost = console.nextInt(); } System.out.println("Selling price: "); sellingPric…
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/35902140
accepted answer of: http://stackoverflow.com/q/23426465
upvote count: 1
type: AcceptedAnswer

http://stackoverflow.com/comment/35806267
type: Comment
comment on: http://stackoverflow.com/a/23374947
score: 3
has text: I would add to this answer that there's no use in sending a POST request if you're going to user query string parameters in the URL...
type: AnswerComment

http://stackoverflow.com/comment/35881780
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23415240
has text: I've obtained no changes. My project is using http://mvnrepository.com/artifact/ognl/ognl/3.0.6
score: 0

http://stackoverflow.com/comment/35725064
comment on: http://stackoverflow.com/a/23330635
score: 0
has text: "You're totally mixed up" - no argument. So, how do I load them all? Once I load all of them, then I'll move onto the next problem of enumerating trusted certificates.
type: AnswerComment
type: Comment

http://stackoverflow.com/a/23372751
has body: Use the other overloaded method of openContactPhotoInputStream (added in API level 14), the one with the boolean parameter indicating that you prefer high res photos. http://developer.android.com/reference/android/provider/ContactsContract.Contacts.html#openContactPhotoInputStream(android.content.ContentResolver, android.net.Uri, boolean) public static InputStream openContactPhotoInputStream (ContentResolver cr, Uri contactUri, boolean preferHighres)
downvote count: 0
score: 2
answers question: http://stackoverflow.com/q/23372581
has comment: http://stackoverflow.com/comment/35802008
accepted answer of: http://stackoverflow.com/q/23372581
upvote count: 2
has comment: http://stackoverflow.com/comment/35802529
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/105289452
has comment: http://stackoverflow.com/comment/68978600
type: Answer

http://stackoverflow.com/q/23425728
tagged with: android
has answer: http://stackoverflow.com/a/23425785
tagged with: android-edittext
downvote count: 2
has body: Basically I need to check that the user input from inputET (an EditText) is equal to the integer, correctAnswer. The problem I'm getting is that "" (which is the text in the EditText field) cannot be converted to an int. Is there any other ways of achieving this or catching the error, I've tried the following code which to my understanding asks if the string in the EditText is not equal to "". Am i going the right way about this or is there an easier way? // check the input if (inputET.getText().toString() != "") { if (correctAnswer == Integer.parseInt(inputET.getText() .toString())) { inputET.setText(""); newSum(); } } if the user inputs the same int as the correctAnswer integer then the EditText text is reset to "". Thanks for any help.
type: AnsweredQuestion
has title: EditText text cannot be converted to int as there is no text there
score: -2
tagged with: java
has answer: http://stackoverflow.com/a/23425820
type: Question
has answer: http://stackoverflow.com/a/23425873
has answer: http://stackoverflow.com/a/23425764
upvote count: 0
has comment: http://stackoverflow.com/comment/35900209
has answer: http://stackoverflow.com/a/23425788
accepted answer: http://stackoverflow.com/a/23425764
possible better answer: http://stackoverflow.com/a/23425873
favorite count: 0
answer count: 5

http://stackoverflow.com/comment/35825905
type: Comment
comment on: http://stackoverflow.com/a/23385244
type: AnswerComment
score: 0
has text: +1, it is **preferred** to create a `equals()` and `hashCode()` method for this case.

http://stackoverflow.com/a/23424878
answers question: http://stackoverflow.com/q/23424313
type: Answer
has body: As a good coding practice. You should not have public variables in your class. Variables should be private with proper get and set methods. That is one of the basic OOPs principle. Encapsulation. But back to your code. First there is a small problem in how you have defined float variables. these should be float firstFloatSize = 0.0f; Now there are few ways you can achieve this. Writing your own reflection based code. Using conditional code something like below. Using Apache PropertyUtils. Which uses reflection to set your property. Still in the end your calling code should be calling a proper set method. Hope it helps. public void changeValue(String property, float value) { if(property.equals("firstFloatSize")) { firstFloatSize = value; } else if(property.equals("secondFloatSize")) { secondFloatSize = value; } else if(property.equals("thirdFloatSize")) { thirdFloatSize = value; } else { fourthFloatSize = value; } }
score: 0

http://stackoverflow.com/q/23295023
answer count: 1
has comment: http://stackoverflow.com/comment/35659821
tagged with: simpleadapter
has body: I'm trying to do Search in my custom listview. But when text change in EditText, IF doesn't work. That's my code. I use SimpleAdapter. What is wrong ? editText.addTextChangedListener(new TextWatcher() { @Override public void onTextChanged(CharSequence cs, int arg1, int arg2, int arg3) { //get the text in the EditText String searchString= editText.getText().toString(); int textLength=searchString.length(); //clear the initial data set searchResults.clear(); for(int i=0;i&lt;docs.size();i++) { String playerName=docs.get(i).get(FIRST).toString(); if(textLength&lt;=playerName.length()){ //compare the String in EditText with Names in the ArrayList if(searchString.equalsIgnoreCase(playerName.substring(0,textLength))) { searchResults.add(docs.get(i)); Log.i("searchResults", docs.get(i)+""); } else Log.i("doesn't work", "doesn't work"); } } adapter.notifyDataSetChanged(); adapter = new SimpleAdapter(Main.this, searchResults, R.layout.list, new String[] { FIRST, LAST, DATE }, new int[] { R.id.text1, R.id.text2, R.id.date }); listView.setAdapter(adapter); listView.setTextFilterEnabled(true); } @Override public void beforeTextChanged(CharSequence arg0, int arg1, int arg2, int arg3) { // TODO Auto-generated method stub } @Override public void afterTextChanged(Editable arg0) { // TODO Auto-generated method stub } });
has answer: http://stackoverflow.com/a/23323299
has comment: http://stackoverflow.com/comment/35661284
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35661927
has comment: http://stackoverflow.com/comment/35661461
has comment: http://stackoverflow.com/comment/35660750
has comment: http://stackoverflow.com/comment/35661865
tagged with: java
has comment: http://stackoverflow.com/comment/35661103
type: Question
has title: Search in Custom ListView with SimpleAdapter
tagged with: search
accepted answer: http://stackoverflow.com/a/23323299
has comment: http://stackoverflow.com/comment/35660647
score: 0
tagged with: android

http://stackoverflow.com/q/23410864
accepted answer: http://stackoverflow.com/a/24051333
answer count: 2
downvote count: 0
has title: Does Sakai have the ability for plugins?
tagged with: plugins
favorite count: 0
has answer: http://stackoverflow.com/a/24051333
possible better answer: http://stackoverflow.com/a/24183106
score: 5
has answer: http://stackoverflow.com/a/24183106
has body: The company I currently work for builds enterprise software for educational facilities. I just finished a plugin for one of their products that integrates it into Moodle. This was simple and quick because all I had to do was create the source code and then bundle it up into a .zip. Now they are coming to me wanting me to do the same thing for facilities using Sakai. I have realized that Sakai is basically compiled java running on a server.. yet am wondering if it has any plugin based or modification system I can utilize to integrate our product into it? Also thanks in advance. :)
type: Question
type: AnsweredQuestion
upvote count: 5
tagged with: java
tagged with: sakai

http://stackoverflow.com/comment/35886117
type: Comment
type: QuestionComment
has text: I have done this in the JPanel if this is what you mean? setDoubleBuffered(true);
comment on: http://stackoverflow.com/q/23417786
score: 0

http://stackoverflow.com/q/23360831
tagged with: jpa
has title: JPA: Remove orphans within uni-directional one-to-one relationships
upvote count: 1
favorite count: 0
has body: Having devices entities and a separate 'tracker' table. A device might have zero or no trackers, but the device is referenced from tracker. I.e. a tracker for the device might exist or not: public class Tracker { @Id @OneToOne @JoinColumn(name="OBJID") private Device device; private int cnt = 0; public Tracker() {} public Tracker(Device device) { this.device = device; } As you can see, my primary is the same as the device entities id. Now it is unidirectional, i.e. I don't have a reference from device to tracker. Is there any way to make sure that if a device will be removed, all trackers referencing the device will also be removed? Or is this a wrong approach?
answer count: 0
type: UnansweredQuestion
downvote count: 0
score: 1
tagged with: java
type: Question
tagged with: jakarta-ee

http://stackoverflow.com/comment/35784725
has text: I need to display Country ISd Code if we call this web service Like we select india then it should display +91 please write method yaar am Stucking please help
score: 0
comment on: http://stackoverflow.com/a/23363733
type: Comment
type: AnswerComment

http://stackoverflow.com/q/23392308
upvote count: 0
has answer: http://stackoverflow.com/a/23392715
has answer: http://stackoverflow.com/a/23392554
favorite count: 0
score: -1
tagged with: return
has comment: http://stackoverflow.com/comment/35837762
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35837575
has comment: http://stackoverflow.com/comment/35837641
has comment: http://stackoverflow.com/comment/35837860
has body: Alright, so what I want it to do is return true if the server is functioning normally, or an ArrayList of servers not functioning properly. Otherwise, it returns false. The problem is I get the error stated in the subject. Here is my code. public ArrayList&lt;Server&gt; needsAttention() { for (int i = 0; i &lt; Server.length()-1; i++) { if( currentServer.ping()==false) { failedServersList+=currentServer; } return failedServers; }
has comment: http://stackoverflow.com/comment/35837668
has comment: http://stackoverflow.com/comment/35837565
has comment: http://stackoverflow.com/comment/35837600
tagged with: return-value
has title: how to fix unexpected error?
tagged with: java
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/35837648
tagged with: arraylist
answer count: 2
has comment: http://stackoverflow.com/comment/35837708

http://stackoverflow.com/comment/35893715
type: Comment
type: QuestionComment
has text: so you want to serialise your objects from one java app to another?
comment on: http://stackoverflow.com/q/23421967
score: 0

http://stackoverflow.com/q/23343067
tagged with: ebean
has title: Inner join in play framework ebean
tagged with: java
tagged with: inner-join
type: Question
score: 5
upvote count: 5
has answer: http://stackoverflow.com/a/27574429
answer count: 2
tagged with: playframework
downvote count: 0
has answer: http://stackoverflow.com/a/23358137
favorite count: 0
has body: I have a query which i want to write in my Product model select * from shop inner join product on product.shops_id=shop.id where product.name=keyword Shop.java public class Shop extends Model { @Id @SequenceGenerator(name="shop_gen", sequenceName="shop_id_seq", allocationSize=1) @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="shop_gen") @Column(name="id") public Long id; @Required public String name; @Required public String addressLine1; public String addressLine2; public String addressLine3; @Required public String city; @Required public String town; @Required public String phoneNumber; @OneToMany(mappedBy = "shops",cascade = CascadeType.REMOVE) public List&lt;Product&gt; products=new ArrayList&lt;&gt;(); @Required @OneToOne public String category; @Lob @Column(name = "shop_pic") public byte[] shop_pic; @ManyToOne @Required public User owner; } Product.java public class Product extends Model { @Id @SequenceGenerator(name="product_gen", sequenceName="product_id_seq", allocationSize=1) @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="product_gen") @Column(name="id") public Long id; @Required public String name; @Required public Float price; @OneToOne @Required public String category; @ManyToOne public Shop shops; } My main aim is to find list of shops which has a particular product. where keyword change everytime. i have referred to similar question but dint understand any of them. Any help would be appreciated
type: UnansweredQuestion

http://stackoverflow.com/a/23302937
type: Answer
has body: It is best to initialize an array to the size that you initially need it. When you need to add items to the array after that, you can uses a memory copy rather than an object clone. int[] arrayOne = new int[20]; int[] arrayTwo = new int[40]; System.arraycopy(arrayOne, 0, arrayTwo, 0, arrayOne.length); This copy is actually very fast because it just makes a direct copy from memory. This is actually what the underlying code of array list does when it doubles in size. If you want a "dynamic" sized array, you could write your own version of array list. For example: Starts at size 1 Doubles in size when it gets full shifts objects on a delete using System.arraycopy() reduces in half when a delete causes size to be less than n/3
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/23302817
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23302817

http://stackoverflow.com/a/23319044
score: 1
answers question: http://stackoverflow.com/q/23318343
has body: When you click on a textfield, the textfield gains focus. That means your frame loses ownership of focus, and since your listener is most likely added to your frame, your listener stops working right when frame isnt in focus. Add your listener to all compoments, or use Key Binding
has comment: http://stackoverflow.com/comment/35703539
upvote count: 1
type: Answer
downvote count: 0

http://stackoverflow.com/comment/35758139
has text: no If i display queue in packetArrived method it shows result , But in run method it shows null
type: AnswerComment
comment on: http://stackoverflow.com/a/23339678
score: 0
type: Comment

http://stackoverflow.com/q/23344831
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/35751354
tagged with: hql
has title: Update query doesn't update the table
type: Question
has body: With the following method I am trying to update a column named accesstoken. There is no exception,there is no error but the table's column doesn't get updated. What could be the reason ? Am I leaving something ? public void updateAccessToken(int id , String accessToken) { try { Session session = new HVR().getSession(); System.out.println("ID :--&gt; " + id); String hql = "UPDATE UCred set accessToken ='" + accessToken + "'" + " WHERE id ='" + id + "'"; Query query = session.createQuery(hql); query.executeUpdate(); session.close(); }catch(Exception exc) { exc.printStackTrace(); } } Note: Initially accesstoken is set to null.
possible better answer: http://stackoverflow.com/a/23344966
has comment: http://stackoverflow.com/comment/35751523
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/35750165
has answer: http://stackoverflow.com/a/23345695
accepted answer: http://stackoverflow.com/a/23345695
has answer: http://stackoverflow.com/a/23344966
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35751455

http://stackoverflow.com/comment/35697217
has text: Yep i'm actually using a job scheduler - Torque - which controls job execution on a cluster. On another hand for a short process (sending an e-mail) would you prefer a thread ?
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23313213

http://stackoverflow.com/a/23338717
score: 4
answers question: http://stackoverflow.com/q/23325666
type: Answer
has body: You can write listener like this: @Component public class SpringContextListener implements ApplicationListener&lt;ApplicationEvent&gt; { public void onApplicationEvent(ApplicationEvent arg0) { System.out.println("ApplicationListener"); }; } Just add component scan path like this: &lt;context:component-scan base-package="com.controller" /&gt;
upvote count: 4
downvote count: 0

http://stackoverflow.com/q/23357916
tagged with: java
type: Question
tagged with: tree-traversal
has body: I have a list of Activities and a list of Activities and the Start Activity, which I am supposedly fetching by parsing an XML. Now I need to find the Possible Paths from Start to End in Java. I googled some algo's that could do the same but, Dijkstra requires a directed conencted graph(which we dont have) and others are search and traversal algo's. Please help.
has comment: http://stackoverflow.com/comment/35774417
tagged with: dom-traversal
has comment: http://stackoverflow.com/comment/35774250
score: 0
has title: Path Traversal in Java
answer count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/57260449
has text: @Chris311 both 'd' and 'a' point to the same object ... which is a Dog, but 'a' has access to only Dog specific methods when it is downcast at runtime. Infact : Animal a = (Animal)d; is unnecessary, you only need Animal a = d; as you're upcasting.
comment on: http://stackoverflow.com/q/23414090
score: 4
type: Comment
type: QuestionComment

http://stackoverflow.com/a/38956775
upvote count: 1
answers question: http://stackoverflow.com/q/23422970
downvote count: 0
type: Answer
has body: Joins The join method allows one thread to wait for the completion of another. If t is a Thread object whose thread is currently executing, t.join(); causes the current thread to pause execution until t's thread terminates. Overloads of join allow the programmer to specify a waiting period. However, as with sleep, join is dependent on the OS for timing, so you should not assume that join will wait exactly as long as you specify. Like sleep, join responds to an interrupt by exiting with an InterruptedException.
score: 1

http://stackoverflow.com/a/23419629
upvote count: 3
type: Answer
has comment: http://stackoverflow.com/comment/36682011
downvote count: 1
accepted answer of: http://stackoverflow.com/q/23419353
score: 2
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36678334
has comment: http://stackoverflow.com/comment/48067676
has body: I would argue that a Map is actually a Set! Map&lt;Key,Value&gt; can be implemented with Set&lt;Entry&lt;Key,Value&gt;&gt; This is similar to the mathematical foundations of what sets, maps, and functions are. Firstly, can we agree that a Map is a function from Key=&gt;Value (or Domain=&gt;Range). Each key corresponds with at most one value, so it is a partial function (or a complete function only upon those keys in the map). So a map is a function. (Scala even goes so far as to have Map implement the Function1 interface.) Secondly, what is a function? A function is a set of tuples where each first element occurs only once in the set. The second element of the tuple is the value returned by the function. So we have Map is a Function is a Set. On a practical note, there are very good reasons for having Sets. They are very often the correct data structure to use from a conceptual point of view, even before you start worrying about performance. I'd use them over a List in most situations.
answers question: http://stackoverflow.com/q/23419353

http://stackoverflow.com/q/23419556
has answer: http://stackoverflow.com/a/23419593
has answer: http://stackoverflow.com/a/23419598
answer count: 4
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: hibernate
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/23419621
possible better answer: http://stackoverflow.com/a/23419598
downvote count: 0
has title: How can I check what parameter is finally passed with the query?
accepted answer: http://stackoverflow.com/a/23419593
has answer: http://stackoverflow.com/a/23421440
favorite count: 0
tagged with: time
has body: Is there any way I can check, how is the query being framed or what values are being passed ? I want to check for this query : String hql = "from Scheduled where stime &lt;= current_time()"; // QUERY List list = session.createQuery(hql).list(); I want to know what value of current_time() is being sent ?

http://stackoverflow.com/q/23358638
answer count: 2
downvote count: 0
tagged with: jar
tagged with: eclipse-plugin
favorite count: 0
has comment: http://stackoverflow.com/comment/35776588
has body: I am doing plugin development in Eclipse. I have a bunch of projects that use a plugin in their dependencies that I use frequently and need to look into its source. This plugin is referenced as a jar in the Plug-In Dependencies. I have the source code on my local machine, and I attached it to the jar by doing right click > Properties > External Location > External folder, where put in the path to the location. After I do this, I can access the source code in Eclipse. However, if I close eclipse and open it again, the source attachment is gone and I get the ugly 'Source not found' window again. Can somebody tell me how to fix this?
has answer: http://stackoverflow.com/a/23359313
upvote count: 3
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23359986
type: Question
score: 3
tagged with: java
tagged with: eclipse
has title: Eclipse keeps losing source location of library

http://stackoverflow.com/comment/36111939
type: QuestionComment
comment on: http://stackoverflow.com/q/23427982
has text: Thanks Dave fro making me clear, Have edited my question what exactly expected to ask.
score: 0
type: Comment

http://stackoverflow.com/q/23329590
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/23330169
has title: Android crash on getActiveNetworkInfo()
upvote count: 3
downvote count: 2
possible better answer: http://stackoverflow.com/a/23329874
has comment: http://stackoverflow.com/comment/35723048
has answer: http://stackoverflow.com/a/23329874
favorite count: 0
has answer: http://stackoverflow.com/a/52785065
has answer: http://stackoverflow.com/a/28005570
accepted answer: http://stackoverflow.com/a/28005570
has comment: http://stackoverflow.com/comment/35722783
tagged with: android
tagged with: permissions
answer count: 4
type: AnsweredQuestion
has body: The error message says Neither user 10093 nor current process has android.permission.ACCESS_NETWORK_STATE And I have added "android.permission.ACCESS_NETWORK_STATE" to the manifest: &lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /&gt; &lt;uses-permission android:name="android.permission.INTERNET"/&gt; &lt;uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /&gt; &lt;uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /&gt; Why does this happen and How can I fix it? I'm emulating on Nexus One - 2.3.7. - API10 Code cut: ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo netInfo = cm.getActiveNetworkInfo(); if (netInfo != null &amp;&amp; netInfo.isConnectedOrConnecting()) { System.out.print("Debb: there is internet\n"); } Whole Error Log: 04-27 22:26:13.781 1522-1522/com.example.nekitamo E/AndroidRuntime﹕ FATAL EXCEPTION: main java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.nekitamo/com.example.nekitamo.MainActivity}: java.lang.SecurityException: ConnectivityService: Neither user 10024 nor current process has android.permission.ACCESS_NETWORK_STATE. at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1647) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663) at android.app.ActivityThread.access$1500(ActivityThread.java:117) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:130) at android.app.ActivityThread.main(ActivityThread.java:3683) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:507) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597) at dalvik.system.NativeStart.main(Native Method) Caused by: java.lang.Secu…
score: 1

http://stackoverflow.com/a/23310560
answers question: http://stackoverflow.com/q/23310284
has comment: http://stackoverflow.com/comment/35714575
has comment: http://stackoverflow.com/comment/35688073
accepted answer of: http://stackoverflow.com/q/23310284
has body: This is due to not specifying the padding mechanism that has to be used; what you do is leaving the padding mechanism up to the provider, in this case Bouncy. Bouncy seems to default on using no padding mechanism. In that case the result of the "RSA" operation is simply the number you get when performing the modular exponentiation (with the private exponent). As a number is not a byte array, it has to be transformed into one. As the number of initial zero's is not known for a number, those are simply stripped off. To avoid this (and use RSA as it is defined, RSA requires padding), try and use "RSA/ECB/PKCS1Padding" or "RSA/ECB/OAEPWithSHA-1AndMGF1Padding" if you want a more modern/secure version. RSA without padding is known to be insecure. Just imagine what happens if the plaintext converts to the number 1. If modular exponentiation is performed with the public exponent, the result is still simply 1. Obviously, that's not how RSA was intended. Without randomized padding, encryption also has the nasty property of encrypting to the same result for identical ciphertext (encrypting "yes" or "no" would be easy enough to distinguish if you have a known ciphertext for "yes").
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/35719735
type: Answer
score: 3
upvote count: 3

http://stackoverflow.com/comment/35843931
type: QuestionComment
type: Comment
has text: i managed to fix my rotate right method its just my left that im having trouble with, if T is null then I dont want the method to do anything @ChuckB
comment on: http://stackoverflow.com/q/23394983
score: 0

http://stackoverflow.com/comment/36006693
has text: You are right that I am filling up the FJP with tasks, waiting on other tasks. But if you take that Semaphore just as an evil test: Note that the Semaphore is at the top of the outer loop. For this nested loop I would not expect that an inner loop's task will wait on any other outer loop' task. But this is what happens. Your hint to implicit coupling is correct, but I would never expect that the tasks were coupled that way. Is a common FJP a good way to execute parallel (nested) streams? Note: 5 of 10 threads are blocked by Semaphore. The blocking then occurs at the inner loop's task awaitJoin
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23480863

http://stackoverflow.com/comment/35740439
comment on: http://stackoverflow.com/q/23339091
score: 0
has text: @BaBL86 Not necessarily, some switches can remove locking altogether (assuming InnoDB). See http://stackoverflow.com/a/104628/505722
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35816341
comment on: http://stackoverflow.com/a/23380773
score: 0
type: AnswerComment
type: Comment
has text: that did not work.. but I just realized something.. there is ' that is coming before the comma, how can you stop the SECOND character?

http://stackoverflow.com/a/23395266
answers question: http://stackoverflow.com/q/23395108
has body: Actually it will not work u have to call like this Try to use this &lt;c:out value = "${a.user.id}"/&gt; &lt;c:out value = "${a.user.name}"/&gt; &lt;c:out value = "${a.user.email}"/&gt; It only works when User class contains id as attribute with setters and getters and you can replace anything with id which should have attributes and setters and getters in Userclass
score: 0
type: Answer

http://stackoverflow.com/comment/35929500
comment on: http://stackoverflow.com/q/23433442
has text: I added an implementation. See edits.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23346622
has body: read the file using correct encoding, something like: document = sxb.build(new BufferedReader(new InputStreamReader(new FileInputStream(XMLFile.getPath()), "UTF8"))); Note: 1. 1st determine which char encoding used in that file. specify that charset instead of UTF8 above. Incase encoding is not known or it's being generated from various systems with different encoding, you may use 'encoding detector library of Mozilla'. @see https://code.google.com/p/juniversalchardet/ need to handle UnsupportedEncodingException
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/23343161
score: 0
answers question: http://stackoverflow.com/q/23343161

http://stackoverflow.com/q/23324897
tagged with: jpa
downvote count: 0
score: 1
has body: Technology: hibernate 4.3.4.Final spring-data-jpa 1.5.0.RELEASE mysql-connector-java 5.1.30 c3p0 0.9.5-pre8 Some part of dao context: &lt;bean id="dataSource" destroy-method="close" class="com.mchange.v2.c3p0.ComboPooledDataSource"&gt; &lt;property name="driverClass" value="${MyApp_Persistance.connection.driver_class}" /&gt; &lt;property name="jdbcUrl" value="${MyApp_Persistance.connection.url}" /&gt; &lt;property name="user" value="${MyApp_Persistance.connection.username}" /&gt; &lt;property name="password" value="${MyApp_Persistance.connection.password}" /&gt; &lt;/bean&gt; I have entity OrganizationDetail: @Entity @Table(name = "OrganizationDetails") public class OrganizationDetail implements Serializable { ... ... ... @Lob private String address; ... and when im trying to save entity into database i get: Caused by: java.lang.AbstractMethodError: Method com/mchange/v2/c3p0/impl/NewProxyPreparedStatement.setCharacterStream(ILjava/io/Reader;J)V is abstract at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.setCharacterStream(NewProxyPreparedStatement.java) at org.hibernate.type.descriptor.sql.ClobTypeDescriptor$4$1.doBind(ClobTypeDescriptor.java:131) at org.hibernate.type.descriptor.sql.BasicBinder.bind(BasicBinder.java:90) at org.hibernate.type.AbstractStandardBasicType.nullSafeSet(AbstractStandardBasicType.java:286) at org.hibernate.type.AbstractStandardBasicType.nullSafeSet(AbstractStandardBasicType.java:281) at org.hibernate.type.AbstractSingleColumnStandardBasicType.nullSafeSet(AbstractSingleColumnStandardBasicType.java:56) at org.hibernate.persister.entity.AbstractEntityPersister.dehydrate(AbstractEntityPersister.java:2843) at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:3248) at org.hibernate.persister.entity.AbstractEntityPersister.updateOrInsert(AbstractEntityPersister.java:3183) at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:3525) at org.hibernate.action.intern…
has title: Error when saving @Lob with hibernate java mysql
favorite count: 0
type: Question
tagged with: spring
has comment: http://stackoverflow.com/comment/35721767
has answer: http://stackoverflow.com/a/26966690
tagged with: java
tagged with: hibernate
tagged with: mysql
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/35732348
accepted answer: http://stackoverflow.com/a/26966690
type: AnsweredQuestion

http://stackoverflow.com/a/28767352
score: 7
upvote count: 7
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/23442621
has body: To make it still more clear. 1>Set JAVA_HOME,JRE_HOME and Update Ant to 1.9 2>Over build.xml right click => run as (this takes into configuration)==>Now in this Edit Configuration and launch pop-up window select Main tab then the third form field called "Arguments" add: -Dbuild.compiler=javac1.7 3> In build.xml add includeantruntime="false" <classpath refid="my.classpath"/> It should compile without any message

http://stackoverflow.com/a/24110313
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23293489
score: 0
answers question: http://stackoverflow.com/q/23293489
type: Answer
has body: You are trying to use an Objectify v5 object definition with Objectify v4. Make sure you have the correct Objectify jar on your classpath.

http://stackoverflow.com/q/23298045
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/23298699
upvote count: 1
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/23298174
tagged with: eclipse
has answer: http://stackoverflow.com/a/23298539
type: Question
has answer: http://stackoverflow.com/a/23298307
has body: I am currently trying to get the basic My First App tutorial of Android (created by google) to work, but I'm having some issues. Currently how the app is made no errors show up in Eclipse, but when I run the app and click the Send button, the app crashes displaying Unfortunately, My First App has stopped. Looking in the Log cat for the error it states that java.lang.IllegalStateException: Could not find a method sendMessage(View) in the activity class com.example.myfirstapp.MainActivity for onClick handler on view class android.widget.Button. sendMessage does exist in the MainActivity class, but it is a nested class inside a function PlaceholderFragment. Originally I thought that this was an indexing error so I tried calling sendMessage like a nested class android:onClick="PlaceholderFragment.sendMessage" with no success. I have included the fragment_main and MainActivity class as well as my full logcat error. Thanks for any help. MainActivity: package com.example.myfirstapp; import android.content.Intent; import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v7.app.ActionBarActivity; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.widget.EditText; public class MainActivity extends ActionBarActivity { public final static String EXTRA_MESSAGE = "com.example.myfirstapp.MESSAGE"; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); if (savedInstanceState == null) { getSupportFragmentManager().beginTransaction() .add(R.id.container, new PlaceholderFragment()) .commit(); } } @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 ac…
tagged with: runtime-error
downvote count: 0
has answer: http://stackoverflow.com/a/23298967
has title: Android My First App Tutorial android:onClick issues
favorite count: 0
answer count: 5

http://stackoverflow.com/comment/36223069
type: Comment
comment on: http://stackoverflow.com/a/23439210
score: 0
type: AnswerComment
has text: And I'm not sure how the Spring Controller interacts with a Jersey Resource? The Jersey resource is recreated per request by jersey while the SpringController is a singleton.

http://stackoverflow.com/a/23313650
score: 0
has body: Objects in an ArrayList are separate objects the list itself. If you perform an operation on an object in the list, it's still in the list at the same position. You don't need to "overwrite" it. class Name { String n; Name(String n) {this.n = n;} String getName() {return n;} void setName(String n) {this.n = n;} } ... List&lt;Name&gt; names = new ArrayList&lt;&gt;(); names.add(new Name("Steve!")); ... // shout louder for (final Name name : names) { name.setName(name.getName().toUpperCase()); } However, if the object is immutable (you can't change the contents of the object itself), you don't have the option to modify what's inside the object in the list. You need to overwrite the entry in the list with a new object. In that case, you need to keep track of where you are in the list: class Name { final String n; Name(String n) {this.n = n;} String getName() {return n;} } ... List&lt;Name&gt; names = new ArrayList&lt;&gt;(); names.add(new Name("Steve!")); ... // shout louder for (int i = 0; i &lt; names.size(); i++) { final Name name = names.get(i); names.put(i, new Name(name.getName().toUpperCase()); }
type: Answer
answers question: http://stackoverflow.com/q/23313289

http://stackoverflow.com/comment/35833449
type: QuestionComment
has text: It is possible to have 2 JDK's installed at once. Have you considered simply changing the environment variables when launching the applications? Maybe make a batch script that precedes the webstart app and specifies the JDK to use?
type: Comment
comment on: http://stackoverflow.com/q/23390015
score: 0

http://stackoverflow.com/comment/35705710
score: 0
type: Comment
has text: it will change for al your applications installed, you can't change the location configuration for only one application
type: AnswerComment
comment on: http://stackoverflow.com/a/23320578

http://stackoverflow.com/q/23414476
has comment: http://stackoverflow.com/comment/35880337
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/35883162
favorite count: 0
tagged with: geometry
answer count: 0
has comment: http://stackoverflow.com/comment/35900688
type: UnansweredQuestion
upvote count: 1
tagged with: java
tagged with: collision-detection
type: Question
has body: I am currently trying to create an anti-collision algorithm with rotated 3D rectangle boxes (wireframes). My system should limit the speed of the two rectangles in the direction where there might be a collision (speed limit in x negative direction, x positive dir, y neg dir, y pos dir, z neg and z positive direction). Each rectangle will be evaluated individually. Lets say there is a overlap between two individual rectangles in the XZ plane. This scenario could lead to a collision in the Y direction. I need to know a good way of calculating which direction I should limit? Its easy if the two rectangles are outside each others boundary boxes, then its only to compare rectangle 1 min Y vs rectangle 2 max Y and so on, but the problem is when one of the rectangles are rotated around the X-axis. Then you might have a collision in several directions. I need a unique way to detect the direction(s) where the rectangle should have speed limitation(s). Br saadne
has title: Direction of conflict between two rotated rectangles

http://stackoverflow.com/comment/35721788
type: Comment
type: QuestionComment
has text: There is some strange thing about your code - `while(!message.equals("bye")); {` in `Server` won't compile :( Can you please fix it? Looks like you forgot `do {`.
score: 0
comment on: http://stackoverflow.com/q/23328770

http://stackoverflow.com/comment/35878855
type: AnswerComment
comment on: http://stackoverflow.com/a/23400890
score: 0
type: Comment
has text: Thanks but I tried that, still nothing. The logcat in eclipse is looping a callback error but I'm not sure where or why it is going wrong. After the first song, it won't play the second. The first doesn't play again either if the shake stops.

http://stackoverflow.com/comment/35796514
has text: According to this link, the problem is mvc:annotation-driven and removing it resolves the problem, but I have other reasons to keep that tag. http://forum.spring.io/forum/spring-projects/web/124660-spring-3-2-classcastexception-contentnegotiationmanagerfactorybean
comment on: http://stackoverflow.com/q/23369672
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23420393
score: 6
accepted answer of: http://stackoverflow.com/q/23419223
type: AcceptedAnswer
downvote count: 0
has body: The sorted operation forces traversal of all the items in the stream. Stateful operations, such as distinct and sorted, may incorporate state from previously seen elements when processing new elements. Stateful operations may need to process the entire input before producing a result. For example, one cannot produce any results from sorting a stream until one has seen all elements of the stream. (Source) I'm not sure, though, why the operations following the sorted are also executed for all the elements in the stream. If you perform the sort separately, and then use the stream for the rest of the processing, the processing will stop when the first match is found, as expected. Arrays.sort(dataArray, Comparator.comparing(d -&gt; d.getPriority())); // sort Arrays.stream(dataArray) .peek(o -&gt; System.out.println("SORT: " + o)) .map(d -&gt; d.getOriginalURL(shortUrl)) .peek(o -&gt; System.out.println("MAP: " + o)) .filter(u -&gt; u != null &amp;&amp; !u.isEmpty()) .peek(o -&gt; System.out.println("FILTER: " + o)) .findFirst().orElse("");
type: Answer
upvote count: 6
answers question: http://stackoverflow.com/q/23419223

http://stackoverflow.com/comment/35829389
comment on: http://stackoverflow.com/a/23382267
type: Comment
score: 2
has text: yea sir it was i thnk jstl problem only but now its printing 4 times i dont knwow why means one row is coming 4 times... on jsp page... the code you have provided here above that alone itself working..
type: AnswerComment

http://stackoverflow.com/comment/35805425
type: Comment
comment on: http://stackoverflow.com/a/23374573
type: AnswerComment
has text: Do you have any data/external links to support this?
score: 6

http://stackoverflow.com/a/23331538
has body: Variables declared inside a method are instance variables and their scope is only within the method itself. You can not access a variable declared inside one method from another. However if you declare the List outside the method and inside the class itself you can either pass the List into both methods or access them as instance variables of the class. They will all be the same List since they are just different references to the same object.
type: Answer
upvote count: 1
downvote count: 1
answers question: http://stackoverflow.com/q/23331517
score: 0

http://stackoverflow.com/a/23404364
has body: To save a state of a table you have several options: Make a copy of the table data in another table. Export using the oracle EXP or EXPDMP utilities. Export into insert statements using external tools such as Toad, SQLDeveloper (free from Oracle), PLSQL Developer. Or look for an online example and/or write your own. It all depends on how you want to use the copy of your data and how much it is. For quick testing work a copy of the data in another table works best for me. With a simple sql script your table is back to it's original state.
type: Answer
answers question: http://stackoverflow.com/q/23402877
score: 0

http://stackoverflow.com/comment/35921329
type: Comment
comment on: http://stackoverflow.com/a/23435038
has text: Ho... You want to help from a poorly specified problem and you see yourself retrograded. People are nice isn't ? ;)
score: 0
type: AnswerComment

http://stackoverflow.com/a/23398646
answers question: http://stackoverflow.com/q/23398574
type: Answer
has comment: http://stackoverflow.com/comment/35922244
has body: No, there are no methods in the JButton class that allows you to perform such a check. You must use some kind of listener. Check the JavaDoc for JButton to see what methods are available. http://docs.oracle.com/javase/7/docs/api/javax/swing/JButton.html You can use e.getSource() to see where the event came from. JButton button = new JButton(); int i = 0; public void actionPerformed(ActionEvent e) { if(e.getSource == button) { i++; } } This will allow you to only increase if that specific button was pressed.
score: 2
has comment: http://stackoverflow.com/comment/35889636
has comment: http://stackoverflow.com/comment/35854907
has comment: http://stackoverflow.com/comment/35853444
has comment: http://stackoverflow.com/comment/35849903
has comment: http://stackoverflow.com/comment/35851284
has comment: http://stackoverflow.com/comment/35888467
has comment: http://stackoverflow.com/comment/35887160
has comment: http://stackoverflow.com/comment/35854933
has comment: http://stackoverflow.com/comment/35888461
has comment: http://stackoverflow.com/comment/35886355
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/35849994
has comment: http://stackoverflow.com/comment/35853696
has comment: http://stackoverflow.com/comment/35888712
accepted answer of: http://stackoverflow.com/q/23398574
has comment: http://stackoverflow.com/comment/35890002
upvote count: 2

http://stackoverflow.com/comment/35662462
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23296575
has text: Yes. That's true. What could be a possible way out? I have been breaking me head over this for quite some time now.
type: AnswerComment

http://stackoverflow.com/q/23422984
type: UnansweredQuestion
tagged with: android
tagged with: java
has title: Android Application failed to start after adding image
has body: I'm experiencing applications could not start from Android Virtual Device. I'm using version 4.4.2. All the images I had placed into drawable-mdpi folder from res folder. The debug error as shown below.. Thread [&lt;1&gt; main] (Suspended (exception RuntimeException)) &lt;VM does not provide monitor information&gt; ActivityThread.performLaunchActivity(ActivityThread$ActivityClientRecord, Intent) line: 2195 ActivityThread.handleLaunchActivity(ActivityThread$ActivityClientRecord, Intent) line: 2245 ActivityThread.access$800(ActivityThread, ActivityThread$ActivityClientRecord, Intent) line: 135 ActivityThread$H.handleMessage(Message) line: 1196 ActivityThread$H(Handler).dispatchMessage(Message) line: 102 Looper.loop() line: 136 ActivityThread.main(String[]) line: 5017 Method.invokeNative(Object, Object[], Class, Class[], Class, int, boolean) line: not available [native method] Method.invoke(Object, Object...) line: 515 ZygoteInit$MethodAndArgsCaller.run() line: 779 ZygoteInit.main(String[]) line: 595 NativeStart.main(String[]) line: not available [native method] MainActivity.java import android.graphics.drawable.AnimationDrawable; import android.media.MediaPlayer; import android.media.MediaPlayer.OnCompletionListener; import android.os.Bundle; import android.support.v7.app.ActionBarActivity; import android.view.Menu; import android.view.View; import android.view.animation.AlphaAnimation; import android.widget.Button; import android.widget.ImageView; import android.widget.TextView; public class MainActivity extends ActionBarActivity { private CrystalBall mCrystalBall = new CrystalBall(); private TextView mAnswerLabel; private Button mGetAnswerButton; private ImageView mCrystalBallImage; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); //Declare our View variables //Assign them the Views from layout files mAnswerLabel = (TextView) findViewById(R.id.textView1); mGetAnswerButton = (Bu…
has answer: http://stackoverflow.com/a/23423705
type: Question
tagged with: debugging
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/23423475

http://stackoverflow.com/comment/36168106
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23427006
type: AnswerComment
has text: @xrcwrn I updated the answer with detailed explanations.

http://stackoverflow.com/a/23403651
type: Answer
score: 2
answers question: http://stackoverflow.com/q/23403575
downvote count: 0
has body: Although your variable can be a Collection, the object it holds a reference to must be a concrete type; you can't instantiate Collection (or a Collections as you attempted). Try something like this: Collection&lt;String&gt; c = new ArrayList&lt;&gt;(); But if you need a Set, use one: Set&lt;String&gt; set = new HashSet&lt;&gt;();
upvote count: 2

http://stackoverflow.com/a/23338255
accepted answer of: http://stackoverflow.com/q/23338203
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35750969
downvote count: 0
has comment: http://stackoverflow.com/comment/35738452
type: Answer
has comment: http://stackoverflow.com/comment/35737976
has comment: http://stackoverflow.com/comment/35751501
has comment: http://stackoverflow.com/comment/35750684
score: 2
has comment: http://stackoverflow.com/comment/35750867
answers question: http://stackoverflow.com/q/23338203
has comment: http://stackoverflow.com/comment/35750805
upvote count: 2
has comment: http://stackoverflow.com/comment/35737912
has body: You have this inside a thread's run method BackgroundAsyncTaskClass task = new BackgroundAsyncTaskClass(); task.execute(); Threading rules from the docs The AsyncTask class must be loaded on the UI thread. This is done automatically as of JELLY_BEAN. The task instance must be created on the UI thread. execute(Params...) must be invoked on the UI thread. Do not call onPreExecute(), onPostExecute(Result), doInBackground(Params...), onProgressUpdate(Progress...) manually. The task can be executed only once (an exception will be thrown if a second execution is attempted.)

http://stackoverflow.com/q/23380851
has title: SHA256Cng in Javascript
type: Question
tagged with: c#
tagged with: javascript
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/23380960
tagged with: hash
has body: I need to be able to produce a hash value in javascript that will match on the server. These are the sample input: string plaintext = "1398836885"; string salt = "8xTpd9gMxF22nBcotVChIH5ocxplLQzI3Ba7xXBkMyyOVVr6e5/mupqxFHYVQD0U77BEbQ9auMWglUK63PeqCX4eB8kzBoOEAr1nXqpT3jjNwdYPQPdRvwPjdI/357CP"; the correct hash result is: ovsvdWYOUIXU+LAfIYtOf7N60v6Qap6qBgS3IVwBG6k= The code for getting plaintext is: var now = ((long)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds).ToString(); And the code that Generates the correct hash: Usage: var _hash = Hashbrowns.Hash(plaintext, salt); Code: public static class Hashbrowns { private const string chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"; public static string Hash(string plaintext, string salt = null) { return Hashbrowns.Hash&lt;SHA256Cng&gt;(plaintext, salt); } public static string Hash&lt;TAlgorithm&gt;(string plaintext, string salt = null) where TAlgorithm : HashAlgorithm, new() { var algorithm = Activator.CreateInstance&lt;TAlgorithm&gt;(); if (string.IsNullOrWhiteSpace(salt)) { salt = Config.Salt; } var data = Encoding.UTF8.GetBytes(plaintext + salt); return Convert.ToBase64String(algorithm.ComputeHash(data)); } public static string HashPassword(string value) { return Hash(value, Config.Salt + Config.Spice); } public static string RandomString(int length) { var random = new Random(); return new string( Enumerable .Repeat(Hashbrowns.chars, length) .Select(o =&gt; o[random.Next(o.Length)]) .ToArray() ); } } JAVASCRIPT PART In my javascript code, I use Crypto Js to get SHA256: &lt;script type="text/javascript" src="plugin/CryptoJS v3.1.2/rollups/sha256.js"&gt;&lt;/script&gt; Hash: function(){ var o = "13988354648xTpd9gMxF22nBcotVChIH5ocxplLQzI3Ba7xXBkMyyOVVr6e5/mupqxFHYVQD0U77BEbQ9auMWglUK63PeqCX4eB8kzBoOEAr1nXqpT3jjNwdYPQPdRvwPjdI/357CP", hash256 = CryptoJS.SHA256(o), ; console.log(hash256.toString(CryptoJS.enc.Base64)); } And the result is: a2fb2f75660e5085d4f8b01f218b4e7fb37ad2fe906a9ea…
type: AnsweredQuestion
tagged with: sha256
tagged with: java
accepted answer: http://stackoverflow.com/a/23380960

intellij-13
tag name: intellij-13
tags question: http://stackoverflow.com/q/23339307
type: Tag

http://stackoverflow.com/q/23440191
has answer: http://stackoverflow.com/a/23446723
has body: I have declared an order entity. It is made up of a date, customer, and a list of LineItem objects. A Line Item has attributes of a product and quantity. I am trying to model this relationship with JPA. It seems incorrect for each LineItem to have an ID, but I'm not sure how to express the relationship between a LineItem and an Order in JPA: @Entity @Table(name = "ORDERS") public class Order { @Id @GeneratedValue(strategy = GenerationType.AUTO, generator = "cust_seq_gen") @SequenceGenerator(name = "cust_seq_gen", sequenceName = "CUSTOMER_SEQUENCE", allocationSize = 5) private int id; @Temporal(DATE) @Column(name = "DATE_PLACED") private Date datePlaced; @Enumerated(EnumType.STRING) @Column(name = "STATUS") private Status status; @JoinTable( name = "LINE_ITEM_JOIN", joinColumns = @JoinColumn(name = "ORDER_ID"), inverseJoinColumns = @JoinColumn(name = "LINE_ITEM_ID") ) private List&lt;LineItem&gt; orderSegments; @Column(name = "TOTAL", precision = 10, scale = 2) private double total; @ManyToOne private Customer customer; @Column(name = "NOTES") private String notes; } LineItem Class @Entity @Table(name = "LINE_ITEMS") public class LineItem { @Id @GeneratedValue(strategy = GenerationType.AUTO, generator = "line_item_seq_gen") @SequenceGenerator(name = "line_item_seq_gen", sequenceName = "LINE_ITEM_SEQUENCE", allocationSize = 5) private Order associatedOrder; private Product product; private int quantity; ... } I think that the primary key for a line item should be a combination of the product id, quantity, and order id, although I know I have not modeled that.
type: UnansweredQuestion
has title: JPA Mapping for order to line items
tagged with: java
tagged with: hibernate
type: Question
tagged with: jpa
score: 0
answer count: 1

http://stackoverflow.com/comment/35714929
score: 0
comment on: http://stackoverflow.com/q/23325555
type: Comment
type: QuestionComment
has text: Please format your code.

http://stackoverflow.com/a/23421095
has body: Hibernate will only generate the INSERT statements when it flushes the session. It will flush the session in the following scenarios When the @Transactional method ends, When it reaches its batch limit (if configured for batch inserts) or, When you call a query that it detects needs the session to be flushed eg you call a count() method. Hibernate would flush the transactional session and commit it so that count() returns an accurate value of records. My only ideas is that an exception is being thrown that isn't being caught (but I would have expected it to show in your logs or your console) which is causing your transaction to roll back, or that for some reason the @Transactional session isn't being created or maintained or something. 1st thing I'd try, remove the Hibernate dialect from your hibernate properties. Hibernate does a fantastic job determining which dialect to use based on the driver you give it, and (especially with Oracle drivers) if you force it to use a different dialect it can produce strange errors. 2nd thing I'd try is to determine if there are any SQLException's being thrown by Hibernate. I'd assume that you have already turned on your hibernate logging using Log4J or whatever logging provider you are using. See if you can find an SQLException being thrown.
has comment: http://stackoverflow.com/comment/35910941
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35911314
has comment: http://stackoverflow.com/comment/40538401
accepted answer of: http://stackoverflow.com/q/23416657
type: Answer
answers question: http://stackoverflow.com/q/23416657

http://stackoverflow.com/a/23443874
accepted answer of: http://stackoverflow.com/q/23424818
answers question: http://stackoverflow.com/q/23424818
type: Answer
has body: After long Research i found the solution. There are some steps to predefine. AdminTask.createCluster('[-clusterConfig [-clusterName test_rpc -preferLocal true]]') clusterConfig is one step. To define the ClusterConfig the SourceCode looks like: AdminCommand cmd = cmdMgr.createCommand("createCluster"); //gotoStep CommandStep step = ((TaskCommand) cmd).gotoStep("clusterConfig"); step.setParameter("clusterName", ClusterName); step.setParameter("preferLocal", true); cmd.setConfigSession(session); cmd.execute(); And now it works perfect!
score: 0
type: AcceptedAnswer

web-services
tags question: http://stackoverflow.com/q/23447916
type: Tag
tags question: http://stackoverflow.com/q/23442583
tags question: http://stackoverflow.com/q/23395939
tags question: http://stackoverflow.com/q/23334846
tags question: http://stackoverflow.com/q/23443471
tags question: http://stackoverflow.com/q/23356678
tags question: http://stackoverflow.com/q/23428114
tags question: http://stackoverflow.com/q/23416247
tags question: http://stackoverflow.com/q/23442919
tags question: http://stackoverflow.com/q/23308532
tags question: http://stackoverflow.com/q/23391088
tags question: http://stackoverflow.com/q/23414432
tags question: http://stackoverflow.com/q/23362144
tags question: http://stackoverflow.com/q/23325316
tags question: http://stackoverflow.com/q/23312183
tags question: http://stackoverflow.com/q/23333092
tags question: http://stackoverflow.com/q/23305120
tags question: http://stackoverflow.com/q/23388828
tags question: http://stackoverflow.com/q/23433688
tags question: http://stackoverflow.com/q/23375766
tags question: http://stackoverflow.com/q/23365231
tags question: http://stackoverflow.com/q/23397690
tags question: http://stackoverflow.com/q/23442609
tags question: http://stackoverflow.com/q/23375987
tags question: http://stackoverflow.com/q/23365864
tags question: http://stackoverflow.com/q/23312469
tags question: http://stackoverflow.com/q/23338207
tags question: http://stackoverflow.com/q/23309002
tags question: http://stackoverflow.com/q/23434537
tags question: http://stackoverflow.com/q/23343896
tags question: http://stackoverflow.com/q/23356338
tags question: http://stackoverflow.com/q/23397540
tags question: http://stackoverflow.com/q/23311660
tag name: web-services
tags question: http://stackoverflow.com/q/23310621
tags question: http://stackoverflow.com/q/23418208
tags question: http://stackoverflow.com/q/23350887
tags question: http://stackoverflow.com/q/23357335
tags question: http://stackoverflow.com/q/23353960
tags question: http://stackoverflow.com/q/23340457
tags question: http://stackoverflow.com/q/23451402
tags question: http://stackoverflow.com/q/23360942

http://stackoverflow.com/q/23366391
has title: Creating JMS Queue with JMX on WebSphere
upvote count: 1
answer count: 1
has body: I want to create a JMS Queue with Scope:Cluster. Session session = new Session(); ConfigService cService = new ConfigServiceProxy(aClient); queryString = "Cluster=xxx"; ObjectName temp = cService.resolve(session, queryString)[0]; CommandMgr cmdMgr = CommandMgr.getCommandMgr(aClient); AdminCommand cmd = cmdMgr.createCommand("createSIBJMSQueue"); cmd.setTargetObject(obj); cmd.setParameter("name", Name); cmd.setParameter("jndiName", "jms/"+Name); cmd.setParameter("description", "FirstTryOfJMX"); cmd.setParameter("busName", "bus"); cmd.setParameter("queueName", "was"); cmd.setConfigSession(session); cmd.execute(); CommandResult result = cmd.getCommandResult(); This Example works very well if i choose other scopes like -> Node="xxx":Server="xxx". I think the problem is the resolve() function from WebSphere: I find this on docu resolve public javax.management.ObjectName[] resolve(Session session, javax.management.ObjectName scope, java.lang.String containmentPath) resolve the config object from its containment path. Parameters: session - the seesion id. null may be supplied there a workspace will be created automatically and the change will be saved to repository. scope - the scope of search. scope may be a **cell, node or server**. we do cell wide search if scope is null. containmentPath - the containment path of config object. Theres only Cell,Server and Node but no Cluster..... I would like to know how to select Cluster Scopes. Pls Help
favorite count: 0
downvote count: 0
score: 1
tagged with: jmx
type: Question
tagged with: jakarta-ee
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23368382
accepted answer: http://stackoverflow.com/a/23368382
tagged with: java
linked to: http://stackoverflow.com/q/42000532
tagged with: websphere
has comment: http://stackoverflow.com/comment/71178911

http://stackoverflow.com/comment/35948505
has text: Is it about Generics?
score: 0
comment on: http://stackoverflow.com/q/23451389
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23405084
tagged with: android
upvote count: 1
has comment: http://stackoverflow.com/comment/35861516
type: Question
has comment: http://stackoverflow.com/comment/35930541
tagged with: android-event
score: 1
tagged with: java
has body: I am currently trying to figure out, how to get the screen on/off event in android. Currently, it works as long as my MainActivity is runnig. But as soon as I close the activity, somehow Sevice and the Receiver stop working aswell (I don't get any Log messages anymore). I guess the problem, is somehow related to the dynamicaly registration of the receiver. As soon as the application gets closed, the receiver gets unregisted (?). How can I keep the receiver alive? (It is not possible to declare the receiver in the Manifest file). I got the following code: Main activity: public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); startService(new Intent(getApplicationContext(), ScreenOnOffService.class)); } } ScreenReceiver: public class ScreenReceiver extends BroadcastReceiver { @Override public void onReceive(final Context context, final Intent intent) { Log.e("test","onReceive"); if (intent.getAction().equals(Intent.ACTION_SCREEN_OFF)) { Log.d("test","Screen Off "); } else if (intent.getAction().equals(Intent.ACTION_SCREEN_ON)) { Log.d("test","Screen On ");} } } ScreenOnOffService: public class ScreenOnOffService extends Service { //Some unimportant code @Override public int onStartCommand(Intent intent, int flags, int startId) { final IntentFilter filter = new IntentFilter(Intent.ACTION_SCREEN_ON); filter.addAction(Intent.ACTION_SCREEN_OFF); filter.addAction(Intent.ACTION_USER_PRESENT); final BroadcastReceiver mReceiver = new ScreenReceiver(); registerReceiver(mReceiver, filter); return super.onStartCommand(intent, flags, startId); } } AndroidManifest: &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;application android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" &gt; &lt;activity android:name="ch.ethz.inf.thesis.screenonoffproject.app.MainActivity" android:label="@s…
has title: Get screen on/off event while application is not running
linked to: http://stackoverflow.com/q/8713361
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/35861864
has answer: http://stackoverflow.com/a/34135551
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/q/23336903
has body: Hey guys, I have a list to be displayed on a view JSP page from the controller side. What do I return from the modelandview function if I want the list to be displayed in the same view page I am calling it from? Here is the jQuery which i use to call the controller $("#customerList").on("keydown",function(){ $.ajax({ url: '/omp/customer', type: 'GET' }); }); }); Here is the controller code @RequestMapping(method= RequestMethod.GET) public ModelAndView getlist(Model mod) { System.out.println("I am here"); CustomerDetails details = new CustomerDetails(); details.setAl(); mod.addAttribute("lists",details.getAl()); return new ModelAndView("dashboard/home"); }
answer count: 1
has title: Spring MVC controller view
type: UnansweredQuestion
tagged with: spring-mvc
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/23340979
tagged with: jsp
tagged with: jquery
score: 0

http://stackoverflow.com/a/23293027
answers question: http://stackoverflow.com/q/23291682
has comment: http://stackoverflow.com/comment/35655947
has body: I would suggest making sure that the keywords you are using are not dynamically generated. I worked on a site once where all of the ID's looked like this: 'ext-gen123', then the next run through, the very same element would have the ID: 'ext-gen124', but the run through after that would have the ID back to 'ext-gen123'... In this case, you'd have to use some other identifier to locate the element--maybe a CssClass or an XPath.
score: -1
has comment: http://stackoverflow.com/comment/35722920
has comment: http://stackoverflow.com/comment/35739539
downvote count: 1
type: Answer
upvote count: 0

http://stackoverflow.com/a/23409379
downvote count: 0
has body: SAMLDiscovery makes a forward when sending users to the /sso/idpSelection. This means that you could programatically disallow users from accessing the page directly using: @RequestMapping(value = "/idpSelection", method = RequestMethod.GET) public String idpSelection(HttpServletRequest request, Model model) { if (request.getAttribute("javax.servlet.forward.request_uri") == null) { // Deny access } ... } The attribute "javax.servlet.forward.request_uri" is automatically set by container during call to requestDispatcher's forward method and therefore won't be present in direct requests. The feature is available since Servlet 2.4.
upvote count: 3
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23390946
type: Answer
accepted answer of: http://stackoverflow.com/q/23390946
score: 3

http://stackoverflow.com/comment/35709311
score: 1
comment on: http://stackoverflow.com/q/23322619
has text: try cleaning your project after the change, also make sure your editText id is the same as in your activity code, and you are using the correct xml in setContentView
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23351235
has comment: http://stackoverflow.com/comment/35763893
has comment: http://stackoverflow.com/comment/35848024
has comment: http://stackoverflow.com/comment/35763692
has comment: http://stackoverflow.com/comment/35790909
has body: SessionFactory's job is to hide the session creation strategy. For example, in a web application, you probably want the SessionFactory to return create a Session the first time getCurrentSession() is called on a thread, and then return the same Session from that point forward for the duration of the request. (Since you probably want to load customer data from that session, then maybe modify their account in that same session.) Other times, you may want SessionFactory to create a brand new session every time you call getCurrentSession(). So by hiding this decision behind the SessionFactory API, you simply write code that gets the Session from the factory and operates on it. The Session is what handles transactions. As you probably expect, transactions are started in a Session, and then either complete or rollback. There is really no way to prioritize them since once they are started, you are committed to either rolling it back or committing it.
score: 6
type: Answer
upvote count: 6
has comment: http://stackoverflow.com/comment/35840932
accepted answer of: http://stackoverflow.com/q/23351083
has comment: http://stackoverflow.com/comment/35762664
answers question: http://stackoverflow.com/q/23351083
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/35841077
has comment: http://stackoverflow.com/comment/35771894

http://stackoverflow.com/q/23331835
score: 1
tagged with: java
tagged with: image-processing
has title: reducing a double int[][] image to a smaller size
tagged with: image
type: Question
has answer: http://stackoverflow.com/a/23332001
answer count: 1
accepted answer: http://stackoverflow.com/a/23332001
has comment: http://stackoverflow.com/comment/35726895
tagged with: scaletransform
favorite count: 0
upvote count: 2
downvote count: 1
type: AnsweredQuestion
has body: So in my code I am representing an image as a double int[][] array of 1's and 0's. I would like to be able to reduce the image to a smaller int[][] array. This is an example of what I am trying to do: 0000000000 0000000000 00000 0000110000 00100 0000110000 =&gt; 00100 0000110000 01110 0000110000 00000 0011111100 00000 0000000000 0000000000 0000000000 Is there any library that can do something like this for me? Or any ideas on how to write the code to do this for me. This would be the method prototype I am looking for: int[][] reduceImage(int[][] image, double scaleOfReduction) { // somehow make image reduced // how to implement this efficiently??? return reducedImage; }

http://stackoverflow.com/comment/35682406
has text: @Ganesh Not a duplicate.
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23307180

http://stackoverflow.com/q/23309084
tagged with: java
score: 0
accepted answer: http://stackoverflow.com/a/23342474
has body: I am trying to do something very similar to this Getting value from dynamically created inputText and i have some difficulties that is why i will ask my question here, hope you can help me. I want to bind dynamically generated input box with Object. I have: &lt;c:forEach items="${filterTypeBean.listTextFilterTypes()}" var="inputBoxes"&gt; &lt;h:outputText value="${inputBoxes.filterTypeName}" style="width: 100px; white-space: normal; border: 3px" /&gt; &lt;h:inputText value="${requestBean.filterTypeValue}" /&gt; &lt;/c:forEach&gt; In the request bean for filterTypeValue i have: private String filterTypeValue; public String getFilterTypeValue() { return filterTypeValue; } public void setFilterTypeValue(String filterTypeValue) { this.filterTypeValue = filterTypeValue; } My issues come from the fact that i have three entities - TRequest, TRequestFilter, TFilter. TRequestFilter is a mapping table, where i have TREQUEST, TFILTER and the value which i want to take and insert in DB from the inputbox latter. filterTypeBean.listTextFilterTypes() i take from FilterTypeBean: public List&lt;TFilterType&gt; listTextFilterTypes() { EntityManager em = HibernateUtil.getEntityManager(); Query q = em.createQuery("select u from TFilterType u where u.filterType like 'T'"); List&lt;TFilterType&gt; resultList = q.getResultList(); return resultList; } I want to set the value of inputbox in RequestBean because first i insert a new Request in the DB, and after that i want to insert the filters for this new Request in TRequestFilter table (the reason i need TFilter and the inserted value for it). Thanks a lot for the help!
type: Question
tagged with: primefaces
linked to: http://stackoverflow.com/q/20856339
answer count: 1
has answer: http://stackoverflow.com/a/23342474
has title: Getting value from dynamically created inputText box in forEach section
type: AnsweredQuestion
tagged with: jsf

http://stackoverflow.com/a/23416107
type: Answer
has body: Example 1: input: here are my output: hr r m //replaced with '' (nothing) Example 2 (first line): input: cake is king xoxo output: aaka as kang xoxo // replaced with 'a' As you can see that the characters inside [] will be replaced with the character you write as 2nd parameter.
answers question: http://stackoverflow.com/q/23415980
has comment: http://stackoverflow.com/comment/35882875
score: 0
has comment: http://stackoverflow.com/comment/35882760

http://stackoverflow.com/a/23331256
downvote count: 0
score: 3
has body: Take a look at the packages the classes come from. You should be using a set of packages that have "mapred" as one level or another set that have "mapreduce" as one level. I suspect that you're mixing packages and you need to use the TextInputFormat from the other package.
has comment: http://stackoverflow.com/comment/35726299
type: AcceptedAnswer
upvote count: 3
type: Answer
answers question: http://stackoverflow.com/q/23329652
has comment: http://stackoverflow.com/comment/35726420
accepted answer of: http://stackoverflow.com/q/23329652

http://stackoverflow.com/a/23358615
downvote count: 0
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/23358382
has body: A static reference is only collected when the class is unloaded, and this only happened when the class loader is not used any more. If you haven't got multiple class loaders it is likely this will never be unloaded (until your program stops) However, just because an object was once referenced statically doesn't change how it is collected. If you had a static reference to an object and no longer have a reference to that object, it will be collected as normal. Having multiple threads can make finding bugs harder, but it doesn't change how objects are collected either. You need to take a memory dump of your application and see why memory is building up. It is possible the objects you retaining are all needed. In this case you need to reduce your memory requirement increase your maximum memory.

http://stackoverflow.com/q/23404984
type: UnansweredQuestion
tagged with: tostring
has title: I need optimized toString() method of BigInteger
tagged with: biginteger
tagged with: java
has body: I have a very large digit (the length number is 200000). And when i want to print this number System.out.println(myBigInt); a lot of time is spent on an implicit call method toString() of BigInteger number(about 5 sec) Do you know any way how i can print biginteger on console? May be first need convert to byte array but i don't know what i do next. I need print on console a very large biginteger number faster then System.out.println(myBigInt);
has answer: http://stackoverflow.com/a/23405213
type: Question
has comment: http://stackoverflow.com/comment/35875798
score: 0
has comment: http://stackoverflow.com/comment/35861159
answer count: 1
has comment: http://stackoverflow.com/comment/35861215
has comment: http://stackoverflow.com/comment/35861412

http://stackoverflow.com/q/23368870
type: Question
tagged with: passwords
tagged with: java
has answer: http://stackoverflow.com/a/23369204
score: -1
answer count: 3
has comment: http://stackoverflow.com/comment/35794878
downvote count: 1
has body: im looking for a way to encrypt a four digits password and as a result get a 16chars string. So far ive got 64chars String using this public static String digestHex(String text) { StringBuilder stringBuffer = new StringBuilder(); try { MessageDigest digest = MessageDigest.getInstance("SHA-256");// SHA-256 digest.reset(); for (byte b : digest.digest(text.getBytes("UTF-8"))) { stringBuffer.append(Integer.toHexString((int) (b &amp; 0xff))); } } catch (NoSuchAlgorithmException | UnsupportedEncodingException e) { e.printStackTrace(); } return stringBuffer.toString(); } being text = 1234 the resulting String is = 3ac674216f3e15c761ee1a5e255f067953623c8b388b4459e13f978d7c846f4 Using Java btw :D
has comment: http://stackoverflow.com/comment/35794451
favorite count: 0
has answer: http://stackoverflow.com/a/23369511
has comment: http://stackoverflow.com/comment/35794643
linked to: http://stackoverflow.com/q/4948322
upvote count: 0
type: UnansweredQuestion
tagged with: encryption
has answer: http://stackoverflow.com/a/23369756
has comment: http://stackoverflow.com/comment/35803931
has title: Encrypt 4 digits pin with hex enumeration system, resulting 16 chars string

http://stackoverflow.com/comment/35785227
has text: jsp is meant for presentation alone . should avoid java codes in jsp
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23364083
score: 1

http://stackoverflow.com/comment/35808255
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23352958
has text: TY that helped - the code will now compile. However, when it runs it comes up with a AWT-EVENTQueue-Q java.lang.NullPointerException and the line still refers to the insert method. Any ideas on how to fix this?

http://stackoverflow.com/a/23407553
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/23407426
downvote count: 0
has body: getenv() is the method of choice for this. #include &lt;stdlib.h&gt; ... const char v[] = "HOMEPATH"; char * p = getenv(v); printf("%s = '%s'\n", v, p ?p :"&lt;no set&gt;");
has comment: http://stackoverflow.com/comment/35977572
has comment: http://stackoverflow.com/comment/35975651
type: Answer

http://stackoverflow.com/comment/35879561
has text: Look at the sample code `Hello World` that I shared you.
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23414194

http://stackoverflow.com/comment/35730791
type: AnswerComment
has text: i run your code it give me lots of exception... i dont know how to deal with your program.. how i can identify my which port is free?
comment on: http://stackoverflow.com/a/23334008
type: Comment
score: 0

http://stackoverflow.com/a/23407082
score: 1
answers question: http://stackoverflow.com/q/23407051
upvote count: 1
has comment: http://stackoverflow.com/comment/35870539
has body: try do{ } while(Character.toUpperCase(choice) !='E')
has comment: http://stackoverflow.com/comment/35865395
downvote count: 0
type: Answer

http://stackoverflow.com/comment/35722190
type: Comment
comment on: http://stackoverflow.com/q/23327639
score: 0
has text: Thanks for that i have same idea but how can i implement threads in one class containing two methods
type: QuestionComment

http://stackoverflow.com/q/23446818
downvote count: 1
type: Question
has body: I am new to stackOverflow and Android development. Will someone please help me out? I have followed this tutorial to open the camera from a button or imageView within a new app I currently work on, but when I want to run the application to test it, it gives me the following error on my android device; "Unfortunately, (myAppName) has stopped.". I use Eclipse as my IDE. LogCat: 05-03 17:19:32.596: I/Process(785): Sending signal. PID: 785 SIG: 9 05-03 17:30:48.661: D/AndroidRuntime(1599): Shutting down VM 05-03 17:30:48.661: W/dalvikvm(1599): threadid=1: thread exiting with uncaught exception (group=0x41f3d2a0) 05-03 17:30:48.666: E/AndroidRuntime(1599): FATAL EXCEPTION: main 05-03 17:30:48.666: E/AndroidRuntime(1599): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.simon.cameratoets/com.simon.cameratoets.MainActivity}: java.lang.NullPointerException 05-03 17:30:48.666: E/AndroidRuntime(1599): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2110) 05-03 17:30:48.666: E/AndroidRuntime(1599): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2135) 05-03 17:30:48.666: E/AndroidRuntime(1599): at android.app.ActivityThread.access$700(ActivityThread.java:140) 05-03 17:30:48.666: E/AndroidRuntime(1599): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1237) 05-03 17:30:48.666: E/AndroidRuntime(1599): at android.os.Handler.dispatchMessage(Handler.java:99) 05-03 17:30:48.666: E/AndroidRuntime(1599): at android.os.Looper.loop(Looper.java:137) 05-03 17:30:48.666: E/AndroidRuntime(1599): at android.app.ActivityThread.main(ActivityThread.java:4921) 05-03 17:30:48.666: E/AndroidRuntime(1599): at java.lang.reflect.Method.invokeNative(Native Method) 05-03 17:30:48.666: E/AndroidRuntime(1599): at java.lang.reflect.Method.invoke(Method.java:511) 05-03 17:30:48.666: E/AndroidRuntime(1599): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1027) 05-03 17:30:48.666: E/AndroidRunt…
has title: Android program doesn't want to run - "Unfortunately, (myAppName) has stopped."
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/23446859
tagged with: android
type: AnsweredQuestion
score: 0
tagged with: java
upvote count: 1
accepted answer: http://stackoverflow.com/a/23446859
tagged with: android-intent

http://stackoverflow.com/q/23423479
tagged with: java
tagged with: itext
possible better answer: http://stackoverflow.com/a/72989955
has title: Add anchor to pdf using itext java
type: Question
has answer: http://stackoverflow.com/a/72989955
answer count: 2
score: 0
tagged with: http://stackoverflow.com/tag/pdf
has answer: http://stackoverflow.com/a/23425945
has body: I am trying to add anchor(named destinations) to pdf using itext java api. But it's not working.When I click the text , nothing happens.This is what I am doing . Anchor anchor = new Anchor("Jump down to next paragraph"); anchor.setReference("#linkTarget"); Paragraph paragraph = new Paragraph(); paragraph.add(anchor); document.add(paragraph); Anchor anchorTarget = new Anchor("This is the target of the link above"); anchor.setName("linkTarget"); Paragraph targetParagraph = new Paragraph(); targetParagraph.setSpacingBefore(50); targetParagraph.add(anchorTarget); document.add(targetParagraph); What am I doing wrong?. Any help
tagged with: pdf-generation
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23425945

http://stackoverflow.com/comment/35740631
has text: Should I try putting the `shouldIStop` variable inside the brackets at the start of the while loop instead of `true`? I.e. `while(shouldIStop == true){...`
type: Comment
comment on: http://stackoverflow.com/a/23339309
score: 0
type: AnswerComment

http://stackoverflow.com/a/31581651
score: 1
has body: After struggling for hours with this too and trying what felt like everything and anything I finally came up with a solution that works! The main issue here is that the browser doesn't fire the onChange() event of the input fields when it populates the username and password. ZK relies on this to update its own component's value. Furthermore, this also makes it impossible for us to know exactly when the browser has populated the values. The work-around that I have is to add a timer to your page which fires repeatedly and forces ZK's updateChange() routine from the client-side. Given this basic scenario: &lt;form&gt; &lt;textbox id="loginUsername"/&gt; &lt;textbox id="loginPassword" type="password"/&gt; &lt;button id="loginButton" type="submit"/&gt; &lt;/form&gt; This timer would do the trick: &lt;timer id="timer" delay="500" repeats="true" w:onTimer="zk.Widget.$('$loginUsername').updateChange_();zk.Widget.$('$loginPassword').updateChange_();" /&gt; It's important to note that the w:onTimer property is a client-side property and requires the following declaration in your top most element: xmlns:w="client" Even though it seems a bit brute-force it has no negative effects on the user inputting his / her username and password if it was not populated by the browser and you could easily stop the timer once the user does something on the page.
answers question: http://stackoverflow.com/q/23391270
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23391270
type: Answer
downvote count: 0

http://stackoverflow.com/comment/35950085
type: Comment
comment on: http://stackoverflow.com/a/23448882
has text: I have tried this. But its says there's no currently open session. Session session = sessionfactory.getCurrentSession(); session.saveOrUpdate(org);
type: AnswerComment
score: 0

http://stackoverflow.com/a/23435446
type: Answer
answers question: http://stackoverflow.com/q/23434597
has body: Your loop in runMarathon() function. You'll want to retrieve each runner from your List and assign a time. for ( int runnersIndex = 0; runnersIndex &lt;= size; runnersIndex ++ ) { this.randomNumber = new Random(); ans = randomNumber.nextInt(190 - 80 +1 ) + 90 ; Runner runner = runners.get(runnersIndex); runner.setTime(ans); //make sure you create the getters/setters for this value }
score: 0

http://stackoverflow.com/a/23317895
has comment: http://stackoverflow.com/comment/35708839
type: AcceptedAnswer
upvote count: 16
has comment: http://stackoverflow.com/comment/35701197
has comment: http://stackoverflow.com/comment/35701244
has body: Boxing and unboxing are operations you can do by hand, but they're build into the language to avoid the repetition you will undoubtedly encounter. Integer obj = Integer.valueOf(5); // instead of Integer obj = 5; int i = obj.intValue(); // instead of int i = obj; In my opinion, the appropriate way to handle that warning to turn it off. But if that is not an option, you can do the above.
type: Answer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23317876
score: 16
answers question: http://stackoverflow.com/q/23317876

http://stackoverflow.com/a/23837016
accepted answer of: http://stackoverflow.com/q/23297951
type: Answer
score: 1
upvote count: 1
has body: In MainActivity you name your Handler instance "myHandler" but then you pass your MyLooper class "_myIOIOHandler".
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23297951

http://stackoverflow.com/a/23404253
has comment: http://stackoverflow.com/comment/35860304
has body: You seem to have a classical producer/consumer program. The easiest way to solve this kind of problem is to have the producer (i.e. the parser, running in its own thread), store read items to a BlockingQueue, and have the consuler (i.e. the service, running in its own thread) read items from this BlockingQueue. To signal the end of the parsing, you can use a specific object and add it to the queue, or change the state (in a thread-safe way) of a shared object, that the consumer check before reading the next item from the queue.
has comment: http://stackoverflow.com/comment/35860040
has comment: http://stackoverflow.com/comment/35859940
has comment: http://stackoverflow.com/comment/35860227
has comment: http://stackoverflow.com/comment/35860104
upvote count: 2
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23404205
answers question: http://stackoverflow.com/q/23404205
type: Answer
score: 2

file-io
tags question: http://stackoverflow.com/q/23402033
tags question: http://stackoverflow.com/q/23375286
tags question: http://stackoverflow.com/q/23391647
tags question: http://stackoverflow.com/q/23420963
type: Tag
tags question: http://stackoverflow.com/q/23364792
tags question: http://stackoverflow.com/q/23363898
tags question: http://stackoverflow.com/q/23333434
tags question: http://stackoverflow.com/q/23344725
tags question: http://stackoverflow.com/q/23436126
tags question: http://stackoverflow.com/q/23297645
tags question: http://stackoverflow.com/q/23424958
tags question: http://stackoverflow.com/q/23375572
tag name: file-io
tags question: http://stackoverflow.com/q/23406207
tags question: http://stackoverflow.com/q/23433276

http://stackoverflow.com/comment/35725331
comment on: http://stackoverflow.com/a/23330921
score: 0
type: Comment
has text: Ah, okay, that makes sense. I was curious on how *this* worked, but had yet to look into it, that seems incredibly useful. Thanks again, that was very helpful!
type: AnswerComment

http://stackoverflow.com/a/23389868
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/35833186
has body: Try to replace localhost in your neo4j.properties and neo4j-server.properties with 127.0.0.1. Alternatively you might change your settings in /etc/hosts.
upvote count: 2
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23389304
answers question: http://stackoverflow.com/q/23389304
type: Answer

http://stackoverflow.com/q/23294195
has body: Eclipse provides a feature to open the declarations of fields, invoked methods etc. (F3 or Right click => Open declaration or Ctrl + click on the invoked method) However, in the case of enum methods this feature doesn't function, e.g. MyEnum.values(); is called somewhere in my code and trying to open the declaration of values() with the combinations denoted above doesn't work obviously. Why doesn't Eclipse open the declaration of such enum methods?
accepted answer: http://stackoverflow.com/a/23294283
tagged with: eclipse
score: 2
type: AnsweredQuestion
downvote count: 0
tagged with: method-declaration
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/23294283
upvote count: 2
has title: Opening Java enum method declarations in Eclipse
answer count: 1
tagged with: enums
tagged with: java

http://stackoverflow.com/q/23345104
has answer: http://stackoverflow.com/a/23345293
tagged with: java
linked to: http://stackoverflow.com/q/23397622
has comment: http://stackoverflow.com/comment/35751729
has body: I have got following code: public class Square { public static double[] square (double a[]){ double[] s = new double[a.length]; for (int i=0; i&lt;a.length; i++) { s[i]=a[i]*a[i]; } return s; } //other methods... } And whenever I BlueJ Method call and choose double[] square (double a[]) and type 0,1,2 and 3, I am keep getting an error message error identifier expected. So I cannot test my numbers, how can I get rid of this problem? Normal if you type 0,1,2 and 3, you supposed to get the square of each number, but for some reason I am not managing it. EDIT: This is how I'm trying to test the method: Square.square(0, 1, 2, 3);
accepted answer: http://stackoverflow.com/a/23345293
has comment: http://stackoverflow.com/comment/35752054
has comment: http://stackoverflow.com/comment/35752220
has comment: http://stackoverflow.com/comment/35751348
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/35752128
favorite count: 0
has comment: http://stackoverflow.com/comment/35752076
has comment: http://stackoverflow.com/comment/35750896
has comment: http://stackoverflow.com/comment/35751781
has comment: http://stackoverflow.com/comment/35750568
has comment: http://stackoverflow.com/comment/35752020
score: 2
has title: BlueJ - Java Code
has comment: http://stackoverflow.com/comment/35751968
upvote count: 2
has comment: http://stackoverflow.com/comment/35752189
has comment: http://stackoverflow.com/comment/35750501
has comment: http://stackoverflow.com/comment/35751536
type: Question
type: AnsweredQuestion

http://stackoverflow.com/q/23379003
accepted answer: http://stackoverflow.com/a/23379604
has title: JSON object not being returned by jsp page
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/23379048
tagged with: jsp
possible better answer: http://stackoverflow.com/a/23379048
has answer: http://stackoverflow.com/a/23379604
score: 0
type: AnsweredQuestion
has body: I was trying to return a JSON Object from this jsp page.But I dont know why Its not providing the required results.Here is my jsp page : <%@page import="net.sf.json.JSONException"%> <%@page import="net.sf.json.JSONArray"%> <%@page import="net.sf.json.JSONObject"%> <%@page contentType="application/json" pageEncoding="UTF-8"%> JSP Page <% JSONObject json = new JSONObject(); JSONArray employeeslist = new JSONArray(); JSONObject employee; try { int count = 15; for (int i=0 ; i<count ; i++) { employee = new JSONObject(); employee.put("name" , "Decepticons" + i); employee.put("id" , "1999" + i); employeeslist.add(employee); } json.put("Employeeslist", employeeslist); } catch (JSONException jse) { } out.write(json.toString()); %> Please help me to find error in this code. My ajax calling this jsp :
tagged with: java
tagged with: http://stackoverflow.com/tag/json

http://stackoverflow.com/comment/35857516
type: Comment
comment on: http://stackoverflow.com/a/23400585
type: AnswerComment
has text: Can you post the unit test code that is setting up your application context. there may be a misconfiguration in the way that you are setting up your unit tests
score: 0

http://stackoverflow.com/comment/35865759
has text: You need to provide example of where your data comes from. The only thing in your code now is `=0` I just gave a pseudo-example
comment on: http://stackoverflow.com/q/23403949
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35907116
score: 1
type: AnswerComment
has text: It is the same as `.*`, except that it is _non-greedy_. You can read more [here](http://www.regular-expressions.info/repeat.html).
comment on: http://stackoverflow.com/a/23429364
type: Comment

http://stackoverflow.com/a/23347220
accepted answer of: http://stackoverflow.com/q/23346903
answers question: http://stackoverflow.com/q/23346903
score: 0
type: AcceptedAnswer
has body: Specify the generation number in your file pattern. From the j.u.l.FileHandler documentation: If no "%g" field has been specified and the file count is greater than one, then the generation number will be added to the end of the generated filename, after a dot.
type: Answer
has comment: http://stackoverflow.com/comment/35779598
has comment: http://stackoverflow.com/comment/35790724

http://stackoverflow.com/q/23304339
upvote count: 1
has title: Servlet Exception Jersey 1.8
score: 1
tagged with: java
tagged with: servlets
type: Question
downvote count: 0
favorite count: 0
has body: I have a webservice runnig and I am getting the following error. Apr 25, 2014 6:28:40 PM org.apache.catalina.core.StandardWrapperValve invoke SEVERE: Servlet.service() for servlet [Jersey REST Service] in context with path [] threw exception [Servlet execution threw an exception] with root cause java.lang.AbstractMethodError: javax.ws.rs.core.UriBuilder.uri(Ljava/lang/String;)Ljavax/ws/rs/core/UriBuilder; at javax.ws.rs.core.UriBuilder.fromUri(UriBuilder.java:119) at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:662) at javax.servlet.http.HttpServlet.service(HttpServlet.java:728) My Libs are at a mininum: <dependencies> com.google google 5 com.google.guava guava 16.0.1 org.mybatis mybatis 3.2.7 com.sun.jersey jersey-server 1.8 org.apache.cxf cxf-bundle-jaxrs 2.7.7 I've read differnt solutions, but none seem to work, I cleared out any other libraries that might affect this.
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35690249

http://stackoverflow.com/a/23447750
score: 2
downvote count: 0
has body: From what i can gather is it is trying to read the numbers for addition/subtraction before the have been entered and it doesn't wait for anymore input before continuing the application. For instance you are closing the input stream with the .close();method before it can read anything else, so try removing those lines of code until the application has reached its end. Output of application: Please Enter '+' for Addition + Please Enter 1st Number = Please Enter 2nd Number = After Addtion Answer is = 0.0 Do You Want more Calculation Enter 'Y' for Yes and any key for No = Exception in thread "main" java.util.NoSuchElementException at java.util.Scanner.throwFor(Scanner.java:907) at java.util.Scanner.next(Scanner.java:1416) at zip.Calculater.addition(Calculater.java:85) at zip.Calculater.main(Calculater.java:40) Java Result: 1 BUILD SUCCESSFUL (total time: 1 second) try a different approach using IO.next();witch will wait for input before moving to the next line of code. i would suggest something like this: package zip; import java.util.Scanner; public class Calculater { static Scanner console = new Scanner(System.in); public static void main(String[] args) { System.out.println("Enter \'+\' for addition."); if(!console.next().equals("+")) { System.out.println(console.next() + "is not an accepted character."); System.exit(0); } else { System.out.println("Enter first number followed enter then the second number followed by enter."); String f = console.next(); String s = console.next(); int fI = Integer.parseInt(f); int sI = Integer.parseInt(s); System.out.println(fI + " + " + sI + "=" + (fI + sI)); } } } Output: Enter '+' for addition. + Enter first number followed enter then the second number followed by enter. 56 23 56 + 23=79 BUILD SUCCESSFUL (total time: 7 seconds) also try not to use capital letters for object names, use a capital letter at the start for a class name and a small letter at the start for an object name.
upvote count: 2
type: Answer
answers question: http://stackoverflow.com/q/23447536

http://stackoverflow.com/a/23388324
answers question: http://stackoverflow.com/q/23372009
has body: You can actually do this with the Swing HTML parser. Though the Swing parser only understands HTML 3.2, tags introduced in later HTML versions will simply be treated as unknown, and all you actually want are links anyway. static Collection&lt;String&gt; getLinks(Path file) throws IOException, MimeTypeParseException, BadLocationException { HTMLEditorKit htmlKit = new HTMLEditorKit(); HTMLDocument htmlDoc; try { htmlDoc = (HTMLDocument) htmlKit.createDefaultDocument(); try (Reader reader = Files.newBufferedReader(file, StandardCharsets.ISO_8859_1)) { htmlKit.read(reader, htmlDoc, 0); } } catch (ChangedCharSetException e) { MimeType mimeType = new MimeType(e.getCharSetSpec()); String charset = mimeType.getParameter("charset"); htmlDoc = (HTMLDocument) htmlKit.createDefaultDocument(); htmlDoc.putProperty("IgnoreCharsetDirective", true); try (Reader reader = Files.newBufferedReader(file, Charset.forName(charset))) { htmlKit.read(reader, htmlDoc, 0); } } Collection&lt;String&gt; links = new ArrayList&lt;&gt;(); for (HTML.Tag tag : Arrays.asList(HTML.Tag.LINK, HTML.Tag.A)) { HTMLDocument.Iterator it = htmlDoc.getIterator(tag); while (it.isValid()) { String link = (String) it.getAttributes().getAttribute(HTML.Attribute.HREF); if (link != null) { links.add(link); } it.next(); } } return links; }
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23372009
downvote count: 0
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/comment/35861291
type: AnswerComment
comment on: http://stackoverflow.com/a/23404936
score: 0
type: Comment
has text: Thanks a lot. I just created 4 booleans for up down left and right, and in my run method depending on which boolean is true, it will execute a movement and then delay it by 10 ms

http://stackoverflow.com/comment/35947014
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23450675
type: Comment
has text: Please include the exception stack trace from LogCat in the question.

android-actionbar
type: Tag
tags question: http://stackoverflow.com/q/23330313
tags question: http://stackoverflow.com/q/23440917
tags question: http://stackoverflow.com/q/23450675
tags question: http://stackoverflow.com/q/23423187
tag name: android-actionbar
tags question: http://stackoverflow.com/q/23338937

http://stackoverflow.com/a/23448264
upvote count: 2
answers question: http://stackoverflow.com/q/23434156
has comment: http://stackoverflow.com/comment/36006907
has comment: http://stackoverflow.com/comment/36004535
has comment: http://stackoverflow.com/comment/36006979
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36087295
has comment: http://stackoverflow.com/comment/36087245
accepted answer of: http://stackoverflow.com/q/23434156
has comment: http://stackoverflow.com/comment/36114923
type: Answer
has comment: http://stackoverflow.com/comment/36003498
has comment: http://stackoverflow.com/comment/36002866
downvote count: 0
has comment: http://stackoverflow.com/comment/36114946
has comment: http://stackoverflow.com/comment/36001739
score: 2
has comment: http://stackoverflow.com/comment/36006713
has comment: http://stackoverflow.com/comment/36002005
has comment: http://stackoverflow.com/comment/36006921
has body: The problem that you're facing here, is that there are different rules for encoding different parts of a URL--to memory there's 4 sections in a URL that have different encoding rules. First, understand why in Java, you need to build URLs using the UriBuilder class. The URL specification will help with nitty-gritty details. Now since the problem is that since the entire URL is coming as input from the user, I cannot simply parse out the Query parameters and sanitize them individually, since malicious input can be created combining the two query parameters and sanitizing them individually wont work in that case. The only real option here is java.net.URI. Try this: URI dirtyURI = new URI("http://example.com/alpha?abc=def&phil=key%3dbdj"); String cleanURIStr = enc.canonicalize( dirtyURI.getPath() ); The call to URI.getPath() should give you a non-percent encoded URL, and if enc.canonicalize() detects double-encoding after that stage then you really DO have a double-encoded string and should inform the caller that you will only accept single-encoded URL strings. The URI.getPath() is smart enough to use decoding rules for each part of the URL string. If its still giving you some trouble, the API reference has other methods that will extract other parts of the URL, in the event that you need to do different things with different parts of the URL. IF you ever need to manually parse parameters on a GET request for example, you can actually just have it return the query string itself--and it will have done a decoding pass on it. =============JUNIT Test Case============ package org.owasp.esapi; import java.net.URI; import java.net.URISyntaxException; import org.junit.Test; public class TestURLValidation { @Test public void test() throws URISyntaxException { Encoder enc = ESAPI.encoder(); String input = "http://example.com/alpha?abc=def&phil=key%3dbdj"; URI dirtyURI = new URI(input); enc.canonicalize(dirtyURI.getQuery()); } } =================Answer for updated question========…
has comment: http://stackoverflow.com/comment/36115075
has comment: http://stackoverflow.com/comment/63600268
has comment: http://stackoverflow.com/comment/36005031
has comment: http://stackoverflow.com/comment/35994937

http://stackoverflow.com/comment/46323259
has text: Long time ago, but I try to remember. The problem was that the path somehow was not accepting having more than one parameter on the function. The path is completely ok and I could request the parameter by explicitly requesting it. This is how I worked around it.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/29017180

http://stackoverflow.com/comment/35693458
type: AnswerComment
score: 0
has text: Ok, I didn't understand the question at first. I do after the update.
type: Comment
comment on: http://stackoverflow.com/a/23313610

http://stackoverflow.com/q/23366908
has comment: http://stackoverflow.com/comment/35790782
type: Question
has answer: http://stackoverflow.com/a/23367138
has body: I am looking for a datastructure in Java that can do the following: It contains key, value pairs; I can do an 'add' operation, if the key is already present it increases the counter in the value, otherwise it adds a new key,value pair to the datastructure; With every add the datastructure automatically reorders itself so that the key,value pairs are sorted based on the value; Preferably all these operations should be logarithmic in time complexity (or less, but will be hard I guess). How can I manage something like this or is there already something implemented? EDIT private HashMap&lt;String, Integer&gt; keyMap; private TreeSet&lt;String&gt; valueSet; public MultiSet() { Comparator&lt;String&gt; comparator = new Comparator&lt;String&gt;() { @Override public int compare(String key1, String key2) { return keyMap.get(key1).compareTo(keyMap.get(key2)); } }; keyMap = new HashMap&lt;String, Integer&gt;(); valueSet = new TreeSet&lt;String&gt;(comparator); } public void add(String key) { if (keyMap.containsKey(key)) { valueSet.remove(key); keyMap.put(key, keyMap.get(key) + 1); valueSet.add(key); } else { keyMap.put(key, 1); } }
tagged with: algorithm
downvote count: 5
tagged with: data-structures
upvote count: 0
score: -5
accepted answer: http://stackoverflow.com/a/23367138
favorite count: 0
has comment: http://stackoverflow.com/comment/35790635
has comment: http://stackoverflow.com/comment/35791092
has answer: http://stackoverflow.com/a/23367076
has answer: http://stackoverflow.com/a/23367108
has answer: http://stackoverflow.com/a/23367443
answer count: 4
type: AnsweredQuestion
has title: Custom datastructure in Java
tagged with: java
has comment: http://stackoverflow.com/comment/35790671
possible better answer: http://stackoverflow.com/a/23367108

http://stackoverflow.com/comment/35662460
score: 1
comment on: http://stackoverflow.com/q/23296187
has text: @Math do you have `BLUETOOTH` permission in your manifest ?
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35884100
comment on: http://stackoverflow.com/q/23416171
score: 0
has text: How do you create your temp file? Are you using http://docs.oracle.com/javase/7/docs/api/java/io/File.html#createTempFile%28java.lang.String,%20java.lang.String%29?
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/36001400
score: 0
has text: Yes, but it is possible that the problem is that the correct manifest is being ignored. We don't know exactly where he is looking for the manifest, or what part of his process is trying to use it. So another thing for him to investigate is probably a good idea.
type: Comment
comment on: http://stackoverflow.com/a/23333405
type: AnswerComment

http://stackoverflow.com/comment/37315694
type: QuestionComment
has text: "The following code does not". Does not what?
score: 0
comment on: http://stackoverflow.com/q/23298372
type: Comment

http://stackoverflow.com/comment/35779252
type: Comment
type: QuestionComment
has text: runtime filling: myList.add("myString") in a list
comment on: http://stackoverflow.com/q/23360664
score: 0

http://stackoverflow.com/q/23410157
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23411087
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: javascript
linked to: http://stackoverflow.com/q/558518
has comment: http://stackoverflow.com/comment/35871343
has answer: http://stackoverflow.com/a/23410224
has body: I have a (java.util.List) List returned to the jag. That should be printed as a json . var storeForum = Packages.org.wso2.carbon.forum.registry.RegistryForumManager; var forum = new storeForum(); var start = request.getParameter('start'); var count = request.getParameter('count'); var array =forum.fetchForumTopics(start,count, tenantDomainsArr, -1234, user.username); forum.fetchForumTopics method returns List&lt;customOjbect&gt; How to print it as a json. Didn't find anything useful on net.
type: Question
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/35871306
has title: How to convert arraylist of custom object in to json in javascript

stream
tags question: http://stackoverflow.com/q/23440299
tags question: http://stackoverflow.com/q/23297478
tags question: http://stackoverflow.com/q/23324033
type: Tag
tag name: stream
tags question: http://stackoverflow.com/q/23377444
tags question: http://stackoverflow.com/q/23374600
tags question: http://stackoverflow.com/q/23418309
tags question: http://stackoverflow.com/q/23438119
tags question: http://stackoverflow.com/q/23378364

http://stackoverflow.com/comment/35930620
has text: The "runtime" does not reach the first one, it is not a statement.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23442026
type: QuestionComment

http://stackoverflow.com/q/23390337
answer count: 1
tagged with: junit
type: UnansweredQuestion
tagged with: codepro
tagged with: junit3
tagged with: junit4
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/23390743
score: 0
has body: I am using codePro tool to generate junit. Since I am using JDK1.4, I opted junit3 in codePro settings. Despite me setting junit-3, the test cases are generated in junit-4 (with annotations) The first screen shot shows that my setting shows my selection on junit-3 The second screen shot shows that test case generations are happening based on junit-4 Please guide me on this
has title: codePro junit generates in junit-4 always

http://stackoverflow.com/q/23394421
type: Question
has answer: http://stackoverflow.com/a/23394508
has title: NullPointerException Throughout Classes
has comment: http://stackoverflow.com/comment/35841633
score: -1
downvote count: 2
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/35841773
has comment: http://stackoverflow.com/comment/35841615
tagged with: null
tagged with: java
type: UnansweredQuestion
has body: This code isn't close to being done by in order to test it through out writing it I have to get pass these errors. All classes compile but when I run it the following errors come up: Exception in thread "main" java.lang.NullPointerException at Deck.&lt;init&gt;(Deck.java:41). at Dealer.&lt;init&gt;(Dealer.java:25). at Poker.main(Poker.java:16). Here are the codes I have so far. Ill bold where the errors are occuring public class Dealer { private Deck deck; private Player[] players; public static final int NUMBER_OF_PLAYERS = 2; /** * Default constructor - creates and populates the Player array and the * Deck object. */ public Dealer() { players = new Player[ NUMBER_OF_PLAYERS ]; **deck = new Deck();** // populate the array of players } // constructor /** * Outermost level of abstraction for the poker game */ public void play() { System.out.println("Welcome to Poker!"); } // method play } public class Poker { public static void main( String[] args ) { Dealer dealer; **dealer = new Dealer();** dealer.play(); } } public class Card { private int face; private int suit; public static final int CLUBS = 100; public static final int DIAMONDS = 200; public static final int HEARTS = 300; public static final int SPADES = 400; /** * Default Value Constructor - for stubs only!!! */ public Card() { // do nothing in it } // default value constructur /** * Explicit Value Constructor */ public Card( int cardFace, int cardSuit ) { face = cardFace; suit = cardSuit; } // constructor /** * Returns the face of the card as a String * * @return the face of the card */ public String getFace() { String returnVal; switch ( face ) { case 11: returnVal = "Jack"; break; case 12: returnVal = "Queen"; break; case 13: returnVal = "King"; break; case 14: returnVal = "Ace"; break; default: returnVal = "" + face; } // end switch return returnVal; } // method getFace /** * Return the numeric face value * * @return the numeric face value */ public int getFaceValue() { return face; } // method getFaceVal…
favorite count: 0
tagged with: nullpointerexception

http://stackoverflow.com/q/23293456
tagged with: android-intent
has comment: http://stackoverflow.com/comment/35656444
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/3280051
tagged with: java
has comment: http://stackoverflow.com/comment/35656570
tagged with: eclipse
accepted answer: http://stackoverflow.com/a/23293519
type: Question
has comment: http://stackoverflow.com/comment/35656093
has title: Unfortunately the app has stopped working error in Android
has answer: http://stackoverflow.com/a/23293519
tagged with: bluetooth
has body: I am new to making Android Applications. I was working on an Android App(in Eclipse) that uses Bluetooth APIs and the problem occurs when I select a particular device name from the list of paired devices(i.e. jumping from one activity to the next), the app stops and it displays this message instead of showing the next screen. I am not able to understand what the error could be. I am sharing the code snippet from the Main Activity: // listening to single list item on click listOfDevices.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { // Launching new Activity on selecting single List Item Intent i = new Intent(getApplicationContext(), Controls.class); startActivity(i); } }); This is the code for the 2nd activity- Controls.java (contains only buttons as of now) public class Controls extends Activity{ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); //this.setContentView(R.layout.controls); final Button bt1 = (Button) findViewById(R.id.button1); final Button bt2 = (Button) findViewById(R.id.button2); final Button bt3 = (Button) findViewById(R.id.button3); final Button bt4 = (Button) findViewById(R.id.button4); bt1.getBackground().setColorFilter(new LightingColorFilter(0xFFFFFFFF, 0xFFAA0000)); bt2.getBackground().setColorFilter(new LightingColorFilter(0xFFFFFFFF, 0xFFAA0000)); bt3.getBackground().setColorFilter(new LightingColorFilter(0xFFFFFFFF, 0xFFAA0000)); bt4.getBackground().setColorFilter(new LightingColorFilter(0xFFFFFFFF, 0xFFAA0000)); Intent i = getIntent(); } } And this is the Manifest file: <?xml version="1.0" encoding="utf-8"?> <uses-sdk android:minSdkVersion="9" /> <uses-permission android:name="android.permission.BLUETOOTH" /> <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" /> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" />
score: 0
answer count: 1
tagged with: android
has comment: http://stackoverflow.com/comment/35656150

http://stackoverflow.com/comment/35673877
comment on: http://stackoverflow.com/a/23302264
type: AnswerComment
score: 0
has text: Thanks so much, this was really helpful!! It's now moving for me!
type: Comment

http://stackoverflow.com/a/35799695
type: Answer
answers question: http://stackoverflow.com/q/23314412
has body: i recently experienced this. I checked everything and didn't find anything that might have caused it. In desperation, i just moved the "/>" closer in the mapping and saved it. And it worked. Mysterious...
score: 0

http://stackoverflow.com/comment/35933455
score: 0
has text: Sorry for my confusion, but I don't understand. Vikram's method just loops through the list once and adds the values to the destination list, and so all the values of both the lists are touched only once. That is the same as copying, but in your method, you do extra steps after copying, so how can it be done in less duration?
type: Comment
comment on: http://stackoverflow.com/a/23443370
type: AnswerComment

http://stackoverflow.com/a/23294323
type: Answer
has comment: http://stackoverflow.com/comment/35657731
answers question: http://stackoverflow.com/q/23294212
downvote count: 0
score: 1
has body: You can use list of list..like below Vector&lt;Vector&lt;Object&gt;&gt; list = new Vector&lt;Vector&lt;Object&gt;&gt;(); Vector&lt;Object&gt; row1 = new Vector&lt;Object&gt;(); row1.add(5); row1.add("John"); Vector&lt;Object&gt; row2 = new Vector&lt;Object&gt;(); row1.add(1.1); row1.add("Aby"); list.add(row1); list.add(row2);
upvote count: 1

http://stackoverflow.com/comment/35837070
type: QuestionComment
comment on: http://stackoverflow.com/q/23391607
has text: This is not a properties file. It's okay to come up with your own file format, but a Java properties file has a specific, well-defined meaning, and this isn't it. Typically, for multiple languages, multiple properties files are used.
score: 0
type: Comment

http://stackoverflow.com/a/23440380
has comment: http://stackoverflow.com/comment/35934517
type: Answer
answers question: http://stackoverflow.com/q/23438120
has body: Looking at just this code out of context, the main error that I see is that its a JFrame, which all thought it may be fine in most cases, for some reason, in certain cases of personal experience, I have noticed that it can cause listeners not to function for some reason or another. Being as you don't use any JComponents, you should be fine converting to a normal Frame, which my just be a simple solution to your problem. This is incredibly likely if there is not output from the try catch in loadIamge(), being as that measn that is was likeyl never called, a good thing to test this may just be a out.println("Do I get called?"); inside the method. its usually a good practice for debugging.
score: 0

http://stackoverflow.com/comment/35815738
score: 0
type: Comment
type: QuestionComment
has text: yes I did install a sample sdk for something..I might have accidentally deleted some file or overwritten it. How can I recover from it?
comment on: http://stackoverflow.com/q/23380132

http://stackoverflow.com/a/23364387
type: Answer
accepted answer of: http://stackoverflow.com/q/23361761
answers question: http://stackoverflow.com/q/23361761
score: 0
type: AcceptedAnswer
has body: Since I am dealing with source context not a file system one, The answer should be: To replace: ImageIcon icon = new ImageIcon("/sau/se/editor/images/HighBtomStPic.png"); With: ImageIcon icon = new ImageIcon(GraphEditor.class.getResource("/sau/se/editor/images/HighBtomStPic‌​.png"));

http://stackoverflow.com/comment/35800350
has text: Iterate over `key-value` entries to get `value` which would be list of your objects and iterate over each of this lists. I assume you know how to iterate over list. To know how to iterate over `key-value` entries check link provided by Luiggi.
score: 0
comment on: http://stackoverflow.com/q/23371843
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35844139
score: 1
type: Comment
type: QuestionComment
has text: +1 for using a `final` local.
comment on: http://stackoverflow.com/q/23395178

http://stackoverflow.com/q/23442583
score: 0
answer count: 1
tagged with: wsdl
tagged with: soap
type: UnansweredQuestion
tagged with: web-services
tagged with: java
tagged with: jax-ws
linked to: http://stackoverflow.com/q/23422756
type: Question
has body: I had posted this question yesterday: How to go about creating SOAP webservice in Java and after following this book: http://www.packtpub.com/java-7-jax-ws-web-services/book I have managed to created a JAX-WS application: package hellows; import javax.jws.*; @WebService(portName = "HelloWSPort", serviceName = "HelloWSService", targetNamespace = "http://hellows/", endpointInterface = "hellows.HelloWS") public class HelloWSImpl implements HelloWS { public String hello(String name) { // replace with your impl here return "Hello "+name +" Welcome to Web Services!"; } } All is fine. But what I need is that the service method(ie "hello") should instead of "string" accept an XML file describing student details(I've changed the original file): <?STU version="1.0"?> 2354282 2012-06-17T21:19:15 2012 Male Sonata 3 Then the service will process it and return a Java Object containing a flag "passed"/"failed" based on some algo. So my question is: How should service method receive this XML data? As a String? or some other way? Will I need to describe this XML data format in .wsdl and .xsd files within the config folder?
has title: Passing XML data to SOAP service dilemma
has answer: http://stackoverflow.com/a/23449201

http://stackoverflow.com/comment/35829287
has text: Current location of the endorsed dir (thanks for check!) differs. And with this location compilation is successful. Thank you! As a result: current location of the endorsed directory not necessarily "$JAVA_HOME/lib/endorsed", it must be checked.
comment on: http://stackoverflow.com/a/23382729
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/23447882
type: Question
has title: PHP multidimentional associative array performance or similar code in Java
score: 0
accepted answer: http://stackoverflow.com/a/23448333
has comment: http://stackoverflow.com/comment/35941548
answer count: 1
has comment: http://stackoverflow.com/comment/35941365
has answer: http://stackoverflow.com/a/23448333
tagged with: php
type: AnsweredQuestion
tagged with: performance
has body: I am doing a lot of operations using a below code in PHP. The issue is PHP is getting slower and slower as my data gets bigger and bigger. My solution to fix this is to move the code in Java so it can provide a better performance as it is complied language and I can also multithread or use async functions to do multiple such operations to make it faster. What I want to know is how to speed up this kind of operation in PHP or what other data structure should I use to improve the performance of this code. And if not PHP how can I do this in Java. foreach ( $dataArr as $direct ) { //total dfpimpr for the date-li combi if ( isset( $arrayToBeFilled[$direct['DS']['DATE']][$direct['DLI']['LIID']]['COUNTER_TOTALIMPR'] ) ) { $arrayToBeFilled[$direct['DS']['DATE']][$direct['DLI']['LIID']]['COUNTER_TOTALIMPR'] += $direct[0]['DFPIMPR']; }else { $arrayToBeFilled[$direct['DS']['DATE']][$direct['DLI']['LIID']]['COUNTER_TOTALIMPR'] = $direct[0]['DFPIMPR']; } $dfpAdUnit = $direct['AD1']['DFPAD1'].'/'.$direct['AD2']['DFPAD2']; // can go on the first level of the array as not dependent on AD1/AD2-COUNTRY if ( isset( self::$orderLineitemSetting[$direct['DOX']['ORDID']][$direct['DLI']['LIID']]['setting']['is_direct'] ) ) { $arrayToBeFilled[$direct['DS']['DATE']][$direct['DLI']['LIID']][$dfpAdUnit][$direct['DC']['COUNTRYID']]['ISDIRECT'] = self::$orderLineitemSetting[$direct['DOX']['ORDID']][$direct['DLI']['LIID']]['setting']['is_direct']; }else { $arrayToBeFilled[$direct['DS']['DATE']][$direct['DLI']['LIID']][$dfpAdUnit][$direct['DC']['COUNTRYID']]['ISDIRECT'] = 1; } if ( isset( self::$orderLineitemSetting[$direct['DOX']['ORDID']][$direct['DLI']['LIID']]['setting']['is_ron'] ) ) { $arrayToBeFilled[$direct['DS']['DATE']][$direct['DLI']['LIID']][$dfpAdUnit][$direct['DC']['COUNTRYID']]['ISRON'] = self::$orderLineitemSetting[$direct['DOX']['ORDID']][$direct['DLI']['LIID']]['setting']['is_ron']; }else { $arrayToBeFilled[$direct['DS']['DATE']][$direct['DLI']['LIID']][$dfpAdUnit][$direct['DC']…
tagged with: java
has comment: http://stackoverflow.com/comment/35941391

http://stackoverflow.com/q/23294569
has title: declaring function while instantiating a class
tagged with: java
has body: I came across the following java code, and i am not sure what it means. Can we write code in '{' after we instantiate a class , eg new TestClass { */ code goes here */ } But when i try to run the code i do not see 'Z is 10' in the output. Can someone please give me some link where i can get some more info related to this feature of java. class TestClass { int z; public TestClass(){ z=10; } public int getZ(){ return z; } public void setZ(int z){ this.z=z; } } class A { public static void main (String[] args) throws java.lang.Exception { TestClass TC = new TestClass() { public void testprint() { System.out.println("Z is " + getZ()); } }; } }
has answer: http://stackoverflow.com/a/23294648
linked to: http://stackoverflow.com/q/56860
favorite count: 0
upvote count: 3
has answer: http://stackoverflow.com/a/23294683
tagged with: anonymous-inner-class
downvote count: 0
answer count: 5
has answer: http://stackoverflow.com/a/23294943
type: UnansweredQuestion
type: Question
has answer: http://stackoverflow.com/a/23294649
score: 3
has answer: http://stackoverflow.com/a/23294763

http://stackoverflow.com/comment/36174351
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23410454
has text: wtf? why you revert the edit? the tag `jade` is wrong, read the descripton of a tag before you use it!

http://stackoverflow.com/a/23438058
has comment: http://stackoverflow.com/comment/35923899
answers question: http://stackoverflow.com/q/23437939
accepted answer of: http://stackoverflow.com/q/23437939
has body: Using a small SQLite database would be easier to manage. You could have the following columns: sequence_num, an auto-incrementing integer that uniquely identifies each message remote_id, an identifier for the remote partner direction, a boolean flag to indicate send vs receive message, the text of the message You'd also probably want: timestmp, the time the message was sent/received conversation_id, an auto-incrementing integer that uniquely identifies each conversation (as defined by you) and any other data that you'd want to track for the messages. You'd also probably want to add other tables to keep the associated connection data for each remote_id, etc. Edit: Here's an official link to using SQLlite on Android and here is a fairly complete tutorial.
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35923841
has comment: http://stackoverflow.com/comment/35923766
type: Answer
score: 0
has comment: http://stackoverflow.com/comment/35923852

http://stackoverflow.com/a/23341682
answers question: http://stackoverflow.com/q/23341332
upvote count: 1
score: 1
downvote count: 0
type: Answer
has body: It seems you are calling below method for getting web-content. public static String getContent( long groupId, String articleId, String viewMode, String languageId, String xmlRequest) But, you can use below mentioned method which accept templatedId. public static String getContent( long groupId, String articleId, String templateId, String viewMode, String languageId, String xmlRequest)

http://stackoverflow.com/a/23554521
downvote count: 0
answers question: http://stackoverflow.com/q/23448103
type: Answer
upvote count: 3
has comment: http://stackoverflow.com/comment/36144842
score: 3
has comment: http://stackoverflow.com/comment/36171856
has body: Separate your concerns. Define your packaging. This need not happen in a profile; if it does, it must be an activeByDefault profile. Restrict your project based on your requirements. If you want to fail the build, the enforcer plugin will do this for you. If you want to skip building the nar, then you can use your default profile to configure the nar plugin with the skipNar configuration item. In you mac profile, create a new configuration without the skipNar configuration item. This snippet (pulled from the enforce plugin's website, and modified a little) should work for the fail-the-build option. org.apache.maven.plugins maven-enforcer-plugin 1.3.1 enforce-versions enforce mac For the skipNar option, some variation on this may suit you. noBuildNar true com.github.maven-nar nar-maven-plugin <skipNar/> buildNar mac com.github.maven-nar nar-maven-plugin
accepted answer of: http://stackoverflow.com/q/23448103
type: AcceptedAnswer

http://stackoverflow.com/q/23330419
has comment: http://stackoverflow.com/comment/35724405
tagged with: arrays
score: -1
has comment: http://stackoverflow.com/comment/35724350
has body: I was wondering if there is a better way of linking arrays? This is not a language specific question, any and all ideas would be interesting to read more about. Basically, I have an array of nodes. This array is linked to another array with unique IDs. This array is, in turn, linked to an array with x coordinates and this, in turn is linked to another array with y coordinates...You see, it's become quite complex. It makes sense and I can use it like this without a problem, but I can't help thinking there's a better way and someone out there with more skill than I have might be able to help?
has comment: http://stackoverflow.com/comment/35724292
answer count: 1
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23330487
tagged with: c++
tagged with: java
has title: An alternative to multiple linked arrays?
downvote count: 1
type: Question
upvote count: 0
tagged with: algorithm

http://stackoverflow.com/comment/35701438
comment on: http://stackoverflow.com/a/23317954
has text: @user3577160 No problem! Just to let you know, since you're new, you can mark the answer as accepted instead of mentioning it worked in a comment. http://stackoverflow.com/help/someone-answers
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/23386856
has answer: http://stackoverflow.com/a/23404870
score: 1
tagged with: java
type: Question
answer count: 1
downvote count: 0
tagged with: linux
has comment: http://stackoverflow.com/comment/35827350
upvote count: 1
has body: I am trying to read serial using Java: byte[] text = new byte[5]; for(int i = 0;i&lt;5;i++){ text[i] = (byte)in.read(); } For some reason it returns me some weird data. I have tried libraries like RXTX and COMM, but other issues comes then. Is there some way to read everything in raw Java way? Any code snippets would be helpful. Thanks
favorite count: 0
tagged with: tty
accepted answer: http://stackoverflow.com/a/23404870
has title: Read serial (/dev/tty*) fom java
tagged with: serial-port
type: AnsweredQuestion

list
type: Tag
tags question: http://stackoverflow.com/q/23404067
tags question: http://stackoverflow.com/q/23331517
tags question: http://stackoverflow.com/q/23336169
tags question: http://stackoverflow.com/q/23326611
tags question: http://stackoverflow.com/q/23392545
tag name: list
tags question: http://stackoverflow.com/q/23357297
tags question: http://stackoverflow.com/q/23323855
tags question: http://stackoverflow.com/q/23358988
tags question: http://stackoverflow.com/q/23447519
tags question: http://stackoverflow.com/q/23428578
tags question: http://stackoverflow.com/q/23398323
tags question: http://stackoverflow.com/q/23392208
tags question: http://stackoverflow.com/q/23354230
tags question: http://stackoverflow.com/q/23434597
tags question: http://stackoverflow.com/q/23428625
tags question: http://stackoverflow.com/q/23448156
tags question: http://stackoverflow.com/q/23355260
tags question: http://stackoverflow.com/q/23409825
tags question: http://stackoverflow.com/q/23331507
tags question: http://stackoverflow.com/q/23302642
tags question: http://stackoverflow.com/q/23356006
tags question: http://stackoverflow.com/q/23394616
tags question: http://stackoverflow.com/q/23382846
tags question: http://stackoverflow.com/q/23435518
tags question: http://stackoverflow.com/q/23338581
tags question: http://stackoverflow.com/q/23310219

http://stackoverflow.com/comment/35939756
type: Comment
has text: You don't need to call read(byte[]) if you're calling readUTF(). The code I got working is what you posted here with the modifications I suggested above.
comment on: http://stackoverflow.com/a/23441488
type: AnswerComment
score: 0

http://stackoverflow.com/comment/35762580
type: Comment
score: 1
has text: The you can either create a new class which simulates a HashMap (ie, contains key and value), and make an array with the key (number in the array) and value (number of times it appears. Or you can create another 2D array with number on the first row and number of appearances on the second. There are other methods, but that should give you at least some direction.
comment on: http://stackoverflow.com/q/23351134
type: QuestionComment

http://stackoverflow.com/q/23387869
score: 5
has comment: http://stackoverflow.com/comment/46989573
upvote count: 5
tagged with: java
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/67476219
has title: How to deploy SparkJava REST API app to Google App Engine via Eclipse Plugin?
has body: I have built a REST API for my project using SparkJava, and now I want to deploy it to Google App Engine. But after installing Google App Engine plugin in Eclipse i have got no clue how to do it. I have copied the src files from my previous project to a new Web Application Project and renamed the main() as init() as stated here http://www.sparkjava.com/readme.html#title18 and I have also updated the web.xml as stated. But the project doesn't run. Please guide!
answer count: 0
downvote count: 0
tagged with: spark-java
favorite count: 0
has comment: http://stackoverflow.com/comment/47219539
type: Question
tagged with: google-app-engine
linked to: http://stackoverflow.com/q/19783646

http://stackoverflow.com/q/23379143
accepted answer: http://stackoverflow.com/a/23379492
tagged with: time
tagged with: multithreading
has title: How to match Time with my table?
has comment: http://stackoverflow.com/comment/35813766
type: AnsweredQuestion
score: 0
tagged with: java
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/23379492
possible better answer: http://stackoverflow.com/a/23379209
has answer: http://stackoverflow.com/a/23379209
tagged with: sql
has comment: http://stackoverflow.com/comment/35813791
tagged with: scheduled-tasks
has body: My database table contains scheduled jobs with the time at which they will start. Currently I have a continuous thread running that keeps checking if there is job scheduled for this moment. The method gives no exception no errors but the job never runs. According to what I think,I am checking the table for the time entry in an improper fashion and it misses by a second or seconds. This is what I am doing : SELECT job FROM mytable where time = new java.sql.Time(new GregorianCalendar().getTimeInMillis()) The above SQL is inside a continuous thread keeps on running. Is this the correct way for matching the time entries ?
has comment: http://stackoverflow.com/comment/35813755

ant
tags question: http://stackoverflow.com/q/23293852
tags question: http://stackoverflow.com/q/23380539
tags question: http://stackoverflow.com/q/23336004
tags question: http://stackoverflow.com/q/23397440
tags question: http://stackoverflow.com/q/23399865
tags question: http://stackoverflow.com/q/23351036
type: Tag
tags question: http://stackoverflow.com/q/23359351
tags question: http://stackoverflow.com/q/23373020
tags question: http://stackoverflow.com/q/23355301
tags question: http://stackoverflow.com/q/23368290
tags question: http://stackoverflow.com/q/23346057
tag name: ant
tags question: http://stackoverflow.com/q/23434504
tags question: http://stackoverflow.com/q/23442621
tags question: http://stackoverflow.com/q/23361737
tags question: http://stackoverflow.com/q/23405724
tags question: http://stackoverflow.com/q/23450708
tags question: http://stackoverflow.com/q/23304492
tags question: http://stackoverflow.com/q/23321542
tags question: http://stackoverflow.com/q/23392660
tags question: http://stackoverflow.com/q/23335916
tags question: http://stackoverflow.com/q/23340646
tags question: http://stackoverflow.com/q/23404767

http://stackoverflow.com/a/23317391
type: AcceptedAnswer
downvote count: 0
has body: Change your last two strings to: Thread writeThread = new ConnectThread(targetdevice); When you need to start your ConnectThread use start() method: writeThread.start(); //If you need start run() method of ConnectThread.
has comment: http://stackoverflow.com/comment/35700435
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/35700511
has comment: http://stackoverflow.com/comment/35700406
upvote count: 2
accepted answer of: http://stackoverflow.com/q/23317360
answers question: http://stackoverflow.com/q/23317360
has comment: http://stackoverflow.com/comment/35700491

http://stackoverflow.com/a/23389144
type: Answer
accepted answer of: http://stackoverflow.com/q/23389088
score: 2
downvote count: 0
upvote count: 2
has comment: http://stackoverflow.com/comment/35831694
has body: Yes . It retrieves based on insertion order but it doesnt sort , you can use the TreeMap for that And the reason for this is because it implements Hashtable and doubly-linked list Also .values() method returns a collection view of the values contained in this map . it will be in the same order of map implementation
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23389088

http://stackoverflow.com/comment/35872810
type: Comment
type: QuestionComment
has text: I believe only when `a` is null. If `c` is null, then you are just saving that null value to `b`, which shouldn't be an issue. Now, if you had `c.Something` and `c` is null, then you also have an issue.
comment on: http://stackoverflow.com/q/23411023
score: 1

http://stackoverflow.com/a/23350609
answers question: http://stackoverflow.com/q/23350492
downvote count: 0
type: Answer
score: 1
has body: You have to reverse input string because doing it your way most inportant digits are on the right side put hexInput=new StringBuilder(hexInput).reverse().toString(); to reverse sting or simply do power other way like int power=Math.pow(16,hexInput.length()-1); and then at end of loop do power/=16; i would use second method, because you don't have to do extra code.
upvote count: 1

http://stackoverflow.com/q/23420322
score: 1
tagged with: java
upvote count: 1
accepted answer: http://stackoverflow.com/a/23420398
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/23420531
has answer: http://stackoverflow.com/a/23420531
tagged with: data-structures
has body: I am trying to create a Linked list.Here's my code. public class Node{ private String element; private Node next; public Node(String element,Node next){ this.element=element; this.next=next; } public Node(String element){ this(element,null); } public void setElement(String newElem){ element=newElem; } public void setNext(Node newNext){ next=newNext; } public String getElement(){ return element; } public Node getNext(){ return next; } } public class SLinkedList{ protected Node head; protected long size; public SLinkedList(){ head=null; size=0; } public void addElem(String e){ v=new Node(e,head); v.setElement(e); v.setNext(head); head=v; size++; System.out.println(v.getElement()); } public static void main (String args[]){ SLinkedList l=new SLinkedList(); l.addElem("Element"); //System.out.println(l.getElement()); } } My question is when I set public void addElem(String e){ v=new Node(e,head); v.setElement(e); v.setNext(head); head=v; it gives an error .But if I change addItem as public void addElem(String e){ Node v=new Node(e,head); head=v; size++; System.out.println(v.getElement()); } this works fine.Do I need to call always through the constructor?what's the point of having set methods ? Also is there a way I can print out the element other that having System.out.println(v.getElement());inside addElem()
has comment: http://stackoverflow.com/comment/35890651
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/23420398
tagged with: constructor
has title: calling set methods without calling the constructor
type: AnsweredQuestion
tagged with: linked-list

http://stackoverflow.com/comment/35905041
type: Comment
comment on: http://stackoverflow.com/a/23406111
has text: @Alex van den Hoogen right now i am not at home. once i am at home i will retry it and confirm whether l managed it or not. thx in advance.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/135427656
type: AnswerComment
comment on: http://stackoverflow.com/a/73800649
has text: I was able to handle it using static field with the `CookieManager` and set is as default when `CookieHandler.getDefault()` returns `null`. After that every time I load any website in my WebView I remove everything from the cookie store.
score: 0
type: Comment

http://stackoverflow.com/comment/35709654
type: Comment
type: AnswerComment
has text: Good point. I think the System.in stream should then be wrapped in a stream class that avoids that the underlying stream is actually closed.
comment on: http://stackoverflow.com/a/23322715
score: 0

http://stackoverflow.com/comment/35829013
has text: Would you please give an example ? I am not sure how I can do it
comment on: http://stackoverflow.com/a/23387346
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/23304835
score: 0
answers question: http://stackoverflow.com/q/23301882
type: Answer
has body: Thanks for reading. It was a syntax error. I neglected to declare public String...

http://stackoverflow.com/comment/35659923
has text: Then you don't need to do anything, since OFX4J will format it correctly.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23292418
score: 0

collections
tags question: http://stackoverflow.com/q/23412697
tags question: http://stackoverflow.com/q/23445546
tags question: http://stackoverflow.com/q/23403575
tags question: http://stackoverflow.com/q/23362143
tags question: http://stackoverflow.com/q/23443219
tags question: http://stackoverflow.com/q/23391500
tags question: http://stackoverflow.com/q/23332849
tags question: http://stackoverflow.com/q/23376057
tags question: http://stackoverflow.com/q/23328709
tags question: http://stackoverflow.com/q/23334896
tags question: http://stackoverflow.com/q/23337693
tags question: http://stackoverflow.com/q/23432736
tags question: http://stackoverflow.com/q/23419353
type: Tag
tags question: http://stackoverflow.com/q/23344042
tags question: http://stackoverflow.com/q/23429050
tags question: http://stackoverflow.com/q/23395571
tags question: http://stackoverflow.com/q/23416089
tags question: http://stackoverflow.com/q/23450227
tags question: http://stackoverflow.com/q/23337321
tags question: http://stackoverflow.com/q/23412874
tags question: http://stackoverflow.com/q/23421137
tags question: http://stackoverflow.com/q/23428600
tags question: http://stackoverflow.com/q/23302096
tags question: http://stackoverflow.com/q/23335429
tag name: collections
tags question: http://stackoverflow.com/q/23296627
tags question: http://stackoverflow.com/q/23431760
tags question: http://stackoverflow.com/q/23294030
tags question: http://stackoverflow.com/q/23410634
tags question: http://stackoverflow.com/q/23351515
tags question: http://stackoverflow.com/q/23345295
tags question: http://stackoverflow.com/q/23445991
tags question: http://stackoverflow.com/q/23356807
tags question: http://stackoverflow.com/q/23315876
tags question: http://stackoverflow.com/q/23409095

resampling
tags question: http://stackoverflow.com/q/23319172
tag name: resampling
type: Tag

http://stackoverflow.com/comment/35836573
has text: create table users ( userId integer not null, email varchar(50) not null, firstName varchar(20), lastName varchar(20), location varchar(50), primary key (userId) )
score: 0
comment on: http://stackoverflow.com/q/23391629
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23361725
downvote count: 0
score: 3
answers question: http://stackoverflow.com/q/23349546
upvote count: 3
has comment: http://stackoverflow.com/comment/35829788
accepted answer of: http://stackoverflow.com/q/23349546
type: AcceptedAnswer
has body: I suspect that you are not exhausting the Iterator from the ExecutionResult returned by ExecutionEngine#execute(). If you do so, the test will finish quickly without needing to wrap execute() in a transaction. Here's what I think is going on, although I haven't reproduced this in a debugger. ExecutionEngine#execute() creates its own transaction, so it shouldn't be necessary to create your own. However all transactions must be closed. In this case the transaction state is handled by the ExecutionResult its methods as documented here. If you partially consume the results Iterator then the transaction is left in an open state. When you call GraphDatabaseService#shutdown(), it tries to accommodate open transactions by waiting for them to complete before forcing them closed. The stall you see in your test is probably that timeout happening. Of course in this case it is not possible for the transaction to close during the wait because it is held by the same thread that is shutting the database down. Because transactions are tied to threads it would be possible, in principle, for the GraphDatabaseService to detect this case and close the transaction without waiting. However it's probably rare in production code that the same thread is executing transactions and controlling the database, so the extra complexity would not be justified. The simplest way to handle this is to always ensure that you exhaust the results iterators that are returned by the ExecutionEngine.
type: Answer

http://stackoverflow.com/q/23372114
tagged with: spring-data-mongodb
type: UnansweredQuestion
tagged with: java
has body: This example aggregation will throw an IllegalArgumentException Invalid reference 'role'! We got this problem every time after renaming a field after a projection stage. final Aggregation aggregation = newAggregation( // We only like to have the "company" and "empolyee.role" renamed to "role" project("company") .and("employee.role").as("role"), // Group by the **renamed** "role" group("role").count().as("count"), // this will fail because "role" is an invalid reference. limit(2) ); return aggregation; The JSON we are working on looks like this: { // some fields company : { // some fields } employee : { role : { // some fields } } } Thoughts: Here Oliver said It's important to understand that you define aggregations in terms of type properties, not document field names. Is that the reason why we get the exception? If so, how to use the nice aggegration api spring data offers. Update:: This is the Stacktrace i get with version 1.5.0.M1: java.lang.IllegalArgumentException: Invalid reference 'role'! at org.springframework.data.mongodb.core.aggregation.ExposedFieldsAggregationOperationContext.getReference(ExposedFieldsAggregationOperationContext.java:78) at org.springframework.data.mongodb.core.aggregation.ExposedFieldsAggregationOperationContext.getReference(ExposedFieldsAggregationOperationContext.java:62) at org.springframework.data.mongodb.core.aggregation.GroupOperation.toDBObject(GroupOperation.java:292) at org.springframework.data.mongodb.core.aggregation.Aggregation.toDbObject(Aggregation.java:247) at com.xxx.report.adapter.AggrigateByTopic.aggrigateBy(AggrigateByTopic.java:38) at com.xxx.report.adapter.AggrigateByTopicTest.shouldAggrigate(AggrigateByTopicTest.java:38) 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.junit.r…
tagged with: spring-data
upvote count: 7
type: Question
score: 7
has comment: http://stackoverflow.com/comment/35817892
has comment: http://stackoverflow.com/comment/35824422
has answer: http://stackoverflow.com/a/23378432
has title: Invalid Reference while making a group aggregation after projection
answer count: 1
downvote count: 0
favorite count: 0

http://stackoverflow.com/a/23364248
answers question: http://stackoverflow.com/q/23363505
accepted answer of: http://stackoverflow.com/q/23363505
downvote count: 0
has comment: http://stackoverflow.com/comment/35793247
has body: The CLASSPATH variable is the search string that Java Virtual Machine (JVM) uses to locate the JDBC drivers on your computer. If the drivers are not listed in your CLASSPATH variable, you receive the following error message when you try to load the driver: java.lang.ClassNotFoundException: com/microsoft/jdbc/sqlserver/SQLServerDriver The JDBC driver is not part of the Java SDK. If you want to use it, you must set the classpath to include the sqljdbc.jar file or the sqljdbc4.jar file. If the classpath is missing an entry for sqljdbc.jar or sqljdbc4.jar, your application will throw the common "Class not found" exception. The sqljdbc.jar file and sqljdbc4.jar file are installed in the following location: &lt;installation directory&gt;\sqljdbc_&lt;version&gt;\&lt;language&gt;\sqljdbc.jar &lt;installation directory&gt;\sqljdbc_&lt;version&gt;\&lt;language&gt;\sqljdbc4.jar The following is an example of the CLASSPATH statement that is used for a Windows application: CLASSPATH =.;C:\Program Files\Microsoft JDBC Driver 4.0 for SQL Server\sqljdbc_4.0\enu\sqljdbc.jar The following is an example of the CLASSPATH statement that is used for a Unix/Linux application: CLASSPATH =.:/home/usr1/mssqlserverjdbc/Driver/sqljdbc_4.0/enu/sqljdbc.jar You must make sure that the CLASSPATH statement contains only one Microsoft JDBC Driver for SQL Server, such as either sqljdbc.jar or sqljdbc4.jar. For more information, please see: support ms msdn ms
upvote count: 2
type: Answer
score: 2
type: AcceptedAnswer

http://stackoverflow.com/comment/35699263
type: Comment
has text: y's coefficient is returned by `result[1]`.
comment on: http://stackoverflow.com/a/23315975
type: AnswerComment
score: 0

http://stackoverflow.com/a/45430268
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/23341391
upvote count: 2
has body: I came across this issue today while trying to Insert the data into a table. To avoid this error, Just keep all the fields having "LOB" data type at the end of the insert statement. For Example Table1 has 8 Fields (Field1,Field2,.... Field8 etc..), of which Field1 and Field2 are of CLOB data types and the rest are Varchar2 Data types . Then while inserting the data make sure you keep Field1 and Field2 values at the end like below. INSERT INTO TABLE1 ( Field3,Field4,Field5,Field6,Field7,Field8,Field1,Field2) Values ('a','b','c','d','e','f','htgybyvvbshbhabjh','cbsdbvsb')
type: Answer

http://stackoverflow.com/a/23345635
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/35751602
upvote count: 2
has comment: http://stackoverflow.com/comment/35751707
answers question: http://stackoverflow.com/q/23345570
has comment: http://stackoverflow.com/comment/35752249
has body: The postfix operators are not evaluated right-to-left; their side-effect happen after the value is determined (roughly speaking - the JLS specifies the order).
has comment: http://stackoverflow.com/comment/35752402
type: Answer

http://stackoverflow.com/q/23352143
answer count: 2
tagged with: arabic
has title: using java for Arabic NLP
score: 0
has body: I'm working on Arabic natural language processing such as word stemming, tokenization etc. In order to deal with words/chars, I need to write arabic letters in java. So, my question is that is it a good practice to write arabic letters in java directly without encoding? example: which one is better: if(word.startsWith("ت"){...} or if(word.startsWith("\u1578"){...}
tagged with: nlp
has answer: http://stackoverflow.com/a/23353501
type: UnansweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/23352310
type: Question

http://stackoverflow.com/comment/35776048
comment on: http://stackoverflow.com/q/23358988
score: 0
type: Comment
has text: words better described by codes
type: QuestionComment

http://stackoverflow.com/comment/35965705
type: QuestionComment
comment on: http://stackoverflow.com/q/23448848
has text: `public void paint();` instead of the second init, sorry.
score: 0
type: Comment

http://stackoverflow.com/comment/35807174
type: Comment
has text: @SashaSalauyou I've never ever implemented a thread before, and I read that using sleep is not recomended due to the fact that it may freeze the main thread (wich seems pretty strange tbh,but some guy around the web says so...)
score: 0
comment on: http://stackoverflow.com/q/23374060
type: QuestionComment

http://stackoverflow.com/comment/35885763
comment on: http://stackoverflow.com/q/23417490
has text: @Parasanger yes, but I am not convinced that it is necessary for this, or how that library solves this particular problem
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35890162
score: 0
type: Comment
has text: What is the different between using [frame.getContentPane().add(buttonsPanel, BorderLayout.SOUTH);] and [frame.getContentPane().add( BorderLayout.SOUTH, buttonsPanel);] ?
comment on: http://stackoverflow.com/a/23415555
type: AnswerComment

http://stackoverflow.com/comment/35896398
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23422782
has text: @user3585120 Then I can't help you. You need to do something like this, but I don't know how. The second answer looks very helpful to me, but there might also be better links...
score: 0

http://stackoverflow.com/a/23322723
upvote count: 2
has comment: http://stackoverflow.com/comment/35714253
has comment: http://stackoverflow.com/comment/35713404
has comment: http://stackoverflow.com/comment/35710712
has comment: http://stackoverflow.com/comment/35709877
has comment: http://stackoverflow.com/comment/35710466
has comment: http://stackoverflow.com/comment/35710774
has comment: http://stackoverflow.com/comment/35711131
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35709940
has comment: http://stackoverflow.com/comment/35711477
has comment: http://stackoverflow.com/comment/35716267
has comment: http://stackoverflow.com/comment/35714755
accepted answer of: http://stackoverflow.com/q/23322564
has comment: http://stackoverflow.com/comment/35710409
has comment: http://stackoverflow.com/comment/35710988
has comment: http://stackoverflow.com/comment/35713337
has comment: http://stackoverflow.com/comment/35712527
has comment: http://stackoverflow.com/comment/35714654
answers question: http://stackoverflow.com/q/23322564
has comment: http://stackoverflow.com/comment/35713240
has comment: http://stackoverflow.com/comment/35714097
has comment: http://stackoverflow.com/comment/35710739
type: Answer
has comment: http://stackoverflow.com/comment/35712336
has comment: http://stackoverflow.com/comment/35714530
has comment: http://stackoverflow.com/comment/35713093
has comment: http://stackoverflow.com/comment/35713225
score: 2
has comment: http://stackoverflow.com/comment/35711081
downvote count: 0
has comment: http://stackoverflow.com/comment/35711523
has body: " or if there is a way to disable the sizing of the window completely." You can set the resizable property of the frame to false. From NetBeans GUI Builder Highlight/select the frame component from the design view, or from the navigator window. Go to the properties window on the right and look for the property resizable and make sure it's unchecked "I also want to ensure that the image size, its parent JLabel's size, JPanel's size will all adjust to the frame when the I change the size of the window" One way is to paint the background onto the background panel, instead of using a label with an icon. You can see an example of that here. For the GUI Builder, the easiest way (without having to edit the auto-generated code, which I don't recommend, if you don't know what you are doing) is to use a JPanel form instead of a JFrame form. Paint on the JPanel form, then you can add that JPanel form to the JFrame form. You can see here for an easy way to add the JPanel form to the JFrame form. See Performing Custom Painting to learn more about painting Can also have a look at this StretchIcon that you can use with a label. UPDATE So your JPanel form class will ultimately look something like this public class PanelForm extends javax.swing.JPanel { private BufferedImage image; public PanelForm() { try { image = ImageIO.read(getClass().getResource("/path/to/image/png")); } catch (IOException ex) { ex.printStackTrace(); } } @Override protected void paintComponent(Graphics g) { super.paintComponent(g); g.drawImage(image, 0, 0, getWidth(), getHeight(), this); } @Override public Dimension getPreferredSize() { return new Dimension(500, 500); } public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable(){ public void run() { JFrame frame = new JFrame(); frame.add(new PanelForm()); // &lt;--- add it here frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); } }); } }

http://stackoverflow.com/comment/35721284
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/23328794
type: Comment
has text: @LuiggiMendoza, thanks for noticing. However, interfaces are just a layout for a class, I'm not sure you can instantiate an interface. I'm reading through that post right now.

http://stackoverflow.com/comment/35860118
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23404352
has text: It worked. Thank you. Why does it do this??
type: Comment

http://stackoverflow.com/q/23422118
tagged with: mysql
type: UnansweredQuestion
tagged with: servlets
has title: Id is too long when it access through session in jsp.
tagged with: jsp
has answer: http://stackoverflow.com/a/23422182
has body: I access the customer id and save it in order table as foriegn key against his current order record is save successfully but customer id is too long I get it as ( String user= session.getId();) but in database is look like as(489B37FC975A6B831EAA685124DC8A38) I have much confusion how to solve it? Thanks
type: Question
has comment: http://stackoverflow.com/comment/35893938
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/35893977
tagged with: session
tagged with: java

http://stackoverflow.com/a/23365894
score: 1
has comment: http://stackoverflow.com/comment/35789174
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23365404
has body: You need to specify the android namespace prefix on the root element of the XML document, then add the name attribute using the same namespace. Namespace ns = Namespace.getNamespace( "android" ); Element e = new Element( "uses-permission", ns ); e.setAttribute( "name", "android.permission.INTERNET", ns );
answers question: http://stackoverflow.com/q/23365404
downvote count: 0
type: Answer
upvote count: 1

http://stackoverflow.com/a/23353307
upvote count: 1
has body: Your issue appears to be with Java generics. Generics are being used here in conjunction with ArrayList to tell Java what type of Object you'd like to store in that ArrayList. If you want to create an ArrayList that stores a particular variety of object, say instances of a class MyClass that you've defined elsewhere, then you can do ArrayList&lt;MyClass&gt; myObjs = new ArrayList&lt;MyClass&gt;(); to instantiate an ArrayList that can hold only objects of type MyClass. You mention that the ArrayList array that i mentioned above is a property of each these objects which I take to mean that the Objects contained in the ArrayList&lt;Object&gt; called objects that you pass into your Search method are instances of a particular class (continuing the example from earlier, MyClass). That class contains the ArrayList&lt;String&gt; that you'd like to iterate over as instance data. The issue is that you haven't told Java that the ArrayList&lt;Object&gt; holds instances of MyClass, so when you get something out of objects, Java doesn't know that it's of type MyClass. (To be specific, the compiler doesn't know that.) If you want to access the instance data of an object, then you're going to have to tell Java what sort of thing you're accessing that data from. The Java compiler is very careful about what types objects are, and what operations are defined on each object. If you attempt to access instance data from an instance of MyClass, but the compiler thinks that instance is of type Object, then the compiler will be very upset with you (since it doesn't know whether the instance in question actually has the data you're trying to access--it might be some other kind of object!). What you need to do is tell the compiler that you can only store instances of MyClass in your ArrayList, so that the compiler will know that objects in that ArrayList have the instance data you want to access.
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/23351445
score: 1

http://stackoverflow.com/comment/83442384
comment on: http://stackoverflow.com/q/23338937
type: Comment
type: QuestionComment
has text: See https://stackoverflow.com/a/34597423/905686
score: 0

http://stackoverflow.com/q/23326571
has comment: http://stackoverflow.com/comment/35716961
answer count: 2
downvote count: 0
accepted answer: http://stackoverflow.com/a/23326585
favorite count: 0
tagged with: shortcut
linked to: http://stackoverflow.com/q/224311
type: AnsweredQuestion
score: 2
has title: Reverse a boolean value?
has comment: http://stackoverflow.com/comment/35717039
duplicate of: http://stackoverflow.com/q/224311
upvote count: 2
has comment: http://stackoverflow.com/comment/35716890
has answer: http://stackoverflow.com/a/23326585
type: Question
has body: In Java (or, to be honest, any computer language), to increment an int, you do as so: // Option 1 - efficient int x = 0; x++; // x = 1 // Option 2 - works, but is ugly int y = 0; y = y + 1; // y = 1; How would you do this to a boolean? // Standard way to // oppose a boolean boolean isTrue = false; if(isTrue){ isTrue = false; } else if(!isTrue){ isTrue = true; } Is there not a shortcut to change a boolean? For example, if the boolean was true, is there a way to change it with just a small shortcut like x++;?
has answer: http://stackoverflow.com/a/23326582
tagged with: java
tagged with: boolean
possible better answer: http://stackoverflow.com/a/23326582

http://stackoverflow.com/comment/35728616
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23332781
type: Comment
has text: your logcat says: length=1; index=1. Which means your string[] has only one item. Try to debug and inspect text and check it's value.

http://stackoverflow.com/a/23354607
has comment: http://stackoverflow.com/comment/35768780
has comment: http://stackoverflow.com/comment/35768754
upvote count: 1
has comment: http://stackoverflow.com/comment/35768772
has body: Try this: line = line.trim().replaceAll("\\s+", " "); element = line.split(" ");
type: Answer
answers question: http://stackoverflow.com/q/23354549
downvote count: 0
has comment: http://stackoverflow.com/comment/35769281
score: 1
has comment: http://stackoverflow.com/comment/35768946
has comment: http://stackoverflow.com/comment/35768841
has comment: http://stackoverflow.com/comment/35768822
has comment: http://stackoverflow.com/comment/35768731
has comment: http://stackoverflow.com/comment/35769247

http://stackoverflow.com/q/23416965
tagged with: java
has answer: http://stackoverflow.com/a/23416991
has comment: http://stackoverflow.com/comment/35884621
type: Question
has comment: http://stackoverflow.com/comment/35906507
has body: I would like to convert below if conditon into java regular expression. The var will be coming as input and it can be any number from -1, 1, -2, 2 upto -20, 20. I'm looking for a code sample. Any help will be appreciated. Thanks. if (var == 1 || var == -1 || var == 2 || var == -2 || var == 3 || var == -3 || var == 4 || var == -4 || var == 5 || var == -5 || var == 10 || var == -10 || var == 11 || var == -11 || var == 12 || var == -12 || var == 14 || var == -14 || var == 16 || var == -16 || var == 17 || var == -17 || var == 19 || var == -19 || var == 20 || var == -20){ dosomething; }
has comment: http://stackoverflow.com/comment/35885618
has answer: http://stackoverflow.com/a/23417047
answer count: 3
downvote count: 3
has comment: http://stackoverflow.com/comment/35907056
has comment: http://stackoverflow.com/comment/35910998
favorite count: 0
type: UnansweredQuestion
score: -3
has answer: http://stackoverflow.com/a/23417216
upvote count: 0
has title: Java regular expression

http://stackoverflow.com/comment/35705975
comment on: http://stackoverflow.com/q/23320680
has text: I think running variable should be volatile because Java caches the runnig variable value and when the stop method exams it in if clause the cached value will returned.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/66952889
score: 0
type: Answer
has body: A web application is always written for users, so it is always user-based. (Or I missed something? ) Scenario First: methodB should be synchronized, but it will create a performance problem as only one thread can access it at a time. Scenario Second: it will work, but maybe creating an object pool will be better, as objects will not be required to be garbage collected.
answers question: http://stackoverflow.com/q/23356200

http://stackoverflow.com/comment/35931776
score: 0
type: AnswerComment
has text: yea it returns a float which represent the load status. Check if it returns correc tif you dont use the *100. or change it to * 100.0f
type: Comment
comment on: http://stackoverflow.com/a/23442205

http://stackoverflow.com/comment/35886794
type: Comment
comment on: http://stackoverflow.com/a/23418211
score: 0
has text: Well thats a nice workaround! it seems to work...why on earth I didnt try that myself lol
type: AnswerComment

http://stackoverflow.com/comment/35941595
comment on: http://stackoverflow.com/a/23447070
score: 0
type: AnswerComment
type: Comment
has text: And from mysqltut, using `java -cp lib/mysql-connector-java-5.1.30-bin.jar src/zetcode.Version` as you suggested does not work. It only returns `Error: Could not find or load main class src.zetcode.Version` I believe when executing a class file you must be in the package folder hence why only zetcode.Version is recognized when I'm in src.

http://stackoverflow.com/q/23440418
favorite count: 0
has answer: http://stackoverflow.com/a/23440465
has comment: http://stackoverflow.com/comment/35928689
upvote count: 2
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23440495
downvote count: 1
tagged with: java
tagged with: eclipse
type: Question
answer count: 2
has body: I want to store a database along with apk file but the application doesnt seem to find the database when i tried to hard code the path. I was using this for hard coding the path but doesnt work. private final String DB_PATH="/data/data/com.example.shopkart/databases/"; private final String Db_NAME = "dbshopkart.db"; How do i set the path for the above database using Environment.getExternalStorageDirectory().getAbsolutePath() please help.. EDIT: my datamanager class public class openingclass extends SQLiteOpenHelper { public openingclass(Context c) { super(c, Db_NAME, null, DB_VERSION); createDataBase(); } public void createDataBase() { boolean dbExist; try { dbExist = checkDataBase(); } catch (SQLiteException e) { e.printStackTrace(); throw new Error("database dose not exist"); } if (dbExist) { //do nothing - database already exist } else { try { copyDataBase(); } catch (IOException e) { e.printStackTrace(); throw new Error("Error copying database"); } //By calling this method and empty database will be created into the default system path //of your application so we are gonna be able to overwrite that database with our database. this.getReadableDatabase(); } } /** * Check if the database already exist to avoid re-copying the file each time you open the application. * * @return true if it exists, false if it doesn't */ private boolean checkDataBase() { SQLiteDatabase checkDB = null; try { String myPath = DB_PATH + "/" + Db_NAME; checkDB = SQLiteDatabase.openDatabase(myPath, null, SQLiteDatabase.OPEN_READONLY); } catch (SQLiteException e) { //database does't exist yet. throw new Error("database does't exist yet."); } if (checkDB != null) { checkDB.close(); } return checkDB != null ? true : false; } /** * Copies your database from your local assets-folder to the just created empty database in the * system folder, from where it can be accessed and handled. * This is done by transfering bytestream. */ private void copyDataBase() throws IOException { //copyDataBase(); //…
has comment: http://stackoverflow.com/comment/35931253
has comment: http://stackoverflow.com/comment/35928669
has title: Using Environment.getExternalStorageDirectory().getAbsolutePath() for setting path
tagged with: android
has comment: http://stackoverflow.com/comment/35928659
has comment: http://stackoverflow.com/comment/35928285
score: 1

http://stackoverflow.com/comment/35870141
has text: hey there, it still doesnt work >.<
comment on: http://stackoverflow.com/q/23409217
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23463188
answers question: http://stackoverflow.com/q/23354680
score: 7
has body: I was continuing to think about this, and had a thought which I just tested out which allows content-assist to work, albeit under less-Groovy conditions: It appears that the root of the problem is that Groovy Eclipse can't do auto-complete on Java objects if they are declared in a Groovy way using def, i.e.: def fooJava = [2, "baz"] as FooJava def fooJava2 = new FooJava(3, "bar") even though in both of these cases, the type is known at compile time. I suspect it has something to do with the fact that def is essentially an alias for Object, and even though the type is technically known, it is probably treated as Object, and so that's the type on which the content-assist operates. If I declare it in the traditional Java way, i.e.: FooJava fooJava3 = new FooJava(4, "foo") Content assist then allows me to find the members, methods, etc. of the FooJava object. So, I can certainly do this in the future to work around the issue, but I do wonder if there is any way to essentially have my cake and eat it too. i.e. Has anyone found a way to get content assist to work on Java objects declared via the def syntax, so long as the type is known?
has comment: http://stackoverflow.com/comment/39499141
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/64483432
downvote count: 0
has comment: http://stackoverflow.com/comment/125748596
has comment: http://stackoverflow.com/comment/47022278
type: Answer
has comment: http://stackoverflow.com/comment/64483727
has comment: http://stackoverflow.com/comment/64482405
has comment: http://stackoverflow.com/comment/64485975
has comment: http://stackoverflow.com/comment/49377314
has comment: http://stackoverflow.com/comment/49437217
upvote count: 7
accepted answer of: http://stackoverflow.com/q/23354680
has comment: http://stackoverflow.com/comment/49436596
has comment: http://stackoverflow.com/comment/36873811

http://stackoverflow.com/comment/35764612
has text: So you have reinvented [`ArrayDeque`](http://docs.oracle.com/javase/7/docs/api/java/util/ArrayDeque.html)… So why don’t you compare your implementation with Oracle’s and if you see differences try to find the reasoning behind them?
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/23352112
type: Comment

http://stackoverflow.com/q/23311341
has comment: http://stackoverflow.com/comment/35689030
tagged with: arrays
score: -1
answer count: 1
has body: Basically, I am loading spritesheets for a game, but I've hit a bug where the sheets can't be bigger than 256x256, this is obviously a problem for large animation sheets. The main problem is when I load the image as a BufferedImage through the ImageIO.read() method, then use the getRGB() method from BufferedImage, it outputs to an int[]. This is fine, except for when the int array needs to be bigger than 256x256(as that's the maximum integer value). In the end the values are being converted from the int[] to an int[][], so the final size of the array isn't an issue, but BufferedImage.getRGB() only outputs to a one dimensional int array, so how can I do this with something bigger than that? Here's a rundown of my code. This is when I tried to analyze the image in two different pieces with different int[] then put them both into the int[][]. private void load() { int width = 0, height = 0; int[] pixelsr = null, pixelsrr = null; try { BufferedImage image = ImageIO.read(new FileInputStream(path)); width = image.getWidth(); height = image.getHeight(); pixels = new int[width][height]; if (width &gt;= 256 || height &gt;= 256) { pixelsr = new int[256 * 256]; image.getRGB(0, 0, w, h, pixelsr, 0, 256); pixelsrr = new int[(width - 256) * (height - 256)]; image.getRGB(256, 256, width, height, pixelsr, 0, width - 256); for (int i = 0; i &lt; pixelsr.length; i++) { for (int ii = 0; ii &lt; 256; ii++) { for (int iii = 0; iii &lt; 256; iii++) { pixels[ii][iii] = pixelsr[ii + iii * 256]; } } } for (int i = 0; i &lt; pixelsrr.length; i++) { for (int ii = 256; ii &lt; width - 256; ii++) { for (int iii = 256; iii &lt; height - 256; iii++) { pixels[ii][iii] = pixelsr[ii + iii * (width - 256)]; } } } } else { pixelsr = new int[width * height]; image.getRGB(0, 0, w, h, pixelsr, 0, width); for (int i = 0; i &lt; pixelsr.length; i++) { for (int ii = 0; ii &lt; width; ii++) { for (int iii = 0; iii &lt; height; iii++) { pixels[ii][iii] = pixelsr[ii + iii * width]; } } } } } catch (IOException…
has comment: http://stackoverflow.com/comment/35690779
favorite count: 0
downvote count: 2
has answer: http://stackoverflow.com/a/23311407
type: AnsweredQuestion
tagged with: java
has title: Using BufferedImage method getRGB() with an image bigger than 256x256
accepted answer: http://stackoverflow.com/a/23311407
upvote count: 1
tagged with: bufferedimage
type: Question

http://stackoverflow.com/a/23348085
score: 0
answers question: http://stackoverflow.com/q/23347425
type: Answer
has comment: http://stackoverflow.com/comment/35756103
has comment: http://stackoverflow.com/comment/35756167
has comment: http://stackoverflow.com/comment/35756824
has body: The fact that you see the pom, does not mean nothing...! Reading the log, i think it's a simple connection error, the log say "connection refused by the proxy"... so maybe you have a proxy and have not configured (or maybe not configured in a correct way) the proxy setting inside the setting.xml.. Can you paste your setting.xml file....?

http://stackoverflow.com/comment/35847510
comment on: http://stackoverflow.com/q/23397353
has text: If MyTester and Utils are two different project then they need the dependency jar in their classpath.
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/comment/35972660
type: Comment
comment on: http://stackoverflow.com/a/23398555
has text: true, that's a better way of saying it, I'll update the answer.
type: AnswerComment
score: 0

http://stackoverflow.com/q/23424799
tagged with: jsp
has body: I'm creating a simple Remember Me form using Jsp & Servlels . Here's my code :- For new.jsp:- <% Cookie c[] = request.getCookies(); String v1 = ""; String v2 = ""; int i = 0; for(i = 0 ; i < c.length ; i++) { String ck = c[i].getName(); // NullPointerException if(ck == null) { v1 = ""; v2 = ""; } else if(ck.equals("userName")) { v1 = c[i].getValue(); } else if(ck.equals("userPass")) { v2 = c[i].getValue(); } } %> <%@page contentType="text/html" pageEncoding="UTF-8"%> JSP Page Remember Me Enter name : <input type="name" name="user" value=<%=v1%>> Enter password : <input type="password" name="pass" value=<%=v2%>> Remember Me for Rem.java:- PrintWriter out = response.getWriter(); String user = request.getParameter("user"); String pass = request.getParameter("pass"); String me = request.getParameter("me"); int flag = 0; if("batman".equals(user) && "batman".equals(pass) && me != null) { flag = 1; Cookie userName = new Cookie("userName" , user); Cookie userPass = new Cookie("userPass" , pass); userName.setMaxAge(60*60*24*7); userPass.setMaxAge(60*60*24*7); response.addCookie(userName); response.addCookie(userPass); response.sendRedirect("wel.html"); } else if("batman".equals(user) && "batman".equals(pass) && me == null) { flag = 1; response.sendRedirect("wel.html"); } if(flag == 0) { RequestDispatcher dis = request.getRequestDispatcher("new.jsp"); out.println(" Please enter correct username or password</h4</center "); dis.include(request, response); } But whenever I run it , I get a NullPointerException(location marked above).The new.jsp is the first page that is run . Could that be a problem . But I've already checked for null . What could be the problem ? Please help ! Fast !! Thank You !
has answer: http://stackoverflow.com/a/23425069
has comment: http://stackoverflow.com/comment/35898632
has comment: http://stackoverflow.com/comment/35898725
type: AnsweredQuestion
has title: NullPointerException when creating an option for Remember Me using JSP & Servlets
tagged with: java
accepted answer: http://stackoverflow.com/a/23425069
type: Question
tagged with: servlets
score: 0
tagged with: nullpointerexception
answer count: 1

http://stackoverflow.com/comment/35880880
type: QuestionComment
comment on: http://stackoverflow.com/q/23414138
score: 0
has text: It isn't, the same issue applies in both cases a new instance (outside of Spring) is created.
type: Comment

http://stackoverflow.com/comment/35895284
has text: Thanks @merlin2011, just give me few minutes to check & than let u know
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23421739
type: QuestionComment

http://stackoverflow.com/comment/35659935
type: AnswerComment
has text: Could you show me how I would move openBT to a separate thread?
type: Comment
comment on: http://stackoverflow.com/a/23292569
score: 0

http://stackoverflow.com/a/23373788
has comment: http://stackoverflow.com/comment/35804567
has comment: http://stackoverflow.com/comment/35804830
accepted answer of: http://stackoverflow.com/q/23373714
type: Answer
answers question: http://stackoverflow.com/q/23373714
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/35804051
has comment: http://stackoverflow.com/comment/35809523
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35804258
has body: By looking at the DecimalFormat docs, I can say, that . is used for decimal separator. If you would like to group numbers, you should use , instead. Also you should specify locale, so the following code should work fine: DecimalFormat decimalFormat = new DecimalFormat(); decimalFormat.setGroupingSize(3); DecimalFormatSymbols decimalFormatSymbols = new DecimalFormatSymbols(); decimalFormatSymbols.setGroupingSeparator('.'); decimalFormat.setDecimalFormatSymbols(decimalFormatSymbols); System.out.println(decimalFormat.format(value));
downvote count: 0

http://stackoverflow.com/comment/35895458
has text: @krishna: I got output using same code. and my console is also there.. then check your side.. where is mistake?
score: 0
comment on: http://stackoverflow.com/a/23422008
type: AnswerComment
type: Comment

http://stackoverflow.com/q/23399919
type: Question
has comment: http://stackoverflow.com/comment/35852193
tagged with: sql
tagged with: jpa
downvote count: 0
tagged with: inheritance
has comment: http://stackoverflow.com/comment/35852513
favorite count: 0
has comment: http://stackoverflow.com/comment/35852163
answer count: 0
type: UnansweredQuestion
upvote count: 1
linked to: http://stackoverflow.com/q/13186572
score: 1
tagged with: java
tagged with: hibernate
has body: The following snippet is retrieving a Player object instance from the database. How can I make it retrieve only the User instance and then use another query to retrieve a Player instance? Query q = em.createQuery("SELECT u FROM User u WHERE email = :email", User.class); User u = (User) q.setParameter("email", email).getSingleResult(); Inherance type is Joined. Thank you, Hibernate 4.3.5.Final EDIT: I could find a question that matches this and already flagged my question as duplicate. Thank you!
has title: Getting super class with JPA Hibernate

http://stackoverflow.com/q/23319894
has comment: http://stackoverflow.com/comment/35704576
tagged with: java
has body: I want a regex for my output |Term Loan-amount or |Bill Purchase / Discounting (Inland)-amount or |PARTNER_NAME-PAN should accept only in this fashion.
has answer: http://stackoverflow.com/a/23319964
accepted answer: http://stackoverflow.com/a/23319964
type: Question
has comment: http://stackoverflow.com/comment/35704586
score: -1
has title: Regex expression for |abc-amount
answer count: 1
downvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/35704554
has comment: http://stackoverflow.com/comment/35704582
tagged with: regex
type: AnsweredQuestion
upvote count: 0

http://stackoverflow.com/comment/35925973
type: Comment
type: QuestionComment
has text: You have to sort it and then use the original. You don't get a brand new array when you call `Arrays.sort()`. That's the whole point of it being `void` - it doesn't return something new; it just manipulates the original.
comment on: http://stackoverflow.com/q/23436868
score: 0

http://stackoverflow.com/comment/35832406
score: 0
comment on: http://stackoverflow.com/q/23389221
type: Comment
has text: When you click Project in the title bar you should see a tick left of `Build Automatically`, if not click it one time.
type: QuestionComment

http://stackoverflow.com/comment/35675019
has text: Does the list contain heavy objects such as images? Cause that could be solved by lazy loading, would speed up any heavy views I would think. Only loading them at the point in the list where the user stops scrolling.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23303248
type: Comment

http://stackoverflow.com/q/23400369
favorite count: 0
accepted answer: http://stackoverflow.com/a/23401599
tagged with: android
has title: How do I write a method using badlogic framework for iterating through the numbers to print?
has body: I have created a game using Mr.Nom framework from badlogic. How do I iterate through each character and print the scores? Help.
tagged with: java
downvote count: 2
type: Question
has comment: http://stackoverflow.com/comment/35853123
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23401599
score: -2
upvote count: 0
answer count: 1

http://stackoverflow.com/comment/53632279
has text: There will be no complete iteration if sheet contain empty cell though value of last cell is fine.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23371007

http://stackoverflow.com/q/23403447
type: UnansweredQuestion
downvote count: 2
has title: Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 1 on an input file program
tagged with: swing
has answer: http://stackoverflow.com/a/23403460
has answer: http://stackoverflow.com/a/23403853
tagged with: java
tagged with: indexoutofboundsexception
type: Question
has answer: http://stackoverflow.com/a/23403480
upvote count: 0
score: -2
has comment: http://stackoverflow.com/comment/35858248
favorite count: 0
has answer: http://stackoverflow.com/a/23403495
answer count: 4
has body: I am receiving a message: Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 1 when trying to run the below code. This program is taking the input from a text file, conducting some salary numbers, and outputting their gross pay. This is the contents of the text file: http://m.uploadedit.com/b034/139892732049.txt package payroll; import java.io.File; import java.io.FileNotFoundException; import java.util.Scanner; import javax.swing.JOptionPane; public class PayRoll { private String empName; private int hours; private int hourlyPayRate; public PayRoll(String name, int hh, int rr) { empName = name; hours = hh; hourlyPayRate = rr; } public String getName() { return empName; } public double getPay() { if(hours &lt;= 40) return hours * hourlyPayRate; else return (40 * hourlyPayRate) + (hours - 40) * 1.5 * hourlyPayRate; } public static void main(String[] args) { Scanner inFile = null; try { inFile = new Scanner(new File("payroll.txt")); } catch(FileNotFoundException e) { e.printStackTrace(); } String name; String first; String last; int hh; int rr; String result = "Details of employees:\n"; while(inFile.hasNextLine()) { String line = inFile.nextLine(); String tokens[] = line.split(" "); first = tokens[0]; last = tokens[1]; hh = Integer.parseInt(tokens[2]); rr = Integer.parseInt(tokens[3]); name = first + " " + last; PayRoll payroll = new PayRoll(name, hh, rr); result += "Name: " + payroll.getName() + ", GrossPay: $" + payroll.getPay() + "\n"; } JOptionPane.showMessageDialog(null, result); inFile.close(); } }

http://stackoverflow.com/comment/35848628
has text: If I had to guess, it's trying to grab the window before the scene is completely shown, which is causing your null-pointer exception, you might have to add a `WindowEvent.WINDOW_SHOWN` handler to the stage in that point and then try to get the window once it's shown
comment on: http://stackoverflow.com/q/23397703
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35655447
comment on: http://stackoverflow.com/a/23291712
type: Comment
has text: Phase is an enum. Why can't an enum have a changing lifespan? If every ESprite gets its own set of Phases and each Phase gets its own lifespan - it makes sense on paper, no?
score: 0
type: AnswerComment

http://stackoverflow.com/comment/35887919
type: Comment
type: QuestionComment
has text: Besides declaring an additional `JavaCompile` task, you could also declare an additional source set, which comes with its own `JavaCompile` task for free.
comment on: http://stackoverflow.com/q/23418005
score: 1

http://stackoverflow.com/comment/42050369
type: QuestionComment
comment on: http://stackoverflow.com/q/23359727
score: 0
has text: gettings this in the logs of a grails project. Everything works fine though.....
type: Comment

http://stackoverflow.com/q/23414090
type: AnsweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/25935354
has answer: http://stackoverflow.com/a/23414798
favorite count: 0
type: Question
linked to: http://stackoverflow.com/q/501653
upvote count: 161
has title: What is the difference between up-casting and down-casting with respect to class variable
tagged with: downcast
tagged with: upcasting
tagged with: class-variables
accepted answer: http://stackoverflow.com/a/23414798
has answer: http://stackoverflow.com/a/23415026
has answer: http://stackoverflow.com/a/39203649
has body: What is the difference between up-casting and down-casting with respect to class variable? For example in the following program class Animal contains only one method but Dog class contains two methods, then how we cast the Dog variable to the Animal Variable. If casting is done then how can we call the Dog's another method with Animal's variable. class Animal { public void callme() { System.out.println("In callme of Animal"); } } class Dog extends Animal { public void callme() { System.out.println("In callme of Dog"); } public void callme2() { System.out.println("In callme2 of Dog"); } } public class UseAnimlas { public static void main (String [] args) { Dog d = new Dog(); Animal a = (Animal)d; d.callme(); a.callme(); ((Dog) a).callme2(); } }
has answer: http://stackoverflow.com/a/34917315
has comment: http://stackoverflow.com/comment/57260449
has comment: http://stackoverflow.com/comment/35879957
has comment: http://stackoverflow.com/comment/57199124
has answer: http://stackoverflow.com/a/35547692
score: 161
answer count: 9
tagged with: java
possible better answer: http://stackoverflow.com/a/34917315
has answer: http://stackoverflow.com/a/33623521
has comment: http://stackoverflow.com/comment/47943978
has answer: http://stackoverflow.com/a/52682421
has answer: http://stackoverflow.com/a/32813618
tagged with: casting

http://stackoverflow.com/a/23459917
has body: Try below code for many-to-many. Also, use variable names instead of column names if you use HQL @ManyToMany(mappedBy = "course", cascade = {CascadeType.ALL}) @LazyCollection(LazyCollectionOption.FALSE) @JsonIgnore private List&lt;ModelStudent&gt; student;
downvote count: 0
answers question: http://stackoverflow.com/q/23448817
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/comment/53373203
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/32766382
has text: Downvote? What for? For providing a way to the answer?
score: 0

http://stackoverflow.com/q/23445991
has comment: http://stackoverflow.com/comment/35937778
type: Question
has title: Accesing a single Set as value of a Map
has comment: http://stackoverflow.com/comment/35937822
tagged with: dictionary
has answer: http://stackoverflow.com/a/23446100
score: 0
tagged with: collections
answer count: 1
tagged with: syntax
tagged with: java
accepted answer: http://stackoverflow.com/a/23446100
has body: I need to display a value from a key-value pair of a Map when the value is a set. The key which value will be displayed can be specified as argument of method. I am not sure what the syntax is to access this. I did it successfully when it was a string. Can anyone make any suggestsion of the below: HashMap&lt;String, Set&lt;Integer&gt;&gt; map = new HashMap&lt;&gt;(); Set&lt;Integer&gt; theValues = new Set&lt;&gt;(); public void mapValue(String aString) { if(map.containsKey(aString)) { System.out.println ("The value of the set is " + theValues ); // what can go here to show the elements of the set that // is the value map given the key? } }
type: AnsweredQuestion

http://stackoverflow.com/a/23328373
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/23328331
has body: Define an array arr of ArrayLists of Strings and index this array from 0 to say 255. The char type can be converted up to int so you can use char as index of your array. So just do arr[firstLetter].add(word) where firstLetter is the char word.charAt(0).
upvote count: 1
has comment: http://stackoverflow.com/comment/35720594
type: Answer

http://stackoverflow.com/q/23295981
tagged with: java
tagged with: mysql
type: Question
has title: MySQLSyntaxErrorException: Error in SQL Syntax
score: 0
tagged with: sql
answer count: 1
tagged with: jdbc
has answer: http://stackoverflow.com/a/23296061
accepted answer: http://stackoverflow.com/a/23296061
type: AnsweredQuestion
has body: Please have a look at the following code public int insert(int index, String hashWord) { String str=""; int result=0; int returnResult=0; try { con.setAutoCommit(false); PreparedStatement ps = con.prepareStatement("insert into Key_Word (key,hashed_word) values(?,?)"); ps.setInt(1, index); ps.setString(2, hashWord); result = ps.executeUpdate(); con.commit(); if(result&gt;0) { returnResult = 1; } else { returnResult = -1; System.out.println( index+" failed to update"); } } catch(SQLException s) { returnResult = -1; s.printStackTrace(); try { con.rollback(); System.out.println(index+" Exception Occured. Update Failed"); } catch (SQLException ex) { ex.printStackTrace(); str = index+" Exception Occured. Update Failed. Rollback Failed"; } } return returnResult; } When I run this code, it gives the below error. com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'key,hashed_word) values(0,'001')' at line 1 0 Exception Occured. Update Failed at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) Operation Broke Completed at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:525) at com.mysql.jdbc.Util.handleNewInstance(Util.java:411) at com.mysql.jdbc.Util.getInstance(Util.java:386) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1054) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4237) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4169) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2617) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2778) at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2834) at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedState…

http://stackoverflow.com/a/23440305
has body: However, it seems to do strange things when all the elements added have odd-numbered widths. It gets stranger than that. The size of the parent container also affects the layout. I replaced the f.pack() with: f.setSize(150, 100); and it doesn't work. This is basically the scenario you described since this method or the f.pack() will result in the parent container to have an even width and the layout doesn't work. However, if you use: f.setSize(151, 100); the parent container has an odd width and the layout does work properly. Another strange observation. I tried adding multiple components to the Box. The problem only seems to happen when the last component added has an odd width. Anyway, I have no idea what the box layout is doing, but it sure seems like a bug to me. The solution is to use a different layout manager. You can use a GridBagLayout to display components on different rows. You will need to set the constraint for each component to go to a new row. Or you could try to use the Relative Layout, which support vertical layout with centered alignment and you don't need any constraints. The only change to your code would be: //Box b = new Box(BoxLayout.Y_AXIS); JPanel b = new JPanel( new RelativeLayout(RelativeLayout.Y_AXIS) );
type: Answer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/23439314
answers question: http://stackoverflow.com/q/23439314
score: 1
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/23335510
accepted answer of: http://stackoverflow.com/q/23334336
type: Answer
upvote count: 6
has body: You wrote: String rep = "Hex: " + this + ", Id: " + this.id; In java simply writing this means that you are indirectly invoking this.toString(). I believe you are trying to override the toString() method of Object and inside your version of toString() you want to print the id you have passed along with the hashcode of the object. So to get the output replace String rep = "Hex: " + this + ", Id: " + this.id; with String rep = "Hex: "+ this.getClass().getName().hashCode() +", Id: " + id; and you will get the output as: Hex: 1800024669, Id: 123
has comment: http://stackoverflow.com/comment/35794845
score: 6
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23334336
downvote count: 0
has comment: http://stackoverflow.com/comment/35754413

http://stackoverflow.com/comment/35719844
score: 0
has text: Thank you Mark. Yes I have the android.permission.INTERNET in my manifest. I read that post and I got the same conclusion as you, it must be the same. In fact, I created a simple android app for android device (nexus 7), and it worked... It must be something about Glass. What I'm not sure if I should create my Socket in an AsynkTask or I could create it onCreate method...
type: Comment
comment on: http://stackoverflow.com/a/23328061
type: AnswerComment

http://stackoverflow.com/q/23413440
has title: Operations / Calculation in Java
has body: Okay I have got following for loop: public static void main(String []args){ for (int i=2; i&lt;12 ; i=i+2) System.out.print(3-i%3); System.out.println(); } And it is printing out: 12312. In order to understand how it calculates the numbers I have tried to work it out and according to my working it out the first number should be actually 2. I am pretty sure, I am wrong with my thinking since BlueJ prints out firstly number 1. But why 1? Can someone explain it? I have written on a piece of paper the way how I understood/work out the calculation and took a picture of it so you can see my working of getting the number 2 and maybe you can point out my mistake.
downvote count: 0
has comment: http://stackoverflow.com/comment/35877745
favorite count: 0
has answer: http://stackoverflow.com/a/23413611
has comment: http://stackoverflow.com/comment/35877686
tagged with: operations
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35877711
score: 1
tagged with: java
upvote count: 1
accepted answer: http://stackoverflow.com/a/23413611
has comment: http://stackoverflow.com/comment/35877430
has comment: http://stackoverflow.com/comment/35877458
has comment: http://stackoverflow.com/comment/35877578
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/23413487
has comment: http://stackoverflow.com/comment/35877480
has comment: http://stackoverflow.com/comment/35877524
has answer: http://stackoverflow.com/a/23413487
has comment: http://stackoverflow.com/comment/35877492

http://stackoverflow.com/a/23444435
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23443444
type: Answer
score: 3
answers question: http://stackoverflow.com/q/23443444
has comment: http://stackoverflow.com/comment/35952187
downvote count: 1
upvote count: 4
has body: If you carefully read the error messge provided, you will notice that your problem is multiple bindings of sfl4j on your build path. You included sfl4j-log4j and logback-classic artifacts. Since logback-classic already contains native implementation of sfl4j and also automatically adds sfl4j jar to your project you end up having mutiple sf4j's in your build path. Simply make up your mind and choose only one logging framework and remove another one from your dependencies. So if you choose logback-classic your Maven dependencies will look like this: ch.qos.logback logback-classic 1.1.1 If you choose log4j then make it look like this org.slf4j slf4j-log4j12 1.7.2 But don't include both! From sfl4j manual: If you wish to use logback-classic as the underlying logging framework, all you need to do is to declare "ch.qos.logback:logback-classic" as a dependency in your pom.xml file as shown below. In addition to logback-classic-1.0.13.jar, this will pull slf4j-api-1.7.7.jar as well as logback-core-1.0.13.jar into your project. Note that explicitly declaring a dependency on logback-core-1.0.13 or slf4j-api-1.7.7.jar is not wrong and may be necessary to impose the correct version of said artifacts by virtue of Maven's "nearest definition" dependency mediation rule

http://stackoverflow.com/q/23353773
tagged with: servlets
linked to: http://stackoverflow.com/q/3106452
type: Question
answer count: 1
tagged with: jsp
score: 0
tagged with: jdbc
has title: Getting information from database through servlet
has answer: http://stackoverflow.com/a/23353792
type: UnansweredQuestion
has body: When I load my index.jsp I would like for all of the customers to be loaded onto the page. For some reason I cant get the customers to show up from the database. I am assuming somewhere in my servlet I am going wrong. Below are the index page and servlet. INDEX <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <%@ page import="java.util.ArrayList" %> <%@ taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql" %> <%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> Add a Customer/Pet List of Customers <c:forEach items="${sessionScope.customers}" var="customer" > ${customer.getFirstName()} </c:forEach> SERVLET package edu.witc.Assignment05.controller; import java.io.IOException; import java.sql.Connection; import java.sql.PreparedStatement; import java.util.ArrayList; import java.util.Collection; import java.util.List; import javax.servlet.*; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; //import javax.servlet.annotation.WebServlet; //import javax.servlet.http.HttpServlet; //import javax.servlet.http.HttpServletRequest; //import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import edu.witc.Assignment05.model.Customer; import edu.witc.Assignment05.model.CustomerDAO; @WebServlet(description = "servlet to get act as controller between form and models", urlPatterns = { "/fetchDataServlet","/addCustomer","/addPet", "/customerManagement" }) public class FetchDataServlet extends HttpServlet { private static final long serialVersionUID = 1L; public FetchDataServlet() { super(); } private List<edu.witc.Assignment05.model.Customer> customers = new ArrayList<Customer>(); private void addCustomer(HttpServletResponse response, HttpServletRequest request)//redirect to form throws IOException, ServletException { String url = "/customerManagement.jsp"; //processRe…
tagged with: model-view-controller
tagged with: java

http://stackoverflow.com/a/23349804
has comment: http://stackoverflow.com/comment/35809240
score: 0
has body: One common place for these technologies to be used together is AJAX. The server side web services might be written in Java and the client side Javascript calls web services. It's worth pointing out that Java and Javascript are actually completely different languages. The web services could be written in any language.
has comment: http://stackoverflow.com/comment/35760275
answers question: http://stackoverflow.com/q/23349747
type: Answer

http://stackoverflow.com/comment/35926383
has text: Maybe this is inherent in the way it's set up, but how would you ensure `isDone()` would return `true` if you're signalling from inside the task?
type: Comment
comment on: http://stackoverflow.com/a/23439520
type: AnswerComment
score: 0

http://stackoverflow.com/comment/35671950
type: Comment
has text: Suppose the input contained just one line. You do `for (i=0; i <= content.length ; i++)...`. The first time through this loop you will process the first line. What happens the second time through this loop?
score: 1
comment on: http://stackoverflow.com/q/23301702
type: QuestionComment

http://stackoverflow.com/comment/35771894
type: AnswerComment
has text: The SessionFactory can be configured in the spring XML config. Define your session factory when you define your transaction manager and you can be sure that all your transactions will be using the session factory you configured.
type: Comment
score: 2
comment on: http://stackoverflow.com/a/23351235

http://stackoverflow.com/comment/35851422
type: QuestionComment
has text: Can you please post code for ActivityPersonalRewardsGfits.java
comment on: http://stackoverflow.com/q/23398861
score: 0
type: Comment

http://stackoverflow.com/a/23342094
accepted answer of: http://stackoverflow.com/q/23341634
type: AcceptedAnswer
downvote count: 0
score: 1
type: Answer
has body: I have implemented the classes you have and used the example xml you provided. I created a main function to test public static void main(String args[]) throws Exception { Serializer serializer = new Persister(new Format("&lt;?xml version=\"1.0\" encoding= \"UTF-8\" ?&gt;")); File source = new File("sample.xml"); Package p = serializer.read(Package.class, source); System.out.println(p.name); } The output is GO Sales (nalysis) Inspecting the object p in debug mode shows it has the two Sets with two and three elements. Your code works fine for me.
upvote count: 1
answers question: http://stackoverflow.com/q/23341634

http://stackoverflow.com/q/23374669
has comment: http://stackoverflow.com/comment/35805770
has answer: http://stackoverflow.com/a/23393004
accepted answer: http://stackoverflow.com/a/23393004
has title: Line of code in R.java representing a string that doesn't exist
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35805563
tagged with: java
has comment: http://stackoverflow.com/comment/35838899
has comment: http://stackoverflow.com/comment/35805978
tagged with: r.java-file
answer count: 1
has comment: http://stackoverflow.com/comment/35805654
has body: public static final class string { public static final int Long Sword=0x7f050002; public static final int app_name=0x7f050000; public static final int desc=0x7f050001; } This is the code that appears in my R.Java. It produces a syntax error, as I suppose "Long Sword" is an invalid name for a string. However, there is no such field in my strings.XML file. If I create any new fields to try and amend the error, it just creates a new line of code in the R.java. Basically, as far as I know, I just need to get rid of this line of code, but don't know how to do it without R.java reverting the "manual changes". Can anyone help?
score: 0
has comment: http://stackoverflow.com/comment/35805690
tagged with: android
has comment: http://stackoverflow.com/comment/35807098

http://stackoverflow.com/comment/35746186
type: AnswerComment
score: 0
type: Comment
has text: Yes, on startup I had an issue described here https://java.net/jira/browse/GLASSFISH-20579 and I resolved it by setting asadmin set configs.config.server-config.cdi-service.enable-implicit-cdi=false That is all, log doesn't have anything else
comment on: http://stackoverflow.com/a/23342092

http://stackoverflow.com/comment/35656950
comment on: http://stackoverflow.com/q/23293844
has text: First set: there is no difference, unless you've overriden `setSize` or `setVisible` in `Main`, because `super.XXX` explicitly will call the method as it is defined in the `Frame` class. With that said, the convention is to only use `super` when necessary.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23437320
has answer: http://stackoverflow.com/a/23437739
tagged with: calendar
has body: I am fairly new to java development and have come accross a problem i need help with. I need to find out the days(if applicable), hours and minutes until 8.30 am. However, as this is a "countdown to school" the code has to know that if the next 8.30 am is on saturday or sunday, it should show the time until monday 8.30AM. Again, sorry if that does not make to much sense. So the logical way i would go about approaching this is by: Working out whether tomorrow is either monday, tuesday, wednesday, thursday or friday. If it is, work out the number of hours and minutes until 8.30am tomorrow and convert that into 2 strings (hours and minutes) Else, work out the days, hours and minutes until monday 8.30 am and convert them to strings(days, hours and minutes) Date dt = new Date(); Calendar c = Calendar.getInstance(); c.setTime(dt); c.set(Calendar.HOUR_OF_DAY, 0); c.set(Calendar.MINUTE, 0); c.set(Calendar.SECOND, 0); c.set(Calendar.MILLISECOND, 0); dt = c.getTime(); DateFormat dateFormat = new SimpleDateFormat("dd"); String datetommorow = dateFormat.format(dt); int date22 = Integer.parseInt(datetommorow); int date33 = date22 + 1; Integer.toString(date33); As you can see from this attempt i am struggling with this. Any help would be greatly appreciated, and if you need any more infomation do not hesitate to ask
type: Question
has comment: http://stackoverflow.com/comment/35922434
has title: Find days, hours and minutes to a time on certain days
has answer: http://stackoverflow.com/a/23437683
tagged with: date
answer count: 3
has comment: http://stackoverflow.com/comment/35922661
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/23437683
tagged with: android
possible better answer: http://stackoverflow.com/a/23437578
type: AnsweredQuestion
score: 2
has answer: http://stackoverflow.com/a/23437578
upvote count: 2
tagged with: java

http://stackoverflow.com/q/23444632
tagged with: swing
has comment: http://stackoverflow.com/comment/35938323
linked to: http://stackoverflow.com/q/23254166
type: Question
has title: Java JPanel movement (keylistener) not working
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35937195
has answer: http://stackoverflow.com/a/23446176
tagged with: java
tagged with: keylistener
linked to: http://stackoverflow.com/q/21817427
linked to: http://stackoverflow.com/q/22796767
linked to: http://stackoverflow.com/q/22741215
has comment: http://stackoverflow.com/comment/35938260
linked to: http://stackoverflow.com/q/23305669
has comment: http://stackoverflow.com/comment/35937152
has comment: http://stackoverflow.com/comment/35935303
linked to: http://stackoverflow.com/q/21867283
downvote count: 0
answer count: 1
has body: I've been trying to let an image move up and down in Jpanel for quite a long while, but it never seems to work. If I put "y = y - 1" in the view, it makes the image move up, so I guess the problem is with the keylistener, right? Could anyone help me with this please? To be honest... I think it will be a very stupid mistake but I can't find how to get it to work. Extra information: I am using BlueJ to from it, with 4 classes in the basic program for my question. I realize that a lot of people on the internet said to use key bindings and not KeyListener but I don't understand key bindings as for now... --- Following the advice of Hovercraft Full Of Eels, I will try to use Keybindings. --- So Keybindings has 2 'commands' to work: input and action. Copied this code and changed it for my program: protected void addBindings() { int condition = JComponent.WHEN_IN_FOCUSED_WINDOW; InputMap inputMap = getInputMap(condition); // What does this do? KeyStroke key = KeyStroke.getKeyStroke(KeyEvent.VK_UP, Event.KEY_PRESS); inputMap.put(key, move(0, 2)); The move function: protected void beweeg (int dx, int dy) { view.x = view.x + dx; view.y = view.y + dy; } I have to say... the code system on this forum is incredibly frustrating. When trying this I get: "cannot find symbol - method getInputMap(int)" Did I need to declare it somewhere? I don't see anything about this.
favorite count: 0
linked to: http://stackoverflow.com/q/22730715
accepted answer: http://stackoverflow.com/a/23446176
tagged with: controller
has comment: http://stackoverflow.com/comment/35937525
has comment: http://stackoverflow.com/comment/35938704
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/35938818

http://stackoverflow.com/comment/35675665
type: QuestionComment
has text: Please don't repost essentially the same question twice. Also, before posting you should be using a debugger to trace through the code to determine where the problem is. Debugging and tracing are a crucial parts of the learning process and if you just ask here and get an answer you won't have learned much.
comment on: http://stackoverflow.com/q/23303683
score: 0
type: Comment

http://stackoverflow.com/comment/35675636
type: Comment
has text: @Darwind Since the data is entirely dynamic and will always vary, the system would have to traverse the data to determine what is actually "expensive" which would probably be just as heavy. Plus it's not just an issue of scrolling quickly. But thanks for still trying to help!
comment on: http://stackoverflow.com/a/23303248
type: AnswerComment
score: 0

http://stackoverflow.com/a/23485017
accepted answer of: http://stackoverflow.com/q/23321450
score: 1
answers question: http://stackoverflow.com/q/23321450
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 1
has body: I managed to make it work. What i did was, i created a method in the LocationData java class that has an input parameter of the persons name, and based on that returns the attributes of that person. Then i created a second servlet, this one only returns the value of the person and not all people like the latter does. I wrote in the doGet of the servlet String personname = request.getParameter("personName"); //This will be received from an Ajax call ArrayList list = ld.getLocation(personname); String json = new Gson().toJson(list); response.setContentType("text/json"); response.setHeader("Cache-Control", "no-cache"); response.getWriter().write(json); In the Javascript, i have an ajax called placed in the onbutton click of the marker that gets the data as such $.ajax({ dataType: "json", type: 'GET', url: 'servleturl', data: {"personName": marker.getTitle()}, success: function(response) { //do stuff here to perform the unique action to the marker} });

http://stackoverflow.com/q/23412423
has comment: http://stackoverflow.com/comment/35890141
tagged with: exception
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23415418
has comment: http://stackoverflow.com/comment/35919069
has comment: http://stackoverflow.com/comment/35927362
tagged with: java
type: Question
tagged with: try-catch
has body: I am assign to make a method to check if the internet is reachable or not. So I try this dummy method to return false if connection is not possible. public static boolean isInternetReachable() { try { //make a URL to a known source URL url = new URL("http://www.google.com"); //open a connection to that source HttpURLConnection urlConnect = (HttpURLConnection)url.openConnection(); //trying to retrieve data from the source. If there //is no connection, this line will fail urlConnect.setConnectTimeout(1000); Object objData = urlConnect.getContent(); } catch (UnknownHostException e) { // TODO Auto-generated catch block e.printStackTrace(); return false; } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); return false; } catch(Exception e){ e.printStackTrace(); return false; } return true; } However, I got this error instead of catching a exception (and be able to return false) java.net.NoRouteToHostException: No route to host: 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 sun.net.NetworkClient.doConnect(Unknown Source) at sun.net.www.http.HttpClient.openServer(Unknown Source) at sun.net.www.http.HttpClient.openServer(Unknown Source) at sun.net.www.http.HttpClient.&lt;init&gt;(Unknown Source) at sun.net.www.http.HttpClient.New(Unknown Source) at sun.net.www.http.HttpClient.New(Unknown Source) at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(Unknown Source) at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown Source) at sun.net.www.protocol.http.HttpURLConnection.connect(Unknown Sourc…
has comment: http://stackoverflow.com/comment/35875988
has title: I can't throw NoRouteToHostException even with catch(Exception e)
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/23413949

http://stackoverflow.com/q/23330347
type: AnsweredQuestion
upvote count: 0
tagged with: java
tagged with: swing
accepted answer: http://stackoverflow.com/a/23330555
type: Question
has comment: http://stackoverflow.com/comment/35724138
has body: Java Glass pane auto resize when I resize the whole interface,but I want to make it stick to a specific location, it will look like this: Instead of moving around when I resize it. Thanks
score: -1
has answer: http://stackoverflow.com/a/23330555
has title: How to make Java Glasspane sticks to a location even if GUI was resized?
answer count: 1
tagged with: user-interface
downvote count: 1
favorite count: 0
linked to: http://stackoverflow.com/q/18356000
tagged with: glasspane

http://stackoverflow.com/q/23442986
upvote count: 1
has comment: http://stackoverflow.com/comment/35932342
tagged with: java
has answer: http://stackoverflow.com/a/23443074
downvote count: 5
has title: extract different number in two array in java
has comment: http://stackoverflow.com/comment/35932246
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/35932210
has answer: http://stackoverflow.com/a/23443282
has comment: http://stackoverflow.com/comment/35932450
tagged with: arrays
favorite count: 0
has comment: http://stackoverflow.com/comment/35932431
has comment: http://stackoverflow.com/comment/35932308
has body: Here i come with to extract different number in two array in java .different number are to be store in third list of array i am new to java could some one guide me in right Direction which i tried upto now?? int[] list={1,2,3,4,5,6,7}; int[] list1={1,2,3,4,5,6,7,8,9,10}; int [] list2 =null; for (int i = 0; i &lt; list.length; i++) { for (int j = 0; j &lt; list1.length; j++) { if(list[i]!=list1[j]) { System.out.println(list2[]); } } }
has comment: http://stackoverflow.com/comment/35932211
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35932331
score: -4

http://stackoverflow.com/a/23309529
type: Answer
accepted answer of: http://stackoverflow.com/q/23309282
score: 1
answers question: http://stackoverflow.com/q/23309282
upvote count: 1
type: AcceptedAnswer
downvote count: 0
has body: If you want to have a quick read on these constructs and what they may be used for, see http://docs.oracle.com/javase/tutorial/java/javaOO/initial.html The comparison to Ruby is somewhat flawed, as this is only a syntactic similarity between Java and Ruby - in Ruby, the "{}" means something completely different to what Java uses this syntax for. The "-> {}" in Ruby is an expression returning a lambda, which is a callable object. What is an initialization block? Also helps explaining the case with some nice code examples.

http://stackoverflow.com/a/43068106
upvote count: 1
score: 1
has body: Best way to solve this error is to open the command prompt and go to the location of the file and Type mvn spring-boot:run and press "Enter" The reason we have to do this is because sometimes we have to provide initial credential's, so to bypass that we will have to go this way.
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/23313247

http://stackoverflow.com/comment/35929170
has text: @Braj no all the columns. as i said the query is correct and running fine with jdbc-odbc bridge but not with hxtt pure java driver.
type: Comment
comment on: http://stackoverflow.com/a/23440818
score: 0
type: AnswerComment

http://stackoverflow.com/q/23401209
score: 0
tagged with: char
answer count: 1
tagged with: string
has comment: http://stackoverflow.com/comment/35854544
accepted answer: http://stackoverflow.com/a/23401256
has comment: http://stackoverflow.com/comment/35854676
has title: Converting the square root sign from string to char
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/35854593
has comment: http://stackoverflow.com/comment/35854516
type: Question
has answer: http://stackoverflow.com/a/23401256
has body: In order to get the char version of "\u221A" (aka the square root sign), would I just do the following: String op = "\u221A"; char operator = op.charAt(0); operator = '\u221A'; The last part doesn't seem right. Just wondering how I'd go about doing that. Thanks for your help!
tagged with: type-conversion

mousemotionlistener
type: Tag
tag name: mousemotionlistener
tags question: http://stackoverflow.com/q/23422313

http://stackoverflow.com/q/23297709
tagged with: java
tagged with: swing
tagged with: jmenu
type: Question
has title: Why does my program not change the font or size of the font when clicked in the JMenu?
upvote count: 1
answer count: 1
has body: When I try to run the program, it runs fine. The problem is that it does not change anything when the button is clicked. I think the problem is that it is not properly changing the Fonts. It does nothing even when I try to change the sizes but I do not know why that is. Thank you for helping! Here is the code to my program: import java.awt.*; import java.awt.event.*; import javax.swing.*; public class JMenuExample5 extends JFrame implements ActionListener{ Container con; JMenuBar menuBar; JMenu file; JMenu colors; JMenu font; JMenu alignment; JMenu themeFont; JMenu size; JMenuItem exit; ButtonGroup group; JRadioButtonMenuItem black; JRadioButtonMenuItem green; JRadioButtonMenuItem red; JRadioButtonMenuItem blue; JMenuItem arial; JMenuItem timesNewRoman; JMenuItem wingdings; JMenuItem stencil; JMenuItem comicSans; JMenuItem pt12; JMenuItem pt18; JMenuItem pt24; JMenuItem pt36; String fTheme = ""; int fsize = 12; Font fontArial = new Font(fTheme, Font.BOLD, fsize); Font fontTimes = new Font(fTheme, Font.BOLD, fsize); Font fontWingdings = new Font(fTheme, Font.BOLD, fsize); Font fontStencil = new Font(fTheme, Font.BOLD, fsize); Font fontComic= new Font(fTheme, Font. BOLD, fsize); JLabel label; public JMenuExample5(){ super("JMenu Demonstration"); setSize(901, 201); con = getContentPane(); con.setLayout(new FlowLayout(FlowLayout.CENTER, 40, 40)); setVisible(true); con.setBackground(Color.LIGHT_GRAY); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); menuBar = new JMenuBar(); group = new ButtonGroup(); file = new JMenu("File"); colors = new JMenu("Colors"); font = new JMenu("Font"); alignment = new JMenu("Alignment"); themeFont = new JMenu("Font Theme"); size = new JMenu("Size"); exit = new JMenuItem("Exit"); black = new JRadioButtonMenuItem("Black"); green = new JRadioButtonMenuItem("Green"); red = new JRadioButtonMenuItem("Red"); blue = new JRadioButtonMenuItem("Blue"); arial = new JMenuItem("Arial"); timesNewRoman = new JMenuItem("Times New Roman"); wingdings = new JMen…
has answer: http://stackoverflow.com/a/23297916
accepted answer: http://stackoverflow.com/a/23297916
favorite count: 0
tagged with: jlabel
type: AnsweredQuestion
downvote count: 0
tagged with: fonts
score: 1

http://stackoverflow.com/comment/35721398
score: 1
type: AnswerComment
has text: That is a separate issue, please create a new question for it instead of drastically rewriting this one multiple times for all future problems.
comment on: http://stackoverflow.com/a/23328654
type: Comment

http://stackoverflow.com/q/23299580
type: Question
tagged with: c#
has answer: http://stackoverflow.com/a/23299602
tagged with: inheritance
has body: Me and my friend, who is a Java programmer, were discussing inheritance. The conversation almost reached the heights when we got different results for same kind of code. My code in .NET: using System; using System.Collections.Generic; using System.Text; namespace ConsoleDemo { class Program { static void Main(string[] args) { Base objBaseRefToDerived = new Derived(); objBaseRefToDerived.Show(); Console.ReadLine(); } } public class Base { public virtual void Show() { Console.WriteLine("Show From Base Class."); } } public class Derived : Base { public void Show() { Console.WriteLine("Show From Derived Class."); } } } Gives me this result: Show From Base Class. While the code this code in Java public class Base { public void show() { System.out.println("From Base"); } } public class Derived extends Base { public void show() { System.out.println("From Derived"); } public static void main(String args[]) { Base obj = new Derived(); obj.show(); } } Gives me this result: From Derived Why is .NET calling the Base class function and java calling derived class function? I will really appreciate if someone can answer this or just provide a link where I can clear this confusion. I hope there is nothing wrong with the code provided.
answer count: 2
has title: Difference in inheritance in C# and Java
favorite count: 0
linked to: http://stackoverflow.com/q/814934
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35667682
score: 8
duplicate of: http://stackoverflow.com/q/814934
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/23299706
has comment: http://stackoverflow.com/comment/35667756
upvote count: 8

http://stackoverflow.com/comment/35753360
comment on: http://stackoverflow.com/q/23331629
type: Comment
has text: Are you still having problems? The error you posted has got nothing to do with Java 8.
score: 0
type: QuestionComment

http://stackoverflow.com/q/23349157
has body: I have 100 text files. 50 of them are called text_H and the other are called text_T. What I would like to do is the following open two text files text_T_1 and text_H_1 and find the number of common words and write it to a text file then open text_H_2 and text_T_2 and find the number of common words....then open text_H_50 and text_T_50 and find the number of common words. I have written the following code that open two text files and find common words and return the the number of common words between the the two files. The results are written in text file For whatever reason instead of giving me the number of common word for just the open text files, it gave me the number of of common words for all files. For the example if the number of common words between fileA_1 and fileB_1 is 10 and the number of common words between fileA_2 and fileB_2 is 5, then result I get for number of common word for the second two files is 10+5=15. I'm hoping someone here can catch whatever it is that I'm missing, because I've been through this code many times now without success. Thanks ahead of time for any help! The code: package xml_test; import java.io.File; import java.io.FileNotFoundException; import java.io.FileWriter; import java.io.IOException; import java.util.ArrayList; import java.util.Scanner; public class app { private static ArrayList&lt;String&gt; load(String f1) throws FileNotFoundException { Scanner reader = new Scanner(new File(f1)); ArrayList&lt;String&gt; out = new ArrayList&lt;String&gt;(); while (reader.hasNext()) { String temp = reader.nextLine(); String[] sts = temp.split(" "); for (int i = 0;i&lt;sts.length;i++) { if(sts[i] != "" &amp;&amp; sts[i] != " " &amp;&amp; sts[i] != "\n") out.add(sts[i]); } } return out; } private static void write(ArrayList&lt;String&gt; out, String fname) throws IOException { FileWriter writer = new FileWriter(new File(fname)); //int count=0; int temp1=0; for (int ss= 1;ss&lt;=3;ss++) { int count=0; for (int i = 0;i&lt;out.size();i++)…
downvote count: 0
possible better answer: http://stackoverflow.com/a/23349982
accepted answer: http://stackoverflow.com/a/23350032
favorite count: 0
has answer: http://stackoverflow.com/a/23349982
has title: find common words in multiple text files
type: AnsweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/35758538
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/23350032
tagged with: arraylist
answer count: 2
tagged with: read-write

build
tags question: http://stackoverflow.com/q/23412649
tag name: build
tags question: http://stackoverflow.com/q/23304492
tags question: http://stackoverflow.com/q/23390109
type: Tag

http://stackoverflow.com/comment/35819245
comment on: http://stackoverflow.com/q/23372303
type: QuestionComment
score: 0
has text: Also note that there is no guarantee for read to only return less than the requested size if you're at the end of the file. Even though it is improbably you could technically end up with only 8 bytes read which would be padded and thus additional spaces end up in your encrypted plaintext. Regarding the padding choice, if can change the python side then you should instead use PKCS5 (or PKCS7 which is the same) padding on both sides. With "` `" padding you cannot differentiate between a padded plaintext and a plaintext that just happened to have spaces at the end.
type: Comment

http://stackoverflow.com/q/23439271
score: 0
answer count: 2
tagged with: struts2-interceptors
tagged with: jsp
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23439297
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/23441105
has body: <%@taglib uri="/struts-tags" prefix="s"%> </s:form> Interceptor test <s:form action="simple"> <s:textfield name="message" label="message"/> <s:submit value="submit"/> </s:form> Action file: package action; public class Simple { String message,Status="action is not invoked"; public String execute() throws Exception { Status="action is invoked"; return "Success"; } public String getMessage() { return message; } public void setMessage(String message) { this.message = message; } public String getStatus() { return Status; } } Myinterceptor: package interceptors; import java.util.Enumeration; import javax.servlet.ServletRequest; import org.apache.struts2.ServletActionContext; import com.opensymphony.xwork2.ActionInvocation; import com.opensymphony.xwork2.interceptor.Interceptor; import com.opensymphony.xwork2.util.ValueStack; public class myinterceptor implements Interceptor { @Override public void destroy() { // TODO Auto-generated method stub } @Override public void init() { // TODO Auto-generated method stub } @Override public String intercept(ActionInvocation ae) throws Exception { //preprocessing logic ServletRequest req=ServletActionContext.getRequest(); ValueStack v=ae.getStack(); Enumeration<String> e=req.getParameterNames(); while(e.hasMoreElements()) { String pname=e.nextElement(); String pvalue=req.getParameter(pname); v.setValue(pname, pvalue); } // get the next compponent invoked String str=ae.invoke(); return "Myjsp"; } } result.jsp: <%@taglib uri="/struts-tags" prefix="s"%> Result is:<s:property value="result"/> <jsp:include page="index.jsp"></jsp:include> MyJsp.jsp: notworking struts.xml: <?xml version="1.0" encoding="UTF-8"?> <result-type name="dispatcher" class="org.apache.struts2.dispatcher.ServletDispatcherResult" default="true"/> <default-interceptor-ref name="params"></default-interceptor-ref> /result.jsp <interceptor-ref name="ps"/> /status.jsp /MyJsp.jsp My question is that I am returning a different string from the interceptor than that of the act…
tagged with: configuration
has title: Different String from action and interceptor
tagged with: struts2

http://stackoverflow.com/a/23353709
downvote count: 0
has body: Providing algorithm for this: Read each line of your file. For each line read: Split it by the separator (not sure if spaces or tab \t character, it depends on your file content). Retrieve the 5th element. Store it in a collection, usually a List&lt;String&gt;. You can easily accomplish this using Scanner class: List&lt;String&gt; desiredContent = new ArrayList&lt;&gt;(); Scanner scanner = new Scanner(new File("/path/to/file.csv")); while (scanner.hasNext()) { String line = scanner.nextLine(); String[] contents = line.split(" "); desiredContent.add(contents[4]); }
answers question: http://stackoverflow.com/q/23353676
upvote count: 2
accepted answer of: http://stackoverflow.com/q/23353676
type: AcceptedAnswer
type: Answer
score: 2

http://stackoverflow.com/q/23443503
tagged with: eclipse
type: Question
score: 0
has body: I'm trying to add a changing background color on every tick of this digital clock, but I have no idea where to start. Here's my tick part of the code public void start() { if ( runner==null) runner =new Thread(this); runner.start(); } public void run() { while(runner==Thread.currentThread()) { repaint(); try {Thread.sleep(1000);} catch(InterruptedException e) {} } } Additional information, if this helps: public Clockclass() { super ("javaclock"); setSize(300,100); setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE); setVisible(true); clockFont= new Font("Serif", Font.BOLD,50); Container contentArea =getContentPane(); ClockPanel timeDisplay = new ClockPanel(); contentArea.add(timeDisplay); setContentPane(contentArea); start(); } class ClockPanel extends JPanel { public void paintComponent (Graphics painter) { painter.setColor(Color.cyan); painter.fillRect(0,0,300,100); painter.setFont(clockFont); painter.setColor(Color.white); painter.drawString(timeNow(), 60, 40); } } public String timeNow(){ Calendar now =Calendar.getInstance(); int hrs=now.get(Calendar.HOUR_OF_DAY); int min=now.get(Calendar.MINUTE); int sec=now.get(Calendar.SECOND); String time= zero(hrs)+":"+zero(min)+":"+zero(sec); return time; } public String zero(int num) { String number= (num&lt;10)?("0"+num):(""+num); return number; } Thanks in advance!
has answer: http://stackoverflow.com/a/23443563
answer count: 1
accepted answer: http://stackoverflow.com/a/23443563
type: AnsweredQuestion
tagged with: java
has title: changing background color on every clock tick
tagged with: swing

http://stackoverflow.com/q/23419672
has body: I am writing a programming project. My project is about the user entering money to buy the amount of chocolate bars they want to consume. Each chocolate bar contains 1 coupon. 1 chocolate bar equals $1. redeeming 6 coupons will get the user 1 free bar plus the extra coupon in the free bar. For example if the user enters 6$ the user will get 6 bars redeeming 6 coupons will get a free bar so the free bar will have a coupon so the the user has one coupon left.I must print the left amount of coupons after the user redeems it. I use this equation to get the leftover coupons amount = coupons / 6; When i run my code the amount prints 0 not the remaining leftovers like 1 coupon left if i buy 6 chocolate bars. Please help what am I doing wrong. Heres my code import java.util.Scanner; public class Chp4PP16RedeemChocolateCoupons_John { public static void main(String[] args) { //Instance Variables int CostOfBar = 1; int ChocolateBar = 0; int UserDollar = 0; int Amount; int Coupons = 0; int Total = 0; Scanner keyboard = new Scanner(System.in); //Tell the user how many chocolate bars they want to buy System.out.println("Welcome User,\nPlease enter your money to buy the amount of chocolate bars you want.\nChocolate Bar = $" + CostOfBar); UserDollar = keyboard.nextInt(); System.out.println("You have entered $" + UserDollar+ "\n"); System.out.println("You have decided to buy"); System.out.println((Amount = UserDollar + ChocolateBar) + " Chocolate Bars."); //get total amount and remainder of coupons while (Coupons &gt; 6) { Total = Amount / 6; } System.out.println("\nYou have " + Total + " remaining coupons."); } }
type: Question
answer count: 1
has comment: http://stackoverflow.com/comment/35889518
downvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/23419735
upvote count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35889396
has title: How can I print the left amount of coupons
linked to: http://stackoverflow.com/q/2664301
tagged with: java
has comment: http://stackoverflow.com/comment/35890134
score: -1
tagged with: loops
has comment: http://stackoverflow.com/comment/35889413

http://stackoverflow.com/a/23408654
upvote count: 3
score: 3
answers question: http://stackoverflow.com/q/23364056
has body: Though I wrote this matter in my blog in Japanese, I hope you can see the figures there and will find the solution. http://nomprix.blogspot.jp/2014/04/sts-350spring-roo.html
downvote count: 0
type: Answer

http://stackoverflow.com/a/29192526
type: Answer
score: 7
downvote count: 2
has body: You can also get this error message on its own, without any stack trace or any further error message. In this case you need to make sure your Android manifest is configured correctly (including any manifest merging happening from a library and any activity that would come from a library), and pay particular attention to the first activity displayed in your application in your manifest files.
upvote count: 9
answers question: http://stackoverflow.com/q/23353173
has comment: http://stackoverflow.com/comment/47979774

http://stackoverflow.com/comment/35931155
comment on: http://stackoverflow.com/q/23428114
score: 0
type: Comment
type: QuestionComment
has text: Ok I will check again

http://stackoverflow.com/q/23378204
upvote count: 1
score: 1
tagged with: java
has body: So I've been working on this project PhoneBook.java program for awhile. The program opens up a .txt file and imports it into a List sorted by Lastname, Firstname. I am attempting to write a search function that opens a window, asks you to input a name, then upon clicking ok it should select the searched index. I can not understand why my following code for the searchMI is not working. I appreciate any help you can give me. public class PhoneBook extends Frame implements ActionListener, ItemListener { MenuItem newMI, openMI, saveMI, saveAsMI, exitMI; MenuItem searchMI, deleteMI, updateMI, newEntryMI, sortMI; String fileName; List nameList; List numberList; TextField lastName, firstName, phoneNumber; // implementing ActionListener public void actionPerformed(ActionEvent event) { Object source = event.getSource(); if(source == newMI) { nameList.removeAll(); numberList.removeAll(); fileName = null; display(-1); setTitle("White Pages") } else if(source == searchMI) { String searchName = JOptionPane.showInputDialog(this, "Please enter a name (last first) to search:"); System.out.println("Name to search: " + searchName); int index = nameList.getSelectedIndex(); String name = lastName.getText().trim() + " " + firstName.getText().trim(); for(int i=0; i!=index; i++){ if(nameList.equals(searchName)){ nameList.select(index); } else { System.out.println("Error searching for the name: " + searchName); } ...
type: Question
tagged with: search
answer count: 1
tagged with: arrays
downvote count: 0
favorite count: 0
has title: Search function for a phonebook.java project
has answer: http://stackoverflow.com/a/23378270
type: UnansweredQuestion

http://stackoverflow.com/comment/35862053
has text: This is a good try, but has 2 shortcomings: 1) what if arguments have different types in one subclass? 2) I prefer compile time checking, rather run time. Of course we can propose some other good run time solutions!
type: AnswerComment
comment on: http://stackoverflow.com/a/23404603
score: 0
type: Comment

http://stackoverflow.com/q/23435289
score: 0
has answer: http://stackoverflow.com/a/23435501
has title: Send objects over socket repeatedly
has answer: http://stackoverflow.com/a/23435345
tagged with: objectoutputstream
type: UnansweredQuestion
tagged with: sockets
has comment: http://stackoverflow.com/comment/74038848
has comment: http://stackoverflow.com/comment/35918151
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/7997106
answer count: 2
has body: I'm trying to write a client-server application in which multiple clients can send objects containing updates to the server at any given time. So far, I managed to connect the clients to the server and send the first object, but I can't send objects at a later time (without making a new connection). This is my code: Server: ServerSocketChannel ssc = null; try { ssc = ServerSocketChannel.open(); ssc.socket().bind(new InetSocketAddress(port)); ssc.configureBlocking(true); while (true) { SocketChannel sc = ssc.accept(); ObjectInputStream ois = new ObjectInputStream(sc.socket().getInputStream()); Object obj = ois.readObject(); Client client = (Client)obj; sc.close(); } } catch (IOException | ClassNotFoundException e) { } finally { if (ssc != null) { try { ssc.close(); } catch (IOException e) { e.printStackTrace(); } } } Client: SocketChannel sc; ObjectOutputStream oos; try { sc = SocketChannel.open(); sc.configureBlocking(true); sc.connect(new InetSocketAddress(client.getPort())); try { /* While channel's socket is not connected */ while (!sc.finishConnect()) {} /* Channel's socket is now connected */ oos = new ObjectOutputStream(sc.socket().getOutputStream()); sendClientObjectToServer(); } catch (ConnectException e){} } catch (IOException e) {} finally { if (sc != null) { try { sc.close(); oos.close(); } catch (IOException e) {} } } public void sendClientObjectToServer() { try { oos.writeObject(client); } catch (IOException e){} } The sendClientObjectToServer method works fine the first time, but I get a ClosedChannelException if I try to call it later (on the press of a jbutton). EDIT: Found the solution.

http://stackoverflow.com/a/23292532
has comment: http://stackoverflow.com/comment/35660784
has comment: http://stackoverflow.com/comment/35663957
has comment: http://stackoverflow.com/comment/35658902
score: 3
has comment: http://stackoverflow.com/comment/35657566
upvote count: 3
has comment: http://stackoverflow.com/comment/35660778
has comment: http://stackoverflow.com/comment/35661711
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35654926
accepted answer of: http://stackoverflow.com/q/23292197
has comment: http://stackoverflow.com/comment/35659731
has comment: http://stackoverflow.com/comment/35654752
has comment: http://stackoverflow.com/comment/35660404
answers question: http://stackoverflow.com/q/23292197
has comment: http://stackoverflow.com/comment/35660540
has body: Starting with private final Card[] deck;//to hold cards before shuffling private final Random rand = new Random(); You can do public void shuffle() { // no need the shuffle the last card. shuffle(deck.length - 1); } // will leave the first N card random without duplicates. public void shuffle(int numberOfCards) { for(int i = 0; i &lt; numberOfCards; i++) { // pick a random card from the rest of the deck int j = rand.nextInt(protoDeck.length - i) + i; // swap cards Card tmp = deck[i]; deck[i] = deck[j]; deck[j] = tmp; } } The cost is O(N) where N is the number of random cards. Imagine you have a small Deck like AS AC AD AH 2S 2C 2D 2H and you need to pick a random first card, you select one from the deck and swap that card. Say nextInt() is 5 => 2C 2C | AC AD AH 2S AS 2D 2H The desk is made up of cards randomly selected + not selected. You have no duplicates because the same cards get moved around. The next random card is say 2H which is swapped with AC 2C 2H | AD AH 2S AS 2D AC Finally AD happens to be selected. 2C 2H AD | AH 2S AS 2D AC This gives you three random cards and the rest. The same array can be use again as starting with a sorted or random deck doesn't make the result any more or less random. In reply to the answer Why does this simple shuffle algorithm produce biased results? if there is 123, the possible outcomes are 123 +- 123 - swap 1 and 1 (these are positions, not numbers) | +- 123 - swap 2 and 2 | +- 132 - swap 2 and 3 +- 213 - swap 1 and 2 | +- 213 - swap 2 and 2 | +- 231 - swap 2 and 3 +- 321 - swap 1 and 3 +- 321 - swap 2 and 2 +- 312 - swap 2 and 3 As you can see there is only 6 possible outcomes, all equally likely.
has comment: http://stackoverflow.com/comment/35659582
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/35660965

http://stackoverflow.com/comment/35765122
has text: I don't understand why you would want to do this. `SharedPreferences` simply get saved to an XML file. A `Serializable` object can however be written to an `ObjectOutputStream` and read back from an `ObjectInputStream`. Bearing in mind both of those can use the filesystem why would you use another filesystem mechanism (i.e., `SharedPreferences`) which isn't optimised for serialization?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23351740
score: 0

http://stackoverflow.com/q/23294816
has comment: http://stackoverflow.com/comment/35660951
tagged with: apache-camel
score: 4
has title: Sending message from HTTP endpoint to JMS
upvote count: 4
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/35660625
tagged with: jms
favorite count: 0
has comment: http://stackoverflow.com/comment/35662182
has answer: http://stackoverflow.com/a/23315352
has comment: http://stackoverflow.com/comment/35662448
tagged with: activemq-classic
type: UnansweredQuestion
has body: I am trying to have a camel route, which would accept a payload on a http endpoint and then write that payload to a JMS queue. The route that I have so far is below. But an empty message gets delivered to the jms queue. A message gets there, but it has no body. Heres the route: <from uri="jetty:http://0.0.0.0:8050/add/Customer"/> <inOnly uri="jms:queue:Q.Customer" /> Heres the payload that I'm sending into to 'http://0.0.0.0:8050/add/Customer' endpoint: John Female Any inputs on why the message body is not being written to the jms queue? Thanks...
tagged with: java
has comment: http://stackoverflow.com/comment/35665549
type: Question

http://stackoverflow.com/q/23449902
has title: @MatrixVariable Spring 3.2 return Null
type: Question
tagged with: maven
tagged with: url-routing
tagged with: spring
tagged with: spring-mvc
has answer: http://stackoverflow.com/a/23449970
score: 0
tagged with: java
answer count: 3
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/58448182
has body: I'm using Spring 3.2.6 in order to learn the @MatrixVariable feature with a basic example. I have coded this method to get the matrix variable from the URI : @RequestMapping(value="/matrix/{paths}", method=RequestMethod.GET) public ModelAndView MatrixVariableExample(@MatrixVariable Integer age){ ModelAndView mv = new ModelAndView("affichageMatrix"); mv.addObject("age", age); return mv; } I use this URI : localhost:8080/SpringMVC-Maven/matrix/user;age=23 The value returned for the age variable is null, but I it should be 23
has answer: http://stackoverflow.com/a/27798499

http://stackoverflow.com/q/23404481
favorite count: 0
type: AnsweredQuestion
score: 1
tagged with: quaternions
tagged with: java
accepted answer: http://stackoverflow.com/a/23642023
upvote count: 1
tagged with: matrix-multiplication
type: Question
tagged with: oculus
tagged with: processing
has comment: http://stackoverflow.com/comment/35864509
has title: Processing: getting Yaw, Pitch and Roll angle from matrix4x4
has body: So I am pretty new with Processing and I am trying to integrate the Oculus Rift in my current project. Since I am reading the Oculus sensor data with an application found on internet, I am only able to get the transformation matrix instead of the Euler angles. Now I need to extract the Yaw Pitch and Roll angles from the Matrix4x4. Does anyone know how would I do that using processing? Thank you.
downvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/23642023

http://stackoverflow.com/q/23303087
answer count: 5
has answer: http://stackoverflow.com/a/43188565
tagged with: javafx-2
type: AnsweredQuestion
tagged with: java
tagged with: javafx
has body: Imagine having an enum defining mouse-modes: public enum MouseMode { SELECTION, EDITING, DELETING } And imagine having a toggle-group made of 3 buttons: ToggleButton selection = new ToggleButton("Select"); ToggleButton editing = new ToggleButton("Edit"); ToggleButton deleting = new ToggleButton("Delete"); ToggleGroup mouseSelection = new ToggleGroup(); I want a field MouseMode currentMode to be bidirectionally linked to the toggle-group. Whenever a toggle is set, currentMode is switched accordingly but also if some external process changes currentMode (maybe a key press) then the togglegroup adapts accordingly. I can do this with 2 listeners but I wonder if there is a way to create a custom bidirectional map.
score: 9
type: Question
has answer: http://stackoverflow.com/a/23317344
upvote count: 9
has answer: http://stackoverflow.com/a/78836403
has answer: http://stackoverflow.com/a/67857069
possible better answer: http://stackoverflow.com/a/25061488
has answer: http://stackoverflow.com/a/25061488
tagged with: javafx-8
has title: Bind ToggleGroup bidirectionally in javafx
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/23317344

http://stackoverflow.com/comment/35675382
type: Comment
type: QuestionComment
score: 3
has text: Are you sure you didn't mean to do `rand.nextInt(87) + 13`?
comment on: http://stackoverflow.com/q/23303659

http://stackoverflow.com/a/23325567
upvote count: 1
downvote count: 1
answers question: http://stackoverflow.com/q/23325457
type: Answer
has body: iterate till you get last node using while loop and once foinds last node return it.. public Node getLast(){ Node p = first; while (p.link != null) { p = p.link; } return p; }
score: 0

http://stackoverflow.com/a/23328568
score: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23309989
has body: Register your action as shown in http://wiki.netbeans.org/DevFaqActionAddProjectPopUp ? IIRC there is also a way to add the action to a specific project type.
type: Answer
accepted answer of: http://stackoverflow.com/q/23309989

http://stackoverflow.com/a/23362726
type: Answer
answers question: http://stackoverflow.com/q/23362610
score: 3
downvote count: 0
has body: You are free to implement such a method. In your case, something like public static Direction getDirection(int number){ return Direction.values()[number-1]; } But why is this more convenient? The whole point of enums is to avoid magic numbers (or strings). I think what you really want is a method on Direction that returns the Direction when you turn left or right from it. public Direction turnLeft(){ switch(this){ case LEFT: return DOWN; case DOWN: return RIGHT; case RIGHT: return UP; case UP: return LEFT; } }
upvote count: 3

http://stackoverflow.com/q/23414568
upvote count: 2
tagged with: java
type: Question
tagged with: google-sheets-api
has body: I have a written a program that takes in user input, but now I want to be able to save that input by editing a Google spreadsheet every time a user submits the form. So basically, the Google spreadsheet is constantly being updated. Can anyone provide a tutorial on how I might be able to achieve this? I'm writing in Java using Eclipse, so which plug-ins would I need? I have already tried using some of the sample code provided in the Google Spreadsheets API (adding a list row section), but I can't seem to get it to work. import com.google.gdata.client.spreadsheet.*; import com.google.gdata.data.spreadsheet.*; import com.google.gdata.util.*; import java.io.IOException; import java.net.*; import java.util.*; public class MySpreadsheetIntegration { public static void main(String[] args) throws AuthenticationException, MalformedURLException, IOException, ServiceException { SpreadsheetService service = new SpreadsheetService("MySpreadsheetIntegration-v1"); // TODO: Authorize the service object for a specific user (see other sections) // Define the URL to request. This should never change. URL SPREADSHEET_FEED_URL = new URL( "https://docs.google.com/spreadsheets/d/1OcDp1IZ4iuvyhndtrZ3OOMHZNSEt7XTaaTrhEkNPnN4/edit#gid=0"); // Make a request to the API and get all spreadsheets. SpreadsheetFeed feed = service.getFeed(SPREADSHEET_FEED_URL, SpreadsheetFeed.class); List&lt;SpreadsheetEntry&gt; spreadsheets = feed.getEntries(); if (spreadsheets.size() == 0) { // TODO: There were no spreadsheets, act accordingly. } // TODO: Choose a spreadsheet more intelligently based on your // app's needs. SpreadsheetEntry spreadsheet = spreadsheets.get(0); System.out.println(spreadsheet.getTitle().getPlainText()); // Get the first worksheet of the first spreadsheet. // TODO: Choose a worksheet more intelligently based on your // app's needs. WorksheetFeed worksheetFeed = service.getFeed( spreadsheet.getWorksheetFeedUrl(), WorksheetFeed.class); List&lt;WorksheetEntry&gt; worksheets = worksheetFe…
tagged with: google-sheets
has comment: http://stackoverflow.com/comment/35882169
has title: Programmatically edit a Google Spreadsheet
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/35882645
favorite count: 0
has comment: http://stackoverflow.com/comment/35888936
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35882869
has answer: http://stackoverflow.com/a/31202575
has comment: http://stackoverflow.com/comment/35882604
score: 2
has comment: http://stackoverflow.com/comment/35976986

http://stackoverflow.com/a/23311689
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/35689575
has comment: http://stackoverflow.com/comment/35689702
answers question: http://stackoverflow.com/q/23311607
has comment: http://stackoverflow.com/comment/35689936
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: If I absolutely had to store my colors in a text file, I would use the int getRGB() method, translate the number to hex, and store the int as a String. Then parsing it back to an int and then a color would be trivial. e.g., public static void writeOutMethod1(File file, List&lt;Color&gt; colorList) throws FileNotFoundException { PrintWriter pw = new PrintWriter(file); for (Color color : colorList) { pw.printf("%08x ", color.getRGB()); } pw.close(); } If I had to use Strings that are humanly understandable, I'd create my own Map to associate Strings with a color.
accepted answer of: http://stackoverflow.com/q/23311607

http://stackoverflow.com/q/23301290
tagged with: google-cloud-endpoints
answer count: 0
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question
tagged with: blobstore
has body: We're trying to build application which will store images to blobstore. I used the code from here and added it to endpoint project. Now the /uploaded servlet returns to client JSONObject like this: json.put("servingUrl", servingUrl); json.put("blobKey", blobKey); There is a PictureEntity class. Where the field blobKey is of the type BlobKey and I can send another HttpPost request with all needed data to server, get the needed String from html entity and apply picture.setBlobKey(blobKey); on server side. But since I use EndPoints I don't want to transfer all the data again to another servlet on the server. I want to use endpoints. And it seems that they should somehow support BlobKey type. At least GAE creates model for them but when I try to do the same on client side I always get an error: The method setBlobKey(BlobKey) in the type PictureEntity is not applicable for the arguments (String) Any help would be appreciated. Thanks!
score: 0
has comment: http://stackoverflow.com/comment/35672502
has comment: http://stackoverflow.com/comment/35672093
linked to: http://stackoverflow.com/q/22168930
type: UnansweredQuestion
tagged with: android
has title: Get BlobKey type from JSON Object

http://stackoverflow.com/comment/35670386
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/23300419
has text: @user3574052 Updated my example with key1 -> sort by id, key2 -> sort by name. The idea behind should be clear.
score: 0

http://stackoverflow.com/comment/35688798
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23310988
has text: your coming up against knowledge that you need to acquire. read more learn more. look through the questions here for background on things that you can learn. if your curious about programming you will get better. if your doing it for a career but not interested then I would suggest you try something else that interests you more.

http://stackoverflow.com/comment/35746001
score: 2
has text: Hibernate is an ORM framework, not MVC. If you're doing a LOT of data manipulation, it will not perform very well either. You could look into Spring...? I would ask your supervisor...
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23342739

http://stackoverflow.com/comment/35830791
type: Comment
comment on: http://stackoverflow.com/q/23387949
type: QuestionComment
has text: Then the problem is in your query per se, we can't help you there since we have no idea of your database structure. Do you have rows in your randomstuff table?
score: 0

http://stackoverflow.com/comment/35949449
comment on: http://stackoverflow.com/a/23451868
type: Comment
score: 0
type: AnswerComment
has text: Well based on what you both mentioned `instanceof` checks if a class is an instance of a class but as I just learned it also checks, and returns true, if you're checking with the subclass of the given class such as my `EnglishQuiz`.

http://stackoverflow.com/comment/35784931
type: AnswerComment
has text: @AbimaranKugathasan I am quoting from an article, *As per the rules of Java programming language only classes or interfaces (collectively known as Type) from same Type hierarchy can be cast or converted into each other. If you try to cast two object which doesn't share same type hierarchy, i.e. there is no parent child relationship between them, you will get compile time error.* Read more: http://javarevisited.blogspot.com/2012/12/what-is-type-casting-in-java-class-interface-example.html#ixzz30H94woEC`
type: Comment
comment on: http://stackoverflow.com/a/23363736
score: 0

http://stackoverflow.com/comment/54007697
comment on: http://stackoverflow.com/a/23349234
type: Comment
has text: @Nathan That is correct. If you are using classpath scanning to create a `LocaleInterceptor` that is a Spring Bean, then you naturally need the `@Component` annotation. Otherwise you could configure the Spring Bean in XML or Java Config
score: 0
type: AnswerComment

http://stackoverflow.com/q/23329033
tagged with: jframe
tagged with: swing
type: Question
tagged with: java
tagged with: jpanel
has title: Putting sprites over background in a game
score: 0
has comment: http://stackoverflow.com/comment/35721733
answer count: 1
has comment: http://stackoverflow.com/comment/35721776
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23329649
has body: I'm having trouble loading a sprite into a game. I have the background done, but the sprite doesn't seem to be on the background. I want to assume you put it in the main constructor, but I don't think it will work. package MyGamePKG; import java.awt.BorderLayout; public class GameJFrame extends JFrame { private JPanel contentPane; private int x,y,x_vel,y_vel; /** * Launch the application. */ public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { GameJFrame frame = new GameJFrame(); frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } /** * Create the frame. */ public GameJFrame() { setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(100, 100, 720, 520); contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); setContentPane(contentPane); contentPane.setLayout(null); GameJPanel Jpanel = new GameJPanel(); Jpanel.setBounds(0, 0, 720, 480); contentPane.add(Jpanel); Jpanel.setLayout(null); JLabel lblNewLabel = new JLabel("New label"); lblNewLabel.setIcon(new ImageIcon(GameJFrame.class.getResource("/Resources/gamemap.png"))); lblNewLabel.setBounds(0, 0, 720, 480); contentPane.add(lblNewLabel); } } The JPanel class package MyGamePKG; import java.awt.BasicStroke; public class GameJPanel extends JPanel implements ActionListener, KeyListener { private int frameRate = 30; private int x=0; private int y=460; private int x_vel, y_vel; private Image map; private Image character; /** * Create the panel. */ public GameJPanel() { character = new ImageIcon(getClass().getResource("/resources/sprite-concepts.png")).getImage(); this.addKeyListener(this); this.setFocusable(true); Timer timer = new Timer(30, this); timer.start(); } @Override public void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2d = (Graphics2D) g; RenderingHints rh = new RenderingHints( RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2d.setRenderingHints(rh); this.setOpa…

http://stackoverflow.com/comment/35961393
score: 1
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23450604
has text: See also *Card Layout Actions*, cited [here](http://stackoverflow.com/a/5657106/230513).

http://stackoverflow.com/comment/35826965
has text: @DeepchandSingh it not working
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23386294

http://stackoverflow.com/comment/113675524
type: Comment
has text: looks like this was fixed before 2013 src: http://hg.openjdk.java.net/jdk/jdk11/file/1ddf9a99e4ad/src/jdk.management/unix/native/libmanagement_ext/OperatingSystemImpl.c#l372
comment on: http://stackoverflow.com/a/59997290
type: AnswerComment
score: 0

http://stackoverflow.com/a/52875316
upvote count: 2
type: Answer
downvote count: 1
has comment: http://stackoverflow.com/comment/92664337
score: 1
has body: EntityManager entityManager; @Autowired public Service(final EntityManager entityManager) { this.entityManager = entityManager; } entityManager.clear(); This works for me, thanks
answers question: http://stackoverflow.com/q/23339274

http://stackoverflow.com/comment/35854544
has text: In Java, unicode escapes are resolved before the source is even parsed. So your second method is perfectly fine; it becomes a literal character 221A. Fun fact: you can write valid Java source consisting entirely of unicode escapes.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23401209
score: 2

http://stackoverflow.com/comment/35724088
has text: That is right but then `getLocation()` returns the UTF-8 index which means that I would need to read the whole file before I know the byte index.
type: Comment
comment on: http://stackoverflow.com/a/23330264
type: AnswerComment
score: 0

http://stackoverflow.com/a/23358349
upvote count: 1
answers question: http://stackoverflow.com/q/23334776
downvote count: 0
has comment: http://stackoverflow.com/comment/35825580
type: Answer
has body: How to close java console in mac when page get navigates to other page.? The console disappearing is subject to decisions by the JVM. Typically it will be left on-screen as long as the JVM runs, and that is significantly later than when the user navigates away from the page. The console can be configured (by the user or their system administrator) to not show at all. Anything beyond visible/not visible is not open to our control and you should not worry about, it is just wasting time.
score: 1

http://stackoverflow.com/a/23356872
has comment: http://stackoverflow.com/comment/35773073
score: -1
type: Answer
has body: Why is not your HashTable generic itself? HashTable&lt;T&gt; nicely solves your problem: this.table = new GenericLinkedList&lt;T&gt;[SIZE]; You might also use GenericLinkedList&lt;?&gt;.
downvote count: 2
has comment: http://stackoverflow.com/comment/35772707
upvote count: 1
answers question: http://stackoverflow.com/q/23356807

http://stackoverflow.com/a/23336193
score: 6
upvote count: 6
downvote count: 0
answers question: http://stackoverflow.com/q/23336138
type: Answer
has body: From the String doc : Returns a hash code for this string. The hash code for a String object is computed as s[0]*31^(n-1) + s[1]*31^(n-2) + ... + s[n-1] and since your string is empty it will result with 0.

http://stackoverflow.com/comment/35888536
score: 0
type: Comment
has text: Hmmm, an arbitrary prefix might be quite difficult to figure out... Is there any way of distinguishing the prefix from the rest of the file name? In your example names, there's a dash for Anti and a space for Phillips
comment on: http://stackoverflow.com/a/23417783
type: AnswerComment

http://stackoverflow.com/comment/35805340
score: 1
has text: @Xanathos Yes, if you would like to keep the backslashes in the regular expression, you need to escape each one of them with a backslash.
type: AnswerComment
comment on: http://stackoverflow.com/a/23374246
type: Comment

http://stackoverflow.com/q/23444878
answer count: 1
linked to: http://stackoverflow.com/q/24577613
has comment: http://stackoverflow.com/comment/38118139
tagged with: java
has comment: http://stackoverflow.com/comment/35935953
tagged with: import
downvote count: 0
tagged with: javascript
type: UnansweredQuestion
score: 1
has comment: http://stackoverflow.com/comment/35935839
favorite count: 0
linked to: http://stackoverflow.com/q/1878052
has comment: http://stackoverflow.com/comment/35935807
type: Question
tagged with: eval
has answer: http://stackoverflow.com/a/24601860
has title: Java ScriptEngine - Disable Importing
has comment: http://stackoverflow.com/comment/35935896
upvote count: 1
has body: I've been searching everywhere and have found nothing, so I would like use Java's inbuilt JavaScript engine, but whilst users can't import java class, like any of the following: importPackage(package.example); or importClass(package.example.MessWithEverythingClass) or new package.example.MessWithEverythingClass(ApplicationIsBroken aib);
tagged with: scriptengine

http://stackoverflow.com/comment/36380357
type: Comment
comment on: http://stackoverflow.com/a/23674988
has text: I tried a few combinations using filters but I think I have found [a bug](https://github.com/ronmamo/reflections/issues/26) preventing this from being useful.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/35884339
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23416818
score: 0
has text: That's probably because `b` and `g` are never increased. Add `System.out.println(b);` etc to see whats happening. Or better yet - use a debugger.

http://stackoverflow.com/comment/35732152
score: 0
type: QuestionComment
type: Comment
has text: those links are added dynamically, so you need code that is already changed by javascript not the original one
comment on: http://stackoverflow.com/q/23334543

http://stackoverflow.com/a/49508867
type: Answer
answers question: http://stackoverflow.com/q/23421359
downvote count: 0
has body: For each request new instance of Action class is created. So there is no thread safety issue with struts 2 action class.
score: 1
upvote count: 1

http://stackoverflow.com/comment/35930674
score: 0
comment on: http://stackoverflow.com/a/23441167
type: Comment
has text: @Battle_Slug Now you are diverting from your actual question.
type: AnswerComment

http://stackoverflow.com/q/23295654
possible better answer: http://stackoverflow.com/a/23356946
upvote count: 1
type: AnsweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/35713203
accepted answer: http://stackoverflow.com/a/23316727
type: Question
answer count: 2
has title: Send String to OBDII
downvote count: 0
tagged with: string
tagged with: android
has answer: http://stackoverflow.com/a/23356946
has answer: http://stackoverflow.com/a/23316727
has comment: http://stackoverflow.com/comment/35757148
favorite count: 0
has body: I want to send a String to an OBD2 Adapter, to read some information, for example the battery voltage. So I wrote this little program: public class MainActivity extends Activity { private BluetoothAdapter mBluetoothAdapter = BluetoothAdapter .getDefaultAdapter(); private ConnectedThread connected; private boolean isConnected = false; // private final BluetoothSocket mmSocket; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } // Button ruft die Methode verbindung auf!!!! public void verbinden(View view) { verbindung(); Toast.makeText(getApplicationContext(), "Verbunden!", Toast.LENGTH_LONG).show(); } // Senden Button public void senden(View view) { String message; EditText Message = (EditText) findViewById(R.id.TFKonsole); message = (Message.getText().toString()); Toast.makeText(getApplicationContext(), "Nachricht gesendet!", Toast.LENGTH_LONG).show(); for (int i = 0; i &lt; message.length(); i++) { char c = message.charAt(i); String bereit = Integer.toHexString(c); System.out.println(bereit); byte[] send = bereit.getBytes(); connected.write(send); //connected.write(abschluss); } } // Trennen Butto public void trennen(View view) { connected.cancel(); } // Verbindung wird ausgeführt private void verbindung() { String address = "AA:BB:CC:11:22:33"; // Adresse vom Dongle(ITEM) // 00:0D:18:06:00:00 ADRESSE VOM // DONGEL (ANDREAS) // 00:0D:18:3A:67:89 // B8:E8:56:41:74:09marco // 00:09:DD:42:5B:AA adresse // bluetoothstick BluetoothDevice device = mBluetoothAdapter.getRemoteDevice(address); ConnectThread connect = new ConnectThread(device); connect.start(); // connected.write(null); } private class ConnectThread extends Thread { private final BluetoothSocket mmSocket; private final BluetoothDevice mmDevice; public ConnectThread(BluetoothDevice device) { // mBluetoothAdapter.cancelDiscovery(); // Use a temporary object that is later assigned to mmSocket, // because mmSocket is final …
tagged with: obd-ii

http://stackoverflow.com/comment/35672481
has text: which lines are 21 and 49?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23302147
score: 0

http://stackoverflow.com/comment/35693555
has text: Okay, thanks for your easy best practise. So i should set a cookie with setcookie('login_status', $status_bolean, time() + COOKIE_RUNTIME, "/", COOKIE_DOMAIN); (in PHP for example). And how would you verify the cookie? Could you please clarify that more in detail? I mean am i to paranoia, or wouldnt a user be able to just set local a cookie with the value true, and is then in the DataActivity, of course he wouldnt see anything as he hasnt a valid PHPSessionID. But at least he could enter. How to avoid that? Thanks for your support and the fast reply
type: AnswerComment
comment on: http://stackoverflow.com/a/23312817
score: 0
type: Comment

http://stackoverflow.com/comment/35824992
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23385326
type: QuestionComment
has text: propably you need an "enclosing" array (an array of arrays) `[[{"id":"id","name":"","age":"","desig":"salary","dept":""}],...,Hello]`

http://stackoverflow.com/q/23451903
favorite count: 0
has body: How can I create value of type String and also Collection? I want someTimes put in this Strings and the othertimes put collections. for example in javascript I would do var k; if (someBoolean){ k=1; } else{ k=[1,2,3]; } can I get this behavior of the variable in java, hack or something? I found Solution: I created an interface and declear this Objects as this interface.
linked to: http://stackoverflow.com/q/7976643
has comment: http://stackoverflow.com/comment/35949391
has comment: http://stackoverflow.com/comment/35949429
downvote count: 6
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/35949360
accepted answer: http://stackoverflow.com/a/23451954
type: Question
has comment: http://stackoverflow.com/comment/35949481
has comment: http://stackoverflow.com/comment/35949380
linked to: http://stackoverflow.com/q/4441017
has title: JAVA variable as 2 types
possible better answer: http://stackoverflow.com/a/23451952
answer count: 2
has comment: http://stackoverflow.com/comment/35949404
upvote count: 0
tagged with: types
has answer: http://stackoverflow.com/a/23451952
tagged with: variables
score: -6
has answer: http://stackoverflow.com/a/23451954

http://stackoverflow.com/comment/35871921
has text: Thanks for your prompt reply. I want the session size between 500KB and 1mb and 100 concurrent users. Every thing that could be done to my knowledge already done. If I use a database server, couldn't it be a performance issue?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23409517
score: 0

http://stackoverflow.com/comment/35765418
comment on: http://stackoverflow.com/q/23352084
type: Comment
score: 0
type: QuestionComment
has text: I'm trying to create a more efficient activity switch in my android app. I have all the images in one class and load only the ones that are need and recycles those that aren't need. Because a lot of images are used between activities, it saves time not having to reload them. Also this makes it easy to recycle images no longer in use, thus saving memory.

http://stackoverflow.com/comment/35916953
type: AnswerComment
comment on: http://stackoverflow.com/a/23422990
score: 0
type: Comment
has text: @Joffrey said, "an A instruction and a B instruction could be executed simultaneously". That is true, but in most mathematical models of concurrent computing, events are never simultaneous. Either it can be shown that A happens before B, or it can be shown that B happens before A, or neither case can be shown. Eliminating the concept of "simultaneous" simplifies the algebra. _Events_ are never simultaneous, but _intervals_ (e.g., a function call that has a "begin" event and an "end" event) can _overlap_.

http://stackoverflow.com/q/23435365
has answer: http://stackoverflow.com/a/23435495
has comment: http://stackoverflow.com/comment/35923003
has comment: http://stackoverflow.com/comment/35922864
answer count: 1
has comment: http://stackoverflow.com/comment/35922921
score: 0
type: UnansweredQuestion
has body: Fortunately, I think I know why the code isn't working but I am just having difficulties fixing it. The error that I am getting is java.lang.ArrayIndexOutOfBoundsException: 2. What I believe is incorrect here is on the last line of code when the for loops increment up to 2, 'j' in Matrix2 [k] [j] denotes columns and since the columns can't be more than 1 in Matrix2, I get that error. The result that I should be getting by multiplying both the matrices : -3 43 18 -60 1 -20 int[][] Matrix1 = {{1,2,-2,0}, {-3,4,7,2}, {6,0,3,1}}; int[][] Matrix2 = {{1,3}, {0,9}, {1,-11}, {4,-5}}; int [][] MultipliedMatrix = new int [3][2]; for (int i=0; i&lt;Matrix1.length; i++) for (int j=0; j&lt;Matrix2.length; j++) for (int k=0; k&lt;Matrix2.length; k++) MultipliedMatrix[i][j] += Matrix1[i][k] * Matrix2[k][j] ;
has comment: http://stackoverflow.com/comment/35922792
has comment: http://stackoverflow.com/comment/35918366
has comment: http://stackoverflow.com/comment/35918411
has title: Matrix Multiplication Error { Happen to know the error but having difficulties fixing it}
tagged with: java
tagged with: matrix-multiplication
type: Question

http://stackoverflow.com/q/23393438
tagged with: http://stackoverflow.com/tag/json
has answer: http://stackoverflow.com/a/23456055
has body: I have a Cloudify 2.7.0 instance running. I need to access Cloudify's API from a Java application and I found an incongruity between the returned JSON and the one which is documented in the Cloudify documentation. The API is /service/applications In the documentation I can read that it should return the following JSON string { "status" : "success", "response" : [ "petclinic", "travel" ] } But if I do the same request to my Cloudify instance I get the following JSON string { "status" : "success", "response" : { "petclinic": "", "travel":"" } } In the java application the JSON information is stored in the following POJO (generated with JSONSchema2POJO) // CloudifyResponse.java public class CloudifyResponse { @JsonProperty("response") private Response response; @JsonProperty("status") private String status; // getters and setters } // Response.java public class Response { @JsonProperty("helloworld") private String helloworld; @JsonProperty("petclinic") private String petclinic; // getters and setters } I use the Jackson library to deserialize JSON into POJO. As you can see the JSON string is deserialized into a POJO in which every istantiated application is a POJO's field. This might be a big problem for the development of the application. In fact, as the instances of the application change, the returned JSON changes and we need to update the POJO structure, something I can't do at runtime. Do you know whether the Cloudify API has changed the response JSON structure? Is there any way to get the documented JSON output instead of the one I get. Thank you in advance Giulio
type: AnsweredQuestion
downvote count: 0
score: 1
favorite count: 0
tagged with: rest
type: Question
accepted answer: http://stackoverflow.com/a/23456055
tagged with: java
upvote count: 1
tagged with: cloudify
answer count: 1
has title: Incongruity between Cloudify documentation for a REST response and the one I get

http://stackoverflow.com/q/23305335
score: 0
has title: Minecraft, Custom Libraries and LWJGL
answer count: 1
type: UnansweredQuestion
tagged with: java
tagged with: lwjgl
has body: What would be my best bet for trying to roll my own libraries when I want to launch Minecraft on an ARM device? Standard Mojang repositories only have x86 versions of LWJGL in particular, and trying to overwrite the copies in .minecraft/libraries with armhf version triggered a corrupt file error and a redownload cycle with the x86 version.
type: Question
has answer: http://stackoverflow.com/a/23305870
tagged with: minecraft

http://stackoverflow.com/comment/35924931
type: AnswerComment
type: Comment
score: 1
has text: for best results use `<T extends Comparable<? super T>>`
comment on: http://stackoverflow.com/a/23419879

http://stackoverflow.com/comment/35920977
has text: Please acquaint yourself with the Stack Overflow help file [here](http://stackoverflow.com/help), paying special attention to the section "What topics can I ask about here?" Also, check out the [Java Tutorial](http://docs.oracle.com/javase/tutorial/uiswing/).
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23436678

http://stackoverflow.com/comment/35712513
comment on: http://stackoverflow.com/q/23324156
type: Comment
type: QuestionComment
has text: AlexR already answered it correctly. Sorry if anything was unclear but Alex has understood it the way i wrote the question.
score: 0

http://stackoverflow.com/q/23324698
downvote count: 2
has comment: http://stackoverflow.com/comment/35713314
type: Question
has comment: http://stackoverflow.com/comment/35713574
has comment: http://stackoverflow.com/comment/35713667
has body: why assignment of binary to float or double is causing an error. here is my first code which works well- float myFloat1 = 0b111; //prints 7.0 double myDouble1 = 0b111; //prints 7.0 here is the second code float myFloat2 = 0b111f; //compiler complains ';' expected double myDouble2 = 0b111d; //compiler complains ';' expected In the second code compilers complains that ';' expected, what's going on in second code snippet? Any help will be greatly appreciated.
has answer: http://stackoverflow.com/a/23476251
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/35713607
has comment: http://stackoverflow.com/comment/35713444
possible better answer: http://stackoverflow.com/a/23324791
tagged with: binary-data
favorite count: 0
has answer: http://stackoverflow.com/a/23324791
accepted answer: http://stackoverflow.com/a/23476251
tagged with: variable-assignment
has comment: http://stackoverflow.com/comment/35713410
has comment: http://stackoverflow.com/comment/35713609
has title: binary to float or double assignment error
type: AnsweredQuestion
upvote count: 2
tagged with: java

http://stackoverflow.com/comment/35839776
type: Comment
type: QuestionComment
score: 0
has text: You must check the values before converting it. Or use something like that http://stackoverflow.com/questions/14319064/how-to-validate-a-jtextfield-to-accept-only-interger-numbers
comment on: http://stackoverflow.com/q/23393452

http://stackoverflow.com/comment/42450193
has text: In addition to that you also need to edit the GameHelper class of the BaseGameUtils if you are using the latest Google Play Services. Edited file can be found here: https://gist.github.com/EmmanuelVinas/ef09a35bcc805ba6deb3
comment on: http://stackoverflow.com/a/24949343
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/54139636
comment on: http://stackoverflow.com/a/23375511
type: Comment
has text: Then you need to redesign something because your design is currently causing you that problem.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/35683960
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23304460
type: AnswerComment
has text: I changed them to GL11.glTexCoord2f(0.625f, 0.702f); and it works fine for all textures now (for example if I put 16, 16 before it would do 10x10, now it is 16x16) Thank you for your help :)

http://stackoverflow.com/q/23306176
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35679815
has title: Need to update a variable inside a while loop
tagged with: java
tagged with: loops
type: Question
has body: I am trying to define a main method that asks the user for an input (x). If the value is >= 0, it asks for another input (y). But if the value was &lt; 0 the player has three chances to enter a correct value, otherwise he exits the game. This is what I have until now: Scanner keyboard = new Scanner(System.in); final int NUMBER_OF_TRIES = 3; boolean correctNumber = false; int attemptNumber = 0; int x = keyboard.nextInt(); keyboard.nextLine();; while (x &lt; 0) { System.out.println("Must not be negative."); System.out.print("Initial x: "); int x = keyboard.nextInt(); keyboard.nextLine(); if (x &gt;= 0) { correctNumber = true; } else { System.out.println("Incorrect answer"); attemptNumber++; } if(x &lt; 0 &amp;&amp; attemptNumber == NUMBER_OF_TRIES) { System.out.println("Too many errors. Exiting."); break; } But as I already defined 'x', I cannot do it again inside the loop. I think my problem is really simple but I cannot figure out a way to fix that. Does anyone know how?
answer count: 2
tagged with: variables
score: 0
tagged with: while-loop
has answer: http://stackoverflow.com/a/23306413
has answer: http://stackoverflow.com/a/23306229

http://stackoverflow.com/q/23306491
has title: How to make a custom module in Mobile OpenERP (android)?
score: 1
tagged with: java
has body: OpenERP in python is very easy to understand and work with. But in Android, it seems a little difficult. I'm studying mobile openERP framework to be able to CRUD with server database(postgreSQL). I don't know how to create a module in it. Any idea....?
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/23427372
tagged with: odoo
has answer: http://stackoverflow.com/a/23422272
answer count: 2
downvote count: 0
favorite count: 0
tagged with: postgresql
type: UnansweredQuestion
tagged with: android

http://stackoverflow.com/a/23434993
downvote count: 0
type: Answer
has body: You probably want to be looking at using the Stanford PoS tagger (http://nlp.stanford.edu/software/tagger.shtml). It will tag the string with it's classification (e.g. verb, noun). You can then use a regular expression to pull out the verbs.
score: 3
has comment: http://stackoverflow.com/comment/35917730
upvote count: 3
answers question: http://stackoverflow.com/q/23434967

http://stackoverflow.com/q/23389856
has title: How to create an invoice entity using the QuickBooks Online Java SDK
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/23390805
type: Question
answer count: 1
tagged with: quickbooks-online
tagged with: intuit-partner-platform
tagged with: quickbooks
has body: I'm referring to version v3 (2.2.1) of the SDK. I'm trying to figure out what I need to do to create an invoice. My issue is not any errors or connection issues, it's just that the docs seem to be poor and there's no examples. So what I have is: BatchOperation batch= new BatchOperation(); Invoice invoice = new Invoice(); invoice.set... ... batch.addEntity(invoice, OperationEnum.CREATE, "bID"); The problem is that I just don't understand how the many setter methods for the Invoice entity would correspond to a general invoice e.g. the ID, customer identifer etc. If anyone has done this before could you give me an example of the kinds of setters that I might want to use for a generic invoice. My main problem here is that the explanations for all the Invoice setters (and getters) in the JavaDoc are like: setAllowIPNPayment(Boolean value) Sets the value of the allowIPNPayment property. ...and they're all like that e.g. Sets the value of the [X] property.
score: 0
accepted answer: http://stackoverflow.com/a/23390805

http://stackoverflow.com/comment/35948780
comment on: http://stackoverflow.com/q/23451389
has text: @PM77-1 Let's not all start guessing what he means. It's up to him to explain.
type: QuestionComment
type: Comment
score: 1

http://stackoverflow.com/a/23298575
type: Answer
answers question: http://stackoverflow.com/q/23296275
score: 0
has body: You can get the class by using the getClass method, like: o.getClass() also, if you have a class c and you need to check whether o is an instance of c, you can use instanceof, like this: o instanceof c Cheers.

http://stackoverflow.com/q/23368585
tagged with: java
tagged with: percentage
has answer: http://stackoverflow.com/a/23368694
type: Question
answer count: 2
upvote count: 1
has body: I have a problem. I have this program that I'm supposed to create, it's supposed to read the grade for two quizzes that both add up to 25 percent of the students total grade, a midterm exam that is 25 percent of the students grade and a final exam that is 50 percent of total grade. When I run the program everything is ok except when I put 7 for first quiz grade , 8 for second quiz grade, 90 for midterm and 80 for final the total grade should be 81.25 percent but instead it displays .8125 and automatically gives the student an F. i don't know how to fix it.... import java.util.Scanner; public class StudentClass { // calculate grade first then the if else statements for the letter grade public static Scanner grades = new Scanner (System.in); public static double quiz1, quiz2, midterm, finalExam, Grades, totalGrade, bothQuizzes, PfinalExam, PmidTerm; public static String studentname; public static int Score; public String getstudentname( ) { return studentname; } public double getquiz1() { return quiz1; } public double getquiz2 () { return quiz2; } public double midterm() { return midterm; } public double finalExam() { return finalExam; } public void setquiz1 (double quiz1) { this.quiz1 = quiz1; } public void setquiz2 (double quiz2) { this.quiz2 = quiz2; } public void setmidterm() { this.midterm = midterm; } public void setfinalExam() { this.finalExam = finalExam; } public void setGrades () { } public String toString(){ return this.quiz1 + " " + this.quiz2 + " " + this.midterm + " " + this.finalExam; } public static void readInput(){ System.out.println("Please enter the grade you got for the first quiz: "); quiz1 = grades.nextInt(); while (quiz1 &lt;0 || quiz1&gt;10) { System.out.println("Please enter a grade between zero and ten: "); quiz1 = grades.nextInt(); } System.out.println("Please enter the grade you got for the second quiz: "); quiz2 = grades.nextInt(); while (quiz2 &lt;0 || quiz2&gt;10) { System.out.println("Please enter a grade between zero and ten: "); quiz…
favorite count: 0
has comment: http://stackoverflow.com/comment/35794676
type: UnansweredQuestion
score: -3
has comment: http://stackoverflow.com/comment/35794234
has answer: http://stackoverflow.com/a/23368610
downvote count: 4
has title: need help on java grading program? i need to make a program that reads the percentage of a students total grade

http://stackoverflow.com/comment/35804094
score: 0
comment on: http://stackoverflow.com/q/23327395
type: Comment
type: QuestionComment
has text: How does your job launch the processes on the sister nodes?

http://stackoverflow.com/a/23400835
has body: Whilst I am yet to find a solution, there is a work-around - you can get the arguments from the join point. The following is what I have decided on: @Around(value = "execution(com.a.b.SearchResults " + "com.a.b.BmcClmRestJsonClient.getRelation(*, *, ..))") public SearchResults getRelationVarargs(ProceedingJoinPoint jp) And I extract the arguments from the join point as follows: Object[] args = jp.getArgs(); ClmUserContextFactory contextFactory = (ClmUserContextFactory) args[0]; CloudObjectId objectId = (CloudObjectId) args[1]; Class&lt;? extends CloudClass&gt;[] relationClasses = null; if (args.length == 3) { relationClasses = (Class&lt;? extends CloudClass&gt;[]) args[2]; } This obviously would not be good enough if you needed to specify the arguments for the pointcut in order for it to cut in the right places - luckily for me that is not the case.
answers question: http://stackoverflow.com/q/23357752
accepted answer of: http://stackoverflow.com/q/23357752
score: 0
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/q/23337693
has answer: http://stackoverflow.com/a/23344422
has comment: http://stackoverflow.com/comment/35737367
has comment: http://stackoverflow.com/comment/35736900
has answer: http://stackoverflow.com/a/23509463
tagged with: global
answer count: 4
favorite count: 0
has answer: http://stackoverflow.com/a/23337957
tagged with: collections
accepted answer: http://stackoverflow.com/a/23337907
score: 2
type: AnsweredQuestion
downvote count: 0
has body: I'm using collection objects (Arraylist, hashmap mainly). My program is running 24*7. In between sometimes, it throws an exception out of memory Error: Java heap space. I have already given 1gb of space for JVM My Question is whether I need to use Global objects of Collection or local objects for each methods? (Almost 1000000 data I have to process per day continuously 24*7)
tagged with: java
has title: About Java heap space while using Collection objects
tagged with: global-variables
has comment: http://stackoverflow.com/comment/35737574
type: Question
has answer: http://stackoverflow.com/a/23337907
upvote count: 2
has comment: http://stackoverflow.com/comment/35736929
tagged with: local
possible better answer: http://stackoverflow.com/a/23337957

http://stackoverflow.com/q/23407185
tagged with: jsp
tagged with: web
favorite count: 0
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35955622
answer count: 4
score: 1
tagged with: java
downvote count: 1
type: Question
tagged with: testing
has body: What sort of a framework can be used to test a jsp web application? All java classes and the servrlets needs to be tested too. What would be the best approach and related frameworks that can be used in this regard? Update Any other suggestions?
has title: How to test a jsp based web application?
has answer: http://stackoverflow.com/a/35441644
has answer: http://stackoverflow.com/a/23455313
has answer: http://stackoverflow.com/a/23407260
has answer: http://stackoverflow.com/a/23408176

http://stackoverflow.com/a/55000276
has body: ^ for the start, $ for the end Aggregation aggregation = newAggregation( match(Criteria.where("fieldName").regex("^"+searchText+"$","i")) );
answers question: http://stackoverflow.com/q/23423464
upvote count: 7
score: 7
downvote count: 0
type: Answer

http://stackoverflow.com/q/23302259
type: UnansweredQuestion
score: 0
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/35672684
downvote count: 1
type: Question
has title: Binary Search Java
has comment: http://stackoverflow.com/comment/35672754
has answer: http://stackoverflow.com/a/28732200
tagged with: binary-search
answer count: 2
has answer: http://stackoverflow.com/a/23302342
favorite count: 0
has body: Im working on a project in which it reads book titles in from a .txt file and puts them into an arraylist, then the arraylist is converted to an array, The user enters a number which is the books reference number, then it does a linear search and a binary search to find that book. Im just having a trouble with the code for the binary search,as i have almost no idea how to do it, heres what I have: private void FindItActionPerformed(java.awt.event.ActionEvent evt) { String input; input = Input.getText(); for(int i=0; i&lt;bookList.length; i++){ if (bookList[i].referenceNumber.equals(input)){ Output1.setText("The Book is " + bookList[i].title); } } Above is the code for the linear search, which works fine. Below is what i think i need for the binary search but again, i am not sure and cannot figure it out. int right = 0, left = bookList.length; while(right&lt;= left){ int middle = (right + left)/2; if( bookList[middle].referenceNumber.equals(input)){ Output2.setText("The book is " + bookList[middle].title); } } } Here is the class and the arrays public class Book{ String referenceNumber, title; public Book(String _referenceNumber, String _title){ referenceNumber = _referenceNumber; title = _title; } } ArrayList &lt;Book&gt; Books = new ArrayList &lt;Book&gt; (); Book [] bookList; Thanks for any help you may be able to offer, This is a bit tricky for me.

http://stackoverflow.com/q/23389695
type: Question
upvote count: 6
score: 5
downvote count: 1
tagged with: virtual-machine
tagged with: vagrant
tagged with: java
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/32393907
has body: I have to use a Java library that has a lot of bugs on Mac OS X and I can't stop using it. I set up a VM (Ubuntu 13) and set up my development environment there, and that works. But is it possible to be able to keep developing on Mac and set-up IntelliJ IDEA 13.1 to compile -> run my project in a Vagrant environment? I could not find any tutorials with how to do that, and not even sure if that's possible.
tagged with: intellij-idea
answer count: 1
has title: IntelliJ IDEA + Vagrant: compile and run in VM environment
favorite count: 0

http://stackoverflow.com/comment/35824991
comment on: http://stackoverflow.com/a/23384931
type: AnswerComment
score: 0
type: Comment
has text: if you add actors in render() it will add actor each frame. It is unnecessary. You should removing old touchGem1 and adding new one to the Stage inside your touchGem() method.

http://stackoverflow.com/q/23373345
accepted answer: http://stackoverflow.com/a/23373460
tagged with: java
has title: Replying with a json for a Spring Restful Web Service
tagged with: http://stackoverflow.com/tag/json
type: Question
has answer: http://stackoverflow.com/a/23373460
answer count: 2
has body: I have a Spring MVC restful webservice which replies back with list of all products. Currently I am having all the data to return in a List of a Bean. List&lt;ProdBean&gt; results = jdbcTemplate.query("select * from Prods", new RowMapper&lt;ProdBean&gt;() { @Override public ProdBean mapRow(ResultSet rs, int rowNum) throws SQLException { ProdBean gb = new ProdBean(); gb.setProdId(rs.getInt("ProdId")); gb.setProdName(rs.getInt("ProdName")); // Few more params return gb; } }); return results; //I want to convert this to a json object. How can I convert the List&lt;ProdBean&gt; results to create a json object and use it as a return parameter? Smthing like - [{"prodId":1, "prodName":"A"}, {"prodId":2, "prodName":"B"}, ... ] Can this be done using some annotation?
score: 0
possible better answer: http://stackoverflow.com/a/23373463
tagged with: rest
has answer: http://stackoverflow.com/a/23373463
tagged with: spring
tagged with: spring-mvc
type: AnsweredQuestion

maven-plugin
tags question: http://stackoverflow.com/q/23301879
tags question: http://stackoverflow.com/q/23342562
tag name: maven-plugin
tags question: http://stackoverflow.com/q/23448103
type: Tag

http://stackoverflow.com/comment/35861471
comment on: http://stackoverflow.com/a/23404936
has text: Btw. this question was already asked several times, for example [here](http://stackoverflow.com/questions/13999506/threads-with-key-bindings)..
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/35700296
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23317282
has text: That workaround sort of helps, but I still get the same error if I make an inner `Runnable` inside `r` that calls `r.run()`.

http://stackoverflow.com/q/23371847
type: AnsweredQuestion
tagged with: java
upvote count: 1
downvote count: 1
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/35800518
score: 0
has answer: http://stackoverflow.com/a/23371861
favorite count: 0
accepted answer: http://stackoverflow.com/a/23371861
has title: Java certification: "& can have integral as well as boolean operands"
has body: I'm reading a book of Hanumant Deshmukh preparing OCAJP, and I don't understand this: &amp; can have integral as well as boolean operands Why is this true? Edit 01.02.2019 Nice post about bitwise operations: https://www.baeldung.com/java-bitwise-operators
possible better answer: http://stackoverflow.com/a/39886576
has answer: http://stackoverflow.com/a/39886576

http://stackoverflow.com/comment/35933238
score: 0
type: Comment
type: QuestionComment
has text: Code is changed and works now, you can see it bellow. Thanks for the willingness to help me!
comment on: http://stackoverflow.com/q/23431420

http://stackoverflow.com/a/23372865
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/23372674
has body: After checking the user input is not null and is correct. Try this: String userInput; .... String filename; String[] split = userInput.split(" "); //get the first names first character and gets the last name filename = userInput.charAt(0)+split[split.length-1];
upvote count: 2

http://stackoverflow.com/a/33791745
answers question: http://stackoverflow.com/q/23327397
has body: Here is the code, you are looking for: import matlabcontrol.*; public class matlabconnect { public static void main(String[] args) throws MatlabConnectionException, MatlabInvocationException { // create proxy MatlabProxyFactoryOptions options = new MatlabProxyFactoryOptions.Builder() .setUsePreviouslyControlledSession(true) .build(); MatlabProxyFactory factory = new MatlabProxyFactory(options); MatlabProxy proxy = factory.getProxy(); // call builtin function proxy.eval("disp('hello world')"); // call user-defined function (must be on the path) proxy.feval("matlab_file_name"); // close connection proxy.disconnect(); } I have tested the program. It is working well. Do not forget to put your matlab file to its default path.
upvote count: 1
score: 1
downvote count: 0
type: Answer

http://stackoverflow.com/a/23428509
has body: Without line current=current.next; you will stuck forever in while loop, and creation of new Node would never happen, at first iteration(first inserting it would raise an exception) public class Test2 { SListNode head; public void insertEnd(String item) { SListNode current = head; while (current.next != null) { current = current.next; } current.next = new SListNode(item); // this line does not have any meaning, because it is out of while loop scope current = current.next; } public static void main(String[] args) { Test2 test2 = new Test2(); test2.test(); } private void test(){ // keeping head reference head = new SListNode("1"); insertEnd("2"); insertEnd("3"); insertEnd("4"); System.out.println("HEAD "+head.item); SListNode init = head.next; while ( init != null ){ System.out.println("ADDED "+init.item); init = init.next; } } class SListNode { SListNode next; String item; public SListNode(String item) { this.item = item; } } } Ok here is a reconstructed code(simplified). With that line or without program is working.
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/35906339
answers question: http://stackoverflow.com/q/23428073
has comment: http://stackoverflow.com/comment/35905616
accepted answer of: http://stackoverflow.com/q/23428073
has comment: http://stackoverflow.com/comment/35905093
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/q/23439502
answer count: 1
favorite count: 0
has title: explain Hibernate query cache
type: AnsweredQuestion
downvote count: 0
type: Question
accepted answer: http://stackoverflow.com/a/23439748
has body: I read the article in http://www.javalobby.org/java/forums/t48846.html which explain Hibernate Query Cache but I couldn't completely understand how it works. As the article explain: Query query = session.createQuery("from Person as p where p.parent.id=? and p.firstName=?"); query.setInt(0, Integer.valueOf(1)); query.setString(1, "Joey"); query.setCacheable(true); List l = query.list(); The query cache works something like this: *----------------------------------------------------------------------------------------* | Query Cache | |----------------------------------------------------------------------------------------| | ["from Person as p where p.parent.id=? and p.firstName=?", [ 1 , "Joey"] ] -&gt; [ 2 ] ] | *----------------------------------------------------------------------------------------* The combination of the query and the values provided as parameters to that query is used as a key, and the value is the list of identifiers for that query. Question 1: What are identifiers in this? Are they the entities' ID in query result? Question 2: Hibernate's documents say For example, if you cache results of a query against an object, Hibernate needs to keep track of whether any changes have been committed against the object, and invalidate the cache accordingly If the answer for question 1 is YES(they are the entities' ID in query result), Does this mean the cached keep timestamps when a table was last updated and decide to refresh cache if needed?
score: 1
tagged with: java
tagged with: hibernate
tagged with: caching
has answer: http://stackoverflow.com/a/23439748
upvote count: 1

http://stackoverflow.com/comment/35824422
has text: I've added the Stacktrace with 1.5.0.M1. (with older versions it is the same)
score: 0
comment on: http://stackoverflow.com/q/23372114
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35938172
type: Comment
has text: One thing to mention is that struts2 provide `aopalliance-1.0.jar` in the `lib` package.
comment on: http://stackoverflow.com/a/23445440
type: AnswerComment
score: 0

http://stackoverflow.com/a/23307479
has comment: http://stackoverflow.com/comment/35682113
has comment: http://stackoverflow.com/comment/35682426
downvote count: 0
has comment: http://stackoverflow.com/comment/35682238
has comment: http://stackoverflow.com/comment/35682298
answers question: http://stackoverflow.com/q/23307423
has comment: http://stackoverflow.com/comment/35682187
has comment: http://stackoverflow.com/comment/35682196
type: Answer
has comment: http://stackoverflow.com/comment/35682291
has comment: http://stackoverflow.com/comment/35682484
upvote count: 1
has comment: http://stackoverflow.com/comment/35682146
has body: Looking at your existing class 'Die': Constructor is case-sensitive &amp; must match the name of the class. public Die (int numSidesInput) rather than 'die'. roll() taking a parameter conflicts with the class, the class already has a field numberOfSides. getValue() syntax is incorrect. It should just be return value;. But there are some design questions here, as to what would really be a useful/ preferable design for actually using the die/ or dice. Usage &amp; doing things are the fundamental tasks by which design must be measured. Design-wise, a couple of points: There's not much usefulness in separating roll() and getValue(). Ideal design would probably just make roll() return the result. Unless you want to look at the die's value more than once, there's no real need to keep the value in it's state. There's a question as to whether embodying the "number of sides" in a Die instance is actually useful, or whether it would be simpler to just pass "number of sides" as a parameter. With regard to the second, the difference in usage would look like: Die d20 = new Die(20); int playerRoll = d20.roll(); int monsterRoll = d20.roll(); versus: // just a static method now, we've eliminated all state int playerRoll = Die.roll(20); int monsterRoll = Die.roll(20);
score: 1
has comment: http://stackoverflow.com/comment/35682055

http://stackoverflow.com/q/23438908
has title: Replace content of one string with another?
downvote count: 0
possible better answer: http://stackoverflow.com/a/23438978
type: Question
has answer: http://stackoverflow.com/a/23438978
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/23439115
accepted answer: http://stackoverflow.com/a/23439115
has body: How could I replace the letters in a String such as "Hello", with the letters here? String bubbled = "ⓐⓑⓒⓓⓔⓕⓖⓗⓘⓙⓚⓛⓜⓝⓞⓟⓠⓡⓢⓣⓤⓥⓦⓧⓨⓩⒶⒷⒸⒹⒺⒻⒼⒽⒾⒿⓀⓁⓂⓃⓄⓅⓆⓇⓈⓉⓊⓋⓌⓍⓎⓏ"; I was initially just doing a replaceAll ("a","ⓐ"), but I feel like there has to be a more efficient way of doing this.
upvote count: 1
has comment: http://stackoverflow.com/comment/35925275
tagged with: string
has answer: http://stackoverflow.com/a/23439093
tagged with: unicode
favorite count: 0
has answer: http://stackoverflow.com/a/23438936
answer count: 4
type: AnsweredQuestion

http://stackoverflow.com/q/23394535
score: 2
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/2108804
tagged with: operators
favorite count: 0
answer count: 6
has answer: http://stackoverflow.com/a/23394720
has title: Pre/post increment/decrement and operator order confusion
type: Question
has answer: http://stackoverflow.com/a/23394569
has comment: http://stackoverflow.com/comment/35841836
possible better answer: http://stackoverflow.com/a/23394720
downvote count: 1
has answer: http://stackoverflow.com/a/23394701
has answer: http://stackoverflow.com/a/67171905
has answer: http://stackoverflow.com/a/76353673
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/23394576
accepted answer: http://stackoverflow.com/a/23394569
has comment: http://stackoverflow.com/comment/35842259
has body: I was going through some exercises but I am confused in this one: public static int f (int x, int y) { int b=y--; while (b&gt;0) { if (x%2!=0) { --x; y=y-2; } else { x=x/2; b=b-x-1; } } return x+y; } What is the purpose of b=y--? So, for example, x=5 and y=5 when we first go inside of while loop (while (b&gt;0)) will b = 4 or 5? When I am running the code in my computer b is 5. And the return is 3. It is really unclear to me. Sorry if I am unclear in my question.

http://stackoverflow.com/comment/35819750
score: 0
comment on: http://stackoverflow.com/q/23359605
type: Comment
type: QuestionComment
has text: @brian yes that is correct i am putting map for table column but i have a table where inside that table i have implemented a cell factory for another table .baiscall one cell of main table is overideen to fit for a inner table view

http://stackoverflow.com/comment/35653042
comment on: http://stackoverflow.com/q/23291448
score: 0
has text: @sgtHale That should probably be a separate question, and it already exists on SO, but this link seemed to be useful: http://blog.leocad.io/how-to-decompile-dalvik-and-java-code/
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23305669
has answer: http://stackoverflow.com/a/23305851
has body: I've been trying to write a small side-scroller game, but ran into an issue with repaint() not repainting. The key listener itself works, it increments and decrements the x and y values when the directional keys are pressed. Just the repaint() doesn't seem to be repainting. public class SideScroller extends JPanel implements KeyListener{ private Random random = new Random(); private int r,g,b; private int x = 0, y = 0; public void keyPressed(KeyEvent e) { if(e.getKeyCode() == e.VK_UP) { y -= 5; } else if(e.getKeyCode() == e.VK_DOWN) { y += 5; } else if(e.getKeyCode() == e.VK_LEFT) { x -= 5; } else if(e.getKeyCode() == e.VK_RIGHT) { x += 5; } repaint(); } public void keyReleased(KeyEvent e) {} public void keyTyped(KeyEvent e) {} public void paint(Graphics gg) { gg.setColor(new Color(r, g, b)); gg.fillRect (x, y, 50, 50); } public static void main(String[] args) { SideScroller ss = new SideScroller(); JFrame f = new JFrame(); f.add(new SideScroller()); f.setSize(500, 500); f.setLocationRelativeTo(null); f.setResizable(false); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.setVisible(true); f.addKeyListener(new SideScroller()); }
score: 2
downvote count: 0
has answer: http://stackoverflow.com/a/23305793
favorite count: 0
has answer: http://stackoverflow.com/a/23305762
has title: Repainting Graphics Issue
upvote count: 2
tagged with: swing
answer count: 4
accepted answer: http://stackoverflow.com/a/23305851
type: AnsweredQuestion
tagged with: java
tagged with: keylistener
type: Question
tagged with: graphics
has answer: http://stackoverflow.com/a/23306438
possible better answer: http://stackoverflow.com/a/23306438

http://stackoverflow.com/q/23329496
type: Question
has title: JTable resizes according to ScrollPane's size
tagged with: java
tagged with: jtable
score: 0
has body: I am trying to make the JTable adjust its size automatically as I resize the window containing the JTable. As the Example below: http://docs.oracle.com/javase/tutorial/uiswing/examples/components/SimpleTableDemoProject/src/components/SimpleTableDemo.java The JTable will adjust its width, also it has a scroll bar on the right if the height is too small to display all. This one is the JFrame, I use separate class extends JPanel: public class GUIFrame { public static void main(String[] args) { //Setting up JFrame's basic properties JFrame mainFrame = new JFrame("Muney Manager"); mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //Setting up panels: JPanel mPanel = new JPanel(); mPanel.setLayout(new BoxLayout(mPanel,BoxLayout.PAGE_AXIS)); TablePanel tPanel = new TablePanel(); ToolBar buttonPanel = new ToolBar(tPanel); mPanel.add(buttonPanel); mPanel.add(tPanel); //Setting up Panels and Frame to be displayed :3 mainFrame.getContentPane().add(mPanel); mainFrame.pack(); mainFrame.setVisible(true); } This is the one containing the JTable: public class TablePanel extends JPanel { //DefaultTableModel is needed for adding new rows private JTable table; private DefaultTableModel tmodel; private JScrollPane scrollPane; //Table's column name private String[] columnNames = {"Date", "Category", "Details", "Add/Subtract", "Total"}; Object[][] data = { {20140925, "Grocery", "Supermarket", -5.23,600.00}, {20141013,"Car Maintenance", "Changing Tires", -200.00, 400.00} }; public TablePanel() { //Initializing tmodel and putting it into table //It's needed for "adding rows" method tmodel = new DefaultTableModel(data, columnNames); table = new JTable(); table.setModel(tmodel); //Setting up JScrollPane, table Headder //and make scrollPane visible table.setFillsViewportHeight(true); add(new JScrollPane(table)); } For some reason, I can't get it work, what's wrong with my code? The JTable width doesn't resize, also I can't seem to get a Scroll Bar on the right
has comment: http://stackoverflow.com/comment/35722509
has comment: http://stackoverflow.com/comment/35722756
answer count: 1
has answer: http://stackoverflow.com/a/23329673
has comment: http://stackoverflow.com/comment/35722772
accepted answer: http://stackoverflow.com/a/23329673
type: AnsweredQuestion
tagged with: scrollpane

mouse
tags question: http://stackoverflow.com/q/23363421
type: Tag
tags question: http://stackoverflow.com/q/23398744
tag name: mouse

http://stackoverflow.com/comment/35891496
score: 0
type: Comment
type: QuestionComment
has text: @MadProgrammer I want to have JTabbedPane like this - as standard JTabbedPane is not well suitable for "like mozilla".
comment on: http://stackoverflow.com/q/23413785

file-upload
tags question: http://stackoverflow.com/q/23449995
tags question: http://stackoverflow.com/q/23428877
type: Tag
tags question: http://stackoverflow.com/q/23375286
tags question: http://stackoverflow.com/q/23365670
tags question: http://stackoverflow.com/q/23382970
tags question: http://stackoverflow.com/q/23443131
tag name: file-upload
tags question: http://stackoverflow.com/q/23355472

http://stackoverflow.com/q/23305086
tagged with: netbeans
has comment: http://stackoverflow.com/comment/35678846
answer count: 0
has title: NetBeans Java Project will compile on Mac but not PC
tagged with: java
tagged with: javafx
type: Question
score: 0
has comment: http://stackoverflow.com/comment/35679293
has body: I seem to be having an issue building and running a project written in NetBeans. It was originally written on a Macbook, and runs just fine, but when I try and run it from my PC I get the following errors: Exception in Application start method java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:483) at com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:367) at com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:305) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:483) at sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:767) Caused by: java.lang.RuntimeException: Exception in Application start method at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:894) at com.sun.javafx.application.LauncherImpl.access$000(LauncherImpl.java:56) at com.sun.javafx.application.LauncherImpl$1.run(LauncherImpl.java:158) at java.lang.Thread.run(Thread.java:745) Caused by: javafx.fxml.LoadException: file:/C:/Users/K/Documents/Sample/captured-desktop/dist/run537474333/Captured.jar!/com/sample/captured/FXMLMainApp.fxml at javafx.fxml.FXMLLoader.constructLoadException(FXMLLoader.java:2617) at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2595) at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2441) at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3230) at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3191) at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3164) at javafx.fxml.FXMLLoader.loadI…
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35679305

semaphore
type: Tag
tags question: http://stackoverflow.com/q/23380303
tags question: http://stackoverflow.com/q/23395545
tag name: semaphore

http://stackoverflow.com/q/23300935
tagged with: inheritance
tagged with: caching
has body: I have an application (spring/hibernate/ehcache 4.3.5 final) where second level cache is working for the majority of objects. But it seems to be broken at a TABLE_PER_CLASS inheritance model, there seems to be some confusion as to the entity name in the cachekey, objects get saved into the region as the super class name but when it goes to retrieve the object it is using the subclass name. So I have 2 classes, one super and one sub... @Entity //@Indexed @Audited(targetAuditMode=RelationTargetAuditMode.NOT_AUDITED) @Inheritance (strategy = InheritanceType.TABLE_PER_CLASS) @Table(name="group_link_entity") @Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE ) public abstract class GroupLinkEntity { @TableGenerator( name="sequenceGen", table="database_sequence", pkColumnName="GEN_KEY", valueColumnName="GEN_VALUE", pkColumnValue="ENTITY_ID", allocationSize=1) @Id @GeneratedValue(strategy=GenerationType.TABLE, generator="sequenceGen") @Column(name = "ENTITY_ID") protected int id; and @Entity //@Indexed @Audited(targetAuditMode=RelationTargetAuditMode.NOT_AUDITED) @Table(name = "core_node") public class Node extends GroupLinkEntity implements Serializable { The region will be as expected the super class name. first time a load runs it places the object into the second level cache which I can see by running with the stats on the following code Map cacheEntries = ((Session) em.getDelegate()).getSessionFactory().getStatistics().getSecondLevelCacheStatistics( element ) .getEntries(); if( cacheEntries.size() &gt; 0 ){ System.out.println( " ... " + cacheEntries ) ; } prints out... - com.core.dao.GroupLinkEntity ... {1=CacheEntry(com.core.dao.Node)[........ So I know that the Node object with PK 1 is in there. The second time I run through it and expect to get the object from the cache it gets to the get method of NonStrictReadWriteEhcacheEntityRegionAccessStrategy and I can see it looking in the region for a key of... com.core.dao.Node#1 But if I look in the cache objec…
downvote count: 0
has title: hibernate Inheritance caching, incorrect entity names used in CacheKey?
favorite count: 0
tagged with: ehcache
has answer: http://stackoverflow.com/a/24306799
type: Question
answer count: 2
score: 5
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/23324154
upvote count: 5
type: UnansweredQuestion

http://stackoverflow.com/comment/36019153
type: QuestionComment
comment on: http://stackoverflow.com/q/23407969
has text: @Mik378 It seems like they have changed their API and have introduced akka.actor.Inbox. The inbox was not there in 2.0.0. Their getting started examples have changed too. any thoughts about that?
score: 0
type: Comment

http://stackoverflow.com/a/23328802
score: 1
has comment: http://stackoverflow.com/comment/35747334
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23328563
answers question: http://stackoverflow.com/q/23328563
type: Answer
upvote count: 1
has body: Create a ByteArrayInputStream based on the byte array, and then pass this stream to the ZipInputStream constructor. --Edit-- In case that the byte array is too large to keep entirely in memory, you can use piped streams to allow processing of small chunks as they arrive: // Write byte arrays to this stream in the producer thread PipedOutputStream os = new PipedOutputStream(); PipedInputStream in = new PipedInputStream(os); // Read from this stream in the consumer thread ZipInputStream zis = new ZipInputStream(in);

http://stackoverflow.com/comment/35921651
has text: You will want to do some debugging to isolate your error. I suggest that you either use a debugger, such as contained in Eclipse, NetBeans, or most any decent IDE, and step through the code checking the state of your variables, or else use a "poor-man's debugger".
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23436972
score: 0

http://stackoverflow.com/comment/35802057
comment on: http://stackoverflow.com/q/23370449
score: 3
has text: OP, your application may actually be calling `System.exit(0xDEADBEEF)` somewhere inside 3rd party code.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35948976
comment on: http://stackoverflow.com/a/23451393
has text: Is there any other way besides using an ArrayList?
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/23440445
has comment: http://stackoverflow.com/comment/35927976
has comment: http://stackoverflow.com/comment/35929301
has comment: http://stackoverflow.com/comment/35929162
has comment: http://stackoverflow.com/comment/35929113
upvote count: 0
has comment: http://stackoverflow.com/comment/35928370
has comment: http://stackoverflow.com/comment/35930924
tagged with: button
tagged with: android-activity
has answer: http://stackoverflow.com/a/23441132
has comment: http://stackoverflow.com/comment/35928244
favorite count: 0
has body: when try to click on New Activity Button in my MainActivity , my app crash and closed . whit this error on screen " unfortunately[ App Name ] has stopped " I google this problem and i can't find any Definitive solution. here is logCat Log , First Java Source ( MainActivity.java ) and seccond java source ( Seccond.java ) . Logcat Log : 05-03 00:05:17.750: E/AndroidRuntime(1091): FATAL EXCEPTION: main 05-03 00:05:17.750: E/AndroidRuntime(1091): Process: com.example.helloworld, PID: 1091 05-03 00:05:17.750: E/AndroidRuntime(1091): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.helloworld/com.example.helloworld.Seccond}: java.lang.IllegalArgumentException: No view found for id 0x7f05003c (com.example.helloworld:id/container) for fragment PlaceholderFragment{b2d2faf8 #0 id=0x7f05003c} 05-03 00:05:17.750: E/AndroidRuntime(1091): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2195) 05-03 00:05:17.750: E/AndroidRuntime(1091): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245) 05-03 00:05:17.750: E/AndroidRuntime(1091): at android.app.ActivityThread.access$800(ActivityThread.java:135) 05-03 00:05:17.750: E/AndroidRuntime(1091): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196) 05-03 00:05:17.750: E/AndroidRuntime(1091): at android.os.Handler.dispatchMessage(Handler.java:102) 05-03 00:05:17.750: E/AndroidRuntime(1091): at android.os.Looper.loop(Looper.java:136) 05-03 00:05:17.750: E/AndroidRuntime(1091): at android.app.ActivityThread.main(ActivityThread.java:5017) 05-03 00:05:17.750: E/AndroidRuntime(1091): at java.lang.reflect.Method.invokeNative(Native Method) 05-03 00:05:17.750: E/AndroidRuntime(1091): at java.lang.reflect.Method.invoke(Method.java:515) 05-03 00:05:17.750: E/AndroidRuntime(1091): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779) 05-03 00:05:17.750: E/AndroidRuntime(1091): at com.android.internal.os.ZygoteInit.main(Zygote…
has comment: http://stackoverflow.com/comment/35928199
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/35928360
answer count: 4
has comment: http://stackoverflow.com/comment/35928261
tagged with: java
has comment: http://stackoverflow.com/comment/35928100
downvote count: 1
has answer: http://stackoverflow.com/a/23440548
type: Question
has title: I can't move from current activity to another activity
has comment: http://stackoverflow.com/comment/35928444
has answer: http://stackoverflow.com/a/23440712
score: -1
has answer: http://stackoverflow.com/a/23441016

http://stackoverflow.com/comment/36201615
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23424483
has text: no, I do not have marker files submitted in perforce

http://stackoverflow.com/comment/35816316
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23375513
type: Comment
has text: oh sorry. but that was just ia copy past mistake. I edited my question and added the GWTUser.

http://stackoverflow.com/comment/35921187
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23436729
has text: You asssume that that metadata is used only for reflection, which I'm not sure is accurate.
type: Comment

http://stackoverflow.com/comment/35876029
has text: I think this gives a ConcurrentModificationException. You are iterating abcobjects and inside that for loop you are trying to remove object. If you want to do that you need to use CopyOnWriteArrayList
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/23412536

http://stackoverflow.com/q/23365874
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/34364240
has body: When I am running application that uses Akka on Android I receive the following exception: 04-29 16:13:06.235: E/AndroidRuntime(8968): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.myapp/com.myapp.MyActivity}: java.lang.NoSuchMethodException: &lt;init&gt; [interface com.typesafe.config.Config, interface akka.event.LoggingAdapter, interface java.util.concurrent.ThreadFactory] This exception is thrown during actor system creation: Props props1 = Props.create(MyActor.class); ActorSystem system = ActorSystem.create("MySystem"); I assumed that proguard removed a constructor, so I added the following line to my proguard.cfg: -keep class com.typesafe.** { *; } but it didn't help. What am I doing wrong?
has answer: http://stackoverflow.com/a/23366338
accepted answer: http://stackoverflow.com/a/23366338
tagged with: akka
downvote count: 0
tagged with: proguard
favorite count: 0
has comment: http://stackoverflow.com/comment/35788930
upvote count: 2
tagged with: android
has comment: http://stackoverflow.com/comment/35788816
possible better answer: http://stackoverflow.com/a/34364240
score: 2
type: AnsweredQuestion
has title: Akka. Android. NoSuchMethodException: <init>
tagged with: java

http://stackoverflow.com/q/23438999
has title: Using a single EventHandler for entire array in Java
has answer: http://stackoverflow.com/a/23439278
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/35926156
type: Question
tagged with: arrays
answer count: 1
has body: I've looked everywhere online and have been stumped for a few hours now. I have a program where I have an array of 40 imageViews on a screen. What I want to happen is when I click on a particular imageView in the array, I want the image to change within the imageView. Here is what I have: public void initBubbles(){ Image image = new Image("file:src/bubbles/images/bubble.png"); for (int i = 0; i &lt; bubbles.length; i++) { //Creates a new bubble bubbles[i] = new Bubble(image, 'A', 1); //Creates a new image view ivs[i] = new ImageView(image); //Various lines of codes that put the imageView in the scene..... (Not relevant) ivs[i].addEventHandler(MouseEvent.MOUSE_CLICKED, new EventHandler&lt;MouseEvent&gt; () { @Override public void handle(MouseEvent event) { System.out.println("Bubble Popped!"); ivs[i].setImage(new Image("popped.png":); //Will result in arrayOutOfBounds } }); } } The problem I am running into is getting the selected element from the MouseEvent. I understand that the line right after the "Bubble Popped!" message will cause an ArrayOutOfBounds exception. But I hope you understand what I am trying to. How can I get the imageView that was clicked based on the MouseEvent? Any help is greatly appreciated as I've been stuck for a few hours.
tagged with: event-handling
accepted answer: http://stackoverflow.com/a/23439278
score: 0
tagged with: javafx-8

http://stackoverflow.com/q/23326071
has title: Play multiple instances in soundpool
has answer: http://stackoverflow.com/a/23326462
favorite count: 0
tagged with: android
type: AnsweredQuestion
score: 1
tagged with: java
has body: How do I play multiple instances of the same music placed in the code below? Also if I am playing 2 different sounds at once, where do I place that code? public class SoundManager { private SoundPool msoundPool; private HashMap&lt;Integer, Integer&gt; mSoundPoolMap; private AudioManager maudioManager; private Context mContext; public SoundManager() { } public void initSounds(Context theContext) { mContext=theContext; msoundPool=new SoundPool(4, AudioManager.STREAM_MUSIC,0); mSoundPoolMap=new HashMap&lt;Integer, Integer&gt;(); maudioManager=(AudioManager)mContext.getSystemService(Context.AUDIO_SERVICE); } public void addSounds(int Index,int soundId) { mSoundPoolMap.put(1, msoundPool.load(mContext, soundId,1)); } public void playSound(int index) { int streamVolume=maudioManager.getStreamVolume(AudioManager.STREAM_MUSIC); msoundPool.play(mSoundPoolMap.get(index), streamVolume, streamVolume, 1, 0, 1f); } public void playLoopedSound(int index) { int streamVolume=maudioManager.getStreamVolume(AudioManager.STREAM_MUSIC); msoundPool.play(mSoundPoolMap.get(index), streamVolume, streamVolume, 1, -1,1f); } } My main method is as follows: I have called this in the onCreate method m=new SoundManager(); m.initSounds(getBaseContext()); m.addSounds(1, R.raw.sound); Button button=(Button)findViewById(R.id.button11); button.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { m.playSound(1); } }); }
accepted answer: http://stackoverflow.com/a/23326462
upvote count: 1
type: Question
tagged with: soundpool
answer count: 1
downvote count: 0

http://stackoverflow.com/comment/35715786
type: QuestionComment
comment on: http://stackoverflow.com/q/23326001
score: 0
type: Comment
has text: "Returns nothing." Are you just being careless? ;)

http://stackoverflow.com/comment/35943583
type: QuestionComment
comment on: http://stackoverflow.com/q/23447620
has text: Perhaps the dependency is located successfully (otherwise the error would be different), and it's just some bug in the build. So it's back to asking the authors/maintainers of the build.
score: 0
type: Comment

http://stackoverflow.com/comment/35970463
type: Comment
has text: @Kelenth : You are welcome . I even often stumbled already on the wrong path assignment.
comment on: http://stackoverflow.com/a/23460921
type: AnswerComment
score: 0

http://stackoverflow.com/comment/35668613
type: Comment
has text: Yes it worked! Thank you. What would you suggest i change my if statements too? As the problem i get now is those system line prints, stay the same. Do i need a sort of clear before i press the different buttons?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23299518

http://stackoverflow.com/comment/35838484
has text: And if you try to generate a file and upload it with curl? e.g. `dd if=/dev/zero of=file.txt count=1 bs=12582912 && curl -i -F name=test -F filedata=@file.txt http://localhost:9000`, this should tell us what server sends back. You can also check if my code which works for me works for you https://dl.dropboxusercontent.com/u/279703/issue_23365670.tar.gz
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23365670
type: QuestionComment

http://stackoverflow.com/comment/35894986
type: Comment
comment on: http://stackoverflow.com/a/23422529
has text: Sorry I am not seeing from the OP's question about any trouble with Authentication.
score: 0
type: AnswerComment

http://stackoverflow.com/a/23357738
has body: This is a side-effect of the JDBC probe. If you disable the JDBC probe, this will no longer be the case. In JProfiler 8, the probe system has been rewritten to be more efficient and this is no longer the case.
answers question: http://stackoverflow.com/q/23350273
score: 0
type: Answer

http://stackoverflow.com/a/23451754
type: Answer
answers question: http://stackoverflow.com/q/23450675
has body: If you have added android.support.v7 library,replace every getActionBar() with getSupportActionBar()
score: 0
has comment: http://stackoverflow.com/comment/36025123

http://stackoverflow.com/comment/35756210
comment on: http://stackoverflow.com/a/23346181
type: AnswerComment
has text: Thanks but it has no effect for me, I'm no doubt trying your patience at this stage. it still loops through both questions and no error message is printed if there is an erroneous first input other than those specified.
score: 0
type: Comment

http://stackoverflow.com/q/23445814
linked to: http://stackoverflow.com/q/7323086
type: UnansweredQuestion
tagged with: swing
has title: JDialog login with JFrame
has body: I am trying to make a 'modal' JDialog ( I hope this is what it's supposed to look like), I want to enter my user and password into my dialog and if it's correct then open my main JFrame where I parse some info. My problem occurs when I do the login button, i cannot refer to the current object(this) with it's textboxes, etc; This is the code, and here's the error : Also I'm a bit confuse because when I'll have a successful login, I am supposed to open a JFrame..... not sure how to proceed because I am supposed to work with only one JFrame and switch my panels. Thanks in advance package test_area; import java.awt.BorderLayout; import java.awt.Color; import java.awt.GridLayout; 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.JPasswordField; import javax.swing.JTextField; public class jpanel1 extends JFrame{ static boolean loginBool = false; //if this goes true, then I go to my frame // JPANEL--------------------------------------------- public static class panel1 extends JPanel implements ActionListener{ //simple constructor public panel1(){ JPanel a = this; a.setLayout(new GridLayout(5,1,5,5)); JLabel username = new JLabel("Username"); JTextField usernameTxt = new JTextField(8); JLabel password = new JLabel("Password"); JPasswordField passwordTxt = new JPasswordField(55); JButton doIt = new JButton("Log In"); doIt.addActionListener(this); a.add(username); a.add(usernameTxt); a.add(password); a.add(passwordTxt); a.add(doIt); a.setSize(200,200); a.setVisible(true); } //constructor with param // public panel1(JLabel a, JTextField b, JLabel c, JPasswordField d, JButton e){ //} //@Overwritten method @Override public void actionPerformed(ActionEvent ae) { String user; String pw; user = a.usernameTxt.getText(); pw = a.passwordTxt.getText(); // package does not exist } } // JPANEL--------------------------------------------- …
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/35941153
has comment: http://stackoverflow.com/comment/35938353
has comment: http://stackoverflow.com/comment/35939205
score: 0
has answer: http://stackoverflow.com/a/23445933
answer count: 1

http://stackoverflow.com/q/23447074
tagged with: selenium
tagged with: selenium-webdriver
has comment: http://stackoverflow.com/comment/36000486
tagged with: java
type: Question
has body: I am trying to find broken links on a webpage and I am using: List&lt;WebElement&gt; var = driver.findElements(By.tagName("a")); which only finds elements on a current web page but I also want to find sub elements available on the first page. Is there any way to do this? I would appreciate if you guys can help me out. Thanks in advance.
answer count: 2
score: 0
has answer: http://stackoverflow.com/a/47474185
has title: Function to find all the links on a webpage using java?
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24056637

http://stackoverflow.com/comment/35882693
has text: I agree but here I don't think so(with all due respect)
type: Comment
comment on: http://stackoverflow.com/a/23405803
score: 0
type: AnswerComment

http://stackoverflow.com/q/23291882
tagged with: java
has comment: http://stackoverflow.com/comment/35655200
upvote count: 1
accepted answer: http://stackoverflow.com/a/23306861
type: Question
tagged with: gwt
has answer: http://stackoverflow.com/a/23293284
has comment: http://stackoverflow.com/comment/35654185
linked to: http://stackoverflow.com/q/2797907
tagged with: javascript
has comment: http://stackoverflow.com/comment/35654936
possible better answer: http://stackoverflow.com/a/23293284
answer count: 2
has body: I have two classes when navigating from one class to another created history. Now, I want to prompt the user by a confirm whether user wants to leave the page or not.Till now , I tried using Window.closingHandler() in gwt but its not working for backspace button and browser back button its only working on closing the entire browser or that particular page using cross. Its also working on reload. I have also tried on Javascript and it worked perfect using onbeforeunload(). Here are the codes I used. JAVASCRIPT: window.onbeforeunload = function () { return "Are you sure you wish to leave this delightful page?"; } And the other code in gwt: Window.addWindowClosingHandler(new Window.ClosingHandler() { public void onWindowClosing(ClosingEvent event) { event.setMessage("Do you wanna close?"); System.out.println("Closing..."); } }); I want it to be done in gwt.
has comment: http://stackoverflow.com/comment/69677198
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/23306861
has comment: http://stackoverflow.com/comment/35655275
linked to: http://stackoverflow.com/q/18457797
has comment: http://stackoverflow.com/comment/35654349
has title: prompt user on backspace and browser backbutton in gwt
linked to: http://stackoverflow.com/q/23291626
linked to: http://stackoverflow.com/q/888483
has comment: http://stackoverflow.com/comment/35655873
type: AnsweredQuestion
score: 1

http://stackoverflow.com/q/23328023
tagged with: javax.sound.sampled
has title: Writing .wav file from byte array in java
has answer: http://stackoverflow.com/a/23328322
type: Question
has body: I need to read a .WAV file, apply some sort offset of semitones, and rewrite it to a new .WAV file. I figured out how to convert the file to a byte array, but I'm not sure how to rewrite this to a new .WAV file. I am using the javax.sound.sampled.* library. I know that there is a function AudioSystem.write(AudioInputStream, FileFormat, File), but I just don't know how to create the AudioInputStream from the byte array. Any ideas?
score: 0
answer count: 1
tagged with: java
type: UnansweredQuestion
tagged with: wav

http://stackoverflow.com/q/23351771
score: 0
answer count: 1
has title: How to efficiently find the max category total for n elements and m categories
type: UnansweredQuestion
has body: If I have an ArrayList of categorized items, for example Travel: Travel(String name, String distanceTraveled, String category) assuming that I want to know the String category in which there are the max total of distanceTraveled (NOT the category of the single travel with the maximum distanceTraveled) Initially my solution was to use a support list for each category, calculate the sum of the travel distance of each list, and return the name of category with the max distanceTraveled sum. But since I don't know how many categories there are, how could I do this efficiently?
has comment: http://stackoverflow.com/comment/35764017
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/23351820
tagged with: arraylist

http://stackoverflow.com/q/23360760
has body: I have imported an example from FMODProgrammersApi example and I have done the procedure of Cygwin and Android NDK but when i run my project it gives following error in console 14:53:34 **** Incremental Build of configuration Default for project Recording **** bash /ndk-build all Cannot run program "bash": Launching failed Error: Program "bash" not found in PATH PATH=[C:/Program Files/Java/jdk1.6.0_06/bin/../jre/bin/client;C:/Program Files/Java/jdk1.6.0_06/bin/../jre/bin;C:/Program Files/Java/jdk1.6.0_06/bin/../jre/lib/i386;C:\Windows\system32;C:\Windows;C:\Windows\system32\Wbem;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Intel\OpenCL SDK\2.0\bin\x86;C:\Program Files\Java\jdk1.6.0_06\bin;D:\ABHIJEET_ONYX\New_Android_Sdk\adt-bundle-windows-x86-20140321\eclipse;] 14:53:35 Build Finished (took 267ms) Please help me ... I have gone through this tutorial http://mindtherobot.com/blog/452/android-beginners-ndk-setup-step-by-step/
answer count: 1
has comment: http://stackoverflow.com/comment/35779809
has comment: http://stackoverflow.com/comment/35779497
favorite count: 0
has comment: http://stackoverflow.com/comment/35779319
has title: Cannot run program "bash": Launching failed?
type: UnansweredQuestion
score: 2
tagged with: java
tagged with: http://stackoverflow.com/tag/c
has comment: http://stackoverflow.com/comment/35779362
tagged with: android-ndk
type: Question
has answer: http://stackoverflow.com/a/40298733
downvote count: 0
upvote count: 2
tagged with: bash
tagged with: android

instance
tags question: http://stackoverflow.com/q/23315521
tags question: http://stackoverflow.com/q/23315269
tags question: http://stackoverflow.com/q/23360079
type: Tag
tag name: instance
tags question: http://stackoverflow.com/q/23363510
tags question: http://stackoverflow.com/q/23372962

http://stackoverflow.com/a/23375889
has comment: http://stackoverflow.com/comment/35846592
downvote count: 0
score: 2
accepted answer of: http://stackoverflow.com/q/23375760
upvote count: 2
answers question: http://stackoverflow.com/q/23375760
type: AcceptedAnswer
has body: I see two solutions, the first one is to attach each Item to the each view using the setTag method (http://developer.android.com/reference/android/view/View.html#setTag(java.lang.Object)), then on you listener retrieve it to know which objet you are dealing with. . . . item.setTag(currentItem ); item.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { Item it = (Item) v.getTag(); } }); . . . The second solution would be to pass the item to your listener private class CustomClickListener implements View.OnClickListener{ private Item mIt; CustomClickListener (Item it){ this.mIt= it; } public void onClick(View v) { // The item that was clicked it mIt } } // When you create the views item.setOnClickListener(new CustomClickListener(currentItem));
has comment: http://stackoverflow.com/comment/35846128
type: Answer

http://stackoverflow.com/comment/133124901
comment on: http://stackoverflow.com/a/23380022
type: AnswerComment
has text: I thought this runs automatically. Apparently it doesn't. Thanks
score: 0
type: Comment

http://stackoverflow.com/a/23308618
type: Answer
downvote count: 1
has body: You only have a dependency on json-api. It does not include the class Json.java that your exception is complaining about. You need to provide also an implementation for the json-api, for example: org.glassfish javax.json 1.0.4 (from https://jsonp.java.net/download.html) I guess prior to packaging you do not notice this because maybe your IDE or something in it is providing an implementation for json-api invisibly.
score: -1
upvote count: 0
answers question: http://stackoverflow.com/q/23306554

c#
tags question: http://stackoverflow.com/q/23316672
tags question: http://stackoverflow.com/q/23368062
tags question: http://stackoverflow.com/q/23349101
tags question: http://stackoverflow.com/q/23353184
tag name: c#
tags question: http://stackoverflow.com/q/23429715
tags question: http://stackoverflow.com/q/23299001
tags question: http://stackoverflow.com/q/23338049
tags question: http://stackoverflow.com/q/23307401
tags question: http://stackoverflow.com/q/23299580
tags question: http://stackoverflow.com/q/23294482
tags question: http://stackoverflow.com/q/23398871
tags question: http://stackoverflow.com/q/23392991
tags question: http://stackoverflow.com/q/23381037
tags question: http://stackoverflow.com/q/23427734
tags question: http://stackoverflow.com/q/23451640
tags question: http://stackoverflow.com/q/23360770
tags question: http://stackoverflow.com/q/23380851
tags question: http://stackoverflow.com/q/23322293
tags question: http://stackoverflow.com/q/23335250
tags question: http://stackoverflow.com/q/23363371
type: Tag
tags question: http://stackoverflow.com/q/23389207
tags question: http://stackoverflow.com/q/23408084
tags question: http://stackoverflow.com/q/23451347
tags question: http://stackoverflow.com/q/23318859

http://stackoverflow.com/comment/35738646
has text: I mean a better way in designing the application using Exception handling instead of logging.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23338059

http://stackoverflow.com/comment/35864453
type: Comment
has text: i also used dispatcher instead of redirect
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23406401

http://stackoverflow.com/comment/35887284
comment on: http://stackoverflow.com/q/23417279
has text: An actual [runnable example that demonstrates your problem](https://stackoverflow.com/help/mcve) would involve less guess work and better responses
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/q/23359730
tagged with: enunciate
answer count: 1
score: 0
accepted answer: http://stackoverflow.com/a/23360812
tagged with: spring
has body: I am using enunciate to generate my rest api documentation, initially it was working fine unless I added spring dependency to my project. My current pom: org.springframework spring-context 3.2.5.RELEASE org.springframework spring-core 3.2.5.RELEASE org.springframework spring-beans 3.2.5.RELEASE org.springframework spring-webmvc 3.2.5.RELEASE org.springframework.data spring-data-rest-webmvc 2.0.2.RELEASE org.springframework.data spring-data-neo4j 3.0.1.RELEASE org.springframework.data spring-data-neo4j-rest 3.0.1.RELEASE javax.validation validation-api 1.0.0.GA com.sun.jersey jersey-server 1.18.1 com.sun.jersey jersey-servlet 1.18.1 org.codehaus.enunciate enunciate-rt 1.26 </dependencies> org.apache.maven.plugins maven-war-plugin 2.2 src/main/webapp true index.html org.codehaus.enunciate maven-enunciate-plugin 1.26 src/main/resources/enunciate.xml assemble org.eclipse.m2e lifecycle-mapping 1.0.0 <lifecycleMappingMetadata> org.codehaus.enunciate maven-enunciate-plugin [1.26,) assemble </lifecycleMappingMetadata> above configuration is generating docs in api directory under war generated. I have following enunciate.xml configuration: <enunciate xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://enunciate.codehaus.org/schemas/enunciate-1.26.xsd"> <docs splashPackage="com.pack.resources" docsDir="api" title="My API" copyright="amg" includeDefaultDownloads="true" /> <jersey useSubcontext="true" /> docs are generated properly, but when I am trying to hit http://localhost:8080/amg-web/api/index.html its giving 404 response.! I checked with extracted war in tomcat webapp where api directory is successfully generated with all the required files, but still not able to access it from deployed app in browser. please help.
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/23360812
has title: Cannot access enunciate generated doc from deployed war in browser
type: Question

http://stackoverflow.com/comment/35802639
comment on: http://stackoverflow.com/q/23373106
score: 0
type: Comment
has text: possible duplicate of [How to send a file in Android from mobile to server using http?](http://stackoverflow.com/questions/4126625/how-to-send-a-file-in-android-from-mobile-to-server-using-http)
type: QuestionComment

http://stackoverflow.com/comment/35806379
comment on: http://stackoverflow.com/q/23374968
score: 2
type: Comment
type: QuestionComment
has text: Line 85 of CaracteristicasProducto.java

http://stackoverflow.com/a/23312949
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/23311976
downvote count: 0
has body: Here's some code I put together some time ago to do this. Use the combinadic method giving it the number of digits you want, the number of bits you want and which number in the sequence. // n = digits, k = weight, m = position. public static BigInteger combinadic(int n, int k, BigInteger m) { BigInteger out = BigInteger.ZERO; for (; n &gt; 0; n--) { BigInteger y = nChooseK(n - 1, k); if (m.compareTo(y) &gt;= 0) { m = m.subtract(y); out = out.setBit(n - 1); k -= 1; } } return out; } // Algorithm borrowed (and tweaked) from: http://stackoverflow.com/a/15302448/823393 public static BigInteger nChooseK(int n, int k) { if (k &gt; n) { return BigInteger.ZERO; } if (k &lt;= 0 || k == n) { return BigInteger.ONE; } // ( n * ( nChooseK(n-1,k-1) ) ) / k; return BigInteger.valueOf(n).multiply(nChooseK(n - 1, k - 1)).divide(BigInteger.valueOf(k)); } public void test() { System.out.println("Hello"); BigInteger m = BigInteger.ZERO; for ( int i = 1; i &lt; 10; i++ ) { BigInteger c = combinadic(5, 2, m); System.out.println("c["+m+"] = "+c.toString(2)); m = m.add(BigInteger.ONE); } } Not sure how it matches up in efficiency with the other posts.
type: Answer

http://stackoverflow.com/comment/35944862
comment on: http://stackoverflow.com/q/23449685
score: 0
type: QuestionComment
has text: Who want +2 rep for edit?
type: Comment

http://stackoverflow.com/q/23365307
has comment: http://stackoverflow.com/comment/35787457
has answer: http://stackoverflow.com/a/23365524
upvote count: 11
type: AnsweredQuestion
tagged with: treeset
has answer: http://stackoverflow.com/a/58848308
has answer: http://stackoverflow.com/a/42687332
score: 11
type: Question
has answer: http://stackoverflow.com/a/23365522
has answer: http://stackoverflow.com/a/23365540
accepted answer: http://stackoverflow.com/a/23365540
tagged with: java
has answer: http://stackoverflow.com/a/23365657
possible better answer: http://stackoverflow.com/a/23365524
has title: java: TreeSet order
has body: With this code I get this output: TreeSet&lt;String&gt; t=new TreeSet&lt;String&gt;(); t.add("test 15"); t.add("dfd 2"); t.add("ersfd 20"); t.add("asdt 10"); Iterator&lt;String&gt; it=t.iterator(); while(it.hasNext()){ System.out.println(it.next); } I get: asdt 10 dfd 2 ersfd 20 test 15 How can I get an order of this kind, based on the numbers, with TreeSet? dfd 2 asdt 10 test 15 ersfd 20
has answer: http://stackoverflow.com/a/57740367
downvote count: 0
has comment: http://stackoverflow.com/comment/35788040
answer count: 7
favorite count: 0

http://stackoverflow.com/a/23384398
has body: The default LayOut of a JFrame is BorderLayout, You just add (set) the JToolBar to JFrame as BorderLayout.NORTH and add JPanel as BorderLayout.CENTER. Set JPanel layout as GridBagLayout and do what you want with it. I think this is you are looking for.
type: Answer
accepted answer of: http://stackoverflow.com/q/23384195
upvote count: 3
answers question: http://stackoverflow.com/q/23384195
score: 3
has comment: http://stackoverflow.com/comment/35826105
has comment: http://stackoverflow.com/comment/35830734
has comment: http://stackoverflow.com/comment/35825318
has comment: http://stackoverflow.com/comment/35891335
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/35823073

http://stackoverflow.com/comment/35930342
type: Comment
comment on: http://stackoverflow.com/q/23440822
type: QuestionComment
has text: You should just put the value of radius inside perimeter and area
score: 0

http://stackoverflow.com/comment/35847847
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23397572
score: 0
has text: Not really compare but do some operation with it

android-dialog
type: Tag
tags question: http://stackoverflow.com/q/23433779
tag name: android-dialog
tags question: http://stackoverflow.com/q/23384288

http://stackoverflow.com/q/23293842
upvote count: 3
answer count: 3
has answer: http://stackoverflow.com/a/23294137
possible better answer: http://stackoverflow.com/a/23294149
accepted answer: http://stackoverflow.com/a/23294137
has body: Here is my test class.. import java.util.HashMap; public class Test { public static void main(String[] args) { A a = new A(0, 1); HashMap&lt;A, Integer&gt; map = new HashMap&lt;A, Integer&gt;(); map.put(a, (a.x + a.y)); System.out.println(map.containsKey(a)); System.out.println("----------------- "); System.out.println(map.containsKey(new A(0, 1))); } } and here is my class A with hashcode and equal method generated by eclipse. class A { int x, y; public A(int x, int y) { super(); this.x = x; this.y = y; } @Override public int hashCode() { System.out.println(" in hashcode"); final int prime = 31; int result = 1; result = prime * result + x; result = prime * result + y; return result; } @Override public boolean equals(Object obj) { System.out.println(" in equal"); if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; A other = (A) obj; if (x != other.x) return false; if (y != other.y) return false; return true; } } The output of program is in hashcode in hashcode true ----------------- in hashcode in equal true My questions are: (I know the contract of hashcode and equal and why it is used) Why in first case hashcode method is called twise ? Why in first case equal does not called ? How JVM know that it is the same variable we are searching?
has answer: http://stackoverflow.com/a/23294793
downvote count: 0
type: AnsweredQuestion
score: 3
has answer: http://stackoverflow.com/a/23294149
tagged with: java
has title: Java: why equal method is not called when searching for same variable in hashmap
type: Question
favorite count: 0

http://stackoverflow.com/comment/35875873
comment on: http://stackoverflow.com/a/23412320
has text: Well, I just based my code on google's tutorial but know I see that I need to implement it differently.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/23415462
tagged with: android-fragments
possible better answer: http://stackoverflow.com/a/23415848
tagged with: java
has comment: http://stackoverflow.com/comment/35881698
tagged with: illegalstateexception
has answer: http://stackoverflow.com/a/23415845
has title: Fragment Replace/Add causing IllegalStateException
has body: So I recently started working with fragments and trying to understand how everything works. I have put this together but my app keeps crashing. Any hints as to what is going on would be greatly appreciated, also an explanation as to why would also be great. I am trying to load a youtube video in a fragment that loads in a view thats handed to me by a listview adapter. Here is my setup: I have a fragment set up for a youtube video: public class PlayerYouTubeFrag extends YouTubePlayerSupportFragment { private String currentVideoID = "Adp1TUDRNtc"; private YouTubePlayer activePlayer; public static PlayerYouTubeFrag newInstance(String url) { PlayerYouTubeFrag playerYouTubeFrag = new PlayerYouTubeFrag(); Bundle bundle = new Bundle(); bundle.putString("url", url); playerYouTubeFrag.setArguments(bundle); return playerYouTubeFrag; } private void init() { initialize("AIzaSyCQxLWF1j0XFwKmros9w4Y5XSk1hqpEg6Q", new OnInitializedListener() { @Override public void onInitializationFailure(Provider arg0, YouTubeInitializationResult arg1) { } @Override public void onInitializationSuccess(YouTubePlayer.Provider provider, YouTubePlayer player, boolean wasRestored) { activePlayer = player; activePlayer.setPlayerStyle(YouTubePlayer.PlayerStyle.DEFAULT); if (!wasRestored) { activePlayer.loadVideo(getArguments().getString("url"), 0); } } }); } } Now I also have a class that sets up the fragments and the swap: public class Youtube extends FragmentActivity{ public static final String API_KEY = "MyKey"; public static final String VIDEO_ID = "videoID"; public YouTubePlayerView youTubePlayerView; public Youtube(View view) { //issue here!!! PlayerYouTubeFrag myFragment = PlayerYouTubeFrag.newInstance("Adp1TUDRNtc"); getSupportFragmentManager().beginTransaction().replace(view.findViewById(R.id.placeholder).getId(), myFragment).commit(); } Last but not least my xml: &lt;FrameLayout android:id="@+id/placeholder" android:layout_height="match_parent" android:layout_width="match_parent"&gt; &lt;/Fram…
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/23415848
tagged with: android
has comment: http://stackoverflow.com/comment/35881511
type: Question
has answer: http://stackoverflow.com/a/23415821
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23415821

http://stackoverflow.com/comment/35755635
comment on: http://stackoverflow.com/q/23340837
has text: The problem that the value is in format name of month day year hiw ican use simpleDAte in this case
score: 0
type: Comment
type: QuestionComment

push
tags question: http://stackoverflow.com/q/23399852
tags question: http://stackoverflow.com/q/23378979
tag name: push
type: Tag

http://stackoverflow.com/q/23347425
tagged with: java
type: Question
has title: Spring-plugin build error
tagged with: bundlor
answer count: 2
upvote count: 0
has body: I have downloaded spring-plugin (https://github.com/spring-projects/spring-plugin). I have unpacked it and when trying to install it using maven (version 3.1.0) I am getting an error. The original POM file is as follows: <?xml version="1.0" encoding="UTF-8"?> 4.0.0 org.springframework.plugin spring-plugin pom Spring Plugin 1.1.0.BUILD-SNAPSHOT Simple plugin infrastructure Pivotal, Inc. http://www.springsource.org 2008 https://github.com/SpringSource/spring-plugin core metadata integration <spring.version>3.2.7.RELEASE</spring.version> <slf4j.version>1.7.5</slf4j.version> gierke Oliver Gierke ogierke@gopivotal.com http://www.olivergierke.de Pivtoal http://www.gopivotal.com Project lead +1 org.hamcrest hamcrest-library 1.3 test junit junit 4.11 test org.mockito mockito-all 1.9.5 test org.slf4j slf4j-api ${slf4j.version} org.slf4j jcl-over-slf4j ${slf4j.version} test ch.qos.logback logback-classic 1.0.13 test org.apache.maven.plugins maven-compiler-plugin 3.1 1.6 1.6 org.apache.maven.plugins maven-source-plugin 2.2.1 attach-sources jar com.springsource.bundlor com.springsource.bundlor.maven 1.0.0.RELEASE bundlor bundlor process-classes true org.apache.maven.plugins maven-jar-plugin 2.4 <useDefaultManifestFile>true</useDefaultManifestFile> org.apache.maven.plugins maven-javadoc-plugin 2.9.1 attach-javadocs jar https://github.com/spring-projects/spring-plugin scm:git:git://github.com/spring-projects/spring-plugin.git scm:git:ssh://git@github.com:spring-projects/spring-plugin.git Bamboo https://build.springsource.org/browse/PLUGIN-MASTER Github https://github.com/spring-projects/spring-plugin/issues spring-libs-release http://repo.spring.io/libs-release false spring-plugins-release http://repo.spring.io/plugins-release false I am trying to install it using the following command line c:\myPathToSpringPlugin> mvn clean install [INFO] Scanning for projects... [INFO] ------------------------------------------------------------------------ [INFO] Reactor Build Order: [INFO] [I…
favorite count: 0
has answer: http://stackoverflow.com/a/23348121
type: UnansweredQuestion
downvote count: 2
tagged with: maven
score: -2
tagged with: spring
has answer: http://stackoverflow.com/a/23348085

http://stackoverflow.com/comment/35734705
score: 0
type: Comment
has text: possible duplicate of [how to wire one JPane to another JPane](http://stackoverflow.com/questions/10523343/how-to-wire-one-jpane-to-another-jpane)
type: QuestionComment
comment on: http://stackoverflow.com/q/23330385

http://stackoverflow.com/comment/35849302
has text: I did all the things you said, but it is still showing up at the top of the activity :/
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23397816

http://stackoverflow.com/comment/35827316
comment on: http://stackoverflow.com/a/23386781
score: 0
type: AnswerComment
has text: Thanks for your clear answer and pointing me towards the very basics of Generics!
type: Comment

http://stackoverflow.com/a/23406458
has body: Data structures(DS) are an abstract way of saying that a structure holds some data'. HashMap with some key value pairs is a data structure in Java. Associated arrays are similarly in PHP etc. Objects is a little lower than the DS level. Your hashmap is a data structure. now to use a hashmap you create an 'object' of it and add data to that object using put method. I can have my own class Employee which has data and is thus a DS for me. But to use this DS to do some operations like o see if the employee is a male or a female colleague i need an instance of an Employee and test its gender property. Don't confuse objects with data structures.
has comment: http://stackoverflow.com/comment/57920541
downvote count: 2
type: Answer
answers question: http://stackoverflow.com/q/23406307
upvote count: 0
has comment: http://stackoverflow.com/comment/118245184
score: -2

http://stackoverflow.com/q/23439780
accepted answer: http://stackoverflow.com/a/23442909
favorite count: 0
has answer: http://stackoverflow.com/a/29010716
has answer: http://stackoverflow.com/a/60186722
has title: How to create a Java 8 Stream from an iterator?
has comment: http://stackoverflow.com/comment/35926997
answer count: 4
type: AnsweredQuestion
upvote count: 35
tagged with: java-stream
tagged with: java
has answer: http://stackoverflow.com/a/36633621
score: 34
has body: Is it possible to create a Stream from an Iterator, in which the sequence of objects is the same as that generated by calling the iterator's next() method repeatedly? The specific case I am thinking of concerns the use of the iterator returned by TreeSet.descendingIterator(), but I can imagine other circumstances in which an iterator, but not the collection it references, is available. For example, for a TreeSet&lt;T&gt; tset we can write tset.stream()... and get a stream of the objects in that set, in the set's sort order, but what if we want them in a different order, such as that available through using descendingIterator()? I am imagining something like tset.descendingIterator().stream()... or stream( tset.descendingIterator() )..., though neither of these forms are valid.
downvote count: 1
has comment: http://stackoverflow.com/comment/35927579
type: Question
possible better answer: http://stackoverflow.com/a/29010716
linked to: http://stackoverflow.com/q/41841310
has comment: http://stackoverflow.com/comment/35927596
has answer: http://stackoverflow.com/a/23442909

http://stackoverflow.com/q/23353291
upvote count: 10
linked to: http://stackoverflow.com/q/10714785
type: Question
linked to: http://stackoverflow.com/q/957700
has title: UnsatisfiedLinkError with sqlite4java, no sqlite4java-osx-amd64
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/23483438
has comment: http://stackoverflow.com/comment/133800980
linked to: http://stackoverflow.com/q/20038789
has comment: http://stackoverflow.com/comment/35931587
tagged with: sqlite
favorite count: 0
linked to: http://stackoverflow.com/q/15559551
has body: I am having a similar issue to this problem: UnsatisfiedLinkError with sqlite4java Jar on Mac OS X NetBeans I am running a script that uses sqlite, and while I am able to successfully run sqlite3 through the command line, I always get this error when I try to run the script: SEVERE: [sqlite] SQLiteQueue[master.catalog]: error running job queue com.almworks.sqlite4java.SQLiteException: [-91] cannot load library: java.lang.UnsatisfiedLinkError: no sqlite4java-osx-amd64 in java.library.path When I run "java -jar sqlite4java.jar -d" in my lib folder, I see this: 140428:170139.831 FINE [sqlite] Internal: loading library 140428:170139.853 FINE [sqlite] Internal: java.library.path=/Users/lee33/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java 140428:170139.853 FINE [sqlite] Internal: sqlite4java.library.path=null 140428:170139.853 FINE [sqlite] Internal: cwd=/Users/lee33/Desktop/myria_workspace/myria/lib/sqlite4java-282/. 140428:170139.853 FINE [sqlite] Internal: default path=null 140428:170139.853 FINE [sqlite] Internal: forced path=null 140428:170139.854 FINE [sqlite] Internal: os.name=mac os x; os=osx 140428:170139.854 FINE [sqlite] Internal: os.arch=amd64 140428:170139.854 FINE [sqlite] Internal: trying to load sqlite4java-osx-amd64 140428:170139.855 FINE [sqlite] Internal: cannot load sqlite4java-osx-amd64: java.lang.UnsatisfiedLinkError: no sqlite4java-osx-amd64 in java.library.path 140428:170139.855 FINE [sqlite] Internal: trying to load sqlite4java-osx-10.4 140428:170139.856 FINE [sqlite] Internal: cannot load sqlite4java-osx-10.4: java.lang.UnsatisfiedLinkError: no sqlite4java-osx-10.4 in java.library.path 140428:170139.856 FINE [sqlite] Internal: trying to load sqlite4java-osx 140428:170139.857 FINE [sqlite] Internal: cannot load sqlite4java-osx: java.lang.UnsatisfiedLinkError: no sqlite4java-osx in java.library.path 140428:170139.857 FINE [sqlite] Internal: trying to load sqlite4java 1…
accepted answer: http://stackoverflow.com/a/23483438
has comment: http://stackoverflow.com/comment/35875885
type: AnsweredQuestion
tagged with: java
score: 10

http://stackoverflow.com/q/23436454
score: 4
possible better answer: http://stackoverflow.com/a/23436506
answer count: 3
favorite count: 0
has answer: http://stackoverflow.com/a/23436506
has answer: http://stackoverflow.com/a/23436852
accepted answer: http://stackoverflow.com/a/23436852
upvote count: 4
type: AnsweredQuestion
has title: Java Threads: Using sleep and interrupt rather than wait and notifyAll
downvote count: 0
tagged with: java
tagged with: multithreading
has answer: http://stackoverflow.com/a/23437265
type: Question
has body: Scenario - Trying to achieve the result with sleep() and interrupt(); which would have been otherwise done by wait() and notifyAll() Question - I know this way is not preferred. Can you guys please let me know what is wrong in doing like this in this below scenario. One reason is notifyAll() notify all threads looking for the lock on that object. But with interrupt() we have the invoke interrupt on each waiting thread explicitly. Other reason is that a different thread cannot change the object state. Here the initial thread itself make food=true on catching an InterruptedException. But what is wrong with that? /** * Objective of this program: * * I was thinking, why can't we achieve the guarded block with Sleep and Interrupt, * why only with wait and notify.. * * Wait releases lock; while Sleep does not . But both suspend the execution. * So if you are synchronizing on the object, then we cannot have the second thread * to modify the object state due the lock on the object, and the second thread cannot acquire it. * * So I did a explicit interrupt on the first thread. * */ /** * * One person ask if he has something to eat polling the "food" variable. * Another person updates the shared variable food. * * food = true means the first person can start eating. food = false means he * has to wait and poll the value until food is available(food = true). This is * not a producer-consumer problem. * */ public class _17GuardedBlockWithSleep_Interrupt_Badcase { static class Person { volatile boolean food; public boolean isFood() { return food; } public void setFood(boolean food) { this.food = food; } String name; Person(String name) { this.name = name; } /* * Sloppy/Bad way of implementation making it pause execution until it * gets interrupted. An interruption alone does not mean food is * available. May be interrupt was called by someone else who does not * provide food. So check the condition too. * * Through sleep(), the execution is paused. CPU is free to take other * ta…

http://stackoverflow.com/a/23435706
has body: I'm afraid that there's no method for deleting or renaming a ZipEntry inside a ZipFile. You'll have to create a new ZipFile, copy the ZipEntries ommiting the one you want to delete.
has comment: http://stackoverflow.com/comment/35940590
has comment: http://stackoverflow.com/comment/35942291
type: Answer
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/23435599
downvote count: 0
has comment: http://stackoverflow.com/comment/35940914

http://stackoverflow.com/comment/35701607
has text: Is the element inside of a `frame` or `iframe`?
type: QuestionComment
comment on: http://stackoverflow.com/q/23317731
score: 0
type: Comment

http://stackoverflow.com/q/23355402
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/30254596
possible better answer: http://stackoverflow.com/a/23356053
type: Question
has answer: http://stackoverflow.com/a/23356053
has title: Android OnClickListener Mechanism
upvote count: 2
answer count: 3
favorite count: 0
has answer: http://stackoverflow.com/a/23355546
accepted answer: http://stackoverflow.com/a/23355546
tagged with: android
has body: I am beginner of Android and java .I cannot understand this portion of my code. May be it is to create an anonymous object. I cannot understand the mechanism of this code.Please help me. btn.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub } });
score: 2
type: AnsweredQuestion

http://stackoverflow.com/comment/35925009
score: 2
comment on: http://stackoverflow.com/q/23438566
has text: It sounds like what you're talking about is more of a Builder than a Factory, but yes, this is a fine approach.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23401998
answers question: http://stackoverflow.com/q/23401884
score: 0
has body: You should read about access modifiers in Java for a bit before you try to understand encapsulation using java. If you mark your variables as public, you can always access any objects. However it is a bad practice.Your objects should always be private or protected. Since you marked the element ListNode as private , you cannot access it from anywhere except within the ListNode class/object, unless you have a leaking function which returns that reference (which is bad code) For Ex: public class List{ private ListNode internalListNode; .... public ListNode badLeakyRef(){ return internalListNode; } }
type: Answer

http://stackoverflow.com/a/23311582
answers question: http://stackoverflow.com/q/23311471
has body: As user3575404 states, yes, call pack() but most important, call setVisible(true) after adding all components to your GUI. You're now calling it first, and so what happens is this -- the GUI is painted, and then you add components which remain invisible, so the result should not surprise you.
upvote count: 1
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/a/23393830
has body: Not sure I'm 100% clear on exactly what you're asking, but here's what I think I would do. Your public methods on page objects should be more representative of user operations (logging in successfully), rather than individual actions (filling in a single field). I have added a loggedIn flag to your MainPage constructor, which may be helpful in determining which actions are/should be available class MainPage { public MainPage(bool loggedIn) { ... } } class LoginPage { public LoginPage(){ ... } public MainPage loginExpectSuccess(string username, string password) { setUser(username); setPassword(password); clickJoin(); return new MainPage(true); } public LoginPage loginExpectFailure(string username, string password) { setUser(username); setPassword(password); clickJoin(); return this; } private void setUser(string username) { ... } private void setPassword(string password) { ... } private void clickJoin() { ... } } This way, your test can be simplified to just: MainPage mainpage = new MainPage(false); LoginPage loginPage=mainpage.clickLogin(); mainpage = loginPage.loginExpectSuccess("whatever", "totally_secret"); ... mainpage.nextUserAction(); //Do whatever a logged in user should be able to do, if user is not actually logged in successfully this will fail
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/23389706
score: 1
downvote count: 0

http://stackoverflow.com/a/23375436
type: AcceptedAnswer
downvote count: 0
has body: Something like: import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.border.*; public class CalculatorPanel extends JPanel { private JTextField display; public CalculatorPanel() { Action numberAction = new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { display.setCaretPosition( display.getDocument().getLength() ); display.replaceSelection(e.getActionCommand()); } }; setLayout( new BorderLayout() ); display = new JTextField(); display.setEditable( false ); display.setHorizontalAlignment(JTextField.RIGHT); add(display, BorderLayout.NORTH); JPanel buttonPanel = new JPanel(); buttonPanel.setLayout( new GridLayout(0, 5) ); add(buttonPanel, BorderLayout.CENTER); for (int i = 0; i &lt; 10; i++) { String text = String.valueOf(i); JButton button = new JButton( text ); button.addActionListener( numberAction ); button.setBorder( new LineBorder(Color.BLACK) ); button.setPreferredSize( new Dimension(50, 50) ); buttonPanel.add( button ); KeyStroke pressed = KeyStroke.getKeyStroke(text); InputMap inputMap = button.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW); inputMap.put(pressed, text); button.getActionMap().put(text, numberAction); } } private static void createAndShowUI() { // UIManager.put("Button.margin", new Insets(10, 10, 10, 10) ); JFrame frame = new JFrame("Calculator Panel"); frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE ); frame.add( new CalculatorPanel() ); frame.pack(); frame.setLocationRelativeTo( null ); frame.setVisible(true); } public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { createAndShowUI(); } }); } } The Action will get the source object from the Event so that it knows which button was clicked. If you need to use if/else logic in your Action, then you should be creating a separate Action. Don't force code into one Action if it doesn't belong.
type: Answer
has comment: http://stackoverflow.com/comment/35807073
answers question: http://stackoverflow.com/q/23375276
score: 4
accepted answer of: http://stackoverflow.com/q/23375276
upvote count: 4

http://stackoverflow.com/a/23400442
answers question: http://stackoverflow.com/q/23400403
downvote count: 0
upvote count: 2
type: Answer
has body: I see AbstractActions for "Open" "Save" "Save As" &amp; "Quit" but I don't see one for "New" I think that is your problem, you "New" AbstractAction is as yet undefined.
score: 2

http://stackoverflow.com/comment/35824828
type: QuestionComment
comment on: http://stackoverflow.com/q/23312957
type: Comment
score: 0
has text: I am using STREAM_TRANSFER_MODE.

http://stackoverflow.com/q/23349747
has answer: http://stackoverflow.com/a/23350001
answer count: 3
linked to: http://stackoverflow.com/q/4112686
downvote count: 0
has comment: http://stackoverflow.com/comment/35760169
favorite count: 0
has body: I know that we can call Java from JavaScript and vice-versa, but I'm wondering myself about when take that power and use it in a healthy way. I'm talking about real world applications, not "hello world". As many developers usually I'm developing java and javascript but I not have the enough experience for know when mix those guys is a good idea. Please if there is some developer who can share his knowlege about how has constructed real world applications using this mix would be great :). Apologies, I failed to convey my doubt in a worthwhile way, so, Did you hear about Narshorm?, for instance you could call Javascript code from a Java Class, but I dont see a business case in which those capabilities increase the worth to my server side applications. This is a nashorn hello world, in this application there is a Java Main which "eval" the content of a .js file calling the functions inside the .js file. My mainly doubt is when this power would be really useful
has answer: http://stackoverflow.com/a/23349804
has comment: http://stackoverflow.com/comment/35760120
has answer: http://stackoverflow.com/a/23350604
has comment: http://stackoverflow.com/comment/35759619
has comment: http://stackoverflow.com/comment/35760524
linked to: http://stackoverflow.com/q/3177733
linked to: http://stackoverflow.com/q/6499543
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/7278626
accepted answer: http://stackoverflow.com/a/23350604
score: 1
tagged with: java
upvote count: 1
has title: Calling Java from JavaScript and vice-versa why?
type: Question
linked to: http://stackoverflow.com/q/5062614
tagged with: javascript
linked to: http://stackoverflow.com/q/2924991
possible better answer: http://stackoverflow.com/a/23350001

http://stackoverflow.com/q/23427089
type: UnansweredQuestion
has body: I have some native files. I need to load those into my project. How can I do so in Netbeans? I'm loading them with: System.loadLibrary("SBXPCJavaProxy");
has comment: http://stackoverflow.com/comment/35913833
has comment: http://stackoverflow.com/comment/35902581
has title: How to add native library folder to existing project in Netbeans
upvote count: 2
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/35904835
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/35902774
tagged with: native
has comment: http://stackoverflow.com/comment/35905495
has answer: http://stackoverflow.com/a/23427869
has comment: http://stackoverflow.com/comment/35903030
has comment: http://stackoverflow.com/comment/35904152
answer count: 1
favorite count: 0

http://stackoverflow.com/q/23371389
answer count: 1
accepted answer: http://stackoverflow.com/a/23371603
favorite count: 0
tagged with: encryption
type: AnsweredQuestion
tagged with: java
has title: 128 bit key issue in AES algorithm Java/ Java Script
has body: I need to encrypt values in my Java code with user choice key and decrypt the values in Java script module. Below is my Java code to encrypt the values. Here I am generating 128 bit key value from the user choice key and same is using to encrypt the values. String plainText = "Hello, World! This is a Java/Javascript AES test."; try { byte[] rawKey = getRawKey("12345".getBytes()); SecretKey key = new SecretKeySpec(rawKey, "AES"); AlgorithmParameterSpec iv = new IvParameterSpec( Base64.decodeBase64("5D9r9ZVzEYYgha93/aUK2w==")); Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding"); cipher.init(Cipher.ENCRYPT_MODE, key, iv); System.out.println(Base64.encodeBase64String(cipher .doFinal(plainText.getBytes("UTF-8")))); } catch (Exception e) { e.printStackTrace(); System.out.println("Exception in crypto..."); } public static byte[] getRawKey(byte[] seed) throws Exception { KeyGenerator kgen = KeyGenerator.getInstance("AES"); SecureRandom sr = SecureRandom.getInstance("SHA1PRNG"); sr.setSeed(seed); kgen.init(128, sr); // 192 and 256 bits may not be available SecretKey skey = kgen.generateKey(); byte[] raw = skey.getEncoded(); String s = new String(raw); System.out.println("raw key.." + raw); return raw; } Above code printing the below values: raw key..[B@45b9ce4b vN2GouJcVli/rFMDHEwCNZejraO5cQxBtlo5D64qkaRTkxxRTIo+Vm38H4fUZp7ABxj7ul0Ha6bO5aFxMzMY0g== When I use the above values to decrypt in JS code , I am not getting any response. hsd h Please point me If there's anything missing from my code or please suggest me if any alternative to produce the same result.
upvote count: 1
downvote count: 1
has answer: http://stackoverflow.com/a/23371603
type: Question
tagged with: javascript
score: 0

http://stackoverflow.com/a/23381545
downvote count: 0
score: 1
has body: Since the problem is that each successive ObjectFactory code generation overwrites the last, rather than being additive, can you copy each one before the next is generated, and then combine them? If this is something that needs to be automated, or part of a Maven build, that may be tricky. But manually combining the ObjectFactory definitions shouldn't be difficult, unless there are mutually incompatible parts.
has comment: http://stackoverflow.com/comment/35847540
upvote count: 1
has comment: http://stackoverflow.com/comment/35818715
answers question: http://stackoverflow.com/q/23351184
type: Answer

http://stackoverflow.com/a/23318353
has comment: http://stackoverflow.com/comment/35721256
has comment: http://stackoverflow.com/comment/35721820
has body: For the tabs use addTab(null, icon, component) of JTabbedPane with icon the image you want and component a translucent JLabel. You can make one by calling its setOpaque(true) and setBackground(new Color(255, 255, 255, 100)). Edit Try to run this and see if it's getting closer to what you want. public class TransparentTabs extends JFrame { private final static Color TRANSPARENT = new Color(0, 0, 0, 0); TransparentTabs() { JTabbedPane tabs = new JTabbedPane(); JLabel label = new JLabel("Text Here"); label.setOpaque(true); label.setBackground(TRANSPARENT); tabs.addTab(null, new ImageIcon("path to image"), label); // Change path tabs.addTab("Tab to the left has only an image", new JLabel("Something")); tabs.setSelectedIndex(-1); getContentPane().setBackground(Color.RED); // Placeholder for background image getContentPane().add(tabs); setLocationRelativeTo(null); setDefaultCloseOperation(EXIT_ON_CLOSE); pack(); setVisible(true); } public static void main(String[] args) { UIManager.put("TabbedPane.contentAreaColor", TRANSPARENT); UIManager.put("TabbedPane.selected", TRANSPARENT); UIManager.put("TabbedPane.background", TRANSPARENT); UIManager.put("TabbedPane.borderHightlightColor", TRANSPARENT); UIManager.put("TabbedPane.darkShadow", TRANSPARENT); UIManager.put("TabbedPane.focus", TRANSPARENT); new TransparentTabs(); } }
has comment: http://stackoverflow.com/comment/35722844
has comment: http://stackoverflow.com/comment/35718103
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/35718202
has comment: http://stackoverflow.com/comment/35722645
has comment: http://stackoverflow.com/comment/35721078
has comment: http://stackoverflow.com/comment/35722813
type: Answer
has comment: http://stackoverflow.com/comment/35722262
has comment: http://stackoverflow.com/comment/35721436
upvote count: 2
has comment: http://stackoverflow.com/comment/35721509
has comment: http://stackoverflow.com/comment/35718882
has comment: http://stackoverflow.com/comment/35718167
has comment: http://stackoverflow.com/comment/35717606
accepted answer of: http://stackoverflow.com/q/23317213
score: 2
answers question: http://stackoverflow.com/q/23317213

http://stackoverflow.com/comment/35896003
type: Comment
comment on: http://stackoverflow.com/q/23423211
type: QuestionComment
has text: You can use any PDF library which allows you to do text extraction with positions in your unit tests. iText itself has a text extraction framework which can easily be adapted to not only return the text but also its position. If you want to not use the same library to test results as is used to originally create them, other libraries will also do.
score: 1

http://stackoverflow.com/comment/35906943
type: Comment
type: QuestionComment
has text: hi , thanks , i will just download the standart edition then
score: 0
comment on: http://stackoverflow.com/q/23426154

http://stackoverflow.com/comment/35809862
comment on: http://stackoverflow.com/q/23371633
has text: It's not clear to me what your directory structure is, and what you mean by "Project_A includes Project_B". Anyway, most likely your `settings.gradle` is in the wrong directory.
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/a/23324675
has comment: http://stackoverflow.com/comment/35713183
upvote count: 3
has comment: http://stackoverflow.com/comment/35713202
score: 3
downvote count: 0
has body: Your class Proj implements an interface. An interface can "tell" which methods a class, implementing this interface, has to implement. The ActionListener interface guarantees that a class implementing this interface has also to implement said method actionPerformed(...). So in order to fix this: Implement said method. No offense, but: You might want to take a look into some Java starter tutorials or books.
answers question: http://stackoverflow.com/q/23324643
type: Answer

http://stackoverflow.com/q/23330034
has body: Now that's very confusing... I have a JPA entity Order that references an entity User. The User can be either buyer or seller of the Order. Because both buyer and seller can enter additional information for an order, I moved that to an extra entity OrderUserData. There might or might not be a corresponding OrderUserData object, but IF one exists, the user should only be able to see the entry they created (based on USER_ID) and not the one of the other party. The entities look like this: @Entity @Table(name = "T_ORDER") public class Order { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; @ManyToOne @JoinColumn(name = "SELLER_ID") private User seller; @ManyToOne @JoinColumn(name = "BUYER_ID") private User buyer; @OneToMany(mappedBy = "order", fetch = FetchType.EAGER) private List&lt;OrderUserData&gt; userData = new ArrayList&lt;&gt;(); //.. } -- @Entity @Table(name = "T_ORDER_USERDATA") public class OrderUserData { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; @ManyToOne @JoinColumn(name = "ORDER_ID") private Order order; @ManyToOne @JoinColumn(name = "USER_ID") private User user; private String comment; //... } ( User is not very exciting, just ID and basic name fields ) Now when I'm trying to select the appropriate data to display in the website, I have a problem: String qry = "SELECT o FROM Order o LEFT JOIN o.userData ud " + " WHERE (o.seller.id = :userId OR o.buyer.id = :userId)" + " AND ( ud.user IS NULL OR ud.user.id = :userId )"; TypedQuery&lt;Order&gt; query = em.createQuery(qry, Order.class); query.setParameter("userId", userId); Let's say I execute this, setting userId to 2: My Database looks like this: ORDER ===== ID SELLER_ID BUYER_ID 1 1 2 2 2 3 3 3 1 ORDER_USERDATA =============== ID ORDER_ID USER_ID COMMENT 1 1 1 Comment that only user 1 should see 2 1 2 Comment that only user 2 should see But unlike you would expect, when executing the above query, both records are included in the userData list! It s…
score: 1
tagged with: java
upvote count: 1
type: Question
has title: JPA / EclipseLink: Joined WHERE query does not give expected result
has answer: http://stackoverflow.com/a/23337651
tagged with: jakarta-ee
accepted answer: http://stackoverflow.com/a/23337651
possible better answer: http://stackoverflow.com/a/23337301
has answer: http://stackoverflow.com/a/23337301
answer count: 3
tagged with: eclipselink
tagged with: jpa
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/23339267
type: AnsweredQuestion

http://stackoverflow.com/q/23394554
score: 3
accepted answer: http://stackoverflow.com/a/23394666
answer count: 1
downvote count: 0
tagged with: string
favorite count: 0
has title: Protobuf builder: set string field without memory allocation
tagged with: protocol-buffers
tagged with: memory-management
upvote count: 3
tagged with: java
has body: Let's say I have to create and write huge amount of protobuf messages, which contain string field (different for each message). I create a protobuf.Builder and reuse it for creating all messages, setting this string field and invoking method build(). I have bytes as input, e.g. for each message I have byte[], which should be set to string-field. So the question is - how can I set byte[] to string field of the builder without new memory allocation? As far as I understand, when use protobuf builder in java there are two ways to set string-field: set(String field) set(ByteString field) The first one requires to make a new object String from byte[], and that's why new memory allocation. The second one requires to use some method of ByteString, for example ByteString.copyFrom(byte[]), but this method (as all other similar methods of ByteString) does not use exists byte array, and creates new one instead. So, is there any workaround about it?
has answer: http://stackoverflow.com/a/23394666
type: Question
type: AnsweredQuestion

http://stackoverflow.com/q/23387521
accepted answer: http://stackoverflow.com/a/23388783
type: Question
tagged with: twitter4j
upvote count: 1
has comment: http://stackoverflow.com/comment/35830068
downvote count: 0
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/35829026
type: AnsweredQuestion
has body: I am using twitter java api tweet4j in order to retrieve data from twitter users. I ve got a list of users ids from which I want to retrieve data. I read a list of string ids and I am trying to extract data via twitter java api into my database. However, some users has protection on their data. Thus, I am getting authentication errors, in some ids. Since my list is enormous, how is it possible to automatically create exceptions from user with no authentication right? Is there any method in twitter4j for protected or not protected users? The error that I am getting: Exception in thread "main" 401:Authentication credentials (https://dev.twitter.com/pages/auth) were missing or incorrect. Ensure that you have set valid consumer key/secret, access token/secret, and the system clock is in sync. [Wed Apr 30 15:35:18 EEST 2014]date: Wed, 30 Apr 2014 12:36:58 GMT [Wed Apr 30 15:35:18 EEST 2014]x-transaction: 0d6f0c50c647c52e [Wed Apr 30 15:35:18 EEST 2014]pragma: no-cache [Wed Apr 30 15:35:18 EEST 2014]cache-control: no-cache, no-store, must-revalidate, pre- check=0, post-check=0 {"request":"\/1.1\/statuses\/user_timeline.json? user_id=787323013&amp;include_my_retweet=true&amp;include_entities=true","error":"Not authorized."} [Wed Apr 30 15:35:18 EEST 2014]x-content-type-options: nosniff [Wed Apr 30 15:35:18 EEST 2014]x-xss-protection: 1; mode=block [Wed Apr 30 15:35:18 EEST 2014]x-rate-limit-limit: 180 Relevant discussions can be found on the Internet at: [Wed Apr 30 15:35:18 EEST 2014]expires: Tue, 31 Mar 1981 05:00:00 GMT http://www.google.co.jp/search?q=0742d262 or http://www.google.co.jp/search?q=32729de5 [Wed Apr 30 15:35:18 EEST 2014]set-cookie: guest_id=v1%3A139886141837883092; Domain=.twitter.com; Path=/; Expires=Fri, 29-Apr-2016 12:36:58 UTC [Wed Apr 30 15:35:18 EEST 2014]set-cookie: lang=en [Wed Apr 30 15:35:18 EEST 2014]www-authenticate: OAuth realm="https://api.twitter.com" [Wed Apr 30 15:35:18 EEST 2014]content-length: 143 [Wed Apr 30 15:35:18 EEST 2014]x-rate-…
score: 1
tagged with: java
tagged with: twitter
has title: Twitter4j issues with user's protected data
has answer: http://stackoverflow.com/a/23388783

http://stackoverflow.com/comment/35669410
type: QuestionComment
has text: I'm sure you would, but that would be stupid since there are millions of examples already written. You prefer that I write to you, instead of making the effort of going to Google. I don't appreciate that kind of laziness. You're free to ask for clarification here if you don't understand something, but **do not** ask for other people to do your homework.
type: Comment
comment on: http://stackoverflow.com/q/23300235
score: 0

http://stackoverflow.com/q/23300014
answer count: 2
downvote count: 0
tagged with: jboss7.x
has title: Object is not getting persisted using JPA/JTA/JBOSS/CDI
favorite count: 0
upvote count: 2
type: UnansweredQuestion
score: 2
has body: Please help me to understand why object is not getting persisted with following code. It throws javax.persistence.TransactionRequiredException: JBAS011469: Transaction is required to perform this operation (either use a transaction or extended persistence context) public class OrganizationRepositoryImpl implements OrganizationRepository { @PersistenceContext(unitName="usermanagement",type=PersistenceContextType.TRANSACTION) private EntityManager em; public void save(Organization organization) { try { em.persist(organization); }catch(Exception e) { e.printStackTrace(); } } } But If I annotate the class with @Stateless annotation(Now ejb), object start getting persisted @Stateless public class OrganizationRepositoryImpl implements OrganizationRepository { @PersistenceContext(unitName="usermanagement",type=PersistenceContextType.TRANSACTION) private EntityManager em; public void save(Organization organization) { try { em.persist(organization); }catch(Exception e) { e.printStackTrace(); } } } persistence.xml <?xml version="1.0" encoding="UTF-8"?> java:jboss/datasources/MysqlXADS <exclude-unlisted-classes>false</exclude-unlisted-classes> <property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5Dialect"/> <property name="hibernate.hbm2ddl.auto" value="create-drop"/> <property name="hibernate.show_sql" value="true"/> <property name="hibernate.format_sql" value="true"/> <property name="use_sql_comments" value="true"/> <property name="jboss.entity.manager.factory.jndi.name" value="java:jboss/myEntityManagerFactory" /> Service class to call Repository to persist the object to the database public class OrganizationServiceImpl implements OrganizationService { @Inject private OrganizationRepository orgRepo; public Response createOrganization(InputStream is) { Organization org = null; org = readStream(is); orgRepo.save(org); return Response.created(URI.create("/organizations/" + org.getId())) .build(); } private Organization readStream(InputStream is) { JAXBContext c…
has answer: http://stackoverflow.com/a/23301282
tagged with: java
has answer: http://stackoverflow.com/a/23300189
type: Question
tagged with: jakarta-ee
tagged with: jpa
tagged with: jta

http://stackoverflow.com/a/23303688
downvote count: 1
has body: The line : So far its only generating 75% of what i want repeatedly a thousand times Really doesn't add up to me. It might be a seeding issue you're having though. Make sure to always re-seed the random number, using time. But I agree with Abdul , you need to take the +13 out of that parenthesis: rand.nextInt(87) + 13; Because rand.nextInt((87) + 13) is the same as rand.nextInt((67) + 23) as rand.nextInt((1) + 99) But if you want more "true" randomness, look into something called buzzhash (though that is for hashing ; yet may be modded for number)
has comment: http://stackoverflow.com/comment/35675579
type: Answer
answers question: http://stackoverflow.com/q/23303659
score: 0
upvote count: 1

http://stackoverflow.com/comment/35727987
type: QuestionComment
score: 1
has text: `the code won't execute but it will compile?` that's unclear to me. If the code compiles than it gets executed. Get rid of `throws Exception` in the main and log the exception when it gets thrown with `e.printStackTrace()`
comment on: http://stackoverflow.com/q/23332416
type: Comment

http://stackoverflow.com/q/23356480
type: Question
upvote count: 2
tagged with: jpa
answer count: 1
accepted answer: http://stackoverflow.com/a/23368751
has title: JPA: query clause on reverse mapping field - Parameter is not set
favorite count: 0
has answer: http://stackoverflow.com/a/23368751
tagged with: spring
score: 2
type: AnsweredQuestion
has body: I have make this simple domain in order to understand why the following query won't work. @Entity public class Owner { @Id @GeneratedValue(strategy = GenerationType.AUTO) private Long id; @OneToOne(cascade = CascadeType.ALL) private Reverse reverse; //getters / setters } @Entity public class Reverse { @Id @GeneratedValue(strategy = GenerationType.AUTO) private Long id; @OneToOne(mappedBy = "reverse") private Owner owner; //getters / setters } This test fails: @Test @Transactional public void testQueryByEntity() throws Exception { Reverse reverse = new Reverse(); Owner owner = new Owner(); owner.setReverse(reverse); entityManager.persist(owner); entityManager.flush(); entityManager.clear(); Reverse dbReverse = em.createQuery("from Reverse r where r.owner = :owner", Reverse.class) .setParameter("owner", owner) .getSingleResult(); System.out.println("Revrse id: " + dbReverse.getId()); } with the following exception: Caused by: org.h2.jdbc.JdbcSQLException: Parameter "#2" is not set; SQL statement: select reverse0_.id as id1_ from T_ORDER reverse0_ where reverse0_.id=? limit ? [90012-156] Same query from Owner side works: Owner dbOwner = em.createQuery("from Owner o where o.reverse = :reverse", Owner.class) .setParameter("reverse", reverse) .getSingleResult(); In order to make the query work I need to modify it in this way: Reverse dbReverse = em.createQuery("from Reverse r where r.owner.id = :ownerId", Reverse.class) .setParameter("ownerId", owner.getId()) .getSingleResult(); So my question is: why if in where clause I have this reverse mapping condition, I need to query r.owner.id and not simply r.owner in order to make my query works? Thank you!
downvote count: 0
tagged with: java
tagged with: hibernate

http://stackoverflow.com/comment/92253739
score: 2
type: AnswerComment
comment on: http://stackoverflow.com/a/23419103
has text: chut's answer is correct. If java String foo is null, then foo.isEmpty() throws NullPointerException. The apache StringUtils.isBlank(foo) returns true even if foo is null.
type: Comment

http://stackoverflow.com/comment/35946384
type: AnswerComment
comment on: http://stackoverflow.com/a/23450112
type: Comment
has text: Debug your application or print the passed argument
score: 0

http://stackoverflow.com/comment/35730376
type: Comment
comment on: http://stackoverflow.com/a/23333613
has text: did you get the intent by calling . getIntent()
type: AnswerComment
score: 0

http://stackoverflow.com/comment/35713873
type: Comment
comment on: http://stackoverflow.com/a/23324871
score: 1
type: AnswerComment
has text: @Debasish: It depends - I'd say that Java 8 is likely to make the whole library somewhat redundant; just something like the `assertThrows` I showed being present in JUnit is enough.

http://stackoverflow.com/comment/35825499
type: Comment
has text: Surely, it **matters**.
comment on: http://stackoverflow.com/a/23384931
type: AnswerComment
score: 0

http://stackoverflow.com/q/23313658
tagged with: android
has answer: http://stackoverflow.com/a/23330936
has body: I have a listview with a custom adapter that is done with one seekbar and one textview. @Override public View getView(final int position, View view, ViewGroup parent) { inflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); view = inflater.inflate(R.layout.adapter, null); seekBar = (SeekBar)view.findViewById(R.id.seekBar); value = (TextView)view.findViewById(R.id.name); seekBar.setMax(200); value.setText(myArray[position]+" - "+value); seekBar.setProgress(value); seekBar.setOnSeekBarChangeListener(new OnSeekBarChangeListener() { @Override public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { // TODO Auto-generated method stub seek = seekBar.getProgress(); value.setText(myArray[position]+" - "+progress+" MB"); } @Override public void onStartTrackingTouch(SeekBar seekBar) { // TODO Auto-generated method stub } @Override public void onStopTrackingTouch(SeekBar seekBar) { // TODO Auto-generated method stub } }); return view; } Now, the problem is that when i move the (for example) second seekbar change the text only at the last textview. why? how can i fix this? i want that if i move the second seekbar change the text of the relative textview and not at the last.
has title: Adapter with seekbar and textview
tagged with: java
has answer: http://stackoverflow.com/a/23331633
type: Question
answer count: 2
score: 0
type: UnansweredQuestion

http://stackoverflow.com/q/23333299
has comment: http://stackoverflow.com/comment/35729499
type: Question
tagged with: jakarta-ee
has answer: http://stackoverflow.com/a/23336080
answer count: 2
linked to: http://stackoverflow.com/q/4750131
has body: I have a scenario where i need to show the success/error messages in jsp's from the controller. The controller has access to many methods and each method may return some message. These messages are stored as key-value pair in a property file which i need to access. Now i want to load this property file just once and use it through out the application. How can this be achieved? the framework is spring mvc. Presently i am doing something like this in every class but this approach doesn't seem right. Please help! Properties prop = new Properties(); prop.load(getClass().getClassLoader().getResourceAsStream(fileName+".properties"));
score: 0
has comment: http://stackoverflow.com/comment/35732978
has comment: http://stackoverflow.com/comment/35729407
has answer: http://stackoverflow.com/a/23333406
has comment: http://stackoverflow.com/comment/35729556
has title: How to load a property file just once and use it throughout the application in java?
type: UnansweredQuestion
tagged with: spring
tagged with: spring-mvc
tagged with: java
has comment: http://stackoverflow.com/comment/35732951

http://stackoverflow.com/q/23428830
tagged with: java
has body: Here is my code: What I am looking to do is in the output I have color display for circle one but not in circle 2 and I am not sure why. Can someone help me with this? Here is my first set of code: public class Circle { private double radius; private String color; public Circle() { radius = 1.0; color = "red"; } public Circle(double newRadius) { radius = newRadius; } public double getRadius() { return radius; } public double getArea() { double ar = Math.PI * radius * radius; // round the area up to two decimals ar = Math.round(ar * 100.0) / 100.0; return ar; } public Circle (String newColor){ color = newColor; } public String getColor(){ return color; } } Here is the second part with the main method: public class TestCircle { public static void main(String[] args) { Circle cir1 = new Circle(); System.out.println("Details of circle 1:"); System.out.println("Radius: " + cir1.getRadius()); System.out.println("Area: " + cir1.getArea()); System.out.println("Color: " + cir1.getColor()); Circle cir2 = new Circle(5); System.out.println("******************************"); System.out.println("Details of circle 2:"); System.out.println("Radius: " + cir2.getRadius()); System.out.println("Area: " + cir2.getArea()); System.out.println("Color: " + cir2.getColor()); } } Here is the output: Details of circle 1: Radius: 1.0 Area: 3.14 Color: red Details of circle 2: Radius: 5.0 Area: 78.54 Color: null
type: Question
has answer: http://stackoverflow.com/a/23428878
has answer: http://stackoverflow.com/a/23428857
accepted answer: http://stackoverflow.com/a/23428857
score: 0
answer count: 3
upvote count: 1
downvote count: 1
favorite count: 0
possible better answer: http://stackoverflow.com/a/23428850
has answer: http://stackoverflow.com/a/23428850
tagged with: getter-setter
has title: Using getters and setters to display the color
type: AnsweredQuestion

http://stackoverflow.com/comment/35730180
comment on: http://stackoverflow.com/a/23333654
score: 0
type: AnswerComment
has text: i used this showing error Message void type is not allowed here
type: Comment

http://stackoverflow.com/q/23353759
has comment: http://stackoverflow.com/comment/35767093
has body: I have the following code I've placed into a custom method. File inputFile = new File("F:\\EmployeePunch\\EmployeePunch\\src\\employeepunch\\original.txt"); // Your file File tempFile = new File("F:\\EmployeePunch\\EmployeePunch\\src\\employeepunch\\temp.txt");// temp file BufferedReader reader = null; BufferedWriter writer = null; try{ reader = new BufferedReader(new FileReader(inputFile)); writer = new BufferedWriter(new FileWriter(tempFile)); String firstName = chosenEmployee.getFirstName(); String lastName = chosenEmployee.getLastName(); String currentLine; while((currentLine = reader.readLine()) != null) { if(currentLine.contains(firstName) &amp;&amp; currentLine.contains(lastName)) continue; writer.write(currentLine); } } catch (IOException e) { e.printStackTrace(); }finally{ try { inputFile.delete(); writer.close(); boolean successful = tempFile.renameTo(inputFile); System.out.println(successful); } catch (IOException ex) { ex.printStackTrace(); } } The problem is; whenever I run the program the renameTo fails; but it does create a temp.txt with the line that was supposed to be removed correctly removed. Why does renameTo always return false though? Edit 1: The files are not opened anywhere else in windows. They are listed in my IDE's project explorer but are not opened by my IDE.
type: AnsweredQuestion
tagged with: bufferedwriter
has answer: http://stackoverflow.com/a/23353805
tagged with: java
tagged with: file
type: Question
tagged with: bufferedreader
accepted answer: http://stackoverflow.com/a/23353805
has title: Cannot rename temp.txt to original.txt after removing line
score: 0
answer count: 1
tagged with: io

http://stackoverflow.com/comment/35896231
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23417314
has text: About the generic helper method , i did somthing else , just write the method in Polygon :)
score: 0

http://stackoverflow.com/q/23349805
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39024655
score: 1
tagged with: java
type: Question
upvote count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/39009268
favorite count: 0
has body: Whenever a user installs my app for the first time an instalationID is generated randomly (say Instalationid =123). I am trying to back up this instalationID, so that when the user uninstalls and then installs my app the old instalationID (123) will be assigned to him again, rather than a new one. After all, he is the same user. I have a shared preferences file, called SESSION_INFO_PREFERENCE_KEY, that holds the instalationID and I try to back up the shared preferences file. The back up manager is: public class ADCBackupAgent extends BackupAgentHelper { // The name of the SharedPreferences file instalation ID static final String INSTID = "SESSION_INFO_PREFERENCE_KEY"; //SESSION_INFO_INSTALLATION_UID // A key to uniquely identify the set of backup data static final String INSTID_BACKUP_KEY = "inst_id"; // Allocate a helper and add it to the backup agent @Override public void onCreate() { Log.i("OnCreate Method","!!!!!!ON create called!!!!!!!!!!"); SharedPreferencesBackupHelper helper = new SharedPreferencesBackupHelper(this, INSTID); addHelper(INSTID_BACKUP_KEY, helper); } } Also, whenever the instalationID is generated for the first time I perform a call to the Back up manager such as: //this pointing to the current Activity BackupManager backUpManager = new BackupManager(this); backUpManager.dataChanged(); For the sake of completenes: &lt;application android:icon="@drawable/application_icon" android:label="@string/app_name" android:name="MyAppName" android:theme="@style/FragmentTheme" android:allowBackup="true" android:backupAgent=".ADCBackupAgent"&gt; ... &lt;meta-data android:name="com.google.android.backup.api_key" android:value="AEdPqr..." /&gt; &lt;/application&gt; My code works perfectly fine when I do the back up on the local transport (using the bmgr tool), however, when I try to back up the data on Google's cloud strage I get: 04-28 15:12:24.305: W/BackupTransportService(390): Not ready for backup request right now: [OperationScheduler: enabledState=true l…
has comment: http://stackoverflow.com/comment/39031833
tagged with: android
has comment: http://stackoverflow.com/comment/39025426
has title: Not ready for backup request right now
tagged with: android-backup-service
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/39042096
answer count: 0

http://stackoverflow.com/comment/105289452
has text: @behelit Did you solve this somehow? I see the same behavior...
type: Comment
comment on: http://stackoverflow.com/a/23372751
score: 0
type: AnswerComment

http://stackoverflow.com/comment/35882875
comment on: http://stackoverflow.com/a/23416107
has text: Sorry my bad, missed the subString part. Fixed.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/23389044
upvote count: 1
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35831344
has comment: http://stackoverflow.com/comment/35832041
has comment: http://stackoverflow.com/comment/35831799
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/35831765
linked to: http://stackoverflow.com/q/18617
tagged with: eclipse
type: Question
has answer: http://stackoverflow.com/a/23389278
has comment: http://stackoverflow.com/comment/35831669
tagged with: apache
answer count: 1
downvote count: 0
tagged with: tomcat
has body: localhost:8080/lio/ works great in my apache tomcat, but when I use&lt;my ip&gt;106.5x.xx.xx:8080/lio/ I get this error: The connection has timed out The server at 106.5x.xx.xx is taking too long to respond. The site could be temporarily unavailable or too busy. Try again in a few moments. If you are unable to load any pages, check your computer's network connection. If your computer or network is protected by a firewall or proxy, make sure that Firefox is permitted to access the Web.
favorite count: 0
has comment: http://stackoverflow.com/comment/35831704
has comment: http://stackoverflow.com/comment/35831489
accepted answer: http://stackoverflow.com/a/23389278
has comment: http://stackoverflow.com/comment/35831708
has title: localhost:8080/lio/ works great in my apachtomcat. but when i put <my ip>:8080/lio/ i get error

http://stackoverflow.com/comment/35828339
type: AnswerComment
type: Comment
has text: whats happends with GridBagLayout/BoxLayout, see (in contrast with) linked code in one of my comments here
comment on: http://stackoverflow.com/a/23383465
score: 0

http://stackoverflow.com/q/23392079
has answer: http://stackoverflow.com/a/23395786
has comment: http://stackoverflow.com/comment/35839081
has comment: http://stackoverflow.com/comment/35838566
type: Question
has comment: http://stackoverflow.com/comment/35840940
tagged with: rmi
tagged with: java
has comment: http://stackoverflow.com/comment/35837925
score: 0
accepted answer: http://stackoverflow.com/a/23395786
answer count: 1
has title: Finding which class called the remote method
has comment: http://stackoverflow.com/comment/35840829
tagged with: security
has comment: http://stackoverflow.com/comment/35839099
has comment: http://stackoverflow.com/comment/35839565
has body: I'm learning Java RMI and I'm trying to do an assignment which requires me to have two different client types interacting with the same server. One of the two clients has more privleges than the other one, and this means that the first one is the only one that can call a certain method. Let's make a quick sample: we have 3 classes: Server AdminClient UserClient Server exports a method called doSomething() which cannot be called from UserClient but only from AdminClient. Is there a way to do something like this? I know that, since I'm writing the code, it's quite easy to write the UserClient and stop him from calling that method, but I'm asking more something on server-side security, provided that the client's code can be modified to call doSomething(). The doSomething() should be like: void doSomething(){ Class caller = getCaller().getClass(); if (caller instanceof UserClient) return; ... }
tagged with: permissions
type: AnsweredQuestion

http://stackoverflow.com/comment/35758580
type: Comment
comment on: http://stackoverflow.com/a/23348904
type: AnswerComment
has text: I get the point, you said create and index of Solr per service operation (XML of request/response). That is an option follow the strategy **pre process XML before save** i think. But i need more info about the two options, or a more eficient strategy as well. Thanks
score: 0

http://stackoverflow.com/comment/35920758
type: AnswerComment
comment on: http://stackoverflow.com/a/23432454
type: Comment
has text: You can also try to go a different route: use SBT only. Look at https://github.com/vitalyg/Strata2014ScaldingTutorial . Possibly you need to update scalding version number in project/Dependencies.scala
score: 0

http://stackoverflow.com/comment/35866356
score: 0
type: AnswerComment
has text: When I started to write my answer there wasn't any other one, Skeet posted it just a minute before.
comment on: http://stackoverflow.com/a/23407609
type: Comment

m2e
type: Tag
tag name: m2e
tags question: http://stackoverflow.com/q/23356056

http://stackoverflow.com/q/23394251
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35841647
score: -5
has comment: http://stackoverflow.com/comment/35841293
tagged with: java
upvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/23394387
linked to: http://stackoverflow.com/q/12043513
has title: Trim a string to remove white spaces
answer count: 3
has answer: http://stackoverflow.com/a/23394380
has comment: http://stackoverflow.com/comment/35843448
has comment: http://stackoverflow.com/comment/35841308
favorite count: 0
has body: I have a string: "hello world". This looks like it has no white space and so I tried to print it out the character o in the hell part of the string. I just did string.chartAt(4) but to my surprise, it printed out nothing. I tried to debug it and realized that this string has over 20 leading white spaces. I could still print it out, now that I know where the leading white spaces end but my question is assuming one does NOT know where the white spaces end and one just want to trim the string so it can start printing from the first non-white space letter. How would one do this in Java? Apparently, using string.trim() didn't work.
has comment: http://stackoverflow.com/comment/35841281
possible better answer: http://stackoverflow.com/a/23394380
has answer: http://stackoverflow.com/a/23394387
has answer: http://stackoverflow.com/a/23394377
downvote count: 6

http://stackoverflow.com/a/23502588
has body: I was able to solve this by avoiding the build-in Java classes SslRMIClientSocketFactory and SslRMIServerSocketFactory and creating my own classes which implement the RMIClientSocketFactory and RMIServerSocketFactory interfaces. RMIClientSocketFactory public class MyClientSocketFactory implements RMIClientSocketFactory, Serializable { public MyClientSocketFactory() {} public Socket createSocket(String host, int port) { SecureRandom sr = new SecureRandom(); sr.nextInt(); KeyStore serverKeyStore = KeyStore.getInstance("JKS"); FileInputStream server = new FileInputStream("src/server.public"); String passphrase = // serverKeyStore.load(server, passphrase.toCharArray()); server.close(); KeyStore clientKeyStore = KeyStore.getInstance("JKS"); FileInputStream client = new FileInputStream("src/client.private"); String password = // clientKeyStore.load(client, password.toCharArray()); client.close(); TrustManagerFactory tmf = TrustManagerFactory.getInstance("SunX509"); tmf.init(serverKeyStore); KeyManagerFactory kmf = KeyManagerFactory.getInstance("SunX509"); kmf.init(clientKeyStore, password.toCharArray()); SSLContext SSLC = SSLContext.getInstance("TLS"); SSLC.init(kmf.getKeyManagers(), tmf.getTrustManagers(), sr); SSLSocketFactory sf = SSLC.getSocketFactory(); SSLSocket socket = (SSLSocket) sf.createSocket(host, port); return socket; } public int hashCode() { return getClass().hashCode(); } public boolean equals(Object obj) { if (obj == this) { return true; } else if (obj == null || getClass() != obj.getClass()) { return false; } return true; } } RMIServerSocketFactory public class MyServerSocketFactory implements RMIClientSocketFactory, Serializable { public MyServerSocketFactory() {} public Socket createSocket(String host, int port) { SecureRandom sr = new SecureRandom(); sr.nextInt(); KeyStore clientKeyStore = KeyStore.getInstance("JKS"); FileInputStream client = new FileInputStream("src/client.public"); String passphrase = // clientKeyStore.load(client, passphrase.toCha…
answers question: http://stackoverflow.com/q/23444004
upvote count: 1
accepted answer of: http://stackoverflow.com/q/23444004
score: 1
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/comment/35736650
type: Comment
type: QuestionComment
score: 2
has text: possible duplicate of [Why can't Java constructors be synchronized?](http://stackoverflow.com/questions/4880168/why-cant-java-constructors-be-synchronized)
comment on: http://stackoverflow.com/q/23337508

pca
tag name: pca
type: Tag
tags question: http://stackoverflow.com/q/23362259

http://stackoverflow.com/comment/35732233
type: AnswerComment
has text: Do you think there is anyway I can read the file as text up until the end of the header, then continue reading as bytes? Maybe there is someway I can change the position of the InputStream so that it starts where the BufferedReader left off?
type: Comment
comment on: http://stackoverflow.com/a/23333540
score: 0

http://stackoverflow.com/q/23423467
has comment: http://stackoverflow.com/comment/35896405
has answer: http://stackoverflow.com/a/23423658
type: UnansweredQuestion
tagged with: android
tagged with: hardware
tagged with: java
has body: I'm getting this weird error in my code Cannot resolve symbol 'surfaceCallback' theese are my current imports import android.content.Intent; import android.hardware.Camera; import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v7.app.ActionBar; import android.support.v7.app.ActionBarActivity; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuItem; import android.view.SurfaceHolder; import android.view.SurfaceView; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.TextView;
type: Question
tagged with: camera
has title: Android camera and SurfaceView not working
has comment: http://stackoverflow.com/comment/35896386
has answer: http://stackoverflow.com/a/23423659
has answer: http://stackoverflow.com/a/23423623
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/35896509
tagged with: surfaceview

http://stackoverflow.com/comment/35884146
comment on: http://stackoverflow.com/q/23416531
type: Comment
type: QuestionComment
has text: `enum` is automatically `final` can't subclass it
score: 0

http://stackoverflow.com/comment/35858932
comment on: http://stackoverflow.com/a/23400585
has text: Ok, if that's the case, then the table is either being deleted from the database or it is never being generated in the first place. Ensure that your session factory, and transaction manager are correctly configured. Have a look at how to run unit tests inside a transaction. My gut says its a problem with your application context not being preserved between tests.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/23415405
type: Question
tagged with: docx4j
tagged with: java
score: 0
has body: I've been googling and I've not found one example for this. I am able to extract the contents for a DOCX file but so far no clue how to get the contents of an EXCEL file. I know you use SpreadsheetMLPackage spreadsheetMLPackage = SpreadsheetMLPackage.load(file); to load the file, but I don't know how to proceed from here. I've check whatever methods SpreadsheetMLPackage has but nothing has gotten me the contents.
answer count: 1
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23419652
has title: How to read/print the contents for excel file using docx4j?
tagged with: excel

http://stackoverflow.com/a/23380451
score: 5
accepted answer of: http://stackoverflow.com/q/23380420
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23380420
type: Answer
has body: use SAX or StAX parser it will not hold all contents of xml in memory. Unlike the DOM parser, the SAX parser does not create an in-memory representation of the XML document and so is faster and uses less memory. Instead, the SAX parser informs clients of the XML document structure by invoking callbacks, that is, by invoking methods on a org.xml.sax.helpes.DefaultHandler instance provided to the parser. Here is an example implementation: SAXParser parser = SAXParserFactory.newInstance().newSAXParser(); DefaultHandler handler = new MyHandler(); parser.parse("file.xml", handler); Where in MyHandler you define the actions to be taken when events like start/end of document/element are generated.(below is just elementary implementation) class MyHandler extends DefaultHandler { @Override public void startDocument() throws SAXException { } @Override public void endDocument() throws SAXException { } @Override public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { } @Override public void endElement(String uri, String localName, String qName) throws SAXException { } // To take specific actions for each chunk of character data (such as // adding the data to a node or buffer, or printing it to a file). @Override public void characters(char ch[], int start, int length) throws SAXException { } } this is good article for samples of SAX and StAX parser
upvote count: 5

http://stackoverflow.com/q/23297724
tagged with: gson
has body: I'd like to build a json in ways of: {"total":1,"rows":[{"id":1,"name":"Chai","price":18.00}],"footer":[{"name":"Total","price":18.00}]} This example was obtained from: http://www.jeasyui.com/tutorial/datagrid/datagrid17.php It's mandatory that I have a "total" property with some value and a "rows" property with a collection refering to it, exactly as in the example above. Consider that for "rows" property actually I have a set of java Properties class objects, inside a List&lt;Properties&gt; collection, with value pairs for "id", "name" and "price". Note: I'm using GSon (https://sites.google.com/site/gson/gson-user-guide) to stringify a set of properties, but I'm not achieving to correctly produce a valid json for that UI. Code: Collection&lt;Atividade&gt; listProducts = storeService.getListPaged(category, rows, page); long qty = storeService.getTotal(category); List&lt;Properties&gt; lp = new LinkedList&lt;Properties&gt;(); for (Item i : listProducts) { Properties prop = new Properties(); prop.setProperty("id", Long.toString(i.getId())); prop.setProperty("name", i.getName()); prop.setProperty("price", i.getPrice); lp.add(prop); } Object[][] array = { {"total",qty}, {"rows", lp} }; Gson gson = new GsonBuilder().setDateFormat("dd-MM-yyyy") .setPrettyPrinting().create(); gList = gson.toJson(array); This code produces the following result, instead of that from above: [ [ "total", 1 ], [ "rows", [ { "id": "1", "name": "Chai", "price": "18.00", }, ] ] ] Thanks!
has title: How to serialize a convenient Json with a subcollection using Java?
type: Question
has comment: http://stackoverflow.com/comment/35670801
score: 0
has answer: http://stackoverflow.com/a/23301309
answer count: 1
has comment: http://stackoverflow.com/comment/35664509
has comment: http://stackoverflow.com/comment/35669300
has comment: http://stackoverflow.com/comment/35667620
has comment: http://stackoverflow.com/comment/35664463
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23301309
tagged with: java
tagged with: http://stackoverflow.com/tag/json

http://stackoverflow.com/a/23304683
answers question: http://stackoverflow.com/q/23304663
has comment: http://stackoverflow.com/comment/35677218
accepted answer of: http://stackoverflow.com/q/23304663
has body: This line: scan.next().split(":"); Will return an array of Strings that you're not storing anywhere. Turn it into: String[] rowData = scan.next().split(":"); And use every item in the array as you wish, for example to fill your variables or directly as arguments for your class constructor. Providing a sample of the former: fName = rowData[0]; lName = rowData[1]; position = rowData[2]; firstParam2 = rowData[3]; secondParam2 = rowData[4]; empNum2 = rowData[5];
type: AcceptedAnswer
score: 0
type: Answer

http://stackoverflow.com/comment/35915207
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23433404
has text: You should probably use a [ProcessBuilder](http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/ProcessBuilder.html) because that will actually format your command correctly. And per the [javadoc](http://docs.oracle.com/javase/7/docs/api/java/lang/Runtime.html#exec%28java.lang.String%5B%5D,%20java.lang.String%5B%5D,%20java.io.File%29) - "ProcessBuilder.start() is now the preferred way to start a process with a modified environment."

http://stackoverflow.com/a/23419105
score: 7
downvote count: 2
answers question: http://stackoverflow.com/q/23419087
upvote count: 9
has comment: http://stackoverflow.com/comment/35888490
type: Answer
has body: StringUtils.isBlank(foo) will perform a null check for you. If you perform foo.isEmpty() and foo is null, you will raise a NullPointerException.

http://stackoverflow.com/q/23315218
type: AnsweredQuestion
downvote count: 0
tagged with: swing
has answer: http://stackoverflow.com/a/23315294
type: Question
possible better answer: http://stackoverflow.com/a/23315295
linked to: http://stackoverflow.com/q/2374295
has answer: http://stackoverflow.com/a/23315295
score: 1
tagged with: java
tagged with: eclipse
has body: i want to choose randomly colors, but only between of them (Red, Blue, Green and Yellow), here some of the code i'm trying. public class LittleBall extends JPanel { private Random random = new Random(); private float r = random.nextFloat(); private float g = random.nextFloat(); private float b = random.nextFloat(); ..... public void paint (Graphics g) { Color randomColor = new Color(r, this.g, b); g.setColor(randomColor); } } But this just give every color in the world o.O, of course because the nextFloat of the r,g, and b variables is giving random numbers. But i just want to give go between colors. Thanks.
upvote count: 1
has answer: http://stackoverflow.com/a/23315340
tagged with: awt
favorite count: 0
has title: Choose randomly colors between 4?
has comment: http://stackoverflow.com/comment/35701577
tagged with: colors
answer count: 4
accepted answer: http://stackoverflow.com/a/23315294
has answer: http://stackoverflow.com/a/23315362

http://stackoverflow.com/a/60681152
has body: java.time and ThreeTenABP I should like to contribute the modern answer: Use java.time, the modern Java date and time API for your date work. If developing for Android API level 25 or lower, then through the backport for Android, ThreeTenABP (link at the bottom). LocalDate eDate = LocalDate.now(ZoneId.of("Europe/Paris")); LocalDate sDate = eDate.minusDays(127); long daysBetween = ChronoUnit.DAYS.between(sDate, eDate); System.out.println(daysBetween); When I ran this code today, the output was the expected: 127 Notice that the code is not only shorter, just one line for finding the difference; it is also clearer and more natural to read. The classes Date and Calendar that you used are poorly designed and long outdated. I recommend you don’t use them. What went wrong in your code? You’ve got an int overflow in your conversion of 127 days to milliseconds. In mathematics 127 * 24 * 3600 * 1000 equals 10 972 800 000. Since the numbers you multiply are ints, Java performs the multiplication in int, and the largest number an int can hold is 2 147 483 647, far from enough for your expected result. In this situation it would have been nice if Java would have thrown an exception or in some other way have made us aware of the error. It doesn’t. It tacitly throws away the high order bits, giving us a result of -1 912 101 888. Subtracting this negative number from the current time is equivalent to adding 22 days and a few hours. This explains why you got 22. Funny that 13 answers have been posted and it seems that no one has spotted this … Even when doing the multiplication using the long type, it still doesn’t calculate 127 days correctly, though. If the 127 days cross a transition to or from summer time (DST), which in France is the case during 254 of the 365 days of a year, the day of the transition is not 24 hours, but either 23 or 25. Which causes an incorrect number of milliseconds. You should always leave date math to proven library methods. Never hand code it yourself. I…
downvote count: 0
type: Answer
upvote count: 2
answers question: http://stackoverflow.com/q/23323792
has comment: http://stackoverflow.com/comment/108543046
score: 2

http://stackoverflow.com/a/23426666
type: Answer
has body: public void deleteEntry(final String input) throws IllegalArgumentException { for (int i = 0; i &lt; entries.size(); i++) { if (entries.get(i).getName().equalsIgnoreCase(input) || entries.get(i).getExtension().equalsIgnoreCase(input)) { entries.remove(i); return; } } throw new IllegalArgumentException(); } This should work, if your intention is find the first entry match the condition and remove, and throw exception if it is not found.Your method will not work except all entries match your condition.
answers question: http://stackoverflow.com/q/23426514
score: 0

http://stackoverflow.com/q/23413589
has comment: http://stackoverflow.com/comment/35883118
favorite count: 0
tagged with: jframe
has comment: http://stackoverflow.com/comment/35882819
upvote count: 1
accepted answer: http://stackoverflow.com/a/23413823
tagged with: jbutton
has comment: http://stackoverflow.com/comment/35879628
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35878082
score: 1
tagged with: java
type: Question
tagged with: actionlistener
answer count: 1
downvote count: 0
has title: Java Button Action Command
has comment: http://stackoverflow.com/comment/35883107
has comment: http://stackoverflow.com/comment/35877938
has comment: http://stackoverflow.com/comment/35885205
has comment: http://stackoverflow.com/comment/35881802
has answer: http://stackoverflow.com/a/23413823
has comment: http://stackoverflow.com/comment/35881941
has body: I'm creating a simple Minesweeper game in Java. Size 9x9. I create an array of JPanels and an array of buttons; I add each button to its respective JPanel. then i add the JPanels to the JFrame. How do i distinguish between each button on the action event? Here's some of my code: int gridx = 9; int gridy = 9; JButton[] buttons = new JButton[gridx*gridy]; JPanel[] jpanels = new JPanel[gridx*gridy]; public Minesweeper(){ super("Minesweeper"); setLayout(new GridLayout(9,9)); JPanel panel = new JPanel(); int i = 0; for(i = 0; i&lt;gridx*gridy; i++){ jpanels[i] = new JPanel(); buttons[i] = new JButton(); buttons[i].addActionListener(buttonEvent); jpanels[i].setLayout(new GridLayout(1,1)); jpanels[i].add(buttons[i]); add(jpanels[i]); } //buttons[67].setEnabled(false); setSize(300,300); setVisible(true); } The only way i can think about doing this is adding text to the button like so: buttons[i] = new JButton(i); Then calling getActionCommand() but i dont want text to show up on the button. Any other ideas?

http://stackoverflow.com/a/23380950
has comment: http://stackoverflow.com/comment/35826009
score: 0
has comment: http://stackoverflow.com/comment/35816810
type: Answer
answers question: http://stackoverflow.com/q/23380918
upvote count: 1
has body: \\d{1,16}@\\d{1,18} should do it for you. According to your regex , it will match from 1 to infinite times i.e. +. also I will like to tell about * , it matches from zero to infinite times. update Getting 32 digits is more important than anything else. So we ll better use : [\d@]{32}
downvote count: 1
has comment: http://stackoverflow.com/comment/35817650
has comment: http://stackoverflow.com/comment/35817140
has comment: http://stackoverflow.com/comment/35822594

http://stackoverflow.com/comment/35824907
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/23383465
has text: 1. getPreferredSize (that by default returns all JComponents to LayoutManager) is concentrations of my 3 points shortcut is setPrototypeCellValue, 2. don't recreate an JComponents in ListCellRenderer (in comment by kleopatra) 3. for why reason is there JPanel with JLabes, 4. nothing there indicating your goal, all there (possible answer) is about guessing, 5. as aside your model could be wrongly designed (guessing by seeing woodoo in Renderer)
score: 0

http://stackoverflow.com/a/23449970
has comment: http://stackoverflow.com/comment/35945925
type: Answer
has comment: http://stackoverflow.com/comment/35946041
has body: Try to change your code like this: @RequestMapping(value="/matrix/{paths}", method=RequestMethod.GET) public ModelAndView MatrixVariableExample(@PathVariable String paths, @MatrixVariable Integer age){ System.out.println(paths); //or do something with it, at your choice ModelAndView mv = new ModelAndView("affichageMatrix"); mv.addObject("age", age); return mv; } And use URL: http://localhost:8080/SpringMVC-Maven/matrix/user;age=23 Your variable paths should now contain string user, and age should be 23. I guess you're not allowed to miss path parameters if you have already parametrized your request mapping.
answers question: http://stackoverflow.com/q/23449902
has comment: http://stackoverflow.com/comment/35946104
score: 0

http://stackoverflow.com/comment/35685194
comment on: http://stackoverflow.com/q/23308869
has text: This question appears to be off-topic because it is not about programming within the scope defined in the help center. I can't find any programming questions here, asking how your robot should identify positions is a conceptual problem highly dependend on the robots sensors and capabilities and would maybe be better asked at the robotics Stack Exchange site.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23341573
has body: First thing to try is to remove headers.add("Content-type", "application/json");. Your actual content-type is application/x-www-form-urlencoded. The following code works fine for me: RestTemplate restTemplate = new RestTemplate(); MultiValueMap&lt;String, String&gt; body = new LinkedMultiValueMap&lt;String, String&gt;(); body.add("client_id", "aViwaUZXir44tcdmr6bg7m"); body.add("client_secret", "65d952744a49774bcf24bcd32c521619"); body.add("grant_type", "client_credentials"); HttpHeaders headers = new HttpHeaders(); headers.add("Accept", "application/json"); HttpEntity&lt;?&gt; entity = new HttpEntity&lt;Object&gt;(body, headers); ResponseEntity&lt;String&gt; res = restTemplate.exchange( "https://api.assembla.com/token?", HttpMethod.POST, entity, String.class); I'm even leaving a valid credentials here, as they are created solely for testing .
answers question: http://stackoverflow.com/q/23341054
has comment: http://stackoverflow.com/comment/35744515
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/132086727
accepted answer of: http://stackoverflow.com/q/23341054
type: Answer
upvote count: 6
has comment: http://stackoverflow.com/comment/35761039
has comment: http://stackoverflow.com/comment/35743847
score: 6

http://stackoverflow.com/a/23439748
type: AcceptedAnswer
has body: Yes. The cache keeps track of which tables a given cache entry is dependent on. When any of these tables are updated (any row or rows, whether or not they affect a particular cached result), the cache entry is invalidated. This means that the next time that query+parameters happens again, it will result in a database query rather than pulling the result from the query cache.
has comment: http://stackoverflow.com/comment/35942723
type: Answer
accepted answer of: http://stackoverflow.com/q/23439502
score: 0
answers question: http://stackoverflow.com/q/23439502
has comment: http://stackoverflow.com/comment/35927084

http://stackoverflow.com/comment/35724138
score: 0
type: Comment
type: QuestionComment
has text: This will come down to the how the glass pane is laid out...
comment on: http://stackoverflow.com/q/23330347

http://stackoverflow.com/q/23290924
has body: Suppose I have a class: public final class Foo and a reflected Class clz reference that refers to that class. How can I tell (using clz) that Foo is final?
type: Question
has answer: http://stackoverflow.com/a/23290992
upvote count: 13
tagged with: reflection
tagged with: java
answer count: 3
has title: How can I tell using reflection if a class is final
possible better answer: http://stackoverflow.com/a/23291002
has answer: http://stackoverflow.com/a/23290991
has answer: http://stackoverflow.com/a/23291002
accepted answer: http://stackoverflow.com/a/23290991
score: 13
type: AnsweredQuestion
downvote count: 0
favorite count: 0

http://stackoverflow.com/comment/35671910
comment on: http://stackoverflow.com/q/23301505
score: 0
type: Comment
type: QuestionComment
has text: In my code this variable is declared as "Person somePerson". Her type Person inits her itself. It is showed in class Person.

http://stackoverflow.com/q/23341319
type: UnansweredQuestion
tagged with: spring
has comment: http://stackoverflow.com/comment/35743670
tagged with: spring-mvc
downvote count: 0
has body: Not able to read property value in a bean that is present in jar file but able to read the same property value in bean that is present in classes folder I have a class PSContext.java which is packaged in X.jar. I have a bean tht is present in classes folder CFContent.java. I am able to read the property value in this file. @Value("${ps.test}") private String test; But the same value I am not able to read it in PSContext.java. This bean is transient. But it should not matter I think. Can someone let me know what is going wrong. Regards, JN
score: 1
has answer: http://stackoverflow.com/a/23465348
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/23341516
answer count: 2
upvote count: 1
favorite count: 0
has title: Spring property value is null in a specific bean

http://stackoverflow.com/comment/35943294
type: Comment
has text: Broadcast Receiver for outgoing calls : http://stackoverflow.com/questions/9569118/how-do-you-receive-outgoing-call-in-broadcastreceiver
comment on: http://stackoverflow.com/a/23448270
score: 0
type: AnswerComment

http://stackoverflow.com/q/23304253
answer count: 2
accepted answer: http://stackoverflow.com/a/23304282
score: 0
has body: I have this JSON data file [{"entityClass":"DefaultEntityClass","mac":["00:00:00:00:00:02"],"ipv4":[],"vlan":[],"attachmentPoint":[{"switchDPID":"00:00:00:00:00:00:00:02","port":1,"errorStatus":null}],"lastSeen":1398463052792}] and I want to get the "mac". but I don't know which data type I have to use, since the server says that it is neither a long nor a string value. Which datatype is this "mac" ?. my code: try { JSONArray arraydevice = new JSONArray(devicesJson); JSONObject obj = arraydevice.getJSONObject(0); long mac = obj.getLong("mac"); System.out.println("The mac address of the host is " + mac); } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } Thanks in advance
has answer: http://stackoverflow.com/a/23304297
has comment: http://stackoverflow.com/comment/35676871
possible better answer: http://stackoverflow.com/a/23304297
has title: Data type of a MAC address?
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23304282
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/35676370
type: Question

http://stackoverflow.com/a/23418718
type: Answer
answers question: http://stackoverflow.com/q/23418702
downvote count: 0
has comment: http://stackoverflow.com/comment/35887810
has body: You can simplify it a little more by applying De Morgan's laws: a &amp;&amp; !b … But I wouldn't call it "optimizing"! Really, it's such a tiny expression that you won't get any performance improvements by "optimizing" it (assuming that you're interested in performance improvements) - profile first and find the performance hotspots elsewhere. Or better yet, clarify what do you understand by "optimizing" , what's your definition for it. UPDATE OK, it was simplifying the expression what you intended all along. Then stick to the first paragraph of my answer.
score: 5
upvote count: 5

http://stackoverflow.com/comment/35665120
comment on: http://stackoverflow.com/q/23296768
score: 0
type: Comment
has text: I've replaced [tag:jks] with [tag:java]. jks is probably more appropriate, but it has 0 followers, so it won't get your question much attention.
type: QuestionComment

http://stackoverflow.com/a/23324913
type: Answer
score: 0
answers question: http://stackoverflow.com/q/23316206
has body: When using enums in GWT, it is a good practice to not rely on enum's default methods like toString, name, valueOf. If you want to provide a public access the enum's instance name, or you want to provide a factory method for retrieving a enum instance you would better create custom methods. Consider the following example: public enum MyEnum { FIRST("First"), SECOND("Second"); // MyEnum factory method public static MyEnum of(String name) { switch (name) { case "First": return FIRST; case "Second": return SECOND; default: return null; } } private final String name; private MyEnum(String name) { this.name = name; } public String getName() { return name; } }

http://stackoverflow.com/q/23441199
type: Question
has title: Why does Glass/GDK based VoiceListener only catch VoiceCommand once in XE16?
has comment: http://stackoverflow.com/comment/35977043
tagged with: java
has comment: http://stackoverflow.com/comment/35970887
tagged with: google-gdk
accepted answer: http://stackoverflow.com/a/23504246
answer count: 1
downvote count: 0
favorite count: 0
tagged with: google-glass
tagged with: android
upvote count: 6
linked to: http://stackoverflow.com/q/29280000
type: AnsweredQuestion
has body: In search for a way to implement contextual voice commands with Google's GDK i came across this post. Yet, the example code seems to work only in XE12 not in XE16+. I tested this code recently, but the onVoiceCommand(...) method is only called once in the lifetime of a related Activity. My expectation would be that a user's voice command can be obtained multiple times, i.e., if a user returns to a certain Activity from another one. I even tried to remove and reattach the Activity and/or Listener to the GDKs built-in VoiceInputHelper when the Activity is backgrounded via the onPause(...) and onResume(...) method, yet no success. Any helpful ideas why VoiceCommands are "gone" after one event and how they can be "reenabled"? I can test your ideas/solutions as I have a Glass device at hand, and I verify any input rapidly.
linked to: http://stackoverflow.com/q/21168267
has answer: http://stackoverflow.com/a/23504246
score: 6

http://stackoverflow.com/a/23345603
type: AcceptedAnswer
score: 0
has body: In this case I think you'll need to use a naming convention for your VMs running databases. e.g. db-mysql or db-mongo Then you can list the servers and iterate over the results to check for VMs that what with the db- prefix. If you're using the ComputeService, you could use ComputeService.listNodesDetailsMatching(Predicate&lt;ComputeMetadata&gt;) If you're using the ServerApi, you could use ServerApi.list()
type: Answer
answers question: http://stackoverflow.com/q/23317815
accepted answer of: http://stackoverflow.com/q/23317815

http://stackoverflow.com/a/23367878
answers question: http://stackoverflow.com/q/23367393
type: AcceptedAnswer
score: 0
type: Answer
has body: Your object is to replace: tasks.add(new Callable&lt;String&gt;() { public String call() throws Exception { client.updateStats(surv).toString(); return surv.getId(); } }); With tasks.add(new Callable&lt;String&gt;() { public String call() throws Exception { doSomething(client, surv); return surv.getId(); } }); Which can be done by defining an Interface: public interface ClientUpdate { public void performUpdate(Client client, Surv surv); } Then, use this interface as a parameter to your method: public Object updateStats() { Becomes public Object update(ClientUpdate updater) { Then use it in your callable tasks.add(new Callable&lt;String&gt;() { public String call() throws Exception { updater.performUpdate(client, surv); return surv.getId(); } }); Then implement it: updateStats(); becomes: update(new ClientUpdate() { public void performUpdate(Client client, Surv surv) { client.updateStats(surv).toString(); } }); Similarly for updateDef();
accepted answer of: http://stackoverflow.com/q/23367393

http://stackoverflow.com/q/23302200
has answer: http://stackoverflow.com/a/23302973
accepted answer: http://stackoverflow.com/a/23302973
has comment: http://stackoverflow.com/comment/35675697
score: 8
has title: Flatten Java Futures
has comment: http://stackoverflow.com/comment/35673481
has comment: http://stackoverflow.com/comment/35673229
tagged with: future
tagged with: java-8
type: AnsweredQuestion
downvote count: 0
tagged with: java
possible better answer: http://stackoverflow.com/a/55278899
has answer: http://stackoverflow.com/a/55278899
upvote count: 8
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/35718125
favorite count: 0
has body: I have two functions that each return CompletableFuture&lt;Boolean&gt; instances and I want to or them into a single ordered and short-circuit-able future. public CompletableFuture&lt;Boolean&gt; doA(); public CompletableFuture&lt;Boolean&gt; doB(); The non-future code (i.e. returning only booleans) would simply be return doA() || doB(); Using Futures I have reached this point, when the return type is a CompletableFuture&lt;CompletableFuture&lt;Boolean&gt;&gt; instance. doA.thenApply(b -&gt; { if (!b) { return doB(); } else { return CompletableFuture.completedFuture(b); } } Is there a way to flatten this? Or, any way I can make a return type of CompletableFuture&lt;Boolean&gt;? Edit: Note, being able to short circuit the futures is a feature that I want. I know that I'm then running the computations in serial, but that's ok. I do not want to run doB when doA returns true.

http://stackoverflow.com/comment/35932751
score: 0
type: AnswerComment
type: Comment
has text: i want ouput as like list2={8,9,10} am noting this output
comment on: http://stackoverflow.com/a/23443282

http://stackoverflow.com/comment/95910512
has text: Correct me if I am wrong but literally I think using SocketChannel is still in blocking mode. It is just that you can check to read from multiple sockets instead of waiting at only 1 socket.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23391793
type: AnswerComment

http://stackoverflow.com/comment/35809795
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23376683
has text: It showed an IllegalArgumentException *where*? The problem is not the test; I believe "Execution failed for task" means it was not even able to run the test. There is a problem with your environment.

http://stackoverflow.com/q/23318023
answer count: 5
type: UnansweredQuestion
tagged with: android
linked to: http://stackoverflow.com/q/4526585
linked to: http://stackoverflow.com/q/6611703
tagged with: java
has answer: http://stackoverflow.com/a/23318156
has title: How to convert resources into int?
tagged with: resources
type: Question
has body: By doing imagebutton1.getResources(); It returns a "Resource". How would you convert that Resource to an int? IE: R.id.xxx I am aiming to retrieve the id of the image.
has answer: http://stackoverflow.com/a/23318249
has comment: http://stackoverflow.com/comment/35701496
has comment: http://stackoverflow.com/comment/35701612
has answer: http://stackoverflow.com/a/23318038
score: 0
has answer: http://stackoverflow.com/a/23318150
has answer: http://stackoverflow.com/a/23318158

http://stackoverflow.com/a/23365322
downvote count: 0
has body: You can change it in Run Configurations in Eclipse: Run -&gt; Run Configurations -&gt; Java Applet -&gt; New Configuration. the default size can be changed in the Parameters tab. Note that this is only for testing and the actual applet your user sees is depends on how the applet is launched for them (Which is done typically via a &lt;applet&gt;, &lt;object&gt; or &lt;embed&gt; tags in a webpage. all of these tags support size attributes.)
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23365183
type: Answer
score: 7
upvote count: 7
accepted answer of: http://stackoverflow.com/q/23365183

http://stackoverflow.com/q/23372710
accepted answer: http://stackoverflow.com/a/23372755
type: Question
has answer: http://stackoverflow.com/a/23372783
has answer: http://stackoverflow.com/a/23372755
tagged with: arraylist
score: 0
answer count: 3
has title: Getting ArrayList<String> from arrays.xml file cast issue
possible better answer: http://stackoverflow.com/a/23372783
tagged with: android
has answer: http://stackoverflow.com/a/63880388
type: AnsweredQuestion
has body: I have to get an array stored in arrays.xml as ArrayList String arrayNames[]=MyActivity.this.getResources().getStringArray(R.array.names; ArrayList&lt;String&gt; namesList=(ArrayList&lt;String&gt;) Arrays.asList(arrayNames)); this cause java.lang.ClassCastException: java.util.Arrays$ArrayList cannot be cast to java.util.ArrayList because cast from List to ArrayList seems deniend due to different implementations of List. I need to pass ArrayList&lt;String&gt; so I cannot change ArrayList&lt;String&gt; namesList in List&lt;String&gt; namesList. wondering if is there a better way to convert String in ArrayList&lt;String&gt; without write manually a method that iterates all array Entries and put all them in an ArrayList&lt;String&gt;
tagged with: java

http://stackoverflow.com/comment/35733347
has text: yes, but I want to know how to handle this multiple requests? so that my app works for a endless amount of users and each user gets his own data when he wants.
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23335583

http://stackoverflow.com/q/23450600
has body: Scenario 1: What if we pass null in constructor of a class and we have an overloaded constructor taking Object and second constructor having String as argument Scenario 2 : What if we pass null in constructor of a class and we have an overloaded constructor taking Integer and second constructor having String as argument and third constructor has Object as argument Scenario 3 : What if we pass null in constructor of a class and we have overloaded constructor taking Exception and second constructor having ArithmeticException as argument and third constructor has Object as argument Answer to case 1 String Answer to case 2 Compiler error , Ambiguous methods Answer to case 3 ArithmeticException Please explain me the logic behind the above answers
has comment: http://stackoverflow.com/comment/35946993
answer count: 1
has answer: http://stackoverflow.com/a/23450691
favorite count: 0
has title: Passing null in constructor argument
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35946917
has comment: http://stackoverflow.com/comment/35946968
has comment: http://stackoverflow.com/comment/35952895
downvote count: 13
has comment: http://stackoverflow.com/comment/35946920
has comment: http://stackoverflow.com/comment/35946842
has comment: http://stackoverflow.com/comment/35946907
tagged with: java
upvote count: 1
type: Question
duplicate of: http://stackoverflow.com/q/5229809
has comment: http://stackoverflow.com/comment/35946953
score: -12
has comment: http://stackoverflow.com/comment/35946886

http://stackoverflow.com/comment/35670057
has text: i felt so because my output isnt coming correct sotirios
comment on: http://stackoverflow.com/q/23300842
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35799325
comment on: http://stackoverflow.com/q/23370978
score: 0
type: Comment
type: QuestionComment
has text: @ajb - oh, sorry. no, im using it in a while loop.

http://stackoverflow.com/comment/35668982
score: 0
has text: I know this program can be dealt without threads, but in my assigment we were told to use threads, and i would like to learn how they work, i want to start them at the same time and want them to communicate until all txt file is printed or user decides to stop program
comment on: http://stackoverflow.com/q/23300235
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23319479
tagged with: rcp
tagged with: eclipse
type: Question
has answer: http://stackoverflow.com/a/23321368
has comment: http://stackoverflow.com/comment/35705834
score: 0
has comment: http://stackoverflow.com/comment/35706837
answer count: 1
has title: How to give Eclipse RCP ContentOutlineView TreeViewer focus properly and respond to selection events
has comment: http://stackoverflow.com/comment/35707524
type: UnansweredQuestion
tagged with: treeview
has body: How do you give the part containing a ContentOutlineView focus correctly when clicking on the TreeViewer? I am creating my own Outline like view and when clicking on the TreeViewer in a ContentOutlinePage when the (view)part is not in focus does not correctly fire selection events. I need to click on the tab to bring the part into focus before the TreeViewer's selection events fire. I have created my own FooBarOutlineView that extends PageBookView. I am creating pages only for FooBarModelView parts and instantiating either a FooOutlinePage or a BarOutlinePage that extends ContentOutlinePage My BarOutlinePage overloads the createControl method to add a content provider to the TreeViewer: public class BarOutlinePage extends ContentOutlinePage { @Override public void createControl(Composite parent) { super.createControl(parent); getTreeViewer().setContentProvider(new MyContentProvider(new MyTreeModel())); getTreeViewer().setLabelProvider(new MyViewLabelProvider()); getTreeViewer().setInput("root"); } } My FooBarOutlineView (trimmed for brevity) looks like: public class FooBarOutlineView extends PageBookView { @Override protected IPage createDefaultPage(PageBook book) { MessagePage defaultPage = new MessagePage(); initPage(defaultPage); defaultPage.setMessage("An outline is not available. (default page)"); defaultPage.createControl(book); return defaultPage; } @Override protected PageRec doCreatePage(IWorkbenchPart part) { IPageBookViewPage page = null; if (part instanceof FooModelView) page = new FooOutlinePage(); else if (part instanceof BarModelView) page = new BarOutlinePage(); initPage(page); page.createControl(getPageBook()); return new PageRec(part, page); } @Override protected boolean isImportant(IWorkbenchPart part) { return (part instanceof FooBarModelView); } } Any insights warmly welcomed!
tagged with: java

http://stackoverflow.com/comment/35806823
score: 0
has text: value is of type xsd:String.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23375299

http://stackoverflow.com/comment/35832087
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23360851
has text: It's a portal that allows out client to manage its whole business components. There are several components and each of them is complex. My major question here is if it's possible to deploy each business component by itself instead of deploying the whole application when anything is changed. Or, if i can create various projects (one per business component) and somehow assemble them as an unique project in liferay
score: 0

http://stackoverflow.com/q/23364662
type: Question
has title: How can I catch password error from configuration.buildSessionFactory (PSQL)?
has body: When starting Hibernate, I change my database password to a wrong password just to see how my system work. I discover my catch block is not catching Hibernate init error when password is wrong and not throw any error. In other words, configuration.buildSessionFactory is not throwing up error. try { Configuration configuration = new Configuration(); configuration.configure(); ServiceRegistry serviceRegistry = new ServiceRegistryBuilder().applySettings(configuration.getProperties()).buildServiceRegistry(); // This not throw org.postgresql.util.PSQLException. Just print stack trace. SessionFactory factory = configuration.buildSessionFactory(serviceRegistry); } catch (Throwable ex) { // And we'll NEVER come here from configuration.buildSessionFactory error. } The Stack Trace: ERROR: HHH000319: Could not get database metadata org.postgresql.util.PSQLException: FATAL: password authentication failed for user "postgres" at org.postgresql.core.v3.ConnectionFactoryImpl.doAuthentication(ConnectionFactoryImpl.java:291) at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:106) at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:64) at org.postgresql.jdbc2.AbstractJdbc2Connection.&lt;init&gt;(AbstractJdbc2Connection.java:123) at org.postgresql.jdbc3.AbstractJdbc3Connection.&lt;init&gt;(AbstractJdbc3Connection.java:28) at org.postgresql.jdbc3g.AbstractJdbc3gConnection.&lt;init&gt;(AbstractJdbc3gConnection.java:20) at org.postgresql.jdbc4.AbstractJdbc4Connection.&lt;init&gt;(AbstractJdbc4Connection.java:30) at org.postgresql.jdbc4.Jdbc4Connection.&lt;init&gt;(Jdbc4Connection.java:22) at org.postgresql.Driver.makeConnection(Driver.java:391) at org.postgresql.Driver.connect(Driver.java:265) at java.sql.DriverManager.getConnection(Unknown Source) at java.sql.DriverManager.getConnection(Unknown Source) at org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl.getConnection(DriverManagerConn…
has comment: http://stackoverflow.com/comment/35787421
has answer: http://stackoverflow.com/a/23520731
answer count: 1
downvote count: 0
favorite count: 0
tagged with: postgresql
accepted answer: http://stackoverflow.com/a/23520731
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: hibernate
upvote count: 1

memory-leaks
tags question: http://stackoverflow.com/q/23393480
tags question: http://stackoverflow.com/q/23349215
tags question: http://stackoverflow.com/q/23359668
tags question: http://stackoverflow.com/q/23380377
tags question: http://stackoverflow.com/q/23436353
tags question: http://stackoverflow.com/q/23393194
type: Tag
tags question: http://stackoverflow.com/q/23291060
tags question: http://stackoverflow.com/q/23358382
tags question: http://stackoverflow.com/q/23434474
tag name: memory-leaks

http://stackoverflow.com/comment/35771924
type: Comment
type: QuestionComment
has text: Seems Thread.sleep approach isn't rare for Allading etoken: http://prenninger.com/wp/pdf-signing-using-etoken-in-java-en
score: 1
comment on: http://stackoverflow.com/q/23329392

http://stackoverflow.com/q/23449621
upvote count: 2
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/48793455
has answer: http://stackoverflow.com/a/23449756
tagged with: java
downvote count: 3
has title: Java Inverted Index program
type: Question
has answer: http://stackoverflow.com/a/23449674
tagged with: inverted-index
score: -1
answer count: 3
has body: I am writing an inverted index program on java which returns the frequency of terms among multiple documents. I have been able to return the number times a word appears in the entire collection, but I have not been able to return which documents the word appears in. This is the code I have so far: import java.util.*; // Provides TreeMap, Iterator, Scanner import java.io.*; // Provides FileReader, FileNotFoundException public class Run { public static void main(String[ ] args) { // **THIS CREATES A TREE MAP** TreeMap&lt;String, Integer&gt; frequencyData = new TreeMap&lt;String, Integer&gt;( ); Map[] mapArray = new Map[5]; mapArray[0] = new HashMap&lt;String, Integer&gt;(); readWordFile(frequencyData); printAllCounts(frequencyData); } public static int getCount(String word, TreeMap&lt;String, Integer&gt; frequencyData) { if (frequencyData.containsKey(word)) { // The word has occurred before, so get its count from the map return frequencyData.get(word); // Auto-unboxed } else { // No occurrences of this word return 0; } } public static void printAllCounts(TreeMap&lt;String, Integer&gt; frequencyData) { System.out.println("-----------------------------------------------"); System.out.println(" Occurrences Word"); for(String word : frequencyData.keySet( )) { System.out.printf("%15d %s\n", frequencyData.get(word), word); } System.out.println("-----------------------------------------------"); } public static void readWordFile(TreeMap&lt;String, Integer&gt; frequencyData) { int total = 0; Scanner wordFile; String word; // A word read from the file Integer count; // The number of occurrences of the word int counter = 0; int docs = 0; //**FOR LOOP TO READ THE DOCUMENTS** for(int x=0; x&lt;Docs.length; x++) { //start of for loop [* try { wordFile = new Scanner(new FileReader(Docs[x])); } catch (FileNotFoundException e) { System.err.println(e); return; } while (wordFile.hasNext( )) { // Read the next word and get rid of the end-of-line marker if needed: word = wordFile.next( )…
tagged with: treemaps
favorite count: 0

http://stackoverflow.com/comment/35774886
type: AnswerComment
comment on: http://stackoverflow.com/a/23351414
type: Comment
has text: why is this not the solution? i wrote "I need to remove all punctuation from words in java"
score: 0

http://stackoverflow.com/comment/35709798
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23320073
score: 0
has text: Please edit your question to include an [mcve](http://stackoverflow.com/help/mcve) that shows your current approach.

http://stackoverflow.com/q/23322382
has comment: http://stackoverflow.com/comment/35708787
answer count: 0
tagged with: java
tagged with: swt
has title: problems with swt layout on different screens
has comment: http://stackoverflow.com/comment/35714721
type: Question
has comment: http://stackoverflow.com/comment/35714713
has body: I am using eclipse and swt to develop a UI for my application. can some one tell me the best layout strategy to follow for makeing the ui look well inline on both wide and square screens? Right now it looks good on wide screen but on square one the widgets in table are not getting aligned neetly.I have used form layout and have a table in a few screens along with other widgets. The table columns have static widths so on square screens they don't look good. Any suggestion?
score: 0
tagged with: layout
has comment: http://stackoverflow.com/comment/35708768
type: UnansweredQuestion

http://stackoverflow.com/a/23440919
has comment: http://stackoverflow.com/comment/35928765
type: Answer
has comment: http://stackoverflow.com/comment/35928879
downvote count: 0
answers question: http://stackoverflow.com/q/23440896
score: 1
accepted answer of: http://stackoverflow.com/q/23440896
has comment: http://stackoverflow.com/comment/35928924
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35928913
has body: Well your method is already broken, in that it won't consider all the strings - if you have {"foo", "bar", "ab", "cd" } then you'll still be left with "bar" afterwards, because of the way you're iterating. It's generally a pain to mutate a collection while you're iterating over it - it would be cleaner from an API perspective to just return a new collection with the even strings in afterwards. However, you can do this with an iterator: public void removeOddLength(Iterable&lt;String&gt; strings) { for (Iterator&lt;String&gt; it = strings.iterator(); it.hasNext(); ) { if (it.next().length() % 2 != 0) { it.remove(); } } } That will accept either a list or a set, or indeed any other iterable sequence - so long as the iterator supports removal, of course.
has comment: http://stackoverflow.com/comment/35928810

http://stackoverflow.com/q/23311738
tagged with: chessboard.js
has answer: http://stackoverflow.com/a/23311823
tagged with: paintcomponent
has body: the code im trying to manipulate is the paint method... i'm trying to get it to show a chess board by filling in the squares evenly, but when i run the programme and move the slider to a even number it gives me one column with black one colum with empty etc. when at an odd number it is the chess board import java.awt.*; import javax.swing.*; import java.awt.event.*; import javax.swing.event.*; public class Blobs extends JFrame implements ActionListener, ChangeListener { private MyCanvas canvas = new MyCanvas(); private JSlider sizeSl = new JSlider(0, 20, 0); private JButton reset = new JButton("RESET"); private int size = 0; // number of lines to draw public static void main(String[] args) { new Blobs(); } public Blobs() { setLayout(new BorderLayout()); setSize(254, 352); setTitle("Blobs (nested for)"); sizeSl.setMajorTickSpacing(5); sizeSl.setMinorTickSpacing(1); sizeSl.setPaintTicks(true); sizeSl.setPaintLabels(true); add("North", sizeSl); sizeSl.addChangeListener(this); add("Center", canvas); JPanel bottom = new JPanel(); bottom.add(reset); reset.addActionListener(this); add("South", bottom); setResizable(false); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setVisible(true); } public void actionPerformed(ActionEvent e) { size = 0; sizeSl.setValue(0); canvas.repaint(); } public void stateChanged(ChangeEvent e) { size = sizeSl.getValue(); canvas.repaint(); } private class MyCanvas extends Canvas { @Override public void paint(Graphics g) { int x, y; int n = 0; for (int i = 0; i &lt; size; i++) { //n = 1 + i; for (int j = 0; j &lt; size; j++) { n++; x = 20 + 10 * i; y = 20 + 10 * j; //g.fillOval(x, y, 10, 10); g.drawRect(x, y, 10, 10); if (n % 2 == 0) { g.fillRect(x, y, 10, 10); } } } } } }
has answer: http://stackoverflow.com/a/23311837
tagged with: loops
has title: Chessboard game java
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/23311837
type: Question
score: 0
answer count: 2
tagged with: for-loop
has comment: http://stackoverflow.com/comment/35689748
possible better answer: http://stackoverflow.com/a/23311823

http://stackoverflow.com/a/23425752
score: 0
has comment: http://stackoverflow.com/comment/35900372
has body: Where do you call createDatabase() ? Try putting this method inside your constructor. That way when you create a object of your openingClass it has to create the database before using it. public openingclass(Context c) { super(c,Db_NAME, null, DB_VERSION); createDataBase(); }
has comment: http://stackoverflow.com/comment/35900559
type: Answer
has comment: http://stackoverflow.com/comment/35901259
has comment: http://stackoverflow.com/comment/35901049
answers question: http://stackoverflow.com/q/23425653
has comment: http://stackoverflow.com/comment/35900758

http://stackoverflow.com/comment/35783992
comment on: http://stackoverflow.com/a/23363335
type: AnswerComment
score: 0
type: Comment
has text: BufferedWriter reduced 10 seconds. Still taking more time.

http://stackoverflow.com/a/23349953
answers question: http://stackoverflow.com/q/23349565
has body: Answering to your first question. Naming is just standard way of following. It is not specific., In general mostly use application-context.xml, application-resource.xml Answering to your second question Talking about location of the files is not confined to any folder. As long you define the import resource properties in web.xml. &lt;import resource="yourpath/myxml.xml"/&gt; One more thing to say is : @Autowired is missing in your code. That migth be the reason for not getting the jdbcTemplate. @Autowired public void setDataSource(DataSource dataSource) { this.jdbcTemplate = new JdbcTemplate(dataSource); }
type: Answer
upvote count: 1
score: 1
downvote count: 0

http://stackoverflow.com/q/23394904
score: 1
tagged with: java
answer count: 2
upvote count: 1
downvote count: 0
has body: My swingworker won't repaint my progress bar(I have 2 classes). This is my file downloader code. It puts percent of download in progress bar. public class Downloader extends SwingWorker&lt;String, Integer&gt; { private String fileURL, destinationDirectory; private int fileTotalSize; public void DownloaderF(String file, String dir) { this.fileURL = file; this.destinationDirectory = dir; } @Override protected String doInBackground() throws Exception { try { URL url = new URL(fileURL); HttpURLConnection httpConn = (HttpURLConnection) url.openConnection(); String downloadedFileName = fileURL.substring(fileURL.lastIndexOf("/")+1); int filesize = httpConn.getContentLength(); int responseCode = httpConn.getResponseCode(); byte[] buffer = new byte[4096]; int bytesRead = 0; int i = 0; int total = 0; BufferedInputStream in = new BufferedInputStream(httpConn.getInputStream()); FileOutputStream fos = new FileOutputStream(destinationDirectory + File.separator + downloadedFileName); BufferedOutputStream bout = new BufferedOutputStream(fos,4096); while ((i=in.read(buffer,0,4096))&gt;=0) { total = total + i; bout.write(buffer,0,i); fileTotalSize = (total * 100) / filesize; publish(fileTotalSize); } bout.close(); in.close(); } catch(FileNotFoundException FNFE) { System.out.print("HTTP: 404!"); } catch (IOException ex) { Logger.getLogger(Downloader.class.getName()).log(Level.SEVERE, null, ex); } return null; } @Override protected void process(List&lt;Integer&gt; chunks) { try { Skin barValue = new Skin(); barValue.setBar(fileTotalSize); //System.out.print("PROCESS:" + fileTotalSize + "\n"); } catch (Exception ex) { ex.printStackTrace(); } } } This is my button code and progress bar value change method: private void LoginButtonActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: // Дебаг Downloader downloadFile = new Downloader(); downloadFile.DownloaderF("http://ipv4.download.thinkbroadband.com/100MB.zip", "."); downloadFile.execute(); } public void …
favorite count: 0
has comment: http://stackoverflow.com/comment/35842726
has comment: http://stackoverflow.com/comment/35844778
has comment: http://stackoverflow.com/comment/35843830
type: UnansweredQuestion
has title: Java swing, SwingWorker, process bar won't update
tagged with: jprogressbar
tagged with: swing
type: Question
has answer: http://stackoverflow.com/a/23395674
has answer: http://stackoverflow.com/a/23398400
tagged with: swingworker

http://stackoverflow.com/comment/35690023
score: 0
comment on: http://stackoverflow.com/q/23311616
type: Comment
type: QuestionComment
has text: click `ctrl+shift+t` and type `User` see what it shows?

http://stackoverflow.com/a/23437906
type: Answer
downvote count: 0
score: 1
has body: When you try to use a class, you need to be sure that it exists and it is reachable. In our case you need to create a class called FirstGui. I believe your test class should have been FirstGui.
answers question: http://stackoverflow.com/q/23437597
upvote count: 1

http://stackoverflow.com/q/23325745
has title: Many subscribers for many shops
type: Question
has answer: http://stackoverflow.com/a/23325873
tagged with: java
has answer: http://stackoverflow.com/a/23326027
has body: I have many shops in Shop table and many users in User table in DB. User can subscribe to any stores. How can I create table for this task? First column with shop name and second column - string with comma separated user ids?
score: 0
has answer: http://stackoverflow.com/a/23325995
answer count: 5
tagged with: sql
has answer: http://stackoverflow.com/a/23325831
tagged with: sqlite
tagged with: ormlite
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23325849

http://stackoverflow.com/comment/35920989
has text: Your current approach is O(n), I don't think there is a more efficient way to do it than this. _"Unlike the List interface, this interface does not provide support for indexed access to elements."_
comment on: http://stackoverflow.com/q/23436682
type: Comment
type: QuestionComment
score: 2

http://stackoverflow.com/comment/35959309
type: AnswerComment
comment on: http://stackoverflow.com/a/23451397
type: Comment
has text: @user3599930 You miss the point of my answer - you should examine how Androidlost finds another phone(s). You can track multiple phones (I have 3 on single account). Although you have to manually switch and locate phone by phone. Besides locating phone, it can do many other things such as: start/stop wifi, gprs, gps, read messages, call logs, take pictures, record sound, wipe, format read SD card, erase whole phone, START APPLICATION of choice in short gaining remote control of other phone which is way more than you plan to do. You should contact Androidlost author and ask him for help.
score: 0

http://stackoverflow.com/a/23383844
score: 0
answers question: http://stackoverflow.com/q/23367750
accepted answer of: http://stackoverflow.com/q/23367750
type: Answer
has body: OK, I found the answer and it was pretty obvious, sorry. I post the answer in case somebody needs it. To position shape in a pane or scene, all I need is add a child. If I need a link between a custom object and a child, all I have to do is create a new class extending Parent that exposes a custom object as a property (public is mandatory if I want this property to be visible). So I create a class DrawTreenode public class DrawTreeNode extends Parent { public TreeNode monNoeud; private double x, y, h, l; Rectangle fond = new Rectangle(); Label l1 = new Label(); Label l2 = new Label(); a basic method that implement event handler public DrawTreeNode(TreeNode n, double posX, double posY, double largeur, double hauteur) { TreeNode = n; x = posX; y = posY; h = hauteur; l = largeur; JavaFX objects can be modified according to TreeNode properties l2.setText(String.valueOf(TreeNode.numChildren())); l2.relocate(x+10, y+15); this.getChildren().add(l2); and I can implement event handler that refers (or at least accesses) my custom property this.setOnMouseClicked(new EventHandler() { public void handle(MouseEvent me) { appuyer(); } }); } Here, it uses properties of the custom object public void appuyer() { AnchorPane arbre = null; try { arbre = FXMLLoader.load(getClass().getResource("noeud.fxml")); ((Pane) Main.root.lookup("#pdt")).getChildren().add(arbre); ((TextField) arbre.lookup("#nomnoeud")).setText(monNoeud.getNom()); ((TextArea) arbre.lookup("#descnoeud")).setText(monNoeud.getDesc()); ((TextField) arbre.lookup("#numfils")).setText(Integer.toString(monNoeud.numEnfants())); ((TextArea) Main.root.lookup("#txtaide")).setText("Cliquer pour voir/modifier le noeud."); } catch (IOException e) { e.printStackTrace(); } } and I can add GraphTree (basically a custom JavaFX shape) anywhere in my project in any Pane using javaFX add method of standard class Shape. ((Pane) Main.root.lookup("#grille")).getChildren().add(new DrawTreenode(((Treenode) element), calculX(((Treenode) element)…
type: AcceptedAnswer

http://stackoverflow.com/comment/35782945
type: Comment
has text: Hypothetically, there are possibilities to create an instance of a class **without** calling any constructor. This is however a JVM hack which is meant to be only used internally, for example to provide deserialization. Normally, you will never encounter such a construction of an object. Providing a default constructor to a framework for creating an instance before calling its life cycle methods is quite common on the other side.
comment on: http://stackoverflow.com/a/23362551
type: AnswerComment
score: 0

http://stackoverflow.com/comment/35764425
type: Comment
has text: @iamnotmaynard You are right. I added the same because we can use the ensureCapacity() method to check that the internal data structure has enough capacity before adding elements.Although I removed the same.
comment on: http://stackoverflow.com/a/23352190
score: 0
type: AnswerComment

sql-server
tags question: http://stackoverflow.com/q/23416130
tags question: http://stackoverflow.com/q/23445096
tags question: http://stackoverflow.com/q/23341166
tags question: http://stackoverflow.com/q/23433218
tags question: http://stackoverflow.com/q/23404968
tags question: http://stackoverflow.com/q/23335509
type: Tag
tags question: http://stackoverflow.com/q/23355775
tags question: http://stackoverflow.com/q/23341744
tags question: http://stackoverflow.com/q/23306000
tag name: sql-server
tags question: http://stackoverflow.com/q/23410150
tags question: http://stackoverflow.com/q/23448861
tags question: http://stackoverflow.com/q/23366393
tags question: http://stackoverflow.com/q/23431254
tags question: http://stackoverflow.com/q/23371132
tags question: http://stackoverflow.com/q/23303687
tags question: http://stackoverflow.com/q/23313653

http://stackoverflow.com/a/23418541
downvote count: 0
score: 1
type: Answer
has body: you can't perform http requests in UI thread. Search "NetworkOnMainThreadException" for more details. You must use AsynkTask.
answers question: http://stackoverflow.com/q/23418434
upvote count: 1

http://stackoverflow.com/q/23385880
tagged with: java
has title: modify visual basic regular expression to work in java
type: Question
answer count: 2
favorite count: 0
score: 0
has body: i want to use java regex for capture certain pattern of word from text box.i have vb regex for that.but it's not valid in java.i want to know how should it modify for java. this is my vb reqex class\s+([^\s]+)[\s\r\n{] i did same in java this way.but it always say no mathes found but vb did. this is java code String text=jTextArea2.getText(); Pattern pattern = Pattern.compile("(?i)class\\s+(\\S+)[\\s{]"); Matcher matcher = pattern.matcher(text); String found =matcher.group(1); System.out.print(found);
possible better answer: http://stackoverflow.com/a/23386001
tagged with: regex
upvote count: 1
downvote count: 1
tagged with: vb.net
has comment: http://stackoverflow.com/comment/35825611
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23386255
accepted answer: http://stackoverflow.com/a/23386255
has answer: http://stackoverflow.com/a/23386001

http://stackoverflow.com/comment/76211740
score: 0
type: AnswerComment
type: Comment
has text: Thank you @Unheilig for reformatting my code. I posted this on my phone and was not fully aware how to change it into the proper format :)
comment on: http://stackoverflow.com/a/44612464

http://stackoverflow.com/q/23358600
type: Question
answer count: 1
has answer: http://stackoverflow.com/a/23358950
tagged with: area
score: 0
has title: Estimating Area Between Shapes
has body: In my class, we are given the task as follows: For this assignment you will attempt to make a program for computing the overlapping area of a set of shapes, implementing Monte Carlo integration, as discussed in class. Make AreaEstimator.java, a program that estimates the area of overlap of an arbitrary number of circles and triangles using randomized estimation. The program's arguments will be the number of randomly-generated points to be used in this trial, followed by the coordinates of the points that define the shapes. For example, java AreaEstimator 1000000 circle 2.0 2.0 1.0 triangle 1.0 1.0 2.5 3.0 2.0 -3.0 circle 2.5 1.0 3.0 would generate one million random points to estimate the overlap of a triangle whose vertices are ( 1.0, 1.0 ), ( 2.5, 3.0 ), ( 2.0, -3.0 ), with two circles whose centers are at ( 2.0, 2.0 ) and ( 2.5, 1.0 ), and whose radii are 1.0 and 3.0, respectively. Here is my code for the Circle class: public class Circle { private double xcenter; private double ycenter; private double radius; private double xcmax; private double xcmin; private double ycmax; private double ycmin; public Circle ( double xcenter, double ycenter, double radius){ if(radius &lt;= 0){ throw new IllegalArgumentException(); } this.xcenter = xcenter; this.ycenter = ycenter; this.radius = radius; } public void maxAndMinCircle (){ //find the minimun and maximum for the plane according to this circle xcmax = (this.xcenter + this.radius); ycmax = (this.ycenter + this.radius); xcmin = (this.xcenter - this.radius); ycmin = (this.ycenter - this.radius); } public double getXCMax (){ return xcmax; } public double getYCMax () { return ycmax; } public double getXCMin() { return xcmin; } public double getYCMin(){ return ycmin; } public boolean outsideCircle(double randX, double randY){ // find if the random point passed thru is in this circle double distance = Math.sqrt((randX-this.xcenter)*(randX-this.xcenter) + (randY-this.ycenter) * (randY - this.ycenter)); return distance &gt;= r…
type: UnansweredQuestion
tagged with: shapes
tagged with: java

http://stackoverflow.com/q/23339211
has body: I have a Java method which, when called, will listen for any traffic being sent across the network, and print information about that traffic to the console. My program currently runs in the console, but I am now looking at creating a graphical user interface to allow the user to interact with the program. Currently, when I run my program, it continually prints statements about the network traffic to the console for as long as it is running, and the only way I have to stop it running is by clicking the 'terminate' button in the Eclipse console window. However, with the graphical user interface that I am making, I have a 'start' button, which the user can click to begin listening for any traffic on the network- but once it starts listening, I have no way of allowing the user to stop it via the GUI. Since there will always be information being sent over the network, I cannot wait until no information is being received to stop the call- what I would like to do is add a 'stop' button that will stop the call to the method (i.e. stop my program from listening for network traffic), but I don't know what method I need to write/ call to stop the first method from listening. For my 'start' button, I have an ActionListener that listens for a click on the button, and calls the method from another class when it hears one. I can create a 'stop' button, but what I don't know is what method to call when the ActionListener hears a click on it, to stop the first method from being called. Anyone have any suggestions? Edit 28/04/2014 @ 14:15 This is the code that I am using to create the 'stop' button: JButton stopCaptureButton = new JButton("Stop"); panel.add(stopCaptureButton); stopCaptureButton.setBounds(875, 350, 80, 30); stopCaptureButton.addActionListener(new ActionListener(){ @Override public void actionPerformed(ActionEvent e){ EspduReceiver.stopCapture = true; pool.shutdown(); } }); But for some reason, absolutely nothing happens when I click it... The method that I am using to…
downvote count: 2
has answer: http://stackoverflow.com/a/23339309
score: -1
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/23339306
tagged with: java
has answer: http://stackoverflow.com/a/23339306
has title: Java- how do I stop a method being called?
upvote count: 1
tagged with: methods
has answer: http://stackoverflow.com/a/23344533
type: Question
tagged with: actionlistener
has comment: http://stackoverflow.com/comment/35745864
answer count: 3
accepted answer: http://stackoverflow.com/a/23344533
tagged with: method-call
favorite count: 0

xamarin.android
type: Tag
tag name: xamarin.android
tags question: http://stackoverflow.com/q/23318859
tags question: http://stackoverflow.com/q/23438350

http://stackoverflow.com/a/70276002
answers question: http://stackoverflow.com/q/23326456
downvote count: 0
score: 1
has body: Additionally to the generation by ones IDE (as mentioned by Brian Vosburgh), the JPA Metamodel may be generated during the maven build, e.g. by the JPA Static Metamodel Generator. This happens, if the maven dependency org.hibernate hibernate-jpamodelgen CURRENT-VERSION is used (e.g. listed in pom.xml). The JPA Metamodel can be used with the JPA Criteria API, see also here.
upvote count: 1
type: Answer

http://stackoverflow.com/comment/35939036
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23446603
score: 0
has text: How do I explicit remove the dependency?

http://stackoverflow.com/comment/35793772
type: Comment
has text: What is the file and location for which this fails? See if you can figure out why this one is different from those that work.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/23366873

http://stackoverflow.com/q/23293288
downvote count: 2
has answer: http://stackoverflow.com/a/23293535
has answer: http://stackoverflow.com/a/23293726
type: Question
has title: Breaking 2 nested loops "at once"
tagged with: nested-loops
tagged with: java
has answer: http://stackoverflow.com/a/23293843
has answer: http://stackoverflow.com/a/23293717
answer count: 6
tagged with: for-loop
has answer: http://stackoverflow.com/a/23293540
duplicate of: http://stackoverflow.com/q/886955
has body: Please have a look at the following code (Java) while((str=br.readLine())!=null) { int tempCounter=0; for(int i=0;i&lt;str.length();i=i+3) { String word = str.substring(i, i+3); // System.out.println(word); int insert = db.insert(index, word); if(insert&lt;0) { break; } tempCounter++; } index++; System.out.println("Index Updated: "+index); System.out.println(String.valueOf("Total words in this run: "+tempCounter)); if(index==5) { break; } } if insert is less than 0, the I need to break both for and while loops. How can I do this? Problem here is I need to break "both" loops if insert is less than 0. And you can't add 2 break commands one after another, even with labels.
favorite count: 0
has comment: http://stackoverflow.com/comment/35655832
tagged with: while-loop
type: UnansweredQuestion
tagged with: break
has answer: http://stackoverflow.com/a/23294559
linked to: http://stackoverflow.com/q/551578
linked to: http://stackoverflow.com/q/886955
has comment: http://stackoverflow.com/comment/35657103
score: 1
upvote count: 3
has comment: http://stackoverflow.com/comment/35655953
linked to: http://stackoverflow.com/q/3821827

http://stackoverflow.com/a/23451580
upvote count: 13
has comment: http://stackoverflow.com/comment/36040618
type: AcceptedAnswer
has body: The best way to do this with streams is to use reduce: // make a transformer that combines all of them as one Transformer combinedTransformer = // the stream of transformers transformers.stream() // combine all the transformers into one .reduce( // apply each of the transformers in turn (t1, t2) -&gt; x -&gt; t2.apply(t1.apply(x))) ); // the stream of strings strings.stream() // transform each string with the combined transformer .map(combinedTranformer::apply); Of course, this assumes that transformers is non-empty; if there is a possibility that it is empty, than it is simple enough to use the two-argument overload of reduce instead, like so (this assumes Tranformer is a functional interface): // make a transformer that combines all of them as one Transformer combinedTransformer = // the stream of transformers transformers.stream() // combine all the transformers into one .reduce( // the no-op transformer x -&gt; x, // apply each of the transformers in turn (t1, t2) -&gt; x -&gt; t2.apply(t1.apply(x))) ); // the stream of strings strings.stream() // transform each string with the combined transformer .map(combinedTranformer::apply); The reason you got a compiler error is that, as the error says, outside variables used in a lambda expression must be effectively final; that is, declaring them final (if they aren't already) must not change the meaning of the program, or change whether or not it compiles. Using a mutable assignment in a lambda is therefore generally forbidden, and with good reason: mutation screws up parallelization, and one of the major reasons lambdas were included in Java 8 was to allow easier parallel programming. Generally speaking, whenever you want to "sum up" results in some way, reduce (in any of its three overloads) is your go-to method. Learning how to use map, filter, reduce, and flatMap effectively is very important when working with Streams.
has comment: http://stackoverflow.com/comment/36955220
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23451579
has comment: http://stackoverflow.com/comment/36045481
has comment: http://stackoverflow.com/comment/35948801
answers question: http://stackoverflow.com/q/23451579
has comment: http://stackoverflow.com/comment/36046317
type: Answer
score: 13

http://stackoverflow.com/a/23390754
answers question: http://stackoverflow.com/q/23390612
downvote count: 0
has comment: http://stackoverflow.com/comment/35834518
has body: If you don't need regex you can do it just by looping through (My reccomendation) public int findFirstLetterPosition(String input) { char c; for (int i = 0; i &lt; input.length(); i++) { c = input.charAt(i); if ( (c &gt;= 'a' &amp;&amp; c &lt;= 'z') || (c &gt;= 'A' || c &lt;= 'Z') ) { return i; } } return -1; // not found } EDIT In response to some comments, you could also do this less explicitly using a built in static method, and add some handling for non-ASCII characters using isLetter: public int findFirstLetterPosition(String input) { for (int i = 0; i &lt; input.length(); i++) { if (Character.isLetter(input.charAt(i))) { return i; } } return -1; // not found } You can also use isAlphabetic: public int findFirstLetterPosition(String input) { for (int i = 0; i &lt; input.length(); i++) { if (Character.isAlphabetic(input.charAt(i))) { return i; } } return -1; // not found } The latter includes some alphabetic characters from other languages which are iffy on whether to box them as characters or phrases ref: Character.isLetter, Character.isAlphabetic
has comment: http://stackoverflow.com/comment/35834776
type: Answer
upvote count: 3
score: 3

http://stackoverflow.com/q/23443342
score: 0
has comment: http://stackoverflow.com/comment/35932906
has comment: http://stackoverflow.com/comment/35932882
tagged with: android
answer count: 4
has title: Setting Current Date in Android
has comment: http://stackoverflow.com/comment/35932881
tagged with: calendar
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/23443408
linked to: http://stackoverflow.com/q/5369682
tagged with: java
has answer: http://stackoverflow.com/a/23443452
type: Question
has comment: http://stackoverflow.com/comment/35932827
has answer: http://stackoverflow.com/a/23443408
has answer: http://stackoverflow.com/a/23443623
has comment: http://stackoverflow.com/comment/35932778
has body: I am using the below code to get a formatted date as 31-12-2014. private Calendar mDummyDate; mDummyDate = Calendar.getInstance(); mDummyDate.set(mDummyDate.get(Calendar.YEAR), 11, 31); When i take logs, the year in mDummyDate is set as 1970. What could be the reason?
has comment: http://stackoverflow.com/comment/35932871
has answer: http://stackoverflow.com/a/23443465
accepted answer: http://stackoverflow.com/a/23443465

http://stackoverflow.com/q/23367491
has answer: http://stackoverflow.com/a/23367657
tagged with: ooad
score: 5
tagged with: object-oriented-analysis
has comment: http://stackoverflow.com/comment/35792039
possible better answer: http://stackoverflow.com/a/23367657
has answer: http://stackoverflow.com/a/23368116
has comment: http://stackoverflow.com/comment/35792164
favorite count: 0
has comment: http://stackoverflow.com/comment/35792871
has comment: http://stackoverflow.com/comment/35791829
has comment: http://stackoverflow.com/comment/35792391
has title: What's the best way to handle type indicators in object-oriented design?
answer count: 5
linked to: http://stackoverflow.com/q/1723786
has comment: http://stackoverflow.com/comment/35791877
has answer: http://stackoverflow.com/a/23367847
has comment: http://stackoverflow.com/comment/35792670
has comment: http://stackoverflow.com/comment/35792335
has comment: http://stackoverflow.com/comment/35791937
upvote count: 6
has comment: http://stackoverflow.com/comment/35792194
has comment: http://stackoverflow.com/comment/35792833
accepted answer: http://stackoverflow.com/a/23368116
tagged with: java
downvote count: 1
has answer: http://stackoverflow.com/a/23368216
type: Question
has comment: http://stackoverflow.com/comment/35791874
has comment: http://stackoverflow.com/comment/35791974
duplicate of: http://stackoverflow.com/q/1723786
has comment: http://stackoverflow.com/comment/35791833
type: AnsweredQuestion
tagged with: oop
has body: We have a business model that requires, say, different types of vehicles to be identified. For example, motorcycle, boat, yacht, farm equipment, snowmobiles, heavy truck, light truck, passenger car, and "Other". I think there are two ways to handle it: Create a Vehicle class with a few subclasses, say, boat, truck, car and have a single enum indicating the actual type. This would work, allowing you to represent vehicles that share some common features with common subclasses. But it allows you to have mismatched enums with the classes. I think the traditional way to handle it is to have a separate subclass for each type, which may subclass the vehicle, or a subclass of vehicle. For example, heavy and light truck might subclass truck; boat and yacht might subclass boat; snowmobile might subclass vehicle. The problem is, it doesn't really lend itself to representing the concept of other. Does anyone have any patterns or best-practices for these sorts of scenarios? Peter EDIT: The purpose of the object is to convey information about the vehicle and to be able to display that information in a user-friendly way. For example, pull the data from a database and display it on a screen to be viewed/edited. This leads to another downside to the traditional OO means that leans away from type indicators for actual types, in that to display the type one would need to perform some sort of instance-of and convert the value to something user-friendly. (Also, clarified I was talking about a single enum, not an enum per subclass.)
has answer: http://stackoverflow.com/a/23367744

http://stackoverflow.com/q/23397703
type: UnansweredQuestion
tagged with: loading
tagged with: fxml
has comment: http://stackoverflow.com/comment/35849517
has comment: http://stackoverflow.com/comment/35849532
tagged with: javafx
has comment: http://stackoverflow.com/comment/35848564
has comment: http://stackoverflow.com/comment/35848477
type: Question
tagged with: java
score: 0
has title: JavFX FXML Loading Error (Nullpointerexception)
answer count: 1
has comment: http://stackoverflow.com/comment/35851250
has body: Yeah i know this question has often been asked, i used the searching function but couldl'nt solve my problem with these answers, and now im tired to search at google or anywhere else. My Problem: I try to load an FXML File into my Javacode: public class Main extends Application { public static void main(String[] args) { launch(args); } @Override public void start(Stage primaryStage) throws Exception { try { //Layout laden Pane pane = FXMLLoader.load(getClass().getResource("layout/main_layout.fxml")); //Scene erstellen und initialisieren Scene scene = new Scene(pane); scene.getStylesheets().add(getClass().getResource("css/main_layout.css").toExternalForm()); primaryStage.setScene(scene); //Breite und Höhe der Stage setzen primaryStage.setWidth(1024); primaryStage.setHeight(768); primaryStage.setTitle("Untitled - jNotepad"); primaryStage.show(); } catch(IOException e) { e.printStackTrace(); } } } My FXML file is in the package de.toxiclab.jNotepad.layout, that means realtive to the path in layout/main_layout.fxml, so the path has to be correct. And then it prints me this ugly exception: javafx.fxml.LoadException: /J:/Eclipse%20Workspace/jNotepad/bin/de/toxiclab/jNotepad/layout/main_layout.fxml:19 at javafx.fxml.FXMLLoader.constructLoadException(FXMLLoader.java:2617) at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2595) at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2441) at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3230) at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3191) at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3164) at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3140) at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3120) at javafx.fxml.FXMLLoader.load(FXMLLoader.java:3113) at de.toxiclab.jNotepad.Main.start(Main.java:32) at com.sun.javafx.application.LauncherImpl$8.run(LauncherImpl.java:837) at com.sun.javafx.application.PlatformImpl$7.run(PlatformImpl.java:335) at com.sun.javafx.application.PlatformImpl$6$1.run(PlatformImpl.java:3…
has answer: http://stackoverflow.com/a/23398555
has comment: http://stackoverflow.com/comment/35848628

http://stackoverflow.com/comment/35669378
comment on: http://stackoverflow.com/q/23300471
score: 0
has text: this is provided from bfr n based on this im writing the code public static class listNode { int data; listNode next; listNode(int d, listNode n) { data = d; next = n; } } public static class list { listNode first; }
type: QuestionComment
type: Comment

http://stackoverflow.com/a/23337955
upvote count: 2
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35738955
type: Answer
has comment: http://stackoverflow.com/comment/35738844
score: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23337752
has body: In case of line tmap1.put(new C(5,4), 73); your comparator returns 0 so it is duplicate for JVM and it overrides it. Put one debug statement like below and re-run your program you will understand the fact.. public int compare(Object obj1, Object obj2) { System.out.println("in compare difference is : "+ (((C)obj1).i - ((C)obj2).i)); return ((C)obj1).i - ((C)obj2).i; } you will get below output..see the zero(0) at last in compare : -9 in compare : -8 in compare : 1 in compare : 7 in compare : -1 in compare : 4 in compare : -4 in compare : -3 in compare : 4 in compare : -3 in compare : 0
answers question: http://stackoverflow.com/q/23337752

http://stackoverflow.com/comment/35684148
type: Comment
comment on: http://stackoverflow.com/a/23303757
has text: For the queue, the sequence of enqueue, dequeue operations is also not alternating, it is still intermixed. But due to the nature of this structure, the sequence of dequeues can only give one result: 0, 1, 2, 3, ..., 9.
type: AnswerComment
score: 0

http://stackoverflow.com/a/23445097
type: Answer
score: 0
answers question: http://stackoverflow.com/q/23444996
has body: Just initialize the array and put 0's for the values you don't know yet. int[] a = new int[] { 1,2,3,0,0,0 } Or if you use Integer instead of int you can use null, but I wouldn't recommend that unless you really need null values.

http://stackoverflow.com/q/23311976
has comment: http://stackoverflow.com/comment/35690777
has answer: http://stackoverflow.com/a/23312885
answer count: 4
has answer: http://stackoverflow.com/a/23312949
has body: In order to explore some solutions, I need to generate all possibilities. I'm doing it by using bit masking, like this: for (long i = 0; i &lt; 1L &lt;&lt; NB; i++) { System.out.println(Long.toBinaryString(i)); if(checkSolution(i)) { this.add(i); // add i to solutions } } this.getBest(); // get the solution with lowest number of 1 this allow me to explore (if NB=3): 000 001 010 011 100 101 110 111 My problem is that the best solution is the one with the lowest number of 1. So, in order to stop the search as soon as I found a solution, I would like to have a different order and produce something like this: 000 001 010 100 011 101 110 111 That would make the search a lot faster since I could stop as soon as I get the first solution. But I don't know how can I change my loop to get this output... PS: NB is undefined...
has comment: http://stackoverflow.com/comment/35691136
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35750614
possible better answer: http://stackoverflow.com/a/23313207
has answer: http://stackoverflow.com/a/23313207
tagged with: java
tagged with: loops
upvote count: 7
linked to: http://stackoverflow.com/q/13542794
type: Question
tagged with: algorithm
linked to: http://stackoverflow.com/q/15301885
linked to: http://stackoverflow.com/q/5836174
accepted answer: http://stackoverflow.com/a/23312885
has answer: http://stackoverflow.com/a/23312372
downvote count: 0
score: 7
favorite count: 0
has comment: http://stackoverflow.com/comment/35692628
has title: Bit mask generation to minimize number of 1

http://stackoverflow.com/q/23417065
score: -1
has comment: http://stackoverflow.com/comment/35884996
has comment: http://stackoverflow.com/comment/35884716
upvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/35886045
has comment: http://stackoverflow.com/comment/35885945
has comment: http://stackoverflow.com/comment/35884754
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35884695
has comment: http://stackoverflow.com/comment/35884844
has title: Variables called from methods not working
has body: I'm trying to create a textbox effect for my RPG game, but I keep getting nullpointers because my variables are null, but I'm setting them in a method. I also need to be able to update the variables in the method, which isn't working. That's why the NPE is occurring. Here is my code: package me.loafayyy.gui; import java.awt.Color; import java.awt.Graphics; import java.awt.Graphics2D; import java.util.Timer; import java.util.TimerTask; import me.loafayyy.main.RPG; import me.loafayyy.main.RPGPane; import me.loafayyy.main.RPGState; public class GuiManager { public int opacity = 0; public int step = 0; public static boolean transitioning = false; public static boolean dialogue = false; public String textlines1; public String textlines2; public String textlines3; public boolean rect = false; public Timer timer = new Timer(); public void createTransition() { transitioning = true; rect = true; } public void setOpacity(int op) { opacity = op; } public int getOpacity() { return opacity; } public void createDialogue(String line1, String line2, String line3, int dur) { // my method which I'm setting the variables. if (!dialogue) { dialogue = true; this.textlines1 = line1; this.textlines2 = line2; this.textlines3 = line3; timer.schedule(new TimerTask() { @Override public void run() { dialogue = false; } }, dur); } else { System.out .println("ERROR: Could not create dialogue, one is already displaying!"); } } public void render(Graphics g) { for (int i = 0; i &lt; 4; i++) { if (transitioning) { rect = false; if (step == 0) { if (opacity &lt; 255) { setOpacity(getOpacity() + 1); } else if (opacity == 255) { step = 1; } } else if (step == 1) { if (opacity &lt; 256 &amp;&amp; opacity != 0) { setOpacity(getOpacity() - 1); } else if (opacity == 0) { transitioning = false; step = 0; } } } } Graphics2D g2 = (Graphics2D) g.create(); if (transitioning) { if (RPG.state == RPGState.MAIN) { RPGPane.main.render(g); } else if (RPG.state == RPGState.PAUSED) { RPGPane.paused.render(g); } else i…
has answer: http://stackoverflow.com/a/23417227
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/35884788
has comment: http://stackoverflow.com/comment/35885527
tagged with: java

http://stackoverflow.com/q/23449107
has comment: http://stackoverflow.com/comment/35943929
has answer: http://stackoverflow.com/a/23449169
has title: I want to call a stock.setPrice() method but I don't know how
has body: I need to set the current price of several Stocks but I don't know how. I know I should do something like stocksymbol.setPrice() but it's not working. and then I need to "print each stock's information by passing each Stock variable to System.out.println(). This will automatically call the stock's toString() method." And I'm not sure how it's going to call the toString. Help please? public class Stock { private String symbol; private String name; private double previousClosingPrice; private double currentPrice; public void Stock(String symbol, String name, double previousClosingPrice { this.symbol= symbol; this.name =name; this.previousClosingPrice = previousClosingPrice; } public void setPrice(String symbol,double a) { this.symbol=symbol; currentPrice=a; } public double getChangePercent() { double percentageDiff=100 * (currentPrice - previousClosingPrice) / previousClosingPrice; return percentageDiff; } public String toString() { return symbol+" "+name+" "+previousClosingPrice+" "+currentPrice; } public void main(String[] args) { // TODO Auto-generated method stub Stock("JAVA","Sun Microsystems, Inc.",4.5); Stock("GOOG","Google Inc.",1007.95); Stock("AAPL","Apple Inc.",512.49); setPrice("JAVA",4.35); System.out.println(); } }
tagged with: tostring
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23449169
tagged with: java
tagged with: stock
type: Question
score: 0
answer count: 1

http://stackoverflow.com/q/23438076
has comment: http://stackoverflow.com/comment/35924134
answer count: 3
has comment: http://stackoverflow.com/comment/35924066
tagged with: string
has comment: http://stackoverflow.com/comment/35924007
has comment: http://stackoverflow.com/comment/35923880
has answer: http://stackoverflow.com/a/23438204
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/23438135
tagged with: java
has answer: http://stackoverflow.com/a/23438117
accepted answer: http://stackoverflow.com/a/23438117
has comment: http://stackoverflow.com/comment/35924059
has body: I am trying to learn how to input from a .dat file and iterate it into a string array. From what I have read so far this is possible. At the moment I am try to test if it is even writing anything to the array using one of my string variables. I am truly stumped on how to get this to work. When I compile I am getting an error that StudentID string variable has never been initialized. public class testInput { static Scanner testanswers; static PrintWriter testresults; public static void main(String[] args) { testanswers = new Scanner(new FileReader("TestInput.dat")); testresults = new PrintWriter("TestOutput.dat"); String StudentID; String answers; while(testanswers.hasNextLine()) { StudentID = testanswers.next(); answers = testanswers.next(); } String[][] answerArray = new String[7][2]; for(int row = 0; col &lt; answerArray.length; col++) { for(int col = 0; col &lt; answerArray.length; col++) { answerArray[row][col] = StudentID: System.out.print(answerArray[row][col]); } } } } .dat file looks like so: TFFTFFTTTTFFTFTFTFTT 5 ABC54301 TFTFTFTT TFTFTFFTTFT SJU12874 TTTFFTFFFTFTFFTTFTTF KSPWFG47 FT FT FTFTFFTTFFTF PAR38501 FFFFFFFFFFFFFFFFFFFF MCY19507 TTTT TTTT TTTT TT TT Is my logic all wrong here?
has title: Input data file into string array
type: Question
has answer: http://stackoverflow.com/a/23438135
tagged with: arrays
score: 0

http://stackoverflow.com/q/23369419
tagged with: java
has body: Ok so I need to get the variables from one class's method and update it in another class. Class which updates method. public abstract class MovableObject{ protected int speed; protected int heading; public void move(){ setX(finalX); setY(finalY); } Class which needs updating: public class Car extends MoveableObject{ private int height; private int width; public Car(){ super.setX(200); super.setY(2); } I have an iterator that goes through a list and checks the X and Y coordinates, currently it keeps printing out (200, 2) constantly but the Car is moving. So the class MovableObject has the updated coordinates but since I'm calling it from Car it's not getting the right coordinates to the moving car. I need to pass the variables from move() to more than one class also, that should be the same since the Iterator takes care of what is updated right or is this way very complicated? listObject = new GameObjectCollection(); car = new Car(); listObject.add(car); System.out.println("CAR: " + ((Car)gameObj).getX() + " " + ((Car)gameObj).getY());
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/35795896
linked to: http://stackoverflow.com/q/5404168
possible better answer: http://stackoverflow.com/a/23369609
has title: How to update variables from another class's method
tagged with: variables
has answer: http://stackoverflow.com/a/23369609
favorite count: 0
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35795668
has answer: http://stackoverflow.com/a/23369678
upvote count: 1
downvote count: 1
tagged with: coordinates
type: Question
accepted answer: http://stackoverflow.com/a/23369678

http://stackoverflow.com/comment/35774295
has text: Which line you are getting error? Your error is opposite of the code you have written in try block
score: 0
comment on: http://stackoverflow.com/q/23357884
type: QuestionComment
type: Comment

http://stackoverflow.com/q/23436943
tagged with: string-parsing
accepted answer: http://stackoverflow.com/a/23437129
downvote count: 1
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/23436976
has answer: http://stackoverflow.com/a/23436976
score: 0
has title: Best way to get integer end of a string in Java?
favorite count: 0
has answer: http://stackoverflow.com/a/23437129
upvote count: 1
tagged with: regex
type: AnsweredQuestion
has body: Given an identifier foo consisting of letters, numbers, and underscores, I want to split the string on the last integer. Examples: "hello" =&gt; "hello", "" "hello0" =&gt; "hello", "0" "hello001" =&gt; "hello", "001" "h123ello123" =&gt; "h123ello", "123" I imagine I could use a regular expression to pull out this information, but wasn't sure that was the cleanest approach (and if it is, what that expression would look like).
tagged with: java

http://stackoverflow.com/comment/35852566
type: Comment
type: QuestionComment
has text: It is too long to put in there. I tried posting it but the site said that it is longer than the max allowed characters by itself. I'm really not trying to be lazy or anything and am looking to learn about these things.
comment on: http://stackoverflow.com/q/23399852
score: 0

http://stackoverflow.com/comment/85874457
type: Comment
has text: The only thing I would add is that you need to specifically add a reference to the COM dll within VisualStudio to make these types available. That might be covered by your link, but I couldn't get to that site because of my company's website blocking rules...
comment on: http://stackoverflow.com/a/23364324
type: AnswerComment
score: 0

http://stackoverflow.com/a/23440063
upvote count: 2
has comment: http://stackoverflow.com/comment/35927652
has comment: http://stackoverflow.com/comment/35927812
has body: For your original problem for(int row=0; row &lt;marks.length; row++){ for(int col=0;col &lt;4; col++){ marks[row][col]= testScores[i]; i++; } Is incrementing i beyond the length of testScores. Use this for(int row=0; row &lt;marks.length; row++){ i = 0; for(int col=0;col &lt;4; col++){ marks[row][col]= testScores[i]; i++; } FWIW, you can also reduce the amount of code you have in this section, the number of variables, and ultimately the amount of memory allocated for variables: test1=testOneIn.getText(); test2=testTwoIn.getText(); test3=testThreeIn.getText(); test4=testFourIn.getText(); score1=Double.parseDouble(test1); score2=Double.parseDouble(test2); score3=Double.parseDouble(test3); score4=Double.parseDouble(test4); testScores[0]=score1; testScores[1]=score2; testScores[2]=score3; testScores[3]=score4; by doing something like this testScores[0] = Double.parseDouble(testOneIn.getText());
has comment: http://stackoverflow.com/comment/35927470
has comment: http://stackoverflow.com/comment/35927689
has comment: http://stackoverflow.com/comment/35927679
has comment: http://stackoverflow.com/comment/35927740
downvote count: 0
has comment: http://stackoverflow.com/comment/35928017
has comment: http://stackoverflow.com/comment/35927436
has comment: http://stackoverflow.com/comment/35927626
type: Answer
has comment: http://stackoverflow.com/comment/35927992
has comment: http://stackoverflow.com/comment/35927444
has comment: http://stackoverflow.com/comment/35927833
score: 2
answers question: http://stackoverflow.com/q/23439983
has comment: http://stackoverflow.com/comment/35927762

http://stackoverflow.com/comment/35923328
has text: using a bubble sort? I can do that, however I was wondering if there were an easier way, something similar to Arrays.sort()?
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23437722
type: Comment

http://stackoverflow.com/a/23451397
has comment: http://stackoverflow.com/comment/35959309
has body: You should check Androidlost. Anyway, how do you want phones to exchange data? Over server using data packets (GPRS/WiFi) or Bluetooth? I think that Nokia had a similar application to what you want to do. Maybe you should check their community developers site (for Simbian) if it is still active. I remember that service was capable of finding nearby friends phones and inform their owners about it by Bluetooth. It was convenient in dark crowded places such as night clubs, so you got notification when your friends arrive. Androidlost is checking position by GPS or by network location. It helps if WiFi is on. Best accuracy is 10 met and worst (network location) is around 2 km. Data is exchanged over androidlost Web server. Hope this helps. If you provide more info about your intentions we might help you better.
has comment: http://stackoverflow.com/comment/35951604
has comment: http://stackoverflow.com/comment/35959436
score: 0
answers question: http://stackoverflow.com/q/23449138
has comment: http://stackoverflow.com/comment/35959092
type: Answer

http://stackoverflow.com/a/23331523
score: 0
answers question: http://stackoverflow.com/q/23331491
has body: You can use Breadth-First-Search to solve this issue, since it will find the shortest path to a specified destination with unweighted edges. Since this is a BST, there should be no weighted edges, so BFS would be your algorithm of choice here. Here is a wonderful presentation and pseudocode follow up of the algorithm: BFS Tutorial Your goal state will just be a node that doesn't have any children, hence a leaf node. Since BFS will find you the shortest path to this goal, this algorithm will return the first leaf node.
type: Answer

http://stackoverflow.com/a/23461850
has comment: http://stackoverflow.com/comment/36015033
score: 0
has body: Can you please share some code on what you already tried? And what your query looks like and what it depends on which target type you want to use? In general the parameter to to() is a class which can be derived from any condition including checks of your query. You can also get the raw results and transform them yourself.
answers question: http://stackoverflow.com/q/23441482
type: Answer

http://stackoverflow.com/q/23384811
accepted answer: http://stackoverflow.com/a/23384991
type: AnsweredQuestion
has body: Consider the following code class OuterClass{ class InnerClass{ int x; int y; void calculateX(){ x = y+z;//I want to access the y field of the outer class } void printX(){ print(); } } int y; int z; InnerClass instance; OuterClass(int y,int z){ this.y = y; this.z = z; instance = new InnerClass(); instance.y = 10; instance.calculateX(); instance.printX(); } void print(){ System.out.println("X:"+instance.x+"\nY:"+y+"\nZ:"+z+"\n"); } } How to access field of the outer class if there is any overlap in name? I have tried the following: x=super.y; x=OuterClass.y; and received compilation error. Will this kind of situation ever occur in real life programs?
tagged with: java
type: Question
score: 0
has title: Java - How to access Outer class field if the fields have same name
has comment: http://stackoverflow.com/comment/35823765
has answer: http://stackoverflow.com/a/23384894
has answer: http://stackoverflow.com/a/23384991
tagged with: inner-classes
has answer: http://stackoverflow.com/a/23384928
has answer: http://stackoverflow.com/a/23384868
answer count: 5
has answer: http://stackoverflow.com/a/23384961
possible better answer: http://stackoverflow.com/a/23384894

http://stackoverflow.com/q/23347670
answer count: 1
tagged with: jpa
downvote count: 0
has comment: http://stackoverflow.com/comment/35776286
tagged with: persistence
favorite count: 0
has comment: http://stackoverflow.com/comment/35781464
tagged with: rollback
has title: javax.persistence.RollbackException thrown when adding ManyToOne/OneToOne relationship to entity
has answer: http://stackoverflow.com/a/23365865
score: 1
has comment: http://stackoverflow.com/comment/35776931
upvote count: 1
has comment: http://stackoverflow.com/comment/35775548
accepted answer: http://stackoverflow.com/a/23365865
has body: Scenario: I have a JSF 2.1 webapp running on a tomcat server, with hibernate implementing the jpa interface and mysql database. Users of the webapp are registered as an Entity on the database, and there are a group of data called Rooms, that have their own Entity, where users have access as proprietary or as external managers. To save the concept of "external management" on the database i have a proper Entity for every management; the external management are saved as a OneToMany relathionship on the User Entity. Here you have the Hibernate dependencies as they were added to the pom.xml of the project: org.hibernate hibernate-core 4.3.5.Final org.hibernate hibernate-entitymanager 4.3.5.Final org.hibernate hibernate-c3p0 4.3.5.Final org.hibernate hibernate-validator 5.1.0.Final Problem: For some odd reason, adding the code for a foreign key to the managed room in the External Management Entity with a ManyToOne relationship, breaks up Hibernate: any update to the list of external management property on the User, when that foreign key is present, throws RollbackException - "Transaction marked as rollback only": Caused by: it.katuiros.core.db.dao.DataAccessException: Data Access error while doing final commit. at it.katuiros.core.db.dao.impl.GenericDaoImpl.closeDataAccess(GenericDaoImpl.java:222) at it.katuiros.core.db.dao.impl.GenericDaoImpl.update(GenericDaoImpl.java:96) at it.katuiros.appLogic.PersistenceTest.saveTestData(PersistenceTest.java:157) at it.katuiros.beans.generics.TestBean.<init>(TestBean.java:44) ... 67 more Caused by: javax.persistence.RollbackException: Transaction marked as rollbackOnly at org.hibernate.jpa.internal.TransactionImpl.commit(TransactionImpl.java:74) at it.katuiros.core.db.dao.impl.GenericDaoImpl.closeDataAccess(GenericDaoImpl.java:217) ... 70 more As you probably know, the sad thing about those RollbackException in Hibernate is that they are UNDEBUGGABLE! CODE the User entity: @Entity @Table(name = "USER") @Access(AccessType.FIELD) publi…
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35772370
has comment: http://stackoverflow.com/comment/35777695
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/35780042
type: Question

http://stackoverflow.com/q/23351493
answer count: 2
has answer: http://stackoverflow.com/a/23351703
has body: Being fairly new to Java I have a quick question and haven't seen it here. I have 2 Array lists, and I need to multiply the numbers held in the index position in each list by each other to provide the answer, e.g. ArrayListAlpha(0,1,2,3 etc) ArrayListBeta(0,1,2,3 etc) So I need to multiply 1x1, 2x2, 3x3 etc. and then display the answers onscreen in a descending order; I also need to show the calculation and the information in the arrays. e.g. 1x1 = 2x2 = 3x3 = Can anyone point me in the right direction? Thanks
favorite count: 0
has answer: http://stackoverflow.com/a/23351710
has comment: http://stackoverflow.com/comment/35763620
type: AnsweredQuestion
has title: Multiplying by indexes position in 2 arrays
tagged with: java
downvote count: 2
upvote count: 1
possible better answer: http://stackoverflow.com/a/23351710
type: Question
accepted answer: http://stackoverflow.com/a/23351703
tagged with: arrays
score: -1
tagged with: arraylist

http://stackoverflow.com/comment/35870472
type: AnswerComment
comment on: http://stackoverflow.com/a/23408966
type: Comment
has text: Thus the word "implies". This is essentially an opinion-based question. I gave my opinion.
score: 0

http://stackoverflow.com/comment/35936308
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23444587
has text: @garagumo: please see latest edit. Also, just for my education, can you tell me how far along in your Java education you are. This may have some bearing on how it would be best to explain things to you.
type: AnswerComment

http://stackoverflow.com/a/23432084
has body: Caching is helpful in some situation, detrimental in others. To implement caching within basic map implementations would cause problems in situations where caching is unhelpful. Remember that one can easily construct a wrapper around a non-caching map that caches as appropriate for a particular scenario.
downvote count: 0
answers question: http://stackoverflow.com/q/23431760
type: Answer
upvote count: 2
score: 2

http://stackoverflow.com/q/23342359
tagged with: keylistener
type: Question
has comment: http://stackoverflow.com/comment/35745334
has body: I´ve implemented a Keylistener in Java, which basically works, but if I hold a key pressed, it seems that all the KeyEvents are "stacked" and executed one after another. Generally, I want this behavior, but since the methods called on a Key Event take some computation time, I would like to "block" the Keylistener to accept Events while already executing a method called from a previous KeyEvent. I already tried to set a bool flag inside the KeyListener, but it didn´t work because it seems that the Keylisteners methods are called after a previous KeyEvent is executed completely. Any ideas how to achieve this? Thanks! edit: Here is a code snippet how I tried it without success: @Override public void keyPressed(KeyEvent e) { frame.removeMouseListener(this); switch (e.getKeyCode()) { case KeyEvent.VK_RIGHT: case KeyEvent.VK_DOWN: case KeyEvent.VK_PAGE_DOWN: frame.myMethod(); break; case KeyEvent.VK_MINUS: case KeyEvent.VK_SUBTRACT: frame.myOtherMethod(); break; } frame.addMouseListener(this); }
score: 0
answer count: 1
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23343183
has title: Block Java Keylistener while executing previous command
tagged with: java

http://stackoverflow.com/q/23448816
has comment: http://stackoverflow.com/comment/35943352
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/23448874
linked to: http://stackoverflow.com/q/1429860
has body: Did a bunch of searching but came up blank. I'm using GreenDao within my app and am querying my database in a specific method which results in a list. I'd like to convert that list to a copyonwritearrayset. Is there a simple way to do this that I'm just not seeing? At this point the only thing I can think to do is go item by item in a for loop: List&lt;Item&gt; list = mItemDao.queryBuilder().orderDesc(ItemDao.Properties._id) .list(); CopyOnWriteArraySet&lt;Item&gt; set = new CopyOnWriteArraySet&lt;Item&gt;(); for (Item item : list) { set.add(item); } return set;
possible better answer: http://stackoverflow.com/a/23448874
tagged with: android
has answer: http://stackoverflow.com/a/23448857
type: AnsweredQuestion
has title: Convert List to CopyOnWriteArraySet
tagged with: java
accepted answer: http://stackoverflow.com/a/23448857
has comment: http://stackoverflow.com/comment/35943411
type: Question

instantiation
type: Tag
tags question: http://stackoverflow.com/q/23363419
tags question: http://stackoverflow.com/q/23347318
tags question: http://stackoverflow.com/q/23412231
tag name: instantiation
tags question: http://stackoverflow.com/q/23303517

http://stackoverflow.com/q/23328928
favorite count: 0
upvote count: 2
type: UnansweredQuestion
tagged with: encryption
has comment: http://stackoverflow.com/comment/35721497
downvote count: 1
has body: So I made a program based off this tut: http://www.macs.hw.ac.uk/~ml355/lore/pkencryption.htm It works perfectly fine, but as you can see at the bottom of the page it requires OpenSSL commands. I used OpenSSL and generated my keys in the correct format to test my program, works perfectly. But I was wondering how I would generate those keys just in Java. I have tried countless times but encryption is so hard to understand for me and to work with. So I have no code to show at the moment, how would I start this or if anyone has a good method for doing so. I don't mind using bouncy castle if it is possible. TL;DR: I would like to generate a unique Private and Public key in the correct format (PKCS#8, DER) using java (with or without a public library). Just need these commands in java (not running through OpenSSL): To generate a private key of length 2048 bits: openssl genrsa -out private.pem 2048 To get it into the required (PKCS#8, DER) format: openssl pkcs8 -topk8 -in private.pem -outform DER -out private.der -nocrypt To generate a public key from the private key: openssl rsa -in private.pem -pubout -outform DER -out public.der
tagged with: pkcs#8
has comment: http://stackoverflow.com/comment/35722453
has comment: http://stackoverflow.com/comment/35722616
has comment: http://stackoverflow.com/comment/35722494
tagged with: java
has comment: http://stackoverflow.com/comment/35722186
type: Question
has comment: http://stackoverflow.com/comment/35726130
has answer: http://stackoverflow.com/a/23330265
has title: OpenSSL commands in Java?
tagged with: openssl
has comment: http://stackoverflow.com/comment/35721810
tagged with: public-key
answer count: 1
score: 1

http://stackoverflow.com/q/23413092
type: Question
has body: I use the lib commons-lang-2.4.jar for my project. I develop under Windows, then send everything (including those libs) to Ubuntu server 4.6.3 Under windows, everything works fine. But when I launch my program under Ubuntu, I get this error: java.lang.NoSuchMethodError: java.lang.String.join(Ljava/lang/CharSequence;[Ljava/lang/CharSequence;)Ljava/lang/String; How can I fix it?
has title: Error under Ubuntu with the method String.join
tagged with: join
tagged with: java
has answer: http://stackoverflow.com/a/23413252
tagged with: ubuntu
score: 0
has comment: http://stackoverflow.com/comment/35877060
answer count: 1
tagged with: string
linked to: http://stackoverflow.com/q/35186
favorite count: 0
accepted answer: http://stackoverflow.com/a/23413252
duplicate of: http://stackoverflow.com/q/35186
has comment: http://stackoverflow.com/comment/35877431
has comment: http://stackoverflow.com/comment/35876867
has comment: http://stackoverflow.com/comment/35876953
type: AnsweredQuestion
upvote count: 2
downvote count: 2

http://stackoverflow.com/a/23373088
has body: You have two different listener objects here, one is a MouseListener instance (that listens to mouse events on the panel) and the other is a ChartMouseListener instance (that listens to mouse events on the chart in the panel). They are registered in separate listener lists, and the isDoubleClicked field from one object isn't visible to the other object. The reason that ChartMouseListener is separate from MouseListener is that JFreeChart creates its own events that contain additional information about the entity in a chart that is "underneath" the mouse pointer.
downvote count: 0
answers question: http://stackoverflow.com/q/23370505
type: AcceptedAnswer
upvote count: 2
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/23370505
has comment: http://stackoverflow.com/comment/35803130

http://stackoverflow.com/comment/35839204
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23392857
has text: What JSON library do you use? Certainly the `JSONObject` and `JSONArray` classes must come from somewhere.

http://stackoverflow.com/comment/35903092
comment on: http://stackoverflow.com/a/23427056
type: AnswerComment
score: 0
has text: I've used this. Is there any way to not make it fill the entire JPanel?
type: Comment

http://stackoverflow.com/q/23331416
upvote count: 8
tagged with: time
has answer: http://stackoverflow.com/a/23438859
answer count: 5
has answer: http://stackoverflow.com/a/23333733
possible better answer: http://stackoverflow.com/a/26538707
tagged with: android
tagged with: android-dateutils
has answer: http://stackoverflow.com/a/26538707
score: 8
type: AnsweredQuestion
tagged with: java
has title: Formatting date & time according to user's locale & preferences with seconds
type: Question
accepted answer: http://stackoverflow.com/a/23438859
tagged with: date
has answer: http://stackoverflow.com/a/23331530
has answer: http://stackoverflow.com/a/34613590
has body: I am attempting to get a formatted date (year, month, date) and time (hour, minute, second) string according to the user's settings. This post in the Android Developers Google Group describes the precise problem I am having, but no one helped that person solve it. I will summarize it: Android has these classes that attempt to do the above, but none use both the user preferences and display the seconds. java.text.DateFormat Doesn't use preferences set in Settings app android.text.format.DateFormat Gets a java.text.DateFormat object that formats output correctly using getDateFormat() and getTimeFormat(), but getTimeFormat() doesn't include seconds. android.text.format.DateUtils Doesn't use preferences set for showing date in Settings app and no way to display seconds. For example, with preferences in Settings set to DD/MM/YYYY and 24-hour format = on, running the following code: long timestamp=System.currentTimeMillis(); sometextview.setText( java.text.format.DateFormat.getDateTimeInstance().format(new Date(timestamp)) +"\n"+ android.text.format.DateFormat.getDateFormat(this).format(new Date(timestamp)) +" "+ android.text.format.DateFormat.getTimeFormat(this).format(new Date(timestamp)) +"\n"+ android.text.format.DateUtils.formatDateTime(this, timestamp, DateUtils.FORMAT_SHOW_DATE| DateUtils.FORMAT_SHOW_TIME| DateUtils.FORMAT_SHOW_YEAR) ); gives me the following output in the textview: Apr 27,2014 5:47:18 PM 27/04/2014 17:47 April 27,2014, 17:47 None gives the desired output, which would be something like this using the aforementioned preferences: 27/04/2014 17:47:18 I've looked into the joda-time-android library as well, but it doesn't seem to do what I need (correct me if I'm wrong). TL;DR: How do you format date/time according to user preferences with seconds on Android?
linked to: http://stackoverflow.com/q/38922754
downvote count: 0
favorite count: 0

http://stackoverflow.com/a/23416727
upvote count: 0
has comment: http://stackoverflow.com/comment/35884188
has comment: http://stackoverflow.com/comment/35884292
has comment: http://stackoverflow.com/comment/35884118
type: Answer
has comment: http://stackoverflow.com/comment/35884332
has comment: http://stackoverflow.com/comment/35884132
has comment: http://stackoverflow.com/comment/35884213
score: -1
answers question: http://stackoverflow.com/q/23416531
has comment: http://stackoverflow.com/comment/35884259
downvote count: 1
has body: What you can do is have enums that implement a common interface, and then utilize those interfaces: public interface YourEnumInterface&lt;E extends Enum&lt;E&gt; &amp; YourEnumInterface&lt;E&gt;&gt; { //methods that your enum should be implementing } The extension for the interface generic declaration is there to guarantee it is only called by enums that implement your interface And then any enum you have to specify can implement it like so: public enum MyEnum implements YourEnumInterface&lt;MyEnum&gt; { // enum constants TEST_VALUE; // implementation of interface methods } From there, you would simply work with the YourEnumInterface as an object, and you can pass enum values for them: public void doSomething(YourEnumInterface enm) { //work with enm } //Elsewheres... doSomething(MyEnum.TEST_VALUE); It should be noted, that once you lower your enum down to the interface itself, you won't be able to change the constant you are working with (without casting, which can potentially be unsafe). This should really be used more or less for passing things to a destination that just works with the values (like a config enum, or internalization of strings, etc) So in relevance to forcing a subclass to implement it: public class YourSuperClass { public abstract YourEnumInterface symbol; } A runnable example public class EnumMagic { public static void main(String[] args) { YourSubClass clazz = new YourSubClass(); //prints the default value System.out.println(clazz.getEnum().getValue()); //gets the value of a specified enum constant System.out.println(clazz.getEnum().SECOND_TEST.getValue()); } } abstract class YourSuperClass { protected YourEnumInterface symbol; public abstract YourEnumInterface getEnum(); } interface YourEnumInterface&lt;E extends Enum&lt;E&gt; &amp; YourEnumInterface&lt;E&gt;&gt; { public int getValue(); } class YourSubClass extends YourSuperClass { public enum MyEnum implements YourEnumInterface&lt;MyEnum&gt; { TEST_VALUE(1), SECOND_TEST(2); private final int …

http://stackoverflow.com/comment/35931572
type: QuestionComment
comment on: http://stackoverflow.com/q/23406424
score: 0
has text: @Ellis yes, you're right - although, there are other system apps that behave like that. For example, People app - I don't think it's using Preference API to achieve such appearance. :)
type: Comment

http://stackoverflow.com/q/23352280
has title: Java downloading a file and retrieving current download completion
has answer: http://stackoverflow.com/a/23352387
favorite count: 0
tagged with: download
type: UnansweredQuestion
upvote count: 1
has answer: http://stackoverflow.com/a/23352437
score: 1
tagged with: java
tagged with: percentage
tagged with: time-estimation
type: Question
has body: In a program I have that auto-updates, I need it to download a specific file (working already) and it does so with the following code: public static void getFile() { try { URL url = new URL("https://dl.dropboxusercontent.com/s/tc301v61zt0v5cd/texture_pack.png?dl=1"); InputStream in = new BufferedInputStream(url.openStream()); ByteArrayOutputStream out = new ByteArrayOutputStream(); byte[] buf = new byte[1024]; int n = 0; while (-1 != (n = in.read(buf))) { out.write(buf, 0, n); } out.close(); in.close(); byte[] response = out.toByteArray(); FileOutputStream fos = new FileOutputStream(file4); fos.write(response); fos.close(); } catch (Exception e) { JOptionPane.showMessageDialog(null, "Check your internet connection, then try again.\nOr re-install the program.\nError Message 7", "Could Not Download The Required Resources.", JOptionPane.NO_OPTION); e.printStackTrace(); System.exit(0); } } How would I implement a way to get the current completion of the download (like the percent it's downloaded) and put it into an integer to be printed out in the console (just for developer testing). Also what sort of equation could i use to get the estimated amount of time left on the download? Anything would help! Thanks.
answer count: 2
downvote count: 0

http://stackoverflow.com/q/23376072
has comment: http://stackoverflow.com/comment/35808225
has body: When i add another JPanel into frame previous will dissapper (or probably overlaps the previous one). How can i stop this overlapping? public Attack() { JFrame frame = new JFrame("Oracle Padding Attack"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); panel1.setLayout(null); JLabel label1 = new JLabel("Inicialization vector:"); createTextField(10, 40, arrayIV, panel1, "HH", true, false); label1.setBounds(10, 0, 120, 50); panel1.add(label1); panel2.setLayout(null); JLabel label2 = new JLabel("Encrypted text:"); createTextField(400, 40, encryptedTextArray, panel2, "00", true, false); label2.setBounds(400, 0, 120, 50); panel2.add(label2); frame.add(panel1); frame.add(panel2); frame.setSize(900, 400); frame.setVisible(true); }
has comment: http://stackoverflow.com/comment/35810430
has answer: http://stackoverflow.com/a/23376183
accepted answer: http://stackoverflow.com/a/23376183
tagged with: swing
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/17874717
tagged with: null-layout-manager
tagged with: java
has comment: http://stackoverflow.com/comment/35812964
type: Question
linked to: http://stackoverflow.com/q/5621338
has comment: http://stackoverflow.com/comment/35808312
tagged with: layout
tagged with: layout-manager
has comment: http://stackoverflow.com/comment/35808280
score: 0
answer count: 1
has title: Custom layout in frame

http://stackoverflow.com/comment/35923406
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23409604
has text: I think i found the issue . The trigger point for this request was from the controller. The controller called a service which invoked the async component. When I added <task:annotation-driven> to the web context as well , it worked . This component resides in the server - not sure why task annotation needs to be enabled in web context also .

http://stackoverflow.com/q/23326456
type: Question
accepted answer: http://stackoverflow.com/a/23331271
upvote count: 12
tagged with: jpa
tagged with: database-schema
answer count: 3
has comment: http://stackoverflow.com/comment/35716809
downvote count: 0
favorite count: 0
possible better answer: http://stackoverflow.com/a/70276002
has answer: http://stackoverflow.com/a/70276002
score: 12
has title: Why is there a class with entity name plus an underscore for JPA entity class
type: AnsweredQuestion
has body: I am new to JPA, I have created a class like the following /** * */ package programme; import javax.persistence.Access; import javax.persistence.AccessType; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.Table; import javax.persistence.Transient; /** * @author anoop * */ @Entity @Table(name="course") @Access(AccessType.FIELD) public class programme { @Id private int id; private String name; private int year; @Transient private String comments; //getters and setters for the fields. } I noted that there is another class with name as my entity java class Programme.java with an underscore i.e. Programme_.java. What is this class and why is this generated. Is there any way that I can stop its generation? the code for the Programme_.java class is as following. package programme; import javax.annotation.Generated; import javax.persistence.metamodel.SingularAttribute; import javax.persistence.metamodel.StaticMetamodel; @Generated(value="Dali", date="2014-04-27T21:32:59.433+0530") @StaticMetamodel(programme.class) public class programme_ { public static volatile SingularAttribute&lt;programme, Integer&gt; id; public static volatile SingularAttribute&lt;programme, String&gt; name; public static volatile SingularAttribute&lt;programme, Integer&gt; year; public static volatile SingularAttribute&lt;programme, String&gt; comments; }
has answer: http://stackoverflow.com/a/23331271
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/32319997

http://stackoverflow.com/q/23365618
has answer: http://stackoverflow.com/a/23365810
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has answer: http://stackoverflow.com/a/23366213
possible better answer: http://stackoverflow.com/a/23365810
answer count: 2
has body: I am developing an Android application which fetches data from a server through HTTP GET, stores the response (JSON format) in a String. I want to parse the String and get the values within the JSONArray. The received JSON which is stored in the STRING is : {"code":1,"data":{"survey":{"id":null,"questionAnswers":[{"id":null,"min":"1","max":"5","step":"0.1","last":"4.7","text":"I am happy at work today","key":"Mood","testQuestionId":"1","datetime":"2014-04-29 15:47:02","answer":"4.7","testAnswerId":null}]}} I want to parse the JSON Array "questionAnswers", and retrieve the value in "answer", which is inside a JSONObject. The code I used is as follows : JSONObject jsonObj_survey = new JSONObject(Get_MySurvey_JSON); JSONObject jsondata_survey = jsonObj_survey.getJSONObject("data"); JSONArray jsonArray_questionAnswer = jsondata_survey .getJSONArray("questionAnswers"); for (int i = 0; i &lt; jsonArray_questionAnswer.length(); i++) { JSONObject questionAnswer = jsonArray_questionAnswer .getJSONObject(i); my_Company_survey_rating[i] = questionAnswer.getString("answer"); // userdata.setMy_Company_Top_key_1(my_Company_Top_key[1]); Log.d("Rating", my_Company_survey_rating[i]); } I am unable to parse it and obtaining an exception : 04-29 18:28:00.272: W/System.err(13189): org.json.JSONException: No value for questionAnswers 04-29 18:28:00.272: W/System.err(13189): at org.json.JSONObject.get(JSONObject.java:354) 04-29 18:28:00.272: W/System.err(13189): at org.json.JSONObject.getJSONArray(JSONObject.java:548) 04-29 18:28:00.272: W/System.err(13189): at com.moodwonder.fi.HTTP_SignIn_Thread.doInBackground(HTTP_SignIn_Thread.java:224) 04-29 18:28:00.272: W/System.err(13189): at com.moodwonder.fi.HTTP_SignIn_Thread.doInBackground(HTTP_SignIn_Thread.java:1) 04-29 18:28:00.272: W/System.err(13189): at android.os.AsyncTask$2.call(AsyncTask.java:287) 04-29 18:28:00.272: W/System.err(13189): at java.util.concurrent.FutureTask.run(FutureTask.java:234) 04-29 18:28:00.272: W/System.err(1318…
tagged with: arrays
score: 0
linked to: http://stackoverflow.com/q/23338695
tagged with: android
has comment: http://stackoverflow.com/comment/35788214
accepted answer: http://stackoverflow.com/a/23366213
has title: Error Parsing JSON file in Android
has comment: http://stackoverflow.com/comment/35788189
has comment: http://stackoverflow.com/comment/35788059
type: Question
type: AnsweredQuestion

http://stackoverflow.com/comment/35919016
score: 0
comment on: http://stackoverflow.com/q/23435662
type: Comment
type: QuestionComment
has text: there's only one line in that example. can you expand on what you mean by "alphabetically"? Do you mean the first letter of each line? And if so, can you give us a better example of the output?

http://stackoverflow.com/comment/35807245
score: 0
type: Comment
type: QuestionComment
has text: Sorry changed String line to line = rd.readLine();
comment on: http://stackoverflow.com/q/23375409

http://stackoverflow.com/q/23367158
tagged with: jakarta-ee
type: AnsweredQuestion
has body: I am trying to switch my dev environment from Eclipse to IntelliJ. I am developing a Java EE application that uses the path returned from this.getClass().getResource("").getFile() to create a new FileInputStream. When running the project with Eclipse/Jetty (from the Jetty plugin on the Eclipse marketplace) and on production with Glassfish, the string returned looks like "/C:/path/to/class/in/jar/". However, when running the project with IntelliJ/Jetty (8.* from http://download.eclipse.org/jetty/stable-8/dist/) the file path returned looks like "file:/C:/path/to/class/in/jar/". The 'file:' at the beginning of the string is causing a FileNotFoundException on "new FileInputStream(path)". I am developing on Windows 8. I can easily strip the "file:" from the string, but I would rather not change the codebase to fix what appears to be an environment issue. Is there something I can do so that getFile() does not return a path starting with "file:"?
tagged with: java
has comment: http://stackoverflow.com/comment/35793581
accepted answer: http://stackoverflow.com/a/23369308
tagged with: eclipse
type: Question
score: 2
tagged with: intellij-idea
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/35794009
has answer: http://stackoverflow.com/a/23369308
favorite count: 0
upvote count: 2
tagged with: jetty
has comment: http://stackoverflow.com/comment/35794364
has title: this.getClass().getResource("").getFile() returning path with "file:" at the beginning when running project with IntelliJ/Jetty 8.1.14
has comment: http://stackoverflow.com/comment/35793867

http://stackoverflow.com/q/23386116
has body: Recently I came up with something like this: public static String allCmds() throws Exception { try { // This will load the MySQL driver, each DB has its own driver Class.forName("com.mysql.jdbc.Driver"); // Setup the connection with the DB connect = DriverManager.getConnection(""+MyBot.mysqlDbPath+"",""+MyBot.mysqlDbUsername+"",""+MyBot.mysqlDbPassword+""); PreparedStatement zpst=null; ResultSet zrs=null; zpst=connect.prepareStatement("SELECT `befehlsname` FROM `eigenebenutzerbefehle` WHERE 1 "); zrs=zpst.executeQuery(); if(zrs.next()){ return zrs.getString(1); }else{ return "-empty-"; } }catch (Exception e) { throw e; } finally { close(); } } The bad thing now is, I am only able to get the first name out of my database even when there are more entries present in it. Is something wrong with below part here? SELECT `befehlsname` FROM `eigenebenutzerbefehle` WHERE 1 Update After reading some answers I cleared some stuff out and now it works. I changed it this way: public static void allCmds() throws Exception { try { // This will load the MySQL driver, each DB has its own driver Class.forName("com.mysql.jdbc.Driver"); // Setup the connection with the DB connect = DriverManager.getConnection(""+MyBot.mysqlDbPath+"",""+MyBot.mysqlDbUsername+"",""+MyBot.mysqlDbPassword+""); PreparedStatement zpst=null; ResultSet zrs=null; zpst=connect.prepareStatement("SELECT `befehlsname` FROM `eigenebenutzerbefehle`"); zrs=zpst.executeQuery(); while (zrs.next()){ MyBot.commandlist.add(zrs.getString(1)); } }catch (Exception e) { throw e; } finally { close(); } }
type: Question
has title: Query the database for all names in a table?
has comment: http://stackoverflow.com/comment/35826017
answer count: 1
has comment: http://stackoverflow.com/comment/35826359
has comment: http://stackoverflow.com/comment/35825965
has comment: http://stackoverflow.com/comment/35825977
has answer: http://stackoverflow.com/a/23386221
has comment: http://stackoverflow.com/comment/35825952
type: UnansweredQuestion
score: 0
tagged with: java
tagged with: mysql

http://stackoverflow.com/comment/35869371
comment on: http://stackoverflow.com/q/23409212
score: 0
type: Comment
type: QuestionComment
has text: Have you tried `SimpleDateFormat` ?

http://stackoverflow.com/q/23348341
tagged with: spring-security
tagged with: thymeleaf
answer count: 2
has comment: http://stackoverflow.com/comment/35758826
has comment: http://stackoverflow.com/comment/35760019
downvote count: 0
has comment: http://stackoverflow.com/comment/35759302
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/41215648
tagged with: spring
has title: Spring security and Thymeleaf doesn't work
has body: I am using Spring 4 and Thymeleaf In my index.xhtml page i wrote: Welcome .... You are authorized user! Hi, Username You are NOT authorized user! ... As a result I see: You are authorized user! Hi, Username You are NOT authorized user! i.e. Spring Security doesn't work My build.gradle (some dependecies) are: compile 'org.thymeleaf:thymeleaf-spring4:2.1.2.RELEASE' compile 'org.thymeleaf.extras:thymeleaf-extras-springsecurity3:2.1.1.RELEASE' compile 'nz.net.ultraq.thymeleaf:thymeleaf-layout-dialect:1.2.3' compile 'org.springframework.security:spring-security-core:3.2.0.RELEASE' compile 'org.springframework.security:spring-security-web:3.2.0.RELEASE' compile 'org.springframework.security:spring-security-config:3.2.0.RELEASE' compile 'org.springframework.security:spring-security-taglibs:3.2.0.RELEASE' My spring-security.xml is: <?xml version="1.0" encoding="UTF-8"?> <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/security http://www.springframework.org/schema/security/spring-security-3.2.xsd 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"> <authentication-manager> <authentication-provider> <jdbc-user-service id="jdbcUserService" data-source-ref="dataSource" users-by-username-query="select login, password, is_enabled from users where login = ?" authorities-by-username-query="select u.login, p.`name` from user_group_ref ug, permission_group_ref pg, users u, groups g, permissions p where ug.user_id=u.id and ug.group_id=g.id and pg.group_id=g.id and pg.permission_id = p.id and u.login = ?" group-authorities-by-username-query="select g.id, g.`name`, p.`name` fro…
has answer: http://stackoverflow.com/a/23366104
tagged with: spring-mvc
tagged with: java
has comment: http://stackoverflow.com/comment/35759423
type: Question
score: 5
has comment: http://stackoverflow.com/comment/35759974
upvote count: 5
has comment: http://stackoverflow.com/comment/35756767

http://stackoverflow.com/comment/35780022
has text: Once you think you are done doing things with your openend session object which you open at `session=cluster.connect("space");` try, calling a `session.close()` on it to release the resources.
comment on: http://stackoverflow.com/q/23359868
type: QuestionComment
type: Comment
score: 1

http://stackoverflow.com/q/23333429
tagged with: java
has answer: http://stackoverflow.com/a/37633414
tagged with: listview
has answer: http://stackoverflow.com/a/23333613
has answer: http://stackoverflow.com/a/23333509
downvote count: 0
favorite count: 0
type: UnansweredQuestion
tagged with: android
answer count: 4
score: 2
upvote count: 2
has answer: http://stackoverflow.com/a/23333458
has body: I have a List&lt;News&gt; new ArrayList&lt;News&gt;(); I need to pass this list to another activity and retrieve object from it to assign it to String values. News.java public class News { String title; String description; String thumbnail; String newsUrl; String body; String newsBigImage ; String newsComments ; String newsViews; String publishedDate; String articleGuid; String newsSourceId; String newsId ; String publisherName; String newsSourceTitle; String color; News(String title, String description, String thumbnail, String newsUrl, String body, String newsBigImage, String newsComments, String newsViews, String publishedDate, String articleGuid, String newsSourceId, String newsId , String publisherName, String newsSourceTitle ) { this.title = title; this.description = description; this.articleGuid =articleGuid; this.thumbnail = thumbnail; this.newsUrl = newsUrl; this.body = body; this.newsBigImage = newsBigImage; this.newsComments = newsComments; this.newsViews = newsViews; this.publishedDate = publishedDate; this.newsId = newsId; this.newsSourceId = newsSourceId; this.publisherName = publisherName; //this.color = color; this.newsSourceTitle =newsSourceTitle; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } public String getThumbnail() { return thumbnail; } public void setThumbnail(String thumbnail) { this.thumbnail = thumbnail; } public String getNewsUrl() { return newsUrl; } public void setNewsUrl(String newsUrl) { this.newsUrl = newsUrl; } public String getBody() { return body; } public void setBody(String body) { this.body = body; } public String getNewsBigImage() { return newsBigImage; } public void setNewsBigImage(String newsBigImage) { this.newsBigImage = newsBigImage; } public String getNewsComments() { return newsComments; } public void setNewsComments(String new…
has title: Pass List with custom object to another activity android
type: Question

http://stackoverflow.com/comment/35923795
score: 0
type: Comment
has text: java -version" in terminal - it shows 1.7 eclipse preference, under Java - is set to 1.7
type: AnswerComment
comment on: http://stackoverflow.com/a/23429954

http://stackoverflow.com/comment/35900112
score: 1
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23424284
has text: That's going to cause a `null` pointer exception as your going to want to use the `MouseEvent` information...just saying...

http://stackoverflow.com/a/23362879
type: Answer
upvote count: 1
has body: Such cases appear when there is some issues with your layouts. Check the error log to find any errors. Clear them and build again.
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/23362792

http://stackoverflow.com/comment/35771895
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23356519
has text: You're explicitly discarding the exception in the catch block that would tell you *exactly* what the problem is.
type: Comment

http://stackoverflow.com/a/23318262
answers question: http://stackoverflow.com/q/23318213
has body: Iterate through the JSONArray, retrieve each JSONObject and call the appropriate Drink constructor from the object's attributes: List&lt;Drink&gt; drinks = new ArrayList&lt;Drink&gt;(); JSONArray jsonArr = new JSONArray(jsonString); int len = jsonArr.length(); for (int i = 0; i &lt; len; ++i) { JSONObject obj = jsonArr.getJSONObject(i); String alcohol = obj.getString("alcohol"); String date = obj.getString("date"); double units = obj.getDouble("units"); Drink drink = new Drink(alcohol, date, units); drinks.add(drink); } Of course, you may need to parse the date or do other data conversions before constructing your Drink object.
score: 0
type: Answer

http://stackoverflow.com/comment/35866554
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23407600
has text: @broncoAbierto: I don't get your suggestion. If I would do that, how would it help me in understanding the behaviour of package-private (default) access level. (Which is the purpose of the question.)

http://stackoverflow.com/a/23346577
downvote count: 0
has body: According to the documentation this is possible when you omit the 0x in the address. Your address string should then look like this: String address_64 = "00 13 a2 00 40 a9 d0 d1"; destination = new XBeeAddress64(address_64);
type: Answer
accepted answer of: http://stackoverflow.com/q/23342339
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/23342339
type: AcceptedAnswer

http://stackoverflow.com/a/23330936
score: 0
type: Answer
has body: Replace first two lines with View v = super.getView(position, convertView, parent); And while initializing the adapter ArrayAdapter&lt;String&gt; languagesAdapter = new ArrayAdapter&lt;String&gt;(mContext, R.layout.adapter, arrayLanguages)
answers question: http://stackoverflow.com/q/23313658

http://stackoverflow.com/q/23299050
has answer: http://stackoverflow.com/a/23299463
type: UnansweredQuestion
downvote count: 1
has comment: http://stackoverflow.com/comment/35666901
tagged with: java
has comment: http://stackoverflow.com/comment/35667021
score: -1
type: Question
answer count: 2
upvote count: 0
tagged with: user-interface
has comment: http://stackoverflow.com/comment/35666851
linked to: http://stackoverflow.com/q/19199031
has comment: http://stackoverflow.com/comment/35667093
tagged with: arraylist
has answer: http://stackoverflow.com/a/23299317
has body: I am running into an issue with adding a ArrayList into a JComboBox. Can someone give some advice on how to proceed? I can't seem to get the ArrayList to go into the ComboBox. What are the different ways to work with populating JCombobox's with arrayLists? HotelSystem.Java package hotelManage; import java.awt.*; import java.awt.event.*; import java.util.ArrayList; import javax.swing.*; public class HotelSystem extends JFrame implements ActionListener { /** * */ private static final long serialVersionUID = 1840835913045151061L; private JFrame mainFrame; private JPanel mainPanel; private JPanel btnPanel; private JButton btnRoom; private JButton btnCustomer; private JButton btnOrder; private JButton btnSearch; private CardLayout cLayout; private JLabel lblUpdate; // // OrderSystem order = new OrderSystem(); JPanel orderPanel = order.getOrderPanel(); // RoomSystem room = new RoomSystem(); JPanel roomPanel = room.getRoomPanel(); ArrayList&lt;String&gt; AvailableRooms = room.getAvailableRooms(); // private JButton btnBackfromRoom = room.getBtnBack(); private JButton btnBackfromOrder = order.getBtnBack(); //other private JButton btnUserInputEdit = room.getBtnEdit(); public HotelSystem(){ showGUI(); registerListeners(); } private void showGUI(){ //create JFrame(mainFrame) mainFrame = new JFrame("Hotel Management System"); mainFrame.setSize(500,300); mainFrame.setLayout(new GridLayout(2,0)); //create buttons btnRoom = new JButton("Room Editor"); btnCustomer = new JButton("Customer Editor"); btnOrder = new JButton("Order"); btnSearch = new JButton("Search"); //create Labels lblUpdate = new JLabel("Instructions/details will go here."); //create main panel mainPanel = new JPanel(); cLayout = new CardLayout(); mainPanel.setLayout(cLayout); //create panel that holds the buttons btnPanel = new JPanel(); //add buttons to panel btnPanel.add(btnRoom); btnPanel.add(btnCustomer); btnPanel.add(btnOrder); btnPanel.add(btnSearch); btnPanel.add(lblUpdate); //Button &amp; Room Panel mainPan…
favorite count: 0
tagged with: jcombobox
has title: Adding a ArrayList into a JComboBox

http://stackoverflow.com/comment/35696731
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23315420
type: AnswerComment
has text: here you are, I added it.

http://stackoverflow.com/q/23320265
has answer: http://stackoverflow.com/a/23321081
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/35705211
answer count: 1
has comment: http://stackoverflow.com/comment/35705302
type: UnansweredQuestion
has body: I have a problem to update a listview, but doesn't work. Gives the NullPointerException on ".SetAdapter", does anyone know what can be? Complete code: http://pastebin.com/AZdMi4sc //Get filter from another fragment, using Interface, works fine. public void setFilter(String tag) { getFeedFilter(tag); } //Get only itens private void getFeedFilter(String filter) { ParseQuery&lt;ParseObject&gt; query = ParseQuery.getQuery("FeedPost"); query.whereContains("Type", filter); query.findInBackground(new FindCallback&lt;ParseObject&gt;() { public void done(List&lt;ParseObject&gt; responseList, ParseException e) { if (e == null) { List&lt;Feed&gt; items = new ArrayList&lt;Feed&gt;(); for(int i = 0; i &lt; responseList.size(); i++) { items.add(new Feed(responseList.get(i).getString("objectId"), responseList.get(i).getString("Title")); } adapter = new FeedAdapter(getActivity(), items); adapter.notifyDataSetChanged(); listView.setAdapter(adapter); // The error occurs here. } else { System.out.println("error: "+ e); } } }); } Logcat log: 04-27 03:52:23.175 4415-4415/com.fatos.application.app E/AndroidRuntime﹕ FATAL EXCEPTION: main java.lang.NullPointerException at com.fatos.application.app.fragment.FeedFragment$6.done(FeedFragment.java:256) at com.parse.FindCallback.internalDone(FindCallback.java:45) at com.parse.FindCallback.internalDone(FindCallback.java:31) at com.parse.Parse$5$1.run(Parse.java:853) .....
has comment: http://stackoverflow.com/comment/35705201
tagged with: android-listview
has comment: http://stackoverflow.com/comment/35705334
has comment: http://stackoverflow.com/comment/35705219
has title: Problems to re-setAdapter the listview
tagged with: parse-platform
type: Question
tagged with: android
has comment: http://stackoverflow.com/comment/35705277
tagged with: android-adapter

http://stackoverflow.com/comment/35888493
score: 0
type: QuestionComment
has text: How are you implementing the `dummy ouputstream that just count bytes`? Is this count used as your final output bytes? Does the numbers in the bad/good column represent the total bytes?
type: Comment
comment on: http://stackoverflow.com/q/23419031

http://stackoverflow.com/q/23296820
tagged with: jtextarea
has title: JTextArea does not show up until you select it
tagged with: layout-manager
score: 0
answer count: 1
type: UnansweredQuestion
tagged with: swing
tagged with: null-layout-manager
tagged with: java
type: Question
has body: My code creates a basic Sign Up screen, but the JTextArea objTE1 does not show up until you select where the text would be. import java.awt.*; import javax.swing.*; public class SignUpScreen extends Frame { SignUpScreen() { super("No Layout Manager"); setLayout(null); setTitle("Sign Up"); setSize(400,700); show(); } public static void main(String[] args) { Frame objFrame; JTextArea objTE1; JCheckBox objCheckMail; JCheckBox objCheckEmail; JCheckBox objCheckPhone; Button objButtonFinish; Button objButtonCancel; TextField objEnterEmail; TextField objEnterAdress; TextField objEnterPhone; TextField objEnterUsername; TextField objEnterPassword; TextField objConfirmPassword; objFrame = new SignUpScreen(); objTE1 = new JTextArea(); objCheckMail = new JCheckBox("Mail Notifications"); objCheckEmail = new JCheckBox("Email Notifications"); objCheckPhone = new JCheckBox("Text Notifications"); objButtonFinish = new Button("Sign Up"); objButtonCancel = new Button("Cancel"); objEnterEmail = new TextField("Enter Email",0); objEnterAdress = new TextField("Enter Adress",0); objEnterPhone = new TextField("Enter Phone Number",0); objEnterUsername = new TextField("Enter Username",0); objEnterPassword = new TextField("Enter Password",0); objConfirmPassword = new TextField("Confirm Password",0); Font pagehead = new Font("Verdana", Font.BOLD, 24); objTE1.setFont(pagehead); objTE1.setForeground(Color.BLUE); objTE1.setText(" Sign up for the\nWatermelone Mail List"); objTE1.setEditable(false); objTE1.setVisible(true); objTE1.setBounds(50, 75, 300, 70); objCheckMail.setBounds(100,450,200,50); objCheckEmail.setBounds(100,500,200,50); objCheckPhone.setBounds(100,550,200,50); objEnterEmail.setBounds(100,150,150,20); objEnterAdress.setBounds(100,200,200,20); objEnterPhone.setBounds(100,250,200,20); objEnterUsername.setBounds(100,300,200,20); objEnterPassword.setBounds(100,350,200,20); objConfirmPassword.setBounds(100,400,200,20); objButtonFinish.setBounds(50,600,120,60); objButtonCancel.setBounds(2…
has answer: http://stackoverflow.com/a/23296943

http://stackoverflow.com/a/25026851
score: 0
type: Answer
has body: Yes, you can do it by breaking the image up into rectangles (and then each rectangle into two triangles) and then using graphics.drawImage(..) after setting an AffineTransform to the graphics (which is a different transform for each triangle). I've done it in this applet: http://nik-sergeev.com/trees.html (If you click through the various warnings about Java applets that come up nowadays), then what you will see when you click on pages or bookmarks in the applet is a "page turning" effect, which is done as described above. (It's an applet that is supposed to look like a book.) Any mapping that is locally affine can be achieved this way. (Which is most of the ones you would ever care about.) To find the six parameters that define the AffineTransform for each triangle, you have to ray-trace for the three corners of each triangle. (If you're not familiar with "ray tracing", it's much easier than it sounds. You just have to specify where the point maps from and where it maps to.) Then solve for the affine transform parameters using some basic maths.
answers question: http://stackoverflow.com/q/23345068

http://stackoverflow.com/a/23386781
upvote count: 3
has body: You can take advantage of Generics in Java by declaring the method in your interface as: public interface DataHandler&lt;T&gt; { public List&lt;T&gt; getIt(); } This means that the DataHandler interface is tied to a specific, unknown type T. The getIt() method returns a List of that class T. In other words, it could be seen as DataHandler will handle objects of class T. And then provide your implementation, specifying that ProjectSet will be a DataHandler handling Project objects: public class ProjectSet implements DataHandler&lt;Project&gt; { public List&lt;Project&gt; getIt() { } } You might find this lesson of the Java Tutorials useful.
has comment: http://stackoverflow.com/comment/35827316
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23386675
type: Answer
answers question: http://stackoverflow.com/q/23386675
score: 3

http://stackoverflow.com/q/23416981
has title: how to solve ( non - static variable...) error
downvote count: 1
type: Question
has body: i have problem with the error ( non-static variable this cannot be referenced from a static context ) ** I can't post an image because i need 10 reputation :( my code solves this problem : Write a Java function Sum2List that takes two lists L1 and L2 of the same size and returns list L that contains the sum of data inside the corresponding nodes of lists L1 and L2. and this is the whole code , but i can'n test it because of the above error public class listNode { int data; listNode next; listNode(int d, listNode n){ data = d; next = n; } } public class list { listNode first; } public list Sum2List (list l1 , list l2){ list l = new list(); listNode lNode = new listNode(0,null); l.first = lNode; listNode p = l1.first; listNode q = l2.first; for (p = l1.first; p.next!=null; p=p.next,q=q.next){ lNode.data = p.data + q.data; if (p.next != null) lNode.next = new listNode(0,null); } return l; } public static void main (String[] args){ list l1= new list(); listNode node4 = new listNode(4,null); listNode node3 = new listNode(3,node4); listNode node2 = new listNode(2,node3); listNode node1 = new listNode(1,node2); l1.first = node1; list l2= new list(); listNode node8 = new listNode(8,null); listNode node7 = new listNode(7,node8); listNode node6 = new listNode(6,node7); listNode node5 = new listNode(5,node6); l2.first = node5; list l = Sum2List(l1,l2); for(listNode p = l.first; p.next !=null; p=p.next){ System.out.println(p.data); } }
duplicate of: http://stackoverflow.com/q/2559527
score: 0
upvote count: 1
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/35884793
has answer: http://stackoverflow.com/a/23417008
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/2559527
has comment: http://stackoverflow.com/comment/35884597
has comment: http://stackoverflow.com/comment/35884554
has comment: http://stackoverflow.com/comment/35886423
tagged with: java

http://stackoverflow.com/comment/44191400
type: QuestionComment
has text: Did you ever get your answer? It would help if you better describe your grid execution deployment/environment. Like where does the test code run from. Does the test code run locally at each grid node? Or does test run from some test agent machine A and connects to grid hub B that then passes execution to actual grid node C-Z?
comment on: http://stackoverflow.com/q/23345822
score: 0
type: Comment

wifi
tag name: wifi
type: Tag
tags question: http://stackoverflow.com/q/23348600
tags question: http://stackoverflow.com/q/23420894

http://stackoverflow.com/a/23375839
score: 0
answers question: http://stackoverflow.com/q/23360423
type: Answer
has body: After the information you shared, I'm afraid you'll have to write an application in a desktop programming language. It doesn't really matter which language you use, and I'm not going to make suggestions since I don't know your situation. The fun part will be determining what the browser does. The browser will basically send a HTTP request, either a POST or a GET (I don't know which one it is since I don't know the page). You'll have to open your developer tools in your browser, check what it sends and how it sends it and where it sends it, then recreate that using your language of choice. You then need to read the response and turn it into an excel file. Now, this is quite challenging and I don't know how experienced you are. If you are willing to give up the desktop executable requirement, you can write a Greasemonkey script (in Firefox) or a Chrome extension (for Chrome, duh) which can automate this from the browser. Both use Javascript and are arguably easier to create since you don't need to recreate the HTTP request or reverse engineer what the browser does.

http://stackoverflow.com/a/23406431
type: Answer
has body: I think you are missing a call to create each of the pro[i] items. Add pro[i] = new Proveedores(); before pro[i].setCodigo(...) pro[i].setNombre(...) etc When you do pro = new Proveedores[num_pro]; you are just creating an array that can hold num_pro entries - each entry must be created separately.
has comment: http://stackoverflow.com/comment/35864571
answers question: http://stackoverflow.com/q/23406290
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23406290

http://stackoverflow.com/q/23436868
linked to: http://stackoverflow.com/q/23434076
has comment: http://stackoverflow.com/comment/35921297
type: Question
has comment: http://stackoverflow.com/comment/35921380
has comment: http://stackoverflow.com/comment/35921863
has comment: http://stackoverflow.com/comment/35921363
tagged with: arrays
tagged with: sorting
has comment: http://stackoverflow.com/comment/35921804
score: 0
has comment: http://stackoverflow.com/comment/35921314
has comment: http://stackoverflow.com/comment/35921413
has comment: http://stackoverflow.com/comment/35921745
has comment: http://stackoverflow.com/comment/35923720
has comment: http://stackoverflow.com/comment/35921388
has title: Java: Sorting user-input array upon return
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35921271
has comment: http://stackoverflow.com/comment/35921247
has comment: http://stackoverflow.com/comment/35925973
has body: How can I sort the following? System.out.println("Title: " + titleArray[x].getBook()); This line gets its data from a user-inputted Title. If I try System.out.println("Title: " + Arrays.sort(titleArray[x].getBook())); I receive the following error: LibraryBookSort.java:66: error: no suitable method found for sort(String) System.out.println("Title: " + Arrays.sort(titleArray[x].getBook())); ^ method Arrays.&lt;T#1&gt;sort(T#1[],int,int,Comparator&lt;? super T#1&gt;) is not applicable (cannot instantiate from arguments because actual and formal argument lists differ in length) method Arrays.&lt;T#2&gt;sort(T#2[],Comparator&lt;? super T#2&gt;) is not applicable (cannot instantiate from arguments because actual and formal argument lists differ in length) method Arrays.sort(Object[],int,int) is not applicable (actual and formal argument lists differ in length) method Arrays.sort(Object[]) is not applicable (actual argument String cannot be converted to Object[] by method invocation conversion) method Arrays.sort(double[],int,int) is not applicable (actual and formal argument lists differ in length) method Arrays.sort(double[]) is not applicable (actual argument String cannot be converted to double[] by method invocation conversion) method Arrays.sort(float[],int,int) is not applicable (actual and formal argument lists differ in length) method Arrays.sort(float[]) is not applicable (actual argument String cannot be converted to float[] by method invocation conversion) method Arrays.sort(byte[],int,int) is not applicable (actual and formal argument lists differ in length) method Arrays.sort(byte[]) is not applicable (actual argument String cannot be converted to byte[] by method invocation conversion) method Arrays.sort(char[],int,int) is not applicable (actual and formal argument lists differ in length) method Arrays.sort(char[]) is not applicable (actual argument String cannot be converted to char[] by method invocation conversion) method Arrays.sort(short[],int,int) is …
has comment: http://stackoverflow.com/comment/35921243
has comment: http://stackoverflow.com/comment/35921649
has comment: http://stackoverflow.com/comment/35923646
linked to: http://stackoverflow.com/q/12986386
tagged with: java
has comment: http://stackoverflow.com/comment/35921345

http://stackoverflow.com/a/23384702
upvote count: 3
type: Answer
has body: Your map is a raw HashMap. So, the value can be any type. You can't use + operator with any type of object in java. To overcome this, define a generic map like below Map&lt;Integer, Integer&gt; map = new HashMap&lt;&gt;(); //Java 7 version Map&lt;Integer, Integer&gt; map = new HashMap&lt;Integer, Integer&gt;(); //Java 5 and later versions Here, both key and value are type of Integer, so you can use + operator with them
score: 3
answers question: http://stackoverflow.com/q/23384651
downvote count: 0

http://stackoverflow.com/comment/35719720
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23326771
has text: Your answer was helpful in a way(learned something new) but my app still won't work. I edited my question by adding LogCat results like you asked.
type: AnswerComment

http://stackoverflow.com/q/23345997
type: Question
has comment: http://stackoverflow.com/comment/35752815
tagged with: java
has comment: http://stackoverflow.com/comment/35752263
has body: Here is my app project structure: myapp/ src/main/java/ com.me.myapp.controllers.HelloController src/main/config/ mvc-dispatcher-servlet.xml web.xml pages/ Hello.jsp lib/ <JARs> build.xml My mvc-dispatcher-servlet.xml: <?xml version="1.0" encoding="UTF-8"?> /WEB-INF/pages/ .jsp My web.xml: Partner Demo mvc-dispatcher org.springframework.web.servlet.DispatcherServlet 1 mvc-dispatcher /* Here is the structure of the packaged WAR (after I bundle it up with Ant): myapp.war META-INF/ WEB-INF/ classes/ lib/ pages/ Hello.jsp mvc-dispatcher-servlet.xml web.xml When I deploy this to Tomcat and go to http://localhost:8080/myapp/hello.htm I get a 404 Not Found error from Tomcat. Edit: The objective is (obviously) to go to that URL and see my Hello.jsp page. Where am I going wrong? Update: my HelloController: public class HelloController extends AbstractController { @Override protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception { ModelAndView model = new ModelAndView("Hello"); model.addObject("msg", "This should be visible."); return model; } }
has title: Why won't Spring MVC app display?
has comment: http://stackoverflow.com/comment/35752663
has answer: http://stackoverflow.com/a/23346131
answer count: 1
downvote count: 0
tagged with: jsp
tagged with: tomcat
favorite count: 0
tagged with: spring
has comment: http://stackoverflow.com/comment/35752620
tagged with: spring-mvc
accepted answer: http://stackoverflow.com/a/23346131
type: AnsweredQuestion
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/35752427
has comment: http://stackoverflow.com/comment/35752878

http://stackoverflow.com/q/23345791
tagged with: time
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23345927
has body: I don't know if the title actually makes my problem clear. I'm making a card game application. When the user and the computer both have played their cards off they should remain on the screen there for a certain until the computer plays the next card off. I tried to solve this problem using thread.sleep() in try catch. And it's basically doing what it's supposed to do but it's not what I want it to do. The delay isn't between the computer playing one card and then the second one off. It is between the user pushing the button (for a card) and the appearance of this card on screen. Here is the relevant code: private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { jLabel1.setIcon(//new Icon of the card); jPanel1.remove(jButton1); jLabel2.setIcon(//new Icon of the card); if(//proving whether the computer played the highest amount off) { disableButtons(); sleep();//waiting for a certain time... playCard();//...until playing the next card off } } public void sleep() { try { Thread.sleep(500); } catch (InterruptedException e) { } }
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/35751954
has comment: http://stackoverflow.com/comment/35751945
tagged with: user-interface
tagged with: delay
answer count: 1
score: 0
tagged with: thread-sleep
has comment: http://stackoverflow.com/comment/35751946
has title: Java: time delay on a specific position - works in the wrong place

http://stackoverflow.com/a/23337776
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23337504
has comment: http://stackoverflow.com/comment/35738289
type: Answer
has body: simplest way to run command and get ouput: Process p = Runtime.getRuntime().exec("ls"); p.waitFor(); Scanner s = new Scanner(p.getInputStream()); while (s.hasNextLine()) { String l = s.nextLine(); System.out.println(l); }
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/23337504
type: AcceptedAnswer

http://stackoverflow.com/a/23410369
accepted answer of: http://stackoverflow.com/q/23387798
score: 0
answers question: http://stackoverflow.com/q/23387798
type: AcceptedAnswer
has body: This help me to fix my problem: @WebFilter("*.jsf") public class CharacterEncodingFilter implements Filter { @Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws ServletException, IOException { request.setCharacterEncoding("UTF-8"); chain.doFilter(request, response); } @Override public void destroy() { // TODO Auto-generated method stub } @Override public void init(FilterConfig arg0) throws ServletException { // TODO Auto-generated method stub } } I follow this UTF-8 form submit in JSF is corrupting data link.
type: Answer

http://stackoverflow.com/q/23302037
has title: Why do removeContent(), removeChild(), and detach() not work?
has answer: http://stackoverflow.com/a/23302100
upvote count: 1
favorite count: 0
tagged with: removechild
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/35672287
downvote count: 0
has answer: http://stackoverflow.com/a/23302112
type: AnsweredQuestion
has body: I have an XML file with a list where each element only has an attribute, and I'm trying to delete a specific element, but it doesn't work. My Java code for deleting is: SAXBuilder builder = new SAXBuilder(); Document readDoc; try { readDoc = builder.build(new File(INACTIVE_FILE)); List&lt;Element&gt; inactiveDocList = readDoc.getRootElement().getChild("inactiveDoctorList").getChildren(); for(Element e: inactiveDocList){ if(e.getAttributeValue("inactiveDoctorID").equals("1")){ e.removeContent(); } } XMLOutputter xmlOutput = new XMLOutputter(Format.getPrettyFormat()); xmlOutput.output(readDoc.getRootElement(), new FileOutputStream(new File(INACTIVE_FILE))); } catch (JDOMException | IOException e) { e.printStackTrace(); } And my XML is: &lt;root&gt; &lt;inactiveDoctorList&gt; &lt;doctor inactiveDoctorID="1" /&gt; &lt;doctor inactiveDoctorID="2" /&gt; &lt;doctor inactiveDoctorID="4" /&gt; &lt;doctor inactiveDoctorID="16" /&gt; &lt;doctor inactiveDoctorID="3" /&gt; &lt;doctor inactiveDoctorID="9" /&gt; &lt;doctor inactiveDoctorID="13" /&gt; &lt;doctor inactiveDoctorID="14" /&gt; &lt;doctor inactiveDoctorID="11" /&gt; &lt;doctor inactiveDoctorID="6" /&gt; &lt;/inactiveDoctorList&gt; &lt;/root&gt; When I do e.removeContent() or e.removeChild("doctor") nothing happens, and when I try e.detach() I get this error: Exception in thread "AWT-EventQueue-0" java.util.ConcurrentModificationException: The ContentList supporting the FilterList this iterator is processing has been modified by something other than this Iterator. at org.jdom2.ContentList$FilterListIterator.checkConcurrent(ContentList.java:1309) at org.jdom2.ContentList$FilterListIterator.next(ContentList.java:1357) at org.jdom2.ContentList$FilterListIterator.next(ContentList.java:1260) at edu.miami.cis324.swing.jfarache.RestorePatDoc.reactivate(RestorePatDoc.java:61) at edu.miami.cis324.swing.jfarache.MainFrame$13.actionPerformed(MainFrame.java:741) at javax.swing.AbstractButton.fireActionPerformed(Unknown Source) at ja…
possible better answer: http://stackoverflow.com/a/23302112
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/23302100
type: Question
answer count: 2

http://stackoverflow.com/comment/35661644
comment on: http://stackoverflow.com/q/23296191
has text: It helps if you isolate the code sample down to just the part that's causing the problem. It also helps if it's something we can just drop and run with out needing other classes. See [SSCCE](http://meta.stackexchange.com/questions/22754/sscce-how-to-provide-examples-for-programming-questions)
score: 0
type: Comment
type: QuestionComment

jersey
tags question: http://stackoverflow.com/q/23314281
tags question: http://stackoverflow.com/q/23397690
tags question: http://stackoverflow.com/q/23297685
tags question: http://stackoverflow.com/q/23451175
tags question: http://stackoverflow.com/q/23349251
tags question: http://stackoverflow.com/q/23316589
tags question: http://stackoverflow.com/q/23401148
tags question: http://stackoverflow.com/q/23391016
tags question: http://stackoverflow.com/q/23441095
tags question: http://stackoverflow.com/q/23413490
tags question: http://stackoverflow.com/q/23342550
tags question: http://stackoverflow.com/q/23319654
tags question: http://stackoverflow.com/q/23298372
tags question: http://stackoverflow.com/q/23428642
tags question: http://stackoverflow.com/q/23367380
tag name: jersey
tags question: http://stackoverflow.com/q/23442440
tags question: http://stackoverflow.com/q/23447752
tags question: http://stackoverflow.com/q/23313849
tags question: http://stackoverflow.com/q/23389671
tags question: http://stackoverflow.com/q/23356678
tags question: http://stackoverflow.com/q/23402814
type: Tag
tags question: http://stackoverflow.com/q/23380285

http://stackoverflow.com/comment/35852306
score: 0
has text: Tomcat is being run using a < 1.7 JRE
comment on: http://stackoverflow.com/q/23399994
type: Comment
type: QuestionComment

encryption
tags question: http://stackoverflow.com/q/23393420
tags question: http://stackoverflow.com/q/23291224
tags question: http://stackoverflow.com/q/23346659
tags question: http://stackoverflow.com/q/23320787
tags question: http://stackoverflow.com/q/23293180
tags question: http://stackoverflow.com/q/23294401
tag name: encryption
tags question: http://stackoverflow.com/q/23337948
tags question: http://stackoverflow.com/q/23387707
tags question: http://stackoverflow.com/q/23402672
tags question: http://stackoverflow.com/q/23292391
tags question: http://stackoverflow.com/q/23368870
tags question: http://stackoverflow.com/q/23302045
tags question: http://stackoverflow.com/q/23294482
tags question: http://stackoverflow.com/q/23296768
tags question: http://stackoverflow.com/q/23440879
tags question: http://stackoverflow.com/q/23392085
tags question: http://stackoverflow.com/q/23328928
tags question: http://stackoverflow.com/q/23344522
tags question: http://stackoverflow.com/q/23371389
tags question: http://stackoverflow.com/q/23375989
tags question: http://stackoverflow.com/q/23343446
tags question: http://stackoverflow.com/q/23441208
tags question: http://stackoverflow.com/q/23382210
tags question: http://stackoverflow.com/q/23372303
tags question: http://stackoverflow.com/q/23413838
tags question: http://stackoverflow.com/q/23387143
tags question: http://stackoverflow.com/q/23310284
tags question: http://stackoverflow.com/q/23293892
type: Tag
tags question: http://stackoverflow.com/q/23319887

http://stackoverflow.com/comment/36137779
has text: I ended up copying the entire sqlite4java-282 folder to /Users/MY_USERNAME/Library/Java/Extensions (which didn't exist anymore for some reason so I remade it) and this worked, so thank you for the help, lot of good info here.
score: 0
comment on: http://stackoverflow.com/a/23483438
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/35946186
type: QuestionComment
has text: What exactly doesn't work? Are you getting any exceptions? Also, what do you mean by 'player'?
comment on: http://stackoverflow.com/q/23449779
score: 0
type: Comment

http://stackoverflow.com/a/23300736
answers question: http://stackoverflow.com/q/23300710
score: 0
type: Answer
has body: Subtract their ASCII values. char ch = 'X'; int diff = ch -'A';

http://stackoverflow.com/comment/35928934
type: Comment
has text: It's something with the Layouts try making a panel with a BorderLayout add to this panel the panel of what you have in the center or the right and then add a panel with your buttons (probably a GridLayout) to the left. I'm not sure if this will fix it but you can give it a try.
comment on: http://stackoverflow.com/a/23440856
score: 0
type: AnswerComment

http://stackoverflow.com/comment/35927490
score: 1
comment on: http://stackoverflow.com/a/23427869
type: AnswerComment
has text: I have added like this -Djava.library.path="D:\bio-metric\SBXPC_CORE_130330"
type: Comment

http://stackoverflow.com/comment/35897836
has text: why don't you want to use getters and setters?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23424313

http://stackoverflow.com/comment/35792289
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23367803
has text: Post your real code. The current code doesn't even compile.
score: 4

http://stackoverflow.com/q/23430130
has answer: http://stackoverflow.com/a/23430458
has answer: http://stackoverflow.com/a/53923724
tagged with: eclipselink
tagged with: jpa
downvote count: 0
has answer: http://stackoverflow.com/a/23430653
favorite count: 0
upvote count: 2
type: UnansweredQuestion
has body: consider the following schema @Entity Class employee{ @OneToMany() List&lt;employee&gt; manaagedEmps; @OneToOne employee manager; } how to write a query that get all the managed employee for a certain manager , direct(the list of managedEmps) and indirect (managed by managed employee).
answer count: 4
score: 2
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/23432012
has title: Jpa recursive query

http://stackoverflow.com/q/23296361
has body: My java class reads in a 60MB file and produces a HashMap of a HashMap with over 300 million records. HashMap&lt;Integer, HashMap&lt;Integer, Double&gt;&gt; pairWise = new HashMap&lt;Integer, HashMap&lt;Integer, Double&gt;&gt;(); I already tunned the VM argument to be: -Xms512M -Xmx2048M But system still goes for: Exception in thread "main" java.lang.OutOfMemoryError: Java heap space at java.util.HashMap.createEntry(HashMap.java:869) at java.util.HashMap.addEntry(HashMap.java:856) at java.util.HashMap.put(HashMap.java:484) at com.Kaggle.baseline.BaselineNew.createSimMap(BaselineNew.java:70) at com.Kaggle.baseline.BaselineNew.&lt;init&gt;(BaselineNew.java:25) at com.Kaggle.baseline.BaselineNew.main(BaselineNew.java:315) How big of the heap will it take to run without failing with an OOME?
downvote count: 0
has comment: http://stackoverflow.com/comment/35663341
has title: JVM Tunning of Java Class
tagged with: jvm
favorite count: 0
tagged with: heap-memory
answer count: 3
linked to: http://stackoverflow.com/q/9037468
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23296595
tagged with: jvm-arguments
has answer: http://stackoverflow.com/a/23296629
has comment: http://stackoverflow.com/comment/35662122
upvote count: 1
type: Question
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/23296451

http://stackoverflow.com/q/23328171
tagged with: date
has comment: http://stackoverflow.com/comment/35720076
has body: I am implementing a programm that creates and vehicle manager, with vehicle(objects) and those vehicle objects contain booking objects (with two Strings, one for the beginning date, and one for the end date) So I did some booking tests and it doesnt work. It must be in this method. public boolean isBookable(Booking wishedBooking) { boolean bookable = false; if ((wishedBooking.begin.compareTo(begin) != 1 &amp;&amp; wishedBooking.end.compareTo(begin) != 1) || (wishedBooking.begin.compareTo(end) != -1 &amp;&amp; wishedBooking.end.compareTo(end) != -1)) { bookable = true; } return bookable; } What I tried to do is to use compareTo. The dates have the format: YYYY/MM/DD HH:MM So the only way the attempt booking can be done is when the begining and end of it is bellow or above one of the booking. If in one case it is not like that, it means that it cant be booked since at one time period of the time interval, there is already a booking. I am using != because it is possible that it can be equal, so the result will be 0. The vehicle object now iterated with an methode over all the booking objects to check whether the booking can be done, os it is bookable. Where is the mistake?
answer count: 1
has comment: http://stackoverflow.com/comment/35720048
downvote count: 0
score: 1
favorite count: 0
tagged with: iteration
has comment: http://stackoverflow.com/comment/35720125
type: AnsweredQuestion
has title: Booking logic doesn't work
tagged with: java
has comment: http://stackoverflow.com/comment/35720016
upvote count: 1
has answer: http://stackoverflow.com/a/23328234
has comment: http://stackoverflow.com/comment/35720044
type: Question
has comment: http://stackoverflow.com/comment/35719968
has comment: http://stackoverflow.com/comment/35720019
tagged with: compareto
accepted answer: http://stackoverflow.com/a/23328234

http://stackoverflow.com/q/23440573
type: Question
tagged with: filenotfoundexception
has answer: http://stackoverflow.com/a/23464958
accepted answer: http://stackoverflow.com/a/23464958
tagged with: struts
has title: Caused by: java.io.FileNotFoundException: Could not open ServletContext resource [/applicationContext.xml]
upvote count: 1
tagged with: io
answer count: 1
downvote count: 0
favorite count: 0
has body: I m trying to port my hibernate example to spring by using spring hibernatetemplate but i m getting this error Caused by: java.io.FileNotFoundException: Could not open ServletContext resource [/applicationContext.xml]. Please suggest me run my project. I m fresher in my company my web.xml file <?xml version="1.0" encoding="UTF-8"?> index.jsp spring org.springframework.web.servlet.DispatcherServlet 1 org.springframework.web.context.ContextLoaderListener contextConfigLocation applicationContext.xml my applicationContext.xml <?xml version="1.0" encoding="UTF-8"?> org.hibernate.dialect.MySQLDialect my HrDAO.java file -> package login; import org.hibernate.SessionFactory; import org.springframework.orm.hibernate3.HibernateTemplate; public class HrDao { HibernateTemplate template; public void setSessionFactory(SessionFactory factory) { template = new HibernateTemplate(factory); } public void saveStudent(HrModel e) { template.save(e); } } MY HrMain.java File -> package login; import org.springframework.beans.factory.BeanFactory; import org.springframework.beans.factory.xml.XmlBeanFactory; import org.springframework.core.io.ClassPathResource; import org.springframework.core.io.Resource; public class HrMain { public static void main(String[] args) { Resource resource = new ClassPathResource("applicationContext.xml"); BeanFactory factory = new XmlBeanFactory(resource); HrDao dao = (HrDao) factory.getBean("d"); HrModel student = new HrModel(); student.setEmployee_Name("Akash"); student.setPassword("jaisiaram"); dao.saveStudent(student); } } Finally my View page ->
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: hibernate

http://stackoverflow.com/a/23301393
answers question: http://stackoverflow.com/q/23301338
type: Answer
downvote count: 0
has body: I think so. You seem to be missing spaces. After the TableName and after the ?. String query = "UPDATE " + TableName; query += " Set Name = ?"; // tableSet not good, and // ?WHERE is not valid add spaces. query += " WHERE Person_ID = " + id;
score: 2
has comment: http://stackoverflow.com/comment/35671335
upvote count: 2

http://stackoverflow.com/comment/35770923
has text: I want to be sure I understand correctly: in my example there are 10 `listener-containers`, each holding the one and only `MyListener` instance, correct? In your example there are 10 containers, each with their own listener? Is it somehow possible to keep my approach (using `concurrency`) and make `Dependency` separate for each `listener-container` ?
type: Comment
comment on: http://stackoverflow.com/a/23342956
score: 1
type: AnswerComment

http://stackoverflow.com/a/23301932
type: Answer
has body: setText() does what it sounds like it does: it sets the text of the label. Try this instead: String s = ""; for (String functionChain : stringCollection) { s += functionChain; System.out.print(functionChain); } lblSource.setText(s);
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/23301867
downvote count: 0

http://stackoverflow.com/comment/35850608
has text: @VinceEmigh The data is being sent by a PHP client, not Java.
comment on: http://stackoverflow.com/q/23398841
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/35842094
score: 0
type: Comment
type: QuestionComment
has text: Check code in SetCity ().if in list there 'll b no values then it must be crashed with nullpointer exception.
comment on: http://stackoverflow.com/q/23394616

http://stackoverflow.com/comment/35909477
type: Comment
has text: Oh wait.. now it works ^_^ thanks bro
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/23429558

http://stackoverflow.com/comment/35946273
has text: @Fuhrmanator Thank you for your time. I also started thinking that actionlisteners belong to view. So in view we have in VIEW such actionlistener { ... controller.doSomething() ...}. This works great and code is well-structured. The only think that confuses me is that in view we have reference to controller. If this question is interesting for you vote for it:)
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23415221

http://stackoverflow.com/q/23340608
has title: Check Datasource connection during initialization
has comment: http://stackoverflow.com/comment/35742631
type: UnansweredQuestion
has body: I am using org.apache.commons.dbcp.BasicDataSource and com.mchange.v2.c3p0.ComboPooledDataSource APIs to manage datasource connections. When I have changed the correct connection parameters I was expecting these API gave an exception during initialization but they did not. What am I missing? &lt;bean id="uslDataSource1" class="org.apache.commons.dbcp.BasicDataSource" lazy-init="false"&gt; &lt;property name="driverClassName" value="${usl.db.driverClass}"/&gt; &lt;property name="url" value="${usl.db.jdbcUrl}"/&gt; &lt;property name="username" value="${usl.db.username}"/&gt; &lt;property name="password" value="${usl.db.password}"/&gt; &lt;property name="initialSize" value="${usl.db.initialPoolSize}"/&gt; &lt;property name="validationQuery" value="select 1 from dualx"/&gt; &lt;property name="testOnBorrow" value="false"/&gt; &lt;property name="testWhileIdle" value="true"/&gt; &lt;property name="timeBetweenEvictionRunsMillis" value="1200000"/&gt; &lt;property name="minEvictableIdleTimeMillis" value="1800000"/&gt; &lt;property name="numTestsPerEvictionRun" value="5"/&gt; &lt;property name="defaultAutoCommit" value="true"/&gt; &lt;/bean&gt; &lt;!-- the DataSource (parameterized for configuration via a PropertyPlaceHolderConfigurer) --&gt; &lt;bean id="scpcDataSource2" class="com.mchange.v2.c3p0.ComboPooledDataSource" lazy-init="false"&gt; &lt;property name="driverClass" value="${scpc.db.driverClass}" /&gt; &lt;property name="jdbcUrl" value="${scpc.db.jdbcUrl}" /&gt; &lt;property name="user" value="${scpc.db.username}" /&gt; &lt;property name="password" value="${scpc.db.password}" /&gt; &lt;property name="initialPoolSize" value="${scpc.db.initialPoolSize}" /&gt; &lt;property name="minPoolSize" value="${scpc.db.minPoolSize}" /&gt; &lt;property name="maxPoolSize" value="${scpc.db.maxPoolSize}" /&gt; &lt;property name="acquireIncrement" value="${scpc.db.acquireIncrement}" /&gt; &lt;property name="autoCommitOnClose" value="${scpc.db.autoCommitOnClose}" /&gt; &lt;!-- property nam…
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/35743015
type: Question
tagged with: apache
tagged with: database
tagged with: c3p0
tagged with: datasource
has comment: http://stackoverflow.com/comment/35743275
score: 0
has comment: http://stackoverflow.com/comment/35743200

http://stackoverflow.com/a/23299058
has comment: http://stackoverflow.com/comment/35670844
has comment: http://stackoverflow.com/comment/35666971
answers question: http://stackoverflow.com/q/23298241
score: 0
type: Answer
has body: This doesn't make sense. It sounds like a bug to me. I think the right answer is to wait for Java 8 where dates are finally done right. Your code, for example, could now change to something like what is below. And, Java will throw an exception, like it should. import java.util.*; import java.lang.*; import java.io.*; import java.text.DateFormat; import java.text.ParseException; import java.time.LocalDate; import java.time.format.DateTimeFormatter; public class Main { public static void main(String[] args) { String dubiousDate = "2014-04-01"; LocalDate d; try { DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMdd"); d = LocalDate.parse(dubiousDate, formatter); System.out.println(dubiousDate + " -&gt; " + d); } catch (Exception e) { e.printStackTrace(); System.err.println(dubiousDate + " failed"); } } } }
has comment: http://stackoverflow.com/comment/35667027
has comment: http://stackoverflow.com/comment/35667260

http://stackoverflow.com/comment/35947506
has text: So the formatting of this is pretty special, requiring `<T extends BaseComponentType> T`. Do you have a link I can read up on this more?
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23449948

http://stackoverflow.com/comment/35822499
has text: Also, most elements have `.setXxxSize` that is equal to overridding the method (but can, of course only set value to constant, while the method override can allow for more complex behavoir).
type: AnswerComment
comment on: http://stackoverflow.com/a/23318033
score: 1
type: Comment

http://stackoverflow.com/comment/35919151
comment on: http://stackoverflow.com/q/23435493
type: QuestionComment
type: Comment
has text: Please clarify in which languages you have your code (JavaScript, Java, both?) and how they are running (in the web browser, as an applet, as an independent application, some other way?) because it's not clear what you mean.
score: 1

http://stackoverflow.com/comment/35795237
has text: But what is the exact problem about having 174 tables? I've chosen liferay because i wanted to build a flexible solution to what my client needed.
comment on: http://stackoverflow.com/q/23360851
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23421843
type: Answer
accepted answer of: http://stackoverflow.com/q/23418351
upvote count: 1
answers question: http://stackoverflow.com/q/23418351
has body: Try this File->New->Other->Android->Android Sample Project and then press next Now, you have to select Build Target and press next You will get list of android sample apps select and press finish Good Luck.....
score: 1
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/23359892
has comment: http://stackoverflow.com/comment/35777777
tagged with: java
has body: Following is the mapreduce query: mapper=function () { if (this.meta != null &amp;&amp; this.meta.active == true &amp;&amp; this.data != null &amp;&amp; this.data.attributes != null &amp;&amp; this.data.attributes.lang == "en" &amp;&amp; this.data.attributes.geo == "us" &amp;&amp; this.meta.client.id == "1") { if (this.meta.created &gt; ISODate("2014-03-30 12:27:50")) { emit("querisAddedSinceLastWeek", { "count": 1 }); } if (this.data.expectedResults == null &amp;&amp; this.data.attributes.lang == "en" &amp;&amp; this.data.attributes.geo == "us" &amp;&amp; this.meta.client.id == "1") { emit("queriesWithExpectedResultsCount", { "count": 1 }); } if (this.data.attributes.lang == "en" &amp;&amp; this.data.attributes.geo == "us" &amp;&amp; this.meta.client.id == "1" &amp;&amp; this.meta.active == true) { emit("totalActiveQueriesCount", { "count": 1 }); } } } reducer=function (k, v) { counter = 0; for (i = 0; i &lt; v.length; i++) { counter += v[i].count; } return { "count": counter } } db['ARTDocument.dev'].mapReduce(mapper,reducer,{out:{inline:1}}); In this query, some conditions are common for all 3 queries and there is only single condition for each of them.I want to fire these queries in a single query if possible using aggregation framework in monodb. I want this exact query to be written in aggregation framework in mongodb. I have tried this but it doesnt work. db['ARTDocument.dev'].aggregate( { $match: { "meta.active": true, "meta.client.id": 1, "data.attributes.lang": "en", "data.attributes.geo": "us" } }, { $group: { _id: { $cond: [{ $lt: ["meta.created", ISODate("2014-03-30 12:27:50")] }, "querisAddedSinceLastWeek", "null" ] }, count: { $sum: 1 } } }, { $group: { _id: { $ifNull: ["data.expectedResults", "queriesWithoutExpectedResultsCount"] }, count: { $sum: 1 } } } )
score: -1
tagged with: mapreduce
type: Question
tagged with: mongodb
upvote count: 0
answer count: 1
favorite count: 0
tagged with: aggregation-framework
has answer: http://stackoverflow.com/a/23378608
accepted answer: http://stackoverflow.com/a/23378608
has comment: http://stackoverflow.com/comment/35787195
has comment: http://stackoverflow.com/comment/35779579
downvote count: 1
type: AnsweredQuestion
has title: Convert mapreduce query to aggregation in mongodb

http://stackoverflow.com/q/23397059
tagged with: java
tagged with: mysql
has comment: http://stackoverflow.com/comment/35879919
has comment: http://stackoverflow.com/comment/35847262
type: Question
tagged with: performance
has comment: http://stackoverflow.com/comment/35847351
has comment: http://stackoverflow.com/comment/35847843
has body: I have added image to MultiPartEntity like MultiPartEntity multipart=new MultiPartEntity(); multipart.addPart("imagePath",new InputStreamBody(getContentResolver().openInputStream(Uri.parse("file://"+imagePath)),imageName+".jpg")); httppost.setEntity(multipart); response = httpclient.execute(httppost); Now i have to get "imagePath" value from server side and store it into Mysql.I am using Jersey.how can I get "imagePath" value?
score: 0
tagged with: sql
linked to: http://stackoverflow.com/q/23394169
has comment: http://stackoverflow.com/comment/35847094
has comment: http://stackoverflow.com/comment/35847941
tagged with: android
has comment: http://stackoverflow.com/comment/35847755
has comment: http://stackoverflow.com/comment/35847703
has title: Image store in android
answer count: 0
type: UnansweredQuestion

http://stackoverflow.com/q/23435691
favorite count: 0
has body: I have a JSON in MongoDB with the following structure: { id:"_234234", "stationId":"ALM", "storageData": { } } To retrieve JSON with storageData equal to null, in MongoDB I query as: db.collection.find({"storageData":{"$gt" : {}}}) It gives me list of JSON bodies with empty storageData. So how do I represent that in Java BasicDBObject obj=new BasicDDBObject("storageData", new BasicDBObject("$gt",{})); collection.find(obj); I am getting an error near BasicDBObject("$gt",{}))... How do I represent ("$gt",{}) in Java??
type: Question
has answer: http://stackoverflow.com/a/23436739
upvote count: 2
score: 0
answer count: 2
downvote count: 2
tagged with: java
has answer: http://stackoverflow.com/a/23438399
has title: How to represent the following query(mongodb) in java
tagged with: mongodb
type: UnansweredQuestion

http://stackoverflow.com/a/23414937
has comment: http://stackoverflow.com/comment/35910115
answers question: http://stackoverflow.com/q/23414852
has comment: http://stackoverflow.com/comment/35910063
has comment: http://stackoverflow.com/comment/35909901
has comment: http://stackoverflow.com/comment/35885353
has comment: http://stackoverflow.com/comment/35900733
type: Answer
upvote count: 2
score: 1
has body: It loads a class dynamically. What does Class.forname method do? is a good article about it and it also explains why database drivers needs it: Let's see why you need Class.forName() to load a driver into memory. All JDBC Drivers have a static block that registers itself with DriverManager and DriverManager has static an initializer only. The MySQL JDBC Driver has a static initializer looks like this: static { try { java.sql.DriverManager.registerDriver(new Driver()); } catch (SQLException E) { throw new RuntimeException("Can't register driver!"); } } JVM executes the static block and the Driver registers itself with the DriverManager. You need a database connection to manipulate the database. In order to create the connection to the database, the DriverManager class has to know which database driver you want to use. It does that by iterating over the array (internally a Vector) of drivers that have registered with it and calls the acceptsURL(url) method on each driver in the array, effectively asking the driver to tell it whether or not it can handle the JDBC URL. Source - What does 'Class.forName("org.sqlite.JDBC");' do?
downvote count: 1

http://stackoverflow.com/comment/35825432
score: 0
type: AnswerComment
has text: I am already using jsoup library in my java code for extracting reviews from a link that the user specifies from console in eclipse. Is there any way such that the user is just supposed to select the product and it automatically fetches the URL from address bar?
type: Comment
comment on: http://stackoverflow.com/a/23384266

http://stackoverflow.com/comment/35765272
type: Comment
comment on: http://stackoverflow.com/a/23352633
type: AnswerComment
has text: This works with g2.drawString(), I can have transparent text, but the fillRect() still has the fade out effect :/
score: 0

http://stackoverflow.com/a/23327106
type: Answer
has comment: http://stackoverflow.com/comment/35730820
has comment: http://stackoverflow.com/comment/35721677
has comment: http://stackoverflow.com/comment/35721934
answers question: http://stackoverflow.com/q/23327061
has body: The GUI is not changing the labels, because you are within the "main" thread, responsible for repainting the GUI. You call ExecutorService service = null; try { service = Executors.newFixedThreadPool(1); Future&lt;Integer&gt; task = service.submit(new BackgroundJob()); ping = task.get(); to spawn a thread asynchronously. But the call task.get(); is again a blocking operation. So you spawn the background thread, but wait blocking for its result.
score: 0
has comment: http://stackoverflow.com/comment/35721601
has comment: http://stackoverflow.com/comment/35718042
has comment: http://stackoverflow.com/comment/35717994

http://stackoverflow.com/a/23391120
answers question: http://stackoverflow.com/q/23390436
score: 1
upvote count: 1
downvote count: 0
has body: Simply use class=("|') to check for the multiple class attributes. Sample code: String str = "test.append(\"&lt;td class='no-order' style='text-align:center;' class=\"data text\"&gt;\");"; Pattern pattern = Pattern.compile("class=(\"|')"); Matcher matcher = pattern.matcher(str); int index = 0; while (matcher.find()) { index++; } if (index &gt; 1) { System.out.println("multiple class attribute found"); } output: multiple class attribute found
type: Answer

http://stackoverflow.com/q/23328391
type: Question
has body: I'm really shy to say this problem. Because i couldn't understand how to do it. I've a text file. In this text file there is a 1 million numbers. These are between 0 to 999 and every line contains a number. I have to separate these numbers with (\n), that means every line will contains one integer number. Then i have to sort these. After sorting i will take 2 inputs from user. Then i have to find and write numbers to a new text file between these inputs in the first text file. I know most people will say "we're not fool. You don't know anything, this site is not like this." That's right, but i have to do this. I just want to know how can i do this. Which methods or strategies do i need? Because i've found similar things in here but i don't know are these true with my work.
tagged with: sorting
has answer: http://stackoverflow.com/a/23328501
accepted answer: http://stackoverflow.com/a/23328501
tagged with: arraylist
answer count: 3
upvote count: 1
possible better answer: http://stackoverflow.com/a/23328512
has title: Reading Text File (Separating, Sorting, Find the Between Numbers With ArrayList)
favorite count: 0
tagged with: text
type: AnsweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/23328512
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/23328499

layout
tags question: http://stackoverflow.com/q/23409503
tag name: layout
tags question: http://stackoverflow.com/q/23322382
type: Tag
tags question: http://stackoverflow.com/q/23317007
tags question: http://stackoverflow.com/q/23395648
tags question: http://stackoverflow.com/q/23364656
tags question: http://stackoverflow.com/q/23452165
tags question: http://stackoverflow.com/q/23376072

http://stackoverflow.com/q/23326829
has comment: http://stackoverflow.com/comment/35740969
type: Question
has comment: http://stackoverflow.com/comment/35740514
has comment: http://stackoverflow.com/comment/35748091
has comment: http://stackoverflow.com/comment/35824741
tagged with: jscrollpane
has comment: http://stackoverflow.com/comment/35774384
has comment: http://stackoverflow.com/comment/35723581
has title: Why does my Swing application freeze a long time on JScrollPane.setViewportView?
downvote count: 0
favorite count: 0
has body: I've built a somewhat absurdly large panel and want to display it. Unfortunately, when I run scrollPane.setViewportView(absurdPanel); it takes a rather absurdly long time to complete the operation. Any suggestions? I'm mostly concerned about this because I'd like the user to be able to set the panel size interactively, but also to be able to cancel the operation in the middle. The panel creation is all done reasonably properly by SwingWorkers, so the only major UI pause is on setViewportView. Simple breaking example This isn't exactly an extract of what I'm really doing, but it should get the general idea across. Note the extended pause between when it prints "foo" and when it prints "bar". import java.lang.reflect.InvocationTargetException; import javax.swing.*; @SuppressWarnings("serial") public class Broken extends JScrollPane { JPanel foo; Broken() { super(); foo = new JPanel(); foo.setLayout(new BoxLayout(foo, BoxLayout.PAGE_AXIS)); } void ruin() { for (int x = 0; x < 200000; x++) { try { SwingUtilities.invokeAndWait(new Runnable() { @Override public void run() { foo.add(new JLabel("What is this nonsense?")); } }); } catch (InvocationTargetException e) { e.printStackTrace(); } catch (InterruptedException e) { } } } public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { JFrame frame = new JFrame(); final Broken broken = new Broken(); frame.setContentPane(broken); frame.setVisible(true); new SwingWorker<Void, Void>() { @Override public Void doInBackground() { broken.ruin(); return null; } @Override public void done() { System.out.print("foo"); broken.setViewportView(broken.foo); System.out.print("bar"); } }.execute(); } }); } }
has comment: http://stackoverflow.com/comment/35723474
has comment: http://stackoverflow.com/comment/35746182
has comment: http://stackoverflow.com/comment/35733358
score: 1
answer count: 0
has comment: http://stackoverflow.com/comment/35734641
type: UnansweredQuestion
upvote count: 1
tagged with: swing
has comment: http://stackoverflow.com/comment/46492530
has comment: http://stackoverflow.com/comment/35760909
tagged with: swingworker
tagged with: java
has comment: http://stackoverflow.com/comment/35730311
tagged with: jpanel
has comment: http://stackoverflow.com/comment/35735256
has comment: http://stackoverflow.com/comment/35747834

http://stackoverflow.com/comment/35909892
type: AnswerComment
comment on: http://stackoverflow.com/a/23429220
has text: Yep i know about it, but question was about something else, which is probably impossible.
type: Comment
score: 0

http://stackoverflow.com/comment/35664148
score: 0
comment on: http://stackoverflow.com/a/23296629
type: AnswerComment
type: Comment
has text: Thx, it seeems a good solution. I downloaded the jar. But it seems cannot imported as other jar libraries? Do you know how to do this?

http://stackoverflow.com/comment/41708203
type: Comment
comment on: http://stackoverflow.com/a/23403059
type: AnswerComment
has text: I have same problem and also destroyed adviews. now it uses about 650 kb and it's rising.
score: 0

http://stackoverflow.com/a/23370166
score: 1
answers question: http://stackoverflow.com/q/23370042
has comment: http://stackoverflow.com/comment/35797242
upvote count: 1
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/35797269
has body: When you call responseLine = in.readLine(); thats a blocking call, it means that the program will not continue to the next line untill the server will send a string ending with \n (a line). that also mean that writeMessage(output); will be called only after the client gets something from the server. so if you want to make this client work as you want it, you should implement 2 threads, 1 for read from server and 1 to write to server
accepted answer of: http://stackoverflow.com/q/23370042
downvote count: 0

http://stackoverflow.com/q/23423784
has title: JPA one to one relation not added
upvote count: 1
tagged with: jpa
answer count: 1
favorite count: 0
tagged with: one-to-one
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23425145
downvote count: 0
score: 1
tagged with: java
tagged with: hibernate
tagged with: mysql
type: Question
has body: I have a two tables in database in relation one to one: CREATE TABLE IF NOT EXISTS `toproject`.`osoby` ( `id` INT NOT NULL AUTO_INCREMENT , `imie` VARCHAR(45) NOT NULL , `nazwisko` VARCHAR(45) NOT NULL , `pesel` VARCHAR(11) NOT NULL , `telefon` VARCHAR(45) NULL , `pensja` VARCHAR(45) NULL , `typ` VARCHAR(45) NOT NULL , `stanowisko_id` INT NULL , PRIMARY KEY (`id`) , UNIQUE INDEX `pesel_UNIQUE` (`pesel` ASC) , INDEX `fk_osoby_stanowiska_idx` (`stanowisko_id` ASC) , CONSTRAINT `fk_osoby_stanowiska` FOREIGN KEY (`stanowisko_id` ) REFERENCES `toproject`.`stanowiska` (`id` ) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB; CREATE TABLE IF NOT EXISTS `toproject`.`adresy` ( `id` INT NOT NULL AUTO_INCREMENT, `ulica` VARCHAR(45) NOT NULL , `miejscowosc` VARCHAR(45) NOT NULL , INDEX `fk_adres_osoby1_idx` (`id` ASC) , PRIMARY KEY (`id`) , CONSTRAINT `fk_adres_osoby1` FOREIGN KEY (`id` ) REFERENCES `toproject`.`osoby` (`id` ) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB; I must using to this @Inheritance(strategy = InheritanceType.SINGLE_TABLE) I write that Java entity class: Head class: @Entity @Table(name = "osoby") @Inheritance(strategy = InheritanceType.SINGLE_TABLE) @DiscriminatorColumn(name="typ", discriminatorType=DiscriminatorType.STRING) public class Osoba implements Serializable { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Basic(optional = false) @Column(name = "id") private Integer id; @Basic(optional = false) @NotNull @Size(min = 1, max = 45) @Column(name = "imie") private String imie; @Basic(optional = false) @NotNull @Size(min = 1, max = 45) @Column(name = "nazwisko") private String nazwisko; @Basic(optional = false) @NotNull @Size(min = 1, max = 11) @Column(name = "pesel") private String pesel; Client class: @Entity @DiscriminatorValue(value = "Klient") public class Klient extends Osoba { @Size(max = 45) @Column(name = "telefon") private String telefon; @OneToMany(cascade = CascadeType.ALL, mappedBy = "osobyId") private Collecti…

http://stackoverflow.com/a/23413159
type: Answer
downvote count: 0
score: 5
answers question: http://stackoverflow.com/q/23413131
accepted answer of: http://stackoverflow.com/q/23413131
has comment: http://stackoverflow.com/comment/35877028
type: AcceptedAnswer
has body: When I try to include the methods within the public method, I am getting an error. You cannot have nested methods in Java1. Indeed, your second snippet has the methods in an appropriate location; outside of main. 1 (Aside) Well, I guess you technically can since you can declare classes within methods, meaning you can ultimately declare a method within another method: void foo1() { class X { void foo2() { ... } } ... } You should very rarely have to do something like that, though.
upvote count: 5

http://stackoverflow.com/q/23296241
upvote count: 1
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23296642
tagged with: java-8
has comment: http://stackoverflow.com/comment/35663135
downvote count: 0
score: 1
tagged with: java
tagged with: javafx
has body: After updating to Java 8, i got problems displaying content of list view public class TestController extends AnchorPane implements Initializable { @FXML private ListView&lt;String&gt; listView; @Override public void initialize(URL url, ResourceBundle rb) { } public void setApp() { setContent(); } /** * Set content in list */ private void setContent() { ObservableList&lt;String&gt; items = FXCollections.observableArrayList(); items.add("1"); items.add("2"); listView.setItems(items); } } With Java 7 this gives me a list with values. After update to java 8, it gives me a empty frame. Thanks James_D, here is the code you asked for public void goToTest() { try { TestController test = (TestController) replaceSceneContent("/fxml/test.fxml"); test.setApp(); } catch (Exception ex) { System.out.println("Error loading: " + ex + " - " + ex.getMessage()); } } private Initializable replaceSceneContent(String fxml) throws Exception { FXMLLoader loader = new FXMLLoader(); InputStream in = MainApp.class.getResourceAsStream(fxml); loader.setBuilderFactory(new JavaFXBuilderFactory()); loader.setLocation(MainApp.class.getResource(fxml)); AnchorPane page; try { page = (AnchorPane) loader.load(in); } finally { in.close(); } Scene scene = new Scene(page); stage.setScene(scene); stage.sizeToScene(); stage.setResizable(resizable); return (Initializable) loader.getController(); }
has comment: http://stackoverflow.com/comment/35667157
type: Question
has title: Problems with list view after updating to java 8
answer count: 1
tagged with: listview
has comment: http://stackoverflow.com/comment/35663794
tagged with: javafx-8
has comment: http://stackoverflow.com/comment/35663476

http://stackoverflow.com/a/23298411
downvote count: 0
has body: Try this: .replaceAll("[^A-Za-z0-9]+"," ").toLowerCase() More: trim() deletes all whitespace characters before and after your string. It doesn't touch ones in the middle.
score: 1
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/23298386

http://stackoverflow.com/comment/35746573
type: Comment
has text: The UsernameNotFoundException has a constructor with "extraInformation" field. Just put it there and load from the exception once in your failureHandler.
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/23340390

http://stackoverflow.com/a/23381951
has body: keys is reserved table name in mysql.. please change your table name..It worked for me..
has comment: http://stackoverflow.com/comment/35818712
type: Answer
answers question: http://stackoverflow.com/q/23381825
score: 0
has comment: http://stackoverflow.com/comment/35818421

http://stackoverflow.com/a/23355515
has comment: http://stackoverflow.com/comment/35770231
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23355472
has comment: http://stackoverflow.com/comment/35770155
has body: Make your variable ext as static. static long ext = 0; This will make the variable common to all instances. Note : You need to store this value somewhere in db / file during restart and get it during application startup to make it consistent irrespective of restart of your application
has comment: http://stackoverflow.com/comment/35770323

http://stackoverflow.com/comment/35941667
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23446336
type: Comment
has text: Good!. Now if this helped you will you please accept is an answer?

http://stackoverflow.com/comment/35844365
has text: @Rogue: I really don't know what makes you think that. The difference between a Stack that drops old entries and a Map that drops old entries is in how you retrieve entries from it; and the only thing that the OP has told us about his/her desired retrieval strategy is that (s)he wants a HashMap. (Or, are you thinking that using a Stack rather than a Map would help in removing old entries? It's true that it's probably easier to implement such a Stack than such a Map, but if that's not what's needed, then who cares?)
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23395622

http://stackoverflow.com/q/23407558
possible better answer: http://stackoverflow.com/a/23407609
tagged with: arraylist
score: 0
answer count: 3
tagged with: wrapper
upvote count: 1
downvote count: 1
has answer: http://stackoverflow.com/a/23407605
accepted answer: http://stackoverflow.com/a/23407582
has title: Why is ArrayList able to remove this?
tagged with: integer
favorite count: 0
has answer: http://stackoverflow.com/a/23407582
has answer: http://stackoverflow.com/a/23407609
has comment: http://stackoverflow.com/comment/35866176
type: AnsweredQuestion
tagged with: java
has body: In Integer Wrapper classes ,whenever we compare like this Integer a=546; Integer b=546; System.out.println(a==b); it returns false,but then why when there is a collection ArrayList&lt;Integer&gt; a=new ArrayList&lt;Integer&gt;(); a.add(5); a.add(546); Integer g=546; a.remove(g); it removes it from the ArrayList??
has comment: http://stackoverflow.com/comment/35866192
type: Question
has comment: http://stackoverflow.com/comment/35866181

http://stackoverflow.com/a/23380994
has comment: http://stackoverflow.com/comment/35816880
has comment: http://stackoverflow.com/comment/35817529
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35816792
type: Answer
answers question: http://stackoverflow.com/q/23380695
has comment: http://stackoverflow.com/comment/35817732
has comment: http://stackoverflow.com/comment/35816841
accepted answer of: http://stackoverflow.com/q/23380695
has comment: http://stackoverflow.com/comment/35817776
has body: For Ex: HTML Code Change This JQuery Code: $(document).ready(function() { var count=0; function change(){ $('.change').text(count++); setTimeout(change,1000); } change(); }); Div will change in every 1000ms.
has comment: http://stackoverflow.com/comment/35816740
has comment: http://stackoverflow.com/comment/35816867

http://stackoverflow.com/comment/35845713
comment on: http://stackoverflow.com/q/23396483
score: 4
type: Comment
type: QuestionComment
has text: What is this syntax: `if {`

http://stackoverflow.com/comment/35744320
has text: Right. I guess your `run` is occurring before anything is added to the queue. You could use a `BlockingQueue`, so you can use the `take` method. But you'll still need a loop as well.
type: Comment
comment on: http://stackoverflow.com/a/23339678
score: 0
type: AnswerComment

http://stackoverflow.com/a/35421762
answers question: http://stackoverflow.com/q/23318109
downvote count: 1
score: 5
has body: When I asked this question almost 2 years ago the answer really was “officially” no, but as pointed out by ekcr1's answer you can get one of the most highly anticipated features (lambdas) to work if you use retrolamba. At the time I was still using eclipse, as Android Studio was in “preview” mode, so I never did pursue this path. Today, I think the “official” answer is still no, and while retrolamba still seems like a good way to go, there is another option for those willing to go down a somewhat “unofficial” route can take, namely Kotlin. Today Kotlin reached 1.0.0. For those not familiar with Kotlin, more info can be found at their website found here: https://kotlinlang.org or watch this utube video of a talk given by Jake Wharton https://www.youtube.com/watch?v=A2LukgT2mKc
type: Answer
upvote count: 6

http://stackoverflow.com/comment/35860155
has text: The characters used to indicate a line break differ by operating system, basically. It's very unfortunate :(
comment on: http://stackoverflow.com/q/23404352
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/35762289
type: AnswerComment
has text: Just add inside [?:!.,;]
type: Comment
comment on: http://stackoverflow.com/a/23351047
score: 0

http://stackoverflow.com/comment/35696507
comment on: http://stackoverflow.com/a/23314870
type: Comment
has text: which one is to check the web application on the glassfish server? I can only see the glassfish server.
type: AnswerComment
score: 0

http://stackoverflow.com/q/23388946
has answer: http://stackoverflow.com/a/23397989
has comment: http://stackoverflow.com/comment/35836089
tagged with: apk-expansion-files
type: Question
upvote count: 4
has comment: http://stackoverflow.com/comment/35844963
answer count: 3
downvote count: 0
score: 4
favorite count: 0
has answer: http://stackoverflow.com/a/23895411
tagged with: android
has body: I would like to load files directly from expansion OBB file by using AssetManager. I implemented my own FileHandleResolver public class CustomFileHandleResolver implements FileHandleResolver { @Override public FileHandle resolve(String fileName) { return new CustomFileHandle(fileName); } } I set it to my AssetManager. I created my own FileHandle and I override read() function @Override public InputStream read() { InputStream input = null; try { input = GameInfo.expansionFile.getInputStream(file.getPath().replace('\\', '/')); } catch (IOException e) { e.printStackTrace(); } return input; } It loads all the files like .PNG, .PACK, .FNT, except .OGG files, so I guess that all sound files won't be loaded. I'm getting this error: com.badlogic.gdx.utils.GdxRuntimeException: com.badlogic.gdx.utils.GdxRuntimeException: Couldn't load dependencies of asset: SFx/button_click.ogg And this error: com.badlogic.gdx.utils.GdxRuntimeException: java.lang.ClassCastException: com.solidgamesstudio.threedefendersn.framework.CustomFileHandle cannot be cast to com.badlogic.gdx.backends.android.AndroidFileHandle I read that zip can not be compressed. In 7zip I selected compression to "Store" so that it's not compressed at all, but still this problem occurs. I traversed what is happening when files are being loaded and I found that AssetManager calls my CustomFileHandleResolver which creates CustomFileHandle. For every file that is not .OGG it calls InputStream read(). In this function it loads the file from the zip and it's fine. But as I said when it comes to loading .OGG it doesn't call this function. So it's not even trying yet to get the file from the zip. Question is, why .OGG file doesn't call InputStream read() in CustomFileHandle()? UPDATE I traversed more and I found out that it won't call InputStream read() because it can't create a Sound from FileHandle somehow. Clue to this is CustomFileHandle cannot be cast to AndroidFileHandle While to create a sound you need to pass fileHandl…
has title: Can't load sound files LibGdx
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35834554
has answer: http://stackoverflow.com/a/34241887
tagged with: libgdx
linked to: http://stackoverflow.com/q/23342450
tagged with: java

http://stackoverflow.com/a/32767599
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/53436718
answers question: http://stackoverflow.com/q/23368039
has body: This work for me. I always use text inside " ". I use the same project: SingleSwingBrowser. "value 1" "value 2" "value 3"
has comment: http://stackoverflow.com/comment/53390728

sorting
tags question: http://stackoverflow.com/q/23291338
tags question: http://stackoverflow.com/q/23362143
tags question: http://stackoverflow.com/q/23433442
tags question: http://stackoverflow.com/q/23428625
tags question: http://stackoverflow.com/q/23451341
tags question: http://stackoverflow.com/q/23408461
tags question: http://stackoverflow.com/q/23305769
tags question: http://stackoverflow.com/q/23434076
tags question: http://stackoverflow.com/q/23353949
tags question: http://stackoverflow.com/q/23328783
tags question: http://stackoverflow.com/q/23321210
tags question: http://stackoverflow.com/q/23374473
tags question: http://stackoverflow.com/q/23443963
tags question: http://stackoverflow.com/q/23334896
tags question: http://stackoverflow.com/q/23355042
tags question: http://stackoverflow.com/q/23378170
tags question: http://stackoverflow.com/q/23377901
tags question: http://stackoverflow.com/q/23335514
tags question: http://stackoverflow.com/q/23339015
tags question: http://stackoverflow.com/q/23353965
tags question: http://stackoverflow.com/q/23437722
tags question: http://stackoverflow.com/q/23433477
tags question: http://stackoverflow.com/q/23436868
tags question: http://stackoverflow.com/q/23341775
tags question: http://stackoverflow.com/q/23340408
tags question: http://stackoverflow.com/q/23315306
tags question: http://stackoverflow.com/q/23426972
tags question: http://stackoverflow.com/q/23321481
tags question: http://stackoverflow.com/q/23328709
type: Tag
tags question: http://stackoverflow.com/q/23389401
tags question: http://stackoverflow.com/q/23416089
tags question: http://stackoverflow.com/q/23333922
tags question: http://stackoverflow.com/q/23291494
tags question: http://stackoverflow.com/q/23439570
tags question: http://stackoverflow.com/q/23418595
tags question: http://stackoverflow.com/q/23296627
tags question: http://stackoverflow.com/q/23300264
tag name: sorting
tags question: http://stackoverflow.com/q/23419374
tags question: http://stackoverflow.com/q/23440299
tags question: http://stackoverflow.com/q/23447768
tags question: http://stackoverflow.com/q/23378069
tags question: http://stackoverflow.com/q/23451240
tags question: http://stackoverflow.com/q/23328391
tags question: http://stackoverflow.com/q/23372535
tags question: http://stackoverflow.com/q/23419725

http://stackoverflow.com/comment/35780835
type: QuestionComment
comment on: http://stackoverflow.com/q/23361629
has text: Have you tried something?
score: 0
type: Comment

akka
type: Tag
tags question: http://stackoverflow.com/q/23415146
tags question: http://stackoverflow.com/q/23407969
tags question: http://stackoverflow.com/q/23442070
tag name: akka
tags question: http://stackoverflow.com/q/23331950
tags question: http://stackoverflow.com/q/23433968
tags question: http://stackoverflow.com/q/23334345
tags question: http://stackoverflow.com/q/23358957
tags question: http://stackoverflow.com/q/23365874
tags question: http://stackoverflow.com/q/23441267
tags question: http://stackoverflow.com/q/23434616
tags question: http://stackoverflow.com/q/23388361

http://stackoverflow.com/q/23441433
has answer: http://stackoverflow.com/a/23649146
answer count: 1
downvote count: 0
score: 1
tagged with: tomcat
favorite count: 0
accepted answer: http://stackoverflow.com/a/23649146
tagged with: scala
tagged with: maven
type: AnsweredQuestion
tagged with: java
upvote count: 1
type: Question
tagged with: apache-kafka
has body: I normally use scala 2.10.x. Due to some limitation of the components which i have no control over, I have to use kafka client version 0.7.2 However this version of kakfa can be compiled only with scala ver 2.9.2 and does not work with scala 2.10. note: I can't use the newer versions of kafka, its not working, i have no control over actual kafka version so i must use this client version. so i must use kafka client 0.7.2 So I had multiple options: Download sources of 0.7.2 kafka client and compile with scala 2.10 unfortunately too many changes in sources to perform. Use jarajar and update scala-library.jar to have a prefix in packaging something like scala.* -&gt; scala.29.*, Then update kafka client 0.7.2 to import classes from scala.29.* I tried that and also had problems here. This is what i'm going to do now - create another .war in my tomcat web server, as tomcat will load different wars with different classloaders, I can send my kafka requests instead of from my original war to from my war1 to war2 and war2 will be a simple web app which will hold a simple kafka client 0.7.2. My question : Does option 3 sounds wise? I have some thoughts about its overhead, if I send GET requests to localhost just because I have multiple wars to resolve having multiple classloaders issues how good/bad is that?
has title: using multiple war's to resolve multiple scala versions

http://stackoverflow.com/comment/35815445
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23380065
has text: I have tested all three words in my sentence and got correct answer

http://stackoverflow.com/q/23309219
has answer: http://stackoverflow.com/a/23309507
score: 1
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/65948639
type: Question
has comment: http://stackoverflow.com/comment/35685083
answer count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/35685040
has title: how to pass parent object as parameter to a constructor of child class
tagged with: inheritance
has body: In the below code i have a couple of questions to be asked: i am unable to pass object of class Address as a parameter to the constructor of its child class EmployeeAddress. Why so ? It is giving error like parameter mismatch ..no parameters passed.... I want to call the Address object from the class EmployeeAddress in show method. How to do that? class Address { public String street; int pin; String city; Address(String street, int pin, String city) { this.street = street; this.pin = pin; this.city = city; } } class EmployeeAddress extends Address { int empid; public String empname; Address add; EmployeeAddress (int empid, String empname, Address add){ this.empid = empid; this.empname = empname; this.add = add; } void show() { System.out.println("my name is " + empname + "and my empid is " + empid); } } class Employee { public static void main(String ar[]) { Address ad1 = new Address("mystreet", 201301, "nyk"); EmployeeAddress a1 = new EmployeeAddress(123, "kin", ad1); a1.show(); } /* * public String toString() { return * "my name is "+a1.empname+"and my pin is "+ad1.pin ; } */ }
has comment: http://stackoverflow.com/comment/65948753
favorite count: 0
tagged with: constructor
has comment: http://stackoverflow.com/comment/35685085
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23309325

http://stackoverflow.com/a/23293726
type: Answer
has body: You may try this simple example to see how a labeled loop works: public static void main(String[] args) { int i = 0; int j = 0; EXIT: for (; i &lt; 10; i++) { for (; j &lt; 10; j++) { if (i * j &gt; 50) { break EXIT; } } j = 0; } System.out.printf("Finished with i=%s and j=%s\n", i, j); } OUTPUT: Finished with i=6 and j=9
answers question: http://stackoverflow.com/q/23293288
upvote count: 1
has comment: http://stackoverflow.com/comment/35657260
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/35657023
has comment: http://stackoverflow.com/comment/35656890

http://stackoverflow.com/a/23360929
answers question: http://stackoverflow.com/q/23360664
type: Answer
score: 6
upvote count: 6
has body: String[] mystring = { "this is string one", "this is string two", "this is string three", "this is string four", "this is string five" }; int idx = new Random().nextInt(mystring.length); String random = (mystring [idx]);
downvote count: 0

http://stackoverflow.com/comment/35880339
score: 2
has text: @artlessnoise there was not meant to be a specific language but just a general knowledge of which would be better or more "enhanced"
type: AnswerComment
comment on: http://stackoverflow.com/a/23414389
type: Comment

http://stackoverflow.com/comment/35785434
has text: Still not happening, the countdown timer does not connect back up with the view when starting timer on D then going back to C then forward to D again.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/23363782
type: Comment

http://stackoverflow.com/a/23328236
score: 0
has body: When you set your OnClickListeners in your Activity MainClass like this: minionClick.setOnClickListener(this); storeClick.setOnClickListener(this); storeDismiss.setOnClickListener(this); Then you are setting the Activity as listener and not the thread. The method that will be called when a click happens is the one at the bottom of your Activity class: @Override public void onClick(View v) { } And not the one inside your Thread. I think the part that is confusing you is the following: When you do something like this: Thread thread = new Thread() { }; Then you are actually creating a whole new class - called an anonymous class - which is a subclass from Thread. So if you define a method in their then it doesn't belong to the Activity, it is actually in a completely different class. Another thing to consider is that what you are trying to do is not a good idea anyways. What you should do is start the thread in the OnClickListener and not handle the click in a separate Thread. Try something like this: @Override public void onClick(View v) { Thread thread = new Thread() { ... }; } Anyway it looks like an AsyncTask would be much better suited than a Thread in this case. And from what I can see in your code threading shouldn't even be necessary in this portion. You don't actually perform any complex tasks which would require running them in a separate Thread and as such any threading would just be counterproductive. The code most likely runs a lot better and smoother without any threading.
answers question: http://stackoverflow.com/q/23327988
type: Answer

http://stackoverflow.com/comment/92329682
has text: @user458577 Unforunately there is no guarantee finalize is called; the JVM may think that a memory-heavy object is tiny (because the memory was allocated in C++), and so not bother to free it. When wrapping C++ objects using JNI I always add an explicit destroy() method which frees the underlying resources.
type: Comment
comment on: http://stackoverflow.com/a/23328187
type: AnswerComment
score: 0

http://stackoverflow.com/q/23376639
downvote count: 0
has answer: http://stackoverflow.com/a/23376860
has comment: http://stackoverflow.com/comment/35809304
favorite count: 0
has title: Java: Produce larger random numbers
type: Question
upvote count: 2
accepted answer: http://stackoverflow.com/a/23376860
has comment: http://stackoverflow.com/comment/35809577
answer count: 2
has comment: http://stackoverflow.com/comment/35809325
has comment: http://stackoverflow.com/comment/35809802
has comment: http://stackoverflow.com/comment/35841505
possible better answer: http://stackoverflow.com/a/23376817
has comment: http://stackoverflow.com/comment/35809305
has comment: http://stackoverflow.com/comment/35809681
has comment: http://stackoverflow.com/comment/35809839
has body: I created a simple prime factorization program in java for the fun of it. Right now I am using the Random class and nextLong() method to assign "temp" a random number ranging in the quintillions and factors it amazingly quickly. What data type or algorithm or method should I use to obtain significantly larger values? import java.util.Random; import javax.swing.JOptionPane; public class factor { public static void main(String[] args) { Random gen = new Random(); String factors = ""; long temp = 0; String hello = JOptionPane.showInputDialog("Type a random number(Must be smaller than 4,611,686,018,427,387,904), or type 1 for a random large number."); temp = Long.parseLong(hello); if(temp &lt; 2) temp = Math.abs(gen.nextLong()); long temp2 = temp; System.out.println(" The factors of \n\n " + temp2 + " are:"); System.out.println(""); while(temp != 1){ //System.out.print(temp); for(long ii = 2; ii &lt;= (Math.ceil(Math.sqrt(temp))); ii++){ // if(ii%12345 == 0) // System.out.println(temp + " " + ii + " " + factors); if(temp%ii == 0){ factors = factors + " " + ii; // System.out.println(temp + " " + ii + " " + factors); temp = temp/ii; ii = temp + 1; }else{ if(ii == Math.ceil(Math.sqrt(temp))){ factors = factors + " " + temp; System.out.println(factors); temp = 1; ii = temp + 1; }} } }}}
has answer: http://stackoverflow.com/a/23376817
tagged with: factorization
has comment: http://stackoverflow.com/comment/35809826
has comment: http://stackoverflow.com/comment/35809412
tagged with: java
has comment: http://stackoverflow.com/comment/35809433
has comment: http://stackoverflow.com/comment/35809810
has comment: http://stackoverflow.com/comment/35809773
has comment: http://stackoverflow.com/comment/35809284
has comment: http://stackoverflow.com/comment/35809660
tagged with: long-integer
has comment: http://stackoverflow.com/comment/35809611
tagged with: int
tagged with: random
type: AnsweredQuestion
score: 2
has comment: http://stackoverflow.com/comment/35809704
has comment: http://stackoverflow.com/comment/35809502
has comment: http://stackoverflow.com/comment/35809550

http://stackoverflow.com/comment/35726535
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23331594
score: 0
has text: Edited again because I left some bits, in trying to test to see if it was something wrong with the sizes of Arrays or whatever.

http://stackoverflow.com/a/23413578
downvote count: 0
answers question: http://stackoverflow.com/q/23413493
upvote count: 3
has body: Most likely it's because you're fetching the value of a.length each iteration in the first case, as opposite to once in the second case. try doing something like int len = a.length; and using len as the termination border for the loop. this could potentially reduce the time of the first loop.
type: Answer
score: 3

http://stackoverflow.com/comment/35690354
has text: Yeah, I appreciate that. Maybe I should go for a Streaming hash function, but as the ByteSource is almost always wrapping a byte array it doesn't matter so much.
comment on: http://stackoverflow.com/a/23298351
score: 0
type: AnswerComment
type: Comment

bukkit
tag name: bukkit
tags question: http://stackoverflow.com/q/23324016
tags question: http://stackoverflow.com/q/23357584
tags question: http://stackoverflow.com/q/23302651
type: Tag
tags question: http://stackoverflow.com/q/23372989
tags question: http://stackoverflow.com/q/23317405

http://stackoverflow.com/comment/35899743
comment on: http://stackoverflow.com/a/23425238
score: 0
type: Comment
has text: Files all lower case :( I have edited the post above with something that might be related. last two paragraphs
type: AnswerComment

http://stackoverflow.com/comment/35886715
has text: See Pattterns in http://docs.oracle.com/javase/7/docs/api/java/text/DecimalFormat.html
type: Comment
comment on: http://stackoverflow.com/a/23418173
score: 0
type: AnswerComment

http://stackoverflow.com/comment/35889062
score: 0
type: Comment
type: QuestionComment
has text: @James_D I have jar file in my Netbeans Project but still when I put the code mentioned below by you below generates lot of errors in my code.
comment on: http://stackoverflow.com/q/23418555

http://stackoverflow.com/comment/35787626
comment on: http://stackoverflow.com/a/23354437
type: AnswerComment
has text: turns out you can prefix settings for the native JPA provider and keep them in the application.properties, i missed this in the spring boot docs. so in my case I added: spring.jpa.properties.hibernate.generate_statistics=true to my application.properties file and things also worked. I prefer this to a hibernate.properties file since I can override with application-{profile}.properties for dev/test/prod settings. thanks again for the kick, it helped.
type: Comment
score: 8

http://stackoverflow.com/a/23417783
upvote count: 1
answers question: http://stackoverflow.com/q/23417663
has body: Edit: Turns out there's a method in String that makes this much easier than regex: String.startsWith(String prefix) http://docs.oracle.com/javase/7/docs/api/java/lang/String.html#startsWith(java.lang.String) Regex is useful, but overkill for something like this. My bad for overthinking this at first... (old answer below) Sounds like a job for regex! http://docs.oracle.com/javase/7/docs/api/java/util/regex/package-summary.html String.matches() would help too. Basically, you'll want to create regexes that match the first sections of your file names and then anything else following those. In the example in your question, example regexes would be "abc." for abc______ and "nmn." for nmn_____. These probably aren't 100% correct syntax, but that's the general idea. The rules in the link (look at the Pattern class) would give you pretty much all you need. What you'd do is create two new Sets, one for each prefix. Then loop through the original set, and based on the regex put the file name into one set or the other.
has comment: http://stackoverflow.com/comment/35886466
has comment: http://stackoverflow.com/comment/35889080
downvote count: 0
has comment: http://stackoverflow.com/comment/35888536
has comment: http://stackoverflow.com/comment/35888582
type: Answer
has comment: http://stackoverflow.com/comment/35886448
has comment: http://stackoverflow.com/comment/35888384
score: 1

http://stackoverflow.com/a/23412399
downvote count: 1
type: Answer
has body: I suggest you to first try to understand Java 8 in the whole picture, most importantly in your case it will be streams, lambdas and method references. You should never convert existing code to Java 8 code on a line-by-line basis, you should extract features and convert those. What I identified in your first case is the following: You want to add elements of an input structure to an output list if they match some predicate. Let's see how we do that, we can do it with the following: List&lt;Player&gt; playersOfTeam = players.stream() .filter(player -&gt; player.getTeam().equals(teamName)) .collect(Collectors.toList()); What you do here is: Turn your input structure into a stream (I am assuming here that it is of type Collection&lt;Player&gt;, now you have a Stream&lt;Player&gt;. Filter out all unwanted elements with a Predicate&lt;Player&gt;, mapping every player to the boolean true if it is wished to be kept. Collect the resulting elements in a list, via a Collector, here we can use one of the standard library collectors, which is Collectors.toList(). This also incorporates two other points: Code against interfaces, so code against List&lt;E&gt; over ArrayList&lt;E&gt;. Use diamond inference for the type parameter in new ArrayList&lt;&gt;(), you are using Java 8 after all. Now onto your second point: You again want to convert something of legacy Java to Java 8 without looking at the bigger picture. This part has already been answered by @IanRoberts, though I think that you need to do players.stream().filter(...)... over what he suggested.
score: 20
answers question: http://stackoverflow.com/q/23407014
upvote count: 21

http://stackoverflow.com/q/23322585
upvote count: 1
type: Question
has title: Java -parsing json into dynamic objects
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/35717803
has comment: http://stackoverflow.com/comment/35717726
downvote count: 0
has body: I have a in-house api (that I can't edit) that parses json into a POJO. The function looks like parse(String jsonString, Class jsonObj) My problem is the the json string is dynamic. I don't always expect the same json object, so I want to avoid some ugly way of figuring out which json it is and pass in the correct class. It would be nice to skip creating a bunch of classes to pass in. How do I achieve this? I was thinking maybe reflection but not sure yet.
favorite count: 0
has comment: http://stackoverflow.com/comment/35709962
has comment: http://stackoverflow.com/comment/35709386
tagged with: parsing
linked to: http://stackoverflow.com/q/11792286
tagged with: reflection
tagged with: dynamic
answer count: 0
has comment: http://stackoverflow.com/comment/35709849
type: UnansweredQuestion

http://stackoverflow.com/comment/35873665
type: QuestionComment
has text: get is JTexTfield,status is JButton orders is textArea , I want that when I type something in JTextField it must 'copied' in JTextArea
comment on: http://stackoverflow.com/q/23410381
score: 0
type: Comment

http://stackoverflow.com/q/23448925
upvote count: 23
has comment: http://stackoverflow.com/comment/35947742
type: AnsweredQuestion
tagged with: java
score: 23
has title: Using Butter Knife in Custom BaseAdapter SubClass Results in "Unable to inject views" error
type: Question
accepted answer: http://stackoverflow.com/a/24274716
possible better answer: http://stackoverflow.com/a/27116318
has answer: http://stackoverflow.com/a/26181217
has answer: http://stackoverflow.com/a/27116318
has answer: http://stackoverflow.com/a/37673260
downvote count: 0
tagged with: baseadapter
favorite count: 0
has answer: http://stackoverflow.com/a/38376693
tagged with: butterknife
answer count: 5
tagged with: android
tagged with: annotations
has body: I'm attempting to use Butter Knife to simplify creation of a custom BaseAdapter class. I'm following the example here: http://jakewharton.github.io/butterknife/ under the "Another use is simplifying the view holder pattern inside of a list adapter." section. Unfortunately, I am getting an "Unable to inject views" error each time the ViewHolder is created for each item in the list. Here is my code: public class ButterknifeCustomBaseAdapter extends BaseAdapter{ @Override public int getCount() { return arrayListNames.size(); } @Override public Name getItem(int iPosition) { return arrayListNames.get(iPosition); } @Override public long getItemId(int iID) { return 0; } LayoutInflater inflater; ArrayList&lt;Name&gt; arrayListNames = new ArrayList&lt;Name&gt;(); static Context context; Activity activity; public ButterknifeCustomBaseAdapter(Context context, ArrayList&lt;Name&gt; names, Activity activity) { arrayListNames = names; this.context = context; inflater = LayoutInflater.from(this.context); } static class ViewHolder implements View.OnClickListener { @InjectView(R.id.textViewFullName) TextView textViewFullName; @InjectView(R.id.imageButtonDeleteName) TextView imageButtonDeleteName; @OnClick(R.id.imageButtonDeleteName) public void onClick(View view) { ((NameActivity)context).DeleteUser((Name)view.getTag()); } public ViewHolder(View view) { ButterKnife.inject(this, view); } } @Override public View getView(int position, View convertView, ViewGroup parent) { ViewHolder viewHolder; if (convertView != null) { viewHolder = (ViewHolder) convertView.getTag(); } else { convertView = inflater.inflate(R.layout.item_name, parent, false); viewHolder = new ViewHolder(convertView); convertView.setTag(viewHolder); } viewHolder.textViewFullName.setText(((Name)getItem(position)).GetFullName()); L.l("ArrayAdapterName", ((Name)getItem(position)).GetID() + " inserted in list | position = " + position); viewHolder.imageButtonDeleteName.setTag((Name)getItem(position)); return convertView; } …
has answer: http://stackoverflow.com/a/24274716

http://stackoverflow.com/comment/35683217
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23308224
type: QuestionComment
has text: Even if you do that every two seconds does not imply that there is always a connection as http is a connectionless protocol. The connection is closed after every request. So explain better what you need.

binary-tree
tag name: binary-tree
tags question: http://stackoverflow.com/q/23423695
type: Tag
tags question: http://stackoverflow.com/q/23396487
tags question: http://stackoverflow.com/q/23302906
tags question: http://stackoverflow.com/q/23321508
tags question: http://stackoverflow.com/q/23378665
tags question: http://stackoverflow.com/q/23401337
tags question: http://stackoverflow.com/q/23431511
tags question: http://stackoverflow.com/q/23420693

http://stackoverflow.com/comment/35823202
type: AnswerComment
has text: Yes, am using same instance of client for entire application. Are you able to elaborate on the "it's better to close the node instead of having other nodes getting that information as an exception". Better why ?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23383913

http://stackoverflow.com/q/23339410
has answer: http://stackoverflow.com/a/23373240
has comment: http://stackoverflow.com/comment/35740039
has comment: http://stackoverflow.com/comment/35740404
upvote count: 1
has comment: http://stackoverflow.com/comment/35740719
type: AnsweredQuestion
score: 1
tagged with: java
linked to: http://stackoverflow.com/q/21065998
type: Question
accepted answer: http://stackoverflow.com/a/23373240
has body: I have several function in different "namespaces" (packages, classes or so) i.e.: com.example.class1.foo1() com.example.class1.foo2(string); com.example.class1.foo3(); com.example.sth.class1.foo1(); com.example.sth.class2.foo1(); After obfuscation, with my current settings, I'm getting sth like: com.example.a.a() com.example.a.a(string) com.example.a.b() com.example.sth.a.a() com.example.sth.b.a() It is all good except one thing: two a methods in com.example.a. Is there any way to tell proguard to give different names to different function inside one class?
has title: Function names in one class after obfuscation
downvote count: 0
has comment: http://stackoverflow.com/comment/35750365
has comment: http://stackoverflow.com/comment/35739896
has comment: http://stackoverflow.com/comment/35796775
has comment: http://stackoverflow.com/comment/35779631
tagged with: android
answer count: 1
favorite count: 0
tagged with: proguard
has comment: http://stackoverflow.com/comment/35739914
has comment: http://stackoverflow.com/comment/35740449

http://stackoverflow.com/comment/35683608
type: Comment
has text: the result of khWert 7 and ph 7 is here 7.450000, the correct result, however, is 19
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23308429

http://stackoverflow.com/comment/35867908
has text: True, but I was thinking about the annotation in the third class in the hierarchy. If you leave that annotation only, and remove the second one, the code compiles, but the annotation processor will STILL complain about an error.
type: Comment
comment on: http://stackoverflow.com/a/23407967
score: 0
type: AnswerComment

http://stackoverflow.com/comment/35876530
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/23411808
type: Comment
has text: Correct, I don't need `CascadeType.ALL`, will change it.

http://stackoverflow.com/a/23351528
has body: Simply change this line: factBox.setText(fact); to that: factBox.setText(factArray[fact]); because this: int fact = rnd.nextInt(factArray.length); is an index you get, not an array value
answers question: http://stackoverflow.com/q/23351448
has comment: http://stackoverflow.com/comment/35772449
downvote count: 0
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/35772798
upvote count: 2

http://stackoverflow.com/comment/35762690
comment on: http://stackoverflow.com/a/23350326
score: 0
type: AnswerComment
has text: nextInt and nextFloat don't consume the trailing newlines. Calling nextLine after nextFloat gave the empty string.
type: Comment

http://stackoverflow.com/q/23333621
possible better answer: http://stackoverflow.com/a/23333901
type: Question
has answer: http://stackoverflow.com/a/23333901
has comment: http://stackoverflow.com/comment/35730097
answer count: 3
downvote count: 0
has answer: http://stackoverflow.com/a/23333740
tagged with: initialization
has answer: http://stackoverflow.com/a/23333713
favorite count: 0
tagged with: constructor
has body: This question is more about having a proper Java program construction. I was wondering: What happens to the public Clazz { this.someClazz = new SomeClazz(); } //initialization Clazz x = y; Is the above constructor gets executed, or is it skipped, and someClazz memberget a new value right away?
upvote count: 1
type: AnsweredQuestion
score: 1
has title: Java: What happens to the supposed-to-be initialized members when passing a value to their object at creation time?
tagged with: java
accepted answer: http://stackoverflow.com/a/23333713

http://stackoverflow.com/comment/35859596
has text: stop all schema generation, only run off your scripts. so change your SMPsecurity-context.xml `<entry key="hibernate.generateDdl" value="${SMPsecurity.hibernate.ddl-generation:false}" />` . If you are generating your schema in SMPsecurity-context.xml then you will be overriding what you initially put there. What happened when you tried to run your unit tests
comment on: http://stackoverflow.com/a/23400585
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/35765023
comment on: http://stackoverflow.com/q/23334049
type: Comment
type: QuestionComment
has text: Using JSP includes for this is a bad idea. Use Ajax calls.
score: 0

http://stackoverflow.com/q/23387697
score: -5
tagged with: arrays
has comment: http://stackoverflow.com/comment/35828955
favorite count: 0
has title: How to store in array of 60 position string and int
type: UnansweredQuestion
tagged with: java
has body: I want to make a library system which it has a menu as: 1.) Add new Book 2.) Edit a book 3.) Search a book from the ISBN 4.) Show all the books 5.) Delete a book from the ISBN 6.) Exit For saving the books I have to use an array of 60 holds. The book will have: 1)Isbn (string) 2)Name (string) 3)author(string) 4)Number of books (int) So far I have done this .. //This goes above your class declaration, this is importing the Scanner class. import java.lang.reflect.Array; import java.lang.Object.*; import java.util.Scanner; import java.util.Arrays; public class BookLibrary { public static void main (String[] args) { // allocates memory for 60 slots String[] book_array; //Program keeps running till this condition updates. Only updates //if the user "chooses" quit option. boolean keepRunning = true; //User choice from the menu is stored here. int userChoice = 0; Scanner keyboard = new Scanner(System.in); while (true) { //your code here System.out.println(""); System.out.println(""); System.out.println("Choose:"); System.out.println("1:Add a new Book"); System.out.println("2:Edit Book Infos"); System.out.println("3:Search a Book (From ISBN)"); System.out.println("4:Show all the Books"); System.out.println("5:Delete a Book (From ISBN)"); System.out.println("6:Exit"); int choose = keyboard.nextInt(); if (choose == 1) { System.out.println("You Choose to Add a New Book1 "); String zero = keyboard.nextLine(); System.out.println("Book Name:"); String book = keyboard.nextLine(); System.out.println("Author:"); String author = keyboard.nextLine(); System.out.println("ISBN:"); String isbn = keyboard.nextLine(); System.out.println("# of Books:"); int numbooks = keyboard.nextInt(); System.out.println(""); System.out.println(""); String bookinfo = book + " ," + author + " ," + isbn; //String[] splits = bookinfo.split(","); System.out.println(bookinfo); System.out.println("Name of Book | " + "Author | " + "ISBN"); // System.out.println(splits[0] +" | "+ splits[1] +" | "+ splits[2]); } e…
has answer: http://stackoverflow.com/a/23387768
downvote count: 5
type: Question
has answer: http://stackoverflow.com/a/23387923
answer count: 2
upvote count: 0

jtextarea
tags question: http://stackoverflow.com/q/23415890
type: Tag
tags question: http://stackoverflow.com/q/23313237
tags question: http://stackoverflow.com/q/23429554
tag name: jtextarea
tags question: http://stackoverflow.com/q/23391647
tags question: http://stackoverflow.com/q/23379940
tags question: http://stackoverflow.com/q/23365847
tags question: http://stackoverflow.com/q/23432549
tags question: http://stackoverflow.com/q/23412873
tags question: http://stackoverflow.com/q/23410381
tags question: http://stackoverflow.com/q/23296820

http://stackoverflow.com/q/23432705
has body: I looked at some of the source code in Netty 4.0 and I noticed that AbstractChannel's localAddress and remoteAddress are volatile, and not final. Are these addresses guaranteed to be set and available when channelActive is triggered? And, more importantly, what do localAddress() and remoteAddress() return when/after channelInactive is triggered? Do channels keep the addresses, even after the connection is closed? I'm working with the NIO channels, and mostly on Windows, if it makes any difference.
type: AnsweredQuestion
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/23435628
has title: Channel addresses after closing connection in Netty 4.0
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/23435628
tagged with: netty

http://stackoverflow.com/a/23416385
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/23416355
has body: If you supply no arguments when you run the program, then args has length zero and there is no args[0] element. Before checking the first arg, you should test whether args.length &gt; 0. For example: public static void main ( String[] args ) { if (args.length == 1) { if ( args[0].equals( "-en" )) { System.out.println( "English Option" ) ; } else if ( args[0].equals( "-es" )) { System.out.println( "Spanish Option") ; } else System.out.println( "Unrecognized option" ) ; } else { // zero or more than one option System.out.println( "Usage: java Option [-en | -es]" ) ; } }
score: 1
upvote count: 1

http://stackoverflow.com/q/23399076
has comment: http://stackoverflow.com/comment/35850715
tagged with: java
has comment: http://stackoverflow.com/comment/35850694
has body: I have a properties file in the WEB-INF with some properties that need to be used by my servlet (properties like a database password,...). What's the best way to load this file? Should I Override the init method of the servlet so that I only load the file once? Thanks
tagged with: servlets
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/35850728
has comment: http://stackoverflow.com/comment/35850665
has answer: http://stackoverflow.com/a/23399274
accepted answer: http://stackoverflow.com/a/23399274
type: AnsweredQuestion
type: Question
tagged with: jakarta-ee
has comment: http://stackoverflow.com/comment/35850564
has title: Load a properties file in a servlet

http://stackoverflow.com/comment/35946513
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23450043
has text: I got it. The class works in a normal java project but not in a Plugin Project, but I've launched this code as a Java Application. I'm sorry for omitting this detail. There is solution?
score: 0

http://stackoverflow.com/comment/35827925
has text: Thanks for Reply .. i understand that but problems is that .. after display fragment i want to tart another fragment activity from this ..
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/23336156
type: Comment

http://stackoverflow.com/q/23311417
accepted answer: http://stackoverflow.com/a/23311529
has body: Can you help me? Why does this not work? And how can I make it work! Thank you :) The app just always shows "Im turned off!". protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ToggleButton b = (ToggleButton)findViewById(R.id.Button); TextView t = (TextView)findViewById(R.id.Field); if (b.isChecked() == false){ t.setText("I'm turned off!"); } if (b.isChecked()==true) t.setText("I'm turned on!"); }
tagged with: android
answer count: 4
has answer: http://stackoverflow.com/a/23311493
tagged with: java
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23311529
has answer: http://stackoverflow.com/a/23311457
score: 0
has answer: http://stackoverflow.com/a/23311504
has title: ToggleButton -> Change TextView
possible better answer: http://stackoverflow.com/a/23311457

http://stackoverflow.com/comment/35801341
comment on: http://stackoverflow.com/q/23346057
score: 0
type: Comment
type: QuestionComment
has text: Sorry didn't make it clear that I use "return". I updated the question.

http://stackoverflow.com/comment/35797366
type: Comment
has text: @gubble in this case, applying the result in that answer would give 1, while OP needs to execute a `COUNT` function on database.
score: 1
comment on: http://stackoverflow.com/q/23370243
type: QuestionComment

http://stackoverflow.com/a/23298703
upvote count: 1
has comment: http://stackoverflow.com/comment/35666869
has comment: http://stackoverflow.com/comment/35666978
answers question: http://stackoverflow.com/q/23298572
has comment: http://stackoverflow.com/comment/35666819
accepted answer of: http://stackoverflow.com/q/23298572
type: AcceptedAnswer
downvote count: 0
has body: import groovy.transform.EqualsAndHashCode @EqualsAndHashCode(includes='id') class Employee { int id String name } You can remove constructors as well if @Canonical AST is used. Canonical also provides @EqualsAndHashCode, but to add the includes it has to be used separately again. UPDATE If the class is not modifiable and you have a list/hasSet then you can use unique with a closure to perform the uniqueness. Assuming the SolrDocument mentioned in comment is referred as Employee and you have the above HashSet with duplicate ids, then below should work: empSet.unique { it.id } //this mutates the original list empSet.unique( false ) { it.id } //this does not mutate the original list
type: Answer
has comment: http://stackoverflow.com/comment/35666713
score: 1

http://stackoverflow.com/a/23330635
accepted answer of: http://stackoverflow.com/q/23330200
answers question: http://stackoverflow.com/q/23330200
has comment: http://stackoverflow.com/comment/35725021
has comment: http://stackoverflow.com/comment/35725402
upvote count: 2
has comment: http://stackoverflow.com/comment/35725064
has comment: http://stackoverflow.com/comment/35724985
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/35731340
has comment: http://stackoverflow.com/comment/35725251
has comment: http://stackoverflow.com/comment/35725187
has comment: http://stackoverflow.com/comment/35725166
type: Answer
has comment: http://stackoverflow.com/comment/35725112
score: 2
has body: KeyStore.TrustedCertificateEntry was introduced in 1.5. You must be using an earlier Java, or maybe you have your own class called KeyStore. In any case the code is nonsense. It should be KeyStore.getInstance(KeyStore.getDefaultType()), or a String argument naming an explicit keystore type.

http://stackoverflow.com/a/23322127
has body: I think your array should not be simply an array of String. Inseted you can create an class that contains tow variable name of type String and time of type Integer. after that you can create an array of objects of the class you created. Then you can sort you list based on the time in second. the class will be some how like the following: (NOTE: the coded is not tested) public class SomeClassName { private String name; private Integer time; // Constructors public SomeClassName() { super(); } public SomeClassName(String name, Integer time) { this.name=name; this.time=time; } // create setter and getter methods public void setName(String name) { this.name=name } public void setTime(Integer time) { this.time=time } public String getName() { return name; } public Integer getTime() { return time; } } then you can create an array of that class as follow: ArrayList&lt;SomeClassName&gt; list = new ArrayList&lt;SomeClassName&gt;(); list.add( new SomeClassName("PersonOne" ,1234) ); list.add( new SomeClassName("PersonTwo",5678) ); to sort an ArrayList of objects based on some attribute you nee to use custom compactor. check this link: Sort ArrayList of custom Objects by property
type: Answer
score: 0
answers question: http://stackoverflow.com/q/23321892

http://stackoverflow.com/q/23399865
possible better answer: http://stackoverflow.com/a/23399955
favorite count: 0
answer count: 5
has answer: http://stackoverflow.com/a/28289907
tagged with: utf-8
has comment: http://stackoverflow.com/comment/56196013
has answer: http://stackoverflow.com/a/26491769
accepted answer: http://stackoverflow.com/a/23399926
has title: Java, Ant error: unmappable character for encoding Cp1252
has answer: http://stackoverflow.com/a/54049571
score: 23
has comment: http://stackoverflow.com/comment/79010141
downvote count: 1
upvote count: 24
linked to: http://stackoverflow.com/q/4211825
type: AnsweredQuestion
tagged with: ant
tagged with: java
tagged with: cp1252
has body: I am using Java, Eclipse and Ant in my project. I had some Java code that I needed to edit and add some UTF-8 chars in them. Previously my build.xml had: And it worked fine. Now after adding those UTF-8 chars when I try to run, it throws "error: unmappable character for encoding Cp1252" Could anyone please tell me what is the fix? I tried changing the encoding to UTF-8 and Cp1252 in the xml but with no luck. I'm using JRE7, Eclipse Kepler and Ant 4.11.
has answer: http://stackoverflow.com/a/23399955
type: Question
has answer: http://stackoverflow.com/a/23399926
tagged with: encoding

http://stackoverflow.com/q/23292930
has body: In JBoss 5 you were able to use : @Service(objectName = "my.app.name:service=NameThatILike") @Management(ServiceManagement.class) to name the JMX MBean in the way I like How to do the same in JBoss AS7 / EAP 6?
tagged with: jmx
type: UnansweredQuestion
has title: How to specify MBean name in JBoss EAP 6 / JBoss AS 7
tagged with: java
tagged with: jboss
type: Question
score: 0
answer count: 1
tagged with: jboss7.x
has answer: http://stackoverflow.com/a/24014761

http://stackoverflow.com/comment/35802341
has text: @Elliott Frisch-Your comment has helped me a bit,one good reference can be attributed to http://faruk.akgul.org/blog/javas-missing-algorithm-biginteger-sqrt/
type: Comment
comment on: http://stackoverflow.com/q/23372573
score: 0
type: QuestionComment

http://stackoverflow.com/a/23303002
answers question: http://stackoverflow.com/q/23302851
type: Answer
has body: To read from a buffered reader do something like this BufferedReader reader = new BufferedReader(new InputStreamReader(socket.getInputStream())); StringBuilder sb = new StringBuilder(); String line = reader.readLine(); while (line != null) { sb.append(line); line = reader.readLine(); } return sb.toString();
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/35759816
has comment: http://stackoverflow.com/comment/35674881
upvote count: 1

http://stackoverflow.com/q/23400395
answer count: 3
has answer: http://stackoverflow.com/a/23400448
tagged with: arrays
has comment: http://stackoverflow.com/comment/35853059
tagged with: method-call
favorite count: 0
has comment: http://stackoverflow.com/comment/35853038
has answer: http://stackoverflow.com/a/23400565
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23400448
has body: i need to do a bubble sort with 2 different set of datas. currently i have entered the bubble sort method twice so it can run with both set of data. is there a way to use a call method to the bubble sort. int intJ1R1 = Integer.parseInt(txtJ1R1.getText()); int intJ2R1 = Integer.parseInt(txtJ2R1.getText()); int intJ3R1 = Integer.parseInt(txtJ3R1.getText()); int intJ4R1 = Integer.parseInt(txtJ4R1.getText()); int intJ5R1 = Integer.parseInt(txtJ5R1.getText()); int intJ6R1 = Integer.parseInt(txtJ6R1.getText()); double[] r1Array = {intJ1R1, intJ2R1, intJ3R1, intJ4R1, intJ5R1, intJ6R1}; double temp; for (int i=0; i&lt;r1Array.length; i++) { for (int j = 1; j &lt;(r1Array.length-i); j++) { if (r1Array[j-1]&gt;=r1Array[j]) { temp=r1Array[j-1]; r1Array[j-1] = r1Array[j]; r1Array[j] = temp; } } } double totalR1 = (r1Array[1] + r1Array[2] + r1Array[3] + r1Array[4])/4; String stringTotalR1 = Double.toString(totalR1); lblTotalRun1.setText(stringTotalR1); int intJ1R2 = Integer.parseInt(txtJ1R2.getText()); int intJ2R2 = Integer.parseInt(txtJ2R2.getText()); int intJ3R2 = Integer.parseInt(txtJ3R2.getText()); int intJ4R2 = Integer.parseInt(txtJ4R2.getText()); int intJ5R2 = Integer.parseInt(txtJ5R2.getText()); int intJ6R2 = Integer.parseInt(txtJ6R2.getText()); double[] r2Array = {intJ1R2, intJ2R2, intJ3R2, intJ4R2, intJ5R2, intJ6R2}; for (int i=0; i&lt;r2Array.length; i++) { for (int j = 1; j &lt;(r2Array.length-i); j++) { if (r2Array[j-1]&gt;=r2Array[j]) { temp=r2Array[j-1]; r2Array[j-1] = r2Array[j]; r2Array[j] = temp; } } } double totalR2 = (r2Array[1] + r2Array[2] + r2Array[3] + r2Array[4])/4; String stringTotalR2 = Double.toString(totalR2); lblTotalRun2.setText(stringTotalR2);
has title: how to call a bubble sort in java
tagged with: java
upvote count: 1
possible better answer: http://stackoverflow.com/a/23400434
type: Question
has answer: http://stackoverflow.com/a/23400434
has comment: http://stackoverflow.com/comment/35853009
tagged with: bubble-sort
score: -3
downvote count: 4

http://stackoverflow.com/a/23414546
type: AcceptedAnswer
downvote count: 0
has body: It does not match with the overridden methods. One way is to have below modifications: //Dynamic Class def setImports(Class importClass) { this.imports &lt;&lt; "$importClass.name" } and then while building builder.newClass{ loader this.class.classLoader name 'MyClass' [Calendar, UUID, Random].each { imports it } fields 'field1' : Integer, 'field2' : Integer methods 'sum' : {return field1 + field2}, 'product' : {return field1 * field2}, 'testCalendar' : {return Calendar.getInstance().getTime()}, 'testRandom' : {return (new Random()).nextInt()} }
type: Answer
has comment: http://stackoverflow.com/comment/35893498
upvote count: 1
score: 1
accepted answer of: http://stackoverflow.com/q/23412992
answers question: http://stackoverflow.com/q/23412992

http://stackoverflow.com/q/23448970
has comment: http://stackoverflow.com/comment/35943725
score: 0
has comment: http://stackoverflow.com/comment/35943758
has answer: http://stackoverflow.com/a/23449116
has answer: http://stackoverflow.com/a/23449111
answer count: 4
has comment: http://stackoverflow.com/comment/35943726
tagged with: ojdbc
type: UnansweredQuestion
tagged with: multithreading
has body: I got an issue with a multi-threaded program. I need to simulate a lot of people trying to book the same flight at the same time, using no locks. So I made an ExecutorService and used that to pool threads so I can have many simultaneous attempt going at once. The problem is though, the program sort of reaches the end and right before it prints out all the results, it just sits there and runs forever. I've tried to go into all the other classes that utilize a connection to a database and simply close them off manually. No luck. package dbassignment4; import java.util.ArrayList; import java.util.List; import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutorService; import java.util.concurrent.Future; import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.RejectedExecutionException; import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; /** * * @author Vipar */ public class Master{ private static final int POOL_SIZE = 50; public static boolean planeIsBooked = false; /** * @param args the command line arguments */ public static void main(String[] args) { int success = 0; int seatNotReserved = 0; int seatNotReservedByCustomerID = 0; int reservationTimeout = 0; int seatIsOccupied = 0; int misc = 0; HelperClass.clearAllBookings("CR9"); Thread t = new Thread(new DBMonitor("CR9")); long start = System.nanoTime(); //HelperClass.clearAllBookings("CR9"); ExecutorService pool = new ThreadPoolExecutor( POOL_SIZE, POOL_SIZE, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue&lt;Runnable&gt;(POOL_SIZE)); int threadsStarted = 0; List&lt;Future&lt;Integer&gt;&gt; results = new ArrayList&lt;&gt;(); long id = 1; t.start(); while(planeIsBooked == false) { try { Future&lt;Integer&gt; submit = pool.submit(new UserThread(id)); results.add(submit); } catch (RejectedExecutionException ex) { misc++; continue; } threadsStarted++; id++; } pool.shutdownNow(); int count = 0; for(Future&lt;Integer&gt; i : results) { t…
linked to: http://stackoverflow.com/q/8432327
has answer: http://stackoverflow.com/a/23449076
has comment: http://stackoverflow.com/comment/35943755
tagged with: java
has title: Program never ends but Thread Pool claims to shut down
type: Question
has answer: http://stackoverflow.com/a/23449380
has comment: http://stackoverflow.com/comment/35943791

http://stackoverflow.com/a/23327755
type: Answer
has body: This stands out: h = h * (3 / 2); You're doing integer division here, so you're always multiplying by 1, effectively. Change that to use floating-point values instead. h = h * (3.0 / 2); Alternatively, be explicit about what you're multiplying by - you know it's always time and a half, so I see no reason not to do this: h = h * 1.5;
answers question: http://stackoverflow.com/q/23312927
score: 0

http://stackoverflow.com/a/23418061
upvote count: 1
answers question: http://stackoverflow.com/q/23417749
type: Answer
downvote count: 0
score: 1
has body: DISPOSE_ON_CLOSE or System.exit(0); You can also just set the visibility on the click of x set it to false so it looks like it closed. Then when the application is done the x will close both

http://stackoverflow.com/comment/35729640
score: 0
has text: He's talking about setting up an index with a GUID to Node mapping so you can get to a Node without search. Problem is, you would have to change your integer ids to match his scheme or you'll still have to iterate through the nodes. I have an example of a recursive depth first search implemented above.
type: Comment
comment on: http://stackoverflow.com/a/23333170
type: AnswerComment

http://stackoverflow.com/q/23300403
tagged with: annotations
type: Question
upvote count: 9
has title: Getting Element Annotation from an AnnotationMirror
has body: Is there an better way to get an Element Annotation from an AnnotationMirror than this? This seems really hacky to me. for (AnnotationMirror annotationMirror : element.getAnnotationMirrors()) { try { Class annotationClass = Class.forName(annotationMirror.getAnnotationType().toString()); Annotation annotation = element.getAnnotation(annotationClass); } catch (ClassNotFoundException e) { e.printStackTrace(); } }
answer count: 2
has comment: http://stackoverflow.com/comment/46170229
downvote count: 0
favorite count: 0
score: 9
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/46163485
has answer: http://stackoverflow.com/a/28955146
tagged with: java
has answer: http://stackoverflow.com/a/24548884

http://stackoverflow.com/comment/35826313
score: 2
has text: checkout this, you can add multiple reg ids eg: "registration_ids": ["4", "8", "15", "16", "23", "42"] http://developer.android.com/google/gcm/notifications.html
type: QuestionComment
comment on: http://stackoverflow.com/q/23386294
type: Comment

http://stackoverflow.com/a/23298165
upvote count: 4
type: AcceptedAnswer
downvote count: 0
score: 4
has comment: http://stackoverflow.com/comment/35671454
type: Answer
has comment: http://stackoverflow.com/comment/35678807
accepted answer of: http://stackoverflow.com/q/23296258
has comment: http://stackoverflow.com/comment/35812659
answers question: http://stackoverflow.com/q/23296258
has body: You may have to do something like SELECT source, user, total, friends, user_rank FROM ( SELECT source, user, count( tweet_id ) as total, max( friends ) as friends, RANK() OVER (PARTITION BY source ORDER BY total DESC, friends DESC ) as user_rank FROM tweets GROUP BY source, user ) HAVING user_rank &lt;= 10

http://stackoverflow.com/q/23443131
accepted answer: http://stackoverflow.com/a/23499920
has comment: http://stackoverflow.com/comment/36025111
type: AnsweredQuestion
has title: How to make file upload in struts2 optional?
tagged with: java
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/35978026
has body: I'm building a web application with Struts2. There's a small part that involves File Upload. The File Upload works well. However a NullPointerException is thrown when I choose to NOT upload a file. The only way I can handle this in code, is by catch(NullPointerException NPE) . And a part of the code gets repeated. I wish to avoid this. Is there any way I can handle a NULL for a file upload in Struts2? My HTML file: &lt;s:file style="height:auto;width:550px;display:inline;align:center;" name="userImage" cssClass="text input" onchange="checkFile(this)"/&gt; My Java action code which handles this: try{ String filePath = servletRequest.getSession().getServletContext().getRealPath("/"); System.out.println("Server path:" + filePath); File fileToCreate = new File(filePath, this.userImageFileName); FileUtils.copyFile(this.userImage, fileToCreate);} catch(NullPointerException NPE){//if I choose to NOT upload a file} catch(Exception E){//some code} I've tried the getUserImage()==null but it does not help. Do I absolutely have to handle the rest of the code inside the catch(NullPointerException NPE) block?
upvote count: 0
score: -1
tagged with: struts2
has answer: http://stackoverflow.com/a/23499920
answer count: 1
has comment: http://stackoverflow.com/comment/35981468
tagged with: file-upload
favorite count: 0
has comment: http://stackoverflow.com/comment/35981535

http://stackoverflow.com/q/23387468
answer count: 0
tagged with: java
tagged with: wysiwyg
type: Question
has comment: http://stackoverflow.com/comment/35828996
score: 0
has title: JEditorPane font size not setting precisely
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35858106
tagged with: swing
has body: Im implementing a WYSIWYG html editor. Im refering this HTMLEditor example. But there different predefined action instances are used for different menuItems. I have a JCombobox in which font sizes are mentioned fontSizeJComboBox.setModel( new javax.swing.DefaultComboBoxModel(new String[] { "10", "12", "14", "16", "18", "20", "24", "28", "32", "36", "42", "48" })); fontSizeJComboBox.addActionListener(customFontSizeAction); on font selection its action listener is invoking class CustomFontSizeAction extends StyledEditorKit.FontSizeAction { public CustomFontSizeAction() { super(fontSizeJComboBox.getSelectedItem().toString(), Integer.parseInt(fontSizeJComboBox.getSelectedItem().toString())); } public void actionPerformed(ActionEvent ae) { JEditorPane editor = getEditor(ae); if (editor != null) { int fontSize = Integer.parseInt(fontSizeJComboBox.getSelectedItem().toString()); if (fontSize != 0) { MutableAttributeSet attr = new SimpleAttributeSet(); StyleConstants.setFontSize(attr, fontSize); setCharacterAttributes(editor, attr, false); } else { UIManager.getLookAndFeel().provideErrorFeedback(editor); } } } } But when i check if correct font size is applied? or on CaretPosition update i want to reselect the jCombobox to specific font size, i do not get same number. CaretListener caretListener = new CaretListener() { @Override public void caretUpdate(CaretEvent e) { AttributeSet attributeSet = ((StyledEditorKit) commentTextArea.getEditorKit()).getInputAttributes(); Object bold = attributeSet == null ? null : attributeSet.getAttribute(StyleConstants.Bold); if (bold != null &amp;&amp; Boolean.parseBoolean(bold.toString())) { // enable bold button } Object italic = attributeSet == null ? null : attributeSet.getAttribute(StyleConstants.Italic); if (italic != null &amp;&amp; Boolean.parseBoolean(italic.toString())) { // enable italic button } Object underline = attributeSet == null ? null : attributeSet.getAttribute(StyleConstants.Underline); if (underline != null &amp;&amp; Bo…
tagged with: jeditorpane

http://stackoverflow.com/comment/35821233
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23382359
score: 0
has text: @devtreat Whats your 2nd question about jsonstr ? Could you please elaborate it.

http://stackoverflow.com/comment/36366362
type: QuestionComment
comment on: http://stackoverflow.com/q/23447459
has text: @ZiedHamdi: "internally a cookie is used to differentiate each session:" - yes, but only if you have different cookies. Open two different browser and login to SO with two different accounts. It works. Try the same in two tabs of a single browser. It doesn't work (as the cookies are shared). I'd like to be able to simulate multiple browsers.
score: 0
type: Comment

http://stackoverflow.com/comment/35821778
type: QuestionComment
comment on: http://stackoverflow.com/q/23383303
has text: @RichardTingle Likewise, a reference to member `ArrayList` who's collection was altered would be altered as well?
score: 0
type: Comment

http://stackoverflow.com/comment/35830311
type: AnswerComment
type: Comment
score: 0
has text: [Read this answer](http://stackoverflow.com/questions/479142/when-to-use-an-interface-instead-of-an-abstract-class-and-vice-versa) and the other linked...
comment on: http://stackoverflow.com/a/23387609

http://stackoverflow.com/a/23297202
score: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23296881
accepted answer of: http://stackoverflow.com/q/23296881
type: Answer
has body: Sciense [mr ali hassan 14/4/1993 ] Ali Hhassan are not valid integer. 1.First read String String str = readLline.next(); 2. Use Integer.parseInt() method to validate the integer input. suppose try{ Integer.parseInt(ste); } catch(NumberFormatException ex){ System.out.println("Its not a valid Integer"); }

http://stackoverflow.com/comment/35702540
type: AnswerComment
has text: Luke, does not mention @ExceptionHandler, just because I'm not using it. I copied a portion of the log, update my question!. As you can see it is trying to invoke: /pages/persistXMLfiletransfer.app which is a method of a controller: @RequestMapping(method = RequestMethod.POST) public final ModelAndView persistXMLfiletransfer(HttpServletRequest request, HttpServletResponse response) throws Exception { BUT, as the TIMEOU (one min!) is fulfiled, spring try to redirected to authentication entry point, but exception and nothing, nothing happens in my browser.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23310450

http://stackoverflow.com/q/23325688
has comment: http://stackoverflow.com/comment/35785527
score: 0
tagged with: eclipselink
answer count: 1
has title: "JDODETACHEDSTATE ': identifier invalid
tagged with: jpa-2.0
has answer: http://stackoverflow.com/a/37562259
accepted answer: http://stackoverflow.com/a/37562259
tagged with: google-app-engine
type: AnsweredQuestion
tagged with: java
has body: Good morning guys Next I'm working with GWT, JPA, EclipseLink and App Engine, and I get the following exception when trying to persist in a given database: Caused by: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.5.1.v20130918-f2b9fc5): org.eclipse.persistence.exceptions.DatabaseException Internal Exception: java.sql.SQLSyntaxErrorException: ORA-00904: "JDODETACHEDSTATE ': identifier invalid Could anyone help me, I have tried to put this column as transient and did not work and finally added the following line in my entity: @ PersistenceCapable (identityType = IdentityType.DATASTORE, detachable = "false") also did not succeed. I'll be grateful for answers.
type: Question
has comment: http://stackoverflow.com/comment/35748901
tagged with: gwt

java.util.scanner
tags question: http://stackoverflow.com/q/23316980
tags question: http://stackoverflow.com/q/23378429
tags question: http://stackoverflow.com/q/23332416
tags question: http://stackoverflow.com/q/23384726
tag name: java.util.scanner
tags question: http://stackoverflow.com/q/23296881
tags question: http://stackoverflow.com/q/23428896
tags question: http://stackoverflow.com/q/23301754
tags question: http://stackoverflow.com/q/23434890
tags question: http://stackoverflow.com/q/23345160
tags question: http://stackoverflow.com/q/23420517
tags question: http://stackoverflow.com/q/23292029
tags question: http://stackoverflow.com/q/23314692
tags question: http://stackoverflow.com/q/23379192
tags question: http://stackoverflow.com/q/23450524
type: Tag
tags question: http://stackoverflow.com/q/23439181
tags question: http://stackoverflow.com/q/23314711
tags question: http://stackoverflow.com/q/23352098
tags question: http://stackoverflow.com/q/23425191
tags question: http://stackoverflow.com/q/23311418
tags question: http://stackoverflow.com/q/23423818
tags question: http://stackoverflow.com/q/23371068

http://stackoverflow.com/q/23314910
has comment: http://stackoverflow.com/comment/35695655
has answer: http://stackoverflow.com/a/23315265
type: Question
has title: double cannot be converted into integer
has comment: http://stackoverflow.com/comment/35698363
has comment: http://stackoverflow.com/comment/35695584
tagged with: java
has comment: http://stackoverflow.com/comment/35698292
has comment: http://stackoverflow.com/comment/35695619
score: 0
answer count: 2
has body: I have the following code public ItemData findItem(Object searchterm) { if (searchterm instanceof Number) { int type = (int)((double) searchterm); return GETXmlParse.itemMap2.get(type); } return GETXmlParse.itemMap.get(searchterm.toString().toUpperCase()); } When the code is executed it throws an error at: int type = (int)((double) searchterm); , Saying a double cannot be converted to an integer. Is there a way around to convert the double into the int?
favorite count: 0
tagged with: int
has answer: http://stackoverflow.com/a/23314952
upvote count: 2
type: UnansweredQuestion
tagged with: double
downvote count: 2

http://stackoverflow.com/a/23446379
downvote count: 0
upvote count: 48
score: 48
type: Answer
accepted answer of: http://stackoverflow.com/q/23445830
answers question: http://stackoverflow.com/q/23445830
has comment: http://stackoverflow.com/comment/49166724
has body: You should prefer the standard JPA API over the proprietary Hibernate one, for several reasons: It makes you learn something that you can reuse in more other projects, relying on a different implementation The JPA API is cleaner than the Hibernate one: it doesn't have the early mistakes that the Hibernate API has The efforts and evolutions are now targeted at the JPA API. For example, the standard JPA2 criteria API is more complete than the old, proprietary, Hibernate Criteria API (but more complex to use, IMHO) If you want, you can always get the Hibernate Session from the JPA EntityManager. Not vice-versa Anyway, most of the effort is in mapping the entities themselves, and that is done using standard JPA annotations, even when using the Session API.
has comment: http://stackoverflow.com/comment/35939632
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35940064
has comment: http://stackoverflow.com/comment/35939503
has comment: http://stackoverflow.com/comment/49166613

http://stackoverflow.com/comment/35682752
score: 0
comment on: http://stackoverflow.com/q/23307914
type: QuestionComment
type: Comment
has text: @AdityaKeyal - yes, the page opened through eclipse browser and also other browsers and I could send a parameter. But the servlet is not found, as mentioned in the intro of my question.

http://stackoverflow.com/comment/35859067
score: 0
type: Comment
type: QuestionComment
has text: No . java doc didn't say that it call System.exit() but also I'm not getting any refernce to confirm that no System.exit() call has been made.
comment on: http://stackoverflow.com/q/23403686

http://stackoverflow.com/comment/35727524
type: AnswerComment
has text: @DavidWallace Yeah, you're right. I've edited my post. However, the question was not showing the regex correctly.
type: Comment
comment on: http://stackoverflow.com/a/23331956
score: 0

http://stackoverflow.com/q/23448052
type: Question
tagged with: 3d
has title: Draw a cube using GridPlot in JMathTools
tagged with: jmathplot
has body: I want to draw a cube using jMathPlot. The cube's points are: (0,0,1),(1,0,1),(1,1,1),(0,1,1),(0,0,2),(1,0,2),(1,1,2),(0,1,2) I have these variables: double[] x = {0,1,0,1}; double[] y = {0,1,0,1}; double[][] z1 = {{1,1,2,2}, {2,2,1,1}, {1,1,2,2}, {1,1,2,2}}; Plot3DPanel plot = new Plot3DPanel("SOUTH"); plot.addGridPlot("cube", Color.red ,x, y, z1); It doesn't work and honestly I still don't understand why z must be a 2D array? Any help would be appreciated.
has answer: http://stackoverflow.com/a/23471595
score: 0
answer count: 1
type: UnansweredQuestion
tagged with: plot
tagged with: java

http://stackoverflow.com/a/23314870
has body: First, a tool you can use to check your memory is JVisualvm. It's distributed with JDK, so check for it in your JDK's installation path, in /bin directory. Then, there are some params you can pass to jvm at runtime. This parameters are util for establish memory use of your application. Maybe this link is useful for you: http://www.oracle.com/technetwork/java/javase/tech/vmoptions-jsp-140102.html
answers question: http://stackoverflow.com/q/23314782
has comment: http://stackoverflow.com/comment/35696507
score: 0
type: Answer

http://stackoverflow.com/q/23404945
score: 0
has title: Removing item from JList with JButton, but won't refresh
tagged with: jlist
answer count: 1
tagged with: user-interface
tagged with: repaint
type: UnansweredQuestion
tagged with: refresh
has answer: http://stackoverflow.com/a/23405214
tagged with: java
type: Question
has body: I've searched and searched and found like 800 solutions, but none of 'em seems to work with my problem. I'm removing an item from a JList using a JButton, and then i want to refresh the GUI in the actionPerformed method. But things like repaint() or updateUI() hasn't helped. Here is my code: public class Watchlist3 extends JPanel { public static ArrayList&lt;String&gt; stocks = new ArrayList&lt;String&gt;(); JButton addStock, removeStock, viewStock, updaterInterval; JLabel stocksAdded, currentInterval, listTitle; JList stocklist; JScrollPane listScroller; public Watchlist3(JFrame frame) { super(new BorderLayout()); //Adding some sample-components to the list stocks.add("PLUG"); stocks.add("IDN"); stocks.add("GOOG"); //Create the components addStock = new JButton("Add Stock"); addStock.setOpaque(true); addStock.setBackground(Color.RED); add(addStock, BorderLayout.LINE_START); removeStock = new JButton("Remove Stock"); removeStock.setOpaque(true); removeStock.setBackground(Color.YELLOW); removeStock.putClientProperty("SENT_FRAME", frame); add(removeStock, BorderLayout.LINE_END); stocklist = new JList(stocks.toArray()); stocklist.setOpaque(true); stocklist.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); stocklist.setLayoutOrientation(JList.HORIZONTAL_WRAP); add(listScroller = new JScrollPane(stocklist), BorderLayout.CENTER); removeStock.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { try { int index = stocklist.getSelectedIndex(); if(index != -1){ stocks.remove(index); System.out.println(stocks); /* Here is where id like to refresh the gui! */ } } catch (Exception ex) {} } }); } private static void createAndShowGUI() { //Create and set up the window. final JFrame frame = new JFrame("Watchlist"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //Create and set up the content pane. Watchlist3 newContentPane = new Watchlist3(frame); newContentPane.setOpaque(true); //content panes must be opaque frame.setContentPane(newCon…

http://stackoverflow.com/comment/35732166
has text: @WiredPrairie for exmpl: if I have two filters 1) _timestamp + userId_ 2) _timestamp + applicationName + country_ or search criteria based on this 4 fields. Does I need 4 indexes? And what the best way to index fields? One way to use '.ensureIndex()' and other one to use Spring annotation '@CompoundIndexes'. Does any principal differences between 'ensureIndex()' and '@CompoundIndexes'?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23326175
score: 0

http://stackoverflow.com/a/23381371
upvote count: 1
downvote count: 0
type: Answer
has body: I've had a similar need for a stack trace even though nothing "went wrong". I understand your reluctance to use an exception even though nothing went wrong. In my case this was a temporary problem, I needed to find out via which sequence of calls a certain method was invoked. To separate this stack trace from "real" exceptions I created a class extending Exception called NoProblemJustShowingStackTrace, but any name that clarifies your intention would be fine. A good name helps a little, but as developers we are so used to seeing stack traces only when a "real" exception is thrown/caught that it will still be confusing to the people reading the log. Best remove this code once the temporary problem is resolved. Note that you don't throw this exception, all you do is create the object and pass it to the logger method. A more permanent alternative solution is to use a pattern layout with location information, like %location, %line, %file, %class, %method. Note that this will have a large impact on performance.
answers question: http://stackoverflow.com/q/23338014
score: 1

http://stackoverflow.com/q/23420963
has answer: http://stackoverflow.com/a/23421037
accepted answer: http://stackoverflow.com/a/23421037
tagged with: file-io
tagged with: regex
type: AnsweredQuestion
downvote count: 0
score: 1
type: Question
tagged with: java
has title: how to use escape characters for patterns read from file in java
has body: I am reading some patterns from a file and using it in String matches method. but while reading the patterns from the file, the escape characters are not working Ex I have few data ex "abc.1", "abcd.1", "abce.1", "def.2" I want do do some activity if the string matches "abc.1" i.e abc. followed by any characters or numbers I have a file that stores the pattern to be matched ex the pattern abc\..* but when I read the pattern from the file and using it in String matches method it does not work. any suggestions a sample java program to demonstrate the issue is : package com.test.resync; import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; public class TestPattern { public static void main(String args[]) { // raw data against which the pattern is to be matched String[] data = { "abc.1", "abcd.1", "abce.1", "def.2" }; String regex_data = ""; // variable to hold the regexpattern after // reading from the file // regex.txt the file containing the regex pattern File file = new File( "/home/ekhaavi/Documents/WORKSPACE/TESTproj/src/com/test/regex.txt"); try { BufferedReader br = new BufferedReader(new FileReader(file)); String str = ""; while ((str = br.readLine()) != null) { if (str.startsWith("matchedpattern")) { regex_data = str.split("=")[1].toString(); // setting the // regex pattern } } } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } /*if the regex is set by the below String literal it works fine*/ //regex_data = "abc\\..*"; for (String st : data) { if (st.matches(regex_data)) { System.out.println(" data matched "); // this is not printed when the pattern is read from the file instead of setting it through literals } } } } The regex.txt file has the below entry matchedpattern=abc\..*
upvote count: 1
answer count: 1
tagged with: string
favorite count: 0

http://stackoverflow.com/comment/35943147
type: AnswerComment
type: Comment
has text: It's not gaining you anything here. You still have to have a loop around a `containsKey` in your code, and it's less efficient. I disagree that "Guava is really a must."
comment on: http://stackoverflow.com/a/23445700
score: 0

http://stackoverflow.com/q/23366817
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/35790617
has comment: http://stackoverflow.com/comment/35790783
answer count: 1
has answer: http://stackoverflow.com/a/23367239
has body: All, thanks in advance for all assistance. I am mixing some SWT and swing. Here is the code: Composite sessionComposite = new Composite(parent, SWT_EMBEDDED | SWT_BORDER); sessionComposite.setLayout(0,0,64,64); Frame frame = new Frame(sessionComposite); frame.setLayout(new BorderLayout()); JPanel panel = new JPanel(new FlowLayout(Flowlayout.LEFT))); frame.add(panel); StyledLabel btnClearHistory = new StyledLabel("Clear Session History"); // some mouse listeners etc... panel.add(btnClearHistory); All works well except the only thing that displays on the button is "Clear Sessio" the rest is truncated. I have tried setting preferredSize on the Panel, Frame and Label but nothing works.. Any help would be appreciated.
tagged with: awt
has comment: http://stackoverflow.com/comment/35791002
score: 0
has comment: http://stackoverflow.com/comment/35790923
has comment: http://stackoverflow.com/comment/35790348
has comment: http://stackoverflow.com/comment/35791175
has comment: http://stackoverflow.com/comment/35791008
has title: Text on StyledLabel being truncated
has comment: http://stackoverflow.com/comment/35790891
has comment: http://stackoverflow.com/comment/35790436
type: UnansweredQuestion
tagged with: swt
tagged with: swing

http://stackoverflow.com/comment/35783967
type: AnswerComment
type: Comment
has text: The bug has been resolved as described. See, i am able to serve jsps and "any other browser requesting resources" via `WEB-INF/classes`.
comment on: http://stackoverflow.com/a/23362912
score: 0

google-play-services
tags question: http://stackoverflow.com/q/23395680
tag name: google-play-services
tags question: http://stackoverflow.com/q/23405174
type: Tag
tags question: http://stackoverflow.com/q/23442633
tags question: http://stackoverflow.com/q/23422017

http://stackoverflow.com/comment/35930277
score: 0
type: Comment
type: QuestionComment
has text: @Manu answer my second question also.
comment on: http://stackoverflow.com/q/23441742

http://stackoverflow.com/comment/35757755
type: AnswerComment
comment on: http://stackoverflow.com/a/23348767
type: Comment
score: 0
has text: i have this structure bin graphics math src graphics math resources graphics i added the pic at resources/graphics and still nothing happened

http://stackoverflow.com/comment/35947315
type: Comment
score: 0
has text: Also your question is kinda vague, you might want to clarify it some more.
type: AnswerComment
comment on: http://stackoverflow.com/a/23450788

http://stackoverflow.com/q/23428991
favorite count: 0
tagged with: synchronization
has body: I am very new to Apache Camel. We have a requirement of handling multiple dynamic routes life-cycle together. Say, there is one route A (static) which, on receiving a message spawns another route B dynamically (the endpoints of B is defined in the message itself, not known in advance). There are different routes created for different messages. Our problem is, there is a class X where from we want to suspend A and resume B and from another class Y just opposite. This switching is not working. In X, before A is suspended fully, the JVM tries to execute resume operation on B, and it seems like the threads are blocked. It is only my guess that it is a synchronization issue. How to address this kind of problem? RouteManager.deactivateRoute(ROUTE_A_ID); //it creates a thread to suspend route as mentioned in Camel's documentation RouteManager.activateRoute(ROUTE_B_ID); //it adds (when B is new) or resumes My log shows no exception, only either of two things happening, "Waiting as there are still 2 inflight and pending exchanges to complete, timeout in 300 seconds." - this message continues Nothing is printed, but B is not working (no log, nothing)
downvote count: 0
has answer: http://stackoverflow.com/a/23454870
has comment: http://stackoverflow.com/comment/35949907
type: Question
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23471254
has title: Camel Route Interdependency
score: 1
tagged with: java
tagged with: apache-camel
has answer: http://stackoverflow.com/a/23471254
answer count: 2
upvote count: 1
possible better answer: http://stackoverflow.com/a/23454870
has comment: http://stackoverflow.com/comment/35973803

http://stackoverflow.com/a/23441341
score: 0
type: Answer
has body: if you want to add one more option field with null value at the begining of the list you can use headerKey & headerValue attribute of s:select tag. Check example given below. <s:select list="myList" listKey="myListVal" listValue="myListDesc" headerKey="0" headerValue="" ></s:select> So the first element of your list will be empty & it's value will be 0(zero) here. It will be render as 0 myListDesc1 myListDesc2 myListDesc3 You can set any value on place of 0 (zero). Hope this will help you.
answers question: http://stackoverflow.com/q/23440767

http://stackoverflow.com/a/23399006
upvote count: 1
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/35880923
has comment: http://stackoverflow.com/comment/35850909
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/23398932
answers question: http://stackoverflow.com/q/23398932
has body: You can simply set: unreadMessages[i] = message; The line before is useless, because you just overwrite the pointer one line deeper (Some IDE will say this) One more suggestion: Make unreadMessages a List&lt;Message&gt; you can add a Message withiout calculating i public Message[] getUnreadMessages() { Message[] messages = inbox.getMessages(1, messageCount); List&lt;Message&gt; readMessages = new ArrayList&lt;Message&gt;(); for (Message message : messages) { boolean isMessageRead = false; for (Flags.Flag flag : message.getFlags().getSystemFlags()) { if (flag == Flags.Flag.SEEN) { readMessages.add(message); break; } } List&lt;Message&gt; unread = Arrays.asList(messages).removeAll(readMessagess); return unread .toArray(new Message[unread.size()]); }
has comment: http://stackoverflow.com/comment/35863361

http://stackoverflow.com/comment/35825122
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23385525
has text: I guess you didn't paste whole method, since it does not return anything. Perhaps the problem is somewhere else, the code you provided shouldn't cause such problems, even if the table is not indexed, has 100 columns etc.

http://stackoverflow.com/q/23449995
answer count: 1
has comment: http://stackoverflow.com/comment/35946208
score: 0
linked to: http://stackoverflow.com/q/14044793
tagged with: file-upload
has title: Uploading a file with httpservlet to java.io.tmpdir through part.write - to an absolute tmp path
has comment: http://stackoverflow.com/comment/35946304
accepted answer: http://stackoverflow.com/a/23450389
has body: I am trying to make a servlet to upload a file to a temporary location. When I build the file path everything seems alright. String uploadFilePath = System.getProperty("java.io.tmpdir") + File.separator + UPLOAD_DIR; and I get the absolute path: C:\Users\victor\AppData\Local\Temp\uploads but when I call part.write(uploadFilePath + File.separator + fileName); I get: C:\Users\victor\GlassFish_Server\glassfish\domains\domain\generated\jsp\pcpweb\ C:\Users\victor\AppData\Local\Temp\uploads and an java.io.FileNotFoundException afterwards, far enough I guess. So "write" is completing my path. I there a way to avoid this? Thanks. Using: glassfish and netbeans protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=UTF-8"); // constructs path of the directory to save uploaded file String uploadFilePath = System.getProperty("java.io.tmpdir") + File.separator + UPLOAD_DIR; // creates the save directory if it does not exists File fileSaveDir = new File(uploadFilePath); if (!fileSaveDir.exists()) { fileSaveDir.mkdirs(); } System.out.println("Upload File Directory=" + fileSaveDir.getAbsolutePath()); String fileName = null; //Get all the parts from request and write it to the file on server for (Part part : request.getParts()) { fileName = getFileName(part); part.write(uploadFilePath + File.separator + fileName); } request.setAttribute("message", fileName + " File uploaded successfully!"); getServletContext().getRequestDispatcher("gerencia.jsp").forward( request, response); }
tagged with: jakarta-ee
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35946248
tagged with: java
tagged with: servlets
type: Question
has answer: http://stackoverflow.com/a/23450389

http://stackoverflow.com/comment/35950909
comment on: http://stackoverflow.com/a/23452800
score: 0
type: AnswerComment
type: Comment
has text: If each method didn't return `this`, you could still use just one constructor. You would have to declare a variable, instantiate it, and make consecutive calls to subsequent methods using the variable.

http://stackoverflow.com/comment/35774590
has text: @Jake I'm sure that's gradually getting better, but not so long ago the interactive debugger in IDEs (I used Eclipse) was not mature. That's why I started with tracing values instead, which was not ideal but was a practical workaround for what you mentioned.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23301682
score: 0

http://stackoverflow.com/comment/35893791
type: Comment
comment on: http://stackoverflow.com/a/23316727
type: AnswerComment
has text: No problem. I don't understand why i+=2 would solve it. Aren't you skipping chars then?
score: 0

http://stackoverflow.com/comment/35864502
has text: you wanted the user to select and option from your arraylist and then you wanted to update it an an option?
type: Comment
comment on: http://stackoverflow.com/q/23405399
score: 0
type: QuestionComment

http://stackoverflow.com/comment/35774852
type: Comment
has text: No, the problem persists
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23346115

while-loop
tags question: http://stackoverflow.com/q/23403709
type: Tag
tags question: http://stackoverflow.com/q/23433210
tags question: http://stackoverflow.com/q/23370509
tags question: http://stackoverflow.com/q/23293288
tags question: http://stackoverflow.com/q/23448787
tags question: http://stackoverflow.com/q/23328611
tags question: http://stackoverflow.com/q/23438550
tags question: http://stackoverflow.com/q/23305304
tags question: http://stackoverflow.com/q/23306176
tags question: http://stackoverflow.com/q/23292029
tags question: http://stackoverflow.com/q/23407051
tags question: http://stackoverflow.com/q/23452793
tags question: http://stackoverflow.com/q/23378960
tag name: while-loop
tags question: http://stackoverflow.com/q/23315521

http://stackoverflow.com/comment/35862739
comment on: http://stackoverflow.com/a/23405588
has text: Just experiment with the values keeping the overall goal in mind and let me know.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/35962473
has text: Did you try the command I suggested? It might have been added at a later time (so your servlet will crash) or it might not have been documented (in which case the servlet will run as expected). Anyway, if you drop us a line at www.gwan.com then we will help you further to let you access the feature you need.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23449647

http://stackoverflow.com/a/23371043
answers question: http://stackoverflow.com/q/23370412
has body: It's easy , you have to 1.Write your own custom adapter for spinner, here is how you do it class SpinnerAdapter extends BaseAdapter { ArrayList&lt;Integer&gt; colors; Context context; public SpinnerAdapter(Context context) { this.context=context; colors=new ArrayList&lt;Integer&gt;(); int retrieve []=context.getResources().getIntArray(R.array.androidColors); for(int re:retrieve) { colors.add(re); } } @Override public int getCount() { return colors.size(); } @Override public Object getItem(int arg0) { return colors.get(arg0); } @Override public long getItemId(int arg0) { return arg0; } @Override public View getView(int pos, View view, ViewGroup parent) { LayoutInflater inflater=LayoutInflater.from(context); view=inflater.inflate(android.R.layout.simple_spinner_dropdown_item, null); TextView txv=(TextView)view.findViewById(android.R.id.text1); txv.setBackgroundColor(colors.get(pos)); txv.setTextSize(20f); txv.setText("Text "+pos); return view; } } 2.Set the adapter like this spnColors=(Spinner)findViewById(R.id.spnColor); spnColors.setAdapter(new SpinnerAdapter(this)); Final Result is Do Accept Answer, If it helps!
has comment: http://stackoverflow.com/comment/91153878
has comment: http://stackoverflow.com/comment/91304896
type: AcceptedAnswer
upvote count: 16
type: Answer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23370412
score: 16

http://stackoverflow.com/comment/35733064
type: AnswerComment
type: Comment
has text: That's an option, but if you note the text I put at the bottom where I explain that "ENDOFMESSAGE" was only for the purposes of the example, the contents of the file shouldn't be an issue. The user can also send the length of the file, which is something I will include in my edit.
comment on: http://stackoverflow.com/a/23326581
score: 0

http://stackoverflow.com/a/23437749
accepted answer of: http://stackoverflow.com/q/23403841
score: 2
has body: Like many time zone abbreviations, "IST" is not unique. It can stand for any of the following: Indian Standard Time (UTC+05:30) Israel Standard Time (UTC+02:00) Irish Standard Time (UTC+01:00) Europe/Dublin is the time zone id for Ireland. Like the United Kingdom, it uses the name "Greenwich Mean Time" during the winter. But in the summer, when the UK switches to "British Summer Time", Ireland switches to "Irish Standard Time". Despite the word "standard" in the name, it is the daylight name for this time zone. If you see "Irish Summer Time" - that is in error. In 2010, Europe/Dublin followed Irish Standard Time from March 28 through October 31, which explains why you see IST for 01-Oct-10 but GMT for 26-Nov-10. India, on the other hand, follows Indian Standard Time all year round, so IST is always applicable. For additional details, see: "Irish Standard Time" - on Wikipedia "Time Zone Abbreviations" - on my blog
upvote count: 2
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23403841
type: Answer

http://stackoverflow.com/q/23425653
tagged with: java
tagged with: eclipse
answer count: 1
has title: Trying to deploy database along with apk ,but force closing on the device
has answer: http://stackoverflow.com/a/23425752
type: UnansweredQuestion
tagged with: android
score: 0
type: Question
has body: I modified my sqliteopenhelper class as follows: public class openingclass extends SQLiteOpenHelper { public openingclass(Context c) { super(c,Db_NAME, null, DB_VERSION); } public void createDataBase() { boolean dbExist; try { dbExist = checkDataBase(); } catch (SQLiteException e) { e.printStackTrace(); throw new Error("database dose not exist"); } if(dbExist){ //do nothing - database already exist }else{ try { copyDataBase(); } catch (IOException e) { e.printStackTrace(); throw new Error("Error copying database"); } //By calling this method and empty database will be created into the default system path //of your application so we are gonna be able to overwrite that database with our database. this.getReadableDatabase(); } } /** * Check if the database already exist to avoid re-copying the file each time you open the application. * @return true if it exists, false if it doesn't */ private boolean checkDataBase(){ SQLiteDatabase checkDB = null; try{ String myPath = DB_PATH +"/"+ Db_NAME; checkDB = SQLiteDatabase.openDatabase(myPath, null, SQLiteDatabase.OPEN_READONLY); }catch(SQLiteException e){ //database does't exist yet. throw new Error("database does't exist yet."); } if(checkDB != null){ checkDB.close(); } return checkDB != null ? true : false; } /** * Copies your database from your local assets-folder to the just created empty database in the * system folder, from where it can be accessed and handled. * This is done by transfering bytestream. * */ private void copyDataBase() throws IOException{ //copyDataBase(); //Open your local db as the input stream InputStream myInput = c1.getAssets().open(Db_NAME); // Path to the just created empty db String outFileName = DB_PATH +"/"+ Db_NAME; File databaseFile = new File(DB_PATH); // check if databases folder exists, if not create one and its subfolders if (!databaseFile.exists()){ databaseFile.mkdir(); } //Open the empty db as the output stream OutputStream myOutput = new FileOutputStream(outFileName); //transfer bytes…

http://stackoverflow.com/q/23397684
tagged with: jasmin
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/24151105
has title: Error executing a file .classes generated by Jasmin
tagged with: grammar
answer count: 1
tagged with: jar
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/68138685
has body: I have a grammar Gram.ge I have to test it with Jasmin. The folder directory contains: Gram.g CodeGenerator.java Instruction.java Main.java Opcode.java SymbolTable.java Type.java jasmin.jar Library directory that contains some programs (for example A.pas) very simple written according to my grammar and saved in .pas While the parent folder (the one immediately above) contains: antlr-3.5-complete.jar Then from the command prompt (Windows) I position in the directory and launch the following commands: java -cp .;../antlr-3.5-complete.jar Org.anltr.Tool Gram.g javac -cp .;../antlr-3.5-complete.jar *.java java -cp .;../antlr-3.5-complete.jar Main/Library/A.pas > Output.j java -jar jasmin.jar Output.j java Output CodeGenerator.java file: import java.util.*; public class CodeGenerator { private Vector&lt;Instruction&gt; instructions = new Vector&lt;Instruction&gt;(); private int counter = 0; public Instruction emit(Opcode opCode) { Instruction ist = new Instruction(opCode); instructions.add(ist); return ist; } public Instruction emit(Opcode opCode, int operand) { Instruction ist = new Instruction(opCode, operand); instructions.add(ist); return ist; } public void emitLabel(int operand) { emit(Opcode.LABEL, operand); } public int newLabel() { return counter++; } public String toJasmin() { String temp = ""; temp += header; for(Instruction ist : instructions) temp += ist.toJasmin() + "\n"; temp += footer; return temp; } public String toString() { String temp = ""; for(Instruction ist : instructions) temp += ist + "\n"; return temp; } private static final String header = ".class public Output \n" + ".super java/lang/Object \n" + "\n" + ".method public &lt;init&gt;()V\n" + " aload_0 \n" + " invokenonvirtual java/lang/Object/&lt;init&gt;()V\n" + " return \n" + ".end method \n" + "\n" + ".method public static printBool(I)V\n" + " .limit stack 3\n" + " getstatic java/lang/System/out Ljava/io/PrintStream;\n" + " iload_0 \n" + " bipush 1\n" + " if_icmpeq Ltrue \n" + " ldc \"false\"\…
has answer: http://stackoverflow.com/a/24151105

http://stackoverflow.com/comment/35779214
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23360001
type: QuestionComment
has text: I remove the org.apache.maven.plugins, and now it's ok :)

http://stackoverflow.com/a/23411586
answers question: http://stackoverflow.com/q/23411346
type: Answer
score: -1
downvote count: 1
upvote count: 0
has body: This is what I did I split into two files and is working for me Car.java public class Car { public static void main (String [] args) { Car a = new Car(); Car b = new Ferrari(); //Car ref, but a Ferrari object a.start(); // Runs the Car version of start() b.start(); // Runs the Ferrari version of start() } public void start() { System.out.println("This is a Generic start to any Car"); } } Ferrari.java public class Ferrari extends Car { @Override public void start() { System.out.println("Lets start the Ferrari and go out for a cool Party."); } } Hope it helps you

http://stackoverflow.com/comment/35792771
type: Comment
comment on: http://stackoverflow.com/a/23367576
type: AnswerComment
has text: anyway there are 2 implementation of whatever class/interface performs/proxies the task. In your case, you'd need 2 implementation too, and I don't think that wether these are anonymous or not is relevant.
score: 0

http://stackoverflow.com/a/23363043
accepted answer of: http://stackoverflow.com/q/23362143
downvote count: 0
answers question: http://stackoverflow.com/q/23362143
has body: I would use an appropriate Collator. Implementing your own comparator isn't the most trivial thing. The nicest would be if you where happy with one of the defaults. e.g. Collections.sort(listStrings, Collator.getInstance(Locale.US)); Or similar. If none of the existing ones works for you then using a rule based collator would make your intent clearer then implementing a comparator imo: String rules = "&lt; a &lt; b &lt; c &lt; '_'" //etc Collections.sort(listStrings, new RuleBasedCollator(rules));
score: 9
type: AcceptedAnswer
upvote count: 9
type: Answer
has comment: http://stackoverflow.com/comment/35789549

http://stackoverflow.com/a/23309453
answers question: http://stackoverflow.com/q/23309427
has body: Well, this could be as simple as checking the root nodes of both the lists for equality, if the nodes are equal, that is your merging point.
type: Answer
score: 0

http://stackoverflow.com/comment/35855007
score: 1
comment on: http://stackoverflow.com/q/23401463
has text: `data` is 2d array, so `data[x]` returns a `String` array
type: QuestionComment
type: Comment

http://stackoverflow.com/a/23444895
score: 1
answers question: http://stackoverflow.com/q/23440822
downvote count: 0
type: Answer
has body: You can't do that because the bean is in the process of being instantiated when the expression is evaluated.
upvote count: 1

http://stackoverflow.com/comment/90342075
comment on: http://stackoverflow.com/a/32566745
type: Comment
score: 3
has text: Note that [`Stream.forEach`](https://docs.oracle.com/javase/10/docs/api/java/util/stream/Stream.html#forEach%28java.util.function.Consumer%29) does *not* provide the same strong guarantee about exceptions being relayed to the caller, so throwing an exception isn't guaranteed to work this way for `Stream.forEach`.
type: AnswerComment

http://stackoverflow.com/q/23389331
has answer: http://stackoverflow.com/a/23392774
has title: Pattern for Guava Splitter
type: Question
accepted answer: http://stackoverflow.com/a/23393345
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23390383
favorite count: 0
tagged with: splitter
has answer: http://stackoverflow.com/a/23393345
possible better answer: http://stackoverflow.com/a/23390383
answer count: 3
upvote count: 1
tagged with: guava
tagged with: java
tagged with: split
downvote count: 0
has body: I need to split String by comma or dot or backslach : Pattern stringPattern = Pattern.compile("\\s+|,|\\\\|"); Splitter.on(stringPattern).omitEmptyStrings().split(description)); but this pattern don't work , what is wrong ?
score: 1

http://stackoverflow.com/comment/35784144
comment on: http://stackoverflow.com/a/23363302
has text: `''` isn't a valid character literal either... and this isn't the cleanest fix anyway.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/62292033
answers question: http://stackoverflow.com/q/23378684
score: 0
type: Answer
has body: Maybe you can set classpath in simple mode in sasv9 config file. It is usually on this installation path: c:\SAS94\x86\SASFoundation\9.4\sasv9.cfg Or not x86 version on: c:\SAS94\SASFoundation\9.4\sasv9.cfg You can register your JAR file in this row end on the config. Example: -Dsas.app.class.path=/sas/sas94/SASVersionedJarRepository/eclipse/plugins/tkjava.jar:/yourpath/your.jar I remember the earlier version are same (9.3,9.2,9.1)

http://stackoverflow.com/a/23404936
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23404863
has body: When the key is pressed, you should set some variable by which you determine movement. On KeyReleased you unset this variable. The way how you handle this it to call the method, for example moveLeft(), and in loop you are checking this variable. On KeyReleased, when you redefine it, the loop ends.
answers question: http://stackoverflow.com/q/23404863
type: Answer
has comment: http://stackoverflow.com/comment/35861291
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/35862023
has comment: http://stackoverflow.com/comment/35861471

http://stackoverflow.com/q/23435780
has title: Lower / upper load factor in hash tables
has answer: http://stackoverflow.com/a/23438573
has body: I am to write a chained hash set class in java. I understand the load factor is M/capacity where M is the number of elements currently in the table and capacity is the size of the table. But how does the load factor help me determine if I should resize the table and rehash or not? Also I couldn't find anywhere how to calculate the lower / upper load factors. Are they even needed? I hope this is enough information, Thank you!!
tagged with: load-factor
has comment: http://stackoverflow.com/comment/35919179
tagged with: hashtable
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/23438573
has comment: http://stackoverflow.com/comment/35920166
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/23435863
score: 0
has answer: http://stackoverflow.com/a/23435863

http://stackoverflow.com/q/23452897
has answer: http://stackoverflow.com/a/24939605
score: 2
downvote count: 0
tagged with: java
has title: How to understand this kind of use of AsyncHandler in an asynchronous web service client code, in Java?
type: Question
upvote count: 2
answer count: 1
tagged with: webservices-client
favorite count: 0
has body: I ran into this piece of code when learning to write an asynchronous client of a web service. I am trying to understand how "new AsyncHandler&lt;Inventory&gt;() {...}" is used here. I am relatively new to Java, and there are a few things that I don't understand: AsyncHandler is from javax.xml.ws.AsyncHandler, and how Inventory, an local or custom object can be part of it. What does AsyncHandler&lt;Inventory&gt; mean? Is the use of "new AsyncHandler&lt;Inventory&gt;() {...}" an instantiation or implementation of the class AsyncHandler? what is the relationship of handleResponse and AsyncHandler? Here is the code: public class StockWebServiceClientCallbackMainMyCopy { private static Logger log = Logger.getLogger(StockWebServiceClientCallbackMain.class.getName()); @SuppressWarnings("unchecked") public static void main(String[] args) throws Exception { final Stock stockPort = new StockService().getStockPort(); log.info("Got StockService port successfully"); final int thresh = 2; // TODO: (53.01) Call async method passing in callback method // In the callback method, print out all the items and exit // Important: call System.exit() from callback stockPort.getStockItemsWithQuantityLessThanAsync(thresh, new AsyncHandler&lt;Inventory&gt;(){ @Override public void handleResponse(Response&lt;Inventory&gt; response) { log.info("Callback invoked"); try{ Inventory inventory = response.get(); for (Item item : inventory.getItems()){ System.out.println(item.getProductId() + " " + item.getQuantity()); } System.exit(0); } catch(Exception e){ e.printStackTrace(); } } }); // TODO: (53.02) Note simulation of other activity using Thread.sleep() while (true){ try{ Thread.sleep(1000); } catch (InterruptedException e){ // ok } } } }
type: UnansweredQuestion

http://stackoverflow.com/a/23341516
has body: Try @DependsOn("ps") public class ..... { @Value("${ps.test}") private String test; .... }
upvote count: 2
type: Answer
score: 2
answers question: http://stackoverflow.com/q/23341319
downvote count: 0

http://stackoverflow.com/comment/35750826
type: QuestionComment
has text: You *could* do this with a 2D `Object` array and a bunch of casting. But just because you *can* do a thing doesn't mean you *should* do a thing. See above comment.
type: Comment
score: 3
comment on: http://stackoverflow.com/q/23345232

http://stackoverflow.com/comment/35661918
score: 0
has text: @alex2410 What's the difference between `JFrame` and `JPanel`, and why would `JPanel` be a better choice to use for a program like this? What about using the Applet class? Could I use that instead?
comment on: http://stackoverflow.com/q/23294604
type: Comment
type: QuestionComment

hql
tag name: hql
tags question: http://stackoverflow.com/q/23344831
type: Tag
tags question: http://stackoverflow.com/q/23426898
tags question: http://stackoverflow.com/q/23356783
tags question: http://stackoverflow.com/q/23369868
tags question: http://stackoverflow.com/q/23359803
tags question: http://stackoverflow.com/q/23322787
tags question: http://stackoverflow.com/q/23369306

http://stackoverflow.com/comment/35741979
type: Comment
has text: do you get `alert(data);`?
type: QuestionComment
comment on: http://stackoverflow.com/q/23340533
score: 0

http://stackoverflow.com/comment/35660019
comment on: http://stackoverflow.com/q/23294956
score: 0
has text: Updated post with stack trance
type: QuestionComment
type: Comment

notnull
type: Tag
tags question: http://stackoverflow.com/q/23410150
tag name: notnull

http://stackoverflow.com/a/23336080
score: 0
has body: you can load the properties file using spring configurations as below: &lt;context:property-placeholder location="classpath:application.properties"/&gt; Add the above configuration in the spring beans configuration file and put the properties file under the source folder which are by default in the classpath. @Value annotation can be used for injecting the property values at your controller. Something like this: @Value("${name}") private String name; your properties file entries would look like this: enter code herename=your name I hope this explanation would solve your problems.
answers question: http://stackoverflow.com/q/23333299
type: Answer

http://stackoverflow.com/comment/35815660
type: QuestionComment
has text: Does each list inside the main list have a consistent type inside (eg, is it a list of shirts, a list of jackets, a list of hats and so on), or does each list have a variety of types of object inside?
score: 0
comment on: http://stackoverflow.com/q/23380213
type: Comment

http://stackoverflow.com/comment/35701199
type: QuestionComment
has text: see this: http://stackoverflow.com/questions/393968/java-is-there-an-easy-quick-way-to-and-or-or-xor-together-sets http://www.codeproject.com/Questions/202720/union-of-two-set-in-java
score: 0
comment on: http://stackoverflow.com/q/23317632
type: Comment

http://stackoverflow.com/comment/35773159
comment on: http://stackoverflow.com/a/23357273
has text: @IvanBabanin 1- That will change the font for ALL the buttons in the whole application, the OP specifically state *"existing buttons within a specific panel"*. 2- If the UI has already being created and visible, you'd also need to call `updateUI`, which doesn't always work well :P
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/35873649
score: 0
type: AnswerComment
has text: String readFile(String fileName) throws IOException { BufferedReader br = new BufferedReader(new FileReader(fileName)); try { StringBuilder sb = new StringBuilder(); String line = br.readLine(); while (line != null) { sb.append(line); sb.append("\n"); line = br.readLine(); } return sb.toString(); } finally { br.close(); } }
type: Comment
comment on: http://stackoverflow.com/a/23390176

http://stackoverflow.com/a/23445700
type: Answer
has comment: http://stackoverflow.com/comment/35943147
has comment: http://stackoverflow.com/comment/35937368
answers question: http://stackoverflow.com/q/23445546
score: 6
upvote count: 7
downvote count: 1
has comment: http://stackoverflow.com/comment/35937471
has comment: http://stackoverflow.com/comment/35937278
has comment: http://stackoverflow.com/comment/35937418
has body: What you want is called the symmetric difference. Guava provides such a method. Set&lt;String&gt; diff = Sets.symmetricDifference(newSet, oldSet); Then just iterate through the set get the samples. List&lt;Sample&gt; samples = new ArrayList&lt;&gt;(); for(String key : diff){ if(oldMap.containsKey(key)){ samples.add(oldMap.get(key)); } else { samples.add(newMap.get(key)); } } You can also do it with the official API, basically the symmetric difference is the union minus the intersection of both sets, but why reinvent the wheel? Using an external dependency can be bad if you're using only one method, but Guava provides a lot of useful features that are a must.

http://stackoverflow.com/comment/35940441
comment on: http://stackoverflow.com/q/23447403
has text: What do you mean by 'remove' the findByUid method? You can't just delete that? And your abstract class does not seem to have any abstract methods, so you don't 'have to' override anything. What is the motive here?
type: Comment
type: QuestionComment
score: 2

http://stackoverflow.com/comment/35748693
type: QuestionComment
comment on: http://stackoverflow.com/q/23298249
has text: In answer to the questions: (1) The file type was a .vm. (2) I don't think there are any custom type converters. (3) I didn't see any other warning or error messages.
score: 0
type: Comment

http://stackoverflow.com/comment/35923630
comment on: http://stackoverflow.com/q/23436818
score: 0
type: QuestionComment
has text: The code also looks good in the console. It needs to be something while displaying it to the browser. I'm not doing anything to the data, getting it from the $.get() call and putting it directly into a table.
type: Comment

http://stackoverflow.com/comment/35854949
score: 0
type: Comment
type: QuestionComment
has text: you question is unclear
comment on: http://stackoverflow.com/q/23401463

http://stackoverflow.com/comment/35761144
comment on: http://stackoverflow.com/a/23350299
has text: Can you please paste the output of `git remote -v`
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/23406279
has answer: http://stackoverflow.com/a/47286881
has answer: http://stackoverflow.com/a/23407030
tagged with: java
linked to: http://stackoverflow.com/q/12588537
possible better answer: http://stackoverflow.com/a/23406324
tagged with: eclipse
tagged with: switch-statement
type: Question
has comment: http://stackoverflow.com/comment/35863903
tagged with: string
has title: switch-case in Java 1.8 with Eclipse not possible?
score: 0
linked to: http://stackoverflow.com/q/338206
has answer: http://stackoverflow.com/a/23406436
has answer: http://stackoverflow.com/a/23406397
answer count: 5
has body: I have re-installed my Java 8 and get a new and fresh Eclipse version. If I write the following code: String a = "001100"; switch(a) { case "5": a = "25"; break; default: System.exit(0); } then Eclipse underlines the "a" in the switch-brackets red and says "Change project compliance and JRE to 1.7". I have not tried this because I'm using Java 1.8 and this should work? I don't want to use Java 1.7. My Eclipse is setting up with Java 1.8, also this Project. There is no lower Java version in the settings.... Where is the problem?
has answer: http://stackoverflow.com/a/23406324
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23406436

http://stackoverflow.com/comment/35731351
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23334171
has text: It sounds like a choice of algorithm issue. You can increase the heap, but you'll be getting diminishing returns as you need it to get bigger and bigger. You might be able to use a more efficient structure, or you might be able to stream the data, processing smaller pieces independently. Nobody can help there unless you explain the situation.

http://stackoverflow.com/comment/35835179
type: QuestionComment
has text: @njzk2 Look on top.. Post my code below EDIT:. Thanks!
comment on: http://stackoverflow.com/q/23368240
score: 0
type: Comment

http://stackoverflow.com/q/23425777
type: AnsweredQuestion
has body: I need to simulate command line, therefore I need to change string into the args[] in the same way running program with parameters into main method does. I am using commons cli, but it does not have any parsing method, it does expect array of string already. I thought, I just use split, but unfortunately, look at this problem : String input = "-command \"This is a long parameter\""; String args[] = input.split(" "); //args[0] = -command //args[1] = "This //args[2] = is //etc. If you use this -command "This is a long parameter" as parameter to your main method, you get following : //args[0] == -command //args[1] == This is a long parameter So any suggestion how to do it? The second problem is to find this on google, because every single thread explains whats args[] is, not how to get it from string.
score: 3
linked to: http://stackoverflow.com/q/7804335
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/35900319
has comment: http://stackoverflow.com/comment/35900381
type: Question
tagged with: command-line-arguments
has title: How to create args[] from string in java
has answer: http://stackoverflow.com/a/23426699
duplicate of: http://stackoverflow.com/q/7804335
answer count: 1
downvote count: 0
favorite count: 0
tagged with: command
tagged with: command-line
accepted answer: http://stackoverflow.com/a/23426699

http://stackoverflow.com/a/23380694
answers question: http://stackoverflow.com/q/23380572
type: Answer
score: 2
upvote count: 2
has body: To get the full line use 'nextLine()' then tokenize it. String line = scan.nextLine();
has comment: http://stackoverflow.com/comment/35816280
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23380572

http://stackoverflow.com/comment/35795159
has text: Ok, let me explain.. Let's say this is a simple interactive application, so I might need to input some random files and output messages accordingly (in different places) and I would like to do this in a single function, so when I call that function in the scriptlet, it should simply execute and print whatever is required to be printed onto the browser!
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23368246
type: Comment

http://stackoverflow.com/a/23444550
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/23442604
has body: First, the most important thing for your requirement is System.getProperty("java.home"), you've got it already. Secondly, don't worry about case sensitivity, the path '$JAVA_HOME/bin/java' always be in lower case in every java release, and there are already many other projects depend on this. Last thing, you don't have to use a '/' or '\' to build the absolute path, consider this: File path = new File(new File(System.getProperty("java.home"), "bin"), executable); As you mentioned the File.separator did similar thing, but that is talking about a string, and File talks about file. Here is a discussion about File path
type: Answer
upvote count: 1

http://stackoverflow.com/comment/35681435
has text: i have numbers and the positions they need to go into from some puzzles online
comment on: http://stackoverflow.com/a/23306913
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/35892771
type: QuestionComment
score: 0
has text: Yes, that was the closest I got, but it still seems like a hack if I'm having to manually handle one value as I get 0.125 each time I go back to position zero
comment on: http://stackoverflow.com/q/23421411
type: Comment

http://stackoverflow.com/a/24824998
accepted answer of: http://stackoverflow.com/q/23343779
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 2
upvote count: 2
has body: ITDConnection QCConnection =null; try{ QCConnection = ClassFactory.createTDConnection(); QCConnection.initConnection("QC URL", domain, domainPswd); IList domains = QCConnection.domainsList(); IList projectList = QCConnection.projectsList(); List&lt;String&gt; domainList = new ArrayList&lt;String&gt;(); for(int i=1;i&lt;domains.count();i++){ domainList.add((String)domains.item(i)); System.out.println("DOmains: "+domains.item(i)); } for(int i=1;i&lt;projectList.count();i++){ System.out.println("Projects : "+projectList.item(i)); } QCConnection.connectProject(project, "LoginName", "Password"); ITreeManager iTreeManager = QCConnection.treeManager().queryInterface(ITreeManager.class); ISubjectNode iSubNode = iTreeManager.nodeByPath("Subject").queryInterface(ISubjectNode.class); IList testFolders = iSubNode.newList(); for(Com4jObject isys:testFolders){ System.out.println("Test folder : "+isys.queryInterface(ISysTreeNode.class).name()); } } catch(Exception e){ System.out.println("Exceptions occured: "+e.getMessage()); } Will Display all the folders in the project!
answers question: http://stackoverflow.com/q/23343779

http://stackoverflow.com/comment/36449788
has text: I want to paste this file into a different application, so I'm wondering if it has something to do with clipboard ownership? Or something to do with a "handle" to the buffer object. http://docs.activestate.com/activepython/2.5/pywin32/win32clipboard__SetClipboardData_meth.html
type: AnswerComment
type: Comment
score: 0
comment on: http://stackoverflow.com/a/23382565

http://stackoverflow.com/q/23339539
possible better answer: http://stackoverflow.com/a/23339627
has comment: http://stackoverflow.com/comment/35740120
has answer: http://stackoverflow.com/a/23339627
answer count: 3
has comment: http://stackoverflow.com/comment/35740081
tagged with: string
favorite count: 0
has body: I have the following string array: String arry[] = { "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", "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", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "`", "~", "!", "@", "#", "$", "%", "^", "&amp;", "*", "(", ")", "-", "_", "=", "+", ";", ":", "'", "|", "", "&lt;", ",", "&gt;", ".", "/", "?", }; In this String array how to get a values randomly ? For example: AG.4fF h9_wO4 So far, I have the following code: for (String st : arry) { String randomValue = arry[new Random().nextInt(arry.length)]; System.out.println(" Inside array values :--&gt;&gt; " + randomValue); } For this code, it returns all the array values, then how to form a multiple combinations. as i mentioned earlier?
score: -3
downvote count: 6
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23341838
has comment: http://stackoverflow.com/comment/35740065
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/35741062
type: Question
has answer: http://stackoverflow.com/a/23339640
tagged with: arrays
has title: how to get those array values randomly?
accepted answer: http://stackoverflow.com/a/23341838

http://stackoverflow.com/comment/35832097
has text: "not possible because this is endless loop without break;" It is not an endless loop! Why you say so?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23389032
type: Comment

http://stackoverflow.com/comment/35931854
has text: My pleasure. I also use 1.7, but still had some trouble without the jmockit agent. I hope it will solve your problem.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23442741

http://stackoverflow.com/q/23445915
has comment: http://stackoverflow.com/comment/35956288
has answer: http://stackoverflow.com/a/23446122
has comment: http://stackoverflow.com/comment/35978773
answer count: 2
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/35953831
has body: The date in database is 2012-03-20 12:24:34.123456. We need to display it in long format.so, we used getTime() method. But when we are converting back to date again, the nano seconds are not matching exact precision. The date after conversion is 2012-03-20 12:24:34.123. last 456 is missing. any one help to get exact date with nano seconds.
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35938103
score: 2
upvote count: 2
has title: Java Convert long value to date with exact precision of nano seconds
tagged with: java
has comment: http://stackoverflow.com/comment/35937682
has answer: http://stackoverflow.com/a/23446173
type: Question

http://stackoverflow.com/comment/35945642
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23449979
has text: That wasn't really intended a serious solution. Writing compilers should be left to the compiler writers. An annotation preprocessor is fairly simple to do. Or even something like a Checkstyle rule.

http://stackoverflow.com/comment/35904281
type: AnswerComment
comment on: http://stackoverflow.com/a/23425652
type: Comment
has text: @JonSkeet Then you'd be wrong. It doesn't. FileOutputStream doesn't even have a flush() method of its own, and the Javadoc for the inherited flush() method specifically contradicts your expectation, several times, for example "if the intended destination of this stream is an abstraction provided by the underlying operating system, for example a file, then flushing the stream guarantees only that bytes previously written to the stream are passed to the operating system for writing; it does not guarantee that they are actually written to a physical device such as a disk drive."
score: 0

http://stackoverflow.com/comment/35704764
type: Comment
score: 1
type: QuestionComment
has text: As an aside: Why code an applet? If it is due to spec. by teacher, please refer them to [Why CS teachers should stop teaching Java applets](http://programmers.blogoverflow.com/2013/05/why-cs-teachers-should-stop-teaching-java-applets/).
comment on: http://stackoverflow.com/q/23315737

http://stackoverflow.com/q/23301124
has comment: http://stackoverflow.com/comment/35670958
favorite count: 0
type: Question
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: mysql
tagged with: twitter
has body: I am a beginner with json formatting and I will appreciate any help. I have a JSON file containing 10.000 tweets from a Twitter db. I create empty 5 table in a DB, each one of them has specific information like user info, tweet info, etc. I want to insert this data from the JSON file to specific columns in any table using Java so I can do searches to retrieve specific tweets based on conditions. I have code to connect the database with the Java class and read the external file but it inserts it in one column, how can i divide it up? import java.io.File; import java.io.FileInputStream; import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; public class InsertTextFileToMySQL { public static Connection getConnection() throws Exception { String driver = "com.mysql.jdbc.Driver"; String url = "jdbc:mysql://localhost:8889/db_Twitter"; String username = "root"; String password = "root"; Class.forName(driver); Connection conn = DriverManager.getConnection(url, username, password); return conn; } public static void main(String[] args)throws Exception { String id = "001"; String fileName = "fileName.txt"; FileInputStream fis = null; PreparedStatement pstmt = null; Connection conn = null; try { conn = getConnection(); conn.setAutoCommit(false); File file = new File(fileName); fis = new FileInputStream(file); pstmt = conn.prepareStatement("insert into DataFiles(id, fileName, fileBody) values (?, ?, ?)"); pstmt.setString(1, id); pstmt.setString(2, fileName); pstmt.setAsciiStream(3, fis, (int) file.length()); pstmt.executeUpdate(); conn.commit(); } catch (Exception e) { System.err.println("Error: " + e.getMessage()); e.printStackTrace(); } finally { pstmt.close(); fis.close(); conn.close(); } } } Again, this code is inserting the entire file in one column.
has comment: http://stackoverflow.com/comment/35670471
upvote count: 1
has title: How insert json file in multiple tables using java?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35671321
has comment: http://stackoverflow.com/comment/35671281
has comment: http://stackoverflow.com/comment/35670957
answer count: 0
downvote count: 0
score: 1

http://stackoverflow.com/q/23398013
downvote count: 0
has comment: http://stackoverflow.com/comment/35848810
answer count: 3
tagged with: nested
favorite count: 0
has answer: http://stackoverflow.com/a/23398082
has title: "Un-nesting" my Try/Catch block in Java
upvote count: 1
has comment: http://stackoverflow.com/comment/35848654
possible better answer: http://stackoverflow.com/a/23398081
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23398081
has body: In my efforts to learn and better understand Java, I have been told that it is generally a bad practice to keep my code nested like it is below. My question is how can I make it so that it performs the same functions while making it a little easier to read. Thanks! class Test { public static void main(String[] args) { try { int zero = 0; int y = 2/zero; try { Object s = null; System.out.println(s.toString()); } catch(NullPointerException e) { System.out.println(e); } } catch(ArithmeticException e) { System.out.println(e); } } }
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/23398171
type: Question
tagged with: try-catch
accepted answer: http://stackoverflow.com/a/23398171
has comment: http://stackoverflow.com/comment/35848767

http://stackoverflow.com/comment/35924059
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23438076
has text: Using `next()` for the student ID and `nextLine()` to get the rest of the line may work, but since everything seems to be aligned in columns, it might be best to use `nextLine()` to get the whole line and [`substring`](http://docs.oracle.com/javase/7/docs/api/java/lang/String.html#substring(int)) to get the parts of that line.
score: 0

http://stackoverflow.com/a/23310862
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35690540
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/35688171
has body: From the structure of the program, we can conclude that the memory hog is either an object that gets bigger in each iteration of the loop (case 1), or an object that gets big within a single iteration (case 2). The stacktrace indicates a failed memory allocation when the BufferedReader tried to resize its internal character buffer to accomodate a line of input. How long is this line at the time of failure? You can find out by running your program in a debugger, with an exception breakpoint on OutOfMemoryError, and inspect the variable holding the size of the array that could not be allocated. If it isn't huge, we can rule out case 2. The most likely suspect for case 1 is the LinkedHashSet storing the tweet_f for all tweets in the output. Try estimating its size (a rough estimate can be obtained with ln.size() * (50 + 2 * average string length in chars), and ensure you have sufficient memory to hold it. If that fails, I'd get out the heavy tools, i.e. take a heap dump, load it in an analysis tool such as VisualVM or a commercial profiler, ask that tool to identify the large objects and which references to these objects prevent their garbage collection.
answers question: http://stackoverflow.com/q/23310245
accepted answer of: http://stackoverflow.com/q/23310245

http://stackoverflow.com/comment/35829461
score: 1
has text: You created the XML Schema, but then instead of generating a class model from it you built one by hand? The following article will help you get rid of the `@XmlTransient` annotations.
type: AnswerComment
comment on: http://stackoverflow.com/a/23387534
type: Comment

http://stackoverflow.com/q/23381253
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23381800
score: 0
tagged with: java
linked to: http://stackoverflow.com/q/8211420
tagged with: jaxb
linked to: http://stackoverflow.com/q/16215409
possible better answer: http://stackoverflow.com/a/23381800
type: Question
has answer: http://stackoverflow.com/a/23382729
answer count: 2
has body: During compilation i have an error: "annotation type not applicable to this kind of declaration". And details: void someFunc(@XmlElement(required=true) MyClass someParam). I use JDK 1.6.18 and @XmlElement not available in this version. I found that the main problem in JAXB (it's version). It was discussed here: XmlElement annotation dissallowed with WebParam Is it possible to replace the version of the JAXB implementation in Java JRE 1.6 SE?. I updated JAXB in JDK by using endorsed method ($JAVA_HOME/lib/endorsed), but it still not work. Q: 1. How i can be convinced that compiler use updated version of JAXB? 2. What else there can be incorrectness reasons?
accepted answer: http://stackoverflow.com/a/23382729
tagged with: annotations
has title: Annotation type @XmlElement not applicable

http://stackoverflow.com/comment/35904125
score: 0
has text: I think Spring is the best framework for development that there is.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23427982

http://stackoverflow.com/comment/35680223
type: Comment
has text: @Boann: `"Another point I'd forgotten: with key bindings, the action is triggered at an unknown rate. Using key listeners, although this is also true of the simple code in this example, it becomes possible to track press & release separately, using a timer to move the game character at a fixed speed regardless of how the user/OS has configured the key repeat rate."` -- I often use Key Bindings together with a Swing Timer. I've had no frequency problems when using them this way.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23305851

http://stackoverflow.com/comment/35862996
type: Comment
score: 0
type: AnswerComment
has text: your comment explains pretty much.
comment on: http://stackoverflow.com/a/23405128

http://stackoverflow.com/comment/35871301
type: AnswerComment
comment on: http://stackoverflow.com/a/23407896
type: Comment
score: 1
has text: The code that invokes the setValueAt(...) method should NOT call the fireTableCellUpdated(...) method. It is the responsibility of the setValueAt(...) method of your custom TableModel to invoke the fireTableCellUpdated(...) method.

http://stackoverflow.com/comment/35877746
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23412883
has text: See my edit answer, I've added `if (shallPaint)`: you don't need the `clear()` method, because you can't literally clear a panel, you can only avoid painting it. So when the clear button is hit and when application starts, simply set this boolean variable `shallPaint` to `false` to avoid painting, then call `repaint()`. Of course, set it to `true` when you want your rectangle to be painted.

http://stackoverflow.com/comment/35930755
has text: what sort of varint do you mean ???. In java version of protocol buffers the writeDelimitedTo method writes a varint32 then the message
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23375555

http://stackoverflow.com/comment/35918919
type: QuestionComment
comment on: http://stackoverflow.com/q/23434625
has text: yea, i meant the records, you could access any stored record in a file giving the position.
score: 0
type: Comment

http://stackoverflow.com/q/23340840
has body: I was implementing an interface with uses DataTables and excel files. Motive is upload an excel and then show it in DataTables. As I didn't find any javascript library which parse the excel and provide it to DataTables. The only option is ot send the data to the front end struts/ java and send back the json. Is it possible to have DataTables waiting for the json by Ajax without sending the request. .
possible better answer: http://stackoverflow.com/a/23340984
has answer: http://stackoverflow.com/a/23341558
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23340984
downvote count: 0
tagged with: javascript
score: 1
favorite count: 0
tagged with: ajax
accepted answer: http://stackoverflow.com/a/23830797
type: Question
tagged with: datatables
has title: Ajax response in datatables
answer count: 3
upvote count: 1
has answer: http://stackoverflow.com/a/23830797
tagged with: java
tagged with: http://stackoverflow.com/tag/json

http://stackoverflow.com/comment/36193520
has text: Am so sorry @Gil but there is nothing there, do you think is possible to resend it?
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23449647

http://stackoverflow.com/comment/35864536
type: AnswerComment
type: Comment
has text: I probably would've said "HashMap in Java is a class which models a **hash table** data structure". IMO a map is an abstract data type (ADT). Some view ADTs and data structures as disjoint (although others views the one as a class of the other). Although it sounds like the book defines ADTs as data structures, so, by that definition, your statement is probably fine.
comment on: http://stackoverflow.com/a/23406393
score: 0

http://stackoverflow.com/comment/35800759
type: Comment
has text: Thank you for the link but I thought SwingWorker could only be used once. Where and how do I create one to control with the buttons?
type: AnswerComment
comment on: http://stackoverflow.com/a/23371354
score: 0

http://stackoverflow.com/comment/35909694
comment on: http://stackoverflow.com/q/23430757
has text: I want to use a button to delete that element in the parent from the db. It's a delete button. @LokiSinclair
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23441640
has answer: http://stackoverflow.com/a/29423750
downvote count: 0
has comment: http://stackoverflow.com/comment/35930507
linked to: http://stackoverflow.com/q/4814916
type: UnansweredQuestion
type: Question
linked to: http://stackoverflow.com/q/45383977
linked to: http://stackoverflow.com/q/5233893
has comment: http://stackoverflow.com/comment/35930029
score: 7
tagged with: java
upvote count: 7
answer count: 1
favorite count: 0
linked to: http://stackoverflow.com/q/14423449
tagged with: scheduledexecutorservice
has title: How to wait for (fixed rate) ScheduledFuture to complete on cancellation
has body: Is there a built-in way to cancel a Runnable task that has been scheduled at a fixed rate via ScheduledExecutorService.scheduleAtFixedRate and await it's completion if it happens to be running when cancel is called?. Consider the following example: public static void main(String[] args) throws InterruptedException, ExecutionException { Runnable fiveSecondTask = new Runnable() { @Override public void run() { System.out.println("5 second task started"); long finishTime = System.currentTimeMillis() + 5_000; while (System.currentTimeMillis() &lt; finishTime); System.out.println("5 second task finished"); } }; ScheduledExecutorService exec = Executors.newSingleThreadScheduledExecutor(); ScheduledFuture&lt;?&gt; fut = exec.scheduleAtFixedRate(fiveSecondTask, 0, 1, TimeUnit.SECONDS); Thread.sleep(1_000); System.out.print("Cancelling task.."); fut.cancel(true); System.out.println("done"); System.out.println("isCancelled : " + fut.isCancelled()); System.out.println("isDone : " + fut.isDone()); try { fut.get(); System.out.println("get : didn't throw exception"); } catch (CancellationException e) { System.out.println("get : threw exception"); } } The output of this program is: 5 second task started Cancelling task..done isCancelled : true isDone : true get : threw exception 5 second task finished Setting a shared volatile flag seems the simplest option, but I'd prefer to avoid it if possible. Does the java.util.concurrent framework have this capability built in?

http://stackoverflow.com/comment/35905820
type: QuestionComment
has text: You should probably update your post to reflect what you have said in the comments
comment on: http://stackoverflow.com/q/23428743
score: 0
type: Comment

http://stackoverflow.com/a/23312499
downvote count: 0
type: Answer
has body: The purpose of the mediator is to relay information between colleagues. You only have to inform the mediator of things that other colleagues in your system need to know about. I would venture that in this system, there is perhaps another class perhaps called Engine which has a start() method also registered with the mediator. When the Ignition start method calls mediator.ignitionTurnedOn(), most likely, the mediator then calls something like getEngine().start() from inside its ignitionTurnedOn() method. Probably nothing is invoked twice here.
upvote count: 1
answers question: http://stackoverflow.com/q/23312236
score: 1

http://stackoverflow.com/a/23326856
has comment: http://stackoverflow.com/comment/35717708
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/23326798
has body: If wordNet.getWordNetPath(groupList.get(i)); returns null, that would cause a NullPointerException in the next statement when the code tries to evaluate wordResult.length. You should change the if to: if(wordResult == null || wordResult.length == 0) { graph.addVertex(groupList.get(i)); } else { . . . You'll have to post the stack trace for us to diagnose the array out of bounds exception. The code you posted should not be generating that (although it might come from within one of the methods you are calling). As an aside, you can eliminate the if inside the inner loop (on index j) by rewriting it as: for(int j=0; j&lt;wordResult.length - 1; j++) { graph.addEdge(edgeFactory.create(), wordResult[j], wordResult[j+1]); } EDIT: Based on your comment that the array bounds exception is coming from this line: wordResult = wordNet.getWordNetPath(groupList.get(i)); I suspect that groupList.get(i) is returning some value that causes getWordNetPath to throw the exception. The answer lies somewhere in code that you haven't posted. If you don't want to bother tracking down the source of the exception and simply want to allow your program to continue in the event one is thrown, you can simply catch it: try { wordResult = wordNet.getWordNetPath(groupList.get(i)); } catch (IndexOutOfBoundsException e) { wordResult = null; } If you're also getting NullPointerException sometimes thrown from getWordNetPath, you can add a second catch clause for that as well.
has comment: http://stackoverflow.com/comment/35745756
has comment: http://stackoverflow.com/comment/35740360
has comment: http://stackoverflow.com/comment/35717669
downvote count: 0
has comment: http://stackoverflow.com/comment/35717871
has comment: http://stackoverflow.com/comment/35718192
type: Answer

rendering-engine
type: Tag
tags question: http://stackoverflow.com/q/23430880
tag name: rendering-engine

jakarta-ee
tags question: http://stackoverflow.com/q/23375049
tags question: http://stackoverflow.com/q/23356678
tags question: http://stackoverflow.com/q/23409517
tags question: http://stackoverflow.com/q/23437284
type: Tag
tags question: http://stackoverflow.com/q/23394233
tags question: http://stackoverflow.com/q/23290913
tags question: http://stackoverflow.com/q/23440067
tags question: http://stackoverflow.com/q/23315980
tags question: http://stackoverflow.com/q/23325352
tags question: http://stackoverflow.com/q/23384357
tags question: http://stackoverflow.com/q/23407835
tags question: http://stackoverflow.com/q/23327143
tags question: http://stackoverflow.com/q/23421967
tags question: http://stackoverflow.com/q/23345612
tags question: http://stackoverflow.com/q/23423278
tags question: http://stackoverflow.com/q/23306000
tags question: http://stackoverflow.com/q/23324986
tags question: http://stackoverflow.com/q/23449995
tags question: http://stackoverflow.com/q/23392938
tags question: http://stackoverflow.com/q/23363783
tags question: http://stackoverflow.com/q/23331677
tags question: http://stackoverflow.com/q/23415680
tags question: http://stackoverflow.com/q/23399603
tags question: http://stackoverflow.com/q/23376106
tags question: http://stackoverflow.com/q/23321046
tags question: http://stackoverflow.com/q/23385628
tags question: http://stackoverflow.com/q/23346681
tag name: jakarta-ee
tags question: http://stackoverflow.com/q/23396105
tags question: http://stackoverflow.com/q/23421352
tags question: http://stackoverflow.com/q/23425150
tags question: http://stackoverflow.com/q/23401972
tags question: http://stackoverflow.com/q/23420954
tags question: http://stackoverflow.com/q/23312469
tags question: http://stackoverflow.com/q/23383635
tags question: http://stackoverflow.com/q/23338412
tags question: http://stackoverflow.com/q/23312828
tags question: http://stackoverflow.com/q/23379900
tags question: http://stackoverflow.com/q/23364301
tags question: http://stackoverflow.com/q/23342279
tags question: http://stackoverflow.com/q/23330034
tags question: http://stackoverflow.com/q/23422959
tags question: http://stackoverflow.com/q/23366391
tags question: http://stackoverflow.com/q/23300014
tags question: http://stackoverflow.com/q/23367158
tags question: http://stackoverflow.com/q/23433310
tags question: http://stackoverflow.com/q/23333299
tags question: http://stackoverflow.com/q/23422549
tags question: http://stackoverflow.com/q/23422650
tags question: http://stackoverflow.com/q/23393454
tags question: http://stackoverflow.com/q/23354067
tags question: http://stackoverflow.com/q/23403306
tags question: http://stackoverflow.com/q/23324139
tags question: http://stackoverflow.com/q/23396290
tags question: http://stackoverflow.com/q/23427028
tags question: http://stackoverflow.com/q/23422081
tags question: http://stackoverflow.com/q/23381313
tags question: http://stackoverflow.com/q/23393281
tags question: http://stackoverflow.com/q/23435735
tags question: http://stackoverflow.com/q/23399076
tags question: http://stackoverflow.com/q/23327538
tags question: http://stackoverflow.com/q/23372079
tags question: http://stackoverflow.com/q/23319159
tags question: http://stackoverflow.com/q/23360831
tags question: http://stackoverflow.com/q/23319210
tags question: http://stackoverflow.com/q/23357650
tags question: http://stackoverflow.com/q/23430577

http://stackoverflow.com/q/23372341
upvote count: 0
has comment: http://stackoverflow.com/comment/35805623
answer count: 1
has comment: http://stackoverflow.com/comment/35805412
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35805737
tagged with: android
has comment: http://stackoverflow.com/comment/35818979
has body: Noob programmer here! I want to loop through a HashMap and send the data from 1 row to a method with a button click. That is when i press the button once the data from the first row is sent into the method, when the button is pressed again the data from row nr 2 is sent into the method and so on. How can I do that and is it even possible? EDIT Code for the method: public void create_dialog_method(String question_param, final boolean identifier) { AlertDialog.Builder alert = new AlertDialog.Builder(this); alert.setTitle("Title"); alert.setMessage(question_param); alert.setPositiveButton("YES", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int whichButton) { if (identifier) showRiskEvaluationDialog(); else if (identifier == false); //&lt;&lt;&lt;&lt;&lt;This is where i need a loop that only picks 1 row each time it's called&gt;&gt;&gt;&gt; for (Entry&lt;String, Boolean&gt; entry: question_map.entrySet()){ create_dialog_method(entry.getKey(),entry.getValue()); } Toast.makeText(getApplicationContext(), "Saved", Toast.LENGTH_SHORT).show(); } }); alert.setNegativeButton("NO", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int whichButton) { if (identifier) Toast.makeText(getApplicationContext(), "Saved", Toast.LENGTH_SHORT).show(); else showRiskEvaluationDialog(); } }); alert.show(); } My class and onCreate(); including the Map with questions and "identifier" boolean value: public class QuestionsActivity extends Activity { Map&lt;String, Boolean&gt; question_map = new LinkedHashMap&lt;String, Boolean&gt;(); int counter = 0; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.test_layout); //false = call showRiskEvaluationDialog() on button NO //true = call showRiskEvaluationDialog() on button YES question_map.put("8. Question8?", false); question_map.put("7. Question7?", false); question_map.put("6. Question6?",…
tagged with: java
score: -4
has comment: http://stackoverflow.com/comment/35805895
has comment: http://stackoverflow.com/comment/35801372
type: Question
has answer: http://stackoverflow.com/a/23372444
has title: How can I loop through a HashMap table and send data from 1 row at a time with a button?
downvote count: 4

http://stackoverflow.com/a/23302116
downvote count: 0
has comment: http://stackoverflow.com/comment/35672407
has comment: http://stackoverflow.com/comment/81999967
has comment: http://stackoverflow.com/comment/35673231
accepted answer of: http://stackoverflow.com/q/23302096
has body: The guarantee that LinkedHashSet makes is about iteration order. However, it's still a Set and a set doesn't care about order in itself. A List on the other hand, does. A List with an element in 3rd position is not the same as another List with the same element in the 1st position. Set javadoc for the equals(Object) method Returns true if the specified object is also a set, the two sets have the same size, and every member of the specified set is contained in this set (or equivalently, every member of this set is contained in the specified set). This definition ensures that the equals method works properly across different implementations of the set interface. The LinkedHashSet javadoc states Hash table and linked list implementation of the Set interface, with predictable iteration order. A LinkedHashSet is a Set. It has the same rules, ie. those that apply to the set ADT.
answers question: http://stackoverflow.com/q/23302096
type: Answer
score: 13
has comment: http://stackoverflow.com/comment/35672847
upvote count: 13
has comment: http://stackoverflow.com/comment/35672913
has comment: http://stackoverflow.com/comment/35672429
type: AcceptedAnswer

http://stackoverflow.com/comment/35838710
type: QuestionComment
score: 0
has text: Thanks Andrew, that clears it up. With both applets communicating with JS there was some blocking going on. I'll investigate more to find exactly how to get it ironed out but I am on the right track.
comment on: http://stackoverflow.com/q/23350350
type: Comment

http://stackoverflow.com/comment/35676278
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/23302651
has text: Your code definitely should work. Near identical code to yours works fine in my plugins. As an added note, you can replace `Bukkit.getServer().dispatchCommand` with `Bukkit.dispatchCommand`. It won't fix your problem, but it's more concise and does the same thing.

http://stackoverflow.com/q/23433968
tagged with: java
has title: Akka Actors Java Competing Consumers
tagged with: actor
tagged with: cluster-computing
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23442444
tagged with: apache-camel
has body: I am trying out a competing event consumer implementation using Akka and Camel. Am using Akka 2.3.2 and Camel 5.8.0. I am connecting camel to ActiveMQ broker and using a producer to generate messages from other end. In the following code EventManager is the master which creates pool of consumers and EventProcessor is the message processing actor. EventManager.java import org.apache.activemq.ActiveMQConnection; import org.apache.activemq.camel.component.ActiveMQComponent; import org.apache.camel.CamelContext; import akka.actor.ActorRef; import akka.actor.ActorSystem; import akka.actor.Props; import akka.actor.UntypedActor; import akka.camel.Camel; import akka.camel.CamelExtension; import akka.japi.Creator; import akka.routing.RoundRobinPool; public class EventManager { private final ActorSystem akkaSystem; private CamelContext camelContext = null; private ActorRef workRouter; public EventManager(ActorSystem system) { akkaSystem = system; initialize(); } public void initialize() { Camel camel = CamelExtension.get(akkaSystem); camelContext = camel.context(); ActiveMQComponent activemqComponent = ActiveMQComponent.activeMQComponent("tcp://localhost:61616"); activemqComponent.setDeliveryPersistent(false); camelContext.addComponent("activemq",activemqComponent ); int numOfWorkers = 5; // distributing the message processing across a pool of 5 actors ActorRef workRouter = akkaSystem.actorOf(new RoundRobinPool(numOfWorkers).props(Props.create(EventProcessor.class)), "workRouter"); } } EventProcessor.java import org.apache.log4j.Logger; import akka.actor.UntypedActor; import akka.camel.CamelMessage; import akka.camel.javaapi.UntypedConsumerActor; public class EventProcessor extends UntypedConsumerActor{ private static final Logger LOGGER = Logger.getLogger(EventProcessor.class); public EventProcessor() { } public void onReceive(Object message) { if(message instanceof CamelMessage) { CamelMessage camelMessage = (CamelMessage) message; String body = camelMessage.getBodyAs(Strin…
accepted answer: http://stackoverflow.com/a/23442444
score: 0
tagged with: akka
answer count: 1

http://stackoverflow.com/q/23394542
accepted answer: http://stackoverflow.com/a/23422249
has body: I have a Camel route using blueprint and Camel PropertiesComponent for configuration, I can run it standalone via 'mvn camel:run' or I can install it into a Karaf container. Both work great and discover the properties and inject them into the route. What I cannot figure out is how to persist the properties when they change at runtime (as an example, I want to set a marker when the route stops/shutsdown and then read it back when the route starts). I have read about OSGi ConfigAdmin - but this doesn't seem to support persisting properties. I have also read about the OSGi preferences service (which does support persistence) - but, how do I implement this so that I can run it standalone or in the container? which will require the Camel route to have a reference to the service thus depending on OSGi? Is there a way to abstract the preferences service in such a way that standalone it does not depend on the container service? thanks in advance.
type: AnsweredQuestion
score: 1
tagged with: maven
upvote count: 1
type: Question
tagged with: java
has title: Using Apache Camel Blueprint - need to persist properties inside container and standalone
has answer: http://stackoverflow.com/a/23422249
tagged with: apache-camel
tagged with: blueprint-osgi
answer count: 1
downvote count: 0
favorite count: 0
tagged with: osgi

http://stackoverflow.com/comment/35894384
type: QuestionComment
comment on: http://stackoverflow.com/q/23403306
has text: Indent your code properly
score: 0
type: Comment

war
tags question: http://stackoverflow.com/q/23324501
type: Tag
tags question: http://stackoverflow.com/q/23390109
tag name: war

http://stackoverflow.com/a/23381856
score: 0
has body: It means that the next line of code after System.exit won't be executed (because the JVM was shut down before getting there).
type: Answer
answers question: http://stackoverflow.com/q/23381780

http://stackoverflow.com/q/23365349
has comment: http://stackoverflow.com/comment/35787651
has body: my application have a requirement to save the image taken from camera to sqlite database locally on mobile, then transfer the data from database from mobile memory to computer. The problem is i am not able to display the real image back onto computer though it shows in DB that the file is saved in PNG format? ANy help would be great. :)
type: UnansweredQuestion
tagged with: android
tagged with: android-sqlite
has comment: http://stackoverflow.com/comment/35788282
answer count: 0
tagged with: java
type: Question
score: 0
has title: save the image taken from camera to SQLite database and display them on computer?

http://stackoverflow.com/a/30603313
has comment: http://stackoverflow.com/comment/139117704
type: Answer
upvote count: 11
answers question: http://stackoverflow.com/q/23308193
score: 11
has comment: http://stackoverflow.com/comment/66485890
downvote count: 0
has body: You can use java8 + rxjava. //import java.util.stream.IntStream; //import rx.Observable; IntStream intStream = IntStream.range(1,10000000); Observable.from(() -&gt; intStream.iterator()) .takeWhile(n -&gt; n &lt; 10) .forEach(n-&gt; System.out.println(n));

http://stackoverflow.com/comment/35787545
type: QuestionComment
comment on: http://stackoverflow.com/q/23363421
has text: Accidentaly, I found out that adding the removed component to another Container fixed the issue. So this problem still exists but isn't an issue to me anymore. Enough brainf*** for one day. :)
score: 0
type: Comment

http://stackoverflow.com/comment/35658384
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23294570
score: 0
has text: where do I place that ?

http://stackoverflow.com/comment/35749072
has text: [Thread interrupts](http://docs.oracle.com/javase/tutorial/essential/concurrency/interrupt.html)
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23344358
score: 0

http://stackoverflow.com/a/23343275
score: 2
upvote count: 2
accepted answer of: http://stackoverflow.com/q/23342603
has body: I agree with CommonsWare's answer - if you don't need to be doing something every second and can do it less frequently, then the best practice is to reduce the frequency as much as possible, as doing it more frequently will consume more energy. However, to address the "significant" part of your question, especially in relation to other device operations, consider this following quote based on tests on the HTC Dream (G1) and Nexus One devices, from: Aaron Carroll and Gernot Heiser, "An analysis of power consumption in a smartphone," presented at the Proceedings of the 2010 USENIX conference on USENIX annual technical conference, Boston, MA, 2010. http://www.nicta.com.au/pub?doc=3587 "The RAM, audio and ﬂash subsystems consistently showed the lowest power consumption. While our micro-benchmarks showed that the peak power of the SD card could be substantial ( 50 mW), in practice the utilisation is low enough such that on average, negligible power is consumed. Even video playback, one of the more data-intensive uses of mobile devices, showed SD power well under 1 % of total power. RAM has similar characteristics; micro-benchmarks showed that RAM power can exceed CPU power in certain workloads, but in practical situations, CPU power overshadows RAM by a factor of two or more. Audio displayed a largely static power consumption in the range of 28–34 mW. Overall, RAM, audio and SD have little effect on the power consumption of the device, and therefore offer little potential for energy optimisation." Keeping the CPU busy when it otherwise wouldn't be is likely the largest energy impact of continuously writing to the database every second, vs. writing every minute. Relatively, assuming normal usage, flash memory use in isolation consumes relatively little energy. If you're interested in additional references and discussion, see: https://stackoverflow.com/a/13004377/937715
answers question: http://stackoverflow.com/q/23342603
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/comment/35809284
has text: If you used a quantum computer you still wouldn't be able to get the largest random number
comment on: http://stackoverflow.com/q/23376639
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/35695647
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23298187
has text: @Yrlec Having read the code, it is pretty simple. More likely is that it tries to free memory more than once if anything.
score: 0

http://stackoverflow.com/comment/35722505
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23327639
score: 0
has text: i am implementing two threds running two different classes. thread 1 runs sniffer class, and thread 2 runns data saving class.

http://stackoverflow.com/comment/35880908
has text: I can open the xlsx file from within the war without issue. One possible problem though is that the xlsx file is packaged in a jar within the war, it looks like the InputStream I am getting back is the jar, not the xlsx file within the jar.
comment on: http://stackoverflow.com/q/23413835
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35839147
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/23372104
type: Comment
has text: Thanks for the help! I think i have something going on, by using the indexOf in string, i can now find the strings that match what im searching for, the problem now is that i want to return multiple books, but it will only allow to return one book. public Book searchBook(String Author2){ ArrayList<Book> kopia = new ArrayList <Book>(); for(int i = 0; i<reg.size();i++){ if(reg.get(i).getAuthor().toLowerCase().indexOf(Author2.toLowerCase()) >= 0){ kopia.add(reg.get(i)); } } for(int k = 0; k<kopia.size(); k++){ return kopia.get(k); } }

jtextpane
tags question: http://stackoverflow.com/q/23333791
tag name: jtextpane
type: Tag
tags question: http://stackoverflow.com/q/23419238

http://stackoverflow.com/comment/35731271
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23334327
has text: i have logged in jira website in this username and this password and it work correctly!!!

http://stackoverflow.com/comment/35919431
score: 3
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23435888
has text: `split` uses regex, as indicated in the doc. splitting on `+` and removing spaces is simple : `"...".split("\\s*,\\s*");`

http://stackoverflow.com/comment/35863361
type: AnswerComment
score: 0
has text: Great code, lots of help. One thing, you are adding the messages to the unreadMessages now when it has the Flag SEEN. That is quite the opposite, as these are the readMessages. So I am sticking to setting a boolean isMessageRead to true and using that to populate the list.
comment on: http://stackoverflow.com/a/23399006
type: Comment

http://stackoverflow.com/comment/35750012
comment on: http://stackoverflow.com/q/23344346
has text: I would suggest adding code and configuration examples, or else its a game of guesses. I can't believe this is default behavior of the framework (nor do I remember having this problem with Spring MVC, but I last used it when Spring 2 was still current); I'd rather suspect the framework is not being applied properly. But without having something to look at, that's me making guesses.
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/a/23445892
has comment: http://stackoverflow.com/comment/35940035
has comment: http://stackoverflow.com/comment/35939419
answers question: http://stackoverflow.com/q/23445861
type: Answer
has comment: http://stackoverflow.com/comment/35942516
has body: You're declaring the n variable locally inside of your loop, and then trying to use it elsewhere. To get the code to compile you would need to declare it in the main method or in the class. Regardless, even if the code compiled, it would still fail since you're re-creating the char array with each loop where you read in from the file. Consider either using a StringBuilder to get all the Strings, either that or reading and writing at the same time in one loop. Something like (in pseudo-code): create StringBuilder Open file to read in a Scanner or BufferedReader Loop through text of file append each String from file into the StringBuilder You probably want to append "\n" with each line added end loop close the Scanner or BufferedReader Open file to write and create a PrintWriter with it write out StringBuilder's String using toString() into the file using PrintWriter close the PrintWriter.
has comment: http://stackoverflow.com/comment/35942198
score: 0

http://stackoverflow.com/comment/35733422
type: Comment
has text: @Basti> When you get the input as a `String` you can check it against various arbitrary conditions using a powerful tool called regular expression, whilst when you try to use `readInt()` you should be sure about many things.
comment on: http://stackoverflow.com/a/23335360
type: AnswerComment
score: 0

http://stackoverflow.com/q/23294330
accepted answer: http://stackoverflow.com/a/23294677
tagged with: java
score: 0
answer count: 2
tagged with: groovy
tagged with: type-conversion
has answer: http://stackoverflow.com/a/23296441
tagged with: x509certificate
has comment: http://stackoverflow.com/comment/35702214
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/23296441
has answer: http://stackoverflow.com/a/23294677
has body: I need to convert an integer (representing x.509 KeyUsage mask) to boolean array, in Java I have following function available which is working fine: public boolean[] getKeyUsage() { int mask = 144; // Integer.parseInt(testRunner.testCase.getPropertyValue("keyUsage")); byte[] bytes = new byte[] { (byte)(mask &amp; 0xff), (byte)((mask &amp; 0xff00) &gt;&gt; 8) }; boolean[] keyUsage = new boolean[9]; for (int i = 0; i != 9; i++) { keyUsage[i] = (bytes[i / 8] &amp; (0x80 &gt;&gt;&gt; (i % 8))) != 0; } return keyUsage; } In this case (144), it should return keyUsage = {boolean[9]@976} [0] = true [1] = false [2] = false [3] = true [4] = false [5] = false [6] = false [7] = false [8] = false When running this in Groovy, I get org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: Script6.groovy: 22: expecting '}', found ',' @ line 22, column 56. w byte[] { (byte)(mask &amp; 0xff), (byte)(( ^ org.codehaus.groovy.syntax.SyntaxException: expecting '}', found ',' @ line 22, column 56. at org.codehaus.groovy.antlr.AntlrParserPlugin.transformCSTIntoAST(AntlrParserPlugin.java:140) at org.codehaus.groovy.antlr.AntlrParserPlugin.parseCST(AntlrParserPlugin.java:108) at org.codehaus.groovy.control.SourceUnit.parse(SourceUnit.java:236) at org.codehaus.groovy.control.CompilationUnit$1.call(CompilationUnit.java:162) at org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits(CompilationUnit.java:912) at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:574) at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:550) at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:527) at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:279) at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:258) at groovy.lang.GroovyShell.parseClass(GroovyShell.java:613) at groovy.lang.GroovyShell.parse(GroovyShell.java:625) at groovy.lang.GroovyShell.parse(Groovy…
type: Question
has comment: http://stackoverflow.com/comment/35702260
has comment: http://stackoverflow.com/comment/35661848
has title: Convert integer to boolean array in Groovy

http://stackoverflow.com/comment/35816343
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23380510
type: Comment
has text: @display name in web.xml will be a part of the REST URL

http://stackoverflow.com/comment/35685140
type: AnswerComment
type: Comment
has text: As now i am facing browser compatibility problem
comment on: http://stackoverflow.com/a/23293284
score: 0

http://stackoverflow.com/a/23338027
score: 0
answers question: http://stackoverflow.com/q/23337686
accepted answer of: http://stackoverflow.com/q/23337686
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35738362
type: Answer
has body: From javadoc A FlatFileItemReader is not thread safe because it maintains state in the form of a ResourceLineReader. Be careful to configure a FlatFileItemReader using an appropriate factory or scope so that it is not shared between threads.

http://stackoverflow.com/comment/35658718
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23292869
type: Comment
has text: Correction: `java.util.Date` has NO internal timezone information and only refers to UTC timezone per specification while its `toString()`-method uses the system timezone for output.

http://stackoverflow.com/comment/35717708
comment on: http://stackoverflow.com/a/23326856
score: 0
type: Comment
type: AnswerComment
has text: @user3469624 - It's impossible that the `if` test I wrote is still generating a NPE. Are you sure it's still coming from the same line? Are you sure that you correctly rebuilt the project and are running the updated code?

http://stackoverflow.com/q/23314936
tagged with: menu
has title: Create menu for more sections
type: AnsweredQuestion
type: Question
tagged with: java
has body: I'm about to create a menu box which will have more sections for ex. (avatar pictures, coupons and more stuff) but i don't really know how do i can do that, i have taken a picture to show you what i'm saying ( http://prntscr.com/3dodfw ). The red marker is where i want the menu to be so when i will choose a section in the combo box the items in the menu to be changed. If somebody can explain me or show me how i can do that i will appreciate it very much.
has answer: http://stackoverflow.com/a/23318487
accepted answer: http://stackoverflow.com/a/23318487
answer count: 1
score: 0

http://stackoverflow.com/comment/35719999
has text: Sorry I noticed that you reference R.Layout.fragment_main in your code, change this to R.layout.activity_main. The view you reference in setContentView will be inflated.
type: Comment
comment on: http://stackoverflow.com/a/23327901
type: AnswerComment
score: 0

http://stackoverflow.com/comment/57792067
has text: @Trejkaz When I switched to developing on an SSD most disk IO problems went away. I suspect it is still doing a lot of IO, but it now happens so much faster.
comment on: http://stackoverflow.com/a/23341948
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/23390250
answers question: http://stackoverflow.com/q/23369794
upvote count: 2
type: Answer
has body: It is definitely a bug in JavaFX 2.2, though there is no such a problem in JavaFX 8. The workaround , as per comment, is to override the value on every change of it: xAxis.tickLabelRotationProperty().addListener(new ChangeListener&lt;Number&gt;() { @Override public void changed(ObservableValue&lt;? extends Number&gt; observable, Number oldValue, Number newValue) { xAxis.setTickLabelRotation(-90); } });
score: 2
has comment: http://stackoverflow.com/comment/35876028
downvote count: 0

http://stackoverflow.com/q/23423552
has comment: http://stackoverflow.com/comment/35896857
tagged with: maven
tagged with: spring
type: Question
has answer: http://stackoverflow.com/a/23427787
tagged with: spring-mvc
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35901018
tagged with: java
tagged with: eclipse
linked to: http://stackoverflow.com/q/3042518
possible better answer: http://stackoverflow.com/a/23425112
has body: I am new to using Maven and Eclipse, I am following this link. Below is the pom.xml I have in my workspace: 4.0.0 com.HelloWorld SpringHelloWorld war 1.0-SNAPSHOT SpringHelloWorld Maven Webapp http://maven.apache.org <spring.version>3.0.5.RELEASE</spring.version> <jdk.version>1.6</jdk.version> org.springframework spring-core ${spring.version} org.springframework spring-web ${spring.version} org.springframework spring-webmvc ${spring.version} junit junit 3.8.1 test SpringHelloWorld org.apache.maven.plugins maven-compiler-plugin 3.0 ${jdk.version} ${jdk.version} For adding the required jars, I run the below command from command prompt: mvn eclipse:eclipse -Dwtpversion=2.0 I got the "BUILD SUCCESS" message in my console. But when I refresh the project in Eclipse IDE, I can see all the libraries are missing and the path for those jars does not exists. e.g. Description Resource Path Location Type Project 'SpringHelloWorld' is missing required library: 'C:\Users\username\.m2\repository\org\springframework\spring-aop\3.0.5.RELEASE\spring-aop-3.0.5.RELEASE.jar' SpringHelloWorld Build path Build Path Problem For this error, when I check manually, I can't see any folder named springframework inside the org folder, hence the jar is missing and the error is displaye din Eclipse IDE. I tried running the command mvn eclipse:eclipse -Dwtpversion=2.0 multiple times but of no use. Please advice how to resolve this. EDIT Below is the snapshot of the Eclipse Installations: EDIT 2 I am not getting the Maven option when I Right Click on my project in Eclipse IDE. Hence when I create the java folder under the main folder, I am not able toUpdate Project Configuration` as mentioned here. Please advice
answer count: 3
has answer: http://stackoverflow.com/a/23425112
has comment: http://stackoverflow.com/comment/35896514
has comment: http://stackoverflow.com/comment/35899776
accepted answer: http://stackoverflow.com/a/23427787
has comment: http://stackoverflow.com/comment/35899377
has answer: http://stackoverflow.com/a/23423609
score: 0
has comment: http://stackoverflow.com/comment/35898756
has title: Maven + Spring in Eclipse: Unable to find the downloaded Jars

http://stackoverflow.com/q/23451385
type: Question
has title: Implementing custom MapReduce
tagged with: concurrency
has answer: http://stackoverflow.com/a/23451575
tagged with: arraylist
score: 0
answer count: 1
has body: I'm implementing a custom MapReduce (for school, so please do not suggest using Hadoop, or existing solutions), the problem I have is "storing" intermediate data between Map and Reduce phases. I was thinking of using a ConcurrentHashMap, CHM_key == Map's_Key, and as its value an Arraylist that contained all Map's_values associated on a Map's_Key, so the reduce can simply aggregate this values. However, I can't think of a way to mutate the Arraylist instance of the CHM atomically without locking the whole collection. I understand this collection implements an putifAbsent and a replace method; actually putifAbsent is usefull because if the key does not exist I just put a new ArrayList and done. However... replacing the Arraylist is not that straightforward, because I have to obtain it, add the new value, and replace it, which can't be done atomically without locking the whole collection...
type: AnsweredQuestion
tagged with: java
tagged with: mapreduce
accepted answer: http://stackoverflow.com/a/23451575

http://stackoverflow.com/q/23329127
favorite count: 0
accepted answer: http://stackoverflow.com/a/23333893
tagged with: one-to-many
type: AnsweredQuestion
tagged with: many-to-many
has title: JOOQ pojos with one-to-many and many-to-many relations
tagged with: java
upvote count: 7
linked to: http://stackoverflow.com/q/33845239
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/23333893
downvote count: 0
possible better answer: http://stackoverflow.com/a/42483883
has answer: http://stackoverflow.com/a/42483883
tagged with: jooq
tagged with: sql
linked to: http://stackoverflow.com/q/67929458
has body: I am struggling to understand how to handle pojos with one-to-many and many-to-many relationships with JOOQ. I store locations that are created by players (one-to-many relation). A location can hold multiple additional players who may visit it (many-to-many). The database layout comes down to the following: CREATE TABLE IF NOT EXISTS `Player` ( `player-id` INT UNSIGNED NOT NULL AUTO_INCREMENT, `player` BINARY(16) NOT NULL, PRIMARY KEY (`player-id`), UNIQUE INDEX `U_player` (`player` ASC)) ENGINE = InnoDB; CREATE TABLE IF NOT EXISTS `Location` ( `location-id` INT UNSIGNED NOT NULL AUTO_INCREMENT, `name` VARCHAR(32) CHARACTER SET 'utf8' COLLATE 'utf8_bin' NOT NULL, `player-id` INT UNSIGNED NOT NULL COMMENT ' UNIQUE INDEX `U_name` (`name` ASC), PRIMARY KEY (`location-id`), INDEX `Location_Player_fk` (`player-id` ASC), CONSTRAINT `fk_location_players1` FOREIGN KEY (`player-id`) REFERENCES `Player` (`player-id`) ON DELETE NO ACTION ON UPDATE NO ACTION, ENGINE = InnoDB; CREATE TABLE IF NOT EXISTS `location2player` ( `location-id` INT UNSIGNED NOT NULL, `player-id` INT UNSIGNED NOT NULL, INDEX `fk_ location2player_Location1_idx` (`location-id` ASC), INDEX `fk_location2player_Player1_idx` (`player-id` ASC), CONSTRAINT `fk_location2player_Location1` FOREIGN KEY (`location-id`) REFERENCES `Location` (`location-id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_location2player_Player1` FOREIGN KEY (`player-id`) REFERENCES `Player` (`player-id`) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB; Within my java application, all these informations are stored within one pojo. Note that the player and the list of invited players can be updated from within the application and need to be updated in the database as well: public class Location { private final String name; private UUID player; private List&lt;UUID&gt; invitedPlayers; public void setPlayer(UUID player) { this.player = player; } public void invitePlayer(UUID player) { invitedPlayers.add(player); } public …
score: 7

http://stackoverflow.com/q/23328049
downvote count: 1
type: Question
has body: I am trying to change the color of a JFrame with no components inside it, but I can't seem to figure it out... JFrame frame = new JFrame(); frame.setTitle(""); // Attempts to change the color frame.setBackground(Color.BLACK); frame.setForeground(Color.BLACK); // Attempts to change the color frame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); frame.setResizable(false); frame.setVisible(true);
answer count: 2
upvote count: 0
has answer: http://stackoverflow.com/a/23328091
possible better answer: http://stackoverflow.com/a/65095554
favorite count: 0
score: -1
has title: Change background color of a JFrame
has answer: http://stackoverflow.com/a/65095554
tagged with: jframe
tagged with: swing
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/23328091

http://stackoverflow.com/comment/35819273
type: AnswerComment
score: 0
has text: Thanks! I have updated question with Jconsole output. swaoff -a is giving this error: swapoff: /dev/mapper/VolGroup-lv_swap: swapoff failed: Cannot allocate memory. I suppose its because RAM has not sufficient space to accomodate swap content.
type: Comment
comment on: http://stackoverflow.com/a/23357697

http://stackoverflow.com/comment/103732740
type: Comment
comment on: http://stackoverflow.com/a/23359897
score: 0
type: AnswerComment
has text: Maybe it can now be found on GitHub. https://github.com/antlr/antlr4/blob/master/doc/left-recursion.md

http://stackoverflow.com/comment/35906535
has text: @user3575404 Please update your post rather than posting long code in comments ;)
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23429089
type: AnswerComment

concurrency
tag name: concurrency
tags question: http://stackoverflow.com/q/23421372
tags question: http://stackoverflow.com/q/23329149
tags question: http://stackoverflow.com/q/23337508
tags question: http://stackoverflow.com/q/23292819
tags question: http://stackoverflow.com/q/23369952
tags question: http://stackoverflow.com/q/23345295
tags question: http://stackoverflow.com/q/23431254
tags question: http://stackoverflow.com/q/23376822
tags question: http://stackoverflow.com/q/23405314
tags question: http://stackoverflow.com/q/23451385
tags question: http://stackoverflow.com/q/23354414
tags question: http://stackoverflow.com/q/23442183
tags question: http://stackoverflow.com/q/23394518
tags question: http://stackoverflow.com/q/23325129
tags question: http://stackoverflow.com/q/23303042
tags question: http://stackoverflow.com/q/23382088
tags question: http://stackoverflow.com/q/23443124
tags question: http://stackoverflow.com/q/23399798
tags question: http://stackoverflow.com/q/23379623
tags question: http://stackoverflow.com/q/23421099
tags question: http://stackoverflow.com/q/23296260
tags question: http://stackoverflow.com/q/23380303
tags question: http://stackoverflow.com/q/23390273
tags question: http://stackoverflow.com/q/23310463
tags question: http://stackoverflow.com/q/23377592
type: Tag
tags question: http://stackoverflow.com/q/23437841
tags question: http://stackoverflow.com/q/23300038
tags question: http://stackoverflow.com/q/23392240
tags question: http://stackoverflow.com/q/23306774

http://stackoverflow.com/q/23359668
has title: Log4j2 AsyncAppender thread does not die on tomcat undeploy causing memory leak
has answer: http://stackoverflow.com/a/23361357
upvote count: 3
tagged with: log4j2
possible better answer: http://stackoverflow.com/a/63890915
type: Question
tagged with: spring-mvc
score: 3
has answer: http://stackoverflow.com/a/63890915
tagged with: java
has body: The stack I am using at the moment is: log4j2 rc1 spring 3.2 core and web tomcat 7.0.47 java 1.6.0_45 Windows 7 I don't have the ability to alter the tomcat version or java version and I would prefer not to alter the log4j version and spring version. Essentially, when I undeploy my webapp I receieve a SEVERE warning saying: SEVERE: The web application [/MyApp] appears to have started a thread named [AsyncAppender-AsyncFile] but has failed to stop it. This is very likely to create a memory leak I can confirm that it does create a memory leak and this is what I am trying to fix. So far I have attempted to create a custom ServletContextListener which contains the following code: @Override public void contextDestroyed(ServletContextEvent event) { System.out.println("Shutting down logger"); try { ((Log4jWebSupport) event.getServletContext().getAttribute( Log4jWebSupport.SUPPORT_ATTRIBUTE)).clearLoggerContext(); ((LifeCycle) LogManager.getContext()).stop(); } catch (Exception e) { } } None of these two lines seems to fix the problem, however I can confirm that this code is being executed due to my sysout statement appearing in the tomcat console. I am using log4j2 through an interceptor which I am setting up using Spring &lt;mvc:interceptors&gt; &lt;mvc:interceptor&gt; &lt;mvc:mapping path="/**" /&gt; &lt;ref bean="LoggingInterceptor"/&gt; &lt;/mvc:interceptor&gt; &lt;/mvc:interceptors&gt; &lt;bean id="LoggingInterceptor" class="MyLoggerClass"&gt; The interceptor works correctly and the logs appear where I expect them to. My implementation of the logger is: private static Logger log = LogManager.getLogger("MetricLogger"); public void log(LogPayload payload) { if(payload != null){ log.info(payload.get()); } } Where LogPayload.get() returns a String. As I am using the logging facility across multiple webapps I have created a separate jar file containing this and the classes recording the measurements. I have included this using maven and I compile it into the final war file…
accepted answer: http://stackoverflow.com/a/23361357
answer count: 3
downvote count: 0
tagged with: tomcat
favorite count: 0
tagged with: memory-leaks
has answer: http://stackoverflow.com/a/58534841
type: AnsweredQuestion

http://stackoverflow.com/a/23301693
downvote count: 0
type: Answer
has body: According to the JSON specification, null is a valid value. Jackson, which Spring uses behind the scenes, deserializes a null JSON value to a Java null reference. You'll have to do what you described and check for it in your controller. Alternatively, you can create your own HandlerMethodArgumentResolver to do that for you.
answers question: http://stackoverflow.com/q/23301070
upvote count: 2
score: 2

http://stackoverflow.com/comment/35925012
score: 0
has text: @MadProgrammer Curious, why do you say that's a better idea?
type: Comment
comment on: http://stackoverflow.com/a/23438409
type: AnswerComment

http://stackoverflow.com/a/24051333
has comment: http://stackoverflow.com/comment/39875198
upvote count: 8
answers question: http://stackoverflow.com/q/23410864
accepted answer of: http://stackoverflow.com/q/23410864
type: AcceptedAnswer
downvote count: 0
score: 8
has comment: http://stackoverflow.com/comment/61802473
type: Answer
has body: Sakai has 2 main methods for developing a new plugin (also sometimes called a tool). LTI (1.0 and 2.0) - Sakai 10 supports the IMS LTI 1 and 2 specifications (it is the first LMS to have support for both). Older versions of Sakai (2.7 or newer) support LTI 1.0. This standard allows development of a tool which runs on it's own server but integrates with the learning system via a launching protocol. Sakai tool webapp - Any Java webapp can be integrated into Sakai as a tool by adding a meta file (tool.xml), adding some parts to the web.xml, and optionally loading CSS/JS in the header and using Java APIs to access the Sakai kernel. More details about that are available in the Sakai wiki: https://confluence.sakaiproject.org/display/BOOT/Sakai+Programmer+Manual

http://stackoverflow.com/comment/35948610
comment on: http://stackoverflow.com/a/23330764
score: 0
type: AnswerComment
has text: Also, I would make PersistentCookieStore in an `@Provides` method not new it up in the CookieUtil class, so you don't end up testing your PersistentCookieStore in unit tests of CookieUtil.
type: Comment

http://stackoverflow.com/a/23337227
has comment: http://stackoverflow.com/comment/35736281
has body: char[] szData = "*KW,NR09G00001,001,082309#".toCharArray(); If you need array with 50 elements, than: char[] szData = Arrays.copyOf("*KW,NR09G00001,001,082309#".toCharArray(), 50);
score: 4
upvote count: 4
has comment: http://stackoverflow.com/comment/35736205
downvote count: 0
has comment: http://stackoverflow.com/comment/35737995
has comment: http://stackoverflow.com/comment/35736154
answers question: http://stackoverflow.com/q/23337148
has comment: http://stackoverflow.com/comment/35736337
has comment: http://stackoverflow.com/comment/35736221
type: Answer

http://stackoverflow.com/comment/35798810
comment on: http://stackoverflow.com/q/23370229
type: Comment
has text: `(?<=X) MEANS X, via zero-width positive lookbehind` from [Java Doc for Pattern](http://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html)
score: 0
type: QuestionComment

http://stackoverflow.com/comment/35783282
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23361461
has text: You are right. Works perfectly. I forgot to force 'long'. My fault. Thank You very much.
score: 0

http://stackoverflow.com/a/23395695
score: -1
upvote count: 0
has body: You will want to create a new TextView, because you declared the first TextView final. If you add an extra line in the else if statement like this, it should work: else if (!currentTags.equals("Tags: &lt;font color='#33B5E5'&gt;&lt;/font&gt;") &amp;&amp; !tagsText.isShown()) { //this line below throws the NullPointerException final TextView tagsText1 = (TextView)postDialogLayout.findViewById(R.id.newPostTagsText); ((LinearLayout)tagsText.getParent()).addView(tagsText1); }
type: Answer
answers question: http://stackoverflow.com/q/23395648
downvote count: 1

http://stackoverflow.com/q/23422804
has comment: http://stackoverflow.com/comment/35897677
has title: Elasticsearch causing java.lang.LinkageError with javax/servlet/FilterConfig on Tomcat 7
tagged with: elasticsearch
tagged with: spring
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35897267
has body: I am using Elasticsearch 1.1.1, java client and server versions are the same. Unit tests all run fine. when i start tomcat server, it has: java.lang.LinkageError: loader constraint violation: loader (instance of org/apache/catalina/loader/WebappClassLoader) previously initiated loading for a different type with name "javax/servlet/FilterConfig" and before that error, there were a lot of the following: 2014-05-02 15:07:03,954 DEBUG o.e.plugins [localhost-startStop-1] [Corsair] [D:\eclipse-indigo\plugins\org.python.pydev.jython_2.7.0.2012080220\_site] directory does not exist. a lot of that and with different folders if i remove the code that uses elasticsearch and keeping the dependency in pom.xml, server starts fine. WEB-INF/lib and my app's classpath does not have a servlet-api.jar, its only in TOMCAT_HOME/lib the part i set up an es client is as follow: if (this.client == null) { this.client = new TransportClient(ImmutableSettings.settingsBuilder(). put("cluster.name", this.cluster).build()); final String[] addresses = this.hosts.split(","); for (final String address : addresses) { final String trimmed = address.trim(); final String[] tuple = trimmed.split(":"); this.client.addTransportAddress( new InetSocketTransportAddress(tuple[0].trim(), Integer.valueOf(tuple[1].trim()))); } } The same code is used for unit tests and it passes all tests. Any pointer is much appreciated. This seems to be relevent but haven't been provided a proper solution. Linkage error when using Elasticsearch client in Spring WebApp FYI, I am also using Spring &amp; Spring MVC 4.2.5.RELEASE, Tomcat version 7.0.40 UPDATE: Thanks to this link http://lexxweb.co.uk/blog/?p=66, it turns out that it is one of the eclipse plugin which loads another version servlet-api, causing the LinkageError I've been getting.
downvote count: 0
score: 1
tagged with: java
linked to: http://stackoverflow.com/q/21043128
type: Question
accepted answer: http://stackoverflow.com/a/23439638
has comment: http://stackoverflow.com/comment/35896583
upvote count: 1
has answer: http://stackoverflow.com/a/23439638
answer count: 1
tagged with: tomcat
favorite count: 0

http://stackoverflow.com/a/23376438
has comment: http://stackoverflow.com/comment/35839437
type: Answer
accepted answer of: http://stackoverflow.com/q/23376277
has comment: http://stackoverflow.com/comment/36116767
has body: In an attempt to answer the question as asked, an SDK is a Software Development Kit. It is a collection of tools, libraries, api's, source code, licenses, examples, documentation, and/or anything else required to develop software applications in a specific programming language or framework. The integration of an SDK into an IDE is essentially the ability for an external application to leverage the capability provided by the SDK, and make programming and application writing easier for the user. The SDK configured in an IDE might provide the capability for the IDE to allow API auto-complete, object inspection, source code compile/debugging, syntax highlighting, integrated code inspection and warning/error information, just-in-time compiling, unit testing, etc. An SDK (such as Java) can be very big, containing a lot of information and capability. Other SDK's may simply be a set of API's or libraries, and as such, may not be as conducive to being used with an IDE, and could be deemed as "convenient" from the perspective of a user that is not familiar with the concept of an SDK in the "Java" sense. The IDE's capability to leverage what is provided by the SDK may be determined by a couple things: 1. The SDK doesn't provide a very comprehensive set of tools and capabilities that allow an IDE to do what it does best, and thus appear "useless" 2. The IDE just didn't implement the SDK capability all that well Hopefully this provides some insight...
answers question: http://stackoverflow.com/q/23376277
has comment: http://stackoverflow.com/comment/35836406
upvote count: 4
has comment: http://stackoverflow.com/comment/35882246
type: AcceptedAnswer
downvote count: 0
score: 4

http://stackoverflow.com/comment/35863789
comment on: http://stackoverflow.com/a/23404825
has text: @krunal first you need to understand how to store data and retrive data from local data here is a good tutorial http://www.vogella.com/tutorials/AndroidSQLite/article.html and for cursor adapter this link will give you example http://stackoverflow.com/questions/5457699/cursor-adapter-and-sqlite-example
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/35747234
type: QuestionComment
has text: I used your code and printed t[0][0] and t[0][1] and they are being added. They are being added the the array lists at those indexes.
type: Comment
score: 0
comment on: http://stackoverflow.com/q/23342988

http://stackoverflow.com/q/23434714
tagged with: jframe
tagged with: mouselistener
tagged with: swing
has body: Hi guys I'm super new to Java; I've looked around and haven't been able to find an answer to this question. Any chance you could help me? Here is an example of what I'm trying to achieve. public class FrameWork extends JFrame implements MouseListener { ... //Irrelevant to the question code public void mouseClicked(MouseEvent e){ int x = e.getX(); int y = e.getY(); if (x==1 &amp;&amp; y==1){ // This is where and when I want to draw GFXDice } }} Now the other class, all imports left out for readability. public class Board extends JPanel{ Image GFXDice1; public Board() { ImageIcon Dice1; Dice1 = new ImageIcon(this.getClass().getResource("GFX/Dice1")); GFXDice1 = Dice1.getImage(); } Now the graphics part public void paint(Graphics g){ Graphics2D g2d = (Graphics2D) g; g2d.drawImage(GFXDice, 100, 100, null); } Now for the question - I want to use the method paint from the Class Board in the Class FrameWork - But can't get it to work - any ideas ? I'm offering a bazillion units of good karma to anyone who has an idea.
type: Question
accepted answer: http://stackoverflow.com/a/23434769
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/23434769
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/35917318
has comment: http://stackoverflow.com/comment/35917140
favorite count: 0
linked to: http://stackoverflow.com/q/23346425
linked to: http://stackoverflow.com/q/23434550
type: AnsweredQuestion
has title: Java using Graphics in a Method
downvote count: 0
tagged with: drawimage

http://stackoverflow.com/comment/35931516
comment on: http://stackoverflow.com/q/23442563
score: 0
has text: @Dave - Of course it's possible. They'll just have to make their own wrapper class.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35844244
comment on: http://stackoverflow.com/a/23395252
score: 0
type: AnswerComment
has text: Thanks, thats very helpful, especially the copyright bit. I don't know how that slipped me. Your answer has already cleared up one or two confusions I had. I had simply hardcoded the load drivers, local address, port number, db name, db username and password into an 'initializer' class but it was obvious that this wasn't the right way. So these are to be stored in an xml file.
type: Comment

http://stackoverflow.com/q/23436725
type: AnsweredQuestion
has title: How do I run my client socket in seperate threads in Java?
tagged with: java
accepted answer: http://stackoverflow.com/a/23436986
type: Question
has body: I am writing a program to control multiple Pc's over a network switch. I don't know enough about mulithreading to understand how the memory is handled, but how can I call infSockeThread.start(); and have connect to ip1, ip2, ip3..? When I issue my code as is it obviously just overwrites the memory in the InfoSocket class the second time I call it. Basically, I want to run the InfoSocket class as many times as their are PCs, each with their own unique connection to each PC. For instance, I am calling this in my main class: String[] compTestArray = {"172.16.98.6", "172.16.98.3"}; for(int i = 0; i &lt; compTestArray.length; i++){ InfoSocket infSocket = new InfoSocket(compTestArray[i]); Runnable infRunnable = infSocket; Thread infSockeThread = new Thread(infRunnable); infSockeThread.start(); } And then I have my socket class: import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.net.Socket; public class InfoSocket implements Runnable { protected static Socket infoSocket; protected static PrintWriter out; protected static BufferedReader in; protected static String ip; public InfoSocket(String ipaddress){ ip = ipaddress; } @Override public void run() { System.out.println("InfoSocket Thread Started"); // TODO Auto-generated method stub String hostName = ip, fromServer = null; int portNumber = 6000; boolean socketConnected = false; while (!socketConnected) { try { Main.textArea.append("Attempting to connect to " + hostName + "\n"); Thread.sleep(5000); infoSocket = new Socket(hostName, portNumber); out = new PrintWriter(infoSocket.getOutputStream(), true); in = new BufferedReader(new InputStreamReader( infoSocket.getInputStream())); System.out.println("Connected sent to server"); // BREAK POINT fromServer = in.readLine(); while (!fromServer.equals("connect")) { Thread.sleep(1000); System.out.print("Waiting for connection response from machine"); } sendResponse(fromServer); // Break while loop beca…
answer count: 1
score: 0
has answer: http://stackoverflow.com/a/23436986
tagged with: memory-management
tagged with: sockets
tagged with: multithreading

http://stackoverflow.com/comment/35927447
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23427869
has text: @ Anubian Noob Exception in thread "main" java.lang.UnsatisfiedLinkError: D:\bio-metric\SBXPC_CORE_130330\SBXPCJavaProxy.dll: Can't find dependent libraries.
type: Comment

http://stackoverflow.com/a/23429558
has body: Always enclose JTextArea in JScrollPanel otherwise it will not work when no of rows are greater than the window height. To set the scroll position read this post How to adjust position of scroll in the scrollpane Sample code: JTextArea textArea = new JTextArea(); textArea.setEditable(false); textArea.setText("abc xyz \n\n\n\n\nabc xyz \n\n\n\n\nabc xyz \n\n\n\n\nabc xyz \n\n\n\n\nabc xyz \n\n\n\n\nabc xyz \n\n\n\n\nabc xyz \n\n\n\n\nabc xyz \n\n\n\n\nabc xyz \n\n\n\n\nabc xyz \n\n\n\n\nabc xyz \n\n\n\n\n"); JScrollPane scrollPane = new JScrollPane(textArea); // now add scrollPane to your desired panel.
has comment: http://stackoverflow.com/comment/35907657
has comment: http://stackoverflow.com/comment/35909477
upvote count: 1
has comment: http://stackoverflow.com/comment/35908209
has comment: http://stackoverflow.com/comment/35907165
has comment: http://stackoverflow.com/comment/35907153
accepted answer of: http://stackoverflow.com/q/23429373
type: AcceptedAnswer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/23429373
has comment: http://stackoverflow.com/comment/35907596
has comment: http://stackoverflow.com/comment/35908070
type: Answer
has comment: http://stackoverflow.com/comment/35907328

http://stackoverflow.com/comment/35846863
type: Comment
has text: thanks for the answer. I won't be able to verify this answer until we upgrade our server to 0.98. It might be as long as a month before I get to come back to this. :(
type: AnswerComment
comment on: http://stackoverflow.com/a/23396466
score: 0

http://stackoverflow.com/comment/35810025
type: Comment
comment on: http://stackoverflow.com/a/23371753
score: 0
type: AnswerComment
has text: Seriously? It's a one line cp statement in bash. How much easier do you want it?

http://stackoverflow.com/q/23429261
has comment: http://stackoverflow.com/comment/35906702
tagged with: user-interface
has comment: http://stackoverflow.com/comment/35909400
favorite count: 0
score: 0
has comment: http://stackoverflow.com/comment/35929607
answer count: 1
has comment: http://stackoverflow.com/comment/35906629
has body: I am creating a GUI using BlueJ - Java, i have made the entry boxes however i cant seem to add a label to go either above each one or to the left. Could anyone help me out and tell me where im going wrong ? My code is below: import javax.swing.*; import java.awt.*; import java.awt.event.*; import javax.swing.JFrame; import javax.swing.JLabel; public class Log extends JFrame { public static void main(String[] args){ Log frameTabel = new Log(); } JButton Confirm = new JButton("Confirm"); JPanel panel = new JPanel(); JLabel label1 = new JLabel("Name", JLabel.RIGHT); JTextField FullName = new JTextField(15); JTextField Address1line = new JTextField(15); JTextField postcode = new JTextField(15); JTextField Destination = new JTextField(15); JTextField Date = new JTextField(15); JTextField MilesTravelling = new JTextField(15); JLabel lblMsg = new JLabel ("Name",JLabel.LEFT); Log(){ super("Customer GUI"); setSize(300,400); setLocation(400,250); panel.setLayout(null); FullName.setBounds(70,30,150,20); Address1line.setBounds(70,80,150,20); postcode.setBounds(70,130,150,20); Destination.setBounds(70,180,150,20); Date.setBounds(70,230,150,20); MilesTravelling.setBounds(70,280,150,20); Confirm.setBounds(105,320,80,20); panel.add(lblMsg); panel.add(Confirm); panel.add(FullName); panel.add(Address1line); panel.add(postcode); panel.add(Destination); panel.add(Date); panel.add(MilesTravelling); getContentPane().add(label1); getContentPane().add(panel); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setVisible(true); } }
has title: Coding a GUI in Java however my labels never seem to appear
tagged with: jlabel
upvote count: 1
tagged with: swing
downvote count: 1
accepted answer: http://stackoverflow.com/a/23429406
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/17874717
tagged with: java
has answer: http://stackoverflow.com/a/23429406
type: Question
tagged with: bluej
linked to: http://stackoverflow.com/q/5621338

http://stackoverflow.com/q/23339903
tagged with: java
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/35759681
has answer: http://stackoverflow.com/a/23340241
possible better answer: http://stackoverflow.com/a/23340260
accepted answer: http://stackoverflow.com/a/23340241
has title: visibility difference between synchronization of field reads and volatile
tagged with: volatile
has answer: http://stackoverflow.com/a/23340260
upvote count: 3
has comment: http://stackoverflow.com/comment/35774193
favorite count: 0
tagged with: synchronization
tagged with: multithreading
tagged with: thread-synchronization
has comment: http://stackoverflow.com/comment/35743944
type: AnsweredQuestion
score: 3
linked to: http://stackoverflow.com/q/3103204
downvote count: 0
has body: I have read following article from SO Difference between synchronization of field reads and volatile here questioner writes the point of the synchronization is to ensure that the value of acct.balance that are read by this thread is current and that any pending writes to the fields of the object in acct.balance are also written to main memory. most popular answer: You are correct. please research this code: public class VolatileTest { static/* volatile */boolean done = false; public VolatileTest() { synchronized (this) { } } public static void main(String[] args) throws Exception { Runnable waiter = new Runnable() { public void run() { while (!done) ; System.out.println("Exited loop"); } }; new Thread(waiter).start(); Thread.sleep(100); // wait for JIT compilation synchronized (VolatileTest.class) { done = true; } System.out.println("done is true "); } } On my pc this program doesn't terminate. Thus I think that if I change volatile variable I will see actual value in another thread for any outstanding everywhere! if I change variable in synchronized section with monitor "A" I will see actual value only in synchronized section with monitor "A"(for example in another thread) Am I correct ?

http://stackoverflow.com/a/23307936
has body: The better option for large number of files transfer is to use ftp protocol. For that you need an ftp server. And, using org.apache.commons.net.ftp.FTPClient you may upload files in to the server (and also various file management). The storeFile(String, InputStream) method of org.apache.commons.net.ftp.FTPClient can give the file upload status, i.e. if the file is uploaded successfully it will return true otherwise false. Please refer this link for a sample program.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23307737

http://stackoverflow.com/comment/35960583
score: 0
comment on: http://stackoverflow.com/q/23428369
type: QuestionComment
type: Comment
has text: @DaveC yes. I have separate methods. and there are different methods for different buttons. What robotium does is click on the first button and then skip the middle once and click on the very last button. when what I want to do is click on each button and check whether it's working.

http://stackoverflow.com/a/23401550
has comment: http://stackoverflow.com/comment/35879978
score: 1
accepted answer of: http://stackoverflow.com/q/23397949
answers question: http://stackoverflow.com/q/23397949
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/35972195
type: Answer
has comment: http://stackoverflow.com/comment/35881350
has body: @monsky, This is an interesting question. Jacoco gives you the flexibility to include or exclude a specific set of classes in your coverage. IF you want to find code coverage of only dependent classes, you can do 2 things. Find out recursively all the dependent sub-modules of the class that need to be covered. Using this, when you invoke Jacoco, mention an explicit list of classes that you want to include coverage for. You can do this using the includes element of Jacoco . http://www.eclemma.org/jacoco/trunk/doc/ant.html In case you have a ready list of files that you want to cover, just mention it in the includes syntax, you do not have to generate a dynamic list of dependencies. I would however go with 1. You can use intellij IDe to do it as well http://jetbrains.com/idea/webhelp/analyzing-dependencies.html
upvote count: 1

http://stackoverflow.com/comment/35851666
type: AnswerComment
has text: @user3131055 Thats because i didnt change anything until now. The first block of code in my answer is YOUR code; its the part thats causing the problem. Ive updated my answer with the solution
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23399624

http://stackoverflow.com/q/23420268
tagged with: spring-mvc
has answer: http://stackoverflow.com/a/23426842
has answer: http://stackoverflow.com/a/23421897
tagged with: java
has body: I have maven setting up environment variable for me &lt;configuration&gt; &lt;systemPropertyVariables&gt; &lt;spring.active.profiles&gt;development&lt;/spring.active.profiles&gt; &lt;/systemPropertyVariables&gt; &lt;/configuration&gt; Then I have two profile classes @Profile("development") public class MockIfsClient implements IFSClient { @Nonnull @Override public String getPayload() { return "MockIFS"; } } and @Configuration @Profile("production") public class RestIfsClient implements IFSClient { @Nonnull @Override public String getPayload() { return "REST IFS Client"; } } and a manager public class IFSManager { private IFSClient ifsClient; @Autowired public IFSManager(@Nonnull final IFSClient ifsClient) { this.ifsClient = ifsClient; System.out.println(ifsClient.getPayload()); } } When I try to test this and see that the injected bean is MockIFSClient, it fails @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(classes = {IFSManager.class, MockIfsClient.class, RestIfsClient.class},loader=AnnotationConfigContextLoader.class) public class IFSManagerTest { @Autowired private IFSManager ifsManager; @Test public void testMockIfsClient() throws Exception { System.out.println(System.getProperty("spring.active.profiles")); assertTrue(true); } } Error I see is Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.yahoo.pryme_services.external_services.ifs.IFSClient] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@javax.annotation.Nonnull(when=ALWAYS)} I am newbie to Spring and not sure what wrong I am doing UPDATE If I remove @Profile annotation, it fails @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(classes = { IFSManager.class, RestIfsClient.class, MockIfsClient.class }, loader = AnnotationConfigContextLoader.class) public class IFSManagerTest { @Autowired private IFSManager ifsManager; @Test public void testM…
type: Question
has comment: http://stackoverflow.com/comment/35891759
has comment: http://stackoverflow.com/comment/35891632
score: 0
answer count: 2
has title: Spring @Profile Annotation not working in tests
has comment: http://stackoverflow.com/comment/35890586
has comment: http://stackoverflow.com/comment/35890543
has comment: http://stackoverflow.com/comment/35890621
type: UnansweredQuestion
tagged with: maven
tagged with: spring

http://stackoverflow.com/a/23393460
has comment: http://stackoverflow.com/comment/35839762
has comment: http://stackoverflow.com/comment/35842309
type: AcceptedAnswer
downvote count: 0
has body: This is the answer to your now modified question: @Override public boolean canScrollHorizontally(int direction) { final int offset = computeHorizontalScrollOffset(); final int range = computeHorizontalScrollRange() - computeHorizontalScrollExtent(); if(range == 0){ return false; } return (direction &lt; 0) ? (offset &gt; 0) : (offset &lt; range - 1); } protected void onScrollChanged(int l, int t, int oldl, int oldt) { left .setVisibility(canScrollHorizontally(-1) ? View.VISIBLE : View.GONE); right.setVisibility(canScrollHorizontally( 1) ? View.VISIBLE : View.GONE); } I would recommend Drawables over using Views'. So, I've extended HorizontalScrollView and overridden the draw() method to draw its own Drawable's to the canvas for the indicators. The rest of it is simply managing the position of them using setBounds, and now a pressed state. Code: https://gist.github.com/slightfoot/4c017f776663bf6dd5d8#file-indicatedhorizontalscrollview-java
has comment: http://stackoverflow.com/comment/35840016
type: Answer
has comment: http://stackoverflow.com/comment/36676123
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/23393365
accepted answer of: http://stackoverflow.com/q/23393365

http://stackoverflow.com/q/23298418
type: AnsweredQuestion
tagged with: if-statement
score: -2
tagged with: java
type: Question
possible better answer: http://stackoverflow.com/a/23298476
upvote count: 0
has answer: http://stackoverflow.com/a/23298476
accepted answer: http://stackoverflow.com/a/23298466
has title: Why is the "else" branch executed along with one of the "if" branches?
has comment: http://stackoverflow.com/comment/35665723
has body: I have a problem and know wat do do with this. Here's the piece of code of a function. if(rClass.equals("SavingsAccount")) { account = new SavingsAccount(rId,rName,start, end); } if(rClass.equals("DraftAccount")) { account = new DraftAccount(rId,rName,start, end); } if(rClass.equals("VIPAccount")) { account = new VIPAccount(rId,rName,start, end); } else { account = null; } The variable String rClass is read from a file and it is 100% "SavingsAccount" but it jumps all the lines and at the end i have account = null, why?? Even tried to put this after the if's: String rClass = "SavingsAccount"; The result is the same.
answer count: 4
favorite count: 0
has answer: http://stackoverflow.com/a/23298482
has comment: http://stackoverflow.com/comment/35666021
downvote count: 2
has answer: http://stackoverflow.com/a/23298466
has comment: http://stackoverflow.com/comment/35665783
has answer: http://stackoverflow.com/a/23298491

http://stackoverflow.com/comment/35784465
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23363421
has text: Just adjusted my code example. But still the problem is that in this example everything works properly, but not in my project. So I am searching for ideas what could've been the problem.
score: 0

http://stackoverflow.com/comment/35941537
comment on: http://stackoverflow.com/a/23446336
has text: I will suggest that you debug your code in debugger. Step through it to find whats going on. If you try to find book that you have not added then sure you will get that message.
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/35689632
score: 1
comment on: http://stackoverflow.com/q/23311574
type: Comment
has text: `Vehicle tv=new Vehicle();` is legal and `Vehicle tv=new Truck();` is legal. But what you've written isn't because a Vehicle isn't a Truck (even though a Truck is a vehicle)
type: QuestionComment

http://stackoverflow.com/a/23321516
has comment: http://stackoverflow.com/comment/63480747
has body: Yes It's a view. The underlying data structure is the same.
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 3
accepted answer of: http://stackoverflow.com/q/23321490
has comment: http://stackoverflow.com/comment/63480851
upvote count: 3
answers question: http://stackoverflow.com/q/23321490

http://stackoverflow.com/a/23325506
type: AcceptedAnswer
score: 4
answers question: http://stackoverflow.com/q/23325133
accepted answer of: http://stackoverflow.com/q/23325133
type: Answer
upvote count: 4
has body: If you are just displaying the text, you can use a VBox (for example) containing a collection of Labels or Texts, and then set the style on each one. If you are using Java 8, there's also a specialized TextFlow container available. None of those will create text that can be selected and copied. If you need that functionality too, there's a third party library that will provide that: RichTextFX.
downvote count: 0

http://stackoverflow.com/comment/35898251
type: Comment
comment on: http://stackoverflow.com/q/23424312
type: QuestionComment
has text: Agreed but the difficulty here is it being packaged with STS - does this perhaps make it the more supported product to use in this case?
score: 1

http://stackoverflow.com/q/23432666
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35913402
has comment: http://stackoverflow.com/comment/35913616
has comment: http://stackoverflow.com/comment/35913435
has comment: http://stackoverflow.com/comment/35913354
has body: I've been looking at this all the morning and I am starting to get desperate. I have datatable and inside it var="message". &lt;h:dataTable value="#{usuarioMBean.usuario.recibidos}" var="message" id="messages" &gt; Message is a class that contains member recibe private Usuario recibe; I know the datatable works correctly and that the message is being set because when I try to use it without if, when or choose statements, it works. One of my messages is null, however, when I try to check whether it is null, it doesn't work. &lt;h:outputText rendered="#{empty message.recibe}" value="text" /&gt; &lt;c:choose&gt; &lt;c:when test="${empty message.recibe}"&gt; Queja &lt;/c:when&gt; &lt;c:otherwise&gt; #{message.recibe.nombre} #{message.recibe.apellidos} &lt;/c:otherwise&gt; &lt;/c:choose Concretely, the h:outputText is never shown, neither is Nombre and Apellidos. However, Queja is shown always. What I am trying to do is simply write "Queja" when the recibe is null. Thanks.
tagged with: java
has title: JSF checking on null error not working?
has comment: http://stackoverflow.com/comment/35966020
has comment: http://stackoverflow.com/comment/35913716
type: Question
tagged with: jsf-2
has comment: http://stackoverflow.com/comment/35913570
linked to: http://stackoverflow.com/q/3342984
has comment: http://stackoverflow.com/comment/35913688
has comment: http://stackoverflow.com/comment/35913452
has comment: http://stackoverflow.com/comment/35913187
has comment: http://stackoverflow.com/comment/35913330
has comment: http://stackoverflow.com/comment/35914344
score: 0
tagged with: view
answer count: 0
tagged with: jsf

http://stackoverflow.com/a/27895280
upvote count: 4
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/23345822
has body: Your question (at time of this writing) isn't very detailed about your specific test setup for grid deployment. So an exact answer can't be proposed as it depends on how your environment is set up. The simplest approach is to use PSExec.exe, telnet, or SSH to remotely call AutoIt on the node machine from your test execution machine. A simple example is given below, note that I have not tested the code, but should work with minor tweaks if needed. String cmd = "C:\\LocalMachinePathTo\\psexec.exe \\\\%s -u %s -p %s -i C:\\GridNodeMachinePathTo\\autoit.exe"; Process p = Runtime.getRuntime().exec(String.format(cmd,gridNodeHostName,gridNodeWindowsLoginUserName,gridNodeWindowsLoginPassword); p.waitFor(); The simple example assumes you use the native local desktop (or console/head) session of the grid node machine for running automated tests, and not using a remote desktop session to the grid node. If the latter, you would then need to supply a session ID after the -i parameter to psexec.exe. You can find more info on PSExec.exe here: http://technet.microsoft.com/en-us/sysinternals/bb897553.aspx The code presented is simple example, you may prefer to add additional logic to check if test is executing locally or over grid, where if executing locally, your command can omit use of psexec and just call autoit.exe directly. Read these blog posts for more details/insight into making AutoIt run with tests on Selenium grid: https://autumnator.wordpress.com/2015/01/22/integrating-autoit-sikuli-and-other-tools-with-selenium-when-running-tests-in-selenium-grid/ https://autumnator.wordpress.com/2011/12/22/autoit-sikuli-and-other-tools-with-selenium-grid/
score: 4

http://stackoverflow.com/comment/35681436
has text: And please make sure the spring version you use is 3.x above. :)
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23306887

http://stackoverflow.com/comment/35877833
comment on: http://stackoverflow.com/a/23412883
has text: Also, for the next questions, please put some minimal code here, not all this quantity of code ;) You may need to re-work / edit your code so that we better understand your problem and your need.
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/35951269
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23452881
type: Comment
has text: @Raghunandan I have uploaded the screenshot

database-connection
tags question: http://stackoverflow.com/q/23303206
type: Tag
tags question: http://stackoverflow.com/q/23414059
tag name: database-connection

http://stackoverflow.com/q/23304483
score: 0
has comment: http://stackoverflow.com/comment/35676784
answer count: 3
has answer: http://stackoverflow.com/a/23304697
upvote count: 1
downvote count: 1
has title: Tree that sorts classes hierarchicly
possible better answer: http://stackoverflow.com/a/23304563
tagged with: tree
has answer: http://stackoverflow.com/a/23318359
accepted answer: http://stackoverflow.com/a/23304697
tagged with: java
tagged with: class
has comment: http://stackoverflow.com/comment/35676799
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35676896
tagged with: data-structures
favorite count: 0
has comment: http://stackoverflow.com/comment/35677073
type: Question
tagged with: hierarchy
has body: I need a tree-structure that sorts all added classes hierarchically. I have to get all classes that inherit one certain class. That one particular read access needs to be very fast. Example: I add the following classes. public static class Event { } public static class PlayerEvent extends Event { } public static class PlayerMoveEvent extends PlayerEvent { } public static class WorldEvent extends Event { } It should sort the classes like this: https://i.sstatic.net/EqehS.png
has answer: http://stackoverflow.com/a/23304563

http://stackoverflow.com/comment/35926944
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23439802
has text: Apologies but would you be able to provide an example ?
type: Comment

http://stackoverflow.com/q/23322919
tagged with: orm
type: Question
possible better answer: http://stackoverflow.com/a/23323410
has body: I'm working on website where user can subscribe to Organisation. when I'm going to implement Subscribe function and I face the following problem. In sort I want to create model class of ManyToMany join table for retrieve rows from table to check which Organisations are subscribe by user. And In Hibernate I can't create Table without primary key.but in join table one user can subscribe to many organisation and one organisation has many subscriber so primary key are repeat and I got exception ERROR: Duplicate entry '1' for key 'PRIMARY'. hibernate.cfg.xml contain <mapping class="model.User"/> <mapping class="model.Post"/> <mapping class="model.UserSubscribes"/> User.java package model; @Entity @Table(name="user", uniqueConstraints = {@UniqueConstraint(columnNames={"email"})} ) @org.hibernate.annotations.Entity(dynamicUpdate=true,selectBeforeUpdate=true) public class User implements Serializable { @Id @GeneratedValue(strategy=GenerationType.IDENTITY) private long userId;//1 private String email;//1 private String password;// public User(long userId, String email, String password){ this.userId = userId; this.email = email; this.password = password; } @ManyToMany(fetch = FetchType.LAZY) @JoinTable( name="UserSubscribes", joinColumns={ @JoinColumn(name="userId",referencedColumnName="userId") }, inverseJoinColumns={ @JoinColumn(name="orgId", referencedColumnName="orgId") } ) private Collection<Organisation> orgSubscribes = new ArrayList<Organisation>(); //Getter & Setter } Organisation.java package model; @Entity @Table(name="org", uniqueConstraints = {@UniqueConstraint(columnNames={"email"})} ) @org.hibernate.annotations.Entity(dynamicUpdate=true,selectBeforeUpdate=true) public class Organisation implements Serializable { @Id @GeneratedValue(strategy=GenerationType.IDENTITY) private long orgId; private String email; private String password; public Organisation(long orgId, String email, String password){ this.orgId = orgId; this.email = email; this.password = password; } /…
has title: HQL query for retrive rows from ManyToMany Join Table
has answer: http://stackoverflow.com/a/23323410
accepted answer: http://stackoverflow.com/a/23323051
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/35710264
type: AnsweredQuestion
tagged with: many-to-many
has answer: http://stackoverflow.com/a/23323051
tagged with: java
tagged with: hibernate
linked to: http://stackoverflow.com/q/3475171

http://stackoverflow.com/comment/35992544
has text: The pom on it's own is very limited. Would you mind add the output of `mvn dependency:tree`? Upgrading to the aforementioned versions should explicitly point to the JAR that is offending.
type: Comment
comment on: http://stackoverflow.com/a/23442362
score: 0
type: AnswerComment

http://stackoverflow.com/comment/35932843
comment on: http://stackoverflow.com/a/23441488
type: Comment
has text: @Parthe I don't know what your first sentence means. I tried it with calling `setMaximum()` and without calling `setProgress()` and it did work. Your `DataInputStream` should be above the `ProgressMonitorInputStream` if you're going to call methods on it, otherwise the `ProgressMonitor` can't possibly be aware of any progress being made. I suggested calling `read(byte[])` rather than the one-byte `read()` which is all that your posted code exhibits. I can't comment on code you haven't posted.
score: 0
type: AnswerComment

http://stackoverflow.com/a/23329007
downvote count: 0
has body: You have to include an &lt;#if value_has_next&gt;,&lt;/#if&gt; statement. This may help: &lt;#assign seq = ["winter", "spring", "summer", "autumn"]&gt; &lt;#list seq as x&gt; ${x_index + 1}. ${x}&lt;#if x_has_next&gt;,&lt;/#if&gt; &lt;/#list&gt; will output: winter, spring, summer, autumn See this and more examples at: http://freemarker.org/docs/ref_directive_list.html
type: Answer
accepted answer of: http://stackoverflow.com/q/23328981
upvote count: 19
score: 19
answers question: http://stackoverflow.com/q/23328981
has comment: http://stackoverflow.com/comment/83162224
has comment: http://stackoverflow.com/comment/120596171
type: AcceptedAnswer

http://stackoverflow.com/q/23423944
tagged with: java
has comment: http://stackoverflow.com/comment/35897155
type: Question
has body: I use this code in all my app fragments and it should be better if I use a static method. How can I do it? This static method should also works on fragment, not only activities. My not static showToast method: public void showToast(String msg){ Toast.makeText(getActivity().getApplicationContext(), msg, Toast.LENGTH_SHORT).show(); } SOLVED BY USING THIS STATIC METHOD thanks @KishanDhamat public static void showToast(Context context, String text) { Toast.makeText(context, text, Toast.LENGTH_LONG).show(); }
possible better answer: http://stackoverflow.com/a/23423973
downvote count: 5
has answer: http://stackoverflow.com/a/23423973
accepted answer: http://stackoverflow.com/a/23423970
answer count: 3
has comment: http://stackoverflow.com/comment/35897516
has answer: http://stackoverflow.com/a/41211268
favorite count: 0
upvote count: 2
tagged with: android
score: -3
has title: Create Toast by a static method
has comment: http://stackoverflow.com/comment/35897395
type: AnsweredQuestion
tagged with: android-fragments
has answer: http://stackoverflow.com/a/23423970

http://stackoverflow.com/q/23364741
has comment: http://stackoverflow.com/comment/35798683
type: Question
score: 0
answer count: 2
has body: I have a db with 5 data - id (PK, int) - question (varchar) - result (varchar) - left_id (int) - right_id (int) and 2 foreign keys into the same table - left_id -> id - right_id -> id How can i map foreign key ? with @one-to-one or @many-to-one ? for the time being my hbm like this <column name="id" /> <generator class="assigned" /> <column name="question" /> <column name="result" /> Like this, my project starts.But if i put column left/right_id my project stops because I have 2 identical column. While for me, i just put id, question and result column with my foreign keys ... here my table structure CREATE TABLE "id INT auto_increment NOT NULL PRIMARY KEY, question varchar(250), result varchar(250), left_id INT, foreign key (left_id) references node(id) on delete cascade, right_id INT, foreign key (right_id) references node(id) on delete cascade" Thanks
has answer: http://stackoverflow.com/a/23388379
has comment: http://stackoverflow.com/comment/35786628
tagged with: mapping
type: UnansweredQuestion
tagged with: mysql
has answer: http://stackoverflow.com/a/23367309
has comment: http://stackoverflow.com/comment/35797441
tagged with: java
tagged with: hibernate
has title: Mapping foreign key into the same table

http://stackoverflow.com/comment/35701420
type: Comment
type: QuestionComment
has text: Without seeing more of your code it's just a guess, but my guess is your not recreating "s" on your client side, so your reusing the connection, your server only sends an IMG to new connections.
score: 0
comment on: http://stackoverflow.com/q/23318002

http://stackoverflow.com/a/23383653
has comment: http://stackoverflow.com/comment/35824434
has comment: http://stackoverflow.com/comment/35821685
has comment: http://stackoverflow.com/comment/35822769
answers question: http://stackoverflow.com/q/23383553
score: 0
has comment: http://stackoverflow.com/comment/35822567
type: Answer
has body: Just open a java.io.FileOutputStream with append mode and just write your single String. Use the following constructor of this class is: FileOutputStream(String name, boolean append) This is for appending to the end of the file. You can use java.io.RandomAccessFile for editing anywhere inside a file. EDIT: Sample code to achieve the task using RandomAccessFile. import java.io.RandomAccessFile; import java.util.ArrayList; import java.util.List; public class InsertPenultimateLine { private static String nl = System.getProperty("line.separator"); private static void usingRAF() throws Exception { String fileName = "somefile.txt"; String myLine = "blah-blah-blah"; RandomAccessFile raf = new RandomAccessFile(fileName, "rw"); List&lt;Byte&gt; bytes = new ArrayList&lt;Byte&gt;(); long len = raf.length(); long index = len-1; for(;index&gt;0;index--) { raf.seek(index); byte b = raf.readByte(); if(b == 10) { break; } bytes.add(0, b); } byte[] rawBytes = new byte[bytes.size()]; for(int j=0;j&lt;bytes.size();j++) { rawBytes[j] = bytes.get(j); } String str = new String(rawBytes); str = myLine + nl + str; raf.seek(index + 1); raf.write(str.getBytes()); raf.close(); } public static void main(String[] args) throws Exception { usingRAF(); } }

http://stackoverflow.com/a/30086103
answers question: http://stackoverflow.com/q/23441643
type: Answer
score: 0
has body: I used this command and it is working flume-ng agent --conf /etc/flume-ng/conf/ -f /etc/flume-ng/conf/flume.conf - Dflume.root.logger=DEBUG,console -n TwitterAgent

http://stackoverflow.com/a/23830518
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23447984
type: Answer
has body: I discovered, as the stacktrace shows, that the problem had to do with the int. I ended up going in a slightly different direction, but one that I hope is cleaner: /* * cancelOrder servlet looks for the cookies associated * with the shopping cart confirmation page */ import java.io.*; import javax.servlet.*; import javax.servlet.http.*; import java.util.*; import java.text.*; import java.util.concurrent.TimeUnit; public class cancelOrder extends HttpServlet { //sets initial values for what we will retrieve //from the cookie String confirmNumber = "0"; String shippingDate = "01/01/2000"; Date date; /** Processes requests for both HTTP GET and POST methods. * @param request servlet request * @param response servlet response */ public static long getDateDiffInDays(Date date1, Date date2) { long diffInMillis = date2.getTime() - date1.getTime(); return TimeUnit.MILLISECONDS.toDays(diffInMillis); } protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, java.io.IOException { //gets the fields that the user filled String enteredConfirmNumber = request.getParameter("ConfirmationNumber"); //gets cookie value if it matches user input Cookie[] cookies = request.getCookies(); Cookie cookie; for(int i=0; i<cookies.length; i++) { cookie = cookies[i]; String foundCookie = cookie.getName(); //converts cookie name from string //to integer if(foundCookie.equals(enteredConfirmNumber)) { confirmNumber = foundCookie; shippingDate = cookie.getValue(); } } SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy"); try { date = formatter.parse(shippingDate); } catch (ParseException e) { e.printStackTrace(); } //converts shippingDate from string //to calendar format Calendar shipDate = Calendar.getInstance(); shipDate.setTime(date); //gets today's date in calendar format Calendar today = Calendar.getInstance(); //unsure if this will throw int or string long daysTillShip = getDateDiffInDays(today.getTime(), shipDate.getTime()); i…
accepted answer of: http://stackoverflow.com/q/23447984
score: 0

http://stackoverflow.com/comment/35857038
type: AnswerComment
type: Comment
has text: @kleopatra F2 still works as it's included in the InputMap list (see above). Also no doubt one could put a KeyListener on the JTable which would start editing with all keys which actually print something. In my opinion that should really be the default behaviour with autoStartsEdit = True...
comment on: http://stackoverflow.com/a/23376059
score: 0

http://stackoverflow.com/q/23396009
tagged with: java
type: Question
has body: I have an error using id3 lib : music = new MP3File(currentFile); if (music.hasID3v2Tag()){ ID3v2_2 tags = (ID3v2_2) music.getID3v2Tag(); String artiste = artistTF.getText(); if (artiste == null || artiste.isEmpty()) artiste = ""; tags.setLeadArtist(artiste); String titre = titleTF.getText(); if (titre == null || artiste.isEmpty()) titre = ""; tags.setSongTitle(titre); music.setID3v2Tag(tags); music.save(); } and getting this exception: java.lang.ClassCastException: org.farng.mp3.id3.ID3v2_3Frame cannot be cast to org.farng.mp3.id3.ID3v2_4Frame
has title: ClassCastException id3 lib
downvote count: 0
favorite count: 0
tagged with: id3lib
answer count: 0
upvote count: 3
type: UnansweredQuestion
score: 3
has comment: http://stackoverflow.com/comment/35844876

http://stackoverflow.com/a/67994769
score: 0
answers question: http://stackoverflow.com/q/23403442
has body: you can store the value in a class as an attribute, if it not solve your problem you can serialize the value to restore when you want.
type: Answer

http://stackoverflow.com/q/23315636
score: -1
has comment: http://stackoverflow.com/comment/35696953
type: Question
has answer: http://stackoverflow.com/a/23315649
answer count: 1
tagged with: inheritance
favorite count: 0
tagged with: class
has title: Java: Extending a Class
linked to: http://stackoverflow.com/q/1197634
accepted answer: http://stackoverflow.com/a/23315649
tagged with: super
downvote count: 2
duplicate of: http://stackoverflow.com/q/1197634
upvote count: 1
has body: I'm trying to extend my Vehicle class to a HumanPowered class -- Has a field for calories per hour. This is my first time trying to extend a class so I'm a bit confused here. class Vehicle { String description; String idNumber; int numWheels; public Vehicle(String aDescription, String aIdNumber, int aNumWheels) { description = aDescription; idNumber = aIdNumber; numWheels = aNumWheels; } void setDescription (String aDescription) { description = aDescription; } void setIdNumber (String aIdNumber) { idNumber = aIdNumber; } void setNumWheels (int aNumWheels) { numWheels = aNumWheels; } public String getDescription() { return description; } public String getIdNumber() { return idNumber; } public int getNumWheels() { return numWheels; } public String toString() { String result= String.format("ID: %s Description: %s Wheels: %d",idNumber,description,numWheels); return result; } } class humanPowered extends Vehicle { int calories; public humanPowered(String aDescription, String aIdNumber, int aNumWheels, int aCalories) //Error here { description = aDescription; idNumber = aIdNumber; numWheels = aNumWheels; calories = aCalories; } void setCalories (int aCalories) { calories = aCalories; } public int getCalories() { return calories; } public String toString() { String result= String.format("ID: %s Description: %s Wheels: %d Calories per Hour: %d",idNumber,description,numWheels, calories); return result; } } I'm getting an error marked above on my constructor for my humanPowered class saying "Implicit super constructor Vehicle() is undefined. Must explicitly invoke another constructor." I can't figure out where I'm going wrong here. Thanks for any and all help!
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/42471356
has text: The question indicates that A, B and C are 30 bit long numbers. 2^30 has the 31st bit set and overflows the 30-bit limit. Which is the correct question, 2^30 or 30-bits?
score: 0
comment on: http://stackoverflow.com/q/23397829
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23370351
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: use list.remove(0) to remove 1st element from list List&lt;String&gt; vals = Modes.get("mode"); vals.remove(0); System.out.println(vals); use this code and check the output String test = "mode,A,B,C,D,E,F,G,H"; test = test.replaceAll("mode,", ""); System.out.println(test);
score: 1
accepted answer of: http://stackoverflow.com/q/23370229
has comment: http://stackoverflow.com/comment/35797664
answers question: http://stackoverflow.com/q/23370229
upvote count: 1

http://stackoverflow.com/a/23330169
type: Answer
score: 0
has comment: http://stackoverflow.com/comment/35724380
has body: This should a bug of Android ICS framework. Try to add this permissions: &lt;uses-permission android:name="android.permission.INTERNET" /&gt; &lt;uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /&gt; After, compile, performs a cleaning and finally rebuild the project.
answers question: http://stackoverflow.com/q/23329590

linked-list
tags question: http://stackoverflow.com/q/23331507
tags question: http://stackoverflow.com/q/23443175
tag name: linked-list
tags question: http://stackoverflow.com/q/23293890
tags question: http://stackoverflow.com/q/23420322
type: Tag
tags question: http://stackoverflow.com/q/23324890
tags question: http://stackoverflow.com/q/23330388
tags question: http://stackoverflow.com/q/23423160
tags question: http://stackoverflow.com/q/23401884
tags question: http://stackoverflow.com/q/23430579
tags question: http://stackoverflow.com/q/23309427
tags question: http://stackoverflow.com/q/23426514
tags question: http://stackoverflow.com/q/23391435
tags question: http://stackoverflow.com/q/23428073
tags question: http://stackoverflow.com/q/23302096
tags question: http://stackoverflow.com/q/23349506
tags question: http://stackoverflow.com/q/23428578
tags question: http://stackoverflow.com/q/23330664
tags question: http://stackoverflow.com/q/23325457
tags question: http://stackoverflow.com/q/23297720
tags question: http://stackoverflow.com/q/23331516
tags question: http://stackoverflow.com/q/23374473
tags question: http://stackoverflow.com/q/23366401

http://stackoverflow.com/q/23362249
downvote count: 0
has title: Joda-Time: How to get the day from a particular date in a year?
favorite count: 0
has comment: http://stackoverflow.com/comment/35782561
has answer: http://stackoverflow.com/a/23364801
tagged with: datetime
has comment: http://stackoverflow.com/comment/35793730
has comment: http://stackoverflow.com/comment/35782490
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35782958
upvote count: 3
tagged with: java
tagged with: date
tagged with: calendar
type: Question
tagged with: jodatime
accepted answer: http://stackoverflow.com/a/23364801
has comment: http://stackoverflow.com/comment/35782799
has comment: http://stackoverflow.com/comment/35782092
answer count: 1
has comment: http://stackoverflow.com/comment/35782209
has body: I have a list of holidays in a year. I need the following things. I need to get all the dates in a year. Then I need to remove all the holidays and get the remaining dates. Something like: Get dates (all dates in a year) Get holiday dates (I already have them stored in a database) Get dates - holiday dates Against a particular date, I need to know what day it is (Monday? Tuesday? What day?) QUESTION:- Using the Joda-Time library, please share the simplest way of getting it done.
score: 3

http://stackoverflow.com/comment/35911228
has text: Thatsn was the approach i took in the end, the idea behind the beans was that I has singleton objects that can be called at anytime. Now I have them in an static collection that can easily be called from anywhere in the application.
comment on: http://stackoverflow.com/q/23427502
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23391197
tagged with: awt
answer count: 1
has body: I have a function to draw on JPanelu, but does not change my color. always displays the white squares . Method set.Color doesn't work. public void paint(Graphics g){ super.paint(g); draw(); } public void draw(){ Graphics g = map.getGraphics(); int xx = map.getSize().width; int yy = map.getSize().height; for(int i = 0; i &lt; (first+second); i++){ if(i &lt; first){ g.setColor( Color.red ); g.clearRect( (3*x+1)*(xx/x/3), (3*y+1)*(yy/y/3),(xx/x/3) , (yy/y/3) ); }else{ g.setColor(Color.black ); int j = i - first; g.clearRect( (3*x+1)*(xx/x/3), (3*y+1)*(yy/y/3),(xx/x/3) , (yy/y/3) ); } } }
favorite count: 0
score: -1
type: UnansweredQuestion
downvote count: 2
has title: setColor on void Paint()
tagged with: java
upvote count: 1
type: Question
tagged with: graphics
has answer: http://stackoverflow.com/a/23391347

http://stackoverflow.com/q/23414957
accepted answer: http://stackoverflow.com/a/23415305
downvote count: 0
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/23432516
score: 1
has title: ASTVisitor Class Definition node
answer count: 2
possible better answer: http://stackoverflow.com/a/23432516
upvote count: 1
tagged with: java
has body: I have been using the ASTVisitor class in Eclipse in order to take data at Method Declaration and Method Invocation nodes. I now also want to take data at Class Declaration nodes, but I can't find anything in the API for the ASTVisitor that would allow me to do this. Am I missing something? What would be a good way to do this?
tagged with: eclipse
has answer: http://stackoverflow.com/a/23415305
tagged with: abstract-syntax-tree
type: AnsweredQuestion

http://stackoverflow.com/comment/35671799
score: 11
has text: yes, yes it does.
comment on: http://stackoverflow.com/q/23301775
type: QuestionComment
type: Comment

http://stackoverflow.com/a/23413148
score: 2
answers question: http://stackoverflow.com/q/23411189
downvote count: 0
has body: You can't mix two mimetypes on the page like you're trying to do. Take all the HTML out. After these two lines response.setContentType("application/pdf"); response.setHeader("content-disposition", "attachment;filename=Donation Report.pdf"); All that should be done is you should print out the bytes of the PDF file. And you probably will have to do this in a servlet, since in JSP attempting to do this often gets the error that response.getOutputStream() has already been called. And the line response.setHeader("content-disposition", "attachment;filename=Donation Report.pdf"); Does nothing but tell the browser the filename of what you are about to print after this. It doesn't go and fetch the PDF itself. You have to open the PDF, read it into a byte array, and print it to response.getOutputStream()
upvote count: 2
type: Answer

http://stackoverflow.com/a/23540589
answers question: http://stackoverflow.com/q/23413880
downvote count: 0
has body: I think, the wordpress site has some plugins to filter Useragents other than just robots.txt. I can say the crawling is blocked by the server. Enable Logger output. BasicConfigurator.configure(); Set Logger to WARN Level. Logger.getRootLogger().setLevel(Level.WARN); Change the UserAgent String to Empty with below code, it crawl the data. config.setUserAgentString(""); So i think its nothing to do with crawler4j. Crawler4j sets the default Useragent string, which i think blocked or its useragent string is blacklisted by such plugins.
type: Answer
upvote count: 1
score: 1

http://stackoverflow.com/q/23392991
downvote count: 0
score: 1
tagged with: java
type: Question
tagged with: c#
has answer: http://stackoverflow.com/a/23393756
tagged with: android-animation
answer count: 2
upvote count: 1
has title: Android slide in/out animation for activity. Is this setup possible?
tagged with: xamarin
favorite count: 0
has body: I'm trying to achieve the following. I want to slide activity 2 in with a click on btn1 and want to slide activity2 out again with a click on btn2 as shown in the following image: I try to do so using the following (c#) code; java equivelant should be somewhat similar: //MainActivity btn1.Click += (object sender, EventArgs e) =&gt; { var stationActivity = new Intent(_mainActivity, typeof(StationInfoActivity)); StartActivity(stationActivity); _mainActivity.OverridePendingTransition(Resource.Animation.slide_1_enter, Resource.Animation.slide_1_exit); //I have a reference to the _mainActivity since this activity is technically a fragment }; //StationActivity btn2.Click += (object sender, EventArgs e) =&gt; { var mainIntent = new Intent(this, typeof(MainActivity)); StartActivity(mainIntent); this.OverridePendingTransition(Resource.Animation.slide_2_enter, Resource.Animation.slide_2_exit); }; And the following resource files: //slide_1_enter &lt;translate xmlns:android="http://schemas.android.com/apk/res/android" android:fromYDelta="100%p" android:toYDelta="0%p" android:duration="@android:integer/config_shortAnimTime"/&gt; //slide_1_exit &lt;translate xmlns:android="http://schemas.android.com/apk/res/android" android:fromYDelta="0%p" android:toYDelta="0%p" android:duration="@android:integer/config_longAnimTime" /&gt; //slide_2_enter &lt;translate xmlns:android="http://schemas.android.com/apk/res/android" android:fromYDelta="0%p" android:toYDelta="0%p" android:duration="@android:integer/config_longAnimTime" /&gt; //slide_2_exit &lt;translate xmlns:android="http://schemas.android.com/apk/res/android" android:fromYDelta="0%p" android:toYDelta="100%p" android:duration="@android:integer/config_longAnimTime" /&gt; The sliding in (slide_1_enter + slide_1_exit) is working perfectly, however, I can't figure out how to create the slide out animation (slide_2_enter + slide_2_exit). I don't visually see the exit animation. This is probably because of the following: MainActivity is vi…
possible better answer: http://stackoverflow.com/a/23393756
tagged with: android
has comment: http://stackoverflow.com/comment/35839433
has answer: http://stackoverflow.com/a/23409360
accepted answer: http://stackoverflow.com/a/23409360
type: AnsweredQuestion

osmdroid
type: Tag
tag name: osmdroid
tags question: http://stackoverflow.com/q/23356265

http://stackoverflow.com/comment/35918720
score: 0
type: QuestionComment
type: Comment
has text: @DavidXu Of course. But it is obvious that the poster does not mean this. He obviously made a typo simplifying the code (which is normally a good thing, simplifying! However, in this cade I think he actually simplified it a bit too much). What I meant, is that such a comment is useless.
comment on: http://stackoverflow.com/q/23435427

http://stackoverflow.com/a/23410158
downvote count: 0
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/23409847
upvote count: 2
has body: For your ImagePanel class super.paint[Component] before all the other stuff. Don't override paint but instead paintComponent Don't set properties in paintComponent method ie setOpaque(). Beside, JPanel is opaque by default Override getPreferredSize() for painting on panels For loadng images Make a habit of not reading images from the file system, unless the application is specific to only your machine. Instead read from the class path and make the image a resource by packaging it into the class path Change your file structure ProjectRoot src images 3D.jpg Read from class path. Use ImageIO to make sure your path is correct. If it's invalid, an exception will be thrown URL url = getClass().getResource("/images/3D.jpg"); Image image = ImageIO.read(url); For Netbeans GUI Builder You can set the label icon using the design tool Select your label from the navigator or the design view. Go to the properties window in the right and find the property icon click the ellipses button to the right of the property and a dialog will appear. Find your image and select OK (make sure your image is in a package in the src) See related and maybe related
answers question: http://stackoverflow.com/q/23409847
type: AcceptedAnswer

thread-safety
tags question: http://stackoverflow.com/q/23450227
tags question: http://stackoverflow.com/q/23293498
tags question: http://stackoverflow.com/q/23421359
tag name: thread-safety
tags question: http://stackoverflow.com/q/23369069
tags question: http://stackoverflow.com/q/23325129
tags question: http://stackoverflow.com/q/23305465
tags question: http://stackoverflow.com/q/23428194
type: Tag

http://stackoverflow.com/comment/35881080
comment on: http://stackoverflow.com/a/23412957
type: Comment
has text: sir its coming i have just changed the placed of ID and total2 i mean request.setAttribute(total2,ID); like this and in another servlet like this XMLParser.ID= (String) request.getAttribute(XMLParser.total2); its printing i am surprised sir i have reach half the way of my task i need your guidance
score: 0
type: AnswerComment

http://stackoverflow.com/a/23437533
has comment: http://stackoverflow.com/comment/35924269
score: 0
has comment: http://stackoverflow.com/comment/35923481
type: Answer
has comment: http://stackoverflow.com/comment/35924605
has comment: http://stackoverflow.com/comment/35924105
has comment: http://stackoverflow.com/comment/35924123
has comment: http://stackoverflow.com/comment/35923359
answers question: http://stackoverflow.com/q/23437192
has comment: http://stackoverflow.com/comment/35922695
has comment: http://stackoverflow.com/comment/35922846
has body: You may have tried these already but thought still wont't hurt to ask. Make sure you accessing same database from your app as you are using in database SQLDeveloper. Try to step though your code in debugger. If you cannot debug for some reason put more log statements. What is your getConnection() method doing. Check for possibilities of a unchecked exception or an exception other than SQLException thrown and swallowed somewhere. Because your method is only handling SQLException. I hope it helps you solve your issue. :)

http://stackoverflow.com/comment/35722927
type: Comment
has text: I just tried the new codes that you post it, somehow it doesn't work and no changes at all. One thing I found out though, if I directly add the tPanel into mainFrame: mainFrame.getContentPane().add(tPanel); The JTable in TablePanel still doesn't change and resize, I believe that it has someting to do with TablePanel rather than Layout Manager.
comment on: http://stackoverflow.com/a/23329673
score: 0
type: AnswerComment

http://stackoverflow.com/comment/35825519
type: Comment
type: QuestionComment
has text: it doesn't "return two digits". it returns a `double`, however many decimal digits worth of precision that would signify (14...16, IIRC). You may want to **format** your output, though.
score: 1
comment on: http://stackoverflow.com/q/23385867

http://stackoverflow.com/a/23446475
upvote count: 1
downvote count: 0
answers question: http://stackoverflow.com/q/23442872
has body: Alternatively to the recipientList pattern you could just set the Exchange.HTTP_QUERY header: exchange.getIn().setHeader(Exchange.HTTP_QUERY, "...");
type: Answer
score: 1

http://stackoverflow.com/q/23313612
tagged with: java
has title: Libgdx read internal text file for android
type: Question
answer count: 1
score: 0
linked to: http://stackoverflow.com/q/5819772
tagged with: android
has body: I am trying to load some data from an internal .txt file. After some efforts with FileHandle the only I thing I've accomplished is to put this .txt file into a string variable. Instead of this string I need the integers that are stored inside: FileHandle handle = Gdx.files.internal("txt/questions.txt"); String lines = handle.readString(); ` Part of txt file:0 #a)1! b)0,350,190,185! c)180,1247,180,153! d)710,970,124,101! e)615,1105,175,120! //sheep #a)2! b)208,344,248,191! c)403,957,142,127! d)655,1250,142,130! e)0,1075,263,150! // elafi #a)3! b)460,344,164,200! c)10,1232,165,155! d)245,915,150,133! e)268,1083,235,145! //elephant #a)4! b)624,344,234,190! c)835,260,150,55! d)500,1228,155,172! e)800,1117,185,108! //horse #a)5! b)858,330,167,203! c)10,890,220,174! d)822,1235,178,145! e)575,943,128,141! //rabbit
has answer: http://stackoverflow.com/a/23328833
type: UnansweredQuestion
tagged with: file
tagged with: text
tagged with: libgdx

http://stackoverflow.com/q/23330388
type: UnansweredQuestion
type: Question
has comment: http://stackoverflow.com/comment/35724466
tagged with: java
answer count: 1
has body: I have two methods for looking up the index of a particular element in a linked list. I'm trying to use contais() and indexOf() to find the index. I am unsure how to override equals() to suit my need. One method finds the index based on surname and initials the other just the telephone number. Here are my methods: @Override public int lookupNumber(String surname, String initials) { Entry entry1 = new Entry(surname, initials); if (listDirectory.contains(entry1)) { int index = listDirectory.indexOf(entry1); return index; } else { return -1; } } @Override public int lookupName(int extension) { Entry entry1 = new Entry(Integer.toString(extension)); if (listDirectory.contains(entry1)) { int index = listDirectory.indexOf(entry1); return index; } else { return -1; } } I've tried to use the equals() and hashCode() that eclipse provides: @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Entry other = (Entry) obj; if (extension == null) { if (other.extension != null) return false; } else if (!extension.equals(other.extension)) return false; if (initals == null) { if (other.initals != null) return false; } else if (!initals.equals(other.initals)) return false; if (surname == null) { if (other.surname != null) return false; } else if (!surname.equals(other.surname)) return false; return true; } But it won't work for both my methods, as it compares all the variables in the objects not just the ones I need it to compare. What is the correct logic for this? Help much appreciated, thanks. Update - here is my full Entry class - public class Entry { private String surname; private String initals; private String extension; public Entry(String surname, String initals,String extension) { this.surname = surname; this.initals = initals; this.extension = extension; } public Entry(String surname,String initals){ this.surname = surname; this.initals = initals; } public Entry(String extens…
has comment: http://stackoverflow.com/comment/35724328
score: 0
has comment: http://stackoverflow.com/comment/35724242
has title: Overriding equals() for use with Linked List
has answer: http://stackoverflow.com/a/23331583
tagged with: linked-list
tagged with: equals

http://stackoverflow.com/comment/35889478
type: Comment
score: 1
comment on: http://stackoverflow.com/a/23419554
type: AnswerComment
has text: I think the idea is to _help_ the poster with his code, not do his work for him.

http://stackoverflow.com/a/23331269
has body: Yet another solution, to delete an element from an array you need to create a new array only with the desired elements. This is a method to do it: private String[] removeElementAt(int index, String[] original) { String[] newArray = new String[original - 1]; System.arrayCopy(original, 0, newArray, 0, index); System.arrayCopy(original, index + 1, newArray, index, newArray.length - index); return newArray; }
answers question: http://stackoverflow.com/q/23331199
type: Answer
score: 1
upvote count: 1
downvote count: 0

http://stackoverflow.com/comment/35926322
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/23439218
type: Comment
has text: @user3598020 try changing `<bean name="dao" ...>` by `<bean id="dao" ...>` (where `...` is the rest of the content of that portion of the xml).

http://stackoverflow.com/comment/35916052
comment on: http://stackoverflow.com/q/23370092
score: 0
type: Comment
has text: @Troveldom Yes, when key and mouse is being pressed, only keyPressed is called but not mousePressed! I have been searching answer for my problem for four days and haven't found answer yet! So, is it possible or not?
type: QuestionComment

http://stackoverflow.com/a/23371354
has comment: http://stackoverflow.com/comment/35810738
accepted answer of: http://stackoverflow.com/q/23371077
has comment: http://stackoverflow.com/comment/35841162
has comment: http://stackoverflow.com/comment/35822604
has comment: http://stackoverflow.com/comment/35831173
has comment: http://stackoverflow.com/comment/35800759
answers question: http://stackoverflow.com/q/23371077
has comment: http://stackoverflow.com/comment/35802691
has comment: http://stackoverflow.com/comment/35800919
has comment: http://stackoverflow.com/comment/35803810
has comment: http://stackoverflow.com/comment/35804769
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35840544
has comment: http://stackoverflow.com/comment/35840467
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/35805717
has body: This How to Pause and Resume a Thread in Java from another Thread question looks very similar to yours and has some nice examples in the answers. As for your own code and why it does not work: You create a new progressor on every click. You should be using and controlling one, instead of creating new ones every time. When suspending your progressor finishes work instead of suspending. As the above question states - you should be looking at the flag at some points of your computation and acting on it. Example: while (!cancel) { if (!suspended) { for (int i = 1; i &lt;= 10; i++) { Thread.sleep(1000); publish(i); } } } The above code will suspend when it next reaches 10 (unless you resumed it before that), and finish when you press cancel (Cancel needs to be added as an extra flag in the obvious manner).

http://stackoverflow.com/comment/35930775
has text: Does your create table statement define the column as being collated? `CREATE TABLE table_name (column_name TEXT COLLATE LOCALIZED, ... )`
score: 0
comment on: http://stackoverflow.com/q/23442034
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35850419
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23398932
score: 1
has text: Why do you even do that `unreadMessages[i] = new Message();` if on the next line you do `unreadMessages[i] = message;`?

http://stackoverflow.com/comment/35907702
comment on: http://stackoverflow.com/q/23429715
has text: Please read up on [type erasure](http://docs.oracle.com/javase/tutorial/java/generics/erasure.html) in Java.
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/23394701
score: 1
has body: It's poor coding, as it can confuse new programmers. The function, assuming it is passing by value, like in the example above (as opposed to passing by reference) takes a copy of y, decrements it, and assigns it to b. It does not alter the argument passed to the function when it was called.
has comment: http://stackoverflow.com/comment/35843884
downvote count: 0
answers question: http://stackoverflow.com/q/23394535
has comment: http://stackoverflow.com/comment/35842337
type: Answer
has comment: http://stackoverflow.com/comment/35842356
has comment: http://stackoverflow.com/comment/35844406
upvote count: 1
has comment: http://stackoverflow.com/comment/35842291
has comment: http://stackoverflow.com/comment/35842269

http://stackoverflow.com/a/23418694
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/35887878
score: 1
upvote count: 1
has body: This code works for me: public static void main(String[] args) { int[] numberSort = {22,7,2, 5, 7, 1, 2, 9,33,55,12,1,0}; for (int i = 1; i &lt; numberSort.length; i++) { int temp = numberSort[i]; int j = i - 1; while ((j &gt;= 0) &amp;&amp; (numberSort[j] &gt; temp)) { numberSort[j + 1] = numberSort[j]; j = j - 1; } numberSort[j + 1] = temp; } for (int i = 0; i &lt; numberSort.length; i++) { System.out.println(numberSort[i]); } } Gives output: 0 1 1 2 2 5 7 7 9 12 22 33 55
answers question: http://stackoverflow.com/q/23418595
has comment: http://stackoverflow.com/comment/35888299

http://stackoverflow.com/comment/35787049
score: 0
comment on: http://stackoverflow.com/q/23364297
type: Comment
type: QuestionComment
has text: I can't see anything obviously wrong. Do you have your code on GitHub or can I download it somewhere else?

http://stackoverflow.com/a/50734654
score: 2
has body: How about this, try (FileOutputStream out = new FileOutputStream("C:\\file\\path\\here\\Informe.xls")) { exceldoc.write(out); } catch (FileNotFoundException ex) { Logger.getLogger(PruebaExcel.class.getName()).log(Level.SEVERE, null, ex); }
downvote count: 0
type: Answer
upvote count: 2
answers question: http://stackoverflow.com/q/23386091

http://stackoverflow.com/comment/35760980
score: 0
type: QuestionComment
has text: Similar to what was mentioned in my previous comment, a BigDecimal can never equal to an Integer because they're of different types. You can use the methods provided in BigDecimal to convert it to int, like intValue().
type: Comment
comment on: http://stackoverflow.com/q/23343757

http://stackoverflow.com/comment/35921118
comment on: http://stackoverflow.com/a/23436729
score: 0
type: AnswerComment
type: Comment
has text: Does that imply that reflection does indeed bloat the memory size of Java programs? This is the main question here.

http://stackoverflow.com/comment/35937471
type: AnswerComment
comment on: http://stackoverflow.com/a/23445700
score: 0
type: Comment
has text: @AVolpe You're right, fixed.

http://stackoverflow.com/q/23419361
score: -1
type: Question
answer count: 1
downvote count: 1
favorite count: 0
tagged with: arraylist
has body: Actually I'm working on a class to read a text file that contains the following elements: Ringer-ID-0: USB\Device_Name_Here Ringer-ID-0: {2344343r4efdwdd2w2sdwq} Ringer-ID-0: volume =100; Ringer-ID-0: speaker = off; Ringer-ID-1: HDAUDIO\Device_Name_Here Ringer-ID-1: {4r3444ewdwdaedw3re3d34d3} Ringer-ID-1: volume = 93; Ringer-ID-1: speaker = off; Ringer-ID-2: HDAUDIO\Device_Name_Here Ringer-ID-2: {23edecrrvt5y66h6hyyhy66} Ringer-ID-2: volume = 93; Ringer-ID-2: speaker = off; Ringer-ID-3: HDAUDIO\Device_Name_Here Ringer-ID-3: {3444444t56756y7h7h6ef} Ringer-ID-3: volume = 93; Ringer-ID-3: speaker = off; Ringer-ID-4: USB\Device_Name_Here Ringer-ID-4: {r4rfrf54g65g65g6h7uj7} Ringer-ID-4: volume = 50; Ringer-ID-4: speaker = on; what I need to do with these elements is to rearrange them in order to have all HDAUDIO devices with its values in the top of my list and USB devices in the bottom like this: Ringer-ID-0: HDAUDIO\Device_Name_Here Ringer-ID-0: {4r3444ewdwdaedw3re3d34d3} Ringer-ID-0: volume = 93; Ringer-ID-0: speaker = off; Ringer-ID-1: HDAUDIO\Device_Name_Here Ringer-ID-1: {23edecrrvt5y66h6hyyhy66} Ringer-ID-1: volume = 93; Ringer-ID-1: speaker = off; Ringer-ID-2: HDAUDIO\Device_Name_Here Ringer-ID-2: {3444444t56756y7h7h6ef} Ringer-ID-2: volume = 93; Ringer-ID-2: speaker = off; Ringer-ID-3: USB\Device_Name_Here Ringer-ID-3: {2344343r4efdwdd2w2sdwq} Ringer-ID-3: volume =100; Ringer-ID-3: speaker = off; Ringer-ID-4: USB\Device_Name_Here Ringer-ID-4: {r4rfrf54g65g65g6h7uj7} Ringer-ID-4: volume = 50; Ringer-ID-4: speaker = on; I thought first store them in an Array List but I don't know how would be the better way to achieve this, please give a hand, thanks in advance guys import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.util.ArrayList; public class RearrangeItems { public static void main(String[] args) { try { BufferedReader reader = new BufferedReader(new FileReader(new File("C:\\Users\\John\\Desktop\\items.txt"))); ArrayList…
has title: How to sort items coming from text file with ArrayList
upvote count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23419537
tagged with: java

http://stackoverflow.com/a/23335220
type: Answer
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/35738772
answers question: http://stackoverflow.com/q/23334989
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23334989
has body: I'd use three different lists (one for each type). @XmlRootElement(name = "ROOT") public class DocumentList { @XmlElement(name="DOCUMENT") private List documents; @XmlElement(name="TEXT") private List texts; @XmlElement(name="ITEMS") private List items; }

http://stackoverflow.com/q/23338545
has comment: http://stackoverflow.com/comment/35738403
accepted answer: http://stackoverflow.com/a/23338677
favorite count: 0
linked to: http://stackoverflow.com/q/5889034
has title: Why only the last value that we are trying to add is stored in an arraylist repeatedly
upvote count: 2
downvote count: 2
has answer: http://stackoverflow.com/a/40017940
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35738540
has comment: http://stackoverflow.com/comment/35738542
tagged with: java
possible better answer: http://stackoverflow.com/a/40017940
has comment: http://stackoverflow.com/comment/35738401
type: Question
has answer: http://stackoverflow.com/a/23338677
answer count: 2
has body: I am retrieving each and every value of a single record and copying it into another array variable and setting array using a bean class and then adding that bean class to an arraylist.While I am trying to print it shows only the last record repeatedly try{ st=con.createStatement(); rs=st.executeQuery("select * from data"); while(rs.next()){ DataBean db=new DataBean(); for(int i=1;i&lt;=tNumber;i++){ a[i]=rs.getFloat(i); } db.setArray(a); al.add(db); } } finally { ... }
tagged with: arrays
tagged with: arraylist
score: 0
has comment: http://stackoverflow.com/comment/35741997

sum
tags question: http://stackoverflow.com/q/23396980
type: Tag
tag name: sum
tags question: http://stackoverflow.com/q/23306164
tags question: http://stackoverflow.com/q/23429673

http://stackoverflow.com/a/23337815
has comment: http://stackoverflow.com/comment/35956621
type: Answer
has comment: http://stackoverflow.com/comment/35835679
has comment: http://stackoverflow.com/comment/35750835
has comment: http://stackoverflow.com/comment/35750980
has comment: http://stackoverflow.com/comment/35957341
has comment: http://stackoverflow.com/comment/35737664
answers question: http://stackoverflow.com/q/23337653
has comment: http://stackoverflow.com/comment/35823022
has comment: http://stackoverflow.com/comment/35832903
has comment: http://stackoverflow.com/comment/35749695
has comment: http://stackoverflow.com/comment/35824148
has body: First of all debug your program and see if the ArrayLists aren't empty. If they aren't good, if they are empty then there must something wrong with your code. And I think you've made your classes wrong. Do you even use Interfaces ?
has comment: http://stackoverflow.com/comment/35835978
has comment: http://stackoverflow.com/comment/35737813
score: 0

http://stackoverflow.com/comment/35991021
type: Comment
type: QuestionComment
score: 1
has text: Few issues, hashmap should be some Concurrent type and a check of the likes of `if (classes.get(name)==null) return super.findClass(name);` should be in the beginning of the method. Also having the method returning a new ClassLoader is very likely wrong (as you'd like only one loader for all the files)
comment on: http://stackoverflow.com/q/23293534

http://stackoverflow.com/a/23366892
type: Answer
score: 2
downvote count: 0
has body: The problem seems to be that the while-loop never terminates. This depends on that if you guess a letter that is inside the word, the while-loop gets going because you NEVER change the value of the variable letter while(getGuessLeft()&gt;0) { getLettersGuesed().add(letter); if (!randomPirateWord.contains(letter+"")) { setGuessLeft(getGuessLeft() - 1); System.out.println("You lost a life, now have " + getGuessLeft()); } for(int i1 = 0; i1 &lt;getRandomPirateWord().length(); i1++) { if(words[i1] == letter) words2[i1] = letter; } for(int i1 = 0; i1 &lt; getRandomPirateWord().length(); i1++){ System.out.print(words2[i1]); } }
answers question: http://stackoverflow.com/q/23366617
accepted answer of: http://stackoverflow.com/q/23366617
upvote count: 2
type: AcceptedAnswer

http://stackoverflow.com/comment/35658326
score: 1
comment on: http://stackoverflow.com/q/23294472
type: QuestionComment
type: Comment
has text: That's.... kind of odd. I'm ignorant of Ruby, but that's _not_ the Singleton pattern as understood by the rest of the CS world. I'd call it an instance-specific method (for which there's no Java equivalent). A *singleton* as understood by the rest of the world is when only one instance of a class can exist. Does Ruby really change the meaning of "singleton" like that? EDIT: apparently so. That's a terrible practice.

http://stackoverflow.com/a/23344827
has comment: http://stackoverflow.com/comment/35750473
score: 0
type: Answer
has body: You can loop your click listener to all the childs within your Layout like this, for (int i = 0; i &lt; layoutParent.getChildCount(); i++) { View view = layoutParent.getChildAt(i); view.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent intent = new Intent(mContext, ImagePager.class); intent.putExtra("CHILD_INDEX", view.getId()); startActivity(intent); } }); }
answers question: http://stackoverflow.com/q/23344737

http://stackoverflow.com/q/23403386
has answer: http://stackoverflow.com/a/23404057
tagged with: java
upvote count: 1
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/35858134
has comment: http://stackoverflow.com/comment/35858399
has comment: http://stackoverflow.com/comment/35861268
has comment: http://stackoverflow.com/comment/35858199
score: 0
has body: This is my regex for password. ((?=.*\\d)(?=.*[a-z])(?=.*[A-Z]).{6,20}) When I enter "cdsafcghiufvcdsfvcdsghfcydsgfcghdysufcdus" more then 20 words its working fine but when I use "Akash1AAkash1AAkash1AAkash1AAkash1AAkash1AAkash1AAkash1AAkash1A" it's not working. For only lower case or upper case its working fine, but when I use uppercase, numeric and lowercase with maximum length its not working. I tried almost everything but not succeed.
accepted answer: http://stackoverflow.com/a/23404057
has comment: http://stackoverflow.com/comment/35858883
has comment: http://stackoverflow.com/comment/35859828
has comment: http://stackoverflow.com/comment/35859112
answer count: 1
has comment: http://stackoverflow.com/comment/35859249
favorite count: 0
has comment: http://stackoverflow.com/comment/35858725
has title: Password regex not working
tagged with: regex
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35858271

http://stackoverflow.com/comment/35824697
score: 8
has text: @CurtisHx: Think about it. One GIGAbyte of virtual memory! It is still insane, what are you doing with that much address space?
comment on: http://stackoverflow.com/q/23385471
type: Comment
type: QuestionComment

file
type: Tag
tags question: http://stackoverflow.com/q/23316334
tags question: http://stackoverflow.com/q/23303787
tags question: http://stackoverflow.com/q/23405068
tags question: http://stackoverflow.com/q/23296881
tags question: http://stackoverflow.com/q/23346922
tags question: http://stackoverflow.com/q/23383553
tags question: http://stackoverflow.com/q/23377630
tags question: http://stackoverflow.com/q/23298631
tag name: file
tags question: http://stackoverflow.com/q/23372989
tags question: http://stackoverflow.com/q/23353759
tags question: http://stackoverflow.com/q/23377809
tags question: http://stackoverflow.com/q/23406303
tags question: http://stackoverflow.com/q/23371611
tags question: http://stackoverflow.com/q/23302860
tags question: http://stackoverflow.com/q/23313612
tags question: http://stackoverflow.com/q/23314426
tags question: http://stackoverflow.com/q/23354648
tags question: http://stackoverflow.com/q/23445944
tags question: http://stackoverflow.com/q/23413835
tags question: http://stackoverflow.com/q/23396344
tags question: http://stackoverflow.com/q/23348220
tags question: http://stackoverflow.com/q/23375957
tags question: http://stackoverflow.com/q/23452527
tags question: http://stackoverflow.com/q/23335709
tags question: http://stackoverflow.com/q/23403837
tags question: http://stackoverflow.com/q/23296203
tags question: http://stackoverflow.com/q/23401849
tags question: http://stackoverflow.com/q/23418715
tags question: http://stackoverflow.com/q/23303616
tags question: http://stackoverflow.com/q/23443634
tags question: http://stackoverflow.com/q/23441742
tags question: http://stackoverflow.com/q/23417663
tags question: http://stackoverflow.com/q/23326833
tags question: http://stackoverflow.com/q/23371068
tags question: http://stackoverflow.com/q/23346340
tags question: http://stackoverflow.com/q/23315389
tags question: http://stackoverflow.com/q/23376262
tags question: http://stackoverflow.com/q/23436126
tags question: http://stackoverflow.com/q/23395560
tags question: http://stackoverflow.com/q/23343521

http://stackoverflow.com/q/23318002
tagged with: ffmpeg
upvote count: 1
type: Question
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/35701420
tagged with: inputstream
has body: My code is intended to update an ImageView with an image from a server when a UI button is pressed. The client side code shown below is a Runnable that runs when the button is pressed. The server is a desktop Java application with ffmpeg running in the background, continuously updating image.png with an image from the webcam. When the button is pressed on the Android app, the Android app attempts to receive image.png from the server, and because ffmpeg is constantly updating this image, it should be the most recent image taken with the server's webcam. My problem is that the first button press shows the correct image, but every subsequent button press will just clear out my ImageView. BitmapFactory.decodeStream() is returning null every time I call it after the first time. Client side (runs when button is pressed): InputStream inputStream = s.getInputStream(); img = BitmapFactory.decodeStream(inputStream); jpgView.setImageBitmap(img); jpgView.invalidate(); Server side: ServerSocket sock = new ServerSocket(PORT_NUMBER); Socket clientSocket = sock.accept(); for (;;) { File f = new File("C:/folder/image.png"); FileInputStream fileInput = new FileInputStream(f); BufferedInputStream bufferedInput = new BufferedInputStream(fileInput); OutputStream outStream = clientSocket.getOutputStream(); try { byte[] outBuffer = new byte[fSize]; int bRead = bufferedInput.read(outBuffer, 0, outBuffer.length); outStream.write(outBuffer, 0, bRead); outStream.flush(); } catch (Exception e) { e.printStackTrace(); } finally { bufferedInput.close(); } }
has answer: http://stackoverflow.com/a/23318143
accepted answer: http://stackoverflow.com/a/23318143
answer count: 1
downvote count: 0
has title: Android: BitmapFactory.decodeStream() returns null after first success
favorite count: 0
tagged with: android
tagged with: bitmapfactory
type: AnsweredQuestion

http://stackoverflow.com/comment/35914196
comment on: http://stackoverflow.com/a/23431770
has text: Thanks for looking into this. Thanks for your help.
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/35679435
type: Comment
type: QuestionComment
has text: That is mysql though, is there a big difference though?
comment on: http://stackoverflow.com/q/23306000
score: 0

http://stackoverflow.com/comment/35686940
score: 0
type: QuestionComment
type: Comment
has text: You can investigate such problems yourself by using a debugger.
comment on: http://stackoverflow.com/q/23309691

http://stackoverflow.com/a/23553870
type: Answer
score: 0
has body: While there is a many-to-many association between Book and Author, there is a many-to-one association between Book and Publisher. In your Java classes you have been using two pairs of mutually inverse reference properties Book::authors and Author::books as well as Book::publisher and Publisher::books. This is the pattern for implementing bi-directional associations. For more about associations, see Section 1 of my tutorial about associations.
answers question: http://stackoverflow.com/q/23413836

http://stackoverflow.com/comment/35942853
score: 0
type: AnswerComment
has text: Thanks a lot, most of this makes sense but bare with me here I honestly don't understand why position P is so important and why I have to do Text1.charAt(i+P) , sorry but it's a bit confusing.
type: Comment
comment on: http://stackoverflow.com/a/23447848

http://stackoverflow.com/q/23294894
has comment: http://stackoverflow.com/comment/35658999
accepted answer: http://stackoverflow.com/a/23295728
score: 0
has title: Apache Library to Standard Java
answer count: 1
has body: I have a problem. I wrote this code that reads a string from a txt file and I exported with the first method a int while the second one particular string. This method is already running but I have used the apache library, now I wanted to rewrite it in Java standard libraries. I have tried this, but I have had problems. Could someone help me? Thank you very much. package ausiliare; import java.io.File; import java.io.IOException; import org.apache.commons.io.*; public class Read { public static int getInt() throws IOException { String content = null; File folder = new File("C:\\Solution.txt"); content = FileUtils.readFileToString(folder) + "\n"; int outside = Integer.parseInt(content.substring(0, content.indexOf("[")).trim()); return outside; } public static String getString() throws IOException { String content = null; File folder = new File("C:\\Solution.txt"); content = FileUtils.readFileToString(folder) + "\n"; String remainingString = content.substring(content.indexOf(" ["), content.lastIndexOf("]") + 1); // System.out.println(remainingString); return remainingString; } public static String[] arg() throws IOException { String[] strArray = getString().split(" "); // System.out.println(Arrays.toString(strArray)); return strArray; } } Ps: The input file is txt (for example): 50 [8,24,-22] [-8,34,12] [19,14,47] [-49,32,44] [-41,16,-6] [-49,-11,43] Where the first method extracts the int 50 and the second extraction method extracts the remaining
linked to: http://stackoverflow.com/q/326390
has comment: http://stackoverflow.com/comment/35659337
has answer: http://stackoverflow.com/a/23295728
type: AnsweredQuestion
tagged with: java
tagged with: eclipse
type: Question
has comment: http://stackoverflow.com/comment/35659346
tagged with: apache

http://stackoverflow.com/comment/50546499
score: 0
has text: Sorry Evgeni, I have created a seprate question http://stackoverflow.com/questions/31276011/spring-boot-spring-batch-job-enabled-false-not-able-to-recognize
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23448661

http://stackoverflow.com/a/23363557
downvote count: 0
type: Answer
has body: that would be something like this: public static &lt;T extends Module&gt; T initializeModule(Class&lt;T&gt; myClass) { T module = null; try { module = myClass.newInstance(); } catch (SecurityException e) { ... } catch (InstantiationException e) { ... } catch (IllegalAccessException e) { ... } return module; }
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/23363419

http://stackoverflow.com/q/23320034
has comment: http://stackoverflow.com/comment/35830424
has answer: http://stackoverflow.com/a/23320087
type: AnsweredQuestion
score: 1
has comment: http://stackoverflow.com/comment/35837941
tagged with: java
has body: I want to crawl yahoo and get the top 10 results matching a keyword. I am using this link to crawl the results Code I am using for this is: public static void main(String args[]) throws IOException { try { Document doc = Jsoup.connect("https://in.search.yahoo.com/search;_ylt=AibrWnqoneznrEAiS9bG0aOuitIF?p=solar+systems&amp;toggle=1&amp;cop=mss&amp;ei=UTF-8&amp;fr=yfp-t-405").get(); for(Element dc : doc.select("div#doc.uh3-p uh3lite")) { System.out.println("data"); for(Element dd : doc.select("div#bd")) { for(Element results : doc.select("div#results")) { for(Element wb : doc.select("div#web")) { Elements data=wb.select("span"); if(data.size()&gt;0) { System.out.println(data.get(0).text()); } } } } } } catch(Exception ex) { System.out.println(ex); } } I am getting no results with it. Can anyone help me?
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/35798559
tagged with: jsoup
downvote count: 0
has comment: http://stackoverflow.com/comment/35840173
has title: Search Yahoo Answers using Jsoup
answer count: 1
accepted answer: http://stackoverflow.com/a/23320087
has comment: http://stackoverflow.com/comment/35837374
favorite count: 0
has comment: http://stackoverflow.com/comment/35785856

http://stackoverflow.com/comment/35669094
comment on: http://stackoverflow.com/a/23300267
score: 0
has text: And I have misunderstanding. I want only only one sync block !!! I cannot understand where should I write last two code snippets
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/35854016
type: Comment
comment on: http://stackoverflow.com/a/23400712
has text: Is getScaledInstance the only way to resize an image? If it's of a poor quality what's a higher quality version
score: 0
type: AnswerComment

http://stackoverflow.com/comment/35891879
type: QuestionComment
comment on: http://stackoverflow.com/q/23420987
score: 0
has text: Hmm, that might work.
type: Comment

http://stackoverflow.com/comment/35712470
score: 0
type: Comment
type: QuestionComment
has text: You would need to either find or write a Java compiler that has similar options to the Scala compiler. However, A large proportion of these AST manipulations don't happen with Java, so it wouldn't really be as worthwhile.
comment on: http://stackoverflow.com/q/23318933

http://stackoverflow.com/comment/35736205
score: 0
has text: I want 50 size how to add?
comment on: http://stackoverflow.com/a/23337227
type: AnswerComment
type: Comment

http://stackoverflow.com/q/23342655
tagged with: java
has comment: http://stackoverflow.com/comment/52949624
has title: Unable to initialize AudioEffect (LoudnessEnhancer) on MediaPlayer (API 19)
tagged with: android-audiorecord
has body: I have tried using various AudioEffect classes on AudioRecord/MediaPlayer and every time i am getting the same error as soon as i call a new object of the AudioEffect class. I am getting the following error - 04-28 18:31:06.571: **E/AudioEffect(6688): set(): AudioFlinger could not create effect, status: -22** 04-28 18:31:06.571: **E/AudioEffects-JNI(6688): AudioEffect initCheck failed -4** 04-28 18:31:06.571: **E/AudioEffect-JAVA(6688): Error code -4 when initializing AudioEffect.** For example I had written the following code where I am creating an object of MediaPlayer class and sending an output file which contains my mp3 recording to setDataSource function. Then according the the android api documentation http://developer.android.com/reference/android/media/audiofx/LoudnessEnhancer.html I am supposed to send audio session id to the constructor of LoudnessEnhancer object. Also i have set the Target Gain at 100 and setEnabled true. MediaPlayer m = new MediaPlayer(); m.setDataSource(outputFile); int sessionID=m.getAudioSessionId(); AudioEffect effect=new LoudnessEnhancer(sessionID); ((LoudnessEnhancer) effect).setTargetGain(100); ((LoudnessEnhancer) effect).setEnabled(true); m.prepare(); m.start(); Note : whenever I debug the code and as soon as it hits the constructor of LoudnessEnhancer I get a message saying Source not attached. So I checked the windows->preferences->java->installed jre and it shows the correct path. However in my Project->BuildPath->configure Build Path->Libraries When I checked the Native Library Location, the path shows none. I don't know which path to include here if at all it is required Is it possible that my project is unable to find certain sources necessary to instantiate the constructor of the AudioEffect class ? Kindly give suggestions..
type: Question
tagged with: android-mediaplayer
upvote count: 5
score: 5
downvote count: 0
tagged with: audioflinger
favorite count: 0
tagged with: android
answer count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/35938103
type: Comment
type: QuestionComment
has text: While there's no "wall clock" value available that returns nanosecond precision (the System.timeNano value isn't tied to "wall clock" time), you can, of course, *format* a timestamp with more than 3 digits of subsecond data. That's simply a matter of using the correct format specifier.
score: 0
comment on: http://stackoverflow.com/q/23445915

http://stackoverflow.com/comment/35875767
type: Comment
comment on: http://stackoverflow.com/a/23405213
score: 0
type: AnswerComment
has text: String.valueOf(myBigInt) -> implicit call toString()

http://stackoverflow.com/q/23403949
has comment: http://stackoverflow.com/comment/35861421
has body: I have made one activity. In that I have to use one asynctask for api. So in that asynctask my url will be dynamically generated based on some number. I have tried as below, but it's not the proper way. Can anybody show me how I can make this url? my sample url is:<a href="http://yehki.epagestore.in/app_api/order.php?customer_id=41&amp;address_id=31&amp;products%5b0%5d%5bproductName%5d=rt&amp;products%5b0%5d%5bproduct_id%5d=41&amp;products%5b0%5d%5bquantity%5d=2&amp;products%5b0%5d%5bunit%5d=1&amp;products%5b0%5d%5bunitPrice%5d=400&amp;products%5b1%5d%5bproductName%5d=rt&amp;products%5b1%5d%5bproduct_id%5d=40&amp;products%5b1%5d%5bquantity%5d=2&amp;products%5b1%5d%5bunit%5d=1&amp;products%5b1%5d%5bunitPrice%5d=400" rel="nofollow">http://yehki.epagestore.in/app_api/order.php?customer_id=41&amp;address_id=31&amp;products[0][productName]=rt&amp;products[0][product_id]=41&amp;products[0][quantity]=2&amp;products[0][unit]=1&amp;products[0][unitPrice]=400&amp;products[1][productName]=rt&amp;products[1][product_id]=40&amp;products[1][quantity]=2&amp;products[1][unit]=1&amp;products[1][unitPrice]=400 my try is: package com.epe.yehki.ui; import java.lang.reflect.Array; import java.net.URL; import java.util.ArrayList; import java.util.HashMap; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import android.R.string; import android.app.Activity; import android.app.ListActivity; import android.app.ProgressDialog; import android.content.Intent; import android.graphics.Paint.Join; import android.net.Uri; import android.os.AsyncTask; import android.os.Bundle; import android.text.Editable; import android.text.TextWatcher; import android.util.Log; import android.view.View; import android.view.View.OnClickListener; import android.view.Window; import android.view.WindowManager; import android.widget.AdapterView; import android.widget.AdapterView.OnItemClickListener; import android.widget.ArrayAdapter; import android.widget.Button; import android.wi…
has answer: http://stackoverflow.com/a/23404074
downvote count: 0
tagged with: url
favorite count: 0
tagged with: android
possible better answer: http://stackoverflow.com/a/23404388
has answer: http://stackoverflow.com/a/23404388
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35867096
accepted answer: http://stackoverflow.com/a/23404074
has comment: http://stackoverflow.com/comment/35865759
upvote count: 1
type: Question
tagged with: stringbuilder
has title: how to build up a string url by using method in android dynamically?
score: 1
tagged with: java
answer count: 2
has comment: http://stackoverflow.com/comment/35859216

http://stackoverflow.com/q/23367393
answer count: 3
has answer: http://stackoverflow.com/a/23367878
tagged with: function
linked to: http://stackoverflow.com/q/4685563
has comment: http://stackoverflow.com/comment/35791939
possible better answer: http://stackoverflow.com/a/23367455
has body: I'm working on a java webserver which calls a web service. I'm trying to write some code in a nicer. I've got 2 similar functions, only one thing changes : the function i have to call depending what i want to do. public Object updateDef() { ExecutorService pool = Executors.newFixedThreadPool(20); List&lt;Callable&lt;String&gt;&gt; tasks = new ArrayList&lt;Callable&lt;String&gt;&gt;(); logger.info("Updating surv def..."); for (final Surv surv : Client.activatedSurvs) { final Client client = new Client(surv.getName(), surv.getPassword()); tasks.add(new Callable&lt;String&gt;() { public String call() throws Exception { HERE -&gt; client.updateDef(surv); return surv.getId(); } }); client.destroy(); } List&lt;Future&lt;String&gt;&gt; results = null; try { results = pool.invokeAll(tasks); for (Future&lt;String&gt; future : results) { future.get(); } } catch (ExecutionException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } pool.shutdown(); return null; } And the other one : public Object updateStats() { ExecutorService pool = Executors.newFixedThreadPool(20); List&lt;Callable&lt;String&gt;&gt; tasks = new ArrayList&lt;Callable&lt;String&gt;&gt;(); logger.info("Updating surv Stats..."); for (final Surv surv : Client.activatedSurvs) { final Client client = new Client(surv.getName(), surv.getPassword()); tasks.add(new Callable&lt;String&gt;() { public String call() throws Exception { HERE -&gt; client.updateStats(surv).toString(); return surv.getId(); } }); client.destroy(); } List&lt;Future&lt;String&gt;&gt; results = null; try { results = pool.invokeAll(tasks); for (Future&lt;String&gt; future : results) { future.get(); } } catch (ExecutionException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } pool.shutdown(); return null; } So the 2 functions are updateStats a…
has comment: http://stackoverflow.com/comment/35791699
type: AnsweredQuestion
tagged with: call
has answer: http://stackoverflow.com/a/23367455
tagged with: java
duplicate of: http://stackoverflow.com/q/4685563
type: Question
has title: How can I factorise this code?
has comment: http://stackoverflow.com/comment/35791590
has comment: http://stackoverflow.com/comment/35791624
accepted answer: http://stackoverflow.com/a/23367878
has answer: http://stackoverflow.com/a/23367576
score: 0

http://stackoverflow.com/q/23371139
favorite count: 0
has comment: http://stackoverflow.com/comment/35798930
has title: Java Multiple Choice Inquiry
type: AnsweredQuestion
score: -5
has comment: http://stackoverflow.com/comment/35798919
has answer: http://stackoverflow.com/a/23371410
tagged with: java
has body: public void printVals (String[] items, int k) { if (K &lt; 1) { printVals(items, k -1); System.out.print(items[k] + ""); printVals(items, k -2) } } suppose the following code segment has been executed: string[] names = {"Pat", "Joe", "Ann", "Cal", "Amy"}; printVals(names, names.length - 1); What is the output? (A) Ann Cal Amy Ann (B) Ann Cal Amy Cal Ann (C) Ann Cal Joe Amy Joe Ann (D) Joe Ann Cal Amy Ann (E) Ann Cal Amy Ann The correct answer is A, but I do not know how to do it, and I am not sure if choice A is right
has comment: http://stackoverflow.com/comment/35799245
type: Question
upvote count: 0
downvote count: 5
accepted answer: http://stackoverflow.com/a/23371410
answer count: 1

http://stackoverflow.com/comment/35850905
type: AnswerComment
comment on: http://stackoverflow.com/a/23398809
has text: Actually since it's a HashMap, containsKey should be pretty harmless. And this solves my problem. Only do previous.put(n, curr) if !previous.containsKey(n).
type: Comment
score: 0

http://stackoverflow.com/comment/35872966
comment on: http://stackoverflow.com/a/23390176
type: Comment
score: 0
type: AnswerComment
has text: Hey Syam, yes that's exactly what I meant. I was wondering I tried to use the array of text with reading a text file. In my text file I have a few sentences. Each sentence on one line. "This is line one" next sentence "This is line two".. etc. For some reasons, it doesn't appear on the text label. I just used the similar as this here - http://www.homeandlearn.co.uk/java/read_a_textfile_in_java.html

http://stackoverflow.com/comment/35911522
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23431835
has text: What is `s`? What is the return type of your method? What does the error message tell you (full message)?

http://stackoverflow.com/q/23437191
type: Question
tagged with: imageview
accepted answer: http://stackoverflow.com/a/23437323
upvote count: 1
answer count: 1
has answer: http://stackoverflow.com/a/23437323
tagged with: textview
favorite count: 0
has title: Center TextView directly below ImageView in Linear Layout
tagged with: android
has body: I am trying to align text directly below each icon despite the text length being of different sizes. I'd prefer for everything to be centered on this line in this screenshot: I have tried using both Linear and Relative layouts to get what I want with no success. This code is what I have now and is the closest to what I want: <?xml version="1.0" encoding="utf-8"?> Surely there is a better way to do this (Maybe a RelativeLayout with a LinearLayout around the Textview?). Any help would be appreciated... I'm fairly new to this.
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java

http://stackoverflow.com/comment/35895463
has text: This is how it look when I check the original text: `धान~1325|चावल~2050|ज्वर~920|जौ~810|मकई~1280|गेहूँ~1420|` Obiously there is some encoding problem _on the server side_ - or possibly you are expecting asian product names?
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/23422782

http://stackoverflow.com/comment/35780442
type: Comment
type: QuestionComment
has text: Stacktrace of the crash please.
score: 1
comment on: http://stackoverflow.com/q/23361474

http://stackoverflow.com/a/23689940
score: 5
answers question: http://stackoverflow.com/q/23416053
upvote count: 5
type: Answer
downvote count: 0
has body: If you are using graddle, you may want to check that you updated your configuration to use the 19.1 version of the android support library. See following line: dependencies { compile 'com.android.support:support-v4:19.1.+' }

http://stackoverflow.com/comment/35949118
type: Comment
has text: Check my answer. I left it in regular English because implementation should be quite easy, but if you have a specific problem feel free to ask
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23451393

http://stackoverflow.com/comment/103245382
has text: for androidx, read: https://stackoverflow.com/a/58453899/7356355
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23416053
score: 0

javafx-8
tags question: http://stackoverflow.com/q/23414737
tags question: http://stackoverflow.com/q/23416704
tags question: http://stackoverflow.com/q/23436894
tag name: javafx-8
tags question: http://stackoverflow.com/q/23358641
tags question: http://stackoverflow.com/q/23342319
tags question: http://stackoverflow.com/q/23313755
tags question: http://stackoverflow.com/q/23399383
tags question: http://stackoverflow.com/q/23296241
tags question: http://stackoverflow.com/q/23438999
type: Tag
tags question: http://stackoverflow.com/q/23419201
tags question: http://stackoverflow.com/q/23300774
tags question: http://stackoverflow.com/q/23303087
tags question: http://stackoverflow.com/q/23315109

http://stackoverflow.com/comment/35744678
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23341652
score: 0
has text: INterms of Java libs Start by investigating the GeoTools API and maybe the related GeoServer.

http://stackoverflow.com/a/25973141
accepted answer of: http://stackoverflow.com/q/23438806
answers question: http://stackoverflow.com/q/23438806
score: 0
has body: I got rid of this error after switching to apache-tomee-plus-1.6.0.
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/q/23398543
has body: I have a problem in my android app. I need to show a text after 10 minutes and i haven't any idea of how i can do. I use a Calendar now = Calendar.getInstance(); and I wish to create a date higher than the current Date. How I can add minutes in my current Date?
accepted answer: http://stackoverflow.com/a/23398572
favorite count: 0
score: -1
has title: How I can add minutes in my current Date?
possible better answer: http://stackoverflow.com/a/23400760
downvote count: 2
tagged with: android
has answer: http://stackoverflow.com/a/23400760
type: AnsweredQuestion
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/23398572
type: Question
answer count: 2

http://stackoverflow.com/q/23366900
has answer: http://stackoverflow.com/a/23367509
answer count: 3
has comment: http://stackoverflow.com/comment/35790813
has comment: http://stackoverflow.com/comment/35791274
has answer: http://stackoverflow.com/a/74549269
has comment: http://stackoverflow.com/comment/35791448
has answer: http://stackoverflow.com/a/23366992
accepted answer: http://stackoverflow.com/a/23366992
favorite count: 0
upvote count: 5
type: AnsweredQuestion
downvote count: 0
tagged with: reflection
has comment: http://stackoverflow.com/comment/35790990
tagged with: java
has comment: http://stackoverflow.com/comment/35791030
has body: I have a Field f, after I check it and it turns out that it is of type List, I can get its generic type. But how do I create a new List with this generic type and put new instances inside? if (List.class.isAssignableFrom(f.getType())) { Type genericType = f.getGenericType(); List&lt;genericType&gt; a = new ArrayList(); // ?????? Error } For example I have a field with type List&lt;MyObject&gt; Is it possible to create an new instance of ArrayList&lt;MyObject&gt; through reflections?
type: Question
score: 5
possible better answer: http://stackoverflow.com/a/23367509
has title: How to create a new List<T> knowing the Type through reflection?

http://stackoverflow.com/q/23365784
tagged with: spring
has answer: http://stackoverflow.com/a/23474317
tagged with: java
has answer: http://stackoverflow.com/a/25440552
type: Question
upvote count: 4
has body: I 've installed sts but the create a new roo project does not exists, what i have to do to add spring roo? In the previous version i could create it but not in 3.5.0
answer count: 2
downvote count: 0
score: 4
favorite count: 0
has comment: http://stackoverflow.com/comment/35804319
tagged with: spring-roo
has title: How to add Spring roo on Spring Tools Suite
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/23364056

http://stackoverflow.com/comment/36380413
score: 1
type: AnswerComment
has text: Update the answer and I'll accept. I ended up doing something along those line because of what seems to be [a bug in the filter](https://github.com/ronmamo/reflections/issues/26).
type: Comment
comment on: http://stackoverflow.com/a/23416508

http://stackoverflow.com/a/23331138
answers question: http://stackoverflow.com/q/23325476
has body: You can't have compound documents like that in a single app engine search index. However, there are other things you can do: A document can have multiple fields with the same name. That is, you could add a field named "review" multiple times, each time with different contents. You can create separate indexes, one for book data that contains book documents, and one for review data that contains review documents. It really depends on what your search usage patterns are going to be.
score: 0
accepted answer of: http://stackoverflow.com/q/23325476
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35725818
type: Answer

http://stackoverflow.com/a/23328780
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35721238
has comment: http://stackoverflow.com/comment/35722678
downvote count: 0
has comment: http://stackoverflow.com/comment/35721155
has comment: http://stackoverflow.com/comment/35722419
accepted answer of: http://stackoverflow.com/q/23328698
upvote count: 2
type: Answer
answers question: http://stackoverflow.com/q/23328698
score: 2
has comment: http://stackoverflow.com/comment/35721195
has body: The problem is this line: return smallestLetter(str.substring(0) + str.substring(2,str.length())); str.substring(0) is actually the entire string; so in this line, the method re-calls itself with a string that's almost twice as big as the original. Just a few method-calls in, you can already have a massive string that's bigger than you can allocate. The minimal fix is: return smallestLetter(str.charAt(0) + str.substring(2,str.length())); but a better fix is to use iteration rather than recursion: public static String smallestLetter(String str) { char ret = str.charAt(0); for (int i = 1; i &lt; str.length(); ++i) if (str.charAt(i) &lt; ret) ret = str.charAt(i); return String.valueOf(ret); } Edited to add: Note that, as Alexey Malev points out below, this will raise an exception if str is the empty string (""). In addition, it does not do any filtering to specifically identify letters; rather, it will return the least character in the string, whether or not that's a letter.
has comment: http://stackoverflow.com/comment/35722467

http://stackoverflow.com/q/23327204
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35718315
tagged with: passwords
has comment: http://stackoverflow.com/comment/35718114
has comment: http://stackoverflow.com/comment/35718161
tagged with: java
score: -1
type: Question
has comment: http://stackoverflow.com/comment/35721835
has comment: http://stackoverflow.com/comment/35718306
has comment: http://stackoverflow.com/comment/35718247
has answer: http://stackoverflow.com/a/23327325
tagged with: .net
answer count: 1
downvote count: 1
has title: Finding out the number of combinations to crack a password?
has comment: http://stackoverflow.com/comment/35718154
has comment: http://stackoverflow.com/comment/35718207
favorite count: 0
has comment: http://stackoverflow.com/comment/35718341
has comment: http://stackoverflow.com/comment/35718220
has body: How do you calculate how many combinations someone has to try to crack a password? Imagine the password is: "Input 1" Char = 26 + 26 + 33 + 10 = 95 Is there any way to calculate the number of combinations? I currently just use 95^a - a being the password length... is this an accurate equation?
upvote count: 0
has comment: http://stackoverflow.com/comment/35718117

http://stackoverflow.com/comment/35791939
type: Comment
has text: I forgot to say that it has to be the quickest way possible. I'm worrying if statement will slow down my app ?
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/23367393

graphics2d
tags question: http://stackoverflow.com/q/23307273
tags question: http://stackoverflow.com/q/23322496
tag name: graphics2d
type: Tag

http://stackoverflow.com/comment/35916985
comment on: http://stackoverflow.com/q/23418556
has text: @323go That was what I wanted to know. There are other concerns with this type of code aside from maintainability. Thanks
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35717578
comment on: http://stackoverflow.com/a/23326752
type: AnswerComment
score: 0
has text: My initial thinking for the minus one was that the user would want lets say 10 values, and if this was the array size there would technically be 11 values available so minus 1 would remedy that. I see now how thats not ideal though! thanks for the help i changed that loop and that seemed to fix it
type: Comment

http://stackoverflow.com/comment/82619587
has text: Although this may answer the questions, you may wan't to provide some extra details and explain the answer. In it's current state this answer is low-quality.
comment on: http://stackoverflow.com/a/23388381
type: Comment
score: 1
type: AnswerComment

http://stackoverflow.com/comment/35886216
comment on: http://stackoverflow.com/q/23417858
has text: The println() is more than 1000x times more expensive than the use of a boolean variable. I suggest the second because it is simpler/
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35928277
comment on: http://stackoverflow.com/q/23440400
has text: could anyone please help me resolve this problem.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35852029
type: Comment
has text: the main code is so big to put here. I double checked. I have not defined them inside the loop.
comment on: http://stackoverflow.com/a/23399746
type: AnswerComment
score: 0

http://stackoverflow.com/comment/35854964
type: QuestionComment
has text: Sorry just updated my explanation
comment on: http://stackoverflow.com/q/23401463
score: 0
type: Comment

http://stackoverflow.com/comment/35715873
score: 0
comment on: http://stackoverflow.com/q/23326001
has text: Guys, I think I should add more. My string comes in the form of:mon/jan/13/20/01/56/0000/2014 I want it like this MM/dd/yyyy kk:mm:ss.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23399331
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23396219
upvote count: 8
type: Answer
score: 8
answers question: http://stackoverflow.com/q/23396219
has body: If you don't need to rely on the content-type returned by the server, you should use getInputStream which doesn't require the content-type to be set.

http://stackoverflow.com/comment/43533052
has text: You are right! This happened only when application is finishing. Thats not a problem so far.
type: Comment
comment on: http://stackoverflow.com/a/23293279
score: 0
type: AnswerComment

http://stackoverflow.com/q/23326798
type: Question
tagged with: exception
score: -2
tagged with: java
answer count: 2
downvote count: 2
has comment: http://stackoverflow.com/comment/35717548
has answer: http://stackoverflow.com/a/23342724
has comment: http://stackoverflow.com/comment/35717265
has comment: http://stackoverflow.com/comment/35717472
has comment: http://stackoverflow.com/comment/35717412
tagged with: arrays
type: UnansweredQuestion
has title: Array out of bounds and null pointer exceptions
upvote count: 0
has body: I'm getting an array out of bounds exception. I know its because the array is empty but I do a check on the length before I try to use its contents. But it won't even do the check because its saying the array is causing a null pointer exception. Anyone any ideas why its throwing this up? Here's the code private void createGroupTree(ArrayList&lt;String&gt; groupList) throws JWNLException { WordNetMeasures wordNet = new WordNetMeasures(); String[] wordResult; for(int i = 0; i&lt;groupList.size(); i++) { wordResult = wordNet.getWordNetPath(groupList.get(i)); if(wordResult.length == 0) { graph.addVertex(groupList.get(i)); } else { for(int j=0; j&lt;wordResult.length; j++) { if(j !=wordResult.length-1) { graph.addEdge(edgeFactory.create(), wordResult[j], wordResult[j+1]); } } } } } Here's the code for the getWordNetPath method that is causing this issues. I know some words in the list are not in the dictionary being used I just don't know how to handle to issue its causing. public String[] getWordNetPath(String word) throws JWNLException { RiWordnet wordnet = new RiWordnet(); //String wordOne = "dog"; String[] posOfWord = wordnet.getPos(word); int[]wordIds = wordnet.getSenseIds(word, posOfWord[0]); String[] wordResults = wordnet.getHypernymTree(wordIds[0]); return wordResults; }
has comment: http://stackoverflow.com/comment/35717257
has answer: http://stackoverflow.com/a/23326856
favorite count: 0
has comment: http://stackoverflow.com/comment/35717437

http://stackoverflow.com/comment/35824708
has text: No, it's saying it **may** use that amount, not (yet) using it.
type: AnswerComment
score: 3
comment on: http://stackoverflow.com/a/23385475
type: Comment

http://stackoverflow.com/comment/35895805
score: 0
comment on: http://stackoverflow.com/q/23422300
type: Comment
has text: You mean you want to use false ip addresses rather than having the ip address stripped?
type: QuestionComment

http://stackoverflow.com/comment/35772693
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23356811
type: AnswerComment
has text: then use master class, catch(Exception e){ out.println(e); }. Using this you can get any exception occured in your code. Please let me know why vote down?

http://stackoverflow.com/a/23373452
answers question: http://stackoverflow.com/q/23346204
upvote count: 5
downvote count: 0
has body: Hold on a second before you write a custom UriFragmentManager. Are you sure, you want to use URIs like /VaadinApp/login? If you only want to get rid of the ! in your URI fragments, you can follow Alexey's proposal and write a custom UriFragmentManager. But there is a good reason why Vaadin uses the shebang #! for URI fragments (look here). If you really don't want to use the hash mark, think twice. This would basically mean to go without URI fragments at all, which is not a road you'll want to travel with a single-page application framework like Vaadin. A Vaadin app runs on a single page and any user action and navigation is handled through lightweight Ajax requests. If you use a URL structure like /VaadinApp/login, /VaadinApp/profile, /VaadinApp/main etc., your Vaadin app would end up doing a full reload after each navigation step made by the user. This would result in an unacceptable flickering effect, since reloading a Vaadin app would mean a full rerendering of the page contents by the browser through the comparatively slow JavaScript engine. Make sure you reread the section about the Navigator component in the Book of Vaadin. Besides, even if not recommended, this solution is not possible to achieve by using a custom UriFragmentManager. That said, if you want to implement Alexey's solution you write a subclass of com.vaadin.navigator.Navigator.UriFragmentManager with the two methodes getState() and setState() as shown above (this proposed implementation simply forgoes the exclamation mark in contrast to the original implementation). Then you pass an instance of this custom fragment manager to the following one of Navigator's constructors: Navigator(UI ui, NavigationStateManager stateManager, ViewDisplay display) UriFragmentManager implements the NavigationStateManager interface.
score: 5
type: Answer

http://stackoverflow.com/comment/108884354
type: Comment
type: QuestionComment
score: 1
has text: https://github.com/eloyzone/jalali-calendar
comment on: http://stackoverflow.com/q/23385434

http://stackoverflow.com/comment/35932211
type: Comment
type: QuestionComment
score: 0
has text: `System.out.println(list2[])` will not even compile...
comment on: http://stackoverflow.com/q/23442986

http://stackoverflow.com/q/23431154
tagged with: java
tagged with: forms
has comment: http://stackoverflow.com/comment/35911008
tagged with: post
has comment: http://stackoverflow.com/comment/35910622
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/23431832
upvote count: 1
has title: HTML form handling in Java
downvote count: 0
tagged with: urlconnection
has comment: http://stackoverflow.com/comment/35910788
possible better answer: http://stackoverflow.com/a/23431802
favorite count: 0
has body: I am developing a Java project that uses the following website: http://feedenlarger.com/ The program essentially just inputs a link [ for example http://feeds.bbci.co.uk/news/rss.xml ] into the "Enter partial feed URL" box and submits the form. Once the form is submitted I want to download the page that a user would access if they manually filled out the form and clicked the button on the page. How can I do this in Java? I have managed to successfully download the page with the form using: private String readWebPage() throws IOException{ URL u = null; URLConnection urlC = null; BufferedInputStream bis = null; try{ u = new URL(this.url); urlC = u.openConnection(); headers = urlC.getHeaderFields(); bis = new BufferedInputStream(urlC.getInputStream()); StringBuilder builder = new StringBuilder(); int byteRead; while ((byteRead = bis.read()) != -1) builder.append((char) byteRead); bis.close(); return builder.toString(); } catch(IOException e){ System.out.println("Webpage: IO Error"); throw e; } } Note: I'm interested in keeping the headers in memory so using URLConnection or similar is preferable. How can I now fill in the form, submit using a POST/GET request and download the next webpage? I have tried downloading the page from the link generated by my browser once the form is submitted but this gives me a "forbidden" error. The compilable project I have been using is available here
has comment: http://stackoverflow.com/comment/35910327
has comment: http://stackoverflow.com/comment/35910549
has comment: http://stackoverflow.com/comment/35910485
has comment: http://stackoverflow.com/comment/35910918
has answer: http://stackoverflow.com/a/23431802
has comment: http://stackoverflow.com/comment/35910282
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23431832
score: 1

http://stackoverflow.com/q/23414274
accepted answer: http://stackoverflow.com/a/23415011
type: AnsweredQuestion
tagged with: performance
has answer: http://stackoverflow.com/a/23414415
has comment: http://stackoverflow.com/comment/35881007
tagged with: java
has comment: http://stackoverflow.com/comment/35880818
has comment: http://stackoverflow.com/comment/35880188
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/35881380
linked to: http://stackoverflow.com/q/1656506
tagged with: for-loop
downvote count: 0
tagged with: jquery
has answer: http://stackoverflow.com/a/23414385
has answer: http://stackoverflow.com/a/23414357
linked to: http://stackoverflow.com/q/3520688
has comment: http://stackoverflow.com/comment/35880402
possible better answer: http://stackoverflow.com/a/23414415
has answer: http://stackoverflow.com/a/23414389
has title: How can I enhance this for loop
favorite count: 0
tagged with: c++
has comment: http://stackoverflow.com/comment/35880067
has comment: http://stackoverflow.com/comment/35881629
score: 2
has body: I use sublime text as my text editor and I have always written my for loops like so: for(int i = 0; i &lt; lengthOfSomething; i++){} recently I was looking at the code hinter for the editor and I noticed it said "Enhaced For Loop" and it showed this to me: for(int i = lengthOfSomething - 1; i &gt;= 0; i--){} I am very curious as to how this is "enhanced" so that I can know and for anyone else who might be curious?
has comment: http://stackoverflow.com/comment/35879502
answer count: 5
has answer: http://stackoverflow.com/a/23415011
has comment: http://stackoverflow.com/comment/35879739

http://stackoverflow.com/q/23363419
has title: Return an instance of generic type from its Class
tagged with: java
possible better answer: http://stackoverflow.com/a/23363557
has answer: http://stackoverflow.com/a/23363557
type: Question
has answer: http://stackoverflow.com/a/23363491
answer count: 2
score: 0
tagged with: types
tagged with: generics
accepted answer: http://stackoverflow.com/a/23363491
has body: My classes are : public class Module {} public class WorkerModule extends Module{} public class WalkerModule extends Module{} I have a module factory with a static method to create modules : public static Module initializeModule(Class&lt;? extends Module myClass) { Module module = null; try { module = myClass.newInstance(); } catch (SecurityException e) { throw new ModuleException(e); } catch (InstantiationException e) { throw new ModuleException(e); } catch (IllegalAccessException e) { throw new ModuleException(e); } return module; } It works, but I would like to improve it by using generic types. I still need my method to return an instance of my class parameter, which I want to force to be a child of Module class. I don't know how to change my method's declaration. Maybe something like this: public static &lt;T&gt; T initializeModule(Class&lt;T extends Module myClass) {} but clearly, it's not that.
tagged with: instantiation
type: AnsweredQuestion

http://stackoverflow.com/comment/35946864
score: 0
has text: I'm not sure what they're called, I believe it may be `classes` as stated by you. I wan't the files with the C in the green circle as represented by Eclipse.
comment on: http://stackoverflow.com/q/23450479
type: QuestionComment
type: Comment

http://stackoverflow.com/a/23427059
has body: Please do not use the NullLayoutbut any other LayoutManager (consider using the GridLayout). The FlowLayout which is standard layout when initializing a JPanel and which you are using is not suitable for this task. Also your setBounds method calls are only relevant when using NullLayout... which you should not. Also you could implement this with a JList and not multiple JLabels. Please consider changing your code with this information and if there a questions left update your answer.
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/23427018
has comment: http://stackoverflow.com/comment/35902540
upvote count: 1
has comment: http://stackoverflow.com/comment/35902580

http://stackoverflow.com/comment/35714288
comment on: http://stackoverflow.com/q/23325250
type: Comment
type: QuestionComment
has text: Using an emulator to test?
score: 0

http://stackoverflow.com/a/23342745
answers question: http://stackoverflow.com/q/23341923
score: -1
upvote count: 0
has comment: http://stackoverflow.com/comment/35980466
has comment: http://stackoverflow.com/comment/67819619
type: Answer
has body: MVEL#executeExpression return the Object You have to cast it in Float Float result = (Float) MVEL.executeExpression(compileExpression, myVarFactory); like this Serializable compiled = MVEL.compileExpression("x * y"); Map&lt;String, Integer&gt; vars = new HashMap&lt;&gt;(); vars.put("x", new Integer(5)); vars.put("y", new Integer(10)); // Executes the compiled expression Integer result = (Integer) MVEL.executeExpression(compiled, vars); See Mvel doc
downvote count: 1

http://stackoverflow.com/q/23398154
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/62477160
has answer: http://stackoverflow.com/a/23398209
has body: I have this code and I was just wondering is my understanding of it correct. 5 is passed into the method numbers and n now equals 5. The if statement is false and therefore it does the else statement, and does numbers(5-1) and does the method numbers again and does NOT print out n or return yet. Now n = 4 and the same method is repeated till n = 1 at which point it hits return? and so from this point it returns to where n = 2, follows the prints 2 (System.out part) and then returns, at which point it returns to n = 3, prints 3 and returns..and so on all the way to 5? That is what i think is going on, could someone clarify this for me please, thank you! public class test { public static void main(String [] args){ numbers(5); } public static void numbers (int n){ if(n==1) return; else{ numbers(n-1); System.out.println(n); return; } } }
possible better answer: http://stackoverflow.com/a/23398340
type: Question
linked to: http://stackoverflow.com/q/25676961
has comment: http://stackoverflow.com/comment/35849084
has title: Recursive Method in java
has answer: http://stackoverflow.com/a/23398340
has comment: http://stackoverflow.com/comment/35849350
has answer: http://stackoverflow.com/a/23398434
upvote count: 2
has comment: http://stackoverflow.com/comment/35849119
answer count: 3
has comment: http://stackoverflow.com/comment/35849147
downvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/35848879
has comment: http://stackoverflow.com/comment/35849020
has comment: http://stackoverflow.com/comment/35848964
has comment: http://stackoverflow.com/comment/35849422
has comment: http://stackoverflow.com/comment/35849227
accepted answer: http://stackoverflow.com/a/23398209
tagged with: recursion
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35849209

http://stackoverflow.com/a/23311529
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23311417
has body: You're only checking the status of the ToggleButton at the time of creation, which means it will only ever have the default checked value you've set for that element in your XML. You need to create a listener to detect changes and update the TextView from within the listener. Code sample: b.setOnClickListener(new OnClickListener(){ @Override public void onClick(View v) { if(b.isChecked()) t.setText("I'm turned on"); else t.setText("I'm turned off"); } });
has comment: http://stackoverflow.com/comment/35690063
answers question: http://stackoverflow.com/q/23311417
type: Answer

http://stackoverflow.com/q/23370243
has comment: http://stackoverflow.com/comment/35797262
favorite count: 0
linked to: http://stackoverflow.com/q/3271249
tagged with: jdbc
has body: Normally, when we want to retrieve a value from our database which is present in the table, we call the appropriate method of ResultSet and pass it the column name which we want to retrieve. ResultSet rs= stmt.executeQuery("select name from db.persons where school ='"+sch+"'"); int count= rs.getString("person_name"); But when we want to get a count of rows (or fields) in a particular column (we use the SQL COUNT function), how do we retrieve the result. What argument should I pass in the rs.getInt() method in the following piece of code? ResultSet rs= stmt.executeQuery("select count(name) from db.persons where school ='"+sch+"'"); int count= rs.getInt( ????? );
has answer: http://stackoverflow.com/a/23370254
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/35797822
tagged with: mysql
upvote count: 1
has comment: http://stackoverflow.com/comment/35797366
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/35797851
accepted answer: http://stackoverflow.com/a/23370254
score: 0
linked to: http://stackoverflow.com/q/192078
has title: How to retrieve the result of SQL COUNT function from the result set?
tagged with: sql
answer count: 1

apache
tags question: http://stackoverflow.com/q/23366606
tag name: apache
tags question: http://stackoverflow.com/q/23331742
tags question: http://stackoverflow.com/q/23376760
tags question: http://stackoverflow.com/q/23438017
tags question: http://stackoverflow.com/q/23407426
tags question: http://stackoverflow.com/q/23291666
tags question: http://stackoverflow.com/q/23306067
tags question: http://stackoverflow.com/q/23291528
tags question: http://stackoverflow.com/q/23324588
tags question: http://stackoverflow.com/q/23363949
tags question: http://stackoverflow.com/q/23342133
tags question: http://stackoverflow.com/q/23340608
tags question: http://stackoverflow.com/q/23436056
tags question: http://stackoverflow.com/q/23307235
tags question: http://stackoverflow.com/q/23425250
tags question: http://stackoverflow.com/q/23338997
tags question: http://stackoverflow.com/q/23452286
tags question: http://stackoverflow.com/q/23360088
tags question: http://stackoverflow.com/q/23306915
tags question: http://stackoverflow.com/q/23294894
tags question: http://stackoverflow.com/q/23377520
tags question: http://stackoverflow.com/q/23421673
type: Tag
tags question: http://stackoverflow.com/q/23397280
tags question: http://stackoverflow.com/q/23388828
tags question: http://stackoverflow.com/q/23389044

http://stackoverflow.com/comment/35804255
type: QuestionComment
comment on: http://stackoverflow.com/q/23373981
has text: Take a look [here](http://stackoverflow.com/questions/2580925/simpledateformat-parsing-date-with-z-literal)
score: 0
type: Comment

http://stackoverflow.com/a/23378290
upvote count: 3
has body: I hammered together the class that I needed using the AnimateMotion classes from Batik to interpolate through the path, it has no dependency with AWT or android. If anyone wants to use it it's in the following repository. The only dependency is libgdx Vector2 that can be easily replaced by any other 2 point class http://github.com/ibrabeicker/bezier
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23352603
accepted answer of: http://stackoverflow.com/q/23352603
score: 3
type: Answer

http://stackoverflow.com/comment/35734320
comment on: http://stackoverflow.com/a/23335737
score: 0
type: AnswerComment
type: Comment
has text: The length of the array is always static, as defined by the protocol. I've managed to get around this, by moving the processing outside of the super constructor to a function. This means that variables from the sub class have been initialized, and as such array lengths and initial values are accessible. As your answer helped me the most in getting to this point, I'll accept it. Thanks

http://stackoverflow.com/a/23432679
score: 0
has comment: http://stackoverflow.com/comment/35913223
type: Answer
answers question: http://stackoverflow.com/q/23429231
accepted answer of: http://stackoverflow.com/q/23429231
has comment: http://stackoverflow.com/comment/35917050
has comment: http://stackoverflow.com/comment/35917137
has body: If you want to read bytes, don't use Readers. A Reader reads chars (not bytes). If you need to read bytes, use low-level input-output classes (InputStream/OutputStream).
type: AcceptedAnswer

singleton
tags question: http://stackoverflow.com/q/23351816
type: Tag
tags question: http://stackoverflow.com/q/23448875
tags question: http://stackoverflow.com/q/23293572
tags question: http://stackoverflow.com/q/23344552
tags question: http://stackoverflow.com/q/23415240
tags question: http://stackoverflow.com/q/23445434
tag name: singleton

http://stackoverflow.com/a/23419039
accepted answer of: http://stackoverflow.com/q/23418907
type: AcceptedAnswer
score: 0
type: Answer
has body: <?xml version="1.0" encoding="utf-8"?> <uses-sdk android:minSdkVersion="10" android:targetSdkVersion="19" /> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" />
answers question: http://stackoverflow.com/q/23418907

http://stackoverflow.com/a/23416367
answers question: http://stackoverflow.com/q/23416248
type: Answer
score: 0
has body: piratewords.txt file should be available inside a classpath or else we need to specify full absolute path of the location where the file is. looks like when you are running it from command line, you are not keeping this file in the required classpath. better give absolute path of the file and check it. absolute path like below BufferedReader in = new BufferedReader( new FileReader("C:/Users/karibasappagc/Desktop/piratewords.txt")); and make sure file existence in the specified path.

http://stackoverflow.com/q/23306791
tagged with: java
tagged with: hibernate
has title: Spring 3 MVC + Hibernate 3.5.x : Autowiring and Dependency Injection of SessionFactory
answer count: 1
accepted answer: http://stackoverflow.com/a/23306887
tagged with: spring
tagged with: spring-mvc
type: AnsweredQuestion
score: 0
has body: I am new to Spring framework; need some clarifications on how the SessionFactory object Dependency injection is working in below code. spring-servlet.xml <context:annotation-config /> <context:component-scan base-package="com.employee" /> classpath:employee.cfg.xml org.hibernate.cfg.AnnotationConfiguration ${jdbc.dialect} true <tx:annotation-driven /> EmployeeDAOImpl.java import org.hibernate.SessionFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Repository; @Repository public class EmployeeDAOImpl implements EmployeeDAO { @Autowired private SessionFactory sessionFactory; @Override public void addEmployee(EmployeeForm employee) { sessionFactory.getCurrentSession().save(employee); } } How is the sessionFactory getting initialized with a SessionFactory object here? What I understand In the sprng-servlet.xml file, the DI of sessionFactory is happening in the below code: Now, if I open the source code for the class org.springframework.orm.hibernate3.HibernateTransactionManager, then I can see the below section: private SessionFactory sessionFactory; public HibernateTransactionManager(SessionFactory sessionFactory){ this.sessionFactory = sessionFactory; afterPropertiesSet(); } public void setSessionFactory(SessionFactory sessionFactory){ this.sessionFactory = sessionFactory; } public SessionFactory getSessionFactory(){ return this.sessionFactory; } which means the sessionFactory class variable of org.springframework.orm.hibernate3.HibernateTransactionManager has been initializd. Now my Query: In my code posted above, how is the sessionFactory of class EmployeeDAOImpl.java getting initialized? I can't find any relation between the sessionFactory of class org.springframework.orm.hibernate3.HibernateTransactionManager (where DI is happening) and the sessionFactory of class EmployeeDAOImpl.java (which I wrote). Then how is it working? Please explain - totally confused !!!
type: Question
has answer: http://stackoverflow.com/a/23306887
tagged with: dependency-injection

jvm-crash
tags question: http://stackoverflow.com/q/23370449
tag name: jvm-crash
type: Tag
tags question: http://stackoverflow.com/q/23392241
tags question: http://stackoverflow.com/q/23384338

http://stackoverflow.com/a/23446616
type: Answer
upvote count: 1
score: 1
downvote count: 0
has body: In addition to myborobudur's answer I'll only mention, that you don't need to use memory database, as you can for an instance use file storage (Embedded) or even run H2 as a server and then connect to it with TCP in Server Mode... Everything is clearly described in H2 documentation.
answers question: http://stackoverflow.com/q/23434988

http://stackoverflow.com/a/23424772
score: 1
has comment: http://stackoverflow.com/comment/35902196
answers question: http://stackoverflow.com/q/23424685
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/35899357
has body: You have task.execute("getLatest").get(); You should not call get() as this blocks the ui thread waiting for the result making it asynctask asynchronous no more. Just use task.execute("getLatest"); You can return result in doInBackground and update ui in onPostExecute.
downvote count: 0
has comment: http://stackoverflow.com/comment/35902237

http://stackoverflow.com/comment/35674649
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23303225
has text: In Java 8, using a collection and the stream API, you could do it without a loop, but I am not sure as to what your exact question is, and neither do I really understand what your code does, or what it is supposed to do.

http://stackoverflow.com/comment/35707158
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/23321428
type: Comment
has text: `EAmount and DAmount are both 2 then pick one of them by random.` Why so?

http://stackoverflow.com/a/23350057
type: Answer
answers question: http://stackoverflow.com/q/23349943
score: 2
downvote count: 0
upvote count: 2
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23349943
has body: The problem here is in the tiles array. It has 64 (8 * 8) elements during initialization, whilst by specifying i &lt; MAP_SIZE * MAP_SIZE (MAP_SIZE = 64) as stop-rule at you loop you are trying to go beyond this limit. I belive it should be: public int[] tiles = new int[MAP_SIZE * MAP_SIZE]

http://stackoverflow.com/q/23366617
has comment: http://stackoverflow.com/comment/35790133
type: AnsweredQuestion
tagged with: java
score: -4
has comment: http://stackoverflow.com/comment/35790286
has comment: http://stackoverflow.com/comment/35790424
type: Question
upvote count: 0
has comment: http://stackoverflow.com/comment/35790274
has answer: http://stackoverflow.com/a/23366892
downvote count: 4
has comment: http://stackoverflow.com/comment/35790093
has title: Code Loops Infinitly
answer count: 1
has comment: http://stackoverflow.com/comment/35790205
tagged with: string
favorite count: 0
has comment: http://stackoverflow.com/comment/35790476
has comment: http://stackoverflow.com/comment/35790144
accepted answer: http://stackoverflow.com/a/23366892
has body: I am creating a game where a user has to guess a letter which is in the word, if they guess correctly it displays the letter in the word if they guess incorrectly, it subtracts a life. the problem is if they guess correctly, it prints out the word for infiniti. Here is my code: char words[] = new char[getRandomPirateWord().length()]; char words2[] = new char[getRandomPirateWord().length()]; for(int i = 0; i &lt; getRandomPirateWord().length(); i++) { words[i] = getRandomPirateWord().charAt(i); words2[i] = (getRandomPirateWord().charAt(i)==' ')?' ':'*'; } while(getGuessLeft()&gt;0) { getLettersGuesed().add(letter); if (!randomPirateWord.contains(letter+"")) { setGuessLeft(getGuessLeft() - 1); System.out.println("You lost a life, now have " + getGuessLeft()); } for(int i1 = 0; i1 &lt;getRandomPirateWord().length(); i1++) { if(words[i1] == letter) { words2[i1] = letter; } } for(int i1 = 0; i1 &lt; getRandomPirateWord().length(); i1++) { System.out.print(words2[i1]);

http://stackoverflow.com/a/23386900
upvote count: 2
score: 2
answers question: http://stackoverflow.com/q/23386754
has body: You have to check if it exists before you access it while(iterate.hasNext()){ String firstwindow = iterate.next(); } Documentation states that boolean hasNext() Returns true if the iteration has more elements. (In other words, returns true if next() would return an element rather than throwing an exception.) Returns: true if the iteration has more elements iterate.next() Throws: NoSuchElementException - if the iteration has no more elements This is what happens in your case.
downvote count: 0
type: Answer

http://stackoverflow.com/comment/35683865
score: 0
comment on: http://stackoverflow.com/q/23308254
type: Comment
type: QuestionComment
has text: The feature vectors should not be rearranged in a random order before splitting

http://stackoverflow.com/a/23425548
has body: Well when you go with CE and you are just starting with liferay than it is always preferable to start with the latest version. Reasons: Here is a one from Liferay Staff Bugs are always there, but 6.2 GA2 solves most of them and there would be other versions coming out for 6.2 which would solve more bugs. If you find any bugs in 6.1, there would be no newer version for this. So it is better to go with 6.2. Hope this helps.
upvote count: 2
type: Answer
answers question: http://stackoverflow.com/q/23425272
score: 2
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23425272
downvote count: 0

http://stackoverflow.com/a/23348636
type: Answer
has body: First of all, I'm going to guess that the blog you mentioned was actually discussing C++. In Java, it's a compiler error to declare an abstract method within a class that is declared with the abstract keyword. With that said, Consider this (erroneous) code: class A { abstract void foo(); } A a = new A(); a.foo(); //Whoa! what are we supposed to do??! If A had been declared as abstract (as would be required in real code), it would have been impossible to instantiate it. If any part of a class is missing (that is, it is declared abstract), the class must be abstract because parts of it cannot be used. In C++, there is no abstract keyword-- a class is automatically abstract if it has any abstract methods (referred to as pure virtual functions in C++). In Java on the other hand, a class is only abstract if it is declared with the abstract keyword. However, this keyword is required if there are any abstract methods, so the only difference between the two systems in practice is that Java allows abstract classes to not have any abstract methods. In both languages, a class must be abstract if it has any abstract methods: in C++, this is simply how abstract classes are defined, and in Java it is required via the mechanics of the abstract keyword.
has comment: http://stackoverflow.com/comment/35757507
score: 2
has comment: http://stackoverflow.com/comment/35757848
upvote count: 2
has comment: http://stackoverflow.com/comment/35757734
answers question: http://stackoverflow.com/q/23348539
downvote count: 0

http://stackoverflow.com/q/23298136
tagged with: java
tagged with: bcrypt
has title: Best salting rule in bcrypt algorithm
has body: I am trying to generate signature token for distributed environment with java bcrypt algorithm,I want my token to be salted by some random string, just wanted suggestion about what can be the best way to create salt in this case so that I can retrieve my original string easily in other end.I started my implementation with sessionid, but sessionid wont be strong salt
type: Question
has comment: http://stackoverflow.com/comment/35683143
has comment: http://stackoverflow.com/comment/35728750
tagged with: security
score: 0
has comment: http://stackoverflow.com/comment/35669901
has comment: http://stackoverflow.com/comment/35719969
has comment: http://stackoverflow.com/comment/35693758
has comment: http://stackoverflow.com/comment/35683152
has comment: http://stackoverflow.com/comment/35688969
type: UnansweredQuestion
answer count: 0

http://stackoverflow.com/comment/35670471
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23301124
has text: Can you show the code with which you are having a problem?

http://stackoverflow.com/a/23435049
answers question: http://stackoverflow.com/q/23434539
upvote count: 1
has body: While what you have is a bit of a mess, I suspect that your actual problem is that you're using an assignment operator (=) where you actually need a comparison operator (==). It's a classic beginner's trap in Java (and other languages, too, for that matter). The single equals sign means take the variable to the left of the sign, and assign it the value you get by evaluating the right side of the sign. a = b + 3 Would assign the value b + 3 to a. The double equals sign means to compare the two values. a == b + 3 Asks the question "is a 3 more than b". Inside an if statement's condition in Java, you are required to ask such a question (you need a boolean). The error message you should get from using the wrong one would be something like "Cannot convert from int to boolean."
type: AcceptedAnswer
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/23434539
type: Answer

http://stackoverflow.com/comment/35755014
has text: Thanks. The whole arbitrary and floating point thing is a bit over my head at the moment and I'm not familiar with the BigDecimal class yet. Our assignment is meant to demonstrate our ability to extend abstract classes.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23347393

http://stackoverflow.com/q/23404736
has title: What do "." and ".." mean in a file path in Android (Java)
accepted answer: http://stackoverflow.com/a/23404748
type: Question
has answer: http://stackoverflow.com/a/23404784
upvote count: 5
tagged with: java
possible better answer: http://stackoverflow.com/a/23404784
downvote count: 4
tagged with: symlink
answer count: 3
has comment: http://stackoverflow.com/comment/35860735
score: 1
has answer: http://stackoverflow.com/a/23404910
favorite count: 0
has body: For example in this path: ../..pictures/Sergey_Brin/Sergey And this path: ./videos/./Larry_Page I know that the dots are some kind of symbolic links. But what do they mean exactly and what's the difference between the two.
tagged with: android
tagged with: path
has answer: http://stackoverflow.com/a/23404748
type: AnsweredQuestion

http://stackoverflow.com/comment/38684819
has text: yes this worked, i needed the eclipse_compat version. please add this as an answer instead of a comment and i will give the bounty.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24860365
type: Comment

http://stackoverflow.com/q/23356244
tagged with: spring
has body: My project initially develop using with out persistence unit and project is spring,Struts2 hibernate intergration one. Now I need to use jboss connection pool and persistence unit. Can any one guild me to shortest way to convert project in that requirement. current spring.xml <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd"> properties/database.properties org.hibernate.dialect.OracleDialect true update true model.AtOrganisation model.AtDivision sample DAO class public class DevisionDaoImpl implements DevisionDao { private SessionFactory sessionfactory; public void setSessionfactory(SessionFactory sessionfactory) { this.sessionfactory = sessionfactory; } @Override public List showDiv() { // TODO Auto-generated method stub return null; } @Override public void addDiv(AtDivision div) { Session session = sessionfactory.openSession(); Transaction tx = null; try { tx = session.beginTransaction(); session.saveOrUpdate(div); tx.commit(); //System.out.println("after save : " + org.getAoId()); } catch (Exception e) { if (tx != null) { tx.rollback(); } e.printStackTrace(); } finally { session.close(); } } }
has answer: http://stackoverflow.com/a/23356453
has comment: http://stackoverflow.com/comment/35771373
tagged with: java
tagged with: hibernate
tagged with: jboss
type: Question
tagged with: struts2
score: 0
answer count: 1
has title: Spring and persistence unit with jboss
has comment: http://stackoverflow.com/comment/35771335
type: UnansweredQuestion

http://stackoverflow.com/comment/35789846
comment on: http://stackoverflow.com/q/23365985
type: Comment
type: QuestionComment
score: 0
has text: Well, there is a difference between full screen and maximize, so which one is it?

http://stackoverflow.com/a/23402030
answers question: http://stackoverflow.com/q/23389221
upvote count: 7
type: Answer
downvote count: 0
has body: Click Project &gt; Build Automatically once and make sure that tick mark is appeared in front of Build Automatically option. Also you have to enable hot code replace options. Click Windows &gt; Preferences. Go to Java &gt; Debug select all options in Hot Code Replace group
has comment: http://stackoverflow.com/comment/74122882
score: 7
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23389221

http://stackoverflow.com/comment/79010141
score: 0
type: Comment
type: QuestionComment
has text: I had the same problem. None of the solutions below worked. I created a new file with the right encoding and then copied and pasted the contents of the class (.java). It worked for me. Previous to that the unknown character kept reinserting itself when I run ant, event when I explicitly deleted it and saved the file. Weird right?
comment on: http://stackoverflow.com/q/23399865

http://stackoverflow.com/comment/35779908
has text: sorry, it is `Integer.toHexString()` Integer is a standard class, you don't even have to import it. http://docs.oracle.com/javase/7/docs/api/java/lang/Integer.html#toHexString(int)
comment on: http://stackoverflow.com/q/23360017
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23353661
type: Answer
accepted answer of: http://stackoverflow.com/q/23350956
answers question: http://stackoverflow.com/q/23350956
score: 1
upvote count: 1
has body: So there are at least two problems in your setValueAt method... Columns (and rows) are 0 indexed switch statements will allow for a case to be executed and all child cases below as well... So, this means... public void setValueAt(Object value, int row, int column) { switch(column) { case 1: basketItems.get(row).setBrand((String)value); case 2: basketItems.get(row).setModel((String)value); case 3: basketItems.get(row).setPrice((double)value); case 4: basketItems.get(row).setQuantity(Integer.parseInt((String) value)); case 5: basketItems.get(row).setTotalPrice(Double.parseDouble((String) value)); } } If column == 1, the cases 1, 2, 3, 4 and 5 will be executed. If column == 3, the cases 3, 4 and 5 will be executed. So, first, you will want to modify the switch so that the cases match the same order as the getValueAt method and add a break statement after each case in order to prevent the following cases from been executed, for example... public void setValueAt(Object value, int row, int column) { switch(column) { case 0: basketItems.get(row).setBrand((String)value); break; case 1: basketItems.get(row).setModel((String)value); break; case 2: basketItems.get(row).setPrice((double)value); break; case 3: basketItems.get(row).setQuantity(Integer.parseInt((String) value)); break; case 4: basketItems.get(row).setTotalPrice(Double.parseDouble((String) value)); break; } }
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/23332039
answers question: http://stackoverflow.com/q/23331935
has comment: http://stackoverflow.com/comment/35727465
has body: DateFormat df = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss", Locale.CANADA); Now try... It'll work. With this you have to add 1 with your month. code is here: String convertDate="03/19/2014 5:30:10 PM"; DateFormat df = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss", Locale.CANADA); Date myDate=new Date(); try { myDate=df.parse(convertDate); final Calendar c = Calendar.getInstance(); c.setTime(myDate); int y,m,d; y=Calendar.YEAR; System.out.println("Year = " + c.get(Calendar.YEAR)); //Log.d("Year", y); System.out.println("Month = " + (c.get(Calendar.MONTH)+1)); System.out.println("Day = " + c.get(Calendar.DATE)); } catch (ParseException e1) { // TODO Auto-generated catch block e1.printStackTrace(); }
type: Answer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/35727206
upvote count: 1
accepted answer of: http://stackoverflow.com/q/23331935
type: AcceptedAnswer

http://stackoverflow.com/comment/35899628
has text: so you dont want the pop-up to be shown after you reload every time , so you can set the value in the query string like this `response.sendRedirect("index.jsp?booVal="+valueHere);`
comment on: http://stackoverflow.com/a/23425033
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/72610605
type: AnswerComment
has text: Assuming the `db` object is shared between threads. And, assuming you cannot capture an event when the operations are done or you are not using any utilities such as observables. The only way I can think is to manually keep track by having an int represent the number of threads and then each time one one is done, decrement, and then check whether to close or not.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23293930

http://stackoverflow.com/q/23387805
tagged with: android
has body: I have a custom expandable list view made of two custom objects. I want to have a click effect on the list's child items so the user knows which item they are clicking. The issue is, after creating the custom adapter I cannot get child on click effect. I have a selector in my drawable folder and I am assigning it to my Expandable list view like this and for some reason it is not working. Can anyone help me figure this out. Thanks main.xml &lt;FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/container" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="com.example.grr.MainActivity" tools:ignore="MergeRootFrame" &gt; &lt;ExpandableListView android:id="@+id/expandableListView1" android:choiceMode="singleChoice" android:layout_width="match_parent" android:listSelector="@drawable/list_selector" android:layout_height="wrap_content" &gt; &lt;/ExpandableListView&gt; &lt;/FrameLayout&gt; and my selector.xml &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;selector xmlns:android="http://schemas.android.com/apk/res/android"&gt; &lt;item android:drawable="@android:color/black" android:state_pressed="true" /&gt; &lt;item android:drawable="@android:color/darker_gray" android:state_checked="true" /&gt; &lt;item android:drawable="@android:color/white" android:state_selected="true" /&gt; &lt;/selector&gt; and this is my CustomAdapter class public class ExpandableListAdapter extends BaseExpandableListAdapter { private Context _context; private List&lt;MainBodyArea&gt; _listDataHeader; private HashMap&lt;MainBodyArea, List&lt;SubBodyArea&gt;&gt; _listDataChild; public ExpandableListAdapter(Context context, List&lt;MainBodyArea&gt; listDataHeader, HashMap&lt;MainBodyArea, List&lt;SubBodyArea&gt;&gt; listChildData) { this._context = context; this._listDataHeader = listDataHeader; this._listDataChild = listChildData; } @Override public Object getChild(int groupPositi…
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/31797160
tagged with: expandablelistview
type: Question
score: 3
tagged with: java
has answer: http://stackoverflow.com/a/31797160
upvote count: 3
downvote count: 0
answer count: 1
has title: How to set selector for custom expandable listview child
favorite count: 0

http://stackoverflow.com/comment/35823045
comment on: http://stackoverflow.com/q/23384369
type: Comment
type: QuestionComment
score: 3
has text: http://docs.oracle.com/javase/tutorial/java/generics/index.html try generics

http://stackoverflow.com/q/23325301
type: Question
upvote count: 2
answer count: 2
tagged with: perl
has answer: http://stackoverflow.com/a/23325870
accepted answer: http://stackoverflow.com/a/23325870
has title: Starting JVM for Inline
tagged with: jvm
favorite count: 0
has body: I have a Perl script that uses Inline::Java and just has to fork (it is a server and I want it to handle multiple connections simultaneously). So I wanted to implement this solution which makes use of a shared JVM with SHARED_JVM =&gt; 1. Since the JVM is not shutdown when the script exits, I want to reuse it with START_JVM =&gt; 0. But since it might just be the first time I start the server, I would also like to have a BEGIN block make sure a JVM is running before calling use Inline. My question is very simple, but I couldn't find any answer on the web: How do I simply start a JVM? I've looked at man java and there seems to be just no option that means "start and just listen for connections". Here is a simplified version of what I'm trying to do in Perl, if this helps: BEGIN { &amp;start_jvm unless &amp;jvm_is_running; } use Inline ( Java =&gt; 'STUDY', SHARED_JVM =&gt; 1, START_JVM =&gt; 0, STUDY =&gt; ['JavaStuff'], ); if (fork) { JavaStuff-&gt;do_something; wait; } else { Inline::Java::reconnect_JVM(); JavaStuff-&gt;do_something; } What I need help with is writing the start_jvm subroutine.
score: 2
type: AnsweredQuestion
downvote count: 0
tagged with: java
possible better answer: http://stackoverflow.com/a/23337012
has answer: http://stackoverflow.com/a/23337012

http://stackoverflow.com/comment/35900185
comment on: http://stackoverflow.com/a/23396214
type: Comment
has text: You do quantize your coefficients, don't you? Once the coefficients are quantized (lossy), the rest of the process should be lossless. Why don't you post your code?
score: 0
type: AnswerComment

http://stackoverflow.com/a/23425479
accepted answer of: http://stackoverflow.com/q/23425191
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 2
has body: Make the change as below: public class ScannerTest { public static void main(String ...args)throws ClassNotFoundException,SQLException,FileNotFoundException { File f =new File("/home/rahul/Desktop/emp.txt"); Scanner s=new Scanner(f); Class.forName("oracle.jdbc.driver.OracleDriver"); Connection con=DriverManager.getConnection("jdbc:oracle:thin:@172.22.22.131:1521:orcl","Demo","demo"); while(s.hasNext()) { PreparedStatement st=con.prepareStatement("Insert into Employee values(?,?,?)"); String rcd = s.next(); Scanner s1 = new Scanner(rcd); s1.useDelimiter(",|\\n"); String name=s1.next(); int id=s1.nextInt(); int sal=s1.nextInt(); st.setString(1,name); st.setInt(2,id); st.setInt(3,sal); int result=st.executeUpdate(); System.out.println("Records Changed: "+ result); } con.close(); } } }
upvote count: 2
has comment: http://stackoverflow.com/comment/35900698
has comment: http://stackoverflow.com/comment/35904003
answers question: http://stackoverflow.com/q/23425191

http://stackoverflow.com/q/23362782
downvote count: 0
has answer: http://stackoverflow.com/a/23364991
accepted answer: http://stackoverflow.com/a/23364991
tagged with: relational-database
answer count: 1
favorite count: 0
has body: I've been using H2 on the functional tests part of a MySQL based application with Hibernate. I was finally fed up with it and I decided to usq jOOQ mostly so I could still abstract myself from the underlying database. My problem is that I don't like this code generation thing jOOQ does at all since I'm yet to see an example with it properly set up in multiple profiles, also don't like connecting to the database as part of my build. It's overall quite a nasty set-up I don't want to spend a morning doing to realise is very horrible and I don't want it in the project. I'm using tableByName() and fieldByName() instead which I thought was a good solution, but I'm getting problems with H2 putting everything in uppercase. If I do something like Query deleteInclusiveQuery = jooqContext.delete(tableByName("inclusive_test"))... I get table inclusive_test not found. Note this has nothing to do with the connection delay or closing configuration. I tried changing the connection to use ;DATABASE_TO_UPPER=false but then I get field not found (I thought it would translate all schema). I'm not sure if H2 is either unable to create non-upper cased schemas or I'm failing at that. If the former then I'd expect jOOQ to also upper case the table and field names in the query. example output is: delete from "inclusive_test" where "segment_id" in (select "id" from "segment" where "external_taxonomy_id" = 1) which would be correct if H2 schema would have not been created like this, however the query I'm creating the schema with specifically puts it in lowercase, yet in the end it ends up being upper cased, which Hibernate seems to understand or solve, but not jOOQ Anyway, I'm asking if there is a solution because I'm quite disappointed at the moment and I'm considering just dropping the tests where I can't use Hibernate. Any solution that is not using the code generation feature is welcome.
tagged with: jooq
upvote count: 5
has comment: http://stackoverflow.com/comment/35786471
has comment: http://stackoverflow.com/comment/35789132
type: AnsweredQuestion
has title: jOOQ H2 Case sensitivity issues without codegen
tagged with: java
tagged with: h2
tagged with: mysql
type: Question
score: 5

http://stackoverflow.com/comment/35890586
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23420268
score: 0
has text: so yes it works if I remove the `@Profile` annotation, but always returns `MockIFS`

http://stackoverflow.com/q/23341601
type: Question
linked to: http://stackoverflow.com/q/23440866
has title: smack connection using servlets
tagged with: java
tagged with: servlets
tagged with: chat
score: 0
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/23341668
tagged with: facebook
tagged with: smack
type: AnsweredQuestion
has body: Here I am connecting to facebook using smack and servlets ,I can able to send and receive chat messages. But here connection object is instance variable(not thread-safe),so all the users are getting same connection object. If we declare XMPPConnection object inside doGet() method we have to take connection every time when the user send chat message. provide some solution for my problem. public class Home_page_action extends HttpServlet implements MessageListener{ public XMPPConnection connection; public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { if(connection!=null) {connection.connect("uname","password");} else{ //send message code to target user } } }
upvote count: 1
accepted answer: http://stackoverflow.com/a/23341668
downvote count: 1

http://stackoverflow.com/comment/35887202
comment on: http://stackoverflow.com/q/23417786
has text: If you are using a `JPanel` (and if you are using it properly), you **are** using double buffering already. Obey what MadProgrammer says, he knows what he's talking about. BTW: `Graphics#dispose()` is intended for `Graphics` objects that, for example, have been obtained from a `BufferedImage`, or created by calling `Graphics#copy()` on another `Graphics` object. You should most likely **not** call this here.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23395939
has answer: http://stackoverflow.com/a/23471166
type: Question
answer count: 2
score: 5
upvote count: 5
downvote count: 0
has comment: http://stackoverflow.com/comment/35845601
possible better answer: http://stackoverflow.com/a/23396624
tagged with: dropwizard
tagged with: yaml
favorite count: 0
tagged with: web-services
accepted answer: http://stackoverflow.com/a/23471166
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23396624
has body: While working with dropwizard, My dropwizard service reads the config.yml file. public void run() throws Exception { this.run(new String[] { "server", "src/main/resources/config.yml" }); } Config.yml file : database: # the name of your JDBC driver driverClass: com.mysql.jdbc.Driver # the username user: user2connect # the password password: password2connect # the JDBC URL url: jdbc:mysql://url.to.connect:port But, I am getting an error as soon as the file is read - Exception in thread "main" com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "database" (class com.service.config.DropWizardConfiguration), not marked as ignorable (4 known properties: , "http", "httpConfiguration", "logging", "loggingConfiguration"]) at [Source: N/A; line: -1, column: -1] (through reference chain: com.service.config.DropWizardConfiguration["database"]) After going through few topics, I realized that this might be causing because of Jackson is not able to ignore few properties. I tried couple of things - 1) Added annotation @JsonIgnoreProperty (But not sure if I added it at expected place) 2) Jackson how to ignore properties None of them helped. Can anyone point me what I might be missing here?
has title: UnrecognizedPropertyException while reading a yaml file
tagged with: java

http://stackoverflow.com/q/23310235
has answer: http://stackoverflow.com/a/58037900
type: Question
tagged with: for-loop
tagged with: arrays
score: 0
answer count: 3
tagged with: matrix
has answer: http://stackoverflow.com/a/23310514
favorite count: 0
has answer: http://stackoverflow.com/a/64272963
has body: I am trying to figure this out. How to write a java program that finds the amicable pairs under a certain value, i.e 10000, so it has to compare all numbers from 0 to that limit within each other, and find out which are the amicable pairs. Then i must have the output as a 2 column matrix. I sort out the formula of calculating the proper divisors of a number and then sum it up. But i can not go further with the for-loop that will compare the numbers together, and the final output which will give me the result as a 2 column matrix. So far I am by the sum of factors or dividers, and this is what I have public class Amicable { public static int sumfactors(int n) { int sum=0; for(int div=1; div&lt;=n; div++) { if(n%div==0) { sum +=div; } } return sum-n; } }
upvote count: 1
has title: Java program to find amicable pairs below 10000 and give an output as a 2 column matrix
downvote count: 1
type: AnsweredQuestion
tagged with: 2d
tagged with: java
accepted answer: http://stackoverflow.com/a/23310514
possible better answer: http://stackoverflow.com/a/58037900

http://stackoverflow.com/comment/35790724
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23347220
type: AnswerComment
has text: http://stackoverflow.com/questions/5730890/why-is-a-lck-file-created-and-not-deleted-by-java-logging/20005326#20005326

http://stackoverflow.com/q/23349811
tagged with: android
score: -1
tagged with: c++
has body: Hi i'm implementing an android application, but this is offtopic. I have a slider which can take valus between 0...16581375 (255*255*255), means all rgb values. now technically this does work: testText.setTextColor(0xff000000 + progress); but when i'm sliding the color is flickering verry hard. How can i distribute the colors more harmonic
tagged with: java
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/23350623
tagged with: rgb
upvote count: 0
answer count: 1
tagged with: picker
favorite count: 0
has title: Color Picker with one single Slider
type: UnansweredQuestion

http://stackoverflow.com/comment/35838159
score: 0
has text: Android Studio is using Gradle.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23392516

http://stackoverflow.com/comment/35862700
has text: have posted what Ive got now. Im terrible at Java only ever really worked with JS and CSS etc. So it is probably wrong in multiple places
comment on: http://stackoverflow.com/q/23405706
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/35709396
comment on: http://stackoverflow.com/q/23322686
type: Comment
score: 3
has text: Why not create and close (if you really want to; it won't matter for System.in) the `Scanner` in `main`, and pass it to `acceptValidInput` as a parameter? As an aside, I wouldn't use recursion here anyway.
type: QuestionComment

http://stackoverflow.com/comment/35737266
comment on: http://stackoverflow.com/q/23337653
type: Comment
type: QuestionComment
score: 0
has text: Where is name populated? I assume you want to refer to `customer.name` within the `infoCustomer` method.

http://stackoverflow.com/comment/35897548
type: AnswerComment
comment on: http://stackoverflow.com/a/23423778
type: Comment
has text: Indeed, seems I did not notice the `Sensitive` column in the table.
score: 0

http://stackoverflow.com/a/23419570
upvote count: 3
has comment: http://stackoverflow.com/comment/35889422
has comment: http://stackoverflow.com/comment/35889318
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/35889721
score: 3
has comment: http://stackoverflow.com/comment/35889302
has body: why is it that New York displays correctly but London doesn't display at all? By default a JFrame uses a BorderLayout. Also by default when you add a component to the frame it will be added to the "CENTER" of the BorderLayout. However, only one component can be displayed in the center, so only the last component added (New York) is displayed. I don't really understand what you are attempting to do so I can't suggest a complete solution, but the basic solution is to use a different layout manager to manage the components. Read the section from the Swing tutorial on Layout Managers for more information. As a simple example to get you started add the following to see the difference: clockFrame = new JFrame("World Clock"); clockFrame.setLayout( new FlowLayout() );
has comment: http://stackoverflow.com/comment/35889530
answers question: http://stackoverflow.com/q/23419553

http://stackoverflow.com/comment/35811611
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23377944
type: Comment
has text: I originally had that, but I have 8 different tasks so I wanted to clean up the code a little bit and put the summation of the slider values in a separate method and just pass the value that I need. For example addTask1 would get value1, addTask2 would get value2, etc. I will try the array method.

http://stackoverflow.com/q/23428369
tagged with: android
tagged with: robotium
has comment: http://stackoverflow.com/comment/35960583
tagged with: java
has body: I am working an app with multiple Buttons to preinstalled apps on the phone (browser, phone, etc.) and I want robotium to test the app by clicking on each of them in order, go back to the application and then click the next button. How can I do this? What I did till now is the following code for each button: public void testBrowser() throws Exception { Log.i(TAG, "test browser"); Thread.sleep(2000); solo.clickOnButton("Start Browser"); solo.assertCurrentActivity("Should be browser activity",MainActivity.class); solo.takeScreenshot(); solo.goBack(); but it always does the first one and skips to the last one and it never closes it.
type: Question
has title: click on multiple buttons inorder with robotium not working
has comment: http://stackoverflow.com/comment/35914640
has answer: http://stackoverflow.com/a/23462680
score: 0
answer count: 1
type: UnansweredQuestion

http://stackoverflow.com/a/23298629
downvote count: 0
type: Answer
score: 9
has body: Your function actually has to return BoxedUnit.UNIT, which is the unit in question. Unit is an AnyVal, not an AnyRef, so it doesn't include null. It is so much nicer when functions return interesting values.
upvote count: 9
accepted answer of: http://stackoverflow.com/q/23298046
answers question: http://stackoverflow.com/q/23298046
type: AcceptedAnswer

http://stackoverflow.com/comment/35815144
has text: if OP wants I will suggest him http://stackoverflow.com/a/15269846/821057
type: AnswerComment
comment on: http://stackoverflow.com/a/23379846
score: 0
type: Comment

http://stackoverflow.com/a/23347310
has body: Take a look at aspect oriented programming which can insert logging code at runtime for your favorite logging framework. The JDK includes the java.lang.instrument package which can insert bytecodes during classloading to perform your logging. Otherwise, you can install a servlet Filter as the top most filter in the call chain which will catch most of your exceptions. public class LogFilter implements javax.servlet.Filter { private static final String CLASS_NAME = LogFilter.class.getName(); private static final Logger logger = Logger.getLogger(CLASS_NAME); @Override public void init(FilterConfig filterConfig) throws ServletException { } @Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { logger.entering(CLASS_NAME, "doFilter", new Object[]{request, response}); try { chain.doFilter(request, response); } catch (IOException | ServletException | RuntimeException | Error ioe) { logger.log(Level.SEVERE, "", ioe); throw ioe; //Keep forwarding. } catch (Throwable t) { logger.log(Level.SEVERE, "", t); throw new ServletException(t); } logger.exiting(CLASS_NAME, "doFilter"); } @Override public void destroy() { } }
has comment: http://stackoverflow.com/comment/36033611
has comment: http://stackoverflow.com/comment/35934201
has comment: http://stackoverflow.com/comment/35993609
answers question: http://stackoverflow.com/q/23334968
downvote count: 0
has comment: http://stackoverflow.com/comment/36028477
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/a/23448681
type: Answer
answers question: http://stackoverflow.com/q/23448132
score: 0
has body: Just only print the last digit of i for (int i = 1; i &lt;= 10; i++) { String s = String.valueOf(i); int lastDigit = s.length() - 1; // last digit position in string System.out.print(s.substring(lastDigit, lastDigit + 1)); // print last digit System.out.print(s.substring(lastDigit, lastDigit + 1)); // print last digit } Output: 11223344556677889900

http://stackoverflow.com/comment/36125217
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23409137
score: 0
has text: @ ZouZou – This is a little late, but how did you get the code for the indexOf? Can you view the code inside the IDE or is it documented somewhere?

http://stackoverflow.com/a/23353508
type: Answer
downvote count: 0
has body: Polymorphy In (Java) inheritance that is the intended behavior -- polymorphy -- it's a way for you (the developer) to design an application around a concept (rectangles) and allow other related concepts (squares) to be used in places where the original concept (rectangle) is used but with their own (square) behavior. Practicality Imagine you'd have a list or array of rectangles and you'd fill it with objects received from returns of functions from outside your own package. Then you'd iterate over the list and ask each object to do things -- it is normal to want those objects to behave as what they really are, not as what they're filling in for. If you ask a rectangle what its area is it will multiply length and width and return the result. If you don't override that in the square class it will do the same thing but you could override it and it could calculate its area as Math.pow(this.side, 2). How about this inheritance chain: Shape &gt; Polygon &gt; Quadrilateral &gt; Parallelogram &gt; Rectangle &gt; Square You would definately need to implement different area calculation methods -- wouldn't you want each object to behave as its own underlying structure tells it to (instead of behaving like the type it's been cast to)?
score: 1
answers question: http://stackoverflow.com/q/23353468
upvote count: 1

jogl
tag name: jogl
tags question: http://stackoverflow.com/q/23311082
type: Tag

http://stackoverflow.com/q/23418114
tagged with: c++
type: AnsweredQuestion
has body: One line of code seems misleading. What I meant was in the form of a for ( ; ; ) ;. While trying out lambda expression, just for fun, I have coded the program below. What I did was to change the third expression of the for-loop, where usually ++i resides, into lambda function. The output is also shown. It's like an obfuscated code but it seems to do the work, anyway. I was wondering if it was possible to do it in similar way with Java. for (int i=1; i&lt;10; [](int i) {for (int j=2; j&lt;10; ++j) printf("%dx%d=%2d ",j,i,i*j);}(i++)) printf("\n"); 2x1= 2 3x1= 3 4x1= 4 5x1= 5 6x1= 6 7x1= 7 8x1= 8 9x1= 9 2x2= 4 3x2= 6 4x2= 8 5x2=10 6x2=12 7x2=14 8x2=16 9x2=18 2x3= 6 3x3= 9 4x3=12 5x3=15 6x3=18 7x3=21 8x3=24 9x3=27 2x4= 8 3x4=12 4x4=16 5x4=20 6x4=24 7x4=28 8x4=32 9x4=36 2x5=10 3x5=15 4x5=20 5x5=25 6x5=30 7x5=35 8x5=40 9x5=45 2x6=12 3x6=18 4x6=24 5x6=30 6x6=36 7x6=42 8x6=48 9x6=54 2x7=14 3x7=21 4x7=28 5x7=35 6x7=42 7x7=49 8x7=56 9x7=63 2x8=16 3x8=24 4x8=32 5x8=40 6x8=48 7x8=56 8x8=64 9x8=72 2x9=18 3x9=27 4x9=36 5x9=45 6x9=54 7x9=63 8x9=72 9x9=81 For somewhat better readability, I've separated the for-loop elements and the lambda function. for (int i=1; i&lt;10; [](int i) { for (int j=2; j&lt;10; ++j) printf("%dx%d=%2d ",j,i,i*j); } (i++)) { printf("\n"); } I tried to insert the Java lambda function similar to C++ like (int i) -&gt; {...} but it doesn't seem correct syntax for the Java for-loop. I've got curious when I read this article. It's in Korean but the code listed are in C++ so I guess any one can read them. First comes some screen captures of a Korean drama I don't know of. The first picture shows Java code for the multiplication. It seems that one of the actor is telling the other guy that it could be done with one line of code. The author of the article tries if it is possible in C++. He is using multiple printfs separated by commas in the for-loop statement. What I did was to make it a lambda function. So, would it be possible to do it in a similar way with Ja…
tagged with: java
has comment: http://stackoverflow.com/comment/35886667
type: Question
has comment: http://stackoverflow.com/comment/35886688
has comment: http://stackoverflow.com/comment/35887958
has answer: http://stackoverflow.com/a/23442759
score: 0
has comment: http://stackoverflow.com/comment/35886664
has title: Multiplication Table with One Line of Code
answer count: 1
accepted answer: http://stackoverflow.com/a/23442759
tagged with: obfuscation

http://stackoverflow.com/comment/35707710
has text: Windows 64bit JVM. I'll try the same code on my Macbook soon.
type: Comment
comment on: http://stackoverflow.com/a/23321368
score: 0
type: AnswerComment

http://stackoverflow.com/comment/35660122
has text: Zyn thanks but actually i didnt get it actually.. can u please alter my code and give..
comment on: http://stackoverflow.com/a/23295405
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/23309853
type: AnsweredQuestion
score: 3
downvote count: 0
tagged with: java
linked to: http://stackoverflow.com/q/4674678
type: Question
accepted answer: http://stackoverflow.com/a/23344437
has comment: http://stackoverflow.com/comment/35686639
has comment: http://stackoverflow.com/comment/101990971
has comment: http://stackoverflow.com/comment/35688972
tagged with: progress-bar
has answer: http://stackoverflow.com/a/23344437
upvote count: 3
has comment: http://stackoverflow.com/comment/35691224
answer count: 1
has comment: http://stackoverflow.com/comment/35690851
has comment: http://stackoverflow.com/comment/35749202
has body: Is it possible to change progress bar color using the paint listner? I don't want just an inital foreground and a background color, but want it to work just like how a normal green color progress bar works on Windows but with my own foreground and background. I tried the below code but it won't work GC gc = event.gc; Device device=Display.getDefault(); Color foreground = gc.getForeground(); Color background = gc.getBackground(); gc.setForeground(device.getSystemColor(SWT.COLOR_RED)); gc.setBackground(device.getSystemColor(SWT.COLOR_YELLOW)); Am stuck with this requirement and have been told that it's possible using the paint listener, wondering how ! Any help would be appreciated.
favorite count: 0
tagged with: listener
has title: How to change color of SWT progress bar?
tagged with: swt
has comment: http://stackoverflow.com/comment/35686692
tagged with: paintevent

http://stackoverflow.com/comment/35894632
type: Comment
comment on: http://stackoverflow.com/a/23422473
score: 0
type: AnswerComment
has text: thanx..i know this is problem ...i am compiling with 1.7 and running with 1.6....do u know any solution for this

http://stackoverflow.com/q/23365049
has comment: http://stackoverflow.com/comment/35787513
tagged with: null
has comment: http://stackoverflow.com/comment/35787535
has body: I have 3 classes: Sportswear (superclass) Jersey (subclass) Driver I have an ArrayList in my driver to hold all my jerseys created. When the user inputs all the values (stock, price, product, team, kit, size, gender), and it displays them back it shows null : Product: null In stock: 0 Price: 0 Team: Kit: Size: Gender: The superclass (Sportswear) has the variables stock, price and product (so I can include other products, not just jerseys) And the subclass (Jersey) contains the variables team, kit, size, gender. It also contains the method jerseyDisplay() which shows what is above. In the driver after the values are inputted I put: Jersey jersey = new Sportswear(stock, price, product, team, kit, size, gender); sportswear.add(jersey); jersey.jerseyDisplay(); Is this completely wrong? Why arn't the inputted values showing up? The jerseyDisplay() method in the subclass Jersey is: public void jerseyDisplay() { super.sportswearDisplay(); System.out.println("Team: "+team); System.out.println("Kit: "+kit); System.out.println("Size: "+size); System.out.println("Gender: "+gender); } @DessertIvy This is the Sportswear superclass: public class Sportswear { //instance variables private int stock; private float price; private String product; //blank constructor public Sportswear() { this.stock = 0; this.price = 0; this.product = ""; } //detailed constructor public Sportswear(int s, float p, String pd) { this.stock = stock; this.price = price; this.product = product; } //setters public void setStock(int stock) { this.stock = stock; } public void setPrice(float price) { this.price = price; } public void setProduct(String product) { this.product = product; } //getters public int getStock() { return stock; } public float getPrice() { return price; } public String getProduct() { return product; } //increase stock public int increaseStock() { stock = stock++; return stock; } //decrease stock public int decreaseStock() { stock = stock - 1; return stock; } public void sportswearDisplay()…
tagged with: inheritance
has comment: http://stackoverflow.com/comment/35787451
has title: My objects values won't save. Displays null
tagged with: arraylist
type: Question
has comment: http://stackoverflow.com/comment/35787063
has comment: http://stackoverflow.com/comment/35787058
has comment: http://stackoverflow.com/comment/35787488
has comment: http://stackoverflow.com/comment/35787685
has comment: http://stackoverflow.com/comment/35787712
score: 0
answer count: 1
tagged with: object
has comment: http://stackoverflow.com/comment/35787077
tagged with: java
has comment: http://stackoverflow.com/comment/35787194
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23365594

http://stackoverflow.com/a/23352907
type: Answer
has comment: http://stackoverflow.com/comment/35765835
has comment: http://stackoverflow.com/comment/35765799
answers question: http://stackoverflow.com/q/23352707
has comment: http://stackoverflow.com/comment/35765701
upvote count: 2
downvote count: 2
score: 0
has body: You must be relying on a null check inside FileLockDTO.setFileLock() or wherever you have it, if indeed you have it at all. All this seems too elaborate for me. I would just lock the actual line of the actual file you're reading rather than introduce these secondary lock files. Then if you encounter an existing lock you know to skip that line. Or else use a data structure that is capable of delivering each line once only and eliminate the whole problem, for example an MQ of some kind, or a database. EDIT Downvoters and/or adherents of the theory that FileLocks don't work across JVMs or processes need to read the documentation.

http://stackoverflow.com/a/23364950
upvote count: 7
type: Answer
accepted answer of: http://stackoverflow.com/q/23363804
answers question: http://stackoverflow.com/q/23363804
downvote count: 0
has body: This should work, just cast the object to your class after receiving it from the serialize/deserialize function. public static byte[] objToByte(TcpPacket tcpPacket) throws IOException { ByteArrayOutputStream byteStream = new ByteArrayOutputStream(); ObjectOutputStream objStream = new ObjectOutputStream(byteStream); objStream.writeObject(tcpPacket); return byteStream.toByteArray(); } public static Object byteToObj(byte[] bytes) throws IOException, ClassNotFoundException { ByteArrayInputStream byteStream = new ByteArrayInputStream(bytes); ObjectInputStream objStream = new ObjectInputStream(byteStream); return objStream.readObject(); }
score: 7
type: AcceptedAnswer

http://stackoverflow.com/a/23826526
upvote count: 5
has body: SpringSource tc Server is an enterprise version of Apache Tomcat, the widely used Web application server. SpringSource tc Server is hardened for enterprise use and is coupled with key operational capabilities, advanced diagnostics, and is backed by mission-critical support. SpringSource tc Server is designed to be a drop in replacement for Apache Tomcat, ensuring a seamless upgrade path for existing custom-built and commercial software applications already certified for Tomcat. Maintaining this level of compatibility enables our customers to add the business-critical functionality they need to more effectively run and manage their applications with the least amount of effort. find more information at http://static.springsource.com/projects/tc-server/6.0/getstart/cgsdiffs.html
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/23424312
score: 5

http://stackoverflow.com/comment/35697886
type: AnswerComment
comment on: http://stackoverflow.com/a/23314211
type: Comment
has text: I checked it, try `+1` instead of `+2` for the exponent, I didn't think about negative exponents. I'll update my answer, also to reflect doubles.
score: 0

http://stackoverflow.com/a/23295112
has comment: http://stackoverflow.com/comment/35745845
accepted answer of: http://stackoverflow.com/q/23292652
has comment: http://stackoverflow.com/comment/35661592
has comment: http://stackoverflow.com/comment/35665015
has comment: http://stackoverflow.com/comment/35662173
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35748148
has body: You can set a variable at the start of flow like this: &lt;set-variable variableName="flowName" value="Your_flow_name"/&gt; And the get the flow name like #[flowName] in your exception strategy. EDIT: To trigger a flow, create a java component implementing Callable interface, from the context get the MuleClient and use send or dispatch method to send payload to flow. Send causes MuleClient to wait for response while dispatch doesn't. More info here: http://www.mulesoft.org/documentation/display/current/Using+the+Mule+Client
answers question: http://stackoverflow.com/q/23292652
type: Answer
has comment: http://stackoverflow.com/comment/35665226
has comment: http://stackoverflow.com/comment/35747575

http://stackoverflow.com/a/23444444
has comment: http://stackoverflow.com/comment/35935622
answers question: http://stackoverflow.com/q/23444314
has comment: http://stackoverflow.com/comment/35935696
has comment: http://stackoverflow.com/comment/35935192
score: 0
has body: If you claim that \\W worked fine for you but only problem was that it also split on whitespace then you can use intersection of \\W and \\S which will remove all whitespaces from \\W. Use split("[\\W&amp;&amp;\\S]+") Also to remove whitespaces surrounding results like _eleement 3 (where _ represents whitespace) you can surround regex with \\s*. To add support for Unicode in predefined character class just add (?U) flag to regex. Demo: String data = "element1;element 2; element 3 (Element 4; Element 5 $Element 6 "; for (String s:data.split("(?U)\\s*[\\W&amp;&amp;\\S]+\\s*")){ System.out.println(s); } Output: element1 element 2 element 3 Element 4 Element 5 Element 6
type: Answer
has comment: http://stackoverflow.com/comment/35935469
has comment: http://stackoverflow.com/comment/35935590
has comment: http://stackoverflow.com/comment/35938101
has comment: http://stackoverflow.com/comment/35935921

http://stackoverflow.com/q/23403841
tagged with: timezone
accepted answer: http://stackoverflow.com/a/23437749
type: AnsweredQuestion
has title: JODA api convert date between timezones
tagged with: java
type: Question
has body: I wanted to convert a date from one TimeZone to other. already had trouble with java.util.Date, So tried with JODA as suggested by people- import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; import org.joda.time.DateTime; import org.joda.time.DateTimeZone; import org.joda.time.format.DateTimeFormat; import org.joda.time.format.DateTimeFormatter; public class JodaTimeTest { public static void main(String[] args) throws ParseException { DateFormat formatter = new SimpleDateFormat("dd-MMM-yy hh:mm:ss a"); System.out.println(getDateStringToShow(formatter.parse("26-Nov-10 03:31:20 PM +0530"), "Asia/Calcutta", "Europe/Dublin", false)); System.out.println(getDateStringToShow(formatter.parse("02-Oct-10 10:00:00 AM +0530"), "Asia/Calcutta", "Europe/Dublin", false)); System.out.println(getDateStringToShow(formatter.parse("26-Nov-10 11:51:20 PM +0530"), "Asia/Kolkata", "Europe/Dublin", false)); System.out.println(getDateStringToShow(formatter.parse("02-Oct-10 01:01:00 AM +0530"), "Asia/Kolkata", "Europe/Dublin", false)); } public static String getDateStringToShow(Date date, String sourceTimeZoneId, String targetTimeZoneId, boolean includeTime) { DateTime dateRes = new DateTime(date); DateTime nowIndia = dateRes.toDateTime(DateTimeZone.forID(sourceTimeZoneId)); DateTime nowDub = nowIndia.toDateTime(DateTimeZone.forID(targetTimeZoneId)); DateTimeFormatter fmt = DateTimeFormat.forPattern("dd-MMM-yy z"); System.out.println("nowIndia : " + fmt.print(nowIndia)); System.out.println("nowDub : " + fmt.print(nowDub)); return "---next---"; } } When Run- nowIndia : 26-Nov-10 IST nowDub : 26-Nov-10 GMT ---next--- nowIndia : 02-Oct-10 IST nowDub : 02-Oct-10 IST ---next--- nowIndia : 26-Nov-10 IST nowDub : 26-Nov-10 GMT ---next--- nowIndia : 02-Oct-10 IST nowDub : 01-Oct-10 IST ---next--- Can anyone suggest me why its showing IST for date- 02-Oct-10 10:00:00 AM +0530
tagged with: jodatime
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/23437749
tagged with: datetime

http://stackoverflow.com/comment/35893938
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23422118
has text: what is the column size of your database?
score: 0

http://stackoverflow.com/a/23431693
downvote count: 0
score: 1
upvote count: 1
has body: Also you have to flush() EntityManager database and clear() it periodically. This is most probably the reason that you run out of memory.
type: Answer
answers question: http://stackoverflow.com/q/23431535

http://stackoverflow.com/comment/35924081
type: QuestionComment
has text: My biggest application (cca 800 javascript files + Ext) compiles into 2.9 MB. There must be something else wrong.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23426843

http://stackoverflow.com/a/23453089
downvote count: 1
has body: First, create a folder in your server outside the tomcat installation folder, for example /opt/myuser/files/upload. Then, configure this path in a properties file or in web.xml as a Servlet init configuration to make it available for any web application you have. If using properties file: file.upload.path = /opt/myuser/files/upload If web.xml: MyServlet your.package.MyServlet FILE_UPLOAD_PATH /opt/myuser/files/upload Or if you're using Servlet 3.0 specification, you can configure the init params using @WebInitParam annotation: @WebServlet(name="MyServlet", urlPatterns = {"/MyServlet"}, initParams = { @WebInitParam(name = "FILE_UPLOAD_PATH", value = "/opt/myuser/files/upload") }) public class MyServlet extends HttpServlet { private String fileUploadPath; public void init(ServletConfig config) { fileUploadPath = config.getInitParameter("FILE_UPLOAD_PATH"); } //use fileUploadPath accordingly public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException) { String fileName = ...; //retrieve it as you're doing it now //using File(String parent, String name) constructor //leave the JDK resolve the paths for you File uploadedFile = new File(fileUploadPath, fileName); //complete your work here... } }
answers question: http://stackoverflow.com/q/23452484
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23452484
type: Answer
score: 2
upvote count: 3

http://stackoverflow.com/q/23378684
has answer: http://stackoverflow.com/a/62292033
answer count: 3
has body: I am trying to call a java class object from a data step in SAS. The Java class file has been placed in the class path./dir/folder_location The class path variable for SAS has been changed to the folder where the class files are stored. This has been verified from the SAS enterprise Guide where I am printing the class path to the logs SYSGET("CLASSPATH") returns /dir/folder_location When I run the following path to declare a java object in the class: data _null_; declare javaobj j ('Classname'); run; This gives me an error that ERROR: Could not find class 'ClassName' at line x column y. Please ensure that the CLASSPATH is correct. ERROR: DATA STEP Component Object failure. Aborted during the EXECUTION phase. Als when i get the java info by using the command PROC javainfo CLASSPATHS; run; This returns a different path. Is this different than the above class path? Does anyone have thoughts on as to why this is happening and what the solution is? Thanks in advance.
has answer: http://stackoverflow.com/a/23379580
score: 2
upvote count: 2
type: UnansweredQuestion
has title: Java Class Path error in SAS
tagged with: java
type: Question
tagged with: sas
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/62168732

http://stackoverflow.com/a/23365180
has comment: http://stackoverflow.com/comment/35788324
has comment: http://stackoverflow.com/comment/35787752
has comment: http://stackoverflow.com/comment/35788011
score: 0
type: Answer
has body: What is the source of the CSV character stream? A file? A blob in a database? You need to make sure that the java.io.Reader that is reading the file uses correct encoding (ie the initial file's encoding).
answers question: http://stackoverflow.com/q/23364843

http://stackoverflow.com/comment/35915783
type: Comment
type: QuestionComment
score: 0
has text: @NichoDiaz No, because the type of textfile is a Scanner instance so it has to be public String problems(Scanner fileScanner). If you want to return a String from this method then you have to create a String in that method presumably made up of the integers you read from the file, but that is up to you, just return a String instance to remove the compile error.
comment on: http://stackoverflow.com/q/23433789

http://stackoverflow.com/q/23301622
tagged with: spring
type: AnsweredQuestion
downvote count: 0
has title: Spring scheduled tasks not firing
tagged with: java
type: Question
score: 3
has body: I'm teaching myself Spring, currently on scheduled tasks, and the following code does not fire the scheduled task. I believe it has something to do with the way I'm setting up the Spring context but that's only a guess - I'm trying to learn Spring so please excuse the ridiculous while loop. Application.java: package hello; import org.springframework.context.annotation.AnnotationConfigApplicationContext; public class Application { public static void main(String[] args) throws Exception { AnnotationConfigApplicationContext rootContext = new AnnotationConfigApplicationContext(); rootContext.register(RootContextConfiguration.class); rootContext.refresh(); while(rootContext != null) { try { Thread.sleep(2500); } catch(InterruptedException ex) { Thread.currentThread().interrupt(); } System.out.println("Loop\n"); } rootContext.close(); } } RootContextConfiguration.java: package hello; import java.util.concurrent.Executor; import org.springframework.context.annotation.AdviceMode; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; import org.springframework.core.Ordered; import org.springframework.scheduling.TaskScheduler; import org.springframework.scheduling.annotation.AsyncConfigurer; import org.springframework.scheduling.annotation.EnableAsync; import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.scheduling.annotation.SchedulingConfigurer; import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler; import org.springframework.scheduling.config.ScheduledTaskRegistrar; @Configuration @EnableScheduling @EnableAsync( mode = AdviceMode.PROXY, proxyTargetClass = false, order = Ordered.HIGHEST_PRECEDENCE ) @ComponentScan( basePackages = "hello" ) public class RootContextConfiguration implements AsyncConfigurer, SchedulingConfigurer { @Bean public ThreadPoolTaskScheduler taskScheduler() { ThreadPoolTaskSc…
upvote count: 3
tagged with: spring-scheduled
answer count: 1
tagged with: scheduled-tasks
favorite count: 0
has answer: http://stackoverflow.com/a/23301660
accepted answer: http://stackoverflow.com/a/23301660

http://stackoverflow.com/comment/35855105
comment on: http://stackoverflow.com/q/23393597
has text: *"The entire code can be posted or e-mailed if needed."* No thanks. For better help sooner, post an [MCVE](http://stackoverflow.com/help/mcve) (Minimal Complete and Verifiable Example) to this thread.
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/a/23312262
type: Answer
answers question: http://stackoverflow.com/q/23312170
has body: I would recommend you to use JUnit tests for this and assertions to check the addiction, rather than printing into console. Anyway, the easiest way would probably be to implement the toString method of the ArrayPhoneDirectory and then call System.out.println(newdir.toString()). Inside the toString, you would just do Arrays.toString(_theArray_) or Arrays.deepToString(_theArray). EDIT: In the light of the code you've shown, it would be probably better to do the following: Map&lt;String, String&gt; testValues = new HashMap&lt;String, String(); testValues.put("Joe Perkins", "07762573872"); testValues.put("Annie Howell", "0876273862"); testValues.put("Buzz Killington", "99999999999"); for(String key : testValues.keySet()) { newdir.addChangeEntry(key, testValues.get(key)); } for(String key : testValues.keySet()) { assert testValues.get(key).equals(newdir.lookUpEntry(key)); } Of course you could just do System.out.println instead of the assert if you wish.
has comment: http://stackoverflow.com/comment/35690805
has comment: http://stackoverflow.com/comment/35690776
score: 0
has comment: http://stackoverflow.com/comment/35690869

http://stackoverflow.com/a/23381332
type: Answer
has body: ..having a problem creating a proper save function for my game Given the word 'proper' (my emphasis) I have to point out that the proper way to save/load games is according to a 'game state model' as opposed to a 'game state model crudely translated to lines of text'. That game state model might be saved a number of ways depending upon the complexity of the data, but should use very different serialization methods (with less work done encoding/decoding the data in our code) than this approach uses.
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/23379940
downvote count: 0

http://stackoverflow.com/a/23318004
answers question: http://stackoverflow.com/q/23317740
has comment: http://stackoverflow.com/comment/35707543
has comment: http://stackoverflow.com/comment/35702997
has body: The best approach is to use HTML parser. But as i read your comment " I'm doing this for a class and am learning about finding, isolating and extracting data." What you can do something like : String producer = "Producer:"; String writer = "Writer:"; String released = "Released:"; String s = "Writer: Dylan Producer: Tom Wilson&nbsp Released: July '65, Columbia 12 weeks; No. 2 "; int writerIndex = s.lastIndexOf(writer); int producerIndex = s.lastIndexOf(producer); int realesedIndex = s.lastIndexOf(released); String writerExtracted = s.substring(writerIndex + writer.length(), producerIndex).replaceAll("\\<.*?>", ""); System.out.println(writerExtracted); String producerExtracted = s.substring( producerIndex + producer.length(), realesedIndex).replaceAll( "\\<.*?>", ""); System.out.println(producerExtracted); String releasedExtracted = s.substring( realesedIndex + released.length(), s.length()).replaceAll( "\\<.*?>", ""); System.out.println(releasedExtracted); Output: Dylan Tom Wilson&nbsp July '65, Columbia12 weeks; No. 2 NOTE: you can get rid of signs such as &#039 or &nbsp using another regex ...
score: 0
type: Answer

http://stackoverflow.com/comment/35815944
has text: post your current algorithm so we can extend it
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23380485
score: 1

http://stackoverflow.com/a/23428527
answers question: http://stackoverflow.com/q/23428073
downvote count: 0
has body: This piece of code uses your while loop to step through your list of potentially many nodes. while(current.next!=null){ current=current.next; } It stops at a list node where current.next ==null. At this point you can add a new node calling current.next = new SListNode(item); The second current=current.next;, your book gets you to add, does nothing for your method. It moves your current pointer to the node you just created, but no work is done with (or required of) it. The null pointer exception:-- When the list is empty, you do not have a head. Meaning any call of head.next is actually a call to null.next, which is a nonsense. Start your method with a check for the empty state: if(head == null){ head = new SlinkNode(item); size = 1; return; } Note that the head is just a standard node and it holds your first item. The size is set to 1 and you return from the method as there is no more work to do. Also note that the size-- at the end of your code is decrementing the size, not incrementing it when you add new nodes. It should be size++.
type: Answer
has comment: http://stackoverflow.com/comment/35905508
has comment: http://stackoverflow.com/comment/35905712
score: 2
has comment: http://stackoverflow.com/comment/35905988
upvote count: 2
has comment: http://stackoverflow.com/comment/35906572

http://stackoverflow.com/comment/35831325
has text: Thanks very much @MarshallTigerus . You shall add the float thing as an answer
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23373022

http://stackoverflow.com/a/23325858
has body: You can do this with String#subtring myWord= myWord.substring(0, myWord.length() - 2) + "BB";
score: -3
type: Answer
has comment: http://stackoverflow.com/comment/35715398
upvote count: 0
answers question: http://stackoverflow.com/q/23325800
downvote count: 3

http://stackoverflow.com/a/23393216
has comment: http://stackoverflow.com/comment/35839529
type: Answer
has comment: http://stackoverflow.com/comment/35839539
has body: finish() actually isn't commited in the same moment it's executed, it just tells the Android OS that it can be freed whenever possible. Calling finish() will fire your onDestroy() method, probably this is what you're not seeing as you've written the onPause() content. onPause() will be triggered, for example, if Activity A calls Activity B. This will actually put your Activity A in background and trigger onPause(), so it still remains in memory, but it could happen that the Android OS has lack of memory and it decides itself killing the Activity A. In this case, when ending Activity B, Activity A's onCreate() will be called instead of onResume() (which in turn will trigger onResume() as per the Activity's lifecycle).
upvote count: 1
has comment: http://stackoverflow.com/comment/35840155
has comment: http://stackoverflow.com/comment/35839649
has comment: http://stackoverflow.com/comment/35839486
has comment: http://stackoverflow.com/comment/35839634
downvote count: 1
has comment: http://stackoverflow.com/comment/35839766
has comment: http://stackoverflow.com/comment/35839864
has comment: http://stackoverflow.com/comment/35839728
has comment: http://stackoverflow.com/comment/35839756
has comment: http://stackoverflow.com/comment/35839342
answers question: http://stackoverflow.com/q/23393000
score: 0

http://stackoverflow.com/q/23386259
has comment: http://stackoverflow.com/comment/35826867
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23386413
tagged with: java
has comment: http://stackoverflow.com/comment/35826197
type: Question
has comment: http://stackoverflow.com/comment/35826225
has comment: http://stackoverflow.com/comment/35826910
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/35826708
has title: How to avoid a same instance of class java is running many times
has comment: http://stackoverflow.com/comment/35826494
has comment: http://stackoverflow.com/comment/35826378
has comment: http://stackoverflow.com/comment/35827002
tagged with: jsp
has answer: http://stackoverflow.com/a/23387149
has body: I have class named: ReceiptGenerateAgentDAO receiptGenerateAgentDAO = new ReceiptGenerateAgentDAO(); this class will be called from a jsp page, which has a method and in that i have a for loop which will execute for more then 5 min and the issue is I request the jsp to call the class and the class started executing,now i reload the jsp and again call the class now both the class are running it is not a thread,how it is possible and how to resolve it? for (String Key : list) { if (!"userDetailsCache".equals(Key)) { preparedStatement2.setString(1, Key); @Cleanup ResultSet rsCreditReceipt = preparedStatement2.executeQuery(); if (rsCreditReceipt.next() &amp;&amp; rsCreditReceipt.getString("SUMMARY_DATE") != null) { String exBalance = rsCreditReceipt.getString("balance"); /** Agent Current Balance */ preparedStatement3.setString(1, rsCreditReceipt.getString("SUMMARY_DATE")); preparedStatement3.setString(2, Key); @Cleanup ResultSet rsCreditBal = preparedStatement3.executeQuery(); double creditDebit = Double.parseDouble(exBalance); if (rsCreditBal.next()) { if (rsCreditBal.getString("creditdebit") != null) { creditDebit += Double.parseDouble(rsCreditBal .getString("creditdebit")); } } if (creditDebit &lt; 0) { Element element = EhcacheManager.getUserDetailsCache() .get(Key); UserDetails details = (UserDetails) element .getObjectValue(); /** Agent Opening Balance */ getZoneDetails(details, connection); receiptGenerateTempDTOs.add(new ReceiptGenerateTempDTO( details.getTerritoryId(), details .getSatelliteId(), details.getZoneId(), rsCreditReceipt.getString(3), NumericConstants.ZERO, String.valueOf(formatter .format((creditDebit * (-1)))), time, receiptGenerateAgentDTO.getSelectedUserId(), NumericConstants.ZERO)); } } else { /** If no opening balance,only current Balance */ preparedStatement4.setString(1, Key); @Cleanup ResultSet rsCreditBal = preparedStatement4.executeQuery(); if (rsCreditBal.next()) { Element element = EhcacheManager.getUserDetailsCache() .get(Key); UserDet…

http://stackoverflow.com/q/23394621
score: 0
has answer: http://stackoverflow.com/a/23394935
answer count: 1
has comment: http://stackoverflow.com/comment/35842262
has body: Actionlistener, doesn't work, nothing happens when the joptionpane should popup on crear_Arbitro click. having trouble creating an external ActionListener class for diferent JPanels inside a JFrame, the idea is to make some Jpanels which will then be inserted into a JFrame using JTabbedPane, and learning to use the MVC architectural pattern to create a GUI, here is a brief example of the code for what i'm trying to do: controller: public class Controlador_Universal { public VentanaPrincipal_vista ventanaPrincipalVista; public Arbitros_modelo arbitrosModelo; public ArbitrosListener ArbitrosListener; public Controlador_Universal() { ventanaPrincipalVista = new VentanaPrincipal_vista(); ArbitrosListener ArbitrosListener = new ArbitrosListener(); ventanaPrincipalVista.pestañaArbitros.crear_Arbitro.addActionListener(ArbitrosListener); } Listener: import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JOptionPane; import modelo.Arbitros_modelo; import controlador.Controlador_Universal; public class ArbitrosListener extends Controlador_Universal implements ActionListener { @Override public void actionPerformed(ActionEvent e) { if(e.getSource() == super.ventanaPrincipalVista.pestañaArbitros.crear_Arbitro) { JOptionPane.showMessageDialog(null, "Presionó en crear Arbitro"); } } }
type: UnansweredQuestion
tagged with: swing
tagged with: model-view-controller
has title: creating external ActionListener using MVC
tagged with: java
has comment: http://stackoverflow.com/comment/35841978
type: Question
tagged with: actionlistener

http://stackoverflow.com/a/23331320
has comment: http://stackoverflow.com/comment/35725889
accepted answer of: http://stackoverflow.com/q/23331280
has body: I think the problem is you are trying to create a connection for every loop, or trying to execute the insert statement for every iteration, consider you using batch. Insert every 5000 or 10000. batch insert: String sql = "insert into employee (name, city, phone) values (?, ?, ?)"; Connection connection = new getConnection(); PreparedStatement ps = connection.prepareStatement(sql); for (Employee employee: employees) { ps.setString(1, employee.getName()); ps.setString(2, employee.getCity()); ps.setString(3, employee.getPhone()); ps.addBatch(); } ps.executeBatch();
upvote count: 2
type: AcceptedAnswer
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/23331280
has comment: http://stackoverflow.com/comment/35725915

http://stackoverflow.com/comment/35670162
has text: I just want to avoid making an insane loop because I will have to remove characters in order to be able to determine if there are two occurences of the letter if needed.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23300821

http://stackoverflow.com/a/23355036
score: 1
answers question: http://stackoverflow.com/q/23354999
downvote count: 0
has comment: http://stackoverflow.com/comment/35769296
has comment: http://stackoverflow.com/comment/35769537
has body: Your string hexStr contains spaces between successive bytes, you need to skip them. One way is putting if(hexStr.charAt(i) == ' ') continue; in the loop. When you put a continue, you don't need to use else: Byte bArray[] = new byte[hexStr.length()/2]; for(int i=0; i&lt;(hexStr.length()/2); i++){ if(hexStr.charAt(i) == ' ') continue; byte firstNibble = Byte.parseByte(hexStr.substring(2*i,2*i+1),16); // [x,y) byte secondNibble = Byte.parseByte(hexStr.substring(2*i+1,2*i+2),16); int finalByte = (secondNibble) | (firstNibble &lt;&lt; 4 ); // bit-operations only with numbers, not bytes. bArray[i] = (byte) finalByte; }
type: Answer
upvote count: 1

jface
tags question: http://stackoverflow.com/q/23432586
tag name: jface
tags question: http://stackoverflow.com/q/23391265
type: Tag
tags question: http://stackoverflow.com/q/23386494
tags question: http://stackoverflow.com/q/23338367

http://stackoverflow.com/comment/93533829
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23442172
has text: Where is the implementation. Could you please explain how does this works ?

http://stackoverflow.com/comment/35750625
comment on: http://stackoverflow.com/q/23330074
score: 0
has text: It's a application, where are inserted some data and if there are a change with them, ask the user to save the changes.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23312339
favorite count: 0
has answer: http://stackoverflow.com/a/23317390
tagged with: regex
accepted answer: http://stackoverflow.com/a/23317390
has body: I need to find some string in text after keyword in inside brackets first occurrence. This is the text example: Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. === FIRST KEYWORD === veniam, {{ text need to get }} ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit {{in voluptate velit esse cillum}} dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia {{deserunt mollit anim }}id est laborum So I need get text inside the brackets after first keyword. I tried many combination but the best was that I received the text from last brackets not first. With this exp I got text after keywords (?&lt;==== FIRST KEYWORD ===).(.|\n)* But with finding first text in brackets I didn't succeed. UPD: Thank you all, but answer from Bohemian not work for my corpus. This answer : "(?&lt;==== FIRST KEYWORD ===)[^{]*\\{\\{([^}]*)\\}\\}" works, but I don't see it now. So I cannot say thanks to that guy who wrote this, I don't remember.
has comment: http://stackoverflow.com/comment/35694902
possible better answer: http://stackoverflow.com/a/23312546
upvote count: 2
has answer: http://stackoverflow.com/a/23312546
has comment: http://stackoverflow.com/comment/35690954
score: 2
type: AnsweredQuestion
tagged with: expression
tagged with: java
type: Question
answer count: 2
has title: Java regex, find text inside
downvote count: 0

http://stackoverflow.com/q/23387798
tagged with: selectmanycheckbox
has title: Setting values using Primefaces selectManyCheckbox to Java property not working
linked to: http://stackoverflow.com/q/9069379
linked to: http://stackoverflow.com/q/14567920
has comment: http://stackoverflow.com/comment/35866840
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35871119
tagged with: jsf
score: 0
has body: I want to select values from Primefaces selectManyCheckbox menu and set the selected values to a property which to use later in a method for writing into database. Here is the code from .xhtml page for the component: &lt;p:selectManyCheckbox id="chkbox1" value="#{requestBean.filterTypeBean.selectedBooleanFilterTypes}" layout="pageDirection" converter="filterTypeConverter"&gt; &lt;f:selectItems var="checkbox" value="#{requestBean.filterTypeBean.listBooleanFilterTypes()}" itemLabel="#{checkbox.filterTypeName}" itemValue="#{checkbox}" /&gt; &lt;/p:selectManyCheckbox&gt; RequestBean class is @ViewScoped and inside it i have: private FilterTypeBean filterTypeBean = new FilterTypeBean(); // Plus public get and set method for it FilterType class is @SessionScoped and in it i have : private List&lt;TFilterType&gt; selectedBooleanFilterTypes; //plus public get and set methods public List&lt;TFilterType&gt; listBooleanFilterTypes() { EntityManager em = HibernateUtil.getEntityManager(); Query q = em .createQuery("select u from TFilterType u where u.filterType = 'B'"); List&lt;TFilterType&gt; resultList = q.getResultList(); return resultList; } For me, everything seems ok, but when i press the commandButton, the selectedBooleanFilterTypes list is empty even if i select some values from the selectManyCheckbox. I try to take the values in RequestBean class using getSelectedBooleanFilterTypes() method: List&lt;TFilterType&gt; selectedBooleanFilterTypes = filterTypeBean .getSelectedBooleanFilterTypes(); It seems that setSelectedFilterTypesNames() is not executed. Any suggestion what is the problem here and how to fix it? Thanks in advance! Asked: The part from the Converter: public Object getAsObject(FacesContext context, UIComponent component, String value) { // It will create bean when not done yet. FilterTypeBean filterTypeBean = context.getApplication().evaluateExpressionGet(context, "#{filterTypeBean}", FilterTypeBean.class); for (TFilterType type : filterTypeBean.listBooleanF…
has comment: http://stackoverflow.com/comment/35858855
has comment: http://stackoverflow.com/comment/35867350
has comment: http://stackoverflow.com/comment/35867573
has comment: http://stackoverflow.com/comment/35845888
type: Question
has answer: http://stackoverflow.com/a/23410369
has comment: http://stackoverflow.com/comment/35865028
has comment: http://stackoverflow.com/comment/35868217
tagged with: primefaces
tagged with: java
linked to: http://stackoverflow.com/q/10721342
answer count: 1
accepted answer: http://stackoverflow.com/a/23410369
has comment: http://stackoverflow.com/comment/35871510

http://stackoverflow.com/q/23355740
tagged with: java
possible better answer: http://stackoverflow.com/a/23355892
has comment: http://stackoverflow.com/comment/35770568
tagged with: eclipse
has answer: http://stackoverflow.com/a/23355892
answer count: 3
favorite count: 0
downvote count: 3
tagged with: android
has title: How to use a button to show a custom dialog in android application?
upvote count: 0
has comment: http://stackoverflow.com/comment/35770592
score: -3
has answer: http://stackoverflow.com/a/23356027
has comment: http://stackoverflow.com/comment/35770610
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35770563
has answer: http://stackoverflow.com/a/23355778
accepted answer: http://stackoverflow.com/a/23355778
has body: I am following a youtube tutorial and I've got most of the works done, but I still got some problems. I have my custom layout for my custom dialog, all I wanted to do is to set the custom dialog on a button. Once we click the button ,the dialog shows, that's it. I've already set the onclicklistener on the button, here's my code. Credit.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Dialog credit = new Dialog(Main.this); credit.setContentView(R.layout.creditdialog); credit.setTitle(" "); credit.show(); } }); I followed all of this on a tutorial, but I don't know that the "MAIN" is about, I got an error there. Please tell me what to do. Sorry for my poor English.

http://stackoverflow.com/comment/35886196
has text: But you really should. Or you'll confuse everyone who has learned that numbers are sent over the network in network byte order.
type: Comment
comment on: http://stackoverflow.com/a/23417883
score: 1
type: AnswerComment

http://stackoverflow.com/comment/35723523
comment on: http://stackoverflow.com/a/23329844
score: 0
type: AnswerComment
type: Comment
has text: @dk_sn1p3r: the problem has nothing to do with JComboBoxes per se, and all to do with your trying to make method calls on variables outside of a method or constructor. You can declare and initialize variables out in the class, but you can't make method calls there.

http://stackoverflow.com/q/23409217
has comment: http://stackoverflow.com/comment/35870463
tagged with: android
has answer: http://stackoverflow.com/a/23409356
has answer: http://stackoverflow.com/a/23409370
answer count: 4
type: AnsweredQuestion
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/23409820
has comment: http://stackoverflow.com/comment/35869909
upvote count: 1
has answer: http://stackoverflow.com/a/23409820
type: Question
has title: ANDROID: clicking multiple checkboxes
has comment: http://stackoverflow.com/comment/35869550
has answer: http://stackoverflow.com/a/23409362
has body: I want to show the name of those multiple checkboxes that was checked. The problem is that when I check on any of them, only the last one checked is written on the textview. How can I resolve this? I don't really understand how I will concatenate the names of those checkboxes. public void ChkCommand(View v) { txtans = (EditText)findViewById(R.id.txtcon1); if(v.getId() == R.id.chk1 &amp;&amp; ((CheckBox)v).isChecked()){ chkClick = (CheckBox) findViewById(R.id.chk1); } else if(v.getId() == R.id.chk2 &amp;&amp; ((CheckBox)v).isChecked()){ chkClick = (CheckBox) findViewById(R.id.chk2); } else if(v.getId() == R.id.chk3 &amp;&amp; ((CheckBox)v).isChecked()){ chkClick = (CheckBox) findViewById(R.id.chk3); } String value = chkClick.getText().toString(); txtans.setText(value); } public void CloseConF(View v) { Intent intent = new Intent(this, SampComponents.class); startActivity(intent); finish(); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.con_chk_samp, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { int id = item.getItemId(); if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } public static class PlaceholderFragment extends Fragment { public PlaceholderFragment() { } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.activity_con_chk_samp, container, false); return rootView; } } }
has comment: http://stackoverflow.com/comment/35870141
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/23409362

http://stackoverflow.com/comment/35941620
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23447682
has text: Yes it's a C# code sorry, I was testing on both. The syntax doesn't really matter I'm stuck with the logic.
score: 0

http://stackoverflow.com/comment/35884539
has text: so it crash when you add the arrayadapter on the postexecute but not on the createView?
comment on: http://stackoverflow.com/q/23416554
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35783124
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23362909
has text: I ve read email completely and saved it into data base it's complete html structure which is stored nothing like path and all.. how to convert it back with correct format which 'll display image

http://stackoverflow.com/a/23369666
accepted answer of: http://stackoverflow.com/q/23369634
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23369634
downvote count: 0
score: 4
has comment: http://stackoverflow.com/comment/35796070
type: Answer
has body: The Map argument you have in your controller handler method is effectively used as a map of model attributes. Model attributes are (typically) added as HttpServletRequest attributes before the view is rendered. This is explained in the documentation here. The following are the supported method arguments: java.util.Map / org.springframework.ui.Model / org.springframework.ui.ModelMap for enriching the implicit model that is exposed to the web view.
upvote count: 4

http://stackoverflow.com/q/23379908
tagged with: java
score: -1
tagged with: substring
type: Question
has comment: http://stackoverflow.com/comment/35815199
answer count: 3
has answer: http://stackoverflow.com/a/23379982
tagged with: removeall
favorite count: 0
has answer: http://stackoverflow.com/a/23380001
has comment: http://stackoverflow.com/comment/35815545
has comment: http://stackoverflow.com/comment/35815050
has title: Don't understand some functions of this code! removeAll
upvote count: 0
has body: Was given this by my lecturer, and some parts have confused me! String removeAll(char c, String s) { String to_return = ""; while(true) { if (s.equals("")) return to_return; // at this point s is not "" char c2 = s.charAt(0); if (c2 != c) { to_return += c2; } s = s.substring(1); } return to_return; // won't be reached } System.out.println(removeAll('l',"hello")); I understand the code is to remove all the l from hello, I just don't understand how it does it! c2 = h (first char of hello), if it is not equal to c to_return += c2? what does this mean, more importantly what is += The next step is very confusing for me too! s = s.substring(1); what does this do in this case I only understand substrings by (1,4) etc! Thanks for helping
has answer: http://stackoverflow.com/a/23379974
accepted answer: http://stackoverflow.com/a/23379974
possible better answer: http://stackoverflow.com/a/23379982
downvote count: 1
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35815077

http://stackoverflow.com/a/23452548
score: 0
type: Answer
has body: The exception means that the server is sending a TCP reset to terminate the connection you are making. If this is an intermittent connection, you could avoid a program exit by putting the try and catch blocks inside the while loop instead of outside. It would be best to figure out why the server is resetting your connections, though.
answers question: http://stackoverflow.com/q/23452442

http://stackoverflow.com/comment/35811018
type: Comment
has text: Ok so I changed that and now the new entry in logcat says 04-29 20:28:07.264: E/AndroidRuntime(1144): java.lang.RuntimeException: Unable to start activity ComponentInfo{ie.gmit.pleasework/ie.gmit.pleasework.Societies}: java.lang.ClassCastException: android.widget.ImageButton cannot be cast to android.widget.Button
type: AnswerComment
comment on: http://stackoverflow.com/a/23377440
score: 0

http://stackoverflow.com/comment/35907371
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23429444
has text: Prior to running the main project I ran maven install on dependency, still no luck!

http://stackoverflow.com/comment/35807357
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23375568
has text: Which exception types can be thrown is deterministic - they are declared on method signatures - there's no reason to just try other types, or to catch the general `Exception` class. The catching of `FileNotFound` should wrap the opening of the file earlier in the method if it needs to be caught, or if this method should instead throw that exception to the caller then the catch should just be removed and the exception declared as being thrown in the method signature.
score: 0

http://stackoverflow.com/comment/35855126
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23401508
has text: Which would you prefer, to check every element, or to use a different data structure? The different data structure could be instead of, or in addition to, the HashSet.

http://stackoverflow.com/comment/138026327
score: 0
has text: Why don't you annotate the argument of `doSomething` (instead of `doSomethingAsync`) with `@NotNull @Valid`?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23375459

http://stackoverflow.com/a/23450047
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35945693
downvote count: 0
has body: How it is restricted that subclass of java.lang.Throwable will not be generic class? Here's how OpenJDK compiler performs the check: import com.sun.tools.javac.code.Symbol.*; private void attribClassBody(Env&lt;AttrContext&gt; env, ClassSymbol c) { .... // Check that a generic class doesn't extend Throwable if (!c.type.allparams().isEmpty() &amp;&amp; types.isSubtype(c.type, syms.throwableType)) log.error(tree.extending.pos(), "generic.throwable"); As you can see forbidden type is kind of harcoded, so you can't use the same technique for your custom class without compiler code customization. Full source code
has comment: http://stackoverflow.com/comment/35947331
has comment: http://stackoverflow.com/comment/35945994
type: Answer
answers question: http://stackoverflow.com/q/23449782
has comment: http://stackoverflow.com/comment/35947873
has comment: http://stackoverflow.com/comment/35947801
upvote count: 20
score: 20
accepted answer of: http://stackoverflow.com/q/23449782

http://stackoverflow.com/comment/35796403
comment on: http://stackoverflow.com/a/23369609
type: AnswerComment
has text: Averroes answer has the correct information to fix this I believe
type: Comment
score: 1

http://stackoverflow.com/q/23292917
type: Question
answer count: 1
downvote count: 0
accepted answer: http://stackoverflow.com/a/23293239
tagged with: compilation
has body: Here's what the lines in my .vimrc look like: autocmd FileType python nnoremap &lt;buffer&gt; &lt;F9&gt; :exec '!python' shellescape(%)&lt;cr&gt; autocmd FileType java nnoremap &lt;buffer&gt; &lt;F9&gt; :exec '!javac' shellescape(%) &amp;&amp; '!java' shellescape(%:r)&lt;cr&gt; autocmd FileType c,cpp nnoremap &lt;buffer&gt; &lt;F9&gt; :exec '!gcc' shellescape(%) &amp;&amp; './a.out'&lt;cr&gt; The Python map executes fine. The Java map will compile alright, but won't run. I'm not entirely sure if my syntax is correct. I don't know what's going on with the C version of the map...it keeps displayig the message: "error: Class names, 'test.C,test', are only accepted if annotation processing is explicitly requested" Anyone know what's going on?
has title: Vim key mapping compile and run for Java and C code
favorite count: 0
score: 2
tagged with: mapping
upvote count: 2
has answer: http://stackoverflow.com/a/23293239
tagged with: vim
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/35727411
type: Comment
has text: That is interesting! what you can do is: For every object define either a radius or height and width and also define and X,Y value that is the center of the image. as soon as another object is in vicinity of the object x + radius or y + radius then you can assume they have collided.
comment on: http://stackoverflow.com/q/23332096
score: 0
type: QuestionComment

http://stackoverflow.com/q/23443615
tagged with: javabeans
favorite count: 0
type: Question
has title: Setter Method of Bean Class
accepted answer: http://stackoverflow.com/a/23443661
answer count: 3
upvote count: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/23443663
has comment: http://stackoverflow.com/comment/35933227
has body: Hello Friends Iam trying to call Setter method from other Setter method but iam getting nullPointerException in that. Is possible to call setter method from other setter. Here is my bean class:- public class ApplicationParameterListEntityTo{ private Long statusValueID; private WidgetFieldValueBean1 parameterListStatusValueID; public Long getStatusValueID() { return statusValueID; } public void setStatusValueID(Long statusValueID){ this.statusValueID = statusValueID; this.parameterListStatusValueID.setWidgetFieldValueID(statusValueID); } public WidgetFieldValueBean1 getParameterListStatusValueID() { return parameterListStatusValueID; } Is there any problem in this peace of code.
has answer: http://stackoverflow.com/a/23443663
type: AnsweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/23443664
has answer: http://stackoverflow.com/a/23443661
score: 1

variables
tag name: variables
tags question: http://stackoverflow.com/q/23320402
tags question: http://stackoverflow.com/q/23352881
tags question: http://stackoverflow.com/q/23403709
tags question: http://stackoverflow.com/q/23354604
tags question: http://stackoverflow.com/q/23436869
type: Tag
tags question: http://stackoverflow.com/q/23397865
tags question: http://stackoverflow.com/q/23431603
tags question: http://stackoverflow.com/q/23451903
tags question: http://stackoverflow.com/q/23441129
tags question: http://stackoverflow.com/q/23405400
tags question: http://stackoverflow.com/q/23353611
tags question: http://stackoverflow.com/q/23450615
tags question: http://stackoverflow.com/q/23432722
tags question: http://stackoverflow.com/q/23297859
tags question: http://stackoverflow.com/q/23306176
tags question: http://stackoverflow.com/q/23331009
tags question: http://stackoverflow.com/q/23369419
tags question: http://stackoverflow.com/q/23438556
tags question: http://stackoverflow.com/q/23431612

http://stackoverflow.com/comment/35764227
comment on: http://stackoverflow.com/q/23352098
score: 0
has text: perhaps your first input contains a line separator , but the second input does not , and the scanner does not find the line correctly - and hence the NSEE
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/35898440
score: 1
has text: Starting from Java 7, the if-cascade can also be done by a switch over the String literals, which - IMHO - looks more elegant and less cluttered.
type: Comment
comment on: http://stackoverflow.com/a/23424645
type: AnswerComment

http://stackoverflow.com/a/23314429
has comment: http://stackoverflow.com/comment/35694636
score: 2
upvote count: 2
has body: Anytime you use @Autowired, the class into which the dependency is going to be injected needs to be managed by Spring. A test with: @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations={"/applicationContext-test.xml"}) is managed by Spring. When the annotations do not exist, the class is not managed by Spring and therefor no dependency injection is performed
accepted answer of: http://stackoverflow.com/q/23314294
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23314294
type: Answer

http://stackoverflow.com/q/23430685
has body: Is it possible to define following in Java: public interface IGenericRepo&lt;T&gt; { void add(); void delete(); void attach(); } public interface IGenericRepo&lt;Book&gt; { default String bookSpecificMethod(){ return "smthn"; } } public class NHGenericRepo&lt;T&gt; implements IGenericRepo&lt;T&gt;{ /* implementation */ } public class NHUnitOfWork implements UnitOfWork{ @Autowired public void setBookRepo(NHGenericRepo&lt;Book&gt; bookRepo) { this.bookRepo= bookRepo; } public NHGenericRepo&lt;Book&gt; getBookRepo() { return bookRepo; } private NHGenericRepo&lt;Book&gt; bookRepo; } And to be able somewhere in code to have: { @Autowired public void setNhuw(NHUnitOfWork nhuw) { this.nhuw = nhuw; } private NHUnitOfWork nhuw; /**/ { String st = this.nhuw.getBookRepo().bookSpecificMethod(); } } In .net this is possible by using Extension Method with "this IGenericRepo&lt;Book&gt;" as a first method parameter.
has comment: http://stackoverflow.com/comment/35909739
accepted answer: http://stackoverflow.com/a/23430730
score: 2
type: AnsweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/23430730
tagged with: java
has title: Generics specific interface definition in Java
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/35909510
has comment: http://stackoverflow.com/comment/35909351
answer count: 1
has comment: http://stackoverflow.com/comment/35910478
favorite count: 0
has comment: http://stackoverflow.com/comment/35909371
has comment: http://stackoverflow.com/comment/35910032
tagged with: generics

http://stackoverflow.com/q/23376498
tagged with: apk
has comment: http://stackoverflow.com/comment/35809194
has answer: http://stackoverflow.com/a/23378607
type: UnansweredQuestion
has body: When I decompiled my .apk I saw some extra files such as MainActivity$1.java, MainActivity$1$1.java etc. In fact some of them are empty. Besides that there are some code snippets that are occuring many times such as this$0 = MainActivity.this; super(); or this$1 = _cls1.this; super(); where can i read more about this? and is there a way to restore my original source code?
tagged with: decompiler
type: Question
has comment: http://stackoverflow.com/comment/35809213
has comment: http://stackoverflow.com/comment/35809278
tagged with: java
has title: Restore original source from apk
has comment: http://stackoverflow.com/comment/35809562
has comment: http://stackoverflow.com/comment/35809039
answer count: 1
score: 0
has comment: http://stackoverflow.com/comment/35809664
tagged with: android

http://stackoverflow.com/q/23331198
score: 1
tagged with: java
upvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/23331218
tagged with: arrays
answer count: 1
has body: These two buttons are cycling through an array and when pressed increment to many times and depending on what the maximum index is. I thought it might be because (for backwards a least I have "i set as maximum index" but changing to current index stops the button functioning all together. btnprev.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { for (int i = dataArrayMaxIndex; i &gt;= 0; i-- ) { System.out.println("backwards"); dataArrayCurrentIndex = i; websitetxt.setText(dataArray[i].getWebsitename()); usernametxt.setText(dataArray[i].getUsername()); passwordtxt.setText(dataArray[i].getPassword()); notestxt.setText(dataArray[i].getNotes()); } } }); btnnext.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { for (int i = 0; i&lt;dataArrayMaxIndex; i++) { System.out.println("foward"); dataArrayCurrentIndex = i; websitetxt.setText(dataArray[i].getWebsitename()); usernametxt.setText(dataArray[i].getUsername()); passwordtxt.setText(dataArray[i].getPassword()); notestxt.setText(dataArray[i].getNotes()); } } }); I am unsure as to fixing this problem and could use some help and suggestions. I feel it would be more helpful for myself to not be given the answer but to have some constructive criticism to lead myself to it, that being said feel free to post an a straight, working answer if that's your thing.
downvote count: 0
favorite count: 0
has title: Next and previous buttons in array cycles through array too many times each press (more then once)
has answer: http://stackoverflow.com/a/23331218
type: AnsweredQuestion

http://stackoverflow.com/q/23423550
favorite count: 0
has body: I am trying to secure the Spring Boot actuactor endpoints. I have working security on my /api REST interface, but trying to add security on the built-in endpoints does not seem to work. I have set up grouping of the endpoints in my application.properties: management.context-path=/management I have this in my Java Config @Override protected void configure( HttpSecurity http ) throws Exception { http.csrf().disable(); http.sessionManagement().sessionCreationPolicy( SessionCreationPolicy.STATELESS ); http.authorizeRequests() .antMatchers( "/api/**" ).hasRole( "READONLY" ) .antMatchers( "/management/**" ).hasRole( "ADMIN" ); SecurityConfigurer&lt;DefaultSecurityFilterChain, HttpSecurity&gt; securityConfigurer = new XAuthTokenConfigurer( userDetailsServiceBean() ); http.apply( securityConfigurer ); } When I use my browser to go to anything below /api, I get a 403 back as expected. When going to /management/info for example, I see the JSON being returned where I would also expect a 403. I also tried adding this to my application.properties file: management.security.role=ADMIN But that did not help either. The DEBUG output shows: 2014-05-02 10:15:30 DEBUG [localhost-startStop-1] ExpressionBasedFilterInvocationSecurityMetadataSource - Adding web access control expression 'hasRole('ROLE_READONLY')', for Ant [pattern='/api/**'] 2014-05-02 10:15:30 DEBUG [localhost-startStop-1] ExpressionBasedFilterInvocationSecurityMetadataSource - Adding web access control expression 'hasRole('ROLE_ADMIN')', for Ant [pattern='/management/**'] And then why I try the HTTP GET: 2014-05-02 10:16:39 DEBUG [http-nio-8443-exec-4] AntPathRequestMatcher - Checking match of request : '/management/info'; against '/css/**' 2014-05-02 10:16:39 DEBUG [http-nio-8443-exec-4] AntPathRequestMatcher - Checking match of request : '/management/info'; against '/js/**' 2014-05-02 10:16:39 DEBUG [http-nio-8443-exec-4] AntPathRequestMatcher - Checking match of request : '/management/info'; against '/images/**' 2014-…
has title: Unable to secure Spring boot management actuator endpoints
score: 6
upvote count: 6
accepted answer: http://stackoverflow.com/a/23423778
type: AnsweredQuestion
tagged with: spring-boot
tagged with: java
type: Question
tagged with: spring-security
has answer: http://stackoverflow.com/a/23423778
downvote count: 0
answer count: 1

http://stackoverflow.com/a/23376305
upvote count: 1
score: 1
has body: Your code will never produce a leading zero in your output as 0+1=1, 0+2=2, ... Try one of these: Ternary Take 1: String zero = ((min &gt; 9 ) ? String.valueOf(min) : "0"+min); Ternary Take 2: System.out.println("The time is " + hourOfDay + ":" + ((min &gt; 9 ) ? "" : "0") + min); String.format: String zero = String.format("%02d", min); System.out.printf: System.out.printf("The time is %d:%02d%n", hourOfDay, zero); I would tend to use one of the later two in this case. Depending on whether or not outputting to System.out is you concern, the third could be the best. Of course there are a lot other options.
answers question: http://stackoverflow.com/q/23376106
downvote count: 0
type: Answer

http://stackoverflow.com/a/42900184
has comment: http://stackoverflow.com/comment/72900822
type: Answer
answers question: http://stackoverflow.com/q/23357142
has body: The syntax would be setFont(new Font("fontName", fontStyle, fontSize)); Unless you have a custom font you made, then it would be setFont(font);
score: 0

http://stackoverflow.com/comment/35666150
type: Comment
score: 0
has text: If I call the method on a non static method using this.print(); will the code work?
comment on: http://stackoverflow.com/a/23298584
type: AnswerComment

http://stackoverflow.com/q/23323094
answer count: 4
tagged with: java
tagged with: spring-tool-suite
type: Question
has answer: http://stackoverflow.com/a/23470757
has answer: http://stackoverflow.com/a/29688279
has body: The GGTS(Groovy Grails Tools Suite) is picking the incorrect value of JAVA_HOME. When I check the value in terminal it shows java-6, but GGTS is picking java-7. sashwat@sashwat-desktop:~$ echo ${JAVA_HOME} /usr/lib/jvm/java-6-openjdk-amd64 I am getting the following error in GGTS Error executing script TestApp: java.io.IOException: Cannot run program "/usr/lib/jvm/java-7-openjdk-amd64/bin/java" (in directory "/home/sashwat/grails/gTunes"): java.io.IOException: error=2, No such file or directory (Use --stacktrace to see the full trace) I am able to run the app from command line, it is only giving error when I try to run it from GGTS. Can someone help me in this regard? There is a strange behavior. If I re-install the GGTS, everything would work fine but after restart it would start showing the above error.
has comment: http://stackoverflow.com/comment/56464783
has answer: http://stackoverflow.com/a/23345109
type: UnansweredQuestion
score: 0
has answer: http://stackoverflow.com/a/23445976
has title: GGTS picking incorrect java path

http://stackoverflow.com/q/23449784
upvote count: 1
tagged with: swing
type: Question
has body: i used a class Imagepanel to show a background image to my panel in netbeans .It successfully works when running it from the IDE netbeans 6.8 ,but when i run it from the jar file it doesn't show the image .Please help me to solve this problem .Thanks for your remarks . Here is my code ImagePanel.java import java.awt.Dimension; import java.awt.Graphics; import java.awt.Image; import javax.swing.ImageIcon; import javax.swing.JPanel; class ImagePanel extends JPanel { private Image img; public ImagePanel(String img ) { this(new ImageIcon(img).getImage()); } public ImagePanel(Image img) { this.img = img; Dimension size = new Dimension(img.getWidth(null), img.getHeight(null)); setPreferredSize(this.getMaximumSize()); setMinimumSize(size); setMaximumSize(size); setSize(this.getMaximumSize()); setLayout(null); } @Override public void paintComponent(Graphics g) { g.drawImage(img, 0, 0, null); } } I have created my panel which is in another class like this where my image is in the directory images under src. Thanks in advance . ImagePanel pan2 = new ImagePanel("src/images/tarif.png");
tagged with: image
has title: ImagePanel isn't showing in my jar file with netbeans
has answer: http://stackoverflow.com/a/23454991
downvote count: 0
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/35947891
type: UnansweredQuestion
tagged with: embedded-resource
tagged with: netbeans
has comment: http://stackoverflow.com/comment/35954933
score: 1
tagged with: java

http://stackoverflow.com/a/23359945
has comment: http://stackoverflow.com/comment/35778519
answers question: http://stackoverflow.com/q/23359753
has body: What is the significance of 'user-visible' synchronization? Locks you cana ccess from Java code. Are there any other synchcronization apart from 'user-visible'? Yes, the JVM has locks internally for it's use. JVM must maintain unique identity of each and every object ever created vs the information that its finalize method has been invoked. Whether the object has been finalized is stored in the header. There is no global id for an object. The only thing unique about it is the reference to the object itself. Wouldn't it ultimately grow beyond whatever region it is stored in ? This space is allocated when the object is created. For more information Object resurrection in Java
score: 2
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/35778023
upvote count: 2
has comment: http://stackoverflow.com/comment/35778120
type: Answer
accepted answer of: http://stackoverflow.com/q/23359753

http://stackoverflow.com/comment/35679290
has text: Here's [a question/answer](http://stackoverflow.com/a/14863539/778118) that explains how to sort arrays of objects. Here's [another one](http://stackoverflow.com/a/17116644/778118)...
comment on: http://stackoverflow.com/q/23305769
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/139868587
comment on: http://stackoverflow.com/a/36843825
type: AnswerComment
score: 0
type: Comment
has text: but that is basically the same as doing `if (!some_condition_met) { do_stuff; }` (where `do_stuff` is missing in your code), so the better (IMO) solution with streams would be to use a `filter()` before `forEach()`

http://stackoverflow.com/q/23357068
type: Question
has comment: http://stackoverflow.com/comment/35774304
answer count: 2
has title: how to send a blocking message via HandlerThread?
score: 0
has comment: http://stackoverflow.com/comment/35777510
tagged with: android
has answer: http://stackoverflow.com/a/23359603
has answer: http://stackoverflow.com/a/23358135
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35773174
has comment: http://stackoverflow.com/comment/35774428
tagged with: java
has body: I need to send a message to a HandlerThread from my current thread but stop the sendmessage call from returning immediately. Is there a way to do this sendMessage() in a blocking way?
has comment: http://stackoverflow.com/comment/35775583

http://stackoverflow.com/a/23357088
answers question: http://stackoverflow.com/q/23356999
has comment: http://stackoverflow.com/comment/35773018
score: 0
has body: The below function will achieve what you want. public int GetRandom() { double random = Math.random() * 100 + 1; int num = (int)random; if(num &lt;= 10) return 4; return 2; }
type: Answer
has comment: http://stackoverflow.com/comment/35773124

http://stackoverflow.com/a/34083156
downvote count: 0
score: 8
answers question: http://stackoverflow.com/q/23392085
upvote count: 8
type: Answer
has body: AES algorithm allows 128, 192 or 256 bit key length. which is 16, 24 or 32 byte. your keys length should be 16 , 24 or 32 bytes.

http://stackoverflow.com/comment/35878296
score: 0
comment on: http://stackoverflow.com/a/23413823
type: Comment
type: AnswerComment
has text: @user3521471 You can only set `String` as the action command. The `i+""` converts `i` to a `String`. When you use `getActionCommand` you're going to have to convert it back to an integer.

http://stackoverflow.com/q/23440253
tagged with: flume
tagged with: java
tagged with: twitter
type: Question
tagged with: location
has answer: http://stackoverflow.com/a/27603839
has title: Finding out the location of tweets downloaded by flume from twitter
score: 0
answer count: 1
tagged with: geo
type: UnansweredQuestion
has body: I used some keywords and downloaded the tweets from twitter using flume.And the sample data looks like as follows {"filter_level":"medium","contributors":null,"text":"Messi, Ozil, CR7 &amp; Suarez Bertengger di Lamborghini t.co/SKk8xnnjl7","geo":null,"retweeted":false,"in_reply_to_screen_name":null,"possibly_sensitive":false,"truncated":false,"lang":"in","entities":{"symbols":[],"urls":[{"expanded_url":"dlvr.it/5XH5Vk","indices":[56,78],"display_url":"dlvr.it/5XH5Vk","url":"t.co/SKk8xnnjl7"}],"hashtags":[],"user_mentions":[]},"in_reply_to_status_id_str":null,"id":461450307856130048,"source":"http://dlvr.it\" rel=\"nofollow\">dlvr.it&lt;/a>","in_reply_to_user_id_str":null,"favorited":false,"in_reply_to_status_id":null,"retweet_count":0,"created_at":"Wed Apr 30 10:21:41 +0000 2014","in_reply_to_user_id":null,"favorite_count":0,"id_str":"461450307856130048","place":null,"user":{"location":"Subscribe Us","default_profile":false,"profile_background_tile":true,"statuses_count":158496,"lang":"en","profile_link_color":"006400","profile_banner_url":"pbs.twimg.com/profile_banners/251586988/1368528690","id":251586988,"following":null,"protected":false,"favourites_count":1,"profile_text_color":"333333","description":"Latest Breaking News &amp; Software.\r\n\r\nAkun ini dijual Rp150.000","verified":false,"contributors_enabled":false,"profile_sidebar_border_color":"000000","name":"TOP NEWS","profile_background_color":"000000","created_at":"Sun Feb 13 12:54:44 +0000 2011","is_translation_enabled":false,"default_profile_image":false,"followers_count":37879,"profile_image_url_https":"pbs.twimg.com/profile_images/449966329588482048/Rb4azNrv_normal.jpeg","geo_enabled":false,"profile_background_image_url":"abs.twimg.com/images/themes/theme14/bg.gif","profile_background_image_url_https":"abs.twimg.com/images/themes/theme14/bg.gif","follow_request_sent":null,"url":"google.com","utc_offset":25200,"time_zone":"Bangkok","notifications":null,"profile_use_background_image":true,"friends_count…

http://stackoverflow.com/comment/35933555
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/23443349
type: Comment
has text: Some comments since you've posted this; you don't need to have overloaded versions for int/float/double; just provide float, since that's what you store anyway (implicit casting will cater for int, and it's worth warning about double). `new Degree(0).equals( new Degree(360) )` will return `false` (actually you have a typo in `setNormalise` which means it will never actually normalise). And your compareTo isn't wrap-around aware (so 361 < 359). Of course, making it wrap-around aware is impossible, but maybe that means you shouldn't allow it?

http://stackoverflow.com/comment/35766888
comment on: http://stackoverflow.com/a/23353659
score: 0
type: AnswerComment
type: Comment
has text: Cartier, thank you. But I have my code implemented like this public class CbabyBall extends JFrame implements KeyListener, ActionListener, ChangeListener {

http://stackoverflow.com/comment/35859171
type: Comment
comment on: http://stackoverflow.com/q/23403595
score: 0
has text: So, assuming that `nCol != 7`, otherwise we have problems, you could use `sampleTable.setValueAt(i, 7, counter)` or `tableData[i][7] = counter`. Assuming that `nCol == 7`, then `Object[][] tableData = new Object[nRow][nCol];` needs to be `Object[][] tableData = new Object[nRow][nCol + 1];`, and you can use `tableData[i][7] = counter`. If the column counts don't match, you'll need to build a new table model...
type: QuestionComment

http://stackoverflow.com/comment/35972726
comment on: http://stackoverflow.com/a/23418010
score: 0
type: Comment
has text: Hi Andrei, (and any interested peruser), I can confirm that GWT 2.6 and gwtupload-1.0.1.jar fix this issue. Please see "http://stackoverflow.com/questions/23455516/issue-with-instalation-of-gwt-2-6/23455886?iemail=1&noredirect=1#23455886" for details. Thanks and regards, Glyn.
type: AnswerComment

http://stackoverflow.com/q/23316946
tagged with: java
has body: New to the site and have not been coding long. I am trying to find a way to check to see if the entered value is withing the array range as well as checking to see if the position is already occupied. I am running into trouble if the problems are not in order. I would like for it to catch the problem in any order and request them to enter another value, then recheck again. Thanks for any advice! This is what I ended up doing. Any thoughts? Thanks again. //in play game method while(checkNotInBounds(move)){ System.out.println("Out of Bounds! Please try again..."); move = getMove(player); } while(!checkSpaceFree(move, boardValues)){ System.out.println("Space Taken! Please try again..."); move = getMove(player); while(checkNotInBounds(move)){ System.out.println("Out of Bounds! Please try again..."); move = getMove(player); } //Method: checkInBounds //Purpose: find out if move is in bounds public static boolean checkNotInBounds(int[] move){ if(move[0] &gt; 2 || move[0] &lt; 0 || move[1] &gt; 2 || move[1] &lt; 0){ return true;} return false; } //Method: checkFreeSpace //Purpose: find if space is free public static boolean checkSpaceFree(int[] move, char[][]boardValues){ if(boardValues[move[0]][move[1]] == ' '){ return true;} return false; }
type: Question
downvote count: 0
has title: Tic Tac Toe, checking legal move
has answer: http://stackoverflow.com/a/23317019
answer count: 1
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/35701579
upvote count: 1
accepted answer: http://stackoverflow.com/a/23317019
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35700270

http://stackoverflow.com/a/23392584
score: 1
upvote count: 1
type: Answer
has body: If I understand your question correctly you want a background process running that accepts requests and then does something to the server Tomcat is running on. You don't need any background process. Tomcat itself will dutifully process any incoming HTTP requests then execute the appropriate servlet based on the configuration in web.xml (or configuration and/or convention of whatever framework you used to write your app).
downvote count: 0
answers question: http://stackoverflow.com/q/23392318

http://stackoverflow.com/comment/36218636
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23470778
has text: @user2709752: See my edit. I have provided a link which has details on how to set header.
type: AnswerComment

http://stackoverflow.com/comment/35745986
score: 0
comment on: http://stackoverflow.com/a/23325029
has text: you will probably have a switch(direction) ... case(NORTH): position.y--; matrix[position.x][position.y].playerEntering(player);
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/35936163
score: 0
type: Comment
type: QuestionComment
has text: @BheshGurung But even I divide them into different sections, I have to check them when add them into list. Is this can be solved?
comment on: http://stackoverflow.com/q/23444659

http://stackoverflow.com/q/23351573
has body: I try to generate database structure with my entities. To do that i use the Eclipse tool. I've the Kepler version but i've test with juno too. "Right click on project -> JPA Tools -> Generate Table from entity" But eclipse fails with this strange error : Exception in thread "main" javax.persistence.PersistenceException: Found 'javax.persistence.provider' property in the map but the value is not a String. Found object : 'null'. at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:131) at org.eclipse.jpt.jpa.eclipselink.core.ddlgen.Main.buildEntityManagerFactory(Main.java:94) at org.eclipse.jpt.jpa.eclipselink.core.ddlgen.Main.execute(Main.java:80) at org.eclipse.jpt.jpa.eclipselink.core.ddlgen.Main.main(Main.java:68) This is my persistence.xml <?xml version="1.0" encoding="UTF-8"?> <persistence version="2.0" 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"> org.eclipse.persistence.jpa.PersistenceProvider <exclude-unlisted-classes>false</exclude-unlisted-classes> ENABLE_SELECTIVE <property name="javax.persistence.jdbc.url" value="jdbc:postgresql://localhost:5432/superng"/> <property name="javax.persistence.jdbc.user" value="postgres"/> <property name="javax.persistence.jdbc.password" value="changeit"/> <property name="javax.persistence.jdbc.driver" value="org.postgresql.Driver"/> <property name="eclipselink.ddl-generation" value="drop-and-create-tables"/> <property name="eclipselink.ddl-generation.output-mode" value="sql-script"/> Why does it fails?
tagged with: java
type: Question
tagged with: eclipse
score: 0
tagged with: eclipselink
answer count: 1
tagged with: jpa
has title: Can't generate table form entity with eclipse and eclipselink
has answer: http://stackoverflow.com/a/23351777
accepted answer: http://stackoverflow.com/a/23351777
type: AnsweredQuestion

http://stackoverflow.com/comment/36139498
type: Comment
comment on: http://stackoverflow.com/a/23422144
has text: http://stackoverflow.com/questions/17533280/resteasy-jax-rs-sending-custom-object-in-response-body. The paragraph "What if your content-type is not supported out of the box?" It says about a "implement a custom MessageBodyReader" . In this sample code, I think we don't need to have such a custom MessageBodyReader as it support Streams,right? Would you explain about "return new StreamingOutput() {)"
type: AnswerComment
score: 0

http://stackoverflow.com/comment/74050835
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23368062
has text: Possible duplicate of [Method resolution order in C++](http://stackoverflow.com/questions/3310910/method-resolution-order-in-c)

http://stackoverflow.com/a/23401990
type: Answer
score: 4
has comment: http://stackoverflow.com/comment/35855968
has comment: http://stackoverflow.com/comment/35855847
has body: The issue lies here: g2.setColor(new Color(Color.WHITE)); The Color class in Java does not accept another Color object as an input for its constructor, because Color.WHITE (along with a myriad of other predefined colors) is a reference to a Color object, the line should read: g2.setColor(Color.WHITE); Source: http://docs.oracle.com/javase/7/docs/api/java/awt/Color.html
has comment: http://stackoverflow.com/comment/35858867
has comment: http://stackoverflow.com/comment/35856089
upvote count: 4
answers question: http://stackoverflow.com/q/23401948
downvote count: 0

http://stackoverflow.com/a/23309208
downvote count: 1
has comment: http://stackoverflow.com/comment/35686096
answers question: http://stackoverflow.com/q/23309141
has comment: http://stackoverflow.com/comment/35686306
has comment: http://stackoverflow.com/comment/35686225
has body: Simple said: Put everything in the main method of the client into a while loop and add an if-branch to jump out of the programm if the given number is 0.
has comment: http://stackoverflow.com/comment/35685750
has comment: http://stackoverflow.com/comment/35686248
type: Answer
has comment: http://stackoverflow.com/comment/35685572
has comment: http://stackoverflow.com/comment/35687537
upvote count: 2
score: 1
has comment: http://stackoverflow.com/comment/35685719

http://stackoverflow.com/comment/35876208
type: Comment
type: QuestionComment
score: 1
has text: there is a problem with the HTML code: opening `<` for first div tag is missing. also it seems never closed
comment on: http://stackoverflow.com/q/23412726

http://stackoverflow.com/q/23448848
score: 2
type: AnsweredQuestion
tagged with: netbeans
tagged with: java
has comment: http://stackoverflow.com/comment/35965705
has comment: http://stackoverflow.com/comment/35979562
has comment: http://stackoverflow.com/comment/35965578
type: Question
has body: My JApplet is producing a error when DrawOvalInputs.html runs and calls the class file of DrawOvalInputs. So far, I have only been able to get it work as an actual application (Which is why the main is in a block quote). My goal for this program is to be able to run a .html file to start up the JApplet with a medium security setting on the java console, yet no matter what I've done it simply won't function. I have looked around on quite a few pages and searches before coming here. Regrettably, I just can't figure this JApplet out, so if someone could guide me in the right direction I'd be most thankful! My Code below: DrawOvalInputs.java package drawovalapplet; import java.awt.BorderLayout; import java.awt.Frame; import java.awt.Graphics; import javax.swing.JApplet; import javax.swing.JOptionPane; /** * This applet inputs a number of values, and then computes the size of * an oval with those given values. * * @author [Redacted] * @version 2014-05-02, [Redacted] */ public class DrawOvalInputs extends JApplet { private static int x; //left edge of the oval private static int y; //top edge of the oval private static int width; //width of oval private static int height; //height of oval private static int windowWidth; //Holds necessary width of window. private static int windowHeight; //Holds necessary height of window. private static int windowBox; //Holds box form of window. @Override public void init() { try { /** Collect the input values. */ Input.inputAll(); /** creates dimensions for box */ windowWidth = width + x + 50; windowHeight = height + y + 50; /** * If... else... function to gather data to create * a fitting box for the oval */ if(windowWidth > windowHeight) windowBox = windowWidth; else windowBox = windowHeight; } catch (Input.CanceledException ex) { System.exit(1); } } @Override public void paint(Graphics g) { super.paint(g); g.drawOval(x, y, width, height); } // end method pain /** * Main entry point. * Execute: * java drawovalapplet.DrawOvalInputs * * …
possible better answer: http://stackoverflow.com/a/23448908
accepted answer: http://stackoverflow.com/a/23460921
has title: JApplet not running: < No main classes found >
upvote count: 2
answer count: 2
tagged with: japplet
has answer: http://stackoverflow.com/a/23460921
linked to: http://stackoverflow.com/q/10382929
downvote count: 0
tagged with: applet
has comment: http://stackoverflow.com/comment/35965519
favorite count: 0
has answer: http://stackoverflow.com/a/23448908
tagged with: http://stackoverflow.com/tag/html
has comment: http://stackoverflow.com/comment/35979221
has comment: http://stackoverflow.com/comment/35950349

http://stackoverflow.com/q/23435493
accepted answer: http://stackoverflow.com/a/23436527
favorite count: 0
has title: Javascript How to stop or reset a timer in Java on a website
tagged with: timer
downvote count: 2
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/35918845
type: Question
has comment: http://stackoverflow.com/comment/35919151
has answer: http://stackoverflow.com/a/23436527
score: -2
tagged with: javascript
has body: I'm trying to stop a timer from running on a website. I either want to stop it or control its value. The timer id is: id="timer" I want to be able to stop it with a bookmarklet, so the code should begin with: javascript: I'm new to java, so I don't know the approach to stop a timer.
upvote count: 0
answer count: 1

calendar
tags question: http://stackoverflow.com/q/23385434
tags question: http://stackoverflow.com/q/23331935
tags question: http://stackoverflow.com/q/23323792
tags question: http://stackoverflow.com/q/23443342
tags question: http://stackoverflow.com/q/23417490
tag name: calendar
tags question: http://stackoverflow.com/q/23437320
tags question: http://stackoverflow.com/q/23346488
type: Tag
tags question: http://stackoverflow.com/q/23362249
tags question: http://stackoverflow.com/q/23340480

http://stackoverflow.com/a/23407894
has body: The reason I got the error was because I'd made the List un-alterable by setting it's values in the cosntructor. If I didn't set the values at all when taskList was created as a member variable. private List&lt;String&gt; taskList; I could then make it into a clean List in the onCreate taskList = new ArrayList&lt;String&gt;(); and add the elements afterwards. Since I was going to scale it up to read from a database in it's onCreate, this wasn't an issue.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23295899

http://stackoverflow.com/comment/35718167
has text: Can't I do it with the Netbeans GUI builder?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23318353
type: Comment

http://stackoverflow.com/comment/35847696
comment on: http://stackoverflow.com/a/23396789
has text: +1 for suggesting `CardLayout`. -1, for posting a custom solution instead of linking to the section from the Swing tutorial on [How to Use CardLayout](http://docs.oracle.com/javase/tutorial/uiswing/layout/card.html) which contains explanations and a better structured working example. Creating a class with all static variables and methods is not a good design.
type: Comment
score: 1
type: AnswerComment

http://stackoverflow.com/comment/35651842
has text: One approach is by writing code.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23290963
score: 7

http://stackoverflow.com/comment/35705501
score: 0
type: Comment
type: QuestionComment
has text: anybody please help me...
comment on: http://stackoverflow.com/q/23309263

http://stackoverflow.com/q/23320988
has comment: http://stackoverflow.com/comment/35706879
has body: I am not getting to how to know to which layout it is point because instead of giving the full name like r.layout.activity_main it has given the id in the form of integer. How to get the location if the integer id is given how to convert it?
linked to: http://stackoverflow.com/q/10137692
has title: how to get the location of the layout "R.Layou.*" if the id is given in the form of integer like "2131296340"
score: 0
has answer: http://stackoverflow.com/a/23321318
type: UnansweredQuestion
tagged with: android
tagged with: reference
has comment: http://stackoverflow.com/comment/35707281
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/23321113
answer count: 2

http://stackoverflow.com/comment/35791888
has text: is it this solrJ.indexAllergenBulkSlor(); method definition is throwing the exception or handling it?
score: 0
comment on: http://stackoverflow.com/a/23365243
type: AnswerComment
type: Comment

http://stackoverflow.com/q/23353965
type: Question
tagged with: sorting
has comment: http://stackoverflow.com/comment/35767618
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/35767481
has body: I've just started learning about sorting and my class is currently working with selection. For my assignment, I have to sort a number list in increasing order and show with the array looks like and the current # of comparisons, and we have to do it on paper. The numbers are: 90, 8, 7, 56, 123, 235, 9, 1, 653. So far, this is what I have (sorted list is in bold): 90|8|7|56|123|235|9|1|653 # of comparisons: 0 --- **1**|8|7|56|123|235|9|90|653 # of comparisons: 1 --- **1**|**7**|8|56|123|235|9|90|653 # of comparisons: 2 This is basically the point at which I have a question. Because 8 is already in the correct place, would a comparison still take place? Or would it go straight to the next value? So, would it be: --- **1**|**7**|**8**|56|123|235|9|90|653 # of comparisons: 3 --- or would it be: --- **1**|**7**|**8**|**9**|123|235|56|90|653 # of comparisons: 3 --- I believe the former is correct, but I just wanted to ask you guys to make sure I'm understanding this properly.
has answer: http://stackoverflow.com/a/23354150
possible better answer: http://stackoverflow.com/a/23354085
has comment: http://stackoverflow.com/comment/35767421
has answer: http://stackoverflow.com/a/23354085
has comment: http://stackoverflow.com/comment/35767500
has comment: http://stackoverflow.com/comment/35767445
has answer: http://stackoverflow.com/a/23354030
has comment: http://stackoverflow.com/comment/35767531
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/23354150
has title: Sorting with Selection

http://stackoverflow.com/comment/35829788
has text: If you don't want the full result, you can always release the resources with the close() method on the returned iterator. The code snippet above shows the result being an Iterable<Map<String, Object>>, but it's actually a ResourseIterable, which returns closeable Iterator.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23361725

http://stackoverflow.com/a/23432807
score: 2
has body: run java classname java GetHeapSize
upvote count: 2
has comment: http://stackoverflow.com/comment/35913937
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23432789
answers question: http://stackoverflow.com/q/23432789
has comment: http://stackoverflow.com/comment/35913861
type: Answer
has comment: http://stackoverflow.com/comment/35913513

http://stackoverflow.com/q/23428821
type: Question
answer count: 2
linked to: http://stackoverflow.com/q/14017154
has answer: http://stackoverflow.com/a/23428842
tagged with: url
tagged with: string
has answer: http://stackoverflow.com/a/23429064
has title: Regular expression for finding URL in Java String
tagged with: regex
possible better answer: http://stackoverflow.com/a/23429064
linked to: http://stackoverflow.com/q/163360
favorite count: 0
downvote count: 6
upvote count: 2
accepted answer: http://stackoverflow.com/a/23428842
score: -4
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35906689
tagged with: java
has comment: http://stackoverflow.com/comment/35906111
linked to: http://stackoverflow.com/q/13704362
has body: How do you modify the following regex: String URLpattern = "((https?|ftp|gopher|telnet|file|Unsure|http):((//)|(\\\\))+[\\w\\d:#@%/;$()~_?\\+-=\\\\\\.&]*)" with one that takes into account ALL the following URL forms? http://www.website.com https://www.website.com www.website.com website.com http://website.com https://website.com EDIT: There are a bunch of already proposed solutions to the problem. I can list some of them: Regular expression to match URLs in Java Regex to matches a url with or without http in java (nice since explained, however not working in my code) Regular Expression, match url without "http://" and any other "/" However, although I tried all of them too, none of them is proposing an explanation of how and why the expression works. Thus, whenever there is a malfunctioning (and to me, a malfunctioning was happening in urls in the form website.com and http://website.com), it becomes difficult for newbies (like me ;) ) to apply any modification or understand what is going on when there is a failure. A well explained solution is always better than a solution made by others and not replicable in the next time =)

http://stackoverflow.com/a/23393898
upvote count: 3
type: Answer
accepted answer of: http://stackoverflow.com/q/23392586
answers question: http://stackoverflow.com/q/23392586
downvote count: 0
has body: This is not allowed. Why not? When methods are called in Java, the method with the most specific type signiture is used. In the example: interface A {...} interface B {...} class X extends A, B {...} void f(X); void f(A); void f(B); X x = ... f(x); // calls f(X) f((A)x); // calls f(A) f((B)x); // calls f(B) We all know how to cast to call the correct method we want. But in the example &lt;T extends X&gt; void g(T); //G1 &lt;T extends A &amp; B&gt; void g(T); //G2 g(x); // calls G1 We can call G1, but there is no way to call G2 without redirection. We cannot downcast to A &amp; B, only to either A or B. The A &amp; B does not seem well intgrated into the type system (most people won't even know of it), therefore Java does not see A as being a different type from A &amp; B when choosing which version of a method to dispatch to. Futher examples of madness: interface A interface B extends A &lt;T extends A &amp; B&gt; void f(T) &lt;T extends B&gt; void f(T) This will compile, but you can't call either of them B b = new B(){...} f(B); // method reference is ambiguious.
score: 3
type: AcceptedAnswer

http://stackoverflow.com/comment/35910335
type: QuestionComment
comment on: http://stackoverflow.com/q/23430932
score: 0
type: Comment
has text: Your problem is that you output all values, not just the largest. So in the first case, the last is *580085*. More details bellow.

http://stackoverflow.com/a/23421747
has comment: http://stackoverflow.com/comment/35902405
score: 2
has comment: http://stackoverflow.com/comment/35901961
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23414137
accepted answer of: http://stackoverflow.com/q/23414137
has body: EditorKit is controller like thing which allows working with specified content type. It has a reference to the Document (model) and listen changes. EditorKit provides Reader and Writer to load/store the specific type of Document (e.g HTMLDocument or RtfDocument). Also it provides ViewFactory to create views for different Document's Elements (nodes and leaves). Also EditorKit provides list of actions possible for the type of content. You can try this to see how an EditorKit could be created and used.
type: Answer
has comment: http://stackoverflow.com/comment/35902183
upvote count: 2
has comment: http://stackoverflow.com/comment/35900618
has comment: http://stackoverflow.com/comment/35900839
has comment: http://stackoverflow.com/comment/35900940

http://stackoverflow.com/comment/35739420
type: Comment
comment on: http://stackoverflow.com/a/23339026
has text: Any `exceptions?` and also clearly state what have you tried ?
type: AnswerComment
score: 0

http://stackoverflow.com/comment/35727274
has text: @ConorWatt Why do you need to pass an instance of `TicTac` to `TicTac`? It doens't make sense
type: Comment
comment on: http://stackoverflow.com/a/23331863
score: 1
type: AnswerComment

http://stackoverflow.com/a/23440881
type: Answer
has comment: http://stackoverflow.com/comment/35931117
answers question: http://stackoverflow.com/q/23430327
has body: The short answer is yes. The Gwan.java class that implements the G-WAN Java API starts with the following comments: // ============================================================================ // Java API calls for the G-WAN Web App. Server (http://trustleap.ch/) // ---------------------------------------------------------------------------- // Compile with: javac Gwan.java // // The G-WAN API getStrEnv() Java function returns a Java string for: // // REQUEST + // QUERY_STRING | // FRAGMENT_ID | // REQ_ENTITY | // VHOST_ROOT | // WWW_ROOT | // CSP_ROOT | // LOG_ROOT | a copy of the G-WAN C string // HLD_ROOT | // FNT_ROOT | // REMOTE_ADDR | // USER_AGENT | // SERVER_SOFTWARE | // SERVER_NAME | // SERVER_ADDR | // SERVER_DATE + // // Use getIntEnv() for the many integer values (like REQUEST_LEN) // // ...but these get_env() values are ignored by Java getxxxEnv() calls: // // HTTP_CODE + // SCRIPT_TMO | // KALIVE_TMO | // REQUEST_TMO | // DOWNLOAD_SPEED | pointers on integers // MIN_READ_SPEED | // MAX_ENTITY_SIZE | // US_HANDLER_STATES + // // US_HANDLER_DATA + // US_VHOST_DATA | pointers on user-defined data structures // US_SERVER_DATA + // // READ_XBUF + pointers on G-WAN internal structures // HTTP_HEADERS + // // If you want to contribute in this matter (by helping to implement Java // G-WAN API in C with JNI), then drop us a line, you are most welcome! // ---------------------------------------------------------------------------- So, yes, you can use Gwan.getIntEnv() with the value REMOTE_ADDR to access the client IP address seen by the G-WAN server.
score: 0

http://stackoverflow.com/a/23523237
accepted answer of: http://stackoverflow.com/q/23434504
score: 0
type: AcceptedAnswer
type: Answer
has body: Found the problem! In order for javassist to get the file name and line numbers it needs to have debug info enabled, and ant does not have it on by default. So, the solution is to enable debug info in ant.
answers question: http://stackoverflow.com/q/23434504

http://stackoverflow.com/comment/35731852
has text: For better help sooner, post an [MCVE](http://stackoverflow.com/help/mcve) (Minimal Complete and Verifiable Example).
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23327061
score: 0

http://stackoverflow.com/comment/35678201
type: Comment
type: QuestionComment
has text: the error the java gave you copy paste it here so we can examine it
comment on: http://stackoverflow.com/q/23305252
score: 0

http://stackoverflow.com/q/23317792
answer count: 1
tagged with: ms-access
has body: I am maintaining an invoice sending system using JAVA(Spring 3.0, JDBCTemplate) with MS-ACCESS on Window platform. My problem is that when I retrive one of the table, the number of ResultSet is different. except for the table, everything is fine. Here is my code and the table information. (DAO) public List&lt;QInv_RegularDto&gt; getAdsForCustomer(String NO_Inv) { List&lt;QInv_RegularDto&gt; returnList = new ArrayList&lt;QInv_RegularDto&gt;(); String sqlString = "SELECT ALL DT_Date" + " , Day_Issued" + " , NO_Inv" + " , DS_Desc" + " , AMT_Rate" + " , Disc" + " , AMT_Sub" + " , AMT_GST" + " , AMT_Tot" + " FROM QInv_Regular " + " WHERE NO_Inv = '0000039796'; log.info("sss : " + sqlString); List&lt;Map&lt;String, Object&gt;&gt; rows = jdbcTemplate.queryForList(sqlString); System.out.println("rows : " + rows.size()); System.out.println("rows : " + rows); for (Map row : rows) { QInv_RegularDto ad = new QInv_RegularDto(); ad.setdT_Date((String)row.get("DT_Date")); ad.setDay_Issued((String)row.get("Day_Issued")); ad.setnO_Inv((String)row.get("NO_Inv")); ad.setdS_Desc((String)row.get("DS_Desc")); ad.setaMT_Rate((BigDecimal)row.get("AMT_Rate")); ad.setDisc((Double)row.get("Disc")); ad.setaMT_Sub((BigDecimal)row.get("AMT_Sub")); ad.setaMT_GST((BigDecimal)row.get("AMT_GST")); ad.setaMT_Tot((BigDecimal)row.get("AMT_Tot")); returnList.add(ad); } return returnList; } When you see the code above, I print the size, query log and the result out and when I copy the query and run it on MS-ACCESS, I get 5 rows but in the code I only get 1 row. I tried to find a solution. I couldn't it. I have to get 5 rows. please give me some advice.
has answer: http://stackoverflow.com/a/23330501
tagged with: sql
has comment: http://stackoverflow.com/comment/35701159
has comment: http://stackoverflow.com/comment/35701279
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35701514
downvote count: 2
tagged with: spring
has title: a different result (JAVA, MS ACCESS, SPRING)
tagged with: spring-mvc
tagged with: java
has comment: http://stackoverflow.com/comment/35701618
type: Question
has comment: http://stackoverflow.com/comment/35701405
has comment: http://stackoverflow.com/comment/35701071
upvote count: 0
score: -2

http://stackoverflow.com/comment/35815708
score: 0
has text: Paper + pencil + effort = understanding
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23380334

http://stackoverflow.com/a/23349204
upvote count: 3
has body: The current (version 8.1) Tableau extract API seems to be designed solely for creating and appending to extracts, not for reading from them. Of course, you can read from them using Tableau. That works well for using extracts as a cache of an external data source. If you have another use case in mind, the API may not support it. (Would love to be proven wrong)
score: 3
has comment: http://stackoverflow.com/comment/80183688
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/36316197
accepted answer of: http://stackoverflow.com/q/23337073
has comment: http://stackoverflow.com/comment/80151903
type: Answer
answers question: http://stackoverflow.com/q/23337073

http://stackoverflow.com/comment/35793349
score: 0
type: Comment
has text: I agree. This is the 'traditional' solution, but it doesn't necessarily lend itself well to the concept of 'other', and also, if I need to know what type it is, to show on a screen or form or something, I will have to do some sort of instanceOf and translate that to something user-friendly.
comment on: http://stackoverflow.com/a/23368216
type: AnswerComment

http://stackoverflow.com/comment/91080024
comment on: http://stackoverflow.com/a/51447485
has text: Could you please guide for the "Emma" code coverage tool ?
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/23360122
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35778174
type: Question
has body: I need to connect and access a database with java (javaFX application). When I run the application, I have an error in the controller sun.jdbc.odbc.JdbcOdbcDriver. I searched a lot but I didnt find a good solution. I use jdk 1.8 and I use this class: public class conexionBD { private Connection conexion; private Statement sentencia; private String controlador; private String nombre_bd; private String usuarioBD; private String passwordBD; public conexionBD(){ this.controlador="sun.jdbc.odbc.JdbcOdbcDriver"; this.nombre_bd="C:\\Users\\SANDRA\\Documents\\Access_BD\\Contactos.mdb"; this.usuarioBD=""; this.passwordBD=""; } public void EstablecerConexion(){ try{ Class.forName (this.controlador); }catch (ClassNotFoundException e){ JOptionPane.showMessageDialog(null, "Error al cambiar el controlador"); e.printStackTrace(); } try{ String DSN="jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ="+this.nombre_bd; conexion=DriverManager.getConnection(DSN,this.usuarioBD,this.passwordBD); }catch (SQLException e){ JOptionPane.showMessageDialog(null,"Error al realizar la conexion "+e); } try { this.sentencia=this.conexion.createStatement( ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); } catch (Exception e) { JOptionPane.showMessageDialog(null,"Error al crear el objeto sentencia "+e); } } } The exception is in Class.forName (this.controlador); java.lang.ClassNotFoundException: sun.jdbc.odbc.JdbcOdbcDriver 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) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:259) at net.facturacion.controller.conexionBD.EstablecerConexion(con…
has comment: http://stackoverflow.com/comment/35778192
tagged with: java
has title: Connect to database using JDBC
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/23360455
linked to: http://stackoverflow.com/q/22984438
accepted answer: http://stackoverflow.com/a/23360455
tagged with: jdbc
duplicate of: http://stackoverflow.com/q/22984438

design-patterns
tags question: http://stackoverflow.com/q/23368864
tags question: http://stackoverflow.com/q/23372079
tags question: http://stackoverflow.com/q/23349144
tags question: http://stackoverflow.com/q/23390145
tags question: http://stackoverflow.com/q/23450686
tags question: http://stackoverflow.com/q/23408923
tags question: http://stackoverflow.com/q/23412992
tag name: design-patterns
tags question: http://stackoverflow.com/q/23391688
tags question: http://stackoverflow.com/q/23415221
tags question: http://stackoverflow.com/q/23312236
tags question: http://stackoverflow.com/q/23423159
type: Tag
tags question: http://stackoverflow.com/q/23293515
tags question: http://stackoverflow.com/q/23312748
tags question: http://stackoverflow.com/q/23341663
tags question: http://stackoverflow.com/q/23296843
tags question: http://stackoverflow.com/q/23306774
tags question: http://stackoverflow.com/q/23329149
tags question: http://stackoverflow.com/q/23362550
tags question: http://stackoverflow.com/q/23297314
tags question: http://stackoverflow.com/q/23295264
tags question: http://stackoverflow.com/q/23329657
tags question: http://stackoverflow.com/q/23438546

http://stackoverflow.com/comment/35832830
type: AnswerComment
has text: absolutly right. use `addAll()` instead of `add()` to add a list in another list.
type: Comment
score: 1
comment on: http://stackoverflow.com/a/23389679

http://stackoverflow.com/comment/35761721
score: 0
type: Comment
type: QuestionComment
has text: i had lines skipping, i solved this by doing scanner.nextLine() at the end of the while loop. Thanks
comment on: http://stackoverflow.com/q/23350426

http://stackoverflow.com/q/23343161
has comment: http://stackoverflow.com/comment/35752031
tagged with: swing
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/35746727
has title: Specific characters not rendering properly in Java
type: Question
accepted answer: http://stackoverflow.com/a/23346622
tagged with: encoding
has answer: http://stackoverflow.com/a/23346622
score: 0
has comment: http://stackoverflow.com/comment/35751168
answer count: 1
has body: I have an issue when displaying strings received from a server in a JTable. Some specific characters appear as little white squares instead of "é" or "à" etc. I tried a lot of things but none of them fixed my problem. I'm working with Eclipse under Windows. The server was developped using Visual Studio 2010. The server sends an XML file using tinyXML2, the client uses JDom to read it. The font used is "Dialog". The server takes the strings from an Oracle database. I assume this is an encoding problem, but I haven't been able to fix it yet. Does anyone have an idea ? Thx Arnaud EDIT : As requested, this is how I use JDom public static Player fromXML(Element e) { Player result = new Player(); String e_text = null; try { e_text = e.getChildText(XMLTags.XML_Player_playerId); if (e_text != null) result.setID(Integer.parseInt(e_text)); e_text = e.getChildText(XMLTags.XML_Player_lastName); if (e_text != null) result.setName(e_text); e_text = e.getChildText(XMLTags.XML_Player_point_scored); if (e_text != null) result.addSpecial(STAT_SCORED, Double.parseDouble(e_text)); e_text = e.getChildText(XMLTags.XML_Player_point_scored_last); if (e_text != null) result.addSpecial(STAT_SCORED_LAST, Double.parseDouble(e_text)); } catch (Exception ex) { ex.printStackTrace(); } return result; } public static Document load(String filename) { File XMLFile = new File(CLIENT_TO_SERVER, filename); SAXBuilder sxb = new SAXBuilder(); Document document = new Document(); try { document = sxb.build(new File(XMLFile.getPath())); } catch(Exception e){e.printStackTrace();} return document; }
tagged with: utf-8
tagged with: http://stackoverflow.com/tag/xml

http://stackoverflow.com/comment/35778082
type: QuestionComment
has text: Absolute copy of this [question](http://stackoverflow.com/questions/13699075/calling-a-java-method-with-no-name) and should be marked duplicate
type: Comment
comment on: http://stackoverflow.com/q/23359791
score: 1

http://stackoverflow.com/comment/35856247
score: 0
type: Comment
has text: That's has image data shell i send that file can u just tell me where to upload the file here i will upload please.
comment on: http://stackoverflow.com/a/23402081
type: AnswerComment

http://stackoverflow.com/q/23428114
type: Question
has comment: http://stackoverflow.com/comment/35931155
score: 0
has body: Does anyone know how to change the namespace name of SOAP response to match with the one I am getting from the SOAP request? For example if I am getting the following as SOAP request from the client side &lt;soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"&gt; &lt;soap:Header/&gt; &lt;soap:Body&gt; &lt;method:Login&gt; &lt;method:userName&gt;?&lt;/method:userName&gt; &lt;method:password&gt;?&lt;/method:password&gt; &lt;/method:Login&gt; &lt;/soap:Body&gt; &lt;/soap:Envelope&gt; SOAP response from the server should be like &lt;soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"&gt; &lt;soap:Body&gt; ResponseString &lt;/soap:Body&gt; &lt;/soap:Envelope&gt; But server is returning &lt;soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&gt; &lt;soapenv:Body&gt; Response String &lt;/soapenv:Body&gt; &lt;/soapenv:Envelope&gt; Is there any way I can change xmlns:soapenv to xmlns:soap dynamically in the SOAP response structure through Java class or through some other method?
tagged with: wsdl
has comment: http://stackoverflow.com/comment/35905864
has title: Changing base namespace mapping in SOAP envelope
has comment: http://stackoverflow.com/comment/35918952
type: UnansweredQuestion
tagged with: soap
tagged with: web-services
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/35920544
answer count: 0
tagged with: java

http://stackoverflow.com/comment/35726107
has text: Why wouldn't this work with negative edges as long as there are no cycles?
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/23330462
type: Comment

http://stackoverflow.com/q/23432349
has body: I have a Spring 4 MVC Servlet, which uses JPA and spring-orm to connect to the database. My applicationContext.xml file contains the following: &lt;util:map id="persistenceUnitConfiguration"&gt; &lt;entry key="javax.persistence.logging.level" value="INFO" /&gt; &lt;entry key="javax.persistence.jdbc.driver" value="com.mysql.jdbc.Driver" /&gt; &lt;entry key="javax.persistence.jdbc.url" value="jdbc:mysql://localhost/DATABASE" /&gt; &lt;entry key="javax.persistence.jdbc.user" value="USERNAME" /&gt; &lt;entry key="javax.persistence.jdbc.password" value="PASSWORD" /&gt; &lt;entry key="eclipselink.weaving" value="false" /&gt; &lt;/util:map&gt; &lt;bean class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean" id="entityManagerFactory"&gt; &lt;property name="persistenceUnitName" value="myPersistenceUnit" /&gt; &lt;property name="jpaVendorAdapter" ref="jpaAdapter" /&gt; &lt;property name="packagesToScan" value="my.package.entities" /&gt; &lt;property name="jpaPropertyMap" ref="persistenceUnitConfiguration" /&gt; &lt;/bean&gt; The application is packaged as a WAR. I want to somehow configure the DATABASE, USERNAME, and PASSWORD values, such that I can distribute the WAR and nobody has to touch it. Only thing to do would be to edit a configuration file somewhere. What is the best approach for doing so? Can I somehow set the jpaPropertyMap programmatically during boot of my webapp and read it from a configuration file at a fixed location?
type: Question
has answer: http://stackoverflow.com/a/23432440
has title: Spring 4 Servlet and a configuration file
answer count: 1
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/23432440
tagged with: spring
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1

http://stackoverflow.com/a/23318255
has body: You can iterate through the JSONArray and add to your drinks List like so: for (int i=0; i&lt;jsonArr.length(); i++) { JSONObject jsonDrink = jsonArr.getJSONObject(i); String alcohol = jsonDrink.getString("alcohol"); String date = jsonDrink.getString("date"); double units = jsonDrink.getDouble("units"); Drink drink = new Drink(); // initialize drink object values here or in constructor (don't know what this class has) drinks.add(drink); }
answers question: http://stackoverflow.com/q/23318213
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23318213
type: Answer

http://stackoverflow.com/a/23433560
answers question: http://stackoverflow.com/q/23424201
upvote count: 2
has body: Is there any way to update the Glassfish libs if there isn't a new version for glassfish-embedded-all. Yes, but there is also a new version which is the 4.0 final build of GlassFish. org.glassfish.main.extras glassfish-embedded-all 4.0 provided This version includes Hibernate Validator 5.0.0 which already depends on Validation API 1.1.0. If you need a newer version then Hibernate Validator 5.0.0 you have to extract the corresponding GlassFish module (in this case bean-validation.jar), change the pom.xml to depend on the desired version and rebuild it with mvn package. See also: Bean-Validation 1.1 in Glassfish 4.0 - CDI Injection not working as intended Trouble starting Hibernate Validator due to Bean Validation API How to upgrade the hibernate-validator 4.3.0.Final to the Glassfish 3.1.2?
type: Answer
score: 2
downvote count: 0

http://stackoverflow.com/comment/35713541
score: 0
type: Comment
has text: -1 A Java constructor is called with the already allocated and somewhat-initialized object as `this`. Likewise, a Python `__init__` function is called with the already allocated and somewhat-initialized object as `self`. @ManasChaturvedi You're right, it does.
comment on: http://stackoverflow.com/a/23324774
type: AnswerComment

http://stackoverflow.com/a/23420398
has comment: http://stackoverflow.com/comment/35891201
answers question: http://stackoverflow.com/q/23420322
type: Answer
accepted answer of: http://stackoverflow.com/q/23420322
has comment: http://stackoverflow.com/comment/35910499
upvote count: 1
score: 1
has body: Your problem is that you are not declaring what v means in the first code, whereas in the second code you are explicitly declaring it. v=new Node(e,head); Since you have not defined v previously, the JVM does not know what v is Node v=new Node(e,head); This tells the JVM that v is of type Node. The point of having constructors is that you set all variables in one go rather than using multiple setter methods. You can always use individual setter methods provided they are public The way you have desinged your code, you will always have to call getElement() to print the value.
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/23301219
accepted answer of: http://stackoverflow.com/q/23300235
has body: Here you are: package test; import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.io.IOException; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; public class Multithreader { /** * Needs to be volatile because the two thread communicate through it. * It is also very important that boolean updates and lookups are atomic, * we cannot do the same with for example a long! */ volatile static boolean shouldFilePrinterPrint = false; public static void main(String[] args) throws IOException { // needs to be final so that the filePrinter can see it final BufferedReader br = new BufferedReader(new FileReader(new File("file.txt"))); // this is the task of printing 5 lines from a file whenever shouldFilePrinterPrint is true Runnable filePrinter = new Runnable() { @Override public void run() { while(true){ if(shouldFilePrinterPrint){ shouldFilePrinterPrint=false; String line; int counter = 0; try { while (counter&lt;5 &amp;&amp; (line = br.readLine()) != null) { counter++; System.out.println(line); } } catch (IOException e) { e.printStackTrace(); } } } } }; // this is the task that will set shouldFilePrinterPrint to true every time we push enter Runnable inputAwaiter = new Runnable(){ @Override public void run() { while(true){ try { System.in.read(); shouldFilePrinterPrint=true; } catch (IOException e) { e.printStackTrace(); } } } }; // we use the executor service to launch the two tasks in two threads ExecutorService executorService = Executors.newFixedThreadPool(2); executorService.execute(filePrinter); executorService.execute(inputAwaiter); // I am omitting cleanup such as closing the reader, shutting down the executor service, etc. // and am just leaving the program to never terminate until manually stopped, // but such cleanup is very important in a real program! } } I think this implements the behavior you described. I ran it, it works. Note that there is no mention of "Thread" or "synchronised" in th…
answers question: http://stackoverflow.com/q/23300235
type: AcceptedAnswer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/35684844
has comment: http://stackoverflow.com/comment/35684791
type: Answer
upvote count: 1

http://stackoverflow.com/comment/35888023
comment on: http://stackoverflow.com/q/23412408
score: 0
type: Comment
type: QuestionComment
has text: I added code to show a more complete example. The reason we are saving is because of the id issue. We know that when we save we can then run a repo call to get the latest which will have the id in it, but we'd rather not have to do that.

http://stackoverflow.com/comment/35842245
score: 0
has text: yep, in this post if you can see I'm using OneToOne at Curriculum2 ...my problem is I don't know how I do set entity Curriculum in Curriculum2 using JPAContainer...I'm trying this, but still doesn't work: binder.getItemDataSource().getBean().setCurriculum(curriculum);
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23394035

http://stackoverflow.com/a/23312191
has comment: http://stackoverflow.com/comment/35690801
has comment: http://stackoverflow.com/comment/35690538
has body: Find out your ip address (with the ipconfig command on Windows), and replace localhost by that value. Also, be sure that your android device is connected to the same network that your PC.
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35691456
accepted answer of: http://stackoverflow.com/q/23312183
has comment: http://stackoverflow.com/comment/35690751
has comment: http://stackoverflow.com/comment/35690666
score: 0
has comment: http://stackoverflow.com/comment/35690472
answers question: http://stackoverflow.com/q/23312183
has comment: http://stackoverflow.com/comment/55137548
has comment: http://stackoverflow.com/comment/35690627
type: Answer

http://stackoverflow.com/a/23322441
answers question: http://stackoverflow.com/q/23322193
has body: If you need explicit default constructor, and implicit default constructor is not available. There're subclasses of that class. Calling non-default constructor of the superclass.
score: 0
type: Answer

http://stackoverflow.com/a/23311457
has body: Because you change the text only in the onCreate method. Instead you would have to react on a change of the ToggleButton using the setOnClickListener method.
type: Answer
answers question: http://stackoverflow.com/q/23311417
score: 0

http://stackoverflow.com/comment/38465714
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/23303206
has text: People! The problem is not about getting a `null` connection but about a `null` return value from executing `Connection#getSchema` method.
type: Comment

http://stackoverflow.com/q/23329717
tagged with: android
has comment: http://stackoverflow.com/comment/53449404
has body: I'm trying to make an android game with libgdx, and am having problems with detecting if a button is being held down. I want to be able to detect when a button is being held down because i want to move my character when the button is down and stop him when it is up. I really just want the button to work like an arrow key on the keyboard. This is what i'm currently using: buttonRight.addListener(new ClickListener() { @Override public void clicked(InputEvent event, float x, float y) { levels.get(index - 1).getBlackPoint().moveRight(); } }); i've tried other ways like using a change listener, but couldn't get it to work. I want to have four buttons on my gamescreen, left, right, up, down. Each button will move the character while the user is holding the button down. Once the button is released the character will stop moving until another one of the four buttons is held down.
linked to: http://stackoverflow.com/q/13409271
score: 1
tagged with: java
type: Question
has title: how to detect when a libgdx button is held down
tagged with: libgdx
has comment: http://stackoverflow.com/comment/35724608
has comment: http://stackoverflow.com/comment/35724901
has comment: http://stackoverflow.com/comment/35725433
linked to: http://stackoverflow.com/q/2615616
upvote count: 2
has comment: http://stackoverflow.com/comment/35726219
has comment: http://stackoverflow.com/comment/35723219
tagged with: button
downvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/35724149
answer count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/35938942
has text: You cannot create an array of generics directly, you must create and array of a type that your generic is derived from and cast it as an array of generics. But I thank you for trying.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23445845

http://stackoverflow.com/comment/35938097
has text: Which is to say, you should use `double` instead of `int`.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23446065
score: 0

http://stackoverflow.com/q/23348663
has comment: http://stackoverflow.com/comment/35762307
upvote count: 6
tagged with: android-studio
tagged with: java
downvote count: 1
type: Question
has title: Restart Gradle without restarting Android Studio
has body: Restarting Gradle when android studio shows that I have errors fixes them sometimes. Is it possible to restart Gradle without restarting android studio as it takes a while for it to load on my machine.
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/42254386
type: UnansweredQuestion
score: 5
tagged with: android

http://stackoverflow.com/comment/35783744
type: AnswerComment
has text: Meaning that your complete html is converted to blob and stored in db, am I understand it correctly?
comment on: http://stackoverflow.com/a/23362909
type: Comment
score: 0

http://stackoverflow.com/q/23434240
answer count: 1
tagged with: multidimensional-array
has answer: http://stackoverflow.com/a/23434501
type: AnsweredQuestion
tagged with: java
tagged with: coordinates
type: Question
has title: Have object get its coordinates in an array
tagged with: point
tagged with: arrays
has body: I have a 2D array of objects that will be changing creating new instances of different objects. Is it possible to have one of my objects get its coordinates with a constructor and put them into an ArrayList of Points? The idea is for these types of objects to be able to "see" each other or know the positions of the others. public static void main(String[] args){ Object [][] objArray = new Object[10][10]; for (int i=0;i&lt;10;i++){ for (int j=0;j&lt;10;j++){ objArray[i][j]= new Class1(); } } } public class Class1{ ArrayList&lt;Point&gt; coordArray = new ArrayList&lt;Point&gt;(); Class1(){ int x = 0, y = 0; //x = objArray. get cord x? //y = objArray. get cord y? coordArray.add(new Point(x,y)); } }
accepted answer: http://stackoverflow.com/a/23434501
score: 0

sharepoint-2010
tags question: http://stackoverflow.com/q/23299395
type: Tag
tag name: sharepoint-2010

http://stackoverflow.com/tag/csv
type: Tag
tag name: csv
tags question: http://stackoverflow.com/q/23374518
tags question: http://stackoverflow.com/q/23311802
tags question: http://stackoverflow.com/q/23363111
tags question: http://stackoverflow.com/q/23339407
tags question: http://stackoverflow.com/q/23378992
tags question: http://stackoverflow.com/q/23364843
tags question: http://stackoverflow.com/q/23294975
tags question: http://stackoverflow.com/q/23328719
tags question: http://stackoverflow.com/q/23346840
tags question: http://stackoverflow.com/q/23376385
tags question: http://stackoverflow.com/q/23377325
tags question: http://stackoverflow.com/q/23377204
tags question: http://stackoverflow.com/q/23411538

http://stackoverflow.com/comment/35911170
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/23431603
has text: The part between `<>` has to be a type name, it can't be a variable or an expression that resolves to a reference.
type: Comment

http://stackoverflow.com/a/23375086
type: AcceptedAnswer
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/35806440
accepted answer of: http://stackoverflow.com/q/23375020
answers question: http://stackoverflow.com/q/23375020
downvote count: 0
has comment: http://stackoverflow.com/comment/35806390
score: 2
has body: The problem is that you're setting an int as it was a String to a TextView. The .setText() method expects a String to be passed, since you're putting an int, it crashes. Try doing the following: scoreImage.setText(String.valueOf(score));

http://stackoverflow.com/a/23296224
score: 0
accepted answer of: http://stackoverflow.com/q/23296081
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35664223
type: Answer
has comment: http://stackoverflow.com/comment/35664083
answers question: http://stackoverflow.com/q/23296081
has body: Assuming that p_u, p_pw and p_sn are String object references the code below is checking whether those two objects are the same object (or whether their refences to the object's position in memory are the same) rather than whether the String objects share the same character sequence. if (p_u == obj.getUsername()&amp;&amp; p_pw == obj.getPassword ()&amp;&amp; p_sn== obj.getStudentID()) Instead, to check whether their character sequence matches up you should use the .equals() method. Example below; if (p_u.equals(obj.getUsername())&amp;&amp; p_pw.equals(obj.getPassword ())&amp;&amp; p_sn.equals(obj.getStudentID())) I hope this helps.
has comment: http://stackoverflow.com/comment/35664043

http://stackoverflow.com/comment/35875226
type: AnswerComment
has text: No Not at all they will navigate you for the source from where the Exception occured please go for line number 59 and 102 which is generating exception and solve the problem.I guide you for your question you asked ...If you want to know why this exception is being generated you can ask another question. :0
type: Comment
comment on: http://stackoverflow.com/a/23412077
score: 0

http://stackoverflow.com/q/23403442
has comment: http://stackoverflow.com/comment/35858323
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35858239
has answer: http://stackoverflow.com/a/67994769
tagged with: selenium-webdriver
tagged with: java
has answer: http://stackoverflow.com/a/23407410
tagged with: selenium
has body: Need your help in Selenium Webdriver coding with Java. I have a scenario, where I create a Course name and submit it to the database and then later I need to search for the Course by the name I created it. Simply the work flow would be; 1. Type the course name in text box (Here I'm randomly generating a string so it's not hard coded, I need to retrieve exactly what I typed here) 2. Store the typed name 3. In the search box type that name private void createCurriculum() throws InterruptedException { selenium.open("http://url.com"); driver.findElement(By.id("Text1")).clear(); driver.findElement(By.id("Text1")).sendKeys("My Curriculum" + genData.generateRandomAlphaNumeric(10)); // Here I'm randomly generating the name, I need to retrieve what I type here in the next method //String curName = driver.findElement(By.id("Text1")).getAttribute("value"); //I tried this but it didn't work Thread.sleep(300); } private void searchCurriculum(String curName) throws InterruptedException { selenium.open("http://url.com"); driver.findElement(By.xpath("//div/input")).sendKeys("curName"); // Here I want to retireve what I previously generated. It's not working // . . . Additionally in the main method, I have declared the variable too. public class TestCaseCreateCurriculum { private Selenium selenium; private WebDriver driver; GenerateData genData; public String curName; // . . . Could anybody help me to correct this code? This perfectly worked after modifying (thanks to Vageesh Bhasin) driver.findElement(By.id("Text1")).sendKeys(curName = "My Curriculum" + genData.generateRandomAlphaNumeric(10)); and driver.findElement(By.xpath("//div/input")).sendKeys(curName);
type: Question
has comment: http://stackoverflow.com/comment/35858537
has title: How to store a text field value and retrieve it later - Selenium Web Driver Using Java
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/35858397

http://stackoverflow.com/comment/35883780
type: Comment
comment on: http://stackoverflow.com/a/23414251
score: 0
type: AnswerComment
has text: Thanks. That was useful. So, the relationship I have at hand, in UML would be (Book)<>----<>(Author), and (Publisher)<>-----(Book) ?

http://stackoverflow.com/comment/35681000
type: Comment
comment on: http://stackoverflow.com/q/23306722
score: 0
has text: pardon for english. Ilet me explain you again..i send one request to web in c++. web module has to response which is in java. how java response to request which come from vc++
type: QuestionComment

http://stackoverflow.com/comment/35723296
has text: see this http://andreinc.net/2013/12/09/java-7-nio-2-how-to-use-seekablebytechannel-interface-for-random-access-to-files-raf/
type: Comment
comment on: http://stackoverflow.com/q/23329923
type: QuestionComment
score: 0

http://stackoverflow.com/a/23354106
has body: If im correct what you are trying to do is to open another activity from LibGDX. Ive done that before by doing what you just described. I created an interface that does different things on each project. Now, let me explain the not so elegant solution that I found a while back in a hurry. In your android interface class you need to have a reference to your main class. Also, you would need a function to switch to your other activity by talking to your MainActivity. public class AndroidInterface implements MyInterface{ private MainActivity _mainActivity; ... public AndroidInterface (MainActivity activity){ _mainActivity = activity; } ... public void switchActivity(int activityID) { _mainActivity.startMyActivity(activityID); } } Pretty simple, isnt it? Now, lets go to your MainActivity class. You would initialize and do the other stuff you would put on the onCreate method, but dont forget to create an AndroidInterface with your MainActivity as a parameter. So, lets say your other activity is called TestActivity and it will be called if your activityID is 10. public class MainActivity extends AndroidApplication{ ... public MainActivity (){ ... } ... public void onCreate(Bundle savedInstanceState) { ... AndroidInterface androidFunctions = new AndroidInterface((MainActivity)this); ... } ... public void startMyActivity(int activityID) { switch(activityID){ case 10: Intent i = new Intent(getApplicationContext(), TestActivity.class); startActivity(i); break; } } } So in the end it would end up looking more or less like that. You would call your AndroidInterface and it would start another activity by calling your Main Activity and getting its context there. So you can see I do all that work because I need the applicationContext of the Main Activity in order to start another Activity. There must be a more elegant and correct way to do it. Im pretty sure that keeping a reference to the MainActivity in the AndroidInterface isnt a good idea, but this got me out of trouble fast if …
downvote count: 0
score: 1
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/23353064

http://stackoverflow.com/a/23355778
type: Answer
score: 0
has body: new Dialog(Main.this); The above line creates a new dialog object and associates it with the context of your Activity. SO you have to pass the context of your activity in the paranthesis.. Eg: If you are calling the dialog from Activity "ActivityMain".. then use: new Dialog(ActivityMain.this);
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23355740
answers question: http://stackoverflow.com/q/23355740

http://stackoverflow.com/comment/35856355
score: 0
type: Comment
type: QuestionComment
has text: char can take upto 255
comment on: http://stackoverflow.com/q/23402289

http://stackoverflow.com/comment/35712579
has text: I used the synchronized word in the getInstance() as it shows in this blog: http://touchlabblog.tumblr.com/post/24474750219/single-sqlite-connection and then I deleted all the db.close(). It seems that is working fine. I was also reading here http://stackoverflow.com/questions/6608498/best-place-to-close-database-connection that is not really necessary to close it. Anyway the documentation is not clear.
score: 3
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23293930

http://stackoverflow.com/comment/35911721
has text: Thank you about the recomendation. I Already changed my code for the library! About the problem, I tried using the elastic-projectxserver.rhcloud.com:80 but gave me another erro:org.elasticsearch.client.transport.NoNodeAvailableException: No node available I'm guessing the link is wrong or the port is wrong. I tried also to use the 9300 port but the same happen!
comment on: http://stackoverflow.com/a/23393278
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/23292973
has comment: http://stackoverflow.com/comment/35655295
answers question: http://stackoverflow.com/q/23292671
has comment: http://stackoverflow.com/comment/35655548
type: Answer
upvote count: 1
score: 1
downvote count: 0
has body: DBCollections objects have method find which takes mainly a DBObject argument. For instance, if you want to find users with age > 50 this can help you. query = new BasicDBObject("age", new BasicDBObject("$gt", 50)); cursor = incollection.find(query); while(cursor.hasNext()){ System.out.println(cursor.next()); } BasicDBObject take first argument, that is a field, and second argument that is another BasicDBObject or a value. With composition of these objects you can build any query. I recommend you take a look at MongoDB Documentation, it's pretty good. Mongo Java Driver http://docs.mongodb.org/ecosystem/drivers/java/ See Javadoc. http://api.mongodb.org/java/current/

http://stackoverflow.com/comment/35676962
comment on: http://stackoverflow.com/a/23304171
has text: I was referring to a class that is probable to leave the libraries which is somewhere in sun `.Unsafe` and deals with alot of memory manipulation. And is what I need indeed unsafe? its just getting some names; what harm is that?
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/23327336
has title: Intercept private methods with Spring and AspectJ
answer count: 1
has body: I am trying to execute code before a private method using AspectJ's load-time-weaving with Spring-Boot and annotation-based configuration and I'm pulling my hair out trying to figure out why my aspect is not being invoked. My simple aspect is as follows: @Aspect public class LoggingAspect { private static Logger log = LoggerFactory.getLogger(LoggingAspect.class); @Before("execution(private * com.mycompany.MyServiceWithPrivateMethods.*(..))") public void privateAspect() { log.warn("#### Private method aspect invoked!"); } } I also have the @EnableLoadTimeWeaving annotation on my Spring configuration class and the following in my META-INF/aop.xml: &lt;aspectj&gt; &lt;weaver options="-verbose"&gt; &lt;!-- only weave classes in our application-specific packages --&gt; &lt;include within="com.mycompany.*"/&gt; &lt;/weaver&gt; &lt;aspects&gt; &lt;!-- weave in just this aspect --&gt; &lt;aspect name="com.mycompany.LoggingAspect"/&gt; &lt;/aspects&gt; &lt;/aspectj&gt; Lastly, I am also starting my application with the -javaagent:/path/to/spring-instrument.jar option, per the docs. I also have the required jars on my classpath (spring-aop and aspectjweaver) as also mentioned in the Spring docs. Is this even possible? There is a 'limitation' listed in the AspectJ docs that states Privileged aspects are not supported by the annotation style. located here, however this older post in the Spring Forum seems to indicate that it is indeed possible.
favorite count: 0
tagged with: spring
type: AnsweredQuestion
score: 2
downvote count: 0
has answer: http://stackoverflow.com/a/23328792
tagged with: java
accepted answer: http://stackoverflow.com/a/23328792
type: Question
tagged with: spring-boot
tagged with: aop
upvote count: 2
tagged with: aspectj

http://stackoverflow.com/comment/122306457
has text: This doesn't work for non-english alphabets.
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23390700

http://stackoverflow.com/comment/35946587
has text: `.readline()` blocks until input is received.
score: 1
comment on: http://stackoverflow.com/q/23450400
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36081400
type: Comment
score: 0
comment on: http://stackoverflow.com/q/23403318
has text: If you care about latency, get off Java 6 immediately. Java 8 is at least 40-50% faster.
type: QuestionComment

http://stackoverflow.com/comment/35813783
type: Comment
type: QuestionComment
has text: @StuartMarks I'm sure that's generally the case, but there's no guarantee. At a minimum, it appears the version of `HashMap` on my machine declares its table as `Entry<K,V>[]`, while the linked class on GrepCode is simply `Entry[]`. I know I've been burned before by confusing OpenJDK and Oracle/Sun JDK, despite how similar they are in theory.
comment on: http://stackoverflow.com/q/23378927
score: 0

http://stackoverflow.com/q/23428743
answer count: 1
tagged with: generics
tagged with: extends
has title: java in method signature generics extends from this
has comment: http://stackoverflow.com/comment/35905715
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23428917
has body: This does not work because of this.class it must be Tower, but I want that all classes that extends from Tower are assignable from the current Tower like ArrowTower or something else. public Tower upgrade(Class&lt;? extends this.class&gt; c) { try { return c.getConstructor().newInstance(); } catch (Exception e) { e.printStackTrace(); } return null; } I can check it so, but I want that the complier says you thats the wrong extends hierarchy or something else if (!this.getClass().isAssignableFrom(c)) { return null; } I want it so because there are an ArrowTower and a FireArrowTower that are extends from ArrowTower and there are a CannonTower and a FireCannonTower that are extends from CannonTower. But if want to upgrade an ArrowTower its possible to upgrade it to an CannonTower, but this should not be allowed. See: Tower t1 = new ArrowTower(); t1 = t1.upgrade(FireArrowTower.class); Tower t2 = new CannonTower(); t2 = t2.upgrade(Tower.class); // Here it musst be an Error Sorry for my bad english I'm from Germany :D
has comment: http://stackoverflow.com/comment/35905820
has comment: http://stackoverflow.com/comment/35905813
tagged with: java
has comment: http://stackoverflow.com/comment/35905881
has comment: http://stackoverflow.com/comment/35905577
type: Question
has comment: http://stackoverflow.com/comment/35905505
score: 0
has comment: http://stackoverflow.com/comment/35905630

http://stackoverflow.com/comment/35671521
type: Comment
has text: @Mentoos - I recommend changing the `if` statements to use the boolean value directly (`if (trainReadyField) { ... }`, etc.) It means **exactly** the same thing as `if (trainReadyField == true) { ... }`. The important thing is to avoid accidentally assigning `true` when all you want to do is test the value. If it only prints false now, then you have a logic error somewhere in your code. Just track down what's happening and you should be able to find it.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23299518

http://stackoverflow.com/q/23441095
answer count: 2
tagged with: jersey
tagged with: jersey-2.0
downvote count: 0
score: 4
favorite count: 0
has body: I have an @GET method that is annotated with a @Produces( MediaType.APPLICATION_JSON ). I'd like to see that call fail when I disable the JSON processing in Jersey, but no matter what I do it continues to generate a JSON output when I access that URL method in the browser. When I place a breakpoint inside com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider's constructor I see it is being registered when MessageBodyFactory is instantiated. In particular, under the line: final Set<MessageBodyReader> mbrs = Providers.getProviders(locator, MessageBodyReader.class); The JacksonJsonProvider is discovered even though I disabled all auto-discoveries. As a result I cannot register my own which provides a custom ObjectMapper. The default one is always used instead. The method looks like this: @GET @Produces( MediaType.APPLICATION_JSON ) public Status getStatus() { return new Status("test"); } In my application, I make what I believe to be the proper (even an overkill) configurations: public class CustomResourceConfig extends ResourceConfig { public CustomResourceConfig() { property(CommonProperties.METAINF_SERVICES_LOOKUP_DISABLE, true); property(CommonProperties.FEATURE_AUTO_DISCOVERY_DISABLE, true); property(CommonProperties.JSON_PROCESSING_FEATURE_DISABLE, true); property(CommonProperties.MOXY_JSON_FEATURE_DISABLE, true); property(ServerProperties.METAINF_SERVICES_LOOKUP_DISABLE, true); property(ServerProperties.FEATURE_AUTO_DISCOVERY_DISABLE, true); property(ServerProperties.MOXY_JSON_FEATURE_DISABLE, true); property(ServerProperties.JSON_PROCESSING_FEATURE_DISABLE, true); property(ClientProperties.FEATURE_AUTO_DISCOVERY_DISABLE, true); property(ClientProperties.METAINF_SERVICES_LOOKUP_DISABLE, true); property(ClientProperties.JSON_PROCESSING_FEATURE_DISABLE, true); packages("test.package.api"); } } I have placed the following configs in the web.xml: jersey-servlet org.glassfish.jersey.servlet.ServletContainer jersey.config.server.tracing ALL jersey.config.disableMetainf…
possible better answer: http://stackoverflow.com/a/29688961
accepted answer: http://stackoverflow.com/a/23448137
has answer: http://stackoverflow.com/a/29688961
type: AnsweredQuestion
has title: How to disable Jersey's JacksonJsonProvider auto registration so I use my own?
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question
upvote count: 4
has answer: http://stackoverflow.com/a/23448137

lombok
type: Tag
tag name: lombok
tags question: http://stackoverflow.com/q/23423774

http://stackoverflow.com/comment/35859751
type: QuestionComment
has text: have them all on my desktop and no dice...
comment on: http://stackoverflow.com/q/23403783
score: 0
type: Comment

http://stackoverflow.com/q/23343611
has answer: http://stackoverflow.com/a/23343914
upvote count: 1
downvote count: 1
possible better answer: http://stackoverflow.com/a/23343744
has answer: http://stackoverflow.com/a/23343744
has comment: http://stackoverflow.com/comment/35748978
has comment: http://stackoverflow.com/comment/35748372
accepted answer: http://stackoverflow.com/a/23343914
type: AnsweredQuestion
favorite count: 0
tagged with: terminal
type: Question
has title: How can I run Java code contained in a .txt file?
answer count: 2
has body: How do you run code in a .txt file? I know you're supposed to use a terminal, but it keeps giving this message: javac: file not found: hii.java Usage: javac &lt;options&gt; &lt;source files&gt; use -help for a list of possible options I saved my .txt file on the desktop.
score: 0
tagged with: java

http://stackoverflow.com/comment/35666392
type: AnswerComment
has text: (And my point about the first sentence still stands, too - the key to this question IMO is that if there isn't a file in the normal file system sense, `FileReader` simply isn't going to work.)
comment on: http://stackoverflow.com/a/23298740
type: Comment
score: 0

http://stackoverflow.com/comment/35792039
has text: *But it allows you to have mismatched enums with the classes.* -- Could you elaborate on this please?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23367491

http://stackoverflow.com/comment/37034579
comment on: http://stackoverflow.com/a/23381937
has text: FYI you could use JavaFX instead of an older applet (such as a Swing applet) but not as many users may have the capability to run JavaFX installed in their browsers.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/35830033
type: Comment
comment on: http://stackoverflow.com/q/23387915
score: 0
has text: @Octopus I have already written that code , in my program, i need any other way ie . not by programming logic.I need any predefined techniq that seperates header and content
type: QuestionComment

http://stackoverflow.com/a/23342686
answers question: http://stackoverflow.com/q/23342613
has comment: http://stackoverflow.com/comment/35745760
downvote count: 0
has body: You need to cast your Shape in a Circle: Circle circle = (Circle) shapeArray.getShape(1); System.out.println(circle.getRadius()); Of course, this sort of invalidate the whole meaning of having a parent class.
has comment: http://stackoverflow.com/comment/35745987
score: 4
type: Answer
upvote count: 4

http://stackoverflow.com/comment/35895853
type: AnswerComment
has text: @Luiggi: that the `org.apache.tomcat.util.http.fileupload.*` imports successfully compile suggests that OP is actually using Servlet 3.0, albeit in a completely wrong way. His actual problem is that he was reading Servlet<=2.5 targeted resources about Commons FileUpload and got completely confused because exactly those classes are under the covers also used by Tomcat 7 to fulfill the new Servlet 3.0 feature. The right answer/solution would be to just put `@MultipartConfig` annotation on the servlet class and tell him to not read outdated resources anymore as they are only confusing.
type: Comment
comment on: http://stackoverflow.com/a/23391700
score: 1

http://stackoverflow.com/comment/35741062
type: QuestionComment
has text: +1, now your question is well-asked. Voting to repoen.
score: 1
comment on: http://stackoverflow.com/q/23339539
type: Comment

http://stackoverflow.com/comment/35668382
type: AnswerComment
comment on: http://stackoverflow.com/a/23294943
type: Comment
has text: Excellent point man i just saw that. thanks a lot. saw you edited the answer so i leave it as it is.
score: 0

http://stackoverflow.com/comment/35721867
has text: @HarryKitchener: get your addActionListener out of the if blocks. Those listeners must be added regardless of the state of any boolean. You need to write your program logic out on paper before committing it to code, to force yourself to think of what steps your code should be doing. Do this and your code will make more sense. Don't just type in code without planning first, trust me.
comment on: http://stackoverflow.com/a/23329055
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/23435599
tagged with: java
answer count: 2
has answer: http://stackoverflow.com/a/23435706
downvote count: 0
tagged with: jar
favorite count: 0
has body: at first I have to say, I already looked in the internet / stackoverflow, but the solutions didnt work for me, because I'm new to Java and dont understand too complex code. I want to delete an Entry (Folder) inside a *.jar File. Is there a simple way to handle this, like: ZipEntry entry = new ZipEntry("path\\File.jar\\Folder"); entry.delete(); If its not possible to delete a ZipEntry, how can I rename a Folder inside a *.jar File? Best regards
type: UnansweredQuestion
score: 2
tagged with: http://stackoverflow.com/tag/zip
has title: Java delete ZipEntry
upvote count: 2
has answer: http://stackoverflow.com/a/36129950
type: Question

http://stackoverflow.com/comment/35805209
comment on: http://stackoverflow.com/a/23372474
score: 0
type: AnswerComment
has text: how can I get customer information from his name any idea
type: Comment

http://stackoverflow.com/comment/39797748
type: Comment
has text: I put up a bounty on another hibernate question. Are you willing to help me with it? here is the link: http://stackoverflow.com/questions/25454703/constraint-violation-when-persisting-one-to-many-relation
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23423905

http://stackoverflow.com/comment/35680833
type: AnswerComment
comment on: http://stackoverflow.com/a/23306612
score: 0
type: Comment
has text: While on my slower machine i got around 200 ms on this, that wasn't the part i don't understand. I think there is some optimization fix for Java 6 (something similar i guess is in android implementation). Probably making temporary copy of array is needed ("Copy required part of byte[] to temporary array before calling this constructor") but i can't get this to perform much better than original one line solution.

http://stackoverflow.com/comment/35779205
type: AnswerComment
type: Comment
has text: @user432 OP asked for a way without filling the array at runtime, there's nothing specifically against arrays and lists
comment on: http://stackoverflow.com/a/23360716
score: 0

http://stackoverflow.com/q/23356398
type: Question
tagged with: neo4j
tagged with: spring-data-neo4j
score: 0
has answer: http://stackoverflow.com/a/23371162
tagged with: spring-data
answer count: 1
has body: I imported the cineast maven project to eclipse, but I face a configuration problem... cvc-complex-type.4: Attribute 'base-package' must appear on element 'neo4j:config' Below are the configuration files which have this error. ApplicationContext.xml <?xml version="1.0" encoding="UTF-8" standalone="no"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:neo4j="http://www.springframework.org/schema/data/neo4j" xmlns:tx="http://www.springframework.org/schema/tx" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/data/neo4j http://www.springframework.org/schema/data/neo4j/spring-neo4j.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd"> <context:annotation-config/> <context:component-scan base-package="org.neo4j.cineasts"> <context:exclude-filter type="annotation" expression="org.springframework.stereotype.Controller"/> </context:component-scan> <context:spring-configured/> <neo4j:config storeDirectory="target/data/graph.db"/> <neo4j:repositories base-package="org.neo4j.cineasts.repository"/> <!--neo4j:config graphDatabaseService="graphDatabaseService"/> <constructor-arg value="http://localhost:7474"/> </bean--> <constructor-arg value="926d2a79e82920b62f03b1cb57e532e6"/> <constructor-arg value="data/json"/> <tx:annotation-driven mode="proxy"/> </beans> movie-test-context.xml <?xml version="1.0" encoding="UTF-8" standalone="no"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:neo4j="http://www.springframework.org/schema/data/neo4j" xmlns:tx="ht…
tagged with: java
type: UnansweredQuestion
has title: Errors of the Cineasts examples of Spring data neo4j

http://stackoverflow.com/comment/35827904
comment on: http://stackoverflow.com/a/23386382
type: AnswerComment
score: 0
type: Comment
has text: Okay, but, i just had to changed to this : float distance = CGPoint.ccpDistance(CGPoint.ccp(actualX, initial), CGPoint.ccp(actualX, fin))/(speed*60); (since i'm using it at 60fps)

http://stackoverflow.com/a/23292472
accepted answer of: http://stackoverflow.com/q/23291338
downvote count: 0
answers question: http://stackoverflow.com/q/23291338
score: 1
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35657085
has body: I suggest taking the source code from Arrays.sort(float[]), copy it in a new method in your project, then modify it in the relevant place to reverse (negate) the comparison result. It should return exactly what you wanted - a reverse-sorted array, using exactly the same algorithm.
type: Answer

http://stackoverflow.com/a/35553915
has body: Can you try fixing one of your nodes? states: 0: name: SPAWNINGSTATE duration: 4 the "-" makes it an array it may be throwing it off.
type: Answer
answers question: http://stackoverflow.com/q/23299444
score: 0

http://stackoverflow.com/q/23449783
linked to: http://stackoverflow.com/q/7938825
has title: Java JLayeredPane doesn't show it's elements
type: AnsweredQuestion
downvote count: 0
tagged with: swing
has answer: http://stackoverflow.com/a/23449922
type: Question
accepted answer: http://stackoverflow.com/a/23449922
tagged with: jlayeredpane
score: 1
tagged with: java
upvote count: 1
answer count: 1
favorite count: 0
has body: I am trying to use JLayeredPane to overlay one JPanel on top of another. For some reason the added panels don't show up. This is the code that creates the JLayeredPane and adds elements to it: import java.awt.BorderLayout; import java.awt.Dimension; import javax.swing.BorderFactory; import javax.swing.JFrame; import javax.swing.JLayeredPane; import javax.swing.SwingUtilities; public class CarAnimator extends JFrame { public CarAnimator() { JLayeredPane racingOverlay = new JLayeredPane(); CarAnimatorJPanel animation = new CarAnimatorJPanel(); Racetrack racetrack = new Racetrack(); racingOverlay.add(racetrack,JLayeredPane.DEFAULT_LAYER); racingOverlay.add(animation,new Integer(2)); racingOverlay.setBorder(BorderFactory.createTitledBorder("Can't see a thing")); this.getContentPane().add(racingOverlay,BorderLayout.CENTER); this.setLocationByPlatform(true); this.setPreferredSize(new Dimension(850,650)); this.setMaximumSize(new Dimension(850,650)); this.setMinimumSize(new Dimension(850,650)); this.setResizable(false);//prevents user from resizing the window this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.pack(); } public static void main(String[] args) { SwingUtilities.invokeLater(() -&gt; { (new CarAnimator()).setVisible(true); }); } } This is the code for the racing track JPanel: import java.awt.Color; import java.awt.Graphics; import javax.swing.JPanel; public class Racetrack extends JPanel { Graphics g = this.getGraphics(); @Override public void paintComponent(Graphics g) { Color c1 = Color.green; g.setColor( c1 ); g.fillRect( 150, 200, 550, 300 ); //grass Color c2 = Color.black; g.setColor( c2 ); g.drawRect(50, 100, 750, 500); // outer edge g.drawRect(150, 200, 550, 300); // inner edge Color c3 = Color.yellow; g.setColor( c3 ); g.drawRect( 100, 150, 650, 400 ); // mid-lane marker Color c4 = Color.white; g.setColor( c4 ); g.drawLine( 425, 500, 425, 600 ); // start line } } And this is the JPanel animation example, taken from Java: How to Program book (http:/…

http://stackoverflow.com/q/23344615
has body: Is there a way to from an external java program get information which is normally available in Lotus Designer? I am able to get Form Names, Field Names and Field Types and do similarly for Views using Notes.jar but I am unable to pull other information such as Combobox Choices or data about Pages, Code, Navigators etc. Does anybody know if there is an existing utility (besides obviously designer) which is capable of pulling this information, or whether there is a jar file besides Notes.jar which is capable of pulling this information.
has answer: http://stackoverflow.com/a/23547861
type: UnansweredQuestion
tagged with: lotus-notes
has comment: http://stackoverflow.com/comment/35752299
score: 1
tagged with: java
upvote count: 1
type: Question
tagged with: lotus-designer
has comment: http://stackoverflow.com/comment/35761195
answer count: 1
downvote count: 0
tagged with: lotus
has comment: http://stackoverflow.com/comment/35760814
has title: Retrieve Lotus Designer information from java
favorite count: 0

http://stackoverflow.com/a/29691301
type: Answer
has body: I am currently facing the same problem. Maybe it can be solved by providing jvm.h and jvm_md.h for your setup. Both contain-jvm-specific symbols and jvm_md.h contains additionally platform-dependent symbols. So you will need to choose jvm.h for your target jvm and jvm_md.h for your target platform. To get these headers for Oracle's OpenJDK8, go to http://download.java.net/openjdk/jdk8/ and download the sources. (For Java 7 it's http://download.java.net/openjdk/jdk7/ etc) Within this file, you will find jvm.h in the folder /openjdk/jdk/src/share/javavm/export/ jvm_md.h is in folder: /openjdk/jdk/src/[target platform]/javavm/export/ Note that this path does not exist for Linux and Bsd (/openjdk/jdk/src/[target platform] only contains docs in these cases). I believe - however - that the Solaris-version is intended to serve these systems too. Hope this helps...
upvote count: 2
accepted answer of: http://stackoverflow.com/q/23392649
score: 2
answers question: http://stackoverflow.com/q/23392649
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/23334874
answers question: http://stackoverflow.com/q/23334619
type: Answer
has body: I don't understand why you would try and compare a int with Reader if(inputstream!=c){ They are incompatible and can't be compared, it doesn't make sense. Because you're using Java 1.8, you could take advantage of the try-with-resource feature, which will automatically close your streams, for example... try (FileReader inputstream = new FileReader("D://raj.txt")) { try (FileWriter outputstream = new FileWriter("D://raj1.txt")) { int c; while ((c = inputstream.read()) != -1) { outputstream.write(c); } } finally { } } finally { }
score: 0

http://stackoverflow.com/a/23355544
has body: 'assertArrayEquals' method is used to check 2 arrays. But your first argument 20 is not an array object that could be the reason for the failure.
type: Answer
answers question: http://stackoverflow.com/q/23355246
score: 0

http://stackoverflow.com/comment/35743294
score: 2
type: AnswerComment
comment on: http://stackoverflow.com/a/23341115
has text: "*`return (T) y;` almost equivalently `return (Object) y;`*" actually since `<T extend Y>` it is equivalent in bytecode to `return (Y) y;`.
type: Comment

http://stackoverflow.com/q/23434687
has title: Is there a way to use GWT.create(...) to instantiate a class of a generic type?
answer count: 1
has body: Is there a way I can do something like this: public class Foo&lt;Bar&gt; { public Bar newBar() { return GWT.create( /* something useful here */ ); } } Would this work, for example: public class Foo&lt;Bar&gt; { public Bar newBar(Class&lt;Bar&gt; prototype) { return GWT.create(prototype); } } where I would for example do new Foo&lt;MyBar&gt;().newBar(MyBar.class)? But, ideally, I wouldn't even need to pass the prototype object.
tagged with: deferred
tagged with: gwt
type: AnsweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/23436790
accepted answer: http://stackoverflow.com/a/23436790
score: 0
tagged with: binding

http://stackoverflow.com/q/23336329
tagged with: offline
type: UnansweredQuestion
tagged with: maven
has title: Problems installing maven2eclipse offline
has answer: http://stackoverflow.com/a/23336519
tagged with: installation
tagged with: java
tagged with: eclipse
type: Question
has answer: http://stackoverflow.com/a/23336450
score: 0
answer count: 3
has body: I've been dealing with this problems for days now. I need to install maven and the eclipse plug-in "maven2eclipse" on an offline environment. So far I've installed maven on the computer but I'm not able to import or open a maven project in eclipse when I right click and select "import source" in the package/project explorer. Maven alternatives simply aren't there for me to use even though I've installed all of the plug-ins that m2e repository has to offer. I've downloaded the m2e-repository for a local version with these commandlines: Artifact and metadata (replacing .artifact. with .metadata. and running it again) "C:\eclipse Java EE\eclipse.exe" -application org.eclipse.equinox.p2.artifact.repository.mirrorApplication \ -source http://download.eclipse.org/technology/m2e/releases \ -destination C:\Maven2Eclipse\repos I then moved this local folder to the offline system and used it as a local repository. I've also downloaded the helios repository, but I haven't installed anything from it. Becuase I seemed to be lacking some important dependancies without it. Something with eclipse.UI.. haven't been able to reproduce it. Anyways, I've added the downloaded repositories to the disposal of my offline environment. I installed everything with "m2e" and/or "maven" in it's name but I still can't import an "existing maven project". The option simply isn't there. Here's a screenshot of what m2e software I have installed using the "install new software". https://i.sstatic.net/dzC3d.png Have I missed something? There's something missing and keeping me from actually being able to select the import source "import an existing maven project". I've been searching the web like crazy and I cannot find anything that resembles my problem. There's quite a lot on mirroring eclipse repositories and what not but I don't seem to have a problem whit that, unless something didn't get downloaded. Thanks in advance for any help.
has answer: http://stackoverflow.com/a/23359723

http://stackoverflow.com/comment/35675750
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23302329
has text: Thank you! This helped out a lot... I was able to get to the fragments! However I seemed to have run into some other problems afterwards, but they are unrelated to this question, so i will make another question
type: AnswerComment

http://stackoverflow.com/comment/35698305
score: 0
comment on: http://stackoverflow.com/q/23315717
type: QuestionComment
type: Comment
has text: I will look at it, it might help. Thanks.

http://stackoverflow.com/comment/35740537
type: AnswerComment
has text: getClazzes returns a HashMap
type: Comment
comment on: http://stackoverflow.com/a/23338891
score: 0

http://stackoverflow.com/comment/35697807
type: QuestionComment
comment on: http://stackoverflow.com/q/23305118
score: 0
has text: @M.Deinum you are correct, the web services aren't actually being run in a transaction. When I call `TransactionSynchronizationManager.isActualTransactionActive()` I get false back, so apparently we messed something up in the upgrade. Not sure what yet.
type: Comment

http://stackoverflow.com/comment/35660199
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23293602
has text: @vacetahanna You're on the right track. Sir RotN's comment is not terrible Java advice in general, but Jena's API *does* use `null` as a wildcard in triple patterns, so your use is sensible.

http://stackoverflow.com/a/23353625
has comment: http://stackoverflow.com/comment/35804518
score: 0
type: Answer
has body: Use an ArrayList&lt;String&gt; or a LinkedList&lt;String&gt;. An array-based collection can hold an indefinite number of objects (think of them as separate variables) accessed by numerical index. List&lt;String&gt; titles = new ArrayList&lt;String&gt;(); titles.add("Title1"); titles.add("Title2"); . . . System.out.println(titles.get(1)); System.out.println(titles.get(2)); . . . System.out.println("There are " + titles.size() + " titles:"); for (String title : titles) { System.out.println(title); } If you want to access them by symbolic name instead of index, use a HashMap&lt;String,String&gt;. Map&lt;String,String&gt; titles = new HashMap&lt;String,String&gt;(); titles.put("title1", "The First Title"); titles.put("title2", "The Second Title"); . . . System.out.println(titles.get("title1")); // etc. The values can be any object type, not only String.
answers question: http://stackoverflow.com/q/23353611

http://stackoverflow.com/q/23403627
type: UnansweredQuestion
tagged with: ibm-jvm
score: 1
tagged with: java
upvote count: 1
type: Question
has body: I am using the IBM JRE, and I have a Java SDK which is used by 2 clients: A Java client, as well as a .NET client. On the Java client, I use the following settings to capture http data: System.setProperty("com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.dump","true"); System.setProperty("com.sun.xml.ws.transport.http.HttpAdapter.dump","true"); System.setProperty("com.sun.xml.internal.ws.transport.http.HttpAdapter.dump","true"); System.setProperty("HttpTransportPipe.dump", "true"); In the .NET client, I can pass on parameters to the JVM. Are there parameters that I can use which achieve the same behavior as the System.setProperty settings in the Java client? I researched a bit about dump agents etc, but couldn't seem to find something suitable. http://publib.boulder.ibm.com/infocenter/javasdk/v6r0/index.jsp?topic=%2Fcom.ibm.java.doc.diagnostics.60%2Fdiag%2Ftools%2Fdump_agents.html
has title: Using Java JVM -xdump argument to print http wire data
has answer: http://stackoverflow.com/a/29865277
answer count: 1
downvote count: 0
favorite count: 0

http://stackoverflow.com/a/23337328
downvote count: 0
has comment: http://stackoverflow.com/comment/35736429
type: Answer
has body: In case that the fixed array size 50 has any important reason for you: char[] szdata = new char[50]; char sc[] = "*KW,NR09G00001,001,082309#".toCharArray(); for(int i=0;i&lt;szdata.length;i++) { if (i&lt;sc.length) szdata[i]=sc[i]; }
score: 1
has comment: http://stackoverflow.com/comment/35736325
has comment: http://stackoverflow.com/comment/35736295
answers question: http://stackoverflow.com/q/23337148
upvote count: 1

http://stackoverflow.com/q/23367991
has body: Iam new to java i have a requirement that all the user logged in details are stored in database.The table looks like this empId timestamp empDeparment empName 1 xxxx java xxxx 2 xxxx testing xxxxx I need to get all these list of records and should store in text file based on some conditions. 1.I need to create new folder(directory) for each department for example "java_currentdate" 2.I need to create a text file the text file look like this logindetails.txt 1timestamp3(no of employees in java department are 3 so 3 times body repeats) -----------Header 2empidtimestampempName 2 " -----------body 2 " 3 -----------------footer All the employees should be sorted based on id and timestamp Please help me explain to work on this. I am using hibernate Orm tool and spring
has answer: http://stackoverflow.com/a/23368563
tagged with: spring
has comment: http://stackoverflow.com/comment/35792845
downvote count: 4
upvote count: 0
score: -4
type: AnsweredQuestion
has title: Storing LoginCredentials in text file
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/35792733
type: Question
answer count: 1
accepted answer: http://stackoverflow.com/a/23368563
favorite count: 0

http://stackoverflow.com/q/23402914
has comment: http://stackoverflow.com/comment/35857626
tagged with: pom.xml
has comment: http://stackoverflow.com/comment/35858876
favorite count: 0
answer count: 0
type: UnansweredQuestion
tagged with: maven
linked to: http://stackoverflow.com/q/17555504
downvote count: 0
score: 1
tagged with: java
has body: I want update project configuration in command not ecplise. I'm try 'mvn dependency:resolve', 'mvn versions:update-properties' etc.. but all build is fail. Ecplise maven -> update Maven Project click and command 'mvn package' that build success. why happen this problem? and I want to know update project configuation pom.xml in command line. Thank you.
type: Question
has title: how to update project configuration in command?
upvote count: 1
has comment: http://stackoverflow.com/comment/35892702
has comment: http://stackoverflow.com/comment/35857819

http://stackoverflow.com/comment/35901362
has text: Unless you really have to, I would use a List like ArrayList. Vector is a legacy class IMHO.
comment on: http://stackoverflow.com/q/23425938
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/35767275
comment on: http://stackoverflow.com/q/23353908
score: 0
type: Comment
type: QuestionComment
has text: Inside instance methods (and constructors), you have a reference to the current instance in the form of the keyword `this`.

http://stackoverflow.com/comment/35859953
type: QuestionComment
comment on: http://stackoverflow.com/q/23404339
has text: What is your question? Did you get an error or was the date format incorrect?
score: 0
type: Comment

http://stackoverflow.com/comment/35715689
has text: I want to test a method that gets an argument of the type File. The file i want to use to test it is in a different package: http://puu.sh/8pJAg/b177243091.png (testdata). I can't seem to access it, i keep getting a filenotfoundexception when i do "new File("testdata/A000100")".
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23325992

http://stackoverflow.com/a/23452719
upvote count: 1
has comment: http://stackoverflow.com/comment/35952934
has comment: http://stackoverflow.com/comment/35951777
answers question: http://stackoverflow.com/q/23452660
type: Answer
downvote count: 0
score: 1
has body: Is there any work around for this to get the no.of bytes written to a file at any instant of time ? That's what you're getting. The number of bytes that have been written to the file. What you really seem to be asking for is the number of chars that have been written to the BufferedWriter. In which case what you need to do is wrap/extend the BufferedWriter.
has comment: http://stackoverflow.com/comment/35952477
has comment: http://stackoverflow.com/comment/35954308

http://stackoverflow.com/a/23338512
upvote count: 1
downvote count: 1
answers question: http://stackoverflow.com/q/23338455
has comment: http://stackoverflow.com/comment/35738336
score: 0
has body: Wikipedia: http://en.wikipedia.org/wiki/CamelCase "Although the first letter of a camel case compound word may or may not be capitalized, the term camel case generally implies lowercase first letter." So both are CamelCase. You can call them "Lower Camel Case" and "Upper Camel Case".
type: Answer

http://stackoverflow.com/a/23382129
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/23381939
has body: "Efficient" is unfortunately unprecise. Efficient in terms of what ? Time ? Memory ? And regards to what "quality" of similarity measure ? Ask yourself first what similarity you want, for what purpose, with which kind of permutations/replacement allowed, etc, then you will be able to search for a "*-efficient" algorithm that computes the metrics which is adapted to your needs you can start by this paper or this post to see the differences, or search for "string similarity metrics" on Google.
downvote count: 0
type: Answer

http://stackoverflow.com/comment/35742198
type: Comment
comment on: http://stackoverflow.com/a/23340634
has text: @Raedwald Syscalls are pretty expensive, so I would expect a relatively big improvement. Also, I think that it's likely that the OP got the list of files by listing the directory, which at least on linux implies that the OS has already cached the modification times.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/35760766
has text: Let me know if the solution worked or we can look into this further.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23350361
type: AnswerComment

http://stackoverflow.com/comment/35900381
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23425777
has text: @BhushanKawadkar - well, it can be the right direction, but I have two delimiters - first is `"`, second is ` `(space)...
score: 0

http://stackoverflow.com/a/23415750
type: Answer
upvote count: 1
has body: while (s.hasNextLine()) { list.add(s.nextLine().replaceAll("&amp;", "")); } removes the ampersands
has comment: http://stackoverflow.com/comment/35882362
answers question: http://stackoverflow.com/q/23415688
has comment: http://stackoverflow.com/comment/35882165
downvote count: 0
score: 1

http://stackoverflow.com/comment/35770256
type: Comment
comment on: http://stackoverflow.com/a/23335745
score: 0
type: AnswerComment
has text: Can you just elaborate this a bit more. If possible.

http://stackoverflow.com/a/23339753
accepted answer of: http://stackoverflow.com/q/23339015
has comment: http://stackoverflow.com/comment/35746570
has comment: http://stackoverflow.com/comment/117480686
score: 10
has comment: http://stackoverflow.com/comment/35741765
has comment: http://stackoverflow.com/comment/137388393
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/23339015
upvote count: 11
has body: Below is the code without using any Map Collection, but if you want to use Map then it becomes very easy. Add both the arrays into map and sort it. public static void main(String args[]) { String a[] = new String[] { "Sam", "Claudia", "Josh", "Toby", "Donna" }; int b[] = new int[] { 1, 2, 3, 4, 5 }; for (int n = 0; n &lt; 5; n++) { System.out.print(a[n] + "..."); System.out.println(b[n]); } System.out.println(" "); //java.util.Arrays.sort(a); /* Bubble Sort */ for (int n = 0; n &lt; 5; n++) { for (int m = 0; m &lt; 4 - n; m++) { if ((a[m].compareTo(a[m + 1])) &gt; 0) { String swapString = a[m]; a[m] = a[m + 1]; a[m + 1] = swapString; int swapInt = b[m]; b[m] = b[m + 1]; b[m + 1] = swapInt; } } } for (int n = 0; n &lt; 5; n++) { System.out.print(a[n] + "..."); System.out.println(b[n]); } }
has comment: http://stackoverflow.com/comment/117480354
has comment: http://stackoverflow.com/comment/35745044
downvote count: 1

http://stackoverflow.com/comment/35743512
has text: You should pay attention to the `cause`of the exception that is what is likely the problem.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23308532
type: QuestionComment

http://stackoverflow.com/comment/35915730
has text: Use BigDecimal setScale.. > [BigDecimal setScale and round][1] [1]: http://stackoverflow.com/questions/3843440/bigdecimal-setscale-and-round
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23433804
type: QuestionComment

http://stackoverflow.com/comment/35902409
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23420145
type: AnswerComment
has text: Someone just told me that the UI and EditorKit are both the controller. Still, could you give me a high-level example of how it works internally when the user types text in the component?

http://stackoverflow.com/comment/35686476
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23309998
has text: It's not duplicated, as you're comparing different variables. This is the simplest and correct way.
score: 0

http://stackoverflow.com/a/23330016
has comment: http://stackoverflow.com/comment/35770932
type: AcceptedAnswer
score: 4
type: Answer
upvote count: 4
has body: My goal is to be able to add a button that comes after the tab list (horizontally). The proper solution is to write a custom UI, but that can be complicated and I'm not sure what code to change. As a simple hack you can us a panel with an OverlayLayout to display the button at the top/right of the tabbed pane: import java.awt.*; import javax.swing.*; import javax.swing.plaf.*; public class TabbedPaneWithComponent { private static void createAndShowUI() { JPanel panel = new JPanel(); panel.setLayout( new OverlayLayout(panel) ); JTabbedPane tabbedPane = new JTabbedPane(); tabbedPane.add("1", new JTextField("one")); tabbedPane.add("2", new JTextField("two")); tabbedPane.setAlignmentX(1.0f); tabbedPane.setAlignmentY(0.0f); JCheckBox checkBox = new JCheckBox("Check Me"); checkBox.setOpaque( false ); checkBox.setAlignmentX(1.0f); checkBox.setAlignmentY(0.0f); panel.add( checkBox ); panel.add(tabbedPane); JFrame frame = new JFrame("TabbedPane With Component"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.add( panel ); frame.setLocationByPlatform( true ); frame.setSize(400, 100); frame.setVisible( true ); } public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { createAndShowUI(); } }); } } Works pretty good except when the width of the tabbed pane becomes too small and the button overlaps the tabs.
accepted answer of: http://stackoverflow.com/q/23329805
downvote count: 0
has comment: http://stackoverflow.com/comment/35771790
answers question: http://stackoverflow.com/q/23329805

http://stackoverflow.com/comment/35874409
comment on: http://stackoverflow.com/q/23411605
has text: Is the real name of your variable `Entries` or `myEntries` ?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35906040
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23428890
score: 0
has text: You need to consult Oracle database admin to reset password.

http://stackoverflow.com/a/69566780
answers question: http://stackoverflow.com/q/23337802
upvote count: 2
has body: you have to replace the xmlns:ads in your parent layout xmlns:ads="http://schemas.android.com/tools" **by this** xmlns:ads="http://schemas.android.com/apk/res-auto"
type: Answer
score: 2
downvote count: 0

http://stackoverflow.com/q/23330385
type: AnsweredQuestion
has body: I am new on Java. I have developed an application with some different JPanels (using a BorderLayout, 3 panels in this case). In panel 1, I have a JLabel and a variable (a class) that is related with its value (method get); in panel 2, I updated the value of the variable (method set) because it is done when an action is performed in this second panel. How Could I get the value of the JLabel in panel 1 updated? I don't know how to trigger an event or something similar after updating the value from panel 2 and how to make panel 1 to listen to this change. Let me explain a bit more. I have a JFrame with two JPanels and I update the model from one panel. Once the model is updated, the JLabel from the other JPanel should be updated: Main: JFrame public class MainClass extends JFrame { public MainClass() { // JPanel 1 .... setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setSize(400,300); setLocationRelativeTo(null); setTitle("Test"); setResizable(false); setVisible(true); // JPanel 1 this.add(west, BorderLayout.WEST); // JPanel 2 this.add(board, BorderLayout.CENTER); } public static void main(String[] args) { // put your code here new MainClass (); } } JPanel 1 public class West extends JPanel { contFase = new Contador(titulo, valor); JLabel lblTitulo; ... lblTitulo.setText = contFase.getText(); this.add(lblTitulo); ... } JPanel 2 public class Board extends JPanel implements ActionListener { .... public void actionPerformed(ActionEvent e) { ... //Here Label of panel 1 should be updated with the model contFase.setValor(contFase.getValor() + pacman.comerElemento(fase.getPacdots(), fase.getPowerPellets())); ... } }
tagged with: java
tagged with: jpanel
type: Question
has answer: http://stackoverflow.com/a/23332062
linked to: http://stackoverflow.com/q/10523343
answer count: 1
has comment: http://stackoverflow.com/comment/38800967
has comment: http://stackoverflow.com/comment/35734705
has comment: http://stackoverflow.com/comment/38822873
score: 0
has comment: http://stackoverflow.com/comment/35724368
has title: Update label of a JPanel when change the value of one variable from another JPanel
tagged with: events
accepted answer: http://stackoverflow.com/a/23332062
tagged with: jlabel
tagged with: swing

http://stackoverflow.com/q/23446702
answer count: 0
score: 1
has body: JDK versions (jdk1.7.0_21 and jdk1.7.0_55) root@xxx-xxx:/usr/lib/jvm# ll drwxr-xr-x 6 root root 4096 Apr 4 2013 jdk1.7.0_21/ drwxr-xr-x 8 root root 4096 Mar 18 09:04 jdk1.7.0_55/ Installed and Configured like below. jdk1.7.0_21 update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.7.0_21/bin/java" 1 update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdk1.7.0_21/bin/javac" 1 update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/lib/jvm/jdk1.7.0_21/bin/javaws" 1 sudo chmod a+x /usr/bin/java sudo chmod a+x /usr/bin/javac sudo chmod a+x /usr/bin/javaws sudo chown -R root:root /usr/lib/jvm/jdk1.7.0_21 jdk1.7.0_55 update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.7.0_55/bin/java" 1 update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdk1.7.0_55/bin/javac" 1 update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/lib/jvm/jdk1.7.0_55/bin/javaws" 1 sudo chmod a+x /usr/bin/java sudo chmod a+x /usr/bin/javac sudo chmod a+x /usr/bin/javaws sudo chown -R root:root /usr/lib/jvm/jdk1.7.0_55 and i am choosing/changing the default JDK by update-alternatives --config java update-alternatives --config javac update-alternatives --config javaws After this if i run java -version while jdk1.7.0_55 is default, output's like below. root@xxx-xxx:/usr/lib/jvm# java -version java version "1.7.0_55" Java(TM) SE Runtime Environment (build 1.7.0_55-b13) Java HotSpot(TM) 64-Bit Server VM (build 24.55-b03, mixed mode) but while jdk1.7.0_21 is default it gives an message like java: error while loading shared libraries: libjli.so: cannot open shared object file: No such file or directory If i issue: locate libjli.so /usr/lib/jvm/jdk1.7.0_55/jre/lib/amd64/jli/libjli.so /usr/lib/jvm/jdk1.7.0_55/lib/amd64/jli/libjli.so So it's clear that though i selected jdk1.7.0_21 but somehow it's still pointing to jdk1.7.0_55 Tried to rename the jdk1.7.0_55 but no luck. Not sure how to fix this. Thanks in advance for your help…
upvote count: 1
type: Question
tagged with: java
tagged with: ubuntu-14.04
tagged with: ubuntu
has title: Multiple JDK is not working properly in Ununtu 14.04
tagged with: java-7
downvote count: 0
has comment: http://stackoverflow.com/comment/35939421
favorite count: 0
tagged with: linux
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35939203

http://stackoverflow.com/a/23447661
answers question: http://stackoverflow.com/q/23446184
type: Answer
has body: The dependencies you have in there will retrieve, by Maven transitive dependency mechanism, the JSR API jar as well. So, if you are asking why that is working well, it is because jax.ws.rs-api 2.0 will be available through jersey-server -> jersey-common -> jax.ws.rs-api path. If you're asking why both are needed (even by Maven transitive dependency mechanism), then I would believe that the reason is a separation between API and implementation. Your code depends at compile time on the JSR API, but at runtime it will need the implementation as well. So, theoretically, one can swap out one implementation with the other without affecting the code.
downvote count: 0
score: 1
upvote count: 1

http://stackoverflow.com/a/23367138
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/35794619
type: Answer
has comment: http://stackoverflow.com/comment/35795608
score: 2
has body: You basically need a Map (preferably hash based), and an SortedSet (probably a TreeSet). Map&lt;Key,Value&gt; byKey and Set&lt;Key&gt; byValue The first map will have the natural key's Comparator, while the second one will have a Comparator that first uses byKey.get(key1).compareTo(byKey.get(key2)) first, and only if they are deemed as equal, uses the natural Key Comparator. Add: check if element already exists, if it is - take it out from byValue. modify the value in byKey Add the element to byValue Note that this ensures that the Set is ordered by increasing value of the given values. Assuming the map is hashed based, and every operation in it is O(1) on average, it gives you O(logn) running time (removing from byValue and adding to it).
upvote count: 2
has comment: http://stackoverflow.com/comment/35791243
has comment: http://stackoverflow.com/comment/35795525
has comment: http://stackoverflow.com/comment/35791330
has comment: http://stackoverflow.com/comment/35790954
accepted answer of: http://stackoverflow.com/q/23366908
has comment: http://stackoverflow.com/comment/35791419
answers question: http://stackoverflow.com/q/23366908
has comment: http://stackoverflow.com/comment/35791051

http://stackoverflow.com/a/23362260
upvote count: 3
downvote count: 1
has comment: http://stackoverflow.com/comment/35782640
has comment: http://stackoverflow.com/comment/35782153
has body: I use IntelliJ CE for this. It has auto-fixes for the migration tools. The free version has about 600 checks, the paid for version has checks/refactoring for libraries like Spring etc. You can do a global search and fix for &lt;&gt; operators. Note: you cannot use &lt;&gt;for anonymous sub-classes. It also has an auto-fix for try { } catch(NullPointerException npe) { npe.printStackTrace(); } catch(NumberFormatException nfe) { nfe.printStackTrace(); } It will merge identical branches. It will also refactor the following to use ARM. FileInputStream fis = new FileInputStream("myfile"); try { } finally { fis.close(); }
has comment: http://stackoverflow.com/comment/35782601
answers question: http://stackoverflow.com/q/23362211
has comment: http://stackoverflow.com/comment/35783507
has comment: http://stackoverflow.com/comment/35782592
type: Answer
has comment: http://stackoverflow.com/comment/35781980
score: 2

http://stackoverflow.com/comment/35848634
score: 0
has text: Sorry, here it is: java.lang.IllegalArgumentException: URI is not absolute
type: QuestionComment
comment on: http://stackoverflow.com/q/23397690
type: Comment

http://stackoverflow.com/comment/45323466
score: 0
comment on: http://stackoverflow.com/q/23339015
type: Comment
type: QuestionComment
has text: Actually you do not have to make your own sort in the case you have huge arrays. Simply make a "index" array than you sort instead of your actual arrays (using a custom comparator)

http://stackoverflow.com/q/23351822
downvote count: 1
type: Question
tagged with: java
accepted answer: http://stackoverflow.com/a/23351887
has body: I have been trying to create a program that will remove a element from the array that the user wants, and to have the array deleting in a loop. The problem that I have is deleting the extra array elements after removing an element. I have been going at this for about 3 hours and got no where. Please help me. Thank you. Here is what I mean: The array list: 10 20 30 40 50 Which number should be removed for the list? Number to delete: 20 10 30 40 50 Try again? y/n Which number should be removed for the list? Number to delete: 30 10 40 **50 50** Try again? y/n Here is what I have: import java.util.Scanner; public class DeleteElements { public static void main(String[] args) { Scanner input = new Scanner(System.in); int del = 0; int intArray[] = {10, 20, 30, 40, 50}; System.out.println("\n---- Part 3 of the Homework----"); char yN; boolean yes = true; for (int i = 0; i &lt; intArray.length; i++) { System.out.print(intArray[i] + " "); } do { System.out.print("\nWhich number should be removed for the list? "); del = input.nextInt(); System.out.println("Number to delete: " + del); for (int i = 0; i &lt; intArray.length; i++) { if (intArray[i] == del) { if (i == 0) { for (int b = i; b &lt; intArray.length - 1; b++) { intArray[b] = intArray[b + 1]; System.out.print(intArray[b] + " "); } } if (i &gt; 0 &amp;&amp; i &lt;= intArray[i]) { for (int c = 0; c &lt; i; c++) { System.out.print(intArray[c] + " "); } for (int a = i; a &lt; intArray.length - 1; a++) { intArray[a] = intArray[a + 1]; System.out.print(intArray[a] + " "); } } } } System.out.println("\nDelete again? y/n"); input.nextLine(); yN = input.nextLine().charAt(0); if (yN == 'y') { yes = true; } else if (yN == 'n') { yes = false; } } while (yes != false); } }
has title: Java Array deleting confusion?
tagged with: arrays
answer count: 1
has comment: http://stackoverflow.com/comment/35763784
has comment: http://stackoverflow.com/comment/35763670
favorite count: 0
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23351887
score: 0
upvote count: 1

http://stackoverflow.com/a/36591834
has body: public static boolean isEmpty(String ptext) { return ptext == null || ptext.trim().length() == 0; } public static boolean isBlank(String ptext) { return ptext == null || ptext.trim().length() == 0; } Both have the same code how will isBlank handle white spaces probably you meant isBlankString this has the code for handling whitespaces. public static boolean isBlankString( String pString ) { int strLength; if( pString == null || (strLength = pString.length()) == 0) return true; for(int i=0; i &lt; strLength; i++) if(!Character.isWhitespace(pString.charAt(i))) return false; return false; }
upvote count: 3
answers question: http://stackoverflow.com/q/23419087
type: Answer
score: 2
downvote count: 1

http://stackoverflow.com/a/23336325
has comment: http://stackoverflow.com/comment/35939266
has body: No it won't work at all. you should iterate the 'teacherInfo' list and you need to override the compare()and hashvalue() of object class.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23336169
has comment: http://stackoverflow.com/comment/35734676

http://stackoverflow.com/comment/76590072
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23318269
has text: Not all Java 7 features are available in Android. Like the package [java.nio.file](https://developer.android.com/reference/java/nio/file/package-summary.html). It will be available in Android O as I understand ?

decorator
tags question: http://stackoverflow.com/q/23341663
tag name: decorator
tags question: http://stackoverflow.com/q/23319746
type: Tag

http://stackoverflow.com/comment/35655756
has text: Just leave your phone connected but launch it from the phone.
comment on: http://stackoverflow.com/q/23291099
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23405431
type: Question
has answer: http://stackoverflow.com/a/23420977
tagged with: mousehover
tagged with: libgdx
accepted answer: http://stackoverflow.com/a/23420977
has body: I am currently working on a LibGDX project in java and i was wondering how to detect mouse over shapes that aren't rectangles or circles. Let's say for example i have a spaceship. While rendering it you will have sprite that is a square and inside that square you have the spaceship. The problem is that the spaceship isn't a square so you will have blank space around edges of that sprite (most likely that blank space will be transparent so it won't cause any troubles over background or other scene objects). How do you detect mouse over the spaceship not the entire square? Is there any method?
score: 3
answer count: 1
tagged with: user-interface
downvote count: 0
favorite count: 0
type: AnsweredQuestion
has title: LinGDX Mouse over scene object
upvote count: 3
tagged with: java

javabeans
tags question: http://stackoverflow.com/q/23444747
type: Tag
tags question: http://stackoverflow.com/q/23304986
tag name: javabeans
tags question: http://stackoverflow.com/q/23443615

http://stackoverflow.com/comment/35817327
type: Comment
comment on: http://stackoverflow.com/a/23375726
has text: Is there any benefit performance wise to using the resources directory over assets over assets? Or is the named resources the only benefit?
type: AnswerComment
score: 0

http://stackoverflow.com/a/23384473
has body: seems this happens due to permission issue on your OS, check your /opt/wso2am-1.6.0/repository/database/ permissions. need to restart API manager again with fresh.
has comment: http://stackoverflow.com/comment/35823889
accepted answer of: http://stackoverflow.com/q/23384210
score: 1
has comment: http://stackoverflow.com/comment/35826475
upvote count: 1
answers question: http://stackoverflow.com/q/23384210
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/comment/35672847
score: 0
type: AnswerComment
type: Comment
has text: I guess my question was more of a _why_ question. "This definition ensures that the equals method works properly across different implementations of the set interface." That part really helps. Every implementation of `Set` must have the same standard. I'm still not sure why, though, but it's clear that LHS is just following the standards set in the `Set` definition of equals. It still seems logical to me that two `LinkedHashSet`s with different ordering would not be equal. Am I the only one?
comment on: http://stackoverflow.com/a/23302116

http://stackoverflow.com/comment/35697971
type: Comment
comment on: http://stackoverflow.com/a/23311210
type: AnswerComment
has text: If I do ```Process p = Runtime.getRuntime().exec("cmd /c start cmd.exe"); System.setOut(new PrintStream(p.getOutputStream()));```, System.out does not write anymore to the console the java app started from and does not write to the new one... If I open it by double clicking the jar, a new console is opened but nothing is sent there...
score: 0

http://stackoverflow.com/q/23331285
tagged with: string
has body: I have the following code in my string.xml file: cm/s2 m/s2 in/s2 ft/s2 I also have the following code in my .java file: if(val.equals("mm/s") || val.equals("m/s") || val.equals("in/s") || val.equals("ft/s") || val.equals("km/hr") || val.equals("mi/hr")) { initiateVelocityConvert(); } Obviously these two functions don't match up (one is for velocity, one is for acceleration). My question is, how can I make the same function for acceleration, because I would have to parse the 2 out. I can't do a val.equals("m/s^2"). Any ideas? I also can't do an else statement because there are multiple functions, and there are other functions that have powers to the 3. Thanks.
tagged with: parsing
has comment: http://stackoverflow.com/comment/35726230
type: UnansweredQuestion
tagged with: android
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/35734342
type: Question
has title: Parsing powers from strings in Android
score: 0

http://stackoverflow.com/q/23425216
type: Question
answer count: 2
has body: I have a working servlet wich originates back from this template: http://www.objectdb.com/tutorial/jpa/eclipse/web/servlet So the basic rountrip works. I added a new feature where I POST data to the servlet, construct a call/request out of the data to a remote http server, retrieve the response-html-string (the content of the website I requested) and want to show this HTML String now as response to my original POST call. I tried it like this: @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { boolean showDetails = Boolean.valueOf(request.getParameter("showDetails")); if (showDetails) { String details = detailsLoader.loadDetails(String.valueOf(request.getParameter("value1")), String.valueOf(request.getParameter("value2"))); response.getWriter().println(details); response.getWriter().flush(); response.getWriter().close(); return; // &lt;----------------- if showDetails then this is the end of doPost } // Display the list of guests: doGet(request, response); } When I press the link that creates the POST event I see in the logfile, that "loadDetails" has succesfully loaded the content from the remote server, but the browser window does not refresh. Why? PS: a simple redirect to the other side is not possible for technical reasons.
possible better answer: http://stackoverflow.com/a/23428423
tagged with: servlets
score: 0
has title: Render HTML response from remote call to the client
has answer: http://stackoverflow.com/a/23428423
has answer: http://stackoverflow.com/a/23923338
accepted answer: http://stackoverflow.com/a/23923338
type: AnsweredQuestion
tagged with: java
tagged with: http

http://stackoverflow.com/comment/35742710
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/23340770
score: 0
has text: I'm not quite sure what to do now, then? Should I delete the "http://earth.google.com/kml/2.1"-URL in the XML file? Chris

http://stackoverflow.com/a/23415026
has body: upcasting means casting the object to a supertype, while downcasting means casting to a subtype. In java, upcasting is not necessary as it's done automatically. And it's usually referred as implicit casting. You can specify it to make it clear to others. Thus, writing Animal a = (Animal)d; or Animal a = d; leads to exactly the same point and in both cases will be executed the callme() from Dog. Downcasting is instead necessary because you defined a as object of Animal. Currently you know it's a Dog, but java has no guarantees it's. Actually at runtime it could be different and java will throw a ClassCastException, would that happen. Of course it's not the case of your very sample example. If you wouldn't cast a to Animal, java couldn't even compile the application because Animal doesn't have method callme2(). In your example you cannot reach the code of callme() of Animal from UseAnimlas (because Dog overwrite it) unless the method would be as follow: class Dog extends Animal { public void callme() { super.callme(); System.out.println("In callme of Dog"); } ... }
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/23414090
downvote count: 0

http://stackoverflow.com/comment/35729970
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/23333623
has text: super must be the first statemenr
type: Comment

http://stackoverflow.com/comment/35851997
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23399800
has text: Well, for starters, in the code you're showing, you don't add the listener to the button. Also, you don't add the button to anything.

http://stackoverflow.com/comment/40951563
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23293280
score: 0
has text: You normally get an object directly back from mybatis. You dont need to get resultset. You should have model value object or pojo representing record. Mynatis would create objects for you and can also return list.

http://stackoverflow.com/a/23316344
type: Answer
has body: Transactions belong to Service layer. For example if you have HotelService, then the code would look like this: @Service("hotelService") @Transactional public class HotelServiceImpl implements HotelService { @Autowired HotelDao hotelDao; // The rest of code omited ... }
score: 3
has comment: http://stackoverflow.com/comment/35698604
upvote count: 3
accepted answer of: http://stackoverflow.com/q/23316118
answers question: http://stackoverflow.com/q/23316118
has comment: http://stackoverflow.com/comment/35698476
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/35698619

http://stackoverflow.com/q/23418997
tagged with: java
type: Question
score: 4
tagged with: centos
has title: JETTY_LOGS is being appended to JETTY_HOME
answer count: 2
has answer: http://stackoverflow.com/a/23588077
has body: I'm trying to run Jetty on CentOS and am having problems as I am getting unexpected results when I try to set the full path for JETTY_LOGS. The system tries to take that path and append it to the path I specified in the JETTY_HOME variable. JETTY_HOME=/usr/local/jetty/jetty-9.1.4 JETTY_USER=jetty JETTY_PORT=8085 JETTY_HOST=0.0.0.0 JETTY_LOGS=/usr/local/jetty/jetty-9.1.4/logs Any ideas as to what I'm doing wrong? The error I get is: Starting Jetty: java.io.IOException: Cannot write start.log to directory /usr/local/jetty/jetty-9.1.4/usr/local/jetty/jetty-9.1.4/logs [directory doesn't exist or is read-only] java.io.IOException: Cannot write start.log to directory /usr/local/jetty/jetty-9.1.4/usr/local/jetty/jetty-9.1.4/logs [directory doesn't exist or is read-only] at org.eclipse.jetty.start.StartLog.initLogFile(StartLog.java:127) at org.eclipse.jetty.start.StartLog.initialize(StartLog.java:113) at org.eclipse.jetty.start.Main.processCommandLine(Main.java:520) at org.eclipse.jetty.start.Main.main(Main.java:102)
favorite count: 0
has answer: http://stackoverflow.com/a/23424492
accepted answer: http://stackoverflow.com/a/23424492
tagged with: jetty
upvote count: 4
type: AnsweredQuestion
downvote count: 0
possible better answer: http://stackoverflow.com/a/23588077

http://stackoverflow.com/comment/35661084
type: AnswerComment
comment on: http://stackoverflow.com/a/23295700
has text: thats it ! ctxSrc.afterPropertiesSet(); needed to be called on LdapContextSource, I was calling it on template :) Thank you !
type: Comment
score: 1

http://stackoverflow.com/q/23323881
has answer: http://stackoverflow.com/a/23323955
has answer: http://stackoverflow.com/a/23323949
has body: I am developing a simple Hibernate application to test an OneToMany association. The Entities I use are Employee and Department which has many Employees: @Entity public class Department { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long departmentId; @OneToMany(cascade=CascadeType.ALL, fetch = FetchType.EAGER, mappedBy="department") private Set&lt;Employee&gt; employees; ... getters/setters } @Entity public class Employee { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long employeeId; @ManyToOne @JoinColumn(name="employee_fk") private Department department; ... getters/setters } I create some records with: tx.begin(); Department department = new Department(); department.setDepartmentName("Sales"); session.persist(department); Employee emp1 = new Employee("Ar", "Mu", "111"); Employee emp2 = new Employee("Tony", "Almeida", "222"); Employee emp3 = new Employee("Va", "Ka", "333"); emp1.setDepartment(department); emp2.setDepartment(department); emp3.setDepartment(department); session.persist(emp1); session.persist(emp2); session.persist(emp3); Set&lt;Employee&gt; emps = department.getEmployees(); emps.remove(emp2); However in the last line: emps.remove(emp2); I receive a NullPointerException, the emps Collection is namely null. I have tried to change the owner of the association with: @Entity public class Department { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long departmentId; @OneToMany(cascade=CascadeType.ALL, fetch = FetchType.EAGER) @JoinColumn(name="department_fk") private Set&lt;Employee&gt; employees; ... getters/setters } @Entity public class Employee { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long employeeId; @ManyToOne @JoinColumn(name="department_fk", insertable=false, updatable=false) private Department department; ... getters/setters } However the result the same. Why is the Set of Employees not created. What must be changed in order to make it work?
score: 0
answer count: 2
has title: OneToMany association collection is null in Hibernate application
tagged with: associate
tagged with: nullpointerexception
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23323955
tagged with: java
tagged with: hibernate
possible better answer: http://stackoverflow.com/a/23323949
type: Question

http://stackoverflow.com/comment/35840120
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/23392586
has text: I think it's only logical to not allow this: if you know a shortcut to add a `ConditionalComponent` have the method check for the interface with `instanceof` (it's an internal property of your method). But as it stands, each object passed in is *also* a `ComponentTemplate` so should be handled by a single `addComponent` method.

http://stackoverflow.com/a/23432434
answers question: http://stackoverflow.com/q/23432294
has body: With FocusGained and FocusLost you can just do: if (FocusLost from JTextfield) stop updating (FYI: this is not actual code)
score: 0
has comment: http://stackoverflow.com/comment/35913190
type: Answer
has comment: http://stackoverflow.com/comment/35913279
has comment: http://stackoverflow.com/comment/35914145

http://stackoverflow.com/comment/35994766
type: Comment
type: QuestionComment
has text: I’m a bit confused about your statement about which version of your code did work or didn’t work with which compiler. Trying myself with Eclipse, Netbeans 8.0, and javac of jdk1.8.0_05, I encounter the same behavior with all of them, needing a cast and not getting a warning about the cast being redundant. And that’s what I would expect.
comment on: http://stackoverflow.com/q/23429929
score: 0

http://stackoverflow.com/a/23415325
has body: When you output to JS from JSP, you have to make sure your output is valid JS. Your current output will output a string with no quotes, which the JS interpreter will treat as JS code and not strings or arrays as you want. In addition, you are producing 10 copies of the JS jQuery(function ($) { var roles = []; roles.push(&lt;%= x%&gt;) roles.push(&lt;%= y%&gt;) and that function is never closed. I would look for a decent JSON output library. That would simplify your life quite a bit here.
has comment: http://stackoverflow.com/comment/35887717
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/23415037
downvote count: 0
score: 1

http://stackoverflow.com/comment/35943197
comment on: http://stackoverflow.com/q/23434539
type: Comment
has text: thanks a bunch guys.. I changed the = to == and got rid of the boolean at end and changed the loop process with ifwantstoplay again and it works perfect.. what a great site.. really hope one day I can help other like you guys do ... really appreciate it.
score: 0
type: QuestionComment

http://stackoverflow.com/q/23292613
tagged with: swing
has body: Java: I have two classes. The first BaseForm(BaseForm.java) extends JFrame, the second ErrorM(ErrorM.java) extends BaseForm. I want to close ErrorM by a click on OK button. I know I am supposed to use the setVisible(false) but I do not know what is the object to invoke it. The classes: package interfaceClasses; import java.awt.GraphicsConfiguration; import java.awt.HeadlessException; import java.awt.Dimension; import javax.swing.JFrame; import java.awt.Color; public class BaseForm extends JFrame { public BaseForm() throws HeadlessException { Dimension d = new Dimension(1100, 850); setTitle("Employee Payroll System"); setSize(d); setLocationRelativeTo(null); getContentPane().setBackground(new Color(107, 142, 35)); getContentPane().setLayout(null); setBackground(new Color(107, 142, 35)); } } and package interfaceClasses; import java.awt.BorderLayout; import java.awt.FlowLayout; import javax.swing.JButton; import javax.swing.JPanel; import javax.swing.border.EmptyBorder; import java.awt.Color; import javax.swing.JLabel; import java.awt.Font; import javax.swing.SwingConstants; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; public class ErrorM extends BaseForm{ private final JPanel contentPanel = new JPanel(); public ErrorM(String errT, String errM) { setTitle("Error"); setLocationRelativeTo(null); setBounds(100, 100, 450, 300); getContentPane().setLayout(new BorderLayout()); contentPanel.setBackground(new Color(107, 142, 35)); contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); getContentPane().add(contentPanel, BorderLayout.CENTER); contentPanel.setLayout(null); { JLabel errorText = new JLabel("Error Text 1"); errorText.setBounds(6, 6, 438, 53); errorText.setHorizontalAlignment(SwingConstants.CENTER); errorText.setForeground(Color.WHITE); errorText.setFont(new Font("Helvetica Neue", Font.PLAIN, 20)); errorText.setText(errT); contentPanel.add(errorText); } { JLabel errorMessage = new JLabel("Error Text 2"); errorMessage.setBounds(6, 67, 438, 1…
downvote count: 1
type: Question
has title: Closing Window (Java)
score: -1
accepted answer: http://stackoverflow.com/a/23293051
linked to: http://stackoverflow.com/q/9554636
answer count: 1
has comment: http://stackoverflow.com/comment/35654815
favorite count: 0
has answer: http://stackoverflow.com/a/23293051
has comment: http://stackoverflow.com/comment/35660710
has comment: http://stackoverflow.com/comment/35659490
type: AnsweredQuestion
upvote count: 0
tagged with: java

http://stackoverflow.com/a/23349574
score: 0
has body: I'm assuming you have field like public int face; I guess it will work if it's what you meant public String getFace() { switch (this.face) { case 1: face = "Ace"; break; case 11: face = "Jack"; break; case 12: face = "Queen"; break; case 13: face = "King"; break; default: return Integer.toString(face); break; } }
type: Answer
answers question: http://stackoverflow.com/q/23348712

http://stackoverflow.com/a/23330487
has comment: http://stackoverflow.com/comment/35726819
score: 0
type: Answer
has body: Object Oriented Programming gives us a better approach to this and both C++ and Java are object oriented languages. So, rather than having several arrays that are linked together (meaning that index i in each array referd to related data) we could do this: public class Node { int id; int x,y; static ArrayList&lt;Node&gt; allNodes; public Node(int idNum, int x, int y) { id = idNum; this.x = x; this.y = y; } } Now your list of all nodes contains a single array with all the data you need. For instance, Node firstNode = Node.allNodes.get(0); //coordinates are firstNode.x, firstNode.y and id is firstNode.id
has comment: http://stackoverflow.com/comment/35724516
answers question: http://stackoverflow.com/q/23330419

http://stackoverflow.com/q/23391473
favorite count: 0
has comment: http://stackoverflow.com/comment/35836067
has comment: http://stackoverflow.com/comment/35835919
has comment: http://stackoverflow.com/comment/35835981
score: -1
has answer: http://stackoverflow.com/a/23391556
downvote count: 1
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/35835911
accepted answer: http://stackoverflow.com/a/23391556
type: Question
has body: I've been trying to figure out how to order a List&lt;Key&gt; where I need to put the root key into the top of the List, the challenge is the method the outputs the List does not output in any order. The root key is the one with parentKey = null and child keys are those with parentKeys What is the right approach to deal with this kind of problem? See parentKey:
upvote count: 0
has title: Sorting Keys or Key objects with Java
answer count: 1

http://stackoverflow.com/q/23316755
has answer: http://stackoverflow.com/a/23316803
has comment: http://stackoverflow.com/comment/35699139
score: 23
has answer: http://stackoverflow.com/a/23316810
has body: I need to encode a String to byte array using UTF-8 encoding. I am using Google guava, it has Charsets class already define Charset instance for UTF-8 encoding. I have 2 ways to do: String.getBytes( charsetName ) try { byte[] bytes = my_input.getBytes ( "UTF-8" ); } catch ( UnsupportedEncodingException ex) { } String.getBytes( Charset object ) // Charsets.UTF_8 is an instance of Charset byte[] bytes = my_input.getBytes ( Charsets.UTF_8 ); My question is which one I should use? They return the same result. For way 2 - I don't have to put try/catch! I take a look at the Java source code and I see that way 1 and way 2 are implemented differently. Anyone has any ideas?
upvote count: 23
type: Question
has comment: http://stackoverflow.com/comment/35699170
tagged with: java
tagged with: character-encoding
has comment: http://stackoverflow.com/comment/35699253
has title: Java String.getBytes( charsetName ) vs String.getBytes ( Charset object )
downvote count: 0
tagged with: string
favorite count: 0
has comment: http://stackoverflow.com/comment/35699316
has answer: http://stackoverflow.com/a/23316807
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23316891
answer count: 4

http://stackoverflow.com/comment/35886008
comment on: http://stackoverflow.com/q/23417777
has text: Why do you think it should have printed a version corresponding to Java 6?
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/45666760
upvote count: 0
score: -1
answers question: http://stackoverflow.com/q/23293759
downvote count: 1
has body: What worked for me (NetBeans 8.1 with jdk8u74) was adding a fx:controller attribute to the root element of my .fxml file. For example, with root element of GridPane and controller class FXMLTableViewController in the fxmltableview package: &lt;GridPane xmlns="http://javafx.com/javafx/8.0.111" xmlns:fx="http://javafx.com/fxml/1" fx:controller="fxmltableview.FXMLTableViewController"&gt;
type: Answer

http://stackoverflow.com/q/23353671
tagged with: java
type: Question
answer count: 2
downvote count: 0
tagged with: string
has answer: http://stackoverflow.com/a/23355406
linked to: http://stackoverflow.com/q/275768
has comment: http://stackoverflow.com/comment/35767787
has answer: http://stackoverflow.com/a/23355163
tagged with: regex
favorite count: 0
has title: Split String at natural language breaks
linked to: http://stackoverflow.com/q/18281206
type: UnansweredQuestion
has body: Overview I send Strings to a Text-to-Speech server that accepts a maximum length of 300 characters. Due to network latency, there may be a delay between each section of speech being returned, so I'd like to break the speech up at the most 'natural pauses' wherever possible. Each server request costs me money, so ideally I'd send the longest string possible, up to the maximum allowed characters. Here is my current implementation: private static final boolean DEBUG = true; private static final int MAX_UTTERANCE_LENGTH = 298; private static final int MIN_UTTERANCE_LENGTH = 200; private static final String FULL_STOP_SPACE = ". "; private static final String QUESTION_MARK_SPACE = "? "; private static final String EXCLAMATION_MARK_SPACE = "! "; private static final String LINE_SEPARATOR = System.getProperty("line.separator"); private static final String COMMA_SPACE = ", "; private static final String JUST_A_SPACE = " "; public static ArrayList&lt;String&gt; splitUtteranceNaturalBreaks(String utterance) { final long then = System.nanoTime(); final ArrayList&lt;String&gt; speakableUtterances = new ArrayList&lt;String&gt;(); int splitLocation = 0; String success = null; while (utterance.length() &gt; MAX_UTTERANCE_LENGTH) { splitLocation = utterance.lastIndexOf(FULL_STOP_SPACE, MAX_UTTERANCE_LENGTH); if (DEBUG) { System.out.println("(0 FULL STOP) - last index at: " + splitLocation); } if (splitLocation &lt; MIN_UTTERANCE_LENGTH) { if (DEBUG) { System.out.println("(1 FULL STOP) - NOT_OK"); } splitLocation = utterance.lastIndexOf(QUESTION_MARK_SPACE, MAX_UTTERANCE_LENGTH); if (DEBUG) { System.out.println("(1 QUESTION MARK) - last index at: " + splitLocation); } if (splitLocation &lt; MIN_UTTERANCE_LENGTH) { if (DEBUG) { System.out.println("(2 QUESTION MARK) - NOT_OK"); } splitLocation = utterance.lastIndexOf(EXCLAMATION_MARK_SPACE, MAX_UTTERANCE_LENGTH); if (DEBUG) { System.out.println("(2 EXCLAMATION MARK) - last index at: " + splitLocation); } if (splitLocation &lt; MIN_UTTE…
score: 6
upvote count: 6
linked to: http://stackoverflow.com/q/10806037

http://stackoverflow.com/comment/35832281
comment on: http://stackoverflow.com/a/23389040
type: AnswerComment
type: Comment
score: 1
has text: This code does not care about the `JProgressBar`’s range. It uses the *same* variable for starting `times` number of threads and for waiting to reach *old progress value* `+times`.

http://stackoverflow.com/q/23344839
linked to: http://stackoverflow.com/q/15780978
has comment: http://stackoverflow.com/comment/35755897
has body: I have a problem with deploying a project created with maven. I make a clean project i try to deploy it with "mvn clean package jboss-as:deploy" immediately but i get this error: "The plugin 'org.apache.maven.plugins:maven-jboss-as-plugin' does not exist or no valid version could be found". It felt strange to me, beacuse the project is "clean". So i found this: The plugin 'org.apache.maven.plugins:maven-jboss-as-plugin' does not exist or no valid version could be found but then just another error appeared instead of the older. I have jboss 7.1.1, and jdk 6 (for some reason I couldn't get newer version), ubuntu 10.04.4 LTS 64-bit. I would appreciate some help //Edit: pom.xml: <?xml version="1.0" encoding="UTF-8"?> 4.0.0 pl.edu.agh.soa zad1h 1.0 pom zad1h application zad1h-ejb zad1h-web zad1h-ear <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <javaee6.web.spec.version>2.0.0.Final</javaee6.web.spec.version> <!-- <javaee6.web.spec.version>3.0.0.Beta1-redhat-1</javaee6.web.spec.version> --> pl.edu.agh.soa zad1h-ejb 1.0 ejb pl.edu.agh.soa zad1h-web 1.0 war compile org.jboss.spec jboss-javaee-web-6.0 ${javaee6.web.spec.version} pom import org.hibernate hibernate-validator 4.1.0.Final provided org.slf4j slf4j-api junit junit 4.10 jar test maven-compiler-plugin 2.3.2 1.6 1.6 org.jboss.as.plugins jboss-as-maven-plugin 7.1.0.Beta1b true true
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35751327
has title: Error when deploying project
tagged with: maven
has answer: http://stackoverflow.com/a/23345600
has answer: http://stackoverflow.com/a/23348139
has comment: http://stackoverflow.com/comment/35752003
tagged with: java
tagged with: jboss
type: Question
answer count: 2
score: 0

http://stackoverflow.com/q/23296794
tagged with: android
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35665770
has comment: http://stackoverflow.com/comment/35662902
score: 0
tagged with: android-sqlite
has comment: http://stackoverflow.com/comment/35665733
type: Question
has comment: http://stackoverflow.com/comment/35662903
has title: Error trying to open assets/database.db
tagged with: java
has answer: http://stackoverflow.com/a/23298868
has body: I am trying to attach a database - prepopulated with information to my application. I followed this tutorial here however when I try to run through my database helper I am getting an error. Here is my helper code: import android.content.Context; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteException; import android.database.sqlite.SQLiteOpenHelper; import android.util.Log; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; public class WorkoutsDatabaseHelper extends SQLiteOpenHelper { private String DATABASE_PATH = "/src/main/assets/"; // All Static variables // Database Version private static final int DATABASE_VERSION = 1; // Database Name private static final String DATABASE_NAME = "workoutsDatabase.db"; // Workouts table name private static final String TABLE_WORKOUTS = "workouts"; // Workouts Table Columns names private static final String KEY_ID = "_id"; private static final String KEY_WORKOUT_NAME = "workout_name"; private static final String KEY_HERO_LAST_NAME = "hero_last_name"; private static final String KEY_HERO_FIRST_NAME = "hero_first_name"; private static final String KEY_HERO_MIDDLE_NAME = "hero_middle_name"; private static final String KEY_HERO_DESCRIPTION = "hero_description"; private static final String KEY_DATE_ADDED = "date_added"; private static final String KEY_WORKOUT = "workout"; private static final String KEY_MEASUREMENT = "measurement"; private static final String KEY_PHOTO = "photo"; private SQLiteDatabase myDatabase; private final Context myContext; public WorkoutsDatabaseHelper(Context context) { super(context, DATABASE_NAME, null, DATABASE_VERSION); this.myContext = context; } // Creates a empty database on the system and rewrites it with your own database. public void createDatabase() throws IOException { boolean dbExist = checkDatabase(); if(dbExist) { // Do nothing - database already exist } else { //By calling this method an e…
has comment: http://stackoverflow.com/comment/35664314
tagged with: sqlite
answer count: 1
accepted answer: http://stackoverflow.com/a/23298868

http://stackoverflow.com/comment/35690889
score: 0
has text: Didn't work out for some reason. It doesn't give an error during run or anything, but the combobox still doesn't update.
type: AnswerComment
comment on: http://stackoverflow.com/a/23299317
type: Comment

http://stackoverflow.com/q/23418314
linked to: http://stackoverflow.com/q/5592806
linked to: http://stackoverflow.com/q/16608524
type: AnsweredQuestion
tagged with: java
tagged with: eclipse
type: Question
has comment: http://stackoverflow.com/comment/35887082
answer count: 2
has comment: http://stackoverflow.com/comment/35887035
has answer: http://stackoverflow.com/a/23420301
has comment: http://stackoverflow.com/comment/35887480
has comment: http://stackoverflow.com/comment/35887375
score: 0
tagged with: android
has comment: http://stackoverflow.com/comment/35887054
has body: I am trying to compile my android app that I am crating by following the google tutorial at https://developer.android.com/training/index.html I have run into a problem where I get the error "R cannot be resolved to a variable" I followed the suggestions from the other threads such as cleaning/rebuiding, removing all import android.R, and reinstalling my Android SDK Build-tools for every version Here is a copy of the tutorial project with the issue MyFirstApp.zip I have taken the suggestions found in other threads, but their solutions have been unsuccessful.1 2 3 4 Please help! Please let me know if there is any other information you need to fix this issue.
has answer: http://stackoverflow.com/a/23421367
accepted answer: http://stackoverflow.com/a/23421367
linked to: http://stackoverflow.com/q/2757107
linked to: http://stackoverflow.com/q/14001974
possible better answer: http://stackoverflow.com/a/23420301
has title: R cannot be resolved to a variable, usual fix doesn't seem to work
linked to: http://stackoverflow.com/q/885009
has comment: http://stackoverflow.com/comment/35887241

http://stackoverflow.com/q/23409095
type: AnsweredQuestion
score: 1
has comment: http://stackoverflow.com/comment/35869260
tagged with: java
has comment: http://stackoverflow.com/comment/35869551
has comment: http://stackoverflow.com/comment/35869269
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/23409662
has body: I implemented the equal’s method in my Person object with the @annotation, however, when I create an object in my main class and check it against my List of Person objects, it doesn’t return the correct index. It says they are both at 1, but it should be 1 and 3. Objective: Check to see if “Andy Bernard” exists in my list and if so, display the index of the objects. import java.util.ArrayList; import java.util.List; public class Person { private String firstName; private String lastName; public Person(String firstName,String lastName) { this.firstName = firstName; this.lastName = lastName; } 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; } @Override public String toString() { return String.format(this.firstName + " " + this.lastName); } @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((firstName == null) ? 0 : firstName.hashCode()); result = prime * result + ((lastName == null) ? 0 : lastName.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; Person other = (Person) obj; if (firstName == null) { if (other.firstName != null) return false; } else if (!firstName.equals(other.firstName)) return false; if (lastName == null) { if (other.lastName != null) return false; } else if (!lastName.equals(other.lastName)) return false; return true; } private static List&lt;Person&gt; deletePeople = new ArrayList&lt;&gt;(); public static void main(String[] args) { addPerson("Micheal","Scott"); addPerson("Andy","Bernard"); addPerson("Micheal","Scott"); addPerson("Andy","Bernard"); display(); } public static void addPerson(String firstname, String lastname) { Person createPerson = new Person(firstname,lastname)…
upvote count: 1
has title: Java: Why Doesn’t My Equals Method Work?
favorite count: 0
downvote count: 0
has answer: http://stackoverflow.com/a/23409662
has answer: http://stackoverflow.com/a/23409137
accepted answer: http://stackoverflow.com/a/23409137
tagged with: collections
has comment: http://stackoverflow.com/comment/35869357

http://stackoverflow.com/comment/35746129
type: Comment
score: 0
has text: @Alexander_Winter: this would split up the `beta-lipoic` from the `acid` which has to be one element. But indeed, just three spaces won't work, since the String is splitted by some spaces and tabs...
comment on: http://stackoverflow.com/a/23342401
type: AnswerComment

http://stackoverflow.com/comment/35897899
type: AnswerComment
type: Comment
has text: I have used Liferay with CAS and the integration was ok and easy. You can have a look in this blog where explain every step:http://www.liferay.com/es/web/azar7k1s/blog/-/blogs/sso-via-cas-in-liferay
score: 1
comment on: http://stackoverflow.com/a/23390348

http://stackoverflow.com/a/23386275
upvote count: 0
has body: Folks try this one i guess it will work for you ***********This is class one "Person"********* public class Person { String name; String surname; String country; int age; public Person(String name, String surname, String country, int age) { this.name = name; this.surname = surname; this.country = country; this.age = age; } } ********This is main class******* public class mainclass { public static void main(String arg[]) { Person person1 = new Person("Abel", "Smith", "EEUU", 26); Person person2 = new Person("Alexa", "Williams", "Canada", 30); Person person3 = new Person("Abel", "Smith", "EEUU", 26); Person person4 = new Person("Alexa", "Williams", "EEUU", 30); System.out.println(samePerson(person1,person2)); System.out.println(samePerson(person1,person3)); System.out.println(samePerson(person2,person4)); System.out.println(samePerson(person3,person4)); System.out.println(samePerson(person1,person4)); } static boolean samePerson(Person personA,Person personB) { if(personA.name.equals(personB.name) &amp;&amp; personA.country.equals(personB.country)&amp;&amp; personA.surname.equals(personB.surname )&amp;&amp; personA.age==personB.age ) return true; else return false; } } Thanks and Regards.
answers question: http://stackoverflow.com/q/23385182
type: Answer
downvote count: 2
score: -2

http://stackoverflow.com/comment/35923202
type: AnswerComment
type: Comment
has text: So you provided the V array, what was the S array ? And did you call pack with s = 15 or 16 ?
comment on: http://stackoverflow.com/a/23437590
score: 0

http://stackoverflow.com/comment/35923759
comment on: http://stackoverflow.com/a/23437891
type: AnswerComment
has text: The first method (creating an anonymous class) works for abstract classes as well as for interfaces. (But lambdas don't.)
type: Comment
score: 1

http://stackoverflow.com/a/23457957
upvote count: 4
downvote count: 0
score: 4
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23446603
type: Answer
has body: I found out the problem, thanks to this reply by Joe Bowser (https://twitter.com/infil00p/status/462639837149798400). The problem here is the Aviary and Phonegap are both using the Lcom/squareup/okhttp framework, so I had to delete the okhttp framework from the CordovaLib directory, and re-run the project.
answers question: http://stackoverflow.com/q/23446603
has comment: http://stackoverflow.com/comment/47902425

http://stackoverflow.com/q/23447682
type: Question
possible better answer: http://stackoverflow.com/a/23447808
has answer: http://stackoverflow.com/a/23447808
score: 1
tagged with: java
tagged with: comparison
has comment: http://stackoverflow.com/comment/35941620
has comment: http://stackoverflow.com/comment/35940997
has answer: http://stackoverflow.com/a/23447848
answer count: 3
has answer: http://stackoverflow.com/a/23448501
tagged with: string-comparison
downvote count: 0
has title: String Comparison Using Nested Loops
has comment: http://stackoverflow.com/comment/35941143
accepted answer: http://stackoverflow.com/a/23447848
favorite count: 0
has body: I'm following this online Java course, after every session there is few assignments, and I can't seem to solve this one. I know that's not the point of an exercise, but I tried everything and I can't see any other way. Write a program that returns number of occurrences of a string in another string. For example: Input: First String: the Second String: the students are working hard in the faculty of Engineering because **the**y love it Output: 3 Note: You should use nested loops. Don’t use some methods like indexOf or substring This is my code so far, I know it's not complete, and I'm pretty sure most of this decisions statements aren't needed. Edit: This is a C# code, I was testing on both Java and C# String Text1 = Console.ReadLine(); String Text2 = Console.ReadLine(); int counter = 0; for (int y = 0; y &lt; Text1.Length; y++) { for (int x = 0; x &lt; Text2.Length; x++) { if (Text1[y] == Text2[x]) { if (y + 1 &lt; Text1.Length &amp;&amp; x + 1 &lt; Text2.Length) { if (Text1[y + 1] == Text2[x + 1]) { } } } } }
has comment: http://stackoverflow.com/comment/35940998
has comment: http://stackoverflow.com/comment/35941019
has comment: http://stackoverflow.com/comment/35941139
type: AnsweredQuestion
tagged with: loops
upvote count: 1

http://stackoverflow.com/a/23298967
has comment: http://stackoverflow.com/comment/35750965
has body: android:onClick="sendMessage" button onClick attribute search the corresponding method in the Activity. but you define that method in the Fragment that's why you get the exception method could not find exception. Android Recommended way to do handle the onClick for button inside the fragment is First Assign id to Button &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="horizontal"&gt; &lt;EditText android:id="@+id/edit_message" android:layout_weight="1" android:layout_width="0dp" android:layout_height="wrap_content" android:hint="@string/edit_message" /&gt; &lt;Button android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/button_send" /&gt; &lt;/LinearLayout&gt; your Fragment then register the button with onClick listener /** * A placeholder fragment containing a simple view. */ public static class PlaceholderFragment extends Fragment implements OnItemClickListener{ public PlaceholderFragment() { } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_main, container, false); Button b = (Button) rootView.findViewById(R.id.button1); b.setOnClickListener(this); return rootView; } /** Called when the user clicks the Send button */ public void sendMessage(View view) { Intent intent = new Intent(getActivity(), DisplayMessageActivity.class); EditText editText = (EditText)getActivity(). findViewById(R.id.edit_message); String message = editText.getText().toString(); intent.putExtra(EXTRA_MESSAGE, message); startActivity(intent); } public void onClick(View view) { sendMessage(view); } }
answers question: http://stackoverflow.com/q/23298045
type: Answer
score: 0

http://stackoverflow.com/comment/35835280
type: AnswerComment
comment on: http://stackoverflow.com/a/23380591
type: Comment
score: 0
has text: Please try again with `act.moveToElement(tab).moveToElement(link).click(link).build().perform();` In this, I added `build()` method.

http://stackoverflow.com/a/23420064
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/35891447
has body: It simply isn't possible to provide API access to the cell for a given item. Not every item has a cell associated with it. On top of that, the item which is represented by a cell may change at any time, so even if you could provide access to the cell, the API would potentially be very confusing. The basic trick to anything like this is to create a cell factory, and register the appropriate listeners with the cell. Your case is somewhat tricky, but possible. The following works to get the cell representing the selected item (you may want to modify the code somewhat to deal with the case where the cell is scrolled off the screen). (Note that I used the Z key, arbitrarily, as I don't have a ContextMenu key on my laptop.) import javafx.application.Application; import javafx.beans.property.ObjectProperty; import javafx.beans.property.SimpleObjectProperty; import javafx.beans.value.ChangeListener; import javafx.geometry.Bounds; import javafx.geometry.Point2D; import javafx.scene.Node; import javafx.scene.Scene; import javafx.scene.control.ContextMenu; import javafx.scene.control.MenuItem; import javafx.scene.control.TreeCell; import javafx.scene.control.TreeItem; import javafx.scene.control.TreeView; import javafx.scene.input.KeyCode; import javafx.scene.layout.BorderPane; import javafx.stage.Stage; public class Main extends Application { @Override public void start(Stage primaryStage) { try { BorderPane root = new BorderPane(); TreeView&lt;String&gt; treeView = new TreeView&lt;&gt;(); TreeItem&lt;String&gt; treeRoot = new TreeItem&lt;&gt;("Root"); for (int i=1; i&lt;=5; i++) { TreeItem&lt;String&gt; child = new TreeItem&lt;&gt;("Item "+i); child.getChildren().addAll(new TreeItem&lt;&gt;("Item "+i+"A"), new TreeItem&lt;&gt;("Item "+i+"B")); treeRoot.getChildren().add(child); } treeView.setRoot(treeRoot); root.setCenter(treeView); ObjectProperty&lt;TreeCell&lt;String&gt;&gt; selectedCell = new SimpleObjectProperty&lt;&gt;(); treeView.setCellFactory(tree -&gt; { TreeCell&lt…
accepted answer of: http://stackoverflow.com/q/23419201
upvote count: 2
answers question: http://stackoverflow.com/q/23419201

http://stackoverflow.com/comment/35760635
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23350271
score: 1
has text: No. It is still a local variable (with invalid modifier) and not a field of the class. You might want to take a look into some Java books or tutorials for a better understanding of the difference.

http://stackoverflow.com/comment/36104684
comment on: http://stackoverflow.com/a/23422144
type: AnswerComment
type: Comment
has text: Hi Zero, when you are free, just let me have working sample code please.
score: 1

http://stackoverflow.com/q/23320192
tagged with: java
tagged with: jaxb
upvote count: 1
tagged with: marshalling
type: Question
linked to: http://stackoverflow.com/q/21387170
has title: Error in marshalling Java to Xml
downvote count: 0
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/35708244
type: UnansweredQuestion
has body: I have an xsd. In xsd there is a canvas which contains lot of widgets, rows &amp; columns. canvas could be a widget. So inside canvas many widget and canvas exist. My xsd is:::: &lt;xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.cms.indiatimes.com/Canvas" xmlns:tns="http://www.cms.indiatimes.com/Canvas" elementFormDefault="qualified"&gt; &lt;xsd:element name="canvas"&gt; &lt;xsd:complexType&gt; &lt;xsd:complexContent&gt; &lt;xsd:extension base="tns:widgetEntry"&gt; &lt;xsd:sequence&gt; &lt;xsd:element name="widget" type="tns:widgetEntry" minOccurs="0" maxOccurs="unbounded" /&gt; &lt;xsd:element name="row" type="xsd:integer" minOccurs="1" maxOccurs="1" /&gt; &lt;xsd:element name="column" type="xsd:integer" minOccurs="1" maxOccurs="1" /&gt; &lt;/xsd:sequence&gt; &lt;/xsd:extension&gt; &lt;/xsd:complexContent&gt; &lt;/xsd:complexType&gt; &lt;/xsd:element&gt; &lt;xsd:complexType name="widgetEntry"&gt; &lt;xsd:sequence&gt; &lt;xsd:element name="ID" type="xsd:int" minOccurs="1" maxOccurs="1" /&gt; &lt;xsd:element name="templateName" type="xsd:string" minOccurs="0" maxOccurs="1" /&gt; &lt;xsd:element name="cacheTime" type="xsd:integer" minOccurs="1" maxOccurs="1" /&gt; &lt;xsd:element name="parameter" type="tns:parameter" minOccurs="0" maxOccurs="unbounded" /&gt; &lt;xsd:element name="visible" type="xsd:boolean" default="false" /&gt; &lt;xsd:element name="canvasSet" type="xsd:boolean" default="false"&gt; &lt;xsd:annotation&gt; &lt;xsd:documentation xml:lang="en"&gt; indicates if the widget is also a canvas. &lt;/xsd:documentation&gt; &lt;/xsd:annotation&gt; &lt;/xsd:element&gt; &lt;xsd:element name="position" type="tns:position" minOccurs="0" maxOccurs="1" /&gt; &lt;/xsd:sequence&gt; &lt;/xsd:complexType&gt; &lt;xsd:complexType name="parameter"&gt; &lt;xsd:annotation&gt; &lt;xsd:documentation xml:lang="en"&gt; The parameter contains a name, a type and a value.Based upon type, the value will need to be converted into the java type. &lt;/…
tagged with: http://stackoverflow.com/tag/xml
answer count: 0

http://stackoverflow.com/q/23312183
type: AnsweredQuestion
has body: I have a REST service which is running on Tomcat with address localhost:8080/Pets/REST/WebService/GetFeeds. I want to use this URL on my Android app. What should I do to use it instead of localhost?
tagged with: java
has answer: http://stackoverflow.com/a/23312191
type: Question
score: 0
upvote count: 1
answer count: 1
tagged with: tomcat
favorite count: 0
tagged with: web-services
downvote count: 1
has title: What address should use to connect RestService?
accepted answer: http://stackoverflow.com/a/23312191

http://stackoverflow.com/comment/35858677
has text: and `GenericLinkedList[]` would be even better
comment on: http://stackoverflow.com/a/23357114
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/35853008
has text: @JediOfTheGrey I've posted as an answer, please accept this to close the question.
comment on: http://stackoverflow.com/q/23398450
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23481290
upvote count: 1
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/23450686
has body: So basically it sounds like you're considering an abstraction layer to simplify output of non-D3 formats. If that's the case, then the value of such a layer depends heavily on your expectations for the future of this code. If you know you're going to be implementing non-D3 solutions in the future, then it makes sense to separate the general purpose "chart" logic from the specific "D3 chart" logic, since the two operate independently of each other. On the other hand, if you suspect you might someday implement a non-D3 version, but have no immediate plans to, then I'd think the YAGNI (you ain't going to need it) principle applies. In other words, you should code whatever is best for the task at hand (ie. no abstraction layer) and then refactor one out whenever it actually comes time to implement a non-D3 chart.
type: Answer

http://stackoverflow.com/comment/37072439
comment on: http://stackoverflow.com/a/23348356
type: Comment
has text: i understand now, `Thread` class is for learning, i am ok with that, thank you very much for your answers. i will be glad to help you as well if i can :)
type: AnswerComment
score: 0

http://stackoverflow.com/comment/35660965
type: Comment
has text: @user2424380 I have used the answer in the link you gave to explore all the possible outcomes for 1 2 3
score: 1
comment on: http://stackoverflow.com/a/23292532
type: AnswerComment

http://stackoverflow.com/a/23339590
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23326472
answers question: http://stackoverflow.com/q/23326472
has body: Set the dataType="local" to the sjg:grid and remove href attribute. Then provide row data from the array. For example &lt;sjg:grid id="gridtable" caption="Example (Editable/Multiselect)" dataType="local" pager="true" navigator="true" navigatorSearchOptions="{sopt:['eq','ne','lt','gt']}" navigatorAddOptions="{height:280, width:500, reloadAfterSubmit:true}" navigatorEditOptions="{height:280, width:500, reloadAfterSubmit:false}" navigatorEdit="true" navigatorView="true" navigatorViewOptions="{height:280, width:500}" navigatorDelete="true" navigatorDeleteOptions="{height:280, width:500,reloadAfterSubmit:true}" gridModel="gridModel" rowList="5,10,15" rowNum="5" rownumbers="true" editurl="%{editurl}" editinline="true" multiselect="true" onSelectRowTopics="rowselect" &gt; &lt;sjg:gridColumn name="id" index="id" title="Id" formatter="integer" editable="false" sortable="true" search="true" sorttype="integer" searchoptions="{sopt:['eq','ne','lt','gt']}"/&gt; &lt;sjg:gridColumn name="name" index="name" key="true" title="Country Name" editable="true" edittype="text" sortable="true" search="true" sorttype="text"/&gt; &lt;/sjg:grid&gt; &lt;script type="text/javascript"&gt; $(document).ready(function(){ var mydata = [{id:"1",name:"Roman C"}]; //for(var i=0;i&lt;=mydata.length;i++) $("#gridtable").jqGrid('addRowData',i+1,mydata[i]); $("#gridtable").jqGrid('setGridParam', { data: mydata }).trigger("reloadGrid"); }); &lt;/script&gt;
upvote count: 3
type: AcceptedAnswer
type: Answer
score: 3

http://stackoverflow.com/q/23307737
has body: I am new in java .I am developing an app in java to transfer a large number of files to server.The requirement is to check the status of failed file and store somewhere and transfer those files later.The application should be maintain a daemon process. Thanks and Regard sanjeet
score: 0
has answer: http://stackoverflow.com/a/23307936
has comment: http://stackoverflow.com/comment/35682600
answer count: 1
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35682533
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/35682491
downvote count: 1
type: Question
has title: how to maintain status of failed file

http://stackoverflow.com/q/23439755
has answer: http://stackoverflow.com/a/23440105
answer count: 1
has body: I am trying to login to SAP CE server using java code. I am getting error: HTTP status code 500 What am I doing wrong ? public class GetExample { public static void main(String[] args)throws Exception { GetExample getExample = new GetExample(); URL gatewayServiceUrl = new URL("http://192.168.55.12:56400/nwa"); HttpURLConnection connection = (HttpURLConnection) gatewayServiceUrl.openConnection(); connection.setRequestMethod("GET"); connection.setRequestProperty("Authorization", getExample.getBasicAuth()); connection.connect(); if (HttpURLConnection.HTTP_OK == connection.getResponseCode()) { System.out.println("success"); System.out.println(getExample.getDataFromStream(connection.getInputStream())); } else { System.out.println("success"); System.out.println(getExample.getDataFromStream(connection.getErrorStream())); } System.out.println(connection.getResponseCode()); } private String getBasicAuth() { String userpass = "bpm-vikask" + ":" + "Init-12345"; return "Basic " + javax.xml.bind.DatatypeConverter.printBase64Binary(userpass .getBytes()); } private String getDataFromStream(InputStream stream) throws IOException { StringBuffer dataBuffer = new StringBuffer(); BufferedReader inStream = new BufferedReader(new InputStreamReader( stream)); String data = ""; while ((data = inStream.readLine()) != null) { dataBuffer.append(data); } inStream.close(); return dataBuffer.toString(); } }
type: UnansweredQuestion
has title: HTTP get to AS is giving 500 error during login
tagged with: java
tagged with: http
type: Question
tagged with: netweaver
tagged with: get
score: 0

http://stackoverflow.com/comment/35905813
has text: So, `upgrade()` is a method in `Tower`, but you want this method to behave differently in subclasses, right? How are you using this method anyway? If you are passing a specific class that you don't get dynamically, then there is probably no point in dealing with generics, you could just have separate methods.
comment on: http://stackoverflow.com/q/23428743
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35805102
comment on: http://stackoverflow.com/a/23374171
type: AnswerComment
score: 0
has text: Yeah so you make an edit change. You dont downvote it.
type: Comment

http://stackoverflow.com/q/23426972
tagged with: sorting
accepted answer: http://stackoverflow.com/a/23427123
tagged with: arraylist
score: 0
has comment: http://stackoverflow.com/comment/35902840
tagged with: android
has comment: http://stackoverflow.com/comment/35902450
favorite count: 0
linked to: http://stackoverflow.com/q/2709253
has comment: http://stackoverflow.com/comment/35904027
possible better answer: http://stackoverflow.com/a/23427019
upvote count: 1
has body: I am sorting my array list int items by using "compareTo(String string);" this method comparing only string but not int values.How I can sort my array list based on integer value. Here is my code : Collections.sort(mAllSpeedsArray, new AllSpeedsComparator()); public class AllSpeedsComparator implements Comparator&lt;AllSpeeds&gt; { @Override public int compare(AllSpeeds lhs, AllSpeeds rhs) { // TODO Auto-generated method stub return lhs.getSpeed().compareTo(rhs.getSpeed()); } }
downvote count: 1
has answer: http://stackoverflow.com/a/23427019
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35902417
has comment: http://stackoverflow.com/comment/35903387
tagged with: java
has title: How to sort arrayList according to Integer size in android?
type: Question
tagged with: comparator
answer count: 2
has answer: http://stackoverflow.com/a/23427123

http://stackoverflow.com/a/23424127
score: 0
type: AcceptedAnswer
has body: In the method cityMatrix() you are using customerMatrix and cityMatrix. Is that just a typo? Try this method: public double[][] cityMatrix() { double[][] cityMatrix = new double[FileReader.cities.size()][2]; for (int i = 0; i &lt; FileReader.cities.size(); i++){ City c = FileReader.cities.get(i); cityMatrix[i][0] = c.getX(); cityMatrix[i][1] = c.getY(); } return cityMatrix; }
has comment: http://stackoverflow.com/comment/35900385
type: Answer
accepted answer of: http://stackoverflow.com/q/23420313
has comment: http://stackoverflow.com/comment/35901921
answers question: http://stackoverflow.com/q/23420313
has comment: http://stackoverflow.com/comment/35898923
has comment: http://stackoverflow.com/comment/35899497

http://stackoverflow.com/comment/35822201
type: QuestionComment
comment on: http://stackoverflow.com/q/23312518
has text: Why don't you on the Java side convert the string's \U with \u?
score: 0
type: Comment

http://stackoverflow.com/comment/35880156
comment on: http://stackoverflow.com/q/23414834
type: Comment
type: QuestionComment
score: 1
has text: Please format your code properly. It hurts to read it as is.

http://stackoverflow.com/comment/35922864
has text: I added what the output should be and yes the code is compiling successfully.
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23435365
type: Comment

currency
tag name: currency
type: Tag
tags question: http://stackoverflow.com/q/23418100

http://stackoverflow.com/comment/35829134
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23387616
has text: The problem is that the exception still occurs even though I changed the source of it. There's no reference to that path in my code but I still get the java.io.exception. If I just remove the whole TestClass there's no exception.
score: 0

http://stackoverflow.com/q/23403555
has body: I'm having problem with adding another JPanel to my frame when I'm using combobox. I want to change the center panel according to the selection in combobox. I made differehnt panel to all selections but it didn't add to my main panel. I added the code. thanks :) import AllClasses.FlightCompany; { public class WorkerDialog extends JFrame { private JPanel Worker; private String[] LabelNames = { "Worker Type:", " Worker Name:" }; String [] str = { "Office", "Host", "Pilot" }; JComboBox&lt;String&gt; ChooseBox = new JComboBox&lt;&gt;(str); public JPanel MainPanel; private JPanel [] p= new JPanel[3]; public WorkerDialog(FlightCompany f) { super("Worker Dialog"); p[0] = new Office_Gui(); p[1] = new Host_Gui(); p[2] = new Pilot_Gui(); Worker = new JPanel(new FlowLayout(FlowLayout.LEFT, 5, 5)); JLabel LabelName = new JLabel(LabelNames[0]); JLabel LabelName2 = new JLabel(LabelNames[1]); JTextField fieldBox = new JTextField(); LabelName.setSize(40, 25); ChooseBox.setPreferredSize(new Dimension(180, 22)); Worker.add(LabelName); Worker.add(ChooseBox); Worker.add(LabelName2); fieldBox.setPreferredSize(new Dimension(180, 22)); Worker.add(fieldBox); JPanel AddPanel = new JPanel(new GridLayout(2, 1, 1, 1)); AddPanel.add(new JButton("Add")); AddPanel.add(new JButton("TakeOff")); MainPanel = new JPanel(new BorderLayout(3, 3)); AddPanel.setPreferredSize(new Dimension(0, 110)); ChooseBox.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { // TODO Auto-generated method stub //String str = e.getActionCommand(); String jb = (String) ChooseBox.getSelectedItem(); if (jb.equals("Office")){ MainPanel.add(p[0],BorderLayout.CENTER); System.out.println("Office");} } }); MainPanel.add(Worker, BorderLayout.NORTH); MainPanel.add(AddPanel, BorderLayout.SOUTH); add(MainPanel); //pack(); setSize(560, 300); setAlwaysOnTop(true); setDefaultCloseOperation(EXIT_ON_CLOSE); setLocationRelativeTo(null); setResizable(false); setVisible(true);
tagged with: jcombobox
has answer: http://stackoverflow.com/a/23403759
type: UnansweredQuestion
tagged with: swing
linked to: http://stackoverflow.com/q/21459718
tagged with: java
tagged with: jpanel
type: Question
answer count: 1
has title: Ad selected panel throw JCombobox
score: 0

http://stackoverflow.com/comment/35660924
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/23295899
has text: In what line are you getting the NullPointerException? Please post the stack trace.

http://stackoverflow.com/comment/35859789
type: Comment
has text: whilst I was, and still am convinced something like this is the right approach, when using it I just get 404 errors when trying to view localhost:7004 with the conext-root set to /appName/apps/. when it's set to / the website will only load when /appName/apps/ is included as part of the URL.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23397711

http://stackoverflow.com/q/23339595
has answer: http://stackoverflow.com/a/23339770
answer count: 5
has answer: http://stackoverflow.com/a/57966466
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35741439
has answer: http://stackoverflow.com/a/30779608
has title: How to set java version in JBoss 7?
has comment: http://stackoverflow.com/comment/35740530
tagged with: java
tagged with: jboss
type: Question
has comment: http://stackoverflow.com/comment/102344166
score: 15
has answer: http://stackoverflow.com/a/33342162
has body: I've got machine which is using 2 versions of java(for eg. 6-th and 7-th). If I will run java -version, the system will say it's 6-th. Is there an approach to set another java version for JBoss only?
upvote count: 15
downvote count: 0
has answer: http://stackoverflow.com/a/43471518
favorite count: 0
linked to: http://stackoverflow.com/q/13570686

http://stackoverflow.com/comment/35859017
comment on: http://stackoverflow.com/q/23403764
score: 0
type: Comment
type: QuestionComment
has text: possible that link may be a different one. Here i am using spring framework, firstly i am forwarding my request to the controller later on to the sevlet page. And i dont need any response from the controller.

http://stackoverflow.com/comment/35755709
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23347529
has text: Prasad: there is no form:form tag? Currently all I am doing is declaring some products in the servlet and then attempting to display them on the page
score: 0

http://stackoverflow.com/comment/35880312
type: Comment
comment on: http://stackoverflow.com/a/23412957
type: AnswerComment
has text: `setAttribute(key,value)` set a value as attribute against key and in another servlet get it using `value = getAttribut(key)` where key is same in both the servlet.
score: 0

http://stackoverflow.com/comment/35890910
score: 0
has text: Also, do `getDownloadCompleteState()` and `onPostExecute()` HAVE to take `ArrayList<Object>` as their arguments?
comment on: http://stackoverflow.com/q/23420002
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35654316
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23292014
has text: @Raedwald Yes that's what I mean.
score: 0

http://stackoverflow.com/comment/35774250
score: 0
type: Comment
type: QuestionComment
has text: you may use JGraph in order to build the graph from the XML containing the data; then on the created graph you can use all the JGraph algorithms
comment on: http://stackoverflow.com/q/23357916

http://stackoverflow.com/comment/35675959
type: QuestionComment
has text: When you construct the contained ArrayList, set its capacity...or initialize it with x objects
comment on: http://stackoverflow.com/q/23303635
score: 0
type: Comment

http://stackoverflow.com/comment/35840852
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/23394012
type: Comment
has text: Great String prova4 = prova3.replaceAll("\\],\\[", "\\] \\["); is the solution. But do u think that my code is "beautiful"? Or is there the possibility to do it better?

http://stackoverflow.com/a/23444117
answers question: http://stackoverflow.com/q/23444004
has comment: http://stackoverflow.com/comment/35940221
upvote count: 1
has comment: http://stackoverflow.com/comment/35954929
has comment: http://stackoverflow.com/comment/35957556
has comment: http://stackoverflow.com/comment/35956945
has comment: http://stackoverflow.com/comment/35967715
has comment: http://stackoverflow.com/comment/35956523
downvote count: 0
has comment: http://stackoverflow.com/comment/35939721
has comment: http://stackoverflow.com/comment/35957092
has comment: http://stackoverflow.com/comment/35957169
type: Answer
has body: You're creating the Registry with SSL socket factories but you're not supplying a socket factory to getRegistry().
has comment: http://stackoverflow.com/comment/35955715
score: 1
has comment: http://stackoverflow.com/comment/35940818

http://stackoverflow.com/a/23310679
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23310633
type: Answer
answers question: http://stackoverflow.com/q/23310633
upvote count: 4
has body: By definition, a final variable can only be assigned once. And static fields of a class are initialized when the class is loaded. So obviously, the IN Quart instance is created just once.
score: 4

http://stackoverflow.com/q/23318661
has comment: http://stackoverflow.com/comment/35702674
score: 2
downvote count: 0
tagged with: java
linked to: http://stackoverflow.com/q/4225164
has comment: http://stackoverflow.com/comment/35702813
has title: Problems with projectiles on a 2d plane
has answer: http://stackoverflow.com/a/23330214
type: Question
tagged with: libgdx
has comment: http://stackoverflow.com/comment/35702871
upvote count: 2
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/35702911
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35702749
has body: I'm having trouble getting my bullets to go where they want and I was hoping I could get some help identifying where my calculations are off. Basically I'm making a 2d game and where ever you click on the screen a bullet should shoot at that location that you clicked, but the problem is that my bullets are not going where I want them to. Now I believe my problem is somewhere in the checkScreenForTouch() method and how I'm calculating what should be added to the bullets location. I'm not the best at trigonometry but I do understand it, so if any one has any advice on how to fix the following code that would be super cool :). private void updateBullets(float dt){ batch.begin(); for(int i = 0; i &lt; bullets.size(); i++){ Bullet b = bullets.get(i); b.velocity.x += b.deltaX * b.speed; b.velocity.y += b.deltaY * b.speed; b.position.x += b.velocity.x * dt; b.position.y += b.velocity.y * dt; batch.draw(bullTex, b.position.x, b.position.y, bullTex.getWidth(), bullTex.getHeight()); if(b.position.x &lt; 0 || b.position.x &gt; sWidth || b.position.y &lt; 0 || b.position.y &gt; sHeight){ bullets.remove(b); continue; } } batch.end(); } private void checkForScreenTouch(float dt){ if(Gdx.input.isTouched()){ Bullet b = new Bullet(); double angle = Math.atan((p.pos.y - Gdx.input.getY())/(p.pos.x - Gdx.input.getX())); b.deltaX = Math.cos(angle); b.deltaY = Math.sin(angle); b.position.x = p.pos.x; //sets bullet start position equal to the players b.position.y = p.pos.y; bullets.add(b); // array list of bullets } } If you need anything clarified just let me know. Thanks.

http://stackoverflow.com/comment/35961398
comment on: http://stackoverflow.com/a/23427006
type: AnswerComment
score: 0
type: Comment
has text: The error was about `spa.amount`, not `spa.id` or `obj.fieldName`.

http://stackoverflow.com/q/23299993
tagged with: graphics
has answer: http://stackoverflow.com/a/23300128
answer count: 2
tagged with: canvas
tagged with: awt
score: 0
possible better answer: http://stackoverflow.com/a/23300128
has answer: http://stackoverflow.com/a/23300049
accepted answer: http://stackoverflow.com/a/23300049
tagged with: swing
type: AnsweredQuestion
has body: I am new to Java and I have a problem with drawing an oval using paintComponent method. I found many similar threads, but none of the soultions worked. My code: RacerMain.java import javax.swing.*; import java.awt.*; public class RacerMain { public static void main (String[]args) { //MainFrame mf = new MainFrame(); JFrame jframe = new JFrame(); JPanel jpanel = new JPanel(); jframe.setSize(480,640); jframe.add(jpanel); jframe.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); jpanel.add(new Dot()); jframe.setVisible(true); } } Dot.java import java.awt.*; import javax.swing.*; public class Dot extends JComponent{ @Override public void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2d = (Graphics2D)g; g2d.setColor(Color.BLUE); g2d.fillOval(20, 20, 20, 20); } } Why it does not work and how to get this code working?
tagged with: java
has title: Drawing oval in canvas using swing
type: Question

http://stackoverflow.com/comment/107330011
has text: i am gettig the same error but my app is working just fine , no crash no abnormal behavior nothing , so should i bother to remove that error
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/37562940

http://stackoverflow.com/comment/35934950
comment on: http://stackoverflow.com/q/23442621
type: Comment
type: QuestionComment
score: 0
has text: Yes I'm using the newest ant version. I'll just use jdk 1.7 as I posted in the answer.

http://stackoverflow.com/q/23310474
type: Question
has answer: http://stackoverflow.com/a/39115355
has answer: http://stackoverflow.com/a/29794690
has answer: http://stackoverflow.com/a/39086249
has answer: http://stackoverflow.com/a/23701738
score: 45
has answer: http://stackoverflow.com/a/57707406
downvote count: 0
upvote count: 45
has body: I am new for Maven ..I am trying to create maven project for springMVC+Hiberante but I am getting lot of errors..can any one slove my problem please check my pom.xml for below <?xml version="1.0" encoding="UTF-8"?> 4.0.0 Spring3HibernateMaven Spring3HibernateMaven war 0.0.1-SNAPSHOT maven-compiler-plugin 2.3.2 1.5 1.5 javax.servlet servlet-api 2.5 org.springframework spring-beans ${org.springframework.version} org.springframework spring-jdbc ${org.springframework.version} org.springframework spring-web ${org.springframework.version} org.springframework spring-webmvc ${org.springframework.version} org.springframework spring-orm ${org.springframework.version} org.hibernate hibernate-core 4.1.9.Final taglibs standard 1.1.2 javax.servlet jstl 1.1.2 mysql mysql-connector-java 5.1.10 commons-dbcp commons-dbcp 20030825.184428 commons-pool commons-pool 20030825.183949 org.slf4j slf4j-api 1.7.5 org.slf4j slf4j-simple 1.6.4 org.slf4j slf4j-log4j12 1.7.5 org.hibernate hibernate-annotations 3.4.0.GA <org.springframework.version>3.0.2.RELEASE</org.springframework.version> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> but I am getting the following errors [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project Spring3HibernateMaven: Compilation failure: Compilation failure: [ERROR] error: error reading C:\Users\Bhanu\.m2\repository\commons-logging\commons-logging\1.1.1\commons-logging-1.1.1.jar; invalid LOC header (bad signature) [ERROR] error: error reading C:\Users\Bhanu\.m2\repository\org\hibernate\hibernate-core\4.1.9.Final\hibernate-core-4.1.9.Final.jar; invalid LOC header (bad signature) [ERROR] error: error reading C:\Users\Bhanu\.m2\repository\antlr\antlr\2.7.7\antlr-2.7.7.jar; invalid LOC header (bad signature) [ERROR] error: error reading C:\Users\Bhanu\.m2\repository\org\jboss\logging\jboss-logging\3.1.0.G…
favorite count: 0
answer count: 12
has answer: http://stackoverflow.com/a/47423478
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/38800896
tagged with: maven
has answer: http://stackoverflow.com/a/41411881
has answer: http://stackoverflow.com/a/38350060
linked to: http://stackoverflow.com/q/39893218
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/44506418
has answer: http://stackoverflow.com/a/57561193
has title: hibernate-commons-annotations-4.0.1.Final.jar; invalid LOC header (bad signature)?
has answer: http://stackoverflow.com/a/27272920

http://stackoverflow.com/a/23316458
has comment: http://stackoverflow.com/comment/35699135
has comment: http://stackoverflow.com/comment/35699373
type: AcceptedAnswer
downvote count: 0
has body: Try DateTimeFormat format = DateTimeFormat.getFormat("c"); // try with "E" pattern also String dayOfWeek = format.format(new Date()); System.out.println(dayOfWeek); For more patterns have a look at DateTimeFormat output 0 for sunday
has comment: http://stackoverflow.com/comment/35698889
has comment: http://stackoverflow.com/comment/35699163
has comment: http://stackoverflow.com/comment/35698925
has comment: http://stackoverflow.com/comment/35699325
type: Answer
upvote count: 3
accepted answer of: http://stackoverflow.com/q/23316288
has comment: http://stackoverflow.com/comment/35700095
has comment: http://stackoverflow.com/comment/35699019
answers question: http://stackoverflow.com/q/23316288
has comment: http://stackoverflow.com/comment/35698881
score: 3
has comment: http://stackoverflow.com/comment/35699268

http://stackoverflow.com/comment/118890550
type: Comment
type: AnswerComment
has text: In case there is nothing in Logcat, Then developer needs to filter the logs by doing following steps: 1. Select Package ID of Application 2. Choose Verbose from Options 3. Select 'No Filters' rather than 'Show only selected application' In this way, Logs will appear after you restart the application. Hope it helps !
comment on: http://stackoverflow.com/a/23353174
score: 0

http://stackoverflow.com/comment/35762377
type: QuestionComment
has text: Please **post your real problem** instead of just giving portions of it. In that way, you could receive more accurate help instead of attempts of a possible-non-solution.
comment on: http://stackoverflow.com/q/23350592
score: 0
type: Comment

http://stackoverflow.com/comment/35663867
type: AnswerComment
has text: I know, I have looked at it. Your evaluate function will return 100 or -100 depending on the player and nothing else. You should take a look at that, I can't help you much more than I already did, sorry :) Don't forget to accept the answer if it helped though!
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23296575

http://stackoverflow.com/comment/35913825
score: 0
has text: sorry, I mean that for each club it displays everybody in the personArray rather than only displaying those who belong in that club
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23432881

http://stackoverflow.com/q/23419550
accepted answer: http://stackoverflow.com/a/23419680
has title: LZW - Compression rate
type: Question
type: AnsweredQuestion
tagged with: lzw
has body: Well, I have to make a PPM image compressor using the LZW algorithm, the algorithm and the code I understand and have implemented a version for strings (in Java,for tests). The big problem is in compression, because if I have: Input: ABCDABCDABCDABCD Output: 65 66 67 68 256 258 260 259 257 68 as for my input I have 16 characters, if I just save my output as a text file, no compression because there are 34 characters. So I thought I'd save as binary file and then burn each field in a byte of my file, but there is the problem of fields >= 256. I also thought the idea of ​​putting some fields set to occur when a value greater than 255 , something like that. : (in this case I would remove the 255 field and 0 in my dictionary) 65 66 67 68 256 258 , would be: 65 66 67 68 255 1 0 255 3 0 then every field equal to 255 indicate an occurrence of consecutive bytes and sum would be the elements to be added; byte 0 indicates the end of sum. The problem is that even so my output would be greater than the input and compression does not make sense. Then I would ask you if there is a way around this.
answer count: 1
has answer: http://stackoverflow.com/a/23419680
score: 0
tagged with: java
tagged with: compression
tagged with: algorithm

http://stackoverflow.com/a/23366415
accepted answer of: http://stackoverflow.com/q/23366348
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23366348
type: Answer
has body: When you're adding the singleVector object to multiVector, you're not making a copy of it. So when you clear the singleVector and change it to "b,b,b" you're also "changing" the (same) object that you added to multiVector. If you want to change singleVector without modifying multiVector you should singleVector = new Vector&lt;&gt;() instead of clear()'ing it.
upvote count: 4
downvote count: 0
score: 4

http://stackoverflow.com/comment/77098214
type: AnswerComment
has text: I've edited the answer to add some clarification around the Configurator class.
comment on: http://stackoverflow.com/a/23434603
type: Comment
score: 0

stackexchange-api
tags question: http://stackoverflow.com/q/23380182
tags question: http://stackoverflow.com/q/23356922
type: Tag
tag name: stackexchange-api

http://stackoverflow.com/comment/35956149
has text: This webapp works fine on my local machine with postgres, and the jar file is there.
score: 0
comment on: http://stackoverflow.com/q/23452734
type: QuestionComment
type: Comment

http://stackoverflow.com/a/65915000
answers question: http://stackoverflow.com/q/23422079
score: 0
type: Answer
has body: Use Apache Web server (or any other http server) as a reverse proxy in front of JBoss and disable access to JBoss management endpoints. So basicly JBoss is listening only on localhost. &lt;VirtualHost *:443&gt; ServerName server.domain ... ProxyPass /invoker/EJBInvokerServlet ! ProxyPass /invoker/JMXInvokerServlett ! ProxyPass / ajp://localhost:8080/ ProxyPassReverse / ajp://localhost/ &lt;/VirtualHost&gt;

http://stackoverflow.com/a/23425007
answers question: http://stackoverflow.com/q/23424695
has comment: http://stackoverflow.com/comment/35900679
type: Answer
has comment: http://stackoverflow.com/comment/35939655
score: 0
has comment: http://stackoverflow.com/comment/35899218
has comment: http://stackoverflow.com/comment/35900704
has comment: http://stackoverflow.com/comment/35899334
has body: First error your code gave was FileNot found in the line BufferedReader br=new BufferedReader(new FileReader(D:\writer.txt")); I hope you have the file in your local machine. Next the file needs to have some data to translate. Last error I got was connection refused. Which will be solved by adding the following code at the start of your "go" method. System.setProperty("http.proxyHost", "proxy.****.com"); System.setProperty("http.proxyPort", "####"); Authenticator authenticator = new Authenticator() { public PasswordAuthentication getPasswordAuthentication() { return (new PasswordAuthentication("user", "PASSWORD".toCharArray())); } }; Authenticator.setDefault(authenticator); Now, you tell us, what error you got?
accepted answer of: http://stackoverflow.com/q/23424695
type: AcceptedAnswer

http://stackoverflow.com/a/23377865
has body: At Double.valueOf(sb.charAt(i)) the character '0' is cast to a double, but its value is 48, not 0. Also, you need to use the value returned by sb.reverse(), rather than the original sb.
score: 0
answers question: http://stackoverflow.com/q/23377814
type: Answer

opencv
type: Tag
tags question: http://stackoverflow.com/q/23295355
tags question: http://stackoverflow.com/q/23433792
tags question: http://stackoverflow.com/q/23311852
tags question: http://stackoverflow.com/q/23334796
tags question: http://stackoverflow.com/q/23421652
tag name: opencv
tags question: http://stackoverflow.com/q/23398227
tags question: http://stackoverflow.com/q/23321837
tags question: http://stackoverflow.com/q/23327502
tags question: http://stackoverflow.com/q/23325251

http://stackoverflow.com/q/23422822
type: AnsweredQuestion
tagged with: java
tagged with: javafx
type: Question
accepted answer: http://stackoverflow.com/a/23472480
possible better answer: http://stackoverflow.com/a/23423588
has title: How Play ogg files in javafx?
has answer: http://stackoverflow.com/a/23472480
score: 0
answer count: 3
has body: i use AudioClip class for playing ogg files but it says MEDIA_UNSUPPORTED .Is there any other libraries in javafx to play ogg files ?
has answer: http://stackoverflow.com/a/23423618
has answer: http://stackoverflow.com/a/23423588

http://stackoverflow.com/q/23306555
tagged with: android
has title: Spinner selection not passing into "if" statement
type: AnsweredQuestion
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/23306566
type: Question
linked to: http://stackoverflow.com/q/7520432
has body: I have the following code: public void convert() { String val = (String) spinner1.getItemAtPosition(spinner1.getSelectedItemPosition()); System.out.println(spinner1.getItemAtPosition(spinner1.getSelectedItemPosition())); System.out.println(val); if(val == "mm" || val == "cm" || val == "m" || val == "km") { System.out.println("got into if statements"); initiateLengthConvert(); } System.out.println("never got it"); } Now when the first to print statements print out, if I selected "mm", then it prints out: mm mm never got it Why won't it pass into the if statement? "val" and the possibilities match up, so it doesn't make any sense to me.
tagged with: if-statement
accepted answer: http://stackoverflow.com/a/23306566
duplicate of: http://stackoverflow.com/q/7520432
linked to: http://stackoverflow.com/q/513832
answer count: 1
tagged with: spinner
duplicate of: http://stackoverflow.com/q/513832

http://stackoverflow.com/comment/35723048
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23329590
has text: i've just added it to problem description
type: Comment

http://stackoverflow.com/q/23393375
has comment: http://stackoverflow.com/comment/35840297
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35840355
tagged with: java
downvote count: 3
type: Question
has answer: http://stackoverflow.com/a/23394485
accepted answer: http://stackoverflow.com/a/23394485
has comment: http://stackoverflow.com/comment/35839880
has body: &lt;#if ${primaryName!}?has_content&gt; &amp;&amp; ${key?js_string!}=="Joe"&gt; //do something &lt;#elseif ${primaryClass!}?has_content&gt; &amp;&amp; ${key?js_string!}=="Apple"&gt; //do something &lt;#else&gt; //do something &lt;/#if&gt; The above gives me error that something is expected at the end. { ] &amp;&amp; . Whats wrong in the above? Encountered "{" at line 26, column 39 in abc.ftl. Was expecting one of: "&gt;" ... "." ... "[" ... "(" ... "?" ... "!" ... &lt;TERMINATING_EXCLAM&gt; ... "??" ... "+" ... "-" ... "*" ... "/" ... "%" ... "!=" ... "=" ... "==" ... "&gt;=" ... &lt;ESCAPED_GTE&gt; ... "&gt;" ... &lt;ESCAPED_GT&gt; ... &lt;LESS_THAN_EQUALS&gt; ... &lt;LESS_THAN&gt; ... ".." ... &lt;AND&gt; ... &lt;OR&gt; ...
upvote count: 0
answer count: 1
favorite count: 0
has title: String comparison in freemarker not working
tagged with: freemarker
score: -3

http://stackoverflow.com/comment/35755719
comment on: http://stackoverflow.com/q/23343446
has text: The key size is only 128bits, so things are okay there it seems. beyond that, i guess i'd need to post the first example they provide (checkKeys()) which contacts the api and verifies the encryption key and the partner key they provided. I think once I have that simple task working, I would be able to start trying to build out the other functions from there.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35784243
comment on: http://stackoverflow.com/q/23363505
score: 0
type: Comment
type: QuestionComment
has text: Yes I added the jar file

http://stackoverflow.com/comment/35930214
has text: @koma I think i have identified the problem, it's simply contention.. I have rewritten much of my application to verify - I'm in the middle of migration now and will let you know.
score: 1
type: Comment
comment on: http://stackoverflow.com/q/23425498
type: QuestionComment

http://stackoverflow.com/a/23337524
type: Answer
answers question: http://stackoverflow.com/q/23337179
has body: Try $wnd.parent.document.getElementById("slider") instead of window.top.document.getElementById("slider")
score: 0

http://stackoverflow.com/a/23341239
score: 3
answers question: http://stackoverflow.com/q/23337470
has body: The following working Java code solves this problem in O(log N) time. The logic is very simple. If the value in the current node is smaller than val, then look for a greater value in the right sub-tree of the current node, or look for an answer in the left subtree. void run(){ Obj root = new Obj(1); root = insertVal(root, 4); root = insertVal(root, 7); root = insertVal(root, 9); root = insertVal(root, 12); root = insertVal(root, 13); root = insertVal(root, 43); root = insertVal(root, 45); System.out.println(floor(root, 15)); } // throws a RuntimeException if there is no smaller value in the BST. int floor(Obj root, int val){ int ans = Integer.MIN_VALUE; boolean found = false; while(root != null){ if(root.val==val){ return val; } if(val &lt; root.val){ root = root.left; }else{ found = true; ans = root.val; root = root.right; } } if(!found){ throw new RuntimeException("There is no smaller value than " + val + " in the BST"); } return ans; } Obj insertVal(Obj root, int val){ if(root==null){ return new Obj(val); } if(val &lt; root.val){ root.left = insertVal(root.left, val); }else{ root.right = insertVal(root.right, val); } return root; } } class Obj{ int val; Obj right; Obj left; public Obj(int val){ this.val = val; right = left = null; } public String toString(){ return val + " "; } }
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23337470
upvote count: 3
type: Answer
downvote count: 0

http://stackoverflow.com/comment/35702024
comment on: http://stackoverflow.com/q/23318100
score: 0
type: QuestionComment
has text: I've answered this question by reinstalling, but provided votes for you all that spent time reading this.
type: Comment

http://stackoverflow.com/a/23400814
answers question: http://stackoverflow.com/q/23400699
has body: Unfortunately, you cannot convince the hash set to compare basic and extended objects for equality as if they both were basic objects. However, you could build a wrapper object that holds a basic or an extended object, and uses the comparison method of the basic object to compare the two. Here is a sketch of a possible implementation: class FooWrapper { private final BasicFoo obj; public FooWrapper(BasicFoo obj) { this.obj = obj; } public BasicFoo getWrapped() { return obj; } public int hashCode() { // Compute the hash code the way the BasicFoo computes it } public boolean equals(Object other) { // Compare the objects the way the BasicFoo does } } Now you can take a mixed collection of BasicFoo and ExtendedFoo, wrap them in the FooWrapper, and put them in a hash set. You can perform operations on the sets, and then harvest the results by unwrapping the individual BasicFoo objects from the set of wrappers.
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 1
accepted answer of: http://stackoverflow.com/q/23400699
upvote count: 1

http://stackoverflow.com/a/23327831
type: AcceptedAnswer
downvote count: 1
has comment: http://stackoverflow.com/comment/35720415
type: Answer
accepted answer of: http://stackoverflow.com/q/23327693
has comment: http://stackoverflow.com/comment/35719311
answers question: http://stackoverflow.com/q/23327693
has body: Make your parenthesis proper like below and run randomNum = (int)(Math.random() * (stuTable.getRowCount() - 1)); check it out
has comment: http://stackoverflow.com/comment/35719688
score: 1
upvote count: 2
has comment: http://stackoverflow.com/comment/35719396
has comment: http://stackoverflow.com/comment/35720639

http://stackoverflow.com/comment/35734641
has text: what's inside setViewportView?
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/23326829
type: Comment

http://stackoverflow.com/a/23312371
has comment: http://stackoverflow.com/comment/35715589
has comment: http://stackoverflow.com/comment/35715567
downvote count: 0
score: 10
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35862361
type: Answer
has body: Try following route: from("servlet://abc") .process(new Processor(){ @Override public void process(Exchange exchange) throws Exception { // Camel will populate all request.parameter and request.headers, // no need for placeholders in the "from" endpoint String id = exchange.getIn().getHeader("id", String.class); String name = exchange.getIn().getHeader("name", String.class); // This URI will override http://dummyhost exchange.getIn().setHeader(Exchange.HTTP_URI, "http://example.com"); // Add input path. This will override the original input path. // If you need to keep the original input path, then add the id to the // URI above instead exchange.getIn().setHeader(Exchange.HTTP_PATH, id); // Add query parameter such as "?name=xxx" exchange.getIn().setHeader(Exchange.HTTP_QUERY, "name="+name); } .to("http://dummyhost") If you request is http://localhost:8080/hello/world?id=111&amp;name=moon, then it should be forwarded to http://example.com/111?name=moon.
answers question: http://stackoverflow.com/q/23307707
accepted answer of: http://stackoverflow.com/q/23307707
upvote count: 10

exception
tags question: http://stackoverflow.com/q/23362759
tags question: http://stackoverflow.com/q/23375515
tags question: http://stackoverflow.com/q/23370463
tags question: http://stackoverflow.com/q/23425191
tags question: http://stackoverflow.com/q/23432549
tags question: http://stackoverflow.com/q/23345629
tags question: http://stackoverflow.com/q/23381825
tags question: http://stackoverflow.com/q/23349119
tags question: http://stackoverflow.com/q/23311418
tags question: http://stackoverflow.com/q/23338269
tags question: http://stackoverflow.com/q/23424544
tags question: http://stackoverflow.com/q/23443872
tags question: http://stackoverflow.com/q/23326798
tags question: http://stackoverflow.com/q/23335250
tags question: http://stackoverflow.com/q/23440400
type: Tag
tags question: http://stackoverflow.com/q/23434733
tags question: http://stackoverflow.com/q/23412632
tags question: http://stackoverflow.com/q/23374181
tags question: http://stackoverflow.com/q/23419433
tags question: http://stackoverflow.com/q/23348971
tags question: http://stackoverflow.com/q/23391572
tags question: http://stackoverflow.com/q/23331516
tags question: http://stackoverflow.com/q/23330106
tags question: http://stackoverflow.com/q/23427561
tags question: http://stackoverflow.com/q/23403825
tags question: http://stackoverflow.com/q/23437254
tags question: http://stackoverflow.com/q/23412423
tags question: http://stackoverflow.com/q/23384726
tags question: http://stackoverflow.com/q/23365869
tags question: http://stackoverflow.com/q/23426514
tags question: http://stackoverflow.com/q/23389546
tags question: http://stackoverflow.com/q/23448861
tags question: http://stackoverflow.com/q/23418736
tags question: http://stackoverflow.com/q/23345083
tag name: exception
tags question: http://stackoverflow.com/q/23357187
tags question: http://stackoverflow.com/q/23334968
tags question: http://stackoverflow.com/q/23345418
tags question: http://stackoverflow.com/q/23441208
tags question: http://stackoverflow.com/q/23348950
tags question: http://stackoverflow.com/q/23411959
tags question: http://stackoverflow.com/q/23349354
tags question: http://stackoverflow.com/q/23416975
tags question: http://stackoverflow.com/q/23317794
tags question: http://stackoverflow.com/q/23417036

http://stackoverflow.com/comment/35946674
comment on: http://stackoverflow.com/a/23449922
type: AnswerComment
score: 0
type: Comment
has text: Actually, I have looked at other similar questions which you have provided an answer for, specifically this one: http://stackoverflow.com/questions/7938825/graphics-not-showing-in-jlayeredpane-java-swing And failed to get it working. However, I came back to above example and extracted two lines from there: myGraphic.setSize(layeredPane.getPreferredSize()); myGraphic.setLocation(0, 0); And converted them to my: racetrack.setSize(750,500); racetrack.setLocation(0,0); And it worked. Your answer is now marked as correct. Thanks.

http://stackoverflow.com/comment/35766511
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23353302
has text: I believe the range is `n-1` to `(n-1)/2`. Given an array-based heap of size `n`, a node at index `p` is a leaf node if `2*p+1 >= n`. Solving for `p` gives `p = (n-1)/2`.

http://stackoverflow.com/q/23411307
favorite count: 0
type: UnansweredQuestion
has body: I have a field productName_split indexed with value "black iPhone 5c". Search for "5c" or "iphone 5c" returns result. But search for "black iPhone 5c" doesn't return any result. Following is debugQuery outcome: productName_split:"iPhone 5c" productName_split:"iPhone 5c" MultiPhraseQuery(productName_split:"iphone (5c 5) c") productName_split:"black iphone (5c 5) c" I am wondering what is the meaning of "(5c 5) c", is this causing the issue? Similar behavior happens with "3GB", "500MB" etc. Schema for productName_split: <tokenizer class="solr.WhitespaceTokenizerFactory" /> <filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt" enablePositionIncrements="true" /> <filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="1" catenateWords="1" catenateNumbers="1" catenateAll="1" splitOnCaseChange="1" preserveOriginal="1" splitOnNumerics="1" /> <filter class="solr.LowerCaseFilterFactory" /> <filter class="solr.KStemFilterFactory" /> <filter class="solr.RemoveDuplicatesTokenFilterFactory" /> <tokenizer class="solr.WhitespaceTokenizerFactory" /> <filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt" enablePositionIncrements="true" /> <filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="1" catenateWords="0" catenateNumbers="0" catenateAll="0" splitOnCaseChange="0" preserveOriginal="1" splitOnNumerics="1" /> <filter class="solr.LowerCaseFilterFactory" /> <filter class="solr.KStemFilterFactory" /> <filter class="solr.RemoveDuplicatesTokenFilterFactory" /> Edit: After searching more on this issue, I am suspecting on MultiPhraseQuery, how and when this kicks-in? I've provided autoGeneratePhraseQuery="false", shouldn't this suppress formation of MultiPhraseQuer?
score: 2
answer count: 0
upvote count: 2
tagged with: java
tagged with: solr
type: Question
has title: Solr Query behavior : Possible MultiPhraseQuery issue
tagged with: search
downvote count: 0
tagged with: full-text-search

http://stackoverflow.com/comment/35661525
type: Comment
score: 0
comment on: http://stackoverflow.com/q/23296203
type: QuestionComment
has text: You are writing Java. You need to write Javascript.

http://stackoverflow.com/a/23295700
has body: please try this LdapContextSource ctxSrc = new LdapContextSource(); ctxSrc.setUrl("ldap://&lt;url&gt;"); ctxSrc.setBase("dc=example,dc=local"); ctxSrc.setUserDn("&lt;user&gt;@example.local"); ctxSrc.setPassword("&lt;pass&gt;"); ctxSrc.afterPropertiesSet(); // this method should be called. LdapTemplate tmpl = new LdapTemplate(ctxSrc); setLdapTemplate(tmpl);
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23294956
has comment: http://stackoverflow.com/comment/35661084
type: Answer
score: 6
upvote count: 6
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23294956

http://stackoverflow.com/q/23449671
answer count: 2
has title: Spring: why do I need applicationContext.xml when I am using annotations?
has body: I am Spring newbie Im trying to deploy my war file on tomcat using cargo and it complained about applicationContext.xml not being found in directory. I further looked up where it should go and added a blank xml file applicationContext.xml to see if that works but then it complained something as [INFO] [talledLocalContainer] SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener [INFO] [talledLocalContainer] org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 1 in XML document from class path resource [applicationContext.xml] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 1; Premature end of file. I am not sure why do I need applicationContext.xml and if I really need it, what should I put in there? I am using @annotations as much as I could and my unit tests are also passing correctly, Meaning, I see that my beans do wire up correctly Seniors, please help Thank you UPDATE src/main/webapp/WEB-INF/web.xml &lt;xml&gt; &lt;/xml&gt; src/main/resources/applicationContext.xml &lt;beans&gt;&lt;/beans&gt;
has comment: http://stackoverflow.com/comment/35945144
upvote count: 3
has answer: http://stackoverflow.com/a/23449830
favorite count: 0
type: UnansweredQuestion
tagged with: annotations
tagged with: spring
has answer: http://stackoverflow.com/a/23449842
has comment: http://stackoverflow.com/comment/35945126
has comment: http://stackoverflow.com/comment/35945030
tagged with: http://stackoverflow.com/tag/xml
tagged with: spring-mvc
score: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/35944892
tagged with: java
has comment: http://stackoverflow.com/comment/35945067
type: Question

http://stackoverflow.com/q/23447256
tagged with: capture-group
type: AnsweredQuestion
tagged with: java
type: Question
possible better answer: http://stackoverflow.com/a/23447275
accepted answer: http://stackoverflow.com/a/23447287
duplicate of: http://stackoverflow.com/q/18257561
score: 0
answer count: 2
has body: I'd like to capture the groups in my regular expression but it seems that I haven't written it as it should be. Consider the following lines: String input = "username=johndoe"; Pattern pattern = Pattern.compile("(\\w+)=(\\w+)"); Matcher matcher = pattern.matcher(input); When I try to capture the group one and two I've got an IllegalStateExcpetion. I really don't know what's wrong with my regex, and I also tried several different ways of writing it =/. Thanks in advance for your help.
has answer: http://stackoverflow.com/a/23447287
has title: Capturing Groups REGEX Java
has answer: http://stackoverflow.com/a/23447275
linked to: http://stackoverflow.com/q/18257561
tagged with: regex

http://stackoverflow.com/comment/35793778
type: Comment
comment on: http://stackoverflow.com/a/23361921
score: 0
type: AnswerComment
has text: Theoretically it would be slower, in practice it's probably a useless optimization.

http://stackoverflow.com/q/23312328
has title: NoSuchFieldError: NULL Spring Error
has comment: http://stackoverflow.com/comment/35690713
has comment: http://stackoverflow.com/comment/35696122
tagged with: spring
tagged with: esb
has comment: http://stackoverflow.com/comment/35706414
type: UnansweredQuestion
tagged with: adroitlogic
type: Question
has answer: http://stackoverflow.com/a/23326743
tagged with: java
has body: I have configured a Spring bean in my xml file but when I run my app, I get the following error. Can anyone tell me why? org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ultra-config' defined in file [C:\src\test\resources\conf\ultra-root.xml]: Initialization of bean failed; nested exception is java.lang.NoSuchFieldError: NULL at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:529) Configuration: &lt;bean id="http-8280" class="org.adroitlogic.ultraesb.transport.http.HttpNIOListener"&gt; &lt;constructor-arg ref="fileCache"/&gt; &lt;property name="port" value="8280"/&gt; &lt;/bean&gt; &lt;bean id="http-sender" class="org.adroitlogic.ultraesb.transport.http.HttpNIOSender"&gt; &lt;constructor-arg ref="fileCache"/&gt; &lt;/bean&gt; &lt;bean id="environment" class="org.adroitlogic.ultraesb.api.Environment"&gt; &lt;constructor-arg value="unit_test" type="java.lang.String"/&gt; &lt;property name="deploymentUnitsEnabled" value="true"/&gt; &lt;/bean&gt; &lt;bean id="ultra-config" class="org.adroitlogic.ultraesb.core.ConfigurationImpl"&gt; &lt;property name="environment" ref="environment"/&gt; &lt;/bean&gt; Gradle dependencies dependencies { testCompile group: 'org.mockito', name: 'mockito-all', version: '1.9.5' testCompile group: 'org.apache.maven.plugins', name: 'maven-failsafe-plugin', version: '2.16' testCompile group: 'junit', name: 'junit', version:'4.9' testCompile group: 'org.adroitlogic', name: 'ultraesb-sample', version:'2.2.0-SNAPSHOT' compile group: 'org.adroitlogic', name: 'ultraesb-api', version:'2.2.0-SNAPSHOT' compile group: 'org.adroitlogic', name: 'logging-api', version:'1.0.0-SNAPSHOT' compile group: 'org.adroitlogic', name: 'logging-slf4j-impl', version:'1.0.0-SNAPSHOT' compile(group: 'org.springframework.security', name: 'spring-security-core', version:'3.1.4.RELEASE') { exclude(module: 'spring-core') exclude(module: 'spring-context') ex…
tagged with: ultraesb
score: 0
linked to: http://stackoverflow.com/q/8500708
answer count: 2
has answer: http://stackoverflow.com/a/23312387

http://stackoverflow.com/q/23425454
answer count: 1
tagged with: jackson
favorite count: 0
has answer: http://stackoverflow.com/a/23425719
accepted answer: http://stackoverflow.com/a/23425719
type: AnsweredQuestion
tagged with: equals
downvote count: 0
score: 1
has title: Compare two JSON objects with tolerance for numbers
type: Question
tagged with: java
has body: I'm currently using the Jackson JSON library for Java to compare a few JSON objects. The JSON objects contain the result of some mathematical computations. For instance: { name:"result_set_1" result:[0.123151351353,1.0123151533,2.0123051353] } When comparing these with a reference implementation, I notice that some browsers produce slightly different results. This is fine, but I need to somehow make sure that I have a tolerance when comparing numbers. JSONNode.equals() actually does a very nice deep-equals, but it compares Numbers in a way that forces them to be perfectly equal. I need to add a tolerance. Is there a way to do a deep equals with a tolerance? The only way right now I have found is to iterate over every single node, check if it is a number, and do a tolerance check instead of an equals. But this method is quite bulky because you have to check whether the node is an object, an array, a string... etc... and do specific things for each. I just want custom behavior for Numbers. Is there a more elegant way of doing this? Any 3rd party libraries?
upvote count: 1

http://stackoverflow.com/comment/35717389
type: QuestionComment
has text: what do You think about my problem ? best regards
comment on: http://stackoverflow.com/q/23326713
score: 0
type: Comment

http://stackoverflow.com/q/23303989
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/23304039
upvote count: 9
accepted answer: http://stackoverflow.com/a/23304039
tagged with: android-studio
type: AnsweredQuestion
has body: If I'm editing an existing line of code in Android Studio, and accept an autocomplete, the following token to the right of the cursor gets eaten: Is there a way to disable this behaviour, keeping both the autocomplete plus the rest of the line?
tagged with: java
type: Question
score: 9
has comment: http://stackoverflow.com/comment/35676162
tagged with: intellij-idea
downvote count: 0
tagged with: ide
has title: How to prevent Android Studio autocomplete removing adjacent token
tagged with: android

http://stackoverflow.com/comment/35746600
comment on: http://stackoverflow.com/a/23342092
type: AnswerComment
type: Comment
score: 0
has text: Update with log. An a few minutes update and DAO but I also had tried without DAO -- issue is the same

http://stackoverflow.com/comment/35910901
has text: I agree with you, but 580085 is not the correct answer because correct answer is 906609. and it comes only the second version of the loop
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23431056

http://stackoverflow.com/a/23371151
type: Answer
answers question: http://stackoverflow.com/q/23371068
has body: Actually this not exactly right, Scanner can get a File and it can get an InputStream Scanner is not only designed for files. also, FileInputStream extends InputStream so it can also be passed to the scanner as a simple InputStream. actually the constructor that receives File, converts it to FileInputStream so basically its just for faster coding Bottom line: there is no performance difference
upvote count: 1
score: 1
downvote count: 0

http://stackoverflow.com/q/23375333
score: -3
has answer: http://stackoverflow.com/a/23375342
downvote count: 4
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/23375358
accepted answer: http://stackoverflow.com/a/23375358
type: Question
duplicate of: http://stackoverflow.com/q/2143476
linked to: http://stackoverflow.com/q/13432845
has comment: http://stackoverflow.com/comment/35807138
has comment: http://stackoverflow.com/comment/35807479
has title: Turning a double to an int in Java
answer count: 3
upvote count: 1
possible better answer: http://stackoverflow.com/a/23375366
has comment: http://stackoverflow.com/comment/35807269
favorite count: 0
has body: I have the following variables and I am trying to turn myInt into a double, however, I am getting a "Cannot convert from double to int' error. I noticed that I can turn a double to an int without incident, but am unsure as to why this fails. Please bear with me as I am new to programming. double myDouble = 4; int myInt; myInt = myDouble; System.out.println(myInt); Thank you!
linked to: http://stackoverflow.com/q/2143476
has answer: http://stackoverflow.com/a/23375366

http://stackoverflow.com/comment/74085432
has text: @cesarferreira You need to update the Android plugin to the latest version (which is at the moment `2.4.0-alpha6`). Please check the quotation block in the answer.
type: Comment
score: 1
comment on: http://stackoverflow.com/a/43237601
type: AnswerComment

http://stackoverflow.com/comment/35899649
score: 0
has text: Use Set, Put all ids of assignment in a set. Now iterate over the person array and try to insert its ids into the same set. If its already present in set, remove it from person array. This will be O(n) solution
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23425089

http://stackoverflow.com/comment/118852265
has text: Though this solution worked for console logging, for rollingFile usage, I had to set proper ThresholdFilter value to make sure the change was reflecting.
type: Comment
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/44678752

http://stackoverflow.com/q/23374955
has comment: http://stackoverflow.com/comment/35810402
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35810022
has comment: http://stackoverflow.com/comment/35809743
tagged with: java
has comment: http://stackoverflow.com/comment/35809234
has comment: http://stackoverflow.com/comment/35810361
type: Question
has title: NullPointerException on .setAdapter in a Fragment with ListView
has comment: http://stackoverflow.com/comment/35807683
score: 0
has comment: http://stackoverflow.com/comment/35808991
has comment: http://stackoverflow.com/comment/35810093
has comment: http://stackoverflow.com/comment/35810464
has comment: http://stackoverflow.com/comment/35809702
answer count: 1
has comment: http://stackoverflow.com/comment/35806155
has body: I have a fragment activity and on the .setAdapter call there is a nullpointerexception and my app force closes when I enter the fragment. I don't really understand why. The fragment is part of a tab interface. Here is my code: import android.app.AlertDialog; import android.content.DialogInterface; 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; import android.widget.EditText; import android.widget.LinearLayout; import android.widget.ListView; import edu.purdue.ugl.adapters.BaseInflaterAdapter; import edu.purdue.ugl.adapters.CardItemDataMultiple; import edu.purdue.ugl.adapters.inflaters.CardInflaterMultiple; public class StickyBoard extends Fragment { Button addButton; ListView listview; BaseInflaterAdapter&lt;CardItemDataMultiple&gt; adapter; public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState){ View rootView = inflater.inflate(R.layout.activity_sticky_board,container,false); addButton = (Button) rootView.findViewById(R.id.newStickyBoard); listview = (ListView) rootView.findViewById(R.id.list_view); adapter=new BaseInflaterAdapter&lt;CardItemDataMultiple&gt;(new CardInflaterMultiple()); listview.setAdapter(adapter); return rootView; } } BaseInflaterAdapter.java package edu.purdue.ugl.adapters; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import java.util.ArrayList; import java.util.List; public class BaseInflaterAdapter&lt;T&gt; extends BaseAdapter { private List&lt;T&gt; m_items = new ArrayList&lt;T&gt;(); private IAdapterViewInflater&lt;T&gt; m_viewInflater; public BaseInflaterAdapter(IAdapterViewInflater&lt;T&gt; viewInflater) { m_viewInflater = viewInflater; } public BaseInflaterAdapter(List&lt;T&gt; items, IAdapterViewInflater&lt;T&gt; viewInflater) { m_items.addAll(items); m_viewInflater = viewInflater; } public void setViewInflate…
has answer: http://stackoverflow.com/a/23377370
accepted answer: http://stackoverflow.com/a/23377370
tagged with: android
has comment: http://stackoverflow.com/comment/35810297

http://stackoverflow.com/a/23375181
score: 4
type: Answer
answers question: http://stackoverflow.com/q/23374852
has body: Agree with Andres &amp; Luiggi. Here's what your modified code would look like: $.ajax({ url: "Servlet", type: "POST", contentType: "application/json; charset=utf-8", data: JSON.stringify({ "fluxos": fluxos }), success: function(data) { alert("success"); } });
accepted answer of: http://stackoverflow.com/q/23374852
upvote count: 4
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/35745588
comment on: http://stackoverflow.com/q/23342603
has text: Every CPU operation consumes power. It's not powered by cosmic rays...
score: 4
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23296943
upvote count: 5
type: Answer
downvote count: 0
has body: Don't use a "null layout". Swing was designed to be used with layout managers. Use new JTextArea(5, 30); when creating a text area. That is specify the rows/columns for the text area. Don't use AWT components in a Swing application. Swing components start with a "J", JButton, JTextField, JFrame. Don't use show(). The proper method is setVisible(true) Create your GUI components on the Event Dispatch Thread (EDT). The setVisible(true) needs to be done AFTER all the components have been added to the frame. I suggest you read the section from the Swing tutorial on Using Layout Managers for some examples of using layout managers and on to use the EDT.
answers question: http://stackoverflow.com/q/23296820
score: 5
has comment: http://stackoverflow.com/comment/35663123
has comment: http://stackoverflow.com/comment/35663568

http://stackoverflow.com/a/23449647
type: Answer
has comment: http://stackoverflow.com/comment/36243356
has comment: http://stackoverflow.com/comment/36193520
has comment: http://stackoverflow.com/comment/36233180
has comment: http://stackoverflow.com/comment/36192330
answers question: http://stackoverflow.com/q/23430327
has comment: http://stackoverflow.com/comment/35962473
score: 0
has comment: http://stackoverflow.com/comment/35978756
has comment: http://stackoverflow.com/comment/36191375
has comment: http://stackoverflow.com/comment/35976295
has body: Hello @Gil for your reply, maybe that code is in other Version? this is what i see in the lasted Gwan version available in the Web page: Gwan.java: // ============================================================================ // Java API calls for the G-WAN Web App. Server (trustleap.ch) // ---------------------------------------------------------------------------- package api; public class Gwan { public static native long getReply(long env); public static native void xbufCat (long ctx, String str); public static native long cycles64(); public static native long getNs (); public static native long getUs (); public static native long getMs (); public static native void logErr (long env, String msg); public static native void report (long reply, int html_format); } // ============================================================================ // End of Source Code // ============================================================================

linux-mint
type: Tag
tag name: linux-mint
tags question: http://stackoverflow.com/q/23338779

http://stackoverflow.com/comment/35937174
has text: Since you were able to successfully connect to server1, did you try connecting to server2 from there? It doesn't really sound like you ran into any trouble
comment on: http://stackoverflow.com/q/23445652
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23365567
accepted answer of: http://stackoverflow.com/q/23365491
upvote count: 1
has comment: http://stackoverflow.com/comment/35788068
has comment: http://stackoverflow.com/comment/35787950
has body: Change your pattern into a non-greedy one: "\\\"\\&gt;(.*?)\\&lt;/a\\&gt;\\&lt;br\\&gt;" However, six words of warning are appropriate: don't do it this way. you are essentially trying to parse (semi-)structured information using regular expression. experience tells, you are doomed if you follow this route. either regexen will prove not to be powerful enough to solve your problem in the end (think of nested structures) or you will produce unmaintainable code. probably both.
type: AcceptedAnswer
downvote count: 0
score: 1
type: Answer
answers question: http://stackoverflow.com/q/23365491

http://stackoverflow.com/a/23321228
score: 4
has body: If you start copying from position 2 then you cannot copy 7 items, you can only copy 5
answers question: http://stackoverflow.com/q/23321213
has comment: http://stackoverflow.com/comment/35706857
upvote count: 4
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/35706823

http://stackoverflow.com/comment/35927689
type: AnswerComment
comment on: http://stackoverflow.com/a/23440063
type: Comment
has text: In that case, row will also have to be a private class variable.
score: 1

http://stackoverflow.com/a/23385535
answers question: http://stackoverflow.com/q/23385471
type: Answer
score: 2
upvote count: 3
downvote count: 1
has body: Your program is NOT using so much memory. JVM / OS is reserving that memory i.e, the limit UPTO WHICH your program can use. Also, like one of the answer clearly mentions. 32 bit and 64 bit have got nothing to do with this. 32 bit means you can access upto 2^32 physical memory locations. and 64 bit means upto 2^64.

http://stackoverflow.com/comment/35746711
has text: Then take \s\s+, it should contain everything from 2 spaces to unlimited.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23342401

http://stackoverflow.com/a/23338863
type: Answer
has comment: http://stackoverflow.com/comment/35739629
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/23338412
downvote count: 0
has body: Well.. I suppose this should work: Query query = session.createSQLQuery(sqlQuery); List listRes = query.list(); int ans = ((BigDecimal) listRes.get(0)).intValue(); Note: you need to import java.math.BigDecimal

http://stackoverflow.com/a/23340871
has body: ok, the problem is, that you send an ajax call to the server by this line: $.post("Login", params, function(data){alert(data);} ); if you perform ajax call, your browser wouldn't go to the new page, your server only redirect the ajax call to another servlet. So if you want to redirect after the ajax call, you have to redirect by javascript. if your loginServlet would send error like this: Login.java if(!password.equals("123456") //check if password is wrong out.println("{\"error\": \"wrong password\"}"); //write error to response. notice, we don't need server-redirect, since we will redirect by the client if the error exists in your client you could do something like this: $.post("Login", params, function(data){ if(!data.error) window.location.href = "http://example.com/UserInfo/"; else alert(data.error); }); the function will be executed if your ajax-call was successfull and will redirect the browser to the UserInfo servlet Edit: added success-check Edit2: added print error to response
has comment: http://stackoverflow.com/comment/35742569
accepted answer of: http://stackoverflow.com/q/23340533
answers question: http://stackoverflow.com/q/23340533
type: Answer
has comment: http://stackoverflow.com/comment/35742629
score: 0
type: AcceptedAnswer

http://stackoverflow.com/a/23364318
type: Answer
score: 0
answers question: http://stackoverflow.com/q/23359177
accepted answer of: http://stackoverflow.com/q/23359177
has body: xPath() works with sites that conform to XML standard.HTML is more forgiving; you can have missing end tags and other errors but in XML this is forbidden. So chances were that the html does not conform with the XML standard so I double checked by validating your link at this site: http://www.w3schools.com/xml/xml_validator.asp And guess what? It had some errors. You save yourself the trouble next time by validating on this site first. Of course, that doesn't mean that XML conforming sites are all suitable for xPath() webscraping(hidden elements, javascript, etc.). However, from the nature of the reported error you might be able to tell which is not.
type: AcceptedAnswer

http://stackoverflow.com/a/23308206
has body: Either you need to use a method which uses a predicate indicating whether to keep going (so it has the break instead) or you need to throw an exception - which is a very ugly approach, of course. So you could write a forEachConditional method like this: public static &lt;T&gt; void forEachConditional(Iterable&lt;T&gt; source, Predicate&lt;T&gt; action) { for (T item : source) { if (!action.test(item)) { break; } } } Rather than Predicate&lt;T&gt;, you might want to define your own functional interface with the same general method (something taking a T and returning a bool) but with names that indicate the expectation more clearly - Predicate&lt;T&gt; isn't ideal here.
answers question: http://stackoverflow.com/q/23308193
has comment: http://stackoverflow.com/comment/35697191
type: Answer
upvote count: 13
has comment: http://stackoverflow.com/comment/35695475
score: 13
has comment: http://stackoverflow.com/comment/35699369
downvote count: 0

http://stackoverflow.com/a/23377627
has comment: http://stackoverflow.com/comment/35973345
answers question: http://stackoverflow.com/q/23362015
has comment: http://stackoverflow.com/comment/35973026
downvote count: 0
has comment: http://stackoverflow.com/comment/35976335
has comment: http://stackoverflow.com/comment/35973358
type: Answer
has comment: http://stackoverflow.com/comment/35973013
score: 1
has body: Don't use setIgnoreRepaint, this can produce unwanted paint artificates or fail to update components when required desktopPane.setDesktopManager(null) is asking trouble. Instead of using a javax.swing.Timer for each instance of TestTableScreen, you should have a single Timer which then provides notifications to multiple recipients. Don't call fireTableDataChanged, this will cause the entire table to re-validate, including the columns and all the rows, this is very, very expensive. Perfer the use appropriate listeners to monitor the changes to components, rather than performing anonymous method overriding. This is, essentially, a butchered version demonstrating the use of a single "master" Timer and changes to the table updating process. It also employs a WindowListener and InternalFrameListener to deregister the views from the Timer when their parent windows are closed, so we're not updating components that are no longer on the screen. import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; import java.awt.EventQueue; import java.awt.Graphics; import java.awt.GridLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.util.ArrayList; import java.util.List; import java.util.Random; import javax.swing.JDesktopPane; import javax.swing.JDialog; import javax.swing.JFrame; import javax.swing.JInternalFrame; import javax.swing.JLabel; import javax.swing.JMenu; import javax.swing.JMenuBar; import javax.swing.JMenuItem; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTable; import javax.swing.SwingUtilities; import javax.swing.Timer; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; import javax.swing.event.InternalFrameAdapter; import javax.swing.event.InternalFrameEvent; import javax.swing.table.AbstractTableModel; import javax.swing.table.TableColumnModel; import javax.swing.tabl…
upvote count: 1

http://stackoverflow.com/a/54479550
upvote count: 1
type: Answer
has body: So after lots of googling I finally found it out myself! If you can create new Javafx projects in IntelliJ and it works perfectly, but when you open a normal java application that happens to use javafx doesn't work, (because java just doesn't want to resolve the javafx references) what works for me is this: You must add the "jre/lib/ext/jfxrt.jar" file to the module classpath that is located inside IDEA on my windows machine this is C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2018.3.3\jre64\lib\ext\jfxrt.jar. And now it finally builds!
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/109076710
answers question: http://stackoverflow.com/q/23421325

http://stackoverflow.com/comment/35845531
has text: I believe I want the reference to the file. Basically I want to copy a file to my clipboard, then emulate a "Ctrl+V" keystroke in Ableton Live, and have it actually paste a WAV file into Live. I'm not sure but I think at one point I tried to copy the raw WAV data and it didn't work
comment on: http://stackoverflow.com/q/23378071
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23294847
score: 1
answers question: http://stackoverflow.com/q/23294661
has body: You are trying to start an activity of the name STARTINGPOINT, but you don't have a class of that name. Your Android manifest activity android:name property should be the same package/class name of the activity java file. Change it to android:name="com.example.helloworld.MainActivity" Also, you can use your intent without using a string literal: Intent intent = new Intent(this, MainActivity.class);
upvote count: 1
type: Answer
downvote count: 0

http://stackoverflow.com/q/23296864
upvote count: 1
has answer: http://stackoverflow.com/a/23296931
tagged with: java
has comment: http://stackoverflow.com/comment/35663414
accepted answer: http://stackoverflow.com/a/23296931
downvote count: 0
score: 1
has answer: http://stackoverflow.com/a/23297107
has comment: http://stackoverflow.com/comment/35662787
type: Question
type: AnsweredQuestion
has body: I know I can do this in python pretty easily using decorators and I was wondering if it was possible in java. Perhaps annotations aren't even the correct way to go for this, but after reading around I can't find anything about a way to do what I want to. Let's say that, for example, I have some code that looks like this: public class AnnotationHelp { public static void exampleMethod() { System.out.println("example method"); } } So calling AnnotationHelp.exampleMethod() should print example method. I want something like this: public class AnnotationHelp { @MysteryAnnotation public static void exampleMethod() { System.out.println("example method"); } } Calling this should hopefully call code before and after exampleMethod's main code, resulting in something like: Printed before main code example method Printed after main code I might be going about this completely wrong, but the gist of it is that I want to be able to quickly add code before and after a bunch of methods (30+) and I think annotations are the way to do it, but I don't know how. I looked at guice, but I don't think I can add it to the project I'm working on for complicated reasons. I'd much rather go for another solution.
possible better answer: http://stackoverflow.com/a/23297107
has title: Is it possible to annotate a java method to add code before and after the main code in the method?
favorite count: 0
answer count: 2

http://stackoverflow.com/comment/35698755
type: QuestionComment
has text: @MarcB the folder exists not the files
comment on: http://stackoverflow.com/q/23316466
score: 0
type: Comment

http://stackoverflow.com/q/23440058
has body: I am not sure if title correctly relates to my problem, feel free to amend it! :) What i am trying to do is, visit a m x n matrix in java and simultaneously mark the visited nodes based on certain condition //int a[][] = new int[5][5]; for(int i = 0;i&lt; a.length;i++) //row for(int k = 0;k&lt;a[0].length;k++) //column if((i+k) % 3 ==0 ) //condition a[i][k].visited = true; else a[i][k].visited = false; In memory, i am imagining it something like : _ _ _ _ | | |a[0][3]| - &gt; Visited //(for true) |_ _ _ _| But i am getting Error : visited can not be resolved or is not a field Can some one please help me on how to mark array blocks, or for instance, associate any value to them, like, just for example : a[i][i].name = "Boston" a[i][i].country = "India" Dummy Program I am using, similar to my actual code class TestingGround { int a[][] = new int[5][5]; boolean visited = false; public static void main(String[] args) { TestingGround tg = new TestingGround(); tg.runner(); } void runner() { for(int i = 0;i&lt; a.length;i++) for(int k = 0;k&lt;a[0].length;k++) if((i+k) % 3 ==0 ) a[i][k].visited = true; else a[i][k].visited = false; } }
type: Question
has comment: http://stackoverflow.com/comment/35927421
has title: Adding an object to array values
tagged with: java
score: 0
accepted answer: http://stackoverflow.com/a/23440074
tagged with: object
has answer: http://stackoverflow.com/a/23440078
tagged with: arrays
answer count: 5
has answer: http://stackoverflow.com/a/23440089
has answer: http://stackoverflow.com/a/23440122
possible better answer: http://stackoverflow.com/a/23440077
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23440077
has answer: http://stackoverflow.com/a/23440074
has comment: http://stackoverflow.com/comment/35927394

http://stackoverflow.com/a/23294313
type: AcceptedAnswer
downvote count: 0
has body: toArray() returns an array of Objects. If you want to create an array of Strings out of it, you will have to do it yourself. For example, Object [] objects = super.getAllKeys(); int size = objects.size(); String [] strings = new String[size]; for (int i = 0; i &lt; size; i++) strings[i] = objects[i].toString(); or something similar... Hope this is useful.
accepted answer of: http://stackoverflow.com/q/23294117
type: Answer
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/23294117

http://stackoverflow.com/a/23468146
has body: Since percolator will not work on parent/child relation until few month ( percolator on nested just wait out), I think the bestsolution is that you change the implementation of your software and use nested object instead of parent/child. I know it might sound heavy cause it will probably involve lot of change but it may be the best solution. Sincerely;
accepted answer of: http://stackoverflow.com/q/23336530
upvote count: 1
type: AcceptedAnswer
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/23336530

http://stackoverflow.com/comment/35778363
has text: the `tr` is the id variable for the transactions collection, like `u` is for the Users
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23360010

http://stackoverflow.com/a/23345485
upvote count: 2
answers question: http://stackoverflow.com/q/23345232
has body: Zoyd has it right, that this should be done with a class. Here's a more complete example. class MyClass { private String name; private int num; public MyClass(String name, int num) { this.name = name; this.num = num; } public String getName() { return name; } public int getNum() { return num; } } MyClass[] array = new MyClass[5]; array[0] = new MyClass("name1", 5); array[1] = new MyClass("name2", 8); ... If name or num ever need to change after original creation, then you can add setters for them.
type: AcceptedAnswer
type: Answer
score: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23345232

http://stackoverflow.com/comment/35950773
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23452680
has text: if Treeset does noy use hashcode , what will happen if i add treemap.add(1) and treemap.add(1), will it allow duplicates and if not how its managing without equals and hashcode ?
type: AnswerComment

http://stackoverflow.com/comment/35916191
type: Comment
has text: I am already having a custom library in my local drive and I want to add the same in my maven dependency. Can you please let me know how to add that custom library in my maven repository?
score: 0
comment on: http://stackoverflow.com/q/23434187
type: QuestionComment

http://stackoverflow.com/q/23327152
has comment: http://stackoverflow.com/comment/39680651
type: Question
has title: query nutch 2 table result from cassandra 2 dose not look right
tagged with: cassandra
accepted answer: http://stackoverflow.com/a/25752136
downvote count: 0
answer count: 1
favorite count: 0
has body: I am using Nutch 2.2.1 and Cassandra 2 to craw pages. for a test i just inject one url to Cassandra and explore the database. Using CQL i can query the table in the webpage keyspace cqlsh:simplex> select * from webpage.f; key | column1 | value --------------------------------------+---------+-------------------- 0x6564752e6373752e7777773a687474702f | 0x6669 | 0x00278d00 0x6564752e6373752e7777773a687474702f | 0x73 | 0x3f800000 0x6564752e6373752e7777773a687474702f | 0x7473 | 0x00000145a266703e which is fine if i convert those hex bytes to string. the key will be the reverted url. then i write java code to read the table f using datastax java driver 2 (http://www.datastax.com/documentation/developer/java-driver/2.0/java-driver/whatsNew2.html) i followed the sample code Cluster cluster = Cluster.builder().addContactPoint("10.20.104.181").build(); Session session = cluster.connect(); ResultSet results = session.execute("SELECT * FROM webpage.f"); for (Row row : results) { System.out.println("Key"); System.out.println(toStrFromByteBuffer(row.getBytes("key"))); System.out.println("column1"); System.out.println(toStrFromByteBuffer(row.getBytes("column1"))); System.out.println("value"); System.out.println(toStrFromByteBuffer(row.getBytes("value"))); } cluster.close(); public static String toStrFromByteBuffer(ByteBuffer buffer) { byte[] ar=buffer.array(); System.out.println(ar.length); return new String(ar,Charset.forName("UTF-8")); } the result is below. You can see row.getBytes("key") returns a whole row data not a specific column value. Could some master help on this?
upvote count: 2
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25752136
tagged with: java
tagged with: nutch

http://stackoverflow.com/comment/35747870
type: Comment
has text: @FrobberOfBits - I have updated my answer based on your comment.
comment on: http://stackoverflow.com/a/23343423
type: AnswerComment
score: 0

http://stackoverflow.com/q/23431760
tagged with: java
possible better answer: http://stackoverflow.com/a/23432084
linked to: http://stackoverflow.com/q/14601016
has answer: http://stackoverflow.com/a/23432084
has answer: http://stackoverflow.com/a/23432170
type: Question
score: 5
has comment: http://stackoverflow.com/comment/35912436
has comment: http://stackoverflow.com/comment/36570945
upvote count: 6
favorite count: 0
has comment: http://stackoverflow.com/comment/35911452
has comment: http://stackoverflow.com/comment/35912446
downvote count: 1
has comment: http://stackoverflow.com/comment/35911563
has answer: http://stackoverflow.com/a/23884675
answer count: 4
has answer: http://stackoverflow.com/a/23432032
has comment: http://stackoverflow.com/comment/35911661
accepted answer: http://stackoverflow.com/a/23432032
has title: Why don't common Map implementations cache the result of Map.containsKey() for Map.get()
tagged with: collections
has body: A common pattern with a map is to check if a key exists and then act on the value only if it does, consider: if(!map.containsKey(key)) { map.put(key, new DefaultValue()); } return map.get(key); However this is generally considered poor, as it requires two map lookups, where this alternative only requires one: Value result = map.get(key); if(result == null) { result = new DefaultValue(); map.put(key,result); } return result; Yet this second implementation has it's own problems. In addition to being less concise and readable, it's potentially incorrect, as it cannot differentiate between the case where the key does not exist and where the key exists but maps explicitly to null. In individual cases of course we can create external invariants that the map will not contain null values, however in general we cannot rely on this second pattern, needing to fall back to the less efficient implementation. But why does the first implementation need to be less efficient? HashMap's .containsKey() looks like this: public boolean containsKey(Object key) { return getEntry(key) != null; } And Guava's ImmutableMap.containsKey() similarly is: public boolean containsKey(@Nullable Object key) { return get(key) != null; } Since these calls go through all the work of doing a .get(), what is the disadvantage of caching the result of this call, and then short-circuting a successive call to .get() for the same key? It seems like the cost is a single pointer, yet the benefit would mean the "right" way to implement such a pattern is also the "efficient" way to do so. private transient Entry&lt;K,V&gt; lastContainsKeyResult = null; public boolean containsKey(Object key) { lastContainsKeyResult = getEntry(key); return lastContainsKeyResult != null; } public V get(Object key) { if(key != null &amp;&amp; lastContainsKeyResult != null &amp;&amp; key.equals(lastContainsKeyResult.getKey()) { return lastContainsKeyResult.getValue(); } // normal hash lookup }
type: AnsweredQuestion
tagged with: short-circuiting
tagged with: guava

http://stackoverflow.com/q/23310573
tagged with: java
type: Question
has title: Clarification about Thread's .isInterrupted(): what is "alive"?
answer count: 1
tagged with: interrupt
score: 0
linked to: http://stackoverflow.com/q/17293304
type: UnansweredQuestion
tagged with: multithreading
has answer: http://stackoverflow.com/a/23310614
has comment: http://stackoverflow.com/comment/35688183
has body: I have some trouble understanding what the javadoc for this method means to say here: A thread interruption ignored because a thread was not alive at the time of the interrupt will be reflected by this method returning false. Uhwell, if it's not alive it does not even run, does it? Or it isn't even born in the first place... So, what does the javadoc want to say here?
has comment: http://stackoverflow.com/comment/35687900

http://stackoverflow.com/comment/35718157
comment on: http://stackoverflow.com/q/23327143
has text: @n1234 thanks I will look in to it right now.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35847144
type: Comment
score: 0
has text: they have been initialized under the class name, this is just a portion of the full code
type: QuestionComment
comment on: http://stackoverflow.com/q/23397138

http://stackoverflow.com/comment/35768492
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23354125
has text: If you've verified that you are getting inside your if statement, have you tried delaying the call to `resp.writeHead()` until inside your `req.on('end')` callback?
score: 0

http://stackoverflow.com/a/23605411
type: Answer
upvote count: 11
accepted answer of: http://stackoverflow.com/q/23394024
score: 11
answers question: http://stackoverflow.com/q/23394024
has comment: http://stackoverflow.com/comment/103827192
has body: I got the answer after quite a while of trying different ways. The solution was pretty simple - to parse the time to a string as toString() didn't work. Date date; SimpleDateFormat df = new SimpleDateFormat("yyyyMMddHHmmss"); try { date = df.parse(String.valueOf(_time.getTime())); } catch (ParseException e) { throw new RuntimeException("Failed to parse date: ", e); } return date.getTime();
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/35820327
type: AnswerComment
has text: As I know, you can cast objects to primitive datatypes in jdk1.6
type: Comment
comment on: http://stackoverflow.com/a/23382933
score: 1

http://stackoverflow.com/q/23436286
type: UnansweredQuestion
tagged with: java
has body: I am currently studying this tutorial. The tutorial describes two different ways of associating a text-editing command (an Action instance) with a GUI element. Option 1: Get an array containing all available Actions from a specific JTextComponent by invoking component.getActions(). After that, sort them by name into a HashMap, and code a method that takes a name and returns an Action from the HashMap. Then associating a GUI element with an Action on a JTextComponent is done like in the following example: JMenu menu = new JMenu("Edit"); ... menu.add(getActionByName(DefaultEditorKit.cutAction)); Option 2: Instantiate the Action directly, and then associate a GUI element with it. For example: JMenu menu = new JMenu("Style"); Action action = new StyledEditorKit.BoldAction(); action.putValue(Action.NAME, "Bold"); menu.add(action); ... The tutorial states that the Action used in option 1 would be shared by all JTextComponents in the application, while the Action used in option 2 would be used only by a single JTextComponent. However, I'm not sure how this can be. Nowhere in option 2 is the Action bound to a particular JTextComponent, while in option 1 the Actions are received from a particular JTextComponent. Please explain why these two techniques differ in the results they generate. (The examples are taken from the tutorial).
tagged with: swing
type: Question
score: 4
upvote count: 4
answer count: 1
downvote count: 0
tagged with: action
favorite count: 0
has answer: http://stackoverflow.com/a/23436474
has title: Why do these two ways of associating a GUI element with an Action differ in their results?

http://stackoverflow.com/comment/35690183
type: AnswerComment
has text: I didn't assume, or mention, XML. If you annotate get methods instead of properties, then Hibernate will use get/set. However I wasn't explicit about this as nobody ever annotates the methods...
type: Comment
comment on: http://stackoverflow.com/a/23296708
score: 0

http://stackoverflow.com/a/23321714
answers question: http://stackoverflow.com/q/23319341
score: 0
type: Answer
has body: I think the challenge here is that this script runs with no knowledge of what happened on any occasion that it previously ran. So, one option would be to store the information about who received the last lead. This way when the next person fills in your web form, you can retrieve the value of the last recipient and send the current lead to the next recipient in an array of defined recipients (then update the information about who was the last recipient for the next time). If you don't have access to a database (or file or something else that is a 'permanent' type of storage) to store the value of the last recipient in, you could simply randomize who receives the current lead. The law of averages suggests that over time, the lead distribution should be relatively equal, though in practice this could result in one person getting all of the leads in a given period. $recipients=array("recipient1@email.com","recipient2@email.com"); $randnum = mt_rand(0,1); $sendto = $recipients[$randnum];

http://stackoverflow.com/comment/35815545
score: 0
has text: If the efficiency of the functions doesn't improve during the next weeks of the lecture, it would be quite embarrassing for the lecturer. At least that function is one of the least effective ways of removing all occurences of a char from a String i can think of right now. This function can be implemented to run in O(n) time instead of O(n^2) after all.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23379908

http://stackoverflow.com/comment/35709877
type: AnswerComment
has text: Thank you so very much. I'll just try to do it in the second way from the GUI builder, and I hope I succeed in that. Can you please clarify if '"paint" on the JPanel form' means just draw the image on the JPanel form? And will the image scale itself to match the JPanel's size? That is a major problem. The image becomes much bigger than the parent.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23322723

http://stackoverflow.com/q/23431963
has answer: http://stackoverflow.com/a/23432274
has comment: http://stackoverflow.com/comment/35911892
has body: Can I add program based on JFrame to JApplet ? How can I do that, when I try to do it like: public class Test extends JApplet{ public void init(){ JFrame frame=new JFrame(300,400); add(frame); frame.setVisible(true); } I got an error when i try to use appletviewer. Can anyone help me ?
answer count: 3
tagged with: japplet
has title: Adding JFrame to JApplet
downvote count: 0
tagged with: applet
favorite count: 0
accepted answer: http://stackoverflow.com/a/23432611
tagged with: jframe
upvote count: 1
tagged with: swing
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35924883
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/25386126
type: Question
has answer: http://stackoverflow.com/a/23432611
possible better answer: http://stackoverflow.com/a/23432274

http://stackoverflow.com/q/23327397
tagged with: matlab
type: Question
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/23327472
has answer: http://stackoverflow.com/a/23327472
score: 1
has answer: http://stackoverflow.com/a/23327546
tagged with: java
has title: How to run a MATLAB file (.m file) from java?
downvote count: 0
has body: I am trying to figure out a way to run a .m file from java. When the .m file is run it outputs a text file that I need to retrieve. I already have the code to retrieve the text file in java but I still cannot figure out how to start and run the .m file from java so that it outputs the file that I need. Any ideas?
favorite count: 0
has answer: http://stackoverflow.com/a/33791745
accepted answer: http://stackoverflow.com/a/23327546
tagged with: mixed-programming
has answer: http://stackoverflow.com/a/62998500
answer count: 4
upvote count: 1

http://stackoverflow.com/q/23372292
has answer: http://stackoverflow.com/a/23372354
score: -6
favorite count: 0
has comment: http://stackoverflow.com/comment/35801149
upvote count: 2
downvote count: 8
has comment: http://stackoverflow.com/comment/35801153
has body: I have an array named numbers that I want to populate with a for loop: int[] numbers; for ( int i = 0; i &lt;=10; i++) { // want to populate the array with a sequence of 0-10 } How can I populate the 11 values generated from the above for loop into my array?
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/23372438
has answer: http://stackoverflow.com/a/23372438
tagged with: java
accepted answer: http://stackoverflow.com/a/23372354
has comment: http://stackoverflow.com/comment/35801528
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/35801422
has title: Populate int array with for loop in Java

http://stackoverflow.com/a/23432516
answers question: http://stackoverflow.com/q/23414957
type: Answer
score: 0
has body: The node "Class Declaration" that you are interested in is actually the TypeDeclaration, the node from which to take in the information that you need. For example: The list of modifiers ('public', etc.) allows you to figure out which and how many modifiers (node.modifiers ()) The type of the super class, if it exists (node.getSuperclassType ()) All the declarations of the methods etc However, these are details that you need to build from a TypeDeclaration However, both methods are inherited TypeDeclaration that can help you get all the info that you need to traverse the tree in a top-down approach.

http://stackoverflow.com/a/36843825
has body: A return in a lambda equals a continue in a for-each, but there is no equivalent to a break. You can just do a return to continue: someObjects.forEach(obj -&gt; { if (some_condition_met) { return; } })
has comment: http://stackoverflow.com/comment/139868587
type: Answer
upvote count: 93
has comment: http://stackoverflow.com/comment/102686081
answers question: http://stackoverflow.com/q/23308193
score: 86
has comment: http://stackoverflow.com/comment/93786729
has comment: http://stackoverflow.com/comment/85101728
downvote count: 7

http://stackoverflow.com/a/49971006
has body: I encountered a similar problem in one of the projects, setting updatable = false fixed the issue for me. Example: @Lob @Column(name = "CONTENT", updatable = false) Blob content; Hibernate somehow tries to re-save the content, even when it was not changed.
upvote count: 4
type: Answer
answers question: http://stackoverflow.com/q/23370468
downvote count: 1
score: 3

http://stackoverflow.com/a/23420145
has comment: http://stackoverflow.com/comment/35904360
has comment: http://stackoverflow.com/comment/35918462
has body: EditorKit is the abstract parent of DefaultEditorKit and StyledEditorKit, both of which export useful Action classes that operate on the Document model common to text components. In this example, editor kit actions update the Document, which indirectly updates the listening view component. Charles Bell's HTMLDocumentEditor, cited here, is a related example.
type: Answer
has comment: http://stackoverflow.com/comment/35902060
has comment: http://stackoverflow.com/comment/35901846
upvote count: 2
has comment: http://stackoverflow.com/comment/35902409
score: 2
answers question: http://stackoverflow.com/q/23414137
downvote count: 0
has comment: http://stackoverflow.com/comment/35903477

http://stackoverflow.com/q/23297685
tagged with: jersey
has answer: http://stackoverflow.com/a/23297731
answer count: 1
downvote count: 0
accepted answer: http://stackoverflow.com/a/23297731
has title: Accepting different types of JSON array input?
tagged with: jax-rs
score: 1
favorite count: 0
tagged with: rest
upvote count: 1
type: AnsweredQuestion
has body: I have a JAX-RS/Jersey project where I'd like to make things easier for my clients. Currently a POST body to a service is like this: POST http://localhost:7101/account/2274321/pieces/ { "piePieceIds": [ 1 ], "cakePieceIds": [ 2 ], "splitName": "Split" } I can map the arrays to an input object using private List&lt;Long&gt; piePieceIds; private List&lt;Long&gt; cakePieceIds; This works fine. However, a client has asked for a change to make her life easier: POST http://localhost:7101/account/2274321/pieces/ { "piePieceIds": [ { "piePieceId": 1 } ], "cakePieceIds": [ { "cakePieceId": 2 } ], "splitName": "Split" } How would I model each array to get the correct input?
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question

http://stackoverflow.com/a/23325326
accepted answer of: http://stackoverflow.com/q/23325190
score: 1
has body: JPA 2.1 allows defining custom types in a standard way. Using the @Convert annotation. See http://www.thoughts-on-java.org/2013/10/jpa-21-how-to-implement-type-converter.html for an explanation, is the javadoc is not sufficient. If you're still using JPA 2.0, then Hibernate has a proprietary way of defining custom types.
upvote count: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23325190
downvote count: 0
type: Answer

http://stackoverflow.com/q/23300710
upvote count: 1
tagged with: io
favorite count: 0
has title: java: converting capital chars to ints
has comment: http://stackoverflow.com/comment/35669821
possible better answer: http://stackoverflow.com/a/23300736
type: AnsweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/23300747
accepted answer: http://stackoverflow.com/a/23300747
answer count: 2
has comment: http://stackoverflow.com/comment/35669747
score: -1
has comment: http://stackoverflow.com/comment/35669734
has answer: http://stackoverflow.com/a/23300736
has body: I am working on a USACO problem (ride) and I am trying to convert a capital char (i.e.'A') to it's respective int (for 'A' it would be 1) and It does not seem to be working. What I am currently doing is: for(char c1 : st1ch) { int charint = (int)c1; totalcharsum1 = totalcharsum1*charint; } ..in order to convert a read string from a file (which I converted to an array of chars) to their int counterparts. I assumed and read that (int)"A" etc. would be 1. However, my code does not produce the right result apparently. I believe this is the problem as I can see no other problems. I have found no guide to this problem. Of course my mistake may be elsewhere so Ill post my code below anyway: import java.io.*; class ride { public static void main(String[] arg) throws IOException{ BufferedReader reader = new BufferedReader(new FileReader ("ride.in")); String st1 = reader.readLine(); String st2 = reader.readLine(); int totalcharsum1 = 1; int totalcharsum2 = 1; char[] st1ch = st1.toCharArray(); char[] st2ch = st2.toCharArray(); for(char c1 : st1ch) { int charint = (int)c1; totalcharsum1 = totalcharsum1*charint; } for(char c2 : st2ch) { int charint = (int)c2; totalcharsum2 = totalcharsum2*charint; } PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter("ride.out"))); if(totalcharsum1%47 == totalcharsum2%47) { out.println("GO"); }else{ out.println("STAY"); } out.close(); System.exit(0); } } My questions is how do you convert a capital char to its respective int on the alphabet? Thanks, Sam.
downvote count: 2
tagged with: char

http://stackoverflow.com/a/23398311
type: Answer
accepted answer of: http://stackoverflow.com/q/23394760
answers question: http://stackoverflow.com/q/23394760
has body: You can use Struts2 JSON plugin API to serialize object. The same way JSONResult is doing when it's executed. String json = JSONUtil.serialize(rootObject, excludeProperties, includeProperties, ignoreHierarchy, enumAsBean, excludeNullProperties);
upvote count: 1
score: 1
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/23347554
downvote count: 3
has comment: http://stackoverflow.com/comment/35755295
type: Question
has comment: http://stackoverflow.com/comment/35755421
answer count: 1
favorite count: 0
has title: Java Hangman program
score: -3
upvote count: 0
has body: I need help figuring out the following errors in my code: replacing the correct letters the user inputs in the mystery word. My last method's function is to do this but I cannot figure out why it will only input a single correct letter and not all of the correct guesses. Also the maximum number of tries the user has is 8 but when I compile my program the number of tries will go into the negatives and I cannot figure out what is wrong with my maximum tries loops. Thank you in advance! I really appreciate this. **Also using several methods in this program is a requirement for my assignment! import java.util.*; import java.io.*; public class Hangman { public static Scanner keyboard; public static final int MAXSIZE = 15000; public static final int NUM_GUESS = 8; public static final int WORD_LENGTH = 20; public static void main(String[] args) { keyboard = new Scanner(System.in); int random = pickrandom(MAXSIZE); try { // Set up connection to the input file Scanner input = new Scanner(new FileReader("dictionary.txt")); String [] dictionaryWords = new String [MAXSIZE]; int usedsize = 0; while ( usedsize &lt; MAXSIZE &amp;&amp; input.hasNextLine() ){ dictionaryWords [usedsize] = input.nextLine(); usedsize ++; } System.out .println(" H A N G M A N. " + "\n This is a word guessing game. " + "\n A word will be selected at random and kept hidden. You will try to figure out the secret word by" + "\n guessing letters which you think are in the word. " + "\n You will guess one letter at a time. " + "\n If the letter you guess is correct, the position(s) of the letter in the secret word will be shown. " + "\n You will be allowed " + NUM_GUESS + " wrong guesses If you guess incorrectly " + NUM_GUESS+ " times, you lose the game. " + "\n If you guess all of the letters in the word, you win." + "\n\n Press enter to continue "); keyboard.nextLine(); clearScreen(); String word = dictionaryWords[random]; System.out.println(dictionaryWords[random]); String blank = blankWord(word); String d…
has comment: http://stackoverflow.com/comment/35755144
has answer: http://stackoverflow.com/a/23347698
type: UnansweredQuestion
tagged with: java

http://stackoverflow.com/q/23330673
has comment: http://stackoverflow.com/comment/35724741
has title: Average of non-zero values in array (Java)
answer count: 3
has answer: http://stackoverflow.com/a/23330700
has comment: http://stackoverflow.com/comment/35724730
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35724735
score: -1
has body: I'm trying to find the average of an array but I only want the values greater than zero to be included. This is what I have right now: double total = 0; double average; for (int index = 1; index &lt; monthlyVisitors.length; index++) { if (monthlyVisitors[index] &gt; 0) total += monthlyVisitors[index]; } average = total / monthlyVisitors.length; I've tried what feels like a million different things at this point. I know it's simple but I can't figure it out. Thanks!
has comment: http://stackoverflow.com/comment/35724959
tagged with: java
downvote count: 2
upvote count: 1
type: Question
tagged with: average
has answer: http://stackoverflow.com/a/23330829
tagged with: arrays
has answer: http://stackoverflow.com/a/23330709

jenkins
tags question: http://stackoverflow.com/q/23335916
tag name: jenkins
tags question: http://stackoverflow.com/q/23360092
tags question: http://stackoverflow.com/q/23416264
tags question: http://stackoverflow.com/q/23408056
tags question: http://stackoverflow.com/q/23415268
tags question: http://stackoverflow.com/q/23335943
tags question: http://stackoverflow.com/q/23428868
tags question: http://stackoverflow.com/q/23304492
type: Tag

http://stackoverflow.com/comment/35825635
comment on: http://stackoverflow.com/q/23384004
type: Comment
type: QuestionComment
has text: Please show the method code
score: 0

http://stackoverflow.com/comment/35681918
type: AnswerComment
has text: Yep! If it works I will be sure to do that!
type: Comment
comment on: http://stackoverflow.com/a/23307365
score: 0

http://stackoverflow.com/a/24416369
type: Answer
has body: I ran into the same issue and used public Response login(@Context Map&lt;String, Object&gt; request) { } This essentially hid the actual param from the output. The annotation comes from javax.ws.rs.core
score: 0
answers question: http://stackoverflow.com/q/23414203

http://stackoverflow.com/comment/35805690
score: 0
has text: This sounds a bit dumb, but sometimes restarting Eclipse has positive effects...
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23374669

http://stackoverflow.com/q/23348321
type: Question
has comment: http://stackoverflow.com/comment/35756635
has comment: http://stackoverflow.com/comment/35756744
possible better answer: http://stackoverflow.com/a/23348412
has answer: http://stackoverflow.com/a/23348412
has body: I have written a piece of code here to generate a random PIN number of a specified length. The code works fine but I want to add an exception where a PIN would be invalid if it ends up in ascending order. For example if a PIN ended up being 1234, 3456, 4567 they would be invalid PINs. public static String generatePin(int nmrPinDigits) { String pin = new String(); NUMBER_PIN_DIGITS = nmrPinDigits; for(int i = 0; i &lt; NUMBER_PIN_DIGITS; i += 1) { double rnd = Math.random(); rnd *= 9; rnd += 1; byte rndByte = (byte)rnd; String rndStr = Byte.toString(rndByte); pin += rndStr; } return pin; }
accepted answer: http://stackoverflow.com/a/23348416
has comment: http://stackoverflow.com/comment/35756645
score: 0
tagged with: random
answer count: 3
has answer: http://stackoverflow.com/a/23348510
has comment: http://stackoverflow.com/comment/35756648
favorite count: 0
has comment: http://stackoverflow.com/comment/35756714
has comment: http://stackoverflow.com/comment/35756650
upvote count: 2
has comment: http://stackoverflow.com/comment/35756571
has answer: http://stackoverflow.com/a/23348416
type: AnsweredQuestion
tagged with: java
downvote count: 2
has title: Testing string for ascending order
has comment: http://stackoverflow.com/comment/35757397

http://stackoverflow.com/comment/35839652
comment on: http://stackoverflow.com/q/23392938
has text: I never heard of any Javascript Libraries that would do what you ask. That would be theoratically possible, Google Docs is doing that (even if that's not open source). I'm the maintainer of DocxTemplater, a docx templating engine, that might be a workaround to your problem. https://github.com/edi9999/docxtemplater
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23294953
upvote count: 1
answers question: http://stackoverflow.com/q/23294242
type: Answer
has body: You can look for :\tat, remove the text before the :. \t is a tab character. You can also include the text from the line before and the line after if it has :\t... e.g. String prev = null; while ((strLine = bufLogcat.readLine()) != null) { String curr = strLine.split(":", 2); if (curr.startsWith("\tat ")) { if (prev != null) System.out.println(prev); System.out.println(curr); prev = null; } else if (curr.startsWith("\t... ") &amp;&amp; prev == null) { System.out.println(curr); } else { prev = curr; } }
downvote count: 0
score: 1

http://stackoverflow.com/comment/35739182
has text: @user3534517 Change `db.setArray` to make a copy of the array that you pass, rather than storing the array: inside `setArray` make a new array of floats, and copy the items from the array that you pass in.
type: Comment
comment on: http://stackoverflow.com/a/23338677
score: 0
type: AnswerComment

http://stackoverflow.com/q/23360017
type: UnansweredQuestion
score: 1
has answer: http://stackoverflow.com/a/23360475
tagged with: java
has comment: http://stackoverflow.com/comment/35778016
type: Question
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/35779908
has title: Not able to buffer special characters
has comment: http://stackoverflow.com/comment/35778204
has body: while (!bStop) { byte[] buffer = new byte[256]; if (inputStream.available() &gt; 0) { inputStream.read(buffer); int i = 0; for (i = 0; i &lt; buffer.length &amp;&amp; buffer[i] != 0; i++) { } final String strInput = new String(buffer, 0, i); System.out.println(strInput);` } The inputstream data is coming in encrypted form in bytes. When i print the data i get funny characters. How can i directly convert the inputstream to hexadecimal in a form of -> 01 2A 03 AA. Please Help.
tagged with: android
favorite count: 0
downvote count: 0

http://stackoverflow.com/comment/35912339
has text: Didn't you forget `extends Identified`? I guess it's unrelated to Lombok as it only creates your getters and setters and Jackson probably works with fields directly.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23423774

http://stackoverflow.com/comment/36009907
has text: Second access? I'm unable to do a `ExecutionResult.dumpToString()` as it throws the error `Cannot make a static reference to the non-static method dumpToString() from the type ExecutionResult` in eclipse...
type: Comment
comment on: http://stackoverflow.com/a/23404886
score: 0
type: AnswerComment

http://stackoverflow.com/comment/35809407
type: AnswerComment
type: Comment
has text: This won't work as you expect for a 2D array -- you'll just get a copy of the first dimension and second dimension will be *the same* arrays as the original. Perhaps create the first dimension manually and use `copyOf()` to populate the second dimension.
score: 1
comment on: http://stackoverflow.com/a/23376558

http://stackoverflow.com/a/23447563
accepted answer of: http://stackoverflow.com/q/23447525
has body: An array in Java is an Object, so when you modify its elements, they change for all the references pointing to that array. If you want a local copy, you should clone it. E.g.: Integer[] origTimetable = bestSoFar.getChromosome(); Integer[] timetable = Arrays.copyOf (origTimetable, origTimeable.length);
has comment: http://stackoverflow.com/comment/35940895
score: 5
has comment: http://stackoverflow.com/comment/35940838
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35940894
has comment: http://stackoverflow.com/comment/35940918
type: Answer
upvote count: 5
downvote count: 0
answers question: http://stackoverflow.com/q/23447525

http://stackoverflow.com/comment/35998583
type: Comment
has text: I am not importing `java.awt.Dialog; `. I am importing `import org.controlsfx.dialog.Dialog;` and I am wondering why I am getting ` an error `java.awt.Dialog is already defined in a single-type import`. If I can't define `showException()` inside try-catch block, then how should I go about showing a dialog as soon as exception occurs? By the way `showException()` method doesn't throw any errors when I declare it inside the catch block.
comment on: http://stackoverflow.com/a/23435455
type: AnswerComment
score: 0

http://stackoverflow.com/q/23304104
has comment: http://stackoverflow.com/comment/35676198
has comment: http://stackoverflow.com/comment/35676485
duplicate of: http://stackoverflow.com/q/14944333
has comment: http://stackoverflow.com/comment/35676270
accepted answer: http://stackoverflow.com/a/23304145
answer count: 2
possible better answer: http://stackoverflow.com/a/23304171
downvote count: 0
has answer: http://stackoverflow.com/a/23304171
favorite count: 0
tagged with: field
has title: How can I get the name of a field in an Object?
linked to: http://stackoverflow.com/q/14944333
has body: Is there a method that exists that allows me to get the name of a field in another object?
type: AnsweredQuestion
tagged with: reflection
score: 1
has answer: http://stackoverflow.com/a/23304145
tagged with: java
has comment: http://stackoverflow.com/comment/35676168
upvote count: 1
type: Question

http://stackoverflow.com/a/23292639
answers question: http://stackoverflow.com/q/23292311
has comment: http://stackoverflow.com/comment/35656057
score: 0
has comment: http://stackoverflow.com/comment/35658793
type: Answer
has body: It is possible to use this Query.setMaxResults() since limit was never implemented in Hibernate like in SQL There is a similar post here, it might help you.. How do you do a limit query in HQL?

http://stackoverflow.com/q/23390237
type: Question
has title: Debugging tests in play
tagged with: debugging
tagged with: playframework
answer count: 1
score: 4
has answer: http://stackoverflow.com/a/26698457
has comment: http://stackoverflow.com/comment/35833822
has comment: http://stackoverflow.com/comment/35834825
upvote count: 4
favorite count: 0
tagged with: playframework-2.0
downvote count: 0
type: UnansweredQuestion
has body: I'm having issues when trying to debug a test which fails in Play. At first I couldn't make it hit a break point, which turned out to be caused by the forking of a new JVM which happens when testing, so I found out I need to add: javaOptions in Test ++= Seq( "-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=9998" ) to the build.sbt file. Now it hits the break point when I start the debugger (I'm using IntelliJ) but the problem is that it won't let me start the debugger before it starts the tests. If I use play debug then play starts and opens the socket (9999) and then I can start the debugger and only then in the play console start my app (using run), but I can't do the same with the tests.. Once I use play test the tests start so I have to start the debugger after the tests started running. Is there any way around this? Thanks!
tagged with: testing
tagged with: java

http://stackoverflow.com/comment/35859212
type: Comment
comment on: http://stackoverflow.com/q/23402577
score: 0
has text: I'm not sure if it is a philosophical question. I'm really trying to see if I am following Android coding standards in terms of software engineering in the "industry". I can do work arounds for anything I want if it is just my code but I want to know if it would be considered to violate separation of concerns in regards to the MVC pattern.
type: QuestionComment

http://stackoverflow.com/q/23337649
tagged with: javadoc
has body: Javadoc seems to only process @value tags on classes declaring the referenced fields and only references without the classname. Example: I have the classes /** {@value #F} */ public class A { public static final String F = "field"; } and /** {@value A#F} */ public class B {} The jdk 1.7 javadoc tool processes the @value tag on A but for B I get the following warning: warning - A#F (referenced by @value tag) is an unknown reference. This waring also occures when I try to reference the field in the javadoc of A with A#F. When I use a @link tag instead everything works as expected. I could not find any documentation mentioning that the @value tag may only reference Fields declared in the class the javadoc is on. Is this a bug or is there another way to get the @value tag to display the value?
has answer: http://stackoverflow.com/a/29467420
answer count: 1
upvote count: 6
has comment: http://stackoverflow.com/comment/35739719
favorite count: 0
has title: unexpected result for @value in javadoc
downvote count: 0
has comment: http://stackoverflow.com/comment/35741607
type: UnansweredQuestion
score: 6
type: Question
tagged with: java

http://stackoverflow.com/a/36357585
upvote count: 3
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/23341391
score: 3
has body: I have also encountered same error in oracle db and foudn that Hibernate Guys fixed here In my case we were already using hiberante 4.3.7 but didnt mention that field is Lob in Entity Reproducing Steps Have fields with varchar2 datatype and clob data type.Make sure your column name are in this alphabetic order clob_field,varchar_two_field1,varchar_two_field2. Now update clob_field with &lt; 2000 bytes and varchar_two_field1 with 4000 bytes size. This should end up with error ORA-24816: Expanded non LONG bind data supplied after actual LONG or LOB column Solution Make sure you have hiberante 4.1.8, &lt; 4.3.0.Beta1 Annotate your clob/blob field in respective Entity as import javax.persistence.Lob; ... @Lob @Column(name = "description") private String description; .... If you want to see the difference , by after making above changes enable debug for sql statements by setting "true" for "hibernate.show_sql" in persistence.xml.

http://stackoverflow.com/a/23321164
score: 2
accepted answer of: http://stackoverflow.com/q/23320878
upvote count: 2
answers question: http://stackoverflow.com/q/23320878
type: AcceptedAnswer
downvote count: 0
has body: C and C++ are languages designed to be compiled and generate fast and efficient code. Interpreters, by the definition that they "interpret" the code, are generally slow (or at least slower than the same compiled language, assuming a good compiler). However, there are combinations of clang and llvm-jit that could be (and has been) built into an "interpreted version of C or C++". I think there are some limitations, and I've never actually used it. There is no great technical reason NOT to do this, it's just that it's about the same amount of work, if not more than, the work to write a compiler, and the end result of writing a compiler is "better".
type: Answer

http://stackoverflow.com/comment/35729014
type: Comment
type: QuestionComment
score: 0
has text: Possible Duplicate of : http://stackoverflow.com/questions/9078528/tool-to-remove-javadoc-comments
comment on: http://stackoverflow.com/q/23333031

http://stackoverflow.com/comment/35893315
type: Comment
type: QuestionComment
has text: An `int` is 4 bytes. You've only added 2 to to your `ByteBuffer`.
score: 0
comment on: http://stackoverflow.com/q/23421739

http://stackoverflow.com/q/23408521
tagged with: java
has title: GWT SuperDevMode breakpoints not working
type: Question
tagged with: intellij-idea
downvote count: 0
tagged with: javascript
has answer: http://stackoverflow.com/a/23435129
has answer: http://stackoverflow.com/a/23882852
answer count: 3
favorite count: 0
has comment: http://stackoverflow.com/comment/36596589
has answer: http://stackoverflow.com/a/23905806
accepted answer: http://stackoverflow.com/a/23905806
has body: I'm using IntelliJ, and I'm trying to put a breakpoint in a class, sometimes it works, but sometimes it brings the debugger in the file MyApp-0.js and I have to debug cryptic generated javascript. Is there a way to navigate with my breakpoints in the corresponding Java file? I am using IntelliJ 13.1.2 And yes, my GWT module uses the super dev mode settings: &lt;add-linker name="xsiframe"/&gt; &lt;set-configuration-property name="devModeRedirectEnabled" value="true"/&gt; edit: Also yes, I'm using the Jetbrains javascript debugging plugin in the latest version of Chrome. I can access my sourcemaps from my code server manually by going to the code server page... Using IntelliJ plugin I go to http://localhost:9876/sourcemaps/MyApp/ and I see the source. It'd be useful to see how the config should look like in IntelliJ maybe.
score: 13
possible better answer: http://stackoverflow.com/a/23435129
upvote count: 13
tagged with: gwt
type: AnsweredQuestion

http://stackoverflow.com/comment/35690063
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23311529
has text: Thanks! That worked for me :) Although I had to make b and t final!

http://stackoverflow.com/comment/35808778
type: Comment
score: 0
comment on: http://stackoverflow.com/a/23376390
has text: This was almost a month ago now, I've closed and opened Eclipse many times.
type: AnswerComment

http://stackoverflow.com/q/23360997
tagged with: java
type: Question
has body: I have a class containing different graphic elements that I serialized. I use a variable is instantiated in the default constructor. In order to properly put my items, I would have repositioned after the creation of this variable. But during deserialization, the deserialized attributes are not available in the constructor. So I'd just run a method after the object is created and all the attributes are correctly deserialized How can I do that? (for serialization and deserialization, I use Java beans XMLEncoder and XMLDecoder) EDIT: In fact, the class which raises me problem is an attribute of a class container who is she same an attribute of a general class Sheet extends JPanel -> JPanel left_container -> Button extends JButton Sheet is the class that I serialize and thus serialize the Button class.
score: 0
has comment: http://stackoverflow.com/comment/35781461
tagged with: xml-deserialization
tagged with: serialization
tagged with: xml-serialization
has comment: http://stackoverflow.com/comment/35786443
type: UnansweredQuestion
has title: How to automatically execute a method after XML deserialization?
tagged with: http://stackoverflow.com/tag/xml
answer count: 0

http://stackoverflow.com/comment/35816650
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23380773
type: Comment
has text: no the letters and numbers can be any combination of letters and numbers

http://stackoverflow.com/comment/35847851
type: Comment
has text: I mean suppose you have special chars in userName, encode userName to UTF-8 and send
score: 0
comment on: http://stackoverflow.com/a/23397432
type: AnswerComment

http://stackoverflow.com/comment/35879688
type: AnswerComment
type: Comment
has text: see @value is the spring EL feature, so get it work we need to make the containing class as a spring bean. you can do that even without xml config but ofcourse you need to use java side config for spring
score: 0
comment on: http://stackoverflow.com/a/23414402

http://stackoverflow.com/a/23437628
type: Answer
has body: Error:FirstGui cannot be resolved to a type This means that the compiler cannot find any class called FirstGui Since you named your class test (which, btw, should be called Test and put inside a package), you should probably try test gui = new test(); import javax.swing.JFrame; import javax.swing.SwingUtilities; import javax.swing.JOptionPane; public class test extends JFrame { public static void main (String args[]) { test gui = new test(); gui.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); gui.setSize(200,200); gui.setVisible(true); gui.setTitle("chart-test"); } } FYI: Everything related to Swing should be invoked on the AWT thread, so you should start your UI in a SwingUtilities.invokeLater() call Don't extend if not needed. Here, no need to extend JFrame
accepted answer of: http://stackoverflow.com/q/23437597
score: 4
upvote count: 4
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23437597

http://stackoverflow.com/q/23386414
upvote count: 2
tagged with: java
has comment: http://stackoverflow.com/comment/35827289
type: Question
has answer: http://stackoverflow.com/a/23387176
has comment: http://stackoverflow.com/comment/35827617
has comment: http://stackoverflow.com/comment/35827143
has comment: http://stackoverflow.com/comment/35826843
has body: I have to make xml document on client side, convert it to byte array and do the reverse sequence on server side. My xml is: &lt;?xml version="1.0" encoding="UTF-8" standalone="no"?&gt; &lt;dirStruct&gt; &lt;file modified="1398855221782" name="sharedFolder\hey.txt"/&gt; &lt;/dirStruct&gt; ... verified with online xml validators, no errors found. Get it on server side: byte[] msg = new byte[5000]; // buffer is large enough, so it isn't problem. in.read(msg); DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder docBuilder = docFactory.newDocumentBuilder(); Document doc = docBuilder.parse(new ByteArrayInputStream(msg)); // Here's i get an exeption ... input data isn't null, verified up. Exception is: [Fatal Error] :1:138: Content is not allowed in trailing section. org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 138; Content is not allowed in trailing section. Where's im wrong? ==================================== Client side: DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder docBuilder = docFactory.newDocumentBuilder(); Document doc = docBuilder.newDocument(); Element root = doc.createElement("dirStruct"); doc.appendChild(root); Element node = doc.createElement("file"); node.setAttribute("name", file.toString()); node.setAttribute("modified", Long.toString(file.lastModified())); root.appendChild(node); TransformerFactory transformerFactory = TransformerFactory.newInstance(); Transformer transformer = transformerFactory.newTransformer(); DOMSource source = new DOMSource(doc); StreamResult result = new StreamResult(stream); transformer.transform(source, result); ... stream is ByteArrayOutputStream. If i will change stream to System.out, i will get correct result too. To byte array is just data = stream.toByteArray();
has comment: http://stackoverflow.com/comment/35827358
has title: Java Cannot make xml from bytes
has comment: http://stackoverflow.com/comment/35826500
has comment: http://stackoverflow.com/comment/35827330
answer count: 1
downvote count: 0
accepted answer: http://stackoverflow.com/a/23387176
has comment: http://stackoverflow.com/comment/35826678
favorite count: 0
has comment: http://stackoverflow.com/comment/35828004
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
score: 2

http://stackoverflow.com/comment/35696543
type: AnswerComment
comment on: http://stackoverflow.com/a/23315362
score: 0
has text: Thanks, but i can use the Random class if i want? like @Braj example? whats the best?
type: Comment

http://stackoverflow.com/q/23296473
type: Question
score: 0
tagged with: performance
tagged with: java
tagged with: eclipse
has answer: http://stackoverflow.com/a/54959856
answer count: 1
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35662228
has comment: http://stackoverflow.com/comment/35662118
has title: Java crashes with Java was started but returned exit code=1
tagged with: android
has comment: http://stackoverflow.com/comment/62875867
has body: I use eclipse for android development. Sometimes, if Google Chrome is running, it crashes and Eclipse also. And I get message Java was started but returned exit code=1. Full message is in print screen. and my eclipse.ini : -startup plugins/org.eclipse.equinox.launcher_1.3.0.v20130327-1440.jar --launcher.library plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.200.v20130807-1835 -product org.eclipse.epp.package.standard.product --launcher.defaultAction openFile --launcher.XXMaxPermSize 512M -showsplash org.eclipse.platform --launcher.XXMaxPermSize 512m --launcher.defaultAction openFile -vm C:/Program Files/Java/jdk1.7.0_51/jre/bin/server/jvm.dll -vmargs -Xms1024m -Xmx1024m -XX:MaxPermSize=512m

http://stackoverflow.com/comment/35840996
type: AnswerComment
has text: That isn't really what I was looking for. I would like the source of the subproject to be **include** in the main jar, so that a jar containing the **classes of both projects** is built.
comment on: http://stackoverflow.com/a/23393778
score: 0
type: Comment

http://stackoverflow.com/a/23295405
downvote count: 0
has body: Here's your issue: Message#getContent() So once you have the object i.e. Object content = message.getContent() you should do an instance check to see if it's either a String or Multipart class. I.e. Object content = message.getContent() if ( content instanceof String ) { String text = (String) content; // Do things } else if ( content instanceof Multipart ) { Multipart multiPart = (Multipart) content; // Do things }
has comment: http://stackoverflow.com/comment/35663045
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/35660122
score: 2
answers question: http://stackoverflow.com/q/23295149

http://stackoverflow.com/a/23312080
downvote count: 0
answers question: http://stackoverflow.com/q/23310539
type: Answer
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/35690220
has body: It didn't work for you because getWhen() returns the time in miliseconds of when that event occured, not the time the event lasted. This code works for me: long mousePressed; long mouseReleased; long mousePressTime; @Override public void mousePressed(java.awt.event.MouseEvent e) { mousePressed = e.getWhen(); } @Override public void mouseReleased(java.awt.event.MouseEvent e) { mouseReleased = e.getWhen(); mousePressTime = mouseReleased - mousePressed; System.out.println("PRESS TIME "+mousePressTime); }
accepted answer of: http://stackoverflow.com/q/23310539
type: AcceptedAnswer

http://stackoverflow.com/q/23291666
has comment: http://stackoverflow.com/comment/35822649
downvote count: 0
tagged with: jersey-2.0
tagged with: jax-rs
favorite count: 0
type: UnansweredQuestion
tagged with: jersey-client
has comment: http://stackoverflow.com/comment/131725026
has title: Jersey 2.7 - setting retry handler
has body: I would like to set a retry handler for Jersey client utilizing ApacheConnector. I wish to do it, because I want it to retry on timeout (my HAProxy will switch it to another server). I have no clue how to do this in Jersey 2.7. Example code: public static void Example() { ClientConfig clientConfig = new ClientConfig(); clientConfig.connectorProvider(new ApacheConnectorProvider()); clientConfig.property(ApacheClientProperties.CONNECTION_MANAGER, new PoolingHttpClientConnectionManager()); RequestConfig reqConfig = RequestConfig.custom().build(); clientConfig.property(ApacheClientProperties.REQUEST_CONFIG, reqConfig); Client client = ClientBuilder.newClient(clientConfig); WebTarget apiTarget = client.target("http://127.0.0.1/rest"); System.out.println(apiTarget.path(ApiConstant.PING) .path(ApiConstant.PING1) .request(MediaType.TEXT_PLAIN) .get(String.class)); } How, using this code, I can set a retry handler to send request again if server responds with an error? Is it possible?
answer count: 0
tagged with: java
type: Question
score: 5
upvote count: 5
tagged with: apache

http://stackoverflow.com/comment/35860742
comment on: http://stackoverflow.com/a/23404649
has text: How would I work a `BufferedReader` on a `HashMap`? I must admit I haven't seen an instance buffering HashMaps.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/23437583
tagged with: jcr
answer count: 2
downvote count: 0
tagged with: jackrabbit
favorite count: 0
has body: I am running the standalone server and trying to make a connection: try { Repository repository = JcrUtils.getRepository("http://localhost:8080/server/"); } catch (RepositoryException ex) { Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex); } As stated in: http://wiki.apache.org/jackrabbit/RemoteAccess However, I am getting: javax.jcr.RepositoryException: Unable to access a repository with the following settings: org.apache.jackrabbit.repository.uri: "the locla host" The following RepositoryFactory classes were consulted: org.apache.jackrabbit.core.RepositoryFactoryImpl: declined org.apache.jackrabbit.commons.JndiRepositoryFactory: declined Perhaps the repository you are trying to access is not available at the moment. I have no problem browsing the jackrabbit server with my webrowser.
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23529796
has answer: http://stackoverflow.com/a/23444071
score: 1
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/50980933
has title: Apache Jackrabbit, connect to localhost through WebDAV protocol
type: Question

http://stackoverflow.com/a/23309278
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/44953445
upvote count: 1
score: 1
has body: With the help of Aadil's answer I resolved The unknownHostException by the following steps: Step-1 Go to /etc/hosts Step-2 Edit the "hosts" file with IP 127.0.0.1 [space/tab] localhost [space/tab] HostName (e.g. static.98.35.ebonenet.com) Step-3 Save the file and try again
answers question: http://stackoverflow.com/q/23307260

http://stackoverflow.com/comment/35773800
score: 0
type: Comment
has text: @Corjava Use `for (Component comp : numbersP.getComponents())` instead
type: AnswerComment
comment on: http://stackoverflow.com/a/23357273

http://stackoverflow.com/comment/35814343
has text: Looks like your eclipse is too old. Try upgrading to Kelper?
comment on: http://stackoverflow.com/q/23379453
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/35988171
type: AnswerComment
has text: I'm not sure that what you are trying to accomplish makes sense. If you "forgot" to include logging where it you really need it then it is a design flaw that should be fixed where the problem really exists, not by using workarounds. Note that in any but the simplest applications exceptions happen quite often during normal flow of execution, including standard and any other libraries used. You would end up flooding your mailbox with junk mail if you managed to configure your application this way. That's why there's uncaught exception handler, but no simple way to handle _all_ exceptions.
type: Comment
comment on: http://stackoverflow.com/a/23335372
score: 1

http://stackoverflow.com/comment/94389849
has text: I don't have an answer but I wish to let you know where you might start debugging this. 1st - if you enter the query as-is into a SQL client - how long does it take? 2nd - use the column names in the query instead of asterisk ("*") - that goes with the next item 3rd - how many columns are there in the table? if there's a great many columns in the table that may also slow down the query.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23385525

http://stackoverflow.com/q/23412764
has answer: http://stackoverflow.com/a/23414003
has body: When my code didn't work, I started with the project I found here and ran it against our custom bluetooth device on my moto-x. Against the general attributes with profiles, I get data back from the following code: public void readCharacteristic(BluetoothGattCharacteristic characteristic) { if (mBluetoothAdapter == null || mBluetoothGatt == null) { Log.w(TAG, "BluetoothAdapter not initialized"); return; } mBluetoothGatt.readCharacteristic(characteristic); } which returns data asynchronously in: public void onCharacteristicRead(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic, int status) { if (status == BluetoothGatt.GATT_SUCCESS) { broadcastUpdate(ACTION_DATA_AVAILABLE, characteristic); } } This also works if i run this code against a heart rate monitor. If I run it against one of our custom properties without a default profile, the data never comes back. Ever. A google search included this: Cannot read characteristic. Android BLE but setting up notifications did not solve my problem. Any advice?
tagged with: android-4.4-kitkat
tagged with: bluetooth-lowenergy
type: Question
has title: readCharacteristic not returning data for custom attributes
tagged with: android
score: 0
tagged with: java
linked to: http://stackoverflow.com/q/22671473
answer count: 1
type: UnansweredQuestion

http://stackoverflow.com/a/23386074
downvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/100068859
has comment: http://stackoverflow.com/comment/100070561
has comment: http://stackoverflow.com/comment/100070896
upvote count: 91
score: 89
has comment: http://stackoverflow.com/comment/57837538
has comment: http://stackoverflow.com/comment/58297491
answers question: http://stackoverflow.com/q/23385434
has comment: http://stackoverflow.com/comment/100069806
has comment: http://stackoverflow.com/comment/71725872
has comment: http://stackoverflow.com/comment/52528173
has comment: http://stackoverflow.com/comment/74010437
has comment: http://stackoverflow.com/comment/79249510
has comment: http://stackoverflow.com/comment/50645687
has comment: http://stackoverflow.com/comment/67496599
has comment: http://stackoverflow.com/comment/96280028
has comment: http://stackoverflow.com/comment/122867973
has body: For better localization and language support, it is often convenient to use the ICU (International Components for Unicode) library from IBM. The APIs are similar to the standard Java APIs, but add additional support for localization and internationalization (e.g. time and calendar issues, sorting, formatting rules and a regex implementation with proper Unicode support). To create a Persian calendar and output the formatted date in Farsi, you would e.g. do something like this: import com.ibm.icu.text.DateFormat; import com.ibm.icu.util.Calendar; import com.ibm.icu.util.ULocale; ... ULocale locale = new ULocale("fa_IR@calendar=persian"); Calendar calendar = Calendar.getInstance(locale); DateFormat df = DateFormat.getDateInstance(DateFormat.FULL, locale); System.out.println(df.format(calendar)); This will output: چهارشنبه ۱۰ اردیبهشت ۱۳۹۳ ه‍.ش.

http://stackoverflow.com/a/23448551
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35960544
has body: It looks to me as if you are using JJT. Here are 3 ways to convert the input file to an XML file using JavaCC or JJT. It is easy to edit the generated SimpleNode class so that it outputs XML -- or whatever format you want. An alternative is to use JavaCC rather than JJT and to make SAX calls so that your parser constructs an XML document. Then it is easy to output the XML document. A third option is to stick with JJT and modify the SimpleNode class to produce an XML document (using either SAX or DOM). Then the XML document can outputted.
type: Answer
has comment: http://stackoverflow.com/comment/35954224
downvote count: 0
has comment: http://stackoverflow.com/comment/35959080
answers question: http://stackoverflow.com/q/23446263
score: 1
has comment: http://stackoverflow.com/comment/35959110
accepted answer of: http://stackoverflow.com/q/23446263
has comment: http://stackoverflow.com/comment/35949735
upvote count: 1

http://stackoverflow.com/comment/35755731
score: 0
comment on: http://stackoverflow.com/q/23346516
type: Comment
type: QuestionComment
has text: Well, that's a good reason. :-) But I'm confused how this could be the case, though. If you define the class like this: `class DataProviderFactoryStub<T> implements DataProviderFactory`, and the method like this: `public DataProvider<T> getDataProvider` (and modify the constructor to take a `DataProvider<T>` instead of a `DataProvider`), shouldn't that work?

http://stackoverflow.com/comment/35663413
comment on: http://stackoverflow.com/a/23294517
score: 1
type: AnswerComment
has text: I am not sure what kind of additional explanations are to be expected here. The code snippet above demonstrates how to create an HttpClient instance with an empty (no-op) protocol processor, which guarantees no request headers will ever be added to outgoing messages executed by such client
type: Comment

http://stackoverflow.com/comment/35674694
comment on: http://stackoverflow.com/a/23301709
score: 0
type: Comment
has text: tried it out and still will only exit if you say "n". any ideas?
type: AnswerComment

http://stackoverflow.com/comment/35665486
score: 0
type: Comment
type: QuestionComment
has text: Pls try some code.. And post for doubt
comment on: http://stackoverflow.com/q/23298341

http://stackoverflow.com/comment/56609294
type: QuestionComment
score: 2
has text: In the end we just used vanilla Eclipse, Spring and Tomcat.
type: Comment
comment on: http://stackoverflow.com/q/23424312

http://stackoverflow.com/comment/35765804
has text: The first one, no sign bit. when it run, it says this 10001110 (this is just example) but it should be 10001111.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23352342

http://stackoverflow.com/comment/35863620
type: AnswerComment
has text: Yes it's worked. But i need the Light classe because i need the coordonates of each Light and the methods that i have created in this class. For exemple i need coordonates for turn off the light when i clicked on and i need that the light around change their stage too. Maybe i can put the light class into my window class but one file for my project is not very clean no ?
comment on: http://stackoverflow.com/a/23405802
type: Comment
score: 0

http://stackoverflow.com/q/23387014
type: Question
type: AnsweredQuestion
has title: (Java Swing) Stalling actionPerformed Command Until A Dialog Returns
has answer: http://stackoverflow.com/a/23391959
accepted answer: http://stackoverflow.com/a/23391959
tagged with: dialog
upvote count: 1
has body: I need to create a JDialog, or a JFrame class (it doesn't particularly matter so long as it's a graphical interface) - that can be used in a static command that is called from the within the actionPerformed(ActionEvent) handler and will stall that process until the user provides their selections from the user interface. Obviously it is possible to do, because this is exactly what the dialogs JOptionPane creates does. But when I try to stall the thread until the user has completed the selection process, the interface doesn't display properly. Here is the part of my code that I'm having trouble with: public static Results queryForResults(String message, int propertyOne, int propertyTwo){ MyCustomDialog mcd = new MyCustomDialog(message, propertyOne,propertyTwo); mcd.show(); // complete() is a boolean property of my MyCustomDialog class that turns // true when the interface has been completed. while(!mcd.complete()){ synchronized(mcd){ try{ mcd.wait(10000L); } catch(InterruptedException e) { e.printStackTrace(); return null; } } } mcd.dispose(); // My MyCustomDialog class has a getResults() property which returns // a Results object (i.e. another custom class I've made to contain // the selections made by the user.) return mcd.getResults(); } The dialog outer frame appears, but it's insides don't. They just seem to be a screen capture of whatever was on the screen beneath the dialog when it appeared. I get the impression that this isn't working because I'm not supposed to be stalling the Swing Event thread with the wait command. So how do you do it?
answer count: 1
favorite count: 0
tagged with: events
downvote count: 0
score: 1
tagged with: java
tagged with: swing

union
type: Tag
tag name: union
tags question: http://stackoverflow.com/q/23317632

http://stackoverflow.com/comment/35784648
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23363707
has text: Question is : ***Should this error be caught by the compiler at compile time, and not at runtime?`***
score: 0

http://stackoverflow.com/q/23318656
has answer: http://stackoverflow.com/a/23318738
type: Question
upvote count: 2
has title: Why does getting a missing key from java.util.HashMap[Long,Long] return 0L?
tagged with: hashmap
has answer: http://stackoverflow.com/a/23320712
has body: I was playing in the scala repl and found this: scala&gt; new java.util.HashMap[Long, Long]().get(1L) res2: Long = 0 Why does it return that? Java hashmaps are supposed to return null for missing keys.
answer count: 3
possible better answer: http://stackoverflow.com/a/23318706
favorite count: 0
has answer: http://stackoverflow.com/a/23318706
tagged with: scala
score: 2
type: AnsweredQuestion
downvote count: 0
accepted answer: http://stackoverflow.com/a/23320712
tagged with: java

http://stackoverflow.com/a/23346803
score: 1
upvote count: 1
downvote count: 0
has body: There is no set function for this kind of behavior, but you could do something like this: public static String getColorName(int r, int g, int b) { String[] colorNames = new String[] { "BLACK", "BLUE", "GREEN", "CYAN", "DARK_GRAY", "GRAY", "LIGHT_GRAY", "MAGENTA", "ORANGE", "PINK", "RED", "WHITE", "YELLOW" }; Color userProvidedColor = new Color(r,g,b); Color color; Field field; for (String colorName : colorNames) { try { field = Class.forName("java.awt.Color").getField(colorName); color = (Color)field.get(null); if (color.equals(userProvidedColor)) { return colorName; // Or maybe return colorName.toLowerCase() for aesthetics } } catch (Exception e) { } } Color someOtherCustomDefinedColorMaybePurple = new Color(128,0,128); if (someOtherCustomDefinedColorMaybePurple.equals(userProvidedColor)) { return "Purple"; } return "Undefined"; } There are a few options from here as well, maybe you want the nearest color? In which case you could try and resolve the distance somehow (here by distance from each r,g,b coordinate, admittedly not the best method but simple enough for this example, this wiki page has a good discussion on more rigorous methods) // ... String minColorName = ""; float minColorDistance = 10000000; float thisColorDistance = -1; for (String colorName : colorNames) { try { field = Class.forName("java.awt.Color").getField(colorName); color = (Color)field.get(null); thisColorDistance = ( Math.abs(color.red - userProvidedColor.red) + Math.abs(color.green - userProvidedColor.green) + Math.abs(color.blue - userProvidedColor.blue) ); if (thisColorDistance &lt; minColorDistance) { minColorName = colorName; minColorDistance = thisColorDistance; } } catch (Exception e) { // exception that should only be raised in the case color name is not defined, which shouldnt happen } } if (minColorName.length &gt; 0) { return minColorName; } // Tests on other custom defined colors This should outline how you would be able to compare to the built in colors from the Color library. Y…
type: Answer
answers question: http://stackoverflow.com/q/23346208

http://stackoverflow.com/comment/35850410
comment on: http://stackoverflow.com/q/23398914
score: 1
type: Comment
has text: The TCP protocol keeps the connection alive without you needing to send anything.
type: QuestionComment

http://stackoverflow.com/comment/35889575
comment on: http://stackoverflow.com/a/23418810
score: 0
type: Comment
type: AnswerComment
has text: Thank you very much. I've spent far too much time on that issue. If it's not too much trouble, would you quickly tell me exactly why calling builder.setView() allowed me to grab that text and the other way would not?

http://stackoverflow.com/comment/35698832
type: Comment
comment on: http://stackoverflow.com/a/23316306
type: AnswerComment
has text: OP asked `Is there any alternative?`
score: 0

http://stackoverflow.com/comment/35779744
comment on: http://stackoverflow.com/a/23335492
type: Comment
score: 0
type: AnswerComment
has text: Accepted answer, because of the simplicity of the solution.

http://stackoverflow.com/comment/35705206
has text: @Mathias thank you Mathias First I couldn't realized @ azurefrog comment "Generally in big O notation you don't care about the base". Now clear.
comment on: http://stackoverflow.com/a/23308114
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/23497306
upvote count: 1
answers question: http://stackoverflow.com/q/23435985
has body: So I added 'switch' inside 'for' loops, so that each time I click a button it flips an image in particular order. I wanted the same images to flip not any text, so I used 'setIcon()' method. For that I created three ImageIcon objects in main class.A counter is added for three different cases &amp; it keeps looping. My final answer code is as follows : import javax.swing.*; import java.awt.*; import java.awt.event.*; public class TicTacToe extends JFrame { public JButton[][] labels = new JButton[3][3]; public ImageIcon[] icons = new ImageIcon[3]; byte value=0; public ImageIcon x= new ImageIcon("C:\\Users\\yogesh\\workspace\\hw3pandarey\\src\\hw3pandarey\\cross_symbol.gif"); public ImageIcon o= new ImageIcon("C:\\Users\\yogesh\\workspace\\hw3pandarey\\src\\hw3pandarey\\zero_symbol.gif"); public ImageIcon n= new ImageIcon(""); public TicTacToe() { // TODO Auto-generated constructor stub setLayout(new GridLayout(3,3)); for(int r=0; r&lt;labels.length ; r++) { for(int c=0; c&lt;labels.length ; c++) { int random = (int)(Math.random() * 3 + 0); System.out.println(random); JButton s = new JButton(this.icons[random]); this.add(s); this.labels[r][c] = s; if(random == 0) { System.out.println("Cross Image Icon"); labels[r][c].setIcon(new ImageIcon("C:\\Users\\yogesh\\workspace\\hw3pandarey\\src\\hw3pandarey\\cross_symbol.gif")); add(labels[r][c]); validate(); } else if(random == 1) { System.out.println("Not Image Icon"); labels[r][c].setIcon(new ImageIcon("C:\\Users\\yogesh\\workspace\\hw3pandarey\\src\\hw3pandarey\\zero_symbol.gif")); add(labels[r][c]); validate(); } else if(random == 2) { System.out.println("Keep it blank"); labels[r][c].setIcon(new ImageIcon()); add(labels[r][c]); validate(); } labels[r][c].addActionListener(new ButtonListener()); } } } // end of TicTacToe constructor public class ButtonListener implements ActionListener { @Override public void actionPerformed(ActionEvent e) { // TODO Auto-generated method stub for(int r = 0; r &lt; 3; r++) { for (int c = 0;…
downvote count: 0
type: Answer
score: 1

http://stackoverflow.com/q/23451771
type: Question
tagged with: search
upvote count: 0
answer count: 1
tagged with: arrays
tagged with: string
favorite count: 0
has answer: http://stackoverflow.com/a/23452284
has body: I been stuck in this program for a while I have to make a program that when user inputs the item and the store number it will give the quantity import java.util.Scanner; public class Searching { public static void main(String[] args) { String firstarray[][] = { {"", "Store101", "Store102", "Store103", "Store104"}, {"Tennis Shoes", "102", "54", "20", "78"}, {"Sweaters", "45", "25", "35", "75"}, {"Jeans", "12", "35", "45", "65"}, {"Shorts", "54", "25", "34", "45"}, {"Jackets", "15", "35", "50", "25"} }; Scanner input = new Scanner(System.in); System.out.println("Enter item"); String userintake = input.next(); System.out.println("Enter Store Number"); String store = input.next(); searchingitem(firstarray, userintake, store); } private static void searchingitem(String x[][], String item, String place) { for (int i = 0; i &lt; x.length; i++) { for (int j = 0; j &lt; x[i].length; j++) { if ((item.equals(x[i][j])) || (place.equals(x[i][j]))) { int row = i; int column = j; printArray(x, i, j); } } } } public static void printArray(String x[][], int product, int place) { for (int row = 0; row &lt; 1; row++) { for (int column = 0; column &lt; 1; column++) System.out.print(x[product][place] + "\t"); } } } When I run the program it outputs the words I typed in and not the quantity. I worked with the search method and it does give the right numbers but when it prints it doesn't print the correct answer any help as to what I can do to fix the problem?
type: UnansweredQuestion
downvote count: 2
has title: Searching for Strings in two dimensional arrays
score: -2
tagged with: java

http://stackoverflow.com/comment/35662179
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23296213
has text: but my application works perfectly on the emulator

http://stackoverflow.com/q/23413955
has answer: http://stackoverflow.com/a/23474972
type: Question
has comment: http://stackoverflow.com/comment/35878593
tagged with: string
upvote count: 3
score: 0
answer count: 3
downvote count: 3
has body: String oldStr = "aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa bbb bbb bbb bbb"; String newStr = "bbb bbb bbb bbb ccc ccc ccc ccc ccc ccc ccc"; How do I find what part of string in newStr already exists in oldStr. I need to be able to separate new Str as below: String newStrExistingContent = "bbb bbb bbb bbb"; String newStrNewContent = "ccc ccc ccc ccc ccc ccc ccc"; Edit: Let me make it more clear. No part of old or new str are known. User clicks a button n logs are displayed. User does some action on application, and clicks button again, and logs are displayed again. What I am trying to do is to show new lines added to log in a didifferent color. I hope this explanation helps.
has comment: http://stackoverflow.com/comment/35878554
linked to: http://stackoverflow.com/q/132478
has answer: http://stackoverflow.com/a/23414588
has comment: http://stackoverflow.com/comment/36211398
has comment: http://stackoverflow.com/comment/35878510
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35878524
has title: how to find what part of string exists in another string (java)
tagged with: java
has answer: http://stackoverflow.com/a/23414073

http://stackoverflow.com/a/23428917
type: Answer
has comment: http://stackoverflow.com/comment/35906089
downvote count: 0
has body: This is impossible due to the principle that, loosely speaking, a subclass should support everything the superclass supports (see also the Liskov substitution principle). Let me illustrate. With the structure you describe, you want the compiler to accept: Tower myTower = new Tower(); myTower.upgrade(ArrowTower.class) .. but not: GunTower myTower = new GunTower(); myTower.upgrade(ArrowTower.class); right? That would cause trouble, though. Look: Tower myTower = new GunTower(); myTower.upgrade(ArrowTower.class); Here we only made the type of 'myTower' a bit less specific, and now you'd like the compiler to suddenly disallow this call. That's surprising, and indeed Java doesn't allow it.
score: 1
answers question: http://stackoverflow.com/q/23428743
upvote count: 1

http://stackoverflow.com/comment/35813463
has text: (Very much to the point, see the `Entry<K,V>[] table = (Entry<K,V>[]) EMPTY_TABLE;` member in HashMap - an array is used, not a HashSet.)
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23378927
score: 0

http://stackoverflow.com/comment/35793779
has text: Tip… Names of day-of-week in English are provided as constants: [DateTimeConstants.MONDAY](http://www.joda.org/joda-time/apidocs/org/joda/time/DateTimeConstants.html#MONDAY) and so on. Makes your code more readable than testing for a number 1, 2, and such.
type: AnswerComment
comment on: http://stackoverflow.com/a/23364801
type: Comment
score: 1

http://stackoverflow.com/comment/35730115
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23327639
has text: Why do you want to have two threads here? It seems to me that the two threads would spend a lot of time waiting for each other, and you wouldn't get any gain from having them. For maximum efficiency, I would suggest running it all in the same thread.
score: 0

http://stackoverflow.com/q/23399650
downvote count: 1
type: Question
has body: Assuming I have a 2-D array as follow: double[][] a={{1,0,0},{0,0,1},{0,1,0}}; I need to use this 'a' in a loop, each time as an input of a method. According to the output of the method, one element of this 2-D array may change. for example: double [][] new_a=a; new_a[0][0]=0; I want to store the new-a in a Hash-map: HashMap&lt;Integer,double[][]&gt; Store=new HashMap&lt;Integer,double[][]&gt;(); Store.put(size.Store(),new_a); next time in the loop I need the original 'a' though. I don't know how I can make a copy from 2-D array 'a' in order to use the original one each time in the loop and store the new one in the Hash-map. When I coded like above it changes the original 'a' as well and when I want to store in 'Store' it replaces new_a for all previous stored arrays. I wonder if you can help me with this issue? Thanks.
has comment: http://stackoverflow.com/comment/35851651
has answer: http://stackoverflow.com/a/23399746
linked to: http://stackoverflow.com/q/5785745
answer count: 2
has title: How can I make a copy of 2-D array in java?
favorite count: 0
has comment: http://stackoverflow.com/comment/35851712
has comment: http://stackoverflow.com/comment/35851698
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35851667
upvote count: 1
has comment: http://stackoverflow.com/comment/35852389
linked to: http://stackoverflow.com/q/1564832
has answer: http://stackoverflow.com/a/23399846
score: 0
tagged with: java

http://stackoverflow.com/a/23425349
upvote count: 1
has body: Use an EnumMap: Map&lt;Attribute,String&gt; attributes = new EnumMap&lt;&gt;(Attribute.class); enum Attribute { One, Two, Three; } public void constructor() { for ( Attribute a : Attribute.values() ) { attributes.put(a, "My string is: "+a.name()); } }
answers question: http://stackoverflow.com/q/23425190
has comment: http://stackoverflow.com/comment/35900002
type: Answer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/35899858

http://stackoverflow.com/q/23320308
has body: Suffixing of each array member by the same suffix (.wav) is required as: String [] a = {"one", "two", "three"}; String str = ".wav" Required output : String[] a ={"one.wav", "two.wav", "three.wav"}; I tried to achieve this in the following way: int m; for (m=0; m&lt;a.length ;) { a[m]= a[m] +str ; } but I failed. What should I do to achieve the required output?
has answer: http://stackoverflow.com/a/23320318
downvote count: 1
type: AnsweredQuestion
tagged with: java
has title: Suffixing the each member of a Java Array of String
score: -1
has comment: http://stackoverflow.com/comment/35705250
accepted answer: http://stackoverflow.com/a/23320318
tagged with: suffix-array
type: Question
upvote count: 0
tagged with: arrays
favorite count: 0
answer count: 1

http://stackoverflow.com/a/23400712
type: Answer
has comment: http://stackoverflow.com/comment/35854055
upvote count: 4
has comment: http://stackoverflow.com/comment/35854016
has body: getScaledInstance doesn't effect the original image, but instead returns a new instance of the image scaled to meet your parameters, make sure you are assigning the result to a variable, for example image = image.getImage().getScaledInstance(30,30,whatever); Then pass this to your what ever needs to use it Beware, the quality of the operation is pretty poor, especially over a large range. Take a look at Quality of Image after resize very low -- Java Java: maintaining aspect ratio of JPanel background image The Perils of Image.getScaledInstance() For details and ideas.
answers question: http://stackoverflow.com/q/23400648
score: 4
accepted answer of: http://stackoverflow.com/q/23400648
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/23407964
has comment: http://stackoverflow.com/comment/35868399
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35868414
accepted answer of: http://stackoverflow.com/q/23407719
type: Answer
answers question: http://stackoverflow.com/q/23407719
has body: I recommend you generally separate your business logic with the GUI interface, so if I were you I would make a StopWatch class that handles that part of it and simply use that object in this gui with fx "start/stop" methods. How to make a stopwatch class.. well there are a few ways. You could fx have a start method which takes an amount of seconds as a parameter, gets the current system time in miliseconds in the start method and runs a loop until the time exceeds the amount of time the user put in the parameter. Basically you get the current time in miliseconds run a loop and do an if sentence in the loop saying something like. EDIT: Also remember that your class might need to extend the thread class so it can run properly and simultaneously with your gui. public void start(int amountOfTime) { int startTime = System.currentTimeMillis(); while (some boolean is true) { if (System.currentTimeMillis()&gt;=startTime+(amountOfTime*1000)) boolean = false; } } I added some code here you should be able to correct it to your liking and figure out the rest. As for stopping it... you could simply make the loop dependant on a boolean and change it with the stop method or something similar. As for showing it graphcially.. well you could just insert a label and keep updating it.
has comment: http://stackoverflow.com/comment/35868129
has comment: http://stackoverflow.com/comment/35867751

multithreading
tags question: http://stackoverflow.com/q/23337046
tags question: http://stackoverflow.com/q/23327692
tags question: http://stackoverflow.com/q/23338290
tags question: http://stackoverflow.com/q/23428194
tags question: http://stackoverflow.com/q/23328674
tags question: http://stackoverflow.com/q/23310295
tags question: http://stackoverflow.com/q/23377592
tags question: http://stackoverflow.com/q/23375304
type: Tag
tags question: http://stackoverflow.com/q/23325193
tags question: http://stackoverflow.com/q/23293515
tags question: http://stackoverflow.com/q/23322788
tags question: http://stackoverflow.com/q/23320073
tags question: http://stackoverflow.com/q/23415146
tags question: http://stackoverflow.com/q/23437841
tags question: http://stackoverflow.com/q/23388014
tags question: http://stackoverflow.com/q/23300038
tags question: http://stackoverflow.com/q/23317332
tags question: http://stackoverflow.com/q/23381466
tags question: http://stackoverflow.com/q/23295828
tags question: http://stackoverflow.com/q/23310551
tags question: http://stackoverflow.com/q/23413297
tags question: http://stackoverflow.com/q/23347516
tags question: http://stackoverflow.com/q/23292819
tags question: http://stackoverflow.com/q/23350426
tags question: http://stackoverflow.com/q/23410452
tags question: http://stackoverflow.com/q/23357010
tags question: http://stackoverflow.com/q/23291583
tags question: http://stackoverflow.com/q/23369952
tags question: http://stackoverflow.com/q/23335457
tags question: http://stackoverflow.com/q/23345612
tags question: http://stackoverflow.com/q/23347564
tags question: http://stackoverflow.com/q/23436725
tags question: http://stackoverflow.com/q/23355039
tags question: http://stackoverflow.com/q/23414744
tags question: http://stackoverflow.com/q/23349057
tags question: http://stackoverflow.com/q/23397683
tags question: http://stackoverflow.com/q/23389385
tags question: http://stackoverflow.com/q/23320680
tags question: http://stackoverflow.com/q/23297859
tags question: http://stackoverflow.com/q/23448970
tags question: http://stackoverflow.com/q/23369069
tags question: http://stackoverflow.com/q/23380686
tags question: http://stackoverflow.com/q/23306774
tags question: http://stackoverflow.com/q/23395545
tags question: http://stackoverflow.com/q/23325646
tags question: http://stackoverflow.com/q/23298979
tags question: http://stackoverflow.com/q/23354143
tags question: http://stackoverflow.com/q/23422970
tags question: http://stackoverflow.com/q/23398257
tags question: http://stackoverflow.com/q/23385628
tags question: http://stackoverflow.com/q/23300235
tags question: http://stackoverflow.com/q/23444516
tags question: http://stackoverflow.com/q/23298187
tags question: http://stackoverflow.com/q/23375409
tags question: http://stackoverflow.com/q/23329149
tags question: http://stackoverflow.com/q/23373215
tags question: http://stackoverflow.com/q/23382275
tags question: http://stackoverflow.com/q/23414207
tags question: http://stackoverflow.com/q/23400206
tags question: http://stackoverflow.com/q/23397940
tags question: http://stackoverflow.com/q/23386643
tags question: http://stackoverflow.com/q/23374060
tags question: http://stackoverflow.com/q/23338367
tags question: http://stackoverflow.com/q/23450395
tags question: http://stackoverflow.com/q/23349215
tags question: http://stackoverflow.com/q/23399031
tags question: http://stackoverflow.com/q/23357124
tags question: http://stackoverflow.com/q/23370042
tags question: http://stackoverflow.com/q/23431535
tags question: http://stackoverflow.com/q/23445137
tags question: http://stackoverflow.com/q/23333804
tags question: http://stackoverflow.com/q/23312828
tags question: http://stackoverflow.com/q/23299051
tags question: http://stackoverflow.com/q/23398914
tags question: http://stackoverflow.com/q/23448846
tags question: http://stackoverflow.com/q/23338233
tags question: http://stackoverflow.com/q/23294437
tags question: http://stackoverflow.com/q/23364351
tags question: http://stackoverflow.com/q/23388221

http://stackoverflow.com/comment/35806585
type: QuestionComment
has text: @pskink Very sorry but it is still not working. Please suggest some other way. Thank You very much again for your time
comment on: http://stackoverflow.com/q/23358112
score: 0
type: Comment

dialog
tag name: dialog
tags question: http://stackoverflow.com/q/23298877
tags question: http://stackoverflow.com/q/23408756
type: Tag
tags question: http://stackoverflow.com/q/23387014

http://stackoverflow.com/comment/35894507
score: 2
comment on: http://stackoverflow.com/q/23382485
type: Comment
type: QuestionComment
has text: See the answer to [this question](http://stackoverflow.com/questions/23406448/error-after-converting-org-pbjar-library-to-osgi-bundle), they have the same problem.

http://stackoverflow.com/q/23405832
tagged with: sigar
tagged with: vmware
score: 3
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/23406170
has title: Sigar 1.6.4 is crashing: EXCEPTION_ACCESS_VIOLATION
downvote count: 0
upvote count: 3
answer count: 1
favorite count: 0
type: UnansweredQuestion
has body: I'm using the Sigar library for Java and I'm getting this error: A fatal error has been detected by the Java Runtime Environment: EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x0000000010014ed4, pid=1560, tid=4812 Here you can see the generated error log. (As well as my machine specs) This happens randomly after the program is running for some hours. Then, it crashes and I can not monitor any parameter (cpu, ram, disk... ) anymore. It is so annoying and makes SIGAR totally useless as you can not trust on whether it is going to crash or not. I've been reading this two topics about it, but it seems a problem of the library an no proper solutions are proposed (and the library doesn't look to have fixed the error) https://jira.hyperic.com/browse/SIGAR-192 https://communities.vmware.com/message/2121479 There's a guy talking about how to solve it for 64 bits in this answer, but that file is not even available to download. (there's no java/src folder). Any idea about how to deal with it? Is it even fixable? If not, which alternatives to Sigar would you suggest me? In case this is relevant, these are the Sigar functions I'm using in my applications: - new Sigar(); - Sigar.getProcCpu(); - Sigar.getCpuList(); - new ProcessFinder(); - ProcessFinder.find(); - new ProcCpu(); - ProcCpu.gather(); - new ProcMem(); - ProcMem.gather(); - ProcMem.getResident() - ProcCpu.getTotal(); - ProcCpu.getLastTime(); - Sigar.getMem(); - Mem.getActualFree(); - Mem.getActualUsed(); - Mem.getFree(); - Mem.getRam(); - Mem.getTotal(); - Mem.getUsed(); - Mem.getUsedPercent(); - new FileSystemUsage(); - FileSystemUsage.getFree(); - FileSystemUsage.getUsed();
tagged with: hyperic

http://stackoverflow.com/comment/35752097
comment on: http://stackoverflow.com/a/23331502
type: AnswerComment
score: 0
type: Comment
has text: Another possibility is that encodedObject isn't identical which would mean loading the object from the server is already faulty. If neither the encodedObject nor the decoded base 64 String are different and you absolutely want to stick to Java serialization then you could serialize/deserialize the objects manually (using readObject/writeObject methods).

http://stackoverflow.com/q/23399283
has body: So my issue is this, I'm implementing a UI creation tool that requires elements to be resized using drag gestures on the edges. The problem arises when doing this drag while checking a modifier key is being pressed, i.e. to implement uniform scaling.The key event is never raised while the drag gesture is active so i cannot activate/deactivate this state during a drag, which is obviously not ideal! My question is, is there some reason in JavaFX why this is the case? Is there any workarounds? Can I access the raw keyboard state, i.e. without event callbacks?
accepted answer: http://stackoverflow.com/a/23408731
tagged with: mouseevent
answer count: 1
downvote count: 0
tagged with: events
has title: JavaFX KeyEvent not raised when dragging gesture active
favorite count: 0
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23408731
tagged with: keyevent
score: 3
upvote count: 3
tagged with: java
tagged with: javafx
type: Question

http://stackoverflow.com/comment/35930997
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23442299
score: 3
has text: prints it in reverse order. `int i = name.length()-1; while (i >= 0){...}`

http://stackoverflow.com/q/23390946
has body: My question may seem kind of strange, but I'd like to better understand how Spring Security works. I've a scenario as follows... By using Spring Security and Spring SAML, I defined an entry point, some patterns and filters in order to properly manage http requests. &lt;!-- Secured pages --&gt; &lt;security:http entry-point-ref="samlEntryPoint" use-expressions="true"&gt; &lt;security:intercept-url pattern="/" access="permitAll" /&gt; &lt;security:intercept-url pattern="/saml/**" access="permitAll" /&gt; &lt;security:intercept-url pattern="/metadata" access="permitAll" /&gt; &lt;security:intercept-url pattern="/metadata/**" access="permitAll" /&gt; &lt;security:intercept-url pattern="/info" access="isAuthenticated()" /&gt; &lt;security:intercept-url pattern="/signup/sso" access="permitAll" /&gt; &lt;security:custom-filter before="FIRST" ref="metadataGeneratorFilter" /&gt; &lt;security:custom-filter after="BASIC_AUTH_FILTER" ref="samlFilter" /&gt; &lt;/security:http&gt; &lt;bean id="samlFilter" class="org.springframework.security.web.FilterChainProxy"&gt; &lt;security:filter-chain-map request-matcher="ant"&gt; &lt;security:filter-chain pattern="/saml/login/**" filters="samlEntryPoint" /&gt; &lt;security:filter-chain pattern="/saml/logout/**" filters="samlLogoutFilter" /&gt; &lt;security:filter-chain pattern="/saml/metadata/**" filters="metadataDisplayFilter" /&gt; &lt;security:filter-chain pattern="/saml/SSO/**" filters="samlWebSSOProcessingFilter" /&gt; &lt;security:filter-chain pattern="/saml/SSOHoK/**" filters="samlWebSSOHoKProcessingFilter" /&gt; &lt;security:filter-chain pattern="/saml/SingleLogout/**" filters="samlLogoutProcessingFilter" /&gt; &lt;security:filter-chain pattern="/saml/discovery/**" filters="samlIDPDiscovery" /&gt; &lt;/security:filter-chain-map&gt; &lt;/bean&gt; Then, I defined also an IdP discovery service: &lt;!-- IDP Discovery Service --&gt; &lt;bean id="samlIDPDiscovery" class="org.springframework.security.saml.SAMLDiscovery"&gt; &lt;property …
tagged with: spring-mvc
type: AnsweredQuestion
score: 3
downvote count: 0
tagged with: java
tagged with: spring-saml
has title: Define HTTP routes to serve only "internal" requests with Spring Security
type: Question
tagged with: saml-2.0
has answer: http://stackoverflow.com/a/23409379
accepted answer: http://stackoverflow.com/a/23409379
upvote count: 3
answer count: 1
favorite count: 0
tagged with: spring

http://stackoverflow.com/q/23358157
has body: I am using netbeans platform module to develop this desktop application. I am using drag and drop facility in netbeans in the developement. I needed to create a toolbar which is having few buttons..I need to create a gradient color for these buttons. I dragged and dropped JToolBar, over it I dragged and placed JButton objects. In the properties of the button I have selected a color for which I want a shaded color. In the custom code I have modified. jbutton = new javax.swing.Jbutton(); as below jbutton = new javax.swing.JButton(){ @Override protected void paintComponent(Graphics grphcs) { Graphics2D g2d = (Graphics2D) grphcs; g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); GradientPaint gp = new GradientPaint(0, 0, getBackground().brighter().brighter().brighter(), 0, getHeight(), getBackground().darker()); g2d.setPaint(gp); g2d.fillRect(0, 0, getWidth(), getHeight()); super.paintComponent(grphcs); }}; When I used the above code for a JPanel in my project it worked but it is not showing any effect when I used it for a button. How to get a gradient color for a button placed in a toolbar?
has title: How to add gradient color to Jbuttons placed in jtoolbar
tagged with: jtoolbar
type: Question
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23358390
favorite count: 0
tagged with: netbeans
upvote count: 2
tagged with: swing
tagged with: jbutton
tagged with: java
has answer: http://stackoverflow.com/a/23358390
score: 2
answer count: 1
downvote count: 0

http://stackoverflow.com/comment/35943932
has text: No problem. The java question is: Why are _all_ java applets closing the stdio handles on Windows? So I think the java applet tag is appropriate. But I've found a workaround that I will add to the question.
comment on: http://stackoverflow.com/q/23409824
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35912267
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23427848
has text: @Marco13 Thank you for your answer. What I got by FRLayout was something similar. The number of vertices is around 600. Since it is just the first step of my work and not my main work, I don't want to spend much time on finding a way to visualize it. I just want to make it have a less complicated view.

http://stackoverflow.com/comment/35750916
score: 0
has text: This is not a trivial problem. What if you have a legitimate % in the template String? If you can guarantee that won't happen, this is an exercise in RegEx.
type: QuestionComment
comment on: http://stackoverflow.com/q/23345209
type: Comment

http://stackoverflow.com/comment/35915062
has text: Try to right-click on pom.xml file.
type: Comment
score: 1
comment on: http://stackoverflow.com/q/23433667
type: QuestionComment

http://stackoverflow.com/a/23450749
answers question: http://stackoverflow.com/q/23450615
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/35947217
type: Answer
accepted answer of: http://stackoverflow.com/q/23450615
upvote count: 1
score: 1
has body: you want to go to Java->Debug-Detail Formatters. then figure how you want it formatted and select the radio button for as the label for variables with detail formatters I think

http://stackoverflow.com/q/23415631
answer count: 1
downvote count: 1
favorite count: 0
has body: The class @Component public class PropertyReader { public PropertyReader() { } @Value("${spring.active.profiles") private String profile; @Nonnull public String getProfile() { return profile; } } The Test @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(loader=AnnotationConfigContextLoader.class) public class PropertyReaderTest { @Autowired private PropertyReader propertyReader; @Test public void testGetProfile() throws Exception { System.out.printf(System.getProperty("spring.active.profiles")); assertEquals("development", propertyReader.getProfile()); } } The dependency org.springframework spring-context 4.0.3.RELEASE org.springframework spring-test 4.0.3.RELEASE test Test Fails Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.yahoo.pryme_services.external_services.ifs.PropertyReader com.yahoo.pryme_services.external_services.ifs.PropertyReaderTest.propertyReader; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.yahoo.pryme_services.external_services.ifs.PropertyReader] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)} What am I missing? P.S. A day old with Spring
type: UnansweredQuestion
tagged with: spring
upvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/23415981
type: Question
has title: Annotation present: still no bean found in testing
score: -1

http://stackoverflow.com/q/23384064
score: 0
answer count: 1
tagged with: sikuli
accepted answer: http://stackoverflow.com/a/23385118
type: AnsweredQuestion
tagged with: java
has title: Compare images using sikuli in java
has answer: http://stackoverflow.com/a/23385118
type: Question
has body: im using sikuli-api 1.0.1 in java. The current problem is that I want to use the matching algo for a given image instead of a screen. The code which works is: ScreenRegion s = new DesktopScreenRegion(); Target imageTarget = new ImageTarget(new File("someImage")); ScreenRegion r = s.find(imageTarget); Instead of using the ScreenRegion I would like to use a given image (File/BufferedImage). Any ideas how to do it? I dont want to click on the image etc. I just want to use sikulis algo to check if the target is inside the image. Thanks in advance

http://stackoverflow.com/comment/35665720
has text: Are you sure you are using ASCII apostrophe (hex 0x27)?
type: Comment
type: QuestionComment
score: 3
comment on: http://stackoverflow.com/q/23298246

http://stackoverflow.com/comment/103472091
has text: Well, what was _your_ problematic field?
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/30997540
type: Comment

http://stackoverflow.com/comment/35790476
type: Comment
score: 0
comment on: http://stackoverflow.com/q/23366617
type: QuestionComment
has text: check also my answer. i believe i found the bug

http://stackoverflow.com/comment/35800588
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23355295
has text: Yes, that was it. Can't believe I couldn't see it myself. Thank you!

http://stackoverflow.com/comment/35657078
type: Comment
has text: in this line: model.remove(user01, null, (RDFNode) null);
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23293602

http://stackoverflow.com/comment/35766998
type: Comment
comment on: http://stackoverflow.com/a/23353659
score: 0
has text: You are correct it does to a degree, however it does make your code somewhat easier to read; maybe not as versatile, and in turn is much better for programs which you are going to be programming for a long time. I also pointed out you would be extending your class by Jpanel and just adding a variable to your jframe. At this point I recommend atleast trying this :)
type: AnswerComment

http://stackoverflow.com/comment/35698865
score: 0
type: QuestionComment
type: Comment
has text: @Vulcan, A file does exist there. I added it there. I am not sure if the path starts from /src or ./src. This was why I decided to use the built in getClass() methods to know exactly how the path is arranged in my project.
comment on: http://stackoverflow.com/q/23316202

http://stackoverflow.com/a/23433091
has comment: http://stackoverflow.com/comment/36026238
answers question: http://stackoverflow.com/q/23416415
score: 0
has body: Scenario 1: If you do not have handler mapping specified explicitly, dispatcher servlet provides BeanNameUrlHandlerMapping by default. '/' is not a valid character in the "id" attribute of xml bean definitions. In BeanNameUrlHandlerMapping, mapping is done from URLs to beans with names that start with a slash("/") and not ids. I don't see name attribute specified in your controller definitions. So change your controller definitions as: ... ... Scenario 2: If you do not want to rely on default BeanNameUrlHandlerMapping, define a SimpleUrlHandlerMapping as: /multiaction/*.htm=userMultiCtrl /details_path.htm=addCtrl ...
has comment: http://stackoverflow.com/comment/36031560
type: Answer
has comment: http://stackoverflow.com/comment/36030737

http://stackoverflow.com/comment/35780463
has text: Try to increase this: http://pumpshooter.com/f7wyNAHE in cassandra.yaml
type: Comment
comment on: http://stackoverflow.com/q/23360941
type: QuestionComment
score: 0

http://stackoverflow.com/q/23291731
score: 0
has body: I'm trying to write a form a Dijkstra’s algorithm, with the weight between two vertices the distance between a set of coordinates taken in from a file. It adds the Vertices fine but when it goes to add in the edges I'm getting a null pointer in my main method. Exception in thread "main" java.lang.NullPointerException at matrix.matrix(matrix.java:61) at matrix.main(matrix.java:102) Which point to the marked(**) parts of code. It's probably something really simple that I'm missing so any help would be greatly appreciated! Thanks. import java.util.*; import java.io.*; class matrix { //public static double[][] distanceMatrix; public static int[] nameOfCities; public static double[] Latitude; public static double[] Longitude; public static Graph theGraph = new Graph(); public static void matrix() { int size=0; try { File f = new File("Cities2.txt");//the file where the coordinates of cities are kept Scanner sc = new Scanner(f); Scanner scan = new Scanner(f); int i=0; while(scan.hasNextLine()) { String readLine = scan.nextLine(); size++; } System.out.println("The number of cities is "+size); double[] Latitude = new double[size]; double[] Longitude = new double[size]; nameOfCities = new int[size]; //double[][] distanceMatrix = new double[size][size]; while(sc.hasNextLine()) { String line = sc.nextLine(); String[] details = line.split(" ");//until there's a space(" ") in the file int name = Integer.parseInt(details[0]);//number in the file corresponds to the name of the town nameOfCities[i]=name;//add this to the array called nameOfCities double latitude = Double.parseDouble(details[1]);//corresponds to latitude value Latitude[i]=latitude;//add this to latitude array double longitude = Double.parseDouble(details[2]);//corresponds to longitude array Longitude[i]=longitude;//add this to longitude array theGraph.addVertex(i+1); theGraph.displayVertex(i); System.out.println(" Vertex added"); i++; } } catch (FileNotFoundException e) { e.printStackTrace(); } **for(int i=0; i&lt;L…
answer count: 1
tagged with: nullpointerexception
has title: null pointer exception weighted graph
has answer: http://stackoverflow.com/a/23291790
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35653211
tagged with: weighted
type: Question
tagged with: java
accepted answer: http://stackoverflow.com/a/23291790
tagged with: graph

http://stackoverflow.com/a/47474185
type: Answer
has body: All the links have anchor tag, so you can create a list of web elements based on the anchor tag locator and then print the text or the href tag(i.e. link URL) of each element. Script- public static void main(String[] args){ WebDriver driver = new FirefoxDriver(); //Launching sample website driver.get("{webpage URL}"); //Get list of web-elements with tagName - a List&lt;WebElement&gt; allLinks = driver.findElements(By.tagName("a")); //Traversing through the list and printing its text along with link address for(WebElement link:allLinks){ System.out.println(link.getText() + " - " + link.getAttribute("href")); } } Reference - Get all links on a webpage using selenium and Java
answers question: http://stackoverflow.com/q/23447074
score: 0

http://stackoverflow.com/a/23415170
type: Answer
has comment: http://stackoverflow.com/comment/35883510
has comment: http://stackoverflow.com/comment/35880988
answers question: http://stackoverflow.com/q/23415037
score: 0
has body: It looks like you are clearing the roles variable var roles = []; with each pass of the loop. You might want to consider not posting the entire file, but pairing the example down to just the part you need help with. You could also put the array into a JSON object and parse that in your javascript. That might be a cleaner implementation.

mysql
tags question: http://stackoverflow.com/q/23303206
tags question: http://stackoverflow.com/q/23404114
tags question: http://stackoverflow.com/q/23311439
tags question: http://stackoverflow.com/q/23397540
tags question: http://stackoverflow.com/q/23301060
tags question: http://stackoverflow.com/q/23312585
tags question: http://stackoverflow.com/q/23363147
tags question: http://stackoverflow.com/q/23408582
tags question: http://stackoverflow.com/q/23311660
tags question: http://stackoverflow.com/q/23335953
tags question: http://stackoverflow.com/q/23340768
tags question: http://stackoverflow.com/q/23411064
tags question: http://stackoverflow.com/q/23435408
tags question: http://stackoverflow.com/q/23445096
tags question: http://stackoverflow.com/q/23424170
tags question: http://stackoverflow.com/q/23434139
tag name: mysql
tags question: http://stackoverflow.com/q/23324466
tags question: http://stackoverflow.com/q/23409026
tags question: http://stackoverflow.com/q/23448817
tags question: http://stackoverflow.com/q/23299230
tags question: http://stackoverflow.com/q/23359840
tags question: http://stackoverflow.com/q/23318193
tags question: http://stackoverflow.com/q/23380632
tags question: http://stackoverflow.com/q/23423784
tags question: http://stackoverflow.com/q/23413743
tags question: http://stackoverflow.com/q/23330160
tags question: http://stackoverflow.com/q/23403306
tags question: http://stackoverflow.com/q/23370243
tags question: http://stackoverflow.com/q/23441365
tags question: http://stackoverflow.com/q/23327511
tags question: http://stackoverflow.com/q/23410439
tags question: http://stackoverflow.com/q/23318100
tags question: http://stackoverflow.com/q/23341087
tags question: http://stackoverflow.com/q/23292479
tags question: http://stackoverflow.com/q/23428243
tags question: http://stackoverflow.com/q/23344416
tags question: http://stackoverflow.com/q/23446901
tags question: http://stackoverflow.com/q/23309456
tags question: http://stackoverflow.com/q/23323653
tags question: http://stackoverflow.com/q/23344382
tags question: http://stackoverflow.com/q/23297474
tags question: http://stackoverflow.com/q/23339226
tags question: http://stackoverflow.com/q/23293870
tags question: http://stackoverflow.com/q/23433259
tags question: http://stackoverflow.com/q/23353185
tags question: http://stackoverflow.com/q/23364741
tags question: http://stackoverflow.com/q/23356519
tags question: http://stackoverflow.com/q/23387949
tags question: http://stackoverflow.com/q/23415876
tags question: http://stackoverflow.com/q/23386116
tags question: http://stackoverflow.com/q/23301124
tags question: http://stackoverflow.com/q/23300752
tags question: http://stackoverflow.com/q/23342739
type: Tag
tags question: http://stackoverflow.com/q/23361891
tags question: http://stackoverflow.com/q/23307964
tags question: http://stackoverflow.com/q/23341997
tags question: http://stackoverflow.com/q/23300815
tags question: http://stackoverflow.com/q/23383205
tags question: http://stackoverflow.com/q/23312951
tags question: http://stackoverflow.com/q/23387541
tags question: http://stackoverflow.com/q/23438591
tags question: http://stackoverflow.com/q/23295981
tags question: http://stackoverflow.com/q/23339091
tags question: http://stackoverflow.com/q/23415006
tags question: http://stackoverflow.com/q/23394948
tags question: http://stackoverflow.com/q/23384381
tags question: http://stackoverflow.com/q/23445831
tags question: http://stackoverflow.com/q/23383816
tags question: http://stackoverflow.com/q/23418667
tags question: http://stackoverflow.com/q/23293095
tags question: http://stackoverflow.com/q/23397059
tags question: http://stackoverflow.com/q/23421027
tags question: http://stackoverflow.com/q/23339496
tags question: http://stackoverflow.com/q/23316517
tags question: http://stackoverflow.com/q/23366532
tags question: http://stackoverflow.com/q/23396105
tags question: http://stackoverflow.com/q/23422118
tags question: http://stackoverflow.com/q/23452177

http://stackoverflow.com/a/23357069
answers question: http://stackoverflow.com/q/23356922
score: -1
has comment: http://stackoverflow.com/comment/35772808
upvote count: 0
has body: You should render the response as UTF-8. And your second question is the Jackson library. It can conver json objects into Java objects.
type: Answer
downvote count: 1

http://stackoverflow.com/q/23360593
tagged with: runtime.exec
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/35807970
answer count: 1
tagged with: unicode
score: 0
has comment: http://stackoverflow.com/comment/35779682
has body: import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JTextArea; public class ping1 { /** * @param args */ public static String feedback = ""; private static void createAndShowGUI() { //Make sure we have nice window decorations. JFrame.setDefaultLookAndFeelDecorated(true); //Create and set up the window. JFrame frame = new JFrame("HelloWorldSwing"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //Add the ubiquitous "Hello World" label. JTextArea ta = new JTextArea(feedback); frame.getContentPane().add(ta); //Display the window. frame.pack(); frame.setVisible(true); } public static void main(String[] args) { // TODO Auto-generated method stub System.out.println("Test1"); Runtime rTime = Runtime.getRuntime(); Process p; try{ p = rTime.exec("ping 10.11.11.67"); InputStream stdout = p.getInputStream(); InputStream stderr = p.getErrorStream(); BufferedReader reader = new BufferedReader(new InputStreamReader(stdout,"UTF-8")); StringBuffer data = new StringBuffer(); String line = ""; char sch = 13; // check for ^M character char dch = '\n'; // replace ^m by next line character while (line != null) { line = reader.readLine(); if (line != null){ line = new String(line.getBytes(),"UTF-8"); //System.out.println("line after :"+line); data.append(line.replace(sch, dch)); // 7.1.00 AMTRAK QM001531720 } data.append(System.getProperty("line.separator")); } // notify listeners if feedback is not suppressed ping1.feedback = data.toString(); System.out.println("Data in feebback:"+ping1.feedback.toString()); // System.out.println("Output stream:"+strout ); // System.out.println("Error stream:"+strerr ); } catch(IOException npe){ System.out.println(npe.getMessage()); return; } //Schedule a job for the event-dispatching thread: //creating and showing this application's GUI. javax.swing.SwingUtilities.invokeLater(new Runnable() { public void r…
has comment: http://stackoverflow.com/comment/35782313
has title: Attached java code does not print German Characters in output correctly on Windows 2008 R2 German Locale
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23360945

http://stackoverflow.com/q/23304198
type: Question
has answer: http://stackoverflow.com/a/23304728
has body: I just simply cannot get the fragments to display...! and I know it's a problem within my onCreateView. Does anyone possibly see the issue and can think of some sort of solution?? The first fragment actually displays if I comment out lines 34-59, which start with the super.onCreate(savedInstanceState); with the onCreateView, and ends with the closing }); for the confirmButton.setOnClickListener. However, with those lines commented out, the tab for the other fragment, when clicked, leads to the app crashing. I also can't save the information that I want to retrieve from the first fragment by doing this... so I do need those lines. I sincerely appreciate all and any help, thank you so much for your time!! public class LyricEditorFragment extends Fragment { private EditText mTitleText; private EditText mBodyText; private Long mRowId; private LyricsDbAdapter mDbHelper; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // TODO Auto-generated method stub View view = inflater.inflate(R.layout.activity_lyriceditor, container, false); super.onCreate(savedInstanceState); mDbHelper = new LyricsDbAdapter(getActivity()); mDbHelper.open(); mTitleText = (EditText) getView().findViewById(R.id.title); mBodyText = (EditText) getView().findViewById(R.id.body); Button confirmButton = (Button) getView().findViewById(R.id.confirm); mRowId = (savedInstanceState == null) ? null : (Long) savedInstanceState.getSerializable(LyricsDbAdapter.KEY_ROWID); if (mRowId == null) { Bundle extras = getActivity().getIntent().getExtras(); mRowId = extras != null ? extras.getLong(LyricsDbAdapter.KEY_ROWID) : null; } populateFields(); confirmButton.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { getActivity().setResult(Activity.RESULT_OK); getActivity().finish(); } }); return view; } private void populateFields() { if (mRowId != null) { Cursor lyric = mDbHelper.fetchLyric(mRowId); getActivity().startManagingCursor(…
has title: Android - Issue With Displaying Fragments
has comment: http://stackoverflow.com/comment/35676964
score: 0
tagged with: android
answer count: 1
accepted answer: http://stackoverflow.com/a/23304728
favorite count: 0
upvote count: 1
downvote count: 1
type: AnsweredQuestion
tagged with: android-fragments
tagged with: java
tagged with: adt
tagged with: mysql

http://stackoverflow.com/comment/35940665
comment on: http://stackoverflow.com/q/23447492
type: Comment
type: QuestionComment
score: 1
has text: @user76020 `String#split` will do it fine.

http://stackoverflow.com/comment/35761141
has text: What is this a duplicate of? The question linked below doesn't match.
comment on: http://stackoverflow.com/q/23349329
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35936605
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23445340
score: 2
has text: Whenever you get an "Sorry the application (app name) has stopped unexpectedly" error message displayed you need to take a look at the logcat output

http://stackoverflow.com/a/23325983
answers question: http://stackoverflow.com/q/23325830
type: Answer
score: 1
upvote count: 1
has body: This cast: ((MySubClass) myClass).sayBye(); does NOT always throw a ClassCastException, as you said, but it depends on what is the actual (more specific) type of the object referenced by the variable myClass. If the variable MyClass myClass references an object of the class MySubClass, then the cast does not throw any exception. But the point is that, if you want to call a method of an object, this method must be defined and implemented in the class (or some superclass) of that object, while you can NOT call a method on a object, where this method is only implemented in some of its subclass, because in this case that method is not present in that object (but only on object of its subclass).
downvote count: 0

http://stackoverflow.com/comment/35713176
has text: That message means, that you need the **actionPerformed** method in your class; this is because the class implements ActionListener. The missing method is declared in the ActionListener interface.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23324643

http://stackoverflow.com/q/23402291
has answer: http://stackoverflow.com/a/23402488
has title: Android Why is all the layout done with strings not enum
type: Question
answer count: 2
score: 0
has answer: http://stackoverflow.com/a/23402521
tagged with: android
has body: Sorry for such a basic question but I am new to Android development, most my experience has been in c# or c++. Not sure if this is a Java thing or just Android but I have been disappointed to see that it is all held together with strings IE: android:layout_height="wrap_content" I would have expected to be more like: android:layout_height=layout.wrap_content which would make sure only valid options are used. This seems to be the case for most things and it seems like bad practice. It also makes intellisense type stuff difficult also. Can anyone explain why that approach has been taken? Is it a Java thing? or does it have its advantages for another reason?
has comment: http://stackoverflow.com/comment/35856575
accepted answer: http://stackoverflow.com/a/23402521
type: AnsweredQuestion
tagged with: enums
tagged with: java
possible better answer: http://stackoverflow.com/a/23402488

http://stackoverflow.com/comment/35962615
score: 0
type: AnswerComment
has text: Caution: this answer ignores the crucial issue of time zone. By ignoring time zone, you get the JVM's default time zone. That time zone may vary from time to time and from computer to computer.
type: Comment
comment on: http://stackoverflow.com/a/23437683

http://stackoverflow.com/comment/35677440
comment on: http://stackoverflow.com/a/23304815
score: 0
type: Comment
type: AnswerComment
has text: In his code: `ContinuousAudioDataStream loop = null;`

http://stackoverflow.com/comment/35888179
has text: It doesn't sound like it, because you said you'd have no idea what the "currently executing object is". But you do, because by definition, it's `this`.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23418770

http://stackoverflow.com/q/23435212
has title: Generating jad file from a jar file
has answer: http://stackoverflow.com/a/23454347
has answer: http://stackoverflow.com/a/23631968
tagged with: java-me
has body: This can be done by 1. Extracting jar to get manifest file 2. Read all lines and concatenate long lines which are distributed in 70 characters lines 3. Add two extra attributes i.e MIDlet-Jar-Size and MIDlet-Jar-URL But I want to know is there any other way like class or library in java which handles everything? Also is there something similar for editing manifest file programmatically?
type: UnansweredQuestion
upvote count: 1
score: 1
tagged with: java
type: Question
answer count: 2
downvote count: 0
favorite count: 0

http://stackoverflow.com/comment/35756650
comment on: http://stackoverflow.com/q/23348321
score: 0
type: QuestionComment
type: Comment
has text: Thanks AntonH, for the edit.

http://stackoverflow.com/a/23400164
upvote count: 2
answers question: http://stackoverflow.com/q/23397633
has body: Does this help? Latency . JMeter measures the latency from just before sending the request to just after the first response has been received. Thus the time includes all the processing needed to assemble the request as well as assembling the first part of the response, which in general will be longer than one byte. Protocol analysers (such as Wireshark) measure the time when bytes are actually sent/received over the interface. The JMeter time should be closer to that which is experienced by a browser or other application client. it's from here: http://jmeter.apache.org/usermanual/glossary.html
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23397633
type: Answer
score: 2

http://stackoverflow.com/q/23319172
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/23320462
has title: How to implement bootstrap (resampling) in Java efficiently
tagged with: statistics-bootstrap
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/35703458
has body: I have a data file of 50,000,000 lines and need to bootstrap each line using Java. Right now I am using Math.random() to generate random number, then do the bootstrapping in a brute force way. However, it will take me forever. So i am wondering if there is any Java library help to do this efficiently or should i call other languages inside Java? Anyway my goal is to optimize the whole process. Thank you!
type: UnansweredQuestion
tagged with: bigdata
tagged with: resampling

http://stackoverflow.com/comment/35715392
type: Comment
score: 0
comment on: http://stackoverflow.com/a/23325121
type: AnswerComment
has text: what is the meaning if 'list' here? is it the linked list?? I kept linked list here but gives error as Exception in thread "AWT-EventQueue-0" java.lang.ClassCastException: Car cannot be cast to java.lang.String at CarTest$17.compare(CarTest.java:738) at java.util.TimSort.countRunAndMakeAscending(TimSort.java:351) at java.util.TimSort.sort(TimSort.java:216) at java.util.Arrays.sort(Arrays.java:1435)

http://stackoverflow.com/comment/35715745
comment on: http://stackoverflow.com/q/23325992
type: Comment
type: QuestionComment
has text: Use `System.out.println(new File(".").getAbsolutePath());` to check whether you are working relative to the correct root directory.
score: 0

http://stackoverflow.com/q/23334989
accepted answer: http://stackoverflow.com/a/23335220
has answer: http://stackoverflow.com/a/23337033
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0
has title: JAXB different elements in list
upvote count: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35732513
tagged with: java
tagged with: jaxb
has body: I have some XML-files that have the following structure: <?xml version="1.0" encoding="iso-8859-1"?> Doc 1 Doc 2 Text 1 Text 2 1 2 I want to parse the files using JAXB and thus I have to create models for all the elements. But what would the model for the ROOT element be? Is it allowed in XML to put different datatypes in one list? I called my model DocumentList but what is the generic type of my list? Can I do it with one list or do I have have to create different lists? @XmlRootElement(name = "ROOT") public class DocumentList { private List elements; } Thanks in advance! Update My model classes look like this: @XmlRootElement(name = "ROOT") @XmlAccessorType(XmlAccessType.FIELD) public class Root { @XmlElement(name = "DOCUMENT") private List documents; @XmlElement(name = "TEXT") private List texts; @XmlElement(name = "ITEM") private List items; } @XmlRootElement(name = "DOCUMENT") @XmlAccessorType(XmlAccessType.FIELD) public class Document { @XmlElement(name = "title") private String title; } @XmlRootElement(name = "TEXT") @XmlAccessorType(XmlAccessType.FIELD) public class Text { @XmlElement(name = "content") private String content; } @XmlRootElement(name = "ITEM") @XmlAccessorType(XmlAccessType.FIELD) public class Item { @XmlElement(name = "id") private String id; } Getters and setters are implemented, too. Now I get the following exception: javax.xml.bind.UnmarshalException: unexpected element (uri:"http://www.XXX.com/YYY", local:"ROOT"). Expected elements are <{}DOCUMENT>,<{}TEXT>,<{}ITEM>,<{}ROOT> at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext.handleEvent(Unknown Source) at com.sun.xml.internal.bind.v2.runtime.unmarshaller.Loader.reportError(Unknown Source) at com.sun.xml.internal.bind.v2.runtime.unmarshaller.Loader.reportError(Unknown Source) at com.sun.xml.internal.bind.v2.runtime.unmarshaller.Loader.reportUnexpectedChildElement(Unknown Source) at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext$DefaultRootLoad…
has answer: http://stackoverflow.com/a/23335220
type: Question
has answer: http://stackoverflow.com/a/23335734
answer count: 3
score: 2
possible better answer: http://stackoverflow.com/a/23337033
downvote count: 0

http://stackoverflow.com/a/23354440
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/35768433
downvote count: 0
answers question: http://stackoverflow.com/q/23354414
has body: I can't think of anything built in. But you could use tryLock to determine if you can acquire a Lock and perform a synchronized action or, if you cannot acquire the Lock, perform a non-synchronized action. Lock l = ... if(l.tryLock()) { try { // do your synchronized action } finally { l.unlock(); } } else { // welp, we couldn't get the lock. // do some local work. }
type: Answer
has comment: http://stackoverflow.com/comment/35810149
has comment: http://stackoverflow.com/comment/35793138
has comment: http://stackoverflow.com/comment/35768689

http://stackoverflow.com/comment/35653929
type: Comment
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/23291575
has text: Reversing the array should be done very quick as against sorting. See http://stackoverflow.com/a/217477/748524 . The alternative was to wrap the primitives into Floats but you don't want to do that.

http://stackoverflow.com/comment/35826001
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23383953
has text: You can also use threading, if synchronization is not required
score: 0

http://stackoverflow.com/comment/35935839
has text: this.ScriptEngine = new ScriptEngineManager(); this.Script = this.ScriptEngine.getEngineByName("JavaScript"); Then, passing through objects: this.Script.put("Sys", sys); this.Script.put("Sys.out", sys.out); this.Script.put("Sys.err", sys.err);
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23444878

http://stackoverflow.com/comment/35801254
type: QuestionComment
type: Comment
has text: This should work, please add your `pom.xml` and your connection-pool-configuration to the question.
score: 0
comment on: http://stackoverflow.com/q/23346923

http://stackoverflow.com/comment/35798281
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23370509
has text: But is the code part of a method in the GUI?
score: 0

http://stackoverflow.com/comment/35937345
type: QuestionComment
has text: you create an array of `Comparable` but you cast it to `E`. `E` and `Comparable` are not the same, so this makes no sense.
comment on: http://stackoverflow.com/q/23445110
score: 0
type: Comment

http://stackoverflow.com/comment/35912220
comment on: http://stackoverflow.com/a/23431770
score: 0
type: Comment
has text: In that way I would miss the double quote which is necessary for commands.add("file location")
type: AnswerComment

http://stackoverflow.com/comment/35844145
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23394709
has text: No, I mean literally. [The manual](http://docs.jboss.org/hibernate/orm/4.3/manual/en-US/html_single/#queryhql-expressions) explicitly lists `current_time()` as an available HQL expression. No need to construct it in your code (if you really, really want to, I suggest params and `createQuery(hql).setObject(...)`).

http://stackoverflow.com/a/36206065
score: 7
answers question: http://stackoverflow.com/q/23291015
downvote count: 0
has body: You need to check whether your "locationInfo" string is null: if (json.isNull("locationInfo")){ mapLoc = ""; } else { mapLoc = json.getString("locationInfo"); }
type: Answer
upvote count: 7

http://stackoverflow.com/a/23300189
score: 9
has comment: http://stackoverflow.com/comment/58586507
upvote count: 9
has body: When you declare the bean as @Stateless then the methods in that bean are by default transactional. Transactional methods commit the persistence state when fully executed. When you don't have your class annotated with @Stateless methods are not transactional by default and hence you get the mentioned exception.
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/35669080
answers question: http://stackoverflow.com/q/23300014

http://stackoverflow.com/a/23342092
has comment: http://stackoverflow.com/comment/35748001
has comment: http://stackoverflow.com/comment/35745793
has comment: http://stackoverflow.com/comment/35747000
score: 5
has comment: http://stackoverflow.com/comment/35747956
has comment: http://stackoverflow.com/comment/35746673
has comment: http://stackoverflow.com/comment/35746186
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/35745838
type: Answer
accepted answer of: http://stackoverflow.com/q/23342053
has comment: http://stackoverflow.com/comment/35746405
has body: You need to either implement a @Local annotated interface that expresses the local view of that EJB bean, or you need to add the @LocalBean annotation to the HotelService class itself to explicitly state that it is a local no-interface view of that EJB. @Stateless @EJB(beanInterface = HotelService.class, name = "HotelService") @LocalBean public class HotelService { // ... } If you want the service to be available outside of the container for RMI or EJB client execution, you'll need to create a @Local and @Remote view of that service and implement both.
answers question: http://stackoverflow.com/q/23342053
has comment: http://stackoverflow.com/comment/35746600
has comment: http://stackoverflow.com/comment/35747228
has comment: http://stackoverflow.com/comment/35747974
has comment: http://stackoverflow.com/comment/35747505
has comment: http://stackoverflow.com/comment/35747173
upvote count: 5
has comment: http://stackoverflow.com/comment/35746503

code-generation
tag name: code-generation
tags question: http://stackoverflow.com/q/23358879
tags question: http://stackoverflow.com/q/23450349
type: Tag
tags question: http://stackoverflow.com/q/23435566

http://stackoverflow.com/q/23313247
has comment: http://stackoverflow.com/comment/35692551
favorite count: 0
has comment: http://stackoverflow.com/comment/35692468
possible better answer: http://stackoverflow.com/a/43068106
has comment: http://stackoverflow.com/comment/35692742
has answer: http://stackoverflow.com/a/43068106
has comment: http://stackoverflow.com/comment/35700872
score: 2
has comment: http://stackoverflow.com/comment/35692816
has answer: http://stackoverflow.com/a/23357629
upvote count: 3
downvote count: 1
accepted answer: http://stackoverflow.com/a/23357629
type: AnsweredQuestion
tagged with: java
has body: I just want to know that why I am not getting output as desired instead of this line as output: Usage: RealmBase -a [-e ] Here is my Beans.xml <?xml version="1.0" encoding="UTF-8"?> And here is my RunClassDemo.java package com.student.spring.test; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; import com.student.spring.impl.BeanScopeDemo; public class RunClassDemo { public static void main(String[] args) { ApplicationContext applicationContext = new ClassPathXmlApplicationContext(new String [] {"beans.xml"}); BeanScopeDemo beanScopeDemo = (BeanScopeDemo) applicationContext.getBean("beanScopeDemo"); beanScopeDemo.setMessage("Message by Customer A"); System.out.println("Message : " + beanScopeDemo.getMessage()); beanScopeDemo.setMessage("Message by Customer B"); System.out.println("Message : " + beanScopeDemo.getMessage()); } } And here is my BeanScopeDemo.java package com.student.spring.impl; public class BeanScopeDemo { String message; public String getMessage() { return message; } public void setMessage(String message) { this.message = message; } }
has title: Usage: RealmBase -a <algorithm> [-e <encoding>] <credentials>
type: Question
answer count: 2

http://stackoverflow.com/a/47306625
downvote count: 0
has body: One un-usual way i found to do is to create two separate file with different logging level. For example. log4j2.xml and log4j-debug.xml Now change the configuration from this files. Sample Code: ConfigurationFactory configFactory = XmlConfigurationFactory.getInstance(); ConfigurationFactory.setConfigurationFactory(configFactory); LoggerContext ctx = (LoggerContext) LogManager.getContext(false); ClassLoader classloader = Thread.currentThread().getContextClassLoader(); InputStream inputStream = classloader.getResourceAsStream(logFileName); ConfigurationSource configurationSource = new ConfigurationSource(inputStream); ctx.start(configFactory.getConfiguration(ctx, configurationSource));
answers question: http://stackoverflow.com/q/23434252
upvote count: 2
type: Answer
score: 2

http://stackoverflow.com/comment/35843217
comment on: http://stackoverflow.com/q/23348619
score: 0
type: Comment
type: QuestionComment
has text: Using this link http://mail-archives.apache.org/mod_mbox/mrunit-user/201403.mbox/%3CCAFukC=4+qvSTd40DGpaeyriSYrtgy90Km=oQBoutx80yLVEZBw@mail.gmail.com%3E then I found the Jar here https://repository.apache.org/content/repositories/orgapachemrunit-1000/org/apache/mrunit/mrunit/1.1.0/

http://stackoverflow.com/a/23451508
answers question: http://stackoverflow.com/q/23451474
has comment: http://stackoverflow.com/comment/97099921
accepted answer of: http://stackoverflow.com/q/23451474
upvote count: 2
type: AcceptedAnswer
has body: Your problem is with the 10/12 part. Java is interpreting them both as integers, and rounding the result down, so it becomes 0. Dividing by 0 produces NaN. Also, both the 20/12 and the 30/12 will evaluate to 2. Although this will not produce an error, it will not return the correct result. You can fix all of these issues by changing every 12 to 12.0.
downvote count: 0
has comment: http://stackoverflow.com/comment/35948754
type: Answer
score: 2

http://stackoverflow.com/a/23450604
has comment: http://stackoverflow.com/comment/35987331
answers question: http://stackoverflow.com/q/23450354
has comment: http://stackoverflow.com/comment/35985360
has comment: http://stackoverflow.com/comment/35961393
accepted answer of: http://stackoverflow.com/q/23450354
type: AcceptedAnswer
downvote count: 0
has body: Use Action to encapsulate the desired functionality. Make a reference to the enclosing panel visible, as shown here and here; or export the Action from a class having (at least) package-private access, as shown here.
type: Answer
score: 2
upvote count: 2

http://stackoverflow.com/q/23381851
has body: I have Two large XML files and i have Java classes for every xml atribute. What i do now: unmarshal XML Files with JAXB. I finaly have Two classes which i can use to get the whole file (all classes/ tags) How the structure of the classes are: For example with this xml file. &lt;GRANDFATHER ID="1" NAME="Hallo"&gt; &lt;\FATHER&gt; &lt;SON&gt; &lt;\SON&gt; &lt;\FATHER&gt; &lt;/GRANDFATHER &gt; after unmarhaling i would have an object -> GRANDFATHER with this object i could make GRANDFATHER.getFATHER and then from FATHER .getSON i now need to compare each object with the other by ID couse there are so many classes this would be a huge ammount of hardcoding so i thaught about houw i could do this by Reflection. Tried but could not find a way. Any Ideas ? If you have a system or algorithm in mind i would highly apreciate it Thanks.
has comment: http://stackoverflow.com/comment/35819941
score: 0
has comment: http://stackoverflow.com/comment/35818304
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/35818634
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35818455
has comment: http://stackoverflow.com/comment/35819080
linked to: http://stackoverflow.com/q/18895262
has comment: http://stackoverflow.com/comment/35821816
tagged with: reflection
tagged with: java
type: Question
tagged with: algorithm
has comment: http://stackoverflow.com/comment/35896856
has title: Compare two XML - Java Elements with Reflection
has comment: http://stackoverflow.com/comment/35819716
has comment: http://stackoverflow.com/comment/35821105

http://stackoverflow.com/comment/35843521
comment on: http://stackoverflow.com/q/23391607
has text: David, the today's version uses .en and .ge properties files read-only. But it's a good point to re-think how far to go away from the original semantic. Beside my 5 chars prefix addition I do not have to evaluate the string handling currently defined by the Properties class. Putting it into the InputStream is a runtime pre-processing only and not touching a wider scope.
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/23444443
upvote count: 0
answers question: http://stackoverflow.com/q/23442621
has comment: http://stackoverflow.com/comment/60517760
has body: I already did some extensive googling before asking this question but continuing that I found a solution here: This issue seems to only appear when using JDK 1.8 so using JDK 1.7 instead solves the problem. The following line needs to be added to eclipse.ini: -vm "path-to-jdk-1.7\bin\javaw.exe"
type: Answer
downvote count: 1
score: -1

http://stackoverflow.com/q/23399619
type: Question
answer count: 2
has body: I have some text strings that I need to process and inside the strings there are HTML special characters. For example: 10&amp;#xd83d;&amp;#xde2d;&amp;#xd83d;&amp;#xde2d;&amp;#xd83d;&amp;#xde02;&amp;#xd83d;&amp;#xde02;&amp;#xd83d;&amp;#xde02;&amp;#xd83d;&amp;#xde02;&amp;#xd83d;&amp;#xde22;&amp;#xd83d;&amp;#xde02;10&amp;#xd83d;&amp;#xde2d;&amp;#xd83d;&amp;#xde2d;&amp;#xd83d;&amp;#xde02;&amp;#xd83d;&amp;#xde02;&amp;#xd83d;&amp;#xde02;&amp;#xd83d;&amp;#xde02;&amp;#xd83d;&amp;#xde22;&amp;#xd83d;&amp;#xde02;&amp;#xd83d;&amp;#xde02; I would like to convert those characters to utf-8. I used org.apache.commons.lang3.StringEscapeUtils.unescapeHtml4 but didn't have any luck. Is there an easy way to deal with this problem?
downvote count: 0
has title: How to unescape html special characters in Java?
has answer: http://stackoverflow.com/a/23400594
favorite count: 0
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35851738
score: 2
has comment: http://stackoverflow.com/comment/35851722
tagged with: java
has answer: http://stackoverflow.com/a/23399725
has comment: http://stackoverflow.com/comment/35852160

http://stackoverflow.com/a/23431317
accepted answer of: http://stackoverflow.com/q/23431254
has comment: http://stackoverflow.com/comment/35911582
has body: Locking the table will work just fine and if every operation needs to go through these steps will have no cost (as you need to lock on something anyway). Really you need to revisit your requirements and architecture though, this has the smell of something that's going to get horribly messy very fast. Just have something responsible for the randomizing, run it on your server, have it randomize when required. Keep things simple.
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/35910856
score: 2
has comment: http://stackoverflow.com/comment/35911692
upvote count: 2
answers question: http://stackoverflow.com/q/23431254

http://stackoverflow.com/q/23329419
has answer: http://stackoverflow.com/a/23329572
score: 0
has comment: http://stackoverflow.com/comment/35722529
answer count: 1
linked to: http://stackoverflow.com/q/2108103
has title: How to use PropertyResourceBundle with keys containing whitespaces
type: UnansweredQuestion
tagged with: java
type: Question
tagged with: properties-file
has body: I want to use properties files through PropertyResourceBundle for i18n. My current issue is that keys on the files I have can include white spaces, e.g. : key number 1 = value number 1 key2 = value2 So, when I load the corresponding property file the first white space is used as the key-value delimiter instead of the '=' sign. Then, my questions are: how can I use a key with white spaces in it without modifying the properties file (I'd like to avoid adding any slash or unicode character code)? Is there any way to override the default properties file delimiter so I can set '=' as the only one to be considered?

http://stackoverflow.com/comment/35895311
type: Comment
has text: Start by understanding the difference between JDK and JRE. Then install JDK7 to do Java 7 development, and JDK6 to do Java 6 development. Having both is not a problem. I have 3 JDKs installed on my machine, because some projects are on 6, some on 7, and some on 8.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23422723

http://stackoverflow.com/q/23390058
favorite count: 0
score: 0
linked to: http://stackoverflow.com/q/14607480
tagged with: css
has comment: http://stackoverflow.com/comment/35833305
upvote count: 1
downvote count: 1
type: AnsweredQuestion
tagged with: java
has title: Current menu link in nevigation bar must stay highlighted
type: Question
tagged with: liferay
answer count: 1
has answer: http://stackoverflow.com/a/23390126
has body: On navigation bar once i clicked on any menu like (Home), home link is active but doesn't stay highlighted. Unable to find the solution.
accepted answer: http://stackoverflow.com/a/23390126

http://stackoverflow.com/comment/35956612
comment on: http://stackoverflow.com/q/23449966
type: QuestionComment
has text: Please take a better look at the Java language and the Java Card platform itself. There is a lot of rather fundamental errors in that code, mostly related how object lifetimes and object assignment works. [This book](http://www.oracle.com/technetwork/java/javacard/javacard-142511.html), while old, should get you started.
score: 0
type: Comment

http://stackoverflow.com/comment/35672324
type: AnswerComment
has text: @Seekerakos `Scanner` keeps a "pointer" to the keyboard input buffer. When users type things, characters get into the buffer. When you read from the scanner, characters get removed from the buffer. You ask the user to enter a menu option; he presses `1`, then hits `[Enter]`. Your code reads `nextInt()` from the scanner, taking `'1'`. The `[Enter]` is still there. Now you ask for `nextLine()` inside the `case` statement. `Scanner` sees the `[Enter]`, so it returns you an empty line right away!
comment on: http://stackoverflow.com/a/23301809
type: Comment
score: 1

http://stackoverflow.com/a/34395563
has comment: http://stackoverflow.com/comment/56912593
has comment: http://stackoverflow.com/comment/58159113
has comment: http://stackoverflow.com/comment/57395310
has body: We Can Use Java 8 using: In build.gradle (Project: myProject) add following classpath 'me.tatarka:gradle-retrolambda:x.x.x' //x.x.x is recent version In build.gradle (Module: myModule) add following apply plugin: 'me.tatarka.retrolambda' compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 }
type: Answer
upvote count: 14
answers question: http://stackoverflow.com/q/23318109
score: 13
downvote count: 1

http://stackoverflow.com/comment/35866671
type: AnswerComment
comment on: http://stackoverflow.com/a/23379105
score: 0
type: Comment
has text: I can't answer that question with any certainty, but my first guess is that it has something to do with the `try` clause.

http://stackoverflow.com/comment/35901293
score: 0
type: Comment
type: QuestionComment
has text: I'm using Vaadin 7.1.11
comment on: http://stackoverflow.com/q/23423526

http://stackoverflow.com/comment/35926541
type: QuestionComment
comment on: http://stackoverflow.com/q/23439576
score: 0
type: Comment
has text: This is probably just a problem with Fraps, try using a different software. If you still get the same issue you know you need to fix something in your game

http://stackoverflow.com/a/23297261
answers question: http://stackoverflow.com/q/23297147
type: AcceptedAnswer
downvote count: 0
score: 4
has body: I believe you just forgot import static com.github.tomakehurst.wiremock.client.WireMock.*; The methods you are trying to invoke are static methods of the WireMock type. They aren't static methods of your custom type. You either import as above, or invoke them with the qualified name of the type.
accepted answer of: http://stackoverflow.com/q/23297147
type: Answer
has comment: http://stackoverflow.com/comment/35663530
upvote count: 4

http://stackoverflow.com/comment/35767226
comment on: http://stackoverflow.com/q/23353164
score: 0
has text: But arithmetic addition fails as well. The point is that the + operator should be working, as it's a valid java operator. But the compiler is choking on it for some reason.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35716661
has text: @Tuga I don't know. What does that gain us?
type: Comment
comment on: http://stackoverflow.com/a/23326339
score: 0
type: AnswerComment

http://stackoverflow.com/comment/35885582
score: 0
type: Comment
type: QuestionComment
has text: I added my project structure. I'm not sure how useful the standard directory and package layout is, however, as I'm using maven and am using the libgdx-gwt-backend, as opposed to native gwt.
comment on: http://stackoverflow.com/q/23398970

http://stackoverflow.com/comment/112704341
score: 0
type: AnswerComment
type: Comment
has text: How do you know they have a Spring setup?
comment on: http://stackoverflow.com/a/63734410

http://stackoverflow.com/q/23409609
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23409910
downvote count: 0
score: 1
tagged with: string
favorite count: 0
tagged with: hash
has title: Compute hash of a substring given the hashes of all prefixes of the string
type: Question
upvote count: 1
tagged with: java
has body: Suppose you are given a string S of length N and also an array of hash values of all the prefixes of the string S hash[0][0...N-1]. hash[0][i] denotes the hash of the prefix of string S ending at index i. M denotes a large prime integer. R denotes a radix used in the hash function. You are also given the hash function used: for(int i = 0; i &lt; N; i++) { hash[0][i] = ( (i &gt; 0 ? hash[0][i - 1] : 0) * R + S.charAt(i) ) % M; } We need to compute the hash[i][j] on a need basis. Can we find out the hash value of a substring of S in O(1) i.e. hash[i][j] given the above information? where, i,j &gt; 0 and i,j &lt; N Note: The array hash[][] initially contains only the precomputed hashes hash[0][0....N-1] of the prefixes of string S.
answer count: 1
tagged with: algorithm

http://stackoverflow.com/a/23429220
answers question: http://stackoverflow.com/q/23426902
has comment: http://stackoverflow.com/comment/35909892
has body: You can't get place holders again once they disappeared. But you can get content assist help as said by @E-Riz Check this answer What is Eclipse shortcut key to turn on feature that allows when pressing TAB key, for cursor to go to expected position? and also this What&#39;s this box around my function input?
score: 0
upvote count: 1
downvote count: 1
type: Answer

http://stackoverflow.com/a/23428462
type: Answer
score: 2
upvote count: 2
has body: Another option is to pass the showPrompt(...) method a StringProperty, and update the property in your OK button's handler. The caller of showPrompt can then create the StringProperty, register a listener with it, and observe it. Something like: public String showPrompt(String title, String defValue, final StringProperty result){ // ... final TextField txtPromptValue = new TextField(defValue); // ... btnOk.setOnAction(new EventHandler&lt;ActionEvent&gt;(){ @Override public void handle(ActionEvent event) { result.set(txtPromptValue.getText()); dlgStage.close(); } }); // ... } Then you call the dialog with something like: StringProperty dialogResult = new SimpleStringProperty(); dialogResult.addListener(new ChangeListener&lt;String&gt;() { public void changed(ObservableValue&lt;? extends String&gt; obs, String oldValue, String newValue) { // process newValue, the value from the dialog... } }); showPrompt("Dialog Title", "Default value", dialogResult);
downvote count: 0
answers question: http://stackoverflow.com/q/23424542

http://stackoverflow.com/comment/35900236
type: Comment
comment on: http://stackoverflow.com/q/23425498
has text: Can you please share some code or object which you are trying to persist.
score: 0
type: QuestionComment

http://stackoverflow.com/comment/35753625
score: 0
comment on: http://stackoverflow.com/q/23346359
has text: Maybe it is because only one of them is being notified of the key press, can you try to move both key processors into one processKey(..) method?
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23402604
upvote count: 1
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/23402874
has comment: http://stackoverflow.com/comment/35856849
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/35857091
favorite count: 0
has comment: http://stackoverflow.com/comment/35856893
has comment: http://stackoverflow.com/comment/35856838
has title: how to view webpage using Implicit Intent in android
tagged with: android
has comment: http://stackoverflow.com/comment/35857028
has body: EDIT: the complete code now package com.example.shopkart; import android.app.Activity; import android.content.Intent; import android.net.Uri; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.webkit.WebView; import android.widget.AdapterView; import android.widget.AdapterView.OnItemSelectedListener; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.Spinner; import android.widget.TableLayout; import android.widget.TextView; public class netbanking extends Activity { datamanager dm; String name,mailid; String[] productnamearray; int[] amount_product,id_array; boolean[] checkarray; int tablesize,finalbill; Spinner spinner_banks; WebView wv1; Button btnbankselect; // @Override // public void onBackPressed() { // // } @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.netbanking); dm=new datamanager(this); wv1=(WebView) findViewById(R.id.wv1); btnbankselect=(Button) findViewById(R.id.btnbankselect); spinner_banks=(Spinner) findViewById(R.id.spinner_banks); productnamearray=getIntent().getExtras().getStringArray("productnamearray"); checkarray=getIntent().getExtras().getBooleanArray("checkarray"); id_array=getIntent().getExtras().getIntArray("id_array"); name=getIntent().getExtras().getString("name"); mailid=getIntent().getExtras().getString("mailid"); finalbill=getIntent().getExtras().getInt("finalbill"); setspinnervalues(); btnbankselect.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { int pos=spinner_banks.getSelectedItemPosition(); switch (pos) { case 0: wv1.getSettings().setJavaScriptEnabled(true); wv1.loadUrl("http://www.canarabank.in"); // Intent i1=new Intent(Intent.ACTION_VIEW); // i1.setData(Uri.parse("http://www.google.com")); // startActivity(i1); break; case 1: wv1.getSettings().setJavaScriptEnabled(true); wv1.loadUrl("http://www.federalbank.co.in"); // Int…
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/35856881

http://stackoverflow.com/a/23451564
type: Answer
accepted answer of: http://stackoverflow.com/q/23451549
score: 2
has comment: http://stackoverflow.com/comment/35949597
upvote count: 2
answers question: http://stackoverflow.com/q/23451549
has body: The first code example uses recursion. The second code sample uses iteration (in the form of a for-each loop). The first is not necassarily better than the second. In your case, I'm assuming the point of the assignment is to become familiar with recursion. Personally I'd use the second one because it's a lot clearer.
has comment: http://stackoverflow.com/comment/35948935
has comment: http://stackoverflow.com/comment/35948963
has comment: http://stackoverflow.com/comment/35948790
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/23389401
tagged with: sorting
has title: Sorting function provides incorrect result
accepted answer: http://stackoverflow.com/a/23389608
has body: I want to sort priorities[] in descending order i.e. ...2,1,0. When I execute the below-provided code, I receive unsorted array, e.g. 18, 14, 15, 19, 23, 37, 35, 1, 8, 24, 26, 36 Why does this happen? double[] priorities = new double[10]; for (int i = 0; i &lt; 10; i++) priorities[i] = Math.round(10*Math.random(); ArrayIndexComparator comparator = new ArrayIndexComparator(priorities,1); Integer[] sortedPriorities = comparator.createIndexArray(); Arrays.sort(sortedPriorities, comparator); public class ArrayIndexComparator implements Comparator&lt;Integer&gt; { private final double[] array; private int sort; public ArrayIndexComparator(double[] array, int sort) { this.array = array; this.sort = sort; } public Integer[] createIndexArray() { Integer[] indexes = new Integer[array.length]; for (int i = 0; i &lt; array.length; i++) { indexes[i] = i; } return indexes; } @Override public int compare(Integer index1, Integer index2) { if (sort == 0) return Double.compare(array[index2],array[index1]); // ascending order 0,1,2,... else return Double.compare(array[index1],array[index2]); // descending order ...2,1,0 } }
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23389608
type: Question
tagged with: java
tagged with: comparable
score: 0
tagged with: comparator
answer count: 1
has comment: http://stackoverflow.com/comment/35832372

http://stackoverflow.com/comment/35935260
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23444599
has text: Just out of curiosity, have you considered using a [JOptionPane](http://docs.oracle.com/javase/7/docs/api/javax/swing/JOptionPane.html) instead? Your dialog looks simple enough to use one.

http://stackoverflow.com/comment/35889541
type: Comment
comment on: http://stackoverflow.com/a/23419756
has text: Thanks. Did you try my updated code? It doesn't rely on the counting stream - and I can see the images. This is driving me crazy.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/36025156
has text: @romkyns The question does _not_ presume that 10GB of virtual memory is bad. When you explain why it isn't bad, that's just preaching to the choir. The question is only asking why Java has 10GB as it's default value.
score: 1
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23385476

http://stackoverflow.com/comment/35803662
comment on: http://stackoverflow.com/q/23372092
score: 0
type: Comment
type: QuestionComment
has text: have you tried the solution in this question: http://stackoverflow.com/questions/2019371/swing-setting-a-function-key-f2-as-an-accelerator

http://stackoverflow.com/a/65096960
downvote count: 0
answers question: http://stackoverflow.com/q/23320407
has body: If you actually want to be able to cancel a task, then you have to use Future itself (e.g. as returned by ExecutorService.submit(Callable&lt;T&gt;), not CompletableFuture. As pointed out in the answer by nosid, CompletableFuture completely ignores any call to cancel(true). My suspicion is that the JDK team did not implement interruption because: Interruption was always hacky, difficult for people to understand, and difficult to work with. The Java I/O system is not even interruptible, despite calls to InputStream.read() being blocking calls! (And the JDK team have no plans to make the standard I/O system interruptible again, like it was in the very early Java days.) The JDK team have been trying very hard to phase out old broken APIs from the early Java days, such as Object.finalize(), Object.wait(), Thread.stop(), etc. I believe Thread.interrupt() is considered to be in the category of things that must be eventually deprecated and replaced. Therefore, newer APIs (like ForkJoinPool and CompletableFuture) are already not supporting it. CompletableFuture was designed for building DAG-structured pipelines of operations, similar to the Java Stream API. It's very dificult to succinctly describe how interruption of one node of a dataflow DAG should affect execution in the rest of the DAG. (Should all concurrent tasks be canceled immediately, when any node is interrupted?) I suspect the JDK team just didn't want to deal with getting interruption right, given the levels of internal complexity that the JDK and libraries have reached these days. (The internals of the lambda system -- ugh.) One very hacky way around this would be to have each CompletableFuture export a reference to itself to an externally-visible AtomicReference, then the Thread reference could be interrupted directly when needed from another external thread. Or if you start all the tasks using your own ExecutorService, in your own ThreadPool, you can manually interrupt any or all the threads that were started…
type: Answer
score: 11
has comment: http://stackoverflow.com/comment/138636713
upvote count: 11
has comment: http://stackoverflow.com/comment/138633565

http://stackoverflow.com/comment/35859181
type: Comment
type: QuestionComment
has text: An actual [runnable example that demonstrates your problem](https://stackoverflow.com/help/mcve) would involve less guess work and better responses
score: 0
comment on: http://stackoverflow.com/q/23403595

http://stackoverflow.com/a/23302233
has comment: http://stackoverflow.com/comment/35672812
type: Answer
has body: Something like this? test = test.replaceAll((test.split(" ")[0]), ""); EDIT: Ok, case insensitivity makes this a bit more interesting. String[] words = test.split(" "); String firstword = words[0]; String test = ""; for(String word : words) { if(!word.equalsIgnoreCase(firstword)) { test += " " + word; } } I'm writing this all in-browser, so it might not be perfect, but that should get the ball rolling.
has comment: http://stackoverflow.com/comment/35672770
score: 1
has comment: http://stackoverflow.com/comment/35672854
upvote count: 2
has comment: http://stackoverflow.com/comment/35672617
has comment: http://stackoverflow.com/comment/35672802
has comment: http://stackoverflow.com/comment/35672702
downvote count: 1
answers question: http://stackoverflow.com/q/23302193

http://stackoverflow.com/comment/35795108
score: 0
has text: @jwells131313 added the binding code.
comment on: http://stackoverflow.com/q/23346516
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23440517
has comment: http://stackoverflow.com/comment/35933283
has comment: http://stackoverflow.com/comment/35928101
has body: I need to get value of dropdown list, radio button and a check box. I am using request.getParameter() method but it's returning null value. JSP Code: <%@page contentType="text/html" pageEncoding="UTF-8"%> JSP Page Highest Qualification : 01 02 03 04 05 Male Female Servlet Code: public class NewServlet extends HttpServlet { protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String bdate = null; bdate = request.getParameter("mon"); System.out.print("This is" + bdate); } }
favorite count: 0
has answer: http://stackoverflow.com/a/23446202
has title: How to get the values of dropdownlist, radio button from a jsp and send it to servlet?
has answer: http://stackoverflow.com/a/23440741
type: UnansweredQuestion
upvote count: 1
type: Question
score: 1
tagged with: java
linked to: http://stackoverflow.com/q/2422468
tagged with: servlets
answer count: 2
downvote count: 0
tagged with: jsp
has comment: http://stackoverflow.com/comment/35928078

http://stackoverflow.com/a/23410816
score: 0
answers question: http://stackoverflow.com/q/23410439
has comment: http://stackoverflow.com/comment/35932986
has comment: http://stackoverflow.com/comment/35878049
has comment: http://stackoverflow.com/comment/35873946
has body: Anyway, It is not relative to the Connector version. I've tried same code with versions 5.1.30 and 5.1.13 and worked both. I also tried the two overloaded methods : c = DriverManager.getConnection(URL+DBNAME, LOGIN, PASSWORD); and c = DriverManager.getConnection("jdbc:mysql://localhost/universite?" + "user=root&amp;password=root"); worked for both versions Try to be sure that you have the access garanteed to all ip adresses.
type: Answer

http://stackoverflow.com/a/23301908
downvote count: 0
answers question: http://stackoverflow.com/q/23301775
has body: Short answer: yes. An if statement takes a boolean expression as its condition. That can be the result of an operator which returns a boolean value such as ==, or that can be a boolean variable. Basically, a boolean expression is anything which you can assign to a boolean variable: boolean b = ?; Therefore, x == true is somewhat redundant, as x on its own already suffices: those two boolean expressions are equivalent. It's quite common for new programmers though to write the == true, as it "reads" more naturally: if x is true, then do... However, you should actually read that as if (x == true) is true, then do... as that's what's actually happening. Here, you see where the redundancy comes from. More experienced programmers know this and prefer writing x and !x as opposed to x == true and x == false respectively. It doesn't matter for the compiler, but it matters for the programmer/maintainer when he has to read: if ( ((x == true) &amp;&amp; (y == true)) || (z == false) ) { ... } as opposed to: if ( (x &amp;&amp; y) || !z ) { ... }
upvote count: 2
type: Answer
score: 2

http://stackoverflow.com/a/23337164
score: 1
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23336004
has comment: http://stackoverflow.com/comment/35736064
has body: From the Javadoc for Throwable.printStacktrace: Note the presence of lines containing the characters "...". These lines indicate that the remainder of the stack trace for this exception matches the indicated number of frames from the bottom of the stack trace of the exception that was caused by this exception (the "enclosing" exception). This shorthand can greatly reduce the length of the output in the common case where a wrapped exception is thrown from same method as the "causative exception" is caught. In other words the rest of the stack trace for your NullPointerException is the same as the trace for ExceptionInInitializerError.
type: Answer
accepted answer of: http://stackoverflow.com/q/23336004
upvote count: 1

http://stackoverflow.com/q/23403764
has comment: http://stackoverflow.com/comment/35859410
tagged with: spring-mvc
tagged with: java
has answer: http://stackoverflow.com/a/23404070
linked to: http://stackoverflow.com/q/5539176
upvote count: 1
downvote count: 1
type: Question
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23404070
has comment: http://stackoverflow.com/comment/35859017
has body: I am writing a jsp file to call a controller with some parameters. And from this controller i want to call a servlet by passing the values from the controller. And with in the servlet i should get access to the parameters. Is it possible to forward values from jsp to servlet via controller?
tagged with: servlets
score: 0
answer count: 1
has title: call servlet from controller with parameters to servlet
has comment: http://stackoverflow.com/comment/35858869
tagged with: jsp
favorite count: 0

http://stackoverflow.com/q/23445252
has answer: http://stackoverflow.com/a/23445306
tagged with: addition
upvote count: 1
has comment: http://stackoverflow.com/comment/35936520
type: AnsweredQuestion
score: 1
tagged with: java
type: Question
possible better answer: http://stackoverflow.com/a/23445710
accepted answer: http://stackoverflow.com/a/23445306
answer count: 2
has comment: http://stackoverflow.com/comment/35936476
has answer: http://stackoverflow.com/a/23445710
tagged with: arrays
downvote count: 0
favorite count: 0
tagged with: integer
has title: Adding an integer to an array inside a node
has body: So the concept of my question is: Let's say we have nodes. Each node has an array of integers. Now, we must add an integer to end of the array. How do we do that? Here's what I've done so far: Created class Node: public class Node { private int[] data; Node next; public Node(int n, Node nxt) { data = new int[n]; next = nxt; } } Then the dynamic array list class: public class DynamicArrayOfInts { private Node head = null; private int numOfElementsPerNode = 0; public DynamicArrayOfInts(int elementsPerNode) { numOfElementsPerNode = elementsPerNode; } public void add(int e) { } }
has comment: http://stackoverflow.com/comment/35936451

http://stackoverflow.com/a/23334883
answers question: http://stackoverflow.com/q/23334503
accepted answer of: http://stackoverflow.com/q/23334503
type: Answer
has body: you should try JLine library. It provides many userful functions for command line applications. http://jline.sourceforge.net/javadoc/
score: 0
type: AcceptedAnswer

http://stackoverflow.com/comment/35694496
type: QuestionComment
has text: My solution actually also seems to work fine with your example: `System.out.println(simplify(d*mult/mult));` prints `1000`.
comment on: http://stackoverflow.com/q/23313411
score: 0
type: Comment

http://stackoverflow.com/comment/35885568
type: Comment
type: QuestionComment
has text: Do you mean `String[] matches = text.split("\\.pm", 2);` ?
comment on: http://stackoverflow.com/q/23417539
score: 0

http://stackoverflow.com/a/23322751
downvote count: 0
upvote count: 2
answers question: http://stackoverflow.com/q/23322686
has body: It works: package scanner; import java.util.Scanner; public class Main { public static void acceptValidInput(Scanner sc) { int i = sc.nextInt(); if (i &lt;= 10) { System.out.print("Enter a number greater than 10: "); acceptValidInput(sc); } } public static void main(String[] args) { System.out.print("Enter a number greater than 10: "); Scanner sc = new Scanner(System.in); acceptValidInput(sc); sc.close(); System.out.println("Your input is valid"); } } The result is: Enter a number greater than 10: 4 Enter a number greater than 10: 5 Enter a number greater than 10: 11 Your input is valid Process finished with exit code 0
type: Answer
score: 2

http://stackoverflow.com/comment/36042191
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23429046
has text: that was the first thing came to my mind. I spent days in that CacheControl and [CacheStrategy](https://github.com/square/okhttp/blob/276908f5322af10ddad0bb4ed024d2edf8939731/okhttp/src/main/java/com/squareup/okhttp/internal/http/CacheStrategy.java) classes. But two requests idea didn't made much sense. If `max-stale + max-age` is passed, it does request from network. But I want to set max-stale a week. This makes it read response from cache even if there is network available.
score: 0

http://stackoverflow.com/a/23394019
accepted answer of: http://stackoverflow.com/q/23393761
has body: Yes Jsoup.connect(url).get() and Jsoup.connect(url).timeout(10*1000).execute(); are two separate connections. Maybe you are looking for something like Response resp = Jsoup.connect(url).timeout(10*1000).execute(); String contentType = res.contentType(); and later parse body of response as a Document Document doc = resp.parse(); Anyway Jsoup by default parses only text/*, application/xml, or application/xhtml+xml and if content type is other, like application/pdf it will throw UnsupportedMimeTypeException so you shouldn't be worried about it.
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23393761
type: Answer
score: 11
downvote count: 0
upvote count: 11

http://stackoverflow.com/q/23366588
has comment: http://stackoverflow.com/comment/38650692
has comment: http://stackoverflow.com/comment/35837325
has comment: http://stackoverflow.com/comment/35847542
has comment: http://stackoverflow.com/comment/35827870
tagged with: xmpp
score: 8
favorite count: 0
accepted answer: http://stackoverflow.com/a/23405653
has body: I've implemented the new GCM CCS for bi-directional messages between an Android application and a web server. Downstream messages (web-device) work perfectly. Unfortunately, upstream messages (device-web) are not received on the server. They do appear to be sent on the client side (see Android app log message below), but nothing is being received on the server. D/GCM﹕ GcmService start Intent { act=com.google.android.gcm.intent.SEND flg=0x10 pkg=com.google.android.gms cmp=com.google.android.gms/.gcm.GcmService (has extras) } com.google.android.gcm.intent.SEND I presume nothing is wrong on the Android side, but rather on the server side. The thing is, I cannot manage to figure out what is wrong, because the connection is still alive and I do receive some messages from GCM server, like ACKs. So why are normal messages not received ? Does anybody have any idea ? Some other details worth mentioning are that the web server being used is Glassfish and that I start the XMPP connection inside a Servlet. Some snippets below. EDIT: As I've stated in the answer, the major problem that prevented any message being received on the server has been resolved. However, quite a lot of messages are still not being received (approx. 50%). For example, I'm sending 2 messages immediately one after another on a background thread, every time a user makes a change in the Android app (presses a button, so there's a minimum couple of seconds between every batch of 2). Sometimes I receive both messages on the server, sometimes I receive only 1 of them, sometimes nothing even happens... This is a serious problem, especially for apps that rely on this technology at their core. Can anybody be of further assistance in order to troubleshoot this down ? More info: I'm pretty sure this is not client related, as every message is being sent, like you see in the logcat log above and I also receive the "event:sent" GCM broadcast after a while (not immediately though, maybe like 5 mins). So it must be somet…
has comment: http://stackoverflow.com/comment/35845553
has comment: http://stackoverflow.com/comment/35835871
tagged with: google-cloud-messaging
has answer: http://stackoverflow.com/a/33384863
has title: GCM CCS server implementation not receiving upstream messages
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23405653
linked to: http://stackoverflow.com/q/30056939
downvote count: 0
tagged with: java
possible better answer: http://stackoverflow.com/a/33384863
upvote count: 8
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/35845807
has comment: http://stackoverflow.com/comment/35836310

http://stackoverflow.com/comment/35930806
has text: Adding to my comment, please check http://stackoverflow.com/q/7477553/2231632 to understand why this is so.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23442044

http://stackoverflow.com/q/23329152
has title: Generics subtle differences
has answer: http://stackoverflow.com/a/23329278
score: 2
downvote count: 0
linked to: http://stackoverflow.com/q/3847162
has answer: http://stackoverflow.com/a/23329232
type: AnsweredQuestion
favorite count: 0
has body: class P { } class Q extends P { } class R extends Q { } class S extends R { } public class Manager { public static void main(String[] args) { X&lt;? super R&gt; x4 = null; x4.test(new S()); x4.test(new R()); x4.test(new P());//compile time error } } class X&lt;A&gt; { void test(A obj) { } } //means that R or superclass of R i.e P, Q or Object but then why I get a compile time error on line as specified in the program.
type: Question
upvote count: 2
answer count: 2
accepted answer: http://stackoverflow.com/a/23329232
linked to: http://stackoverflow.com/q/2723397
tagged with: java
possible better answer: http://stackoverflow.com/a/23329278

http://stackoverflow.com/q/23320233
has comment: http://stackoverflow.com/comment/35705200
tagged with: jakarta-mail
score: 0
has answer: http://stackoverflow.com/a/23320519
tagged with: netbeans-7
has title: Exception in reading mails using javamail
has body: I am trying to implement the code of receive mails But I am getting NullPointerException. The method to receive code, called from the "Settings.java" program is "connect()" which is in "EmailClient.java" program. Authentication works successfully but when I try to put message headers in vector or array it gives the Exception. Settings.java public class Settings extends javax.swing.JFrame { public String uname; public String pass; public String smtpserver; public String port; Object item, item2; EmailClient ec; public Settings() { initComponents(); } public String getUname() { return uname; } public String getPass() { return pass; } public String getSmtpserver() { return smtpserver; } public String getPort() { return port; } private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: uname = jTextField1.getText(); pass = jPasswordField1.getText(); item = jComboBox1.getSelectedItem(); smtpserver = (String) item; item2 = jComboBox2.getSelectedItem(); port = (String) item2; if (uname.equals("") || pass.equals("") || smtpserver.equals("") || port.equals("")) { JOptionPane.showMessageDialog(this, "All Fields are mandatory"); } ec = new EmailClient(); ec.connect(uname, pass); setVisible(false); } /** * @param args the command line arguments */ public static void main(String args[]) { java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new Settings().setVisible(false); } }); } EmailClient.java public class EmailClient extends javax.swing.JFrame { Settings set = new Settings(); SendMail sm = new SendMail(set); Vector vdate, vsubject, vmessage, vfrom; ArrayList adate, asubject, amessage, afrom; String[] date; String[] subject; String[] frm; String[] mess; Properties props = null; private Session session = null; private Store store = null; private Folder inbox = null; private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: sm.setVisible(true); } private void jBu…
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/23457495
type: Question
answer count: 2
accepted answer: http://stackoverflow.com/a/23320519
possible better answer: http://stackoverflow.com/a/23457495

http://stackoverflow.com/comment/124539944
comment on: http://stackoverflow.com/a/23380506
type: Comment
has text: @Jon Skeet, it is too late, but why are we multiplying here? the 1st one will be in pool, and then only 4 byte int.. the only i part of it needs to be allocated .. no?
score: 0
type: AnswerComment

http://stackoverflow.com/comment/35659006
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23294604
has text: 1) use Swing `Timer` instead `Thread.sleep()`. 2) Your problem in `ballMove()` method in `this.setSpeedX(xSpeed);this.setSpeedY(ySpeed);` lines. 3) Instead paint on `JFrame` use `JPanel` and method `paintComponent()`
score: 0

http://stackoverflow.com/q/23310245
has comment: http://stackoverflow.com/comment/35687131
has comment: http://stackoverflow.com/comment/35687525
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/35687566
has comment: http://stackoverflow.com/comment/35688014
has title: I am unable to process 5GB text file while getting this error?
type: Question
has comment: http://stackoverflow.com/comment/35687074
has comment: http://stackoverflow.com/comment/35687695
has body: I am using StringBuilder, reading each tweet of a file and writing it after filtering it to another file. I am also flushing my StringBuilder at the end of each loop. I am on a 8GB RAM mac retina mid 2012. Exception in thread "main" java.lang.OutOfMemoryError: Java heap space at java.util.Arrays.copyOf(Arrays.java:2367) at java.lang.AbstractStringBuilder.expandCapacity(AbstractStringBuilder.java:130) at java.lang.AbstractStringBuilder.ensureCapacityInternal(AbstractStringBuilder.java:114) at java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:535) at java.lang.StringBuffer.append(StringBuffer.java:322) at java.io.BufferedReader.readLine(BufferedReader.java:363) at java.io.BufferedReader.readLine(BufferedReader.java:382) at Parser.main(Parser.java:52)
has comment: http://stackoverflow.com/comment/35687045
answer count: 2
accepted answer: http://stackoverflow.com/a/23310862
upvote count: 1
linked to: http://stackoverflow.com/q/2610194
favorite count: 0
possible better answer: http://stackoverflow.com/a/23310323
has answer: http://stackoverflow.com/a/23310862
has answer: http://stackoverflow.com/a/23310323

http://stackoverflow.com/comment/35824842
score: 0
type: Comment
type: QuestionComment
has text: Using lots of memory is only a problem if you don’t have it (or need it for other purposes). You didn’t say that you got an `OutOfMemoryError` so it doesn’t seem to be a *real* problem then. Maybe you should just reduce the heap of you JVM…
comment on: http://stackoverflow.com/q/23364351

http://stackoverflow.com/a/23444107
has comment: http://stackoverflow.com/comment/36294235
score: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23438234
type: Answer
has comment: http://stackoverflow.com/comment/36177693
accepted answer of: http://stackoverflow.com/q/23438234
has body: The exception message: Unable to convert value "" from type java.lang.String to type java.util.Date spring throws because you have not informed spring to convert empty string to null. binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, false)); pass true if you want null when empty string like: binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, true)); Spring CustomDateEditor constructor java docs has: public CustomDateEditor(DateFormat dateFormat, boolean allowEmpty) Create a new CustomDateEditor instance, using the given DateFormat for parsing and rendering. The allowEmpty parameter states if an empty String should be allowed for parsing, i.e. get interpreted as null value. Otherwise, an IllegalArgumentException gets thrown in that case. Parameters: dateFormat - DateFormat to use for parsing and rendering allowEmpty - if empty strings should be allowed

http://stackoverflow.com/comment/35732650
type: AnswerComment
has text: Can you give example here?
type: Comment
comment on: http://stackoverflow.com/a/23334340
score: 0

http://stackoverflow.com/comment/35722332
comment on: http://stackoverflow.com/q/23329296
score: 0
type: Comment
type: QuestionComment
has text: You can also do this by computing the multisets of prime factors of #'s from 1 to 20, taking the union of these multisets, then multiplying these numbers: union({2}{3}{2,2}{5}{3,2}{7}{2,2,2}{3,3}{5,2}{11}{3,2,2}{13}{7,2}{3,5}{2,2,2,2}{17}{3,3,2}{19}{2,2,5})={2,2,2,2,3,3,5,7,11,13,17,19}. So try `System.out.println(2*2*2*2*3*3*5*7*11*13*17*19);`.

http://stackoverflow.com/a/23361264
score: 1
answers question: http://stackoverflow.com/q/23329580
has comment: http://stackoverflow.com/comment/37549648
type: Answer
has body: I think you are running into a plattform and java liberary specific issue. Please provide additional infos about your os plattform (x86/x64) and which version of jdk from which vendor are you using? According to this Link http://www.oracle.com/technetwork/java/javase/7u51-relnotes-2085002.html Above Oracle JDK 7u51: The default socket permissions assigned to all code including untrusted code have been changed. You can only bind sockets to the ephemeral port range on each system. Port 53705 should be a save ephemeral port. But still use netstat -an | grep 53705 to double check if the port is used in linux and use netstat or tcpview for windows. You can use less /proc/sys/net/ipv4/ip_local_port_range for linux to check your ephemeral port range for linux and find HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters in windows to get determine your ephemeral port range. More about ephemeral range in windows can be found in how to change/view ephemeral port range in windows machines I can confirm your server code and client without the "man" -> "main" typo is running under Opensuse 12.3 with Java version "1.7.0_51" OpenJDK Runtime Environment (IcedTea 2.4.4) (suse-8.32.5-i386) OpenJDK Client VM (build 24.45-b08, mixed mode) jvm is running by an non admin user with groups: www,dialout,video,shadow,users
upvote count: 2
downvote count: 1
has comment: http://stackoverflow.com/comment/37593639

http://stackoverflow.com/q/23344035
has body: I swapped out my ojdb6.jar file in tomcat/lib with ojdb7.jar. Turned on Tomcat and I get the following error when trying to use it... Could not get JDBC Connection; nested exception is org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (ORA-00604: error occurred at recursive SQL level 1 ORA-01882: timezone region not found here is the connection pool configuration I am using.... &lt;Resource auth="Container" driverClassName="oracle.jdbc.driver.OracleDriver" type="javax.sql.DataSource" maxActive="25" maxIdle="25" maxWait="2000" name="jdbc/getcontacts" timeBetweenEvictionRunsMillis="1000" minEvictableIdleTimeMillis="30000" removeAbandoned="true" removeAbandonedTimeout="30000" logAbandoned="true" username="xxxx" password="xxxxx" validationQuery="Select 1 from dual" connectionProperties="defaultRowPrefetch=10000" url="jdbcracle:thin:@//xxxxx.net/xxxxx" /&gt; Any idea what could be causing this? We are using Oracle database 11g. /usr/jdk7/bin/java -version java version "1.7.0_17" Java(TM) SE Runtime Environment (build 1.7.0_17-b02) Java HotSpot(TM) 64-Bit Server VM (build 23.7-b01, mixed mode) Any help would be greatly appreciated. When I put the ojdb6.jar file back and remove the ojdb7.jar file everything works fine.
score: 2
type: AnsweredQuestion
downvote count: 0
has comment: http://stackoverflow.com/comment/35748556
has comment: http://stackoverflow.com/comment/35749102
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/35748967
upvote count: 2
has title: exception while trying to upgrade oto ojdbc7.jar from ojdb6.jar
linked to: http://stackoverflow.com/q/9156379
accepted answer: http://stackoverflow.com/a/23344146
answer count: 1
tagged with: tomcat
favorite count: 0
has answer: http://stackoverflow.com/a/23344146
tagged with: ojdbc

http://stackoverflow.com/q/23361461
has comment: http://stackoverflow.com/comment/35780684
has title: posixct date to Java date
type: Question
has comment: http://stackoverflow.com/comment/35783282
tagged with: date
score: 0
has comment: http://stackoverflow.com/comment/35782550
has comment: http://stackoverflow.com/comment/37588752
has comment: http://stackoverflow.com/comment/35780509
linked to: http://stackoverflow.com/q/3371326
type: UnansweredQuestion
has body: How can I convert in Java a POSIXct date to a formatted date like "y-M-d". I've been looking around but I didn't found anything. I read from a file these lines: 1398691820,517.0400,517.0400,517.0400,517.0400,56200 1398691870,517.1950,517.1950,516.8850,517.0350,2700 1398691920,516.2500,517.2050,516.2500,517.2050,5800 1398691980,515.6000,516.4408,515.6000,516.2800,7700 1398692044,515.4800,515.9700,515.4800,515.9200,5300 The first number of each line is a POSIXct date and I need to convert it to y-M-d hour:min. I also have in the file the offset: timezone:EDT gmtoffset:-14400 Any help is very apreciated. Thanks a lot. Edit: This the way to convert the date in R: as.POSIXct(1398691820-1400*60, origin = '1970-01-01', tz='EST')
tagged with: posixct
answer count: 0
has comment: http://stackoverflow.com/comment/35782332
tagged with: java

http://stackoverflow.com/q/23426902
upvote count: 30
has answer: http://stackoverflow.com/a/51924466
has comment: http://stackoverflow.com/comment/35902505
has comment: http://stackoverflow.com/comment/83574752
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/33712752
tagged with: eclipse
has comment: http://stackoverflow.com/comment/35903372
has comment: http://stackoverflow.com/comment/35902393
type: Question
has body: By default In Eclipse when you use a function or create objects it helps with parameters like this: But once it's done, it'll never show up again. Is there any way to call this parameter helper on code that's already written when I point the cursor on the method? The Image I uploaded only appears while writing code.
has answer: http://stackoverflow.com/a/23429220
answer count: 6
linked to: http://stackoverflow.com/q/23024622
has answer: http://stackoverflow.com/a/38479485
has comment: http://stackoverflow.com/comment/35902538
has comment: http://stackoverflow.com/comment/35902613
possible better answer: http://stackoverflow.com/a/23429138
has answer: http://stackoverflow.com/a/23429138
linked to: http://stackoverflow.com/q/23014815
downvote count: 0
has answer: http://stackoverflow.com/a/42948063
has title: Eclipse parameter dialog/hint when using functions in code
favorite count: 0
score: 30
has answer: http://stackoverflow.com/a/33712752

http://stackoverflow.com/comment/35915097
type: Comment
has text: What do you change and what is the change?
type: QuestionComment
comment on: http://stackoverflow.com/q/23432341
score: 0

http://stackoverflow.com/comment/35995147
has text: I updated question. Thank you very much for your help and for your support :)
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23384348
type: QuestionComment

http://stackoverflow.com/a/23423609
has body: mvn eclipse:eclipse -Dwtpversion=2.0 -e clean install run this instead. This builds your project by resolving dependencies
type: Answer
answers question: http://stackoverflow.com/q/23423552
has comment: http://stackoverflow.com/comment/35896904
score: 0

http://stackoverflow.com/q/23308241
downvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/23308520
has answer: http://stackoverflow.com/a/23308461
accepted answer: http://stackoverflow.com/a/23308520
has comment: http://stackoverflow.com/comment/68086897
type: AnsweredQuestion
tagged with: java
type: Question
has title: Best Practice - Multi Layer Architecture and DTOs
possible better answer: http://stackoverflow.com/a/23308461
tagged with: jpa
score: 18
tagged with: multi-tier
upvote count: 19
tagged with: dto
has body: After reading some of the Q/As here on Stackoverflow, I am still confused about the correct implementation of DTOs in my web application. My current implementation is a (Java EE based) multi-tier architecture (with persistence, service and presentation layer) but with a "common" package used by all layers, containing (amongst others) domain objects. In this case the layers can not really be considered as independent. In a re-design I am planning to remove the "common" package step by step. Questions During re-design I encounter various challenges/questions: Assume the persistence layer would use a class myproject.persistence.domain.UserEntity (a JPA based entity) to store and load data to/from the database. To show data in the view I would provide another class myproject.service.domain.User. Where do I convert them? Would the service for the users be responsible to convert between the two classes? Would this really help to improve the coupling? How should the User class look like? Should it contain only getters to be immutable? Wouldn't it be cumbersome for the views to edit existing users (create a new User, use the getters of the existing User object etc.)? Should I use the same DTO-classes (User) to send a request to the service to modify an existing user/create a new user or should I implement other classes? Wouldn't the presentation layer be very dependent on the service layer by using all the DTOs in myproject.service.domain? How to handle my own exceptions? My current approach rethrows most "severe" exceptions until they are handled by the presentation layer (usually they are logged and the user is informed that something went wrong). On the one hand I have the problem that I have again a shared package. On the other hand I am still not sure that this can be considered "best practice". Any ideas?
answer count: 2

http://stackoverflow.com/a/23398568
answers question: http://stackoverflow.com/q/23382970
type: Answer
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/23382970
has body: Use the filesubmit event in your ajax listener: &lt;rich:fileUpload fileUploadListener="#{fileUploadBean.listener}" id="upload" acceptedTypes="jpg, gif, png, bmp" ontyperejected="alert('Only JPG, GIF, PNG and BMP files are accepted');" maxFilesQuantity="5"&gt; &lt;a4j:ajax event="filesubmit" execute="@none" render="info" /&gt; &lt;/rich:fileUpload&gt; The filesubmit event is fired before the file is upload Reference: Richfaces HTML documentation
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/35768405
score: 0
comment on: http://stackoverflow.com/q/23354125
type: Comment
type: QuestionComment
has text: or "application/json" I suppose.

http://stackoverflow.com/comment/35664838
comment on: http://stackoverflow.com/q/23297786
type: QuestionComment
type: Comment
score: 0
has text: I hope this is prototype code, otherwise please seperate at least UI and file IO.

http://stackoverflow.com/q/23376229
upvote count: 3
has answer: http://stackoverflow.com/a/35267898
answer count: 1
downvote count: 0
favorite count: 0
tagged with: cobertura
type: UnansweredQuestion
score: 3
tagged with: java
tagged with: sap-ariba
type: Question
tagged with: test-coverage
has body: I am using Corbetura-2.0.3 with java 1.7 and I am trying to instrument the classes in our build system via command line. Stuck at instrumenting classes. Please assist. Here is the command: ./cobertura-instrument.sh --basedir /ariba/9r2_sourcing/roots-S49r2/install/classes/ariba.app.approvable.zip --destination /ariba/9r2_sourcing/Instrument -auxClasspath /ariba/9r2_sourcing/roots-S49r2/install/classes Wherein, /ariba/9r2_sourcing/roots-S49r2/install/classes/ariba.app.approvable.zip – zip containing classes which I would like to instrument /ariba/9r2_sourcing/Instrument – Folder to save instrumented classes /ariba/9r2_sourcing/roots-S49r2/install/classes – path where all other reference classes are present. Output: -bash-4.1$ ./cobertura-instrument.sh --basedir /ariba/9r2_sourcing/roots-S49r2/install/classes/ariba.app.approvable.zip --destination /ariba/9r2_sourcing/Instrument -auxClasspath /ariba/9r2_sourcing/roots-S49r2/install/classes Cobertura 2.0.3 - GNU GPL License (NO WARRANTY) - See COPYRIGHT file Apr 29, 2014 4:53:27 AM net.sourceforge.cobertura.coveragedata.CoverageDataFileHandler loadCoverageData INFO: Cobertura: Loaded information on 0 classes. Apr 29, 2014 4:53:27 AM net.sourceforge.cobertura.coveragedata.CoverageDataFileHandler saveCoverageData INFO: Cobertura: Saved information on 0 classes. Also tried with: archivesdepth parameter as well; it gives the same above error. I have updated the cobertura-instrument.sh file with the right versions of jars present in Cobertura installed location.
has title: Cobertura 2.0.3 - unable to instrument

http://stackoverflow.com/comment/35789334
type: AnswerComment
comment on: http://stackoverflow.com/a/23366160
type: Comment
has text: what will happen if url will something like this `http://mydomain.com/samsung?min_price=20&max_price=50`. I think your controller will not map it. Here all the parameters are optional. User can apply the the "brand" before "category" or can directly apply the "min_price" and "max_price" query parameters.
score: 0

http://stackoverflow.com/comment/47666675
type: Comment
comment on: http://stackoverflow.com/a/23416624
has text: I don't understand how the +1 can solve that. Moreover it looks like it will drastically increase the number of out of bound exception the way it's done. Let's say you got 10 servers, MIN_INT % 10 will give -8...+1 = -7. If think the real solution is to have a special handling of MIN_INT. But thx !
score: 0
type: AnswerComment

http://stackoverflow.com/q/23417821
score: 0
accepted answer: http://stackoverflow.com/a/23421779
type: AnsweredQuestion
tagged with: java
tagged with: gradle
type: Question
answer count: 1
has title: Gradle: How can I make one set of Java files target either Android and Oracle JVM?
tagged with: jvm
has answer: http://stackoverflow.com/a/23421779
has body: I have a chunk of Java code that is cross platform in the sense that it works on both the Oracle JVM and Android. I prefer to develop and run my unit tests on the Oracle JVM but need to test and run on Android as well. Thoughts or suggestions?

http://stackoverflow.com/comment/35942998
type: QuestionComment
has text: Well, yes. The problem here is that if you hold the space bar down continuously it does not prevent you from jumping an infinite number of times. You should only set `jumping` to false after you hit the ground. Otherwise every frame that happens while spacebar is down is going to cause you to jump.
comment on: http://stackoverflow.com/q/23446714
score: 0
type: Comment

http://stackoverflow.com/q/23349215
has answer: http://stackoverflow.com/a/23351201
score: 0
tagged with: memory-leaks
type: UnansweredQuestion
tagged with: multithreading
tagged with: garbage-collection
type: Question
has body: I'm trying to play a sound effect in my program using threads, I searched the web and as I understand when a thread reaches the end of the run function it will become free for the GC to collect. However when I call for the function many times one after another the task manager shows a high increase at memory usage and it never went back down, I waited for 2 minutes for the GC but there was no effect. Here is the code that I use for playing sound effect: public static void playSfx(final String path) { new Thread(new Runnable() { public void run() { try { AudioInputStream audioInputStream = AudioSystem.getAudioInputStream(new File(path)); final int BUFFER_SIZE = 128000; SourceDataLine sourceLine = null; AudioFormat audioFormat = audioInputStream.getFormat(); DataLine.Info info = new DataLine.Info(SourceDataLine.class, audioFormat); sourceLine = (SourceDataLine) AudioSystem.getLine(info); sourceLine.open(audioFormat); if (sourceLine == null) return; sourceLine.start(); int nBytesRead = 0; byte[] abData = new byte[BUFFER_SIZE]; while (nBytesRead != -1) { try { nBytesRead = audioInputStream.read(abData, 0, abData.length); } catch (IOException e) { e.printStackTrace(); } if (nBytesRead &gt;= 0) { sourceLine.write(abData, 0, nBytesRead); } } sourceLine.drain(); sourceLine.close(); audioInputStream.close(); } catch (IOException e) { e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); System.exit(1); } } }).start(); } What should I do to reclaim the lost memory?
tagged with: audio
has comment: http://stackoverflow.com/comment/35825022
tagged with: java
has title: Thread not releasing memory
answer count: 2
has answer: http://stackoverflow.com/a/23350766

http://stackoverflow.com/q/23430577
tagged with: jakarta-ee
tagged with: jsp
score: 0
has title: Again Neither BindingResult nor plain target object for bean name
has body: Hi I am getiing the above exception : java.lang.IllegalStateException: Neither BindingResult nor plain target object for bean name 'Projet' available as request attribute. Please find my jsp and controller class. The code I have is like below. Controller code: @Controller @RequestMapping(value="/directeur") public class AdminController { @Autowired private IAdmin directeur; @RequestMapping(value="/index") public String index(Model model) { model.addAttribute("Projet",new Projet()); model.addAttribute("Projets",directeur.getAllProjet()); return "Projets"; } @RequestMapping(value="/saveProjet",method = RequestMethod.POST) public String saveProjet(Projet p,BindingResult result,Model model) throws IOException { if(result.hasErrors()) { model.addAttribute("Projets",directeur.getAllProjet()); return "Projets"; } directeur.ajouterProjet(p); model.addAttribute("Projet",new Projet()); model.addAttribute("Projets",directeur.getAllProjet()); return "Projets"; } } Jsp Code: <%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> <%@taglib uri="http://www.springframework.org/tags/form" prefix="f"%> <f:form modelAttribute="Projet" action="saveProjet" method="POST" enctype="multipart/form-data"> ID Projet <f:input path="idProjet" /> <f:errors path="idProjet" cssClass="errors"/> Nom <f:textarea path="nomProjet" /> <f:errors path="nomProjet" cssClass="errors"/> Description du Projet <f:textarea path="description" /> <f:errors path="description" cssClass="errors"/> </f:form> ID Nom Description Photo <c:forEach items="${Projets }" var="proj"> ${proj.idProjet } ${proj.nomProjet } ${proj.description } </c:forEach>
answer count: 0
type: UnansweredQuestion
tagged with: spring
has comment: http://stackoverflow.com/comment/35909606
has comment: http://stackoverflow.com/comment/35909218
tagged with: java
type: Question

http://stackoverflow.com/a/23379110
upvote count: 2
has body: The MovingSignPanel class needs an actionPerformed(java.awt.event.ActionEvent) method. For example: void actionPerformed(java.awt.event.ActionEvent ev) { // your code } You need to do this because your class says it's implementing the ActionListener interface, and actionPerformed() is part of that interface.
downvote count: 0
answers question: http://stackoverflow.com/q/23379081
type: Answer
score: 2

http://stackoverflow.com/comment/59698750
type: AnswerComment
has text: I'm having an issue with this, where I download a file into the directory, but I need it to do the action AFTER the download is complete. Is there any way to do that?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/31072948

http://stackoverflow.com/comment/35925948
type: AnswerComment
has text: So the string returned by the interceptor is of no use after the action class has been called?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23439297

http://stackoverflow.com/a/23350558
score: 0
type: Answer
has body: That's because AWT and Swing are rendered in a different manner. It's not recommended mixing both AWT and Swing components. You can learn more about it here: http://www.comp.nus.edu.sg/~cs3283/ftp/Java/swingConnect/archive/tech_topics_arch/mixing/mixing.html Swing and AWT Mixing is bad, but still done, why? mixing awt and swing in GUI programming using Java
answers question: http://stackoverflow.com/q/23350264

http://stackoverflow.com/q/23411921
has title: JAMA is not calculating the right eigen vectors
upvote count: 1
has answer: http://stackoverflow.com/a/23412592
answer count: 1
tagged with: java
has body: I have the following matrix, which is symmetric and real (It is a hamilton-operator): (Matlab friendly) [63.000000, -1.732051, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000; -1.732051, 61.000000, -2.000000, 0.000000, -1.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000; 0.000000, -2.000000, 61.000000, -1.732051, 0.000000, -1.414214, 0.000000, 0.000000, 0.000000, 0.000000; 0.000000, 0.000000, -1.732051, 63.000000, 0.000000, 0.000000, -1.732051, 0.000000, 0.000000, 0.000000; 0.000000, -1.000000, 0.000000, 0.000000, 61.000000, -1.414214, 0.000000, 0.000000, 0.000000, 0.000000; 0.000000, 0.000000, -1.414214, 0.000000, -1.414214, 60.000000, -1.414214, -1.414214, 0.000000, 0.000000; 0.000000, 0.000000, 0.000000, -1.732051, 0.000000, -1.414214, 61.000000, 0.000000, -2.000000, 0.000000; 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, -1.414214, 0.000000, 61.000000, -1.000000, 0.000000; 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, -2.000000, -1.000000, 61.000000, -1.732051; 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, -1.732051, 63.000000] If i make a JAMA-matrix with these values, and execute the eigenvalue decomposition, V*D*transpose(V) does NOT equal the hamilton. Do any of you guys know what goes wrong? The eigenvalues are consistent with MATLAB, but the eigenvectors are not. Here is a class to test it public class TestJama { public static void main(String[] args) { double[][] m = new double[][] { {63.000000, -1.732051, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000}, { -1.732051, 61.000000, -2.000000, 0.000000, -1.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000}, { 0.000000, -2.000000, 61.000000, -1.732051, 0.000000, -1.414214, 0.000000, 0.000000, 0.000000, 0.000000}, { 0.000000, 0.000000, -1.732051, 63.000000, 0.000000, 0.000000, -1.732051, 0.000000, 0.000000, 0.000000}, { 0.000000, -1.000000, 0.000000, 0.000000, 61.000000, -1.414214, 0.…
tagged with: jama
has comment: http://stackoverflow.com/comment/35882068
has comment: http://stackoverflow.com/comment/35893946
downvote count: 0
type: UnansweredQuestion
score: 1
favorite count: 0
type: Question

http://stackoverflow.com/comment/71362130
has text: @WindRider, you can use minSdkVersion 15 and above. Currently I'm using minSdkVersion 17 in my Android project with Lambdas and everything is working.
type: AnswerComment
comment on: http://stackoverflow.com/a/35907821
type: Comment
score: 1

http://stackoverflow.com/a/23435129
answers question: http://stackoverflow.com/q/23408521
has comment: http://stackoverflow.com/comment/39205697
has body: One of the most important differences between DevMode and Super DevMode is the environment that executes your code. JVM executes your GWT module in DevMode so the IDE can debug it like an usual Java application. The bad news about Super DevMode is that Chrome executes your GWT module, so the IDE does not know about breakpoints that you set in Chrome Dev Tools. If your breakpoints in Chrome Dev Tools don't work properly, I think this is a bug that should be reported.
type: Answer
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/39377984
has comment: http://stackoverflow.com/comment/36596561
downvote count: 0

http://stackoverflow.com/comment/35915666
type: QuestionComment
has text: The problem likely lies somewhere else in your code. What you have here should result in each `Club` instance having its own `personArray` instance.
comment on: http://stackoverflow.com/q/23433962
score: 0
type: Comment

http://stackoverflow.com/comment/35871762
has text: where/how are you adding checkbox column on list grid?
comment on: http://stackoverflow.com/a/23401777
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/23430495
type: AnsweredQuestion
tagged with: sql
tagged with: ibatis
type: Question
accepted answer: http://stackoverflow.com/a/23441855
score: 0
answer count: 1
tagged with: java
has answer: http://stackoverflow.com/a/23441855
has title: ibatis LazyQueryContainer - how to create QueryDefinition for a SQL?
has body: I have a set of classes that can generate SQL code for me. I would like to use a generated SQL to implement the Query interface found in ibatis. I'm trying to create a special Query component that caches all results in memory. I'm having trouble writing this method: public void loadAllItems() { String sql = buildSQL(); List&lt;Map&lt;String, Object&gt;&gt; query = DB.rows(sql, new RowBounds(0, maxRows+1)); this.rows = new ArrayList&lt;Item&gt;(); for (Map&lt;String,Object&gt; row : query) { Item item = new PropertysetItem(); // How can I create a QueryDefinition for my query??? Collection&lt;Object&gt; propertyIds = definition.getPropertyIds(); for (Object propertyId : propertyIds) { Object value = row.get(propertyId); if (value!=null) { item.addItemProperty(propertyId, new ObjectProperty(value)); } } this.rows.add(item); } } Here, the DB.rows method returns a List of rows. For each row, column names are mapped to column values. I have the rows and values for all columns. The only problem is that I cannot put results into a list of Item instances. I don't know how to create a QueryDefinition instance for an arbitrary SQL. I know that there is an SQL builder ( http://mybatis.github.io/mybatis-3/statement-builders.html ) but I DO NOT want to use it. I want to use a plain SQL that was already generated, and put the results into a list of Item instances. How do I do that? What kind of properties do I need to assign before I could use these items to implement the Query interface of ibatis?

http://stackoverflow.com/comment/35887112
type: QuestionComment
has text: @user1587985 "var cannot be resolved to a type"
comment on: http://stackoverflow.com/q/23418387
score: 0
type: Comment

http://stackoverflow.com/comment/35916865
comment on: http://stackoverflow.com/q/23414314
has text: @DuncanKinnear Thank you. I just commented out `@AttributeOverrides`, but I am still getting the same stack trace when I try to recompile the app. Can you suggest anything else?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23313610
has comment: http://stackoverflow.com/comment/35693333
score: 2
has comment: http://stackoverflow.com/comment/35693458
has body: You are probably trying to ask how to store and handle currencies. Short answers are: use the BigDecimal type or create your own currency implementation with separate integer fields for the Euros and Cents (or Dollars if ou prefer :) ). Already explained: Using BigDecimal to work with currencies Why not use Double or Float to represent currency?
downvote count: 0
answers question: http://stackoverflow.com/q/23313411
type: Answer
upvote count: 2

http://stackoverflow.com/a/23351979
has body: The JSON you show has a field states. That field holds an array which you show as holding two different types of objects. One has a field SPAWNINGPHASE, the other a field ALIVEPHASE. Each of those hold an array that contains another type of object. This poses a problem for automatic deserailization to a POJO. The only way that could possibly work is if your State class had fields for every "Phase" (This is assuming you have a Java class named NameAndDuration that you can map those inner objects to). class State { List&lt;NameAndDuration&gt; SPAWNINGPHASE; List&lt;NameAndDuration&gt; ALIVEPHASE; ... } Provided you mean that your Group class represents the JSON object, it would have: List&lt;State&gt; states; Gson silently ignores any missing fields in the JSON, so what you'd end up with is a List of your State objects, with only one of those fields set and all the others null. As-is you would need to have: public List&lt;Map&lt;String, List&lt;NameAndDuration&gt;&gt;&gt; states; A JSON object is inherently a key/value map and since those objects inside the arrays are of a common type, that would work. You'd have a List containing Maps that each had one entry, the "phase" as the key and a list of those inner objects. Not exactly ideal, but it would work. Option B and something that makes a little more sense is changing that JSON so the "phase" is a value: { "states": [ { "phase": "SPAWNINGPHASE", "values": [ { "name": "STATEA", "duration": 4 }, { "name": "STATEB", "duration": 4 } ] } ] } And change your State class accordingly: class State { String phase; List&lt;NameAndDuration&gt; values; } (Note you could also use an enum for phase here) Now List&lt;State&gt; states; becomes a bit more usable. (Although it does seem a bit of a misnomer; it seems like you really have a list of "phases" that contain state info rather than a list of "states")
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35764641
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/23351595
score: 1
accepted answer of: http://stackoverflow.com/q/23351595
downvote count: 0

http://stackoverflow.com/comment/35773775
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23357498
type: AnswerComment
has text: @chopu - consider Ankur's answer. Its correct. You might be reading only one line or you might replacing the string instead of appending.

http://stackoverflow.com/a/23422248
answers question: http://stackoverflow.com/q/23421967
type: Answer
score: 0
has body: Hey check out the java documentation here I think this may be what you are looking for? http://docs.oracle.com/javase/tutorial/essential/io/objectstreams.html

http://stackoverflow.com/comment/35717929
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23327033
has text: From your code, it seems the field `normalizedPower` ins't actually initialized until you call the `normalizedPower()` method.

http://stackoverflow.com/comment/35818715
comment on: http://stackoverflow.com/a/23381545
type: AnswerComment
score: 0
type: Comment
has text: I've been hesitant to try this only because there are so many object factories per service, 9 of them in the service I checked. So that's over 100 Object Factories to merge. Not theoretically difficult, but I'm worried about making a mistake since I'm still new to CXF and these types of services in general.

http://stackoverflow.com/a/23315932
score: 0
type: Answer
has body: try this, public class Main { public static void main(String[] args) throws URISyntaxException { java.net.URL dirURL = ClassLoader.getSystemResource("resources"); File[] filePaths = new File(dirURL.toURI()).listFiles(); for (File file : filePaths) { if (file.isFile()) { System.out.println(file); } } } }
answers question: http://stackoverflow.com/q/23315389

http://stackoverflow.com/comment/36192252
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23571519
has text: Nice one, some awesome stuff in here but this being so compact is my ideal answer. Thanks :)
score: 0

http://stackoverflow.com/comment/36231848
type: Comment
has text: I have to agree with @Jason. This solution is short because the code grows to the right and hides the length of each line. It is neither readable nor is it smart. To repeat the whole computation leads to a theoretical endless loop which is not even a solution in the sense of computer science, in my opinion.
type: AnswerComment
comment on: http://stackoverflow.com/a/23571519
score: 0

http://stackoverflow.com/comment/35798794
comment on: http://stackoverflow.com/q/23370978
type: Comment
type: QuestionComment
has text: @ThaBomb - I know I can't multiply them, that's why I needed to know what to do to change that. like Pradeep ^ said, I need to change my String with an Integer.parseIntr()
score: 0

apache-commons-cli
tags question: http://stackoverflow.com/q/23361982
tag name: apache-commons-cli
type: Tag

http://stackoverflow.com/a/23335492
has comment: http://stackoverflow.com/comment/35733206
has comment: http://stackoverflow.com/comment/35757981
upvote count: 5
has comment: http://stackoverflow.com/comment/35772621
type: Answer
downvote count: 0
has body: See docs section Reusing the score calculation outside the Solver. That provide all the data you need in a simple way. for (ConstraintMatchTotal constraintMatchTotal : guiScoreDirector.getConstraintMatchTotals()) { String constraintName = constraintMatchTotal.getConstraintName(); Number weightTotal = constraintMatchTotal.getWeightTotalAsNumber(); for (ConstraintMatch constraintMatch : constraintMatchTotal.getConstraintMatchSet()) { List&lt;Object&gt; justificationList = constraintMatch.getJustificationList(); Number weight = constraintMatch.getWeightAsNumber(); ... } } See Laune's answer for more advanced drools specific techniques/tricks.
has comment: http://stackoverflow.com/comment/35779744
accepted answer of: http://stackoverflow.com/q/23327662
score: 5
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23327662

http://stackoverflow.com/comment/35937112
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23441650
has text: I think problem is with your java-code
score: 0

http://stackoverflow.com/q/23430466
has answer: http://stackoverflow.com/a/23436235
upvote count: 2
tagged with: python
possible better answer: http://stackoverflow.com/a/36857669
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/36857669
has title: JPype class not found
tagged with: java
tagged with: jpype
accepted answer: http://stackoverflow.com/a/23436235
type: Question
has answer: http://stackoverflow.com/a/77069878
answer count: 3
has body: JPype is an amazing project since I allows to instantiate a JVM directly from Python. Unfortunately, I got stuck in the first baby steps. I have A.java source code (located in C:\tmp folder): class A { public A() { super(); } public String sayHi() { return("Hello"); } } Which was compiled to a class, using: javac A.java Thus, A.class is located in C:\tmp folder. I have the following Python source code: import os import jpype jpype.startJVM(jpype.getDefaultJVMPath(), '-ea', '-Djava.class.path=c:\\tmp') A = jpype.JClass("A") a = A() print a.sayHi() jpype.shutdownJVM() When I run it, I get the error below: C:\tmp&gt;jpype_test.py Traceback (most recent call last): File "C:\tmp\jpype_test.py", line 10, in &lt;module&gt; A = jpype.JClass("A") File "C:\Python27\lib\site-packages\jpype\_jclass.py", line 54, in JClass raise _RUNTIMEEXCEPTION.PYEXC("Class %s not found" % name) jpype._jexception.ExceptionPyRaisable: java.lang.Exception: Class A not found Since I can't find the A class, it is probably an issue related to CLASSPATH, but I can't realize what I am doing wrong. Any clues? EDIT 1: The problem persists. But, just to add to my question, if I use native java libraries, like: java.util, the code runs WITHOUT errors. For example, the code below works: import jpype jpype.startJVM(jpype.getDefaultJVMPath()) util = jpype.JPackage("java.util") al = util.ArrayList() al.add(1) al.add(2) print al.size() jpype.shutdownJVM() And returns 2. EDIT 2: Issue solved, see answer below...
downvote count: 0
tagged with: jvm
favorite count: 0

http://stackoverflow.com/a/23321416
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35771651
downvote count: 0
type: Answer
has body: Spring 4 provides very good support for Java 8 version. It means that they have good support for Java 7 too. If you are planning to use Spring 4 with Java 7 or 8, there should not be any issues. It will be perfectly matching. However, Spring 4 has upgraded their framework API compatible with Java 8 code which has lot of improvements in the language like Lambdas, etc. It is always backwards compatible and you need not worry anything since more than. 90% of the project will be using Java 6 or 7 for the next couple of years. My advice is that, if you could start your project with Java 8, that is good for the future since migrating later will have more changes with syntax of the new Apis. Also this is the information provided by Spring team about the Java 8 support on Spring: Java 8 is a perfect fit for Spring's programming model. We believe that the combination is very attractive, with Java 8 offering elegant language features and library improvements for immediate use with typical Spring APIs. In fact, Spring Framework 4.0 is the first fully Java 8 enabled application framework in the industry. We went the extra mile to provide everything that is necessary to start developing Spring applications on Java 8 today, even before the production launch of Java 8 in March. also I have found useful details in the spring documentation http://docs.spring.io/spring/docs/current/spring-framework-reference/html/new-in-4.0.html. They have clearly mentioned as However, for newly started development projects based on Spring 4, we recommend the use of Java 7 or 8. Note that minimum supported Java version for Spring 4 is raised to Java 6. Hope this answer helps you.
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/23321117
accepted answer of: http://stackoverflow.com/q/23321117
has comment: http://stackoverflow.com/comment/117796132

http://stackoverflow.com/comment/35663170
type: Comment
type: QuestionComment
has text: debug key should work just fine, have you followed the steps in details, slight changes was made to the steps, have you included play google_play_services_version in your manifest.xml ?
comment on: http://stackoverflow.com/q/23296770
score: 0

http://stackoverflow.com/a/23466442
has comment: http://stackoverflow.com/comment/35984706
score: 3
has comment: http://stackoverflow.com/comment/129146198
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/46466692
answers question: http://stackoverflow.com/q/23427343
has comment: http://stackoverflow.com/comment/35976427
type: Answer
has comment: http://stackoverflow.com/comment/35978913
accepted answer of: http://stackoverflow.com/q/23427343
has body: It seems this is a limitation of Windows when it comes to accounts that are also in the local administration group. I read the following here: Known Issues If an AD account is also added into local administrator group on the client PC, Microsoft restricts such client from getting the session key for tickets (even if you set the allowtgtsessionkey registry key to 1). The workaround is: Just forget you're a logged in user, call kinit.exe. Do not depends on LSA credential cache. In a recent hotfix ([35]http://support.microsoft.com/kb/942219/en-us, should be included in Vista SP1), this restriction is lifted for normal service tickets. However, it still applies to TGT. Since Java uses TGT to acquire tickets for other services (the standard Kerberos process), this update provides no benefit to JGSS programming on Windows. Furthermore, even if the implementation of Java is changed to read service tickets from the LSA cache, it still cannot perform delegation, since a TGT is always needed in that case.
has comment: http://stackoverflow.com/comment/36001553
has comment: http://stackoverflow.com/comment/54737178
upvote count: 3

http://stackoverflow.com/a/54798689
answers question: http://stackoverflow.com/q/23442440
score: 0
type: Answer
has body: This very same exception is also thrown by jersey-media-moxy for silly mistakes like using an @XmlAttribute annotation where you really need an @XmlElement. This was the case in my scenario, and this is something to look into especially if the problem only happens for certain classes but others work fine.

http://stackoverflow.com/q/23318933
upvote count: 1
downvote count: 1
has title: Java: show compiler phases like `scalac -Xprint:parser`
tagged with: java
has body: javac -Xprint only shows the class's API. i can write a scala program, compile it with scalac -Xprint:&lt;phase&gt;, and print out the tree with whatever processing has done at any phase. i want something that can emit the representation at each of the fundamental stages of java compilation: $ javac -Xshow-phases phase name description ---------- ----------- parser parse source into ASTs, perform simple desugaring namer resolve names, attach symbols to named trees packageobjects load package objects typer the meat and potatoes: type the trees superaccessors add super accessors in traits and nested classes refchecks reference/override checking, translate nested objects erasure erase types flatten eliminate inner classes jvm generate JVM bytecode does such an option or tool exist? how could we do this in java?
type: Question
favorite count: 0
has comment: http://stackoverflow.com/comment/35761476
score: 0
has comment: http://stackoverflow.com/comment/35712470
answer count: 0
has comment: http://stackoverflow.com/comment/35761216
tagged with: scala
type: UnansweredQuestion

http://stackoverflow.com/a/23381401
upvote count: 11
has comment: http://stackoverflow.com/comment/35817667
has body: When you create a Document object like this: Document document = new Document(); You tell iText to create a document with pages of the A4 format using Portrait orientation. You can add a Rectangle object as a parameter of the Document constructor to create documents with pages in any size you want. You can also use the PageSize class to use a predefined format. For instance: if you want to use an A4 page in landscape, you'd use this: Document document = new Document(PageSize.A4.rotate()); Please download the free eBook "The ABC of PDF" for more info.
answers question: http://stackoverflow.com/q/23381148
has comment: http://stackoverflow.com/comment/35817854
downvote count: 0
type: Answer
score: 11

http://stackoverflow.com/comment/35766795
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23353513
has text: @theGreenCabbage That's right. The lowest implementation in the inheritance hierarchy will be invoked. (I assume here `Dodecahedron` is really high in the hierarchy.)
type: Comment

http://stackoverflow.com/comment/35732870
type: QuestionComment
comment on: http://stackoverflow.com/q/23334543
score: 0
type: Comment
has text: in php I would use curl requests to scrape page, I don't know what would be the analogue for java. Check also if [this tool](http://htmlunit.sourceforge.net/) works for you

http://stackoverflow.com/q/23351515
has title: equals on objects that contain different types of collections
has comment: http://stackoverflow.com/comment/35763342
has answer: http://stackoverflow.com/a/23351609
score: 0
type: UnansweredQuestion
tagged with: collections
type: Question
has comment: http://stackoverflow.com/comment/35763379
linked to: http://stackoverflow.com/q/27581
tagged with: java
has comment: http://stackoverflow.com/comment/35763159
answer count: 2
has answer: http://stackoverflow.com/a/23351676
has body: I have an object that looks like this (I've using a bit of the Guava library in order to simply my equals and hashcode methods): public class MyClass { private Collection&lt;Integer&gt; integers; private Collection&lt;String&gt; strings; // Getters and Setters... @Override public boolean equals(Object o) { if (o == this) { return true; } if (o == null || getClass() != o.getClass()) { return false; } MyClass that = (MyClass) o; return Objects.equal(integers, that.integers) &amp;&amp; Objects.equal(strings, that.strings); } @Override public int hashCode() { return Objects.hashCode(integers, strings); } } The issue I'm running into is with code that essentially does this (this would be a typical test case): // Produce a new instance of MyClass that users ArrayLists. MyClass expected = new MyClass(); expected.setIntegers(Arrays.asList(1, 2, 3)); expected.setStrings(Arrays.asList("a", "b")); // I don't normally construct the actual object here, // but I've included the code so you get an understanding of what's happening // Produce a new instance of MyClass that uses HashSets. Set&lt;Integer&gt; someNumbers = new HashSet&lt;Integer&gt;(); someNumbers.add(1); someNumbers.add(2); someNumbers.add(3); Set&lt;String&gt; someStrings = new HashSet&lt;String&gt;(); someStrings.add("a"); someStrings.add("b"); MyClass actual = new MyClass(); actual.setIntegers(someNumbers); actual.setIntegers(someStrings); assertEquals(expected, actual); The problem I'm running into is that even though the contents of the collections are all the same and the compile-time type of those members is "Collection", the run-time types are used to evaluate equality so this assertion fails. Looking at the source code for AbstractSet.equals and AbstractList.equals, they check to see if the other object is a Set or a List, respectively, before they evaluate the contents. I suppose that makes some sense because order matters in a list and doesn't in a set, so, even if the contents are the same, you can't comp…

http://stackoverflow.com/comment/35706865
score: 0
type: AnswerComment
type: Comment
has text: Why the logcat is showing InvocationTargetException. What is this error exactly??
comment on: http://stackoverflow.com/a/23307719

http://stackoverflow.com/comment/35721117
comment on: http://stackoverflow.com/q/23328719
type: Comment
type: QuestionComment
score: 0
has text: @Braj I have not tried anything. I currently have my program storing everything as columns which is not good considering that Excel only supports up to 16,000 columns.

http://stackoverflow.com/comment/35825977
type: Comment
type: QuestionComment
has text: @a_horse_with_no_: that should be an answer
comment on: http://stackoverflow.com/q/23386116
score: 0

http://stackoverflow.com/q/23394407
tagged with: java
has comment: http://stackoverflow.com/comment/35841605
tagged with: aop
has comment: http://stackoverflow.com/comment/35841791
type: Question
score: 0
has comment: http://stackoverflow.com/comment/35841790
answer count: 2
has answer: http://stackoverflow.com/a/23395128
has body: Spring AOP depends on proxy mechanism - J2SE dynamic proxies or using CGLIB(according to the spring documentation). Is it possible to use the AOP mechanism defined by Spring without creating/declaring the beans in the spring application context? If its not possible with Spring - is AspectJ's Load time Weaving(LTW) or Compile Time Weaving (CTW) would help resolve the issue? Requirement : Trying to implement logging and transaction management for a old project of mine without declaring the POJO's as spring beans.
has title: Is it possible to use Spring AOP without creating beans?
tagged with: spring-aop
linked to: http://stackoverflow.com/q/19068725
has comment: http://stackoverflow.com/comment/35841825
tagged with: spring
has comment: http://stackoverflow.com/comment/35843081
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35842021
has answer: http://stackoverflow.com/a/23394440

http://stackoverflow.com/comment/35747237
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23343232
has text: That's odd. As soon as I install an Oracle JDK, it becomes the default on my system. What does `/usr/libexec/java_home -V` reveal?
score: 0

http://stackoverflow.com/a/23298259
type: Answer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/35665370
has body: It prevents you from making unintentional error in your code. Rule of thumb here is to make each field and each function argument you know you shouldn't change (I mean reference, you still can change value) in your code as final. So basically its a mean to prevent programmer from shooting their foot. Nothing more.
answers question: http://stackoverflow.com/q/23298147
has comment: http://stackoverflow.com/comment/35665430
upvote count: 1

http://stackoverflow.com/a/23314747
upvote count: 1
has comment: http://stackoverflow.com/comment/35695420
score: 1
has comment: http://stackoverflow.com/comment/35695454
answers question: http://stackoverflow.com/q/23314692
has body: If your file is so regularly formatted, all you need is a simple list of character patterns representing each part of your string: ^\d\d-\d\d-\d\d\d\d ;\d\d-\d\d-\d\d\d\d ;SUMMARY ;\d+[.]\d+ ;\d+[.]\d+ ;\d+[.]\d+ ;\d+[.]\d+$ Of course you need to escape the slashes to put this expression in a Java string. The documentation for the Pattern class provides a great cheat-sheet of the pattern elements. \d matches a single digit; \d+ matches one or more digits.
downvote count: 0
type: Answer

http://stackoverflow.com/comment/35932793
score: 1
type: AnswerComment
has text: yes there is no issue but opposite is not true. Try it yourself.
type: Comment
comment on: http://stackoverflow.com/a/23443080

http://stackoverflow.com/a/23337066
type: Answer
has body: so here is your solution when the user successfully logged in set the shared preferences in your login class class like this //declare pref editor SharedPreferences prefs; SharedPreferences.Editor prefsEditor; prefs = PreferenceManager.getDefaultSharedPreferences(this); prefsEditor = prefs.edit(); //paste below peace of code when the loginwill be success prefsEditor.putString("remember", "yes"); prefsEditor.commit(); //now in your first activity you just check the shared pref value to know the user is logged in or not SharedPreferences prefs; String Log; prefs = PreferenceManager.getDefaultSharedPreferences(this); Log=prefs.getString("remember", ""); //now check the value of shared pref and apply the condition like this Intent intent ; if(register.equalsIgnoreCase("yes")) { intent = new Intent(this, Home.class); startActivity(intent); finish(); } else { intent = new Intent(this, Login.class); startActivity(intent); finish(); }
score: 0
answers question: http://stackoverflow.com/q/23336712

http://stackoverflow.com/comment/35814321
score: 2
type: Comment
comment on: http://stackoverflow.com/a/23376095
has text: The `XYChartBuilder` (like most of the builders) is deprecated, and probably should not be used. You can easily create an array or `List` of `XYChart.Data` values and set them en masse anyway.
type: AnswerComment

http://stackoverflow.com/comment/35658546
has text: Is it actually entering the `if` block?
score: 2
comment on: http://stackoverflow.com/q/23294733
type: Comment
type: QuestionComment

inner-classes
tags question: http://stackoverflow.com/q/23384811
tags question: http://stackoverflow.com/q/23428622
type: Tag
tags question: http://stackoverflow.com/q/23429937
tag name: inner-classes

http://stackoverflow.com/comment/35838719
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23367997
type: AnswerComment
has text: At column 6 there is a String object, not a Boolean.

http://stackoverflow.com/comment/139966570
score: 0
type: Comment
has text: This post gave me hope but unfortunately it doesn't work. The print statements in this minimal example will keep coming. https://pastebin.com/4jwvDgjg
comment on: http://stackoverflow.com/a/23346089
type: AnswerComment

http://stackoverflow.com/comment/35694599
comment on: http://stackoverflow.com/a/23314418
type: Comment
has text: Ok, I understand that, but why in tests that is possible? Is it because a test is an object managed by Spring?
type: AnswerComment
score: 0

http://stackoverflow.com/a/23320400
type: Answer
downvote count: 1
score: 1
has body: Have a look at the Desktop#browse(). Look at other method also Desktop#open() Explore other method also.
upvote count: 2
answers question: http://stackoverflow.com/q/23320368

http://stackoverflow.com/comment/35995795
type: Comment
has text: Then you answered your own questioh
comment on: http://stackoverflow.com/a/23476251
score: 0
type: AnswerComment

http://stackoverflow.com/comment/35816543
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23380715
has text: could you explain more,i can't understand

http://stackoverflow.com/comment/35868087
has text: Are you aware of OSGi?
type: QuestionComment
comment on: http://stackoverflow.com/q/23408556
type: Comment
score: 2

http://stackoverflow.com/q/23409797
tagged with: java
has body: Why do you need to implement this empty interface to serialize an object? Why if you have to do it, the methods to serialize in a file ask for an Object instead of a Serializable? ObjectOutputStream.writeObject(Object obj) How it works?
type: Question
has title: Serializable class Why? and How? in Java
answer count: 2
has answer: http://stackoverflow.com/a/23410393
favorite count: 0
score: 0
tagged with: serialization
upvote count: 2
type: UnansweredQuestion
downvote count: 2
has answer: http://stackoverflow.com/a/23410227
has comment: http://stackoverflow.com/comment/35870638
has comment: http://stackoverflow.com/comment/35870588

http://stackoverflow.com/a/23448322
has comment: http://stackoverflow.com/comment/35942930
accepted answer of: http://stackoverflow.com/q/23448295
upvote count: 2
has comment: http://stackoverflow.com/comment/35944549
answers question: http://stackoverflow.com/q/23448295
has body: When you pass the variable selection into displayMenu the original variable does not change. The variable that is changed inside that method is a copy. Anything you do inside that method has absolutely no effect on the original selection Therefore selection has not been initialized as is correctly pointed out by the compiler You need to redesign the displayMenu to return a value which will be assigned to selection. No input to that method is needed On another note, you probably want to add break after each System.out.println inside the case statements. If you don't the control will fall through to each next case.
score: 2
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/q/23304243
tagged with: stack
tagged with: java
has body: The problem I'm getting comes when cloning and changing a stack. It doesn't matter if I do it with ArrayADT or LinkedADT. The original exercise statement says I must implement some code that is able to clone a given stack and in the original stack, the "oldElem" is susbstituted by the "newElem". My original idea was to take and Aux Stack so I can simply copy &amp; replace the elemtents of the original one (due to the inversion of order according to the Stack inversed order) and that one copy again into a second Stack and so I could get the original stack in the same order and with the elements changed. This is the code that I've wrote: public &lt;T&gt; BoundedStackADT&lt;T&gt; cloneAndReplaceWith( BoundedStackADT&lt;T&gt; sourceStack, T oldElem, T newElem) { BoundedStackADT&lt;T&gt; pila = new BoundedStackADTArrayImpl&lt;T&gt;(sourceStack.size()); BoundedStackADT&lt;T&gt; pilaAux = new BoundedStackADTArrayImpl&lt;T&gt;(sourceStack.size()); T result = null; T result2 = null; for (int r=0; r&lt;sourceStack.size();) //I'm pretty sure the problem is here { try { result = sourceStack.pop(); } catch (EmptyCollectionException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } if (result.equals(oldElem)) result = newElem; pilaAux.push(result); r++; } for (int i = 0; i &lt; sourceStack.size();) { try { result2 = pilaAux.pop(); pila.push(result2); i++; } catch (EmptyCollectionException e) { // TODO Auto-generated catch block e.printStackTrace(); } } return pila; } } I know T result2 is not necessary. My problem is that doing the JUnit tests the returned Stack (pila) which is supposed to be the sime size as the original stack (sourceStack) is never bigger than 2. How could I solve it? Big thanks to everybody.
type: Question
has comment: http://stackoverflow.com/comment/35678076
score: 0
has title: Java stack cloning and changing
has comment: http://stackoverflow.com/comment/35677957
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35677257

http://stackoverflow.com/comment/35752602
has text: Colors don't have names.
score: 3
type: QuestionComment
comment on: http://stackoverflow.com/q/23346208
type: Comment

http://stackoverflow.com/comment/35937010
has text: How do i prevent it from using the same transaction if its alredy existing?Using propagation=Propagation.REQUIRED??
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23445298
score: 0

http://stackoverflow.com/a/23421405
has comment: http://stackoverflow.com/comment/35892919
score: 5
upvote count: 5
has comment: http://stackoverflow.com/comment/35892690
has comment: http://stackoverflow.com/comment/35892650
has body: Use substring(). String str = "This is a very long string which needs to be broken"; int begin=0; int end=str.length(); int lengthToWrap = 30; while (str.length() &gt; lengthToWrap) { System.out.println(str.substring(begin,begin+lengthToWrap)); str=str.substring(begin+lengthToWrap,end); end=end-lengthToWrap; } System.out.println(str.substring(begin,end));
downvote count: 0
has comment: http://stackoverflow.com/comment/35893089
has comment: http://stackoverflow.com/comment/35892966
type: Answer
answers question: http://stackoverflow.com/q/23421306

onclicklistener
tag name: onclicklistener
tags question: http://stackoverflow.com/q/23292362
tags question: http://stackoverflow.com/q/23375760
type: Tag
tags question: http://stackoverflow.com/q/23369600

http://stackoverflow.com/comment/35862436
comment on: http://stackoverflow.com/q/23405399
score: 0
has text: I have Many other method on it
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/35888918
type: QuestionComment
has text: so what is broken? Help us to help you.
comment on: http://stackoverflow.com/q/23419374
score: 1
type: Comment

http://stackoverflow.com/comment/35814827
type: Comment
has text: This will not work If the word will be the first word in the sentence
comment on: http://stackoverflow.com/a/23379626
score: 0
type: AnswerComment

http://stackoverflow.com/q/23379835
has comment: http://stackoverflow.com/comment/35815594
has answer: http://stackoverflow.com/a/23380856
has comment: http://stackoverflow.com/comment/35815637
type: Question
has body: There is web project with lost &lt;%=%&gt; in it, which are not XSS safe! Is there any approach which can be used to fix them all? If you have jsp web projects with lots of %{} you can change the EL resolver functionality to override the default ELResolver and make ${} XSS safe. Please see https://github.com/pukkaone/webappenhance Is there a same way for &lt;%=&gt; ?! Can we override the functionality of &lt;%=%&gt; the same way as ${} ?? I see some guides at Java 5 HTML escaping To Prevent XSS.
linked to: http://stackoverflow.com/q/17339439
tagged with: xss
score: 0
answer count: 1
tagged with: jsp
has comment: http://stackoverflow.com/comment/35815978
linked to: http://stackoverflow.com/q/2333586
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/3177733
has title: Overriding default <%=%> in JSP to prevent XSS Hack
has comment: http://stackoverflow.com/comment/35815766
has comment: http://stackoverflow.com/comment/35815541
has comment: http://stackoverflow.com/comment/35815450
tagged with: java

http://stackoverflow.com/q/23345048
upvote count: 1
has body: If I save a Bitmap called "picture.jpg" in internal storage and some steps later I save another Bitmap called "picture.jpg" too, what happens then? Does the second Bitmap overwrite the first or are there two Bitmaps with the same name then?
has comment: http://stackoverflow.com/comment/35751690
tagged with: bitmap
accepted answer: http://stackoverflow.com/a/23345350
type: Question
linked to: http://stackoverflow.com/q/37791853
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: internal-storage
tagged with: image
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/111615635
has title: Android: Save two Bitmaps with same name in internal storage
favorite count: 0
has answer: http://stackoverflow.com/a/23345350
tagged with: android
has comment: http://stackoverflow.com/comment/35750436
has comment: http://stackoverflow.com/comment/35751594

http://stackoverflow.com/comment/35839794
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23392408
has text: @njzk2 I'm not sure what you mean
score: 0

http://stackoverflow.com/comment/35894607
comment on: http://stackoverflow.com/q/23422300
has text: But unless your proxy is written to hide such information then it would still remain. There are other uses for proxy servers other than just to hide your ip address.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23311653
has body: I want to create a method that evaluates an arithmetic expression like for example ((2+100)*5)*7 containing no spaces between operands and operators If there are spaces I would use the split method giving it the " " as delimiter. Can anyone help me find the algorithm to solve this kind of problem?
duplicate of: http://stackoverflow.com/q/3422673
has answer: http://stackoverflow.com/a/23311718
answer count: 3
has answer: http://stackoverflow.com/a/23311709
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23311685
downvote count: 1
has title: Evaluating an arithmetic expression without delimiters
has comment: http://stackoverflow.com/comment/35689519
tagged with: algorithm
tagged with: java
score: -1
linked to: http://stackoverflow.com/q/4589951
type: Question
linked to: http://stackoverflow.com/q/3422673
has comment: http://stackoverflow.com/comment/35689501
upvote count: 0

http://stackoverflow.com/a/23449327
type: Answer
answers question: http://stackoverflow.com/q/23449257
score: 7
upvote count: 7
has body: The .class is not needed (and apparently doesn't work). As noted in a comment, {@link IOException IOException.class} should create a link with an appropriate text label.
has comment: http://stackoverflow.com/comment/35944348
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23449257

http://stackoverflow.com/comment/35751559
score: 0
type: Comment
type: QuestionComment
has text: Evaluation order only applies if there are multiple things to evaluate. Your example doesn't.
comment on: http://stackoverflow.com/q/23345570

http://stackoverflow.com/q/23353949
has title: how do i sort my highscore list with name from a file?-java
tagged with: java
downvote count: 3
upvote count: 1
type: Question
score: -2
tagged with: sorting
answer count: 2
tagged with: scoring
has answer: http://stackoverflow.com/a/23355196
has comment: http://stackoverflow.com/comment/35767394
favorite count: 0
has body: I am trying to sort my highscores for my snake game in java: I want to be able to sort them from a file. an example of the file would be: George : 200 Sarah : 700 Ben : 100 Fred : 400 AJ : 300 How could i sort the name and all to be: Sarah : 700 Fred : 400 AJ : 300 George : 200 Ben : 100 If you could explain how to do it, send some code if you have done it before or send me to a link that explains it well, that would be Great!! thanks
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23354242

http://stackoverflow.com/a/23364779
score: 1
upvote count: 1
downvote count: 0
answers question: http://stackoverflow.com/q/23364572
type: Answer
has body: Here are few rules of @Transactional worth mentioning 1.@Transactional annotations only work on public methods. If you have a private or protected method with this annotation there’s no (easy) way for Spring AOP to see the annotation. It doesn’t go crazy trying to find them so make sure all of your annotated methods are public. 2.Transaction boundaries are only created when properly annotated (see above) methods are called through a Spring proxy. This means that you need to call your annotated method directly through an @Autowired bean or the transaction will never start. If you call a method on an @Autowired bean that isn’t annotated which itself calls a public method that is annotated YOUR ANNOTATION IS IGNORED. This is because Spring AOP is only checking annotations when it first enters the @Autowired code. Source - http://blog.timmattison.com/archives/2012/04/19/tips-for-debugging-springs-transactional-annotation/

http://stackoverflow.com/comment/35809785
has text: Ofcourse there is, on my repository classes I often autowire both EntityManager and JdbcOperations. Have to be careful with transaction management though.
type: Comment
comment on: http://stackoverflow.com/a/23354597
score: 0
type: AnswerComment

http://stackoverflow.com/q/23360079
has answer: http://stackoverflow.com/a/23360185
tagged with: class
score: 0
has answer: http://stackoverflow.com/a/23360124
has title: Object Initialization - Java
has answer: http://stackoverflow.com/a/23360187
has comment: http://stackoverflow.com/comment/35778069
answer count: 4
has answer: http://stackoverflow.com/a/23360154
type: AnsweredQuestion
tagged with: oop
tagged with: instance
tagged with: java
has body: I am new to Java. I want to ask about object initialization. First, I make a class. public class A { .... } Then at the main class, the A class is instantiated. A a = new A(); Now, the question is, whether these two codes are the same? A aa = a; and A aa = new A();
possible better answer: http://stackoverflow.com/a/23360187
accepted answer: http://stackoverflow.com/a/23360154
type: Question
tagged with: object

http://stackoverflow.com/comment/35851712
comment on: http://stackoverflow.com/q/23399650
has text: You need to copy the array, see [How do I do a deep copy of a 2d array in Java?](http://stackoverflow.com/q/1564832/1347968). But maybe we can help you better if you explain the context a bit more, i.e. why you need to build this `HashMap`.
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35674581
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23293239
has text: Ah, beautiful! Thanks for the detailed answer, I really appreciate it. Not only does everything execute perfectly now, I understand why also.

http://stackoverflow.com/comment/35899828
has text: @ThreaT I have updates my answer with a short example. I think the problem is that the cast you want to do, is not necessary at all.
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/23425285

http://stackoverflow.com/q/23311880
has answer: http://stackoverflow.com/a/23313261
has comment: http://stackoverflow.com/comment/35689976
has comment: http://stackoverflow.com/comment/35690013
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35691173
upvote count: 1
tagged with: spring
has answer: http://stackoverflow.com/a/23312063
type: Question
accepted answer: http://stackoverflow.com/a/23313261
score: 1
tagged with: java
tagged with: hibernate
possible better answer: http://stackoverflow.com/a/23312063
answer count: 2
has comment: http://stackoverflow.com/comment/35691034
downvote count: 0
has title: Transactional annotation doesn't work
favorite count: 0
has body: I use spring 3.2.8, hibernate 4. I have an error "org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.hibernate.HibernateException: createCriteria is not valid without active transaction" web.xml: journeys journeys org.springframework.web.servlet.DispatcherServlet 1 journeys / contextConfigLocation /WEB-INF/journeys-servlet.xml org.springframework.web.context.ContextLoaderListener *.jsp UTF-8 journeys-servlet.xml: <context:annotation-config /> <context:component-scan base-package="journeys.*" /> <bean id="viewResolver" ... classpath:hibernate.cfg.xml org.hibernate.dialect.MySQLInnoDBDialect true <tx:annotation-driven transaction-manager="txManager" /> <mvc:resources mapping="/resources/**" location="/resources/" /> <mvc:annotation-driven /> class/hibernate.cfg.xml: <?xml version='1.0' encoding='UTF-8'?> <hibernate-configuration> <mapping class="journeys.entity.Company"/> .... </hibernate-configuration> CompanyDAO: package journeys.dao; import java.util.List; import org.hibernate.SessionFactory; import org.hibernate.criterion.Restrictions; import journeys.utils.Pair; import journeys.entity.Company; import journeys.entity.Journey; import journeys.entity.JourneyDeparture; import journeys.entity.Order; @Component public class CompanyDAO extends AbstractDAO<Company> { @Autowired private SessionFactory sessionFactory; public CompanyDAO() { super(Company.class); } @Transactional @SuppressWarnings("unchecked") public List<Company> f() { return (List<Company>)sessionFactory.getCurrentSession().createCriteria(Company.class).list(); } } CompanyController: package journeys.controller; import journeys.dao.CompanyDAO; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.servlet.ModelAndView; @Controller @RequestMapping(value = "/company") public class CompanyController { @Autowi…
has comment: http://stackoverflow.com/comment/35691162

http://stackoverflow.com/comment/35923726
comment on: http://stackoverflow.com/q/23437939
type: QuestionComment
has text: I took flags i thought the user would most likely not type during a conversation. What flags would you suggest?
score: 0
type: Comment

http://stackoverflow.com/comment/35941636
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23440082
type: Comment
has text: Thank you. Im still trying to learn and still not getting better. :)

http://stackoverflow.com/q/23310551
has answer: http://stackoverflow.com/a/23311394
answer count: 1
downvote count: 0
score: 4
favorite count: 0
tagged with: redis
has title: Subscribe to multiple channels with same thread Jedis
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23311394
tagged with: multithreading
type: Question
has body: I have an application that uses Redis publish/subscribe to transfer messages between clients using the Jedis client in Java. I want to be able to subscribe to channels at runtime when the user types a command but as subscribe is a blocking operation as it listens on the thread that calls subscribe I'm not sure how to go about subscribing to other channels at a later date on the original thread. Example: private PubSubListener psl = new PubSubListener(); public void onCommand(String[] args) { subscribe(args[0]); } public void subscribe(String channel) { Jedis jedis = jedisPool.getResource(); jedis.subscribe(psl, channel); } This would work except the thread that dispatches the command would then be used to poll Redis and I wouldn't be able to subscribe to any more channels with that thread.
tagged with: java
tagged with: jedis
upvote count: 4

http://stackoverflow.com/comment/35865849
score: 0
comment on: http://stackoverflow.com/a/23405443
type: Comment
has text: @user3591952 See http://stackoverflow.com/questions/5769024/in-java-how-can-i-take-a-variable-obtained-from-a-user-input-from-one-method-an once, in there it is shown how to take input from user, check it try to code it yourself if you get an error (search for answer on google but if you cannot find it) put the code here and then tell what is the error and then we can help you.
type: AnswerComment

http://stackoverflow.com/comment/35910888
has text: @Husterknupp Add a log message to your `WebInitializer` and check if it's logged.
comment on: http://stackoverflow.com/a/23411438
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/35768610
comment on: http://stackoverflow.com/a/23354529
has text: Maybe I didn't clarify myself - I'm looking for an implementation of non-blocking locking that protect code blocks ie get/set invocations - not to avoid using the `synchronized` keyword.
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/35712527
type: Comment
score: 0
has text: @Zarah It means your path is wrong. Look at the path in the code you posted. I think that's the path you want. What does your project file structure look like?
type: AnswerComment
comment on: http://stackoverflow.com/a/23322723

http://stackoverflow.com/q/23303363
tagged with: swing
type: Question
possible better answer: http://stackoverflow.com/a/23303427
has comment: http://stackoverflow.com/comment/35674849
tagged with: awt
has answer: http://stackoverflow.com/a/23303432
has title: Nothing appears when I try to create a JFrame. (JButtons, JMenuBar etc.)
answer count: 3
score: 2
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/23303430
upvote count: 2
accepted answer: http://stackoverflow.com/a/23303432
has body: I'm working on a pathfinder program which uses GUI. I tried to run the program before I added some stuff and it showed everything fine. But after working on it some more it stopped showing the buttons and the menu bar. Here is the code. Some variable names are in Swedish as well, but I hope that it won't be an issue. (Please take in mind that the program is far from finished.) Thank you in advance! import java.util.*; import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.io.File; public class Pathfinder extends JFrame { JButton hittaVäg, visaFörbindelse, nyPlats, nyFörbindelse, ändraFörbindelse; JMenuBar menyBar; JMenuItem ny, avsluta, hittaVägMeny, visaFörbindelseMeny, nyPlatsMeny, nyFörbindelseMeny, ändraFörbindelseMeny; String str = System.getProperty("user.dir"); JFileChooser jfc; BildPanel Bild = null; Pathfinder(){ super("PathFinder"); setLayout(new BorderLayout()); setSize(590, 400); setDefaultCloseOperation(EXIT_ON_CLOSE); setLocationRelativeTo(null); setVisible(true); jfc = new JFileChooser("."); JPanel norra = new JPanel(); add(norra, "norra"); JButton hittaVäg = new JButton("Hitta väg"); JButton visaFörbindelse = new JButton("Visa förbindelse"); JButton nyPlats = new JButton("Ny plats"); JButton nyFörbindelse = new JButton("Ny förbindelse"); JButton ändraFörbindelse = new JButton("Ändra förbindelse"); norra.add(hittaVäg); norra.add(visaFörbindelse); norra.add(nyPlats); norra.add(nyFörbindelse); norra.add(ändraFörbindelse); hittaVäg.addActionListener(new HittaLyss()); visaFörbindelse.addActionListener(new VisaLyss()); nyPlats.addActionListener(new NyPlatsLyss()); nyFörbindelse.addActionListener(new NyFörbindelseLyss()); ändraFörbindelse.addActionListener(new NyFörbindelseLyss()); JMenuBar menyBar = new JMenuBar(); setJMenuBar(menyBar); JMenu arkivMeny = new JMenu("Arkiv"); JMenu operationerMeny = new JMenu("Operationer"); menyBar.add(arkivMeny); menyBar.add(operationerMeny); JMenuItem ny = new JMenuItem("Ny"); JMenuItem avsluta = ne…
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23303427
tagged with: java

http://stackoverflow.com/comment/35950124
has text: **1.** I'm sure it is. Anything is possible with Java :D **2.** Asking for third party libraries on SO is frowned upon and reason for closing of a question. **3.** This question is too broad, and is also reason for closing. **4.** Please read [How to Ask](http://stackoverflow.com/questions/how-to-ask).
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23452273
score: 1

http://stackoverflow.com/comment/47022278
comment on: http://stackoverflow.com/a/23463188
type: Comment
has text: With the recent news that *Codehaus* is [shutting down](http://www.javaworld.com/article/2892227/open-source-tools/codehaus-the-once-great-house-of-code-has-fallen.html), I'm not sure where the *Jira* for *Groovy Eclipse* will end up. It appears the new wiki home is at [Github](https://github.com/groovy/groovy-eclipse/wiki), but that still refers to the *Codehaus Jira* as I write this.
score: 0
type: AnswerComment

http://stackoverflow.com/a/23409645
has body: Your problem is not related to spring-security. This log message is generated in DispatcherServlet class. You can extend org.springframework.web.servlet.DispatcherServlet and override protected void noHandlerFound(HttpServletRequest request, HttpServletResponse response) throws Exception method: protected void noHandlerFound(HttpServletRequest request, HttpServletResponse response) throws Exception { if (pageNotFoundLogger.isWarnEnabled()) { String requestUri = urlPathHelper.getRequestUri(request); pageNotFoundLogger.warn("No mapping found for HTTP request with URI [" + requestUri +"] in DispatcherServlet with name '" + getServletName() + "'"); } response.sendError(HttpServletResponse.SC_NOT_FOUND); } In this way you can customize logging message and add to it the ip address from HttpServletRequest parameter: request.getRemoteAddr(); I'm not sure that it is a good practice.. but it should works. Hope this helps!!
has comment: http://stackoverflow.com/comment/35871760
type: AcceptedAnswer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/35871675
answers question: http://stackoverflow.com/q/23396100
type: Answer
accepted answer of: http://stackoverflow.com/q/23396100
upvote count: 1

http://stackoverflow.com/comment/35716175
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23325840
score: 1
has text: True, you need to reverse replacement string aswell.

http://stackoverflow.com/comment/35934480
has text: Just guessing: as all stream computations performed on a shared thread pool and you have blocked it's part with a semaphore - inner stream can't be run until semaphore is released and semaphore can't be released because it's waiting inner stream. You can find some more info in this article: http://java.dzone.com/articles/think-twice-using-java-8
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23442183
score: 0

http://stackoverflow.com/comment/36166074
has text: since I am using a BFS to find the shortest path, I will anyways not visit any already visited states. Can you please elaborate a little on how can we optimize the bfs?
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23435897
score: 0

http://stackoverflow.com/a/23369061
answers question: http://stackoverflow.com/q/23344405
has comment: http://stackoverflow.com/comment/35899424
has body: AFAIK you can't do that: if Tomcat is listening for HTTPS on port 8443, it can't be listening for HTTP on the same port. The other question you linked to was different in that it wasn't about a specific port.
type: AcceptedAnswer
type: Answer
score: 0
accepted answer of: http://stackoverflow.com/q/23344405

http://stackoverflow.com/comment/35767880
type: QuestionComment
has text: Your lead developer ... wasn't very lead-y. I suspect more cargo cult-y.
comment on: http://stackoverflow.com/q/23354172
score: 1
type: Comment

codepro
tags question: http://stackoverflow.com/q/23390337
tag name: codepro
type: Tag

http://stackoverflow.com/a/23355406
answers question: http://stackoverflow.com/q/23353671
has body: The Unicode standard defines how you should break text into sentences and other logical components. Here's some working pseudocode: // tests two consecutive codepoints within the text to detect the end of sentences boolean continueSentence(Text text, Range range1, Range range2) { Code code1 = text.code(range1), code2 = text.code(range2); // 0.2 sot ÷ if (code1.isStartOfText()) return false; // 0.3 ÷ eot if (code2.isEndOfText()) return false; // 3.0 CR × LF if (code1.isCR() &amp;&amp; code2.isLF()) return true; // 4.0 (Sep | CR | LF) ÷ if (code1.isSep() || code1.isCR() || code1.isLF()) return false; // 5.0 × [Format Extend] if (code2.isFormat() || code2.isExtend()) return true; // 6.0 ATerm × Numeric if (code1.isATerm() &amp;&amp; (code2.isDigit() || code2.isDecimal() || code2.isNumeric())) return true; // 7.0 Upper ATerm × Upper if (code2.isUppercase() &amp;&amp; code1.isATerm()) { Range range = text.previousCode(range1); if (range.isValid() &amp;&amp; text.code(range).isUppercase()) return true; } boolean allow_STerm = true, return_value = true; // 8.0 ATerm Close* Sp* × [^ OLetter Upper Lower Sep CR LF STerm ATerm]* Lower Range range = range2; Code code = code2; while (!code.isOLetter() &amp;&amp; !code.isUppercase() &amp;&amp; !code.isLowercase() &amp;&amp; !code.isSep() &amp;&amp; !code.isCR() &amp;&amp; !code.isLF() &amp;&amp; !code.isSTerm() &amp;&amp; !code.isATerm()) { if (!(range = text.nextCode(range)).isValid()) break; code = text.code(range); } range = range1; if (code.isLowercase()) { code = code1; allow_STerm = true; goto Sp_Close_ATerm; } code = code1; // 8.1 (STerm | ATerm) Close* Sp* × (SContinue | STerm | ATerm) if (code2.isSContinue() || code2.isSTerm() || code2.isATerm()) goto Sp_Close_ATerm; // 9.0 ( STerm | ATerm ) Close* × ( Close | Sp | Sep | CR | LF ) if (code2.isClose()) goto Close_ATerm; // 10.0 ( STerm | ATerm ) Close* Sp* × ( Sp | Sep | CR | LF ) if (code2.isSp() || code2.isSep() || code2.isCR() || code2.isLF()) goto Sp_Close_ATerm; // 1…
score: 0
type: Answer

http://stackoverflow.com/a/23312414
type: Answer
answers question: http://stackoverflow.com/q/23312171
score: 0
has body: You have a bidirectional OneToMany association. The owner of the association is the Many side: HamKeywordsAlias.hamKeywords. That's the side that Hibernate cares about. But you didn't initialize it. You added an alias to the keywords' collection of aliases, but failed to set the keywords of the alias: hka.setHamKeywords(hkw);

http://stackoverflow.com/comment/35892353
score: 2
type: QuestionComment
comment on: http://stackoverflow.com/q/23421306
type: Comment
has text: I don't see a pattern of how one would want to break the string to begin with. The length of each line is two, four, three, and two words in sequence. We don't know enough about the requirements, or the way you would want to approach it, to answer this question reasonably.

http://stackoverflow.com/a/70344447
score: 0
type: Answer
has body: This error is fixed in latest jre's, just upgrade the version of jre. This issue is caused by SNI
answers question: http://stackoverflow.com/q/23324807

http://stackoverflow.com/comment/35684791
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23301219
has text: You are welcome! Be careful though: this is indeed a very inappropriate usage of threads, as the other posters mentioned.

http://stackoverflow.com/comment/37593639
has text: @EJP: thanks for your comments, but the new restriction is that binding sockets outside of the ephemeral range now requires an explicit permission in the system security policy, which means it is an additional Setting outside my programming while the Environment Setups. If i didn't do that, i can still not bind the ports, did i also get an BindException caused by the security Exception? or i am wrong? Thanks.
type: Comment
comment on: http://stackoverflow.com/a/23361264
score: 0
type: AnswerComment

http://stackoverflow.com/a/23393957
has comment: http://stackoverflow.com/comment/35841154
answers question: http://stackoverflow.com/q/23393657
has comment: http://stackoverflow.com/comment/35841037
has body: Yes it looks like an Eclipse bug which you would report at https://bugs.eclipse.org/bugs/ Looking at existing bugs this class cast error has happened before but there are no open bugs for this error. Looking at the jdt plugins there are a lot of debug options that can be turned on, I'm not sure which ones would be useful here.
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/35840880
accepted answer of: http://stackoverflow.com/q/23393657
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/35841318
type: Answer

http://stackoverflow.com/q/23305482
has body: Getting a Null Pointer Exception that I dont understand since Im new to java. package com.atm; import com.atm.IUserAction.ActionType; /** * The ATM implementation class. * * @author mshields * */ public class AtmImpl { private static final IAtmHelper ATM = AtmUtils.getAtmHelper(); /** * This method is invoked when a bank card is inserted into the ATM. The card * is ejected immediately upon completion of this method, which represents the * user's ATM session. * * @param args * the bank card number is the only argument. */ public static void main(String args[]) { IUserAction pinResponse = ATM.getUserResponse("Please enter your 4-digit PIN.", ActionType.STRING); the last line is where im getting the error. I thought it is initialized when I said private static final IAtmHelper ATM = AtmUtils.getAtmHelper(); the IAtmHelper is basically empty: public class AtmUtils { public static IAtmHelper getAtmHelper() { // this dummy impl is just included to satisfy compile-time errors return null; } } here is the top of the ATMHelper class that is used: package com.atm; import java.math.BigDecimal; import java.util.List; import com.atm.IUserAction.ActionType; /** * Interface that defines ATM utility methods. * * @author mshields * */ public interface IAtmHelper { here is the function public IUserAction getUserResponse(String argMessage, ActionType... argValidActionTypes); they dont really do anthing since this isnt a real porject, but more like a test. I understand how to do all of it basically, but i cant get around this null pointer in the beginning of the main. thanks
favorite count: 0
type: UnansweredQuestion
tagged with: java
has title: Getting null pointer exception, new to Java
downvote count: 1
type: Question
linked to: http://stackoverflow.com/q/218384
score: -1
has answer: http://stackoverflow.com/a/23305510
has comment: http://stackoverflow.com/comment/35678586
upvote count: 0
answer count: 1

http://stackoverflow.com/q/23384381
has comment: http://stackoverflow.com/comment/35823149
has comment: http://stackoverflow.com/comment/35978086
upvote count: 2
has comment: http://stackoverflow.com/comment/35978694
linked to: http://stackoverflow.com/q/10752531
type: AnsweredQuestion
tagged with: installation
tagged with: java
tagged with: mysql
accepted answer: http://stackoverflow.com/a/24491022
type: Question
has title: How make an installer for a java application?
has body: I made a netbeans java application (javax.swing), connecting to the mysql database. The connection is made through localhost. Now I would like to create an installer for this application. In order to install my project on other computers. What do I need to do in order to create an installer? I'll have to make some kind of change in the database, or connection? Do you know any simple program? I've been researching this: http://www.clickteam.com/install-creator-2 Thank you all for your help. If someone did not understand my question, I try to explain better. I apologize for the inconvenience. Greetings.
score: 2
downvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/24491022
favorite count: 0

http://stackoverflow.com/comment/35906868
has text: How do you read those nodes? Are they in the same stream or file, or in different ones? Did you try anything? There are many ways to do this in Java: SAX, DOM, XPath, JDOM, DOM4J, XML Reader, XSLT Transform. If you have any code you used to read the files, post it since it could be a starting point for a possible answer.
score: 0
comment on: http://stackoverflow.com/q/23426740
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23311033
type: Question
answer count: 2
upvote count: 0
tagged with: string
has answer: http://stackoverflow.com/a/23311075
favorite count: 0
has title: removing spaces in between the string
has comment: http://stackoverflow.com/comment/35688448
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35688496
downvote count: 1
has answer: http://stackoverflow.com/a/23311069
tagged with: java
score: -1
has body: I am storing the result of list&lt;Object[]&gt; into a set as shown below.. String s ; for (Object[] arr : ilist) { String t = arr[2].toString(); Set&lt;String&gt; st = new HashSet&lt;String&gt;(); s=((String) arr[0]+ (String) arr[1]+t + (String) arr[3]); } now the problem is that upon debugging i found that in arr[2] the value is "TRE RTYU" that is a string but as we can see that there are space in between please advise how can i remove the space in between so that the value in arr[2] = "TRERTYU"
linked to: http://stackoverflow.com/q/5455794

http://stackoverflow.com/comment/35733622
has text: When the consensus is of the same opinion, that's when it's called best practice.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23335303

http://stackoverflow.com/q/23329951
has comment: http://stackoverflow.com/comment/35723414
type: Question
tagged with: logcat
has comment: http://stackoverflow.com/comment/35724268
has body: I can upload my code, but I don't even know where to look to find the error. I am not sure which xml file it is talking about. Any help would be appreciated. The errors are below: 04-27 18:22:26.524: D/AndroidRuntime(15365): Shutting down VM 04-27 18:22:26.524: W/dalvikvm(15365): threadid=1: thread exiting with uncaught exception (group=0x4001e578) 04-27 18:22:26.833: E/AndroidRuntime(15365): FATAL EXCEPTION: main 04-27 18:22:26.833: E/AndroidRuntime(15365): android.view.InflateException: Binary XML file line #18: Error inflating class <unknown> 04-27 18:22:26.833: E/AndroidRuntime(15365): at android.view.LayoutInflater.createView(LayoutInflater.java:518) 04-27 18:22:26.833: E/AndroidRuntime(15365): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56) 04-27 18:22:26.833: E/AndroidRuntime(15365): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:568) 04-27 18:22:26.833: E/AndroidRuntime(15365): at android.view.LayoutInflater.rInflate(LayoutInflater.java:623) 04-27 18:22:26.833: E/AndroidRuntime(15365): at android.view.LayoutInflater.inflate(LayoutInflater.java:408) 04-27 18:22:26.833: E/AndroidRuntime(15365): at android.view.LayoutInflater.inflate(LayoutInflater.java:320) 04-27 18:22:26.833: E/AndroidRuntime(15365): at android.view.LayoutInflater.inflate(LayoutInflater.java:276) 04-27 18:22:26.833: E/AndroidRuntime(15365): at io.uprint.android.adapter.NavDrawerListAdapter.getView(NavDrawerListAdapter.java:47) 04-27 18:22:26.833: E/AndroidRuntime(15365): at android.widget.AbsListView.obtainView(AbsListView.java:1598) 04-27 18:22:26.833: E/AndroidRuntime(15365): at android.widget.ListView.makeAndAddView(ListView.java:1770) 04-27 18:22:26.833: E/AndroidRuntime(15365): at android.widget.ListView.fillDown(ListView.java:693) 04-27 18:22:26.833: E/AndroidRuntime(15365): at android.widget.ListView.fillFromTop(ListView.java:750) 04-27 18:22:26.833: E/AndroidRuntime(15365): at android.widget.ListView.layoutChildre…
score: 0
answer count: 1
tagged with: android
has comment: http://stackoverflow.com/comment/35723333
has title: Identifying Error in LogCat
has comment: http://stackoverflow.com/comment/35723855
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27398270
has comment: http://stackoverflow.com/comment/35725290
tagged with: java

http://stackoverflow.com/q/23434474
has answer: http://stackoverflow.com/a/23434652
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35916630
score: 0
tagged with: java
upvote count: 1
tagged with: memory
downvote count: 1
possible better answer: http://stackoverflow.com/a/23434592
type: Question
has answer: http://stackoverflow.com/a/23434592
has title: Will this cause memory leak
linked to: http://stackoverflow.com/q/176745
has answer: http://stackoverflow.com/a/23434555
has answer: http://stackoverflow.com/a/23434513
has body: I am new to Java Garbage Collection and wondering if following codes will cause memory leak in Java. Why or why not? Thanks. class ListNode { int value; ListNode next; public ListNode(int value) { this.value = value; next = null; } } public class Test() { static void tryCreateMemoryLeak() { ListNode l1, l2; for (int i = 0; i &lt; 1000000; i++) { l1 = new ListNode(1); l2 = new ListNode(2); // create a circle here // will this circle be reclaimed? if do, when? l1.next = l2; l2.next = l1; } } public static void main(String[] args) { tryCreateMemoryLeak(); } }
has comment: http://stackoverflow.com/comment/35916616
has answer: http://stackoverflow.com/a/23434515
linked to: http://stackoverflow.com/q/1910194
favorite count: 0
has comment: http://stackoverflow.com/comment/35916646
answer count: 5
tagged with: memory-leaks
tagged with: garbage-collection
duplicate of: http://stackoverflow.com/q/1910194
accepted answer: http://stackoverflow.com/a/23434555

http://stackoverflow.com/q/23351740
type: Question
tagged with: android
has body: I have a small, Serializable object I need to persist between sessions outside the context of an Activity. My first thought was to write it to a SharedPreferences file, but unfortunately that class doesn't have support for reading or writing a generic Serializable. But it does support String. So my next thought was: a Serializable is just an array of bytes, and a String is just an array of 2-byte chars... why not just chop my array up two bytes at a time, convert each pair of bytes into a char, and build a String out of those chars (and then do the reverse to read it back in)? I tried this and it works fine, most of the time. But once in a while, the object fails to serialize back in. After looking into it for a while, I realized that there was something fishy going on during the writes that precede the failed reads. Specifically, logcat shows the following exception being thrown (and caught) within the framework code during the write: java.io.IOException: java.nio.charset.CoderResult[Malformed-input error with erroneous input length 1] at com.android.internal.util.FastXmlSerializer.flush(FastXmlSerializer.java:225) at com.android.internal.util.FastXmlSerializer.endDocument(FastXmlSerializer.java:183) at com.android.internal.util.XmlUtils.writeMapXml(XmlUtils.java:186) at android.app.SharedPreferencesImpl.writeToFile(SharedPreferencesImpl.java:596) at android.app.SharedPreferencesImpl.access$800(SharedPreferencesImpl.java:52) at android.app.SharedPreferencesImpl$2.run(SharedPreferencesImpl.java:511) at android.app.SharedPreferencesImpl.enqueueDiskWrite(SharedPreferencesImpl.java:532) at android.app.SharedPreferencesImpl.access$100(SharedPreferencesImpl.java:52) at android.app.SharedPreferencesImpl$EditorImpl.commit(SharedPreferencesImpl.java:454) This exception never propogates out to my code; as far it can tell, everything worked fine. My best guess after reading the char documentation here is that I sometimes by coincidence end up with a char whose numeric value p…
has title: Are there restrictions on what types of Strings can be saved in SharedPreferences?
has comment: http://stackoverflow.com/comment/35765122
score: 0
tagged with: java
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35765677

http://stackoverflow.com/a/23423299
score: 1
has comment: http://stackoverflow.com/comment/35896035
answers question: http://stackoverflow.com/q/23423226
upvote count: 1
has body: You are declaring an explicit list of A, if you want to accept all subclasses, specify so in your list declaration: List&lt;? extends A&gt; theActions = super.getActionsFor(a);
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/35896017

http://stackoverflow.com/q/23376683
tagged with: android
has comment: http://stackoverflow.com/comment/35809757
has body: I have finally started to realize that it is a good idea to unit test my Android application (specifically the database operations) and found the Robolectric framework to help me do that. I set up a simple test in /app/src/test/java/&lt;package&gt;/SanityTest.java: package &lt;package&gt;; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; import org.robolectric.RobolectricTestRunner; @RunWith(RobolectricTestRunner.class) public class SanityTest { @Test public void testTrueIsTrue() { Assert.assertTrue(true); } } I ran the test with ./gradlew robolectric: :app:compileDebugNdk UP-TO-DATE :app:preBuild // ... :app:robolectricClasses UP-TO-DATE :app:robolectric &lt;package&gt;.SanityTest &gt; testTrueIsTrue FAILED java.lang.IllegalArgumentException 1 test completed, 1 failed :app:robolectric FAILED FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':app:robolectric'. &gt; There were failing tests. See the report at: file:///&lt;project_root&gt;/app/build/reports/tests/index.html The stack trace generated by the Robolectric report showed an IllegalArgumentException Some other information: I'm using Gradle 1.10 Android Studio 0.5.7 Robolectric 2.2 JUnit 4.11
score: 2
has title: Robolectric fails to assert that true is true
answer count: 0
downvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/35809867
tagged with: robolectric
has comment: http://stackoverflow.com/comment/35809795
tagged with: unit-testing
type: Question
has comment: http://stackoverflow.com/comment/35809714
has comment: http://stackoverflow.com/comment/36618283
has comment: http://stackoverflow.com/comment/35810075
has comment: http://stackoverflow.com/comment/35809740
upvote count: 2
has comment: http://stackoverflow.com/comment/36611780
has comment: http://stackoverflow.com/comment/35809987
favorite count: 0
has comment: http://stackoverflow.com/comment/35809875
type: UnansweredQuestion

http://stackoverflow.com/comment/36808689
has text: I am afraid I don't quite understand what 'results from the actual directory` means. Please note that Git can only operate on local repositories. If you whish to list all files of a remote directory you first have to create a clone. Once you have a local repository, you can use `FileTreeIterator` to iterate over all files in the work directory.
type: AnswerComment
comment on: http://stackoverflow.com/a/23326025
type: Comment
score: 1

http://stackoverflow.com/comment/35933974
score: 0
comment on: http://stackoverflow.com/q/23442230
type: Comment
has text: YM .equals compares **values** not hashcodes (and not references).
type: QuestionComment

http://stackoverflow.com/comment/35877938
has text: I suspect you can play with the [`getSource()`](http://docs.oracle.com/javase/7/docs/api/java/util/EventObject.html#getSource()) method of the `ActionEvent` object that you get when you get called back on your `ActionListener#actionPerformed` method stub.
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/23413589

http://stackoverflow.com/comment/35934120
has text: Yes of course... mostly it is bad in case of smaller tasks. It is really good when the tasks are time consuming and can be done in parallel
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/23443058
type: Comment

http://stackoverflow.com/comment/35785452
comment on: http://stackoverflow.com/q/23364083
score: 0
has text: @Evan Knowles i need to use threads in JSP specifically
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/35697936
has text: I've tried the card layout as well and got the same result. My problem is I don't know how to make my updatePanel function that removes the old, unneeded frames, and adds a new one (created from dynamic data existing elsewhere In the program).
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23315711

http://stackoverflow.com/comment/35905598
has text: Since the DataStructureIterator hold of object EvenIterator It should be able to access setNextIndex right?
comment on: http://stackoverflow.com/a/23428672
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/tag/c
tags question: http://stackoverflow.com/q/23301860
tags question: http://stackoverflow.com/q/23305232
tags question: http://stackoverflow.com/q/23381836
tags question: http://stackoverflow.com/q/23402672
tag name: c
tags question: http://stackoverflow.com/q/23407426
type: Tag
tags question: http://stackoverflow.com/q/23362532
tags question: http://stackoverflow.com/q/23382619
tags question: http://stackoverflow.com/q/23444692
tags question: http://stackoverflow.com/q/23352592
tags question: http://stackoverflow.com/q/23360760
tags question: http://stackoverflow.com/q/23417810
tags question: http://stackoverflow.com/q/23320878
tags question: http://stackoverflow.com/q/23293758
tags question: http://stackoverflow.com/q/23385052

http://stackoverflow.com/comment/35914006
has text: See my updates above.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23431387

http://stackoverflow.com/comment/35746510
score: 0
has text: So when it runs, there's still nothing in the queue?
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/23339678

http://stackoverflow.com/q/23449662
has answer: http://stackoverflow.com/a/23449879
has comment: http://stackoverflow.com/comment/35945039
has title: Java round to nearest .5
downvote count: 2
linked to: http://stackoverflow.com/q/11815135
has comment: http://stackoverflow.com/comment/35944860
upvote count: 24
has comment: http://stackoverflow.com/comment/35944994
has comment: http://stackoverflow.com/comment/35944958
type: AnsweredQuestion
duplicate of: http://stackoverflow.com/q/11815135
tagged with: rounding
tagged with: java
accepted answer: http://stackoverflow.com/a/23449769
type: Question
tagged with: decimal
has comment: http://stackoverflow.com/comment/35944904
has body: How is this possible in Java? I have a float and I'd like to round it to the nearest .5. For example: 1.1 should round to 1.0 1.3 should round to 1.5 2.5 should round to 2.5 3.223920 should round to 3.0 EDIT: Also, I don't just want the string representation, I want an actual float to work with after that.
score: 22
answer count: 3
possible better answer: http://stackoverflow.com/a/23449879
favorite count: 0
has answer: http://stackoverflow.com/a/23449964
has answer: http://stackoverflow.com/a/23449769

http://stackoverflow.com/q/23364288
type: Question
answer count: 2
tagged with: spring-batch
score: 0
has body: Below is my ItemProcessor bean, I am implementing ItemProcessor interface. It works fine but <beans:bean id="myItemProcessor" class="com.st.foundation.MyItemProcessor" p:id="#{jobParameters[date]}" p:type="my-type" scope="step" /> I want to combine many such beans in to single pojo and use an ItemProcessorAdapter. <beans:bean id="myItemProcessor" class="org.springframework.batch.item.adapter.ItemProcessorAdapter" p:targetObject-ref="myObject" p:targetMethod="myMethod" p:arguments="{jobParameters[date]}" scope="step" /> But my targetMethod has multiple arguments (type argument along with id). How can I pass multiple arguments to the adapter as it has only p:arguments parameter ? I tried separating arguments by comma but it doesn't work. Getting error "target class must declare a method with matching name and parameter types". Also I tried using <?xml version="1.0" encoding="UTF-8"?> <beans:beans xmlns="http://www.springframework.org/schema/batch" xmlns:beans="http://www.springframework.org/schema/beans" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:file="http://www.springframework.org/schema/integration/file" xmlns:integration="http://www.springframework.org/schema/integration" xmlns:p="http://www.springframework.org/schema/p" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:util="http://www.springframework.org/schema/util" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration.xsd http://www.springframework.org/schema/integration/file http://www.springframework.org/schema/integration/file/spring-integration-file.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/…
possible better answer: http://stackoverflow.com/a/23366844
tagged with: spring
has answer: http://stackoverflow.com/a/23514768
accepted answer: http://stackoverflow.com/a/23514768
type: AnsweredQuestion
has title: spring batch ItemProcessorAdapter how to pass multiple argument to targetMethod?
has answer: http://stackoverflow.com/a/23366844
tagged with: java
linked to: http://stackoverflow.com/q/2416056

http://stackoverflow.com/a/23382774
has body: Err, javax.security.auth.X500Principal? All Implemented Interfaces: Serializable, Principal
upvote count: 1
downvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/23362698
score: 0

boolean
tags question: http://stackoverflow.com/q/23424247
tags question: http://stackoverflow.com/q/23412300
tags question: http://stackoverflow.com/q/23326571
tags question: http://stackoverflow.com/q/23330074
tags question: http://stackoverflow.com/q/23419281
tags question: http://stackoverflow.com/q/23408987
tag name: boolean
tags question: http://stackoverflow.com/q/23393299
tags question: http://stackoverflow.com/q/23421046
tags question: http://stackoverflow.com/q/23418702
tags question: http://stackoverflow.com/q/23309326
tags question: http://stackoverflow.com/q/23350229
tags question: http://stackoverflow.com/q/23319761
tags question: http://stackoverflow.com/q/23432192
tags question: http://stackoverflow.com/q/23348509
type: Tag
tags question: http://stackoverflow.com/q/23398574

http://stackoverflow.com/comment/35739370
comment on: http://stackoverflow.com/q/23339015
type: Comment
type: QuestionComment
has text: Take a look at SortedMap http://docs.oracle.com/javase/7/docs/api/java/util/SortedMap.html
score: 2

http://stackoverflow.com/a/23368563
type: Answer
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/23367991
has body: Your question is too broad. There are several resources that could be useful: Spring Getting Starter guide: Accessing Relational Data using JDBC with Spring Spring Data sample application tutorial: Spring Data Access Tutorial Spring Data doc: Spring Data current JPA Specification A lot of examples on the web. Now, it doesn't matter if you have to write/read on file or DB, as newbie, first of all you have to understand how Spring works to perform data access.
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23367991

http://stackoverflow.com/comment/35935486
comment on: http://stackoverflow.com/a/23444728
score: 0
type: Comment
has text: Thanks, sound like something workable for my project ! I will do some trials with it.
type: AnswerComment

http://stackoverflow.com/comment/35686811
type: Comment
comment on: http://stackoverflow.com/q/23310094
has text: I think getOutputText() returns a null value. You should set outputText, too.
score: 1
type: QuestionComment

http://stackoverflow.com/a/23417665
has comment: http://stackoverflow.com/comment/35886437
upvote count: 6
has comment: http://stackoverflow.com/comment/35885964
has body: I have some thing for you. I don't know how to upload a jar file here so just adding files here. Approach: ClassGenerator class creates a new class loader in a while loop and loads the same class over and over again until it run out of permgen. Now you will notice there is a list that keeps a reference of the loaded class. That is to prevent JVM from unloading those classes :). Files Explained The first image shows that when you run the program it run out of permgen space. Second image shows the structure of the project if you want to set it up in eclipse. I tested it within eclipse and exported it as a runnable jar file it works in both cases. Run as a runnable jar file and it ran out of permgen. Eclipse Project setup ClassGenerator class package com.vkg; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; import java.util.ArrayList; import java.util.List; public class ClassGenerator { private static final int BUFFER = 1024; private List&lt;Class&lt;?&gt;&gt; classList = new ArrayList&lt;Class&lt;?&gt;&gt;(); public static void main(String[] args) { ClassGenerator classGenerator = new ClassGenerator(); // Load just some class with class loaders until perm gen space fills. while (true) { classGenerator.classLoader(); } } private void classLoader() { ClassLoader classLoader = new ClassLoader() { public Class&lt;?&gt; loadClass(String classNameWithPackage) throws ClassNotFoundException { if (!classNameWithPackage.contains("DummyClass")) { return super.loadClass(classNameWithPackage); } String className = classNameWithPackage.replace('.', '/') + ".class"; byte[] classData = null; InputStream inputStream = null; try { inputStream = getResourceAsStream(className); byte[] buffer = new byte[BUFFER]; ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); int bytesRead = -1; while ((bytesRead = inputStream.read(buffer, 0, BUFFER)) != -1) { outputStream.write(buffer, 0, bytesRead); } classData = outputStream.toByteArray(); …
has comment: http://stackoverflow.com/comment/35886211
score: 6
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23415288
answers question: http://stackoverflow.com/q/23415288
has comment: http://stackoverflow.com/comment/35886980
type: Answer
has comment: http://stackoverflow.com/comment/35885903

http://stackoverflow.com/q/23357902
has answer: http://stackoverflow.com/a/23511533
tagged with: java
has comment: http://stackoverflow.com/comment/35774843
has title: Saving Plugin Data in Eclipse SWT
tagged with: jaxb
type: Question
score: 0
answer count: 1
tagged with: eclipse-plugin
has comment: http://stackoverflow.com/comment/35774575
has body: I am developing an eclipse plugin in SWT, which has about 5 Wizard pages, the user needs to enter some data in each page. My pain point is whenever the user clicks the NEXT button, an XML must be generated behind which would keep updating on each NEXT press. i.e. once the user clicks NEXT in the first page, a new XML is created and on successive pages, the user data must get appended to it. I am going to use JAXB to do this, but I am not sure how to proceed. So, if anyone could give some suggestions and references please. Thanks.
type: UnansweredQuestion
tagged with: swt

http://stackoverflow.com/a/23354905
type: Answer
score: -1
downvote count: 1
has comment: http://stackoverflow.com/comment/35769027
has comment: http://stackoverflow.com/comment/35769104
has body: to call savemap, use AntsControlPanel.this.savemap(file,obstacles); at the place of AntsControlPanel.this.savemap(file,ArrayList&lt;Cell&gt; obstacles);
answers question: http://stackoverflow.com/q/23354648
has comment: http://stackoverflow.com/comment/35769269
upvote count: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23354648
has comment: http://stackoverflow.com/comment/35769254
has comment: http://stackoverflow.com/comment/35769282

http://stackoverflow.com/a/23349596
type: Answer
has comment: http://stackoverflow.com/comment/35763122
has comment: http://stackoverflow.com/comment/35767321
answers question: http://stackoverflow.com/q/23349101
has body: Very simple in C# as well: var minBufSize = AudioTrack.GetMinBufferSize ( 44100, ChannelOut.Mono, Encoding.Pcm16bit);
score: 0

http://stackoverflow.com/q/23293890
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23294069
accepted answer: http://stackoverflow.com/a/23294069
tagged with: linked-list
tagged with: java
has title: Detecting the end of a linked list
has comment: http://stackoverflow.com/comment/35658202
type: Question
has answer: http://stackoverflow.com/a/23294125
has body: I'm making a linked list of entry's in a Phone book. However I'm struggling to work out a complete delete method. I'm trying to detect the entry I'm trying to delete is not in the list, and give an 'Entry not found' message. I'm using the list interface for linked list. Here is the delete method so far. Now I've tried to cover the "last node" situation in the last if statement. But it doesn't work. If i was not using the list interface I guess I could use the getLast() method and compare it to the entry I'm currently on, but i'd prefer to do it this way and figure out another way to solve it. Any ideas ? --edit the reason its not working is if I delete the last entry on the list, it print out the entry not found message even if the entry was there as the last node and was successfully deleted public void deleteEntry(String number) { ListIterator&lt;Entry&gt; i = phoneBook.listIterator(); while(i.hasNext()){ Entry e = i.next(); if(e.getNumber().equals(number)){ i.remove(); break; } } if(phoneBook.size() != 0 &amp;&amp; (!(i.hasNext()))){ System.out.println("Entry not found"); } }
has comment: http://stackoverflow.com/comment/35657021
has answer: http://stackoverflow.com/a/23293975
tagged with: listiterator
score: 0
answer count: 4
has comment: http://stackoverflow.com/comment/35657398
has answer: http://stackoverflow.com/a/23294114
possible better answer: http://stackoverflow.com/a/23293975

http://stackoverflow.com/comment/46177553
comment on: http://stackoverflow.com/a/28955146
score: 0
type: AnswerComment
type: Comment
has text: I don't know about the OP but I found this question trying to look for sibling annotations on a method i.e. I find a class annotation with @SomeAnnotation, then iterate on the members of that class trying to find what annotations are on each member and what values are attached to them.

http://stackoverflow.com/comment/35854864
has text: @JamesMassey It is the `scheduled time`
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23401332

http://stackoverflow.com/comment/35941432
score: 0
type: Comment
has text: @user1803551 Unfortunately, final classes interfere with a number of AOP and other reflection-based techniques (one Spring feature breaks if a method returns `String`), so it's not as easy to recommend as it was five years ago.
comment on: http://stackoverflow.com/a/23438618
type: AnswerComment

http://stackoverflow.com/q/23375987
answer count: 1
linked to: http://stackoverflow.com/q/9872510
has title: SEVERE: SAAJ0537: Invalid Content-Type. Could be an error message instead of a SOAP message
favorite count: 0
has answer: http://stackoverflow.com/a/26710535
tagged with: soap
tagged with: netbeans
downvote count: 0
type: UnansweredQuestion
score: 1
tagged with: java
tagged with: web-services
has body: I want to run a java application which calls a web service. Everything works fine from the netbeans ide, but fails when I run the .jar generated. What could be the problem? How can I check the content type that the error is pointing at? the error says: "SEVERE: SAAJ0537: Invalid Content-Type. Could be an error message instead of a SOAP message. com.sun.xml.messaging.saaj.MessageImpl identifyContentType" EDIT I am realizing that the problem could be originated by the fact that the web service that Im consuming uses a custom data type, but I have no idea where to look. Please help
type: Question
upvote count: 1

http://stackoverflow.com/comment/35687207
type: Comment
has text: you will get an error when you do : b || s(b,0). b is an integer!
comment on: http://stackoverflow.com/a/23310165
score: 1
type: AnswerComment

http://stackoverflow.com/q/23424937
has comment: http://stackoverflow.com/comment/35912405
favorite count: 0
has answer: http://stackoverflow.com/a/31649981
has title: Java 8 parallel sorting vs Scala parallel sorting
linked to: http://stackoverflow.com/q/15589502
tagged with: scala
type: UnansweredQuestion
has body: So I was just learning new Java 8, specially lambdas and date and time api. I was comparing it with scala. My basic idea was to find the execution time difference between imperative, Stream and parallel stream. So I decided to create a Library application and do some operations like searching, filtering, sorting etc. I created a Library class with a list field called books and populated it with 1000 books. Then created a functional interface for search and did some operation in all three styles. It all worked fine. My code is: // Functional Interface interface Search&lt;T&gt; { public void search(T t); } // Library class final Library library = new Library(); // This just creates some random book objects. final List&lt;Book&gt; books = collectBooks(); final Search&lt;List&lt;Book&gt;&gt; parallelSearch = (bks) -&gt; library.findAndPrintBooksParallel(bks); // Parallel Operations private void findAndPrintBooksParallel(List&lt;Book&gt; books) { books.parallelStream() .filter(b -&gt; b.getAuthor().equals("J.K. Rowling")) .sorted((x,y) -&gt; x.getAuthor().compareTo(y.getAuthor())) .map(Book::getIsbn) .forEach(Library::waitAndPrintRecord); } Now I tried to re-create the same program in scala and see whether the execution is faster or not? Surprisingly scala didn't allow me to do parallel sorting (Or may be I'm being ignorant here). My scala library is // Again some random book objects as a list val books = collectBooks // Parallel operation books.par filter(_.author == "J.K. Rowling") map (_.isdn) foreach waitAndPrint Here the books.par gives a ParSeq. This doesn't have a sort method. Is there any way I could create a parallel sort with my books list in scala. So I could write something like: books.par filter(_.author == "J.K. Rowling") sortWith (_.author &lt; _.author) map (_.isdn) foreach waitAndPrint Your help is much appreciated. Thanks.
downvote count: 2
tagged with: lambda
has comment: http://stackoverflow.com/comment/40649641
has comment: http://stackoverflow.com/comment/35912096
tagged with: parallel-processing
tagged with: java-stream
tagged with: java
has comment: http://stackoverflow.com/comment/35903791
has comment: http://stackoverflow.com/comment/35903359
has comment: http://stackoverflow.com/comment/35914102
score: 33
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/26018315
upvote count: 35
linked to: http://stackoverflow.com/q/7549795
has comment: http://stackoverflow.com/comment/39886250

http://stackoverflow.com/comment/35759428
type: QuestionComment
has text: yea I have one in there
comment on: http://stackoverflow.com/q/23349154
score: 0
type: Comment

http://stackoverflow.com/a/23341385
has comment: http://stackoverflow.com/comment/35743915
type: Answer
answers question: http://stackoverflow.com/q/23335903
score: 0
has body: It should be this to look up beans by their name : dbLogger = (MesarimLogService) appCtx.getBean("mesarimLogService"); well in fact you should not use getBean, as it is service locator pattern, not inversion of control.

http://stackoverflow.com/a/23487781
upvote count: 1
score: 1
accepted answer of: http://stackoverflow.com/q/23319887
answers question: http://stackoverflow.com/q/23319887
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: I found the problem, I hope this post will help those who may encounter this kind of exception. In my code I encrypted the message with a RecipientCertificate which is not the same as my Decryption Certificate in Recipient's Smart Token! I made this mistake and it takes me the whole three days to resolve it. Anyway, BadPaddingException made me think about cipher mode or padding.

http://stackoverflow.com/comment/35895862
type: QuestionComment
score: 0
has text: If so see http://stackoverflow.com/questions/5317513/c-sharp-how-to-spoof-ip-address-for-webrequest
comment on: http://stackoverflow.com/q/23422300
type: Comment

http://stackoverflow.com/comment/35719665
type: AnswerComment
has text: Thanks for the confirmation ;)
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23327325

http://stackoverflow.com/q/23425629
type: UnansweredQuestion
tagged with: channel
has title: Why is InputStream constructed from Channel much faster than one constructed from FileDescriptor?
has comment: http://stackoverflow.com/comment/35900203
answer count: 0
type: Question
has comment: http://stackoverflow.com/comment/35900146
has comment: http://stackoverflow.com/comment/35900767
upvote count: 5
tagged with: java
has body: When constructing an InputStream on a RandomAccessFile in order to have Kryo deserialize objects from it, it seems it makes a HUGE difference for performance whether one constructs the mediating InputStream through the file's Channel (gives good performance) or through its FileDescriptor (gives terrible performance): RandomAccessFile ra = new RandomAccessFile(dataFile, "r"); Input input1 = new InputWithRandomAccessFile(Channels.newInputStream(ra.getChannel()), FILE_BUF_SIZE, ra); Input input2 = new InputWithRandomAccessFile(new FileInputStream(ra.getFD()), FILE_BUF_SIZE, ra); InputWithRandomAccessFile is my own class extending Kryo's Input class, with the only additional behavior that it seeks the correct position in the R/A file when #setPosition is called. Reading 3,000 fixed-size objects from input1 takes around 600 ms, from input2 it takes around 16 seconds.
tagged with: inputstream
tagged with: kryo
has comment: http://stackoverflow.com/comment/35900963
score: 5
has comment: http://stackoverflow.com/comment/35900345
tagged with: fileinputstream
downvote count: 0
has comment: http://stackoverflow.com/comment/35900708
favorite count: 0
has comment: http://stackoverflow.com/comment/35900268

http://stackoverflow.com/q/23444478
downvote count: 0
score: 1
tagged with: java
tagged with: output
tagged with: photo
has body: Say I have got a image file, which shows a dog (just for example). During execution, I want to display the image located at "C:\image.png" (again, just saying) to be displayed by using System.out.println or basic GUI by using Swing class. I am curious to know about it, so if it is possible, it'd be so helpful if you could kindly explain. Same for if not possible. Thanks a ton! EDIT: Is it impossible to include images in System.out.println?
type: Question
has comment: http://stackoverflow.com/comment/35935018
has comment: http://stackoverflow.com/comment/35934981
has comment: http://stackoverflow.com/comment/35936329
has comment: http://stackoverflow.com/comment/35934975
upvote count: 1
has title: Is it possible for images to be displayed in Java program output?
accepted answer: http://stackoverflow.com/a/23445123
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/23445123
type: AnsweredQuestion

http://stackoverflow.com/q/23291197
has body: In this example: class Test3 { public static void main(String[] args) { byte mask = 1; for(mask &lt;&lt;= 7; mask != 0; mask &gt;&gt;&gt;= 1) { System.out.print(mask + " "); } } } I was expecting the output to be -128 64 32 16 8 4 2 1, instead i received an infinite recursive loop of -1. If i change the type of the mask variable to be int, the program behaves normally. Could you please explain me why I am having this particular output? Thank you in advance for your time to help me!
has comment: http://stackoverflow.com/comment/35652812
upvote count: 3
tagged with: types
has comment: http://stackoverflow.com/comment/35652490
answer count: 1
accepted answer: http://stackoverflow.com/a/23291608
favorite count: 0
has comment: http://stackoverflow.com/comment/35652285
linked to: http://stackoverflow.com/q/3948220
tagged with: byte
has answer: http://stackoverflow.com/a/23291608
type: AnsweredQuestion
has title: byte type behavior is not what expected
downvote count: 0
tagged with: java
tagged with: bitwise-operators
has comment: http://stackoverflow.com/comment/35652452
type: Question
has comment: http://stackoverflow.com/comment/35652315
score: 3
has comment: http://stackoverflow.com/comment/35652373
has comment: http://stackoverflow.com/comment/35652543

http://stackoverflow.com/a/23435833
answers question: http://stackoverflow.com/q/23427493
has comment: http://stackoverflow.com/comment/35920128
has body: try this one @Then("^The Text \"([^\"]*)\"\d+\"([^\"]*)\" isnt present on the page$"). This step mapping will be mapped to string in feature file Then The Text "Living Place "123" hasn't been found" isnt present on the page. This substitutes the text before digits \"([^\"]*)\" i.e. 'Living Place ', this searches more then one digit symbol in quotation marks \"\d+\" i.e 123, and again part to match text.
type: Answer
has comment: http://stackoverflow.com/comment/36022791
score: 0

http://stackoverflow.com/a/23437261
downvote count: 0
has comment: http://stackoverflow.com/comment/35924006
upvote count: 8
type: Answer
score: 8
answers question: http://stackoverflow.com/q/23436894
has body: Yes, you can develop JavaFX programs with just JavaScript (Nashorn). How to access JavaFX from JavaScript Use the jjs -fx yourscript.js command line switch. The -fx flag on jjs will bootstrap scripts using a javafx.application.Application. There is no compile step for JavaScript, just write your script and run it with jjs -fx. There are no bootstrapping files required. The jjs binary and the JavaFX runtime are both shipped with the Oracle Java 8 Runtime Environment (JRE) and jjs is located in the bin directory of the JRE installation. Sample Code A Hello World example (copied from Jim Laskey's blog). var Button = Java.type("javafx.scene.control.Button"); var StackPane = Java.type("javafx.scene.layout.StackPane"); var Scene = Java.type("javafx.scene.Scene"); $STAGE.title = "Hello World!"; var button = new Button(); button.text = "Say 'Hello World'"; button.onAction = function() print("Hello World!"); var root = new StackPane(); root.children.add(button); $STAGE.scene = new Scene(root, 300, 250); $STAGE.show(); Additional Resources There are numerous web examples of running JavaFX using Nashorn scripts. JavaFX with Nashorn Hello World and 3D demos JavaFX with Nashorn Canvas example. JavaFX with Nashorn Animated Gauge Demo. JavaFX with Nashorn LED readout demo.

http://stackoverflow.com/a/23412760
answers question: http://stackoverflow.com/q/23412697
has body: classB.getClassCList().removeAll(objectsTobeRemoved);
has comment: http://stackoverflow.com/comment/35877661
has comment: http://stackoverflow.com/comment/35876278
score: 0
type: Answer

http://stackoverflow.com/q/23398871
has body: I'm working on a project where we would like to send messages via an Azure Service Bus (Topic). In this instance, I've setup a C# Console app and a Java app that sends and receives messages between them. When sending a message from C#, I get a strangely formatted string within Java containing "schema.microsoft.com/2003/10/serialisation". Changing the message content type makes no difference. When sending data from Java to C# I get an exception. Send/Receive Data - C# private static void SendMessages() { topicClient = TopicClient.Create(TopicName); List&lt;BrokeredMessage&gt; messageList = new List&lt;BrokeredMessage&gt;(); messageList.Add(CreateSampleMessage("1", "Test")); Console.WriteLine("\nSending messages to topic..."); foreach (BrokeredMessage message in messageList) { while (true) { try { topicClient.Send(message); } catch (MessagingException e) { if (!e.IsTransient) { Console.WriteLine(e.Message); throw; } else { HandleTransientErrors(e); } } Console.WriteLine(string.Format("Message sent: Id = {0}, Body = {1}", message.MessageId, message.GetBody&lt;string&gt;())); break; } } topicClient.Close(); } private static BrokeredMessage CreateSampleMessage(string messageId, string messageBody) { BrokeredMessage message = new BrokeredMessage(messageBody); message.MessageId = messageId; return message; } C# Stacktrace {"There was an error deserializing the object of type System.String. Unexpected end of file. Following elements are not closed: ."} at System.Runtime.Serialization.XmlObjectSerializer.ReadObjectHandleExceptions(XmlReaderDelegator reader, Boolean verifyObjectName, DataContractResolver dataContractResolver) at System.Runtime.Serialization.DataContractSerializer.ReadObject(XmlDictionaryReader reader, Boolean verifyObjectName) at Microsoft.ServiceBus.Messaging.DataContractBinarySerializer.ReadObject(XmlDictionaryReader reader, Boolean verifyObjectName) at System.Runtime.Serialization.XmlObjectSerializer.ReadObjectHandleExceptions(XmlReaderDelegator reader, Bo…
type: Question
tagged with: c#
has title: Azure Service Bus - Data Transmission Issue
has answer: http://stackoverflow.com/a/23399024
score: 0
answer count: 1
tagged with: azure
type: UnansweredQuestion
tagged with: java

http://stackoverflow.com/q/23322193
tagged with: constructor
has comment: http://stackoverflow.com/comment/35708485
has answer: http://stackoverflow.com/a/23322441
type: UnansweredQuestion
tagged with: java
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/23322266
score: -1
answer count: 3
has answer: http://stackoverflow.com/a/23322313
upvote count: 0
has title: A few basics questions about constructors in different classes in Java
has body: A few basics questions about constructors in different classes: When should I add an empty constructor in a class? When should I add constructor in abstract class? When should I add a "super" constructor in an extends class?
favorite count: 0

http://stackoverflow.com/a/23447980
type: Answer
answers question: http://stackoverflow.com/q/23447768
has comment: http://stackoverflow.com/comment/35942052
has comment: http://stackoverflow.com/comment/35941542
has comment: http://stackoverflow.com/comment/35941948
has body: You aren't totally clear in asking your question, (so turned out I tried to fix the wrong issue here) but it appears that you're kind of misusing the second for loop there. for(String s: employee.keySet()){ for(Integer i : employee.get(s)) ... The first for loop is correct, albeit not as efficient as it could be. The issue is with the second for loop: for(Integer i : employee.get(s)) If you look at the online javadoc, you see that get() returns the value that corresponds to the key that you passed in. So in your case, employee.get(s) returns an Integer object. And it doesn't make sense to try to iterate over a single Integer object. You probably just want to do Integer i = employee.get(s). instead. A possibly more efficient way for you to go about this is to iterate over HashMap.entrySet(). This way, you get both the name and age in one shot without having to check the HashMap again for the age. So something like this: for (Map.Entry&lt;String, Integer&gt; entry : employee.entrySet()) { String s = entry.getKey(); Integer i = entry.getValue(); // Rest of code here } Hope that helped!
has comment: http://stackoverflow.com/comment/35942006
score: 0
has comment: http://stackoverflow.com/comment/35942076

http://stackoverflow.com/comment/35776145
type: Comment
type: QuestionComment
has text: What do you expect if your `List` contains many groups sharing the same `SourceTitle`?
comment on: http://stackoverflow.com/q/23358988
score: 0

http://stackoverflow.com/q/23318914
favorite count: 0
has title: Can you override static method in Java? if I create same method in subclass is it compile time error?
has comment: http://stackoverflow.com/comment/35703079
has comment: http://stackoverflow.com/comment/35703039
linked to: http://stackoverflow.com/q/2223386
downvote count: 2
has comment: http://stackoverflow.com/comment/35703141
type: AnsweredQuestion
score: 2
accepted answer: http://stackoverflow.com/a/23318925
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/35703056
upvote count: 4
has body: I thought you can not override static method in Java but its not a compile time error to declare exactly same method in sub class, That is called method hiding in Java. But what if i have to override static method. // filename Test.java public class Test { public static void foo() { System.out.println("Test.foo() called "); } public static void foo(int a) { System.out.println("Test.foo(int) called "); } public static void main(String args[]) { Test.foo(); Test.foo(10); } }
has answer: http://stackoverflow.com/a/23318925
has comment: http://stackoverflow.com/comment/35703044
has comment: http://stackoverflow.com/comment/77694334
answer count: 1

http://stackoverflow.com/q/23357479
has answer: http://stackoverflow.com/a/29070098
tagged with: java
tagged with: socketexception
type: Question
has comment: http://stackoverflow.com/comment/96494030
has answer: http://stackoverflow.com/a/28025580
has answer: http://stackoverflow.com/a/27304247
has title: java.net.SocketException: sendto failed: EPIPE (Broken pipe) on Android
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/24929171
type: UnansweredQuestion
tagged with: sockets
tagged with: android
score: 6
has body: I am trying to read data from server socket from client in Android. Here are the snippets of code that I'm using: Client (On Android in JAVA) DataOutputStream dataOutputStream = null; DataInputStream dataInputStream = null; try { if (client.socket == null || !client.socket.isConnected()) client.createSocket(); // Get Input/Output stream for socket dataOutputStream = new DataOutputStream(client.socket.getOutputStream()); dataInputStream = new DataInputStream(client.socket.getInputStream()); // Here RS is simple JAVA class that stores information about payload and response length Log.d("Send", "Sending payload for pair " + RS.getc_s_pair() + " " + RS.getResponse_len()); dataOutputStream.write(UtilsManager.serialize(RS.getPayload())); // Notify waiting Queue thread to start processing next packet if (RS.getResponse_len() &gt; 0) { Log.d("Response", "Waiting for response for pair " + RS.getc_s_pair() + " of " + RS.getResponse_len() + " bytes"); int totalRead = 0; byte[] buffer = new byte[RS.getResponse_len()]; while (totalRead &lt; RS.getResponse_len()) { int bytesRead = dataInputStream.read(buffer, totalRead, RS.getResponse_len() - totalRead); if (bytesRead &lt; 0) { throw new IOException("Data stream ended prematurely"); } totalRead += bytesRead; } } Server (Python) # Here request_len is the expected request size while buffer_len &lt; response_set.request_len: new_data = connection.recv( min(self.buff_size, response_set.request_len-buffer_len) ) if not new_data: return False buffer_len += len(new_data) # Send required response for response in response_set.response_list: try: connection.sendall(str(response.payload)) except: return False Sometimes, I am getting error while I'm sending payload from client on line dataOutputStream.write(UtilsManager.serialize(RS.getPayload())); Error I'm getting is: java.net.SocketException: sendto failed: EPIPE (Broken pipe) at libcore.io.IoBridge.maybeThrowAfterSendto(IoBridge.java:506) at libcore.io.IoBridge.sendto(IoBridge.java:475) …
tagged with: python
upvote count: 6
answer count: 4
linked to: http://stackoverflow.com/q/36386141

http://stackoverflow.com/comment/35868591
comment on: http://stackoverflow.com/q/23408086
has text: It's a String array, and it's constantly changed and can even be empty. It's filled by a database query from the activity, I forgot to mention this is all inside a fragment. I want a button with it's own listener and way to set it's layout if it's possible, not just another String that could get popped. If the query returns null, and the String array is empty, the button will still be there.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35872662
comment on: http://stackoverflow.com/a/23410737
score: 0
type: AnswerComment
type: Comment
has text: sir please can you explain more this i am not familiar with collection methods so please can you tell me what method i have to create in that class and both class are servlet so can i call their object....?

http://stackoverflow.com/comment/35949858
score: 2
has text: Have you tried doing some profiling to see if you're actually running out of memory? And the thing is that I'm fairly certain that Java will do its best to reclaim unused memory before throwing an `OutOfMemoryError`; this means that in all likelihood even if calling `System.gc()` did anything, it would have no net effect because Java probably does that anyways before giving up. Freeing memory in Java pretty much just means letting it go out of scope.
comment on: http://stackoverflow.com/q/23452176
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35668939
type: Comment
type: QuestionComment
has text: possible duplicate of [Only want to ever see Allman style code and save K&R style code](http://stackoverflow.com/questions/6876617/only-want-to-ever-see-allman-style-code-and-save-kr-style-code)
comment on: http://stackoverflow.com/q/23299433
score: 0

http://stackoverflow.com/comment/35783507
type: AnswerComment
has text: @JakubPolák Sometimes people down vote because either a) they don't like the answer, b) don't understand the answer. In any case, a comment on how to improve is far more useful. Just because I think I am right doesn't mean a) everyone agrees with me, b) everyone understand what I am going on about, c) couldn't be clearer or add some detail.
type: Comment
comment on: http://stackoverflow.com/a/23362260
score: 0

http://stackoverflow.com/q/23403878
score: -2
linked to: http://stackoverflow.com/q/5457699
answer count: 2
has title: Access to Browser history on Android Application
has answer: http://stackoverflow.com/a/23404013
favorite count: 0
has comment: http://stackoverflow.com/comment/35859274
tagged with: android
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23404013
possible better answer: http://stackoverflow.com/a/23404825
tagged with: java
has answer: http://stackoverflow.com/a/23404825
downvote count: 3
upvote count: 1
has body: I have created a simple browser application with a edittext , go button and history button. Please suggest what coding do i need to implement for history button such that when i press it my browsing history gets displayed on the hi.xml layout. Please suggest what coding changes do i need to make in my xml file as well as java file . MainActivity.java: package com.example.history; import android.os.Bundle; import android.app.Activity; import android.content.Context; import android.content.Intent; import android.view.Menu; import android.view.View; import android.view.View.OnClickListener; import android.view.inputmethod.InputMethodManager; import android.webkit.WebView; import android.webkit.WebViewClient; import android.widget.Button; import android.widget.EditText; public class MainActivity extends Activity implements OnClickListener{ EditText t; Button g,h; WebView w; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); g=(Button) findViewById(R.id.button1); h=(Button) findViewById(R.id.button2); t=(EditText) findViewById(R.id.editText1); w=(WebView) findViewById(R.id.webView1); h.setOnClickListener(this); g.setOnClickListener(this); w.getSettings().setJavaScriptEnabled(true); w.getSettings().setLoadWithOverviewMode(true); w.getSettings().setUseWideViewPort(true); w.setWebViewClient(new Callback()); } @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 void onClick(View arg0) { // TODO Auto-generated method stub switch(arg0.getId()) { case R.id.button1: String c; c=t.getText().toString(); String theWebsite=("http://").concat(c); t.setText(theWebsite); w.loadUrl(theWebsite); InputMethodManager imm=(InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(w.getWindowToken(),0); break; case …
type: Question

http://stackoverflow.com/a/33918771
has comment: http://stackoverflow.com/comment/67758766
has comment: http://stackoverflow.com/comment/57395195
type: Answer
downvote count: 1
has comment: http://stackoverflow.com/comment/138127606
answers question: http://stackoverflow.com/q/23318109
has body: Yes, Android Supports Java 8 Now (24.1.17) Now it is possible But you will need to have your device rom run on java 1.8 and enable "jackOptions" to run it. Jack is the name for the new Android compiler that runs Java 8 https://developer.android.com/guide/platform/j8-jack.html add these lines to build_gradle android { ... defaultConfig { ... jackOptions { enabled true } } compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } } Java 8 seem to be the running java engine of Android studio 2.0, But it still does not accept the syntax of java 8 after I checked, and you cannot chose a compiler from android studio now. However, you can use the scala plugin if you need functional programming mechanism in your android client.
score: 24
upvote count: 25

struts
tags question: http://stackoverflow.com/q/23420941
tags question: http://stackoverflow.com/q/23378727
tags question: http://stackoverflow.com/q/23345626
tag name: struts
type: Tag
tags question: http://stackoverflow.com/q/23440573

http://stackoverflow.com/a/23423391
score: -1
upvote count: 0
answers question: http://stackoverflow.com/q/23422650
type: Answer
downvote count: 1
has body: Check the time-out on the server too. Because when you trying to download large file through JAVA some time server is giving time out exception. here are some other example code for downloading data from server to app using FTP.here i used two list remoteFileList,localFileList to give sourse file and local file paths. FTPClient ftpClient = new FTPClient(); ftpClient.connect(Constant.FTP_SERVER_IP); ftpClient.login(Constant.FTP_USER_NAME, Constant.FTP_PASSWORD); ftpClient.setFileType(FTP.BINARY_FILE_TYPE); ftpClient.enterLocalPassiveMode(); int reply = ftpClient.getReplyCode(); if (FTPReply.isPositiveCompletion(reply)) { System.out.println("Connection Succeeded"); for (int i = 0; i &lt; remoteFileList.size(); i++) { remoteFileName = remoteFileList.get(i); localFileName = localFileList.get(i); File localFile = new File(localFileName); if (localFile.exists()) { System.out.println("File Already Exists!!"); } else { downloadFile = new FileOutputStream(localFile); boolean isDownloaded = ftpClient.retrieveFile(remoteFileName, downloadFile); System.out.println("Downloaded"); if (isDownloaded) { System.out.println(" - Success.\n"); } else { System.out.println( " - Unsuccess.\n"); } } if (i == remoteFileList.size() - 1 &amp;&amp; this.DownloadType == 1) { System.out.println("This is time to open !"); JOptionPane.showMessageDialog(this, "Image downloading completed.Please open the inspection"); } } } else { ftpClient.disconnect(); }

http://stackoverflow.com/comment/35877343
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23412883
type: AnswerComment
has text: Sorry but the g2dImg is used in the other class, what code do i use to clear it now the program starts with the bar there i want it to appear after i click the draw button.

http://stackoverflow.com/q/23450771
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35947661
has body: I was working with a class extending a Swing Object Class (e.g. public myClass extends JFrame) and with methods/variables referring to Screen objects/DisplayMode/Graphics. There were no issues. However when I tried to cast Grphics instance g to a Graphics2D object, I have gotten, seem-to-be-common error as explained in multiple places of SE with great answers and information. I AM CURIOUS! Because I managed to solve the issue without adding a serialVersionID or without implementing serializable interface. And as said I don't need my class to be serialized. Since it was solved without having to implement/extend serializable interface or adding serialVersionID - I am just curious to understand in what scenarios compiler decides or treats a class as or better be serialized...I am not sure how else I can explain this. What I want to know, how/under what criteria does Java Compiler qualify a class as a serializable and demand a Serial ID? In my case neither I required a serialization nor did I specify one.
tagged with: java
score: -1
accepted answer: http://stackoverflow.com/a/23450788
answer count: 2
upvote count: 0
has comment: http://stackoverflow.com/comment/35947590
favorite count: 0
has comment: http://stackoverflow.com/comment/35947583
tagged with: serialization
has comment: http://stackoverflow.com/comment/35947686
possible better answer: http://stackoverflow.com/a/23451140
has answer: http://stackoverflow.com/a/23451140
has answer: http://stackoverflow.com/a/23450788
linked to: http://stackoverflow.com/q/2288937
has comment: http://stackoverflow.com/comment/35947784
tagged with: swing
has title: How does Java define or detect a class as a serializable class?
downvote count: 1

http://stackoverflow.com/q/23433259
has title: JDBC connection in constructor
answer count: 1
accepted answer: http://stackoverflow.com/a/23433319
tagged with: jdbc
type: AnsweredQuestion
has body: I know it is sily question but please give me an idea why does below mentioned code throw NullPointerException? An initialization is performed in the next order: static fields/initializator - constructor - local variables. Why do I have an exception if when addInvoiceData() is callled all the static variables(connection and statement) are already initialized? If I connect to DB in the method everything works out. Any comments would be appreciated. public class DaoClass { public DaoClass() { try { Class.forName("com.mysql.jdbc.Driver"); connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/ved_project", "root", "1111"); } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (SQLException e) { e.printStackTrace(); } } static Connection connection; static PreparedStatement statement; public static void addInvoiceData() { try { statement = connection.prepareStatement("INSERT INTO invoices(contractor_id, invoice_num, date, amount) VALUES (?, ?, ?, ?)"); statement.setInt(1, 1); statement.setString(2, "RM-2014"); statement.setString(3, "20140212"); statement.setFloat(4, 125.12f); statement.executeUpdate(); } catch (SQLException e) { e.printStackTrace(); } finally { try { if (statement != null) {statement.close();} if (connection != null) {connection.close();} } catch (SQLException e) { e.printStackTrace(); } } } public static void main(String[] args) { addInvoiceData(); } }
score: 0
tagged with: java
tagged with: mysql
has answer: http://stackoverflow.com/a/23433319
type: Question

http://stackoverflow.com/a/23396250
answers question: http://stackoverflow.com/q/23396033
has body: The core algorithms are essentially the same. The ThreadLocalRandom uses the Java ThreadLocal construct to create a new Random variable for each thread. This guarantees that the calls from each thread will never conflict with each (no contention). Take a look at this line from Random for comparison: } while (!seed.compareAndSet(oldseed, nextseed)); When you ask for a next value, Random takes the old value and generates a new value. It then uses the AtomicLong.compareAndSet function to set the new value, only if the old value is still the one it used. If another thread had changed the value, the loop will run again (and again, until it's the only loop that's both get and set the value in one random number generation). Thus there is possible contention, and thus possible performance implications. The ThreadLocalRandom, because it is guaranteed not to conflict, does not require atomic functions and thread-safe operations/locking. There are some tradeoffs you would want to think about. Using one Random allows for one random number generator which is very useful if you want to use a single seed for your application. If you make only occasional calls to Random, so that conflicts are likely to be "rare" (not the normal case) then you might not worry about conflicts and the small individual impact to performance may not matter. If you're calling random hundreds of time per seconds across multiple threads, then you clearly want to use ThreadLocalRandom.
score: 4
upvote count: 4
downvote count: 0
type: Answer

http://stackoverflow.com/comment/35893957
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23418010
has text: Take a look at this issue, if you have not done it already: https://code.google.com/p/google-web-toolkit/issues/detail?id=4785&can=1&q=datepicker%20twice&colspec=ID%20Type%20Status%20Owner%20Milestone%20Summary%20Stars
type: AnswerComment

http://stackoverflow.com/q/23328594
has answer: http://stackoverflow.com/a/23328688
upvote count: 1
downvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/23328742
type: UnansweredQuestion
has title: No Such Element Exception With Loop
has comment: http://stackoverflow.com/comment/35721227
has comment: http://stackoverflow.com/comment/35720802
tagged with: java
type: Question
has body: I am using this code, and for some reason, I'm getting a No Such Element Exception... numCompanies is being imported from the keyboard and is showing up right and portfolio is an array with [numCompanies][4]. Can anyone figure out why? for(int i = 0; i &lt; numCompanies; i++) { System.out.print("Stock #" + (i+1) + ": "); String stockData = kbReader.nextLine(); System.out.print("\n\n hi" + stockData); Scanner stockLine = new Scanner(stockData); for(int j = 0; j &lt; 4; j++) { portfolio[i][j] = stockLine.next(); } }
answer count: 2
score: 0

http://stackoverflow.com/q/23421967
has comment: http://stackoverflow.com/comment/35894391
tagged with: jax-rs
linked to: http://stackoverflow.com/q/17533280
has comment: http://stackoverflow.com/comment/35894610
has answer: http://stackoverflow.com/a/23422144
has comment: http://stackoverflow.com/comment/35894684
favorite count: 0
has comment: http://stackoverflow.com/comment/35895065
has comment: http://stackoverflow.com/comment/35893565
has comment: http://stackoverflow.com/comment/35894884
has body: As REST services intended to send xml or JSON type data, @Consumes({MediaType.APPLICATION_JSON}) @Produces({MediaType.APPLICATION_JSON}) and This Search Results elaborates custom Object into JSON and then, tranffer it. Without doing so, can any one let me know, Is there a way to send serialized objects straightforward ? Any resource, code snip where domestrate how JAX-RS send serialized Objects ?
has comment: http://stackoverflow.com/comment/35893551
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/35893812
tagged with: jakarta-ee
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35894489
tagged with: java
accepted answer: http://stackoverflow.com/a/23422144
possible better answer: http://stackoverflow.com/a/23422248
type: Question
has comment: http://stackoverflow.com/comment/35894494
has comment: http://stackoverflow.com/comment/35893677
has title: JAX-RS send serialized Objects
answer count: 2
has comment: http://stackoverflow.com/comment/35894090
has answer: http://stackoverflow.com/a/23422248
has comment: http://stackoverflow.com/comment/35894616
has comment: http://stackoverflow.com/comment/35894808
has comment: http://stackoverflow.com/comment/35893715
score: 0
tagged with: rest
has comment: http://stackoverflow.com/comment/35894345
linked to: http://stackoverflow.com/q/19354095

android-fragments
tags question: http://stackoverflow.com/q/23338937
tags question: http://stackoverflow.com/q/23336091
tags question: http://stackoverflow.com/q/23375644
tags question: http://stackoverflow.com/q/23313158
tags question: http://stackoverflow.com/q/23443642
tags question: http://stackoverflow.com/q/23318958
tags question: http://stackoverflow.com/q/23423894
tags question: http://stackoverflow.com/q/23361448
tags question: http://stackoverflow.com/q/23371690
tags question: http://stackoverflow.com/q/23420817
tags question: http://stackoverflow.com/q/23338290
tags question: http://stackoverflow.com/q/23301858
tags question: http://stackoverflow.com/q/23333092
type: Tag
tags question: http://stackoverflow.com/q/23328738
tags question: http://stackoverflow.com/q/23313472
tags question: http://stackoverflow.com/q/23297951
tags question: http://stackoverflow.com/q/23391350
tags question: http://stackoverflow.com/q/23304467
tags question: http://stackoverflow.com/q/23438350
tags question: http://stackoverflow.com/q/23438390
tags question: http://stackoverflow.com/q/23376086
tags question: http://stackoverflow.com/q/23294138
tags question: http://stackoverflow.com/q/23313680
tags question: http://stackoverflow.com/q/23442272
tags question: http://stackoverflow.com/q/23407535
tags question: http://stackoverflow.com/q/23295899
tags question: http://stackoverflow.com/q/23330313
tags question: http://stackoverflow.com/q/23322619
tags question: http://stackoverflow.com/q/23438575
tags question: http://stackoverflow.com/q/23304198
tags question: http://stackoverflow.com/q/23423944
tags question: http://stackoverflow.com/q/23324709
tags question: http://stackoverflow.com/q/23326055
tags question: http://stackoverflow.com/q/23327435
tags question: http://stackoverflow.com/q/23424040
tags question: http://stackoverflow.com/q/23408899
tags question: http://stackoverflow.com/q/23423187
tags question: http://stackoverflow.com/q/23415462
tag name: android-fragments
tags question: http://stackoverflow.com/q/23426999
tags question: http://stackoverflow.com/q/23426634
tags question: http://stackoverflow.com/q/23407487
tags question: http://stackoverflow.com/q/23401520

http://stackoverflow.com/q/23372009
tagged with: text-extraction
favorite count: 0
type: AnsweredQuestion
score: 1
tagged with: java
has title: How to extract urls from an html file stored on my computer using java?
type: Question
downvote count: 0
has body: I need to find all the urls present in an html file which is stored in my computer itself and extract the links and store it to a variable. I'm using the code below to scan the file and get the lines. But I'm having a hard time extracting just the links. I would appreciate if someone could help me out. Scanner htmlScanner = new Scanner(new File(args[0])); PrintWriter output = new PrintWriter(new FileWriter(args[1])); while(htmlScanner.hasNext()){ output.print(htmlScanner.next()); } System.out.println("\nDone"); htmlScanner.close(); output.close();
upvote count: 1
has answer: http://stackoverflow.com/a/23388324
has comment: http://stackoverflow.com/comment/35800645
tagged with: io
accepted answer: http://stackoverflow.com/a/23388324
answer count: 1

http://stackoverflow.com/comment/35714463
type: Comment
has text: @PrasadKharkar JB Nizet is correct. The example he showed is called an "island of isolation". The JVM is smart enough to pick up on these things
comment on: http://stackoverflow.com/a/23324212
score: 0
type: AnswerComment

http://stackoverflow.com/comment/35731864
comment on: http://stackoverflow.com/a/23334008
score: 0
type: AnswerComment
has text: now it run proper .. Number of Used Ports In Your Machine: 7 is this actual output. how should i test or cross verify?
type: Comment

http://stackoverflow.com/q/23340646
has comment: http://stackoverflow.com/comment/35742465
has comment: http://stackoverflow.com/comment/35743725
has comment: http://stackoverflow.com/comment/35743595
has comment: http://stackoverflow.com/comment/35745366
has comment: http://stackoverflow.com/comment/35742284
has comment: http://stackoverflow.com/comment/35744017
has comment: http://stackoverflow.com/comment/35749315
type: UnansweredQuestion
has title: System property, "java.class.path" does not contain classpath added from ant script
has body: I added classpath to an ant script. Then, in a java file, I wrote "java.class.path" property to get the classpath. When I run a test suite in Eclipse, the classpath is in the property value. However, when I ran the test suite with ant script in terminal, the classpath is not in the property value. I couldn't find the reason. Here is the ant script snippet. I added "target/class" and jar files to the classpath. &lt;target name="test"&gt; &lt;echo message="Running unit tests ..."/&gt; &lt;junit printsummary="true" showoutput="true" haltonfailure="false"&gt; &lt;formatter type="plain" usefile="false"/&gt; &lt;classpath&gt; &lt;pathelement path="${result.classes.dir}"/&gt; &lt;path refid="jmeter_cp"/&gt; &lt;/classpath&gt; &lt;test name="test.JMeterTestSuite"/&gt; &lt;/junit&gt; &lt;/target&gt; And here is java code snippet. It retrieves "java.class.path" property value. stPaths = new StringTokenizer( System.getProperty("java.class.path"), System.getProperty("path.separator")); I looked at the "java.class.path" value, but it did not have "target/class" and the jar files... FYI, I'm using an modified ant from a mutation tool(http://mutation-testing.org/). "java.class.path" value contains only libraries for the tool. The tool might delete the classpath that I added. But I'm not sure, so this is why I'm posting this question here.
has comment: http://stackoverflow.com/comment/35745679
has comment: http://stackoverflow.com/comment/35742224
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/35747424
tagged with: eclipse
has comment: http://stackoverflow.com/comment/35742101
type: Question
tagged with: ant
has comment: http://stackoverflow.com/comment/35742402
has comment: http://stackoverflow.com/comment/35742552
score: 0
has comment: http://stackoverflow.com/comment/35742715

http://stackoverflow.com/a/23319805
accepted answer of: http://stackoverflow.com/q/23319761
answers question: http://stackoverflow.com/q/23319761
upvote count: 1
type: AcceptedAnswer
has body: It isn't sufficient for you to instantiate your array, you must also populate it with objects. Otherwise each index contains null by default. private Item[] itemListArray = new Item[30]; for (int i = 0; i &lt; itemListArray.length; i++) { itemListArray[i] = new Item(); }
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/comment/45345586
has text: @KorayTugay it translates to: `ajax = ajax || executeBooleanJavascript(input, JS_JQUERY_ACTIVE);`
comment on: http://stackoverflow.com/a/23300127
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/23324189
favorite count: 0
has title: Anonymous object and Garbage Collection in Java
has comment: http://stackoverflow.com/comment/35712405
has body: My question is: When is an anonymous object swept by the garbage collector in Java? The code is: class Test extends Thread { Test(){} public void run() { for(int i=0;i&lt;4;i++) System.out.println(this.getName()+"i="+i); } protected void finalize() { System.out.println("Finalized"); } public static void main(String args[]) { new Test().start(); } } From what I know about Java, any unreferenced object is swept by the GC. But there is no object reference here. Although the garbage collection process cannot be predetermined, but, still, when would the GC be "probably" done?
answer count: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23324363
has comment: http://stackoverflow.com/comment/35712479
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/35712433
tagged with: garbage-collection
has answer: http://stackoverflow.com/a/23324212
accepted answer: http://stackoverflow.com/a/23324212
has comment: http://stackoverflow.com/comment/35712484
type: Question
linked to: http://stackoverflow.com/q/2506488
score: 3
has comment: http://stackoverflow.com/comment/35712413
has comment: http://stackoverflow.com/comment/35732300
has answer: http://stackoverflow.com/a/23324222
has comment: http://stackoverflow.com/comment/35712482
possible better answer: http://stackoverflow.com/a/23324363
downvote count: 0
has comment: http://stackoverflow.com/comment/35712382
has answer: http://stackoverflow.com/a/23324232

http://stackoverflow.com/comment/35816320
type: Comment
comment on: http://stackoverflow.com/a/23367008
has text: Please understand the difference between your class `SList` (representing the entire List) and your class `SListNode` (representing the elements your list contains of. Every Node has a **payload** (i.e. data) and a **successor**). *Please do not forget to rate and accept my answer*.
type: AnswerComment
score: 0

http://stackoverflow.com/a/23451251
upvote count: 1
type: AcceptedAnswer
type: Answer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23451050
answers question: http://stackoverflow.com/q/23451050
score: 1
has body: Issue seems to be due to the ListView recycle. ListView will try to reuse the same view for the items. So in your case , newView is called for first 6 visible items and when you scroll ListView resizes the same 6 items views for the next 6 item in the list. You need to update the ListView, that you have 2 different item view, so that it know your last item views is different from others You need to override the getViewTypeCount and return that you have 2 different view @Override public int getViewTypeCount() { return 2; // return the view type } Also, override getItemViewType and inform ListView that the last position view is the one different. Override public int getItemViewType(int position){ int beforeLast = GameData.totalPlayers-1; // return a unique number if(beforeLast == position) { return 1; // some unique id }else { return 0; } }

oop
tags question: http://stackoverflow.com/q/23372121
tags question: http://stackoverflow.com/q/23446084
tags question: http://stackoverflow.com/q/23429937
tags question: http://stackoverflow.com/q/23318415
tags question: http://stackoverflow.com/q/23420403
tags question: http://stackoverflow.com/q/23316816
tag name: oop
tags question: http://stackoverflow.com/q/23412650
tags question: http://stackoverflow.com/q/23302920
tags question: http://stackoverflow.com/q/23367491
tags question: http://stackoverflow.com/q/23362900
tags question: http://stackoverflow.com/q/23380625
tags question: http://stackoverflow.com/q/23429380
tags question: http://stackoverflow.com/q/23380297
tags question: http://stackoverflow.com/q/23336485
tags question: http://stackoverflow.com/q/23336138
tags question: http://stackoverflow.com/q/23324731
tags question: http://stackoverflow.com/q/23360079
tags question: http://stackoverflow.com/q/23346662
tags question: http://stackoverflow.com/q/23432722
tags question: http://stackoverflow.com/q/23413590
tags question: http://stackoverflow.com/q/23438546
tags question: http://stackoverflow.com/q/23406307
tags question: http://stackoverflow.com/q/23313365
tags question: http://stackoverflow.com/q/23449491
tags question: http://stackoverflow.com/q/23333062
tags question: http://stackoverflow.com/q/23444659
tags question: http://stackoverflow.com/q/23298147
tags question: http://stackoverflow.com/q/23451825
tags question: http://stackoverflow.com/q/23413836
tags question: http://stackoverflow.com/q/23358399
type: Tag
tags question: http://stackoverflow.com/q/23339799
tags question: http://stackoverflow.com/q/23348539
tags question: http://stackoverflow.com/q/23328794
tags question: http://stackoverflow.com/q/23295830

http://stackoverflow.com/comment/53464328
has text: 'Polymorphism uses automatic downcast during method calls.' No it doesn't. The mechanism used isn't specified, but the most usual mechanism -a vtable - does no such thing. Look in the object code. No downcast.
comment on: http://stackoverflow.com/a/32813618
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/35757203
has text: @niiraj874u: thanks for pointing that out. java is so verbose for that sort of simple things...
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/23348416

http://stackoverflow.com/q/23437730
has body: I have a LinearLayout that is supposed to show vertically an image and 3 Buttons. However, as soon as I put the image, I can't see the buttons. Is there a logical reason for this behavior ? <ImageView android:scaleType="fitStart" android:maxHeight="40dp" android:layout_height="wrap_content" android:layout_width="wrap_content" android:src="@drawable/logooutlast" />
tagged with: imageview
score: -2
has comment: http://stackoverflow.com/comment/35923263
has title: Buttons do not appear with the ImageView
downvote count: 2
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/23437788
tagged with: android
has answer: http://stackoverflow.com/a/23437788
type: AnsweredQuestion
upvote count: 0
has comment: http://stackoverflow.com/comment/35923081
tagged with: java
tagged with: android-linearlayout
type: Question
has comment: http://stackoverflow.com/comment/35923329

http://stackoverflow.com/q/23296462
score: 0
has comment: http://stackoverflow.com/comment/35667178
has comment: http://stackoverflow.com/comment/35662368
linked to: http://stackoverflow.com/q/20600721
answer count: 0
type: UnansweredQuestion
tagged with: swing
tagged with: java
has body: I want to create a swing worker that copies file and shows the progress in a progress bar. SIt all works fine except the process() function although I copied paste the code I found in a blog - I don't remember the link to show you, I get compilation errors. Here is my code: class Copy extends SwingWorker&lt;Void, Void&gt; { File src,dest; InputStream in; OutputStream out; JProgressBar bar; public Copy(File source,File dst) { src=source; dest=dst; //bar=Br; progressBar.setValue(0); } public Copy(MouseAdapter mouseAdapter) { // TODO Auto-generated constructor stub } protected Void doInBackground() throws Exception { System.out.print("Started\n"); InputStream input = null; OutputStream output = null; try { input = new FileInputStream(src); output = new FileOutputStream(dest); byte[] buf = new byte[1024]; int bytesRead; while ((bytesRead = input.read(buf)) &gt; 0) { output.write(buf, 0, bytesRead); } } finally { input.close(); output.close(); } progressBar.setVisible(true); return null; } //Here I get the error: @Override //Description Resource Path Location Type //The method process() of type Main.Copy must override or implement a supertype method protected Void process() { long expectedBytes = src.length(); // This is the numbe r of bytes we expected to copy.. byte[] buffer = new byte[1024]; int length; long totalBytesCopied = 0; // This will track the total number of bytes we've copied try { while ((length = in.read(buffer)) &gt; 0){ out.write(buffer, 0, length); totalBytesCopied += length; int progress = (int)Math.round(((double)totalBytesCopied / (double)expectedBytes) * 100); System.out.print(progress); progressBar.setValue(progress); } } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } // return progress; } protected void done() { System.out.print("Complete\n"); } } } I cannot understand what I am doing wrong so a little help would be appreciated. Also what is the difference between Void e.g protected Void doInBackground() and voi…
type: Question
has title: Swing Worker wont start copy files

http://stackoverflow.com/comment/35734970
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23324514
has text: @BasilBourque Sorry, I meant "cycle". I fixed the issue. Anyway, I was looking for a better solution because my example code is too complicated, I know (and doesn't works)...

http://stackoverflow.com/q/23380695
answer count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/35816364
has title: Auto Value change in jsp value
has comment: http://stackoverflow.com/comment/35816299
tagged with: javascript
tagged with: jquery
accepted answer: http://stackoverflow.com/a/23380994
has comment: http://stackoverflow.com/comment/35816285
has body: I am developing an application on jsp. I need to change content of HTML table in jsp page for every x seconds. I am done with all the other functionalities except this one. Can someone provide some help on this. Here is my code Auto.jsp <% int a=10; int b=20; int c=30; %> Thanks $(document).ready(function() { var count=0; function change(){ $('.change').text(count++)..load('Auto.jsp').fadeIn("slow");; setTimeout(change,10000); } $('.change').click(function() change(); }); Change
type: AnsweredQuestion
upvote count: 0
has comment: http://stackoverflow.com/comment/35816322
tagged with: jsp
favorite count: 0
tagged with: ajax
type: Question
has comment: http://stackoverflow.com/comment/35816394
score: -1
has answer: http://stackoverflow.com/a/23380994
has comment: http://stackoverflow.com/comment/35816306
tagged with: java

http://stackoverflow.com/comment/35937152
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23444632
has text: Ok, so I've tried that before (Keybindings), It didn't work so I guess I'll ask a bit more here? If that's okay with you.
score: 0

http://stackoverflow.com/q/23395263
type: AnsweredQuestion
tagged with: types
score: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/23395364
type: Question
upvote count: 2
answer count: 1
downvote count: 1
has body: I am using a JDBC query that returns output as following: Name Id A 1 B 2 Then I am trying to generate an arrylist based on the query result using the following java class: private class GetCompanyInfo implements Work { ArrayList&lt;CompanyRelatedInfo&gt; companyRelatedDataList = new ArrayList&lt;CompanyRelatedInfo&gt;(); private String queryString; @Override public void execute(Connection connection) throws SQLException { PreparedStatement ps = connection.prepareStatement(queryString); ResultSet rs = ps.executeQuery(); CompanyRelatedInfo ci = new CompanyRelatedInfo(); while(rs.next()) { String name = rs.getString("name"); Long id = rs.getLong("id"); ci.setName(name); ci.setId(id); companyRelatedDataList.add(ci); } rs.close(); ps.close(); } } But the problem is the arraylist returns results as following: Name Id B 2 B 2 How can I generate the arraylist as following: Name Id A 1 B 2
tagged with: java
has title: How to create an arraylist class that can store multiple data type objects in java
has answer: http://stackoverflow.com/a/23395364
tagged with: arraylist

http://stackoverflow.com/comment/35905831
score: 0
type: Comment
has text: Thanks for the answer. So I need to get a 3rd party jdbc-odbc driver basically. By the way, do you think using a earlier Java version where i can use the built-in driver is worth it or will i lose key/special features from this new versions? At the end my project needs to query a .accdb file and return the results through a REST API (probably to be developed in Jersey).
comment on: http://stackoverflow.com/a/23428817
type: AnswerComment

http://stackoverflow.com/comment/57836468
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23385553
type: AnswerComment
has text: I tried to convert 5/11/1394 to gregorian using YearMonthDate.jalaliToGregorian and the conversion is wrong. Instead of 25/01/2016 it returns 24/01/2016.

http://stackoverflow.com/q/23384013
score: 0
answer count: 2
tagged with: parsing
tagged with: token
tagged with: regex
has title: Resolving JavaCC token ambiguity
type: AnsweredQuestion
tagged with: javacc
has answer: http://stackoverflow.com/a/23389456
tagged with: java
has body: I'm trying to parse regular expressions using JavaCC but I encountered a problem with integers. The problem is that sometimes, in some productions, I want to interpret a set of numbers as a character each, however, on something like (ab){1,20} I want to interpret the numbers inside the braces as integers. The problem is that JavaCC is choosing the first token that matches in the list, regardless of if that token is expected in the production or not. I have a token DIGIT and a token INTEGER defined as one or more DIGITs. If I prioritize DIGIT, it will never choose INTEGER, if I prioritize INTEGER, in the productions where I want to interpret digits one by one it will choose INTEGER. I also tried to define something like (&lt; DIGIT >)+ in the production expecting an integer, but then I don't know how to assign that to a Token. Is there a way to assign the whole sequence to a single token, or at least append each digit to the image of one token or store an array of tokens?
type: Question
has answer: http://stackoverflow.com/a/23385529
possible better answer: http://stackoverflow.com/a/23385529
accepted answer: http://stackoverflow.com/a/23389456

http://stackoverflow.com/comment/35865087
type: QuestionComment
has text: I've flaged it because I cannot delete the question, apologizes @l4mpi
score: 0
comment on: http://stackoverflow.com/q/23406377
type: Comment

serialization
tags question: http://stackoverflow.com/q/23331400
tags question: http://stackoverflow.com/q/23371941
tags question: http://stackoverflow.com/q/23363804
tags question: http://stackoverflow.com/q/23360997
tags question: http://stackoverflow.com/q/23351748
tags question: http://stackoverflow.com/q/23344915
tags question: http://stackoverflow.com/q/23431051
tag name: serialization
tags question: http://stackoverflow.com/q/23430934
tags question: http://stackoverflow.com/q/23303616
tags question: http://stackoverflow.com/q/23350018
tags question: http://stackoverflow.com/q/23394760
tags question: http://stackoverflow.com/q/23346567
tags question: http://stackoverflow.com/q/23433901
type: Tag
tags question: http://stackoverflow.com/q/23377464
tags question: http://stackoverflow.com/q/23409797
tags question: http://stackoverflow.com/q/23444132
tags question: http://stackoverflow.com/q/23343757
tags question: http://stackoverflow.com/q/23385927
tags question: http://stackoverflow.com/q/23342229
tags question: http://stackoverflow.com/q/23297402
tags question: http://stackoverflow.com/q/23443007
tags question: http://stackoverflow.com/q/23396321
tags question: http://stackoverflow.com/q/23434625
tags question: http://stackoverflow.com/q/23374392
tags question: http://stackoverflow.com/q/23368014
tags question: http://stackoverflow.com/q/23391101
tags question: http://stackoverflow.com/q/23383121
tags question: http://stackoverflow.com/q/23305166
tags question: http://stackoverflow.com/q/23450771

http://stackoverflow.com/comment/35767531
has text: Thanks a lot man! That cleared things up.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23353965
score: 0

http://stackoverflow.com/comment/35715187
type: Comment
has text: sorry sir but could you please give me a code example
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23325121

http://stackoverflow.com/a/23372104
answers question: http://stackoverflow.com/q/23371592
has comment: http://stackoverflow.com/comment/35839147
has body: How about this? public List&lt;Book&gt; searchBook(String Author2){ List&lt;Book&gt; kopia = new ArrayList &lt;Book&gt;(); for(Book book : reg){ if(book.getAuthor().equalsIgnoreCase(Author2) || book.getTitle().toLowerCase().indexOf(Author2.toLowerCase()) != -1){ kopia.add(book); } } return kopia; } This is just to keep it simple. You can use regex as well.
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/35840875

http://stackoverflow.com/q/23419112
type: Question
has body: I am trying to set up GCM but my project doesn't recognize certain methods. I followed the advice of many other links which was to import GCM and google play services but I am still getting no such luck. Thanks for looking. Edit: I've cleaned a million times and rebuilt.
score: 0
answer count: 1
tagged with: android
tagged with: google-cloud-messaging
has title: GCM sendRegistrationIdToBackend is undefined
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23419200
accepted answer: http://stackoverflow.com/a/23419200
tagged with: java

http://stackoverflow.com/q/23399719
tagged with: android-studio
tagged with: java
tagged with: import
type: Question
tagged with: project
has body: I have imported an Android Studio project as a library for another of my projects. My original question for that is here. It worked excellently for a while, until today. Today I finished updating my library (in its own project) and copied the new files over. I edited the settings.gradle and build.gradle files as I did before but I am getting the error: Project with path 'Eed:libraries:Overt:Util' could not be found in project ':CES'. The library's original project is structured like this: Overt/ + Visible/ + Control/ + CES/ + Util/ In that project, CES is dependent upon Util dependencies { compile 'com.android.support:appcompat-v7:19.+' compile fileTree(dir: 'libs', include: ['*.jar']) compile project(':Util') } When I copied the new version of Overt over I modified the project level settings.gradle and module level build.gradle. Structure: Eed/ Eed/ libraries/ Overt/ + Visible/ + Control/ + CES/ + Util/ settings.gradle include ':Eed' include ':Eed:libraries:Overt:Visible' include ':Eed:libraries:Overt:Control' include ':Eed:libraries:Overt:Util' include ':Eed:libraries:Overt:CES' and build.gradle (Eed module) dependencies { compile 'com.android.support:appcompat-v7:+' compile fileTree(dir: 'libs', include: ['*.jar']) compile project('libraries:Overt:Visible') compile project('libraries:Overt:Control') compile project('libraries:Overt:Util') compile project('libraries:Overt:CES') } I have played with modifying the build.gradle in CES but cannot figure out a solution. What am I doing wrong?
has title: Android studio library project dependencies
score: 0
answer count: 1
linked to: http://stackoverflow.com/q/20128416
linked to: http://stackoverflow.com/q/23236493
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/23400156

http://stackoverflow.com/a/23302264
type: Answer
has comment: http://stackoverflow.com/comment/35673212
has body: I think there are two problems in your code. At first the two inner classes in your Component are not used. So if you click the buttons nothing would happen, because they are not linked to any code. I would suggest to add an ActionListener to your buttons: JButton moveButton = new JButton("Move"); moveButton.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ testBug.move(); repaint(); } }); JButton turnButton = new JButton("Turn"); turnButton.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ testBug.turn(); repaint(); } }); I already added repaint(). The bug starts moving then.
answers question: http://stackoverflow.com/q/23301617
score: 0
accepted answer of: http://stackoverflow.com/q/23301617
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35673877

http://stackoverflow.com/a/23346141
type: AcceptedAnswer
downvote count: 0
has body: Your regex is OK. What you need to do is cycle through the matches, a Matcher can match several times! while (m.find()) System.out.println(m.group(1)); A Matcher will try again from the end of the last match (unless you use \G but that's pretty special)
type: Answer
upvote count: 6
score: 6
accepted answer of: http://stackoverflow.com/q/23346119
answers question: http://stackoverflow.com/q/23346119
has comment: http://stackoverflow.com/comment/35752480

http://stackoverflow.com/a/23304297
has body: From the JSON Schema the MAC Address looks like an Array of String. However if you have a Class structure defined on the server , you can use that for converting the JSON into an object.
answers question: http://stackoverflow.com/q/23304253
score: 0
type: Answer

size
type: Tag
tags question: http://stackoverflow.com/q/23318443
tag name: size
tags question: http://stackoverflow.com/q/23359868

http://stackoverflow.com/q/23395774
favorite count: 0
tagged with: instanceof
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35844375
has comment: http://stackoverflow.com/comment/35844553
has title: usage of instanceof vs adding isSomething() to base-class
tagged with: reflection
score: 1
has answer: http://stackoverflow.com/a/23396212
tagged with: java
has answer: http://stackoverflow.com/a/23395901
type: Question
has comment: http://stackoverflow.com/comment/35844524
has answer: http://stackoverflow.com/a/23395893
linked to: http://stackoverflow.com/q/103564
has comment: http://stackoverflow.com/comment/35844617
answer count: 3
has comment: http://stackoverflow.com/comment/35844416
has body: Say I have this class hierarchy: Animal &lt;-- FourLegged &lt;-- Dog Animal &lt;-- FourLegged &lt;-- .... Animal &lt;-- ThreeLegged &lt;-- ... (what has 3 legs?) Animal &lt;-- TwoLegged &lt;-- Chicken Animal &lt;-- TwoLegged &lt;-- ... (Forgot what the scientific terms for four-legged and two-legged animals are. But that's beside point, right? :) ) If I have an Animal object, and I need to know whether it is a FourLegged or if it is a TwoLegged, I would normally do animalObject instanceof FourLegged. Is that slower than adding a bunch of isFourLegged(), isThreeLegged(), isTwoLegged(), to Animal class? (I would like to know the performance impact. This is NOT a design exercise. So I would appreciate it if you won't be wasting time suggesting how to re-write the class) Edit Some people have suggested adding 'getNumberOfLegs()", which is perfectly reasonably given this specific example. But suppose the point is NOT to have the number of legs, but to get what type of animal this is.
has comment: http://stackoverflow.com/comment/35844410
upvote count: 1
downvote count: 0

http://stackoverflow.com/comment/35933651
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23443349
type: Comment
has text: I should also point out that your equals function won't always be used (e.g. if put in a Set or Map), because it should take an Object not a Degree (use the @Override annotation on it and you will be warned about this). Also I'd strongly recommend making the class immutable (make degreeFloat final and remove setters), which will make it much safer to use as a type inside other objects (can't be changed externally so doesn't need protective copies made). Sorry to throw such a list at you but these are common pitfalls which I think it's worth being aware of!

http://stackoverflow.com/a/23330110
score: 2
has comment: http://stackoverflow.com/comment/35723681
has comment: http://stackoverflow.com/comment/35723907
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23329933
upvote count: 2
has body: Luiggi is correct in the comments, the stacktrace provides all the info you need about the error. Particularly this line: 22:34:29.617: E/AndroidRuntime(382): Caused by: java.lang.ClassCastException: android.widget.ImageButton cannot be cast to android.widget.Button Somewhere in your OnCreate method you are trying to cast an ImageButton as a Button, this is invalid. According to the Android Developer Docs, ImageButton extends ImageView, not Button. Thus, a ClassCastException is being thrown because you are trying to turn one thing into something that it is not. Take a look at your activity_quiz.xml file and see which view is an ImageButton. You'll need to update its type in your activity to ImageButton to fix this issue. Good luck with Android Development, it can be pretty fun! :)
has comment: http://stackoverflow.com/comment/35723830
accepted answer of: http://stackoverflow.com/q/23329933
type: Answer

http://stackoverflow.com/q/23384004
has comment: http://stackoverflow.com/comment/35824407
upvote count: 1
type: Question
has title: BindingResult doesn't work after change ModelAttribute name
tagged with: java
answer count: 1
downvote count: 0
favorite count: 0
has body: When using default ObjectName like this: model.addAttribute(myObject); BindingResult will bind the error result to the corresponding input path, with its object name as myObject. But if I'm using a new name for my object like this: model.addAttribute("newObjectName",myObject); BindingResult will still set its object name as myObject, rather than "newObjectName", and the result error won't be binded. So, is there any way to make BindingResult work without changing model object name to default? My Controller @RequestMapping(value="unit/unitAdd.do", method=RequestMethod.POST) public final String saveUnitAdd(@Valid PmiUnit pmiUnit,Model model,BindingResult bindingResult,HttpServletRequest httpServletRequest, HttpSession session){ logger.info("saveAddUnit called!"); boolean exists = unitService.isAlreadyExists("pmi_units", "uni_unit_name_pk",pmiUnit.getUniUnitNamePk()); if (exists) { //exists and without state DEL, return exists error logger.info("Unit Name_PK exists"); if(!unitService.isExistsAndDeleted("pmi_units", "uni_unit_name_pk",pmiUnit.getUniUnitNamePk())){ System.out.println("exists and not deleted"); bindingResult.rejectValue("uniUnitNamePk", "pmi.validator.constraints.unique");} //exists but with state DEL, update this row else{ unitService.updateDeletedUnit(pmiUnit); mainService.getDefaultPmiUnit(pmiUnit, model); httpServletRequest.setAttribute("fromAddUnit", "true"); httpServletRequest.setAttribute("addResult", "true"); model.addAttribute("pmiUnit",pmiUnit); return "accessControl1/unit/unitManage"; } } //if has errors, return the same page if (bindingResult.hasErrors()) { model.addAttribute("pmiUnit",pmiUnit); return "accessControl1/unit/unitAdd"; } The JSP part &lt;form:form method="POST" id="pmiAddUnit" name="pmiAddUnit" modelAttribute="pmiUnit" enctype="multipart/form-data" action="unitAdd.do"&gt; ... &lt;table&gt; &lt;tr&gt; &lt;td align="left"&gt;&lt;form:input id="uniUnitNamePk" name="uniUnitNamePk" path="uniUnitNamePk" class="margin-right-ten" /&gt;&l…
has answer: http://stackoverflow.com/a/23386324
tagged with: spring
accepted answer: http://stackoverflow.com/a/23386324
tagged with: spring-mvc
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35825635
score: 1

http://stackoverflow.com/a/23399810
has comment: http://stackoverflow.com/comment/35851972
has comment: http://stackoverflow.com/comment/35852018
has body: An event handler (mousePressed) souldn't take a long time to complete, there should be no sleeps in it. As long as it runs (or sleeps), nothing else can happen. The runtime is waiting for the handler to return and displays the image after that. I would move most of the code to a function called by a timer, and use a state variable to keep track of how intensely the wheels are spinning.
score: 0
has comment: http://stackoverflow.com/comment/36296348
answers question: http://stackoverflow.com/q/23399692
type: Answer
has comment: http://stackoverflow.com/comment/35852030
has comment: http://stackoverflow.com/comment/35853839
has comment: http://stackoverflow.com/comment/35851920
has comment: http://stackoverflow.com/comment/35852668
has comment: http://stackoverflow.com/comment/35852125

http://stackoverflow.com/a/23341323
has comment: http://stackoverflow.com/comment/78729546
type: Answer
has comment: http://stackoverflow.com/comment/35743788
has body: Use the count(int resultCount) method : Query query = new Query("ipl7"); query.count(100); //100 is the max allowed QueryResult result = twitter.search(query);
answers question: http://stackoverflow.com/q/23341215
score: 0

http://stackoverflow.com/comment/35829005
type: Comment
has text: omg. i am a blind mole. just did a code without method calls... and it totally works! ok, it seems to be a mistake just in my method call, but it is already easier to find. thank You very-very much for being so patient with me!
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/23352795

http://stackoverflow.com/q/23313365
has comment: http://stackoverflow.com/comment/35693293
has body: I have a base Java class, which has two similar methods: class Base { public void processA(SomeClass sc, Args args); public void processB(AnotherClass ac, Args argc); } I would like to create a descendant, which must implement at least one of these two methods of the Base class. For instance, I consider following variants are correct ("good"): class ChildA extends Base { public void processA(SomeClass sc, Args args); } class ChildB extends Base { public void processB(AnotherClass ac, Args args); } But the following variant is wrong (let's call it "bad"): class ChildC extends Base { /* nothing here */ } So the question is how methods process{A,B} must be implemented/designated to allow detection of such "bad" and "good" implementation of the childs at compile time? Now I'm using run-time detection like this: class Base { public void processA(SomeClass sc, Args args) { throw new NullPointerException("Hey, buddy, you forget to implement this, but calling it."); } public void processB(AnotherClass ac, Args argc) { throw new NullPointerException("Hey, buddy, you forget to implement this, but calling it."); } } Maybe there is another good approach to do this?
has title: How to ensure that at least one of two methods in Java class is overridden?
favorite count: 0
accepted answer: http://stackoverflow.com/a/23316041
upvote count: 1
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35692564
tagged with: oop
has answer: http://stackoverflow.com/a/23315201
score: 1
tagged with: java
type: Question
possible better answer: http://stackoverflow.com/a/23315201
answer count: 2
has answer: http://stackoverflow.com/a/23316041
downvote count: 0
tagged with: inheritance

http://stackoverflow.com/q/23296770
type: UnansweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/23297012
type: Question
has comment: http://stackoverflow.com/comment/35663170
has answer: http://stackoverflow.com/a/23300096
has answer: http://stackoverflow.com/a/23299849
has title: Google MAP V2 - Map Not Showing On Real Phone
score: 0
answer count: 3
has body: I've implemented Google Maps v2 on my emulator, it works fine and displays but I need to test this on an android phone however the map just displays with a blank white screen with zoom buttons. I'm using the debug API key, i don't want to generate a release key just yet, can I still test my maps on a real phone with a debug API key? If not where can I find the *.keystroke file required to enable me to generate a release key?
tagged with: android
has comment: http://stackoverflow.com/comment/35663370
has comment: http://stackoverflow.com/comment/35663156

http://stackoverflow.com/q/23333518
favorite count: 0
has comment: http://stackoverflow.com/comment/35730368
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23333586
linked to: http://stackoverflow.com/q/15730619
has comment: http://stackoverflow.com/comment/35729860
has comment: http://stackoverflow.com/comment/35729831
has title: ".bat" file wont open in JAVA
linked to: http://stackoverflow.com/q/615948
linked to: http://stackoverflow.com/q/19103570
has answer: http://stackoverflow.com/a/23333622
tagged with: java
downvote count: 1
type: Question
has body: Lets suppose I have a listener for a Button public class Visualizer1 implements ActionListener { public void actionPerformed(ActionEvent a) { try { Runtime rt2 = Runtime.getRuntime(); Process p = rt2.exec("visualizer/vis1.exe"); InputStream in = p.getInputStream(); OutputStream out = p.getOutputStream(); InputStream err = p.getErrorStream(); p.destroy(); } catch (Exception exc) {/* handle exception */ } the "vis1.exe" will execute without any problem and it will open up but if I have an application with a ".bat" extension like if it was(vis1.bat), it won't open up. Note: .bat extension is an executable file
score: -1
answer count: 3
duplicate of: http://stackoverflow.com/q/615948
upvote count: 0
linked to: http://stackoverflow.com/q/1421143
has answer: http://stackoverflow.com/a/23333625

dto
tags question: http://stackoverflow.com/q/23308241
tag name: dto
type: Tag

http://stackoverflow.com/a/23305291
answers question: http://stackoverflow.com/q/23305252
has comment: http://stackoverflow.com/comment/35678274
has comment: http://stackoverflow.com/comment/35678338
has body: String[] rowData = new String[5]; // edited out of original post rowData = scan.next().split(":"); The first statement allocates an array of 5 Strings and sets them all to null. The second statement just throws away the array you just allocated. The result of split will return an array of however many items it finds, and then you assign rowData, which is a reference to an array, to a reference to the new array. The old one gets garbage collected. So there's no guarantee that rowData will have 5 elements after this assignment. You'll have to decide what you want to do if the split doesn't return enough array elements. You could use something like Arrays.copyOf that could put the split result into some of the rowData elements while leaving the rest alone, but then the unassigned elements will still be null, and you'll just get a NullPointerException a few lines later. So you have some design decisions to make here. More: You may want to consider using the Scanner method nextLine() instead of next(). next() will return just one token, which means it will stop at a space character, which means you will have problems if someone is named "Mary Beth" or something like that.
has comment: http://stackoverflow.com/comment/35678282
score: 0
has comment: http://stackoverflow.com/comment/35681035
type: Answer

http://stackoverflow.com/q/23420506
downvote count: 1
type: Question
tagged with: java
has title: Move pieces on the board at random chess programming
score: -1
answer count: 1
favorite count: 0
has body: I am creating a chess program whereby computer plays against human, but for now I just simply want the computer to move pieces on the board at random after I have moved a piece as human. Everything seems to be working fine, but computer won't move piece on the board except I click the file menu which the click command for action performed is initiated. So I have to always click before computer moves piece at random on the board. But I want it to be "automatic". I am doing it like this; if (command == "1") { while(!gameover) { if (board.getTurn()) { //computer turn List&lt;Map.Entry&lt;Location, ArrayList&lt;Location&gt;&gt;&gt; whitemovelist = new ArrayList&lt;Map.Entry&lt;Location, ArrayList&lt;Location&gt;&gt;&gt;(whitemap.entrySet()); Collections.shuffle(whitemovelist); System.out.println("White turn"); for (Map.Entry&lt;Location, ArrayList&lt;Location&gt;&gt; entry : whitemovelist) { if(entry.getValue().size() != 0) { for (int i = 0; i &lt; entry.getValue().size(); i++) { System.out.println(entry.getKey() + " :: " + entry.getValue().get(i)); from = entry.getKey(); to = entry.getValue().get(i); } } } processOne(from); movePiece(to); System.out.println("Take piece " +board.takenPiece); } } }
has answer: http://stackoverflow.com/a/23420582
has comment: http://stackoverflow.com/comment/35891040
upvote count: 0
type: UnansweredQuestion

itext
tags question: http://stackoverflow.com/q/23450547
tags question: http://stackoverflow.com/q/23423479
tags question: http://stackoverflow.com/q/23362646
tags question: http://stackoverflow.com/q/23314111
tags question: http://stackoverflow.com/q/23422471
tag name: itext
tags question: http://stackoverflow.com/q/23390011
tags question: http://stackoverflow.com/q/23423211
tags question: http://stackoverflow.com/q/23381148
type: Tag
tags question: http://stackoverflow.com/q/23384348

http://stackoverflow.com/comment/35923173
type: Comment
type: QuestionComment
has text: @ewbrowning It seems that you don't know how `Arrays.sort` works. Why are you doing `Arrays.sort(authorArray[x].getAuthor())`? What's your goal when doing this?
score: 1
comment on: http://stackoverflow.com/q/23437722

http://stackoverflow.com/comment/46733534
type: Comment
type: AnswerComment
has text: You can find this post useful too: https://github.com/couchbase/couchbase-lite-android/issues/346
comment on: http://stackoverflow.com/a/29265830
score: 0

http://stackoverflow.com/a/26473990
has body: Unfortunately no, but there is a trick. You can define contextual mapping for your Item class: test.ClassA test.ClassB item item test.ItemA test.ItemB subItem subItem
upvote count: 3
answers question: http://stackoverflow.com/q/23309642
type: Answer
score: 3
downvote count: 0

http://stackoverflow.com/comment/35719688
score: 0
type: AnswerComment
type: Comment
has text: It doesn't matter it still does the same thing
comment on: http://stackoverflow.com/a/23327831

http://stackoverflow.com/comment/35838581
comment on: http://stackoverflow.com/q/23392240
has text: So you will have one Completion Service, which can accept multiple request and submit . In another thread you are processing them in sequence way ( by calling get() - get() will wait the current thread until the job got complete). Are your try to reinvent JMS ?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35858867
type: Comment
comment on: http://stackoverflow.com/a/23401990
has text: Actually it appears to be working fine... for any colour but white, which was unfortunately the only colour I tested...
type: AnswerComment
score: 0

http://stackoverflow.com/a/23451727
accepted answer of: http://stackoverflow.com/q/23417699
score: 2
has body: I don't know of a way to magically create a read only user. However, you can create a role such as ROLE_UPDATE and make all of your methods that perform creates/updates/deletes be secured via @Secured("ROLE_UPDATE"). Then, if a user is not granted the ROLE_UPDATE authority, they will not be able to call any of the 'writing' methods, and therefore it will be restricted to only call 'read' methods.
answers question: http://stackoverflow.com/q/23417699
type: AcceptedAnswer
downvote count: 0
upvote count: 2
type: Answer

http://stackoverflow.com/comment/35761515
type: Comment
has text: good thing: after you are done with reading, close reader/inputStream by calling `close`
comment on: http://stackoverflow.com/q/23350721
score: 4
type: QuestionComment

http://stackoverflow.com/q/23431676
has title: How to test Handler callbacks from a Service in an Android JUnit Test?
tagged with: android
score: 2
has comment: http://stackoverflow.com/comment/37182298
downvote count: 0
tagged with: unit-testing
has answer: http://stackoverflow.com/a/23477437
accepted answer: http://stackoverflow.com/a/23477437
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/46928504
tagged with: java
possible better answer: http://stackoverflow.com/a/46928504
type: Question
upvote count: 2
answer count: 2
tagged with: handler
tagged with: junit
has body: I want to test the following (standard?) scenario An activity uses a Service object to do some stuff. The Service is bind to the activity with bindService(..). The service itself allows access via a Binder that it returns in onBind() that gives access to the service object itself (everything happens on the same thread here). In onServiceConnected(..) the activity gets access to the service via the Binder and hands the Service a Handler object to send Messages to the activity. So the communication is: Activity -> Service via direct calls on Service. And Service -> Activity via Handler object injected from Activity into Service This scenario works fine. No problems in the App. But now I also want to write automated Unit Tests and I run into the problem, that the handler does not seem to send and process the messages any more. I wrote an Android JUnit Test like this public class EpcServiceMockTest extends ServiceTestCase&lt;EpcServiceMock&gt; {...} With a test method like this public void testConnectToDevice() { Intent serviceIntent = new Intent(getContext(), EpcServiceMock.class); IBinder binder = bindService(serviceIntent); EpcServiceHandlerMock mockHandler = new EpcServiceHandlerMock(this); EpcServiceMock service = (EpcServiceMock) ((EpcServiceBase.LocalBinder) binder).getService(mockHandler); service.doSomething(..); This set-up works fine. The service runs and does execute the called methods. BUT everytime the handler is used to send messages, the messages are never executed. i.e. handleMessage() is never called on the Handler. Message callbackMsg = mCallbackHandler.obtainMessage(CB_CONNECT_TO_NULL_DEVICE, mDevice); mCallbackHandler.sendMessage(callbackMsg); This code is called. The Handler mCallbackHandler is the correct type. No errors. Just nothing happens. No call to handleMessage() in the Handler. First I thought there is a race condition, because the Looper is on another thread. So I let the test case sleep for a while: (..) service.doSomething(..); Thread.s…
favorite count: 0

http://stackoverflow.com/comment/35675158
type: Comment
type: QuestionComment
has text: @nKn there you go, sorry for the delay.
score: 0
comment on: http://stackoverflow.com/q/23302668

http://stackoverflow.com/q/23317510
type: UnansweredQuestion
score: 6
upvote count: 6
has answer: http://stackoverflow.com/a/36143893
has body: Please note, SOAPHeader is extends Node and Element interfaces: Document docToAppend= getDoc(); final SOAPHeader soapHeader = getSoapHeader(); final Node importNode = soapHeader.getOwnerDocument().importNode(docToAppend.cloneNode(true), true); soapHeader.appendChild(importNode); i.e. i want to append docToAppendto soapHeader node. But it fails with exception: Caused by: org.w3c.dom.DOMException: NOT_SUPPORTED_ERR: The implementation does not support the requested type of object or operation. I think my code is incorrect.
tagged with: java
type: Question
answer count: 2
downvote count: 0
has title: How to properly use org.w3c.xml.Document#importNode
has answer: http://stackoverflow.com/a/23357848
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0

http://stackoverflow.com/q/23324199
has answer: http://stackoverflow.com/a/23324440
accepted answer: http://stackoverflow.com/a/23324440
tagged with: classcastexception
tagged with: android
favorite count: 0
score: 2
type: AnsweredQuestion
upvote count: 2
has title: java.lang.ClassCastException while running new `runnableThread` in `Service` Class
type: Question
has body: I have an application , contains a broadcastReceiver which listens to all new received SMS . If any new SMS received this BroadcastReceiver starts a background Service which runs GPS and return the coordinates , this coordinate retrieving needs a new thread to be run , in the Service class there is no getApplicationContext() so I used 'getContentBase()' for starting the new thread this is the code ((Activity)getBaseContext()).runOnUiThread(new Runnable() { ((Activity)getBaseContext()).runOnUiThread(new Runnable() { @Override public void run() { // TODO Auto-generated method stub LocationManager locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE); LocationListener locationListener = new MyLocationListener(); locationManager.requestLocationUpdates( LocationManager.GPS_PROVIDER, 5000, 10, locationListener); } } and I am getting this exception E/AndroidRuntime(24700): java.lang.ClassCastException: android.app.ContextImpl cannot be cast to android.app.Activity this is how the receiver defined in the manifest &lt;receiver android:name=".BroadCastReceiver" android:exported="true" &gt; &lt;intent-filter android:priority="1000" &gt; &lt;action android:name="android.provider.Telephony.SMS_RECEIVED" /&gt; &lt;/intent-filter&gt; &lt;/receiver&gt; and here is how the Service started in the BroadcastReceiver @Override public void onReceive(Context context, Intent intent) { // TODO Auto-generated method stub context.startService(new Intent(con, MyService.class)); } and the exception is at this line ((Activity)getBaseContext()).runOnUiThread(new Runnable() I've searched a lot through the stack and the google as well , non of the answers solved my issue and tried to send the context from the BroadCastReceiver to the Service class , again there was the same Exception , any help??
tagged with: java
tagged with: android-service
tagged with: broadcastreceiver
answer count: 1
downvote count: 0

http://stackoverflow.com/comment/35756746
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23345068
type: QuestionComment
has text: Actually, what you showed is not an affine transform it's a perspective transform. An affine transformation keeps parallel lines parallel. If it helps, OpenCV has some built-in functionality for performing perspective warps.

http://stackoverflow.com/a/32704204
score: 8
has body: With primefaces 5.1 just do this: &lt;p:chart type="line"&gt; Using the new tag, and in the Java code just do this: lineCharModelFinanceiro = new LineChartModel(); lineCharModelFinanceiro.getAxes().put(AxisType.X, new CategoryAxis("Meses")); Axis yAxis = lineCharModelFinanceiro.getAxis(AxisType.Y); yAxis.setTickFormat("%.2f"); yAxis.setLabel("Valor R$"); yAxis.setMin(-1);
downvote count: 0
upvote count: 8
answers question: http://stackoverflow.com/q/23360491
type: Answer

http://stackoverflow.com/comment/35905476
score: 0
type: QuestionComment
type: Comment
has text: for mobile field iam using this <%=request.getAttribute("mobile_No")%> because i have to show the value which is entered in previous page,no need to enter second time
comment on: http://stackoverflow.com/q/23428115

http://stackoverflow.com/comment/35675716
has text: But if you are doing that, you need to remove `pick++;`. ;)
comment on: http://stackoverflow.com/a/23303708
type: AnswerComment
score: 1
type: Comment

http://stackoverflow.com/a/23416534
has body: What you are seeing is the result of the default toString() method being called on an array object. [Ljava.lang.Integer tells you it is an array of Integers and the @7a279c gives you the hex string of the hashcode. Do as ZouZou suggests and use Arrays.toString(unSortedNumbers);
type: Answer
score: 0
answers question: http://stackoverflow.com/q/23416400

dicom
tag name: dicom
type: Tag
tags question: http://stackoverflow.com/q/23307004

http://stackoverflow.com/a/23417253
type: AcceptedAnswer
has body: Two threads can run two different methods at the same time. If you use synchronized it can limit the threads from running the two method at the same time, if you lock the same object. However, if your two method synchronize on different objects, they can still be as concurrent.
accepted answer of: http://stackoverflow.com/q/23417161
answers question: http://stackoverflow.com/q/23417161
type: Answer
score: 0

http://stackoverflow.com/q/23300842
downvote count: 1
has comment: http://stackoverflow.com/comment/35670091
has answer: http://stackoverflow.com/a/23301181
type: Question
has comment: http://stackoverflow.com/comment/35670176
upvote count: 0
has comment: http://stackoverflow.com/comment/35670107
score: -1
has answer: http://stackoverflow.com/a/23301037
has comment: http://stackoverflow.com/comment/35669907
possible better answer: http://stackoverflow.com/a/23300951
has answer: http://stackoverflow.com/a/23300960
has body: public static int countDigitx(int n, int x) { int count = 0; if (n == 0) { count = 1; } else if (n%10 == x) { count++; countDigitx(n+1,x); } return count; } i'm trying to do but i feel this isn't the correct way that i'm doing. because i think my logic isn't correct to find digit at each index.for example if n=23432 and x=4 so the output should be 1.
has answer: http://stackoverflow.com/a/23300951
favorite count: 0
has answer: http://stackoverflow.com/a/23301005
has comment: http://stackoverflow.com/comment/35670057
answer count: 5
has comment: http://stackoverflow.com/comment/35670043
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23300960
tagged with: java
has title: recursive method to find a digit that occur in given number
has comment: http://stackoverflow.com/comment/35670040

http://stackoverflow.com/a/23397758
has comment: http://stackoverflow.com/comment/35848510
answers question: http://stackoverflow.com/q/23397622
has body: double[] results = sum(new double[] {0,1,2}, new double[] {2,2,3});
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/35848430
score: 1
has comment: http://stackoverflow.com/comment/35848884
has comment: http://stackoverflow.com/comment/35848304
downvote count: 0
has comment: http://stackoverflow.com/comment/35848807

http://stackoverflow.com/q/23312800
has body: I'm having some trouble getting my web app to launch on my server. The URL is: http://www.apollowebworks.com/kmsales/ItemSearch.do It used to work fine, and still runs on my local build using Eclipse. I noticed it wasn't working anymore sometime after my hosting provider informed me that they were migrating to a new server. This is the error I'm getting: HTTP Status 404 - /kmsales/ItemSearch.do type Status report message /kmsales/ItemSearch.do description The requested resource is not available. Apache Tomcat/7.0.42 I find it suspicious that it's posting "Apache Tomcat/7.0.42". My host has Tomcat 5.5. I am running it on a 5.5 build locally. I was initially running it on a higher build, and I'm thinking maybe some of my xml files or jars might still reference the wrong Tomcat somehow. I can't find that anywhere though. Any idea where else to look? The libraries I'm using are: javacsv.jar jstl.jar mysql-connector-java-5.1.15-bin.jar standard.jar
tagged with: java
has answer: http://stackoverflow.com/a/23315190
tagged with: tomcat5.5
has comment: http://stackoverflow.com/comment/35693412
linked to: http://stackoverflow.com/q/11731377
score: 0
answer count: 1
duplicate of: http://stackoverflow.com/q/11731377
tagged with: tomcat
type: UnansweredQuestion
tagged with: spring
has title: Tomcat 5.5: The requested resource is not available
type: Question

http://stackoverflow.com/q/23350592
possible better answer: http://stackoverflow.com/a/23362349
has comment: http://stackoverflow.com/comment/35762507
has comment: http://stackoverflow.com/comment/35761355
has comment: http://stackoverflow.com/comment/35761273
has comment: http://stackoverflow.com/comment/35762377
answer count: 4
type: AnsweredQuestion
has title: Comparing a string to a part of string inside an arraylist
has answer: http://stackoverflow.com/a/23350802
has comment: http://stackoverflow.com/comment/35761443
accepted answer: http://stackoverflow.com/a/23350802
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/23362349
has answer: http://stackoverflow.com/a/23350669
has comment: http://stackoverflow.com/comment/35761233
has comment: http://stackoverflow.com/comment/35761702
tagged with: comparison
tagged with: arraylist
score: 0
has body: The title may be a little confusing or misleading but I'm trying to compare a single string: String mystring = "abc"; And then try to compare it with every single string contained in an arraylist ArrayList&lt;String&gt; array = new ArrayList&lt;String&gt;(); array.add("The first letters of the alphabet are abc"); array.add("abc"); array.add("Alphabet"); array.add("Nothing"); But (and I'm not certain) it seems that contains is true only if both strings matches and not if the word or phrase is inside the string. How can I compare a desired string to a "phrase" that is within an ArrayList of strings?
tagged with: string
has answer: http://stackoverflow.com/a/23350650

http://stackoverflow.com/q/23408937
type: Question
tagged with: hadoop
has title: Test if Hadoop is correctly working
has answer: http://stackoverflow.com/a/23409642
has answer: http://stackoverflow.com/a/23409785
answer count: 3
downvote count: 0
favorite count: 0
possible better answer: http://stackoverflow.com/a/23409897
tagged with: mahout
tagged with: maven
has answer: http://stackoverflow.com/a/23409897
accepted answer: http://stackoverflow.com/a/23409785
score: 2
type: AnsweredQuestion
upvote count: 2
has body: How can I now test my hadoop installation? I can't find adoop-examples-1.1.2.jar. Is there any other way to test if Hadoop and Mahout are working correctly? Thanks in advance.
tagged with: java

http://stackoverflow.com/comment/35697772
comment on: http://stackoverflow.com/a/23316037
has text: If there's a connection created, shouldn't there be a System.out.println("Client from " + client.getInetAddress() + " connected."); ..?
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/23360178
accepted answer: http://stackoverflow.com/a/23470611
has comment: http://stackoverflow.com/comment/35778220
possible better answer: http://stackoverflow.com/a/23362790
tagged with: jsp
has answer: http://stackoverflow.com/a/23370999
has answer: http://stackoverflow.com/a/23362790
has body: In a simple Java web application can we do JSP and HTML URL mapping in somewhat similar fashion to Spring's InternalResourceViewResolver, where we use prefix and suffix to map URLs. Mapping should be done as following:- mysite.com/home ==> /index.html mysite.com/help ==> /help.html mysite.com/view/form ==> /jsp/form.jsp mysite.com/view/user ==> /jsp/user.jsp I know that we can do JSP mapping in web.xml like:- formpage /jsp/form.jsp formpage /view/form But there is no prefix and suffix property here. How can we generalize jsp and html mapping like above? Edit: Spring example: <property name="prefix" value="/WEB-INF/jsp/" /> <property name="suffix" value=".jsp" />
has comment: http://stackoverflow.com/comment/35781210
has title: URL mapping in Java Web Applications
tagged with: spring
has answer: http://stackoverflow.com/a/23470611
answer count: 4
has answer: http://stackoverflow.com/a/23364231
type: AnsweredQuestion
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/35778612
type: Question
has comment: http://stackoverflow.com/comment/35782606
has comment: http://stackoverflow.com/comment/35780700

http://stackoverflow.com/q/23312951
has answer: http://stackoverflow.com/a/23315020
score: 0
answer count: 1
tagged with: postgresql
accepted answer: http://stackoverflow.com/a/23315020
has body: In my JavaFX application When I use Non Lazy Collection option with EmbeddedId class, for maintain bidirectional relation ship it will produce following exception. After working on several hours yet I can not get fixed it. Entity classes as follow. Thanks. EmbeddedId class @Embeddable public class WorkflowStepPK implements Serializable { @Column(name = "STEP_SEQ_NO", nullable = false) private Integer stepSeqNo; @JoinColumn(name = "WST_ID", referencedColumnName = "ID", nullable = false) @ManyToOne private WfScriptTemplate wfScriptTemplate; } WorkflowStep Entity (with EmbeddedId) @Entity @Table(name = "workflow_step") public class WorkflowStep implements Serializable { @EmbeddedId private WorkflowStepPK id; // more fields } WfScriptTemplate Entity (with bidirectional relation ship) @Entity @Table(name = "wf_script_template") public class WfScriptTemplate implements Serializable { @Id @Basic(optional = false) @Column(name = "ID") private Integer id; // Refer the filed "wfScriptTemplate" inside the Composite key of WorkflowStep entity @OneToMany(cascade = CascadeType.REMOVE, mappedBy = "id.wfScriptTemplate") @LazyCollection(LazyCollectionOption.FALSE) @OrderBy(value = "stepSeqNo") private List&lt;WorkflowStep&gt; workflowStepList; } Exception on postgresql Caused by: org.hibernate.exception.SQLGrammarException: could not extract ResultSet at org.hibernate.exception.internal.SQLStateConversionDelegate.convert(SQLStateConversionDelegate.java:123) at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:49) at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:126) at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:112) at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.extract(ResultSetReturnImpl.java:89) at org.hibernate.loader.plan.exec.internal.AbstractLoadPlanBasedLoader.getResultSet(AbstractLoadPlanBasedLoader.java:449) at org.hibernate.loader.pla…
type: AnsweredQuestion
tagged with: java
tagged with: hibernate
tagged with: mysql
has title: JPA and Hibernate initialize Non Lazy Collections Error
type: Question
tagged with: jpa

http://stackoverflow.com/q/23418351
score: 0
answer count: 2
tagged with: sdk
has body: I have gone to File &gt; Import &gt; Android &gt; Existing Android Code but when I select the folder (Am I supposed to select the whole folder?) and attempt to run it in the emulator that I set up, nothing happens in the emulator.
accepted answer: http://stackoverflow.com/a/23421843
possible better answer: http://stackoverflow.com/a/23418598
tagged with: android
has answer: http://stackoverflow.com/a/23418598
type: AnsweredQuestion
tagged with: sample
tagged with: java
tagged with: eclipse
type: Question
has answer: http://stackoverflow.com/a/23421843
has title: How do I run sample Android SDK apps in Eclipse?

http://stackoverflow.com/q/23402672
has title: Java BigInteger Out of memory, possibly from long conversion
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/35860331
downvote count: 0
tagged with: http://stackoverflow.com/tag/c
has comment: http://stackoverflow.com/comment/35858844
has comment: http://stackoverflow.com/comment/35859053
has comment: http://stackoverflow.com/comment/35858868
has comment: http://stackoverflow.com/comment/35858427
tagged with: cpu-registers
has body: I'm trying to convert this KeeLoq algorithm from C into Java but my decryption method seems to use too much memory for Java's BigInteger. I was wondering if there was an equivalent operation that would work with Java's BigInteger. The original calculations for the index and bitVal variables are commented out below. The original source code I'm using as an example can be found here: https://github.com/franksmicro/Arduino/blob/master/libraries/Keeloq/Keeloq.cpp Any help would be much appreciated. package keeloq; /** * * @author */ import java.math.BigInteger; public class KeeLoq { BigInteger _keyHigh, _keyLow, keyHigh, keyLow; int KeeLoq_code = 0x3A5C742E; BigInteger KeeLoq_NLF = new BigInteger(Integer.toString(KeeLoq_code)); public KeeLoq() { } public KeeLoq(BigInteger keyHigh, BigInteger keyLow) { _keyHigh = keyHigh; _keyLow = keyLow; } public BigInteger bitRead(BigInteger x, int n) { BigInteger temp = x.shiftRight(n); return temp; } public BigInteger multiplyBig(BigInteger x, BigInteger n) { BigInteger temp = x.multiply(n); return temp; } public BigInteger Encrypt(BigInteger data) { BigInteger x = data; int keyBitNo; long index; long position1, position2, position3, position4, position5; BigInteger keyBitVal, bitVal; BigInteger b1, b2, b3, b4, b5; for (int r = 0; r &lt; 528; r++) { keyBitNo = r &amp; 63; if (keyBitNo &lt; 32) { keyBitVal = bitRead(_keyLow, keyBitNo); } else { keyBitVal = bitRead(_keyHigh, keyBitNo - 32); } position1 = bitRead(x, 1).longValue() * 1; position2 = bitRead(x, 9).longValue() * 2; position3 = bitRead(x, 20).longValue() * 4; position4 = bitRead(x, 26).longValue() * 8; position5 = bitRead(x, 31).longValue() * 16; index = position1 + position2 + position3 + position4 + position5; System.out.println("the encrypted index is " + index); b1 = bitRead(x, 0); b2 = bitRead(x, 16); int intIndex = (int) index; b3 = bitRead(KeeLoq_NLF, intIndex); b4 = keyBitVal; bitVal = b1.xor(b2).xor(b3).xor(b4); BigInteger tempx = x.shiftRight(1); x = tempx.xor(bit…
favorite count: 0
has answer: http://stackoverflow.com/a/59049559
has comment: http://stackoverflow.com/comment/35860360
type: UnansweredQuestion
tagged with: encryption
has comment: http://stackoverflow.com/comment/35857025
has comment: http://stackoverflow.com/comment/35859148
has answer: http://stackoverflow.com/a/23402774
upvote count: 1
has comment: http://stackoverflow.com/comment/35856998
has comment: http://stackoverflow.com/comment/35860441
score: 1
tagged with: java

http://stackoverflow.com/comment/35778204
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23360017
score: 0
has text: @PeterLawrey Hi, what library function is Integer.toHexDecimal??

http://stackoverflow.com/a/40943438
type: Answer
upvote count: 29
score: 29
has comment: http://stackoverflow.com/comment/118968252
has body: Update with Java 9+ with takeWhile: AtomicBoolean ongoing = new AtomicBoolean(true); someobjects.stream()...takeWhile(t -&gt; ongoing.get()).forEach(t -&gt; { // doing something. if (...) { // want to break; ongoing.set(false); } });
has comment: http://stackoverflow.com/comment/136175509
answers question: http://stackoverflow.com/q/23308193
downvote count: 0

http://stackoverflow.com/comment/35884861
has text: Yep, the `id` is indeed PRIMARY and UNIQUE. Sorry should have mentioned that. This definitely solves the problem - you are absolutely correct, it is the "random" number that was the culprit. Originally, the `set` value was being updated to its positive equivalent after the push was made, so selecting with the pseudorandom negative number was never a problem. But we removed that feature while trying to solve some deadlocking problems when running multiple daemons. Should have realized all this, given the huge growth rate of the data. Thank you for your help!
type: Comment
comment on: http://stackoverflow.com/a/23416179
score: 0
type: AnswerComment

http://stackoverflow.com/comment/35847466
type: QuestionComment
has text: I am using hibernate 4.0.1.Final and Spring 3.2.3 RELEASE, i can't find a complete stacktrace because its not showing. However i updated the original post with a stacktrace of an error that pops up at the same time.
comment on: http://stackoverflow.com/q/23396645
score: 0
type: Comment

http://stackoverflow.com/comment/35661451
comment on: http://stackoverflow.com/q/23296187
score: 0
has text: "The if(name == null) is always true even if my string has a value" - I'm afraid I just don't believe that. If the value of `name` is a non-null reference, it really *won't* go into that block. I suggest you add more diagnostics to help understand what's going on.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23292543
score: 0
possible better answer: http://stackoverflow.com/a/23292714
has body: I want to get the value of the long "transmitBytes" in this JSON string [ { "portNumber" : 2, "queueId" : 0, "transmitBytes" : 1944145, "transmitPackets" : 1684, "transmitErrors" : 0 } ] I have used the org.json library and implemented the code: String queueJson = [{"portNumber":2,"queueId":0,"transmitBytes":1944145,"transmitPackets":1684,"transmitErrors":0}]; System.out.println("The JSON string is: " + queueJson); JSONObject obj; try { obj = new JSONObject(queueJson); long TXbytes = obj.getLong("transmitBytes"); System.out.println("The amount of transmittet bytes is " + TXbytes); } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } The issue occurs, when I'm running the Apache tomcat web server. Following error occurs: SEVERE: A child container failed during start with following: org.apache.catalina.LifecycleException: Failed to start component When I remove the JSONObject class and the corresponding org.json library, everything works fine, and the server runs without any issues. Does anyone know why this issue occurs, and are there another libraries available to access a long value in a JSON string from Java ?. Thanks in advance
has comment: http://stackoverflow.com/comment/35654772
tagged with: tomcat
has answer: http://stackoverflow.com/a/23294060
type: AnsweredQuestion
tagged with: java
tagged with: http://stackoverflow.com/tag/json
accepted answer: http://stackoverflow.com/a/23294060
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/23292714
has title: Access to a long value in a JSON string from Java

http://stackoverflow.com/q/23320023
has body: I have a java project I need to write that reads data in from a comma delimited text file. But, for extra credit we can use a database instead of a text file . I dont want to pay for a host or deal with servers. So, is there a way to create a database that is in my java package so I can use sql? I'm using netbeans (if it matters). I need everything to be in my java package so when I turn it in to my teacher he doesn't need to download extensions or do anything special.
accepted answer: http://stackoverflow.com/a/23320121
type: Question
has answer: http://stackoverflow.com/a/23320123
tagged with: database
has answer: http://stackoverflow.com/a/23320121
has answer: http://stackoverflow.com/a/23320056
answer count: 3
upvote count: 1
tagged with: sql
favorite count: 0
has title: Is there a way to add a local database to a netbeans java project package?
type: AnsweredQuestion
tagged with: netbeans
possible better answer: http://stackoverflow.com/a/23320056
downvote count: 0
score: 1
tagged with: java

http://stackoverflow.com/a/23417227
has body: I think the problem is your render method can be called before your createDialogue method. As a result, textlines1 can be unassigned/null. One way to solve this is to take @Takendarkk's advice and initialize the variable to "". Another way is to ask yourself, "Does it make sense for this class to exist without textlines1 being set? If not, perhaps set this in the GuiManager's constructor.
has comment: http://stackoverflow.com/comment/35885247
has comment: http://stackoverflow.com/comment/35885416
has comment: http://stackoverflow.com/comment/35885171
has comment: http://stackoverflow.com/comment/35885021
has comment: http://stackoverflow.com/comment/35885195
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/23417065
has comment: http://stackoverflow.com/comment/35885330
has comment: http://stackoverflow.com/comment/35884976
score: 1
has comment: http://stackoverflow.com/comment/35886181
upvote count: 1
has comment: http://stackoverflow.com/comment/35885091

http://stackoverflow.com/q/23297376
has body: I'm doing a chat desktop app with sockets and my intention is to create a peer-to-peer communication between clients. My question is this: If I have all the IP addresses, can I connect simultaneously clients between them? In my project every Client has both server sockets and sockets (client). For example client_1 listens in the port 1001 for connections but at the same time can connect to other clients who have different IP-s and listen to different ports. Now what I want to know, if someone with experience can tell it, is it possible to connect to some client and at the same time receive messages from others if I'm connected to one client but others are connected to me? If Client_A listens to port 1001 but wants to chat with Client_B, than it connects himself to Client_B by specifying his IP and port; now, can at the same time Client_A recieve messages form other Clients who connects to his port?Is it possibile? If someone can help me I can publish also my code; but I think is a logic problem I have to solve here. Thank you very much.
tagged with: p2p
has comment: http://stackoverflow.com/comment/35663705
score: 1
has answer: http://stackoverflow.com/a/23302032
favorite count: 0
has comment: http://stackoverflow.com/comment/35685961
downvote count: 2
tagged with: sockets
accepted answer: http://stackoverflow.com/a/23302032
linked to: http://stackoverflow.com/q/3329641
linked to: http://stackoverflow.com/q/5810358
type: AnsweredQuestion
upvote count: 3
tagged with: java
has title: Sockets peer-to-peer
type: Question
answer count: 1

webodf
tags question: http://stackoverflow.com/q/23335169
type: Tag
tag name: webodf

http://stackoverflow.com/q/23437156
has comment: http://stackoverflow.com/comment/35921857
has answer: http://stackoverflow.com/a/29707257
accepted answer: http://stackoverflow.com/a/29707257
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35921996
has title: Iterators Java methods
tagged with: java
has body: I have two questions: I want to do a method that use as iterator. I have array of arrays and I want that I can go with for loop on this iterator and receive every time the next item. I have an arrayList in abstract class that in inheritance classes I initialize this ArrayList with Strings and in the sec time I intialize this with linkedList. So If I have to declare the type of this ArrayList what I have to write? I tried ArrayList(Object) but I want to know if there is better way to do this. I tried ArrayList&lt;Object&gt;
type: Question
tagged with: iterator
has comment: http://stackoverflow.com/comment/35921830
tagged with: inheritance
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/35922761

http://stackoverflow.com/comment/35795536
type: QuestionComment
comment on: http://stackoverflow.com/q/23369398
score: 0
type: Comment
has text: Are you sure you have more than one object in your input list whose Id is 1 ? Can we have a sample input and output ?

http://stackoverflow.com/comment/35699273
score: 0
type: Comment
type: QuestionComment
has text: yes first of all it is bigger in size than the size on DB, meaning extra bytes added meanwhile. response.reset() is a good practice.I guess it compains about the "UTF-8" thing. I don't have control over the files put to the BLOB Column.
comment on: http://stackoverflow.com/q/23297066

http://stackoverflow.com/q/23431051
downvote count: 0
score: 1
favorite count: 0
tagged with: serialization
type: Question
tagged with: sockets
has answer: http://stackoverflow.com/a/23431119
has title: Unable to Create ObjectInputStream Object
has body: This is my code. When I run this, I get up to "Three and a Half" printed. (The prints are added for debugging since I don't know any other way.) After that, the execution hangs. No exceptions, no prompts, nothing. So what is wrong with my object creation? Each and every tutorial I see online has the same code, but mine won't work. public class Connection { Socket socket; ObjectInputStream iStream; ObjectOutput outputStream; public Connection(Socket s) { try { System.out.println("One"); socket = s; System.out.println("Two"); outputStream = new ObjectOutputStream(new BufferedOutputStream(socket.getOutputStream())); System.out.println("Three"); InputStream is = socket.getInputStream(); System.out.println("Three and a Half"); iStream = new ObjectInputStream(is); System.out.println("Four"); } catch (IOException e) { e.printStackTrace(); } } } Thanks in advance.
upvote count: 1
answer count: 1
tagged with: objectinputstream
accepted answer: http://stackoverflow.com/a/23431119
tagged with: java
type: AnsweredQuestion

http://stackoverflow.com/comment/35698476
comment on: http://stackoverflow.com/a/23316344
type: Comment
score: 1
type: AnswerComment
has text: Also don't you think adding it at function level rather than class level might be better as we have control over readonly transactions etc ?

http://stackoverflow.com/a/48793455
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/23449621
upvote count: 1
type: Answer
has body: I've put a scanner into the main methode, and the word I search for will return the documents the word occurce in. I also return how many times the word occurs, but I will only get it to be the total of times in all of three documents. And I want it to return how many times it occurs in each document. I want this to be able to calculate tf-idf, if u have a total answer for the whole tf-idf I would appreciate. Cheers Here is my code: import java.util.*; // Provides TreeMap, Iterator, Scanner import java.io.*; // Provides FileReader, FileNotFoundException public class test2 { public static void main(String[ ] args) { // **THIS CREATES A TREE MAP** TreeMap&lt;String, Integer&gt; frequencyData = new TreeMap&lt;String, Integer&gt;(); Map&lt;String, Set&lt;String&gt;&gt; filenames = new HashMap&lt;String, Set&lt;String&gt;&gt;(); Map&lt;String, Integer&gt; countByWords = new HashMap&lt;String, Integer&gt;(); Map[] mapArray = new Map[5]; mapArray[0] = new HashMap&lt;String, Integer&gt;(); readWordFile(countByWords, frequencyData, filenames); printAllCounts(countByWords, frequencyData, filenames); } public static int getCount(String word, TreeMap&lt;String, Integer&gt; frequencyData) { if (frequencyData.containsKey(word)) { // The word has occurred before, so get its count from the map return frequencyData.get(word); // Auto-unboxed } else { // No occurrences of this word return 0; } } public static void printAllCounts( Map&lt;String, Integer&gt; countByWords, TreeMap&lt;String, Integer&gt; frequencyData, Map&lt;String, Set&lt;String&gt;&gt; filenames) { System.out.println("-----------------------------------------------"); System.out.print("Search for a word: "); String worde; int result = 0; Scanner input = new Scanner(System.in); worde=input.nextLine(); if(!filenames.containsKey(worde)){ System.out.println("The word does not exist"); } else{ for(String filename : filenames.get(worde)){ System.out.println(filename); System.out.println(countByWords.get(worde)); } } System.…

http://stackoverflow.com/comment/35766962
type: AnswerComment
comment on: http://stackoverflow.com/a/23352837
type: Comment
score: 0
has text: More likely, you misunderstood the teacher. You see, with 0 and 1, you're adding ALL the numbers in the range. With 3 and 5, you're adding just SOME of them. Common sense says that the two answers are not going to be the same.

http://stackoverflow.com/comment/35886398
comment on: http://stackoverflow.com/a/23417988
score: 0
type: AnswerComment
type: Comment
has text: any trouble besides garbage values?

http://stackoverflow.com/comment/35694471
has text: `result * 1` looks veeeery suspicious. Why multiply by 1?
score: 1
comment on: http://stackoverflow.com/q/23314309
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35746757
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/23342539
has text: make sql fiddle for that and share link over here.
type: Comment

http://stackoverflow.com/a/23297909
has comment: http://stackoverflow.com/comment/35664930
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23297845
type: Answer
score: 2
has body: The setVisible(true) statement should be invoked AFTER all the components have been added to the frame. You currently have two setVisible(...) statements, so you need to get rid of the first one. Edit: Took a second look at the code. You have multiple setVisible(...) statements. Get rid of them all except for the last one. Don't create separate panels for each button. Instead you create one panel (called buttonPanel) for all the buttons. In your case you might use a horizontal BoxLayout. Add a button to the panel, then add glue then add a button, then add glue and then add your final button. Then add this buttonPanel to the NORTH of the frame. ie. this.add(buttonPanel, BorderLayout.NORTH). Read the section from the Swing tutorial on How to Use Box Layout for more information on how the layout works and on what glue is.
upvote count: 2
answers question: http://stackoverflow.com/q/23297845

http://stackoverflow.com/comment/35662182
has text: Then I don't know. I set up a route like yours, logging the exchange body instead of passing the message on, and POSTed your XML and it worked for me.
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23294816

http://stackoverflow.com/a/23425850
has body: Yes of course you just have to do something like public static void main(String[] args) { URL url; try { // get URL content url = new URL("http://www.mkyong.com"); URLConnection conn = url.openConnection(); // open the stream and put it into BufferedReader BufferedReader br = new BufferedReader( new InputStreamReader(conn.getInputStream())); String inputLine; //save to this filename String fileName = "/users/mkyong/test.html"; File file = new File(fileName); if (!file.exists()) { file.createNewFile(); } //use FileWriter to write file FileWriter fw = new FileWriter(file.getAbsoluteFile()); BufferedWriter bw = new BufferedWriter(fw); while ((inputLine = br.readLine()) != null) { bw.write(inputLine); } bw.close(); br.close(); System.out.println("Done"); } catch (MalformedURLException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } CREDIT : mkyong
accepted answer of: http://stackoverflow.com/q/23425768
answers question: http://stackoverflow.com/q/23425768
score: 1
upvote count: 1
type: AcceptedAnswer
type: Answer
downvote count: 0

http://stackoverflow.com/q/23434784
score: 0
tagged with: sockets
type: AnsweredQuestion
has title: Sockets in Java Master-Slave
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/23440500
answer count: 1
has answer: http://stackoverflow.com/a/23440500
has body: i need help about sockets in java... I have to develop a routine where I create a master ServerSocket that will control a list of numbers and other slave machines can connect to go testing each number from the list and tell if it is prime or not ... I created a helper class that has the properties Number, State (Tested, Waiting and NotTested) and IsPrimo I also created a static list helper class that contains numbers which will test thus each slave would ask for the master and test whether a number is prime returning to the master and the master would update the list until all values ​​would keep the state .... Tested as I have little knowledge with sockets in java, I'm really struggling to know how to implement this exchange of information .. needs to be asynchronously can anyone help me or give me an example implemented like? apparently is not difficult but as I said I have little knowledge about it. sorry about english!!!

http://stackoverflow.com/q/23398354
favorite count: 0
tagged with: string.format
downvote count: 2
has answer: http://stackoverflow.com/a/23398618
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23398365
has title: Is there a "%"-symbol for Space in string.format()?
upvote count: 3
score: 1
has body: For new line the symbol is "%n"; how about space, is there a symbol for it? I've searched for it on various websites but I couldn't find it.
tagged with: java
accepted answer: http://stackoverflow.com/a/23398365
type: Question
tagged with: format-string
answer count: 3
possible better answer: http://stackoverflow.com/a/23398404
has answer: http://stackoverflow.com/a/23398404

http://stackoverflow.com/comment/35742406
type: QuestionComment
comment on: http://stackoverflow.com/q/23338870
has text: You're right! I was looking for conflicting jars in my library projects but i missed a package org.apache.http.entity.mime in one of these projects (facepalm). Thanks a lot!
score: 0
type: Comment

http://stackoverflow.com/a/23369193
has comment: http://stackoverflow.com/comment/35842636
type: Answer
answers question: http://stackoverflow.com/q/23342987
score: 0
has body: I don't think primefaces update works with #id selector, please try with style class : &lt;h:form styleClass="form-selector"&gt; &lt;p:commandButton update="@(.form-selector)" /&gt;

http://stackoverflow.com/comment/35806969
has text: I understand, I chose these names for my question so users can have a better time understanding.
comment on: http://stackoverflow.com/a/23375342
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/35716850
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23326611
score: 3
has text: What are `EAmount` and `finalk`?

atomic
type: Tag
tags question: http://stackoverflow.com/q/23310295
tag name: atomic

http://stackoverflow.com/comment/35847504
comment on: http://stackoverflow.com/a/23396246
has text: its just a one to many relationship. The many know who their one is and the one knows who their many is. Not cyclic at all
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/35796775
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23339410
score: 0
has text: Check out the answer here: http://stackoverflow.com/questions/21065998/proguard-retrace-missing-line-numbers (Took me two minutes to find that with Google...)

http://stackoverflow.com/q/23330317
downvote count: 1
has body: I'm learning Java in school and they told us to use eclipse since it provide a whole IDE, but somehow I like working with sublime better, I don't know, maybe because its cleaner and feels really light weight compare to eclipse. Now, if I created a Rectangle.java class and I have also created a Program.java class which includes the main: public class Program { public static void main(String[] args) { // TODO Auto-generated method stub Rectangle myRect = new Rectangle(double w, double h); myRect.show; } } So where do I run this..? in the terminal? and how? Of course I will not have a debugger unfortunately, but please help me to figure out how can I use sublime while learning Java, I like this editor and want to use it. Thanks guys!
has answer: http://stackoverflow.com/a/31427410
type: AnsweredQuestion
tagged with: java
tagged with: eclipse
type: Question
has answer: http://stackoverflow.com/a/23330389
has title: How to run my Java code that I created with sublime editor?
score: 0
has answer: http://stackoverflow.com/a/31427550
possible better answer: http://stackoverflow.com/a/23330360
has answer: http://stackoverflow.com/a/23330360
answer count: 4
has comment: http://stackoverflow.com/comment/35724063
favorite count: 0
linked to: http://stackoverflow.com/q/2360995
accepted answer: http://stackoverflow.com/a/23330389
upvote count: 1

http://stackoverflow.com/a/23352795
type: Answer
has comment: http://stackoverflow.com/comment/35812657
has comment: http://stackoverflow.com/comment/35827955
accepted answer of: http://stackoverflow.com/q/23351748
upvote count: 1
has comment: http://stackoverflow.com/comment/35820939
has comment: http://stackoverflow.com/comment/35828727
has comment: http://stackoverflow.com/comment/35828803
score: 1
has comment: http://stackoverflow.com/comment/35808434
has comment: http://stackoverflow.com/comment/35766149
has comment: http://stackoverflow.com/comment/35824084
has comment: http://stackoverflow.com/comment/35767083
has comment: http://stackoverflow.com/comment/35810081
has body: receiveMSG = (Message) deserialize(receivedPacket.getData()); You need to change this to receiveMSG = (Message) deserialize(receivedPacket.getData(), receivedPacket.getOffset(), receivedPacket.getLength); and adjust your 'deserialise()' method accordingly, to accept 'offset' and 'length' parameters, and to use them when constructing the ByteArrayInputStream. EDIT The code you posted doesn't compile: the expression that constructs the outgoing datagram packet is incorrect. It should be new DatagramPacket(test, test.length, datagramSocket.getInetAddress(), datagramSocket.getPort()) I have no idea what packetOverhead is supposed to be, but you don't need it. NB You don't need to create a new Message() the line before you call readObject().
has comment: http://stackoverflow.com/comment/35829005
has comment: http://stackoverflow.com/comment/35811498
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/35767014
has comment: http://stackoverflow.com/comment/35765788
answers question: http://stackoverflow.com/q/23351748

geotools
type: Tag
tags question: http://stackoverflow.com/q/23324456
tag name: geotools

http://stackoverflow.com/comment/35940702
score: 0
has text: @JoshPinter You're not required to override any methods except the abstract ones (which you didn't define in the sample).
comment on: http://stackoverflow.com/q/23447403
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35748089
has text: A few people have the same name as me. Does this have an impact on whether they are the same person as me. Clearly not, and so name should not be part of the `equals`/`hashCode` implementation. Probably it does not make sense to override `equals` here.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23342711
type: Comment

http://stackoverflow.com/q/23345776
tagged with: android
score: 4
linked to: http://stackoverflow.com/q/21168579
tagged with: default-constructor
tagged with: java
has comment: http://stackoverflow.com/comment/35752144
type: Question
upvote count: 4
has comment: http://stackoverflow.com/comment/35755326
has comment: http://stackoverflow.com/comment/35755403
has comment: http://stackoverflow.com/comment/35752399
has answer: http://stackoverflow.com/a/23345971
has comment: http://stackoverflow.com/comment/35752354
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/35751992
favorite count: 0
tagged with: dalvik
has body: I've gotten a number of crash reports with the following stack traces (names changed): Caused by: java.lang.InstantiationException: can't instantiate class com.example.MyApplication; no empty constructor at java.lang.Class.newInstanceImpl(Native Method) at java.lang.Class.newInstance(Class.java:1319) at android.app.Instrumentation.newApplication(Instrumentation.java:997) at android.app.Instrumentation.newApplication(Instrumentation.java:982) at android.app.LoadedApk.makeApplication(LoadedApk.java:496) ... 11 more java.lang.RuntimeException: Unable to instantiate application com.example.MyApplication: java.lang.InstantiationException: can't instantiate class com.example.MyApplication; no empty constructor at android.app.LoadedApk.makeApplication(LoadedApk.java:501) android.app.Application has an explicit parameterless constructor: public Application() { super(null); } MyApplication inherits from android.app.Application and has no explicit constructors at all. According to my understanding of the Java spec, this means that the following constructor should be implicitly inserted by the compiler: public MyApplication() { super(); } This must have happened, or I'd never have been able to compile the app in the first place. So what could be causing these crashes? EDIT: Here's part of the output from decompiling the ProGuard-ed MyApplication.class with javap: Compiled from "MyApplication.java" public class com.example.MyApplication extends android.app.Application { public com.example.MyApplication(); Signature: ()V public void onCreate(); Signature: ()V public void onLowMemory(); Signature: ()V public void onTrimMemory(int); Signature: (I)V // ... some other methods ... static {}; Signature: ()V } The default constructor is definitely in there, and it's public.
has title: Disappearing default constructors
type: UnansweredQuestion

http://stackoverflow.com/a/23299208
answers question: http://stackoverflow.com/q/23299100
type: Answer
score: 0
has body: You can try looking into a Java HTML parser like this: http://jsoup.org/

http://stackoverflow.com/comment/35721962
has text: @abl, So you're saying the variable I create is Car, but points to a Honda? I'm not understanding the hierarchy here. Or are they both on the same level? And yes, I had completely overlooked the fact that `List` is an interface. My apologies.
comment on: http://stackoverflow.com/a/23328871
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/23381148
type: Question
upvote count: 5
score: 3
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/23381401
has body: I have done creating pdf and chart with the help of this link http://viralpatel.net/blogs/generate-pie-chart-bar-graph-in-pdf-using-itext-jfreechart/. package net.viralpatel.pdf; import java.awt.Graphics2D; import java.awt.geom.Rectangle2D; import java.io.FileOutputStream; import org.jfree.chart.ChartFactory; import org.jfree.chart.JFreeChart; import org.jfree.chart.plot.PlotOrientation; import org.jfree.data.category.DefaultCategoryDataset; import org.jfree.data.general.DefaultPieDataset; import com.itextpdf.text.Document; import com.itextpdf.text.pdf.DefaultFontMapper; import com.itextpdf.text.pdf.PdfContentByte; import com.itextpdf.text.pdf.PdfTemplate; import com.itextpdf.text.pdf.PdfWriter; public class PieChartDemo { public static void main(String[] args) { //TODO: Add code to generate PDFs with charts writeChartToPDF(generateBarChart(), 500, 400, "C://barchart.pdf"); writeChartToPDF(generatePieChart(), 500, 400, "C://piechart.pdf"); } public static void writeChartToPDF(JFreeChart chart, int width, int height, String fileName) { PdfWriter writer = null; Document document = new Document(); try { writer = PdfWriter.getInstance(document, new FileOutputStream( fileName)); document.open(); PdfContentByte contentByte = writer.getDirectContent(); PdfTemplate template = contentByte.createTemplate(width, height); Graphics2D graphics2d = template.createGraphics(width, height, new DefaultFontMapper()); Rectangle2D rectangle2d = new Rectangle2D.Double(0, 0, width, height); chart.draw(graphics2d, rectangle2d); graphics2d.dispose(); contentByte.addTemplate(template, 0, 0); } catch (Exception e) { e.printStackTrace(); } document.close(); } public static JFreeChart generatePieChart() { DefaultPieDataset dataSet = new DefaultPieDataset(); dataSet.setValue("China", 19.64); dataSet.setValue("India", 17.3); dataSet.setValue("United States", 4.54); dataSet.setValue("Indonesia", 3.4); dataSet.setValue("Brazil", 2.83); dataSet.setValue("Pakistan", 2.48); dataSet.setValue("Bangladesh…
type: UnansweredQuestion
downvote count: 2
has comment: http://stackoverflow.com/comment/35817214
linked to: http://stackoverflow.com/q/17274618
tagged with: java
has title: Changing the orientation of PDF using Itext
tagged with: itext
tagged with: jfreechart

http://stackoverflow.com/comment/35896530
type: Comment
has text: what part of the code does the balance? If size isn't global how will its value propagate in the recursive calls. You have to pass it in the recursive function as a parameter.
comment on: http://stackoverflow.com/q/23420930
score: 0
type: QuestionComment

http://stackoverflow.com/q/23291015
type: AnsweredQuestion
score: 3
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: gson
has answer: http://stackoverflow.com/a/23291127
type: Question
possible better answer: http://stackoverflow.com/a/36206065
has comment: http://stackoverflow.com/comment/35652247
has body: Sorry for the repeated question.I have been banging my head on this since hours. I am trying to parse json to an object of setter/getter class. String location = request.getParameter("location"); System.out.print(location); org.json.JSONObject json = new org.json.JSONObject(location); /* JSONObject js = json.getJSONObject("locationInfo"); String mapLoc = js.getString("locationInfo"); */ String mapLoc = json.getString("locationInfo"); &lt;--- receiving the error on this line Gson gsn = new Gson(); MapObject mLocObj = gsn.fromJson(mapLoc, MapObject.class); System.out.println(mLocObj.getLongitude()); double longitude = Double.parseDouble(mLocObj.getLongitude()); double latitude = Double.parseDouble(mLocObj.getLatitude()); Here is my json string location: {"locationInfo":{"latitude":"19.3828815","longitude":"72.8296205"}} This is the error log: 19: System.out.print(location); 20: 21: org.json.JSONObject json = new org.json.JSONObject(location); 22: String mapLoc = json.getString("locationInfo"); 23: 24: Gson gsn = new Gson(); 25: MapObject mLocObj = gsn.fromJson(mapLoc, MapObject.class); Stacktrace:] with root cause org.json.JSONException: JSONObject["locationInfo"] not a string. at org.json.JSONObject.getString(JSONObject.java:639) at org.apache.jsp.mapView_jsp._jspService(mapView_jsp.java:88) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) at javax.servlet.http.HttpServlet.service(HttpServlet.java:722) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334) at javax.servlet.http.HttpServlet.service(HttpServlet.java:722) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrap…
has answer: http://stackoverflow.com/a/23291205
accepted answer: http://stackoverflow.com/a/23291205
favorite count: 0
upvote count: 3
answer count: 4
has answer: http://stackoverflow.com/a/23294174
has answer: http://stackoverflow.com/a/36206065
has title: JSONObject["locationInfo"] not a string
downvote count: 0

http://stackoverflow.com/comment/35790353
has text: JMS systems (or any other implementation that uses the network) are not suitable for this use case. Guava does not seem to have anything useful, either. Thanks though and +1. :-)
type: Comment
score: 1
comment on: http://stackoverflow.com/a/23360800
type: AnswerComment

http://stackoverflow.com/comment/35742094
type: Comment
has text: what was actually in that alertbox?
score: 0
comment on: http://stackoverflow.com/q/23340533
type: QuestionComment

http://stackoverflow.com/q/23318278
type: Question
has body: I have a singleton spring bean named gameContext, my spring bean definition; &lt;bean name="gameContext" scope="singleton" class="tr.com.hevi.game.numblock.core.context.GameContext"/&gt; I also use this class for session listening, here is my web.xml &lt;listener&gt; &lt;listener-class&gt; tr.com.hevi.game.numblock.core.context.GameContext &lt;/listener-class&gt; &lt;/listener&gt; The problem is that gameContext is being created twice. one; at the very beginning before the spring context is being loaded, and the second; within the spring context. I am sure that I do not component-scan more than once. I understand the reason behind but don't know how to tackle the problem. One possible solution should be adding the listener within the spring context not web.xml, or there might be a proxy object solution.
has answer: http://stackoverflow.com/a/23318768
tagged with: spring
tagged with: spring-mvc
score: 0
tagged with: java
has title: Singleton spring bean is being created more than once
answer count: 1
type: UnansweredQuestion
tagged with: web.xml

http://stackoverflow.com/comment/50458238
has text: @Zombies Yes you are still able to debug it. Everything works just fine.
type: AnswerComment
comment on: http://stackoverflow.com/a/28394024
type: Comment
score: 2

http://stackoverflow.com/q/23433667
answer count: 2
has comment: http://stackoverflow.com/comment/35915584
has body: I created the maven-spring project using the m2e plugin of eclipse. The project is working fine. I want to do a Maven build in Eclipse the project without using any commands in command prompt i.e. using the eclipse IDE only. But I am not able to find the option for Maven build from Eclipse IDE. Below are the options I am getting when I right click on my project: Kindly advise.
has comment: http://stackoverflow.com/comment/35915062
has comment: http://stackoverflow.com/comment/35915086
has comment: http://stackoverflow.com/comment/35915835
downvote count: 0
accepted answer: http://stackoverflow.com/a/23434132
favorite count: 0
upvote count: 2
has comment: http://stackoverflow.com/comment/35915209
has comment: http://stackoverflow.com/comment/35915883
tagged with: maven
tagged with: spring
has title: Maven Build in Eclipse without using Command prompt
has comment: http://stackoverflow.com/comment/35915250
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35915092
possible better answer: http://stackoverflow.com/a/23433926
tagged with: java
has answer: http://stackoverflow.com/a/23433926
tagged with: eclipse
type: Question
has answer: http://stackoverflow.com/a/23434132

http://stackoverflow.com/comment/35887813
has text: I think you're more confused by what [``this``](http://docs.oracle.com/javase/tutorial/java/javaOO/thiskey.html) means than the ``.`` operator
comment on: http://stackoverflow.com/q/23418770
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/comment/35806158
comment on: http://stackoverflow.com/a/23374857
type: AnswerComment
score: 0
has text: sorry about my java knowledge but ı want to generate SessionClass object with variable name "s".I dont want to write again and again SessionClassroom sessionClassroom1,2,3,4 = new SessionClassroom(classTmp);
type: Comment

http://stackoverflow.com/comment/35913487
comment on: http://stackoverflow.com/q/23429373
type: Comment
type: QuestionComment
has text: How is this question unclear. It seems vary clear to me - `I want it to automatically scroll so the last line is visible as text is added to the area (using append()).`. The OP is simply asking to be pointed in the right direction. Is that not what a forum is for?
score: 1

http://stackoverflow.com/a/23365626
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/23364083
type: Answer
upvote count: 1
has body: As everyone has already mentioned in the comments above this cannot be achieved using the Thread class in java. But if you want to do it in Javascript, something similar to the below can be used; &lt;!DOCTYPE html&gt; &lt;html&gt; &lt;body onload="myFunction()"&gt; &lt;div id="num"&gt;&lt;div&gt; &lt;script&gt; function myFunction() { document.getElementById("num").innerHTML=1; setInterval(function() {document.getElementById("num").innerHTML=Number(document.getElementById("num").innerHTML)+1},1000); } &lt;/script&gt; &lt;/body&gt; &lt;/html&gt;

http://stackoverflow.com/q/23354215
has comment: http://stackoverflow.com/comment/35767925
score: 0
has comment: http://stackoverflow.com/comment/35795815
has answer: http://stackoverflow.com/a/23354427
answer count: 1
accepted answer: http://stackoverflow.com/a/23354427
has title: How to compile servlet and existing package for tomcat
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35795859
tagged with: java
has comment: http://stackoverflow.com/comment/35767953
has body: Sorry, I'm very new to java servlets. I have an existing java package (that I built and ran in eclipse, did not compile) that runs fine on its own. I have a sample servlet in another folder. I'd like to compile all of this so it can run on a tomcat server. I know a javac will compile a class, but which one do I compile if this is a servlet AND another package? Do I have to list ALL classes, can I list just the package names? Do I need to create a single .war file or multiple .war/.jar files? Sorry, my use of Java up to now has been in Eclipse. I can compile and run a single class, but a complex environment with multiple packages with a target platform of tomcat is leaving me lost as to 'where I begin.
has comment: http://stackoverflow.com/comment/35767898
has comment: http://stackoverflow.com/comment/35795660
tagged with: servlets
type: Question
has comment: http://stackoverflow.com/comment/35795740
tagged with: tomcat

breakout
type: Tag
tag name: breakout
tags question: http://stackoverflow.com/q/23337735

http://stackoverflow.com/q/23404475
accepted answer: http://stackoverflow.com/a/23404646
upvote count: 8
type: AnsweredQuestion
tagged with: java
downvote count: 2
type: Question
tagged with: split
has title: What is the way to insert a colon(:) after every two characters in a string?
has answer: http://stackoverflow.com/a/23404646
possible better answer: http://stackoverflow.com/a/23404516
has answer: http://stackoverflow.com/a/23404516
score: 6
answer count: 2
has comment: http://stackoverflow.com/comment/35860208
has body: I am trying to figure out that - INPUT: String data = "506313B5EA3E"; OUTPUT: String data = "50:63:13:B5:EA:3E"; I tried using- java.util.Arrays.toString(data.split("(?&lt;=\\G..)")) But the output is: [50, 6313B5EA3E]
tagged with: string
favorite count: 0

http://stackoverflow.com/comment/35776541
has text: Down-vote from me - doesn't look like you've attempted anything. Also - what exactly is a `SourceTitle` - what type?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23358988

http://stackoverflow.com/comment/35799559
comment on: http://stackoverflow.com/q/23370298
score: 0
type: Comment
type: QuestionComment
has text: @peeskillet, thanks it is a good article. How can I click your as answer?

http://stackoverflow.com/comment/35779016
comment on: http://stackoverflow.com/q/23360578
has text: In Java Garbage collector is very lazy. If enough memory is available then it does nothing.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23430775
has answer: http://stackoverflow.com/a/23439079
has comment: http://stackoverflow.com/comment/35925951
has comment: http://stackoverflow.com/comment/35965754
has title: Control the disk location of documents in Lucene
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23439079
tagged with: java
type: Question
tagged with: lucene
score: 0
has body: Is there a way I can tell Lucene to store documents in disk in some predefined order? For instance, I have documents with sparse, but sorted, IDs (i.e. in a LongField named ID). I want to load them one by one -- sorted -- from Lucene Index. In a perfect world, this will happen magically just by iterating from 0 to IndexReader.maxDoc() and loading IndexReader.document(i). Is this possible?
answer count: 1

http://stackoverflow.com/a/23293381
has body: See the comments in the code below, it shows one of the cases of failure. { String inp="aaa" , z = "" ; int len , i ,j , l; char x ,y ; inp = inp + ' '; len = (inp.length())-1; for (i=0;i&lt;=len;i++) // i is 0 { x = inp.charAt(i); // X is 'a' z = z + x ; 'z is 'a' l = i + 1 ; // l is 1 for ( j=i ; j&lt;len ; j++) { y = inp.charAt(j); if(x==y) continue; else z = z + y; } // z is still 'a' inp = z ; // inp is also 'a' z = " " ; // inp.charAt(1) -&gt; OOB if (inp.charAt(l)==' ') break ; } System.out.println("new String "+inp); }
type: Answer
has comment: http://stackoverflow.com/comment/35657960
score: 0
answers question: http://stackoverflow.com/q/23293060

http://stackoverflow.com/comment/36822679
score: 1
comment on: http://stackoverflow.com/a/23358033
type: AnswerComment
type: Comment
has text: Uh, sorry, I misunderstood. Then it's much simpler: `SELECT avg(salary), year, userId FROM salaries GROUP BY year, userId` This groups by year AND THEN by UserId

http://stackoverflow.com/comment/35862928
has text: Yep, simply use the technique you did for adding them. getValueAt
type: AnswerComment
comment on: http://stackoverflow.com/a/23405029
score: 0
type: Comment

http://stackoverflow.com/comment/35903745
score: 0
type: Comment
has text: I explained above what I would like it to do, now there is a following error: insert while expression to complete a do statement.
type: QuestionComment
comment on: http://stackoverflow.com/q/23427708

http://stackoverflow.com/q/23444659
has comment: http://stackoverflow.com/comment/35935475
has title: OOP:How could extends/implements help me in this case
has answer: http://stackoverflow.com/a/23444767
has comment: http://stackoverflow.com/comment/35935382
has answer: http://stackoverflow.com/a/23444924
has comment: http://stackoverflow.com/comment/35935464
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23445000
has comment: http://stackoverflow.com/comment/35936163
has body: I am making a storehouse system(use OOP) and of course there are many goods in it. I want to have a ArrayList(or some other containers) to hold those goods, so I can change less code when the goods change from lights to cups(subclass of goods). It seems can be fulfilled by extends/implements the class Goods. But when I get the input of user, it seems I have to use many if-else if I have many subclass. like this: if(name == Light){list.add(new Light(...)} if(name == Cup){list.add(new Cup(...)} ... And when I get the goods from the list, it seems that I have to use instanceof like this: if(goods instanceof Light){} if(goods instanceof Cup) {} ... So the code become not so elegant at all. So my question is how can I solve this problem.
tagged with: oop
has comment: http://stackoverflow.com/comment/35935409
tagged with: java
has comment: http://stackoverflow.com/comment/35936094
type: Question
has comment: http://stackoverflow.com/comment/35936531
has comment: http://stackoverflow.com/comment/35936113
score: 0
answer count: 3

http://stackoverflow.com/a/23344902
accepted answer of: http://stackoverflow.com/q/23344725
answers question: http://stackoverflow.com/q/23344725
has comment: http://stackoverflow.com/comment/35751044
type: AcceptedAnswer
downvote count: 0
score: 8
upvote count: 8
type: Answer
has comment: http://stackoverflow.com/comment/35750158
has comment: http://stackoverflow.com/comment/35751567
has comment: http://stackoverflow.com/comment/35751196
has body: Here is probably what you want to do - as I wrote in comment, use SAX parser and when your condition for stopping is met use this How to stop parsing xml document with SAX at any time? edit: test.xml <?xml version="1.0" encoding="UTF-8"?> data second third next ReadXmlUpToSomeElementSaxParser.java import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParserFactory; import org.xml.sax.Attributes; import org.xml.sax.SAXException; import org.xml.sax.helpers.DefaultHandler; public class ReadXmlUpToSomeElementSaxParser extends DefaultHandler { private final String lastElementToRead; public ReadXmlUpToSomeElementSaxParser(String lastElementToRead) { this.lastElementToRead = lastElementToRead; } @Override public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { // just for showing what is parsed System.out.println("startElement: " + qName); } @Override public void endElement(String uri, String localName, String qName) throws SAXException { if (lastElementToRead.equals(qName)) { throw new MySaxTerminatorException(); } } public static void main(String[] args) throws Exception { SAXParserFactory factory = SAXParserFactory.newInstance(); SAXParser saxParser = factory.newSAXParser(); try { saxParser.parse("src/test.xml", new ReadXmlUpToSomeElementSaxParser("second")); } catch (MySaxTerminatorException exp) { // nothing to do, expected } } public class MySaxTerminatorException extends SAXException { } } output startElement: root startElement: first startElement: inner startElement: second Why is that better? Simply because some application can send you <?xml version="1.0" encoding="UTF-8"?> data second third next and lines oriented approach will fail... I provided the parser that is not counting elements to show that the condition can be defined based on business logic required to achieve... characters() warning For reading data in element you can use character() method, but please be aware that SAX parsers may r…

http://stackoverflow.com/a/23394610
has body: I think you need 128 bit key here for AES algorithm - not 128 byte. To convert your long key to needed length you could try something like password-based key derivation function. See PBKDF2 for example.
has comment: http://stackoverflow.com/comment/35843264
accepted answer of: http://stackoverflow.com/q/23392085
answers question: http://stackoverflow.com/q/23392085
has comment: http://stackoverflow.com/comment/35868083
score: 12
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/35863730
upvote count: 12

http://stackoverflow.com/comment/35882196
has text: Sorry, I have posted an example of how the data looks.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23415688

http://stackoverflow.com/q/23303898
type: Question
has title: Something is wrong with my timer gui panel
tagged with: jpanel
answer count: 1
tagged with: user-interface
downvote count: 0
score: 1
favorite count: 0
has answer: http://stackoverflow.com/a/23303908
tagged with: timer
linked to: http://stackoverflow.com/q/9759115
type: AnsweredQuestion
tagged with: java
has body: I'm making a timer to go along with a sudoku grid im making and the code in bold bellow is giving me errors and i dont know why. If anyone could point out any mistakes and offer a solution that would be helpful. Thank you. import javax.swing.*; import java.awt.*; import java.awt.event.*; public class Timer extends JPanel { private JLabel timeDisplay; private JButton resetButton; private JButton startButton; private JButton stopButton; public Timer(){ final Timer timer; startButton = new JButton("Start Timer"); stopButton = new JButton("Stop Button"); timeDisplay = new JLabel("...Waiting..."); resetButton = new JButton("Reset Timer"); this.add(resetButton); this.add(startButton); this.add(stopButton); this.add(timeDisplay); class TimerClass implements ActionListener{ int counter; public TimerClass(int counter){ this.counter = counter; } @Override public void actionPerformed(ActionEvent tc) { counter++; } } class startButtonaction implements ActionListener{ public void actionPerformed(ActionEvent e){ int count = 0; timeDisplay.setText("Time Elapsed in Seconds: " + count); TimerClass tc = new TimerClass(count); **timer = new Timer(1000, tc); timer.start();** } } } }
upvote count: 1
tagged with: swing
accepted answer: http://stackoverflow.com/a/23303908

http://stackoverflow.com/comment/35679651
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23305851
has text: ‍@peeskillet Presumably the OP is going to fill the background with something. Clearing it twice, once with a JPanel color and once again with a game background, is just a performance hit. That tutorial page doesn't explain *why* it recommends key bindings, so that's a non-answer. There's no advantage to them in this case. A KeyListener works nicely.

http://stackoverflow.com/q/23341241
type: Question
has comment: http://stackoverflow.com/comment/35761035
has comment: http://stackoverflow.com/comment/35931278
has comment: http://stackoverflow.com/comment/35931044
has answer: http://stackoverflow.com/a/23442712
has comment: http://stackoverflow.com/comment/35930969
has comment: http://stackoverflow.com/comment/35802375
has comment: http://stackoverflow.com/comment/35898530
has comment: http://stackoverflow.com/comment/35826099
has comment: http://stackoverflow.com/comment/35827744
has comment: http://stackoverflow.com/comment/35931216
score: 0
has comment: http://stackoverflow.com/comment/35906012
tagged with: android-listview
tagged with: custom-adapter
answer count: 1
has comment: http://stackoverflow.com/comment/35931224
has comment: http://stackoverflow.com/comment/35930988
has comment: http://stackoverflow.com/comment/35802114
has comment: http://stackoverflow.com/comment/35798913
has comment: http://stackoverflow.com/comment/35801540
favorite count: 0
has comment: http://stackoverflow.com/comment/35825625
has comment: http://stackoverflow.com/comment/35803114
has comment: http://stackoverflow.com/comment/35825742
has comment: http://stackoverflow.com/comment/35931018
has comment: http://stackoverflow.com/comment/35931069
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35931149
tagged with: android
has comment: http://stackoverflow.com/comment/35790513
tagged with: android-adapter
upvote count: 1
has body: i´m newbie in android programming and try to implement getFilter() into my custom ArrayAdapter an filter the List by Name. I have not found any example that matches with my adapter. Can someone help me with an example please (with my code), thx!!! Maybe there is another possibility to filter the List? java code: public class c_DTArtikel_allforsearch extends Activity implements AdapterView.OnItemClickListener { private ListView ListViewLayout; private EditText search; private String[] Name; private String[] Number; private int[] ImagesID; private ArrayList&lt;Article&gt; articleList = new ArrayList&lt;Article&gt;(); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.layout_lv_search); Resources res = getResources(); String[] saugname = res.getStringArray(R.array.SauglanzeName); String[] pumpmname = res.getStringArray(R.array.PumpMName); String[] saugnummer = res.getStringArray(R.array.SauglanzeNumber); String[] pumpmnummer = res.getStringArray(R.array.PumpMNummer); TypedArray saugimg = res.obtainTypedArray(R.array.SauglanzeImg); TypedArray pumpmimg = res.obtainTypedArray(R.array.PumpeMImg); ArrayList&lt;String&gt; name = new ArrayList&lt;String&gt;(); name.addAll(Arrays.asList(saugname)); name.addAll(Arrays.asList(pumpmname)); Name = name.toArray(new String[saugname.length+pumpmname.length]); ArrayList&lt;String&gt; number = new ArrayList&lt;String&gt;(); number.addAll(Arrays.asList(saugnummer)); number.addAll(Arrays.asList(pumpmnummer)); Number = number.toArray(new String[saugnummer.length+pumpmnummer.length]); ArrayList&lt;Integer&gt; imgInts = new ArrayList&lt;Integer&gt;(); int nr = -1; while ( ++nr &lt; saugimg.length() ) imgInts.add (saugimg.getResourceId(nr, 0)); nr = -1; while ( ++nr &lt; pumpmimg.length() ) imgInts.add (pumpmimg.getResourceId(nr, 0)); ImagesID = new int[imgInts.size()]; for (int i=0; i &lt; imgInts.size(); i++) { ImagesID[i] = ((Integer) imgInts.get(i)).intValue(); } Sea…
has comment: http://stackoverflow.com/comment/35792525
has comment: http://stackoverflow.com/comment/35905893
has comment: http://stackoverflow.com/comment/35905532
tagged with: java
linked to: http://stackoverflow.com/q/23339478
has comment: http://stackoverflow.com/comment/35793049
has title: implementing getFilter(). into custom ArrayAdapter with AsyncTask
downvote count: 1

http://stackoverflow.com/comment/63313578
comment on: http://stackoverflow.com/a/23333893
score: 0
type: AnswerComment
has text: In other [answers](http://stackoverflow.com/questions/33845239/jooq-single-query-with-one-to-many-relationship) (as well as on your [blog](https://blog.jooq.org/2014/07/11/java-8-friday-more-functional-relational-transformation/)) you have mentioned that Java 8's streams can be useful to properly match complex relationships from the database into POJOs. From this perspective, can Streams be used to solve the problem of this question?
type: Comment

http://stackoverflow.com/a/23440074
type: Answer
has body: You have made your two dimensional array using int, so you can only set each one to an integer value. In order to be able to set things like .name or .country you need to make an array of class objects that contain your requirements. Eg: describe your object (note: this is just a simple example, and should be improved) public class MyObject { public String name; public String country; } Then elsewhere: MyObject arr[][] = new MyObject[5][5]; arr[0][3].name = "SomeName";
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/35927529
answers question: http://stackoverflow.com/q/23440058
has comment: http://stackoverflow.com/comment/35927475
has comment: http://stackoverflow.com/comment/35927537
accepted answer of: http://stackoverflow.com/q/23440058
upvote count: 2
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35927486

http://stackoverflow.com/comment/35944860
type: QuestionComment
type: Comment
has text: Multiply by two, round and finally divide by two
score: 7
comment on: http://stackoverflow.com/q/23449662

http://stackoverflow.com/a/23361841
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/23361224
type: Answer
upvote count: 2
has body: Something I fount by google, and use in my project: private final static String algorithm = "PBKDF2WithHmacSHA1"; private final static String HEX = "0123456789ABCDEF"; private static final String CP_ALGORITH = "AES"; private static final String CP_KEY = "PUTsomeKEYinHere"; public static String cipher(String cipherKey, String data) throws NoSuchAlgorithmException, InvalidKeySpecException, NoSuchPaddingException, InvalidKeyException, IllegalBlockSizeException, BadPaddingException { SecretKeyFactory skf = SecretKeyFactory.getInstance(algorithm); KeySpec spec = new PBEKeySpec(cipherKey.toCharArray(), cipherKey.getBytes(), 128, 256); SecretKey tmp = skf.generateSecret(spec); SecretKey key = new SecretKeySpec(tmp.getEncoded(), CP_ALGORITH); Cipher cipher = Cipher.getInstance(CP_ALGORITH); cipher.init(Cipher.ENCRYPT_MODE, key); return toHex(cipher.doFinal(data.getBytes())); } public static String decipher(String cipherKey, String data) throws NoSuchAlgorithmException, InvalidKeySpecException, NoSuchPaddingException, InvalidKeyException, IllegalBlockSizeException, BadPaddingException { SecretKeyFactory skf = SecretKeyFactory.getInstance(algorithm); KeySpec spec = new PBEKeySpec(cipherKey.toCharArray(), cipherKey.getBytes(), 128, 256); SecretKey tmp = skf.generateSecret(spec); SecretKey key = new SecretKeySpec(tmp.getEncoded(), CP_ALGORITH); Cipher cipher = Cipher.getInstance(CP_ALGORITH); cipher.init(Cipher.DECRYPT_MODE, key); return new String(cipher.doFinal(toByte(data))); } private static byte[] toByte(String data) throws NullPointerException{ int len = data.length()/2; byte[] result = new byte[len]; for (int i = 0; i &lt; len; i++) result[i] = Integer.valueOf(data.substring(2*i, 2*i+2), 16).byteValue(); return result; } private static String toHex(byte[] doFinal) { StringBuffer result = new StringBuffer(2*doFinal.length); for (int i = 0; i &lt; doFinal.length; i++) { result.append(HEX.charAt((doFinal[i]&gt;&gt;4)&amp;0x0f)).append(HEX.charAt(doFinal[i]&amp;0x0f)); } ret…

http://stackoverflow.com/q/23441481
has answer: http://stackoverflow.com/a/23441508
tagged with: superclass
has title: super keyword without extends to the super class
type: AnsweredQuestion
tagged with: super
tagged with: java
type: Question
upvote count: 12
accepted answer: http://stackoverflow.com/a/23441508
possible better answer: http://stackoverflow.com/a/23441501
score: 12
answer count: 3
has answer: http://stackoverflow.com/a/23441501
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/58437429
has body: There is a code of simple program. In constructor, super() is called without extends to the super class, I can not understand what will does this in this situation? public class Student { private String name; private int rollNum; Student(String name,int rollNum){ super(); //I can not understand why super keyword here. this.name=name; this.rollNum=rollNum; } public static void main(String[] args) { Student s1 = new Student("A",1); Student s2 = new Student("A",1); System.out.println(s1.equals(s2)); } }

http://stackoverflow.com/a/23338891
has comment: http://stackoverflow.com/comment/35740537
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35739230
type: Answer
accepted answer of: http://stackoverflow.com/q/23338404
has body: Ok, so I did some research. According to this document the put operation has a happens-before relation with contains keys. Hence if we use a ConcurrentHashMap the double-checked locking should work
answers question: http://stackoverflow.com/q/23338404

http://stackoverflow.com/q/23405145
downvote count: 2
tagged with: timing
type: AnsweredQuestion
tagged with: java
tagged with: adt
has answer: http://stackoverflow.com/a/23405433
tagged with: eclipse
type: Question
has body: I'm programming a little Javagame for Android and would like to know if there is a possibility in Eclipse to find out which method takes the most time to execute.
upvote count: 0
score: -2
answer count: 1
linked to: http://stackoverflow.com/q/3871311
has comment: http://stackoverflow.com/comment/35861463
has comment: http://stackoverflow.com/comment/35861562
duplicate of: http://stackoverflow.com/q/3871311
accepted answer: http://stackoverflow.com/a/23405433
tagged with: android
favorite count: 0
has title: Is there a way to find out which method takes most time ? Eclipse Java

http://stackoverflow.com/q/23364143
has title: Java SimpleDateFormat Parse Wrong Date
answer count: 2
tagged with: java-7
downvote count: 0
favorite count: 0
tagged with: parsing
has comment: http://stackoverflow.com/comment/35793697
upvote count: 2
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23364222
score: 2
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/46033079
tagged with: simpledateformat
has body: I'm trying to use the parse function of SimpleDateFormat to turn a String into a Date SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-YYYY"); String strInput1 = "29-04-2014"; System.out.println("string 1: " + strInput1); Date date1 = new Date(); try { date1 = sdf.parse(strInput1); } catch (ParseException e) { // TODO Auto-generated catch block e.printStackTrace(); } System.out.println("date 1: " + date1.toString()); String strInput2 = sdf.format(date1); System.out.println("string 2: " +strInput2); Date date2 = new Date(); try { date2 = sdf.parse(strInput2); } catch (ParseException e) { // TODO Auto-generated catch block e.printStackTrace(); } System.out.println("date 2 " + date2); The output for date1 is Mon Dec 30 00:00:00 GMT 2013, which is then correctly parsed to 30-12-2014. I assume the mistake is somewhere when sdf is initialized.

http://stackoverflow.com/q/23412873
has comment: http://stackoverflow.com/comment/35876799
tagged with: jtextarea
has answer: http://stackoverflow.com/a/23413378
has title: JTextArea won't allow for text to be typed in
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/35876561
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/35876752
has body: I've read up on the other questions about JTextArea and moved the setVisible(true) to the bottom, but my JTextArea still will not let me display text. My code is below, it is the constructor of a class that extends JPanel, it won't show anything when I type into the JTextArea. The JTextArea appears in the middle, called "newText." Thank you for your help! EditScreen(TaskMaster taskMaster, Task toEdit){ this.taskMaster = taskMaster; editingTask = toEdit; textAreaShading = new Color(10, 20, 20, 20); initBackground(); this.setLayout(new BorderLayout(500,500)); this.setBackground(background); //this might not be initializedset topToolbar = new JPanel(); topToolbar.setBorder(BorderFactory.createEmptyBorder(5,5,5,5)); topToolbar.setOpaque(false); topToolbar.setLayout(new BoxLayout(topToolbar, BoxLayout.X_AXIS)); category = new JLabel("Choose type:"); categories = new JComboBox(catS); date = new JTextField(10); topToolbar.add(category); topToolbar.add(categories); topToolbar.add(new JLabel("Due Date:")); topToolbar.add(date); textPanel = new JPanel(); //textPanel.setLayout(new BoxLayout(textPanel, BoxLayout.Y_AXIS)); textPanel.setBorder(BorderFactory.createEmptyBorder(5,5,5,5)); textPanel.setLayout(new BorderLayout()); //textPanel.setOpaque(false); textPanel.setBackground(Color.CYAN); newText = new JTextArea(); newText.setOpaque(true); newText.setBackground(textAreaShading); newText.setLineWrap(true); newText.setWrapStyleWord(true); textPanel.add(BorderLayout.CENTER, newText); bottomPanel = new JPanel(); bottomPanel.setBorder(BorderFactory.createEmptyBorder(5,5,2,0)); bottomPanel.setOpaque(false); bottomPanel.setLayout(new BoxLayout(bottomPanel, BoxLayout.X_AXIS)); priority = new JComboBox(priorityS); cancel = new JButton("Cancel"); save = new JButton("Save"); bottomPanel.add(new JLabel("Choose Priority:")); bottomPanel.add(priority); bottomPanel.add(cancel); bottomPanel.add(save); //set layout and size of frame this.add(topToolbar,BorderLayout.NORTH); this.add(textPanel, …
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35876562
tagged with: java
upvote count: 1
tagged with: swing
type: Question

http://stackoverflow.com/comment/35720488
comment on: http://stackoverflow.com/q/23328345
score: 0
has text: So I see that Java is pass-by-value, but I'm unsure how to apply that to my problem. If this was a language like PHP this wouldn't even be an issue...
type: Comment
type: QuestionComment

jbutton
tags question: http://stackoverflow.com/q/23400708
tags question: http://stackoverflow.com/q/23429554
tags question: http://stackoverflow.com/q/23320986
tags question: http://stackoverflow.com/q/23421855
tags question: http://stackoverflow.com/q/23376906
tags question: http://stackoverflow.com/q/23372456
tags question: http://stackoverflow.com/q/23398574
tags question: http://stackoverflow.com/q/23444599
tags question: http://stackoverflow.com/q/23375276
tags question: http://stackoverflow.com/q/23301617
tags question: http://stackoverflow.com/q/23316243
tags question: http://stackoverflow.com/q/23449242
tags question: http://stackoverflow.com/q/23315937
type: Tag
tags question: http://stackoverflow.com/q/23349154
tags question: http://stackoverflow.com/q/23422313
tags question: http://stackoverflow.com/q/23291193
tags question: http://stackoverflow.com/q/23413589
tags question: http://stackoverflow.com/q/23358157
tags question: http://stackoverflow.com/q/23355208
tags question: http://stackoverflow.com/q/23311314
tags question: http://stackoverflow.com/q/23393697
tag name: jbutton
tags question: http://stackoverflow.com/q/23358464
tags question: http://stackoverflow.com/q/23356688
tags question: http://stackoverflow.com/q/23435985

http://stackoverflow.com/a/23363156
answers question: http://stackoverflow.com/q/23363074
downvote count: 0
has body: In Java, it is common to combine several classes in one .jar ("java archive") file. Library classes are stored that way. Larger projects (such as the Case Study in the AP program) use jar files. You can create your own jar file combining several classes, too. jar files are created using the jar.exe utility program from JDK. You can make your jar file runnable by telling jar.exe which class has main. To do that, you need to create a manifest file. A manifest is a one-line text file with a "Main-Class" directive. For example: Main-Class: Craps This line must end with a newline. A jar file created with a main class manifest can be used both as a library and a runnable jar. If you use it as a library, you can edit and compile any of the classes included in the jar, and add it to your project. Then it will override the one in the jar file. You can create a manifest file in any text editor, or even by using the MS-DOS echo command. You can give your manifest file any name, but it's better to use something standard, such as manifest.txt. Once you have a manifest and all your classes have been compiled, you need to run JDK's jar.exe utility. It is located in the JDK’s bin folder, the same place where javac.exe and java.exe are. jar.exe takes command-line arguments; if you run it without any arguments, it will display the usage information and examples. You need C\mywork> jar cvfm MyJarName.jar manifest.txt *.class cvfm means "create a jar; show verbose output; specify the output jar file name; specify the manifest file name." This is followed by the name you wish to give to your jar file, the name of your manifest file, and the list of .class files that you want included in the jar. *.class means all class files in the current directory. Actually, if your manifest contains only the Main-Class directive, you can specify the main class directly on the jar.exe's command line, using the e switch, instead of m. Then you do not need a separate manifest file; jar will add the requ…
upvote count: 2
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/35783902
has comment: http://stackoverflow.com/comment/35783838
has comment: http://stackoverflow.com/comment/35783538

http://stackoverflow.com/a/23429495
type: AcceptedAnswer
type: Answer
upvote count: 1
score: 1
has body: I can recommend a different way that works like a charm: Android Query. You can download that JAR file from here AQuery androidAQuery = new AQuery(this); As an example: androidAQuery.id(YOUR IMAGEVIEW).image(YOUR IMAGE TO LOAD, true, true, getDeviceWidth(), ANY DEFAULT IMAGE YOU WANT TO SHOW); It's very fast and accurate, and using this you can find many more features like animation when loading, getting a bitmap (if needed), etc.
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23429388
answers question: http://stackoverflow.com/q/23429388

http://stackoverflow.com/a/23422434
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/35895084
answers question: http://stackoverflow.com/q/23421699
score: 2
downvote count: 0
has body: Hi again guys i wanted to mention something, when i extracted the maven created jar file and copied the POM.xml file in a separate location and installed the jar file by referencing to it . it worked fine but i dont know why my first command din`t work! here is the command that worked; mvn install:install-file -Dfile=E:\jarFiles\utill-1.0.jar -DpomFile=E:\jarFiles\pom.xml -DloaclRepositoryPath=E:\repo by the way obviously mvn install , also works fine and installs the jar file to my local repository.

http://stackoverflow.com/a/23392804
has body: i know this is not what really PO want but i think this may helpful. Wrapers can help in this situation. you can create two Class and one interface: interface SpecialList&lt;T&gt; { T get(int i); void add(T item); } class CatList implements SpecialList&lt;Cat&gt; { private List&lt;Cat&gt; list; ... } class OrangeList implements SpecialList&lt;Orange&gt; { private List&lt;Cat&gt; list; ... } then Observable can return a SpecialList object. in this case instance of will work.
type: Answer
upvote count: 1
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/23392208

http://stackoverflow.com/q/23436596
has answer: http://stackoverflow.com/a/23436729
answer count: 1
downvote count: 0
tagged with: memory-footprint
favorite count: 0
has body: It seems to be an established fact that Java programs use a lot more memory than C++ programs do. According to an answer on StackExchange, this is due to the nature of Garbage Collection and the bytecode nature of Java's "binaries". But what role does reflection play in this case? In Java it is possible to enumerate and call the variables and methods of a class as plain text, that is provided at runtime. For this to be possible there has be some kind of stored metadata that links these String keys with their respective attributes. Is this metadata stored on the heap, and if so, is there a way to disabled it for classes for which I don't need reflection anyway? (Plain old data)
score: 2
type: AnsweredQuestion
tagged with: metadata
tagged with: reflection
upvote count: 2
tagged with: metaprogramming
accepted answer: http://stackoverflow.com/a/23436729
type: Question
has title: How does Java's reflection impact its memory footprint?
tagged with: java

http://stackoverflow.com/a/23303921
downvote count: 0
answers question: http://stackoverflow.com/q/23302906
has body: I added working solution based on pseudo-code in Niklas answer : public TreeNode successor(TreeNode node) { if (node == null) return node; if (node.right != null) { return leftMostNode(node.right); } while (null != node.parent /*while we are not root*/ &amp;&amp; node.parent.right == node) /* and while we are "right" node */ { node = node.parent; // go one level up } return node.parent; } For this to work, you have to fix implementation of some of your methods (provided below) : /** Search value in Tree need for Successor **/ public TreeNode search(int key) { TreeNode node = root; while (node != null &amp;&amp; key != node.value) { if(key &lt; node.value) { node = node.left; } else if (key &gt; node.value) { node = node.right; } } return node; } /** Returns Successor of given value **/ public int getSuccessor(int val) { TreeNode node; if (null == (node = search(val)) || (null == (node = successor(node))) { // either val is not in BST, or it is the last value-&gt; no successor return ERROR_CODE; // -1, for instance; } return node.value; }
type: Answer
accepted answer of: http://stackoverflow.com/q/23302906
has comment: http://stackoverflow.com/comment/35691755
upvote count: 3
has comment: http://stackoverflow.com/comment/35684712
has comment: http://stackoverflow.com/comment/35678819
score: 3
type: AcceptedAnswer

http://stackoverflow.com/comment/35813953
score: 0
comment on: http://stackoverflow.com/q/23379192
has text: Are you asking about the recommended file content format or how to implement file I/O in Java?
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35915910
type: QuestionComment
comment on: http://stackoverflow.com/q/23433789
has text: What is the point of saying "You have several errors caused by basic misconceptions about the way java works. " Was that supposed to be constructive criticism? If so would you mind adding the constructive part so its not just a waste of time reading your condescending comments that provide no helpful feedback?
score: 0
type: Comment

http://stackoverflow.com/comment/35838794
comment on: http://stackoverflow.com/q/23392408
has text: @Karakuri Clarified what I meant
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35884687
score: 0
type: AnswerComment
has text: Think of it like this 1) server listens 2) client connects and server stores the client (service) 3) client sends a message to server 4) server gets the message and sends it to everyone in the service list. In actuality the clients are never talking to each other, the server receives all messages and forwards them between users (if its private chat) or to everyone (general chat).
type: Comment
comment on: http://stackoverflow.com/a/23414599

http://stackoverflow.com/comment/35886180
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/23398524
score: 0
has text: @Fingolricks A|B performs a bit-wise or, which is exactly what you need. For example, 2|3=3 (since 010|011=011). You should read about binary operators in java. And you can find the number of zeroes in the binary representation of the int without converting it to string. You can read about it [here](http://stackoverflow.com/questions/109023/how-to-count-the-number-of-set-bits-in-a-32-bit-integer).

http://stackoverflow.com/comment/35924795
type: Comment
has text: OK, does your encryption/decryption algorithm use fixed size blocks? That is, if I read from offset x and y, can I decrypt this range individually as long as x and y are on block boundaries?
comment on: http://stackoverflow.com/a/23438317
score: 0
type: AnswerComment

http://stackoverflow.com/a/23472062
upvote count: 1
answers question: http://stackoverflow.com/q/23293534
downvote count: 0
has comment: http://stackoverflow.com/comment/35987657
has body: Maybe this can help you. It works for my project on WebLogic. String getClassPath() { final String BASE_PATH = "&lt;your_project_folder_name&gt;"; String path = ""; String classPathProperty = System.getProperty("java.class.path"); if (classPathProperty != null) { path = classPathProperty + File.pathSeparator; } URL classLocation = this.getClass().getProtectionDomain().getCodeSource().getLocation(); URL classesLocation = this.getClass().getClassLoader().getResource("/"); if (classesLocation == null) { path = path + classLocation.getPath(); } else { String classesLocationPath = classesLocation.getPath(); String libsLocationPath = classesLocationPath + "../lib"; File libsLocation = new File(libsLocationPath); if (libsLocation.exists() == false) { libsLocationPath = URLDecoder.decode(classesLocationPath + "../" + BASE_PATH + "/WEB-INF/lib/"); libsLocation = new File(libsLocationPath); } File[] filesInLibraryPath = libsLocation.listFiles(new FilenameFilter() { @Override public boolean accept(File dir, String name) { return name.endsWith(".jar"); } }); if (filesInLibraryPath != null) { for (File libraryFile : filesInLibraryPath) { libsLocationPath += File.pathSeparator + URLDecoder.decode(libraryFile.getAbsolutePath()); } } path = path + classLocation.getPath() + File.pathSeparator + classesLocationPath + File.pathSeparator + libsLocationPath; path = URLDecoder.decode(path); } return path; }
type: Answer
score: 1

http://stackoverflow.com/a/23388628
answers question: http://stackoverflow.com/q/23388557
type: Answer
has body: You are not checking null for request attributes. replace String user = request.getParameter("user"); String pass = request.getParameter("pass"); with String user = request.getParameter("user") != null ? request.getParameter("user") : ""; String pass = request.getParameter("pass") != null ? request.getParameter("pass") : "";
score: 0

http://stackoverflow.com/q/23419192
tagged with: android
downvote count: 2
upvote count: 1
accepted answer: http://stackoverflow.com/a/23419216
has answer: http://stackoverflow.com/a/23452855
type: AnsweredQuestion
tagged with: java
score: -1
possible better answer: http://stackoverflow.com/a/23419217
type: Question
has title: Caused by java.lang.NullPointerException and java.lang.RuntimeException
has answer: http://stackoverflow.com/a/23419217
has body: I keep getting this error, I am not sure what's causing it. I declared and initialized the variables, but the error didn't disappear. I have been looking at the same error but I can't catch the mistake. 05-01 20:57:43.162 32675-32675/com.ammar.customlistview1.app W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0x40be21f8) 05-01 20:57:43.172 32675-32675/com.ammar.customlistview1.app E/AndroidRuntime﹕ FATAL EXCEPTION: main java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.ammar.customlistview1.app/com.ammar.customlistview1.app.MainActivity}: java.lang.NullPointerException at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1891) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1992) at android.app.ActivityThread.access$600(ActivityThread.java:127) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1158) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:137) at android.app.ActivityThread.main(ActivityThread.java:4511) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:511) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:976) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:743) at dalvik.system.NativeStart.main(Native Method) Caused by: java.lang.NullPointerException at android.app.Activity.findViewById(Activity.java:1810) at com.ammar.customlistview1.app.MainActivity.&lt;init&gt;(MainActivity.java:16) at java.lang.Class.newInstanceImpl(Native Method) at java.lang.Class.newInstance(Class.java:1319) at android.app.Instrumentation.newActivity(Instrumentation.java:1026) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1882) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1992) at android.app.ActivityThread.access$600(ActivityThread.java:127) at android.app.ActivityThread$H.handleMessage(Act…
favorite count: 0
has answer: http://stackoverflow.com/a/23419216
answer count: 3

http://stackoverflow.com/comment/35756021
comment on: http://stackoverflow.com/q/23347529
score: 0
has text: Your view doesn't have include.jsp ;)
type: QuestionComment
type: Comment

http://stackoverflow.com/q/23364294
answer count: 0
upvote count: 2
type: UnansweredQuestion
score: 2
tagged with: java
has body: I have a java web application(hosted in Linux) which speaks to a document management system which is a .NET based system via rest services. By default SSO Kerberos authentication is used in document system and for the same we are passing SSO Token to identify the user who accesses our application via web browser. This works fine and the document system is able to identify the user and allows user to upload document. However we have a problem when a user who belongs to a different domain/AD tries to access the application. This is due to the external trust level between the environment document service is hosted and user environment. The document mgmt system supports NTLM authentication to handle this scenario and we were told that we need to pass credential object in the request. It appears there are easy ways for .NET client to extract user credential using CredentialCache object but I am struggling to find equivalent in Java. I am trying to find out a way to pull the users windows credential so that I can set in the credentials object before i send the request to document system. Our application is SSO enabled, hence we dont want the user to explicitly pass his windows credential.
type: Question
has title: Java web application - retrieving client windows credential
tagged with: ntlm
downvote count: 0
favorite count: 0

http://stackoverflow.com/a/23400015
answers question: http://stackoverflow.com/q/23399994
has body: Your tomcat configuration must be using a different java version. Check catalina.sh / catalina.bat, and check the java version mentioned in those files. By default it uses JAVA_HOME so if you have set it correctly and have not played with tomcat sh/bat files then it should work.
score: 0
accepted answer of: http://stackoverflow.com/q/23399994
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/comment/35890002
type: Comment
score: 0
has text: @user3519829 There's no need for a new question. You can edit this question, and make it suitable for future reference. The point of StackOverflow is to ask questions that haven't been asked before. That way, it can be a page of information that others can reference to later. Creating a new question would be seen as spam (probably get marked as duplicate). If you edit your question, I will edit my answer
type: AnswerComment
comment on: http://stackoverflow.com/a/23398646

http://stackoverflow.com/comment/35856387
comment on: http://stackoverflow.com/q/23402289
has text: Why can you pass a char as an int? Passing 'd' instead of an int.
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/comment/101284615
comment on: http://stackoverflow.com/a/23409312
type: Comment
has text: `Date` is very old; Java has much better date-related classes now. If you want to be aware of timezones, an [`Instant`](https://docs.oracle.com/javase/8/docs/api/java/time/Instant.html) would probably be more suitable. (Or if not, a [`LocalDateTime`](https://docs.oracle.com/javase/8/docs/api/java/time/LocalDateTime.html).)
score: 0
type: AnswerComment

http://stackoverflow.com/q/23291931
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/36066398
tagged with: lotus-domino
type: Question
tagged with: session
downvote count: 0
tagged with: xpages
has body: Domino version: 9.0.1 Use Case I have a main database(DB0.nsf) on which the user has the reader access right and N databases on which the currently logged user has different levels of access (example DB1 - default user is reader; DB2 - User no access, DB3 - user's group is author) User opens xpage from the main database. XPage contains a view panel that should display the list of databases over whom currently logged user has minimum reader access. This view is acting strange, ie. sometimes it works as expected and all the database over which the user has minimum reader access are displayed, and sometimes it does not display all databases.(In my example user should see DB1 and DB3, but sometimes he sees only one DB3, he does not see the database which has default access in ACL set to Reader) xpage xsp contains a view panel where the source is list of objects, defined in Managed Bean as attribute managed bean session scope Snippet of my code String path=paths.get(0).replace("\\","\\\\"); String srv=srvss.get(0); dbSearch=NotesContext.getCurrent().getCurrentSession().getDatabase(srv,path,false); The problem On db1.nsf.ACL entry Default access is set to reader. With the same user logged in, I have different results of above code. User just refreshes the page constantly and sometimes the exception is thrown in the getDatabase line. NotesException: User user cannot open database TEST\\test\\db1.nsf at lotus.domino.local.Session.NgetDatabase(Native Method) at lotus.domino.local.Session.getDatabase(Unknown Source) Extra debug I added a few lines for debug - and when exception is thrown I get same database as session signer and print access level for every ACL entry in that database. in my example I open DB1.nsf as sessionAsSigner and in console I see that default ACL level for DB1.nsf is Reader. Any suggestions would be appreciated.
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/35832750
favorite count: 0
has comment: http://stackoverflow.com/comment/35731143
type: UnansweredQuestion
has title: xPage NotesContext getDatabase ACL issues
has comment: http://stackoverflow.com/comment/35730501
has comment: http://stackoverflow.com/comment/35654294
tagged with: managed-bean
has answer: http://stackoverflow.com/a/23334448

http://stackoverflow.com/a/23363904
answers question: http://stackoverflow.com/q/23362562
type: Answer
has body: The JComboBox class implements the interfaces of various event listeners (ActionListener, etc.). Because the interfaces enforce public access, the JComboBox class defines those methods as public as well. The comment is there to let developers know that they should not call these methods explicitly, even though they have public access.
score: 3
upvote count: 3
downvote count: 0

http://stackoverflow.com/a/23396638
upvote count: 2
score: 2
downvote count: 0
has body: check this sample custom navigation drawer inside onclick SelectItem.get(position).setColor(getResources().getColor("your color"));
type: Answer
answers question: http://stackoverflow.com/q/23396434

http://stackoverflow.com/q/23415688
accepted answer: http://stackoverflow.com/a/23415922
type: Question
has answer: http://stackoverflow.com/a/23415922
has body: I have this program that reads a text file from my computer. the text file is a list of titles. Im trying to figure out how to tokenize what is returned so that I get the full name instead of a piece. All the examples I am able to find involve regular arrays and Im using an arraylist. I need to be able to read each string back into my arraylist and cut it off where the &amp; are. The Text file looks like this: Star Wars&amp; DVD&amp; Lord of the Rings&amp; DVD&amp; Resident Evil&amp; DVD&amp; public static void main(String[] args) { File f = new File("file.txt"); try { ArrayList&lt;String&gt; lines = get_arraylist_from_file(f); for (int x = 0; x &lt; lines.size(); x++) { System.out.println(lines.get(x)); } } catch (Exception e) { e.printStackTrace(); } System.out.println("done"); } public static ArrayList&lt;String&gt; get_arraylist_from_file(File f) throws FileNotFoundException { Scanner s; ArrayList&lt;String&gt; list = new ArrayList&lt;String&gt;(); s = new Scanner(f); while (s.hasNext()) { list.add(s.next()); } s.close(); return list; }
tagged with: arraylist
possible better answer: http://stackoverflow.com/a/23415750
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/23415750
has comment: http://stackoverflow.com/comment/35881943
has comment: http://stackoverflow.com/comment/35882196
has title: java tokenize strings read from a text file
type: AnsweredQuestion
tagged with: tokenize
tagged with: java
has comment: http://stackoverflow.com/comment/35881934

http://stackoverflow.com/a/23377637
answers question: http://stackoverflow.com/q/23377594
score: 1
type: Answer
upvote count: 1
has body: You'll have to use reflection: Method m = Main.class.getMethod("doBlah"); m.invoke(new Main(), null) You can add many more other arguments both for retrieving the method and invoking it, all of which can be found here.
accepted answer of: http://stackoverflow.com/q/23377594
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/35742902
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23340408
has text: Do you really need to sort the list at all? Do you just need the most recently modified file? If so, you can do it in one pass, which will be about 15 times faster.

http://stackoverflow.com/q/23424542
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23428462
has body: How to return result from event handler in javafx? I have bellow code, and how to return data from event to function showPrompt? Is it possible to recover the data for the function of the event? public static String showPrompt(String title, String defValue){ final Stage dlgStage = new Stage(); TextField txtPromptValue = new TextField(defValue); Button btnOk = new Button("Ok"); Button btnCancel = new Button("Cancel"); btnOk.setOnAction(new EventHandler&lt;ActionEvent&gt;(){ @Override public void handle(ActionEvent arg0) { //How to return data from event to function? dlgStage.close(); } }); btnCancel.setOnAction(new EventHandler&lt;ActionEvent&gt;(){ @Override public void handle(ActionEvent arg0) { //How to return data from event to function? dlgStage.close(); } }); // Label lblTitle = new Label(title); lblTitle.setFont(Font.font("Amble CN", FontWeight.NORMAL, 14)); // VBox vbox = new VBox(lblTitle,txtPromptValue,btnOk,btnCancel); vbox.setAlignment(Pos.CENTER); vbox.setMinSize(300, 200); // Scene dlgScene = new Scene(vbox); // dlgStage.setScene(dlgScene); dlgStage.initStyle(StageStyle.UNDECORATED); dlgStage.initModality(Modality.APPLICATION_MODAL); dlgStage.setMinWidth(300); dlgStage.setMinHeight(200); dlgStage.show(); }
has title: How to return result from event handler in javafx?
tagged with: javafx
upvote count: 1
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/23425237
has comment: http://stackoverflow.com/comment/35898492
possible better answer: http://stackoverflow.com/a/23425664
has answer: http://stackoverflow.com/a/23425664
downvote count: 0
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/35898724
answer count: 3
accepted answer: http://stackoverflow.com/a/23425237

http://stackoverflow.com/comment/35765835
type: Comment
score: 1
has text: @Asaph That doesn't support your contention in any way. Nor does it contradict the part I have quoted. You're clutching at straws.
type: AnswerComment
comment on: http://stackoverflow.com/a/23352907

http://stackoverflow.com/comment/35856226
comment on: http://stackoverflow.com/q/23402244
type: Comment
type: QuestionComment
has text: What is your code so far?
score: 0

http://stackoverflow.com/comment/35913234
type: Comment
has text: No, what it means is "the local `x` that's a parameter to `Point` is hiding the class member `x`." So you are hiding one variable that is named the same as a variable in an outer scope.
type: QuestionComment
comment on: http://stackoverflow.com/q/23432722
score: 0

http://stackoverflow.com/comment/35906095
has text: Your problem is, you are not able to get the mobile number submitted from the second page to the controller, right?
type: QuestionComment
comment on: http://stackoverflow.com/q/23428115
score: 0
type: Comment

http://stackoverflow.com/comment/35657718
comment on: http://stackoverflow.com/a/23294125
type: Comment
has text: also, you don't need `if (!found)`, because you exit the loop as soon as this boolean turns true anyway ;-) Even if we were not sure that found is false, assigning true to a true boolean is not wrong anyway ^^
type: AnswerComment
score: 0

http://stackoverflow.com/comment/35758254
type: QuestionComment
has text: Let me look into what you wrote. I think I might have the same probelm also with none unicode things. Any idea on how the `file.list()` method works. Because the folders worked before renaming them.
score: 0
comment on: http://stackoverflow.com/q/23303395
type: Comment

http://stackoverflow.com/q/23394709
has comment: http://stackoverflow.com/comment/35844214
downvote count: 0
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23395977
has answer: http://stackoverflow.com/a/23395008
has body: The following method tries to get the data for the row that has java.sql.Time &lt; currentTime. In spite of table having a time entry less than current time, the query doesn't return any result and the program never enters the inner while loop. Why is that ? Where am I going wrong ? private void find() { Session session = new HVR().getSession(); while(isThreadRunning) { String hql = "from Scheduled where stime &lt;'" + new java.sql.Time(new GregorianCalendar().getTimeInMillis()) + "'"; List list = session.createQuery(hql).list(); Iterator iterator = list.iterator(); System.out.println("Inside outer while loop"); while(iterator.hasNext()) { System.out.println("Inside inner while loop"); Scheduled scheduled = (Scheduled)iterator.next(); String tweet = scheduled.getTweet(); int id = scheduled.getId(); tweetThread(tweet, id); // Tweet on a separate thread } } }
has comment: http://stackoverflow.com/comment/35842442
score: 1
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/35844052
has title: Why doesn't the query return any result when the table is populated with the data?
upvote count: 1
has comment: http://stackoverflow.com/comment/35844085
type: Question
has comment: http://stackoverflow.com/comment/35844145
has comment: http://stackoverflow.com/comment/35842593
has answer: http://stackoverflow.com/a/23395004
has comment: http://stackoverflow.com/comment/35844281
has comment: http://stackoverflow.com/comment/35842749
answer count: 3

http://stackoverflow.com/comment/35949467
type: QuestionComment
has text: Because I want to start an activity when the main activity is created. Is this incorrect?
score: 0
comment on: http://stackoverflow.com/q/23451210
type: Comment

http://stackoverflow.com/comment/35739216
has text: You said result should be 3000 and 10000.. and that's right.. but what is the actual outcome? where is the problem?
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23338628

http://stackoverflow.com/comment/35769671
has text: @AlanW and it prints?? upon clicking the button?
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23355255

http://stackoverflow.com/a/23768990
accepted answer of: http://stackoverflow.com/q/23424312
answers question: http://stackoverflow.com/q/23424312
upvote count: 42
type: AcceptedAnswer
downvote count: 0
score: 42
has comment: http://stackoverflow.com/comment/36553674
has body: Pivotal tc Server contains all of vanilla Tomcat, and has a few optional extensions designed to make it easier to deploy and maintain. Broken out into three groups, the diff looks like this: Configuration extensions (No altered code, just config changes we implement) Multi-Instance using shared binaries Trivial to change Tomcat versions while preserving app and configuration Variable Substitution in config files Async Logging Mild Security Tuning (ports, mgmt apps, JMX) Code Extensions Patch version releases – fix flaws in current release [e.g. tomcat-7.0.32.B.RELEASE] Extended JMX interface Additional Metrics Application Deployment Diagnostics Valve - good troubleshooting info when there's a slowdown Config Templates – including custom-created Change log level on the fly Advanced Session replication (Gemfire) Oracle DB Connection Proxy Add-Ons Windows Service Wrapper RPM / Apt-Get / Debian installers (linux) Startup scripts (linux) Chef Recipes Puppet Scripts Password Encryption Spring Insight for performance tuning FYI on the tag thing, there's still the old "springsource-tc-server" tag. SpringSource is now Pivotal. (Can/should we update the tag or add a new one?) Hope this helps.
type: Answer

http://stackoverflow.com/comment/35917217
score: 2
comment on: http://stackoverflow.com/a/23434754
has text: @user3580294: if you want a synchronized implementation, similar to Vector, you just need `Collections.synchronizedList(new ArrayList())`
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/35690591
type: Comment
type: QuestionComment
has text: It just doesn't make sense to me, why it works for the first JSON object and doesn't work for the second.
comment on: http://stackoverflow.com/q/23311648
score: 0

http://stackoverflow.com/q/23384099
has answer: http://stackoverflow.com/a/23398647
tagged with: selenium
has body: I want to select from a li (it looks like a dropdown but it is not) the second value (in my example, Bellevue). Here is a screenshot: I am using Page Objects and I am looking after elements using @FindBy annonations. Here is what I tried: @FindBy(how=How.CSS,using = "a[id^='ui-id-'][1]") I receive the error: The given selector a[id*='ui-id-'](1) is either invalid or does not result in a WebElement or using @FindBy(how=How.CSS,using = "a[id^='ui-id-']"[1])` I get the error: the type of expression must be an array but it resolved to string`. It worked if I used: WebElement value = driver.findElements(By.cssSelector("a[id^='ui-id']")).get(3); value.click(); but I must use @FindBy and I can not get it to work on get(3) method.
type: AnsweredQuestion
tagged with: java
has title: How to find the second value with same CSS class using Selenium webdriver
tagged with: webdriver
type: Question
possible better answer: http://stackoverflow.com/a/23384358
score: 0
answer count: 3
accepted answer: http://stackoverflow.com/a/23398647
tagged with: css
has answer: http://stackoverflow.com/a/23395272
has answer: http://stackoverflow.com/a/23384358

http://stackoverflow.com/comment/35687978
score: 0
type: Comment
type: QuestionComment
has text: @GilbertLeBlanc I tried doing everything in the watcher thread but still crashes sometimes.
comment on: http://stackoverflow.com/q/23298187

http://stackoverflow.com/comment/35671480
has text: Good spot. I missed that.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23301611

http://stackoverflow.com/a/23293902
upvote count: 1
downvote count: 0
answers question: http://stackoverflow.com/q/23293871
score: 1
has body: Try the next: String output = new StringBuilder(input).reverse().toString();
type: Answer

http://stackoverflow.com/comment/35742402
type: QuestionComment
has text: @duffymo Sorry, I don't get it. Can you give an example?
comment on: http://stackoverflow.com/q/23340646
score: 0
type: Comment

http://stackoverflow.com/q/23304778
has comment: http://stackoverflow.com/comment/35677527
linked to: http://stackoverflow.com/q/14889951
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/35684550
type: UnansweredQuestion
has body: I am making an assumption that a code path is only executed once within the JVM. However, when writing complex, multi-threaded system sometimes the assumption can be wrong. Are there any one liner assertion I can use to assert this. Something like Guava's Preconditions.checkState(expr) but more like assertAtMostTimes(1, "Should not be executing more than once"). Prefer something simple rather than tracking number of times in a class variable. This is similar to how test cases can be written but I am looking for something in production code.
has answer: http://stackoverflow.com/a/23304810
has title: How to assert that execution path is not executed more than once in Java?
score: 1
tagged with: java
upvote count: 1
type: Question

http://stackoverflow.com/comment/35673642
type: Comment
score: 2
has text: @Barry it would also help the stigma of this site being noob/learner/student unfriendly
comment on: http://stackoverflow.com/q/23302660
type: QuestionComment

http://stackoverflow.com/comment/35662987
comment on: http://stackoverflow.com/a/23296840
has text: Yeah I thought about that originally with the assumption that it will always be a square, which although I have been told should, I shouldn't rely fully on it... If only Java kept track of the length of the largest inner array, then I wouldn't mind a lit bit of wasted space if it was jagged.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/36083878
has text: that's exactly what you want.. to make sure that your tests are independent and quick, you need them to open their own browser each time.
score: 0
comment on: http://stackoverflow.com/a/23301937
type: Comment
type: AnswerComment

jide
tags question: http://stackoverflow.com/q/23383232
tag name: jide
type: Tag

http://stackoverflow.com/comment/36042070
type: AnswerComment
has text: It didn't help =[ Data storage rised to 3.88mb and keep rising. I don't really know why it happens... Maybe somehow it is possible to delete this database? Like I am deleting SharedPreferences File file= new File("/data/data/com.example.testlogo/shared_prefs/LevelOne.xml"); file.delete();
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23403059

http://stackoverflow.com/a/23341125
answers question: http://stackoverflow.com/q/23341087
downvote count: 0
score: 4
type: Answer
has body: You need to put quotes around your input String query= "select person_id from person " + "where person_name= '"+ inputname + "'"; Or better use Prepared Statements to let the escaping do the program for you automatically.
upvote count: 4

http://stackoverflow.com/comment/35786508
score: 1
type: Comment
type: QuestionComment
has text: *A marker interface to denote that an object implements a view on some other object.* It doesn't seem to be *some other object* but the object itself. That's what bugs me.
comment on: http://stackoverflow.com/q/23364402

http://stackoverflow.com/comment/35821746
has text: You do not need it for method `addItem`. You *probably* need it for `getAllItems` but since you have not shared code of this method I cannot say whether you can eliminate this parameter. Try to ask another question and share more code.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23383313

http://stackoverflow.com/q/23443585
has title: JBPM 6 REST interface responses with 404
possible better answer: http://stackoverflow.com/a/23456165
score: 0
answer count: 2
tagged with: jbpm
accepted answer: http://stackoverflow.com/a/24331369
tagged with: rest
has answer: http://stackoverflow.com/a/24331369
has body: In BRMS 5 (with JBPM 5.2) when I go to the http://localhost:8080/business-central-server/rs/server/resources/jbpm I have listed all available methods, but in BRMS 6 there is no business-central-server application, it's only business-central - where can I find similar page there? I also tried to connect with REST using following code: public class Test { public static void main(String[] args) throws MalformedURLException { String deploymentId = "com.example.test:test_project:1.0"; URL baseUrl = new URL("http://localhost:8080/business-central"); String user = "aswu"; String password = "uwsa@123"; RemoteRestRuntimeFactory restSessionFactory = new RemoteRestRuntimeFactory( deploymentId, baseUrl, user, password); System.out.println("Is RemoteRestRuntimeFactory created : " + (restSessionFactory != null)); RemoteRuntimeEngine runtimeEngine = restSessionFactory .newRuntimeEngine(); KieSession kieSession = runtimeEngine.getKieSession(); System.out.println("Is KieSession obtained : " + (kieSession != null)); kieSession.startProcess("test-project.test-process"); } } I've got then the exception: Exception in thread "main" java.lang.RuntimeException: Error invoking StartProcessCommand via REST (http://localhost:8080/business-central/rest/runtime/com.example.test:test_project:1.0/execute): JBoss Web/7.2.2.Final-redhat-1 - JBWEB000064: Error report JBWEB000065: HTTP Status 404 - Could not find resource for relative : /runtime/com.example.test:test_project:1.0/execute of full path: http://localhost:8080/business-central/rest/runtime/com.example.test:test_project:1.0/execute JBWEB000309: type JBWEB000067: Status report JBWEB000068: message Could not find resource for relative : /runtime/com.example.test:test_project:1.0/execute of full path: http://localhost:8080/business-central/rest/runtime/com.example.test:test_project:1.0/execute JBWEB000069: description JBWEB000124: The requested resource is not available. JBoss Web/7.2.2.Final-redhat-1 at org.kie.services.client.api.command.Ab…
has answer: http://stackoverflow.com/a/23456165
type: AnsweredQuestion
tagged with: java
type: Question

jpype
tag name: jpype
tags question: http://stackoverflow.com/q/23430466
type: Tag

http://stackoverflow.com/comment/35711221
score: 1
has text: Doesn't matter, the async task class dont have access to your activity unless to send your listener which is YourAcivity.this.
type: AnswerComment
comment on: http://stackoverflow.com/a/23323428
type: Comment

http://stackoverflow.com/q/23309836
downvote count: 0
score: 1
favorite count: 0
type: UnansweredQuestion
answer count: 0
tagged with: java
tagged with: slick2d
tagged with: lwjgl
upvote count: 1
has title: Slick2D vs slick-util version/build confusion
type: Question
has body: Slick2D officially seems to be split into: slick2D itself, the full 2D game library slick-util, a lightweight subset of slick2d, which only contains certain LWJGL helpers, e.g. for font rendering. I'm currently trying to understand the versioning of both slick2D and slick-util. One strange observation I made is that there are many references stating that slick-util is outdated: LWJGL Wiki Slick Repo LWJGL Forum The essential point seems to be the situation regarding TrueTypeFont vs UnicodeFont: The above references mention that TrueTypeFont is deprecated and UnicodeFont is the appropriate successor; implying that slick-util is outdated since it does not contain the modern UnicodeFont. My confusion continuous as a result of the following observations: Slick2D does not seem to have explicit version numbers; instead the slick.jar contains a version file which contains the build number. The current build seems to be 237. My project is currently using a slick.jar, which I downloaded about 2 years ago. Surprisingly this JAR has a build version 274 -- higher than the current version! The (apparently current) Slick Repository Trunk reveals a build version 232 -- even lower than the current release! My question is: Does Slick2D use a decreasing version numbering? Further observation: I cannot find any deprecation warning regarding TrueTypeFont in the current source code itself. So the question is whether the claims that TrueTypeFont is deprecated (and slick-util is outdated) are actually true? Answering this question based on the file timestamps in the source archive does not seem to be possible: (Almost) all files in slick-util-src.zip have been updated in June 2013. So they have either all been updated (but there is still no UnicodeFont included in slick-util, but maybe TrueTypeFont has become the standard again!?) or they have simply be touched. Any clarification on what really is up-to-date here would be highly appreciated.

http://stackoverflow.com/q/23375760
tagged with: android
has answer: http://stackoverflow.com/a/23375889
has body: This is what my Activity looks like: I have an arrayList which is already defined with a few Item objects. ArrayList&lt;Item&gt; selectedItems = new ArrayList&lt;Item&gt;(); The following code dynamically creates multiple views and adds them to a linearlayout based on how many there are within the ArrayList selectedItems. In this case we only have 2 Item objects which present us with the value Single Potrait and Makeup as we can see from the screenshot. I attempted to assign an onClickListener however I am unable to determine which view is being clicked. How can I assign a onClickListener to each view where I am able to determine which one is clicked so I can change the Quantity TextView for that specific item. I would like to avoid using a ListView in this situation for other reasons. In other words: If someone clicks "Makeup" I want to be able to have a reference to that created view so that I can edit the values such as the Price or Quantity however the difficulty is that I do not know how to reference the view or even how to determine which view was selected. Thank you for all the help! for(Item currentItem : selectedItems) { LayoutInflater inflater = (LayoutInflater)this.getSystemService (Context.LAYOUT_INFLATER_SERVICE); View item = inflater.inflate(R.layout.product_template, productField,false); item.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { //Add Code to open Dialog for Changing Quantity //HOW DO I GET ID OF THE VIEW THAT IS CLICKED //So I can change the text within it? } }); //Set the Name TextView name = (TextView) item.findViewById(R.id.TextView1); name.setText(currentItem.getTitle()); //Set the Quantity TextView quantity = (TextView)item.findViewById(R.id.TextView2); quantity.setText(""+ currencyFormat.format(currentItem.getQuantity())); productField.addView(item); } } This is the Item.java code if needed for additional reference. public class Item { private String title; private double price, quantity; private int pos…
answer count: 4
tagged with: onclicklistener
has answer: http://stackoverflow.com/a/23375916
has answer: http://stackoverflow.com/a/23375902
type: AnsweredQuestion
has title: Dynamically assign onClickListener to inflated Views
tagged with: java
accepted answer: http://stackoverflow.com/a/23375889
possible better answer: http://stackoverflow.com/a/23375822
tagged with: layout-inflater
has answer: http://stackoverflow.com/a/23375822
type: Question
has comment: http://stackoverflow.com/comment/35807692
score: 0

http://stackoverflow.com/comment/35872890
comment on: http://stackoverflow.com/a/23410815
has text: @BrianAgnew using TestRules is the 2nd mechanism I have already described in my question. I will take a look at assumptions.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/35791630
score: 0
type: Comment
has text: Your code looks like my code. The things you said that are missing I have it in the code just didn't type it in becuase I cannot copy and paste
type: AnswerComment
comment on: http://stackoverflow.com/a/23367239

http://stackoverflow.com/q/23338367
tagged with: jface
has body: I'm using JFace to write a simple file-explorer application. The application's logic can be simplified as: Display contents of a folder in a TableViewer. Whenever a folder item gets double-clicked, async-load (to keep UI responsive) its contents and display it. So in my opnion, there are at least 2 threads get involved: a) the UI thread and b) the background thread that fetches contents of a folder. What really bothers me here is how does the two threads communicate and do I have to 'invent the wheel'? To be more specific: How to tell the background thread when an item gets double-clicked? I suppose I need a task queue shared between the two threads or does JFace already provides some async-task mechanism? How to tell the UI thread that the data have arrived and repaint the table? Which one to choose, asyncexec or syncexec?
tagged with: java
type: Question
has title: Thread pool for async tasks?
has answer: http://stackoverflow.com/a/23338599
score: 0
answer count: 1
tagged with: asynchronous
type: UnansweredQuestion
tagged with: multithreading
tagged with: swt

http://stackoverflow.com/a/23475348
upvote count: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23429776
type: Answer
accepted answer of: http://stackoverflow.com/q/23429776
downvote count: 0
score: 1
has body: See answer how to set and get cookies in JSF. It contents the code of CookieHelper class, which can be used multiple times in one application. Purpose of this class is separate cookies related code in one class which is not related to business logic.

http://stackoverflow.com/comment/35817181
type: QuestionComment
has text: which line do you think update all global objects? paste that line here
score: 0
comment on: http://stackoverflow.com/q/23381136
type: Comment

http://stackoverflow.com/q/23417650
answer count: 4
has title: Java Class that can be used to represent null and absent differently
tagged with: guava
tagged with: java
has comment: http://stackoverflow.com/comment/35886417
has answer: http://stackoverflow.com/a/23418988
has answer: http://stackoverflow.com/a/23417855
type: Question
has body: I am wondering if there is a ready made Java class that can be used similarly with Guava's Optional but treats null and absent differently. I have use case that requires to pass a method parameter with String value, null value or absent (does not provide anything). Null is a purely valid value and carries special meaning. I tried to use Guava's Optional but found that it cannot differentiate null and absent. Passwing null to Optional means absent. I am wondering if there is a ready made Java utility that can be used for my usecase: It can carry a value, null value or no value (absent). many thanks
has answer: http://stackoverflow.com/a/23498687
has answer: http://stackoverflow.com/a/23418040
score: 0
has comment: http://stackoverflow.com/comment/35886029
type: UnansweredQuestion

http://stackoverflow.com/comment/35949008
has text: sorry guys I have edited it.
score: 0
comment on: http://stackoverflow.com/q/23451389
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35740120
type: QuestionComment
comment on: http://stackoverflow.com/q/23339539
has text: As some other users have stated, you can use the `Random` API that Java ships with and make sure it falls within the range of your array `arry`
score: 0
type: Comment

http://stackoverflow.com/comment/35721544
has text: Those are already covered in the possible duplicate Q/A. And there are great advantages when programming oriented to interfaces (which is the main question).
comment on: http://stackoverflow.com/a/23328871
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/35766176
type: QuestionComment
comment on: http://stackoverflow.com/q/23352970
score: 1
has text: I know it is going to sound either stupid, too complicated or both; but, with the information I have so far the only thing I can think of at this moment is to "sniff" the http packages being sent by the C# client and your Android app and see what the difference is
type: Comment

http://stackoverflow.com/comment/128086680
comment on: http://stackoverflow.com/a/60805123
score: 0
type: Comment
has text: What if two players have the same score. A reverse index using treemap won't work.
type: AnswerComment

http://stackoverflow.com/comment/62962500
type: AnswerComment
comment on: http://stackoverflow.com/a/37743349
type: Comment
has text: So your reason against `final` is that you (or others) don't understand it's meaning (which can be a valid argument)? `final` neither means or implies immutable objects, so *"`final` word can end lying you"* is only true for someone who doesn't know what `final` means. *"mascarading a bug"* is quite unclear, because when the bug is that a method mutates an object, then this will happen for both `final` and non-`final` parameters. *"By putting `final` in params you can only show wishes, not facts"* This is wrong as well, because the parameter value is `final` and that's a fact.
score: 0

http://stackoverflow.com/comment/35954433
comment on: http://stackoverflow.com/q/23428774
type: QuestionComment
type: Comment
score: 0
has text: @Abhijiit Sarkhel, alright - so can you show us how you configure hibernate?

http://stackoverflow.com/q/23403197
linked to: http://stackoverflow.com/q/18664579
tagged with: jsf
has comment: http://stackoverflow.com/comment/35859052
tagged with: primefaces
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/35857780
linked to: http://stackoverflow.com/q/14211843
has body: i used simple mode, glassfish 3.0 and primefaces 3.0 Backing Bean private UploadedFile file; private String destination="D:\temp\"; public void upload(FleUploadEvent event) { System.out.println("upload"); FacesMessage msg = new FacesMessage("Success! ", event.getFile().getFileName() + " is uploaded."); FacesContext.getCurrentInstance().addMessage(null, msg); try { copyFile(event.getFile().getFileName(), event.getFile().getInputstream()); } catch (IOException e) { e.printStackTrace(); } } System.out.println("uploaf finished"); public void copyFile(String fileName, InputStream in) { try { // write the inputStream to a FileOutputStream OutputStream out = new FileOutputStream(new File(destination + fileName)); int read = 0; byte[] bytes = new byte[1024]; while ((read = in.read(bytes)) != -1) { out.write(bytes, 0, read); } in.close(); out.flush(); out.close(); System.out.println("New file created!"); } catch (IOException e) { System.out.println(e.getMessage()); } } this is my jsf page
answer count: 1
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23406650
has title: in primefaces 3 and jsf i upload the file but in destination place the image is not show
has comment: http://stackoverflow.com/comment/35859232
has comment: http://stackoverflow.com/comment/35857876
has comment: http://stackoverflow.com/comment/35858336
type: Question
has comment: http://stackoverflow.com/comment/35858377

http://stackoverflow.com/a/23439166
type: Answer
has comment: http://stackoverflow.com/comment/35925699
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/35926907
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23439015
has comment: http://stackoverflow.com/comment/35925719
has comment: http://stackoverflow.com/comment/35925799
answers question: http://stackoverflow.com/q/23439015
type: AcceptedAnswer
has body: You can also make your code a little more readable by using Arrays.copyOf(): destination = Arrays.copyOf(source,source.length); Internally, this does the same thing, but it's a little clearer.
has comment: http://stackoverflow.com/comment/35927526

http://stackoverflow.com/q/23325592
score: 0
answer count: 1
tagged with: swing
accepted answer: http://stackoverflow.com/a/23325633
type: AnsweredQuestion
tagged with: java
has body: I'm trying to get the selected item from my implementation of AbstractListModel. What type of listener should I use? There only appears to be the ListDataListener class, but that doesn't appear to have the functionality I'm looking for. Thanks for your help! Implementation below: class MyListModel extends javax.swing.AbstractListModel&lt;String&gt; { private final ArrayList&lt;String&gt; myArrayList = new ArrayList&lt;String&gt;(); public void addElement(String obj) { if(obj==null || obj.isEmpty()) return; myArrayList.add(obj); fireIntervalAdded(this, myArrayList.size()-1, myArrayList.size()-1); } public void removeElement(String obj) { int idx = myArrayList.indexOf(obj); if(idx!=-1) { myArrayList.remove(obj); fireIntervalRemoved(this, idx, idx); } } @Override public String getElementAt(int index) { return myArrayList.get(index); } @Override public int getSize() { return myArrayList.size(); } }
has answer: http://stackoverflow.com/a/23325633
type: Question
has title: Does AbstractListModel have a getSelectedIndex() method?

http://stackoverflow.com/a/23418326
answers question: http://stackoverflow.com/q/23418252
has comment: http://stackoverflow.com/comment/35887170
accepted answer of: http://stackoverflow.com/q/23418252
has body: Pass the reference to snowBoarding class object (please, write the class names starting with upper letter) class MyJPanel extends JPanel { SnowBoarding snowBoarding; public MyJPanel(SnowBoarding snowBoarding) { this.snowBoarding = snowBoarding; } then in paintComponent method you can simply get these arrays using snowBoarding.run_1
score: 1
upvote count: 1
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/35887100
downvote count: 0

http://stackoverflow.com/comment/35773948
type: AnswerComment
has text: That is even simple then. In that case you will receive entire paragraph as a single string. Just use 'str.replaceAll("\\s+", "")' in that case.
type: Comment
comment on: http://stackoverflow.com/a/23357599
score: 0

jmx
tags question: http://stackoverflow.com/q/23324986
tags question: http://stackoverflow.com/q/23366391
tags question: http://stackoverflow.com/q/23292930
tags question: http://stackoverflow.com/q/23424818
tag name: jmx
type: Tag
tags question: http://stackoverflow.com/q/23439883

http://stackoverflow.com/q/23371068
has title: Whats the difference between Scanner(new File) and Scanner(new FileInputStream)?
has body: I observed, Scanner when used for file reading works with both the arguments : File and FileInputStream. Scanner scan = new Scanner(new File("myfile.txt")); and Scanner scan = new Scanner(new FileInputStream("myfile.txt")); However, I don't know the difference between these two definitions. Are there any performance related differences ? Which one to prefer? Anybody please explain. Thanks.
possible better answer: http://stackoverflow.com/a/23371151
has answer: http://stackoverflow.com/a/23371151
accepted answer: http://stackoverflow.com/a/23371101
answer count: 2
downvote count: 0
favorite count: 0
tagged with: java.util.scanner
upvote count: 2
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23371101
tagged with: java
tagged with: file
type: Question

http://stackoverflow.com/comment/35810468
score: 2
has text: You're not running out of memory. The failure is in the first couple of log lines -- the BufferQueue is getting in a bad state, rejecting attempts to queue a buffer. So the buffer is still officially "checked out", and when lockCanvas() tries to dequeue another one the BufferQueue is saying no. It looks like the root cause is a NULL fence being passed to queueBuffer(). Not sure what would cause that.
comment on: http://stackoverflow.com/q/23370836
type: Comment
type: QuestionComment

spring-data-jpa
tags question: http://stackoverflow.com/q/23303987
tags question: http://stackoverflow.com/q/23339274
type: Tag
tag name: spring-data-jpa
tags question: http://stackoverflow.com/q/23364297
tags question: http://stackoverflow.com/q/23316118

http://stackoverflow.com/comment/35822002
type: AnswerComment
has text: It can still be sort of a winner, through that logic you can at least make the serialization of the third-party objects tailor made; in stead of excluding what you don't want you can include what you do want. But that would be a last resort as it is terrible micromanagement and thus a huge bother to maintain.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23383456

http://stackoverflow.com/comment/35711081
type: Comment
score: 1
comment on: http://stackoverflow.com/a/23322723
type: AnswerComment
has text: @Zarah I have made one slight adjustment to the code above. You will also want to override `getPreferredSize()` of the panel form, for the initial size of you want the frame to appear. The auto-generated code will pack the frame, and it you don't override that method, your frame will not appear the size you want.

http://stackoverflow.com/q/23313653
tagged with: java
has body: I have connected Java to SQL and want to delete two rows from different tables, but having issues with my Java Method. I am trying to delete from both tables because I can't delete ID from Table1 because it is referenced by table2. Any suggestions on fixing this? public void delete() throws SQLException { DataConnection connection = new DataConnection(); String query = " DELETE FROM " + Table1 + " WHERE ID = " + id + " AND " + " DELETE FROM " + Table2 + " WHERE ID = " + id; connection.updateData(query); connection.closeConnection(); }
has comment: http://stackoverflow.com/comment/35693133
answer count: 3
tagged with: sql
tagged with: sql-server
score: 0
possible better answer: http://stackoverflow.com/a/23313711
has answer: http://stackoverflow.com/a/23313711
has answer: http://stackoverflow.com/a/23313734
accepted answer: http://stackoverflow.com/a/23313734
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23313774
type: Question
has title: Delete Rows in Two Tables with Java and SQL

http://stackoverflow.com/a/23349146
score: 0
answers question: http://stackoverflow.com/q/23348971
type: Answer
has body: In your first for you go from 0 to 9 (a.length = 10). In the second you go from 0 to 11 (res.length=12). the j*i in res[j * i] will exceed the limit of res (12) with the simple values of 2 and 10.

http://stackoverflow.com/comment/35677182
type: Comment
has text: @LinkTheProgrammer because hacks are not well suited in real world programming.
comment on: http://stackoverflow.com/a/23304145
score: 0
type: AnswerComment

http://stackoverflow.com/a/23433944
downvote count: 0
type: Answer
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/23433224
answers question: http://stackoverflow.com/q/23433224
has body: According to JAR File Specification (Under "Main Attributes", "Class-Path" the path should be relative not absolute. So if you copy the oracle jdbc jar to the same directory as your jar file, and change the path to just "ojdbc14.jar", it should work.
type: AcceptedAnswer

http://stackoverflow.com/a/23404153
has comment: http://stackoverflow.com/comment/35885266
has body: In the Java Code, get a command line by Process p; p = Runtime.getRuntime().exec("su"); // or execute something else, su is just to get root DataOutputStream dos = new DataOutputStream(p.getOutputStream()); dos.writeBytes(ForExampleABinaryPath+" &amp;\n"); dos.flush(); // to read (might has to run parallel in different thread) InputStream is = p.getInputStream(); BufferedReader br = new BufferedReader(new InputStreamReader(is)); is.readLine() // will get you a line o null using write &amp;&amp; flush and read in parallel, you might be able to achieve your goals. good luck
has comment: http://stackoverflow.com/comment/35864986
type: Answer
answers question: http://stackoverflow.com/q/23352592
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/35867355
downvote count: 0
has comment: http://stackoverflow.com/comment/35894758

http://stackoverflow.com/q/23417615
has body: I have just started with neo4J and wanted to try the transactional cypher endpoint. I have my neo4J server running on localhost:7474/ and have inserted the movie data. As stated in the documentation, I have to do a post request and include some parameters. Unfortunately I don't know how I have to include my query in the POST request. As far as I have understood it, I have to pass a JSON String. private static String sendPost() throws Exception { String url = "http://localhost:7474/db/data/transaction"; String statement ="[ { \"statement\" : \"MATCH (n:Person) RETURN n.name, n.born\"} ]"; HttpClient client = new DefaultHttpClient(); HttpPost post = new HttpPost(url); List&lt;NameValuePair&gt; urlParameters = new ArrayList&lt;NameValuePair&gt;(); urlParameters.add(new BasicNameValuePair("Accept", "application/json; charset=UTF-8")); urlParameters.add(new BasicNameValuePair("Content-Type", "application/json")); urlParameters.add(new BasicNameValuePair("statements", statement)); post.setEntity(new UrlEncodedFormEntity(urlParameters)); HttpResponse response = client.execute(post); StringBuilder builder = new StringBuilder(); builder.append("\nSending 'POST' request to URL : " + url+"&lt;br&gt;"); builder.append("Post parameters : " + post.getEntity()+"&lt;br&gt;"); builder.append("Response Code : " + response.getStatusLine().getStatusCode()+"&lt;br&gt;"); BufferedReader rd = new BufferedReader( new InputStreamReader(response.getEntity().getContent())); StringBuffer result = new StringBuffer(); result.append("&lt;p&gt;"); String line = ""; while ((line = rd.readLine()) != null) { result.append(line+"\n"); } result.append("&lt;/p&gt;"); return builder.toString(); } When I execute the code, I get the following output: Sending 'POST' request to URL : http://localhost:7474/db/data/transaction Post parameters : org.apache.http.client.entity.UrlEncodedFormEntity@76adb5f6 Response Code : 415 Can anyone help me on how I have to include my query in the POST request?
has comment: http://stackoverflow.com/comment/35968368
upvote count: 1
answer count: 1
downvote count: 1
has title: how to insert cypher statement in http post request
has comment: http://stackoverflow.com/comment/35908496
has answer: http://stackoverflow.com/a/23448430
type: AnsweredQuestion
tagged with: neo4j
favorite count: 0
accepted answer: http://stackoverflow.com/a/23448430
has comment: http://stackoverflow.com/comment/35921405
type: Question
tagged with: cypher
score: 0
tagged with: java

http://stackoverflow.com/q/23442633
tagged with: android
linked to: http://stackoverflow.com/q/28759454
has answer: http://stackoverflow.com/a/29169693
has answer: http://stackoverflow.com/a/29008147
type: UnansweredQuestion
upvote count: 1
has body: I am using Google Play Location Service to get location updates with high accuracy in my Android app as follows: mLocationRequest=LocationRequest.create(); mLocationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY); My question is that if the app user has selected the battery saving location mode (see below image) in the device settings, then would the above request be able to get location updates with high accuracy or would I have to toggle the location mode programmatically? Or is getting the user change the location mode manually the only solution? As always, many thanks to everyone helping out to point in the right direction!! :)
tagged with: java
tagged with: google-play-services
type: Question
answer count: 2
tagged with: location
downvote count: 0
has title: Is it possible to get location updates on Android with high accuracy if the user has selected battery saving location mode on their device?
score: 1
favorite count: 0

for-loop
tags question: http://stackoverflow.com/q/23414059
tags question: http://stackoverflow.com/q/23395982
tags question: http://stackoverflow.com/q/23310235
tags question: http://stackoverflow.com/q/23328611
tags question: http://stackoverflow.com/q/23414274
tags question: http://stackoverflow.com/q/23377814
tags question: http://stackoverflow.com/q/23305304
tags question: http://stackoverflow.com/q/23449779
tags question: http://stackoverflow.com/q/23311738
tag name: for-loop
tags question: http://stackoverflow.com/q/23316881
tags question: http://stackoverflow.com/q/23448132
tags question: http://stackoverflow.com/q/23413493
tags question: http://stackoverflow.com/q/23403595
tags question: http://stackoverflow.com/q/23439181
tags question: http://stackoverflow.com/q/23296081
tags question: http://stackoverflow.com/q/23306099
tags question: http://stackoverflow.com/q/23391342
type: Tag
tags question: http://stackoverflow.com/q/23329611
tags question: http://stackoverflow.com/q/23295828
tags question: http://stackoverflow.com/q/23293288
tags question: http://stackoverflow.com/q/23357692

towers-of-hanoi
tag name: towers-of-hanoi
tags question: http://stackoverflow.com/q/23321106
type: Tag

http://stackoverflow.com/comment/35887921
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23418770
has text: Uh...no? I know perfectly well what `this` means.
score: 0

http://stackoverflow.com/q/23353064
score: 0
has answer: http://stackoverflow.com/a/23354106
tagged with: android
tagged with: android-activity
has title: Load an activity from libgdx project
type: UnansweredQuestion
tagged with: libgdx
tagged with: java
type: Question
has body: I'm trying to use some Android widget, like the scrolling listbox for listing the scores of players. I have my basic Libgdx project so there are no class hineriting from Activity. I'm trying to incorporate a class extending Activity. The problem(and also an advantage) is that libgdx is not specific to Android. So I have to create an Interface to handle the Android part Desktop part iOS part etc... like described on this page: http://code.google.com/p/libgdx/wiki/ApplicationPlatformSpecific I did it and it's "working", what I mean by workin it's that the program go in the right class hineriting from my Interface. This Android class extends Activity. I have implemented the onCreate() function but it's not working, I put some breakpoint in this onCreate() methode but there are ignore, so I guess there are not going in the function. I read that I have to call: Intent myIntent = new Intent(this, AvitivityName.class); startActivity(myIntent); I'm not doing this two lignes above. Should I put them? If so, where? Edit OK, first thank you for your very detail answer. I understand the first par of the code (the class AndroidInterface). But I'm not sure to understand the second part. This is the default code in the android part when you build a libgdx project: public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); AndroidApplicationConfiguration cfg = new AndroidApplicationConfiguration(); initialize(new MyMain(), cfg); } And this is what I add in this function: public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); AndroidApplicationConfiguration cfg = new AndroidApplicationConfiguration(); cfg.useGL20 = true; IRank rank = new ARank(); initialize(new MyMain(rank), cfg); } So when it create the MyMain() object it will pass the Interface. So like that I can call the appropriate Interface for each support. But when the core of the project is going to call my interface I don't know how to go back to the main activity, …
answer count: 1

http://stackoverflow.com/q/23395680
has body: The problem I have is that I had an older version of google play services set up with my app to be used for ads, everything was fine and this version of the app is currently in production on google play. I havent updated any code since a newer version of google play services came out and when I try to update something I get this error when I test on a device that has the most recent version of google play services: java.lang.IllegalStateException: The meta-data tag in your app's AndroidManifest.xml does not have the right value. Expected 4132500 but found 4242000. You must have the following declaration within the &lt;application&gt; element: &lt;meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" /&gt; at com.google.android.gms.common.GooglePlayServicesUtil.n(Unknown Source) at com.google.android.gms.common.GooglePlayServicesUtil.isGooglePlayServicesAvailable(Unknown Source) at com.google.android.gms.internal.u.a(Unknown Source) at com.google.android.gms.internal.ag.U(Unknown Source) at com.google.android.gms.internal.ag.a(Unknown Source) and this is what my AndroidManifest looks like: .... &lt;application &lt;meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" /&gt; &lt;/application&gt; .... I suspect the problem is that I am compiling with an older version of google play services, and because of that im getting the error, but what I do not understand is as far as I am aware my current version in production was built with the older google play services version and I do not have any crash reports that are from this error, and I am assuming that by now most if not all devices have the latest version so by following previous logic they too should also crash because of this. So is it necessary to change the google play services project I use to build any time there is a new one available, or will an older one still work? I don't see why the older version…
downvote count: 0
has answer: http://stackoverflow.com/a/27655382
tagged with: google-play-services
favorite count: 0
type: UnansweredQuestion
tagged with: android
score: 3
has answer: http://stackoverflow.com/a/27249205
has title: The meta-data tag in AndroidManifest.xml does not have the right value
upvote count: 3
tagged with: java
type: Question
answer count: 2

http://stackoverflow.com/q/23331009
upvote count: 2
has answer: http://stackoverflow.com/a/23331061
downvote count: 1
type: AnsweredQuestion
score: 1
tagged with: java
type: Question
has body: Im creating a simple rpg game where you fight monsters. how your attack is generated is by generating a random number with the max set as your attack stat. the attack stat is declared at 0 at the begining of the class but later is set to one of 3 numbers (10,15,or20) later on depending on what class the player chooses. then i use this line to generate the players attack: charDamage = rand.nextInt(charAttackTotal) + 10; but when i run it it gives me an error saying n (charAttackTotal) must be positive. this is how i get charAttackTotal: static int charAttackBase = 0; this is what is set to 10,15, or20 static int charAttackMod = 0; this is set by what weapons the player has static int charAttackTotal = charAttackBase + charAttackMod - 10; but when i put this in an empty class it works just fine. Is this an error with having these variables declared outside the of the function (method) and then used inside the method or what? I have put all of the code on pastebin if you want to look at it heres a link: http://pastebin.com/RBMScyss the error is on line 124 if your looking at pastebin, all of the variables are declared at the beginning though
tagged with: random
accepted answer: http://stackoverflow.com/a/23331061
answer count: 1
tagged with: variables
has comment: http://stackoverflow.com/comment/35725265
has title: using variables to create random integers in java
favorite count: 0

http://stackoverflow.com/a/23293746
has body: sure. one example would be that at #CP1 you could keep a "waiting list". i'm not sure i can think of shared state you might be altering at #CP2 as generally the while loop is only there in the case of "spurious" wakeups (i.e. you were woken up but really shouldn't have been). also, your handling of InterruptedException is generally a bad idea, as it doesn't allow the thread to be shutdown (a spurious wakeup is different from getting InterruptedException). If you know that only one waiter will be proceeding, you can use notify instead of notifyAll. this can be much more efficient if there are large number of waiting threads. however, there are some caveats when using notify that you need to be very careful about. a waiter could be notified and interrupted, so your handling of InterruptedException needs to re-notify (so the notification doesn't get lost). this means that even if you only intend a single waiter to be awoken, you need to correctly handle the case that more than one could be awoken. in general, you have to make sure that your code correctly causes another thread to proceed, or you could end up in a deadlock situation. sure. you could have one flag which indicates that a given thread should proceed and a separate one which indicates that all threads should abort (system shutdown or algorithm abort).
upvote count: 1
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/23293515
type: Answer

http://stackoverflow.com/a/23387534
has comment: http://stackoverflow.com/comment/35829528
score: 0
answers question: http://stackoverflow.com/q/23385941
has comment: http://stackoverflow.com/comment/35829461
has body: I presume there was a copy error in your XML. Either your root element is &lt;partlist&gt; or it is missing the elements Part_Number, Part_Version, Part_Type and Status (that would make sense). So your schema would look like this: &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="http://www.serus.com" xmlns:ns1="http://www.serus.com"&gt; &lt;xs:element name="part"&gt; &lt;xs:complexType&gt; &lt;xs:sequence minOccurs="1" maxOccurs="1"&gt; &lt;xs:element ref="ns1:Part_Number"/&gt; &lt;xs:element ref="ns1:Part_Type"/&gt; &lt;xs:element ref="ns1:Part_Version"/&gt; &lt;xs:element ref="ns1:Status"/&gt; &lt;xs:choice minOccurs="0" maxOccurs="unbounded"&gt; &lt;xs:element ref="ns1:part"/&gt; &lt;/xs:choice&gt; &lt;/xs:sequence&gt; &lt;/xs:complexType&gt; &lt;/xs:element&gt; &lt;xs:element name="Part_Number" type="xs:NCName"/&gt; &lt;xs:element name="Part_Type" type="xs:NCName"/&gt; &lt;xs:element name="Part_Version" type="xs:NCName"/&gt; &lt;xs:element name="Status" type="xs:NCName"/&gt; &lt;/xs:schema&gt; Then a class would have this format: import java.io.ByteArrayOutputStream; import java.io.InputStream; import java.io.Serializable; import java.util.ArrayList; import java.util.Collection; import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBException; import javax.xml.bind.Marshaller; import javax.xml.bind.Unmarshaller; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlTransient; @XmlRootElement(name = "part") public class Part implements Serializable { public static Part fromXML(InputStream in) throws Exception { JAXBContext context = JAXBContext.newInstance(Part.class); Unmarshaller um = context.createUnmarshaller(); return (Part) um.unmarshal(in); } private static final long serialVersionUID = 1L; @XmlElement(name = "Part_Number") private String partNumber; @XmlElement(name = "Part_…
type: Answer

http://stackoverflow.com/q/23434156
downvote count: 0
tagged with: java
type: Question
tagged with: encoding
score: 4
tagged with: xss
linked to: http://stackoverflow.com/q/23267759
has comment: http://stackoverflow.com/comment/36087368
linked to: http://stackoverflow.com/q/17658535
has comment: http://stackoverflow.com/comment/36072820
answer count: 1
has title: ESAPI XSS prevention for user supplied url property
favorite count: 0
tagged with: esapi
has answer: http://stackoverflow.com/a/23448264
accepted answer: http://stackoverflow.com/a/23448264
tagged with: owasp
upvote count: 4
has comment: http://stackoverflow.com/comment/35942247
has comment: http://stackoverflow.com/comment/45291747
type: AnsweredQuestion
has body: One of my REST APIs is expecting a property "url" which expects a URL as input from the user. I am using ESAPI to prevent from XSS attacks. The problem is that the user supplied URL is something like http://example.com/alpha?abc=def&amp;phil=key%3dbdj The cannonicalize method from the ESAPI encoder throws intrusion exception here claiming that the input has mixed encoding, since it is url encoded and the piece '&amp;phi' is treated as HTML encoded and thus the exception. I had a similar problem with sanitizing one of my application urls where the second query parameter started with 'pa' or 'pi' and was converted to delta or pi characters by HTML decoding. Please refer to my previous Stackoverflow question here Now since the problem is that since the entire URL is coming as input from the user, I cannot simply parse out the Query parameters and sanitize them individually, since malicious input can be created combining the two query parameters and sanitizing them individually wont work in that case. Example: &amp;ltscr comes is last part of first query param value and ipt&amp;gtalert(0); or something comes as first part of the next query param control context. Has anyone faced a similar problem? I would really like to know what solutions you guys implemented. Thanks for any pointers. EDIT: The below answer from 'avgvstvs' does not throw the intrusion exception (Thanks!!). However, the cannonicalize method now changes the original input string. ESAPI treats &amp;phi of the query param to be some html encoded char and replaces it to '?' char. Something like my previous question which is linked here. The difference being that was a URL of my application whereas this is user input. Is my only option maintaining a white list here?

communication
tag name: communication
tags question: http://stackoverflow.com/q/23308256
tags question: http://stackoverflow.com/q/23355181
type: Tag

http://stackoverflow.com/q/23379940
tagged with: swing
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/23381332
tagged with: java
tagged with: fileoutputstream
has title: How to output all of the text in my JtextArea to a save file?
type: Question
tagged with: jtextarea
tagged with: printstream
has answer: http://stackoverflow.com/a/23381332
score: 0
accepted answer: http://stackoverflow.com/a/23380275
answer count: 2
has answer: http://stackoverflow.com/a/23380275
has body: Hello there fellow stackers! I'm having a problem creating a proper save function for my game. The main problem I am having is capturing all of the data inside of my J text area named display. The display reflects what moves have been made so far in the game, and at the top of the display it says "Welcome to Togiz Kumalak". My problem is that when I save the game, it only records the first line of text to the file instead of all lines. an example is: Welcome to Togiz Kumalak Player 1 Cup 1 Player 2 Cup 3 and so on. When I save the file, only the top line will be shown. Here is my current code for the save Listener. class SaveListener implements ActionListener { String a = display.getText(); JFileChooser myChooser= new JFileChooser(); public void actionPerformed(ActionEvent event) { String fileName; myChooser.setCurrentDirectory(new File(".")); myChooser.showSaveDialog(null); fileName = myChooser.getSelectedFile().getPath(); try { OutputStream file = new FileOutputStream(fileName); PrintStream printStream = new PrintStream(file); printStream.print(a); printStream.close(); /* Version 11, 23.1. Scroll pane and text area support when saving. */ } catch(IOException e) { System.out.println("Problem making or writing to an output stream."); System.out.println(e); } } }

http://stackoverflow.com/comment/35870250
score: 0
type: Comment
has text: No, i mean implementing JFrame2 as a `JDialog` (instead of `JFrame`).
type: AnswerComment
comment on: http://stackoverflow.com/a/23394127

http://stackoverflow.com/comment/66682896
type: Comment
comment on: http://stackoverflow.com/q/23320541
has text: https://github.com/RoutingKit/RoutingKit/blob/master/doc/ContractionHierarchy.md This is a C++ implementation of CH.
score: 0
type: QuestionComment

http://stackoverflow.com/comment/35814172
type: QuestionComment
type: Comment
has text: are you looking at the official repo? https://github.com/mongodb/morphia
comment on: http://stackoverflow.com/q/23378813
score: 0

http://stackoverflow.com/comment/35950996
has text: I suppose, setting encoding has nothing to do with getByteStream. The last one returns just bytes. Encoding is a meta-information about how to interpret these bytes, but with getBytes there's no such interpretation at all.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23452823

http://stackoverflow.com/comment/35820597
type: Comment
comment on: http://stackoverflow.com/a/23382517
type: AnswerComment
score: 0
has text: @PeterLawrey *however a specific implementation might [expect] a different range of valid inputs* -- then that implementation breaks the contract of the interface. But anyway, if the interface does not specify it cleary, and the implementation is free, then IAE informs you that this specific implementation does not accept that. What's the problem?

http://stackoverflow.com/comment/35795822
type: AnswerComment
has text: @user3496780 I tried a number of combinations with POI 2.5.1 however this seems to be a limitation with that implementation. So unfortunately with that version we can't do much.
type: Comment
comment on: http://stackoverflow.com/a/23341992
score: 0

http://stackoverflow.com/comment/35924605
has text: I was reading at oracle link that I added in my previous comment. What I meant give it a try. Try to change String sql = "SELECT COUNT(*) FROM SEAT WHERE BOOKED IS NULL"; to String sql = "SELECT COUNT(*) FROM SEAT WHERE BOOKED = ?"; and then use st.setNull(1,Types.INTEGER); I am not sure if it work. But may be worth a try.
comment on: http://stackoverflow.com/a/23437533
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/35870662
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23409825
score: 0
has text: Have you read the javadoc for List?

http://stackoverflow.com/comment/37012402
type: Comment
comment on: http://stackoverflow.com/a/23433686
score: 0
type: AnswerComment
has text: depends on your xpath. One thing I noticed was that the whole gridview needed to be visible (I used a swipe motion) otherwise you get IndexOutBounds error. Post your xpath.

http://stackoverflow.com/q/23404521
has body: class a { static final int a =5; static { System.out.println("hi"); } } class b { public static void main(String[] args) { System.out.println(a.a); } } Why doesn't the static block run,and the output is only 5 whereas if I remove final keyword from the class variable, the static block gets executed and the output becomes hi 5
answer count: 2
has comment: http://stackoverflow.com/comment/35860543
has title: Why is the static initializer not executed if referenced static field is final
has comment: http://stackoverflow.com/comment/35860591
has comment: http://stackoverflow.com/comment/35860502
favorite count: 0
tagged with: static
downvote count: 3
duplicate of: http://stackoverflow.com/q/16853747
upvote count: 4
has answer: http://stackoverflow.com/a/23404536
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35860787
score: 1
tagged with: final
has answer: http://stackoverflow.com/a/23404557
has comment: http://stackoverflow.com/comment/35860383
accepted answer: http://stackoverflow.com/a/23404557
type: Question
linked to: http://stackoverflow.com/q/16853747
tagged with: java
possible better answer: http://stackoverflow.com/a/23404536

http://stackoverflow.com/comment/35660302
comment on: http://stackoverflow.com/q/23293489
type: QuestionComment
type: Comment
score: 0
has text: Which version of Objectify are you using?

http://stackoverflow.com/a/23425751
upvote count: 7
type: AcceptedAnswer
has body: For a bit of fun I thought I'd knock up a little example DRL demonstrating how this might be done by inserting AgeLimit facts. declare AgeLimit country: String age: int end declare Bar country: String revellers: java.util.Collection end declare Person age: int end declare ThrowOutOfTheBar person: Person bar: Bar end rule "UK drinking age" salience 1000 when then insertLogical( new AgeLimit( 'uk', 18 ) ); end rule "US drinking age" salience 1000 when then insertLogical( new AgeLimit( 'us', 21 ) ); end rule "Can I buy a beer?" when $p: Person() $bar: Bar( revellers contains $p ) AgeLimit( country == $bar.country, age &gt; $p.age ) then insertLogical( new ThrowOutOfTheBar($p, $bar) ); end To reduce the amount of hand-cranked DRL further, you could insert those AgeLimit facts using the API. For example, you could maintain a database table of national age limits and at the start of your session you could insert them all into working memory as facts. Alternatively, you could create a decision table which generates those same age limit insertions rules behind the scenes. This is likely to be a good way to manage things if for example, you wish to maintain an age limit for every country. Furthering these ends of keeping hard-coded values out of key rules, it would be worth reading up on inference and truth maintenance. This could lead to a rule such as: rule "Can I buy a beer?" when $p: Person() $bar: Bar( revellers contains $p ) IsUnderAge( person == $p, country == $bar.country ) then insertLogical( new ThrowOutOfTheBar($p, $bar) ); end This has the benefit of encapsulating the rules around age limits and providing some re-use potential. However to achieve it in the example above involves inserting IsUnderAge facts for every person for every country in which they are under age. Working out whether that would be a good thing was leading me into all sorts of off-topic thinking, so I left it out. :)
type: Answer
downvote count: 0
score: 7
answers question: http://stackoverflow.com/q/23410450
accepted answer of: http://stackoverflow.com/q/23410450
has comment: http://stackoverflow.com/comment/43181676

http://stackoverflow.com/q/23317007
tagged with: java
tagged with: jfreechart
type: Question
has answer: http://stackoverflow.com/a/23317384
answer count: 2
has title: BorderLayout problems
tagged with: layout
accepted answer: http://stackoverflow.com/a/23317384
score: 0
possible better answer: http://stackoverflow.com/a/23317204
has answer: http://stackoverflow.com/a/23317204
has body: I have chartPanel (JFreeChart), buttonPanel and errorPanel. frame.add(chartPanel, BorderLayout.PAGE_START); JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.CENTER)); errorPanel = new JLabel("Error String"); errorPanel.setHorizontalAlignment(JLabel.CENTER); frame.getContentPane().add(buttonPanel, BorderLayout.CENTER); frame.getContentPane().add(errorPanel, BorderLayout.SOUTH); When I change height of application window, buttonPanel and errorPanel disappeared. When I don't use JLabel: frame.add(chartPanel); JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.CENTER)); frame.getContentPane().add(buttonPanel, BorderLayout.SOUTH); it's okey in changing of height of application window. How to make it right and not have problems with window zoom?
type: AnsweredQuestion
tagged with: border-layout

http://stackoverflow.com/a/23350922
has comment: http://stackoverflow.com/comment/35762611
type: Answer
has comment: http://stackoverflow.com/comment/35772116
answers question: http://stackoverflow.com/q/23350904
has body: You can get input and output streams from the process using the corresponding getter methods. Edit: getInputStream() and getOutputStream()
score: 0

http://stackoverflow.com/q/23305881
tagged with: scope
possible better answer: http://stackoverflow.com/a/23305927
has answer: http://stackoverflow.com/a/23305927
has comment: http://stackoverflow.com/comment/35679165
type: AnsweredQuestion
upvote count: 3
has answer: http://stackoverflow.com/a/23305935
type: Question
score: 3
tagged with: java
has body: I'm not sure if I am doing this right, but I keep getting an error saying my array "currentRoute" cannot be resolved into a variable. I'm assuming this is because I have declared the array in a different scope. Is there any way I can get this to work while still declaring the variable in within my switch statement and while still using a simple array? (I cannot use an arraylist, as the rest of my code would be affected) switch (routeID) { case "1" : { String[] currentRoute = new String[Route1.length]; currentRoute = Route1; } case "96" : { String[] currentRoute = new String[Route96.length]; currentRoute = Route96; } } // print out values in currentRoute for (int i = 0; i &lt; currentRoute.length; i++) { System.out.println(currentRoute[i]); } there are a lot more switch statements, but I have just included 2 for this example. EDIT:both switch and for statements are located within the same method.
has comment: http://stackoverflow.com/comment/35679314
answer count: 2
tagged with: arrays
downvote count: 0
has comment: http://stackoverflow.com/comment/35679281
accepted answer: http://stackoverflow.com/a/23305935
has title: Java: how to access a variable which was declared inside a switch statement
favorite count: 0

http://stackoverflow.com/comment/35657085
type: Comment
score: 0
type: AnswerComment
has text: That looks like the best thing one can possibly do to actually solve this. Too bad Java libraries don't implement this out of the box...
comment on: http://stackoverflow.com/a/23292472

http://stackoverflow.com/comment/72442168
score: 0
type: Comment
has text: Did not work. The answer below with the jersey json library did.
comment on: http://stackoverflow.com/a/25313319
type: AnswerComment

http://stackoverflow.com/comment/35698001
score: 0
type: AnswerComment
type: Comment
has text: Yes you can't pass the constructor arguments to initialization block but its sole purpose is to prepare the data before constructing the object that is independent of any external factor.
comment on: http://stackoverflow.com/a/23316084

http://stackoverflow.com/a/37523922
answers question: http://stackoverflow.com/q/23325389
type: Answer
downvote count: 1
has body: Here it goes a way to have them displayed in console or whatever file you choose. Declare Tomcat's RequestDumperFilter in any @Configuration class: @Bean public FilterRegistrationBean requestDumperFilter() { FilterRegistrationBean registration = new FilterRegistrationBean(); Filter requestDumperFilter = new RequestDumperFilter(); registration.setFilter(requestDumperFilter); registration.addUrlPatterns("/*"); return registration; } And that's the output: http-nio-8765-exec-1 START TIME =30-may-2016 12:45:41 http-nio-8765-exec-1 requestURI=/info http-nio-8765-exec-1 authType=null http-nio-8765-exec-1 characterEncoding=UTF-8 http-nio-8765-exec-1 contentLength=-1 http-nio-8765-exec-1 contentType=null http-nio-8765-exec-1 contextPath= http-nio-8765-exec-1 cookie=JSESSIONID=E7259F5F9ED6B04CBE5A294C5F8CA5C6 http-nio-8765-exec-1 header=host=mies-057:8765 http-nio-8765-exec-1 header=connection=keep-alive http-nio-8765-exec-1 header=accept=text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8 http-nio-8765-exec-1 header=upgrade-insecure-requests=1 http-nio-8765-exec-1 header=user-agent=Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36 http-nio-8765-exec-1 header=referer=http://mies-057:1111/ http-nio-8765-exec-1 header=accept-encoding=gzip, deflate, sdch http-nio-8765-exec-1 header=accept-language=es-ES,es;q=0.8 http-nio-8765-exec-1 header=cookie=JSESSIONID=E7259F5F9ED6B04CBE5A294C5F8CA5C6 http-nio-8765-exec-1 locale=es_ES http-nio-8765-exec-1 method=GET http-nio-8765-exec-1 pathInfo=null http-nio-8765-exec-1 protocol=HTTP/1.1 http-nio-8765-exec-1 queryString=null http-nio-8765-exec-1 remoteAddr=192.168.56.1 http-nio-8765-exec-1 remoteHost=192.168.56.1 http-nio-8765-exec-1 remoteUser=null http-nio-8765-exec-1 requestedSessionId=E7259F5F9ED6B04CBE5A294C5F8CA5C6 http-nio-8765-exec-1 scheme=http http-nio-8765-exec-1 serverName=mies-057 http-nio-8765-exec-1 serverPort=8765 http-nio-8765-exec-1 servle…
upvote count: 47
score: 46

http://stackoverflow.com/a/23418075
type: Answer
score: 0
answers question: http://stackoverflow.com/q/23417777
has body: It could also be if and where the JAVA_HOME ENV points to.

apt-get
tags question: http://stackoverflow.com/q/23332126
type: Tag
tag name: apt-get

hadoop
tags question: http://stackoverflow.com/q/23307235
tags question: http://stackoverflow.com/q/23408937
tags question: http://stackoverflow.com/q/23421818
tags question: http://stackoverflow.com/q/23358109
tag name: hadoop
tags question: http://stackoverflow.com/q/23367595
tags question: http://stackoverflow.com/q/23451573
tags question: http://stackoverflow.com/q/23329517
tags question: http://stackoverflow.com/q/23374049
tags question: http://stackoverflow.com/q/23367052
tags question: http://stackoverflow.com/q/23411464
tags question: http://stackoverflow.com/q/23330353
tags question: http://stackoverflow.com/q/23338509
type: Tag
tags question: http://stackoverflow.com/q/23441643
tags question: http://stackoverflow.com/q/23348619
tags question: http://stackoverflow.com/q/23325862
tags question: http://stackoverflow.com/q/23365622
tags question: http://stackoverflow.com/q/23334846
tags question: http://stackoverflow.com/q/23428584
tags question: http://stackoverflow.com/q/23395171
tags question: http://stackoverflow.com/q/23377606
tags question: http://stackoverflow.com/q/23380539
tags question: http://stackoverflow.com/q/23402505
tags question: http://stackoverflow.com/q/23428483
tags question: http://stackoverflow.com/q/23331805
tags question: http://stackoverflow.com/q/23329652
tags question: http://stackoverflow.com/q/23329173
tags question: http://stackoverflow.com/q/23307260
tags question: http://stackoverflow.com/q/23399517
tags question: http://stackoverflow.com/q/23390546
tags question: http://stackoverflow.com/q/23327395
tags question: http://stackoverflow.com/q/23317012
tags question: http://stackoverflow.com/q/23300371
tags question: http://stackoverflow.com/q/23435662

http://stackoverflow.com/comment/35755533
has text: I've put in the try catch as shown now the program still skips to the 2nd & 3rd input question without printing the error exception after ("Enter your operation: add, subtract, divide, multiply, or exit"). Also if "exit" is inputed for first question the the 2nd & 3rd input requirements still loop before program finishes, is there any way to exit immediately as prompted with the other inputs being required? Any suggestions welcome
type: AnswerComment
comment on: http://stackoverflow.com/a/23346181
score: 0
type: Comment

http://stackoverflow.com/q/23358759
tagged with: generics
linked to: http://stackoverflow.com/q/529085
tagged with: interface
possible better answer: http://stackoverflow.com/a/23359244
downvote count: 1
score: 2
type: AnsweredQuestion
has body: I am having trouble understanding the nuances of generics, interfaces, and arrays and how to use them together. I have an assignment for an intermediate Java class. The assignment is as follows: Create a generic class SimpleQueue that implements Queue Use a constructor to initialize an array with 5 slots. Use of ArrayList not allowed We must be able to increase the size of the array if it gets filled The problem I'm having is the with the initialization of the array. Here's the code I have: import java.util.Collection; import java.util.Iterator; import java.util.Queue; public class SimpleQueue&lt;E&gt; implements Queue&lt;E&gt;{ private E myQueue[]; //Constructor with no arguments. public SimpleQueue() { myQueue = new [5]; System.out.println("A queue with length " + myQueue.length + " was created."); } } Eclipse complains by saying that we can't create a generic array. I've managed to get it to work by doing this: private Object myQueue[] = Object[5]; ...but I feel like this defeats the purpose of using generics. Am I misunderstanding the use of generics? Pointers would be greatly appreciated! This is the code I'm using to test my generic class as I'm working: public class SimpleQueueTester { public static void main(String [] args) { SimpleQueue&lt;String&gt; myStringQueue = new SimpleQueue&lt;&gt;(); SimpleQueue&lt;Integer&gt; myIntegerQueue = new SimpleQueue&lt;&gt;(); } } Disclaimer: Please don't think I want my homework done for me. I'm just stuck at this point and I figured this would be the best place to ask. Thanks! Edit: I took some of your suggestions and now my code looks like this: public class SimpleQueue&lt;E&gt; implements Queue&lt;E&gt;{ private E[] myQueue; @SuppressWarnings("unchecked") //Constructor with no arguments. public SimpleQueue() { //This was changed. What does (E[]) do exactly? this.myQueue = (E[]) new Object[5]; System.out.println("A queue with length " + this.myQueue.length + " was created."); } } Thank you for you suggestions! You guys…
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/35801319
has answer: http://stackoverflow.com/a/23359244
type: Question
tagged with: arrays
duplicate of: http://stackoverflow.com/q/529085
has comment: http://stackoverflow.com/comment/35775753
favorite count: 0
has answer: http://stackoverflow.com/a/23359192
accepted answer: http://stackoverflow.com/a/23359192
answer count: 3
has answer: http://stackoverflow.com/a/23359167
has title: Implementation of Queue<E> interface

http://stackoverflow.com/q/23421027
has comment: http://stackoverflow.com/comment/35891912
tagged with: java
tagged with: mysql
has answer: http://stackoverflow.com/a/23421284
has comment: http://stackoverflow.com/comment/35892181
type: Question
score: 0
has title: replacing localhost by ip address in connection string
has answer: http://stackoverflow.com/a/23421178
has answer: http://stackoverflow.com/a/23421092
type: UnansweredQuestion
has body: public Connection conn() throws ClassNotFoundException, InstantiationException, IllegalAccessException, SQLException { Connection all_connection = null; Class.forName("com.mysql.jdbc.Driver").newInstance(); all_connection = DriverManager .getConnection("jdbc:mysql://localhost:3306/dbname","username","password"); return all_connection; } Above code is my connection code. Its working fine. If i replace localhost by my ip address, its not working. Actually i want to replace localhost by ip address. Replacing localhost by 127.0.0.1 works fine. Why replacing ip address is not working????
has answer: http://stackoverflow.com/a/23421089
has comment: http://stackoverflow.com/comment/35891872
answer count: 4

http://stackoverflow.com/comment/35859216
type: Comment
type: QuestionComment
has text: what is this, in loop you are creating new `StringBuilder` on every loop itration, and assigning it something. what u wnat actually?
comment on: http://stackoverflow.com/q/23403949
score: 0

http://stackoverflow.com/q/23404845
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35861024
has body: Say I have a static method increment: public class StaticTest { private static int no = 0; public static void increment() { no++; } } When I call increment using the StaticTest.increment() syntax, does the class ever get instantiated? What if no object of that type exists on the heap already?
tagged with: java
type: Question
possible better answer: http://stackoverflow.com/a/23405007
has answer: http://stackoverflow.com/a/23405007
has title: When using a static method, does the class every get instantiated?
has answer: http://stackoverflow.com/a/23404889
answer count: 3
downvote count: 0
has answer: http://stackoverflow.com/a/23404878
favorite count: 0
tagged with: static
accepted answer: http://stackoverflow.com/a/23404878
score: 6
upvote count: 6

http://stackoverflow.com/comment/35860787
has text: @user3239652 updated my answer, included the several ways the static block can be triggered
comment on: http://stackoverflow.com/q/23404521
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23343129
has comment: http://stackoverflow.com/comment/35746793
score: 0
type: Answer
has body: ArrayList is not an array type. Instead of treating it like one you need to make a nested ArrayList. // create ArrayList&lt;ArrayList&lt;FooBar&gt;&gt; list=new ArrayList&lt;ArrayList&lt;FooBar&gt;&gt;(); // add to first layer list.set(index, new ArrayList&lt;FooBar&gt;()); // add to second layer list.get(index1).set(index2, new FooBar()); // etc So basically in order to access the second layer of arraylists you need to use get() on the first list.
answers question: http://stackoverflow.com/q/23342988

http://stackoverflow.com/comment/35931883
type: Comment
has text: I would suggest a factory method rather than a constructor, like the number types' `valueOf`. That leaves you free to have cached values, like 0, 90, etc. or cache-as-created. Of course, your class would need to be immutable, but that's good practice anyway.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23442752

http://stackoverflow.com/comment/35889359
score: 0
has text: Ok, thankyou I'm still trying to wrap my head around using extend if I'm honest. I tried looking up the "is-a" test you mention but failed to find anything about it could you please expand on what you mean by this?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23419553

replaceall
tags question: http://stackoverflow.com/q/23332146
tags question: http://stackoverflow.com/q/23424023
tags question: http://stackoverflow.com/q/23415980
type: Tag
tag name: replaceall

stringtemplate
tags question: http://stackoverflow.com/q/23386243
tag name: stringtemplate
type: Tag

http://stackoverflow.com/q/23409825
has answer: http://stackoverflow.com/a/23410040
has title: How do I get 7 random elements from an array which was converted to a list?
score: -1
has answer: http://stackoverflow.com/a/23409860
has answer: http://stackoverflow.com/a/23409924
tagged with: random
has body: public static String doDraw(String cardName[], int deckSize){ int counter, n; String list; List&lt;Cin&gt; cardList = Arrays.asList(cardName); Collections.shuffle(cardList); ? cardList = cardList.get(7); System.out.println(cardList); } So I cannot seem to get the right way of getting code for the random. The program takes a deck of cards and draws 7 random cards to simulate a first hand draw. I have made the array into a list and have shuffled it. I just am not 100% sure on where to go with getting the 7 random cards now.
tagged with: arrays
favorite count: 0
has comment: http://stackoverflow.com/comment/35870662
answer count: 4
has answer: http://stackoverflow.com/a/23410049
tagged with: list
type: UnansweredQuestion
tagged with: java
downvote count: 2
upvote count: 1
has comment: http://stackoverflow.com/comment/35871253
type: Question

http://stackoverflow.com/comment/35832784
comment on: http://stackoverflow.com/a/23388857
has text: so will it come back as null of rootLogger is off? I need to check if it has been disabled.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/35742631
comment on: http://stackoverflow.com/q/23340608
has text: did you use "datasource" somewhere?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35862020
type: QuestionComment
has text: google around, dont ask for code. Ask for ideas and direction only, implement your own code.
comment on: http://stackoverflow.com/q/23405400
score: 0
type: Comment

http://stackoverflow.com/comment/35677169
has text: @user3571995 Are you not sure? on which object you are calling `getValueAt()` method?
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23304550
type: QuestionComment

http://stackoverflow.com/comment/35746845
comment on: http://stackoverflow.com/q/23342987
type: Comment
has text: you can also look at `resetValues` for <f:ajax>
score: 0
type: QuestionComment

apache-camel
tags question: http://stackoverflow.com/q/23411096
tags question: http://stackoverflow.com/q/23310585
tags question: http://stackoverflow.com/q/23307707
tags question: http://stackoverflow.com/q/23433968
tags question: http://stackoverflow.com/q/23298249
tag name: apache-camel
tags question: http://stackoverflow.com/q/23433201
tags question: http://stackoverflow.com/q/23375218
tags question: http://stackoverflow.com/q/23428991
tags question: http://stackoverflow.com/q/23358072
tags question: http://stackoverflow.com/q/23391810
tags question: http://stackoverflow.com/q/23344648
tags question: http://stackoverflow.com/q/23394542
tags question: http://stackoverflow.com/q/23300299
tags question: http://stackoverflow.com/q/23354161
tags question: http://stackoverflow.com/q/23294816
tags question: http://stackoverflow.com/q/23442872
type: Tag
tags question: http://stackoverflow.com/q/23405580

http://stackoverflow.com/comment/35903696
comment on: http://stackoverflow.com/a/23413843
has text: It does. The query I wrote inserts in table_name if the id does not exist. If it exists a duplicate flag will be raised and the update query will be executed, instead.
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/23297398
tagged with: jsf-2.2
tagged with: glassfish
score: 0
duplicate of: http://stackoverflow.com/q/3112946
answer count: 1
has title: JSF Data table not displaying any data
has body: I have been messing around with some tutorial files I had and tried changing a data table that would normally just display a bunch of nonsense into a table that displays flower information form. I thought the changes would be pretty topical (just switching variable names for whatever I put in the database) but it seems as though I am missing something important. Some help or direction on the matter would be appreciated. Instead of a table, the output I keep getting is this (literally this string) Flower ID #{f.flowerID} Name #{f.name} Color #{f.color} Country #{f.country} Price #{f.price} as opposed to the nicely formatted table from the tutorial. Here are all my project files. I can't seem to find any error logs though. ViewFlowers.xhtml <?xml version='1.0' encoding='UTF-8' ?> <h:head> Flowers ABOUND <h:outputStylesheet library="css" name="table-style.css" /> </h:head> <h:body> FLOWERS GALORE <h:dataTable value="#{flower.getFlowerList()}" var="f" styleClass="order-table" headerClass="order-table-header" rowClasses="order-table-odd-row,order-table-even-row" > <h:column> <f:facet name="header"> Flower ID </f:facet> #{f.flowerID} </h:column> <h:column> <f:facet name="header"> Name </f:facet> #{f.name} </h:column> <h:column> <f:facet name="header"> Color </f:facet> #{f.color} </h:column> <h:column> <f:facet name="header"> Country </f:facet> #{f.country} </h:column> <h:column> <f:facet name="header"> Price </f:facet> #{f.price} </h:column> </h:dataTable> </h:body> FlowerBean.java import jsf.Flower; @ManagedBean(name="flower") @RequestScoped public class FlowerBean implements Serializable{ /** * Creates a new instance of FlowerBean */ DataSource ds; public FlowerBean() { //resource injection // @Resource(name="jdbc/flower") // if resource injection is not support, you still can get it manually. try { Context ctx = new InitialContext(); ds = (DataSource)ctx.lookup("jdbc:mysql://localhost/flow"); } catch (NamingException e) { e.printStackTrace(); } } //connect to DB and ge…
has answer: http://stackoverflow.com/a/54604085
type: UnansweredQuestion
tagged with: css
linked to: http://stackoverflow.com/q/3112946
tagged with: jsf
tagged with: java
has comment: http://stackoverflow.com/comment/35671534
type: Question
has comment: http://stackoverflow.com/comment/35665899

http://stackoverflow.com/q/23409649
tagged with: java
score: -1
type: Question
upvote count: 0
answer count: 1
tagged with: lucene
favorite count: 0
accepted answer: http://stackoverflow.com/a/23416747
has body: I am new to SOLR and this is my first post in this list. I have been working on this problem for a couple of days. I tried everything which I found in google but it looks like I am missing something. Here is my problem: I have a field called: DBASE_LOCAT_NM_TEXT It contains values like: CRD_PROD The goal is to be able to search this field either by putting the exact string "CRD_PROD" or part of it (tokenized by "_") like "CRD" or "PROD" Currently: This query returns results: q=DBASE_LOCAT_NM_TEXT:CRD_PROD But this does not: q=DBASE_LOCAT_NM_TEXT:CRD I want to understand why the second query does not return any results Here is how I configured the field: &lt;field name="DBASE_LOCAT_NM_TEXT" type="text_general" indexed="true" stored="true" required="false" multiValued="false"/&gt; And Here is how I configured the field type : &lt;fieldType name="text_general" class="solr.TextField" positionIncrementGap="100"&gt; &lt;analyzer type="index"&gt; &lt;filter class="solr.WordDelimiterFilterFactory" preserveOriginal="1" generateWordParts="1" generateNumberParts="1" catenateWords="1" catenateNumbers="1" catenateAll="0" splitOnCaseChange="1"/&gt; &lt;tokenizer class="solr.WhitespaceTokenizerFactory"/&gt; &lt;filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt"/&gt; &lt;filter class="solr.LowerCaseFilterFactory"/&gt; &lt;filter class="solr.KeywordMarkerFilterFactory" protected="protwords.txt"/&gt; &lt;filter class="solr.RemoveDuplicatesTokenFilterFactory"/&gt; &lt;/analyzer&gt; &lt;analyzer type="query"&gt; &lt;filter class="solr.WordDelimiterFilterFactory" preserveOriginal="1" generateWordParts="1" generateNumberParts="1" catenateWords="0" catenateNumbers="0" catenateAll="0" splitOnCaseChange="1"/&gt; &lt;tokenizer class="solr.WhitespaceTokenizerFactory"/&gt; &lt;filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt"/&gt; &lt;filter class="solr.LowerCaseFilterFactory"/&gt; &lt;filter class="solr.KeywordMarkerFilterFactory" protect…
tagged with: tokenize
tagged with: solr
has title: Searching for tokens does not return any results
downvote count: 1
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23416747

http://stackoverflow.com/a/23320780
has body: Spring MVC is one component within the whole Spring Framework, to support development of web applications. You can use any web containers, so it works fine with Tomcat. Just think that Spring is a third party library. You just need to put the necessary jar files in the lib directory, and define a few xml files. So basically when you just say Spring it is a just a framework. And by framework I mean lot of functionalities/jars. Like you may have core which has core functionality or aspectj etc. Spring MVC i.e model view controller is one such functionality offered by Spring framework. You can deffer processing of request to various controllers based on the pattern of URL requested. You can refer Spring MVC hello world example
downvote count: 0
answers question: http://stackoverflow.com/q/23320747
type: Answer
has comment: http://stackoverflow.com/comment/35706164
score: 5
upvote count: 5

http://stackoverflow.com/comment/35782016
has text: Over TCP. Via the TCP transport layer, the network layer, the datalink layer, the physical layer, the network, TCP segments, IP packets, Ethernet, xDSL, packet-switching, electricity, electrons, particle physics, ... How much detail is going to satisfy you?
comment on: http://stackoverflow.com/a/23362080
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/29324250
has comment: http://stackoverflow.com/comment/65398179
score: 28
accepted answer of: http://stackoverflow.com/q/23302698
type: Answer
downvote count: 0
upvote count: 28
has body: This will find if the rectangle is overlapping another rectangle: public boolean overlaps (Rectangle r) { return x &lt; r.x + r.width &amp;&amp; x + width &gt; r.x &amp;&amp; y &lt; r.y + r.height &amp;&amp; y + height &gt; r.y; }
has comment: http://stackoverflow.com/comment/69840046
answers question: http://stackoverflow.com/q/23302698
type: AcceptedAnswer

http://stackoverflow.com/comment/35920957
score: 0
type: AnswerComment
type: Comment
has text: It's just an example to illustrate how to face it, it's not the definitive solution as I'm not doing this application and I really don't know what kind of data is sent - the OP will have to play around to get what he wants, but that's the idea.
comment on: http://stackoverflow.com/a/23431615

http://stackoverflow.com/a/23399733
answers question: http://stackoverflow.com/q/23399692
has comment: http://stackoverflow.com/comment/36246558
type: Answer
has comment: http://stackoverflow.com/comment/35866848
score: 1
has body: There are basically 2 problems in your code: 1) A call to label.setImage() won't update immediately, as this is true for everything in AWT and Swing. Any time a repaint request is fired, it is simply added to a repaint queue, that will wait patiently for all other tasks done in the EDT (Event Dispatching Thread) to finish. But since you do other things in the mousePressed(), they will run first. A simple solution for this would be to do the computing in mouseReleased(). But a bigger problem exists. 2) What you are currently doing is "starving" the EDT - a bad programming practice - as all screen related invocations must be executed immediately. Sleeping the EDT won't allow any repaints to take place while running. This is true for any long running tasks as well. Its solution is to run the non-painting calls in a different thread: private volatile boolean isComputing = false; public void mousePressed(MouseEvent evt) { if(isComputing) return; isComputing = true; // . // . // . // change icon here, or any // other swing related change. // . // . // run game new Thread(){ public void run(){ // all non-swing computations SwingUtilities.invokeLater(new Runnable() { public void run() { // change back icons, // and some other swing updates } } isComputing = false; } }.start(); }
upvote count: 1
has comment: http://stackoverflow.com/comment/36205754
has comment: http://stackoverflow.com/comment/35865792
has comment: http://stackoverflow.com/comment/35852405
has comment: http://stackoverflow.com/comment/36348856
has comment: http://stackoverflow.com/comment/36304356
downvote count: 0
has comment: http://stackoverflow.com/comment/35852550

http://stackoverflow.com/comment/35856571
has text: Yeah I am trying to do that right now but what my problem is while for the both 'A's of String "CAA" its pointing to the same 'A'
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23402421
type: Comment

http://stackoverflow.com/q/23428625
has title: Get order of list by value
answer count: 3
score: 3
accepted answer: http://stackoverflow.com/a/23429161
has body: I have an order of list with different values: List&lt;Double&gt; values = new LinkedList&lt;Double&gt;(); values.add(0.1); values.add(0.8); values.add(0.3); What is the fastest way to get a list with indexes depending on the order of values of the given list, in this case {1, 3, 2} because 0.1 is the smallest, 0.2 the second smallest and 0.8 the third smallest?
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/35905425
type: AnsweredQuestion
tagged with: list
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/23429161
has answer: http://stackoverflow.com/a/23428925
type: Question
has comment: http://stackoverflow.com/comment/35905325
has comment: http://stackoverflow.com/comment/35905320
possible better answer: http://stackoverflow.com/a/23428925
tagged with: sorting
has answer: http://stackoverflow.com/a/23428677

http://stackoverflow.com/comment/35673301
has text: @Mr.Pandey: Disagree as well. That question and this question are tangentially related.
type: QuestionComment
comment on: http://stackoverflow.com/q/23302401
score: 0
type: Comment

http://stackoverflow.com/comment/35797654
score: 2
has text: Can you post the full code with correct syntax? You've left the for loop block open.
comment on: http://stackoverflow.com/q/23370463
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23311548
upvote count: 2
has comment: http://stackoverflow.com/comment/35689353
has body: Using your code, I cannot find any Syntax errors (the code compiles). You should use pack to use the minimal size for your JFrame. So simply add an f.pack(); after you added all your components.
downvote count: 0
type: Answer
score: 2
answers question: http://stackoverflow.com/q/23311471

http://stackoverflow.com/q/23333747
tagged with: listgrid
tagged with: smartgwt
has answer: http://stackoverflow.com/a/23334618
type: Question
has title: change filter icon place in smartGWT
linked to: http://stackoverflow.com/q/9534554
score: 0
tagged with: java
accepted answer: http://stackoverflow.com/a/23334618
answer count: 1
tagged with: filter
has body: is it possible in SmartGWT to change the filter icon place from right to left ?
type: AnsweredQuestion

http://stackoverflow.com/comment/35840875
score: 0
comment on: http://stackoverflow.com/a/23372104
type: Comment
has text: If its just one book you can change the return type to Book and in the if statement you could return nook instead of adding this to kopia.
type: AnswerComment

http://stackoverflow.com/comment/35725668
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23331199
has text: possible duplicate of [How to remove object from array](http://stackoverflow.com/questions/23255669/how-to-remove-object-from-array)

http://stackoverflow.com/comment/35909079
comment on: http://stackoverflow.com/a/23428822
score: 0
type: AnswerComment
has text: It says: "<p:ajax> Event:change is not supported." and where exactly i should put this line.
type: Comment

http://stackoverflow.com/comment/35829499
type: Comment
comment on: http://stackoverflow.com/q/23386234
score: 2
has text: In pom: junit 4.7, javax.servlet-api 3.0.1, spring-test 4.0.3, spring-context 4.0.3
type: QuestionComment

http://stackoverflow.com/a/23409999
answers question: http://stackoverflow.com/q/23409655
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: Sub-flows don't have their own exception handling. Exceptions triggered in sub-flow are processed by calling flows(main flow) Private flows are another type of reusable flows, much similar to sub-flows but with a very different behavior in term of threading and exception handling. The primary reason for using a private flow instead of a sub-flow is to define in it a different exception strategy than from the calling flow (something that is impossible with a sub-flow). Private flow is nothing but the main flow without the inbound endpoint. To start the flow again, make your flow main-flow, with an inbound endpoint and in your catch exception strategy, create a java component implementing Callable interface and use muleClient.dispatch to start flow again. A sample component would be something like this: import org.mule.api.MuleEventContext; import org.mule.api.MuleMessage; import org.mule.api.lifecycle.Callable; import org.mule.api.client.MuleClient; public class MyCustomComponent implements Callable { @Override public Object onCall(MuleEventContext eventContext) throws Exception { MuleClient muleClient = eventContext.getMuleContext().getClient(); muleClient.dispatch("jms://my.queue", "Message Payload", null); } }
has comment: http://stackoverflow.com/comment/35870988
upvote count: 2
has comment: http://stackoverflow.com/comment/35871261
score: 2
accepted answer of: http://stackoverflow.com/q/23409655

http://stackoverflow.com/q/23356914
score: 0
answer count: 0
type: UnansweredQuestion
has body: I am trying to write a MessageSourceFileLocator in my utility project. The utility project contains some utility classes, which are packed in a JAR file. The JAR file is added to any other Spring application I have. How is it possible to locate the MessageSource file in another Spring application. I can search by file name, because it is always the same for the MessageSource. I need to know the effective file location/path.
tagged with: spring
tagged with: spring-mvc
has comment: http://stackoverflow.com/comment/35772443
tagged with: java
tagged with: classpath
has comment: http://stackoverflow.com/comment/35772548
has title: Java/Spring: Get MessageSource file path from other Spring applications
type: Question

http://stackoverflow.com/q/23366565
score: -2
has comment: http://stackoverflow.com/comment/35789806
has answer: http://stackoverflow.com/a/23368404
tagged with: java
downvote count: 2
has comment: http://stackoverflow.com/comment/35789957
has body: I have an array of objects in a saved file.dat and i want to restore them into an array of the same object to my java program to use them into my program this is my code but doesn't work at all public static void main (String args[]) throws FileNotFoundException, IOException { Seat[] arr = new Seat [100]; try{ File f = new File("reservedSeats.dat"); FileInputStream fs = new FileInputStream(f); DataInputStream ds = new DataInputStream(fs); int temp; for(int i=0;i&lt;arr.length;i++){ temp=ds.readInt(); arr[i] = new Seat (String.valueOf(temp)/*to convert from int to String*/); } } catch ( FileNotFoundException e ){ } for (Seat arr1 : arr) { System.out.println(arr1); } My Seat.java constructor as follows : public Seat(String seatNo) { this.seatNo = seatNo; }
has comment: http://stackoverflow.com/comment/35789927
has comment: http://stackoverflow.com/comment/35790500
type: Question
has comment: http://stackoverflow.com/comment/35789899
tagged with: object
has comment: http://stackoverflow.com/comment/35789975
tagged with: arrays
has comment: http://stackoverflow.com/comment/35790001
has comment: http://stackoverflow.com/comment/35790379
has comment: http://stackoverflow.com/comment/35789908
has comment: http://stackoverflow.com/comment/35792369
upvote count: 0
answer count: 1
favorite count: 0
has title: Reading array of objects from a .dat file java
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35790907
has comment: http://stackoverflow.com/comment/35789854

http://stackoverflow.com/a/23361140
answers question: http://stackoverflow.com/q/23360278
type: Answer
score: 7
has comment: http://stackoverflow.com/comment/70868107
downvote count: 1
has body: Considering the introduction of default methods to ensure backwards compatibility, I fail to understand why this Interface doesn't have stream() function. The interface was defined before Java 8 existed. Since Stream did not exist prior Java 8, it follows that NodeList could not support it. How do I use a NodeList in combination with the Stream API? You can't. At least, not directly. If it's discouraged to do so, what are the reasons for that? It is not "discouraged". Rather it is not supported. The primary reason is history. See above. It is possible that the people responsible for specifying the org.w3c.dom APIs for Java (i.e. the W3 consortium) will bring out a new edition of the APIs that will be more friendly to Java 8. However, that would introduce a bunch of new compatibility issues. The new edition of the APIs would would not be binary compatibility with the current ones, and would not be compatible with pre-Java 8 JVMs. However, it is more complicated than just getting the W3 Consortium to update the APIs. The DOM APIs are defined in CORBA IDL, and the Java APIs are "generated" by applying the CORBA Java mapping to the IDL. This mapping is specified by the OMG ... not the W3 Consortium. So creating a "Java 8 Stream friendly" version of the org.w3c.dom APIs would entail either getting the OMG to update the CORBA Java mapping to be Stream aware (which would be problematic from a CORBA compatibility perspective, at least) or breaking the connection between the Java API and CORBA. Unfortunately, finding out what (if anything) is happening in the OMG world on refreshing the IDL to Java mapping is difficult ... unless you work for an OMG member organization, etcetera. I don't.
upvote count: 8
has comment: http://stackoverflow.com/comment/70870112

http://stackoverflow.com/q/23309751
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/23332511
type: UnansweredQuestion
upvote count: 1
score: 1
tagged with: java
type: Question
has body: To be specific I am trying to read/write power settings, fan settings, and clock speed settings. I also need access to GPU temperature. I attempted to do this from MingGW with Swig using the NVAPI library but it will not compile as MinGW's compiler doesn't understand the nvapi.h header file. I have scanned through JCuda but I can't locate any functions in JCuda for accessing these driver settings. Note: I have already successfully been able to access all of this functionality from the AMD-SDK for AMD video cards which had no problems compiling with MinGW Visual studio is NOT an option for this project because it is part of a larger project that uses the autotools build system. For linux I should be able to wrap the XNVCtrl library using swig so the only compatibility gap is the windows-nvidea combination. One final note: All kernels will be modular in this system so if the kernels need to be compiled with visual studio that isn't a problem but the control system itself needs to be built with autotools and accessible from Java.
tagged with: nvapi
has title: How can you control NVidia devices from Java on windows using MinGW/MSYS autotools?
tagged with: gpu

http://stackoverflow.com/comment/35858809
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23400585
type: Comment
has text: The first test which modify the database definition has the same result. For the second, I had to insert data to the database after hibernate creates schema otherwise, I cannot pass through getRoles function

http://stackoverflow.com/a/23311210
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/35697971
upvote count: 1
has body: I'm sure it can't be this easy, but: There's Process#getOutputStream, which gives you an OutputStream you can write to that writes to stdin on the process. So in theory, System.setOut(new PrintStream(p.getOutputStream()))... (You may want one of the other PrintStream constructors.)
type: Answer
answers question: http://stackoverflow.com/q/23311177

http://stackoverflow.com/comment/35805685
has text: are you using spring 3
type: Comment
comment on: http://stackoverflow.com/q/23374518
score: 0
type: QuestionComment

http://stackoverflow.com/a/23442487
downvote count: 0
type: Answer
has body: This is a Closest pair of points problem Here is an implementation: http://algs4.cs.princeton.edu/99hull/ClosestPair.java.html Your objects can only move vertically or horizontally, so you need to replace the distance with x+y.
upvote count: 2
answers question: http://stackoverflow.com/q/23442292
score: 2

http://stackoverflow.com/q/23364083
upvote count: 0
score: -2
answer count: 1
tagged with: jsp
has comment: http://stackoverflow.com/comment/35785398
has body: I am learning to use the Thread class in java and I want to print the numbers 1 to 50 using a Thread every x seconds on my JSP page. I am not able to do it. I am able to do this using a simple java program but I would like to use it in a JSP. Demo.jsp &lt;%@ page language="java" contentType="text/html;charset=UTF-8" %&gt; &lt;HTML&gt; &lt;BODY&gt; &lt;% for(int i=0;i&lt;=50;i++) out.println(i); %&gt; &lt;/BODY&gt; &lt;/HTML&gt; How can I achieve my output?
has comment: http://stackoverflow.com/comment/35785624
has comment: http://stackoverflow.com/comment/35785603
has comment: http://stackoverflow.com/comment/35785524
has comment: http://stackoverflow.com/comment/35785338
has comment: http://stackoverflow.com/comment/35785565
has comment: http://stackoverflow.com/comment/35785282
has answer: http://stackoverflow.com/a/23365626
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35787204
downvote count: 2
tagged with: multithreading
has comment: http://stackoverflow.com/comment/35785220
has comment: http://stackoverflow.com/comment/35785227
has title: How to use thread in jsp?
has comment: http://stackoverflow.com/comment/35785452
has comment: http://stackoverflow.com/comment/35785462
tagged with: java
has comment: http://stackoverflow.com/comment/35785293
has comment: http://stackoverflow.com/comment/35785522
type: Question
has comment: http://stackoverflow.com/comment/35785787

http://stackoverflow.com/comment/35682944
type: Comment
comment on: http://stackoverflow.com/a/23308025
has text: Btw, I run my web app by `html > right click form.html > open with > web browser`.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/35906450
type: QuestionComment
has text: Why are you including the `FileHandler` code? Show us the log configuration instead.
comment on: http://stackoverflow.com/q/23429230
score: 0
type: Comment

http://stackoverflow.com/comment/35767093
type: QuestionComment
comment on: http://stackoverflow.com/q/23353759
score: 0
has text: It looks like you are accessing the input file via `BufferedReader`. Hence the file is still open.
type: Comment

http://stackoverflow.com/a/23323793
downvote count: 0
type: Answer
has body: Create a Utility class for connection management to manage it at single point in whole application. Don't load the DataSource every time you need a new connection. Sample code: public class ConnectionUtil { private DataSource dataSource; private static ConnectionUtil instance = new ConnectionUtil(); private ConnectionUtil() { try { Context initContext = new InitialContext(); dataSource = (DataSource) initContext.lookup("JNDI_LOOKUP_NAME"); } catch (NamingException e) { e.printStackTrace(); } } public static ConnectionUtil getInstance() { return instance; } public Connection getConnection() throws SQLException { Connection connection = dataSource.getConnection(); return connection; } public void close(Connection connection) throws SQLException { if (connection != null &amp;&amp; !connection.isClosed()) { connection.close(); } connection = null; } } Always close the connection and handle it in try-catch-finally Connection conn = null; PreparedStatement stmt = null; ResultSet rs = null; try { conn = ConnectionUtil.getInstance().getConnection(); ... } finally { if (rs != null) { rs.close(); } if (stmt != null) { stmt.close(); } if (conn != null) { ConnectionUtil.getInstance().close(conn); } }
score: 5
answers question: http://stackoverflow.com/q/23323653
upvote count: 5

http://stackoverflow.com/q/23330098
tagged with: android
has body: I must say documentation for this is really confusing. I want to get my data from datastore and I receive the following error: 04-27 18:48:40.951: W/System.err(1678): com.google.api.client.googleapis.json.GoogleJsonResponseException: 401 Unauthorized 04-27 18:48:40.951: W/System.err(1678): { 04-27 18:48:40.951: W/System.err(1678): "code" : 401, 04-27 18:48:40.951: W/System.err(1678): "errors" : [ { 04-27 18:48:40.951: W/System.err(1678): "domain" : "global", 04-27 18:48:40.951: W/System.err(1678): "location" : "Authorization", 04-27 18:48:40.951: W/System.err(1678): "locationType" : "header", 04-27 18:48:40.951: W/System.err(1678): "message" : "com.google.appengine.api.oauth.OAuthRequestException", 04-27 18:48:40.951: W/System.err(1678): "reason" : "required" 04-27 18:48:40.961: W/System.err(1678): } ], 04-27 18:48:40.961: W/System.err(1678): "message" : "com.google.appengine.api.oauth.OAuthRequestException" 04-27 18:48:40.961: W/System.err(1678): } 04-27 18:48:40.961: W/System.err(1678): at com.google.api.client.googleapis.services.json.AbstractGoogleJsonClientRequest.newExceptionOnError(AbstractGoogleJsonClientRequest.java:113) I am using OAuth and I have defined my Android device in my Endpoint: public class Constants { public static final String WEB_CLIENT_ID = "bvye4g73g7.apps.googleusercontent.com"; public static final String ANDROID_CLIENT_ID = "biurgf8ery8.apps.googleusercontent.com"; public static final String ANDROID_AUDIENCE = WEB_CLIENT_ID; public static final String EMAIL_SCOPE = "https://www.googleapis.com/auth/userinfo.email"; } @ApiMethod(name = "listCars", scopes = { Constants.EMAIL_SCOPE }, clientIds = { Constants.WEB_CLIENT_ID, Constants.ANDROID_CLIENT_ID }, audiences = { Constants.ANDROID_AUDIENCE }) I have followed these steps to create my Android Client ID: https://developers.google.com/appengine/docs/java/endpoints/auth#Java_Specifying_authorized_clients_in_the_API_backend I don't get it. I have defined my Android client on my Google App Engin…
type: UnansweredQuestion
tagged with: java
tagged with: oauth-2.0
type: Question
has title: Android error while connecting to Google Endpoints
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/23339878
tagged with: google-app-engine

http://stackoverflow.com/comment/35771790
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23330016
has text: Oh man, I've really been able to dig through the source and it does indeed look like you are correct - ALL of the visuals from JTabbedPane come from it's UI field (BasicTabbedPaneUI or e.g. WindowsTabbedPaneUI) and it's built from scratch. No buttons or panels. Just painting rectangles and handling mouse events. With everything else, I just assumed that I was missing something because all my other swing-related questions have been answered with "just use this already-well-implemented component and extend it."

http://stackoverflow.com/comment/35769964
comment on: http://stackoverflow.com/a/23355070
type: Comment
type: AnswerComment
score: 0
has text: It has not solved it. I started a new program from scratch again and used your code exact other than the file location. I am not finding the issue. I still get the same error as I did before.

http://stackoverflow.com/comment/35654236
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23292197
has text: Possible duplicate http://stackoverflow.com/questions/3951547/java-array-finding-duplicates

http://stackoverflow.com/a/23391717
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/23388115
accepted answer of: http://stackoverflow.com/q/23388115
upvote count: 2
has body: I resolve this by add a customer Deserialize like this: @JsonIgnoreProperties(ignoreUnknown = true) public class CalendarResultsDto { @JsonDeserialize(using=JsonMatchDeserialize.class) @JsonProperty(value="flux") So after that a return a Map witch String it's the key. JsonMatchDeserialize.java: public class JsonMatchDeserialize extends JsonDeserializer> { @Override public Map&lt;String, CalendarMatchDataDto&gt; deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException, JsonProcessingException { Map&lt;String, CalendarMatchDataDto&gt; mapToReturn = new HashMap&lt;String, CalendarMatchDataDto&gt;(); JSONObject flux; try { flux = new JSONObject(jsonParser.getValueAsString()); ObjectMapper mapper = new ObjectMapper(); Iterator&lt;String&gt; iter = flux.keys(); while (iter.hasNext()) { String key = iter.next(); try { Object value = flux.get(key); CalendarMatchDataDto calendarMatchDataDto = mapper.readValue(value.toString(), CalendarMatchDataDto.class); if(key!=null &amp;&amp; calendarMatchDataDto!=null) mapToReturn.put(key, calendarMatchDataDto); } catch (JSONException e) { e.printStackTrace(); } } } catch (JSONException e1) { e1.printStackTrace(); } return mapToReturn; } and CalendarMatchDataDto.java public class CalendarMatchDataDto { @JsonProperty(value="Optaf_matchdata") public MatchDto matchDto ; }
type: AcceptedAnswer

http://stackoverflow.com/q/23350721
has comment: http://stackoverflow.com/comment/35762953
has body: I am using correct practices mentioned in this article: http://www.javaworld.com/article/2071275/core-java/when-runtime-exec---won-t.html?page=2 I read the Output and Error streams in concurrently. However, when reading the Output stream of the process, it hangs on readLine() after the last line. I have no idea how to work around this. It is the line of the process and it just hangs there. The command that hangs this is paexec \192.168.1.92 -c -f C:\Windows\ITBBsync0.bat. Inside the batch file there are several line such as the following: devcon.exe status =USB > C:\Windows\output.txt When I execute it on command line, process exits with code 0. When I execute it in Java it hangs after reading the last line of output (which is basically the last line of the batch file). I believe the process is not exiting which is why the issue occurs. import java.io.*; class StreamGobbler extends Thread { InputStream is; String type; StreamGobbler(InputStream is, String type) { this.is = is; this.type = type; } public void run() { try { InputStreamReader isr = new InputStreamReader(is); BufferedReader br = new BufferedReader(isr); String line=null; while ((line = br.readLine()) != null){ System.out.println(type + "&gt;" + line); //hangs after reading last line. } } catch (IOException ioe) { ioe.printStackTrace(); } } } Also the method that uses the StreamGobbler is the following. There is obviously a parent class which executes this method. public static boolean cmd(String command){ try{ Runtime rt = Runtime.getRuntime(); System.out.println("Execing " + command); Process p = rt.exec(command); // any error message? StreamGobbler errorGobbler = new StreamGobbler(p.getErrorStream(),"ERROR"); StreamGobbler outputGobbler = new StreamGobbler(p.getInputStream(), "OUTPUT"); errorGobbler.start(); outputGobbler.start(); int exitVal = p.waitFor(); if (exitVal != 0){ System.out.println("ExitValue: " + exitVal); System.out.println(command + "EXIT CODE:" + exitVal); return false; } return true;…
has comment: http://stackoverflow.com/comment/35761627
tagged with: readline
linked to: http://stackoverflow.com/q/13541157
upvote count: 1
linked to: http://stackoverflow.com/q/3643939
has comment: http://stackoverflow.com/comment/35762551
has comment: http://stackoverflow.com/comment/35762667
has comment: http://stackoverflow.com/comment/35764843
tagged with: java
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35773811
answer count: 0
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/35761515
has title: readLine() hangs on last line using Runtime.exec and BufferedStream
linked to: http://stackoverflow.com/q/11266861
has comment: http://stackoverflow.com/comment/35761802
favorite count: 0
type: Question

http://stackoverflow.com/a/23414755
has comment: http://stackoverflow.com/comment/35885103
has comment: http://stackoverflow.com/comment/35882617
has comment: http://stackoverflow.com/comment/35881374
has body: Your pom is missing the Spring Boot Maven Plugin: org.springframework.boot spring-boot-maven-plugin
answers question: http://stackoverflow.com/q/23414609
type: Answer
has comment: http://stackoverflow.com/comment/35889108
score: 11
has comment: http://stackoverflow.com/comment/95859755
downvote count: 0
upvote count: 11

http://stackoverflow.com/comment/59312859
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23447859
has text: It makes sense, the problem is that I had to got to Google and Stack Overflow to figure that out.
score: 1

http://stackoverflow.com/q/23381832
has comment: http://stackoverflow.com/comment/35820325
has comment: http://stackoverflow.com/comment/35819376
favorite count: 0
has title: Stuck on a ClassCastException with Hibernate but only occasionally on tomcat
has comment: http://stackoverflow.com/comment/35819675
answer count: 0
has body: I don't suppose anyone can help here, but if you have any pointers it would be much appreciated. Basically since moving Tomcat (7) to Java 7 we sometimes get the below exception. The only thing that seems to sort it is restarting the tomcat. I cannot reproduce it locally on my machine, so I know all the mappings etc are good. I was wondering if anyone has any ideas? org.hibernate.PropertyAccessException: IllegalArgumentException occurred calling getter of hub.app.model.DocumentFolder.id at org.hibernate.property.BasicPropertyAccessor$BasicGetter.get(BasicPropertyAccessor.java:171) at org.hibernate.tuple.entity.AbstractEntityTuplizer.getIdentifier(AbstractEntityTuplizer.java:183) at org.hibernate.persister.entity.AbstractEntityPersister.getIdentifier(AbstractEntityPersister.java:3596) at org.hibernate.persister.entity.AbstractEntityPersister.isTransient(AbstractEntityPersister.java:3312) at org.hibernate.engine.ForeignKeys.isTransient(ForeignKeys.java:181) at org.hibernate.engine.CascadingAction$9.noCascade(CascadingAction.java:348) at org.hibernate.engine.Cascade.cascade(Cascade.java:139) &lt;snip&gt; Caused by: java.lang.IllegalArgumentException: java.lang.ClassCastException@18b0170 at sun.reflect.GeneratedMethodAccessor754.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.hibernate.property.BasicPropertyAccessor$BasicGetter.get(BasicPropertyAccessor.java:145) at org.hibernate.tuple.entity.AbstractEntityTuplizer.getIdentifier(AbstractEntityTuplizer.java:183) at org.hibernate.persister.entity.AbstractEntityPersister.getIdentifier(AbstractEntityPersister.java:3596) at org.hibernate.persister.entity.AbstractEntityPersister.isTransient(AbstractEntityPersister.java:3312) at org.hibernate.engine.ForeignKeys.isTransient(ForeignKeys.java:181) at org.hibernate.engine.CascadingAction$9.noCascade(CascadingAction.java:348) at org.hibernate.engine.Cascade.cas…
type: UnansweredQuestion
upvote count: 1
score: 1
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/35818228
type: Question
downvote count: 0

http://stackoverflow.com/q/23317332
has comment: http://stackoverflow.com/comment/35700784
has comment: http://stackoverflow.com/comment/35710389
score: 26
has comment: http://stackoverflow.com/comment/35700292
has comment: http://stackoverflow.com/comment/35700697
upvote count: 26
has comment: http://stackoverflow.com/comment/35700467
has answer: http://stackoverflow.com/a/23317345
downvote count: 0
has answer: http://stackoverflow.com/a/23317375
favorite count: 0
has comment: http://stackoverflow.com/comment/35700686
possible better answer: http://stackoverflow.com/a/23317375
tagged with: java-8
answer count: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23346089
has answer: http://stackoverflow.com/a/67774043
has comment: http://stackoverflow.com/comment/35753295
tagged with: java
has comment: http://stackoverflow.com/comment/35710251
tagged with: multithreading
has title: Alternate to Thread.stop() in Java 8?
accepted answer: http://stackoverflow.com/a/23346089
type: Question
has body: Is there any way to force a Thread to stop under Java 8, now that Thread.stop has been removed? This includes forcing a thread waiting on a lock/synchronized/sleep/wait/infinite loop to stop. This is intended as part of a watchdog for the application which can detect if it has deadlocked/frozen, force kill threads and then save the current state to avoid lost information - while there is a high chance of this information being corrupt due to forcing a thread to stop, it's better to have a copy of the possibly incorrect information than to lose it. Attempting to save this information without stopping the locked up threads is impossible, as saving it will require acquiring locks.

http://stackoverflow.com/q/23323823
answer count: 4
has answer: http://stackoverflow.com/a/66258507
has title: android countdowntimer tick is not accurate
has comment: http://stackoverflow.com/comment/35721010
possible better answer: http://stackoverflow.com/a/66258507
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/56248619
downvote count: 0
has answer: http://stackoverflow.com/a/74268712
score: 10
favorite count: 0
has answer: http://stackoverflow.com/a/32554107
type: Question
tagged with: countdowntimer
tagged with: android
has comment: http://stackoverflow.com/comment/35713936
has body: I am using a countdown timer for audio notification... and it's not accurate from the start... using initial parameters private final long startCountDown; private final long intervalCountDown; ... startCountDown = 180 * 1000; // 3 mns - to be set from Preferences later intervalCountDown = 60 * 1000; // 1 mns - to be set from Preferences later ... public void onTick(long millisUntilFinished) { Log.d(TAG, "notify countDown: " + millisUntilFinished + " msecs"); } countDownTimer = new SwimCountDownTimer(startCountDown,intervalCountDown); .... public void startCountDown() { Log.d(TAG, "start countDown for " + startCountDown + " msecs" ); countDownTimer.start(); } I can see in the log that the initial countdown is correctly set to 180000 but the next one should be 120000 and it's set to 119945 !!! 04-27 14:50:42.146: I/SWIMMER(8670): notify countDown: 180000 msecs 04-27 14:51:42.206: I/SWIMMER(8670): notify countDown: 119945 msecs This is quite annoying as the audio notifier is expecting to say only '2 minutes" and not "1 minute and fifty nine seconds" ...; why the interval is not right ... ? I can tricj it in setting myself the text to speech string ... but is there any way to get correct data ? thanks for suggestions
tagged with: java
has comment: http://stackoverflow.com/comment/35711891
upvote count: 10
accepted answer: http://stackoverflow.com/a/32554107

http://stackoverflow.com/comment/35661598
type: Comment
has text: You wouldn't modify `ExternalClass`, you'd write your own subclass.
comment on: http://stackoverflow.com/a/23296218
score: 0
type: AnswerComment

http://stackoverflow.com/a/23294683
has comment: http://stackoverflow.com/comment/35658490
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/23294569
has comment: http://stackoverflow.com/comment/35661561
upvote count: 8
has comment: http://stackoverflow.com/comment/35661714
has comment: http://stackoverflow.com/comment/35658705
has body: This is an anonymous inner class. It creates an object that is an instance of some class that subclasses TestClass, where you don't want to give that subclass a name (because you just need to create the object on the fly and you don't need to use that class anywhere else). The code only initializes the object, you're not actually calling the methods on the object you're creating, so that's why you don't see any output. You could add a line to your code public static void main (String[] args) throws java.lang.Exception { TestClass TC = new TestClass() { public void testprint() { System.out.println("Z is " + getZ()); } }; // &lt;- call the new method (&gt;_&lt; this won't compile) TC.testprint(); } except this won't work because testprint isn't defined as a method on TestClass, the local variable referencing the object has the type TestClass, so the compiler expects to find methods defined on TestClass or on superclasses of TestClass. You could add some kind of method to TestClass, like this: abstract class TestClass { int z; public TestClass(){ z=10; } public int getZ(){ return z; } public void setZ(int z){ this.z=z; } // add new method public abstract void testprint(); } Now the compiler knows to expect that an object of type TestClass will have a method called testprint. I didn't have to make TestClass abstract, I could have added an impelmentation of testprint to it. However, because TestClass is abstract, it's evident that the new object is not a TestClass but is some subclass of it. Or alternatively, call this method through a different already-public method of TestClass. Use your TestClass unaltered but change the main method to: public static void main (String[] args) throws java.lang.Exception { TestClass TC = new TestClass() { public void testprint() { System.out.println("Z is " + super.getZ()); } // override Z getter to call testprint @Override public int getZ(){ testprint(); return z; } }; TC.getZ(); // &lt;- call method on object created above } testprint…
score: 8

http://stackoverflow.com/q/23341799
has comment: http://stackoverflow.com/comment/35748272
has comment: http://stackoverflow.com/comment/35744489
tagged with: string
has comment: http://stackoverflow.com/comment/35745202
has comment: http://stackoverflow.com/comment/35745209
favorite count: 0
has comment: http://stackoverflow.com/comment/35744675
tagged with: byte
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35744633
has comment: http://stackoverflow.com/comment/35744938
answer count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/35744948
upvote count: 1
type: Question
has body: Hi could any explain me how to parse the String hex decimal array into an image as below. This data I am getting from the server and I am converting that into the hex String. String sb = "0d 02 01 02 4e 52 30 39 47 30 35 36 31 38 00 03 00 fa 01 95 \n" + "e4 53 c0 a8 51 b1 53 a3 03 40 89 54 66 9c ee 10 01 de 9a 5c \n" + "22 e6 a0 2c 5d b2 69 8c 9d 79 e6 a5 41 50 c6 78 ab 31 8c 8a \n" + "00 72 83 53 2a e0 67 14 d0 2a 54 1b 85 00 00 76 a6 b4 64 1e \n" + "95 32 a1 c8 a5 90 f3 81 da 98 15 88 c7 51 54 6e 63 cb 1e 3a \n" + "d6 99 19 19 ef 55 6e 13 2b 91 49 89 98 2f a7 49 b8 95 20 8a \n" + "88 d9 cc b9 f9 0d 6d 85 e6 9e 23 e3 a5 06 7c a6 02 c6 e8 c3 \n" + "2a 72 0d 74 90 1d d1 29 f5 14 cf 29 5b 82 01 fa 8a 9d 14 00 \n" + "00 e0 50 38 ad 46 4c 38 15 89 7a b8 9c fa 11 5b f2 2e 56 a9 \n" + "5c e9 ad 39 0e 18 03 8e f4 8a 68 c4 14 d2 39 ad 07 d2 ae 17 \n" + "a0 0d f4 35 5d ed 27 4f bd 1b 0f c2 99 9d 88 06 41 ae 9f 4e \n" + "19 b2 88 fb 57 36 54 83 c8 23 eb c5 74 da 70 c5 94 7f 4a 07 \n" + "1d cb 2c 3e 53 58 77 1c ca 45 6e 37 dd 35 89 38 fd e9 a1 97 \n" + "2d 88 76 d1 8a 76 29 c8 bb 98 52 32 23 da 4f 6a 96 38 01 19 \n" + "6e 95 21 c0 e0 0a 98 0d d1 0c 75 14 0a c4 b6 d1 a0 8f 81 8c \n" + "d3 9d 76 1a 92 24 21 00 a8 e7 38 fc 29 9b c7 62 85 c9 dc f8 \n" + "f4 aa f8 a7 bb 65 89 a6 1e b4 8c a5 ab 0a 43 41 a6 f7 a0 43 \n" + "5e 95 54 e0 50 06 48 06 a4 c7 14 0e 28 85 86 2a 32 78 a9 5e \n" + "a0 90 e0 52 35 7b 12 e2 81 4b 8e 69 71 4c 60 bd 6a 74 a8 50 \n" + "73 53 31 c0 da 3a d0 00 cd b8 e0 74 14 a0 8c e3 bd 20 18 1c \n" + "75 a6 a9 cb 8d c3 9c d3 02 c4 7c 1a b8 83 8a aa 8a 59 b8 ab \n" + "89 c0 02 80 1e 38 a5 52 41 e2 90 0a 51 40 0f f3 1b 34 ed e1 \n" + "ba f5 a8 a9 71 40 12 16 e3 02 a2 75 ca 9a 78 a5 c1 34 01 45 \n" + "46 3a d4 8b 43 ae d9 0f bd 0b 40 89 00 14 f0 05 31 4d 48 a2 \n" + "81 8e db 9a 70 5a 45 19 a9 00 a6 16 1a 12 83 1e 6a 40 29 c1 \n" + "68 15 91 58 db 46 df 79 14 fe 15 24 71 88 d7 6a 8c 01 da a6 \n" + "c5 21 5a 01 22 0d 0a 2a 4b 57 00 0f 00 01 82 03 00 00 0d 0a "; String …
has comment: http://stackoverflow.com/comment/35745448
has comment: http://stackoverflow.com/comment/35744444
linked to: http://stackoverflow.com/q/140131
has comment: http://stackoverflow.com/comment/35744595
has comment: http://stackoverflow.com/comment/35744549
downvote count: 0
tagged with: image
has comment: http://stackoverflow.com/comment/35744504
has comment: http://stackoverflow.com/comment/35744968
has title: How to parse the String array into image using java?

paintcomponent
tags question: http://stackoverflow.com/q/23296974
tags question: http://stackoverflow.com/q/23369447
tag name: paintcomponent
tags question: http://stackoverflow.com/q/23309601
tags question: http://stackoverflow.com/q/23331476
tags question: http://stackoverflow.com/q/23398744
tags question: http://stackoverflow.com/q/23323085
tags question: http://stackoverflow.com/q/23310564
tags question: http://stackoverflow.com/q/23357919
tags question: http://stackoverflow.com/q/23384327
tags question: http://stackoverflow.com/q/23311738
tags question: http://stackoverflow.com/q/23296354
type: Tag
tags question: http://stackoverflow.com/q/23444267

http://stackoverflow.com/comment/35855802
score: 0
comment on: http://stackoverflow.com/q/23401972
type: Comment
type: QuestionComment
has text: It's very suspicious to me that you're comparing the current room number to `getRoomBookings().size()` _and_ to a room booking ID. Does `RoomBookingDTO` correctly implement `equals()` and `hashCode()`?

http://stackoverflow.com/comment/35930432
type: AnswerComment
has text: So, does this mean that an object will inherit private fields of it superclass even if it cannot access them?
score: 0
comment on: http://stackoverflow.com/a/23441863
type: Comment

http://stackoverflow.com/comment/35819396
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23382380
has text: I assumed it can't be done, are there really no tools that do this automatically? Like for example I've used EclEmma for code coverage that more or less insert sort of hidden markers to see where code reached - it should be possible shouldn't it?
score: 0

http://stackoverflow.com/a/23352837
answers question: http://stackoverflow.com/q/23352783
has comment: http://stackoverflow.com/comment/35766786
has comment: http://stackoverflow.com/comment/35766936
score: 1
has comment: http://stackoverflow.com/comment/35766592
accepted answer of: http://stackoverflow.com/q/23352783
has comment: http://stackoverflow.com/comment/35766659
has comment: http://stackoverflow.com/comment/35766962
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/35766700
has comment: http://stackoverflow.com/comment/35765587
has comment: http://stackoverflow.com/comment/35766953
type: Answer
has body: You could change the if to if ((num1 != 0 &amp;&amp; i % num1 == 0) || (num2 != 0 &amp;&amp; i % num2 == 0)) {
has comment: http://stackoverflow.com/comment/35766513
upvote count: 1

http://stackoverflow.com/q/23359797
has comment: http://stackoverflow.com/comment/35782879
score: 6
answer count: 1
favorite count: 0
has body: There is an object a classic POJO as below: @Document public class MyPojo { @DBRef @Field("otherPojo") private List&lt;OtherPojo&gt; otherPojos; } And OtherPojo.java: public class OtherPojo{ @Id private ObjectId _id; private String someOtherFields; } I can not cascade-save these, but I'm getting over it by saving DBRefs first and then saving my POJO list, but still when I try to fetch all list or querying some of them with below code: Query query = new Query( Criteria.where( "myPojo.blabla" ).is( "blabla" ) ); List&lt;MyPojo&gt; resultList = mongoTemplate.find( query, MyPojo.class, "myCollection" ); it returns me with a list of null DBrefs, it counts true. For example: there are saved 10 DBRefs it returns 10 null object in it, but its primitive types and other types that aren't a DBRref are all non-null. How can i handle this ? I save my objects as below: for (MyPojo pojo : somePojoList) { for (OtherPojo otherPojo : pojo.getOtherPojos()) { mongoTemplate.save(otherPojo, "myCollection"); } } // ... mongoTemplate.insert( myPojoList, "myCollection" ); EDIT: OK, now I know if I do not specify a collection name when I'm saving otherPojos, I can fetch them (thanks to @jmen7070). But I have to write myCollection there because I'm dropping and re-creating them always. That's a use-case. So how can I say "find method to use same collection to fetch DBRefs"?
tagged with: spring-data-mongodb
tagged with: spring
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23360827
tagged with: java
upvote count: 7
downvote count: 1
accepted answer: http://stackoverflow.com/a/23360827
type: Question
has comment: http://stackoverflow.com/comment/122315104
tagged with: mongodb
has title: Spring MongoDB data can not fetch @DBRef objects with "find" query

http://stackoverflow.com/comment/35880990
has text: @blisstdev: Have you tried to do as I suggested? What does not work?
score: 0
comment on: http://stackoverflow.com/q/23378071
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35690317
type: Comment
comment on: http://stackoverflow.com/a/23312033
has text: If both codes are same but you are getting different results then I suspect that you are handling different input. Double check if you are really using same code and if you didn't incorrectly edit `gift1.in` file.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/35719299
type: AnswerComment
score: 0
type: Comment
has text: I also tried to make the inner for loop start from int j = i. However, using that method will not detect self edges.
comment on: http://stackoverflow.com/a/23327818

http://stackoverflow.com/comment/35693441
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23313411
score: 0
has text: Why is `239999995.546` worse than `239989995.546`? But maybe something like this question helps you: http://stackoverflow.com/questions/7906996/algorithm-to-round-to-the-next-order-of-magnitude-in-r

http://stackoverflow.com/comment/35918344
comment on: http://stackoverflow.com/a/23435253
has text: Then I'd say this is not an answer, and not useful.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/23315545
upvote count: 10
has body: I have been searching for quite some time to read an "official statement" on this matter, but found none. Therefore, could anyone please indicate a reference or point to some news on this? What version of JasperReports has support for Java 8, or at least is there partial support available? (or is it "trial and error"?) Some posts on the Jasper community forum seem to indicate that iReport and JasperReports Server does not provide Java 8 support yet. On the other hand, I see some indications that it does, at least in part (http://community.jaspersoft.com/jasperreports-server/issues/3498). It is a bit confusing.
has answer: http://stackoverflow.com/a/37566807
type: Question
tagged with: jasper-reports
tagged with: compatibility
score: 10
has answer: http://stackoverflow.com/a/23324530
has title: What version of JaspeReports has support for Java 8?
answer count: 3
downvote count: 0
accepted answer: http://stackoverflow.com/a/23324530
favorite count: 0
tagged with: java-8
has answer: http://stackoverflow.com/a/54399028
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/37566807

http://stackoverflow.com/q/23403595
has comment: http://stackoverflow.com/comment/35858919
has comment: http://stackoverflow.com/comment/35858575
has comment: http://stackoverflow.com/comment/35859108
tagged with: swing
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/35858685
has comment: http://stackoverflow.com/comment/35859726
type: Question
tagged with: for-loop
accepted answer: http://stackoverflow.com/a/23405029
has comment: http://stackoverflow.com/comment/35859181
has comment: http://stackoverflow.com/comment/35859171
has comment: http://stackoverflow.com/comment/35861784
tagged with: jtable
score: 0
has body: Good day, guys. I would just like to ask, how can I set the value of the next column value? Here, I have the counter "counter" which adds the number of true boolean values in the sampleTable. What I want to do is to set the value of the data in the next column of the table, for the "total". the "total" data should be the counter value. What should I do about this? private void tableTest(){ int nRow = sampleTable.getRowCount(); int nCol = sampleTable.getColumnCount(); int counter = 0; Object[][] tableData = new Object[nRow][nCol]; for (int i = 0 ; i &lt; nRow ; i++){ for (int j = 3 ; j &lt; nCol ; j++){ tableData[i][j] = sampleTable.getValueAt(i,j); System.out.println(tableData[i][j]); if(tableData[i][j] != null &amp;&amp; tableData[i][j].equals(true)){ counter++; } } /* if(nCol == 7){ sampleTable.setValueAt(i, 7, counter); }else{ tableData = new Object[nRow][nCol + 1]; sampleTable.setValueAt(i, 7, counter); }*/ System.out.println(counter); sampleTable.setValueAt(i,7,counter); counter = 0; } }
has answer: http://stackoverflow.com/a/23405029
answer count: 1
has comment: http://stackoverflow.com/comment/35861187
has comment: http://stackoverflow.com/comment/35859674
has title: setting the data of the next column in jtable in java

http://stackoverflow.com/q/23337096
has title: Apache FileUtils when comparing two identical pdfs keeps returning false
score: 0
has answer: http://stackoverflow.com/a/23338266
answer count: 3
possible better answer: http://stackoverflow.com/a/23337110
tagged with: http://stackoverflow.com/tag/pdf
has answer: http://stackoverflow.com/a/23337110
has comment: http://stackoverflow.com/comment/35738238
has comment: http://stackoverflow.com/comment/35741419
accepted answer: http://stackoverflow.com/a/23338266
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35738071
tagged with: java
tagged with: fileutils
type: Question
has comment: http://stackoverflow.com/comment/35737577
has comment: http://stackoverflow.com/comment/35741377
has body: I am using FileUtils to compare two identical pdfs. This is the code: boolean comparison = FileUtils.contentEquals(pdfFile1, pdfFile2); Despite the fact that both pdf files are identical, I keep getting false. I also noticed that when I execute: byte[] byteArray = FileUtils.readFileToByteArray(pdfFile1); byte[] byteArrayTwo = FileUtils.readFileToByteArray(pdfFile2); System.out.println(byteArray); System.out.println(byteArrayTwo); I get the following bytecode for the two pdf files: [B@3a56f631 [B@233d28e3 So even though both pdf files are absolutely identical visually, their byte-code is different and hence failing the boolean test. Is there any way to test whether the identical pdf files are identical?
has answer: http://stackoverflow.com/a/23337386

http://stackoverflow.com/a/23372474
has comment: http://stackoverflow.com/comment/35802613
has comment: http://stackoverflow.com/comment/35805209
has body: try experimenting with a List: List&lt;Customer&gt; customers = new List&lt;Customer&gt;(); do { customers.add(new Customer(/* Possible args */)); } while (/* condition to keep making customers */); And then you can access them using List.get: customers.get(0); customers.get(1); /* etc */ or many of the options in the java.util.Collections Library You could also write your own to better understand how to dynamically store objects. Here is a rudimentary example. You store the objects in an Array: T[] list You add them to the next available space which is tracked by an integer int nextIndex which starts at 0 and is incremented each time something is added. When you add something you check if you have reached the current capacity of your storage list, if you have, create a newlist (T[] newList) of double the size of the old list, copy over the values, and then replace the old list with this new list. T is a generic used to generalize the input that will be given. class AutoExpandingList&lt;T&gt; { T[] list; int nextIndex; public AutoExpandingList() { this.list = new T[10]; this.nextIndex = 0; } public void add(T item) { if (nextIndex &gt;= list.length) { expandList(); } list[nextIndex] = item; nextIndex++; } public void expandList() { T[] newList = new T[list.length*2]; for (int i = 0; i &lt; list.length; i++) { newList[i] = list[i]; } this.list = newList; } public T get(int index) { return list[index]; } // You could implement other methods here: // remove(int index) // insert(int index, T item) // sort() // etc... } Which you could now use: AutoExpandingList&lt;Integer&gt; numbers = new AutoExpandingList&lt;Integer&gt;(); numbers.add(1); numbers.add(5); AutoExpandingList&lt;String&gt; strings = new AutoExpandingList&lt;String&gt;(); strings.add("one"); strings.add("five"); AutoExpandingList&lt;Customer&gt; costumers = new AutoExpandingList&lt;Costumer&gt;(); costumers.add(new Customer(1)); costumers.add(new Customer(5)); For you provided code you would simply impleme…
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23372358
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/35802435
has comment: http://stackoverflow.com/comment/35883649
accepted answer of: http://stackoverflow.com/q/23372358

http://stackoverflow.com/comment/35854974
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23401275
has text: I actually just got it with the regex, was actually really easy.

http://stackoverflow.com/comment/35774638
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/23348356
type: Comment
has text: use execute instead of submit.

http://stackoverflow.com/comment/35888753
type: Comment
has text: thanks a lot for clearing almost every doubts I had regarding HashMap's memory layout.
comment on: http://stackoverflow.com/a/23419050
score: 1
type: AnswerComment

http://stackoverflow.com/comment/36689832
has text: Hi chelo_c. Are you trying to load images from OBB file? If not, you don't have to override anything you just create instance of AssetManager and then use AssetManager.load() function to load images, sounds etc.
comment on: http://stackoverflow.com/a/23397989
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/35659686
comment on: http://stackoverflow.com/a/23295026
type: AnswerComment
score: 0
type: Comment
has text: Better to use `fail("Should have thrown exception!")` after `do stuff` instead of `assertTrue(passed)` - one less variable.

http://stackoverflow.com/a/23390126
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/23390058
score: 0
accepted answer of: http://stackoverflow.com/q/23390058
has body: You need to dynamically add active class to menu item and add suitable style to it. HTML About MHG Workout Programs Fitness Tips Contact Us Read Our Blog jquery $('a.menu').click(function(){ $('a.menu').removeClass("active"); $(this).addClass("active"); }); JSFIDDLE Reference - Jquery Add active class to main menu

http://stackoverflow.com/comment/35936365
type: Comment
type: AnswerComment
has text: How did I missed that? Thanks, will update my answer accordingly :)
score: 0
comment on: http://stackoverflow.com/a/23429838

http://stackoverflow.com/q/23369867
has comment: http://stackoverflow.com/comment/35796794
tagged with: arraylist
answer count: 1
has comment: http://stackoverflow.com/comment/35796536
has answer: http://stackoverflow.com/a/23370065
favorite count: 0
tagged with: jlabel
type: UnansweredQuestion
has title: Display Arraylist Items as Separate JLabels
has comment: http://stackoverflow.com/comment/35796452
score: -3
has body: I'm making an ordering system application. I want the user to click a button, add the item of the button they clicked to an arraylist, and display the arraylist at the bottom of the screen. I currently can add the item to the list, but having trouble displaying each item as it's own JLabel. So, how do I do it, or how is it properly done. Shortened examples. MenuPanel.Java b1.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { OrderPanel.getOrder().add("bread"); meatMenu(); //Changes panel display (not important) System.out.println(OrderPanel.getOrder()); } }); OrderPanel.Java Map&lt;String, List&lt;String&gt;&gt; map = new HashMap&lt;String, List&lt;String&gt;&gt;(); order = new ArrayList&lt;String&gt;(); map.put("order", order); System.out.println(order); l1 = new JLabel(); l1.setFont(l1.getFont().deriveFont(FONT_POINTS)); l1.add(order.toString()); //Error on add add(l1); I can System.out.print the items in the list with no problem, but cannot display them in a JLabel. :/ EDIT: NullPointerException Issue public JLabel holder; public static List&lt;String&gt; order; order = new ArrayList&lt;String&gt;(); ArrayList&lt;JLabel&gt; labels = new ArrayList&lt;JLabel&gt;(); for (int i = 0; i &lt; order.size(); i++) { holder = new JLabel(); holder.setText(order.get(i).toString()); labels.add(holder); } System.out.print(holder); // Works add(holder); // Doesn't work - throws exception
tagged with: swing
tagged with: dictionary
upvote count: 0
tagged with: java
downvote count: 3
type: Question

http://stackoverflow.com/q/23320402
type: Question
answer count: 2
tagged with: variables
accepted answer: http://stackoverflow.com/a/23320424
has comment: http://stackoverflow.com/comment/35705472
has body: I'm pretty new to Java. I'm making a class for a card. The face is the number of the card, and can only be 1-13. I'm trying to validate it by setting f to 1-13. I wanted to simply do this: public void setFace(int f) { f int &gt;= 1 &amp;&amp; f &lt;= 13); } Obviously, you can't do that. How do would I simply set f to the numbers 1-13? Thanks for any help!
possible better answer: http://stackoverflow.com/a/23320439
score: 0
tagged with: set
has answer: http://stackoverflow.com/a/23320439
has comment: http://stackoverflow.com/comment/35705410
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23320424
tagged with: java
has title: How to set int variable to number-number

http://stackoverflow.com/comment/35709554
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23322645
type: Comment
has text: Thx...But my concern is about consistency of the MDB in a clustered environment. does JMX handle synchronization in clustered environment?? does it manage all instances of the MDB or it will cause troubles??

http://stackoverflow.com/comment/35731668
type: QuestionComment
comment on: http://stackoverflow.com/q/23334619
has text: You declared variable c inside your try block, and trying to access in finally block. Move declaration outside try block
score: 0
type: Comment

http://stackoverflow.com/a/23372452
type: AcceptedAnswer
has body: Firstly, my apologies about the sarky comment above. The reason you receive this error is because your alter script isn't taking any action with respect to constraints. Columns which are the target of constraints (Unique, Foreign Key, Default, etc) can't be modified unless the constraint is first dropped. In which case you'll probably need to add the constraints back afterwards. I've assumed your earlier (deleted) comment still holds, viz that you do not require to create the constraints again after they have been dropped. Re : How do I drop all constraints Disclaimer : Back up your database before you try this, but the following MIGHT work. It is a destructive one way operation. declare @sql nvarchar(2000); while(exists(select 1 from sys.objects WHERE type_desc LIKE '%CONSTRAINT%')) begin BEGIN TRY SELECT TOP 1 @sql=('ALTER TABLE ' + SCHEMA_NAME(schema_id) + '.[' + OBJECT_NAME(parent_object_id) + '] DROP CONSTRAINT [' + OBJECT_NAME(OBJECT_ID) + ']') FROM sys.objects WHERE type_desc LIKE '%CONSTRAINT%' ORDER BY NEWID(); exec (@sql); END TRY BEGIN CATCH END CATCH end; GO Rationale: The TRY CATCH is required because there is no guarantee that we will get the order of dependencies correct when dropping constraints (e.g. FK dependent on PK), so we basically squash the error and try drop another random constraint (ORDER BY NEWID()) Reference : Based on this query here, but extended to all constraints SqlFiddle Here
type: Answer
accepted answer of: http://stackoverflow.com/q/23371132
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/23371132
upvote count: 2

http://stackoverflow.com/comment/35745111
has text: Why dont you post some code so we can see what you tried?
comment on: http://stackoverflow.com/q/23342292
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/35787102
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23363111
has text: I just added while(rs.next()){ } inside the try. It is taking 247 seconds. Actual csv size is 1200KB..

http://stackoverflow.com/q/23382326
favorite count: 0
type: UnansweredQuestion
tagged with: wicket
answer count: 0
tagged with: classloader
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/35820473
type: Question
has body: I sporadically encounter the following exception when loading a specific page: java.lang.NoClassDefFoundError: Could not initialize class com.app.item.search.SearchResultPanel at com.app.item.search.SearchResultPage.initialize(SearchResultPage.java:86) at com.app.core.layout.BasePage.onInitialize(BasePage.java:147) at org.apache.wicket.Component.fireInitialize(Component.java:864) at org.apache.wicket.MarkupContainer.internalInitialize(MarkupContainer.java:955) at org.apache.wicket.Page.isPageStateless(Page.java:464) at org.apache.wicket.core.request.mapper.AbstractBookmarkableMapper.getPageInfo(AbstractBookmarkableMapper.java:447 ) at org.apache.wicket.core.request.mapper.AbstractBookmarkableMapper.mapHandler(AbstractBookmarkableMapper.java:391) at org.apache.wicket.request.mapper.mount.UnmountedMapperAdapter.mapHandler(UnmountedMapperAdapter.java:61) at org.apache.wicket.request.mapper.mount.MountMapper.mapHandler(MountMapper.java:145) at org.apache.wicket.request.mapper.CompoundRequestMapper.mapHandler(CompoundRequestMapper.java:215) at org.apache.wicket.request.cycle.RequestCycle.mapUrlFor(RequestCycle.java:429) at org.apache.wicket.request.handler.render.WebPageRenderer.respond(WebPageRenderer.java:271) at org.apache.wicket.core.request.handler.RenderPageRequestHandler.respond(RenderPageRequestHandler.java:175) at org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:862) at org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64) at org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:261) at org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:218) at org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:289) --- CUT --- at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:619)…
tagged with: java
has comment: http://stackoverflow.com/comment/35819332
has comment: http://stackoverflow.com/comment/57430836
downvote count: 0
has title: Tomcat+Wicket sporadic NoClassDefFoundError
tagged with: tomcat

http://stackoverflow.com/comment/35775996
has text: yes nothing ather than this.. actually i am just building this to a db login project.. i am getting the compilation error.. I am editing the questions with the name of the jars.
comment on: http://stackoverflow.com/q/23358367
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/comment/35927529
type: AnswerComment
comment on: http://stackoverflow.com/a/23440074
type: Comment
has text: Primitives like `int` don't have fields you can set. All you can do with them is math and assignment. What's he's saying is that if you want to set a specific field what you need is an array of some kind of object that has the field(s) you want to set - not an array of primitives. Does that make sense?
score: 2

http://stackoverflow.com/comment/35866228
comment on: http://stackoverflow.com/q/23407535
has text: You can use `scollview`.
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/comment/35695180
type: QuestionComment
has text: @dasblinkenlight Don't matter is it a .csv or .scsv or .txt. The question is how to create a pattern for `xx-xx-xxxx`
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23314692

http://stackoverflow.com/a/23341948
answers question: http://stackoverflow.com/q/23340242
type: Answer
has comment: http://stackoverflow.com/comment/57792067
has body: Most likely, some of your data is on a network drive or in your profile which is being synchronized with a network drive. If you are on windows, try moving your .IdeaXXX/system directory and your work directory to somewhere else on your C: drive.
has comment: http://stackoverflow.com/comment/57792122
has comment: http://stackoverflow.com/comment/129751255
downvote count: 1
score: 3
upvote count: 4
has comment: http://stackoverflow.com/comment/57792598
has comment: http://stackoverflow.com/comment/57782062
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23340242

http://stackoverflow.com/comment/35858154
type: QuestionComment
has text: I am not sure if this problem is suited for the map reduce paradigm, If you have 100's of such files and you want to parallelize it from a file perspective then this can be done. But from the perspective of a single file the problem is not splittable, it cannot be solved using a divide and conquer approach. To process each element in the file you need to access the entire file, so any algorithm that you use will need you to hold the entire file in memory if this is acceptable then we could have multiple solutions including the one stated below.
comment on: http://stackoverflow.com/q/23377606
score: 0
type: Comment

http://stackoverflow.com/comment/35719679
has text: Thank you! I get it!! The compiling process is normal but JVM is saying no. Then I checked the running configuration and found IDE is trying to run my program as an applet. I changed it to Java application and it works! thank you very much!!
comment on: http://stackoverflow.com/a/23327802
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/35734676
has text: why to override compare() and hashvalue()?
type: Comment
score: 0
comment on: http://stackoverflow.com/a/23336325
type: AnswerComment

http://stackoverflow.com/comment/35902805
score: 1
comment on: http://stackoverflow.com/q/23427171
has text: What have you tried? There is no native widget in SWT which would realize exactly that type of behaviour.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35942352
comment on: http://stackoverflow.com/a/23448134
has text: If you follow my updated answer, the code should work on Jetty also. I verified it many times
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/35879783
type: Comment
has text: I have tried both suggestions but in vain..the result is still same
type: AnswerComment
comment on: http://stackoverflow.com/a/23414330
score: 0

http://stackoverflow.com/comment/35720858
type: Comment
type: QuestionComment
has text: How is the image rendered? Either it's done using a JLabel or cpustom painting
score: 0
comment on: http://stackoverflow.com/q/23327104

http://stackoverflow.com/a/30623012
has body: Issue is with ojdbc jar.....Please put the ojdbc5.jar in classpath and try.
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23361313
type: Answer
accepted answer of: http://stackoverflow.com/q/23361313
score: 0

http://stackoverflow.com/q/23373351
has answer: http://stackoverflow.com/a/23373475
has comment: http://stackoverflow.com/comment/35803312
has title: Why does my code print out 0 as the distance in dijkstras?
type: UnansweredQuestion
tagged with: dijkstra
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/35803117
answer count: 1
score: 0
has body: import java.util.*; public class Dijkstra { public static class Vertex implements Comparable&lt;Vertex&gt; { public String name; public List&lt;Edge&gt; adj; public int minDistance; public Vertex previous; public Vertex(String argName) { name = argName; adj = new ArrayList&lt;Edge&gt;(); } public void addEdge(Edge e) { adj.add(e); } public String toString() { return (name+""); } public int compareTo(Vertex other) { return Double.compare(minDistance, other.minDistance); } } public static class Edge { public Vertex target; public Vertex from; public int weight; public Edge(Vertex tar, int argWeight) { target = tar; weight = argWeight; } } public static Scanner in = new Scanner(System.in); public int numOfLines; public static void path(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(); for (Edge e : u.adj) { Vertex v = e.target; int weight = e.weight; int distanceThroughU = u.minDistance + weight; if (distanceThroughU &lt; v.minDistance) { vertexQueue.remove(v); v.minDistance = distanceThroughU ; v.previous = u; vertexQueue.add(v); } } } } public static Vertex from,target; public static void main(String[] args) { int numOfLines = Integer.parseInt(in.nextLine()); Map&lt;String, Vertex&gt; vertexMap = new HashMap&lt;String, Vertex&gt;(); boolean inVertex=true; String line; for(int count=0; count&lt;numOfLines; count++){ line=in.nextLine(); String[] parts = line.split(" "); if(!vertexMap.containsKey(parts[0])) { Vertex v = new Vertex(parts[0]); vertexMap.put(parts[0], v); } else if(!vertexMap.containsKey(parts[1])) { Vertex v = new Vertex(parts[1]); vertexMap.put(parts[1], v); } int weight = Integer.parseInt(parts[2]); Vertex v = vertexMap.get(parts[0]); if (v != null) { v.addEdge(new Edge(vertexMap.get(parts[1]),weight)); } } Collection&lt;Vertex&gt; vertices = vertexMap.values(); for(Vertex v: vertices) { System.out.…
tagged with: integer

http://stackoverflow.com/a/23409816
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/23409143
score: 1
has body: Try the SpringData Mongo driver. It has methods in the Criteria object to create the kind of query you want: http://docs.spring.io/spring-data/data-mongo/docs/1.4.2.RELEASE/api/index.html?org/springframework/data/mongodb/core/query/Criteria.html The official Java driver for MongoDB is really not very good. The equivalent JavaScript commands are distributed unevenly across the Java API, and sometimes you're required to do what @Sambhav-Sharma says: just pass MongoDB operators as strings.
upvote count: 1
accepted answer of: http://stackoverflow.com/q/23409143
has comment: http://stackoverflow.com/comment/35908093
has comment: http://stackoverflow.com/comment/35892170

http://stackoverflow.com/comment/35708461
type: Comment
comment on: http://stackoverflow.com/q/23310616
score: 0
type: QuestionComment
has text: Add more details to your question. You want to know how to show score table or how to store data for score table? You can also read this topic, there are lost of ready code samples of using Scene2D for table score there: http://www.java-gaming.org/index.php?topic=31331.0

http://stackoverflow.com/q/23353766
has title: Error while implementing Google Play Games
type: Question
downvote count: 0
tagged with: google-play-games
has comment: http://stackoverflow.com/comment/35804727
answer count: 1
has body: I am getting an error on an import statement that I am using in order to try and implement Play Games with my app. -The import com.google.android.gms.games.GamesClient cannot be resolved I have BaseGameUtils referecncing google-play-services_lib, and my project references BaseGameUtils as a library. It's my understanding that GameClient was to have been deprecated as of February 7, 2014 but when looking at Google's sample code (e.g. ButtonClicker) it still uses this import and some of the method calls from the import. I got the code I am using from Google's GitHub sample app repository for the ButtonClicker2000, some of that code has been recycled and used in the program I'm having errors with as well. This is all the info I can think to provide, if anything more would help please let me know.
favorite count: 0
upvote count: 2
has answer: http://stackoverflow.com/a/23450830
accepted answer: http://stackoverflow.com/a/23450830
type: AnsweredQuestion
score: 2
tagged with: java
has comment: http://stackoverflow.com/comment/35950736

http://stackoverflow.com/a/23451783
answers question: http://stackoverflow.com/q/23410168
type: Answer
score: 6
has body: It depends on what you mean by 'supporting' it. The mongo docs actually recommend using manual references rather than using DBRefs. All a DBRef does is store the collection name and a document id. It optionally stores the db name if multiple db's are in use and you are referring to something in another one. The nice thing about DBRefs is that the referred document is automatically fetched with you load the document containing the DBRef. The pain with DBRefs is that the referred doc is ALWAYS loaded because it is a greedy load. If you know where documents are going to be stored, it is often easier and more efficient to simply store the referred document's id in a field and load the referenced document yourself rather than using a DBRef. How you use manual references all depends on how you want them to work, and your question doesn't quite specify that much detail. { "_id" : [some id], "refId" : [some other id] } Update: Just noticed that Spring Data has finally implemented lazy loading of DBRefs, so you can use the annotation @DBRef(lazy = true) and the ref is loaded on demand. The main reason not to use DBRefs has been removed, so you need to decide if the additional work of doing manual references is worth it Update #2 Having worked with DBRefs for a while, I actually wish I had not used them. They don't play well with aggregations and trying to do queries and updates with them via shells and such is typically a pain. I will say that the MongoDB recommendation of doing manual references rather than using DBRef's if your use case is simple enough is my recommendation as well.
downvote count: 0
has comment: http://stackoverflow.com/comment/36014333
has comment: http://stackoverflow.com/comment/36045385
upvote count: 6

http://stackoverflow.com/comment/35861427
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/23309297
type: Comment
has text: What I mean is, when you code an application you create frames, panels explicitly , with an applet , a frame is made behind the scenes and the graphic gets placed in it. I do not know how to use layout managers with an applet . Could somebody please give me a template or rough idea of how to have say two panels, one for the graphic, one for buttons. Thanks alot .

http://stackoverflow.com/q/23437640
score: 0
tagged with: matrix
tagged with: lwjgl
accepted answer: http://stackoverflow.com/a/23438262
has comment: http://stackoverflow.com/comment/35925152
has title: Modern method of transforming modelview matrix in OpenGL?
type: AnsweredQuestion
tagged with: performance
has comment: http://stackoverflow.com/comment/35924248
tagged with: opengl
has body: I've recently began learning OpenGL, starting with immediate mode, glPush/PopMatrix, and the glTranslate/Rotate/Scale functions. I've switched over to vertex buffer objects for storing geometry, but I'm still using the push/pop matrix and transform functions. Is there a newer, more efficient method of performing these operations? I've heard of glMultMatrix, but some sources have said this is less efficient. If at all relevant, I am using LWJGL with Java for rendering. edit: Does anyone know about the performance impact of calling glViewport and gluPerspective, as well as other standard initialization functions? I have been told that it is often good practice to call these init functions along with the rendering code every update.
tagged with: java
type: Question
answer count: 1
has answer: http://stackoverflow.com/a/23438262

http://stackoverflow.com/comment/35828301
type: Comment
type: QuestionComment
has text: can you post your pom configuration
comment on: http://stackoverflow.com/q/23386234
score: 0

http://stackoverflow.com/comment/35709330
comment on: http://stackoverflow.com/q/23322619
score: 0
type: Comment
type: QuestionComment
has text: @vjdhama Oh. It is 273 508bytes. Ok The one problem is fixed, but why it takes the whole `LinearLayout` instead of the `EditText`?

http://stackoverflow.com/a/24208550
type: Answer
has body: The simple login jar depends on the Android runtime, but if you just want to authenticate a server, you can do one of two things: Use your Firebase secret as the auth credential Generate a specific admin token for your server See the documentation here: https://www.firebase.com/docs/security/custom-login.html Helper libraries are available in several languages for generating your own token.
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23405318
score: 0
answers question: http://stackoverflow.com/q/23405318

http://stackoverflow.com/a/23423538
type: Answer
has comment: http://stackoverflow.com/comment/35896918
has comment: http://stackoverflow.com/comment/39609196
has body: I think you are after Collectors.mapping which can be passed as a second argument to groupingBy Complete example import java.util.AbstractMap; import java.util.List; import java.util.Map; import static java.util.Arrays.asList; import static java.util.Map.Entry; import static java.util.stream.Collectors.*; public class SO { public static void main(String... args) { List&lt;Album&gt; albums = asList( new Album( asList( new Artist("bob"), new Artist("tom") ) ), new Album(asList(new Artist("bill"))) ); Map&lt;Artist, List&lt;Album&gt;&gt; x = albums.stream() .flatMap(album -&gt; album.getArtist().stream().map(artist -&gt; pair(artist, album))) .collect(groupingBy(Entry::getKey, mapping(Entry::getValue, toList()))); x.entrySet().stream().forEach(System.out::println); } static class Artist { private final String name; Artist(String name) { this.name = name; } public String toString() {return name;} } static class Album { private List&lt;Artist&gt; artist; Album(List&lt;Artist&gt; artist) { this.artist = artist; } List&lt;Artist&gt; getArtist() { return artist; } } private static &lt;T,U&gt; AbstractMap.SimpleEntry&lt;T,U&gt; pair(T t, U u) { return new AbstractMap.SimpleEntry&lt;T,U&gt;(t,u); } }
score: 17
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23423078
upvote count: 17
accepted answer of: http://stackoverflow.com/q/23423078
downvote count: 0

http://stackoverflow.com/comment/35884020
type: QuestionComment
has text: See http://stackoverflow.com/questions/9802626/programmatically-fill-the-jvm-permanent-generation-permgen-memory-region. A solution mentioned is to retain a lot of references to different interned strings, as these are added to the string pool (which is located in perm gen in java 6, seems this isn't the case for later versions see http://java-performance.info/string-intern-in-java-6-7-8/ which suggests the string pool was moved).
comment on: http://stackoverflow.com/q/23415288
score: 0
type: Comment

http://stackoverflow.com/q/23342969
upvote count: 1
tagged with: logging
type: Question
tagged with: java
answer count: 1
downvote count: 0
tagged with: log4j
has title: log4j - rootLogger without appender gives warning
favorite count: 0
has answer: http://stackoverflow.com/a/23344674
type: UnansweredQuestion
has body: I have defined appenders for all the log files which I need. So, I thought there is no need for an appender for the rootLogger as there is nothing to log in rootLogger. So, I changed the line in log4j.properties from: log4j.rootLogger=debug,default to log4j.rootLogger=debug But I am getting the following warning on application startup. log4j:WARN No appenders could be found for logger (org.apache.commons.configuration.PropertiesConfiguration). log4j:WARN Please initialize the log4j system properly. log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info. So, is there any way to achieve the intention i.e. not to redirect rootLogger logs to any appenders without getting any error or warning?
score: 1

http://stackoverflow.com/q/23409138
score: 10
favorite count: 0
has comment: http://stackoverflow.com/comment/35944644
has comment: http://stackoverflow.com/comment/35876779
has answer: http://stackoverflow.com/a/73800649
tagged with: oauth-2.0
tagged with: webview
tagged with: swing
type: AnsweredQuestion
has title: Clear the session/cache/cookie in the JavaFX WebView
possible better answer: http://stackoverflow.com/a/24997602
tagged with: java
tagged with: javafx
has answer: http://stackoverflow.com/a/24997602
linked to: http://stackoverflow.com/q/14385233
upvote count: 10
has comment: http://stackoverflow.com/comment/35942702
has body: I had a Swing dialog, which uses JavaFX WebView to display oAuth 2.0 URL from Google server. public class SimpleSwingBrowser extends JDialog { private final JFXPanel jfxPanel = new JFXPanel(); private WebEngine engine; private final JPanel panel = new JPanel(new BorderLayout()); public SimpleSwingBrowser() { super(MainFrame.getInstance(), JDialog.ModalityType.APPLICATION_MODAL); initComponents(); } private void initComponents() { createScene(); panel.add(jfxPanel, BorderLayout.CENTER); getContentPane().add(panel); java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize(); setBounds((screenSize.width-460)/2, (screenSize.height-680)/2, 460, 680); } private void createScene() { Platform.runLater(new Runnable() { @Override public void run() { final WebView view = new WebView(); engine = view.getEngine(); engine.titleProperty().addListener(new ChangeListener&lt;String&gt;() { @Override public void changed(ObservableValue&lt;? extends String&gt; observable, String oldValue, final String newValue) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { SimpleSwingBrowser.this.setTitle(newValue); } }); } }); engine.getLoadWorker() .exceptionProperty() .addListener(new ChangeListener&lt;Throwable&gt;() { public void changed(ObservableValue&lt;? extends Throwable&gt; o, Throwable old, final Throwable value) { if (engine.getLoadWorker().getState() == FAILED) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { JOptionPane.showMessageDialog( panel, (value != null) ? engine.getLocation() + "\n" + value.getMessage() : engine.getLocation() + "\nUnexpected error.", "Loading error...", JOptionPane.ERROR_MESSAGE); } }); } } }); // http://stackoverflow.com/questions/11206942/how-to-hide-scrollbars-in-the-javafx-webview // hide webview scrollbars whenever they appear. view.getChildrenUnmodifiable().addListener(new ListChangeListener&lt;Node&gt;() { @Override public void onChanged(Change&lt;? extends Node&gt; change) …
type: Question
linked to: http://stackoverflow.com/q/11206942
downvote count: 0
has answer: http://stackoverflow.com/a/23470976
answer count: 3
accepted answer: http://stackoverflow.com/a/23470976

http://stackoverflow.com/comment/35664668
score: 1
comment on: http://stackoverflow.com/q/23297845
type: QuestionComment
has text: `if(e.getSource() == "Rock"){` You're trying to compare an string to an object
type: Comment

http://stackoverflow.com/q/23339226
tagged with: mysql
type: Question
has body: I have some problem with hibernate updating object: public class SearchType implements Serializable{ private static final long serialVersionUID = -7909889858492050282L; private Integer id; private String name; private Set&lt;SearchTypeParameters&gt; parameters = new HashSet&lt;SearchTypeParameters&gt;(); public SearchType() {} public SearchType(SearchTypeDTO typeDto) { id = typeDto.getId(); name = typeDto.getName(); Set&lt;SearchTypeParametersDTO&gt; parametersDTOs = typeDto.getParameters(); Set&lt;SearchTypeParameters&gt; parameters = new HashSet&lt;SearchTypeParameters&gt;(parametersDTOs.size()); for (SearchTypeParametersDTO parameterDTO : parametersDTOs) { parameters.add(new SearchTypeParameters(parameterDTO)); } this.parameters = parameters; } //getters and setters } public class SearchTypeParameters implements Serializable{ private static final long serialVersionUID = -7312128186599122114L; private int parameterId; private String searchCriteria; private String value; private SearchType type; public SearchTypeParameters() {} public SearchTypeParameters(SearchTypeParametersDTO searchParametersDto) { parameterId = searchParametersDto.getParameterId(); searchCriteria = searchParametersDto.getSearchCriteria(); value = searchParametersDto.getValue(); } //getters and setters } DTO classes are used to prevent GWT ecxeption with serialization of PersistentSet. I have no problems when trying to add a new or delete an old object. But when I tried to update an object: public void updateSearchType(SearchTypeDTO typeDto) throws GwtException { try { CommonConfig.getBean(SearchTypeDao.class).deleteSearchTypeParameters(typeDto.getId()); SearchType type = new SearchType(typeDto); for (SearchTypeParameters parameter : type.getParameters()) { parameter.setSearchType(type); } CommonConfig.getBean(SearchTypeDao.class).updateSearchType(type); } catch (Exception e) { log.error(e, e); throw new GwtException(e.getMessage()); } } Old records of SearchTypeParameters are deleted normally, …
score: 0
has title: Updating old Set with a new one in hibernate
answer count: 1
accepted answer: http://stackoverflow.com/a/23359747
has answer: http://stackoverflow.com/a/23359747
type: AnsweredQuestion
tagged with: java
tagged with: hibernate

http://stackoverflow.com/q/23354549
has comment: http://stackoverflow.com/comment/35768549
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/35768545
type: Question
has comment: http://stackoverflow.com/comment/35768725
has comment: http://stackoverflow.com/comment/35768690
has body: I asked this question earlier but was requested to add additional info and never got a response after that. Sorry ahead of time. I am not trying to spam the site or anything. I'm just looking for some assistance. I am receiving the error Exception in thread "main" java.lang.NumberFormatException: For input string: "3 50" in the code below. And I am having a hard time solving it. Could anyone possibly shed some light on what it could be from? From my understanding it usually means the error is in line 3 and line 50 correct? package report.generator; import java.io.BufferedReader; import java.io.FileReader; import java.io.File; import java.io.FileWriter; import java.io.BufferedWriter; import java.io.IOException; public class ReportGenerator { public static void main(String[] args) { BufferedReader br = null; BufferedWriter bw = null; try { br = new BufferedReader(new FileReader("C:\\sprocketorders.txt")); String line; String element[] = new String[2]; int sum[] = new int[5]; File file = new File ("C:\\sprocketordersreport.txt"); while ((line = br.readLine()) != null) { element = line.split(" "); switch(Integer.parseInt(element[0])) { case 1: sum[0] = sum[0] + Integer.parseInt(element[1]); break; case 2: sum[1] = sum[1] + Integer.parseInt(element[1]); break; case 3: sum[2] = sum[2] + Integer.parseInt(element[1]); break; case 4: sum[3] = sum[3] + Integer.parseInt(element[1]); break; case 5: sum[4] = sum[4] + Integer.parseInt(element[1]); break; } } if (!file.exists()) { file.createNewFile(); } FileWriter fw = new FileWriter(file.getAbsoluteFile()); bw = new BufferedWriter(fw); bw.write("Spacely Sprockets\nTaking Sprockets into the Future\nSales Summary Report\nSprocket Number Total Quantity Sold\n"); for(int i = 0; i &lt; sum.length; i++) bw.write((i + 1) + "\t" + sum[i] + "\n"); } catch (IOException e) { e.printStackTrace(); } finally { try { if (br != null) br.close(); if (bw != null) bw.close(); } catch (IOException e) { e.printStackTrace(); } } } } This program is t…
has comment: http://stackoverflow.com/comment/35768758
tagged with: java
has comment: http://stackoverflow.com/comment/35768716
has comment: http://stackoverflow.com/comment/35768495
has comment: http://stackoverflow.com/comment/35768660
has comment: http://stackoverflow.com/comment/35768705
has comment: http://stackoverflow.com/comment/35768632
has title: Receiving NumberFormatException error when trying to run my program
has comment: http://stackoverflow.com/comment/35768700
favorite count: 0
has comment: http://stackoverflow.com/comment/35768670
has comment: http://stackoverflow.com/comment/35768785
linked to: http://stackoverflow.com/q/1602157
score: 0
has answer: http://stackoverflow.com/a/23355070
has comment: http://stackoverflow.com/comment/35768654
has answer: http://stackoverflow.com/a/23354782
answer count: 4
has comment: http://stackoverflow.com/comment/35768753
has answer: http://stackoverflow.com/a/23354635
has answer: http://stackoverflow.com/a/23354607
has comment: http://stackoverflow.com/comment/35768502
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35768767

http://stackoverflow.com/a/23430699
answers question: http://stackoverflow.com/q/23415517
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23415517
type: Answer
has comment: http://stackoverflow.com/comment/35911723
has body: I believe the answer to this question is it depends on which JAXP provider you are using. If you have configured an XPath engine that supports XPath 2.0; then yes, messages will be in document-order. If you use the default or an XPath 1.0 engine; then no, order cannot be guaranteed1. Does XPath support ordering? XPath 1.0 does not1, XPath 2.0 does. According to the XPath 1.0 specification, XPath 1.0 expressions return node-set types and node-set types are unordered: The primary syntactic construct in XPath is the expression. An expression matches the production Expr. An expression is evaluated to yield an object, which has one of the following four basic types: node-set (an unordered collection of nodes without duplicates) boolean (true or false) number (a floating-point number) string (a sequence of UCS characters) On the other hand, the XPath 2.0 specification introduces the idea of document order: Document order is a total ordering, although the relative order of some nodes is implementation-dependent. [Definition: Informally, document order is the order in which nodes appear in the XML serialization of a document.] [Definition: Document order is stable, which means that the relative order of two nodes will not change during the processing of a given expression, even if this order is implementation-dependent.] The specification also states that evaluation of Path Expressions returns a sequence of nodes in document order: The sequences resulting from all the evaluations of E2 are combined as follows: If every evaluation of E2 returns a (possibly empty) sequence of nodes, these sequences are combined, and duplicate nodes are eliminated based on node identity. The resulting node sequence is returned in document order. If every evaluation of E2 returns a (possibly empty) sequence of atomic values, these sequences are concatenated, in order, and returned. If the multiple evaluations of E2 return at least one node and at least one atomic value, a type error is raised […
score: 2
has comment: http://stackoverflow.com/comment/35910626
upvote count: 2

http://stackoverflow.com/comment/35907016
has text: From the same url, is a photo transmitted second by second from PiCamera installed on Raspberry Pi.
comment on: http://stackoverflow.com/q/23429388
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35774076
comment on: http://stackoverflow.com/q/23357584
score: 0
type: Comment
type: QuestionComment
has text: @geoand yes I am, the playerChatEvent can only be called after pm.registerEvents(), (That function tells bukkit (a server software) about the existence of the event listener.

http://stackoverflow.com/q/23377089
accepted answer: http://stackoverflow.com/a/23377338
score: 0
answer count: 1
tagged with: netty
has answer: http://stackoverflow.com/a/23377338
type: AnsweredQuestion
has title: Encoding and Decoding multiple different types with Netty 5
tagged with: java
has body: I am trying to implement a network protocol with multiple different packet types. The problem I am facing is the most "proper" way of implementing this with Netty. I'll post some classes first, and then describe what I want to accomplish. public class ItemStack { public ItemStack(final int item, final int amount) { if (item &lt; 0) { throw new IllegalArgumentException("item must be non-negative integer: " + item); } if (amount &lt; 1) { throw new IllegalArgumentException("amount must be positive integer: " + amount); } this.item = item; this.amount = amount; } public int getItem() { return item; } public int getAmount() { return amount; } private final int item; private final int amount; } public class ChatMessage { public ChatMessage(final String playerName, final String message) { if (playerName == null) { throw new IllegalArgumentException("playerName must not be null"); } if (message == null) { throw new IllegalArgumentException("message must not be null"); } this.playerName = playerName; this.message = message; } public String getPlayerName() { return playerName; } public String getMessage() { return message; } private final int playerName; private final int message; } Now, all POJO that are transmitted across the network will have a packet identifier. This will be a 1-byte code that will let the decoder know what type of packet it is, and how to decode it. What would be the most appropriate way of handling this case? Would it be better (read more conventional) to have one PacketDecoder class that extends the ByteToMessageDecoder which reads one byte, determines the type, and then in that same class, decode the packet with the appropriate method like so: public class PacketDecoder extends ByteToMessageDecoder { protected void decode( final ChannelHandlerContext context, final ByteBuf buf, List&lt;Object&gt; objects) throws Exception { if (buf.readableBytes &lt; 1) { return; } final int opcode = buf.readByte() &amp; 0xff; final Packet packet = decodePacket(opcod…
type: Question
tagged with: network-programming

http://stackoverflow.com/comment/35709726
score: 0
type: AnswerComment
has text: [Here](http://www.json.org/javadoc/org/json/JSONObject.html) is full documentation of JSONObject. There is a method called `getJSONArray` for such case.
type: Comment
comment on: http://stackoverflow.com/a/23322836

getparameter
tag name: getparameter
type: Tag
tags question: http://stackoverflow.com/q/23449720

http://stackoverflow.com/comment/35757308
score: 0
has text: @LexWebb About the linked image: When the cloth is attached at two corners, and the edges may **not** stretch at all, then ... it will remain the perfect rectangle as in the left image! Apart from that, such simulations usually do not work with the deformation of quadrilaterals. Usually, they operate on the edges, which (in the simplest case) are modeled as forces of a mass-spring model ( http://en.wikipedia.org/wiki/Soft_body_dynamics#Cloth_simulation ). Rarely, these methods operate on triangles, for anisotropic stretching behavior. In any case, the simulation is in no way related to images
type: Comment
comment on: http://stackoverflow.com/q/23345068
type: QuestionComment

http://stackoverflow.com/q/23406307
tagged with: language-agnostic
has answer: http://stackoverflow.com/a/35099650
has answer: http://stackoverflow.com/a/31843598
accepted answer: http://stackoverflow.com/a/35099650
downvote count: 0
has title: Whats the difference between objects and data structures?
answer count: 8
type: AnsweredQuestion
tagged with: object
has answer: http://stackoverflow.com/a/23406458
tagged with: oop
score: 62
has comment: http://stackoverflow.com/comment/35869526
tagged with: java
has answer: http://stackoverflow.com/a/23406393
type: Question
possible better answer: http://stackoverflow.com/a/31843598
has answer: http://stackoverflow.com/a/23407669
has answer: http://stackoverflow.com/a/23406507
has answer: http://stackoverflow.com/a/23407377
has answer: http://stackoverflow.com/a/35099828
has body: I've been reading the book Clean Code: A Handbook of Agile Software Craftsmanship and in chapter six pages 95-98 it clarifies about the differences between objects and data structures: Objects hide their data behind abstractions and expose functions that operate on that data. Data structures expose their data and have no meaningful functions. Object expose behavior and hide data. This makes it easy to add new kinds of objects without changing existing behaviors. It also makes it hard to add new behaviors to existing objects. Data structures expose data and have no significant behavior. This makes it easy to add new behaviors to existing data structures but makes it hard to add new data structures to existing functions. I'm a tad bit confused whether some classes are objects or data structures. Say for example HashMaps in java.util, are they objects? (because of its methods like put(), get(), we dont know their inner workings) or are they data structures? (I've always thought of it as data structures because its a Map). Strings as well, are they data structures or objects? So far majority of the code I've been writing have been the so called "hybrid classes" which try to act as an object and a data structure as well. Any tips on how to avoid them as well?
tagged with: data-structures
has comment: http://stackoverflow.com/comment/62666274
favorite count: 0
upvote count: 62

http://stackoverflow.com/comment/35734757
score: 0
has text: Mock is a good idea too, but I would prefer to make like a integration test. In some place of business logic I use stored procedure, it makes complications to test.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23299143

http://stackoverflow.com/q/23372989
tagged with: file
answer count: 1
has comment: http://stackoverflow.com/comment/35803127
has comment: http://stackoverflow.com/comment/35802917
tagged with: java
tagged with: bukkit
has body: this is my first question and I hope you can help me. I'm coding a register/login plugin for Bukkit in Java. Now when the player joins my server I'd like that he log-ins. My plugin must check if the password which the player provided is right. This is the code which I have done so far. The problem is, that I have no idea, how to do this. Can someone explain how to do this (maybe only in words)? String currln; br = new BufferedReader(new FileReader("/plugins/LobbyLogin/passwd.crypt")); while ((currln = br.readLine()) != null) { password = currln; } String password = null; String[] select = password.split(":"); String username = select[0]; String readed_pwd = select[1]; String alldata = username+readed_pwd; P.S.: The password of the user is saved in a file called "passwd.crypt" which I have created. Here's a example string from it. ExampleUser:cGFzc3dvcmQ= The password is stored encrypted.
type: AnsweredQuestion
has title: Java/Bukkit (Minecraft) - If file contains playername then check password which is stored in same line after a ":" and do something
tagged with: minecraft
has comment: http://stackoverflow.com/comment/35835288
has answer: http://stackoverflow.com/a/23379954
type: Question
has comment: http://stackoverflow.com/comment/35805507
tagged with: plugins
accepted answer: http://stackoverflow.com/a/23379954
score: 0

http://stackoverflow.com/comment/35819570
type: AnswerComment
score: 0
type: Comment
has text: You can try newQuery = newQuery.subString( 0, newQuery.length() - 3); instead of newQuery = newQuery.subString( newQuery.length() - 3);
comment on: http://stackoverflow.com/a/23363837

http://stackoverflow.com/q/23442604
type: Question
has answer: http://stackoverflow.com/a/23444550
answer count: 1
score: 0
linked to: http://stackoverflow.com/q/16632276
has title: platform independent way to get current java executable path and filename
tagged with: processbuilder
type: UnansweredQuestion
tagged with: java
has body: I need to execute a java application using ProcessBuilder. I also need to use the same java executable in the called process that is being used by the calling application. Is there a platform independent way to retrieve the current java executable path and file name? I've seen some code snippets similar to this: public static boolean isWindows() { return (System.getProperty("os.name").toLowerCase().indexOf("win") &gt;= 0); } public static String getJavaExecutablePath() { String executable = "java"; if (isWindows()) { executable = executable + ".exe"; } File path = new File(System.getProperty("java.home"), "/bin/" + executable); return path.getAbsolutePath(); } The above code will probably need to be improved to use File.separator. Is the above all that is required, or is there something else to consider, for example case sensitivity? Ideally, there would be a library available for getting the OS path, but that is probably a question for a different forum.

http://stackoverflow.com/comment/35667260
type: Comment
comment on: http://stackoverflow.com/a/23299058
has text: Just to note: If `SimpleDateFormat` is set to strict mode (using `sdf.setLenient(false);`) then the old JDK-code will also throw an exception. You have to admit that switching between lenient and strict is much easier in old JDK than in JSR-310. Saying this does not mean that I consider JSR-310 worse, rather better because of immutability of formatter class.
type: AnswerComment
score: 0

http://stackoverflow.com/q/23296173
has title: Getting skipped whitespases in ANTLR parser
tagged with: antlr
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/23304930
has body: I have some grammar, that ignores whitespaces in following way WS : [ \r\t\n]+ -&gt; channel(HIDDEN) ; It's ok, 'cos whitespace isn't part of my grammar. But in parser I need to know where whitespaces was. For now I unable to find any straight way to do this. I use last version of ANTLR4 Thanks in advance.
tagged with: parsing
tagged with: antlr4
type: UnansweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/23296865
type: Question

http://stackoverflow.com/comment/35812657
comment on: http://stackoverflow.com/a/23352795
type: Comment
has text: Your code works for me with all the corrections I have noted. Have you really applied them all?
type: AnswerComment
score: 0

http://stackoverflow.com/comment/35869958
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23405893
has text: It's not an attempt to "replace skill with tool", but as I said, I have method `a()` and test for it. `a()` calls `b()` in release 1.0, but in release 1.1 `a()` calls also `c()` and I do not want to forget to write the test for `c()` also...
score: 0

http://stackoverflow.com/q/23326541
accepted answer: http://stackoverflow.com/a/23326588
type: Question
tagged with: google-app-engine
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/23326588
tagged with: java
has body: In this documentation, it shows an example code for Future&lt;V&gt;, in some GAE datastore ORM's I can see usages for this pattern, what is the implication of using Future on doing datastore put, get or delete methods? What is the common motivation on doing this?
has title: Using Future<V>
type: AnsweredQuestion
tagged with: google-cloud-datastore

http://stackoverflow.com/comment/72811579
type: AnswerComment
comment on: http://stackoverflow.com/a/23335613
score: 0
type: Comment
has text: Yes, see examination video, optaplanner.org -> learn -> video's.

http://stackoverflow.com/comment/35730311
type: Comment
has text: `The panel creation is all done reasonably properly by SwingWorkers` - then I can't see any logical, real reason why caused by a.m. issue, problem is in code that you not showing here, be default no one from mentioned methods (in your queston) are used in custom code for JScrollPane
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/23326829

http://stackoverflow.com/a/23357114
upvote count: 3
downvote count: 1
has comment: http://stackoverflow.com/comment/35858677
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/35859782
has comment: http://stackoverflow.com/comment/35891387
has body: You can't create an array of generic type. The following code is invalid: List&lt;String&gt;[] listArray = new List&lt;String&gt;[10]; // Error It would be better to use an Object[] internally to store the elements, and let the method returning the elements do appropriate cast: public class HashTable&lt;T&gt; { private Object[] table; private static final int SIZE = 50; public HashTable(){ this.table = new Object[SIZE]; for(int i = 0; i &lt; SIZE; i++) this.table[i] = new GenericLinkedList(); } } FYI, this is how the java.util.ArrayList is implemented. P.S.: Why your Hashtable doesn't seem to have key-value mapping kind of thing? This is more like a list.
accepted answer of: http://stackoverflow.com/q/23356807
answers question: http://stackoverflow.com/q/23356807
score: 2
has comment: http://stackoverflow.com/comment/35895531

http://stackoverflow.com/comment/36632736
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23803256
has text: I'll give it a try on my GitHub repo and get back to you. The last resort is DbObject converter
score: 0

http://stackoverflow.com/q/23405215
type: Question
tagged with: java-3d
tagged with: macos
has comment: http://stackoverflow.com/comment/35864332
tagged with: netbeans
score: 0
has body: I have a Java project in Netbeans, which uses Java3d. When I distribute the jar file, it doesn't work. I tried various ways to add the files vecmath.jar, j3dutils.jar, j3dcore.jar, but they seem to be ignored. I tried to run the resulting jar on another PC with Windows XP, and I asked a friend to try it on Mac, and it didn't launch. What I tried so far and didn't work (based on answers on the Internet, some maybe don't make sense, but I tried everything I could find): check enable native packaging actions in project menu distribute the dist folder, including a folder named lib generated by Netbeans, with the three Java3d jars right click the project, Properties->Libraries, and add there the Java3d jars right click the Libraries folder under the project, and add jar/folder include a folder with the jars in the src folder create a library with "Add Library..." from "Project Properties", in the "Global Libraries" folder, and added it to the project. Nothing worked. If I make a Windows installer with "Package as", the installation works on Windows XP (although if I doubleclick the jar, is not launched). How can I make an installer for Mac? To resume, the questions are: How can I distribute the Java3d jar files so that it works on other computers? In particular, I am interested for Mac Update Here is the error I get when running the jar file on Windows XP: java.lang.UnsatisfiedLinkError: no j3dcore-ogl-chk in java.library.path I added the dll files, and it works. I have to see how I make it work on Mac.
has title: Include Java3d in Netbeans dist
tagged with: java
has comment: http://stackoverflow.com/comment/40111540
answer count: 0
tagged with: jar
type: UnansweredQuestion

http://stackoverflow.com/comment/35686698
type: Comment
comment on: http://stackoverflow.com/q/23302668
type: QuestionComment
has text: @nKn Finally I've solved it. It was not only that, but also the charset that the Scanner object was using. Both the request and the Scanner were using UTF-8 (as of being the Android default I guess) but I required ISO-8859-1 for these characters to be displayed correctly. Once specified this charset on both methods, the problem has been fixed. Anyway, your help was quite useful to put me on the right track, so should you make an answer I'll be glad to accept it.
score: 0

http://stackoverflow.com/q/23364969
type: Question
type: AnsweredQuestion
has body: I am getting a Java null pointer exception Unable to start receiver error. I am making an app which receives the push from the parse.com and I am getting the error for Android 4.0.3 - 4.0.4, and also when I restart the some devices.. My LogCat is **java.lang.RuntimeException: Unable to start receiver com.omega.omegaplus.main.MyCustomReceiver: java.lang.NullPointerException at android.app.ActivityThread.handleReceiver(ActivityThread.java:2419) at android.app.ActivityThread.access$1500(ActivityThread.java:139) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1322) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:156) at android.app.ActivityThread.main(ActivityThread.java:4987) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:511) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551) at dalvik.system.NativeStart.main(Native Method) Caused by: java.lang.NullPointerException at org.json.JSONTokener.nextCleanInternal(JSONTokener.java:116) at org.json.JSONTokener.nextValue(JSONTokener.java:94) at org.json.JSONObject.&lt;init&gt;(JSONObject.java:154) at org.json.JSONObject.&lt;init&gt;(JSONObject.java:171) at com.omega.omegaplus.main.MyCustomReceiver.onReceive(MyCustomReceiver.java:30) at android.app.ActivityThread.handleReceiver(ActivityThread.java:2408) ... 10 more** My broadcast receiver is @Override public void onReceive(Context context, Intent intent) { Bundle extras = intent.getExtras(); String message = extras != null ? extras.getString("com.parse.Data") : ""; Log.e("message ", " " + message); JSONObject jObject; try { jObject = new JSONObject(message); //objectId = jObject.getString("id"); time = jObject.getString("time"); msg = jObject.getString("title"); title = jObject.getString("msg"); GCMMessage gcmMessage = new GCMMessage(); //gcmMessage.setMsg_id(1); gcmM…
tagged with: android
has comment: http://stackoverflow.com/comment/35787031
has title: java.lang.RuntimeException: Unable to start receiver *.mycustomReceiver java.lang.NullPointerException
accepted answer: http://stackoverflow.com/a/23365205
answer count: 1
has comment: http://stackoverflow.com/comment/35787971
has comment: http://stackoverflow.com/comment/35787375
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/35788238
has comment: http://stackoverflow.com/comment/35787137
has comment: http://stackoverflow.com/comment/35787168
has answer: http://stackoverflow.com/a/23365205

http://stackoverflow.com/q/23396171
downvote count: 0
has answer: http://stackoverflow.com/a/23531084
favorite count: 0
tagged with: esapi
has title: to wrap or not to wrap ESAPI
has answer: http://stackoverflow.com/a/23448283
has comment: http://stackoverflow.com/comment/36205020
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23575210
answer count: 4
score: 1
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/35884520
type: Question
has body: We have several webapps that needs functionality provided by ESAPI java library. my colleague and I are in a dilemma whether to use ESAPI directly thereby creating a direct dependence on ESAPI or create an interface that abstracts calls to ESAPI. By abstracting a dependence on a library we get flexibility to easily switch to some other option if need arises. Besides that we get to define our own interface which is more likely to match our needs. But as we identify methods that we need in our interface, it is looking more and more like interfaces used in ESAPI itself. And ESAPI is a facade itself, with configurable implementations of Validator, Encryptor and others. Is ESAPI mature enough that it is safe to directly depend on it or is it wise to stick with this wrapper ?
tagged with: decoupling
has answer: http://stackoverflow.com/a/23396773
tagged with: maintainability

http://stackoverflow.com/comment/35925159
has text: Possible duplicate of [Cannot override generic interface](https://stackoverflow.com/questions/12579153/override-a-method-in-java-generically)
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23438813

http://stackoverflow.com/a/23303248
has comment: http://stackoverflow.com/comment/35675811
has comment: http://stackoverflow.com/comment/35674794
has comment: http://stackoverflow.com/comment/35675019
has comment: http://stackoverflow.com/comment/35674782
has comment: http://stackoverflow.com/comment/35674712
has comment: http://stackoverflow.com/comment/35675636
has comment: http://stackoverflow.com/comment/35675325
has comment: http://stackoverflow.com/comment/35674588
has comment: http://stackoverflow.com/comment/35675765
has comment: http://stackoverflow.com/comment/35675254
has comment: http://stackoverflow.com/comment/35674583
score: 0
has comment: http://stackoverflow.com/comment/35674993
has comment: http://stackoverflow.com/comment/35674879
has body: Sounds like you could need something called Holder Pattern. This looks like a nice tutorial: http://www.codeofaninja.com/2013/09/android-viewholder-pattern-example.html Vogella also touches the subject here: http://www.vogella.com/tutorials/AndroidListView/article.html#adapterperformance_holder To avoid having to enable scrolling through all of the list, you could also add pagnation, somthing like this library might help: https://github.com/nicolasjafelle/PagingListView
has comment: http://stackoverflow.com/comment/35675013
has comment: http://stackoverflow.com/comment/35675116
has comment: http://stackoverflow.com/comment/35675160
answers question: http://stackoverflow.com/q/23303089
type: Answer
has comment: http://stackoverflow.com/comment/35675563

http://stackoverflow.com/comment/35839619
type: QuestionComment
has text: You can still use LibGDX without gradle (download 0.9.9 and use the old setup-tool to create standard projects, which are not based on gradle). You can also use another IDE, since I assume it's a Netbeans gradle-plugin problem here, no libgdx specific one.
comment on: http://stackoverflow.com/q/23386271
score: 0
type: Comment

http://stackoverflow.com/comment/35773297
score: 0
comment on: http://stackoverflow.com/q/23357207
type: QuestionComment
has text: Can you please elaborate on what you are trying to achieve using this `key_pressed` boolean value?
type: Comment

http://stackoverflow.com/q/23295495
has comment: http://stackoverflow.com/comment/35660709
has title: How to format XML ResponseBody output without or with minimal configuration in SpringMVC
downvote count: 0
tagged with: jaxb2
has comment: http://stackoverflow.com/comment/35660535
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0
answer count: 0
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/4882988
upvote count: 1
has comment: http://stackoverflow.com/comment/35660877
tagged with: spring
has body: In a Spring MVC project we have a small use-case where we need to expose some data in XML format. We don't need an XSD for our project. Since JAXB2 is included in the JDK (up from version 6), we really did not need to configure anything: really nice! Before, we presented a link that was followed. The XML output was automatically formatted (i.e. indented and new-lined nicely) by the browser. Now however, we needed to change the link to have the xml file automatically be downloaded. The problem here is that the file contents are not formatted. The question is: is it possible to format the file output with minimal configuration? All examples I can find already start out by configuring view resolvers, but I hope that that is not needed. Would be elegant :) Current setup is as follows. In the Controller: @RequestMapping(value = "/{filename}.xml", produces = "application/xml") public @ResponseBody XmlData downloadDataAsXml(HttpServletResponse response) { XmlData xmlData = someLogic(); response.setHeader("Content-type", "application/octet-stream"); response.setHeader("Content-Disposition", "attachment"); return xmlData; } , where we use annotations on XmlData import javax.xml.bind.annotation.*; @XmlRootElement(name = "data") @XmlAccessorType(XmlAccessType.FIELD) @XmlType(propOrder = { "field1", "field2", "entry"}) public class XmlData { @XmlElement private String field1; @XmlElement private String field2; @XmlElementWrapper(name = "entries") @XmlElement private SortedSet&lt;String&gt; entry; } So, except for setting Spring MVC to annotation-driven, everything works out of the box but the formatting.
tagged with: spring-mvc
score: 1
tagged with: java
type: Question

http://stackoverflow.com/comment/35736436
type: AnswerComment
score: 0
type: Comment
has text: Why does your function use an integer array? I have found functioning binary searches that use integer arrays, but I am trying to modify one so that I can use it on string arrays.
comment on: http://stackoverflow.com/a/23337262

http://stackoverflow.com/comment/122567969
comment on: http://stackoverflow.com/a/23439520
score: 0
type: Comment
has text: the `get()`of the tasks blocks until done. No need to wait explicitly, or what?
type: AnswerComment

http://stackoverflow.com/q/23448861
tagged with: java
has comment: http://stackoverflow.com/comment/35943337
accepted answer: http://stackoverflow.com/a/23448959
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/23448959
tagged with: sql-server
tagged with: exception
has title: Getting Checked Exception while running a SQL Program
tagged with: jdbc
has body: import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.io.PrintWriter; import java.sql.*; import java.net.*; public class connection { JTextField textfeild; JButton button; String text; Socket sock; PrintWriter writer; JButton button1; public static void main(String[] args) { connection user1 = new connection(); user1.go(); }//main method close public void go() { JFrame frame12 = new JFrame(); JPanel centerpanel12 = new JPanel(); centerpanel12.setLayout(new BoxLayout(centerpanel12, BoxLayout.Y_AXIS)); textfeild = new JTextField(20); centerpanel12.add(textfeild); //textfeild.addActionListener(new textfeildlitner()); frame12.add(centerpanel12); button = new JButton("Click Me"); centerpanel12.add(button); button.addActionListener(new buttonlitner()); button1 = new JButton("DataDisplay"); centerpanel12.add(button1); button1.addActionListener(new buttonlitner1()); frame12.getContentPane().add(BorderLayout.CENTER, centerpanel12); frame12.pack(); frame12.setVisible(true); frame12.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); }//go method close /*class textfeildlitner implements ActionListener{ public void actionPerformed(ActionEvent ev){ } }//inner class textfeildlitner close*/ class buttonlitner implements ActionListener { public void actionPerformed(ActionEvent ev) { button.setText("I AM Clicked"); String name = textfeild.getText(); System.out.println(name); textfeild.setText(""); textfeild.requestFocus(); }//method close }//inner class close class buttonlitner1 implements ActionListener { void connection() { try { String user = "SQlUI"; String pass = "123456"; String db = "jdbc:sqlserver://localhost:1234;" + ";databaseName=SQlUI"; Class.forName("com.microsoft.sqlserver.jdbc"); Connection con = DriverManager.getConnection(db, user, pass); Statement s1 = con.createStatement(); ResultSet r1 = s1.executeQuery("select * from Table_1"); String[] result = new String[20]; if (r1 != null) { while (r1.next()) { for (int i = 0; i &lt; result.length; i++) {…
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35954049
type: Question
tagged with: sql-server-2005

http://stackoverflow.com/comment/35695399
has text: Can you run hprof on the vm and see if there are regular GCs?
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23314782

http://stackoverflow.com/q/23418252
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/23418326
type: Question
score: 0
answer count: 2
tagged with: user-interface
tagged with: arrays
tagged with: class
possible better answer: http://stackoverflow.com/a/23418401
has answer: http://stackoverflow.com/a/23418401
accepted answer: http://stackoverflow.com/a/23418326
has body: I want to use the run_1 and run_2 arrays from the snowBoarding class within the paintComponent() when I redraw. I want to use the values to make a bar graph out of rectangles, but I cannot figure out how to bring the values from snowBoarding into the myJPanel. public class snowBoarding extends JFrame { public int[] run_1 = new int[6]; public int[] run_2 = new int[6]; private myJPanel DrawPanel = null; private myJPanel getDrawPanel() { if (DrawPanel == null) { DrawPanel = new myJPanel(); DrawPanel.setLayout(new GridBagLayout()); DrawPanel.setBounds(new Rectangle(258, 39, 326, 361)); DrawPanel.setBackground(Color.white); DrawPanel.setEnabled(true); DrawPanel.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED)); //Instantiate the BufferedImage object and give it the same width // and height as that of the drawing area JPanel img = new BufferedImage(DrawPanel.getWidth(), DrawPanel.getHeight(), BufferedImage.TYPE_INT_RGB); //Get its graphics context. A graphics context of a particular object allows us to draw on it. g2dImg = (Graphics2D)img.getGraphics(); //Draw a filled white coloured rectangle on the entire area to clear it. g2dImg.setPaint(Color.WHITE); g2dImg.fill(new Rectangle2D.Double(0, 0, img.getWidth(), img.getHeight())); } return DrawPanel; } public JButton getButton_calc_draw() { if (Button_calc_draw == null) { Button_calc_draw = new JButton(); Button_calc_draw.setBounds(303, 411, 131, 39); Button_calc_draw.setFont(new Font ("Dialog", Font.BOLD, 18)); Button_calc_draw.setText("Draw"); Button_calc_draw.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent e) { // Get values from the text fields //I want these values from the array// run_1[0] = Integer.parseInt(textField.getText()); run_1[1] = Integer.parseInt(textField_1.getText()); run_1[2] = Integer.parseInt(textField_2.getText()); run_1[3] = Integer.parseInt(textField_3.getText()); run_1[4] = Integer.parseInt(textField_4.getText()); run_1[5]…
has title: calling an array from classA to classB

http://stackoverflow.com/a/23423658
has comment: http://stackoverflow.com/comment/35896970
type: Answer
has comment: http://stackoverflow.com/comment/35897217
answers question: http://stackoverflow.com/q/23423467
has comment: http://stackoverflow.com/comment/35897177
score: 0
has comment: http://stackoverflow.com/comment/35897145
has body: SurfaceHolder.Callback is related to its Surface. Abstract interface to someone holding a display surface. Allows you to control the surface size and format, edit the pixels in the surface, and monitor changes to the surface. This interface is typically available through the SurfaceView class. When using this interface from a thread other than the one running its SurfaceView, you will want to carefully read the methods lockCanvas() and Callback.surfaceCreated(). You need to implement the SurfaceCallback interface of SurfaceView as below: public class callbackSurfaceMethod implements SurfaceHolder.Callback{ @Override public void surfaceCreated(SurfaceHolder holder) { // TODO Auto-generated method stub } @Override public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) { // TODO Auto-generated method stub } @Override public void surfaceDestroyed(SurfaceHolder holder) { // TODO Auto-generated method stub } Change in your code. surfaceView = (SurfaceView)findViewById(R.id.surfaceview); surfaceHolder = surfaceView.getHolder(); surfaceHolder.addCallback(callbackSurfaceMethod );
has comment: http://stackoverflow.com/comment/35896752

datamapper
tag name: datamapper
tags question: http://stackoverflow.com/q/23444731
type: Tag

http://stackoverflow.com/comment/35747386
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23343422
has text: @newbieee Edit your post to explain, explanations in comments are not very visible ;-)

http://stackoverflow.com/comment/35860227
score: 0
type: AnswerComment
has text: Unfortunately that iterator is an interface for the consumer that I don't control, so I just `take()` the element from the BlockingQueue in the `hasNext()` and then I retrieve it in the `next()`, am I right? and what about the implementation? which is the best for my problem in your opinion?
type: Comment
comment on: http://stackoverflow.com/a/23404253

http://stackoverflow.com/q/23423328
score: 0
has body: I have a project that I have to create a backup periodically based on more frequent access to a file using java netbeans. it will be in client server network. for example : a client access a file 5 times in a day, so that file will be backed up to a server database. and some file just accessed 1, 2, 3 or 4 times a day, these will not be backed up.
has comment: http://stackoverflow.com/comment/35896185
type: UnansweredQuestion
answer count: 0
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/35899641
has title: How To Create Backup Periodically Based On More Frequent Access To A File Using Java Netbeans

http://stackoverflow.com/comment/35769070
has text: if you have a stub, you're doing it wrong. try an updated rmi tutorial. it should not mention anything about rmic, skeletons, or stubs.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23354891

http://stackoverflow.com/a/23360827
has body: As you can see from docs: The mapping framework does not handle cascading saves. If you change an Account object that is referenced by a Person object, you must save the Account object separately. Calling save on the Person object will not automatically save the Account objects in the property accounts. So, first, you have to save each object of the otherPojos list. After that you can save MyPojo instance: MyPojo pojo = new MyPojo(); OtherPojo otherPojo = new OtherPojo(); OtherPojo otherPojo1 = new OtherPojo(); pojo.setOtherPojos(Arrays.asList(otherPojo, otherPojo1)); mongoTemplate.save(otherPojo); mongoTemplate.save(otherPojo1); mongoTemplate.save(pojo); UPDATED: You saved a objects: for( MyPojo pojo : somePojoList ){ for( OtherPojo otherPojo : pojo.getOtherPojos() ){ mongoTemplate.save( otherPojo,collectionname ); } } All otherPojo objects will be saved in collection with name "collectionName".. but your myPojo objects have a $ref to an otherPojo collection.. "otherPojo" : [ { "$ref" : "otherPojo", "$id" : ObjectId("535f9100ad52e59815755cef") }, { "$ref" : "otherPojo", "$id" : ObjectId("535f9101ad52e59815755cf0") } ] So, "collectionname" variable mongoTemplate.save( otherPojo,collectionname ); must be "otherPojo". To avoid confusion, I propose to specify a collection for saving OtherPojo objects with @Doucument annotation: @Document(collection="otherPojos") public class OtherPojo{ @Id private ObjectId _id; private String someOtherFields; } And to save otherPojo objects by using a overloaded save() method of mongoTemplate mongoTemplate.save( otherPojo ); In this way , you will have a valid $ref for myPojo documents UPDATE 2: In this case, you want to store parents and childs object in same collection. To achieve this you can use this approach
upvote count: 2
has comment: http://stackoverflow.com/comment/35787369
type: Answer
has comment: http://stackoverflow.com/comment/35789951
score: 2
answers question: http://stackoverflow.com/q/23359797
has comment: http://stackoverflow.com/comment/35787663
has comment: http://stackoverflow.com/comment/35786924
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23359797
has comment: http://stackoverflow.com/comment/35790300
has comment: http://stackoverflow.com/comment/35781884
has comment: http://stackoverflow.com/comment/35790469

http://stackoverflow.com/a/23426626
has comment: http://stackoverflow.com/comment/35904639
score: 1
has body: It isn't possible to set your own token lifetime. Why would anyone even need this?
has comment: http://stackoverflow.com/comment/35904047
accepted answer of: http://stackoverflow.com/q/23426523
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35902927
answers question: http://stackoverflow.com/q/23426523
upvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/35902341
downvote count: 0
has comment: http://stackoverflow.com/comment/35902168
has comment: http://stackoverflow.com/comment/35903225

http://stackoverflow.com/q/23433354
tagged with: mdx
accepted answer: http://stackoverflow.com/a/23433516
tagged with: olap4j
favorite count: 0
upvote count: 0
has answer: http://stackoverflow.com/a/23433516
type: AnsweredQuestion
has body: I'm trying to create a report from an olap4j datasource DriverConnectionProvider provider = new DriverConnectionProvider(); provider.setDriver("mondrian.olap4j.MondrianOlap4jDriver"); provider.setUrl("jdbc:postgresql://localhost:5432/FoodMart1"); provider.setProperty("Catalog", "C:/Users/mimi/Documents/FoodMart.xml"); provider.setProperty("JdbcUser","postgres" ); provider.setProperty("JdbcPassword", "*****"); provider.setProperty("JdbcDrivers", "org.postgresql.Driver"); BandedMDXDataFactory factory = new BandedMDXDataFactory(provider); factory.setQuery("MyQuery",query.getMdxQuery() ); MasterReport report = new MasterReport(); report.addPreProcessor(new RelationalAutoGeneratorPreProcessor()); report.setDataFactory(factory); But I'm having this problem at the line MasterReport report = new MasterReport() : java.lang.ClassNotFoundException: org.pentaho.reporting.libraries.resourceloader.ResourceException
tagged with: java
downvote count: 1
type: Question
tagged with: pentaho
answer count: 1
score: -1
tagged with: olap
has title: java.lang.ClassNotFoundException: org.pentaho.reporting.libraries.resourceloader.ResourceException

http://stackoverflow.com/comment/35861750
type: AnswerComment
comment on: http://stackoverflow.com/a/23405298
has text: thanks for your reply.. will surely implement it and check but can you please let me know is it possible to retrive all the values of the key and store in varialbles?
score: 0
type: Comment

http://stackoverflow.com/q/23341635
has title: About the double to be a garbled
tagged with: java
has answer: http://stackoverflow.com/a/23341720
type: UnansweredQuestion
tagged with: sqlite
type: Question
tagged with: android
has body: I want get the sqlite data to ArrayList but I dont know why the data would become a garbled. Can someone tell me the solution? List&lt;double[]&gt; y = new ArrayList&lt;double[]&gt;(); Cursor vocabCursor = database.query(HIST_TABLE, new String[]{QUIZ_WHAT, QUIZ_SCORE}, QUIZ_WHAT + "='Vocabulary Quiz'", null, null, null, null); vocabCursor.moveToFirst(); if(!vocabCursor.isAfterLast()) { do { double name = vocabCursor.getDouble(1); y.add(new double[]{name}); } while (vocabCursor.moveToNext()); } vocabCursor.close(); Log.d("y",y); The result of the log: [D@45fe5220, [D@45fe288, [D@45fe52a8, [D@45fe52c8]
score: 0
tagged with: double
has comment: http://stackoverflow.com/comment/35743916
tagged with: android-cursor
answer count: 1

http://stackoverflow.com/q/23329470
tagged with: java
tagged with: hibernate
has body: we are using Spring and hibernate in our project and i have noticed that we have defined &lt;tx:annotation-driven /&gt; in sprint context file and if i put @Transactionalannotation for method i am successfully able to interact with database but if i remove @Transactional annotation from method i am getting exception stating that "No Hibernate Session bound to thread, and configuration does not allow creation of non-transactional one here" is there any way by which i can define all the select operation as non Transactional(i mean without @Transactional annotation) and update and insert as Transactional
type: Question
answer count: 2
has title: Transactions in Spring/hibernate
accepted answer: http://stackoverflow.com/a/23350445
score: 0
has answer: http://stackoverflow.com/a/23329655
tagged with: spring
possible better answer: http://stackoverflow.com/a/23329655
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23350445
tagged with: transactions

http://stackoverflow.com/comment/35932142
type: Comment
comment on: http://stackoverflow.com/a/23442423
has text: could anyone could explain this to me in detail
type: AnswerComment
score: 0

http://stackoverflow.com/comment/103732765
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/23359897
type: Comment
has text: Confirmed. Search for assoc on this page

http://stackoverflow.com/comment/35937766
score: 0
comment on: http://stackoverflow.com/q/23445956
type: Comment
type: QuestionComment
has text: What is that closing brace doing there right under `int Mn=10`? Currently, it terminates the `if` block.

http://stackoverflow.com/a/26491769
answers question: http://stackoverflow.com/q/23399865
downvote count: 0
has body: Go to common tab of RUN/DEBUG configuration in eclipse change encoding to UTF-8.
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/comment/35909005
type: QuestionComment
has text: *what should I write in place of ip address?* Use the public URL for your site instead.
comment on: http://stackoverflow.com/q/23430477
score: 0
type: Comment

http://stackoverflow.com/comment/35941675
type: Comment
comment on: http://stackoverflow.com/a/23447935
has text: Not to mention that any Maven- or Gradle-based projects are known to have different structures. Eclipse has "source folders" for a reason.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/35675919
type: Comment
has text: I added java code for your solution + fixed some other issues in OP's code. Should work now.
comment on: http://stackoverflow.com/a/23303376
type: AnswerComment
score: 0

http://stackoverflow.com/comment/35927579
type: QuestionComment
comment on: http://stackoverflow.com/q/23439780
score: 0
has text: @user3580294 The term stream is unfortunately overloaded, but I am referring to the java.util.stream.Stream<T> interface. I will add an example.
type: Comment

http://stackoverflow.com/a/24786080
score: 10
upvote count: 10
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/23303206
answers question: http://stackoverflow.com/q/23303206
has body: MySQL doesn't support the concept of schema. For MySQL, the schema is in fact the database. From MySQL Glossary: schema Conceptually, a schema is a set of interrelated database objects, such as tables, table columns, data types of the columns, indexes, foreign keys, and so on. (...) Based on this answer from MySQL forums, you can't get the current database (or databases) through Connection#getSchema method (which was added since Java 7 with JDBC 4) but using Connection#getCatalog unless you use the latest JDBC jar driver: The JDBC driver (because of legacy, mysql didn't call them "schemas" until 5.0, and JDBC didn't have a way to select schemas until JDBC4), calls databases "catalogs", so thus you have to call getCatalogs() to get the list of databases I made a dirty quick to prove the italic sentence above (unless you use the latest JDBC jar driver). Using getCatalog() worked using Java 6: public class DirtyQuickTest { private static final String url = "jdbc:mysql://localhost:7841/test"; private static final String user = "lmendozaj"; private static final String password = "s3cr3t"; //I won't show you my password public static void main(String[] args) throws Exception { Connection con = null; try { Class.forName("com.mysql.jdbc.Driver"); con = DriverManager.getConnection(url, user, password); //commented since doesn't exists in Java 6 //System.out.println(con.getSchema()); System.out.println(con.getCatalog()); } finally { con.close(); } } } Output: test Then I executed the same code in Java 8 and uncommented the statement containing getSchema using mysql-connector-java-5.1.31-bin.jar (currently the latest Java Connector Driver for MySQL). This was the output: null test Which means they still don't support getSchema method. Related: Difference Between Schema / Database in MySQL

http://stackoverflow.com/q/23422077
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: select
upvote count: 1
has title: SQL Retrieving and storing integer
type: Question
answer count: 2
accepted answer: http://stackoverflow.com/a/23422165
tagged with: derby
tagged with: sql
downvote count: 0
favorite count: 0
possible better answer: http://stackoverflow.com/a/23422360
has answer: http://stackoverflow.com/a/23422360
has answer: http://stackoverflow.com/a/23422165
has body: I have the following code: String query_NoHotels = "SELECT max(id) FROM hotels" ; ResultSet res = stmnt.executeQuery(query_NoHotels); logger.info("The result set size is "+res.getFetchSize()); int noHotels = res.getInt(1); However, the ResultSet is always returning empty.. I have tested this query on the database and it should be returning 5. Is this the correct way to store a result when the result is just one item (an integer)? Thanks for your help.

http://stackoverflow.com/q/23406092
has body: I am trying to submit a form with jsoup and then get the html from the directed page: import org.jsoup.Connection; import org.jsoup.Jsoup; import org.jsoup.nodes.Document; public class RF { public static void main(String[] args) throws Exception { Connection.Response submitForm = Jsoup.connect("http://rfinder.asalink.net/free/") .method(Connection.Method.POST) .execute(); Document data = Jsoup.connect("http://rfinder.asalink.net/free/autoroute_rtx.php") .data("cookieexists", "false") .data("id1", "LMML") .data("id2", "LIRA") .data("submit", "Find Route") .cookies(submitForm.cookies()) .post(); System.out.println(data); } } I think the problem may be that the submit button does not have a name tag and I don't know what to include instead of the 'submit' part. What can I do please?
has title: Post Form with JSoup
tagged with: submit
tagged with: form-submit
type: AnsweredQuestion
tagged with: java
tagged with: forms
accepted answer: http://stackoverflow.com/a/23406164
type: Question
tagged with: jsoup
answer count: 1
has answer: http://stackoverflow.com/a/23406164
score: 0

http://stackoverflow.com/comment/35890506
has text: Thank you. I've learned a lot just by deciphering your answer.
comment on: http://stackoverflow.com/a/23419675
type: Comment
score: 1
type: AnswerComment

http://stackoverflow.com/comment/35699366
comment on: http://stackoverflow.com/a/23316741
type: AnswerComment
score: 0
type: Comment
has text: @JBNizet Absolutely correct! Do you mind if I update my answer with your suggestion?

http://stackoverflow.com/q/23414207
type: AnsweredQuestion
tagged with: multithreading
has answer: http://stackoverflow.com/a/23414599
has comment: http://stackoverflow.com/comment/35879492
downvote count: 1
type: Question
has title: How to print text from one client to all other clients using Sockets
has comment: http://stackoverflow.com/comment/35879339
has comment: http://stackoverflow.com/comment/35879616
accepted answer: http://stackoverflow.com/a/23414599
tagged with: java
score: -1
has comment: http://stackoverflow.com/comment/35879393
has comment: http://stackoverflow.com/comment/35879334
upvote count: 0
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/35879192
has body: Everytime I connect a client to the server, it adds a new socket to my ArrayList. When I send a message in my client to the server, it shows up in the server output window, but I am trying to push the message that it sent from one client thread into all of the client windows by somehow iterating through the ArrayList of Sockets. How would I go about sending the input from one of the clients to all of the clients? I have the program broken up into 3 classes, Client, Server, and Service.
tagged with: sockets

http://stackoverflow.com/comment/35853463
comment on: http://stackoverflow.com/a/23400096
has text: Yes that was definitely it! Thanks a lot for solving my problem and for the lesson on Java :D
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/35657831
comment on: http://stackoverflow.com/a/23294283
score: 1
type: AnswerComment
has text: Thanks for the answer. Of course, MyEnum declaration gets open with no problems. I didn't know that enum methods aren't declared in source code. Can you also point to the other compiler-supplied code in Java other than enums please?
type: Comment

http://stackoverflow.com/comment/35824714
comment on: http://stackoverflow.com/a/23385476
score: 12
type: AnswerComment
has text: @gnat It does, by explaining that the premise of the question (that 10G of virtual address space is somehow bad or undesirable) is false, and that there is a benefit (protection against fragmentation).
type: Comment

http://stackoverflow.com/q/23415890
type: Question
has answer: http://stackoverflow.com/a/23416030
has body: So essentially I have an object of vectors and in a specific instance called 'comments' I have comments that actually have String in them and some that are just white space or have a single space. I tried to separate these from each other and I am running into trouble. Everything is outputted for some strange reason. Any thoughts? (display is a JTextArea) for (int x = 0; x&lt;dogParkProgramMain.infoVector.size(); x++) { if(dogParkProgramMain.infoVector.elementAt(x).getComment() == "//s" || dogParkProgramMain.infoVector.elementAt(x).getComment() == null){ System.out.println("Blank"); } else{ display.append("Name: " + dogParkProgramMain.infoVector.elementAt(x).getFName() + " " + dogParkProgramMain.infoVector.elementAt(x).getLName() + newLine); display.append("Comment: " + dogParkProgramMain.infoVector.elementAt(x).getComment() + newLine); display.append("---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------" + newLine); } } // end first for loop
tagged with: jtextarea
tagged with: vector
score: 0
has title: Separating string from white space from a vector
answer count: 1
tagged with: string
accepted answer: http://stackoverflow.com/a/23416030
type: AnsweredQuestion
tagged with: java
tagged with: loops

http://stackoverflow.com/comment/35947583
type: QuestionComment
comment on: http://stackoverflow.com/q/23450771
has text: The Java compiler has nothing to do with it whatsoever. This is a message from your IDE. You can configure it back to a warning I believe.
score: 0
type: Comment

http://stackoverflow.com/comment/35923773
score: 0
type: Comment
has text: Never try to guess what the user would not do. They will do it ;-)
type: QuestionComment
comment on: http://stackoverflow.com/q/23437939

http://stackoverflow.com/q/23345570
downvote count: 0
accepted answer: http://stackoverflow.com/a/23346022
score: 1
favorite count: 0
linked to: http://stackoverflow.com/q/930486
has body: Suppose we have the following code snippet in Java: int a = 3; int b = a++; The value of a gets assigned to b first and then it gets incremented. b = 3 and a = 4. Then why does the postfix expression get evaluated from right to left? Wouldn't it make more sense for it to be evaluated from left to right?
tagged with: operator-precedence
has comment: http://stackoverflow.com/comment/35751525
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23345630
has title: Why do postfix operators in Java get evaluated from right to left?
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/23346022
type: Question
has answer: http://stackoverflow.com/a/23345635
has comment: http://stackoverflow.com/comment/35751559
possible better answer: http://stackoverflow.com/a/23345635
answer count: 3

http://stackoverflow.com/q/23412029
possible better answer: http://stackoverflow.com/a/23412273
type: Question
has answer: http://stackoverflow.com/a/23412273
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/35875033
answer count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/35874887
favorite count: 0
has title: How to mail TextView data on button click with Android-Intent?
has comment: http://stackoverflow.com/comment/35874972
tagged with: android
tagged with: email
tagged with: android-activity
has answer: http://stackoverflow.com/a/23412226
type: AnsweredQuestion
has body: I am pretty new to both android and NFC. I am working on an NFC related application as a college project that reads the data from tags and lists them. Although I am able to do so, I am facing problems with intent where I am supposed to mail this list to user on button click. Can someone please tell me where I am going wrong and help with a detailed step-by-step approach. Huge thanks..!! Here's the WebServiceActivity: public class WebServiceActivity extends Activity { Intent intent = getIntent(); String studlist = intent.getStringExtra("studlist"); @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.webservice); TextView mailtext = (TextView) findViewById(R.id.students); TextView mailbody = (TextView) findViewById(R.id.emailtext); mailbody.setText("Here is the list for Tranport Tracking For Today: \n" + studlist); Button send=(Button) findViewById(R.id.emailsendbutton); send.setOnClickListener(new OnClickListener() { @Override public void onClick(View view) { Log.i("Send email", ""); String[] TO = {"h.trivedi04@gmail.com"}; String[] CC = {"h.trivedi04@gmail.com", "harshit.trivedi22@gmail.com"}; Intent emailIntent = new Intent(Intent.ACTION_SEND); emailIntent.setData(Uri.parse("mailto:")); emailIntent.setType("text/plain"); emailIntent.putExtra(Intent.EXTRA_EMAIL, TO); emailIntent.putExtra(Intent.EXTRA_CC, CC); emailIntent.putExtra(Intent.EXTRA_SUBJECT, "Student Transport Track For Today"); emailIntent.putExtra(Intent.EXTRA_TEXT, studlist); try { startActivity(Intent.createChooser(emailIntent, "Send mail...")); finish(); Log.i("Finished sending email...", ""); } catch (android.content.ActivityNotFoundException ex) { Toast.makeText(WebServiceActivity.this, "There is no email client installed.", Toast.LENGTH_SHORT).show(); } } }); } } And the main activity TransportActivity has: Button webServiceButton = (Button)this.findViewById(R.id.webServiceButton); webServiceButton.setOnClickListener(new android.vi…
has comment: http://stackoverflow.com/comment/35874782
upvote count: 1
accepted answer: http://stackoverflow.com/a/23412226
tagged with: android-intent

http://stackoverflow.com/q/23358362
tagged with: java
tagged with: jpanel
accepted answer: http://stackoverflow.com/a/23358591
answer count: 1
has body: How do I display a JLabel based on a combobox option. When I run the code all the JLabels are displayed straight away. combo1.addActionListener(this); panel.add(combo1); panel.add(img1); panel.add(img2); panel.add(img3); frame.add(panel); img1.setText(" Image : Image1/ "); img2.setText(" Image : Image2/ "); img3.setText(" Image : Image3/ "); img1.setCursor(new Cursor(Cursor.HAND_CURSOR)); img2.setCursor(new Cursor(Cursor.HAND_CURSOR)); img3.setCursor(new Cursor(Cursor.HAND_CURSOR)); I'm using mouseListener to check which label is passed into the goWebsite() function, and then according to that it'll add a hyperlink to the label. private void goWebsite(final JLabel website) { website.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { if(website == img1){ try { Desktop.getDesktop().browse(new URI("http://2.bp.blogspot.com/_2dxp9ORKKAM/TBZpViy7O1I/AAAAAAAABGY/zitq3ZLA8K4/s1600/red.png")); } catch (URISyntaxException | IOException ex) { //It looks like there's a problem } } if(website == img2){ try { Desktop.getDesktop().browse(new URI("http://www.pratikbagaria.com/wp-content/uploads/2011/04/BlueGreenPink.jpg")); } catch (URISyntaxException | IOException ex) { //It looks like there's a problem } } if(website == img3){ try { Desktop.getDesktop().browse(new URI("http://i.imgur.com/9OPnZNk.png")); } catch (URISyntaxException | IOException ex) { //It looks like there's a problem } } if(website == img4){ try { Desktop.getDesktop().browse(new URI("http://www.solidbackgrounds.com/images/three/2048x2048/2048x2048-fluorescent-orange-fluorescent-pink-fluorescent-yellow-three-color-background.jpg")); } catch (URISyntaxException | IOException ex) { //It looks like there's a problem } } The actionPerformed checks which option from the combobox the user has selected and then passes the right img JLabel into the goWebsite() function. @Override public void actionPerformed(ActionEvent e) { String color1 = (String)combo1.getSelectedItem(); // Possibl…
tagged with: jlabel
has title: Displaying JLabel based on combobox option
type: AnsweredQuestion
score: 0
tagged with: mouselistener
tagged with: swing
has answer: http://stackoverflow.com/a/23358591
type: Question

http://stackoverflow.com/q/23355302
has comment: http://stackoverflow.com/comment/35769729
has title: Transparency issue of area in area chart in jasper report
score: 1
tagged with: java
tagged with: jfreechart
type: Question
tagged with: jasper-reports
has body: I am facing a problem when i do a area chart through jasper. The problem is that when multiple areas are there in the area chart section ,one is overrided by the next one.So the previous one is not visble. It seems to be an issue of transparency of colours used. below is piece of code public class StatsChartCustomiser extends JRAbstractChartCustomizer implements JRChartCustomizer { /** The class logger. */ private static final Log log = LogFactory.getLog(StatsChartCustomiser.class); public void customize(final JFreeChart jFreeChart, final JRChart jasperChart) { Plot plot = jFreeChart.getPlot(); jFreeChart.getCategoryPlot().getRenderer().getPlot().setForegroundAlpha(0.5f); jasperChart.getPlot().setForegroundAlpha(0.5f); if (plot instanceof CategoryPlot) { CategoryPlot categoryPlot = (CategoryPlot) plot; CategoryItemRenderer renderer = categoryPlot.getRenderer(); renderer.setSeriesPaint(0, Color.blue); renderer.setSeriesPaint(1, Color.red); renderer.setSeriesPaint(2, Color.green); categoryPlot.setDomainGridlinePaint(Color.LIGHT_GRAY); categoryPlot.setRangeGridlinePaint(Color.LIGHT_GRAY); categoryPlot.setDomainGridlinesVisible(true); categoryPlot.setForegroundAlpha(0.5f); categoryPlot.getForegroundAlpha(); CategoryAxis xAxis = categoryPlot.getDomainAxis(); Font tickLabelFont = xAxis.getTickLabelFont(); ChartFrame frame1=new ChartFrame("Area Chart",jFreeChart); frame1.setVisible(true); //frame1.setOpacity((float) .5); // category labels in category charts with lots of tick marks are // unreadable, so reduce font size (think a JFreeChart bug) xAxis.setTickLabelFont(tickLabelFont.deriveFont(8f)); ValueAxis yAxis = categoryPlot.getRangeAxis(); xAxis.setCategoryLabelPositions(CategoryLabelPositions.createUpRotationLabelPositions(Math.PI / 2.0)); // vertical yAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); jasperChart.getParentProperties(); JRChartPlot jasperplot = jasperChart.getPlot(); System.out.println("before---- "+jasperplot.getForegroundAlpha()); jaspe…
has answer: http://stackoverflow.com/a/23675325
answer count: 1
upvote count: 1
favorite count: 0
downvote count: 0
type: UnansweredQuestion

http://stackoverflow.com/a/23309975
upvote count: 5
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23309326
score: 5
type: Answer
answers question: http://stackoverflow.com/q/23309326
has body: Implementing nand without &amp;&amp; and ||? Try: a ? !b : true; As in: public static void nand(boolean a , boolean b){ System.out.println(a + "\t" + b + "\t" + (a ? !b : true)); }

http://stackoverflow.com/a/23328531
answers question: http://stackoverflow.com/q/23328345
score: 1
downvote count: 0
has body: You change the strings array in the line of: test.getStrings().set(0, "1"); so you cannot expect that the line test.setStrings(strings); will restore the original one. You can do something like: public static void main(String[] args) { ArrayList&lt;String&gt; originalStrings = new ArrayList&lt;String&gt;(); originalStrings.add("One"); originalStrings.add("Two"); originalStrings.add("Three"); ArrayList&lt;String&gt; strings = (ArrayList&lt;String&gt;) originalStrings.clone(); Test11 test = new Test11(); test.setStrings(strings); System.out.println("First get() of index 0: "+test.getStrings().get(0)); System.out.println("Modifying test's strings object..."); test.getStrings().set(0, "1"); System.out.println("First get() of index 0: "+test.getStrings().get(0)); System.out.println("Change it back... using strings variable"); test.setStrings(originalStrings); System.out.println("First get() of index 0: "+test.getStrings().get(0)); }
type: Answer
upvote count: 1

http://stackoverflow.com/comment/35720217
comment on: http://stackoverflow.com/a/23326108
type: AnswerComment
score: 0
has text: Yes, the reverse of what you've just said. So if "test" is "84101115116", how would I turn "84101115116" back to test?
type: Comment

http://stackoverflow.com/a/23406204
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/35871388
has comment: http://stackoverflow.com/comment/35870968
has comment: http://stackoverflow.com/comment/35871926
type: Answer
has comment: http://stackoverflow.com/comment/35864094
accepted answer of: http://stackoverflow.com/q/23405706
has comment: http://stackoverflow.com/comment/35864222
answers question: http://stackoverflow.com/q/23405706
score: 1
upvote count: 1
has body: A few points: you didnt have any way of reading the file. your array had 3 rows and 50 columns when your comment stated the opposite you were trying to split on a space, not a tab. see comments in code explaining what it does: public class ArrayDirectory { public static void main(String args[]) throws FileNotFoundException { String file = ("lab4b2.txt"); Scanner scan = new Scanner(new FileReader(file)); // initialises the scanner to read the file file String[][] entries = new String[100][3]; // creates a 2d array with 100 rows and 3 columns. int i = 0; while(scan.hasNextLine()){ entries[i] = scan.nextLine().split("\t"); i++; } //loops through the file and splits on a tab for (int row = 0; row &lt; entries.length; row++) { for (int col = 0; col &lt; entries[0].length; col++) { if(entries[row][col] != null){ System.out.print(entries[row][col] + " " ); } } if(entries[row][0] != null){ System.out.print("\n"); } } //prints the contents of the array that are not "null" } }
has comment: http://stackoverflow.com/comment/35864189
has comment: http://stackoverflow.com/comment/35871237
has comment: http://stackoverflow.com/comment/35869984
has comment: http://stackoverflow.com/comment/35875723

http://stackoverflow.com/comment/35869801
score: 0
type: AnswerComment
has text: @ ZouZou – Thank you VERY MUCH. Just for my own understanding. I wasn’t doing anything wrong, it was just the way indexof and equals function in Java, that’s why I was getting the incorrect result?
type: Comment
comment on: http://stackoverflow.com/a/23409137

http://stackoverflow.com/comment/35694914
type: QuestionComment
has text: Did you run `gradle --refresh-dependencies` and `gradle eclipse`? Also try to select all projects in eclispe, rightclick them and do a Gradle -> refresh all
score: 1
comment on: http://stackoverflow.com/q/23314348
type: Comment

class-variables
tag name: class-variables
type: Tag
tags question: http://stackoverflow.com/q/23414090

http://stackoverflow.com/a/23391171
accepted answer of: http://stackoverflow.com/q/23391016
answers question: http://stackoverflow.com/q/23391016
has comment: http://stackoverflow.com/comment/35897062
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 1
has body: The problem seems to be with the last path segment static3.{format}. Try the following: @Path("/static1/{variable}/static2") public class DoStuff { @POST @Path("/{segment3:static3.*}") @Consumes(MediaType.APPLICATION_XML) @Produces("application/xml") public Response validation(@PathParam("variable") String variable, @PathParam("segment3") String segment3, String inputXML) { ............... }
has comment: http://stackoverflow.com/comment/35839561
upvote count: 1

http://stackoverflow.com/a/28955146
score: 1
has body: The short answer is: it can't be done -- you have to use Class.forName(). The javax.lang.model package (and subpackages) are designed for dealing with source code (the primary use case being annotation processors). In these cases, you typically have not yet produced binary artifacts (i.e. .class files) for the Elements you're dealing with, so invoking Class.forName() is likely to fail. If you can give us more details about where element comes from or what you want to do with annotation once you've obtained it, we might be able to provide more guidance. It's likely that the DeclaredType returned by annotationMirror.getAnnotationType() provides access to the information you're after in a more reliable way than Annotation would.
answers question: http://stackoverflow.com/q/23300403
has comment: http://stackoverflow.com/comment/46186124
type: Answer
upvote count: 2
downvote count: 1
has comment: http://stackoverflow.com/comment/46177553

http://stackoverflow.com/comment/35923523
score: 0
has text: You were asking about a method that has the return type of an interface. If you extend a class, you inherit it's type. `class Z extends A { }` `A obj = new Z()` makes total sense, so if return type was A, you could return a Z instance. This also works with interfaces whe implementing them. I was just showing how you could return a value when the methods return type is an interface
comment on: http://stackoverflow.com/a/23437891
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/35883700
has text: Yes, it moves from the beginning again.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23416272

http://stackoverflow.com/q/23439802
tagged with: java
has comment: http://stackoverflow.com/comment/35926944
has comment: http://stackoverflow.com/comment/35927667
type: Question
tagged with: hashmap
answer count: 1
has answer: http://stackoverflow.com/a/23440286
accepted answer: http://stackoverflow.com/a/23440286
has title: Get Values from an Object
score: 0
tagged with: sqlite
has comment: http://stackoverflow.com/comment/35926923
has body: I tried a few solutions on stack overflow but they seem to not work for me. I use the following onlongclicklistener Object j = (Quote) MainActivity.this.adapter.getItem(position); The following is my object J Now I would like to get the value of ticker into a string How do I go about this. Do I need a Hashmap ? String valueofticker = j.toString(ticker); // How to do this ?
has comment: http://stackoverflow.com/comment/35927226
tagged with: object
type: AnsweredQuestion
tagged with: onlongclicklistener

http://stackoverflow.com/comment/35758882
has text: Okay. Well, I am confused as to why it is "empty" as I can see the list presented to me. I am populating the ArrayList from the SQLite DB. Do you mind elaborating a little bit?
comment on: http://stackoverflow.com/a/23349389
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/23382650
has comment: http://stackoverflow.com/comment/35819847
has body: What if I don't set the Xmx flag? Then the JVM defaults to a (typically modest) size of memory for the app. Does it mean unlimited memory usage? No. How can I realize if the application is frozen in either C or Java? Fix the memory leak1. Note that the question I answered used 'release' as opposed to 'realize'. After careful consideration, I feel the answer should remain exactly the same. Either 'releasing (memory)' or 'realizing (there is a problem)' is not going to actually fix the problem. It is better either way to fix the actual problem (a memory leak). As an aside. I don't think the problem is in the C code, but a simple test (launch the app. from the command line) should reveal either way. The reason I think the problem is the Java code is that the OutOfMemoryError is detected by a (presumably) fully functional JVM. If the C app. had used memory space that the JVM reserved for itself or the app. I guess the error would be very different, possibly along the lines of: JVM internal error.. 1. Fixing the memory leak There has been a range of good advice offered by other contributors, that I will revisit here. @ChristianKullmann started it off by stressing the importance of memory profiling. @KlasLindbäck followed it up with some excellent resources linked in a comment. Java Heap Dump. "One way to find memory leaks is analyzing heap dumps. There are several ways to get a heap dump (not including 3rd party tools).." Tips and tricks for analyzing Java virtual machine heap memory dumps. "Memory dumps are a very useful feature of the JVM to analyze the contents of the memory at any given time, but their usage requires some experience, and in this post I will share with you some tips and tricks that I’ve learned over the years, so hopefully they will be useful to you too." @mKorbel rounded it out with some typical problems to look for: *"search in code if there are close() all: JDBC, FileIO, Socket, etc and in finally block, then you'd love re_engeneering too much"*
has comment: http://stackoverflow.com/comment/35820003
type: Answer
accepted answer of: http://stackoverflow.com/q/23382619
answers question: http://stackoverflow.com/q/23382619
has comment: http://stackoverflow.com/comment/35821419
upvote count: 7
score: 7
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/23325133
type: Question
accepted answer: http://stackoverflow.com/a/23325506
tagged with: user-interface
answer count: 1
downvote count: 0
has body: I want to add console pane to JavaFX app. I could use TextArea with setEditable(false), but how can I set different colors to different messages (errors,warnings,info). I have experiense with Swing. So in Swing I was using TextPane inside of ScrollPane and Style for coloring. Has JavaFX an approach to do that? Which controls should I use?
favorite count: 0
has title: Console pane in JavaFX
has answer: http://stackoverflow.com/a/23325506
upvote count: 1
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: javafx

http://stackoverflow.com/q/23331491
upvote count: 1
downvote count: 1
has answer: http://stackoverflow.com/a/23336458
tagged with: java
has body: I'm using recursion to find the shortest path in a BST(Binary Search Tree) and the shortest path should be the first childless leaf that is found. Whenever I return it gives me back the root. I've tried many various ways and I either keep getting the root back for a nullPointerException. Here is what I have public int minPath(){ if(isEmpty()){ return -1; } else{ return findMin(root); } } private int findMin(IntegerTreeNode tNode){ if((tNode.left != null) &amp;&amp; (tNode.right != null)){ findMin(tNode.left); findMin(tNode.right); } return tNode.item; } I think what is happening is that it is returning the start of the stack, so how would I return the first childless leaf node?
type: Question
answer count: 2
has title: Shortest path to leaf in Binary Search Tree
has answer: http://stackoverflow.com/a/23331523
favorite count: 0
tagged with: binary-search-tree
score: 0
type: UnansweredQuestion

http://stackoverflow.com/q/23451977
answer count: 1
downvote count: 0
score: 1
favorite count: 0
has title: Java: JOption pane element listing
type: AnsweredQuestion
tagged with: joptionpane
has body: How can you display multiple elements of an array in JOption pane without an individual window for each element? The following code will output a single window for each element of inputDie1[x], how can I list them? i.e. 5, 1, 6, 1, 2 in one window. for (int x = 0; x &lt; 5; x++) { randomValue1 = ((int)(Math.random() * 100) % HIGHEST_DIE_VALUE + LOWEST_DIE_VALUE); inputDie1[x].setValue1(randomValue1); randomValue2 = ((int)(Math.random() * 100) % HIGHEST_DIE_VALUE + LOWEST_DIE_VALUE); inputDie2[x].setValue2(randomValue2); JOptionPane.showMessageDialog(null, inputDie1[x].getValue1()); } after concatenation for (int x = 0; x &lt; 5; x++) {v1 = inputDie1[x].getValue1();} JOptionPane.showMessageDialog(null, v1);
tagged with: java
has answer: http://stackoverflow.com/a/23451997
upvote count: 1
tagged with: swing
type: Question
accepted answer: http://stackoverflow.com/a/23451997
tagged with: arrays

http://stackoverflow.com/a/43885880
answers question: http://stackoverflow.com/q/23331932
score: 0
has body: It is not a accepted regexp, if you want to try it out IDE shows an error you can try this : [_A-Za-z0-9-\\+]+]
type: Answer

http://stackoverflow.com/a/23376059
accepted answer of: http://stackoverflow.com/q/23372092
type: AcceptedAnswer
has body: The default actions <-> keys are defined by the L&F in the InputMap and ActionMap I believe they are called before any external listener. You can always overwrite it. Alternatively, you can overwrite processKeyBinding Here is an example of the code that may do what you need. It intercepts Cntrl-F6 and prints to sysout. Please see my comment as to why Cntrl-F6 is not in the bindings. public class PrintTableTest { public JPanel buildUI() { String[] columnNames = {"First Name", "Last Name", "Sport", "# of Years", "Vegetarian"}; Object[][] data = { {"Mary", "Campione", "Snowboarding", 5, new JComboBox(new Object[]{Boolean.TRUE, Boolean.FALSE})}, {"Alison", "Huml", "Rowing", 3, Boolean.FALSE}, {"Kathy", "Walrath", "Knitting", 2, Boolean.FALSE}, {"Sharon", "Zakhour", "Speed reading", 20, Boolean.TRUE}, {"Philip", "Milne", "Pool", 10, Boolean.TRUE } }; final JTable table = new JTable(increase(data, 50), columnNames); JScrollPane scrollPane = new JScrollPane(table); JButton print = new JButton("Print"); print.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { try { table.print(); } catch (PrinterException e1) { e1.printStackTrace(); } } }); table.setDefaultRenderer(TableColumn.class, new TableCellRenderer()); JPanel panel = new JPanel(new BorderLayout(5, 5)); panel.add(scrollPane, BorderLayout.CENTER); panel.add(print, BorderLayout.SOUTH); JTextField textField = new JFormattedTextField(); JSpinner spinner = new JSpinner(new SpinnerNumberModel()); spinner.setEditor(textField); textField.setEditable(false); panel.add(spinner, BorderLayout.NORTH); panel.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(KeyStroke.getKeyStroke(KeyEvent.VK_F6, InputEvent.CTRL_DOWN_MASK), "doSomething" ); panel.getActionMap().put("doSomething",new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { System.out.println("TEST OUT"); } }); table.putClientProperty("JTable.autoStartsEdit", Boolean.FALSE); return panel; } private Objec…
downvote count: 0
answers question: http://stackoverflow.com/q/23372092
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/35864739
score: 2
has comment: http://stackoverflow.com/comment/35857038
has comment: http://stackoverflow.com/comment/35859496
has comment: http://stackoverflow.com/comment/35859444
has comment: http://stackoverflow.com/comment/35809230
has comment: http://stackoverflow.com/comment/35838450
has comment: http://stackoverflow.com/comment/35835960

http://stackoverflow.com/a/23436572
answers question: http://stackoverflow.com/q/23435888
type: Answer
downvote count: 0
score: 1
has body: This is what you need: public class Test { public static void main(String[] args) { String source = "storm, whatever1, fire,water and something else,earth"; for (String piece : source.split("\\s*,\\s*")) { System.out.println(piece); } } }
upvote count: 1

http://stackoverflow.com/comment/35660875
type: QuestionComment
has text: I can keep track changes in this value if i set that as property="category" in jsp. How to do that
comment on: http://stackoverflow.com/q/23295864
score: 0
type: Comment

http://stackoverflow.com/a/23360800
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/35790353
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/23360459
has body: RabbitMQ is a message broker. In essence, it accepts messages from producers, and delivers them to consumers. In-between, it can route, buffer, and persist the messages and data according to rules you give it. You can also use Google Guava

http://stackoverflow.com/comment/35893881
has text: @MadProgrammer M trying to get that column/row but i am getting that where i have not added combobox. but when i cliced combobox its not giving. that
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23421952

http://stackoverflow.com/comment/35924698
comment on: http://stackoverflow.com/q/23417884
has text: So you want multitouch?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35729434
comment on: http://stackoverflow.com/q/23333328
score: 0
type: Comment
type: QuestionComment
has text: Give us an example input.

http://stackoverflow.com/q/23416415
tagged with: spring
tagged with: spring-mvc
has answer: http://stackoverflow.com/a/23433091
tagged with: spring-webflow
has title: Unusual behavior of MultiActionController, Its not letting leave it's controll
type: Question
has comment: http://stackoverflow.com/comment/35911460
has body: I'm using MultiActionCotroller for handling user details curd operations. In Controller I'v define add, delete, update method and these methods referring different pages. Every page then invoking different Controller(SimpleFormController) for performing their operation but when I'm trying to invoke different controller, its not going to that controller. Its again searching into the MultiActionController with the action path name of refered page. Its not getting out from the MultiActionController, here I'm not understanding the behavior of the MultiActionController. In my example, In the add_details_form.jsp, I'm defined action path name, that is "details_path.htm". and this is suppose to invoke "AddCtrl" controller but it's not going to AddCtrl but UserMultiCtrl. Really I'm stuck here, I can't move forward. I'm not familiar with annotation I'v gone through many sites but I didn't get any... I'v very high expectation from StackOverFlow of getting solution of it. Thanks in advance Here is my code Index.jsp Add User Details Update User Details Delete User Details UserMultiCtrl public class UserMultiCtrl extends MultiActionController { public ModelAndView add(HttpServletRequest request,HttpServletResponse response)throws Exception { ModelAndView mav = new ModelAndView(); mav.setViewName("add_details_form"); return mav; } public ModelAndView update(HttpServletRequest request,HttpServletResponse response)throws Exception { ModelAndView mav = new ModelAndView(); mav.setViewName("update_details_form"); return mav; } public ModelAndView delete(HttpServletRequest request,HttpServletResponse response)throws Exception { ModelAndView mav = new ModelAndView(); mav.setViewName("delete_details_form"); return mav; } } Spring-Servlet.xml add_details_form.jsp <form:form action="details_path.htm" commandName="userDetails" method="POST"> User Name: Address: Age: </form:form> AddCtrl.java public class AddCtrl extends SimpleFormController { private DetailsJB djb; public void setDjb(Detail…
tagged with: java
has comment: http://stackoverflow.com/comment/36011827
score: 0
answer count: 1
type: UnansweredQuestion

http://stackoverflow.com/comment/35933406
comment on: http://stackoverflow.com/a/23442997
has text: @Abhijit If you're doing it wrong, yes. If you have too many threads you may end up having to do lots of unnecessary context switches, which are quite costly in terms of performance.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/39470848
type: QuestionComment
type: Comment
score: 0
has text: Possible duplicate of [Eclipse and Ant: javac1.8 class not found](http://stackoverflow.com/questions/20702626/eclipse-and-ant-javac1-8-class-not-found)
comment on: http://stackoverflow.com/q/23442621

http://stackoverflow.com/comment/35667157
type: Comment
has text: Looks right... can you show some of the FXML (root element and declaration of the list view)?
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/23296241

http://stackoverflow.com/q/23371006
has body: I'm using POI java library to read an Excel. My Exel have a simple structure composed by 8 columns. The problem is that reading column length by method getPhysicalNumberOfCells I get different number for each row.
favorite count: 0
tagged with: apache-poi
has title: POI: wrong number of cell per row form method getPhysicalNumberOfCells
has comment: http://stackoverflow.com/comment/35816055
tagged with: excel
has answer: http://stackoverflow.com/a/23371007
type: AnsweredQuestion
score: 3
upvote count: 3
tagged with: java
accepted answer: http://stackoverflow.com/a/23371007
type: Question
linked to: http://stackoverflow.com/q/18201381
downvote count: 0
linked to: http://stackoverflow.com/q/18489817
answer count: 1

http://stackoverflow.com/comment/35910918
comment on: http://stackoverflow.com/q/23431154
has text: I've been trying to work out what is causing the "forbidden" message when I just load the url encoded link without visiting the first page. I'm not sure what to look for on the network monitor though, there's no cookies as far as i'm aware
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35725248
has text: Could you be more exact than "I'm having an issue"?
comment on: http://stackoverflow.com/q/23331000
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35688601
comment on: http://stackoverflow.com/q/23310532
has text: I'm pretty sure you are getting an "unreported **exception**" not an "unreported *expectation*"
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23409604
type: UnansweredQuestion
tagged with: spring
type: Question
tagged with: threadpool
tagged with: java
has comment: http://stackoverflow.com/comment/35921963
has comment: http://stackoverflow.com/comment/35923406
score: 0
has title: spring @Async not intercepted
has comment: http://stackoverflow.com/comment/35921712
has comment: http://stackoverflow.com/comment/35872836
tagged with: executorservice
tagged with: asynchronous
has comment: http://stackoverflow.com/comment/35921892
has body: I am tyring out a basic spring @Async example. I have an interface like below public interface AsyncInterface { public void test(); } Below is the implementation @Service public class AsyncImpl implements AsyncInterface { @Async public void test() { System.out.println( " This is seperate thread - let me sleep "); for ( int i = 0; i &lt; 10 ; i ++ ) { try { Thread.sleep(1000); }catch(Exception ex) { } } } } I am injecting the above implementation in another spring component and invoked the method annotated with @Async. I have &lt;task:annotation-driven/&gt; in my application-context. The @Async method is getting invoked sychronously and executes in the scope of the calling thread. The async behavior is not happening. If i add a custom annotation to the test() method and if I write an aspect to intercept , it works. For some reason, the AsyncExecutorIntercpetor is not getting triggered ( at least i could not see it in the logs ) . Am I missing somethig here . Cant @Async be invoked from another spring component? Thanks Lives This is how I am calling the async I am calling Async from another spring @Service component @Component public class MyComponentImpl implements ComponentInterface { @Autowired private AsyncInterface asyncInterface; @Override public void testAsyncInvocation() { logger.debug( " Before calling async "); asyncInterface.test(); logger.debug( " After calling async "); } } Configuration &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;beans xmlns="http://www.springframework.org/schema/beans" xmlns:p="http://www.springframework.org/schema/p" xmlns:context="http://www.springframework.org/schema/context" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:task="http://www.springframework.org/schema/task" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.spr…
answer count: 0

command
tags question: http://stackoverflow.com/q/23356731
tags question: http://stackoverflow.com/q/23449598
tag name: command
tags question: http://stackoverflow.com/q/23413743
tags question: http://stackoverflow.com/q/23425777
type: Tag

http://stackoverflow.com/comment/35781049
has text: yes its like this 91 India 91 India
type: AnswerComment
comment on: http://stackoverflow.com/a/23361738
score: 0
type: Comment

cocos2d-android
type: Tag
tags question: http://stackoverflow.com/q/23383160
tag name: cocos2d-android

http://stackoverflow.com/comment/35950785
comment on: http://stackoverflow.com/a/23452329
type: AnswerComment
score: 0
type: Comment
has text: You can convert it to use array.

http://stackoverflow.com/a/23389032
downvote count: 2
has body: How can I know where all the threads are finished? If I use a counter inside invokeLater I think I will I run into race conditions.. not possible because this is endless loop without break; So what is the right way to do it? JProgressBar has range from zero to 100 in API, just to test if value in loop is 100 or greather, then to use break; use Runnable#Thread instead of plain vanilla Thread for example (the same output should be from SwingWorker, but there are is used more than 12 instances, AFAIK note there was a bug about overloading number of..., but for purpose as code for forum is possible to create similair code by using SwingWorker) import java.awt.Component; import java.util.Random; import javax.swing.JFrame; import javax.swing.JProgressBar; import javax.swing.JScrollPane; import javax.swing.JTable; import javax.swing.SwingUtilities; import javax.swing.table.DefaultTableModel; import javax.swing.table.TableCellRenderer; public class TableWithProgressBars { private static final int maximum = 100; private JFrame frame = new JFrame("Progressing"); Integer[] oneRow = {0, 0, 0, 0}; private String[] headers = {"One", "Two", "Three", "Four"}; private Integer[][] data = {oneRow, oneRow, oneRow, oneRow, oneRow,}; private DefaultTableModel model = new DefaultTableModel(data, headers); private JTable table = new JTable(model); public TableWithProgressBars() { table.setDefaultRenderer(Object.class, new ProgressRenderer(0, maximum)); table.setPreferredScrollableViewportSize(table.getPreferredSize()); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.add(new JScrollPane(table)); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); new Thread(new Runnable() { @Override public void run() { Object waiter = new Object(); synchronized (waiter) { int rows = model.getRowCount(); int columns = model.getColumnCount(); Random random = new Random(System.currentTimeMillis()); boolean done = false; while (!done) { int row = random.nextInt(rows); int colum…
has comment: http://stackoverflow.com/comment/35833326
has comment: http://stackoverflow.com/comment/35833082
has comment: http://stackoverflow.com/comment/35832805
score: -2
has comment: http://stackoverflow.com/comment/35832170
has comment: http://stackoverflow.com/comment/35832259
answers question: http://stackoverflow.com/q/23388221
has comment: http://stackoverflow.com/comment/35832819
upvote count: 0
has comment: http://stackoverflow.com/comment/35946315
has comment: http://stackoverflow.com/comment/35832097
has comment: http://stackoverflow.com/comment/35832564
has comment: http://stackoverflow.com/comment/35833581
type: Answer
has comment: http://stackoverflow.com/comment/35832197
has comment: http://stackoverflow.com/comment/35832407

http://stackoverflow.com/a/23378319
type: Answer
answers question: http://stackoverflow.com/q/23377979
score: 0
accepted answer of: http://stackoverflow.com/q/23377979
type: AcceptedAnswer
has body: class Matches{ List&lt;MatchesCollection&gt; matchCollection=new ArrayList&lt;MatchesCollection&gt;(); //add getter and setter here } class MatchesCollection { private String _index; private Integer _id; //add getter and setter here } //add the objects you need to be retrieved Try to google about POJO Check this link for creating classes How to create a POJO?

http://stackoverflow.com/a/23429298
has comment: http://stackoverflow.com/comment/35908461
type: Answer
has body: Hi there your problem is that your while is not well done change this : while (!in.hasNextLine()) { in.nextLine(); } String entry= in.nextLine(); to : String entry = ""; while(entry.equals("")) { entry = in.nextLine(); } Don't forget to change it in both of your function ;) I just tried it and it's working for me ;) UPDATE * You can see your problem by adding : String entry= in.nextLine(); System.out.println("entry//" + entry+"//"); output = Enter a phrase you wish to encrypt: entry////
has comment: http://stackoverflow.com/comment/35907660
has comment: http://stackoverflow.com/comment/35907037
answers question: http://stackoverflow.com/q/23428896
score: 0
has comment: http://stackoverflow.com/comment/35907496

http://stackoverflow.com/comment/35918193
type: QuestionComment
score: 0
has text: Have you tried using the strings directly as opposed to referencing them? Not sure if it matters, just never done it like that :P
comment on: http://stackoverflow.com/q/23435182
type: Comment

http://stackoverflow.com/q/23341634
has answer: http://stackoverflow.com/a/23342094
tagged with: simple-framework
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
accepted answer: http://stackoverflow.com/a/23342094
type: Question
has title: Deserialiazing list of elements with @Text annotation in Simple
has body: I have two classes, Package and ModelRefObj. Package contains two sets of ModelRefObj. I'm using Simple framework to parse their instances from XML, so I've created some JUnit tests. I'm able to parse ModelRefObj XML, but I'm getting the following exception when trying to parse a Package: org.simpleframework.xml.core.ValueRequiredException: Empty value for @org.simpleframework.xml.Text(empty=, data=false, required=true) on field 'value' private java.lang.String cz.semanta.coc.domain.cognos.ModelRefObj.value in class cz.semanta.coc.domain.cognos.ModelRefObj at line 1 at org.simpleframework.xml.core.Composite.readInstance(Composite.java:580) at org.simpleframework.xml.core.Composite.readText(Composite.java:467) at org.simpleframework.xml.core.Composite.access$200(Composite.java:59) at org.simpleframework.xml.core.Composite$Builder.read(Composite.java:1381) ... Here is the XML I'm trying to parse: GO Sales (nalysis) [go_sales] [Filters and calculations].[Returns] [gosales].[BRANCH].[BRANCH_CODE] [gosales].[BRANCH].[ADDRESS1] [gosales].[BRANCH].[CITY] Here are my annotated classes: @Root(name = "package") public class Package { @Element private String name; @ElementList(name = "visible", entry = "refObj", type = ModelRefObj.class) private Set<ModelRefObj> visibleRefObjs; @ElementList(name = "hidden", entry = "refObj", type = ModelRefObj.class) private Set<ModelRefObj> hiddenRefObjs; Package() { } ... } @Root(name = "refObj") public class ModelRefObj { @Text private String value; ModelRefObj() { } public ModelRefObj(String value) { this.value = value; } ... }
downvote count: 0
answer count: 1
favorite count: 0

http://stackoverflow.com/a/23419015
upvote count: 3
has body: "I would like to be able to close on frame or the other without having to worry about both frames being closed." First of all you will want to take a look at The Use of Multiple JFrames, Good/Bad Practice?. Just to highlight, the majority of voters lean towards the "bad" side. That being said, you should consider the semantics of your frames. Namely opening another frame just for game instructions. This may seem reasonable, but if you understand modality, you will probably agree that for the use of a secondary frame for this scenario, a modal JDialog would be more suitable, as the the main game frame's interaction would be blocked, while the instruction dialog is open. See more at How to Make Dialogs Another option, if you didn't want to use two separate windows, would be to use a CardLayout. That would allow you to swap between views. So when the instructions are prompted, the game would move out of view, and the instructions into view. And vice versa. You can see more at How to use CardLayout. Also see a simple example here
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/23417749
score: 3

http://stackoverflow.com/q/23420113
has body: Being new to elastic search I have few questions on it related to best practices for closing Client and Node and in which situations we need to close them. I am using elasticsearch java api for it. public static Node elasticSearchNode = null; public static Client elasticSearchClient = null; I am declaring both node and client as static and in static get client method, I am checking that if its NULL then create new node or new client. So currently I am not closing Node and Client at any location in code. I am using same client in all locations like indexing documents as well as searching. Can you please tell me if its a right approach? or do I have to close them at some locations and where? Thanks in advance.
type: Question
tagged with: elasticsearch
tagged with: client
linked to: http://stackoverflow.com/q/23383544
tagged with: java
upvote count: 1
has title: When to close Client and Node in ElasticSearch?
has comment: http://stackoverflow.com/comment/35908562
type: UnansweredQuestion
answer count: 0
downvote count: 0
score: 1
favorite count: 0

http://stackoverflow.com/comment/35714925
type: Comment
type: QuestionComment
has text: This answer might help: (http://stackoverflow.com/questions/22881227/server-client-chat-program/22881978#22881978)
comment on: http://stackoverflow.com/q/23324009
score: 0

http://stackoverflow.com/comment/35809194
type: Comment
type: QuestionComment
has text: why are you de-compiling YOUR apk??
comment on: http://stackoverflow.com/q/23376498
score: 1

http://stackoverflow.com/comment/35824924
type: Comment
has text: What JSON Library/Framework do you use?
type: QuestionComment
comment on: http://stackoverflow.com/q/23385326
score: 0

http://stackoverflow.com/comment/35834488
type: QuestionComment
has text: @Mena please undelete your answer. It was basically correct, just don't read the group but the start index.
comment on: http://stackoverflow.com/q/23390612
score: 0
type: Comment

http://stackoverflow.com/comment/35930072
type: QuestionComment
type: Comment
has text: You don't have 6 GB for tomcat. You only have 1 GB allotted for Tomcat. Even then 30 Mb shouldn't bring the server down. You said you tried to upload the file and while reading it, the error was thrown. Are you sure the upload is successful? You're doing a `BufferedImages.copy`. do you have other images in that class? Can you get a heap dump on error? If you are using Oracle JDK, try these setting `-XX:HeapDumpPath=./java_pid<pid>.hprof and -XX:-HeapDumpOnOutOfMemoryError `
comment on: http://stackoverflow.com/q/23441692
score: 0

http://stackoverflow.com/q/23320338
has answer: http://stackoverflow.com/a/23809720
type: UnansweredQuestion
upvote count: 1
type: Question
score: 1
tagged with: java
tagged with: textarea
downvote count: 0
answer count: 1
favorite count: 0
has title: Show OutputStream(System.out) in text Area
has body: I use Channel.setOutputStream(System.out) and now I want to show the result in my textArea. How can I do that? Here is my code : public static void main(String[] args) throws JSchException, InterruptedException { JSch jSch = new JSch(); Session session = jSch.getSession(user , host , 22); session.setPassword(password); session.setConfig("StrictHostKeyChecking" , "no"); session.connect(10*1000); System.out.println("Connected"); Channel channel = session.openChannel("shell"); InputStream is = new ByteArrayInputStream(command.getBytes()); channel.setInputStream(is); channel.setOutputStream(System.out); channel.connect(15*1000); Thread.sleep(3*1000); channel.disconnect(); session.disconnect(); } Thanks.
has comment: http://stackoverflow.com/comment/35705296
tagged with: outputstream

http://stackoverflow.com/comment/35671287
score: 0
type: AnswerComment
type: Comment
has text: Thanks this works... However, how would I do this for multiple columns. i.e query += " SET Name = ?, Age =?"; I tried this and it doesn't work. Any ideas!
comment on: http://stackoverflow.com/a/23301415

http://stackoverflow.com/comment/35784559
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23363674
has text: The reason why I'm not using HashMap is that I want the A instances in B to be directly accesible by dot, e.g. B.a1 | But it seems I need to also implement that HashMap. Thanks

http://stackoverflow.com/q/23365869
has answer: http://stackoverflow.com/a/23367621
has comment: http://stackoverflow.com/comment/35790441
tagged with: exception
answer count: 5
has comment: http://stackoverflow.com/comment/35788733
has answer: http://stackoverflow.com/a/23365904
has answer: http://stackoverflow.com/a/23365936
type: AnsweredQuestion
has body: Assume the following function: public void close() throws SQLException { if (rs != null) { rs.close(); } if (ps != null) { ps.close(); } if (connection != null){ connection.close(); } } If I try to close rs and it fails, does the rest of my code still get executed (i.e. does the exception get thrown at the end), or does it immediatly interrupt the function (and thus prevent ps and connection from getting closed correctly).
has title: When is "throws Exception" thrown?
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/23365936
downvote count: 3
has comment: http://stackoverflow.com/comment/35790147
has answer: http://stackoverflow.com/a/23365939
type: Question
accepted answer: http://stackoverflow.com/a/23365904
upvote count: 4
has answer: http://stackoverflow.com/a/23365926
has comment: http://stackoverflow.com/comment/35794341
favorite count: 0

http://stackoverflow.com/q/23451341
type: Question
answer count: 1
tagged with: arrays
downvote count: 0
tagged with: sorting
accepted answer: http://stackoverflow.com/a/23451393
has body: How do you sort two custom array classes that have a parent/child relationship? The sorting needs to be based on a String variable that is in the parent class and the sorting has to happen for both classes without displaying the sorted values of one class then the sorted values of the other class. import java.util.Arrays; public class Store { // main method begins execution of program public static void main (String [] agrs) { //code... Book[] bk = new Book[3]; Movie[] movie = new Movie[2]; //code... } class Book implements Comparable&lt;Book&gt; { private String title; //code... @Override public int compareTo(Book o) { if(o == null) { return 1; } if (this == o) { return 0; } else { if(this.title != null &amp;&amp; o.title != null) { return this.title.compareTo(o.title); } else if(this.title != null) { return 1; } else { return -1; }}}} class Movie extends Book { private String diskType; How would you sort these two classes at the same time so that they both would be displayed alphabetically based on the title variable in the Book class?
has title: how to merge custom class arrays in java to be sorted
favorite count: 0
upvote count: 1
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23451393
score: 1
tagged with: java

http://stackoverflow.com/a/63890915
type: Answer
has body: In case you are facing this issue recently you should note the following: If you are using servlet 3.0+ and tomcat > 7.0.43 or Tomcat 8 there are no configuration needed, you just have to provide the correct maven dependencies to make log4j2 aware of running in a webcontainer like the following (in addition we use slf4j): org.slf4j slf4j-api 1.7.30 org.apache.logging.log4j log4j-api 2.11.0 org.apache.logging.log4j log4j-core 2.11.0 org.apache.logging.log4j log4j-web 2.11.0 org.apache.logging.log4j log4j-slf4j-impl 2.11.0 Since in our case the log4j-web artifact was missing we faced the same warning which said "... started a thread named [AsyncAppender-AsyncFile] but has failed to stop it ..." After providing the mentioned dependencies the warning is gone. you can read more about requirements here
score: 3
downvote count: 0
answers question: http://stackoverflow.com/q/23359668
upvote count: 3

http://stackoverflow.com/q/23396157
tagged with: one-to-many
has comment: http://stackoverflow.com/comment/35845141
type: UnansweredQuestion
has body: I am trying to create a one to many relationship using two classes - Producer and Product. The relationship between classes is simple: A producer produces many products, each product is produced by a single producer. The class structure is like this: public class Producer{ private int producerID; private String producerName; private String producerAddress; // private ArrayList&lt;Product&gt; products; // shall I do this? } public class Product{ private int productID; private String productName; // private int producerID; // or shall I do this instead? } I was wondering how can I create such a relationship using these classes. Shall I just hold producerID as a property of the Product class, or shall I create a list of Products and every time I create a product, just add it to product list in the Producer class? In terms of databases, it is a simple relationship, but how can I achieve this in Java? Can you please shed some light on pros and cons of both approaches?
tagged with: java
type: Question
has title: How to achieve a producer-product relationship
has comment: http://stackoverflow.com/comment/35845472
tagged with: data-structures
has answer: http://stackoverflow.com/a/23396246
score: 0
has comment: http://stackoverflow.com/comment/35849065
has comment: http://stackoverflow.com/comment/35845213
answer count: 1

http://stackoverflow.com/a/23404603
has comment: http://stackoverflow.com/comment/35862053
score: 0
has comment: http://stackoverflow.com/comment/35861438
has comment: http://stackoverflow.com/comment/35860995
answers question: http://stackoverflow.com/q/23404517
type: Answer
has body: One important rule of overriding... The argument list should be exactly the same as that of the overridden method. refer for other rules http://www.tutorialspoint.com/java/java_overriding.htm Alternatively you can use overloading. Something like the code below, can be present in the subclass void test(Object data) { // some logic here super.test(data); } I dont know what your requirements are, but I would probably make the super class method "parameterized" so that sub classes can provide concrete implementations. ==================== EDITED ===================================== I dont know your usecase. But based on the post, following is the solution that I could think of. Please check if this works. abstract class baseClass&lt;T&gt;{ public abstract void serialize(T... data); } class subClass1 extends baseClass &lt;String&gt;{ @Override public void serialize(String... data) { if(data.length&gt;1)throw new IllegalArgumentException("Accepts only single string"); } } class subClass2 extends baseClass&lt;Integer&gt;{ @Override public void serialize(Integer... data) { } } public static void main(String[] args) { baseClass&lt;String&gt; sc1 = new subClass1(); sc1.serialize("test"); baseClass&lt;Integer&gt; sc2 = new subClass2(); sc2.serialize(1,2); }

http://stackoverflow.com/q/23414150
downvote count: 0
has answer: http://stackoverflow.com/a/62144056
favorite count: 0
type: Question
has title: How to find broken links using Selenium WebDriver with Java
tagged with: selenium-webdriver
answer count: 6
score: 4
has answer: http://stackoverflow.com/a/68740709
tagged with: selenium
has body: I want to verify broken links on a website and I am using this code: public static int invalidLink; String currentLink; String temp; public static void main(String[] args) throws IOException { // Launch The Browser WebDriver driver = new FirefoxDriver(); // Enter URL driver.get("http://www.applicoinc.com"); // Get all the links URL List&lt;WebElement&gt; ele = driver.findElements(By.tagName("a")); System.out.println("size:" + ele.size()); boolean isValid = false; for (int i = 0; i &lt; ele.size(); i++) { isValid = getResponseCode(ele.get(i).getAttribute("href")); if (isValid) { System.out.println("ValidLinks:" + ele.get(i).getAttribute("href")); driver.get(ele.get(i).getAttribute("href")); List&lt;WebElement&gt; ele1 = driver.findElements(By.tagName("a")); System.out.println("InsideSize:" + ele1.size()); for (int j=0; j&lt;ele1.size(); j++){ isValid = getResponseCode(ele.get(j).getAttribute("href")); if (isValid) { System.out.println("ValidLinks:" + ele.get(j).getAttribute("href")); } else{ System.out.println("InvalidLinks:"+ ele.get(j).getAttribute("href")); } } } else { System.out.println("InvalidLinks:" + ele.get(i).getAttribute("href")); } } } } public static boolean getResponseCode(String urlString) { boolean isValid = false; try { URL u = new URL(urlString); HttpURLConnection h = (HttpURLConnection) u.openConnection(); h.setRequestMethod("GET"); h.connect(); System.out.println(h.getResponseCode()); if (h.getResponseCode() != 404) { isValid = true; } } catch (Exception e) { } return isValid; } }
has answer: http://stackoverflow.com/a/23416253
has answer: http://stackoverflow.com/a/23415165
has comment: http://stackoverflow.com/comment/51424010
has answer: http://stackoverflow.com/a/60669606
tagged with: java
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/40976811
upvote count: 4

http://stackoverflow.com/q/23432549
favorite count: 0
upvote count: 2
type: UnansweredQuestion
tagged with: swing
tagged with: ioexception
tagged with: java
type: Question
tagged with: jtextarea
has title: Swing text components fail to paste large text data from clipboard: java.io.IOException: Owner failed to convert data
downvote count: 0
tagged with: exception
score: 2
has answer: http://stackoverflow.com/a/23432768
has body: I am working with a JTextArea directly and via JTextComponent interface attempting to paste text data from outside the swing-based app (notepad) into the app. Using two different methods (shown below) I seem to be getting the same result for large amounts of text data. It works fine as long as I stick to small amounts (&lt;25k) but pasting in a white-list of domains around 1.5MB seems to cause the IOException. I have seen a number of articles for various apps around the net referring to it being a bug in the 1.6 JVM. I'm currently using jdk1.7.0_25 and I'm wondering if anyone knows a resolution or workaround??? I'm also open to the possibility that I'm going about this thing the wrong way entirely... code: @Override public void actionPerformed(ActionEvent ae) { String cmd = ae.getActionCommand(); log.debug("Running {}",cmd); if (cmd.equals("copy")){ this.component.copy(); } else if (cmd.equals("paste")){ // Simple paste -- but large data doesnt paste this.component.paste(); } else { log.warn("No handler for {}", cmd); } } also tried: Clipboard c = Toolkit.getDefaultToolkit().getSystemClipboard(); Transferable t = c.getContents(this); if (t == null) return; try { component.setText((String) t.getTransferData(DataFlavor.stringFlavor)); } catch (Exception e){ e.printStackTrace(); } Exception: 11:35:21.030 [AWT-EventQueue-0] DEBUG c.a.y.a.c.e.CopyPasteMouseListener - Running paste java.io.IOException: Owner failed to convert data at sun.awt.X11.XSelection.validateDataGetter(XSelection.java:444) at sun.awt.X11.XSelection.getData(XSelection.java:378) at sun.awt.X11.XClipboard.getClipboardData(XClipboard.java:120) at sun.awt.datatransfer.ClipboardTransferable.fetchOneFlavor(ClipboardTransferable.java:118) at sun.awt.datatransfer.ClipboardTransferable.(ClipboardTransferable.java:97) at sun.awt.X11.XClipboard.getContents(XClipboard.java:106) at com.adjuggler.yorick.ajentconsole.console.editors.CopyPasteMouseListener.actionPerformed(CopyPasteMouseListener.java:75) at javax.swi…
answer count: 1

http://stackoverflow.com/comment/35674117
type: QuestionComment
has text: @aruisdante Yeah, I didn't know how I could thin my question down without leaving important information out... but basically I don't want to write the type explicitly since it may be subject to change. The failure underneath would be relatively silent (written to a log, but that's about it) if I failed a cast.
score: 0
comment on: http://stackoverflow.com/q/23302335
type: Comment

http://stackoverflow.com/comment/45122751
score: 0
type: AnswerComment
has text: `IgnoreTextAndAttributeValuesDifferenceListener` ignores the content. Your difference is about the number of child nodes, not their content. The extra child node you see could be text nodes of "element content whitespace" which should vanish when you set `setIgnoreWhitespace(true)`. I don't see the difference when I paste your examples into a simple test after setting the property.
type: Comment
comment on: http://stackoverflow.com/a/23388243

http://stackoverflow.com/comment/35694453
comment on: http://stackoverflow.com/a/23314211
type: Comment
has text: Looks interesting. But what happened to `-4334.345345`, why is it changed?
score: 0
type: AnswerComment

http://stackoverflow.com/q/23445259
downvote count: 0
has answer: http://stackoverflow.com/a/23445297
has title: Can instance variable be declared as static variable in java
favorite count: 0
answer count: 3
accepted answer: http://stackoverflow.com/a/23445296
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23445292
upvote count: 2
has answer: http://stackoverflow.com/a/23445296
has comment: http://stackoverflow.com/comment/35936516
type: Question
tagged with: java
has body: I wrote the following code: public class Count { private static int[] array; public Count( int[] array ) { this.array = array; } public int count() { int count = 0; for (int i = 0; i &lt; array.length; i++) { int x = array[i]; if (x &lt; 0) { if (x == -1 &amp;&amp; i &gt; 0 &amp;&amp; array[i - 1] == -1) { break; } } else { count++; } } return count; } } and then in another class I wrote: Count c = new Count(new int[]{1,-1,-1}); and checked the result of c.count(). I didn't get a compiler error,and I got 1 as I wanted. I wonder why because how can I assign a static variable to an instance variable? And also, what happens if I create another instance of class Count? Will they both have the same variable?or just their own copy of it? and what should happen if I try to access the variable by writing Count.array? Thanks.
possible better answer: http://stackoverflow.com/a/23445292

http://stackoverflow.com/comment/35902646
type: Comment
has text: You can't have code after a return. There is no way it would execute.
comment on: http://stackoverflow.com/q/23427136
score: 0
type: QuestionComment

http://stackoverflow.com/q/23424348
tagged with: audio
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/23424546
has body: I am recording sound from mic using audio recorder. recoChunk byte[] store raw recording as shown below. while (isRecording == true) { Log.w("myMsg", "recording.."); recoChunk = new byte[minBuffSize]; audioRecord.read(recoChunk, 0, minBuffSize); mFosRaw.write(recoChunk); } now from recoChunk I want to find largest amplitude recorded how can I do that?
type: Question
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/35898231
accepted answer: http://stackoverflow.com/a/23424546
tagged with: android
has title: How to extract amplitude from byte array in android?
score: 1
upvote count: 1

import
type: Tag
tags question: http://stackoverflow.com/q/23357762
tag name: import
tags question: http://stackoverflow.com/q/23399719
tags question: http://stackoverflow.com/q/23337152
tags question: http://stackoverflow.com/q/23444878

http://stackoverflow.com/a/23344901
answers question: http://stackoverflow.com/q/23344725
has body: I suggest looking into a streaming XML parser; the use case for streaming APIs extends to reading files that are several 100s of GB which obviously cannot fit in memory. In Java, the StAX API is a (fairly large) evolution of native SAX APIs. Look through the tutorial here on parsing "on the fly": http://tutorials.jenkov.com/java-xml/stax.html
type: Answer
upvote count: 5
score: 5
downvote count: 0

http://stackoverflow.com/comment/35779507
has text: I posted the source code... can you help me @Ceiling
type: Comment
score: 0
comment on: http://stackoverflow.com/q/23359868
type: QuestionComment

http://stackoverflow.com/q/23385551
has body: I have a file of roughly the following shape: <?xml version="1.0" encoding="UTF-8"?> Then I am using JDOM 2.x with the following XPath query: //htmlFile is an input variable of type java.nio.Path Document document = xmlBuilder.build(htmlFile.toFile()); XPathFactory factory = XPathFactory.instance(); XPathExpression<Element> xpePages = factory.compile("//html/body/div[@class='ocr_page']", Filters.element()); List<Element> pages = xpePages.evaluate(document); But it is never able to find any elements, what am I doing wrong in query?
downvote count: 0
has title: XPathExpression to select from tesseract hOCR XML output
linked to: http://stackoverflow.com/q/6390339
possible better answer: http://stackoverflow.com/a/23385726
favorite count: 0
tagged with: xpath
has answer: http://stackoverflow.com/a/23385708
accepted answer: http://stackoverflow.com/a/23385708
tagged with: tesseract
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23385726
score: 3
upvote count: 3
tagged with: java
tagged with: jdom-2
type: Question
answer count: 2

jmeter
tags question: http://stackoverflow.com/q/23291528
tag name: jmeter
tags question: http://stackoverflow.com/q/23380523
tags question: http://stackoverflow.com/q/23397633
type: Tag

http://stackoverflow.com/a/23384708
answers question: http://stackoverflow.com/q/23384651
score: 2
has body: Your map is not using generics. Do this Map&lt;Integer, Integer&gt; map = new HashMap&lt;&gt;(); (assuming you have Java 7+) Map&lt;Integer, Integer&gt; map = new HashMap&lt;Integer, Integer&gt;(); (assuming you have Java 5+) When no using generics, the result of map.get() is Object which of course cannot be used with the + operator
downvote count: 0
type: Answer
upvote count: 2

http://stackoverflow.com/a/23425285
answers question: http://stackoverflow.com/q/23424996
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35899487
has comment: http://stackoverflow.com/comment/35899828
has comment: http://stackoverflow.com/comment/35899566
type: Answer
has body: It is not possible to use a dynamic Classname in a cast statement! And besides that it would not make much sense. At runtime Java knows of what type your object is, so there is no sens in casting it to that class. If you want your code to react differently to different subclasses then you can use the instance of construct: if (object instanceof MyClass) { MyClass myObject = (MyClass) object; //... } If you only want to know which class the object is from, you can get its classname like this: String className = object.getClass().getName(); EDIT: It is not necessary to cast to the subclass. As mentioned before Java already knows about the subclass. See: class A {} class B extends A {} public class Demo { public static void main(String[] args) { Object a = new A(); Object b = new B(); System.out.println(a.getClass().getName()); //prints A System.out.println(b.getClass().getName()); //prints B } }
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/35899607
accepted answer of: http://stackoverflow.com/q/23424996
has comment: http://stackoverflow.com/comment/35899578

http://stackoverflow.com/comment/35880129
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23414744
has text: @user3580294:OOps! yes Indeed.
score: 0

http://stackoverflow.com/a/23380764
upvote count: 3
type: Answer
downvote count: 1
accepted answer of: http://stackoverflow.com/q/23380625
has comment: http://stackoverflow.com/comment/35816470
answers question: http://stackoverflow.com/q/23380625
has comment: http://stackoverflow.com/comment/35816376
score: 2
has body: Make DongleManager to implement interface IDongle. public abstract class DongleManager implements IDongle { private boolean connected = false; public void setConnected(boolean status) { connected = status; } public boolean getConnected() { return connected; } }
type: AcceptedAnswer

http://stackoverflow.com/comment/35656830
type: AnswerComment
score: 0
type: Comment
has text: This isn't what Exceptions are for.
comment on: http://stackoverflow.com/a/23293843

http://stackoverflow.com/a/23301415
has comment: http://stackoverflow.com/comment/35671287
type: AcceptedAnswer
downvote count: 0
score: 4
type: Answer
accepted answer of: http://stackoverflow.com/q/23301338
answers question: http://stackoverflow.com/q/23301338
has body: Add spaces before 'SET' and 'WHERE', otherwise it will not work. String query = "UPDATE " + TableName; query += " SET Name = ?"; query += " , Age = ?"; query += " , Col1 = ?"; //And other cols query += " WHERE Person_ID = " + id; EDIT: Changed query to update multiple columns.
upvote count: 4

http://stackoverflow.com/comment/35849365
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23397614
has text: I used to have it this way before but then i get this error: `The persistence-context-ref-name [org.springframework.data.jpa.repository.support.JpaRepositoryFactoryBean/entityManager] in module [p2groep04-javaweb] resolves to a persistence unit called [myPersistenceUnit] which is of type RESOURCE_LOCAL. Only persistence units with transaction type JTA can be used as a container managed entity manager. Please verify your application.`

http://stackoverflow.com/a/35479445
type: Answer
has body: Try adding correct layouts at correct place like ex. in my case I was putting colors.xml in values-w820p then it was giving runtime exception of classtype. I changed the folder from this to simple value and... taddda!! it worked! :)
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/23424040
downvote count: 0

http://stackoverflow.com/comment/35888582
has text: I only provided 2 examples from a list of aprox 30.000 files. Things are random. From that random list of files, i need to figure out how the files can be grouped together.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23417783

http://stackoverflow.com/a/23361853
upvote count: 78
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/115654800
has body: The DOM is a strange beast, the API is defined in a language-independent way by the W3C and then mapped into various different programming languages, so Java can't add anything Java-specific to the core DOM interfaces that wasn't part of the DOM spec in the first place. So while you can't use a NodeList as a stream, you can easily create a stream from a NodeList, using e.g. Stream&lt;Node&gt; nodeStream = IntStream.range(0, nodeList.getLength()) .mapToObj(nodeList::item); However, there is one big caveat - a DOM NodeList is live, and reflects changes to the original DOM tree since the list was created. If you add or remove elements in the DOM tree they may magically appear or disappear from existing NodeLists, and this may cause strange effects if this happens mid-iteration. If you want a "dead" node list you'll need to copy it into an array or list, as you are doing already.
accepted answer of: http://stackoverflow.com/q/23360278
answers question: http://stackoverflow.com/q/23360278
score: 78

http://stackoverflow.com/a/23333638
downvote count: 0
has comment: http://stackoverflow.com/comment/35730349
has comment: http://stackoverflow.com/comment/35730156
has comment: http://stackoverflow.com/comment/35730292
has comment: http://stackoverflow.com/comment/35730228
accepted answer of: http://stackoverflow.com/q/23333623
has body: The call to super must be the first statement in the constructor body. From section 8.8.7 of the JLS: The first statement of a constructor body may be an explicit invocation of another constructor of the same class or of the direct superclass (§8.8.7.1). You just need to inline the calls: public Child(String url) { super(getHostFromUrl(url), getPathFromUrl(url), getPortFromUrl(url)); } Alternatively, parse once to some cleaner representation of the URL, and call another constructor in the same class: public Child(String url) { this(new URL(url)); } // Or public, of course private Child(URL url) { super(url.getHost(), url.getPath(), url.getPort()); } (I haven't checked whether those members would work for java.net.URL - this is more by way of an approach than the details. Adjust according to your actual requirements.)
type: Answer
has comment: http://stackoverflow.com/comment/35730399
has comment: http://stackoverflow.com/comment/35730361
score: 12
upvote count: 12
answers question: http://stackoverflow.com/q/23333623
type: AcceptedAnswer

http://stackoverflow.com/a/23365895
answers question: http://stackoverflow.com/q/23353523
type: Answer
has body: locMan.getLastKnownLocation(LocationManager.GPS_PROVIDER); is returning null, which is why you're getting the NullPointerException. Any Context should work in retrieving the LocationManager. getLastKnownLocation(LocationManager.GPS_PROVIDER) may return null if GPS hasn't been used in the recent past (especially since last reboot). If a slightly less accurate location (e.g., cell tower level) is acceptable for your application, a better approach is to loop through all LocationProviders and find a non-null location: public static Location getLocation2(Context cxt) { LocationManager mgr = (LocationManager) cxt.getSystemService(Context.LOCATION_SERVICE); List&lt;String&gt; providers = mgr.getProviders(true); Location last = null; for (Iterator&lt;String&gt; i = providers.iterator(); i.hasNext(); ) { Location loc = mgr.getLastKnownLocation(i.next()); // If this provider has a last location, and either: // 1. We don't have a last location, // 2. Our last location is older than this location. if (loc != null &amp;&amp; (last == null || loc.getTime() &gt; last.getTime())) { last = loc; } } return last; } This will use give you the last known GPS position if it is available, and if not, you'll likely get a NETWORK_PROVIDER position. Note that in rare cases (on normal Android devices) all providers may return null. In this scenario, you'd need to register a LocationListener and wait for a new location to be provided. See https://stackoverflow.com/a/23224818/937715 for a full solution. Related - for code that takes into consideration the accuracy of each position from each provider, see https://stackoverflow.com/a/21364664/937715. One final note - you may want to consider using the new(er) fused location provider that is part of Google Play Services, which in my experience is better about always providing a last known location. For sample code that gets the last known location using the fused location provider, see the "Retrieving the Current Location" example.
score: 0