http://stackoverflow.com/comment/35474171
has text: repaint() method was what I was missing. Thanks! As for the timer suggestions, why are they better? I tried doing that change (I just had the timer actionlistener call my update() method) and it didn't seem any different. The way I do it now is from a game engine tutorial and it is by comparing the systemTimeMilliseconds to the last frame and if it is less than a threshold I sleep the thread for the difference. I have never run into that problem though, the game usually runs around 35fps (40 is my max). What's the benefit?
type: Comment
comment on: http://stackoverflow.com/a/23190759
score: 0
type: AnswerComment

http://stackoverflow.com/comment/35631934
type: Comment
comment on: http://stackoverflow.com/a/23278726
type: AnswerComment
score: 0
has text: @Mani Accessing big blocks of memory randomly does cause programs to run much slower than accessing sequentially and/or locally. Read up on "memory hierarchy". Modern memory functions orders of magnitude faster when access is local and/or sequential.

http://stackoverflow.com/comment/35540282
comment on: http://stackoverflow.com/q/23229810
has text: what is in `/opt/jdk/`? It looks like it `/opt/jdk/bin/java` isn't the Java executable
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23284998
tagged with: java
has body: I'm using Rhino to parse a javascript object into my Java application and I wish to understand about the behavior of the get method of the Scriptable object. My javascript object is similar to this: Obj = {}; Obj['001'] = 'First Content'; Obj['100A'] = 'Second Content'; Obj['100'] = 'Third Content'; As it is stated in the documentation, I should be using the signature that takes an integer and the Scriptable start. JavaScript code | Java code a[3] | a.get(3, a) a["3"] | a.get(3, a) My question is this: Why the signature that takes the String argument cant match the numeric string? Is my solution correct or there would be a way to just use the (String name, Scriptable start) signature? // Scriptable scope already defined // id is an object from scope.getIds() Scriptable content; if(id instanceof Integer) { content = scope.get((Integer) id, scope); } else { content = scope.get((String) id, scope); } Thank You Rhino 1.7R2
type: Question
has answer: http://stackoverflow.com/a/23342014
tagged with: javascript
accepted answer: http://stackoverflow.com/a/23342014
answer count: 1
has title: Rhino - Scriptable method: Object get (String name, Scriptable start) not finding the correct key (numeric string)
type: AnsweredQuestion
tagged with: rhino
score: 0

http://stackoverflow.com/q/23285294
has comment: http://stackoverflow.com/comment/35641868
score: 0
accepted answer: http://stackoverflow.com/a/23285456
answer count: 1
has comment: http://stackoverflow.com/comment/35641900
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23285456
tagged with: java
has body: public void savemap (File file) { 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(); } /* get the selected file */ try { /* save the current TSP */ FileWriter writer = new FileWriter(file); writer.write(); writer.close(); } catch (IOException e) { String msg = e.getMessage(); this.stat.setText(msg); System.err.println(msg); JOptionPane.showMessageDialog(this, msg, "Error", JOptionPane.ERROR_MESSAGE); } /* set the status text */ this.curr = file; /* note the new file name */ } Edited try { int rows = 50; int columns = 50; Cell [][] cellArray = new Cell[columns][rows]; FileOutputStream fout = new FileOutputStream(FILE_PATH); ObjectOutputStream oos = new ObjectOutputStream(fout); oos.writeObject(cellArray); } //This is what i changed the code. Is it correct? However i have an error at (FILE_PATH) FILE_PATH cannot be resolved to a variable
has comment: http://stackoverflow.com/comment/35641907
type: Question
has comment: http://stackoverflow.com/comment/35641869
has title: I want to save an Arraylist of objects into a file.Can Someone help me with this?

http://stackoverflow.com/q/23211050
tagged with: mysql
upvote count: 1
has body: I am new to java programming and need help with calling a java method from another jform class. I basically need to connect the second jform named Prizes.java to the MySQL database and call a method(maybe the Fillforms?) so that the same row of data in the MySQL table is edited(controlled by "ID"). I tired to set a return value on Fillforms but it appears it will not work with a try method. So I'm not sure if I need to make a new method or can I change the one I have? Tickets.java package Tickets; import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; import java.sql.Statement; import java.sql.ResultSet; import javax.swing.JOptionPane; import java.sql.*; public class Tickets extends javax.swing.JFrame { Connection con; Statement stmt; ResultSet rs; int curRow = 0; public Tickets() { initComponents(); DoConnect(); } public void DoConnect( ) { String url = "jdbc:mysql://&amp;&amp;.&amp;&amp;.&amp;&amp;.&amp;&amp;&amp;:3306/"; String dbName = "pos"; String driver = "com.mysql.jdbc.Driver"; String userName = "Switcher"; String password = "*****"; try { Class.forName(driver).newInstance(); con = DriverManager.getConnection(url+dbName,userName,password); //conn.close(); stmt = con.createStatement( ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE ); String sql = "SELECT * FROM instock"; rs = stmt.executeQuery(sql); rs.next(); Fillforms(); } catch (Exception e) { e.printStackTrace(); } } public void Fillforms(){ int id_col = 0; try{ id_col = rs.getInt("ID"); String id = Integer.toString( id_col ); String game_name = rs.getString("Game"); String mf_id = rs.getString("MF_ID"); String dist_id = rs.getString("Dist_ID"); String part_no = rs.getString("Part_No"); String game_type = rs.getString("Game_Type"); String inv_num = rs.getString("Invoice_num"); String date_purch = rs.getString("Date_purch"); String date_placed = rs.getString("Date_placed"); String date_removed = rs.getString("Date_removed"); String inplay = rs.getString("Inp…
type: Question
downvote count: 0
score: 1
favorite count: 0
type: UnansweredQuestion
tagged with: swing
has title: Move variable from one jform to another
answer count: 0
tagged with: java

http://stackoverflow.com/comment/35663227
score: 0
has text: @yitzih thank you it seems that it is the only option, but I was searching a more effective way.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23289216

http://stackoverflow.com/a/23207356
has body: In addition to the other answers provided, you could use a standard library StopWatch, like the one provided by Google's Guava API: Stopwatch stopwatch = new Stopwatch(); stopwatch.start(); calculate(); stopwatch.stop(); // optional long Seconds= stopwatch.elapsedMillis() / 1000000; // equals 1 second
upvote count: 1
answers question: http://stackoverflow.com/q/23207093
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/q/23265986
tagged with: http://stackoverflow.com/tag/json
type: Question
has title: Spring webservice won't read JSON
answer count: 1
has answer: http://stackoverflow.com/a/23266191
has body: As editing a question didn't seem to bump it up for more answers, I'll continue asking in a new thread. The thing is that I'm trying to set up a very basic web-service with Spring, to which I should be able to send JSON through Java. But I'm very new to Spring, and web-services in general, so I don't know where to troubleshoot. Old question: Getting a RESTful webservice with Spring to understand a JSON-string Right now I have this in my controller @RequestMapping(value = "/toggleB") public @ResponseBody String sendCommand(@RequestBody Ident ident) { //body } The Ident-class just has a String as variable, called IP. Sending this String {"IP":"192.168.1.9"} Gives the return code 400. Thing is, I think there might be something wrong, or missing, in the build.gradle (or pom.xml). How is a correct Gradle/Spring project supposed to be organized as? My main method is runnable, and looks like this: import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.SpringApplication; import org.springframework.context.annotation.ComponentScan; @ComponentScan @EnableAutoConfiguration public class mainFile { public static void main(String[] args) { SpringApplication.run(mainFile.class, args); } } I don't use any beans as configuration, might that be what fails my program? Thanks again for replies! I hope I'm not breaking the rules by continuing my question like this, but I didn't know how to bump the old one up. Ah... The disadvantages of being completely new to a site, heh.
accepted answer: http://stackoverflow.com/a/23266191
has comment: http://stackoverflow.com/comment/35605368
score: 0
upvote count: 1
downvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/35608256
tagged with: spring
linked to: http://stackoverflow.com/q/23219344
tagged with: spring-mvc
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/35468775
score: 0
type: Comment
type: QuestionComment
has text: the im variable is `im = new ImageManager(ss);` which is what is responsible for cutting up my spritesheet
comment on: http://stackoverflow.com/q/23188801

http://stackoverflow.com/a/23173047
has body: if I get it right, you're trying to check the itemnumber == rightand when true, move on to the next step, otherwise go back to 1, maybe you can add a while loop to achieve it. public void runProcedure(){ try { int step = 1; while(step != 4) { switch(step){ case 1: //run "verify operator" step = 2; break; case 2: //run "Ask operator for item number" if (itemnumber == right) { // program should just continue step = 3; } else { // I should run case 1 or 2 again. step = 1; } break; case 3: //run "Ask operator to verify item name" step = 4; break; default: //default } } }catch(Exception e) { } }
type: Answer
accepted answer of: http://stackoverflow.com/q/23172836
has comment: http://stackoverflow.com/comment/35439706
has comment: http://stackoverflow.com/comment/35439906
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35439448
answers question: http://stackoverflow.com/q/23172836

http://stackoverflow.com/comment/35413289
type: Comment
has text: And running as Maven Install via Eclipse
comment on: http://stackoverflow.com/a/23158336
score: 0
type: AnswerComment

http://stackoverflow.com/comment/35484424
has text: @pskink the child views inside the HorizontalScrollView is still getting the touch events. dispatchTouchEvent() is always returning true. Then why the child views are getting the events. Can you please check my code
comment on: http://stackoverflow.com/q/23187772
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23202298
has title: Saving "master" element in many to one relationship with ebean
has body: I am having a little issue with Ebean (in the context of Play Framework, Java). I have elements sharing a one-to-many relationship (BankAccount &lt;- BankingOperation). I have defined the BankAccount class with, among others, the following fields: @JsonIgnore @OneToMany(cascade = CascadeType.ALL) public List&lt;BankingOperation&gt; operations = new ArrayList&lt;BankingOperation&gt;(); For the Banking operation, the corresponding field: @ManyToOne @JsonIgnore public BankAccount bankAccount; My issue is that when I try to update the bank account, it deletes the related operations. Here's the code I am using: public static Result saveAccount(Long id) { Form&lt;BankAccount&gt; form = Form.form(BankAccount.class).bindFromRequest(); if (form.hasErrors() || form.get().id != id) { return badRequest(); } form.get().update(id); return ok(); } I have the feeling that operations are deleted because they aren't loaded when I do the form().get(), and thus, when synchronizing with the DB, Ebean does what seems to be the best solution to it. Would anyone have any clue on this issue? Is there another solution that I haven't discovered yet? Thanks in advance for your help!
type: UnansweredQuestion
type: Question
tagged with: java
tagged with: playframework
answer count: 1
has answer: http://stackoverflow.com/a/23202299
score: 0
tagged with: ebean

http://stackoverflow.com/q/23281206
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/35634548
has comment: http://stackoverflow.com/comment/35634571
type: UnansweredQuestion
has title: How to display newly sorted integers?
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/23281327
type: Question
has comment: http://stackoverflow.com/comment/35634633
has answer: http://stackoverflow.com/a/23281325
tagged with: sorting
answer count: 2
downvote count: 0
has body: I am doing a project in which the user enters a number, x ,it will then generate x amount of random numbers and add them to an arraylist. In one text field, it will display however many random integers are in the array, I then have to make it so in another textfield, it sorts those numbers through a selection sorting. I'm pretty sure I have the code for it right, I'm just not sure how to get the sorted numbers to display on the text field #2. Heres what I have: ArrayList &lt;Integer&gt; Numbers = new ArrayList &lt;Integer&gt;(); .... String input; int int1,int2 = 0, min = -1000, max = 1000,j, maximum; input = Input.getText(); int1 = Integer.parseInt(input); Random number = new Random(); while(int2 &lt; int1){ for (int i = 0; i &lt; int1; i++){ int randomInt = number.nextInt(max - min + 1) + min; Numbers.add(randomInt); int1--; } } if(Selection.isSelected() &amp;&amp; Ascending.isSelected()){ for (int i = 0; i&lt;Numbers.size()-1; i++){ maximum = i; for(j = i+1; j&lt;=Numbers.size()-1;j++){ if(j &lt; i){ int temp = i; i = j; j = temp; } } } } Output1.setText("Unsorted Numbers " + Numbers); Output2.setText("Sorted Numbers " + //what here? ); Numbers.clear(); Thanks for any help you might be able to offer.

http://stackoverflow.com/comment/35477507
has text: I had read that, but how can i use a listview to display grid data? I mean how can I manage displaying those columns?
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23195056

http://stackoverflow.com/comment/35577370
score: 0
type: AnswerComment
type: Comment
has text: @user3460769 Oh right because you're doing it in main, forgot about that. Mine was a separate class that I'd instantiate. Anywho, that's fine. Just don't make everything static when you're dealing with actual instances and such. :)
comment on: http://stackoverflow.com/a/23250089

http://stackoverflow.com/comment/35540647
type: AnswerComment
has text: That means group of one or more characters, any characters except `.`. And that group should be preceded by a `@` and followed by a `.`.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23229511

http://stackoverflow.com/q/23259318
tagged with: comparator
favorite count: 0
possible better answer: http://stackoverflow.com/a/23259339
has comment: http://stackoverflow.com/comment/35628003
score: 6
tagged with: java-8
type: AnsweredQuestion
has title: Maximum of Stream with custom Comparator
tagged with: java-stream
downvote count: 0
has comment: http://stackoverflow.com/comment/35637476
tagged with: java
has comment: http://stackoverflow.com/comment/35629622
has answer: http://stackoverflow.com/a/23259339
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/23261175
accepted answer: http://stackoverflow.com/a/23261175
tagged with: max
upvote count: 6
has body: Below is my code written specifically to use custom Comparator with max in Java 8 Stream. import java.math.BigDecimal; import java.util.*; public class BigDecimalMax { public static BigDecimal getBigDecimalMax(List&lt;forTest&gt; list) { return list.stream() .filter(t -&gt; t.id % 2 == 0) .max(forTestComparator::compare) //&lt;-- syntax error ---------- .orElse(null); } public static class forTestComparator implements Comparator&lt;forTest&gt; { @Override public int compare(forTest val1, forTest val2) { return val1.value.compareTo(val2.value); } } public static void main(String[] args) { List&lt;forTest&gt; lst = new ArrayList&lt;&gt;(); Random rn = new Random(); BigDecimalMax bdm = new BigDecimalMax(); for (int i=1; i&lt;22; ++i) { lst.add(bdm.new forTest(i, BigDecimal.valueOf(rn.nextLong()))); } System.out.println(getBigDecimalMax(lst)); } class forTest { public int id; public BigDecimal value; forTest(int id, BigDecimal value) { this.id = id; this.value = value; } @Override public String toString() { return "forTest{" + "id=" + id + ", value=" + value + '}'; } } } I'm getting a syntax error on a method reference which I don't understand. Error:(15, 18) java: incompatible types: invalid method reference cannot find symbol symbol: method compare(BigDecimalMax.forTest, BigDecimalMax.forTest) location: class BigDecimalMax.forTestComparator while IntelliJ IDEA complains that Non-static method cannot be referenced from a static context. What exactly am I doing wrong here? ADDITIONAL EXPLANATION (04/24/14): I understand now the reason for the syntax error. Thank you. Was custom Comparator actually needed here? Since BigDecimal implements Comparable but does not seem to implement Comparator ( it has CompareTo() but no Compare()) I thought that custom Comparator was necessary. That's why I could not just use Comparator.comparing(ft -&gt; ft.value). Is there a flaw in my logic?

http://stackoverflow.com/q/23283365
has comment: http://stackoverflow.com/comment/35638551
accepted answer: http://stackoverflow.com/a/23283433
type: AnsweredQuestion
tagged with: android-fragments
tagged with: java
has body: 1.This ListView Adapter is integrate on fragment public class ListViewAdapter extends BaseAdapter { // Declare Variables Context context; LayoutInflater inflater; ArrayList&lt;HashMap&lt;String, String&gt;&gt; data; ImageLoader imageLoader; HashMap&lt;String, String&gt; resultp = new HashMap&lt;String, String&gt;(); public ListViewAdapter(NewsFragment newsFragment, ArrayList&lt;HashMap&lt;String, String&gt;&gt; arraylist) { this.context = context; data = arraylist; imageLoader = new ImageLoader(context); } @Override public int getCount() { return data.size(); } @Override public Object getItem(int position) { return null; } @Override public long getItemId(int position) { return 0; } public View getView(final int position, View convertView, ViewGroup parent) { //protected void onActivityResult(int requestCode, int resultCode, Intent data) { // Declare Variables TextView productname; TextView productid; TextView producttype; ImageView image; here is the problems inflater = (LayoutInflater)convertView.getContext() .getSystemService(Context.LAYOUT_INFLATER_SERVICE); //inflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); enter code here View itemView = inflater.inflate(R.layout.listview_item, parent, false); // Get the position resultp = data.get(position); // Locate the TextViews in listview_item.xml productname = (TextView) itemView.findViewById(R.id.product); productid = (TextView) itemView.findViewById(R.id.dateOfInput); producttype = (TextView) itemView.findViewById(R.id.productprice); // Locate the ImageView in listview_item.xml image = (ImageView) itemView.findViewById(R.id.flag); // Capture position and set results to the TextViews productname.setText(resultp.get(NewsFragment.PRODUCTNAME)); productid.setText(resultp.get(NewsFragment.PRODUCTPRICE)); producttype.setText(resultp.get(NewsFragment.DATEOFINPUT)); // Capture position and set results to the ImageView // Passes flag images URL into ImageLoader.class imageLoader.DisplayImage…
type: Question
score: 0
has answer: http://stackoverflow.com/a/23283433
has comment: http://stackoverflow.com/comment/35638632
answer count: 1
has title: java.lang.NullPointerException ListViewAdapter.getView(ListViewAdapter.java:60) on fragment
tagged with: android

http://stackoverflow.com/comment/35381298
has text: Ok, so then I store the results in List<String> or something? Then I set the session variables in my servlet like this? : for (int i = 0; i < myList.length; i++) { session.setAttribute("sessionEducation" + i, myList.get[i]);} How do I make my JSP then to display this?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23139962
type: AnswerComment

http://stackoverflow.com/q/23175244
score: 0
answer count: 1
tagged with: modular
has comment: http://stackoverflow.com/comment/35443386
has comment: http://stackoverflow.com/comment/35443208
has comment: http://stackoverflow.com/comment/35443432
has title: Java Extend class based on object in constructor
tagged with: constructor
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/35443244
has body: What I would like to do is extend a class based on what is in the constructor. Is this possible? With my limited knowledge of java this would be the best example of what I'm trying to do. public class Test extends extendClass { Object extendClass; public Test(Object extendClass){ this.extendClass = extendClass; } } EDIT: What I would like is to have a sort of modular class that extends another class that is defined in the constructor I'm just using the constructor as an example. What I would be doing is running the code of the super class and then running mine as well. Also Object is just an example as well I know the class that I'm going to be extending.
tagged with: extend
type: Question
has answer: http://stackoverflow.com/a/23175314
tagged with: class
has comment: http://stackoverflow.com/comment/35443133

http://stackoverflow.com/a/23256083
accepted answer of: http://stackoverflow.com/q/23255860
type: Answer
has body: How about create an MenuItem and add the action then add to menu.. Sample: //Submenu subMenu = new JMenu("Paste"); menuOptions.add(SubMenu); JMenuItem cut = new JMenuItem(new DefaultEditorKit.CutAction()); JMenuItem copy = new JMenuItem(new DefaultEditorKit.CopyAction()); JMenuItem paste = new JMenuItem(new DefaultEditorKit.PasteAction()); subMenu .add(cut); paste.setText("Paste"); cut.setText("Cut"); copy.setText("Copy"); subMenu .add(copy); subMenu .add(paste); Also follow the Java convention for variable names
answers question: http://stackoverflow.com/q/23255860
upvote count: 5
has comment: http://stackoverflow.com/comment/35587681
score: 5
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/35821164
score: 1
answers question: http://stackoverflow.com/q/23136817
upvote count: 1
has comment: http://stackoverflow.com/comment/68608005
downvote count: 0
has body: public static int count7(int n){ if(n == 7) return 1; else if(n &gt; 9){ int a = count7(n%10); int b = count7(n/10); return a + b; }else return 0; }
type: Answer

http://stackoverflow.com/comment/35558641
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23238725
has text: The Thread in your `categoryshow()` method isn't finishing before you're initializing `mStrings`, so `arr` is still null. Declare `mStrings` as a member of the Activity class, set its values at the end of the Thread, and then call `notifyDataSetChanged()` on your Adapter.
score: 0

ehcache
tags question: http://stackoverflow.com/q/23201724
tags question: http://stackoverflow.com/q/23213728
tags question: http://stackoverflow.com/q/23197246
tags question: http://stackoverflow.com/q/23288522
tags question: http://stackoverflow.com/q/23174107
tag name: ehcache
tags question: http://stackoverflow.com/q/23241706
tags question: http://stackoverflow.com/q/23179574
tags question: http://stackoverflow.com/q/23245364
tags question: http://stackoverflow.com/q/23255397
type: Tag

http://stackoverflow.com/comment/35488742
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23200708
type: AnswerComment
has text: Thanks Nick. But error is not in that line. I'm trying to make the user (who is already the editor to the project) as Team member to the project. I got the team member name and the Project name. `JsonArray existTeamMemberships = (JsonArray) userQueryResponse.getResults().get(0).getAsJsonObject().get("TeamMemberships"); existTeamMemberships.add(projectObj);` has the error when trying to provide Team membership for the project. Could you please help?

jfreechart
type: Tag
tags question: http://stackoverflow.com/q/23174840
tags question: http://stackoverflow.com/q/23152867
tags question: http://stackoverflow.com/q/23193958
tags question: http://stackoverflow.com/q/23215280
tags question: http://stackoverflow.com/q/23242433
tags question: http://stackoverflow.com/q/23176784
tags question: http://stackoverflow.com/q/23275713
tag name: jfreechart
tags question: http://stackoverflow.com/q/23264922
tags question: http://stackoverflow.com/q/23175201

http://stackoverflow.com/comment/35435200
type: Comment
comment on: http://stackoverflow.com/a/23170631
type: AnswerComment
has text: Try this one `for (String s : list1){ if(s.equals("Hello")){ list1.remove(1); } }` You can't delete an item that is not processed yet or you can say whose index is greater than current running index of for-each loop.
score: 0

send
type: Tag
tags question: http://stackoverflow.com/q/23211764
tags question: http://stackoverflow.com/q/23225151
tag name: send

http://stackoverflow.com/comment/35495636
comment on: http://stackoverflow.com/a/23204882
score: 0
type: AnswerComment
type: Comment
has text: @Leon oh you make a really good point here. I just sort of assumed that every matrix will be a square one. Is it even possible to have a symmetric matrix that is not a square matrix ?

http://stackoverflow.com/comment/35572580
type: AnswerComment
type: Comment
has text: @Murilo yep Socket socket = new Socket(hostname, port);
comment on: http://stackoverflow.com/a/23248060
score: 1

http://stackoverflow.com/comment/35566073
score: 1
comment on: http://stackoverflow.com/q/23244571
type: QuestionComment
has text: "NetworkOnMainThreadException" probably you're running your network operation on the UI thread. Do it for example in an AsyncTask or anyway not on the main thread.
type: Comment

http://stackoverflow.com/comment/35567534
type: Comment
has text: don't. do. that. ever.
comment on: http://stackoverflow.com/a/23244706
type: AnswerComment
score: 0

http://stackoverflow.com/q/23145807
has comment: http://stackoverflow.com/comment/35391664
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23146107
has title: Write a method that takes an integer argument and returns the number of times that integer occurs in the list
upvote count: 0
tagged with: list
tagged with: linked-list
has comment: http://stackoverflow.com/comment/35391766
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/35392021
score: -1
has comment: http://stackoverflow.com/comment/35391713
answer count: 1
downvote count: 1
favorite count: 0
has body: I am complete new to Linked List in Java, and having trouble finding any help on this. Write a method that takes an integer argument and returns the number of times that integer occurs in the list public class LinkedList { private class Node { public int data; public Node next; public Node( int datum, Node n ) {data = datum; next = n;} } private Node head; // the head of the list LinkedList() { head = null; } }
has comment: http://stackoverflow.com/comment/35392011

http://stackoverflow.com/q/23134163
tagged with: tomcat7
type: Question
has title: Adding a image upload option to a form on a jsp page and adding to a MySQL database table
tagged with: java
tagged with: servlets
has body: I am using a JSP page to add information through tomcat to a MySQL database which is working. I would like to add a user profile picture upload function to the form. Can I save this image to the same database entry? How will do I go about adding a browse function to the form to select the image and persist it with the rest of the data? Form from My Jsp: Signup Details Name: Address: County: Telephone: Email: Password: Registration Servlet: protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { try{ System.out.println("In the registration Servlet"); User user = new User(); user.setName(request.getParameter("name")); user.setPassword(request.getParameter("password")); user.setEmail(request.getParameter("email")); user.setTelephone(request.getParameter("phone")); user.setCounty(request.getParameter("county")); user.setAddress1(request.getParameter("address1")); user.setAddress2(request.getParameter("address2")); RegisterUser.addUser(user); response.sendRedirect("Welcome.jsp"); } catch (Throwable exc) { System.out.println(exc); }
downvote count: 0
tagged with: jsp
favorite count: 0
type: UnansweredQuestion
score: 2
has comment: http://stackoverflow.com/comment/35370208
answer count: 0
upvote count: 2
has comment: http://stackoverflow.com/comment/44601784
tagged with: mysql

http://stackoverflow.com/comment/35388819
type: Comment
comment on: http://stackoverflow.com/a/23143282
type: AnswerComment
score: 0
has text: i have provided the complete working code. Check out the edit

http://stackoverflow.com/comment/35461095
comment on: http://stackoverflow.com/q/23185608
score: 0
type: Comment
type: QuestionComment
has text: @user3551586 It might be that the array has references to the same object. You can check that by printing default `toString()` of the objects inside array...

http://stackoverflow.com/a/23231384
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/23231215
downvote count: 0
score: 1
has body: public class MyExceptionClass extends Exception{ public MyExceptionClass() { super("Invalid Temperature!"); } } In your code you can throw the exception like this: ... public void myMethod() throws MyExceptionClass{ MyExceptionClass e = new MyExceptionClass(); throw e; }
has comment: http://stackoverflow.com/comment/35543206

http://stackoverflow.com/comment/35536706
type: Comment
has text: It's not really one way or the other it's a matter of opinion, you prefer it your way I the other. As I said it's a matter of preference.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23227612

http://stackoverflow.com/a/23284236
has body: You could make methods like someMethod() in the Main class static, or if that's not possible, make the Main class itself a singleton. Example of the former approach: public class Main { public Main() { Class2 class2 = new Class2(this); } public static void someMethod() { //Do something } } Now you don't have to pass an instance of Main around any more, because other classes can just call Main.someMethod() directly.
score: -2
has comment: http://stackoverflow.com/comment/35640050
has comment: http://stackoverflow.com/comment/35640003
answers question: http://stackoverflow.com/q/23284220
has comment: http://stackoverflow.com/comment/35639972
has comment: http://stackoverflow.com/comment/35640130
type: Answer
has comment: http://stackoverflow.com/comment/35639950
downvote count: 3
upvote count: 1

http://stackoverflow.com/q/23159915
tagged with: swing
has answer: http://stackoverflow.com/a/23160001
tagged with: java
linked to: http://stackoverflow.com/q/3256269
has title: Java, thread.sleep() blocks use of buttons (does not recognize button clicks)
type: Question
has comment: http://stackoverflow.com/comment/35416126
has answer: http://stackoverflow.com/a/23160113
score: 0
answer count: 3
has body: I'm writing a program that draws a train that moves across the screen. I'm using the graphics class with the fillRect, drawOval, and draw lines methods. I have a button that starts the train on the right hand side of the screen. After disappearing off screen, it should reappear with random y location and run again. This should loop until the stop button is clicked. The problem is I'm using the thread.sleep() method to pause the program before it updates the train's position. For some reason, I can't click any buttons while the program is running. Any ideas on how to make my stop button work? Thanks. Here's the code I am using. It also has the normal code that a JFrame form has in netbeans. private void btnStartTrainActionPerformed(java.awt.event.ActionEvent evt) { run = true; while (run) { Graphics g = jPanel1.getGraphics(); int x =0; int y = (int)(Math.random() *500) + 20; int smoke =1; for( x = 900; x &gt; -600; x--) { drawTrain(g, x, y, smoke); try { Thread.sleep(17); } catch (InterruptedException e) { e.printStackTrace(); } clearJFrame(g); smoke++; x = x-4; } if (x == -599) { x = 900; y = (int)(Math.random() *500) + 20; } } } private void btnStopTrainActionPerformed(java.awt.event.ActionEvent evt) { run = false; } public void drawTrain(Graphics g, int x, int y, int smoke) { // draw locomotive g.setColor(Color.RED); g.fillRect(x, y, 100, 30); g.fillRect(x +100, y-30, 40, 60); g.setColor(Color.BLACK); g.fillRect(x +110, y-20, 20, 10); g.drawLine(x +10, y, x, y-20); g.drawLine(x +11, y, x, y-20); g.drawLine(x, y-20, x +30, y-20); g.drawLine(x +30, y-20, x +20, y); g.drawLine(x +31, y-20, x +20, y); g.drawLine(x, y+30, x-20, y+25); g.drawLine(x-20, y+25, x-20, y+20); g.drawLine(x-20, y+20, x, y+15); g.drawOval(x +10, y+20, 25, 25); //draw wheels g.drawOval(x +35, y+20, 25, 25); g.drawOval(x +60, y+20, 25, 25); g.drawOval(x +85, y+20, 25, 25); g.drawOval(x +110, y+20, 25, 25); if (smoke &gt;20) g.drawOval(x +8, y-33, 12, 12); // draw smoke if (smoke &gt;40) g.drawOva…
has answer: http://stackoverflow.com/a/23160022
tagged with: netbeans
type: UnansweredQuestion
tagged with: multithreading

http://stackoverflow.com/comment/35465487
comment on: http://stackoverflow.com/q/23187582
score: 0
type: Comment
type: QuestionComment
has text: The exception stack trace points at the line with the error. On that line one or more pointers ("object references") will appear. One of those is null. If you don't have a better way to debug it, insert println statements to figure out which reference is the problem. This is known as debugging, and is what real programmers do.

http://stackoverflow.com/q/23253164
downvote count: 0
type: UnansweredQuestion
tagged with: android-actionbar
tagged with: styles
type: Question
has answer: http://stackoverflow.com/a/23253389
score: 1
tagged with: java
tagged with: eclipse
upvote count: 1
answer count: 1
has title: Scale Action Bar background image proportionally
favorite count: 0
has body: Im using ActionBar in my Android App, and to customize each of the tabs, i put a background image behing the ActionBar, which looks the following: On my phone actually it looks fine, but on other phones it's look very squashed. How can i scale the ActionBar proportionally based on the background's ratio? Are there any solution for this? I had to determine the height in fix DPI because if i leave it out, the ActionBar is not even showing up. My style code is the following right now; Update: I just do not know where to Mr.T's xml code. Im using the basic android ActionBar, and i have only one xml named menu.xml, but if i put the code into it, no effect. I tried to style the actionbar with the following, but still, if i do not specify the android:height parameter, the actionbar remains 0 and do not showing up. The actionbar still looks like the following on some devices; https://i.sstatic.net/4453K.png
tagged with: android

http://stackoverflow.com/comment/35647037
comment on: http://stackoverflow.com/a/23272796
has text: @Aaron You're Welcome, Sometimes after importing support library, R.jar may not generate, at this time goes to "Java Build Path" and in "Order and Export" tab. unchecked "Android Dependencies" and then clean the project.
type: AnswerComment
type: Comment
score: 1

http://stackoverflow.com/comment/35374080
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23131499
score: 0
has text: Maybe I didn't understand the complexity of the question. But you mean in the scope of your application? Than everything should change if you have all the translations available (like you say you do). On a system level there could be problems with custom locale's.

http://stackoverflow.com/comment/35464573
comment on: http://stackoverflow.com/q/23187294
score: 0
type: Comment
type: QuestionComment
has text: @Benjamin Gruenbaum I figured there would be a better way, especially with the advent of Java 8.

http://stackoverflow.com/comment/35459442
type: Comment
has text: That may be the point. `ArrayDeque` is not thread safe. Hard to tell though, without seeing your current code. One thing you can try is swapping out `ArrayDeque` with a thread safe queue such as `ArrayBlockedQueue`. And see if you still have duplicates.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23173182

http://stackoverflow.com/comment/35549084
has text: any sample output?? that you want to achive?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23234847

http://stackoverflow.com/comment/35650649
type: Comment
score: 1
type: AnswerComment
has text: @user228908 Read my comment on your question. I guess you're approaching this problem wrongly. You need to get the actual position of the letter guessed from the original string, and replace the `*` at that position only. Simple `replace()` will not work.
comment on: http://stackoverflow.com/a/23289955

http://stackoverflow.com/q/23206810
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: annotations
upvote count: 1
tagged with: jaxb
type: Question
has body: I'm currently producing the following XML output: ffab8c72-bace-4748-b010-a06d1b13ad84 Erna Robust med kant 69.0 I would like to have the id data in the element of the XML output. Like: Erna Robust med kant 69.0 The current output is generated by marshalling over an ArrayList which contains pizza elements. The class that holds this list is annotated like this: @XmlRootElement(name = "pizzas") @XmlAccessorType(XmlAccessType.FIELD) and the ArrayList itself is annotated with: @XmlElement(name = "pizza") -- So the ArrayList annotation is the one I need to change. But how in the world do I do that :-) - I have had a look at @XMLElementRef, thought of ways to update @XMLElement dynamically, but as far as I can see its name String needs to be static/constant. @XMLWrapper has also caught my eye....but but but..... Furthermore, for info. Each pizza element is annotated as: @XmlRootElement(name = "pizza") @XmlAccessorType(XmlAccessType.FIELD) @XmlType(propOrder = { "id", "name", "description", "price", "toppings" }) I hope someone here on Stackoverflow is able to assist me with a good piece of advice :-D Looking forward to hear from you. Kind regards /Lars Bingchong
tagged with: arraylist
has answer: http://stackoverflow.com/a/23206824
answer count: 1
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/23206824
has title: Dynamically add value to XMLRootElement or XMLElement annotation using JAXB

http://stackoverflow.com/comment/35649197
score: 0
comment on: http://stackoverflow.com/q/23288319
type: QuestionComment
type: Comment
has text: Please see edit above.

http://stackoverflow.com/q/23140862
has comment: http://stackoverflow.com/comment/35382632
has title: Get JTextField text from JDialog
upvote count: 0
tagged with: java
tagged with: jtextfield
downvote count: 1
type: Question
score: -1
tagged with: jdialog
has body: I have a JFrame, I have a check box in the JFrame that once clicked opens a JDialog, which then adds a JPanel I have created. Inside the JPanel I have 2 arrays of JTextField. I need to get the values from these JTextField into my JFrame to use them in a method. I have tried creating methods in the panel, but the JDialog can't see them. Any help appreciated. public ProdDialog(String popUp, JFrame jFrame, DigiProduct p) { this.p = p; this.jframe = jFrame; JPanel popupPanels[] = new JPanel[] { cd = new CDPopup(p)}; cdDialog = new JDialog(jFrame, true); cdDialog.setLocationRelativeTo(null); for (int i = 0; i &lt; popupPanels.length; i++) { if (popUp.equals(popupPanels[i].getName())) { cdDialog.add(popupPanels[i]); cdDialog.setSize(popupPanels[i].getSize()); } } cdDialog.setVisible(true); } public CDPopup(DigiProduct p) { this.setName("cd"); this.p = p; this.setLayout(new BorderLayout()); if(p.getAlbum().getSongList().size() &gt;= 15) { this.setSize(690, 600); } else if(p.getAlbum().getSongList().size() &lt; 11) { this.setSize(690, 410); } else { this.setSize(690, 490); } JPanel top = new JPanel(new GridBagLayout()); this.setBorder(new TitledBorder("CD")); JPanel detailsPanel = new JPanel(new BorderLayout()); detailsPanel.setPreferredSize(new Dimension(240, 80)); this.add(detailsPanel, BorderLayout.WEST); JPanel details = new JPanel(new GridBagLayout()); details.setBorder(border); details.setPreferredSize(new Dimension(150, 130)); detailsPanel.add(details, BorderLayout.NORTH); JPanel spacer = new JPanel(); spacer.setPreferredSize(new Dimension(200, 100)); detailsPanel.add(spacer, BorderLayout.SOUTH); gc.gridx = 0; gc.gridy = 0; artist = new JLabel(" Artist"); details.add(artist, gc); gc.gridx = 0; gc.gridy = 1; artistTBox = new JTextField(10); details.add(artistTBox, gc); JPanel songs = new JPanel(new GridBagLayout()); songs.setPreferredSize(new Dimension(380, 200)); songs.setBorder(border); songNumber = new JLabel(" No."); songName = new JLabel("Song"); songLength = new…
answer count: 1
accepted answer: http://stackoverflow.com/a/23141033
favorite count: 0
has answer: http://stackoverflow.com/a/23141033
type: AnsweredQuestion

http://stackoverflow.com/comment/35547906
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23200025
has text: Thanks for attempting to answer my question, but this only helps my code not to have anymore errors. I now just have problems getting the bug in the middle of the grid after it cannot move forward anymore.
type: AnswerComment

http://stackoverflow.com/comment/35403759
type: AnswerComment
has text: @TruePS You said *then it gets 'a'* -- be careful here, `a` is just the variable name. It is in fact holding one of the values of you array (a different one at each loop turn.
comment on: http://stackoverflow.com/a/23152800
type: Comment
score: 1

http://stackoverflow.com/comment/35421713
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23162419
has text: thanks .. the data is being stored in the values array 1 need to extract that data in sets of 5 0 -4 is the first set then 5-9 second etc..

http://stackoverflow.com/comment/35420046
type: QuestionComment
has text: I'm afraid you have to do it yourself using recursion. Implement clone() in both, and use that.
score: 0
comment on: http://stackoverflow.com/q/23162087
type: Comment

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

http://stackoverflow.com/q/23217460
answer count: 1
has comment: http://stackoverflow.com/comment/83494847
downvote count: 0
has answer: http://stackoverflow.com/a/24353758
favorite count: 0
tagged with: groovy
tagged with: windows
score: 11
upvote count: 11
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24353758
type: Question
has body: i'm creating symbolic links on Windows using a command like this : cmd /c mklink /J "${linkName.canonicalPath}" "${targetFolder.canonicalPath}" From Groovy and using Runtime.getRuntime().exec() method It's working fine but i want do the same using java.nio.Files.createSymbolicLink() method. But I always obtain the same error message: java.nio.file.FileSystemException: A required privilege is not held by the client. The mklink /J command works for the current user and i want avoid elevate privileges
tagged with: java
has comment: http://stackoverflow.com/comment/35517451
tagged with: nio
has title: How to create Soft symbolic Link using java.nio.Files
linked to: http://stackoverflow.com/q/8228030

http://stackoverflow.com/a/54136617
score: 3
upvote count: 3
answers question: http://stackoverflow.com/q/23184964
has comment: http://stackoverflow.com/comment/103128592
has comment: http://stackoverflow.com/comment/103138812
downvote count: 0
type: Answer
has body: @antak mentioned it buried in a comment, but I think the correct answer here is: For CompletableFuture.supplyAsync() wrap it in java.util.concurrent.CompletionException and rethrow it. So the sample code would look something like: CompletableFuture.supplyAsync( () -&gt; { transporter.write(req); try { //here take the value from a blocking queue,will throw a interruptedException return responseQueue.take(); } catch (InterruptedException e) { throw new CompletionException(e); } }, executorService);

java
tags question: http://stackoverflow.com/q/23189048
tags question: http://stackoverflow.com/q/23205200
tags question: http://stackoverflow.com/q/23150853
tags question: http://stackoverflow.com/q/23134267
tags question: http://stackoverflow.com/q/23189685
tags question: http://stackoverflow.com/q/23264480
tags question: http://stackoverflow.com/q/23234615
tags question: http://stackoverflow.com/q/23208293
tags question: http://stackoverflow.com/q/23202442
tags question: http://stackoverflow.com/q/23264749
tags question: http://stackoverflow.com/q/23276597
tags question: http://stackoverflow.com/q/23178942
tags question: http://stackoverflow.com/q/23160530
tags question: http://stackoverflow.com/q/23232683
tags question: http://stackoverflow.com/q/23217450
tags question: http://stackoverflow.com/q/23151949
tags question: http://stackoverflow.com/q/23204538
tags question: http://stackoverflow.com/q/23238644
tags question: http://stackoverflow.com/q/23263877
tags question: http://stackoverflow.com/q/23184063
tags question: http://stackoverflow.com/q/23213678
tags question: http://stackoverflow.com/q/23261357
tags question: http://stackoverflow.com/q/23176228
tags question: http://stackoverflow.com/q/23256711
tags question: http://stackoverflow.com/q/23183101
tags question: http://stackoverflow.com/q/23265994
tags question: http://stackoverflow.com/q/23269966
tags question: http://stackoverflow.com/q/23172548
tags question: http://stackoverflow.com/q/23211375
tags question: http://stackoverflow.com/q/23175408
tags question: http://stackoverflow.com/q/23157352
tags question: http://stackoverflow.com/q/23175745
tags question: http://stackoverflow.com/q/23150698
tags question: http://stackoverflow.com/q/23191100
tags question: http://stackoverflow.com/q/23133713
tags question: http://stackoverflow.com/q/23195426
tags question: http://stackoverflow.com/q/23216707
tags question: http://stackoverflow.com/q/23239991
tags question: http://stackoverflow.com/q/23166986
tags question: http://stackoverflow.com/q/23232693
tags question: http://stackoverflow.com/q/23217414
tags question: http://stackoverflow.com/q/23232107
tags question: http://stackoverflow.com/q/23142142
tags question: http://stackoverflow.com/q/23185923
tags question: http://stackoverflow.com/q/23235938
tags question: http://stackoverflow.com/q/23168493
tags question: http://stackoverflow.com/q/23185162
tags question: http://stackoverflow.com/q/23196381
tags question: http://stackoverflow.com/q/23193121
tags question: http://stackoverflow.com/q/23164988
tags question: http://stackoverflow.com/q/23148055
tags question: http://stackoverflow.com/q/23185811
tags question: http://stackoverflow.com/q/23155171
tags question: http://stackoverflow.com/q/23251784
tags question: http://stackoverflow.com/q/23173042
tags question: http://stackoverflow.com/q/23219563
tags question: http://stackoverflow.com/q/23161665
tags question: http://stackoverflow.com/q/23277583
tags question: http://stackoverflow.com/q/23270840
tags question: http://stackoverflow.com/q/23239521
tags question: http://stackoverflow.com/q/23199631
tags question: http://stackoverflow.com/q/23271456
tags question: http://stackoverflow.com/q/23278950
tags question: http://stackoverflow.com/q/23129959
tags question: http://stackoverflow.com/q/23171226
tags question: http://stackoverflow.com/q/23201724
tags question: http://stackoverflow.com/q/23264366
tags question: http://stackoverflow.com/q/23137758
tags question: http://stackoverflow.com/q/23201039
tags question: http://stackoverflow.com/q/23214343
tags question: http://stackoverflow.com/q/23243292
tags question: http://stackoverflow.com/q/23206112
tags question: http://stackoverflow.com/q/23288039
tags question: http://stackoverflow.com/q/23217918
tags question: http://stackoverflow.com/q/23259599
tags question: http://stackoverflow.com/q/23179139
tags question: http://stackoverflow.com/q/23274262
tags question: http://stackoverflow.com/q/23278903
tags question: http://stackoverflow.com/q/23262189
tags question: http://stackoverflow.com/q/23206154

logging
tags question: http://stackoverflow.com/q/23229763
tags question: http://stackoverflow.com/q/23201053
tags question: http://stackoverflow.com/q/23231535
tag name: logging
tags question: http://stackoverflow.com/q/23212313
tags question: http://stackoverflow.com/q/23281667
tags question: http://stackoverflow.com/q/23162164
tags question: http://stackoverflow.com/q/23261020
tags question: http://stackoverflow.com/q/23278607
tags question: http://stackoverflow.com/q/23252743
tags question: http://stackoverflow.com/q/23253916
tags question: http://stackoverflow.com/q/23133479
tags question: http://stackoverflow.com/q/23153631
tags question: http://stackoverflow.com/q/23252140
tags question: http://stackoverflow.com/q/23195015
tags question: http://stackoverflow.com/q/23266794
tags question: http://stackoverflow.com/q/23278467
tags question: http://stackoverflow.com/q/23200891
tags question: http://stackoverflow.com/q/23180125
type: Tag

http://stackoverflow.com/a/43818141
score: 7
upvote count: 7
has comment: http://stackoverflow.com/comment/80820473
downvote count: 0
answers question: http://stackoverflow.com/q/23217002
type: Answer
has body: I tried the following code in pom.xml and it worked for me <build> org.springframework.boot spring-boot-maven-plugin myPackage.HelloWorld maven-compiler-plugin true D:\jdk1.8\bin\javaw.exe

http://stackoverflow.com/q/23179305
downvote count: 3
has body: Basically, I create a map to store a unique key and a list of items. at first the map is null so in my class dosomething im checking if the map is null but it returns an exception. Please see code below. Does anyone know what i can do to fix this issue? public class MyClass{ private static Map&lt;String, List&lt;MyList&gt;&gt; MyMap = null; private static void doSomething(){ String myKey = "hello"; if(MyMap.get(myKey) == null ){ // Here is where i got the exception "java.lang.NullPointerException" //do something } } } public class MyList{ // do my List }
type: Question
has answer: http://stackoverflow.com/a/23179324
upvote count: 0
has comment: http://stackoverflow.com/comment/35450293
score: -3
has answer: http://stackoverflow.com/a/23179408
has answer: http://stackoverflow.com/a/23179395
tagged with: nullpointerexception
has comment: http://stackoverflow.com/comment/35450303
tagged with: dictionary
has title: NullPointerException when checking null
answer count: 4
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23179320
tagged with: java

http://stackoverflow.com/comment/35473304
has text: @pskink I basically have to route touch events to all the child views which are between my fingers. But how do I know the indices of child which are currently visible on screen. I have edited the above code and added HorizontalScrollView subclass also.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23187772

http://stackoverflow.com/comment/35494423
score: 0
comment on: http://stackoverflow.com/q/23202988
type: Comment
type: QuestionComment
has text: @BrianRoach - No cypherText is not set to UTF-8. Thanks for plotting the same. Can you please help me set it to UTF-8 encoding as I am not able to do so.

http://stackoverflow.com/comment/35686024
type: QuestionComment
comment on: http://stackoverflow.com/q/23281598
has text: What is the URL of the page?
score: 0
type: Comment

http://stackoverflow.com/a/23271099
score: 2
has body: An improvement to your existing approach : You could add more flexibility to your filtering rules by using Filter as an interface (and having to add more code ) - very similar to applying different comparison rules when calling Collections.sort methods with custom Comparator, for instance something like : interface Filter&lt;T&gt; { boolean include(T item); public final static Filter&lt;Object&gt; INCLUDE_ALL = new Filter&lt;Object&gt;() { @Override public boolean include(Object item) { return true; /* includes everything unconditionally */ } }; } public static int sumFilter(Collection&lt;MyClass&gt; collection, Filter&lt;? super MyClass&gt; filter) { int result = 0; if (filter == null) { filter = Filter.INCLUDE_ALL; } for (MyClass item : collection) { if (filter.include(item)) { result += item.value; } } return result; } public static int sumAll(Collection&lt;MyClass&gt; collection) { return sumFilter(collection, Filter.INCLUDE_ALL); } Then you could have custom filters with more complex rules (rather than just String.equals like in your example), for instance matching against regex : new Filter&lt;MyClass&gt;() { @Override public boolean include(MyClass item) { return item.getName().matches("some regex"); } };
accepted answer of: http://stackoverflow.com/q/23269932
downvote count: 0
answers question: http://stackoverflow.com/q/23269932
type: AcceptedAnswer
upvote count: 2
type: Answer

http://stackoverflow.com/comment/35420945
comment on: http://stackoverflow.com/q/23162559
has text: Try adding a List to your class as a private member and use it in all 3 of those methods.
score: 2
type: QuestionComment
type: Comment

http://stackoverflow.com/q/23185975
has comment: http://stackoverflow.com/comment/35461739
has answer: http://stackoverflow.com/a/23186041
has comment: http://stackoverflow.com/comment/35461719
has title: NoClassDefFoundError when using this code
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/35461696
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35461967
tagged with: java
has comment: http://stackoverflow.com/comment/35461882
has body: I have copied this code from here: http://rosettacode.org/wiki/Dining_philosophers#Java package diningphilosophers; import java.util.ArrayList; import java.util.Random; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicInteger; enum PhilosopherState { Get, Eat, Pon } class Fork { public static final int ON_TABLE = -1; static int instances = 0; public int id; public AtomicInteger holder = new AtomicInteger(ON_TABLE); Fork() { id = instances++; } } class Philosopher implements Runnable { static final int maxWaitMs = 100; // must be &gt; 0 static AtomicInteger token = new AtomicInteger(0); static int instances = 0; static Random rand = new Random(); AtomicBoolean end = new AtomicBoolean(false); int id; PhilosopherState state = PhilosopherState.Get; Fork left; Fork right; int timesEaten = 0; Philosopher() { id = instances++; left = Main.forks.get(id); right = Main.forks.get((id+1)%Main.philosopherCount); } void sleep() { try { Thread.sleep(rand.nextInt(maxWaitMs)); } catch (InterruptedException ex) {} } void waitForFork(Fork fork) { do { if (fork.holder.get() == Fork.ON_TABLE) { fork.holder.set(id); // my id shows I hold it return; } else { // someone still holds it sleep(); // check again later } } while (true); } public void run() { do { if (state == PhilosopherState.Pon) { // all that pondering state = PhilosopherState.Get; // made me hungry } else { // ==PhilosopherState.Get if (token.get() == id) { // my turn now waitForFork(left); waitForFork(right); // Ah needs me some foahks! token.set((id+2)% Main.philosopherCount); state = PhilosopherState.Eat; timesEaten++; sleep(); // eat for a while left.holder.set(Fork.ON_TABLE); right.holder.set(Fork.ON_TABLE); state = PhilosopherState.Pon; // ponder for a while sleep(); } else { // token.get() != id, so not my turn sleep(); } } } while (!end.get()); } } public class Main { static final int philosopherCount = 5; // token +2 behavior good for odd #s static final int runSeconds = 15;…
accepted answer: http://stackoverflow.com/a/23186041
has comment: http://stackoverflow.com/comment/35462254
has comment: http://stackoverflow.com/comment/35462019
has comment: http://stackoverflow.com/comment/35461723
has comment: http://stackoverflow.com/comment/35462293
has comment: http://stackoverflow.com/comment/35461762
has comment: http://stackoverflow.com/comment/35462161
type: Question
has comment: http://stackoverflow.com/comment/35461770
has comment: http://stackoverflow.com/comment/35461708
has comment: http://stackoverflow.com/comment/35461943
has comment: http://stackoverflow.com/comment/35462081
favorite count: 0
score: 0
has comment: http://stackoverflow.com/comment/35461800
answer count: 1
has comment: http://stackoverflow.com/comment/35462152

http://stackoverflow.com/a/23180091
answers question: http://stackoverflow.com/q/23180059
upvote count: 1
has body: You initialize it inside the try block, you have to give it some arbitrary value outside the try block, like null, so the compiler knows the value is always initialized, even if the try fails.
downvote count: 0
type: Answer
score: 1

http://stackoverflow.com/comment/35537996
score: 1
comment on: http://stackoverflow.com/q/23228521
type: Comment
has text: Just so you know, you shouldn't be calling `Thread.sleep()` in the EDT. That is, where you are drawing.
type: QuestionComment

http://stackoverflow.com/q/23266347
favorite count: 0
has body: I'm currently confused why I cannot pull a JSONArray from a JSONArray in my android application. An example and a snippet of my source code are given below. //The JSON { "currentPage":1, "data":[ { "id":"dimtrs", "name":"Bud Light", "breweries":[ { "id":"BznahA", "name":"Anheuser-Busch InBev", } ] } ], "status":"success" } Now I'm trying to retreive the "breweries" array. //Code Snippet ... JSONObject jsonobject = new JSONObject(inputLine); JSONArray jArray = jsonobject.getJSONArray("data"); JSONArray jsArray = jArray.getJSONArray("breweries"); ... I can pull objects out of the data array just fine, but I cannot get the "breweries" array from the "data" array using my current code. The error for jsArray is: The method .getJSONArray(int) in the type JSONArray is not applicable for the arguments String So what is the correct way to pull the "breweries" array out of the "data" array? Thanks for the help in advance!
has comment: http://stackoverflow.com/comment/35607472
has comment: http://stackoverflow.com/comment/35606254
score: 4
type: AnsweredQuestion
has title: JSONArray within JSONArray
has answer: http://stackoverflow.com/a/23267060
downvote count: 1
type: Question
upvote count: 5
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/35606836
has comment: http://stackoverflow.com/comment/35605911
has comment: http://stackoverflow.com/comment/35606258
answer count: 1
accepted answer: http://stackoverflow.com/a/23267060
tagged with: arrays

http://stackoverflow.com/q/23271060
score: 0
has body: I am trying to send Push Notification with payload for IOS, payload has limited size which is 256 byte so when Push Notification message has emoji or different than text I can not detect actual message size as a result payload size excedd 256 byte, How can I detect actual size of message with using java ? thanks
has answer: http://stackoverflow.com/a/23630362
type: UnansweredQuestion
has title: Emoji Detection while filling apn Payload
tagged with: java
has answer: http://stackoverflow.com/a/23271558
type: Question
tagged with: jakarta-ee
answer count: 2
tagged with: payload
tagged with: ios
tagged with: apn

selenium-webdriver
tags question: http://stackoverflow.com/q/23159234
tags question: http://stackoverflow.com/q/23194353
tags question: http://stackoverflow.com/q/23167297
tags question: http://stackoverflow.com/q/23269546
tags question: http://stackoverflow.com/q/23237749
tags question: http://stackoverflow.com/q/23276463
tags question: http://stackoverflow.com/q/23252196
tags question: http://stackoverflow.com/q/23156624
tags question: http://stackoverflow.com/q/23165624
tags question: http://stackoverflow.com/q/23142156
tags question: http://stackoverflow.com/q/23269076
tags question: http://stackoverflow.com/q/23261495
tags question: http://stackoverflow.com/q/23214254
tags question: http://stackoverflow.com/q/23191701
tags question: http://stackoverflow.com/q/23147663
tags question: http://stackoverflow.com/q/23211029
tag name: selenium-webdriver
tags question: http://stackoverflow.com/q/23171162
tags question: http://stackoverflow.com/q/23220293
tags question: http://stackoverflow.com/q/23269670
tags question: http://stackoverflow.com/q/23249141
tags question: http://stackoverflow.com/q/23196652
tags question: http://stackoverflow.com/q/23248400
tags question: http://stackoverflow.com/q/23247269
type: Tag
tags question: http://stackoverflow.com/q/23270929
tags question: http://stackoverflow.com/q/23227074
tags question: http://stackoverflow.com/q/23149807
tags question: http://stackoverflow.com/q/23220575
tags question: http://stackoverflow.com/q/23186851
tags question: http://stackoverflow.com/q/23262051

http://stackoverflow.com/q/23130145
has comment: http://stackoverflow.com/comment/35362889
has comment: http://stackoverflow.com/comment/35362765
has comment: http://stackoverflow.com/comment/35363146
tagged with: swing
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35363181
tagged with: paint
has answer: http://stackoverflow.com/a/23130692
has answer: http://stackoverflow.com/a/23131134
possible better answer: http://stackoverflow.com/a/23130307
tagged with: java
tagged with: jpanel
has answer: http://stackoverflow.com/a/23130307
type: Question
accepted answer: http://stackoverflow.com/a/23130692
score: 0
has title: Java Jpanel color not appearing
tagged with: thread-sleep
answer count: 3
has body: Hello i was studying about 2d graphics and wanted to make something like this http://i60.tinypic.com/71tm37.png my code for the frame and declaration of the Jpanel is this : public class Animation extends JPanel { private ArrayList&lt;BouncingCircle&gt; circles; Animation() { this.setSize(320, 240); this.setOpaque(true); this.setBackground(new java.awt.Color(102, 255, 102)); circles = new ArrayList&lt;BouncingCircle&gt;(); } public void paint(Graphics g) { Image dbImg = createImage(getWidth(), getHeight()); Graphics dbg = dbImg.getGraphics(); draw(dbg); g.drawImage(dbImg, 0, 0, this); } public void draw(Graphics g) { for (int i = 0; i &lt; circles.size(); i++) { BouncingCircle bc = circles.get(i); bc.draw(g); } repaint(); } private void addCircle() { BouncingCircle bc = new BouncingCircle(); circles.add(bc); Thread t = new Thread(bc); t.start(); } public static void main(String[] args) { JFrame frame = new JFrame("Game"); frame.setVisible(true); frame.setSize(320,240); frame.setResizable(true); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Animation a = new Animation(); frame.getContentPane().add(a); for (int i = 0; i &lt; 5; i++) { a.addCircle(); try { Thread.sleep(1000); } catch (InterruptedException ex) { System.err.println("Error: Thread Interrupted."); } } } the BouncingCircle class here: public class BouncingCircle implements Runnable { private int x; private int y; private int xVelocity; private int yVelocity; BouncingCircle() { x = 0; y = 0; xVelocity = 2; yVelocity = 2; } public void run() { while (true) { move(); try { Thread.sleep(5); } catch (InterruptedException ex) { System.err.println("Error: Thread Interrupted."); } } } private void move() { x += xVelocity; y += yVelocity; if (x &lt; 0) xVelocity = 2; if (x &gt; 320) xVelocity = -2; if (y &lt; 0) yVelocity = 2; if (y &gt; 240) yVelocity = -2; } void draw(Graphics g) { g.setColor(Color.RED); g.fillOval(x, y, 10, 10); } } but it doesnt show the backgroundcolor i tried with frame.add(a) but stil…

http://stackoverflow.com/q/23166192
type: Question
answer count: 2
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/23166211
has title: Java array init block with null
accepted answer: http://stackoverflow.com/a/23166211
has answer: http://stackoverflow.com/a/23166200
upvote count: 2
has body: Can somebody tell me how to interpret the following code? I know how to use blocks to initialize multi-dimensional arrays, but exactly what the null does in this example has me stumped. What will the contents of the whole array be? Thanks. int arry[][] = { {1, 2}, null };` `
score: 2
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/23166200
tagged with: java

http://stackoverflow.com/a/23175768
answers question: http://stackoverflow.com/q/23175625
type: Answer
accepted answer of: http://stackoverflow.com/q/23175625
has comment: http://stackoverflow.com/comment/35444344
has body: Have a variable outside of the method for its y-velocity. Every tick, increase its velocity accounting for gravity. If the ball is past a boundary, set it to the boundary and set the velocity to -1*velocity to make it "bounce" in the other direction. Maybe something like this: private int currentVelocityY = 0; private int gravity = 3; public void Gravity(){ this.currentPositionY = this.currentPositionY + this.currentVelocityY; if (this.currentPositionY &gt;= 581){ this.currentPositionY=581; this.currentVelocityY = -1 * this.currentVelocityY; } currentVelocityY = currentVelocityY + gravity; }
has comment: http://stackoverflow.com/comment/35444172
score: 0
type: AcceptedAnswer

internet-explorer-9
tag name: internet-explorer-9
type: Tag
tags question: http://stackoverflow.com/q/23269546

http://stackoverflow.com/a/23232358
type: Answer
has comment: http://stackoverflow.com/comment/35545059
has comment: http://stackoverflow.com/comment/35547853
has body: It seems you have got a problem about your Manifest file. You added com.example.buttonactivity1.DisplayMessageActivity but code try to run different path android.content.ActivityNotFoundException: Unable to find explicit activity class {com.example.buttonactivity1.app/com.example.buttonactivity1.app.DisplayMessageActivity}; have you declared this activity in your AndroidManifest.xml?
has comment: http://stackoverflow.com/comment/35545701
has comment: http://stackoverflow.com/comment/35545016
has comment: http://stackoverflow.com/comment/35545683
has comment: http://stackoverflow.com/comment/35544924
accepted answer of: http://stackoverflow.com/q/23232226
answers question: http://stackoverflow.com/q/23232226
has comment: http://stackoverflow.com/comment/35544744
has comment: http://stackoverflow.com/comment/35544833
score: 0
has comment: http://stackoverflow.com/comment/35545552
type: AcceptedAnswer

http://stackoverflow.com/q/23137404
upvote count: 1
accepted answer: http://stackoverflow.com/a/23137534
type: Question
has title: Iterate over subrange of weekdays
tagged with: weekday
has body: I'm trying to iterate over a range of weekdays, where each weekday maps to an integer (Sunday = 1, Monday = 2, ..., Saturday = 7). The range is defined by a start and end day. This is fine for a start and end day like Monday(2) - Thursday(5), as I can just do: for(int i = startDay; i &lt;= endDay; i++) { ... } I'm having difficulty when the range is split across the end and start of a week, like Friday(6) - Monday(2). This obviously doesn't work with the above for loop - e.g. for(int i = 6; i &lt;= 2; i++) { ... } // wouldn't even execute once. The only solution I can see is implementing some sort of circular buffer, which I feel is overkill for such a simple problem. I'm just stumped, and most likely missing something obvious here. I think a solution may have something to do with modular arithmetic, but I'm not quite sure.
has answer: http://stackoverflow.com/a/23137934
tagged with: dayofweek
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/23137534
possible better answer: http://stackoverflow.com/a/23137609
answer count: 4
has answer: http://stackoverflow.com/a/23137609
type: AnsweredQuestion
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/23138086

http://stackoverflow.com/comment/35522172
comment on: http://stackoverflow.com/a/23206899
score: 0
type: AnswerComment
type: Comment
has text: Unfortunately this method does not work for @ManyToMany relationships where someone wishes to persist multiselect type data in the database. It cannot be done automagically. The easiest option I have found is to throw Play out the window and go with AngularJS and ajax.

http://stackoverflow.com/comment/35491992
type: Comment
type: QuestionComment
score: 0
has text: Agreed with @erickson. This is clearly beyond simple locking.
comment on: http://stackoverflow.com/q/23202632

http://stackoverflow.com/q/23281959
favorite count: 0
has comment: http://stackoverflow.com/comment/35635974
has answer: http://stackoverflow.com/a/23284053
tagged with: maven
upvote count: 1
has comment: http://stackoverflow.com/comment/35638111
type: AnsweredQuestion
score: 1
tagged with: java
type: Question
answer count: 2
accepted answer: http://stackoverflow.com/a/23284053
possible better answer: http://stackoverflow.com/a/23296593
has comment: http://stackoverflow.com/comment/35638116
downvote count: 0
has answer: http://stackoverflow.com/a/23296593
has body: Consider this structure project pom.xml component1/ pom.xml persistence/pom.xml business/pom.xml rest/pom.xml component2/ pom.xml persistence/pom.xml business/pom.xml rest/pom.xml When I try to do this, I get NullPointerException [ERROR] Internal error: java.lang.NullPointerException -> [Help 1] org.apache.maven.InternalErrorException: Internal error: java.lang.NullPointerException at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:167) at org.apache.maven.cli.MavenCli.execute(MavenCli.java:584) at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:213) at org.apache.maven.cli.MavenCli.main(MavenCli.java:157) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289) at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415) at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356) Caused by: java.lang.NullPointerException at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:270) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:155) ... 11 more [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/InternalErrorException Can I not have a structure like this? I am using Maven 3.2.1 This is how component2/pom.xml looks com.org component2 1.0-SNAPSHOT persistence 1.0-SNAPSHOT This is same as component1/pom.xml except parent 4.0.…
has comment: http://stackoverflow.com/comment/35635932
has title: Maven: How can I have a module with same name under two different modules?
has comment: http://stackoverflow.com/comment/35642655

http://stackoverflow.com/comment/35451192
type: AnswerComment
has text: is it possible to add an String[][] array to an intent and get this array after all in the second array?
score: 0
comment on: http://stackoverflow.com/a/23175843
type: Comment

http://stackoverflow.com/q/23254133
downvote count: 1
type: Question
tagged with: jakarta-ee
answer count: 2
upvote count: 0
has answer: http://stackoverflow.com/a/23254300
linked to: http://stackoverflow.com/q/9635032
score: -1
tagged with: class
has answer: http://stackoverflow.com/a/23254246
favorite count: 0
has title: Thread.setPriority() is not working fine?
type: UnansweredQuestion
tagged with: multithreading
has comment: http://stackoverflow.com/comment/35583901
has body: i am just playing with threads. i am reading two text files a.txt and b.txt in multithreaded program. what i am doing is that i am assigning higher priority to thread reading data from a.txt. but this is not taking affect. a.txt file gets read first or something unnormal is happeining. plus a exception is also occurring. anyone here to please help me. void main() package introtothreading; import java.io.FileNotFoundException; import java.io.FileReader; import java.lang.Thread; import java.util.logging.Level; import java.util.logging.Logger; public class IntroToThreading { public static void main(String[] args) { FileReaderA fa = new FileReaderA(); FileReaderB fb = new FileReaderB(); Thread t4 = new Thread(fa); Thread t5 = new Thread(fb); t4.setPriority(Thread.MAX_PRIORITY); t5.setPriority(Thread.MIN_PRIORITY); t5.start(); t4.start(); } } FileReaderA public class FileReaderA implements Runnable { File f = new File("D:/a.txt") ; FileReader fr ; BufferedReader br ; public FileReaderA() { try { fr = new FileReader(f); br = new BufferedReader(fr); } catch (FileNotFoundException ex) { Logger.getLogger(FileReaderA.class.getName()).log(Level.SEVERE, null, ex); } } @Override public void run() { try { String s; s = br.readLine(); do { System.out.println(s); s = br.readLine(); } while(! s.equals("")); //To change body of generated methods, choose Tools | Templates. } catch (IOException ex) { System.out.println("IO Exception.."); } } } FileReaderB public class FileReaderB implements Runnable { File f = new File("D:/b.txt") ; FileReader fr ; BufferedReader br ; public FileReaderB() { try { fr = new FileReader(f); br = new BufferedReader(fr); } catch (FileNotFoundException ex) { Logger.getLogger(FileReaderB.class.getName()).log(Level.SEVERE, null, ex); } } @Override public void run() { try { String s1; s1 = br.readLine(); do { System.out.println(s1); s1 = br.readLine(); } while(!s1.equals(" ")); //To change body of generated methods, choose Tools | Templates. } catch (IOException…
tagged with: java

http://stackoverflow.com/q/23250764
favorite count: 0
tagged with: binary-search-tree
type: Question
has comment: http://stackoverflow.com/comment/35578182
has answer: http://stackoverflow.com/a/23250825
tagged with: java
upvote count: 1
answer count: 1
has title: Counting "sticks" (nodes with one child) in a binary search tree?
accepted answer: http://stackoverflow.com/a/23250825
tagged with: algorithm
tagged with: data-structures
has comment: http://stackoverflow.com/comment/35577374
type: AnsweredQuestion
has body: So I am working with Binary Search Trees and one method I am having trouble with is a method called stickCt, which basically it will count the number of sticks in a tree and return the number. For it to be a stick it has to have a null and a non null child for it to be considered a stick, I have my code done and it complies but I keep getting 0 as my return value, I have no idea what is wrong I've tried moving stuff around but nothing seems to work some help would be greatly appreciated.By the way I am doing it recursively, here is the code: // The number of nodes with exactly one non-null child //driver public int stickCt () { return stickCt(root); } private static int stickCt (IntNode T) { int num; //easiest case if (T == null) { num = 0; } //if the left child is null and the right child is not null else if (T.getLeft() == null &amp;&amp; T.getRight() != null) { num = stickCt(T.getRight()) + 1; } //if right child is null and left side is not null else if (T.getRight() == null &amp;&amp; T.getLeft() != null) { num = stickCt(T.getLeft()) + 1; } //recursive part else { num = stickCt(T.getLeft()) + stickCt(T.getRight()); } return num; }
downvote count: 0
score: 1

http://stackoverflow.com/comment/35622742
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23275084
type: AnswerComment
has text: `Lists.transform` takes a `List<T1>`, and a `Function<T1, T2>`, and returns a `List<T2>`. None of what you've described looks like that.

http://stackoverflow.com/comment/35413361
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23158386
has text: There is no validation when creating your connection. Are you certain that you have a good connection? Also, you should consider surrounding your statement execution with TRY/CATCH.
type: Comment

http://stackoverflow.com/q/23177175
type: Question
tagged with: cardlayout
tagged with: null
has title: NullPointerException Error with JPanel and CardLayout
has answer: http://stackoverflow.com/a/23177205
score: 0
has body: I am working on hotel management software for class and I am running into a few issues with my code. At this point, I am simply trying to add a JPanel I created in a separate class into my main gui. Any Help would be greatly appreciated. ~ Thanks! Exception in thread "main" java.lang.NullPointerException at java.awt.Container.addImpl(Unknown Source) at java.awt.Container.add(Unknown Source) at hotelManage.HotelSystem.showGUI(HotelSystem.java:75) at hotelManage.HotelSystem.&lt;init&gt;(HotelSystem.java:27) at hotelManage.HotelSystem.main(HotelSystem.java:115) Note: The error occurs at the line "jpanel.add("Room", room.getRoomPanel());" The code: HotelSystem.java import java.awt.*; import java.awt.event.*; import javax.swing.*; public class HotelSystem extends JFrame implements ActionListener { /** * */ private static final long serialVersionUID = 1840835913045151061L; private JFrame mainFrame; private JPanel mainPanel; private JButton btnRoom; private JButton btnCustomer; private JButton btnOrder; private JButton btnSearch; RoomSystem room; //RoomSystem room = new RoomSystem(); public HotelSystem(){ prepareGUI(); showGUI(); registerListeners(); } private void prepareGUI(){ mainFrame = new JFrame("Hotel Management System"); mainFrame.setSize(500,500); mainFrame.setLayout(new GridLayout(1,1)); btnRoom = new JButton("Room Editor"); btnCustomer = new JButton("Customer Editor"); btnOrder = new JButton("Order"); btnSearch = new JButton("Search"); //main panel mainPanel = new JPanel(); mainPanel.setLayout(new FlowLayout()); mainFrame.add(mainPanel); mainFrame.setVisible(true); } private void showGUI(){ final JPanel jpanel = new JPanel(); jpanel.setBackground(Color.CYAN); jpanel.setSize(300,300); CardLayout cLayout = new CardLayout(); cLayout.setHgap(5); cLayout.setVgap(5); jpanel.setLayout(cLayout); JPanel btnPanel = new JPanel(new FlowLayout()); btnPanel.add(btnRoom); btnPanel.add(btnCustomer); btnPanel.add(btnOrder); btnPanel.add(btnSearch); jpanel.add("Button", btnPanel)…
answer count: 1
accepted answer: http://stackoverflow.com/a/23177205
tagged with: swing
type: AnsweredQuestion
tagged with: java
tagged with: jpanel

http://stackoverflow.com/comment/35564067
has text: @user2902894 - You need to override the `equals()` and `hashCode()` methods as well in that class with your own logic which would tell the `Set` as to on what basis are 2 instances of that class are supposed to be treated as equal. The default methods provided by `Object` aren't sufficient enough to determine that.
type: Comment
comment on: http://stackoverflow.com/a/23243145
score: 1
type: AnswerComment

http://stackoverflow.com/comment/35407917
type: Comment
type: QuestionComment
has text: I figured out a work around by adding an array of named JTextFields, is this the only/best way?
comment on: http://stackoverflow.com/q/23155628
score: 0

http://stackoverflow.com/q/23172718
upvote count: 2
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question
accepted answer: http://stackoverflow.com/a/23174103
has body: I try to have Jackson property type info serialized, even when my type is referenced by a map. With this simple sample: import java.util.HashMap; import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; public class DemoJackson { @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY) public static abstract class Animal {} @JsonTypeName("cat") public static class Cat extends Animal {} public static void main(String[] args) throws JsonProcessingException { ObjectMapper objectMapper = new ObjectMapper(); Cat cat = new Cat(); System.out.println(objectMapper.writeValueAsString(cat)); HashMap&lt;String, Object&gt; map = new HashMap&lt;String, Object&gt;(); map.put("data", cat); System.out.println(objectMapper.writeValueAsString(map)); } } I get: {"@type":"cat"} {"data":{}} But I would like to have: {"@type":"cat"} {"data":{"@type":"cat"}} Is it possible? How to do it? I have tried with enableDefaultTyping but I get: {"@type":"cat"} {"data":["DemoJackson$Cat",{}]}
tagged with: jackson
answer count: 1
downvote count: 0
favorite count: 0
has title: How to make polymorphic jackson serialization working with map
has answer: http://stackoverflow.com/a/23174103
type: AnsweredQuestion
score: 2

http://stackoverflow.com/a/23218501
answers question: http://stackoverflow.com/q/23218454
type: Answer
has body: SELECT USER_ID FROM TABLE 1 WHERE COUNTRY NOT IN "AFGHANISTAN"
downvote count: 1
score: -1
upvote count: 0

linux
tags question: http://stackoverflow.com/q/23256428
tags question: http://stackoverflow.com/q/23141772
tags question: http://stackoverflow.com/q/23153250
tags question: http://stackoverflow.com/q/23283272
tags question: http://stackoverflow.com/q/23189678
tags question: http://stackoverflow.com/q/23217313
tags question: http://stackoverflow.com/q/23138817
tags question: http://stackoverflow.com/q/23176624
type: Tag
tags question: http://stackoverflow.com/q/23208281
tags question: http://stackoverflow.com/q/23181350
tags question: http://stackoverflow.com/q/23142071
tags question: http://stackoverflow.com/q/23267890
tags question: http://stackoverflow.com/q/23277062
tags question: http://stackoverflow.com/q/23263672
tags question: http://stackoverflow.com/q/23280056
tags question: http://stackoverflow.com/q/23197802
tags question: http://stackoverflow.com/q/23217698
tags question: http://stackoverflow.com/q/23234203
tags question: http://stackoverflow.com/q/23265994
tags question: http://stackoverflow.com/q/23272987
tag name: linux
tags question: http://stackoverflow.com/q/23228253
tags question: http://stackoverflow.com/q/23261813
tags question: http://stackoverflow.com/q/23288017
tags question: http://stackoverflow.com/q/23274743
tags question: http://stackoverflow.com/q/23269473
tags question: http://stackoverflow.com/q/23191520
tags question: http://stackoverflow.com/q/23228593
tags question: http://stackoverflow.com/q/23198753
tags question: http://stackoverflow.com/q/23261414
tags question: http://stackoverflow.com/q/23208224
tags question: http://stackoverflow.com/q/23224912
tags question: http://stackoverflow.com/q/23192070
tags question: http://stackoverflow.com/q/23183829

http://stackoverflow.com/q/23154060
answer count: 1
tagged with: maven-plugin
upvote count: 2
type: UnansweredQuestion
tagged with: maven
has body: I am writing a simple plugin that would make some files visible for other plugins during compilation. Imagine I have this project structure (this structure is present in quite a few projects I maintain): / | -- /src | |---- /main | |------ /assembly | |---------- file1 | |---------- file2 | |---------- fileN | |------ /java | |------ /resources | | -- pom.xml I want to avoid having to keep everything under /assembly in each of my projects. I want to store the default files in a separate artifact/file e.g. / | -- /src | |---- /main | |------ /assembly | |---------- file1 | |---------- file2 | |---------- fileN I want my plugin to merge my project with the default files during compilation. I also need to be able to selectively override the default files, so say I have 200 default files in /assembly but in one project I need to provide different file2, or add a fileN+1. I think I could try a shade or other merging plugin but the merged project is NOT the end result in my case (plus I want to learn writing plugins). The point is that I'd plug my plugin into generate-resoruces (or sth), and there is a plugin in the project (bound to package) that expects to find it's configuration in /assembly. And this is what I want to achieve: provide a default set of files (in arbitrary directories), be able to override them and make the merged result visible to next plugins. I came to this code: Artifact artifact = project.dependencyArtifacts.find { /* find the dependency with boilerplate files */ } JarFile jar = new JarFile(artifact.file) jar.entries().each { /* make the entries visible to other next plugins */ } And this is where I'm stuck. What should I do with the dependency's files in order to make them visible to next plugins?
score: 2
tagged with: java
has comment: http://stackoverflow.com/comment/35428357
type: Question
has comment: http://stackoverflow.com/comment/35420423
downvote count: 0
tagged with: maven-3
favorite count: 0
tagged with: groovy
has answer: http://stackoverflow.com/a/23301308
has title: Develop a Maven 3 plugin that provides some boilerplate files for compilation process

http://stackoverflow.com/comment/35620715
score: 1
has text: Why do you declare the variable final if you want to change it? Remove final.
type: QuestionComment
comment on: http://stackoverflow.com/q/23273936
type: Comment

http://stackoverflow.com/q/23252627
tagged with: listview
type: Question
accepted answer: http://stackoverflow.com/a/23252786
answer count: 1
downvote count: 0
has title: javafx implementing and showing a ListView
favorite count: 0
score: 2
upvote count: 2
has body: I want to have a ListView with the name of the "Persons", but on the ListView when I launch the application, I see some weird strings instead of the (string)names. I think it is a cast problem of the "Person"-object. I didnt know if the ListView should be ListView or ListView. Because when I try to set the items on the listview, using setItems(ObservableList) i get that weird Strings on list shown.. here is the code: MainApp.java: public static ObservableList&lt;Person&gt; personList; public static void main(String[] args) { personList = FXCollections.observableArrayList(); Person p1 = new Person("Tom"); Person p2 = new Person("Anna"); personList.add(p1); personList.add(p2); launch(args); } PersonController.java: import static ordercheck.OrderCheck.personList; public class PersonalController implements Initializable { @FXML private ListView&lt;Person&gt; personalList; public void initialize(URL url, ResourceBundle rb) { personalList.setItems(personList); .... .... } .... .... } how could I see the real names and not such strings: ordercheck.model.Person@2c5ds8dsf8sdf8 Thank you!
type: AnsweredQuestion
tagged with: java
tagged with: javafx
linked to: http://stackoverflow.com/q/36657299
has answer: http://stackoverflow.com/a/23252786

http://stackoverflow.com/comment/35416334
has text: no exception. but it is conformed that error is in parsing bcoz if i write json string to file , there is no problem, but if i am parsing it using above code. nothing is being written to the file.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23158785

http://stackoverflow.com/q/23171041
tagged with: mysql
type: Question
has comment: http://stackoverflow.com/comment/35435663
tagged with: jpa
has answer: http://stackoverflow.com/a/23171116
score: 0
accepted answer: http://stackoverflow.com/a/23171116
has title: JPA - Insert many tables
answer count: 1
has body: I'd like to know if theres somehow to insert multiples tables at one-time. Example: Class A {...} Class B {...} Class C {A a, B b} C.setA(new A()); C.setB(new B()); Then, when I try to insert the object C, it doesn't let me because JPA says that doesn't exists any a or b object in Database. So, I have to insert A, then B, then C. One by one, which is really bad to go to the Database 3 times everytime that I want to insert 3 new objects. Theres somehow to JPA interpret that I want to insert the class C and their dependencies (A and B)? Thanks!
type: AnsweredQuestion
tagged with: java
tagged with: hibernate

http://stackoverflow.com/q/23200929
has comment: http://stackoverflow.com/comment/35545126
tagged with: neo4j
has body: I am have been using neo4j-community-2.0.0-M04 and all of a sudden the neo4j database has started giving Caused by: java.lang.OutOfMemoryError: Java heap space Here is the log extract from neo4j server logs: http://pastebin.com/Lr0guH1F Neo4j system startup command is shown below: Using additional JVM arguments: -server -XX:+DisableExplicitGC -Dorg.neo4j.server.properties=conf/neo4j-server.properties -Djava.util.logging.config.file=conf/logging.properties -Dlog4j.configuration=file:conf/log4j.properties -XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEnabled -Xms1200m -Xmx1512m The Server has 1.7GB memory. I have tried reducing the memory from 1200MB to 512MB but that doesn't work either. Not sure what can be done.
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35511459
tagged with: java
has title: Neo4j cannot start: Java Heap Space error
type: Question
score: 0

http://stackoverflow.com/comment/35372571
has text: At this point I'm trying to set the file path as a property at runtime (while the flow is running), and then using that with the ${} notation inside my identityFile attribute. Is there a way to access a message property using ${}?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23135289
score: 0

http://stackoverflow.com/q/23221784
has answer: http://stackoverflow.com/a/23227018
has comment: http://stackoverflow.com/comment/35525738
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35525263
score: 0
has title: Solr delay at document delete
tagged with: java
tagged with: solr
type: Question
tagged with: delay
has comment: http://stackoverflow.com/comment/35525385
has body: Maybe someone got the same problem as I and can help me, when I delete document there is delay between solr index refresh and I got still on my list document which was just deleted Thans in advance
answer count: 1
has comment: http://stackoverflow.com/comment/35526022

http://stackoverflow.com/comment/35564354
score: 1
type: AnswerComment
has text: for that case Object would be best which can accomodate anything and later downcasting based on the type
comment on: http://stackoverflow.com/a/23243568
type: Comment

http://stackoverflow.com/comment/35499827
type: QuestionComment
has text: @JesusRamos Ahh right, so I could sipush 24480 twice?
type: Comment
comment on: http://stackoverflow.com/q/23207021
score: 0

http://stackoverflow.com/a/23218829
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/23192931
upvote count: 1
score: 1
has body: Finally got the solution for my question &lt;!-- Declare a view resolver --&gt; &lt;bean class="com.project.controller.AppPortalViewResolver"&gt; &lt;property name="viewResolver" ref="viewResolver" /&gt; &lt;/bean&gt; &lt;bean id="viewResolver" class="org.springframework.web.servlet.view.UrlBasedViewResolver"&gt; &lt;property name="viewClass" value="org.springframework.web.servlet.view.JstlView" /&gt; &lt;property name="prefix" value="/WEB-INF/views/" /&gt; &lt;property name="suffix" value=".jsp" /&gt; &lt;/bean&gt; AppPortalViewResolver.class public class AppPortalViewResolver implements ViewResolver { private ViewResolver viewResolver; public void setViewResolver(ViewResolver viewResolver) { this.viewResolver = viewResolver; } @Override public View resolveViewName(String viewName, Locale locale) throws Exception { /* do your logic to change the view name */ viewName = "ur_folder_structure"; return viewResolver.resolveViewName(viewName, locale); }
answers question: http://stackoverflow.com/q/23192931
type: AcceptedAnswer

http://stackoverflow.com/comment/35377134
comment on: http://stackoverflow.com/q/23137669
score: 0
type: Comment
type: QuestionComment
has text: See this question http://stackoverflow.com/questions/191215/how-to-stop-java-process-gracefully . Shutdown hooks + standard kill is the way to go, tested on production :)

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

http://stackoverflow.com/q/23200464
score: 1
linked to: http://stackoverflow.com/q/7787998
favorite count: 0
tagged with: memory-leaks
answer count: 0
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/2486136
upvote count: 1
has title: Memory leak of LightweightFocusRequest in KeyboardFocusManager?
tagged with: swing
has comment: http://stackoverflow.com/comment/35494312
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/35489251
has comment: http://stackoverflow.com/comment/35494074
downvote count: 0
linked to: http://stackoverflow.com/q/6309407
has body: I'm seeing a memory leak in a java swing application. It's leaking LightweightFocusRequest objects connected under a HeavyweightFocusRequest in the DefaultKeyboardFocusManager. The application runs in an undecorated, alwaysontop JFrame. (i.e. full-screen). The application appears to have focus. Users can click on it, and interact (all via mouse as it's a kiosk w/o a keyboard). But each interaction that produces a focus request such as showing a dialog, etc, leaks the LightweightFocusRequest object. I was able to determine this via a heap-dump and the Eclipse Memory Analyzer tool. As a workaround, if the application is switched out of fullscreen mode and the user clicks on another app, and back on our app, then the leaked memory is reclaimed as the outstanding focus request events are all cleared. It's acting as if the java application missed a focus gained event. I've seen this problem under Windows with jre version 1.6.0_35 (and _27). Not all users suffer the issue, so I don't know what other factors contribute. I also can't say for sure that it happens or doesn't happen under the latest 1.7 JRE, as the JRE versions used are beyond my control. The majority (90%+) are 1.6.0_20 to 1.6.0_39. All attempts to reproduce the problem have failed. My next strategy as a workaround is to add a check in the application on a timer to examine the focus request queue via reflection. If it looks like it's leaking (100+ outstanding items?) then create another window, give it focus, re-request focus and close the other temp window. Has anyone seen a problem like this before or have a better workaround? My searching for something similar in the java bugdb and google wasn't fruitful.

http://stackoverflow.com/comment/35590584
comment on: http://stackoverflow.com/a/23143784
score: 0
has text: I do not see the check mark on teh left... vote count?
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/35496159
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23205345
score: 0
has text: Why do you always skip index 0 to 2? And your example string is only length 14? Is it actually a string or an array?

http://stackoverflow.com/tag/xml
tags question: http://stackoverflow.com/q/23247539
tags question: http://stackoverflow.com/q/23160627
tags question: http://stackoverflow.com/q/23288853
tags question: http://stackoverflow.com/q/23290694
tags question: http://stackoverflow.com/q/23290424
tags question: http://stackoverflow.com/q/23235766
tags question: http://stackoverflow.com/q/23147581
tags question: http://stackoverflow.com/q/23132738
tags question: http://stackoverflow.com/q/23280931
tags question: http://stackoverflow.com/q/23130010
tags question: http://stackoverflow.com/q/23275432
type: Tag
tags question: http://stackoverflow.com/q/23284450
tags question: http://stackoverflow.com/q/23183173
tags question: http://stackoverflow.com/q/23262300
tags question: http://stackoverflow.com/q/23136695
tags question: http://stackoverflow.com/q/23286038
tags question: http://stackoverflow.com/q/23217059
tags question: http://stackoverflow.com/q/23277646
tags question: http://stackoverflow.com/q/23179995
tags question: http://stackoverflow.com/q/23249140
tags question: http://stackoverflow.com/q/23137445
tags question: http://stackoverflow.com/q/23202671
tags question: http://stackoverflow.com/q/23261215
tags question: http://stackoverflow.com/q/23222179
tags question: http://stackoverflow.com/q/23182957
tags question: http://stackoverflow.com/q/23279183
tags question: http://stackoverflow.com/q/23176562
tags question: http://stackoverflow.com/q/23159852
tags question: http://stackoverflow.com/q/23247853
tags question: http://stackoverflow.com/q/23273524
tags question: http://stackoverflow.com/q/23147676
tags question: http://stackoverflow.com/q/23143742
tags question: http://stackoverflow.com/q/23186164
tags question: http://stackoverflow.com/q/23149683
tags question: http://stackoverflow.com/q/23261889
tags question: http://stackoverflow.com/q/23265652
tags question: http://stackoverflow.com/q/23172342
tags question: http://stackoverflow.com/q/23281530
tags question: http://stackoverflow.com/q/23147551
tags question: http://stackoverflow.com/q/23282669
tags question: http://stackoverflow.com/q/23266794
tags question: http://stackoverflow.com/q/23264419
tags question: http://stackoverflow.com/q/23205243
tags question: http://stackoverflow.com/q/23140217
tags question: http://stackoverflow.com/q/23245625
tags question: http://stackoverflow.com/q/23287185
tags question: http://stackoverflow.com/q/23227142
tags question: http://stackoverflow.com/q/23273484
tags question: http://stackoverflow.com/q/23276471
tags question: http://stackoverflow.com/q/23156292
tags question: http://stackoverflow.com/q/23244326
tags question: http://stackoverflow.com/q/23186553
tags question: http://stackoverflow.com/q/23157039
tags question: http://stackoverflow.com/q/23138528
tags question: http://stackoverflow.com/q/23262168
tags question: http://stackoverflow.com/q/23230939
tags question: http://stackoverflow.com/q/23255645
tag name: xml
tags question: http://stackoverflow.com/q/23232226
tags question: http://stackoverflow.com/q/23193538
tags question: http://stackoverflow.com/q/23196029
tags question: http://stackoverflow.com/q/23218236
tags question: http://stackoverflow.com/q/23260895
tags question: http://stackoverflow.com/q/23267382
tags question: http://stackoverflow.com/q/23253795
tags question: http://stackoverflow.com/q/23270093
tags question: http://stackoverflow.com/q/23140095
tags question: http://stackoverflow.com/q/23285597
tags question: http://stackoverflow.com/q/23152902
tags question: http://stackoverflow.com/q/23222413
tags question: http://stackoverflow.com/q/23154387
tags question: http://stackoverflow.com/q/23203421
tags question: http://stackoverflow.com/q/23213454
tags question: http://stackoverflow.com/q/23228968
tags question: http://stackoverflow.com/q/23286568
tags question: http://stackoverflow.com/q/23199570
tags question: http://stackoverflow.com/q/23164145
tags question: http://stackoverflow.com/q/23223052
tags question: http://stackoverflow.com/q/23163113

http://stackoverflow.com/comment/35582413
comment on: http://stackoverflow.com/a/23231453
has text: I bet you can prove that a meet-in-the-middle Dijkstra variant works here, actually.
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/35472477
type: Comment
type: QuestionComment
has text: I can not use mime type as HTMl, i am using space only, i am not using tabs
comment on: http://stackoverflow.com/q/23191572
score: 0

http://stackoverflow.com/q/23274698
answer count: 2
has comment: http://stackoverflow.com/comment/35621834
has comment: http://stackoverflow.com/comment/35621780
has comment: http://stackoverflow.com/comment/35621762
has title: My code is not Compiling
has comment: http://stackoverflow.com/comment/35621772
upvote count: 1
favorite count: 0
downvote count: 5
type: UnansweredQuestion
score: -4
has comment: http://stackoverflow.com/comment/35621791
has comment: http://stackoverflow.com/comment/35621746
has answer: http://stackoverflow.com/a/23274778
tagged with: java
has body: I have the following code, but is not compiling, any suggestions? It keeps giving an error on line 11. import java.util.ArrayList; public class ListArray { public static ArrayList&lt;Integer&gt; getList(int a, int b, int[] array){ ArrayList&lt;Integer&gt; list = new ArrayList&lt;Integer&gt;(); if(a == b){ list = null; } if(a &gt; b){ list = null; } for(int i = a; i &lt;= b - 1; i++){ list =(i + 1); } return list; } }
has answer: http://stackoverflow.com/a/23274805
type: Question

http://stackoverflow.com/q/23184064
tagged with: java
has answer: http://stackoverflow.com/a/23192657
linked to: http://stackoverflow.com/q/4728756
answer count: 2
has answer: http://stackoverflow.com/a/23184495
score: 0
has body: I would like to extract the value of 4.1 from a website with JAVA (Android). I tried Jsoup and even though it couldn't be simpler to use, it gives me the value in 8 seconds, which is very slow. You need to know, the page source of the site has 300,000 characters and this is somewhere in the middle. Even using HttpClient and getting the source into a StringBuilder then going through the whole string until the score part is found is faster (3-4 seconds). I couldn't try out HtmlUnit as it requires a massive amount of jar files and after a while Eclipse always pissed itself in its confusion. Is there a faster way?
type: UnansweredQuestion
tagged with: web-scraping
has title: Scrape website for one data
type: Question

string
tags question: http://stackoverflow.com/q/23151028
tags question: http://stackoverflow.com/q/23140123
tags question: http://stackoverflow.com/q/23283222
tags question: http://stackoverflow.com/q/23172113
tags question: http://stackoverflow.com/q/23241419
tags question: http://stackoverflow.com/q/23210049
tags question: http://stackoverflow.com/q/23180890
tags question: http://stackoverflow.com/q/23234169
tags question: http://stackoverflow.com/q/23208773
tags question: http://stackoverflow.com/q/23228266
tags question: http://stackoverflow.com/q/23279183
tags question: http://stackoverflow.com/q/23145947
tags question: http://stackoverflow.com/q/23133525
tags question: http://stackoverflow.com/q/23241098
tags question: http://stackoverflow.com/q/23236792
tags question: http://stackoverflow.com/q/23282417
tags question: http://stackoverflow.com/q/23217419
tags question: http://stackoverflow.com/q/23198021
tags question: http://stackoverflow.com/q/23181623
tags question: http://stackoverflow.com/q/23218362
tags question: http://stackoverflow.com/q/23279253
tags question: http://stackoverflow.com/q/23251047
tags question: http://stackoverflow.com/q/23193924
tags question: http://stackoverflow.com/q/23196896
tags question: http://stackoverflow.com/q/23174220
tags question: http://stackoverflow.com/q/23231651
tags question: http://stackoverflow.com/q/23214851
tags question: http://stackoverflow.com/q/23134812
tags question: http://stackoverflow.com/q/23282626
tags question: http://stackoverflow.com/q/23178543
tags question: http://stackoverflow.com/q/23273484
tags question: http://stackoverflow.com/q/23238630
tags question: http://stackoverflow.com/q/23187843
tags question: http://stackoverflow.com/q/23149597
tags question: http://stackoverflow.com/q/23274061
tags question: http://stackoverflow.com/q/23191213
tags question: http://stackoverflow.com/q/23192323
tags question: http://stackoverflow.com/q/23256578
tags question: http://stackoverflow.com/q/23275480
tag name: string
tags question: http://stackoverflow.com/q/23149715
tags question: http://stackoverflow.com/q/23218347
tags question: http://stackoverflow.com/q/23183023
tags question: http://stackoverflow.com/q/23258251
tags question: http://stackoverflow.com/q/23237883
tags question: http://stackoverflow.com/q/23254651
tags question: http://stackoverflow.com/q/23260805
tags question: http://stackoverflow.com/q/23233458
tags question: http://stackoverflow.com/q/23163925
tags question: http://stackoverflow.com/q/23147283
tags question: http://stackoverflow.com/q/23177289
tags question: http://stackoverflow.com/q/23143211
tags question: http://stackoverflow.com/q/23203876
tags question: http://stackoverflow.com/q/23240336
tags question: http://stackoverflow.com/q/23179464
tags question: http://stackoverflow.com/q/23171680
tags question: http://stackoverflow.com/q/23258191
tags question: http://stackoverflow.com/q/23241347
tags question: http://stackoverflow.com/q/23154391
type: Tag
tags question: http://stackoverflow.com/q/23207983
tags question: http://stackoverflow.com/q/23151539
tags question: http://stackoverflow.com/q/23284736
tags question: http://stackoverflow.com/q/23139413
tags question: http://stackoverflow.com/q/23198492
tags question: http://stackoverflow.com/q/23180226
tags question: http://stackoverflow.com/q/23195423
tags question: http://stackoverflow.com/q/23178607
tags question: http://stackoverflow.com/q/23278367
tags question: http://stackoverflow.com/q/23231226
tags question: http://stackoverflow.com/q/23183744
tags question: http://stackoverflow.com/q/23208476
tags question: http://stackoverflow.com/q/23214149
tags question: http://stackoverflow.com/q/23146845
tags question: http://stackoverflow.com/q/23170448
tags question: http://stackoverflow.com/q/23174697
tags question: http://stackoverflow.com/q/23203627
tags question: http://stackoverflow.com/q/23146233
tags question: http://stackoverflow.com/q/23228275
tags question: http://stackoverflow.com/q/23283118

http://stackoverflow.com/q/23239474
linked to: http://stackoverflow.com/q/15503976
type: UnansweredQuestion
score: 6
tagged with: try-catch
tagged with: transactions
tagged with: java
tagged with: hibernate
type: Question
answer count: 3
has body: I am developing an application using hibernate and I save Entities as usual inside hibernate transactions. I want to 'get Feedback' from a transaction if it has completed sucessfully or not and according to that to excecute next code. Here is the trivial method I use to update the entity: public boolean updateDepartment(Department s) { Session session = HibernateUtil.getSessionFactory().getCurrentSession(); Transaction tx = HibernateUtil.getTransaction(session); boolean success = false; try { tx.begin(); session.update(s); tx.commit(); success = true; } catch (Exception e) { tx.rollback(); e.printStackTrace(); success = false; } return success; } Invocation of the method from other code: boolean b = dao.updateDepartment(d); if(b) { doStuff(); } else { showMessage("Save not usccessful. Try again"); } My question is whether this approach with the boolean variable is the optimal way, or could it be carried out in a better way. If my approach is OK, would it be better if the return statement would be surrounded with finally?
downvote count: 0
has answer: http://stackoverflow.com/a/50270152
favorite count: 0
has answer: http://stackoverflow.com/a/23240314
has answer: http://stackoverflow.com/a/32974787
upvote count: 6
has title: Check if transaction in hibernate successful

http://stackoverflow.com/comment/35631489
type: AnswerComment
has text: @HarryKitchener updated answer please check it it works on mine
type: Comment
comment on: http://stackoverflow.com/a/23279462
score: 0

http://stackoverflow.com/a/34772909
type: Answer
answers question: http://stackoverflow.com/q/23188800
score: 1
upvote count: 1
has body: First: using the way you coded, you have to receive a list of String as a paramater. Second: you have to create you myWords variable. I think your code should be ok that way: public String[] multiLetter (int n, char included, List&lt;String&gt; words) //public String[] multiLetter(int n, char included) //returns an array of words with at least m occurrences //of the letter included { List&lt;String&gt; myWords = new ArrayList&lt;String&gt;(); for (int i = 0 ; i &lt; words.size() ; i++) { int repeatCounter = 0; for (int j = 0 ; j &lt; words.get(i).length(); j ++) { if (included == words.get(i).charAt(j)) { repeatCounter++; } }//closes inner for loop if (repeatCounter &gt;= n) { myWords.add(words.get(i)); } } return (String[])myWords.toArray(); }
downvote count: 0

http://stackoverflow.com/comment/35407111
comment on: http://stackoverflow.com/q/23155077
has text: if you want a .exe file, why did you write your code in Java? even if you decide to make it a .exe, everything can be decompiled (if the user knows what he's doing). the only 'certain' way to achieve something like that, is to run the actual business logic on a server you control, and not distributing the code. then you can perform the 'check number of days remaining' away from the users influence.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/88875182
type: Comment
has text: What does this add to the answer given 4 years ago?
comment on: http://stackoverflow.com/a/50938260
type: AnswerComment
score: 0

http://stackoverflow.com/q/23187696
has comment: http://stackoverflow.com/comment/35465394
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/67097745
answer count: 1
tagged with: database
has title: Is there a way to perform a student t-test using postgresql
type: UnansweredQuestion
tagged with: statistics
has comment: http://stackoverflow.com/comment/35469000
tagged with: sql
score: 3
downvote count: 0
favorite count: 0
tagged with: postgresql
type: Question
has body: I have a bunch of data in a database. 'Year', 'Disabled', 'non-disabled' 1990, 5, 3 1991, 2, 1 I want to be able to find the average of all the years for each column. So I want the average of the numbers for disabled and then I want the average of the years for non disabled. I then want to compare the two values using a t-test to see if there's a significant difference between the two. Can I do that? Does postgresql have a way for me to enter in two values and get a p-value using a t test?

http://stackoverflow.com/a/23318682
has body: Here is the version 2 of array_info Class. class PhaseIII still the same. import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.File; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import java.util.StringTokenizer; import javax.swing.JOptionPane; public class array_info { int count=-1; int rcount=-1; String [] flight = new String [100]; int [] flight_number = new int [100]; String [] origin = new String [100]; String [] destination = new String [100]; String [] date = new String [100]; String [] time = new String [100]; int [] fl_number = new int [100]; int [] reservation_code = new int [100]; String [] last_name = new String [100]; String [] first_name = new String [100]; String [] seat_type = new String [100]; double [] seat_cost = new double [100]; { count=start_program(); rcount=start_program1();{ } } int menu() { String mnumber =""; int number; String output = "ACME AIRLINE SYSTEM" + " \n " + " \n " + "1. ADD/MODIFY FLIGHT INFORMATION" + " \n " + "2. ADD/MODIFY RESERVATION INFORMATION (Don't Work Yet)" + " \n " + "3. REPORT SECTION" + " \n " + "4. EXIT AIRLINE SYSTEM" + " \n" + " \n " + "Please make your selection &gt;"; mnumber = JOptionPane.showInputDialog(null, output, " ", JOptionPane.QUESTION_MESSAGE); if(mnumber == null || mnumber.length() == 0 ){ number = 4; } else{ try{ number=Integer.parseInt(mnumber); } catch(Exception e){ number = 4; } } return number; }//method menu int modify_flight() { String mnumber2; int number2; String output = "Modify Flight Information Menu" + " \n " + " \n " + "1. ADD FLIGHT" + " \n " + "2. DELETE FLIGHT" + " \n " + "3. MODIFY FLIGHT" + " \n " + "4. EXIT THIS MENU" + " \n" + " \n " + "Please make your selection &gt;"; mnumber2 = JOptionPane.showInputDialog(null, output, " ", JOptionPane.QUESTION_MESSAGE); if(mnumber2 == null || mnumber2.length() == 0 ){ number2 = 4; } else{ try{ number2=Integer.parseInt(mnumber2); } catch(Exception e){ number2 = 4; } } return number2;…
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23256578

http://stackoverflow.com/comment/35462133
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23178130
has text: So you mean I have to get a new connection from connection pool for each Servlet request, and then close it(request scope)?
score: 0

http://stackoverflow.com/comment/35427029
has text: I have checked.Its working in my code.Please post your class file so i can check it.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23155551

http://stackoverflow.com/comment/35545753
comment on: http://stackoverflow.com/a/23232890
type: Comment
score: 1
type: AnswerComment
has text: ***The 'idlj' tool*** will call the 'idlj' tool. You shouldn't be using 'java'. You shouldn't be using the undocumented class name. You shouldn't be being told to do these things.

http://stackoverflow.com/q/23278978
has title: Short filename causing issues with two otherwise identical Paths
score: 6
linked to: http://stackoverflow.com/q/972559
upvote count: 6
type: AnsweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/23298494
answer count: 2
downvote count: 0
possible better answer: http://stackoverflow.com/a/23279391
tagged with: eclipse-plugin
accepted answer: http://stackoverflow.com/a/23298494
has body: I used Files.createTempFile("Hello", "txt"); to create a temporary file and stored the returned Path. I have an Eclipse IFile resource linked to the temporary file I created: linkedFile.createLink(tempFile.toUri(), IResource.NONE, null); If I want to get a Path back from this resource, I call linkedFile.getLocation().toFile().toPath() On my local machine, this works 100% fine. But on a remote test machine, I get two different paths: from Files.createTempFile: C:\Users\USERNA~1\AppData\Local\Temp\Hello3606197456871226795txt from getLocation().toFile().toPath() C:\Users\Username_Testing\AppData\Local\Temp\Hello3606197456871226795txt The Folder Username_Testing and only that folder gets turned into a short filename, and only for my direct creation of it as a temporary. These two paths are not considered equal by Path.equals(...), which is causing a failing of my tests on the remote machine. In general, this makes me a bit nervous using Path.equals(...) even though in the actual real operation of the application I haven't had any issues yet. Is there a way I can force the system to always use long filenames? Is there something I'm missing that I should be aware of when I do path equality checks, or when converting paths from one form to another? Update #1: This specific issue is caused by %TEMP% on the target windows machine returning a path using a short filename, that doesn't happen on my local machine. Only test code creates temporary files and folders so this won't affect the real application. The obvious solution to my current problem is fix %TEMP% so the tests run fine in both places, but this solution is not viable in the general sense. It would be nice if there was a way to rectify the situation without modifying the target computer or jumping into native or windows specific code, since I used no such code directly to get both paths.
has answer: http://stackoverflow.com/a/23279391
favorite count: 0

http://stackoverflow.com/comment/35416294
comment on: http://stackoverflow.com/a/23160093
score: 0
type: Comment
type: AnswerComment
has text: what about array of hashset. because all the node should has this hashset. arraylist is dynamic. The index may not point to the node index.

http://stackoverflow.com/a/23262637
has body: You can map a url directly to a view (assuming your ViewResolver is correctly setup) surpassing and without the need of an intermediate Controller. XML config sample &lt;mvc:view-controller path="/test" view-name="test"/&gt; Java config sample @Configuration public class AppConfig extends WebMvcConfigurerAdapter { //.. @Override public void addViewControllers(ViewControllerRegistry registry) { registry.addViewController("/test").setViewName("test"); } //.. }
has comment: http://stackoverflow.com/comment/35599406
has comment: http://stackoverflow.com/comment/35607927
upvote count: 1
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/35609192
type: Answer
answers question: http://stackoverflow.com/q/23261587
accepted answer of: http://stackoverflow.com/q/23261587
score: 1
has comment: http://stackoverflow.com/comment/35599554

http://stackoverflow.com/a/23222927
accepted answer of: http://stackoverflow.com/q/23222179
has body: Your XML does not match your XML Schema. If you populate your object model and then marshal it you will see what the XML is supposed to look like. Marshal Example MarshalDemo package ActionMathML; import javax.xml.bind.*; public class MarshalDemo { public static void main(String[] args) throws Exception { JAXBContext context = JAXBContext.newInstance("ActionMathML"); ObjectFactory objectFactory = new ObjectFactory(); Utilisateur utilisateur = objectFactory.createUtilisateur(); utilisateur.setCodeTraitement(0); utilisateur.setNomUtilisateur("nomok"); utilisateur.setPassUtilisateur("passok"); JAXBElement<TraitementDTO> jaxbElement = objectFactory.createCreate(utilisateur); Marshaller marshaller = context.createMarshaller(); marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); marshaller.marshal(jaxbElement, System.out); } } Output Below is what the XML should look like based on your XML schema. <?xml version="1.0" encoding="UTF-8" standalone="yes"?> 0 nomok passok Unmarshal Example input.xml <?xml version="1.0" encoding="UTF-8" standalone="yes"?> 0 nomok passok UnmarshalDemo package ActionMathML; import java.io.File; import javax.xml.bind.*; public class UnmarshalDemo { public static void main(String[] args) throws Exception { JAXBContext context = JAXBContext.newInstance("ActionMathML"); Unmarshaller unmarshaller = context.createUnmarshaller(); File xml = new File("src/ActionMathML/input.xml"); JAXBElement<TraitementDTO> jaxbElement = (JAXBElement<TraitementDTO>) unmarshaller.unmarshal(xml); TraitementDTO traitementDTO = jaxbElement.getValue(); System.out.println(traitementDTO.getCodeTraitement()); if(traitementDTO instanceof Utilisateur) { Utilisateur utilisateur = (Utilisateur) traitementDTO; System.out.println(utilisateur.getNomUtilisateur()); System.out.println(utilisateur.getPassUtilisateur()); } } } Output 0 nomok passok For More Information I have written more about JAXB and inheritance on my blog: http://blog.bdoughan.com/2010/11/jaxb-and-inheritan…
has comment: http://stackoverflow.com/comment/35528082
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23222179
has comment: http://stackoverflow.com/comment/35529656
has comment: http://stackoverflow.com/comment/35543646
type: Answer
has comment: http://stackoverflow.com/comment/35528387
score: 1
has comment: http://stackoverflow.com/comment/35529181
upvote count: 1
has comment: http://stackoverflow.com/comment/35529179
has comment: http://stackoverflow.com/comment/35543525
has comment: http://stackoverflow.com/comment/35528202
has comment: http://stackoverflow.com/comment/35527719

http://stackoverflow.com/q/23161586
tagged with: jena
has answer: http://stackoverflow.com/a/23161736
score: 0
answer count: 1
has title: Model.listSubjectsWithProperty(Property p, String o) does not list resources having Typed literal with same string value
has body: I have a model whcih prints like this - &lt;rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:j.0="http://www.graphsearch.org/property/" xmlns:vcard="http://www.w3.org/2001/vcard-rdf/3.0#" xmlns:owl="http://www.w3.org/2002/07/owl#" xmlns:xsd="http://www.w3.org/2001/XMLSchema#" xmlns:j.1="http://www.graphsearch.org/class/" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" &gt; &lt;rdf:Description rdf:about="http://www.graphsearch.org/property/hasPassword"&gt; &lt;rdf:type rdf:resource="http://www.w3.org/2002/07/owl#DatatypeProperty"/&gt; &lt;/rdf:Description&gt; &lt;rdf:Description rdf:about="http://www.graphsearch.org/class/Nothing"&gt; &lt;rdf:type rdf:resource="http://www.w3.org/2002/07/owl#Class"/&gt; &lt;/rdf:Description&gt; &lt;rdf:Description rdf:about="http://www.graphsearch.org/property/hasEmail"&gt; &lt;rdf:type rdf:resource="http://www.w3.org/2002/07/owl#DatatypeProperty"/&gt; &lt;/rdf:Description&gt; &lt;rdf:Description rdf:about="http://www.graphsearch.org/class/User"&gt; &lt;rdf:type rdf:resource="http://www.w3.org/2002/07/owl#Class"/&gt; &lt;rdfs:subClassOf rdf:resource="http://www.graphsearch.org/class/Thing"/&gt; &lt;/rdf:Description&gt; &lt;rdf:Description rdf:about="http://www.graphsearch.org/class/Thing"&gt; &lt;rdf:type rdf:resource="http://www.w3.org/2002/07/owl#Class"/&gt; &lt;owl:disjointWith rdf:resource="http://www.graphsearch.org/class/Nothing"/&gt; &lt;/rdf:Description&gt; &lt;rdf:Description rdf:about="http://www.graphsearch.org/property/bornOn"&gt; &lt;rdf:type rdf:resource="http://www.w3.org/2002/07/owl#DatatypeProperty"/&gt; &lt;/rdf:Description&gt; &lt;rdf:Description rdf:about="http://www.graphsearch.org/property/hasName"&gt; &lt;rdf:type rdf:resource="http://www.w3.org/2002/07/owl#DatatypeProperty"/&gt; &lt;/rdf:Description&gt; &lt;rdf:Description rdf:about="http://www.graphsearch.org/property/livesInCity"&gt; &lt;rdf:type rdf:resource="http://www.w3.org/2002/07/owl#ObjectProperty"/&gt; &lt;/rdf:Description&gt; …
has comment: http://stackoverflow.com/comment/35419489
accepted answer: http://stackoverflow.com/a/23161736
has comment: http://stackoverflow.com/comment/35422460
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35419738
tagged with: java
type: Question

http://stackoverflow.com/q/23144746
tagged with: java
type: Question
downvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/23144762
has title: Update JFrame paintings
has body: I want to update my rectangle when my key is pressed currently I have almost achieved that package com.raggaer.frame; import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics; import javax.swing.JPanel; import javax.swing.KeyStroke; public class Elements extends JPanel { private static int y = 250; public Elements() { this.getInputMap().put(KeyStroke.getKeyStroke("UP"), "up"); this.getActionMap().put("up", new Listener("up")); this.getInputMap().put(KeyStroke.getKeyStroke("DOWN"), "down"); this.getActionMap().put("down", new Listener("down")); } public void paintComponent(Graphics g) { super.paintComponent(g); g.drawRect(250, this.y, 10, 10); } public Dimension getPreferredSize() { return new Dimension(500, 500); } public static void setY(int cord) { y += cord; // Cant access repaint() } } And this is my listener class package com.raggaer.frame; import java.awt.Graphics; import java.awt.event.ActionEvent; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import javax.swing.AbstractAction; public class Listener extends AbstractAction { private String code; //final Elements game = new Elements(); public Listener(String order) { this.code = order; } public void actionPerformed(ActionEvent e) { System.out.println(this.code); Elements.setY(1); } } Currently everything works except that I dont know how to update the y position of the rectangle, I tried using an static variable but then I cant call the repaint() method.
favorite count: 0
tagged with: repaint
tagged with: paint
accepted answer: http://stackoverflow.com/a/23144762
upvote count: 1
tagged with: swing
type: AnsweredQuestion
score: 1

http://stackoverflow.com/q/23223470
downvote count: 1
type: Question
tagged with: knapsack-problem
has body: I am trying solve the 0/1 Knapsack problem through brute force. The simplest (it seems) way to do it would be to set up a 2d matrix with 1's and 0's signifying present and non-present in the knapsack, respectively. The parameters would be the number of items (ie: columns), so then the rows should be 2^numOfItems. But since the number of items isn't constant, I can't think of how to fill the matrix. I was told that bit-shifting would work, but I do not understand how that works. Can someone point me in the right direction? EDIT: by truth table I mean the 'A' part of one of these: http://www.johnloomis.org/ece314/notes/devices/binary_to_BCD/bcd03.png
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/23224805
has comment: http://stackoverflow.com/comment/35529411
has title: Create and fill a variable-sized binary truth table
score: 2
type: AnsweredQuestion
upvote count: 3
tagged with: java
accepted answer: http://stackoverflow.com/a/23224805

http://stackoverflow.com/a/23185195
has comment: http://stackoverflow.com/comment/35460543
score: 4
upvote count: 4
accepted answer of: http://stackoverflow.com/q/23185162
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23185162
has comment: http://stackoverflow.com/comment/35460571
has body: Your problem is with this line: boolean[] grid = new boolean[sides]; This is initializing a local variable grid, not the field in the instance. Change it to: grid = new boolean[sides]; This initializes the field in the instance. By putting the type in front you are declaring a new variable. When you declar a variable in a method its scope is limited to that method. Since your local variable is named the same as your instance variable it "hides" the instance variable.
type: Answer
has comment: http://stackoverflow.com/comment/35461098

http://stackoverflow.com/comment/35405998
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23154257
has text: This seems unlikely - parsing an int should be much faster than I/O, and the poster says that serialization (binary format) is just as slow -- presumably because the above format takes around 16 bytes per line and serialization takes 20 for 5 ints)
score: 0

http://stackoverflow.com/a/23185982
score: 1
has comment: http://stackoverflow.com/comment/35463777
answers question: http://stackoverflow.com/q/23184762
has body: First of all, I do not think that it is a good idea to expose an interface that allows SQL input to users. Anyway, in your case you could program the SQL result set extraction yourself. There is no need for object relational mapping, if you do not map into objects. You could then go and just check for the existence of the columns and map them right away into your data structure. Nice way to learn plain JDBC. Just for the case you use Hibernate for other issues in your application, you can even mix the approaches.
has comment: http://stackoverflow.com/comment/35475775
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23184762
type: Answer
has comment: http://stackoverflow.com/comment/35463573
has comment: http://stackoverflow.com/comment/35463216
upvote count: 1
has comment: http://stackoverflow.com/comment/35462532

http://stackoverflow.com/q/23269750
type: Question
tagged with: jsoup
has comment: http://stackoverflow.com/comment/35656910
has body: I am trying to use the jaunt api with android as per suggestion from this SO answer. But I get this error when I run the project: Could not find class 'com.jaunt.h', referenced from method com.jaunt.UserAgent.a I tried changing the order of referencing of libraries by putting jaunt0.9.6.3.jar at the top of android 4.3 platform.jar. But in that case, I get this error: Could not find class 'android.app.AppOpsManager', referenced from method box.a Now it suggests that the class name "a" is at conflict. So what should I do to resolve this? Has anyone experience with using jaunt with android?Anyone able to use it successfully?
linked to: http://stackoverflow.com/q/14765910
downvote count: 0
linked to: http://stackoverflow.com/q/18652100
favorite count: 0
type: UnansweredQuestion
has title: Class name conflict while using Jaunt with android
tagged with: android
tagged with: jaunt-api
score: 2
answer count: 0
upvote count: 2
tagged with: java
tagged with: web-scraping

http://stackoverflow.com/comment/35368871
has text: @ Ivan Babanin thank for commant but please give me suggestion what can i do. Now i can not ignore liferay.
comment on: http://stackoverflow.com/q/23132009
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23140697
tagged with: java
type: UnansweredQuestion
has body: I came across a rather interesting thread on the Bukkit forums today. The poster was encountering a ClassNotFoundException upon attempting to create a new instance after hours of not using it. It works without issue when the JVM is first started. This all occurs within a single uninterrupted instance of the JVM. He suspects that Java is GCing his class, but I have no clue as to why that might happen (or how to fix it for that matter), so I've decided to ask here. What exactly is happening to the class, and how would the problem be fixed? Edit: After a bit more investigation, I've found that as long as the plugin owning the class is still running, the class itself is ineligible for garbage collection.
linked to: http://stackoverflow.com/q/2433261
tagged with: classnotfoundexception
answer count: 0
has comment: http://stackoverflow.com/comment/35382404
type: Question
has comment: http://stackoverflow.com/comment/35382786
has title: ClassNotFoundException after hours of not using a class
has comment: http://stackoverflow.com/comment/35382818
score: 0

http://stackoverflow.com/comment/35551452
type: Comment
type: QuestionComment
score: 3
has text: Your `return true` returns as soon as the first duplicate is found. How do you think this affects your ability to find all duplicates?
comment on: http://stackoverflow.com/q/23236240

http://stackoverflow.com/q/23219089
type: UnansweredQuestion
tagged with: java
type: Question
has title: hadoop in windows with cygwin noclassdefinition found error
has comment: http://stackoverflow.com/comment/36277335
has comment: http://stackoverflow.com/comment/35650932
tagged with: hadoop
score: 0
answer count: 1
tagged with: windows
has body: i am trying to install hadoop in my windows 7 environment and run it with cygwin. i have downloaded and installed cygwin and have configured ssh i have set java class path inside cygwin .bashrc and set up all hadoop configuration files My .bashrc file is listed export JAVA_HOME="C:\\Program Files\\Java\\jdk1.6.0_24" export HADOOP_HOME=/home/user/hadoop export HADOOP_MAPRED_HOME=/home/user/hadoop export HADOOP_COMMON_HOME=/home/user/hadoop export HADOOP_HDFS_HOME=/home/user/hadoop export YARN_HOME=/home/user/hadoop export HADOOP_CONF_DIR=/home/user/hadoop/etc/hadoop but get class not found error when i run the folowing commands the error on cygwin terminal is : $ ./hadoop version java.lang.NoClassDefFoundError: org/apache/hadoop/util/VersionInfo Caused by: java.lang.ClassNotFoundException: org.apache.hadoop.util.VersionInfo at java.net.URLClassLoader$1.run(URLClassLoader.java:202) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:190) at java.lang.ClassLoader.loadClass(ClassLoader.java:307) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at java.lang.ClassLoader.loadClass(ClassLoader.java:248) Could not find the main class: org.apache.hadoop.util.VersionInfo. Program will exit. Exception in thread "main" why do i get a noclass definition found error, is there some thing else i need to do with configuration . am using windows 7 64bit and hadoop version 2.2.0
has answer: http://stackoverflow.com/a/27844198

http://stackoverflow.com/q/23280052
has answer: http://stackoverflow.com/a/23280097
has comment: http://stackoverflow.com/comment/35633098
linked to: http://stackoverflow.com/q/32568261
has comment: http://stackoverflow.com/comment/35633718
has comment: http://stackoverflow.com/comment/35632499
downvote count: 2
upvote count: 1
duplicate of: http://stackoverflow.com/q/32568261
answer count: 1
has body: For one of my classes, we had to find a way to make a certain amount of change given an arbitrary amount of coins, with the least amount of coins. Here is my code below: public class Changemaker { public static void main ( String[] args ) { int amount = Integer.parseInt(args[args.length-1]); int coins = args.length - 1; if (amount &lt; 0){ throw new IllegalArgumentException("IMPROPER AMOUNT"); } else { for (int i = 1; i &lt;= coins; i++) { int coin = Integer.parseInt(args[i]); if (coin &lt;= 0){ throw new IllegalArgumentException("IMPROPER DENOMINATION"); } else { for (int j = 1; j &lt;= coins; j++) { int validCoin = Integer.parseInt(args[j]); if (validCoin == coin &amp;&amp; j != i ) { throw new IllegalArgumentException("DUPLICATE DENOMINATION"); } } } try { String firstCoin = args[1]; } catch (ArrayIndexOutOfBoundsException e) { System.out.println("INSUFFICIENT DATA"); throw new ArrayIndexOutOfBoundsException(" "); } } } Tuple [][] table = new Tuple [coins][amount + 1]; for(int x = 0; x &lt; coins; x++) { for (int i = 0; i &lt;= amount; i++) { Tuple tuple = new Tuple (coins); table[x][i] = tuple; } } for (int i = 1; i &lt;= amount; i++) { Tuple tuple = table[0][i]; int coin = Integer.parseInt(args[1]); int total = i; int remainder = total % coin; int coinAmt= (int)Math.floor(total / coin); if (remainder == 0) { tuple.setElement(0, coinAmt); } } for(int x = 1; x &lt; coins; x++) { int coin = Integer.parseInt(args[x + 1]); for (int i = 1; i &lt;= amount; i++) { Tuple tuple = table[x][i]; int total = i; int remainder = total % coin; int coinAmt= (int)Math.floor(total / coin); if (remainder == 0) { tuple.setElement(x, coinAmt); int optimalRow = optimalCheck(table, tuple, x, i); Tuple optimalTuple = table[optimalRow][i]; tuple.copy(optimalTuple); } else if (remainder != 0 &amp;&amp; amount &lt; coin) { tuple.copy(table[x - 1][i]); } else if (remainder != 0 &amp;&amp; amount &gt; coin) { tuple.setElement(x, coinAmt); Tuple remainderTuple = table[x][remainder]; tuple.add…
tagged with: java
tagged with: command-line-arguments
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35660169
favorite count: 0
has comment: http://stackoverflow.com/comment/35632819
type: Question
has title: Argument values error
score: -1

http://stackoverflow.com/a/23280798
accepted answer of: http://stackoverflow.com/q/23280547
upvote count: 1
downvote count: 0
answers question: http://stackoverflow.com/q/23280547
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/35634141
has body: I've oftenly have the same problem, the easiest way to deal with many versions of Java in the same machine is to modify the environment variables JAVA_HOME and PATH for each process that needs a different version of java. Have a "source script" like this: export JAVA_HOME=/opt/jdk1.5 export PATH=$JAVA_HOME/bin:$PATH and call it, say, java_1_5.sh. It doesn't matter if there is already another binary java in the PATH, because $JAVA_HOME/bin comes first in the PATH, the process will "see" your version of java first. Now, whenever you need to run java 1.5 (or the java version/vendor/whatever you want): if run java manually from the console: $ . ./java_1_5.sh yes, the dot at the beggining is important, it tells the shel to take the script as a source if you need to run, say, tomcat: then modify catalina.sh an put . path_to/java_1_5.sh in the beggining of the script ... and so on. Maybe there are more "canonical" ways to have many installations of java in the same machine (like the jdks under the directory /usr/lib/jvm, having a soft link pointing to the latest, tweaking the /etc/alternatives system, etc...) but, believe me, the way I'm telling you is the easiest I could find so far.
score: 1

http://stackoverflow.com/a/23271388
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 1
has body: You need to move these two lines of code from where they are now to inside the onClick handler of the DialogInterface.OnClickListener. String e = edit.getText().toString(); n = Integer.parseInt(e); revised code private Button btnstart; private Button btnstop; TimePicker myTimePicker; final static int RQS_1 = 1; TimePickerDialog timePickerDialog; Context context; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); btnstart = (Button)findViewById(R.id.btnstart); btnstart.setOnClickListener(new View.OnClickListener(){ public void onClick(View v) { LayoutInflater l = LayoutInflater.from(MainActivity.this); View dview = l.inflate(R.layout.dialog, null); AlertDialog.Builder ad = new AlertDialog.Builder(MainActivity.this); ad.setView(dview); final EditText edit = (EditText) dview.findViewById(R.id.edit); ad.setCancelable(false) .setTitle("Imposta i Secondi") .setPositiveButton("Ok", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id){ String e = edit.getText().toString(); int n = Integer.parseInt(e); Handler handler = new Handler(); handler.postDelayed(new Runnable(){ @Override public void run(){ Toast.makeText(getApplicationContext(), "Start",Toast.LENGTH_LONG).show(); } }, n); } }) .setNegativeButton("Cancel",new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id){ dialog.cancel(); } }); AlertDialog alertD = ad.create(); alertD.show(); } });
accepted answer of: http://stackoverflow.com/q/23271119
has comment: http://stackoverflow.com/comment/35615934
answers question: http://stackoverflow.com/q/23271119
upvote count: 1
has comment: http://stackoverflow.com/comment/35615682

http://stackoverflow.com/q/23211494
type: Question
accepted answer: http://stackoverflow.com/a/23696852
score: 12
upvote count: 12
has comment: http://stackoverflow.com/comment/35507482
downvote count: 0
has comment: http://stackoverflow.com/comment/35507501
favorite count: 0
has answer: http://stackoverflow.com/a/23696852
has title: "Plug-in org.eclipse.jdt.ui was unable to load class org.eclipse.jdt.internal.ui.packageview.PackageExplorerPart." issue in adt ( v22.6.2)
linked to: http://stackoverflow.com/q/32944658
possible better answer: http://stackoverflow.com/a/51512207
has answer: http://stackoverflow.com/a/76885498
tagged with: android
tagged with: eclipse-adt
has comment: http://stackoverflow.com/comment/35507310
answer count: 4
linked to: http://stackoverflow.com/q/22524818
has comment: http://stackoverflow.com/comment/35507752
has answer: http://stackoverflow.com/a/44877702
has body: I am getting this error in my adt eclipse. I am using the updated version of java. Please somebody help me to solve this issue.
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/51512207
tagged with: java

http://stackoverflow.com/q/23249009
duplicate of: http://stackoverflow.com/q/218384
has answer: http://stackoverflow.com/a/23249184
upvote count: 0
answer count: 1
has body: I am trying to create an addChangeEntry method for my PhoneDirectory program, its function is to search and either add a new entry to the Directory if the name passed does not exist, or if the contact already exists, updates their number. I keep getting NullPointerExceptions, as I believe that my value of x equals null. After learning this I tried to catch and handle the Exception, but I am still receiving NullPointerExceptions. addChangeEntry code: public String addChangeEntry(String name, String telno) { for (DirectoryEntry x : theDirectory) { try { if (x == null) { Logger logger = Logger.getLogger(ArrayPhoneDirectory.class.getName()); logger.log(Level.WARNING, "User with no name found"); continue; } else if (x.getName().equals(name)) { x.setNumber(telno); return x.getNumber(); } add(name, telno); } catch (Exception ex) { System.out.println("Exception found"); throw ex; } } return null; } Any help on how to handle this exception would be much appreciated, as it is currently halting my testing of the program.
has title: How should I handle a NullPointerException in PhoneDirectory program
favorite count: 0
tagged with: nullpointerexception
tagged with: exception
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35574640
downvote count: 1
type: Question
linked to: http://stackoverflow.com/q/218384
has comment: http://stackoverflow.com/comment/35689587
tagged with: java
has comment: http://stackoverflow.com/comment/35574424
has comment: http://stackoverflow.com/comment/35574181
score: -1

http://stackoverflow.com/q/23187428
has comment: http://stackoverflow.com/comment/35464708
has body: public void loseHealth(int amo) { if(airID == Value.airTowerLaser) { amo = Value.damage[0]; } if(airID == Value.airTowerLaser2) { amo = Value.damage[1]; } health -= amo; System.out.print(health); checkDeath(); } I have this and now it is working. In my array {2, 900} and yet they both seem to do the same amount of damage. I have been doing some debugging by printing out the values: I have it printing out the right values but it doesn't seem to change anything. I apologize if I am upsetting anybody. I have done a little more debugging and I have found that the if statements are not being called. I found this by: public void loseHealth(int amo) { if(airID == Value.airTowerLaser) { amo = Value.damage[0]; System.out.print(amo); } if(airID == Value.airTowerLaser2) { amo += Value.damage[1]; System.out.print(amo); } health -= amo; // System.out.print(health); checkDeath(); } If I print outside of the if statement it prints 1 not what is declared in the array. Any help would be fantastic. Thank you.
has answer: http://stackoverflow.com/a/23187549
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23187533
upvote count: 0
has comment: http://stackoverflow.com/comment/35464680
tagged with: java
has comment: http://stackoverflow.com/comment/35464979
type: Question
score: -2
tagged with: arrays
has title: If() statement not getting called
answer count: 2
downvote count: 2
has comment: http://stackoverflow.com/comment/35464738
favorite count: 0

java-me
tags question: http://stackoverflow.com/q/23267913
tags question: http://stackoverflow.com/q/23252834
tags question: http://stackoverflow.com/q/23182862
type: Tag
tag name: java-me

http://stackoverflow.com/q/23172937
tagged with: propertyinfo
has title: ksoap2 AsyncTask PropertyInfo not recevied to webservice, why?
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/35661957
has body: I need to send some parameters to my web service and get result. I have used ksoap2-android-assembly-2.4-jar-with-dependencies.jar in lib, my web service work properly : [WebMethod] public string TestParams(string userName, string password, string startRowIndex, string maximumRows, string OrderType, string IdOpera) { return userName + " - " + password + " - " + startRowIndex + " - " + maximumRows + " - " + OrderType + " - " + IdOpera; } In main java code : private class AsyncCall extends AsyncTask&lt;String, Void, SoapObject &gt; { @Override protected SoapObject doInBackground(String... params) { if (Constants.DEBUG)Log.i(Constants.LOGTAG, "doInBackground"); AsynGetSellList list = new AsynGetSellList(); AsynGetSellList.setMAIN_REQUEST_URL(MAIN_REQUEST_URL); AsynGetSellList.setMETHOD_NAME(METHOD_NAME); AsynGetSellList.setNAMESPACE(NAMESPACE); AsynGetSellList.setSOAP_ACTION(SOAP_ACTION); javab = list.GetSellList(1); return javab; } @Override protected void onPreExecute() { if (Constants.DEBUG)Log.i(Constants.LOGTAG, "onPreExecute"); pDialog = new ProgressDialog(SellList.this); pDialog.setMessage("Please wait..."); pDialog.setCancelable(false); pDialog.show(); } @Override protected void onProgressUpdate(Void... values) { if (Constants.DEBUG)Log.i(Constants.LOGTAG, "onProgressUpdate"); } @Override protected void onPostExecute(SoapObject javab) { if (Constants.DEBUG)Log.i(Constants.LOGTAG, "onPostExecute"); pDialog.dismiss(); if (isCancelled()) { finish(); } if (javab!=null){ fillSells(javab); } } } and GetSellList.java that include params : public SoapObject GetSellList(int startRowIndex) { SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME); // افزودن پارامترهای فراخوانی request.addProperty("userName", "01395175"); request.addProperty("password", "123123"); request.addProperty("startRowIndex", "1"); request.addProperty("maximumRows", "50"); request.addProperty("OrderType", "1"); request.addProperty("IdOpera", "50"); if (Constants.DEBUG)Log.i(Constants.LOGTAG,"r…
answer count: 1
has answer: http://stackoverflow.com/a/23301407
score: 0
tagged with: ksoap
tagged with: android-asynctask
type: UnansweredQuestion
tagged with: web-services

http://stackoverflow.com/a/23211680
score: 0
answers question: http://stackoverflow.com/q/23211539
type: Answer
has body: What's going on is someone has reinvented the wheel. The whole thing can be done with this line: String ReplacedString = strIn.replace(stringToReplace, replacementString); There is no advantage whatsoever is trying to write your own version of the replace() method. Conversely, there is considerable disadvantage - the fact you are asking what is going on is testimony that this is hard to read and therefore bug-prone.

http://stackoverflow.com/q/23142071
type: Question
tagged with: bluecove
tagged with: arm
answer count: 2
downvote count: 0
favorite count: 0
tagged with: linux
has answer: http://stackoverflow.com/a/26646571
upvote count: 6
tagged with: beagleboneblack
has body: I am trying to compile/run a program that uses the BlueCove libraries on a BeagleBone Black running Ubuntu. However I keep getting this error when running: Native Library bluecove_arm not available javax.bluetooth.BluetoothStateException: BlueCove library bluecove not available at com.intel.bluetooth.BlueCoveImpl.loadNativeLibraries(BlueCoveImpl.java:381) at com.intel.bluetooth.BlueCoveImpl.detectStack(BlueCoveImpl.java:429) at com.intel.bluetooth.BlueCoveImpl.access$500(BlueCoveImpl.java:65) at com.intel.bluetooth.BlueCoveImpl$1.run(BlueCoveImpl.java:1020) at java.security.AccessController.doPrivileged(Native Method) at com.intel.bluetooth.BlueCoveImpl.detectStackPrivileged(BlueCoveImpl.java:1018) at com.intel.bluetooth.BlueCoveImpl.getBluetoothStack(BlueCoveImpl.java:1011) at javax.bluetooth.LocalDevice.getLocalDeviceInstance(LocalDevice.java:75) at javax.bluetooth.LocalDevice.getLocalDevice(LocalDevice.java:95) at edit.rit.ce.whud.DataServer.bluetoothHandler(DataServer.java:16) at edit.rit.ce.whud.GUI.main(GUI.java:153) I know this isn't an issue with the code, since I can run the code with the BlueCove libraries on a x64 bit Linux computer running Mint (which is based off Ubuntu). I have searched online for several solutions and can't find one that solves my problem. I have already recompiled the bluecove-gpl-2.1.0 libraries for ARM using this method http://www.raspberrypi.org/forums/viewtopic.php?f=81&amp;t=58758 and have tried compiling/running the code both through the terminal and NetBeans IDE. Is there some other step I need to do to make this work? Why does it keep saying Bluecove library isn't available even after I recompiled it for ARM?
has title: Native Library bluecove_arm not available
type: UnansweredQuestion
tagged with: java
score: 6
has answer: http://stackoverflow.com/a/41498720

http://stackoverflow.com/a/23231531
type: Answer
accepted answer of: http://stackoverflow.com/q/23231248
downvote count: 0
answers question: http://stackoverflow.com/q/23231248
score: 1
has comment: http://stackoverflow.com/comment/35543435
has body: You should be able to use regexes for this. Something like relabel target /^(.*)$/Skip-$1/ Though you will have to be careful with your pattern, it will have to ignore nodes beginning with Skip-.
type: AcceptedAnswer
upvote count: 1

http://stackoverflow.com/q/23188959
accepted answer: http://stackoverflow.com/a/23583888
has comment: http://stackoverflow.com/comment/35478285
tagged with: spring
has comment: http://stackoverflow.com/comment/35478633
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35467555
has body: In the current state my Spring/Maven project, I have two entity classes which should br created in my postgresql database. The Hibernate configuration class is this: @Configuration @EnableTransactionManagement @PropertySource({ "classpath:database.properties" }) @ComponentScan({ "spring.webapp.persistence" }) public class HibernateConfig { @Autowired private Environment env; @Bean public LocalSessionFactoryBean sessionFactory() { LocalSessionFactoryBean sessionFactory = new LocalSessionFactoryBean(); sessionFactory.setDataSource(restDataSource()); sessionFactory.setPackagesToScan(new String[] { "spring.webapp.persistence.model" }); sessionFactory.setHibernateProperties(hibernateProperties()); return sessionFactory; } @Bean public DataSource restDataSource() { BasicDataSource dataSource = new BasicDataSource(); dataSource.setDriverClassName(env.getProperty("jdbc.driverClassname")); dataSource.setUrl(env.getProperty("jdbc.url")); dataSource.setUsername(env.getProperty("jdbc.user")); dataSource.setPassword(env.getProperty("jdbc.pass")); return dataSource; } @Bean @Autowired public HibernateTransactionManager transactionManager(SessionFactory sessionFactory) { HibernateTransactionManager txManager = new HibernateTransactionManager(); txManager.setSessionFactory(sessionFactory); return txManager; } @Bean public PersistenceExceptionTranslationPostProcessor exceptionTranslation() { return new PersistenceExceptionTranslationPostProcessor(); } Properties hibernateProperties() { return new Properties() { /** * */ private static final long serialVersionUID = 1L; { setProperty("hibernate.hbm2ddl.auto", env.getProperty("hibernate.hbm2ddl.auto")); setProperty("hibernate.dialect", env.getProperty("hibernate.dialect")); setProperty("hibernate.globally_quoted_identifiers", "true"); } }; } } my file database.properties is: jdbc.driverClassname=org.postgresql.Driver jdbc.url=jdbc:postgresql://localhost:5432/maven_test?charSet=LATIN1 jdbc.user=klebermo jdbc.pass=123 hibernate.dialect=o…
tagged with: maven
type: Question
has title: Hibernate aren't creating my tables in database
tagged with: java
tagged with: hibernate
possible better answer: http://stackoverflow.com/a/23195419
has answer: http://stackoverflow.com/a/23195419
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/35467542
has comment: http://stackoverflow.com/comment/35478116
tagged with: postgresql
has comment: http://stackoverflow.com/comment/35478356
has answer: http://stackoverflow.com/a/23583888

http://stackoverflow.com/comment/35452092
type: Comment
has text: I tried the code u gave me and after br.close i tried to split the text but it's giving me an error which is 'no suitable method found for split(char)' what's wrong !:\
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23180233

http://stackoverflow.com/a/23178609
has body: Found in the properties of the Jframe which i want to close defaultCloseOperation was set to EXIT_ON_CLOSE i set it to Dispose.
has comment: http://stackoverflow.com/comment/35449376
has comment: http://stackoverflow.com/comment/35449265
type: Answer
answers question: http://stackoverflow.com/q/23178409
score: 1
upvote count: 2
downvote count: 1

http://stackoverflow.com/a/23250472
type: Answer
has comment: http://stackoverflow.com/comment/35576721
downvote count: 0
score: 1
has body: Your question isn't abundandtly clear, but if I understand you correctly, you're asking can you use DefaaultCalculator methods from an ExtendedCalculator; if so, the answer is yes, public and protected methods and variables from a parent class are available in an extended class. As long as the object you're referencing is a DefaultCalculator or ExtendedCalculator you should be able to access getY and getX. As far as what you're talking about with Z I have no clue how that's relevant to what I think you're asking.
has comment: http://stackoverflow.com/comment/35577064
accepted answer of: http://stackoverflow.com/q/23250234
answers question: http://stackoverflow.com/q/23250234
upvote count: 1
has comment: http://stackoverflow.com/comment/35576885
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35576836

http://stackoverflow.com/q/23219596
tagged with: primefaces
accepted answer: http://stackoverflow.com/a/23264023
tagged with: java
type: Question
score: 0
has body: My sql code is SELECT d FROM deneme d WHERE d.createdDate between :startDate AND :stopDate ORDER BY d.createdDate ASC My primefaces codes are &lt;p:calendar id="basla" value="#{denemeBean.startDate}" pattern ="dd-MM-yyyy"/&gt; &lt;p:calendar id="bit" value="#{denemeBean.stopDate}" pattern ="dd-MM-yyyy"/&gt; When I choose dates between starDate = 20-04-2014 Sunday and stopDate = 22-04-2014 Tuesday, I see data's date start with 19-04-2014 Saturday and stop with 21-04-2014 Monday And also startDate = 19-04-2014 Saturday and stopDate = 22-04-2014 Tuesday, the data's date start with 18-04-2014 Saturday and stop with 21-04-2014 Monday DenemeBean `public class DenemeBean implements Serializable { private Date startDate = new Date(); private Date stopDate = new Date(); public DenemeBean () { } @PostConstruct public void init() { startDate = DateUtils.addDays(startDate, -1); } public Date getStartDate() { return startDate; } public void setStartDate(Date startDate) { this.startDate = startDate; } public Date getStopDate() { return stopDate; } public void setStopDate(Date stopDate) { this.stopDate = stopDate; } } `
answer count: 1
has comment: http://stackoverflow.com/comment/35534753
has title: Primefaces p:calendar component is not working for Saturday and Sunday
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23264023
tagged with: jsf

http://stackoverflow.com/comment/35379602
type: QuestionComment
comment on: http://stackoverflow.com/q/23134304
score: 1
has text: Cheating on Ruzzle? :-)
type: Comment

http://stackoverflow.com/comment/35602441
comment on: http://stackoverflow.com/a/23264536
has text: That is not fast method... If I have an `Integer.MAX_INT` elements in map it's will be make worse perfomance...
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/23242145
tagged with: java
has body: It's been two days that I am trying to solve this! Here is the thing: I have a Class as below: public class TaskEntity extends Index { public String title; public String description; public UUID posterId; public Long time; public String address; public GeoPoint location; public static Finder find = new Finder(TaskEntity.class); //some methods } which extends this abstract class: public abstract class Index implements Indexable { //some public non static fields // some methods public static class Finder { private final Class type; private IndexQueryPath queryPath; public Finder(Class type) { this.type = type; T t = IndexUtils.getInstanceIndex(type); // error here! this.queryPath = t.getIndexPath(); } public IndexQueryPath getIndexPath() { IndexType indexTypeAnnotation = this.getClass().getAnnotation(IndexType.class); if(indexTypeAnnotation == null) { Logger.error("ElasticSearch : Class " + this.getClass().getCanonicalName() + " no contain @IndexType(name) annotation "); } String indexType = indexTypeAnnotation.name(); String indexName = IndexService.INDEX_DEFAULT; // This is not defined, therefore throw a NullPointerException IndexName indexNameAnnotation = this.getClass().getAnnotation(IndexName.class); if(indexNameAnnotation != null) { indexName = indexNameAnnotation.name(); } return new IndexQueryPath(indexName, indexType); } // some methods } } Simply I try to mock the TaskEntity class without any extra code as below: public class TaskManagementServiceImplTest { @Mock private TaskEntity taskEntity; @Before public void setUp() throws Exception { MockitoAnnotations.initMocks(this); } @Test public void emptyTest(){ } } BOOM: java.lang.ExceptionInInitializerError at com.github.cleverage.elasticsearch.Index.getIndexPath(Index.java:41) at com.github.cleverage.elasticsearch.Index$Finder.(Index.java:164) at models.elasticsearch.TaskEntity.(TaskEntity.java:48) at sun.reflect.GeneratedSerializationConstructorAccessor6.newInstance(Unknown Source) at java.lang.reflect.Constr…
tagged with: unit-testing
type: Question
tagged with: mockito
score: 4
tagged with: mocking
answer count: 1
favorite count: 0
tagged with: powermock
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23247768
has title: How can I mock a class that has a static field in my example?
has comment: http://stackoverflow.com/comment/35569968
upvote count: 4
downvote count: 0
has comment: http://stackoverflow.com/comment/35571538

http://stackoverflow.com/comment/35642281
type: Comment
comment on: http://stackoverflow.com/q/23283939
has text: Thanks Got it....the error is...Phno has value Null. So the sql fails...when i changed it...the query works perfectly...Thank you.. :) :)
score: 0
type: QuestionComment

http://stackoverflow.com/comment/35606254
has text: The JSON you show is invalid, therefore no, there isn't a way to parse it. You can use [JSONlint](http://jsonlint.com/) to see this is the case.
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23266347

http://stackoverflow.com/q/23289062
tagged with: android
tagged with: soap
has body: Inside my app I've build a reporting system that uploads errors users might have encountered to my server. I am receiving this error from several users. I haven't been able to reproduce it or to figure out what is causing it. My app calls a SOAP server several times causing the error below: OS: Android 4.4.2 Exception = expected: START_TAG {http://www.w3.org/2003/05/soap-envelope}Envelope (position:START_TAG @2:7 in java.io.InputStreamReader@4340df58) StackTrace = [org.kxml2.io.KXmlParser.require(KXmlParser.java:2056), org.ksoap2.SoapEnvelope.parse(SoapEnvelope.java:127), org.ksoap2.transport.Transport.parseResponse(Transport.java:100), org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:195), org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:95), com.xxxx.engine.ws.xxxMobileService$ServiceCallTask.doInBackground(xxxtMobileService.java:227), com.xxxx.engine.ws.xxxtMobileService$ServiceCallTask.doInBackground(xxxMobileService.java:192), android.os.AsyncTask$2.call(AsyncTask.java:288), java.util.concurrent.FutureTask.run(FutureTask.java:237), java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112), java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587), java.lang.Thread.run(Thread.java:841)] Does anyone have any ideas to what may be causing this?
has answer: http://stackoverflow.com/a/29579334
tagged with: android-asynctask
type: UnansweredQuestion
tagged with: web-services
type: Question
tagged with: java
has title: expected: START_TAG SOAP error
score: 0
answer count: 1

http://stackoverflow.com/comment/35451445
comment on: http://stackoverflow.com/q/23179910
score: 1
has text: There aren't any other disadvantages: a `synchronized` block is essentially a `ReentrantLock` without the clutter. But that is enough reason: you should not complicate your code unnecessarily.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23157574
has comment: http://stackoverflow.com/comment/35419287
type: Answer
has body: Your problem is in this method indexOf, You don't use the second argument i.e starting index of search area. public int indexOf(char guess, int i) { return word.indexOf(guess, i); } Also foundPos should initialize to -1.
score: 2
has comment: http://stackoverflow.com/comment/35411929
upvote count: 2
has comment: http://stackoverflow.com/comment/35418626
has comment: http://stackoverflow.com/comment/35412617
has comment: http://stackoverflow.com/comment/35418288
answers question: http://stackoverflow.com/q/23157274
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23157274
downvote count: 0
has comment: http://stackoverflow.com/comment/35412392
has comment: http://stackoverflow.com/comment/35412141

http://stackoverflow.com/q/23229204
has comment: http://stackoverflow.com/comment/35539612
has comment: http://stackoverflow.com/comment/35539814
has body: The code ran fine, but the output was not as expected. My code is: public class Test { public static class MapReduceMapper extends Mapper&lt;LongWritable, Text, IntWritable, IntWritable&gt; { public void map(LongWritable key, Text value, OutputCollector&lt;IntWritable, IntWritable&gt; output) throws IOException, InterruptedException { Scanner scanner = new Scanner(value.toString()); String row; String[] pre; int[] tokens; while (scanner.hasNext()) { row = scanner.nextLine(); pre = row.split("\\t"); tokens = new int[pre.length]; for(int i=0; i&lt;pre.length;i++) { tokens[i] = Integer.parseInt(pre[i]); } output.collect(new IntWritable(tokens[0]), new IntWritable(tokens[1])); } } } public static class MapReduceReducer extends Reducer&lt;IntWritable, IntWritable, Text, NullWritable&gt; { NullWritable NULL = NullWritable.get(); public void reduce(IntWritable key, Iterable&lt;IntWritable&gt; values, OutputCollector&lt;Text, NullWritable&gt; output) throws IOException, InterruptedException { for (IntWritable val : values) { int a = val.get(); count++; } String keyValue = key.get() + ": "; output.collect(new Text(keyValue + "Mean = " + (sum / count)), NULL); output.collect(new Text(keyValue + "Count = " + count), NULL); } } public static void main(String[] args) throws Exception { Configuration conf = new Configuration(); FileSystem fs = FileSystem.get(conf); Job job = new Job(conf, "mapreduce"); job.setJarByClass(test.class); job.setOutputKeyClass(LongWritable.class); job.setOutputValueClass(Text.class); job.setMapperClass(MapReduceMapper.class); job.setReducerClass(MapReduceReducer.class); job.setInputFormatClass(TextInputFormat.class); job.setOutputFormatClass(TextOutputFormat.class); FileInputFormat.addInputPath(job, new Path("")); String outputFile = "/home/kevmccar/mapreduce/output/"; Path outPath = new Path(outputFile); fs.delete(outPath, true); FileOutputFormat.setOutputPath(job, new Path(outputFile)); job.waitForCompletion(true); } } the input file I am using has a…
has answer: http://stackoverflow.com/a/23231519
has title: Map/reduce java - code creating unknown output
has comment: http://stackoverflow.com/comment/35541804
upvote count: 1
has comment: http://stackoverflow.com/comment/35542333
accepted answer: http://stackoverflow.com/a/23231519
has comment: http://stackoverflow.com/comment/35542454
type: AnsweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/35541872
has comment: http://stackoverflow.com/comment/35539750
has comment: http://stackoverflow.com/comment/35541057
has comment: http://stackoverflow.com/comment/35540966
has comment: http://stackoverflow.com/comment/35543064
has comment: http://stackoverflow.com/comment/35541785
type: Question
has comment: http://stackoverflow.com/comment/35541642
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/35539699
favorite count: 0

http://stackoverflow.com/q/23186461
score: 0
has answer: http://stackoverflow.com/a/23186746
has comment: http://stackoverflow.com/comment/35462763
has answer: http://stackoverflow.com/a/23186798
has answer: http://stackoverflow.com/a/23186950
has comment: http://stackoverflow.com/comment/35462807
has comment: http://stackoverflow.com/comment/35462749
has answer: http://stackoverflow.com/a/23186802
answer count: 5
tagged with: insertion-sort
has answer: http://stackoverflow.com/a/23191434
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23186950
has comment: http://stackoverflow.com/comment/35462817
tagged with: java
has comment: http://stackoverflow.com/comment/35462882
has comment: http://stackoverflow.com/comment/35462889
type: Question
has body: im having some trouble with another program (im just not good with modules and arrays really). can anyone help me to get it working correctly? been working on it all night and im extremely tired... anyway here is the code ive done so far. the problem asks: Design a program that asks the user to enter 10 golf scores. The scores should be stored in an Integer array. Sort the array in ascending order and display its contents. import java.util.Scanner; public class SortedGolfScoresIB { public static void main(String[] args) { //local variables final int SIZE = 10; int[] scores = new int[SIZE]; // get the scores getScores(scores, SIZE); // sore the scores in ascending order insertionSort(scores, SIZE); //display the results in ascending order displayScores(scores, SIZE); } // the getScoresmodule prompts the user for // golf scores to populare the scores array. public static void getScores(int scores[], int size) { // local variable for loop index int index; // get the scores for (index = 0; index &lt;=size; size--) { System.out.println("Enter golf score number " + index +1 + ":"); Scanner keyboard = new Scanner(System.in); scores[index] = keyboard.nextInt(); } } // the insertionSort module sorts the contents of the array // in ascending order public static void insertionSort(int array[], int size) { //local variables int index; int scan; int unsortedValue; for (index = 1; index &lt;=size; size--) { unsortedValue = array[index]; scan = index; } while (scan &gt; 0 &amp;&amp; array[scan-1] &lt; array [scan]) { swap (array[scan-1], array[scan]); scan = scan -1; } array[scan] = unsortedValue; } //the swap module swaps the contents of its two arguments public static void swap(int a, int b) { int temp; //swap a and b temp = a; a = b; b = temp; } // the display scores module displays the // golve scores in the scores array public static void displayScores(int scores[], int size) { // local variable for loop index int index; //display the scores System.out.println ("here are the …
tagged with: algorithm
has comment: http://stackoverflow.com/comment/35462869
tagged with: sorting
possible better answer: http://stackoverflow.com/a/23186746
has title: Java: sorting/searching an array

http://stackoverflow.com/comment/35503420
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23209074
has text: Not this `if(i == 1 || i == 0)` only `if(i == 1)` as you want 9 at index 1.

http://stackoverflow.com/comment/35648512
comment on: http://stackoverflow.com/q/23288991
has text: check whether all resources are available . Also post us `web.xml` code
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23174843
has comment: http://stackoverflow.com/comment/35443001
has answer: http://stackoverflow.com/a/23175118
answer count: 2
downvote count: 3
upvote count: 1
tagged with: fileinputstream
favorite count: 0
possible better answer: http://stackoverflow.com/a/23175118
has body: How can i wright in the beggining of the first file infomation which contains in second file, so that they merge each other?? please help, thanks. BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); FileInputStream fileReader = new FileInputStream(reader.readLine()); FileOutputStream fileWriter = new FileOutputStream(reader.readLine(), true); while (fileReader.available() &gt; 0) { int data = fileReader.read(); fileWriter.write(data); } fileReader.close(); fileWriter.close(); reader.close();
has comment: http://stackoverflow.com/comment/35443999
has comment: http://stackoverflow.com/comment/35444342
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35467502
tagged with: java
has answer: http://stackoverflow.com/a/23175158
accepted answer: http://stackoverflow.com/a/23175158
tagged with: fileoutputstream
type: Question
has title: how can i Merge files
score: -2

http://stackoverflow.com/comment/35530335
score: 0
type: AnswerComment
type: Comment
has text: I would like to be able to automatically extract the contents of a txt file into a String [], and NO String, and then not using the split because it was already creating problems
comment on: http://stackoverflow.com/a/23224321

http://stackoverflow.com/a/23174141
accepted answer of: http://stackoverflow.com/q/23173979
upvote count: 1
type: AcceptedAnswer
has body: remove setContentView(R.layout.activity_main) from go(View v) method.
type: Answer
answers question: http://stackoverflow.com/q/23173979
downvote count: 0
score: 1

http://stackoverflow.com/q/23200439
has comment: http://stackoverflow.com/comment/35487134
has comment: http://stackoverflow.com/comment/35487318
has answer: http://stackoverflow.com/a/23200517
type: AnsweredQuestion
has body: I have the following multimap: private ListMultimap&lt;String, int[]&gt; terrainMap = ArrayListMultimap.create(); { terrainMap.put("Terrain.Ground", new int[] {0,100,300,0}); terrainMap.put("Terrain.Ground", new int[] {300,200,400,0}); terrainMap.put("Terrain.Ground", new int[] {400,250,800,0}); terrainMap.put("Terrain.Ground", new int[] {800,500,810,0}); terrainMap.put("Terrain.Ground", new int[] {100,200,150,150}); terrainMap.put("Terrain.Ground", new int[] {500,400,600,350}); }; When I iterate through this in the same class, everything works as expected: for (Map.Entry&lt;String, int[]&gt; entry : terrainMap.entries()) { } However, when I pass the map as a parameter of some other class method, I get an error incompatible types: Object cannot be converted to entry&lt;String, int[]&gt; otherClassMethod(terrainMap); And the method looks like this: public void otherClassMethod(ListMultimap terrainMap) { } What's wrong?
type: Question
has title: Iterating over google multimap passed as a parameter
tagged with: java
score: 0
has comment: http://stackoverflow.com/comment/35487402
tagged with: google-maps
answer count: 1
accepted answer: http://stackoverflow.com/a/23200517

http://stackoverflow.com/q/23273230
has answer: http://stackoverflow.com/a/23273634
favorite count: 0
score: 48
has answer: http://stackoverflow.com/a/57219008
has answer: http://stackoverflow.com/a/79269387
has answer: http://stackoverflow.com/a/66164348
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/57219008
accepted answer: http://stackoverflow.com/a/23273634
has answer: http://stackoverflow.com/a/76377887
upvote count: 49
has answer: http://stackoverflow.com/a/64873819
downvote count: 1
tagged with: unit-testing
type: Question
tagged with: java
answer count: 6
has body: Out of the following two test cases in BundleProcessorTest.java, i am getting below exception, although, my first test case passes successfully. org.mockito.exceptions.misusing.InvalidUseOfMatchersException: Misplaced argument matcher detected here: -> at bundle.test.BundleProcessorTest.bundlePluginShouldNotBeNull(BundleProcessorTest.java:22) You cannot use argument matchers outside of verification or stubbing. Examples of correct usage of argument matchers: when(mock.get(anyInt())).thenReturn(null); doThrow(new RuntimeException()).when(mock).someVoidMethod(anyObject()); verify(mock).someMethod(contains("foo")) Also, this error might show up because you use argument matchers with methods that cannot be mocked. Following methods cannot be stubbed/verified: final/private/equals()/hashCode(). at bundle.test.BundleProcessorTest.bundlePluginCollectionShouldNotBeNull(BundleProcessorTest.java:28) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) Please find below simplified code listing :- BundlePlugin.java package bundle; import java.util.List; public class BundlePlugin { private final String pluginName ; private final List&lt;String&gt; featureContent ; public BundlePlugin(String pluginName, List&lt;String&gt; featureContent) { super(); this.pluginName = pluginName; this.featureContent = featureContent; } public String getPluginName() { return pluginName; } public List&lt;String&gt; getFeatureContent() { return featureContent; } } BundleProcessor.java package bundle; import java.util.ArrayList; import java.util.Iterator; import java.util.List; public class BundleProcessor { public BundlePlugin getBundlePlugin(String pluginName, Iterator&lt;String&gt; artifactIterator) { List&lt;String&gt; featureContent = new ArrayList&lt;String&gt;() ; return new BundlePlugin(pluginName, featureContent); } } BundleProcessorTest.java package bundle.test; import static org.junit.Assert.assertNotNull; import static…
linked to: http://stackoverflow.com/q/22822512
tagged with: mockito
tagged with: junit
has title: Misplaced argument matcher detected here. You cannot use argument matchers outside of verification or stubbing in Mockito

http://stackoverflow.com/q/23268532
tagged with: channel
answer count: 1
tagged with: events
favorite count: 0
has answer: http://stackoverflow.com/a/23281639
tagged with: asterisk
type: UnansweredQuestion
upvote count: 1
has body: Asterisk 11.4.0 Asterisk-java: 1.0.0.CI-SNAPSHOT I've try to run this code: import org.asteriskjava.live.AsteriskChannel; import org.asteriskjava.live.AsteriskQueue; import org.asteriskjava.live.AsteriskQueueEntry; import org.asteriskjava.live.internal.AsteriskAgentImpl; import org.asteriskjava.live.AsteriskServer; import org.asteriskjava.live.AsteriskServerListener; import org.asteriskjava.live.DefaultAsteriskServer; import org.asteriskjava.live.ManagerCommunicationException; import org.asteriskjava.live.MeetMeRoom; import org.asteriskjava.live.MeetMeUser; import java.beans.PropertyChangeListener; import java.beans.PropertyChangeEvent; public class HelloLiveEverything implements AsteriskServerListener, PropertyChangeListener { private AsteriskServer asteriskServer; public HelloLiveEverything() { asteriskServer = new DefaultAsteriskServer("localhost", "manager", "password"); } public void run() throws ManagerCommunicationException { // listen for new events asteriskServer.addAsteriskServerListener(this); // add property change listeners to existing objects for (AsteriskChannel asteriskChannel : asteriskServer.getChannels()) { System.out.println(asteriskChannel); asteriskChannel.addPropertyChangeListener(this); } } public void onNewAsteriskChannel(AsteriskChannel channel) { System.out.println(channel); channel.addPropertyChangeListener(this); } public void onNewMeetMeUser(MeetMeUser user) { System.out.println(user); user.addPropertyChangeListener(this); } public void onNewQueueEntry(AsteriskQueueEntry user) { System.out.println(user); user.addPropertyChangeListener(this); } public void onNewAgent(AsteriskAgentImpl user) { System.out.println(user); user.addPropertyChangeListener(this); } public void propertyChange(PropertyChangeEvent propertyChangeEvent) { System.out.println(propertyChangeEvent); } public static void main(String[] args) throws Exception { HelloLiveEverything helloLiveEverything = new HelloLiveEverything(); helloLiveEverything.run(); while (true) { } }…
score: 1
tagged with: java
has title: Asterisk + asterisk-java listen new channels
type: Question
downvote count: 0

http://stackoverflow.com/comment/35445182
score: 1
has text: Hashtable<String,Entity> htEntities=new Hashtable<String,Entity>(); and, if you want to copy the entries from h into htEntities, you could then do: htEntities.putAll(h); http://docs.oracle.com/javase/7/docs/api/java/util/Hashtable.html#putAll%28java.util.Map%29
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23176309

http://stackoverflow.com/comment/35474411
score: 1
has text: The reason I've asked this question on stackoverflow was to receive help from those who are knowledgeable about JDO and Datanucleus. I have read logs but it requires some understanding of Datanucleus internals to analyse them. That's why I have posted the code as a standalone unit test so anyone can run and play with it on their own. If you are interested you can also follow the same topic on datanucleus forum at http://www.datanucleus.org/servlet/forum/viewthread_thread,7724
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23169963

http://stackoverflow.com/a/23197244
has comment: http://stackoverflow.com/comment/35481538
score: 1
has comment: http://stackoverflow.com/comment/35726946
has comment: http://stackoverflow.com/comment/35529718
has body: This has happened because your test cases are not properly designed. Firstly, If you wish the data to be added to the database, you should commit the changes after any update/insert operation. You have to do a rollback only if there are any exceptions during transactions. Design your tests some thing like this. @BeforeTest public void setUp() { personDao.setEntityManager(entityManager); entityManager.getTransaction().begin(); } @AfterTest public void tearDown() { // TODO clear all inserted data either using sql statement or JPA //Rollback only if there is any exception entityManager.getTransaction().rollback(); } @Test public void findPersonById() { Long id = System.currentTimeMillis(); personDao.savePerson(new Person(id,"Hans")); entityManager.flush(); // TODO your assert statements go in here /* Data is visible till here during your debug. Once AfterTest is executed then the your data would be rolled back */ } I have used testNG as my Unit testing tool, pls use appropriate tool based on your requirements. Also, if you are enityManager.flush() insert/update statements would be sent to the DB but wont be committed until commit instruction is sent to the DB by HIbernate. Pls refer this answer for further details
has comment: http://stackoverflow.com/comment/35506240
downvote count: 0
has comment: http://stackoverflow.com/comment/35690830
has comment: http://stackoverflow.com/comment/35553179
has comment: http://stackoverflow.com/comment/35485312
has comment: http://stackoverflow.com/comment/35481309
has comment: http://stackoverflow.com/comment/35553642
type: Answer
has comment: http://stackoverflow.com/comment/35481686
has comment: http://stackoverflow.com/comment/35481727
answers question: http://stackoverflow.com/q/23196380
upvote count: 1

http://stackoverflow.com/comment/35476005
comment on: http://stackoverflow.com/q/23194141
score: 0
type: Comment
type: QuestionComment
has text: You can only return once, and you can't return multiple values. The answers you linked provide solutions. Returning an int[] array or some collection also works.

http://stackoverflow.com/comment/35579925
type: Comment
score: 0
has text: @BinoyDalal your problem is a threading one - see my answer. And please take a closer look to sscce.org, there are still many unnecessary lines in your code.
comment on: http://stackoverflow.com/q/23244448
type: QuestionComment

http://stackoverflow.com/comment/35476581
type: AnswerComment
type: Comment
has text: I have extracted the text. How to take particular parameter value in that PDF?
comment on: http://stackoverflow.com/a/23191652
score: 0

http://stackoverflow.com/comment/35462426
type: Comment
comment on: http://stackoverflow.com/q/23179053
has text: Edited original to answer your questions.
score: 0
type: QuestionComment

telnet
tags question: http://stackoverflow.com/q/23223600
tags question: http://stackoverflow.com/q/23268956
tag name: telnet
tags question: http://stackoverflow.com/q/23276863
type: Tag

http://stackoverflow.com/q/23239161
tagged with: java
has answer: http://stackoverflow.com/a/23239303
tagged with: mysql
has body: I made a java application and to access it you must login. There are 2 types of login: admin and normal user. I want to save information about all the movements of normal users. In other words I need to know which user added, changed or deleted anything from the database. Is there any way to do this? I know I'll have to create a new table in the database, but do not know anything else. Does anyone can help me clarify this doubt I have. I honestly don't even know where to start. I apologize if I did not make myself clear. Thank all any help you can give me. Greetings. Any questions I will try to explain as best as possible.
type: Question
upvote count: 2
answer count: 2
has title: How save all actions from users in MySQL Database - Java Application
has comment: http://stackoverflow.com/comment/35557365
has answer: http://stackoverflow.com/a/23239385
accepted answer: http://stackoverflow.com/a/23239385
favorite count: 0
possible better answer: http://stackoverflow.com/a/23239303
score: 2
type: AnsweredQuestion
downvote count: 0

http://stackoverflow.com/comment/35575485
type: Comment
comment on: http://stackoverflow.com/a/23249350
has text: Although even longer, the regex `T(?:o(?:p(?: (?:C(?:h(?:o(?:i(?:ce?)?)?)?)?)?)?)?)?` would probably be better as it uses non-capture groups rather then 8 nested capture groups
score: 0
type: AnswerComment

http://stackoverflow.com/q/23253264
has comment: http://stackoverflow.com/comment/35583360
type: AnsweredQuestion
score: 1
has answer: http://stackoverflow.com/a/23253349
tagged with: java
accepted answer: http://stackoverflow.com/a/23253349
type: Question
has body: I am writing a simple Jframe program, with a menubar and some options. Now when I click on the option open it does what the open action should do, but it also does the close action. not sure why. Here are the respective codes. //MenuItems menuItem = new JMenuItem("New"); menuOptions.add(menuItem); menuItem = new JMenuItem("Open"); menuOptions.add(menuItem); menuItem.addActionListener(new Actions()); menuOptions.addSeparator(); menuItem = new JMenuItem("Save"); menuOptions.add(menuItem); menuItem.addActionListener(new Actions()); menuOptions.addSeparator(); menuItem = new JMenuItem("Close"); menuOptions.add(menuItem); menuItem.addActionListener(new Actions()); And the actions class: import java.awt.event.ActionListener; import java.awt.event.ActionEvent; import java.io.IOException; class Actions implements ActionListener { DisplayText dt; public void actionPerformed(ActionEvent e) { if(e.getActionCommand().equalsIgnoreCase("Open")) { BasicFile f = new BasicFile(); // Important to encapsulate in try-catch block. try{ dt = new DisplayText( f.getName(), f.getContents()); }catch(IOException ex){ ex.printStackTrace();//in case of exeption print to find error. } //Print to console for debuggin. System.out.println(f.getName() ); //"The string that was clicked " + e.getActionCommand()); } if(e.getActionCommand().equalsIgnoreCase("Close")); { dt = new DisplayText(00); System.exit(0); } } }
answer count: 1
has comment: http://stackoverflow.com/comment/35582436
upvote count: 1
has comment: http://stackoverflow.com/comment/35582181
favorite count: 0
downvote count: 0
has title: Why is it performing two actions?

http://stackoverflow.com/q/23174220
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35441370
upvote count: 0
score: -5
tagged with: java
has answer: http://stackoverflow.com/a/23174262
type: Question
has title: Compiling Error
has comment: http://stackoverflow.com/comment/35441378
tagged with: types
has comment: http://stackoverflow.com/comment/35441430
answer count: 1
tagged with: string
favorite count: 0
has body: The accompanying code is inadequately organized. Rework it with the goal that it has a finer structure and keeps away from excess. To help wipe out excess, change over the code into a strategy named using that acknowledges two parameters: a Scanner for the comfort, and a String for a solitary individual's name, and prints the suitable data about that individual's bills. Your technique could be called twice (once for John and once for Jane) to duplicate the first code's conduct. public static void main (String [] args) { Scanner console = new Scanner(System.in); int numBills1 = spending(console, "John"); int numBills2 = spending(console, "Jane"); System.out.println("John needs " + numBills1 + " bills"); System.out.println("Jane needs " + numBills2 + " bills"); } public static int spending(Scanner console, String name) { System.out.print("How much will " + name + " be spending? "); double amount = console.nextDouble() System.out.println(); int numBills = (int) (amount / 20.0); if (numBills * 20.0 &lt; amount) { numBills++; } return numBills; } Error Return types do not match. expected return type: void your return type was: int
tagged with: return
downvote count: 5

http://stackoverflow.com/comment/35540041
comment on: http://stackoverflow.com/q/23229685
has text: You could simply catch the exception. Do you need it to propagate for any reason?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23194405
score: 1
has comment: http://stackoverflow.com/comment/35476798
has comment: http://stackoverflow.com/comment/35534173
upvote count: 1
answers question: http://stackoverflow.com/q/23194145
has body: The offset in your timezone is UTC+3, while the offset in your friends's timezone is UTC+2. But your friend’s applies Daylight Saving Time (3600000 ms = 1 hour), meaning the effective offset in both is UTC+3. Therefore, your friend ends up with the same time as you. This looks perfectly normal. If your friend does not live in the Eastern Europe time zone, he should adjust the system settings on his computer.
downvote count: 0
has comment: http://stackoverflow.com/comment/35485009
has comment: http://stackoverflow.com/comment/35476963
type: Answer

http://stackoverflow.com/q/23199764
has comment: http://stackoverflow.com/comment/35487150
downvote count: 4
upvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/23199926
tagged with: arrays
favorite count: 0
has comment: http://stackoverflow.com/comment/35486122
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/35491341
has title: Creating ArrayList from class
has comment: http://stackoverflow.com/comment/35485762
tagged with: java
score: -4
type: Question
has body: I've been building simple card game, player will have 3 cards. i have this cardPart class and i want to create array list from it public List&lt;CardParts&gt; parts = new ArrayList&lt;CardParts&gt;(); parts.add(new CardParts()); //&lt;== error here, i don't know how to make it array my cardparts class : public class CardParts { public CardParts(String[] picz) { } } i need to use array , so i can easily use the for loop and enter random number for each increment.. for example : parts[i] = randomnumber; if you confuse, simply this, the plan is i need 3 cards , with each card can keep 11 data (array) card1 = (1,2,3,4,5,6,7,8,9,0,A) , so on the other card &lt;-- just like that.. please help me solve it with arraylist thing if you could.. , however if stuck, i am willing to use other method.. , thank you
has comment: http://stackoverflow.com/comment/35486362

http://stackoverflow.com/comment/35408598
comment on: http://stackoverflow.com/a/23155993
type: Comment
has text: @Jirka-x1 Yes, this is happening because of the improved target type inference that Java 8 introduced.
type: AnswerComment
score: 0

http://stackoverflow.com/a/23135916
type: Answer
accepted answer of: http://stackoverflow.com/q/23135412
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/23135412
has comment: http://stackoverflow.com/comment/35374411
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35373815
downvote count: 0
has body: Change you code in run method to display name of the current thread instead: System.out.println("The current Thread is " + Thread.currentThread().getName() + " and thread ID is " + Thread.currentThread().getId()); Every time you create new Thread you override instance variable t, so it is not safe to use it to track thread name and ID.

http://stackoverflow.com/q/23205664
answer count: 0
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/35565469
type: Question
has title: How to create a method that blocks until something is received in netty?
has comment: http://stackoverflow.com/comment/35511152
has comment: http://stackoverflow.com/comment/35565712
has body: I'm new to netty and I want to use it for communication between my server-network. I got a Master and various Slaves in my Scenario. The Slaves need to query data from the Master. So that's why I want to create a method that sends something to the Server, and blocks until it receives an answer from the Server. After something is received it returns that. To make things more understandable here is a lil' bit of "pseudo-code": public String getProperty(String queryString) { sendString(queryString); return methodThatBlocksUntilSomethingComesBackFromServer(); } I heard I need to do something with Future&lt;>(). but I am a little confused about that whole ChannelFuture-Thing ... Thanks in Advance, Scrayos
tagged with: blocking
type: UnansweredQuestion
tagged with: netty

http://stackoverflow.com/a/23248867
has body: Every executing program has a current working directory. Often times, it is the directory where the executable lives (if it was launched in a "normal" way). Since you didn't specify a path (in fileName), the file will be saved with that name in the current working directory. If you want the file to be saved in your downloads directory, specify the full path. E.g. String fileName = "C:\\Users\\YOUR_USERNAME\\Downloads\\Death Grips - Get Got.mp3"; Note how I've escaped the backslashes. Also note that there are methods for joining paths in Java. There is a way to get the current working directory in Java.
answers question: http://stackoverflow.com/q/23248792
accepted answer of: http://stackoverflow.com/q/23248792
has comment: http://stackoverflow.com/comment/35574085
upvote count: 2
has comment: http://stackoverflow.com/comment/35574023
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/35573978
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/35573893

http://stackoverflow.com/comment/35434752
has text: Also see: http://stackoverflow.com/questions/2486191/java-string-pool
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23170448

http://stackoverflow.com/q/23214891
accepted answer: http://stackoverflow.com/a/23215196
tagged with: wait
favorite count: 0
tagged with: synchronization
possible better answer: http://stackoverflow.com/a/23215097
answer count: 4
type: AnsweredQuestion
score: 2
downvote count: 0
has answer: http://stackoverflow.com/a/56746871
tagged with: java
has body: I try to understand java core synchronization. I wrote code sample: Program should write left right 10 times package concurrency; public class LeftRightWaitNotifyExample { final static String str = "1"; public static void main(String[] args) { new LeftLegThread(str).start(); new RightLegThread(str).start(); } } class LeftLegThread extends Thread { String monitor; public LeftLegThread(String str) { monitor = str; } @Override public void run() { try { makeStep(); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } private void makeStep() throws InterruptedException { synchronized (monitor) { for (int i = 0; i &lt; 10; i++) { System.out.println("Left "); wait(); } } } } class RightLegThread extends Thread { String monitor; public RightLegThread(String str) { monitor = str; } @Override public void run() { try { makeStep(); } catch (InterruptedException e) { } } private void makeStep() throws InterruptedException { synchronized (monitor) { while (true) { System.out.println("Right "); notify(); wait(); } } } } I get this output: Left Right Exception in thread "Thread-0" java.lang.IllegalMonitorStateException at java.lang.Object.wait(Native Method) at java.lang.Object.wait(Object.java:485) at concurrency.LeftLegThread.makeStep(LeftRightWaitNotifyExample.java:35) at concurrency.LeftLegThread.run(LeftRightWaitNotifyExample.java:23) Exception in thread "Thread-1" java.lang.IllegalMonitorStateException at java.lang.Object.notify(Native Method) at concurrency.RightLegThread.makeStep(LeftRightWaitNotifyExample.java:61) at concurrency.RightLegThread.run(LeftRightWaitNotifyExample.java:51) Before I got this error when I used wait method non within synchronized block. But here I use wait within synchronized block What is the cause of the problem and how to fix it? update I rewrite code according advice: public class LeftRightWaitNotifyExample { final static String str = "1"; public static void main(String[] args) throws InterruptedExceptio…
type: Question
has answer: http://stackoverflow.com/a/23215097
tagged with: concurrency
upvote count: 2
has title: reason of IllegalMonitorStateException if I use wait within sync block
has answer: http://stackoverflow.com/a/49656320
has answer: http://stackoverflow.com/a/23215196

ejb
tags question: http://stackoverflow.com/q/23238161
tags question: http://stackoverflow.com/q/23267479
tags question: http://stackoverflow.com/q/23135525
tags question: http://stackoverflow.com/q/23138497
tags question: http://stackoverflow.com/q/23153104
tags question: http://stackoverflow.com/q/23288319
tag name: ejb
tags question: http://stackoverflow.com/q/23229160
tags question: http://stackoverflow.com/q/23206942
tags question: http://stackoverflow.com/q/23221508
tags question: http://stackoverflow.com/q/23287054
tags question: http://stackoverflow.com/q/23266272
type: Tag

http://stackoverflow.com/comment/35496264
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/23205265
has text: In a greatly generalized sense, you can lock and unlock the way you have mentioned and make something thread safe. This is taking a lot of complex things and making them super simple, however.
type: Comment

http://stackoverflow.com/comment/35550588
type: Comment
has text: @user3515895 isn't `Enrollment` class supposed to be an object definition? do the search in your main class
type: AnswerComment
comment on: http://stackoverflow.com/a/23235570
score: 0

http://stackoverflow.com/comment/35387381
comment on: http://stackoverflow.com/a/23143372
has text: Except for the entire meaning of the condition ;)
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/35463177
type: AnswerComment
score: 0
type: Comment
has text: sorry, I didn't read the question properly and though infinite loop is the problem. Can you please take a heap dump when out of memory occurs and analyze that to see what is taking memory. If your own application objects are taking space, you will know where the problem is.
comment on: http://stackoverflow.com/a/23178887

concatenation
tags question: http://stackoverflow.com/q/23275539
type: Tag
tag name: concatenation

http://stackoverflow.com/q/23178923
downvote count: 0
has answer: http://stackoverflow.com/a/23189064
has title: Hibernate Search Association with IndexEmbedded property with composite ID
favorite count: 0
accepted answer: http://stackoverflow.com/a/23189064
upvote count: 1
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: hibernate
type: Question
tagged with: hibernate-search
has body: How do we associate class A with class B when class A has a primary key id1 and class B has a composite key made of id1 and id2. Code will look like this: @Entity @Indexed public class ClassA { @Id @DocumentId private Integer id1; @Field private Integer description; @ManyToOne(cascade = {CascadeType.ALL}) @IndexEmbedded ClassB b; // getters and setters } @Entity public class ClassB { @EmbdeddedId @DocumentId private ClassB_Pk id; } @Embeddable public class ClassB_Pk { private Integer id1; private Integer id2; // getters and setters } Solution Approach1: public class classA { @ManyToOne(cascade = { CascadeType.ALL}) @IndexedEmbedded @JoinColumn(name="id1") private ClassB b; } Error Received: Student_Main has the wrong number of column. should be 2 Solution Approach2: public class classA { @ManyToOne(cascade = { CascadeType.ALL}) @IndexedEmbedded @MapsId("id1") private ClassB b; } Error: No errors thrown, but no indexing occured (as checked with luke) I have stumbled upon this problem for quite a while. Any recommendation will be greatly appreciated. Thank you in advance
answer count: 1

http://stackoverflow.com/comment/66015821
has text: @aroth link fixed.
type: Comment
comment on: http://stackoverflow.com/a/23247316
score: 1
type: AnswerComment

http://stackoverflow.com/q/23169795
has answer: http://stackoverflow.com/a/23975626
possible better answer: http://stackoverflow.com/a/23169845
downvote count: 0
has body: Effective Java - Item-2 states , a JavaBean may be in an inconsistent state partway through its construction. I could not understand this, If an object is being constructed in a method, how would that go inconsistent, if exception has to occur, that can occur in constructor too. And how is this related to threading?
has answer: http://stackoverflow.com/a/23169845
favorite count: 0
accepted answer: http://stackoverflow.com/a/23975626
has comment: http://stackoverflow.com/comment/48902197
type: AnsweredQuestion
tagged with: java
tagged with: effective-java
has title: JavaBean disadvantage - inconsistent during construction
type: Question
upvote count: 5
answer count: 2
score: 5

http://stackoverflow.com/a/27522403
upvote count: 7
downvote count: 70
answers question: http://stackoverflow.com/q/23260057
has body: for me it worked with mvn clean install -DskipTests -e
has comment: http://stackoverflow.com/comment/67105911
has comment: http://stackoverflow.com/comment/47182189
type: Answer
score: -63
has comment: http://stackoverflow.com/comment/140209818

http://stackoverflow.com/comment/35541622
type: Comment
comment on: http://stackoverflow.com/q/23230604
type: QuestionComment
has text: A lot of what you're asking is somewhat described in the docs you linked to.
score: 10

http://stackoverflow.com/q/23273378
favorite count: 0
has comment: http://stackoverflow.com/comment/35622412
has comment: http://stackoverflow.com/comment/35628728
type: Question
has answer: http://stackoverflow.com/a/23273659
has comment: http://stackoverflow.com/comment/35632429
upvote count: 2
has answer: http://stackoverflow.com/a/23273749
tagged with: multithreading
has comment: http://stackoverflow.com/comment/35619241
has comment: http://stackoverflow.com/comment/35619526
has body: I think I have implemented the Double-checked locking pattern but not sure if it safe or it works as intended. Any other logic to implement the same would be really helpful. public class OnProperties { private static String dfltPropertyFile = "on.properties"; private static long refreshSecs = 120L; private static Properties props; private static long lastReadTimestamp = 0; public static String getProperty(String propertyName, String dfltValue) { long currentTimestamp = System.currentTimeMillis() / 1000L; if (props == null || (refreshSecs &gt; 0 &amp;&amp; (currentTimestamp - lastReadTimestamp) &gt; refreshSecs)) { synchronized (props) { if (props == null || (refreshSecs &gt; 0 &amp;&amp; (currentTimestamp - lastReadTimestamp) &gt; refreshSecs)) { lastReadTimestamp = currentTimestamp; try { loadProperties(dfltPropertyFile); refreshSecs = getProperty("on.properties.refresh", 120L); if (refreshSecs &lt; 0L) { refreshSecs = 0L; } } catch (Exception e) { refreshSecs = 600L; } } } } if (props == null) { return dfltValue; } String propertyValue = props.getProperty(propertyName, dfltValue); return propertyValue; } public static boolean getProperty(String propertyName, boolean dfltValue) { boolean value = dfltValue; String strValue = getProperty(propertyName, (String) null); if (strValue != null) { try { value = Boolean.parseBoolean(strValue); } catch (NumberFormatException e) { // just keep the default } } return value; } private static void loadProperties(String p_propertiesFile) throws java.io.IOException, java.io.FileNotFoundException { InputStream fileStream = new FileInputStream(p_propertiesFile); props = new Properties(); props.load(fileStream); fileStream.close(); } } Generally multiple threads running often access the "getProperty" method as follows: extDebug = OnProperties.getProperty("on.extdebug", false);
has comment: http://stackoverflow.com/comment/35626627
has comment: http://stackoverflow.com/comment/35619572
has comment: http://stackoverflow.com/comment/35623706
has title: Is the following code thread safe?
tagged with: java
tagged with: thread-safety
answer count: 5
score: 2
has comment: http://stackoverflow.com/comment/35619351
has answer: http://stackoverflow.com/a/23280082
has comment: http://stackoverflow.com/comment/35646995
has answer: http://stackoverflow.com/a/23274894
downvote count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35620111
has answer: http://stackoverflow.com/a/23273922

http://stackoverflow.com/comment/35420370
type: QuestionComment
has text: Are the locks a bottleneck in your application?
type: Comment
comment on: http://stackoverflow.com/q/23162181
score: 1

http://stackoverflow.com/comment/35726391
has text: No problem, Kevin -- glad it helped!
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23147080
score: 0

http://stackoverflow.com/q/23249782
tagged with: jackson
accepted answer: http://stackoverflow.com/a/23252961
answer count: 1
favorite count: 0
score: 14
type: AnsweredQuestion
upvote count: 14
has title: Adding an array element to JSON using Jackson
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has answer: http://stackoverflow.com/a/23252961
type: Question
downvote count: 0
has body: I have a JSON that looks like this [ { "itemLabel":"Social Media", "itemValue":90 }, { "itemLabel":"Blogs", "itemValue":30 }, { "itemLabel":"Text Messaging", "itemValue":60 }, { "itemLabel":"Email", "itemValue":90 }, ] I want to place all of those objects into an array to manipulate it easier in one of my code. Thus I want to do something like [ { "data": [ { "itemLabel": "Social Media", "itemValue": 90 }, { "itemLabel": "Blogs", "itemValue": 30 }, { "itemLabel": "Text Messaging", "itemValue": 60 }, { "itemLabel": "Email", "itemValue": 90 } ] } ] How do I go about to add in that data array element using Jackson? I have done mostly read using Jackson but have not done too many writes. Any help would be appreciated.

http://stackoverflow.com/comment/35541639
type: QuestionComment
comment on: http://stackoverflow.com/q/23230513
score: 0
has text: Note that your `if(e==counter)` is only going to return true a handful of times, then never return true again. I would actually recommend using nested loops here - an outer one where the index goes from 0 to 9, and an inner one where the index goes from 0 to 999. You should print out your estimate of pi at the end of each iteration of the outer loop.
type: Comment

http://stackoverflow.com/a/23187160
answers question: http://stackoverflow.com/q/23187095
type: Answer
accepted answer of: http://stackoverflow.com/q/23187095
has body: Your best bet is : 1.Create a folder called libs in your project's root folder 2.Copy your JAR files to the libs folder 3.Now right click on the Jar file and then select Build Path &gt; Add to Build Path, which will create a folder called 'Referenced Libraries' within your project
type: AcceptedAnswer
score: 0

http://stackoverflow.com/a/23287327
downvote count: 0
score: 1
has body: You can't override finalize as private. If you try you will get this error: Cannot reduce the visibility of the inherited method from Object. I think you should try to learn more about the access modifiers. protected doesn't ever (and can't) become private. This works: protected void finalize() throws Throwable { // something } This works as well: public void finalize() throws Throwable { // something } This won't work: private void finalize() throws Throwable { // something } Have a read of this answer: In Java, what's the difference between public, default, protected, and private?
upvote count: 1
answers question: http://stackoverflow.com/q/23287223
type: Answer

http://stackoverflow.com/comment/35645774
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23280245
has text: when i use thread.sleep(10) , the code work correctly
score: 0

http://stackoverflow.com/comment/35654831
type: QuestionComment
type: Comment
has text: What's not working here? This seems to be correct for the most part. Can you provide a screenshot of what you are getting and explain why its different from your desired end result?
score: 1
comment on: http://stackoverflow.com/q/23284386

http://stackoverflow.com/comment/35562508
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23241815
has text: Ok, it has a lot of troubles with Java, int this article is an explanation about it and how to solve: http://msdn.microsoft.com/en-us/magazine/cc188755.aspx

recursion
type: Tag
tags question: http://stackoverflow.com/q/23136817
tags question: http://stackoverflow.com/q/23130908
tags question: http://stackoverflow.com/q/23145158
tags question: http://stackoverflow.com/q/23234241
tags question: http://stackoverflow.com/q/23187663
tags question: http://stackoverflow.com/q/23228416
tag name: recursion
tags question: http://stackoverflow.com/q/23144252
tags question: http://stackoverflow.com/q/23179088
tags question: http://stackoverflow.com/q/23176905
tags question: http://stackoverflow.com/q/23237808
tags question: http://stackoverflow.com/q/23187162
tags question: http://stackoverflow.com/q/23253637
tags question: http://stackoverflow.com/q/23203249
tags question: http://stackoverflow.com/q/23188417
tags question: http://stackoverflow.com/q/23282417
tags question: http://stackoverflow.com/q/23175806
tags question: http://stackoverflow.com/q/23232413
tags question: http://stackoverflow.com/q/23207931
tags question: http://stackoverflow.com/q/23139075
tags question: http://stackoverflow.com/q/23189649
tags question: http://stackoverflow.com/q/23208758
tags question: http://stackoverflow.com/q/23248103
tags question: http://stackoverflow.com/q/23174838
tags question: http://stackoverflow.com/q/23161248
tags question: http://stackoverflow.com/q/23133510
tags question: http://stackoverflow.com/q/23241376

http://stackoverflow.com/comment/35463036
type: QuestionComment
score: 3
comment on: http://stackoverflow.com/q/23186592
has text: Also, note that types in Java (i.e. class names) should start with capital letter, i.e. `Sistemi`.
type: Comment

http://stackoverflow.com/q/23234310
type: Question
answer count: 1
tagged with: tomcat
score: 0
has answer: http://stackoverflow.com/a/23658862
has body: My environment is the following: win8 enterprise tomcat 8.0.5 (can start up and access the home page successfully) ctag ctags58 opengrok 0.9 jdk1.8.0_05 I copied all source code (C++ and C#) to OpenGrok\source, it is about 50GB. Go to d:\opengrok in command windows, and run java -Xmx1024m -jar lib\opengrok.jar -W "D:\OpenGrok\data\configuration.xml" -P -S -v -s "D:\OpenGrok\source" -d "D:\OpenGrok\data" And under OpenGrok\data\index, there is about 1GB index files generated. Configure the Tomcat with OpenGrok webapp by help document. But, when I open http://www.mycomputername.com:8080/source, and input 'MonitorProc' in the "Full Search", I got Your search full:MonitorProc did not match any files. (I have checked that the file containing MonitorProc must be under OpenGrop\Source folder. p.s: if I input 'class' as key word, I can got several results. I wonder if there is some ways I could use to trouble shoot where the problem is? is the indexing problem? or Opengrok search issue? or any other problems.
tagged with: opengrok
type: UnansweredQuestion
has title: Why my OpenGrok full search always failed to get results?
tagged with: java

http://stackoverflow.com/a/23258739
has body: You are mixing up your variables. The "this" statement in java refers to the one already defined in the class while the ones without "this" refer to the ones in the parameters. So as mentioned you just need to switch them around, it's printing null because they are not declared as anything.
score: 0
answers question: http://stackoverflow.com/q/23258484
type: Answer

http://stackoverflow.com/comment/35481538
type: AnswerComment
score: 0
type: Comment
has text: The rollback is only for testing-purposes. I think the author did this, to prepare the db to be just the same before every execution.
comment on: http://stackoverflow.com/a/23197244

http://stackoverflow.com/q/23225970
tagged with: eclipse
answer count: 1
has title: Eclipse - Shortcut that toggles between Caller and Callee Hierarchy
has body: Eclipse provides the shortcut "Ctrl + Alt + H" that opens the Call Hierarchy. I find this very helpful, however, I often find myself needing to toggle between the Caller Hierarchy, and the Callee Hierarchy. Is there a way to do this without mouse-clicking on the respective icons?
type: UnansweredQuestion
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/23226240
type: Question

http://stackoverflow.com/q/23284722
has body: so I am trying to have my program read a list of lines from a txt file. This is then displayed in a JTextArea. The user can input data using the JTextField and the goal is to display "Hooray" if the user matches the text in the JArea and "Wrong!" if they do not. Any help is appreciated. public class TextArea1 { JTextArea text; JFrame frame; JTextField textField; public int k; public ArrayList aList; public String correctAnswer; public static void main(String[] args) { TextArea1 gui = new TextArea1(); gui.go(); } private String textLine; public void go() { frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JPanel panel = new JPanel(); textField = new JTextField(""); textField.addActionListener(new startTextFieldListener("correct answer")); JButton startButton = new JButton("Start!"); startButton.addActionListener(new startButtonListener(aList)); text = new JTextArea(30, 60); text.setLineWrap(true); JScrollPane scroller = new JScrollPane(text); scroller.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); scroller.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); panel.add(scroller); frame.getContentPane().add(BorderLayout.CENTER, panel); frame.getContentPane().add(BorderLayout.WEST, startButton); frame.getContentPane().add(BorderLayout.SOUTH, textField); frame.setSize(350, 300); frame.setVisible(true); } class startButtonListener implements ActionListener { ArrayList aList; startButtonListener(ArrayList passedInList) { aList = passedInList; } @Override public void actionPerformed(ActionEvent event) { String fileName = "test.txt"; String line; ArrayList aList = new ArrayList(); try { try (BufferedReader input = new BufferedReader(new FileReader(fileName))) { if (!input.ready()) { throw new IOException(); } while ((line = input.readLine()) != null) { aList.add(line); } } } catch (IOException e) { System.out.println(e); } int sz = aList.size(); for (int k = 0; k &lt; sz; k++) { String correctAnsw…
has comment: http://stackoverflow.com/comment/35640827
tagged with: awt
has comment: http://stackoverflow.com/comment/35641174
has comment: http://stackoverflow.com/comment/35640922
has comment: http://stackoverflow.com/comment/35640783
has answer: http://stackoverflow.com/a/23285115
type: AnsweredQuestion
has title: JTextArea ArrayList string data and JTextField input data not matching
has comment: http://stackoverflow.com/comment/35642043
tagged with: java
possible better answer: http://stackoverflow.com/a/23285102
tagged with: swing
has answer: http://stackoverflow.com/a/23285102
has comment: http://stackoverflow.com/comment/35642209
type: Question
has comment: http://stackoverflow.com/comment/35640930
has answer: http://stackoverflow.com/a/23286097
accepted answer: http://stackoverflow.com/a/23286097
has comment: http://stackoverflow.com/comment/35640810
tagged with: arraylist
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/35640904
has comment: http://stackoverflow.com/comment/35641082

swing
tags question: http://stackoverflow.com/q/23153233
tags question: http://stackoverflow.com/q/23248657
tags question: http://stackoverflow.com/q/23260801
tags question: http://stackoverflow.com/q/23189685
tags question: http://stackoverflow.com/q/23217450
tags question: http://stackoverflow.com/q/23213678
tags question: http://stackoverflow.com/q/23261357
tags question: http://stackoverflow.com/q/23175408
tags question: http://stackoverflow.com/q/23175745
tags question: http://stackoverflow.com/q/23142142
tags question: http://stackoverflow.com/q/23173042
tags question: http://stackoverflow.com/q/23179139
tags question: http://stackoverflow.com/q/23278903
tags question: http://stackoverflow.com/q/23174351
tags question: http://stackoverflow.com/q/23176863
tags question: http://stackoverflow.com/q/23249399
tags question: http://stackoverflow.com/q/23179496
tags question: http://stackoverflow.com/q/23259503
tags question: http://stackoverflow.com/q/23178563
tags question: http://stackoverflow.com/q/23201984
tags question: http://stackoverflow.com/q/23270420
tags question: http://stackoverflow.com/q/23186750
tags question: http://stackoverflow.com/q/23227189
tags question: http://stackoverflow.com/q/23165748
tags question: http://stackoverflow.com/q/23168652
tags question: http://stackoverflow.com/q/23177175
tags question: http://stackoverflow.com/q/23158604
tags question: http://stackoverflow.com/q/23178106
tags question: http://stackoverflow.com/q/23184024
tags question: http://stackoverflow.com/q/23266605
tags question: http://stackoverflow.com/q/23251319
tags question: http://stackoverflow.com/q/23157938
tags question: http://stackoverflow.com/q/23215882
tags question: http://stackoverflow.com/q/23225572
tags question: http://stackoverflow.com/q/23225885
tags question: http://stackoverflow.com/q/23201275
tags question: http://stackoverflow.com/q/23240251
tags question: http://stackoverflow.com/q/23225389
tags question: http://stackoverflow.com/q/23206079
tags question: http://stackoverflow.com/q/23222606
tags question: http://stackoverflow.com/q/23221528
tags question: http://stackoverflow.com/q/23234780
tags question: http://stackoverflow.com/q/23167319
tags question: http://stackoverflow.com/q/23284722
tags question: http://stackoverflow.com/q/23263009
tags question: http://stackoverflow.com/q/23286680
tags question: http://stackoverflow.com/q/23156874
tags question: http://stackoverflow.com/q/23233473
tags question: http://stackoverflow.com/q/23181288
tags question: http://stackoverflow.com/q/23253002
tags question: http://stackoverflow.com/q/23165581
tags question: http://stackoverflow.com/q/23186352
tags question: http://stackoverflow.com/q/23271351
tags question: http://stackoverflow.com/q/23203392
tags question: http://stackoverflow.com/q/23210865
tags question: http://stackoverflow.com/q/23144873
tags question: http://stackoverflow.com/q/23154600
tags question: http://stackoverflow.com/q/23138945
tags question: http://stackoverflow.com/q/23244186
tags question: http://stackoverflow.com/q/23206309
tags question: http://stackoverflow.com/q/23152786
tags question: http://stackoverflow.com/q/23201030
tags question: http://stackoverflow.com/q/23179053
tags question: http://stackoverflow.com/q/23258875
tags question: http://stackoverflow.com/q/23273989
tags question: http://stackoverflow.com/q/23170603
tags question: http://stackoverflow.com/q/23288050
tags question: http://stackoverflow.com/q/23130694
tags question: http://stackoverflow.com/q/23254166
tags question: http://stackoverflow.com/q/23201818
tags question: http://stackoverflow.com/q/23255734
tags question: http://stackoverflow.com/q/23188305
tags question: http://stackoverflow.com/q/23285288
tags question: http://stackoverflow.com/q/23144895
tags question: http://stackoverflow.com/q/23205784
tags question: http://stackoverflow.com/q/23188597
tags question: http://stackoverflow.com/q/23199840
tags question: http://stackoverflow.com/q/23180870
tags question: http://stackoverflow.com/q/23267509
tags question: http://stackoverflow.com/q/23163081

http://stackoverflow.com/q/23251103
answer count: 4
has comment: http://stackoverflow.com/comment/35577930
tagged with: java.util.scanner
has comment: http://stackoverflow.com/comment/35578018
accepted answer: http://stackoverflow.com/a/23251173
has body: I need to get the values as strings. How do I do this? In the first set of directions I was given seven numbers as integers. So I set all the variables up as integers besides players, but I also want to get all values as strings. import java.util.Scanner; public class Baseball { public static void main(String[] args) { //opens a new scanner instance Scanner baseball = new Scanner(System.in); // Allows a person to enter players name System.out.print("Enter the Players Name: "); // reads the users entry and assigns it the String "players" String players = baseball.nextLine(); // Allows a person to enter the amount of at bats System.out.print("Enter the amount of at bats: "); // reads the users entry and assigns it the int "atBats" int atBats = baseball.nextInt(); // Allows a person to enter home runs System.out.print("Enter the amount of homeruns: "); // reads the users entry and assigns it the int "homeruns" int homeruns = baseball.nextInt(); // Allows a person to enter walks System.out.print("Enter the amount of walks: "); // reads the users entry and assigns it the int "walks" int walks = baseball.nextInt(); // Allows a person to enter Doubles System.out.print("Enter the amount of doubles: "); // reads the users entry and assigns it the int "doubles" int doubles = baseball.nextInt(); // Allows a person to enter Triples System.out.print("Enter the amount of triples: "); int triples = baseball.nextInt(); // Allows a person to enter hits System.out.print("Enter the amount of hits: "); int hits = baseball.nextInt(); baseball.close(); //calculates singles int singles = (hits - homeruns - doubles - triples); battingAverage(hits, atBats); onBasePercentage(hits, atBats, walks); sluggingPercentage(singles, doubles, triples, homeruns, atBats); } //method that calculates battingAverage public static void battingAverage(int hits, int atBats) { Double average = (double) (hits / atBats); System.out.println("The batting average is: " + average); } //method that calculates onBaseP…
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23251303
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/35577938
has answer: http://stackoverflow.com/a/23251177
type: Question
has title: Getting string from an int input
possible better answer: http://stackoverflow.com/a/23251188
has answer: http://stackoverflow.com/a/23251173
has answer: http://stackoverflow.com/a/23251188

http://stackoverflow.com/a/23308338
has body: I don't know exactly what a 'serial interface file in Linux' is. But I assume it is a simple file which has some text appended all the time and you want to wait for the new stuff appended and not read the whole file from scratch. You could use the RandomAccessFile class' seek(long) method to skip data. Or you could just sleep for some time when you reached the end of file. public static void main(String[] args) throws Exception { FileInputStream fis = new FileInputStream("src/file.txt"); int i = 0; while (i &lt; 50) { // read only 50 bytes byte b = (byte)fis.read(); if (b == -1) { // end of file, wait Thread.sleep(500L); continue; } System.out.print((char) b); i++; } fis.close(); } This is just a simple example. I read only up to 50 bytes, but you want to read much more than that. Maybe you could use a timeout.
accepted answer of: http://stackoverflow.com/q/23288595
answers question: http://stackoverflow.com/q/23288595
type: AcceptedAnswer
downvote count: 0
score: 1
type: Answer
upvote count: 1

http://stackoverflow.com/comment/35602749
type: Comment
score: 0
comment on: http://stackoverflow.com/a/23263864
type: AnswerComment
has text: I had seen ur answer and I am trying also, please provide me some brief example.

http://stackoverflow.com/comment/35446562
score: 1
has text: Post the stack trace.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23177003

http://stackoverflow.com/q/23239703
type: AnsweredQuestion
has body: I have to draw an EQ triangle, and the coordinates of two points are already given. I'm using the drawPolygon method, and so I have to find the third point out. int xCoord[] = {x1, x2, ?}; int yCoord[] = {y1, y2, ?}; g.drawPolygon(xCoord, yCoord, 3);
upvote count: 0
has answer: http://stackoverflow.com/a/23239970
tagged with: java
has answer: http://stackoverflow.com/a/23241331
accepted answer: http://stackoverflow.com/a/23241331
tagged with: coordinates
type: Question
tagged with: draw
answer count: 2
tagged with: polygon
score: -2
has comment: http://stackoverflow.com/comment/35557539
has comment: http://stackoverflow.com/comment/35557593
possible better answer: http://stackoverflow.com/a/23239970
favorite count: 0
tagged with: geometry
downvote count: 2
has title: How to draw an equilateral triangle when two points are already given?

http://stackoverflow.com/comment/35623445
has text: Other than the `+`, what other characters does it contain? What rules do you have for converting it?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23275480

http://stackoverflow.com/comment/35454814
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23180992
has text: what about masking? Is it possible to apply say 10 different masks for each to have the different piece?

http://stackoverflow.com/comment/35595657
comment on: http://stackoverflow.com/a/23232188
score: 0
type: Comment
has text: With time in URL its not working.how can i writen URL with time
type: AnswerComment

odata
tag name: odata
tags question: http://stackoverflow.com/q/23210805
type: Tag

http://stackoverflow.com/a/23244360
has body: In DB2, SQLCODE SQL0181 means that the given representation is not valid db2 ? sql0181 However, when I write in DB2 your date, it accepts it: db2 "values timestamp('0001-01-01 00:00:00.000000')" 1 -------------------------- 0001-01-01 00:00:00.000000 1 record(s) selected. However, when I put an invalid date, like 13 months, it returns your error code db2 "values timestamp('0001-13-01 00:00:00.000000')" 1 -------------------------- SQL0181N The string representation of a datetime value is out of range. I think you have a problem of locale and regional settings that does not correspond to the provided datetime. Run this command, and then start modifying the date db2 "values current timestamp" Table 6. Datetime Limits Smallest TIMESTAMP value 0001-01-01-00.00.00.000000000000 Largest TIMESTAMP value 9999-12-31-24.00.00.000000000000 http://pic.dhe.ibm.com/infocenter/db2luw/v10r5/topic/com.ibm.db2.luw.sql.ref.doc/doc/r0001029.html
answers question: http://stackoverflow.com/q/23242000
has comment: http://stackoverflow.com/comment/35569031
downvote count: 0
has comment: http://stackoverflow.com/comment/35568866
has comment: http://stackoverflow.com/comment/35566027
has comment: http://stackoverflow.com/comment/35567118
type: Answer
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/35568669

http://stackoverflow.com/comment/35608538
has text: All of my JSPs are stored in WEB-INF since it ensures the user cannot access them without going through the servlet, the user MUST go through the servlet or dynamic function will not work. I've fixed the mismatch though, thanks. Although that doesn't actually solve anything.
comment on: http://stackoverflow.com/q/23267506
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/23254234
possible better answer: http://stackoverflow.com/a/23254339
has comment: http://stackoverflow.com/comment/35584200
upvote count: 1
downvote count: 0
has body: So I'm trying to get the latest version of Java. When I run: java -version I get: java version "1.6.0_65" Java(TM) SE Runtime Environment (build 1.6.0_65-b14-462-11M4609) Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-462, mixed mode) When I run: javac -version I get: javac 1.6.0_65 Now I've just downloaded and installed JDK 8. When I go into System Preferences --> Java --> Update, I see: Your system has the recommended vesion of Java. Java 8 Update 05. I guess I have a few questions: 1) Don't I want the JDK and my version of Java to match up? 2) Why does my Java Control Panel claim I have Java 8, but my work in the terminal (when checking my Java version) says otherwise? Thanks for the help, Mariogs
favorite count: 0
has comment: http://stackoverflow.com/comment/35584210
answer count: 5
has title: Confusion about Java Versions
accepted answer: http://stackoverflow.com/a/23254341
has answer: http://stackoverflow.com/a/23254339
has comment: http://stackoverflow.com/comment/35584201
has answer: http://stackoverflow.com/a/51535737
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23254343
score: 1
has answer: http://stackoverflow.com/a/23254341
tagged with: java
has answer: http://stackoverflow.com/a/23254484
type: Question

documentfilter
tags question: http://stackoverflow.com/q/23180781
tags question: http://stackoverflow.com/q/23175938
tag name: documentfilter
type: Tag
tags question: http://stackoverflow.com/q/23186316

http://stackoverflow.com/q/23176717
has answer: http://stackoverflow.com/a/58311252
has answer: http://stackoverflow.com/a/23176765
score: 30
possible better answer: http://stackoverflow.com/a/58311252
type: Question
tagged with: heroku
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23176765
has body: I'm working on a Java project and have been using a Tomcat server for local testing. However I am about to push up to Heroku and I found an article that suggests to use "embedded" Tomcat. I looked around to see what exactly "embedded" meant in the context of a Java server but it seems like everyone on Google already understands what "embedded" means. I don't. What is the difference between deploying a "regular" Tomcat server and an "embedded" one?
tagged with: java
tagged with: webserver
has title: Embedded vs Non-Embedded Java Server
answer count: 3
downvote count: 0
tagged with: tomcat
has answer: http://stackoverflow.com/a/23176773
favorite count: 0
upvote count: 30

http://stackoverflow.com/comment/35512639
comment on: http://stackoverflow.com/a/23211967
type: AnswerComment
score: 0
type: Comment
has text: Thanks it works.But just asking is there a better way to do it? can it be achieved even more efficiently?

http://stackoverflow.com/q/23184024
has comment: http://stackoverflow.com/comment/35459405
answer count: 1
accepted answer: http://stackoverflow.com/a/23184155
has title: Java Swing: Making a Combo Box error message
has body: I'm fairly new to Java Swing and I'm currently trying to figure out how to make a catch error for a combo box. It was fairly easy with a text box where I could simply .getText() and .equals() it to a value I wanted it to catch for, such as if(!textFrame.getText().trim().equals("")){ do Stuff }else{ errorMessage.setText("You need to fill that field"); } How do I do this same thing, but with a combo box? Something along the lines of: if(!comboBox.getScrollValue().equals("Value")){ do Stuff }else{ errorMessage.setText("You need to select a thingy");
tagged with: combobox
has comment: http://stackoverflow.com/comment/35460108
has comment: http://stackoverflow.com/comment/35458150
score: 0
tagged with: java
tagged with: error-handling
tagged with: swing
has answer: http://stackoverflow.com/a/23184155
type: Question
type: AnsweredQuestion

http://stackoverflow.com/q/23262569
answer count: 1
accepted answer: http://stackoverflow.com/a/23262622
score: 0
tagged with: http://stackoverflow.com/tag/csv
tagged with: opencsv
favorite count: 0
has comment: http://stackoverflow.com/comment/35599015
upvote count: 1
has comment: http://stackoverflow.com/comment/35599208
has answer: http://stackoverflow.com/a/23262622
type: AnsweredQuestion
has title: Unnecessary double quotes added to rows of CVS file when opening with notepad/notepad++
tagged with: java
has comment: http://stackoverflow.com/comment/35599139
has comment: http://stackoverflow.com/comment/35599174
downvote count: 1
type: Question
tagged with: jakarta-ee
has body: I am creating a CSV file using openCsv jar. If I am opening generated CSV file in spreadsheet then its fine. But same if I open with notepad/Notepad++ then its adding extra double inverted comma in each row. Any help how can I fix that?

http://stackoverflow.com/comment/39585889
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/23287076
type: Comment
has text: what version of smack are you using here ,smack-core-4.0.3.jar and smack-bosh-4.0.3.jar,but unable to even log in to server,can you please tell me what library(.jar files ) are you using for above code to be able to run!!!!

http://stackoverflow.com/comment/35577790
score: 0
comment on: http://stackoverflow.com/q/23250954
has text: @VirtualTroll: Sorry, but that's unhelpful as I am a beginner and do not understand half of that. Also, please don't tell me something like "hasNextLine" because I never had to do that before.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35546128
type: Comment
has text: oh god i fixed it, i dont know how though lmao
comment on: http://stackoverflow.com/a/23232829
type: AnswerComment
score: 0

http://stackoverflow.com/comment/35627181
has text: Error message could be helpful.
comment on: http://stackoverflow.com/q/23277528
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35533350
type: Comment
comment on: http://stackoverflow.com/a/23226166
type: AnswerComment
score: 0
has text: It actually has little to do with Garbage Collection -- garbage collection deals with freeing memory by detecting unused objects, while the behaviour above has more to do with the JVM threading model. Most languages implements multi-threading in a similar pattern, where you would supply the code to run (the Runnable in Java) and the language library takes care of working with the OS to allocate threads, run the supplied code, and clean up.

http://stackoverflow.com/q/23134373
upvote count: 3
tagged with: java
type: Question
has title: Audit fields of a class using a class level annotation (aspectj)
tagged with: aspectj
answer count: 2
has comment: http://stackoverflow.com/comment/35374468
downvote count: 0
favorite count: 0
has body: I'm writing a simple auditing framework with aspectj, which allows me to audit the fields of a class which are annotated with an @Audit annotation. As value the @Audit annotation expects an array of field names to be watched Example Usage: @Audit({"name","phoneNumber"}) class User { private String name; private String phoneNumber; public getName(){ return name; }; public setName(String name){ this.name=name; } } How does the Aspect look that watches the assignment of fields that are annotated like in the above example? Here the stub of my first try: @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.TYPE}) public @interface Audit { String[] value() } @Aspect class AuditAspect { @Pointcut("????") public void markedFieldWasModified(){} @AfterReturning("markedFieldWasModified()") public void addFieldToModifiedFields(JoinPoint jp, AuditableEO eo){ eo.addModifiedField(jp.getSignature().getName()); } // inter Type declarations public interface IAuditableEO { public Iterator&lt;String&gt; modifiedFields(); public boolean modified(); public boolean addModifiedField(String field); }; }
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23137519
has answer: http://stackoverflow.com/a/23455145
score: 3

http://stackoverflow.com/q/23187582
has answer: http://stackoverflow.com/a/23187636
type: AnsweredQuestion
upvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/35465024
tagged with: nullpointerexception
type: Question
has comment: http://stackoverflow.com/comment/35465487
accepted answer: http://stackoverflow.com/a/23187636
score: -1
has title: How to solve java.lang.NullPointerException
downvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/35465031
has body: Hi everyone I keep getting this error java.lang.NullPointerException can you please help me fix it for (int i = 0; i &lt; lst.size(); i++){ Movie movie = (Movie) ((Object[]) lst.get(i))[0]; Category c = (Category) ((Object[]) lst.get(i))[1]; if(movie == null){ System.out.println("the Object movie is null"); movie = (Movie) ((Object[]) lst.get(i))[0]; Movie_List.add(movie); }else{ Movie_List.add(movie); } } even if I do the test to see if the object movie is null it does not show the message so it is not null so what is the problem? please help me
tagged with: java

http://stackoverflow.com/q/23189063
tagged with: android
has title: TabHost + Youtube Player LIST API : Implicit intents with startService are not safe
has body: You try everything and still failing. If I try to do without TabHost works perfectly. What I need is to show a list of videos from youtube in a TAB. But the process can not start. thank you very much click IMAGE Implicit intents with startService are not safe: Intent { act=com.google.android.youtube.api.service.START } android.content.ContextWrapper.bindService:517 com.google.android.youtube.player.internal.r.e:-1 com.google.android.youtube.player.YouTubeThumbnailView.initialize:-1 MainActivity.java package z.YoutubeAPI.List.zyoulistlayouts.app; import android.app.TabActivity; import android.content.Intent; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.widget.TabHost; public class MainActivity extends TabActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // create the TabHost that will contain the Tabs final TabHost tabHost = getTabHost(); TabHost.TabSpec tab1 = tabHost.newTabSpec("First Tab"); TabHost.TabSpec tab2 = tabHost.newTabSpec("Second Tab"); TabHost.TabSpec tab3 = tabHost.newTabSpec("Third tab"); // Set the Tab name and Activity // that will be opened when particular Tab will be selected tab1.setIndicator("Tab1"); Intent intent = new Intent(this,Tab1Activity.class); tab1.setContent(intent); tab2.setIndicator("Tab2"); tab2.setContent(new Intent(this,Tab2Activity.class)); tab3.setIndicator("Tab3"); tab3.setContent(new Intent(this,Tab3Activity.class)); tabHost.addTab(tab1); tabHost.addTab(tab2); tabHost.addTab(tab3); } @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 pare…
answer count: 0
type: UnansweredQuestion
tagged with: youtube
score: 1
tagged with: java
type: Question
upvote count: 1
downvote count: 0
favorite count: 0

http://stackoverflow.com/q/23221838
has comment: http://stackoverflow.com/comment/35527877
favorite count: 0
has comment: http://stackoverflow.com/comment/35525532
has comment: http://stackoverflow.com/comment/35525582
has answer: http://stackoverflow.com/a/23222058
has comment: http://stackoverflow.com/comment/35526352
tagged with: php
type: AnsweredQuestion
score: 1
tagged with: wampserver
tagged with: java
has comment: http://stackoverflow.com/comment/35526746
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/35525556
accepted answer: http://stackoverflow.com/a/23222008
has body: Hi I'm new to programming in PHP. I use a WAMP server -> Apache version 2.4.4 and PHP version 5.4.16 I want to execute java program from php script, here's my java program file : test.java import java.io.*; public class test { public static void main(String args[]) { System.out.println("Hello World"); } } I used exec("javac test.java"); exec(java test); and it's no use. So then I tried to put the command code in "runfile.bat" javac test.java &gt; error.txt java test &gt; output.txt when I execute runfile.bat by left clicking twice, it run perfectly and there's text "Hello World" in output.txt then I try from PHP: exec('start /B /C runfile.bat'); ... and output.txt has nothing in it.
possible better answer: http://stackoverflow.com/a/23222058
has comment: http://stackoverflow.com/comment/35525697
has title: running java ".class" in PHP
answer count: 2
has answer: http://stackoverflow.com/a/23222008
downvote count: 0

http://stackoverflow.com/comment/35575979
score: 0
comment on: http://stackoverflow.com/q/23249619
type: Comment
type: QuestionComment
has text: You have to first work out what you want to happen, then you (with our help) can implement that. What would you like to happen?

arrays
tags question: http://stackoverflow.com/q/23186231
tags question: http://stackoverflow.com/q/23233060
tags question: http://stackoverflow.com/q/23278447
tags question: http://stackoverflow.com/q/23143326
tags question: http://stackoverflow.com/q/23218181
tags question: http://stackoverflow.com/q/23201884
tags question: http://stackoverflow.com/q/23153750
tags question: http://stackoverflow.com/q/23176968
tags question: http://stackoverflow.com/q/23166739
tags question: http://stackoverflow.com/q/23158493
tags question: http://stackoverflow.com/q/23155333
tags question: http://stackoverflow.com/q/23250438
tags question: http://stackoverflow.com/q/23206047
tags question: http://stackoverflow.com/q/23137331
tags question: http://stackoverflow.com/q/23247499
tags question: http://stackoverflow.com/q/23275539
type: Tag
tags question: http://stackoverflow.com/q/23131733
tags question: http://stackoverflow.com/q/23210138
tags question: http://stackoverflow.com/q/23279647
tags question: http://stackoverflow.com/q/23250947
tags question: http://stackoverflow.com/q/23174057
tags question: http://stackoverflow.com/q/23162459
tags question: http://stackoverflow.com/q/23187254
tags question: http://stackoverflow.com/q/23208585
tags question: http://stackoverflow.com/q/23186123
tags question: http://stackoverflow.com/q/23245603
tags question: http://stackoverflow.com/q/23165611
tags question: http://stackoverflow.com/q/23181592
tags question: http://stackoverflow.com/q/23175413
tags question: http://stackoverflow.com/q/23278367
tags question: http://stackoverflow.com/q/23286383
tags question: http://stackoverflow.com/q/23266347
tags question: http://stackoverflow.com/q/23189791
tags question: http://stackoverflow.com/q/23221415
tags question: http://stackoverflow.com/q/23203627
tags question: http://stackoverflow.com/q/23188575
tags question: http://stackoverflow.com/q/23196403
tags question: http://stackoverflow.com/q/23187111
tags question: http://stackoverflow.com/q/23147941
tags question: http://stackoverflow.com/q/23145059
tags question: http://stackoverflow.com/q/23154464
tags question: http://stackoverflow.com/q/23133274
tags question: http://stackoverflow.com/q/23150853
tags question: http://stackoverflow.com/q/23188454
tags question: http://stackoverflow.com/q/23185162
tags question: http://stackoverflow.com/q/23164988
tags question: http://stackoverflow.com/q/23258045
tags question: http://stackoverflow.com/q/23204544
tags question: http://stackoverflow.com/q/23152199
tags question: http://stackoverflow.com/q/23226116
tags question: http://stackoverflow.com/q/23168342
tags question: http://stackoverflow.com/q/23277777
tags question: http://stackoverflow.com/q/23191701
tags question: http://stackoverflow.com/q/23178440
tags question: http://stackoverflow.com/q/23159624
tags question: http://stackoverflow.com/q/23172447
tags question: http://stackoverflow.com/q/23188767
tags question: http://stackoverflow.com/q/23227678
tags question: http://stackoverflow.com/q/23212291
tags question: http://stackoverflow.com/q/23177770
tags question: http://stackoverflow.com/q/23189282
tags question: http://stackoverflow.com/q/23232020
tags question: http://stackoverflow.com/q/23231387
tags question: http://stackoverflow.com/q/23151049
tags question: http://stackoverflow.com/q/23267247
tags question: http://stackoverflow.com/q/23177151
tags question: http://stackoverflow.com/q/23159454
tags question: http://stackoverflow.com/q/23278321
tags question: http://stackoverflow.com/q/23130871
tags question: http://stackoverflow.com/q/23197874
tags question: http://stackoverflow.com/q/23284259
tags question: http://stackoverflow.com/q/23160832
tags question: http://stackoverflow.com/q/23159326
tags question: http://stackoverflow.com/q/23199870
tags question: http://stackoverflow.com/q/23146584
tags question: http://stackoverflow.com/q/23170675
tags question: http://stackoverflow.com/q/23189292
tags question: http://stackoverflow.com/q/23161272
tags question: http://stackoverflow.com/q/23181288

http://stackoverflow.com/q/23283483
type: UnansweredQuestion
tagged with: google-app-engine
upvote count: 1
score: 1
tagged with: java
has title: Can't upload and download files from google cloud storage when deployed
has comment: http://stackoverflow.com/comment/35640037
tagged with: google-cloud-storage
has body: I can upload and download files from google cloud storage locally. However, when I deployed the code on google app engine, I can't succeed. I thought it may due to access limitation, but isn't the storage open for its corresponding project? here's my java code: public class DataStorageTestServlet extends HttpServlet { private final GcsService gcsService = GcsServiceFactory.createGcsService(RetryParams.getDefaultInstance()); public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException { resp.setContentType("text/plain"); byte[] file = {1, 2, 3, 4, 5, 6}; GcsFilename fileName = new GcsFilename("charlie-first-bucket", "a"); writeToFile(fileName, file); resp.getWriter().println(readFromFile(fileName)); } Here's the log status: Error for /datastoragetest java.lang.NoClassDefFoundError: com/google/api/client/http/HttpRequestInitializer at com.google.appengine.tools.cloudstorage.oauth.OauthRawGcsServiceFactory.(OauthRawGcsServiceFactory.java:29) at com.google.appengine.tools.cloudstorage.GcsServiceFactory.createRawGcsService(GcsServiceFactory.java:42) at com.google.appengine.tools.cloudstorage.GcsServiceFactory.createGcsService(GcsServiceFactory.java:34) at com.example.test.DataStorageTestServlet.(DataStorageTestServlet.java:23) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:526) at java.lang.Class.newInstance(Class.java:370) at org.mortbay.jetty.servlet.Holder.newInstance(Holder.java:153) at org.mortbay.jetty.servlet.ServletHolder.initServlet(ServletHolder.java:428) at org.mortbay.jetty.servlet.ServletHolder.getServlet(ServletHolder.java:339) at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487) at org.mortbay.jetty.servlet.ServletHandler$Cache…
type: Question
answer count: 2
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/32810852
has answer: http://stackoverflow.com/a/23318764
has comment: http://stackoverflow.com/comment/35702182

http://stackoverflow.com/q/23164175
type: Question
answer count: 1
tagged with: sorting
score: 0
has title: Passing data from a link-stack to a sorting array, then adding it back
has body: public void sort(int NumElements) { int[] numbers = new int[node - 1]; int temphead = head; for(int i = NumElements; i &gt; 1; i--) // for statement grabbing values to sort. { if(stack.getfloor(temphead) != 0) { numbers[i] = (stack.getfloor(temphead)); } temphead = stack.getBLink(temphead); } int tempVar; for (int i = 0; i &lt; numbers.length; i++) // bubble sort. { for(int j = 1; j &lt; numbers.length - 1; j++) { if(numbers[i] &gt; numbers[j + 1]) { tempVar = numbers [j + 1]; numbers [j + 1] = numbers [i]; numbers [i] = tempVar; } } } int temphead2 = head; for(int i = NumElements; i &gt; 1; i--) { remove(); // removes all vales } for(int i = NumElements; i &gt; 1; i--) { insert(1,numbers[i]); // adds all vales } } Fulling working: Working with "Double link Queue" -> "handle by stack" -> "Basic attribute tree" The Above has been fixed And is part of the Double link queue Sort method. The sort method as shown calls stack. The stack has basic methods to hold and give data when called. The stack is a link stack. After such infomation is requested from its methods the following functions puts the Floor levels it got back randomly from stack, Aka the queue path. after it used its bubble sort to order it in the following the old data in the stack is removed and free up for use. the sort the Puts "Numbers[i] the sorted array back into the stack. it does this by using basic sort methods in the double link and basic removes. If you wish to see the full code, i will gladly send it.
type: AnsweredQuestion
tagged with: stack
tagged with: java
has answer: http://stackoverflow.com/a/23164304
accepted answer: http://stackoverflow.com/a/23164304

http://stackoverflow.com/comment/35625047
type: Comment
has text: May help if example shows a situation that more resembles what @filippo was asking for, when you only do reads and no writes during that time.
type: AnswerComment
comment on: http://stackoverflow.com/a/23273588
score: 0

http://stackoverflow.com/q/23219951
answer count: 1
has answer: http://stackoverflow.com/a/23221987
type: UnansweredQuestion
tagged with: web-applications
tagged with: internationalization
tagged with: jsf
tagged with: java
has comment: http://stackoverflow.com/comment/35528584
has comment: http://stackoverflow.com/comment/35529823
has comment: http://stackoverflow.com/comment/35523773
type: Question
tagged with: jakarta-ee
has title: Muti language support in single web page
has body: I have come across a requirement which I have never experienced before. I have a web page in which I have to show two language equivalent of a sentence. Like How are you? (In english) ¿Cómo está usted (In Spanish) So far, I have used the concept of Internalization which would change the locale and convert complete web page (other than database driven values) into the selected locale. If the locale is set to Spanish, complete form will be displayed in Spanish. Here requirement is that both language string should be displayed next to each one. Update: Here is the image of my sample web page.
score: 0

http://stackoverflow.com/comment/35445732
type: Comment
type: QuestionComment
has text: I tried using jsoup but it didn't quite work, it must be something wrong that i did, i just want a code that will display the pictures from my website (www.eversorandom.com) doesnt have to be jsoup. i'm using jquery on Dreamweaver and my knowledge is a bit limited.
comment on: http://stackoverflow.com/q/23176354
score: 0

http://stackoverflow.com/q/23187772
has comment: http://stackoverflow.com/comment/35478202
has comment: http://stackoverflow.com/comment/35478806
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/35474005
has comment: http://stackoverflow.com/comment/35475630
type: Question
has comment: http://stackoverflow.com/comment/35473547
linked to: http://stackoverflow.com/q/4628800
has comment: http://stackoverflow.com/comment/35478427
has comment: http://stackoverflow.com/comment/35491347
downvote count: 0
has comment: http://stackoverflow.com/comment/35475986
favorite count: 0
has comment: http://stackoverflow.com/comment/35480330
has comment: http://stackoverflow.com/comment/35480023
tagged with: pinchzoom
tagged with: android
has comment: http://stackoverflow.com/comment/35484424
has comment: http://stackoverflow.com/comment/35478632
tagged with: horizontalscrollview
linked to: http://stackoverflow.com/q/23358112
has title: how to pass pinch zoom event from a ViewGroup to multiple child Views
has comment: http://stackoverflow.com/comment/35473727
has comment: http://stackoverflow.com/comment/35473304
has comment: http://stackoverflow.com/comment/35465444
has comment: http://stackoverflow.com/comment/35474136
answer count: 0
has comment: http://stackoverflow.com/comment/35473913
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35479485
has comment: http://stackoverflow.com/comment/35774583
upvote count: 1
has comment: http://stackoverflow.com/comment/35479176
has body: I am making an app that is using HorizontalScrollView for showing list of items. So I have multiple views inside HorizontalScrollView for horizontal scrolling. I am changing the layout size of a view on detecting pinch zoom according to scaleFactor I have implemented it at view level so when user pinch zoom having both finger inside a single view, that view is detecting pinch zoom and changing its size but when I pinch zoom with my fingers in different views this is not working. I want to extend this so when user pinch zoom having fingers on different views, all the views which are between two fingers should change its size dynamically. Can anyone suggest me on how to extend this idea and make it work. public CenterLockHorizontalScrollview(Context context, AttributeSet attrs) { super(context, attrs); this.context = context; this.setSmoothScrollingEnabled(true); detector = new ScaleGestureDetector(context, new ScaleListener()); } public boolean onTouchEvent(MotionEvent ev) { return super.onTouchEvent(ev); } public void setAdapter(Context context, CustomListAdapter mAdapter) { try { this.kk=mAdapter; fillViewWithAdapter(mAdapter); } catch (ZeroChildException e) { e.printStackTrace(); } } private void fillViewWithAdapter(CustomListAdapter mAdapter) throws ZeroChildException { if (getChildCount() == 0) { throw new ZeroChildException( "CenterLockHorizontalScrollView must have one child"); } if (getChildCount() == 0 || mAdapter == null) { Log.e("Ronak","Came at zero"); return; } parent = (ViewGroup) getChildAt(0); for (int i = 0; i &lt; mAdapter.getCount(); i++) { parent.addView(mAdapter.getView(i, null, parent)); } //System.out.println("number of child is "+parent.getChildCount()); } public ViewGroup takeparent() { return parent; } int start=0; //index of first child view int last=0; //index of last child view float x1,x2,y1,y2; public boolean dispatchTouchEvent(MotionEvent ev) { boolean result = super.dispatchTouchEvent(ev); if (inDifferentView(ev)) { detector.onTouchEv…
tagged with: android-layout
has comment: http://stackoverflow.com/comment/35479617

super
tags question: http://stackoverflow.com/q/23227571
tags question: http://stackoverflow.com/q/23172838
tag name: super
type: Tag
tags question: http://stackoverflow.com/q/23271534

http://stackoverflow.com/comment/35627488
score: 0
type: QuestionComment
has text: The stacktrace says it's a problem with a bitmap in a `RelativeLayout`. So first check that `@drawable/cadremenu` is in fact a valid drawable.
type: Comment
comment on: http://stackoverflow.com/q/23277646

http://stackoverflow.com/q/23196967
score: 0
answer count: 1
tagged with: android
has title: Open Cv Android : how to find all max locations of a Mat
type: UnansweredQuestion
tagged with: opencv
has body: Core.minmaxLoc(Mat).maxLoc returns the first location where the maximum value occurs but when in our Mat if maximum value is occurring on more than one places how to get all places.
has answer: http://stackoverflow.com/a/23198068
tagged with: java
type: Question

http://stackoverflow.com/a/60996645
downvote count: 0
type: Answer
has body: As already stated you need to set at least spring.mail.host in your application properties. Spring Boot autoconfiguration only creates a JavaMailSender bean if the property is set: https://github.com/spring-projects/spring-boot/blob/master/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mail/MailSenderPropertiesConfiguration.java#L38
score: 9
upvote count: 9
answers question: http://stackoverflow.com/q/23246912

http://stackoverflow.com/a/23280817
downvote count: 0
has comment: http://stackoverflow.com/comment/35633724
type: Answer
score: 4
has body: Generics simply don't work with primitive types. Overload your method for the various primitive types like Arrays.toString(..) does.
upvote count: 4
answers question: http://stackoverflow.com/q/23280809

http://stackoverflow.com/comment/35641859
score: 0
has text: @BheshGurung The real situation is a little complicated . I want to create a `JenaOWLModel` for every user, so I create in an Map which map the user's session to the JenaOWLModel. In order to share this Map in all servlets I choose to put the Map into Session.Once an user login, I will put an element to the Map. When the user want to operate the JenaOWLModel, I get it from the Map. In this case, I think I should synchronize the Map and every JenaModel in the Map.Since I'm fresh to web develop, I don't know whether this is a good way.Could you give me some advice?
comment on: http://stackoverflow.com/q/23284403
type: QuestionComment
type: Comment

http://stackoverflow.com/q/23133095
upvote count: 1
favorite count: 0
type: UnansweredQuestion
has body: Suppose the architecture is such that there is Struts framework or jersey resource Facade layer Business layer Data access object layer DAO Though the Input field validation is to be done at presentation layer i.e Struts Action class or jersey resource class But my question is where should business level validation to be done and same outcome to be passed to UI. I.e suppose resource is employee/{employeeId} method DELETE Now first need to verify that employeeId exist or not , so for that validation should be done at resource level, facade level or business level and how it should be any best practice is highly appreciated. Also please note that this business validation require DAO layer access since to check in DB if employeeId really exist. Thanks in advance
has answer: http://stackoverflow.com/a/23133388
downvote count: 0
has answer: http://stackoverflow.com/a/23133945
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/35368171
has title: Where should business validation to be done
type: Question
tagged with: jakarta-ee
has answer: http://stackoverflow.com/a/23133899
answer count: 3

http://stackoverflow.com/comment/35451821
type: QuestionComment
has text: Does this help? http://stackoverflow.com/questions/2410480/csv-reading-in-java
score: 0
comment on: http://stackoverflow.com/q/23180111
type: Comment

http://stackoverflow.com/comment/35439237
score: 0
comment on: http://stackoverflow.com/a/23173011
type: AnswerComment
has text: Yes for val[2] there exists values. Since I initialized with null only it was throwing NullPointerException. I changed it a bit as in above comment and it works :)
type: Comment

http://stackoverflow.com/q/23244207
score: 1
tagged with: java
type: Question
has body: Hard to find the right title... My android application connects to a polar bluetooth chest belt. It receives the bytes and parses the heart rate, rr-interval and so on. When the test person removes the chest belt (sensor), the service still receives data, which are nonsense. Either the rr-intervals are 2295ms or 0ms... First I thought the connection between the service and the polar sensor is kept open, because the service constantly reads the buffer of the bluetooth socket. But as soon as I "reattache" the sensor to the test person I get an error saying bluetooth connection is lost. IMO this is a strange behaviour: I would assume that either: the connection is lost as soon as the test person removes the sensor (maybe a few seconds later) or that the connection is kept open, as long as the service reads data. If the test person is not wearing the sensor the service receives "nonsense" data but as soon as he put the sensor back on the sensor gets the measured values (since the connection is open over the whole time). My question: How can I trigger one of these options?
downvote count: 0
tagged with: bytebuffer
tagged with: bluetooth
tagged with: sockets
tagged with: android
favorite count: 0
has title: Android Bluetooth connection polar - keep sending data after removing chest belt
answer count: 0
type: UnansweredQuestion
upvote count: 1

http://stackoverflow.com/comment/35435991
score: 1
comment on: http://stackoverflow.com/q/23171207
has text: It might be possible to do what you're asking, but that's not how programmers do things in general. Why do you want the variable name to be scanned? Since you're a beginner I'm just guessing that it's more likely that this isn't what you want.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/38445058
type: Answer
answers question: http://stackoverflow.com/q/23222605
score: 2
has body: Looking at the code inside QueryBuilder.java for (FieldType fieldType : tableInfo.getFieldTypes()) { // if this is a foreign field and its foreign-id field is the same as the other's id FieldType foreignIdField = fieldType.getForeignIdField(); if (fieldType.isForeign() &amp;&amp; foreignIdField.equals(joinedQueryBuilder.tableInfo.getIdField())) { joinInfo.localField = fieldType; joinInfo.remoteField = foreignIdField; return; } } // if this other field is a foreign field and its foreign-id field is our id for (FieldType fieldType : joinedQueryBuilder.tableInfo.getFieldTypes()) { if (fieldType.isForeign() &amp;&amp; fieldType.getForeignIdField().equals(idField)) { joinInfo.localField = idField; joinInfo.remoteField = fieldType; return; } } Above states that if you want to make a join using QueryBuilder, you need to make sure you put a join on id field so this seems to me like a limitation of QueryBuilder.java in orm-lite.If you have put up a foreign key as id in Coupon.java It would have worked. A quick workaround should be to use a raw query string to achieve what you want. For example - final GenericRawResults&lt;Coupon&gt; results = couponDao.queryRaw("SELECT " + "product_table.product_id AS id, " + "product_table.store_id AS storeId " + " FROM coupon_table " + "JOIN product_table ON coupon_table.store_id = product_table.store_id " + "WHERE product_table.store_id = 1", new RawRowMapper&lt;Coupon&gt;() { @Override public Coupon mapRow(String[] columnNames, String[] resultColumns) throws SQLException { final Integer productId = Integer.parseInt(resultColumns[0]); final Integer storeId = Integer.parseInt(resultColumns[1]); final Product product = new Product(); product.setId(productId); product.setStoreId(storeId); final Coupon coupon = new Coupon(); coupon.setProduct(product); return coupon; } }); final Coupon coupon = results.getResults().get(0); final Product product = coupon.getProduct(); System.out.println("Product id is " + product.getId() + " , Store id is " + …
upvote count: 2
accepted answer of: http://stackoverflow.com/q/23222605
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/36011024
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23217592
has text: And executing them at large scale if required causes many issues in terms of memory, unwanted cpu utilization..... Instead of that, better we could do it from command line in multiple units saving the memory occupied by eclipse

http://stackoverflow.com/q/23222413
has body: I'm having some annoying problems with the following code, that worked okay until switched to Java 1.7 import javax.xml.validation.SchemaFactory; SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); Running from Netbeans with -Djaxp.debug=1, the following error is thrown: The above snipped code is part of an OSGI bundle JAXP: using thread context class loader (sun.misc.Launcher$AppClassLoader@5e3a78ad) for search JAXP: Looking up system property 'javax.xml.validation.SchemaFactory:http://www.w3.org/2001/XMLSchema' JAXP: The property is undefined. JAXP: found null in $java.home/jaxp.properties JAXP: no META-INF/services/javax.xml.validation.SchemaFactory file was found JAXP: attempting to use the platform default XML Schema validator JAXP: instanciating org.apache.xerces.jaxp.validation.XMLSchemaFactory JAXP: failed to instanciate org.apache.xerces.jaxp.validation.XMLSchemaFactory java.lang.ClassNotFoundException: org.apache.xerces.jaxp.validation.XMLSchemaFactory at java.net.URLClassLoader$1.run(URLClassLoader.java:366) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:354) at java.lang.ClassLoader.loadClass(ClassLoader.java:425) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at java.lang.ClassLoader.loadClass(ClassLoader.java:358) at javax.xml.validation.SchemaFactoryFinder.createInstance(Unknown Source) at javax.xml.validation.SchemaFactoryFinder._newFactory(Unknown Source) at javax.xml.validation.SchemaFactoryFinder.newFactory(Unknown Source) at javax.xml.validation.SchemaFactory.newInstance(Unknown Source) JAXP: unable to find a factory for http://www.w3.org/2001/XMLSchema Exception in thread "AWT-EventQueue-0" java.lang.IllegalArgumentException: http://www.w3.org/2001/XMLSchema I have also made a small Java app with only the factory instance SchemaFactory factory = SchemaFactory.newIns…
tagged with: java
type: Question
answer count: 2
has title: Unable to find a factory for http://www.w3.org/2001/XMLSchema
has answer: http://stackoverflow.com/a/45288653
tagged with: jaxp
score: 0
tagged with: classnotfoundexception
has answer: http://stackoverflow.com/a/23223009
tagged with: http://stackoverflow.com/tag/xml
type: UnansweredQuestion

http://stackoverflow.com/q/23258357
has title: What's the trade-off between using GetPrimitiveArrayCritical and Get<PrimitiveType>ArrayRegion?
favorite count: 0
accepted answer: http://stackoverflow.com/a/46608121
tagged with: multithreading
has body: When bridging c++ and Java using JNI, we always want to avoid unnecessary copying. I found GetPrimitiveArrayCritical might give us a high chance not copying an array. But I don't fully understand its restriction documented here: After calling GetPrimitiveArrayCritical, the native code should not run for an extended period of time before it calls ReleasePrimitiveArrayCritical. We must treat the code inside this pair of functions as running in a "critical region." Inside a critical region, native code must not call other JNI functions, or any system call that may cause the current thread to block and wait for another Java thread. (For example, the current thread must not call read on a stream being written by another Java thread.) These restrictions make it more likely that the native code will obtain an uncopied version of the array, even if the VM does not support pinning. My questions are: What is the exact meaning of extended period of time? So does that mean we can safely call other JNI functions or system call that will never cause the current thread to block and wait for another Java thread? Is GetPrimitiveArrayCritical thread-safe? Is there anything I should know when using GetPrimitiveArrayCritical instead of GetArrayRegion?
score: 29
upvote count: 29
has answer: http://stackoverflow.com/a/25810347
tagged with: c++
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/25687499
type: Question
has answer: http://stackoverflow.com/a/25687499
tagged with: java-native-interface
tagged with: arrays
has answer: http://stackoverflow.com/a/46608121
answer count: 3
downvote count: 0

http://stackoverflow.com/comment/60744802
comment on: http://stackoverflow.com/a/23148514
score: 2
type: AnswerComment
has text: Not really, there's a difference between default and static methods, so let's not confuse those (and other users). This was maybe a good pointer, but not a correct answer.
type: Comment

http://stackoverflow.com/a/23258489
has body: Prefered solution would be to use JLayeredPane as it provides better control over the z-ordering of the components, failing that, you fake it to a certain extent by using Container#add(Component, Object, int) So, basically, whenever you add a card to the UI, you need to do something like... panelMazoUno.add(c, new org.netbeans.lib.awtextra.AbsoluteConstraints(-1, -1, -1, -1), 0); With out z-order correction... With z-order correction... Which is accomplished by simply using... for (Carta c : mazoUno) { c.setBounds(0, i, 50, 100); panelMazoUno.add(c, new org.netbeans.lib.awtextra.AbsoluteConstraints(-1, -1, -1, -1), 0); } for (Carta c : mazoDos) { c.setBounds(0, i, 50, 100); panelMazoDos.add(c, new org.netbeans.lib.awtextra.AbsoluteConstraints(-1, i, -1, -1), 0); i += 15; } for (Carta c : mazoTres) { c.setBounds(0, i, 50, 100); panelMazoTres.add(c, new org.netbeans.lib.awtextra.AbsoluteConstraints(-1, 0, -1, -1), 0); i += 15; } for (Carta c : mazoCuatro) { c.setBounds(0, i, 50, 100); panelMazoCuatro.add(c, new org.netbeans.lib.awtextra.AbsoluteConstraints(-1, -1, -1, -1), 0); i += 15; } for (Carta c : mazoCinco) { c.setBounds(0, i, 50, 100); panelMazoCinco.add(c, new org.netbeans.lib.awtextra.AbsoluteConstraints(-1, -1, -1, -1), 0); i += 15; } for (Carta c : mazoSeis) { c.setBounds(0, i, 50, 100); panelMazoSeis.add(c, new org.netbeans.lib.awtextra.AbsoluteConstraints(-1, -1, i, -1), 0); i += 15; i++; } for (Carta c : mazoSiete) { c.setBounds(0, i, 50, 100); panelMazoSiete.add(c, new org.netbeans.lib.awtextra.AbsoluteConstraints(-1, -1, -1, -1), 0); i += 15; }
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/35633723
has comment: http://stackoverflow.com/comment/35593437
has comment: http://stackoverflow.com/comment/35592190
downvote count: 0
has comment: http://stackoverflow.com/comment/35633894
answers question: http://stackoverflow.com/q/23257903
has comment: http://stackoverflow.com/comment/35592473
type: Answer

http://stackoverflow.com/q/23182950
tagged with: startapp
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35456042
tagged with: java
has title: Displaying an ad on a new thread
type: Question
score: 0
has body: I have a game with different screens. To show an ad on a specific screen I use the method below which use thread. Everything works fine but the ads keeps loading and new ads popup. I want that the ad loads only once. How can I create a thread so the ad methods are called only once. public void displayAd(){ runOnUiThread(new Runnable() { public void run() { startAppAd.showAd(); // show the ad startAppAd.loadAd(); // load the next ad } }); }
tagged with: android
has comment: http://stackoverflow.com/comment/35456134

foreign-keys
tags question: http://stackoverflow.com/q/23193077
tags question: http://stackoverflow.com/q/23193616
tag name: foreign-keys
type: Tag

http://stackoverflow.com/comment/35460926
has text: @mostruash I made the changes but now the runnable file wont run, see the update
comment on: http://stackoverflow.com/q/23185350
score: 0
type: QuestionComment
type: Comment

mysql
tags question: http://stackoverflow.com/q/23268838
tags question: http://stackoverflow.com/q/23282129
tags question: http://stackoverflow.com/q/23284062
tags question: http://stackoverflow.com/q/23172303
tags question: http://stackoverflow.com/q/23174416
tags question: http://stackoverflow.com/q/23175512
tags question: http://stackoverflow.com/q/23244669
tags question: http://stackoverflow.com/q/23167376
tags question: http://stackoverflow.com/q/23280381
tags question: http://stackoverflow.com/q/23176527
tags question: http://stackoverflow.com/q/23200096
tags question: http://stackoverflow.com/q/23186371
tags question: http://stackoverflow.com/q/23199662
tag name: mysql
tags question: http://stackoverflow.com/q/23211050
tags question: http://stackoverflow.com/q/23131340
tags question: http://stackoverflow.com/q/23174060
tags question: http://stackoverflow.com/q/23184923
tags question: http://stackoverflow.com/q/23172484
tags question: http://stackoverflow.com/q/23189677
tags question: http://stackoverflow.com/q/23139545
tags question: http://stackoverflow.com/q/23274735
tags question: http://stackoverflow.com/q/23159928
tags question: http://stackoverflow.com/q/23237883
tags question: http://stackoverflow.com/q/23138281
tags question: http://stackoverflow.com/q/23144448
tags question: http://stackoverflow.com/q/23211711
tags question: http://stackoverflow.com/q/23154116
tags question: http://stackoverflow.com/q/23139707
tags question: http://stackoverflow.com/q/23176551
tags question: http://stackoverflow.com/q/23193616
tags question: http://stackoverflow.com/q/23284095
tags question: http://stackoverflow.com/q/23213579
tags question: http://stackoverflow.com/q/23148202
tags question: http://stackoverflow.com/q/23251525
tags question: http://stackoverflow.com/q/23168120
tags question: http://stackoverflow.com/q/23196282
tags question: http://stackoverflow.com/q/23168979
tags question: http://stackoverflow.com/q/23153250
tags question: http://stackoverflow.com/q/23224512
tags question: http://stackoverflow.com/q/23214330
tags question: http://stackoverflow.com/q/23272500
tags question: http://stackoverflow.com/q/23283939
tags question: http://stackoverflow.com/q/23212654
tags question: http://stackoverflow.com/q/23135416
tags question: http://stackoverflow.com/q/23283704
tags question: http://stackoverflow.com/q/23287895
tags question: http://stackoverflow.com/q/23247746
tags question: http://stackoverflow.com/q/23134163
tags question: http://stackoverflow.com/q/23240702
tags question: http://stackoverflow.com/q/23173905
tags question: http://stackoverflow.com/q/23148859
tags question: http://stackoverflow.com/q/23146419
tags question: http://stackoverflow.com/q/23232254
tags question: http://stackoverflow.com/q/23253212
tags question: http://stackoverflow.com/q/23212428
tags question: http://stackoverflow.com/q/23269075
tags question: http://stackoverflow.com/q/23131494
tags question: http://stackoverflow.com/q/23156988
tags question: http://stackoverflow.com/q/23268501
tags question: http://stackoverflow.com/q/23191387
tags question: http://stackoverflow.com/q/23239161
tags question: http://stackoverflow.com/q/23176436
tags question: http://stackoverflow.com/q/23200729
tags question: http://stackoverflow.com/q/23288119
type: Tag
tags question: http://stackoverflow.com/q/23132715
tags question: http://stackoverflow.com/q/23234137
tags question: http://stackoverflow.com/q/23259768
tags question: http://stackoverflow.com/q/23253494
tags question: http://stackoverflow.com/q/23151309
tags question: http://stackoverflow.com/q/23143460
tags question: http://stackoverflow.com/q/23212491
tags question: http://stackoverflow.com/q/23172199
tags question: http://stackoverflow.com/q/23167501
tags question: http://stackoverflow.com/q/23184619
tags question: http://stackoverflow.com/q/23264749
tags question: http://stackoverflow.com/q/23184063
tags question: http://stackoverflow.com/q/23214343
tags question: http://stackoverflow.com/q/23197923

http://stackoverflow.com/q/23262313
type: Question
tagged with: native
tagged with: frameworks
has comment: http://stackoverflow.com/comment/35611773
answer count: 1
has title: "Unable to load library: JNA native support not found in resource path" on trying to load JNA library on Mac OS X
favorite count: 0
tagged with: jna
upvote count: 1
tagged with: macos
downvote count: 0
type: UnansweredQuestion
score: 1
tagged with: java
has body: I have a JNA library stub like this: public interface FREngine extends Library { NativeLibrary JNA_NATIVE_LIB = NativeLibrary.getInstance("FREngine"); FREngine INSTANCE = (FREngine) Native.loadLibrary("FREngine", FREngine.class); } If I try to use this library in any way, I get a really confusing error: java.lang.UnsatisfiedLinkError: Unable to load library 'FREngine': JNA native support (darwin/libFREngine.jnilib) not found in resource path (...entire classpath here...) Why this is confusing to me: .jnilib is the file extension for JNI libraries. Since I'm using JNA, I wouldn't expect JNA to be using any JNI library other than its own one, "jnidispatch". JNA is looking on the classpath for this file, but there is no way in hell it will be there because it's just some random library I'm trying to import. Shouldn't it be looking on DYLD_FRAMEWORK_PATH? Other native libraries which are initialised in exactly the same way work fine. For instance, CoreFoundation can be resolved. Its code for loading the library is the same aside from the name of the library being different. I tried looking at the frameworks themselves and can only see minor differences: FREngine.framework is in /Library, CoreFoundation.framework is in /System/Library FREngine.framework/Versions contains a directory with a longer and more complex name than CoreFoundation.framework, which only has one version called A. FREngine.framework/Versions/[ver] contains Headers and Libraries The version of JNA in use is 3.5.2. We can't upgrade to 4.x because there is some other bug which causes an exception as soon as we try to load our native library.
has answer: http://stackoverflow.com/a/35407376
has comment: http://stackoverflow.com/comment/35608018

http://stackoverflow.com/q/23199374
accepted answer: http://stackoverflow.com/a/23221551
type: AnsweredQuestion
tagged with: java
tagged with: post
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/23221551
has title: Posting File to WebServer with Java
score: 0
tagged with: http://stackoverflow.com/tag/html
tagged with: file-upload
has body: I'm trying to post a file to a ASP.NET WEB API (C#) Server with a local Java application. Basically I'm trying to reproduce the following HTML code in Java SE: Image File What's the simplest way to do this? I'd like to avoid using Apache.. Something like: String urlToConnect = "http://localhost:50447/api/files/"; String paramToSend = ""; File fileToUpload = new File("C:/Users/aa/Desktop/sample_signed.pdf"); String boundary = Long.toHexString(System.currentTimeMillis()); // Just generate some unique random value. URLConnection connection = null; try { connection = new URL(urlToConnect).openConnection(); } catch (IOException e2) { // TODO Auto-generated catch block e2.printStackTrace(); } connection.setDoOutput(true); // This sets request method to POST. connection.setRequestProperty("Content-Type", "multipart/form-data; boundary=" + boundary); PrintWriter writer = null; try { writer = new PrintWriter(new OutputStreamWriter(connection.getOutputStream(), "UTF-8")); writer.println("--" + boundary); writer.println("Content-Disposition: form-data; name=\"paramToSend\""); writer.println("Content-Type: text/plain; charset=UTF-8"); writer.println(); writer.println(paramToSend); writer.println("--" + boundary); writer.println("Content-Disposition: form-data; name=\"fileToUpload\"; filename=\"sample_signed.pdf\""); writer.println("Content-Type: text/plain; charset=UTF-8"); writer.println(); BufferedReader reader = null; try { try { reader = new BufferedReader(new InputStreamReader(new FileInputStream(fileToUpload), "UTF-8")); } catch (UnsupportedEncodingException | FileNotFoundException e1) { e1.printStackTrace(); } try { for (String line; (line = reader.readLine()) != null;) { writer.println(line); } } catch (IOException e) { e.printStackTrace(); } } finally { if (reader != null) try { reader.close(); } catch (IOException logOrIgnore) {} } writer.println("--" + boundary + "--"); } catch (UnsupportedEncodingException e2) { e2.printStackTrace(); } catch (IOException e2) { e2.pr…
possible better answer: http://stackoverflow.com/a/23200047
has answer: http://stackoverflow.com/a/23200047

http://stackoverflow.com/a/23215209
type: AcceptedAnswer
score: 4
has comment: http://stackoverflow.com/comment/35550763
has body: It is recommended that the main Spring Boot application class to be located in a root package above other classes so that the base "search package" to be the root one. All packages from the root will be scanned for configuration classes. If you choose to place some other configuration classes in other packages, I believe these needs to be specified. For example, if you have your main application class in package "demo" and your Mongo configuration class in package "another.demo", the @ComponentScan annotation for your main application class would need to look like: @Configuration @ComponentScan(basePackages={"another.demo", "demo"}) @EnableAutoConfiguration public class Application {
type: Answer
accepted answer of: http://stackoverflow.com/q/23210143
has comment: http://stackoverflow.com/comment/35570777
upvote count: 4
answers question: http://stackoverflow.com/q/23210143
has comment: http://stackoverflow.com/comment/35577731
downvote count: 0
has comment: http://stackoverflow.com/comment/35547748

http://stackoverflow.com/a/23194673
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23193773
has body: You could use the setNullRepresentation() for this. https://vaadin.com/de/book/-/page/components.textfield.html This way you can tell the TextField what to display when the value is NULL
has comment: http://stackoverflow.com/comment/35477128
has comment: http://stackoverflow.com/comment/35514634

http://stackoverflow.com/a/23240891
upvote count: 1
accepted answer of: http://stackoverflow.com/q/23229929
answers question: http://stackoverflow.com/q/23229929
type: AcceptedAnswer
downvote count: 0
has body: Curious? Pick some JVM (list of them is available here: http://en.wikipedia.org/wiki/Java_Virtual_Machine) with source code open and go debug output of the JIT compiler. I don't know if internals of the Oracle JVM in particular (the one you're probably running on Windows) went open source, but perhaps their engineers might answer your question clearly, especially if you file in a performance-problem ticket (I used to solve this kind of tickets for Symbian JVM (there 2 of them) and we had tools to diagnose this kind stuff in detail). In general the question how modern Java optimizes something does not have general simple answer. IMHO best way to learn more is to go pick one and play with it (run benchmarks, study traces etc.) If you're asking how to write better code then this - super cool Stack Overflow answer - can give you some hints EDIT: Is there a guide to setting up the JDK to compile your java code from a C Compiler? (Ideally an eclipse set up) Yes there should be one. Just be warned that working with larger software repositories (thousands of files and hundreds of thousands up to milions of lines of code) is usually not for the faint-hearted and to get the environment setup right (even with some documentation) can take some days. Wikipedia - List of Java virtual machines lists some open source JVMs. The Oracle JVM page points to OpenJDK - the The HotSpot Group where you can find some (lots of) resources and guides, but mainly invaluable contacts to developers who should be able to help you get up and running. (I can not provide you with more precise instructions as I'm out of the JVM and Symbian OS business for nearly 5 years and things had changed a bit...)
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/35577598

http://stackoverflow.com/comment/35496581
type: AnswerComment
has text: The suggested approach, was indeed the right approach. Thank you for your quick reply, Eric.
type: Comment
comment on: http://stackoverflow.com/a/23189218
score: 0

http://stackoverflow.com/comment/35453063
has text: Your question is very unclear. You seem to know that reflection can be used to invoke methods, so what is the specific problem?
comment on: http://stackoverflow.com/q/23180890
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35578780
type: AnswerComment
comment on: http://stackoverflow.com/a/23247765
type: Comment
has text: @Jon when your form uses `enctype="multipart/form-data"` then you have to register `CommonsMultipartResolver` bean and necessary jar files also to be available in CLASSPATH to bind multipart data.
score: 0

graphics
tag name: graphics
tags question: http://stackoverflow.com/q/23243153
tags question: http://stackoverflow.com/q/23257107
tags question: http://stackoverflow.com/q/23226170
tags question: http://stackoverflow.com/q/23267949
tags question: http://stackoverflow.com/q/23229466
tags question: http://stackoverflow.com/q/23288235
tags question: http://stackoverflow.com/q/23210215
tags question: http://stackoverflow.com/q/23253544
tags question: http://stackoverflow.com/q/23163509
tags question: http://stackoverflow.com/q/23183344
tags question: http://stackoverflow.com/q/23270342
type: Tag
tags question: http://stackoverflow.com/q/23202556
tags question: http://stackoverflow.com/q/23144628
tags question: http://stackoverflow.com/q/23223818
tags question: http://stackoverflow.com/q/23151804
tags question: http://stackoverflow.com/q/23174461
tags question: http://stackoverflow.com/q/23207987
tags question: http://stackoverflow.com/q/23236054

http://stackoverflow.com/a/23214151
answers question: http://stackoverflow.com/q/23212313
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/77876521
downvote count: 1
accepted answer of: http://stackoverflow.com/q/23212313
type: Answer
has body: I had similar problem, where I needed to mask passwords in my input request. I made a small change to existing LogginInterceptor and overridden format method and added my method to mask the password. Here is an example public class CustomLogInInterceptor extends LoggingInInterceptor { @Override protected String formatLoggingMessage(LoggingMessage loggingMessage) { String str = loggingMessage.toString(); String output = maskPasswords(str); return(output); } private String maskPasswords(String str) { final String[] keys = { "password", "passwords" }; for (String key : keys) { int beginIndex = 0; int lastIndex = -1; boolean emptyPass = false; while (beginIndex != -1 && (beginIndex = StringUtils.indexOfIgnoreCase(str, key, beginIndex)) > 0) { beginIndex = StringUtils.indexOf(str, ">", beginIndex); if (beginIndex != -1) { char ch = str.charAt(beginIndex - 1); if (ch == '/') { emptyPass = true; } if (!emptyPass) { lastIndex = StringUtils.indexOf(str, "<", beginIndex); if (lastIndex != -1) { String overlay = "*"; String str2 = StringUtils.substring(str, beginIndex + 1, lastIndex); if (str2 != null && str2.length() > 1) { overlay = StringUtils.rightPad(overlay, str2.length(), "*"); str = StringUtils.overlay(str, overlay, beginIndex + 1, lastIndex); } } } if (emptyPass) { emptyPass = false; lastIndex = beginIndex + 1; } else { if (lastIndex != -1) { lastIndex = StringUtils .indexOf(str, ">", lastIndex); } } } beginIndex = lastIndex; } } return str; } } And added custtom cxf logging bean in my cxf-bean.xml <cxf:bus> <cxf:inInterceptors> </cxf:inInterceptors> <cxf:inFaultInterceptors> </cxf:inFaultInterceptors> </cxf:bus> Note I've used Apache commons-lang3 jar for String manipulation. Similarly you can use for response as well UPDATE using Patterns and making keys configurable using properties. Interceptor public class CustomLogInInterceptor extends LoggingInInterceptor { private static final String MASK_PATTERN = "<\\s*{}\\s*>(.*)</\\s*{}\\s*>|<\\s*name\\s*>\\s*{}\\s*</\\s*n…
has comment: http://stackoverflow.com/comment/105629555
has comment: http://stackoverflow.com/comment/108613795
has comment: http://stackoverflow.com/comment/90373764
score: 10
upvote count: 11

http://stackoverflow.com/q/23202128
has comment: http://stackoverflow.com/comment/35490117
has answer: http://stackoverflow.com/a/23202505
has title: How do I get the power of each string based on its length?
upvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/35490230
type: Question
downvote count: 2
has comment: http://stackoverflow.com/comment/35490370
has comment: http://stackoverflow.com/comment/35490387
score: -2
has comment: http://stackoverflow.com/comment/35490175
has comment: http://stackoverflow.com/comment/35490579
tagged with: java
has comment: http://stackoverflow.com/comment/35490138
has comment: http://stackoverflow.com/comment/35490160
has comment: http://stackoverflow.com/comment/35490248
answer count: 1
has comment: http://stackoverflow.com/comment/35490472
tagged with: algorithm
type: UnansweredQuestion
has body: I have a string of length 15: "10101000000010". i want to take the exclusive or namely the ^ int s = a[3] ^ a[ 5] ^ a[ 7] ^ a[ 9] ^ a[11] ^ a[13] ^ a[15]; //here ^ skips 1 index all the way up until the end of string which is 7. int t = a[3] ^ a[ 6] ^ a[ 7] ^ a[10] ^ a[11] ^ a[14] ^ a[15]; //here ^ skips 2 index and lets 2 go, and so on... How do I devise an algorithm to do this? I just want the int after taking the excluisve or of each index. So what the question is, I want to what if the length of the String is 20, how do i make it so the procedure above is followed. That i would be able to replicate the above for any give size of a string
has comment: http://stackoverflow.com/comment/35490317

http://stackoverflow.com/a/23193260
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/35512432
answers question: http://stackoverflow.com/q/23192750
has body: In cryptography c = m^e (mod n) where c is the cipher text, n is your max value that can be represented. Modulus operation is needed. In addition to that, for large numbers exponentiation Exponentiation by squaring is used. pow operation implements this algorithm. Code is here. Cryptography implementation is much more complex, through, predefined byte arrays and byte operations. You can refer to this paper's, Modular Exponentiation and Roots section.
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/23192750
upvote count: 2

http://stackoverflow.com/a/23238185
score: 1
has body: What I'm going to say can sound crazy, but it's my experience: if you know vba, don't go to vb .net. I was an VB 4/5/6 programmer, and when .net came i tried it. It was a nightmare. Why? Because everything is very similar but not just the same, you will have a lot of troubles with bad habits, triying to do what you know to do (what in vb .net must not be done, hehehe) and so on. Between C#, Java or C++, there is your preferences. C# is more Microsoft mentality, so you will not be so lost as with Java comming from vba, and if you are targeting MS platform is one of the best choices (also for mobile dev, Xamarin does a great job porting c# to Android and iOS), but Java has more laboral opportunities (more servers with linux). C++ is a lot more powerful, but also a lot more complicated and developing a program with it is really slow compared to any of the other ones. So, if you can, learn all of them, start with C# or Java (both are very similar) and in the future expand your knowledge to C++.
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/23238029
upvote count: 1
accepted answer of: http://stackoverflow.com/q/23238029

http://stackoverflow.com/q/23210865
favorite count: 0
type: UnansweredQuestion
has title: is there any concept like FrameLayout (Android) in java Swing?
tagged with: android
has body: I am new to java Swing framework and have been working with android since many years. So, naturally I am relating Android's layout with java's swing layouts. I have requirement of something like FrameLayout in android. FrameLayout of android works as; FrameLayout is designed to block out an area on the screen to display a single item. You can add multiple children to a FrameLayout, but all children are pegged to the top left of the screen. Children are drawn in a stack, with the most recently added child on top. The size of the frame layout is the size of its largest child (plus padding), visible or not (if the FrameLayout's parent permits). Is there any layout or any implementation which works in similar way? I need to implement the following UI. In this; there is a Container which holds JTabbedPane. I have implemented it partially, I am not able to implement the dark bar behind the tabs. any pointers will be appreciated.
has comment: http://stackoverflow.com/comment/35506118
has comment: http://stackoverflow.com/comment/35506227
upvote count: 1
tagged with: swing
type: Question
has answer: http://stackoverflow.com/a/23210931
score: 1
tagged with: java
answer count: 1
downvote count: 0
tagged with: awt

http://stackoverflow.com/comment/35516790
comment on: http://stackoverflow.com/a/23216855
has text: Correct. I am using Jasypt. using http://www.jasypt.org/api/jasypt-hibernate3/1.9.0/org/jasypt/hibernate/type/EncryptedStringType.html to encrypt. how to find this is MD5 or not. (I am New to encryption)
type: AnswerComment
type: Comment
score: 0

http://stackoverflow.com/comment/35578438
type: Comment
comment on: http://stackoverflow.com/a/23251132
has text: @eis This one has a line for STDIN Input. It was odd (but it worked).
score: 0
type: AnswerComment

http://stackoverflow.com/q/23213516
tagged with: java
downvote count: 1
has answer: http://stackoverflow.com/a/23213937
type: Question
score: 0
upvote count: 1
answer count: 1
favorite count: 0
tagged with: snmp
type: UnansweredQuestion
has body: this is the bean package Bean; public class AlarmeBean { public String getOID() { return OID; } public void setOID(String oID) { OID = oID; } public String getAdrip() { return adrip; } public void setAdrip(String adrip) { this.adrip = adrip; } public String getDate() { return date; } public void setDate(String date) { this.date = date; } public String getSeverity() { return severity; } public void setSeverity(String severity) { this.severity = severity; } private String OID; private String adrip; private String date; private String severity; public void alarme(){ Manager manager=new Manager(162); System.out.println("listnning on :"+manager.trapReceiver.getPort()); manager.trapReceiver.addTrapListener(manager); } this is the class manager package Bean; import com.adventnet.snmp.beans.SnmpTrapReceiver; import com.adventnet.snmp.beans.TrapEvent; import com.adventnet.snmp.beans.TrapListener; public class Manager implements TrapListener { SnmpTrapReceiver trapReceiver =new SnmpTrapReceiver(); public Manager(int port ){ trapReceiver.setPort(port); } public void receivedTrap(TrapEvent trapEvent) { System.out.println("TrapEvent received." + "\n" + "Received a trap from:" + trapEvent.getRemoteHost () + "Community is:" + trapEvent.getCommunity () + "\n" + "Agent Address is:" + trapEvent.getAgentAddress () + "\n" + "Enterprise OID:" + trapEvent.getEnterprise () + "\n" + "Trap Variable OID:" + trapEvent.getObjectID (0) + "\n"); } } and in the xhtml i writed a commandbutoom to call the alarme methode in the alarmeBean &lt;p:commandButton process="form" value="call" action={AlarmeBean.alarme}" /&gt; but i have this error : La classe de bean ou de propriété «Bean.Alarme» du bean géré «alarmeBean» ne peut pas être chargée à cause de l’absence de la dépendance com/adventnet/snmp/beans/TrapListener. if i execute the class manager out of this web project it works normally but (it will rturn in the console "listnning on :162")
tagged with: jsf
tagged with: primefaces
has comment: http://stackoverflow.com/comment/35510955
has title: call a method in a java class with jsf

http://stackoverflow.com/q/23188629
type: Question
answer count: 2
score: 0
has comment: http://stackoverflow.com/comment/35466929
has title: Two Players Fighting With Multiple Attack Options Java
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23188779
has body: I am trying to create a game where there is two fighters. A warrior versus gladiator. Both of the fighters have 1000 health. When the battle starts, player 1 gets to choose between three options: 1 - thrust 2 - slice 3 - drink potion... Lets say player 1 chooses thrust and attacks 55 (using random) then my code prints player 2's new health which is now 945. Then it's player two's turn and lets say he does the exact same thing and takes off some health from player 1. Now it will go back to player 1's turn. This is where it gets complicated. Now player 1 attacks for the second time and lets say he does 80 damage. It will print out that player two has 920 health. It doesn't have the previous attack subtracted off. I want them to fight until one of there health goes down to 0 and dies. So how can I fix my code so the health doesn't restart at 1000 after each attack and it subtracts from the new health that was already been lowered from the previous attacks. Like this: 1000 hp - 55 = 945 hp - 80 = 865 hp etc. I' new to coding. Started in January. Any help would be amazing! import java.util.Random; public class Duel { Random hit = new Random(); Random hit1 = new Random(); int newHealth, newHealth1; int outcome, outcome1, outcome2, outcome3; int attack, attack1; int defense, defense1; int health, health1; void calculateWinner() { do { outcome = hit1.nextInt(100) - hit1.nextInt(15); newHealth1 = health1 - outcome; System.out.println("Your attack does " + outcome + " damage!"); System.out.println(""); System.out.print("Warrior Health: " + newHealth1 + "\n"); break; } while(newHealth1 == 0); //System.out.println("Gladiator is the winner!"); } void calculateWinner1() { do { outcome1 = hit.nextInt(100) - hit.nextInt(15); newHealth = health - outcome1; System.out.println("Your attack does " + outcome1 + " damage!"); System.out.println(""); System.out.print("Gladiator Health: " + newHealth + "\n\n"); break; } while(newHealth == 0); //System.out.println("Warrior is the winner!"); …
tagged with: java
has answer: http://stackoverflow.com/a/23189102

http://stackoverflow.com/q/23286042
has comment: http://stackoverflow.com/comment/35646439
type: UnansweredQuestion
has title: sharing data between two jenkins plugin
downvote count: 0
score: 1
has body: I am having a requirement where the output of one plugin is the input for another plugin. Please provide some examples how to share data between two jenkins plugins.
favorite count: 0
type: Question
answer count: 0
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/35643215
tagged with: jenkins-plugins

http://stackoverflow.com/a/23160186
downvote count: 0
has body: What you are trying to do is fundamentally wrong. Your desire is to have your query return results ordered by key; the very same thing that uniquely identifies your entity within the datastore. I cannot understand why you would want to do this since the key is derived using the Kind, Id and optionally the parent, if your class has one, as such I can't see how this ordering by key could ever be useful, but I am sure you have your reasons for wanting this. Perhaps you could expand on your question by explaining fully what you're trying to achieve. Now I will attempt to answer your questions on why your queries aren't returning your desired results and suggest some solutions: Your first query: MainObjectlastUrl = OfyService.ofy().load().type(MainObject.class).ancestor(parent).order("-key").first().now(); The reason this query is returning null is because the key property you are passing as the condition to the order method to sort against is not a field of your MainObject entity. It does not exist and will always return null when objectify tries to apply the sort order. The same applies to your second query. It returns an empty list because there are not entities of type MainObject with a key field. The only difference to the first query is that you are specifically requesting a list of entities rather than calling first(). The third query list = OfyService.ofy().load().type(MainObject.class).ancestor(parent).list(); This query works, of course, because you are querying for all entities of type MainObject that are ancestors of specified `parent' entity. Since such entities exist the query returns the expected results. As you can see, the assumption that an entity's "key" somehow intrinsically exists as a property of your entity is incorrect. In order to use it sort by Key you would need to add, say a property key to your entity 'MainObject' to hold the value of entity's generated key, which would not make sense and definitely not recommended. Caveat: there may be a way…
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/23149390
score: 1

http://stackoverflow.com/comment/35474405
has text: Java's memory model was considered broken by many until Java 5.
comment on: http://stackoverflow.com/q/23193059
type: Comment
type: QuestionComment
score: 2

http://stackoverflow.com/q/23212857
has answer: http://stackoverflow.com/a/30828363
has comment: http://stackoverflow.com/comment/45427679
has body: when I send invalid xml to my web services on websphere server, I get java heap space: <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soap-enc="http://schemas.xmlsoap.org/soap/encoding/"> <soap:Header/> <soap:Body> <MyElementsomething </soap:Body> </soap:Envelope> with the element something Everything works ok Exception: java.lang.OutOfMemoryError: Java heap space at com.ibm.ws.webservices.utils.BAIS.create(BAIS.java:74) ~[com.ibm.ws.runtime.jar:?] at com.ibm.ws.webservices.utils.WebServicesInputSource.getBAISContent(WebServicesInputSource.java:744) ~[com.ibm.ws.runtime.jar:?] at com.ibm.ws.webservices.utils.WebServicesInputSource.getByteArrayContent(WebServicesInputSource.java:710) ~[com.ibm.ws.runtime.jar:?] at com.ibm.ws.webservices.utils.WebServicesInputSource.getStringContent(WebServicesInputSource.java:674) ~[com.ibm.ws.runtime.jar:?] at com.ibm.ws.webservices.utils.WebServicesInputSource.getString(WebServicesInputSource.java:425) ~[com.ibm.ws.runtime.jar:?] at com.ibm.ws.webservices.engine.SOAPPart._getSOAPEnvelope(SOAPPart.java:1090) ~[com.ibm.ws.runtime.jar:?] at com.ibm.ws.webservices.engine.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:628) ~[com.ibm.ws.runtime.jar:?] at com.ibm.ws.webservices.engine.SOAPPart.getEnvelope(SOAPPart.java:656) ~[com.ibm.ws.runtime.jar:?] at org.springframework.ws.soap.saaj.support.SaajUtils.getSaajVersion(SaajUtils.java:155) ~[spring-ws-core-2.1.0.RELEASE.jar:?] at org.springframework.ws.soap.saaj.SaajSoapMessage.getSaajVersion(SaajSoapMessage.java:257) ~[spring-ws-core-2.1.0.RELEASE.jar:?] at org.springframework.ws.soap.saaj.SaajSoapMessage.getImplementation(SaajSoapMessage.java:342) ~[spring-ws-core-2.1.0.RELEASE.jar:?] at org.springframework.ws.soap.saaj.SaajSoapMessage.<init>(SaajSoapMessage.java:117) ~[spring-ws-core-2.1.0.RELEASE.jar:?] at org.springframework.ws.soap.saaj.SaajSoapMessageFactory.createWebServiceMessage(SaajSoapMessageFactory.java:186) ~[spring-ws-core-2.1.0.RELEASE.jar:?] at org.s…
has answer: http://stackoverflow.com/a/28682553
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/28559070
has comment: http://stackoverflow.com/comment/45480370
has answer: http://stackoverflow.com/a/38665037
tagged with: java
has comment: http://stackoverflow.com/comment/45480757
has comment: http://stackoverflow.com/comment/41448243
type: Question
has comment: http://stackoverflow.com/comment/45641515
score: 9
has comment: http://stackoverflow.com/comment/45482235
has answer: http://stackoverflow.com/a/38657257
has title: How to fix java heap space on websphere when sending invalid xml
tagged with: websphere
has comment: http://stackoverflow.com/comment/45489227
has answer: http://stackoverflow.com/a/28691338
upvote count: 9
has answer: http://stackoverflow.com/a/28723133
downvote count: 0
has comment: http://stackoverflow.com/comment/45640969
has comment: http://stackoverflow.com/comment/45673714
has comment: http://stackoverflow.com/comment/41446981
answer count: 7
favorite count: 0
accepted answer: http://stackoverflow.com/a/28691338
has comment: http://stackoverflow.com/comment/45666682
has comment: http://stackoverflow.com/comment/45427817
tagged with: web-services
possible better answer: http://stackoverflow.com/a/30828363

http://stackoverflow.com/a/51451979
type: Answer
has body: Just give the JDK path in Jenkins Global Tool configurations, i.e the path where we have kept the jdk file in the di
has comment: http://stackoverflow.com/comment/89874064
answers question: http://stackoverflow.com/q/23213038
score: 0
upvote count: 1
downvote count: 1

http://stackoverflow.com/a/23175997
score: 2
has body: Don't use a custom Document. Instead use a DocumentFilter. Read the section from the Swing tutorial on Implementing a Document Filter for a working example that limits the number of characters you can enter in a Document. Then just add some additional logic to make sure only letters are added. Or an easier option is to use a JFormatttedTextField with a character mask. Again see the tutorial on Using a Formatted Text Field.
upvote count: 2
has comment: http://stackoverflow.com/comment/35444809
has comment: http://stackoverflow.com/comment/35444939
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23175938
type: Answer
answers question: http://stackoverflow.com/q/23175938

http://stackoverflow.com/comment/35632862
type: Comment
comment on: http://stackoverflow.com/q/23280409
type: QuestionComment
score: 0
has text: I'm in Ontario, Canada. (EST)

http://stackoverflow.com/q/23222408
has comment: http://stackoverflow.com/comment/35527089
score: -5
tagged with: java
type: Question
has title: How to display decimal numbers in Java?
downvote count: 5
has comment: http://stackoverflow.com/comment/35526375
has comment: http://stackoverflow.com/comment/35537614
answer count: 2
upvote count: 0
has answer: http://stackoverflow.com/a/23222549
favorite count: 0
linked to: http://stackoverflow.com/q/153724
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/23222449
has body: I'm using float to display decimal numbers, but sometimes it doesn't display correct result. For example, for 6.2/1000 the result is 0.0061999997. I know why is this happening, but I wonder is there a way to display correct result, in this case, 0.0062? EDIT: How to round a number to n decimal places in Java does not answer to my question, so why did you marked my question as already been answered in other place? Numbers I wrote are only example. In the app user can enter any number and divide / multiply number with any other number, so the result maybe won't have any decimal points, maybe it will have 4 decimals, maybe it will have 7 decimals,...
duplicate of: http://stackoverflow.com/q/153724
has comment: http://stackoverflow.com/comment/35526506

http://stackoverflow.com/q/23138317
favorite count: 0
has title: Java Generics: Returning object of generic class with type parameter that is a super of argument T
score: 5
possible better answer: http://stackoverflow.com/a/23138691
has comment: http://stackoverflow.com/comment/35378015
has comment: http://stackoverflow.com/comment/35378025
has answer: http://stackoverflow.com/a/23138691
has answer: http://stackoverflow.com/a/23139511
has comment: http://stackoverflow.com/comment/35385252
has comment: http://stackoverflow.com/comment/35378251
has comment: http://stackoverflow.com/comment/35378308
type: AnsweredQuestion
tagged with: java
has body: I am trying to accomplish something with Java generics and am having a hell of a time since the approaches I would instinctively take do not work in this language, due to type erasure. I can cobble something reasonable together, though, if I get get the following to work. I have two classes: class A {} class B extends A {} And a third class: class C&lt;T extends A&gt; {} I want a generic factory method that will return an instance of C, if I give it an instance of either A or B. A first attempt might look like this: &lt;T extends A&gt; C&lt;T&gt; getObject(T t) { ... } The issue I am having, which I suppose is not very unique, is most easily explained with the following line: B b = new B(); C&lt;A&gt; = getObject(b); The way I have defined getObject, the above call will return an object of type C&lt;B&gt;, which is not C&lt;A&gt; and does not inherit from C&lt;A&gt;, so this will not compile. What I want to know is: is it possible to invoke some generics magic so that the compiler chooses the generic type T in getObject to be the superclass involved in the above function call, namely A? Thanks so much!
type: Question
upvote count: 5
accepted answer: http://stackoverflow.com/a/23139511
has comment: http://stackoverflow.com/comment/35377953
has comment: http://stackoverflow.com/comment/35378450
answer count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/35385286
tagged with: generics

http://stackoverflow.com/q/23185086
has comment: http://stackoverflow.com/comment/35460238
has comment: http://stackoverflow.com/comment/35460678
has comment: http://stackoverflow.com/comment/35460349
type: Question
has comment: http://stackoverflow.com/comment/35460439
has comment: http://stackoverflow.com/comment/35463198
tagged with: jsp
has body: I was trying to get the image from dataUrl in a jsp page as follow : String dataUrl = request.getParameter("dataUrl"); String encodingPrefix = "base64,"; int contentStartIndex = dataUrl.indexOf(encodingPrefix) + encodingPrefix.length(); byte[] imageData = org.apache.commons.codec.binary.Base64.decodeBase64(dataUrl.substring(contentStartIndex)); System.out.println(imageData); FileOutputStream fos=new FileOutputStream("C://testimage.jpg"); fos.write(imageData); But the problem am facing is that its giving an exception that : org.apache.jasper.JasperException: Unable to compile class for JSP: An error occurred at line: 26 in the jsp file: /uploadmyimage.jsp org.apache.commons.codec.binary.Base64 cannot be resolved to a type Please help to solve this problem. Also my jsp having javascript from where am bringing dataUrl to this page is : $(document).ready(function () { $('#photo').photobooth().on("image", function (event, dataUrl) { alert(dataUrl); //alert(imgdata); $.ajax({ url: 'uploadmyimage.jsp', type: "POST", data: { encodeimg: dataUrl }, error : function(){ alert('Error'); }, success: function(msg){ alert('Data updated.'); } }); $("#gallery").show().html('&lt;img src="' + dataUrl + '" &gt;'); }); }); But when i print this DataUrl in other called jsp.It does not print anything.
has comment: http://stackoverflow.com/comment/35460485
has comment: http://stackoverflow.com/comment/35460403
answer count: 0
type: UnansweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/35461381
has title: DataUrl to Bytearray in jsp
has comment: http://stackoverflow.com/comment/35460273
has comment: http://stackoverflow.com/comment/35461071
tagged with: java
has comment: http://stackoverflow.com/comment/35461177

http://stackoverflow.com/a/23256137
has body: The problem is that DOMHelper is not properly escaping the quotes in your JSON string. It's creating an input field that looks like &lt;input name="columnsToTitles" value="{"title":"Title","seqTask":"SeqTask","platform":"Platform"}"&gt; This feature is clearly noted in the documentation NOTE: For other arbitrary attributes, the value will currently not be automatically HTML-escaped prior to building the element's HTML string. This means that if your attribute value contains special characters that would not normally be allowed in a double-quoted attribute value, you must manually HTML-encode it beforehand (see Ext.String.htmlEncode) or risk malformed HTML being created. This behavior may change in a future release. Therefore, you can just escape your value form = Ext.DomHelper.append(document.body, { action: '/exportExcel', cn: [{ tag:'input', name : 'columnsToTitles', value : Ext.String.htmlEncode(Ext.JSON.encode(exportConfig[1])) }, Then your input tag will look like &lt;input name="columnsToTitles" value="{&amp;quot;title&amp;quot;:&amp;quot;Title&amp;quot;,&amp;quot;seqTask&amp;quot;:&amp;quot;SeqTask&amp;quot;,&amp;quot;platform&amp;quot;:&amp;quot;Platform&amp;quot;}"&gt;
accepted answer of: http://stackoverflow.com/q/23253525
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/23253525
score: 1
upvote count: 1

http://stackoverflow.com/comment/35396126
has text: How is a condition that starts with `answer.charAt(0) == answer.charAt(0)` ever going to be false?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23148347

http://stackoverflow.com/comment/35540635
has text: @DavidWallace The code can be found anywhere, that's why I skipped the implementation. But I added it now :)
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23229751
type: Comment

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

http://stackoverflow.com/comment/35556919
score: 0
type: AnswerComment
type: Comment
has text: Alright, i wanna know why u set the left and right node on null at the beginning. Also why they are no right or left in the constructor because a mate said that he wrote a constructor with all variables in it. The reason behind that was to state right and left nodes. And i didnt test the whole code, i got error messages on coding the main function because i use different types(Integer != int ).
comment on: http://stackoverflow.com/a/23227113

http://stackoverflow.com/comment/35483054
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23198289
has text: sorry!missed it.Thanks!
type: AnswerComment

http://stackoverflow.com/q/23202461
favorite count: 0
tagged with: android
has answer: http://stackoverflow.com/a/23202879
accepted answer: http://stackoverflow.com/a/23202879
type: AnsweredQuestion
tagged with: tabs
score: 1
tagged with: java
has body: I have this class: public class Map extends ActionBarActivity implements TabListener{ @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_the_map); // Set up the action bar. final ActionBar actionBar = getActionBar(); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); ActionBar.Tab ttestTab = actionBar.newTab().setText("The test"); ActionBar.Tab chatTab = actionBar.newTab().setText("Chat"); testTab.setTabListener(this); chatTab.setTabListener(this); actionBar.addTab(testTab, false); actionBar.addTab(chatTab, true); GoogleMap map = ((MapFragment) getFragmentManager() .findFragmentById(R.id.map)).getMap(); LatLng mapCenter = new LatLng(41.889, -87.622); LatLng mapCenter2 = new LatLng(41.889, -85.622); map.addMarker(new MarkerOptions() .icon(BitmapDescriptorFactory.fromResource(R.drawable.orienteering)) .position(mapCenter) .flat(true) ); map.addMarker(new MarkerOptions() .icon(BitmapDescriptorFactory.fromResource(R.drawable.orienteering)) .position(mapCenter2) .flat(true) ); // CameraPosition cameraPosition = CameraPosition.builder() // .target(mapCenter) // .zoom(13) // .bearing(90) // .build(); // map.moveCamera(CameraUpdateFactory.newLatLngZoom( // new LatLng(-18.142, 178.431), 2)); map.setMapType(GoogleMap.MAP_TYPE_HYBRID); // Animate the change in camera view over 2 seconds // map.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition), // 2000, null); } @Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater actionMenue = getMenuInflater(); actionMenue.inflate(R.menu.the_map, menu); return super.onCreateOptionsMenu(menu); } @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; } if (id =…
has title: Infinite loop when running an activity
type: Question
upvote count: 1
answer count: 1
downvote count: 0
tagged with: android-activity

http://stackoverflow.com/comment/35365673
comment on: http://stackoverflow.com/q/23131499
type: Comment
score: 0
has text: Okay. I'm done with testing. I did that with Genymotion emulators and two real devices. As you can see, the one with the issue seems to be the tablet with 160dpi and 4.3. IDK if this is a bug of that version. I'll try to keep testing devices.
type: QuestionComment

http://stackoverflow.com/q/23202516
has comment: http://stackoverflow.com/comment/35685022
upvote count: 38
linked to: http://stackoverflow.com/q/22519596
tagged with: macos
accepted answer: http://stackoverflow.com/a/23305195
favorite count: 0
has body: I'm having issues upgrading from JDK 1.7 -> 1.8 on OSX. The upgrade has completed, but javac still returns 1.7 as the version. I've downloaded JDK 8_u5 from Oracle's homepage, and run the installer. I've also taken the following steps, post-install: &gt; export JAVA_HOME=`/usr/libexec/java_home -v 1.8` (Executed in my .bashrc file) &gt; echo $JAVA_HOME /Library/Java/JavaVirtualMachines/jdk1.8.0_05.jdk/Contents/Home &gt; javac -version javac 1.7.0_21 &gt; $JAVA_HOME/bin/javac -version javac 1.7.0_21 &gt; $JAVA_HOME/bin/java -version java version "1.8.0_05" Java(TM) SE Runtime Environment (build 1.8.0_05-b13) Java HotSpot(TM) 64-Bit Server VM (build 25.5-b02, mixed mode) I've gone through and removed Java 1.7 (and all other JDK versions), and then re-run the installer: &gt; ls /Library/Java/JavaVirtualMachines jdk1.8.0_05.jdk Still no use, javac reports the version as 1.7.0_21 &gt; which javac /usr/bin/javac &gt; ls -ltra /usr/bin/javac [snipped] /usr/bin/javac -&gt; /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/javac Within that path, Current is a symlink to A. The contents of A/Commands are a series of files (not symlinks). &gt; cd A/Commands &gt; ./javac -version javac 1.7.0_21 &gt; ./java -version java version "1.8.0_05" Java(TM) SE Runtime Environment (build 1.8.0_05-b13) Java HotSpot(TM) 64-Bit Server VM (build 25.5-b02, mixed mode) Edit Further to the original post, I've done some digging with jenv, as suggested on this answer. &gt; jenv add /Library/Java/JavaVirtualMachines/jdk1.8.0_05.jdk/Contents/Home &gt; jenv global oracle64-1.8.0.05 &gt; jenv version oracle64-1.8.0.05 (set by /Users/martypitt/.jenv/version) &gt; jenv info java Jenv will exec : /Users/martypitt/.jenv/versions/oracle64-1.8.0.05/bin/java &gt; jenv info javac Jenv will exec : /Users/martypitt/.jenv/versions/oracle64-1.8.0.05/bin/javac &gt; javac -version javac 1.7.0_21 This casts dispersions on my thoughts that this was a random javac lurking in my path, which was some…
has comment: http://stackoverflow.com/comment/35677896
has comment: http://stackoverflow.com/comment/35679859
has title: After upgrading to Java8, javac still shows 1.7
linked to: http://stackoverflow.com/q/22700845
has answer: http://stackoverflow.com/a/44452706
tagged with: java-8
has answer: http://stackoverflow.com/a/41416141
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35723570
has comment: http://stackoverflow.com/comment/35680230
has comment: http://stackoverflow.com/comment/35677787
possible better answer: http://stackoverflow.com/a/25995877
has comment: http://stackoverflow.com/comment/35782054
tagged with: java
has comment: http://stackoverflow.com/comment/35678107
has answer: http://stackoverflow.com/a/25995877
downvote count: 1
has comment: http://stackoverflow.com/comment/35678427
type: Question
score: 37
has answer: http://stackoverflow.com/a/23305195
has answer: http://stackoverflow.com/a/44469444
has comment: http://stackoverflow.com/comment/35678067
has comment: http://stackoverflow.com/comment/63651051
linked to: http://stackoverflow.com/q/21147720
has comment: http://stackoverflow.com/comment/35681868
has comment: http://stackoverflow.com/comment/35678043
has comment: http://stackoverflow.com/comment/35685030
has comment: http://stackoverflow.com/comment/35680252
answer count: 6
has answer: http://stackoverflow.com/a/23203335
has comment: http://stackoverflow.com/comment/35697606

http://stackoverflow.com/q/23176030
downvote count: 1
has answer: http://stackoverflow.com/a/23176077
type: Question
tagged with: image
score: 0
answer count: 1
has title: Why can't I load Images?
favorite count: 0
type: UnansweredQuestion
has body: I am making a game &amp; trying to add a play button, but it says "The local variable playbutton may not have been initialized,". Here is my code: class graphics extends JPanel{ ImageIcon playbutton = new ImageIcon("res\\playbutton"); public void paintComponent(Graphics g){ super.paintComponent(g); this.setBackground(Color.BLACK); Image playbutton; g.drawImage(playbutton, 250, 300, null); } }
upvote count: 1
tagged with: java

http://stackoverflow.com/comment/35445210
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23176290
type: Comment
has text: yes, because in my servlet I recovered the parameter passed through jsp

http://stackoverflow.com/a/23256449
has comment: http://stackoverflow.com/comment/73423746
accepted answer of: http://stackoverflow.com/q/23256115
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23256115
type: Answer
has body: Override getPreferredSize rather than using setPreferredSize You can also affect the size using GridBagLayout by specifying the fill property and changing the weightx/y property
upvote count: 2
has comment: http://stackoverflow.com/comment/73423794
score: 2

http://stackoverflow.com/comment/35366260
score: 2
has text: I suggest you spend more time on design and work out specifically what you want. It's like saying; I want a holiday which doesn't have to be to a city, how much will it cost and where should I go?
comment on: http://stackoverflow.com/q/23132243
type: Comment
type: QuestionComment

http://stackoverflow.com/a/43443555
downvote count: 0
score: 20
type: Answer
has body: if I have a lot of configurations and/or environments, usually I do so: $ cat src/main/resources/application.yml: spring: profiles: include: &gt; profile1, profile2, ... profileN $ ls -lah src/main/resources/config: drwxr-xr-x 4 mak staff 136B Apr 16 23:58 . drwxr-xr-x 6 mak staff 204B Apr 17 01:54 .. -rw-r--r-- 1 mak staff 60B Apr 16 23:58 application-profile1.yml -rw-r--r-- 1 mak staff 62B Apr 16 23:16 application-profile2.yml ... -rw-r--r-- 1 mak staff 50B Apr 16 23:16 application-profileN.yml
answers question: http://stackoverflow.com/q/23134869
upvote count: 20

http://stackoverflow.com/q/23192126
type: Question
score: 0
answer count: 2
accepted answer: http://stackoverflow.com/a/23192206
tagged with: android
possible better answer: http://stackoverflow.com/a/23194281
has body: I need to set the seekbar values from -10 to 10. The default SeekBar class do not allow to set a minimum value but only max. How can i set also a minimum value? Thanks in advance.
has answer: http://stackoverflow.com/a/23194281
type: AnsweredQuestion
tagged with: java
has title: Custom SeekBar: set min value
has answer: http://stackoverflow.com/a/23192206

http://stackoverflow.com/comment/35501912
type: Comment
comment on: http://stackoverflow.com/q/23208346
has text: possible duplicate of [How to wait for a JFrame to close before continuing?](http://stackoverflow.com/questions/12335733/how-to-wait-for-a-jframe-to-close-before-continuing)
score: 0
type: QuestionComment

http://stackoverflow.com/comment/35555177
has text: I'm trying to execute my jar with beans from spring with Runtime.exec http://stackoverflow.com/questions/23223909/runtime-exec-trying-to-load-spring-beans-in-jar-of-your-project-from-you-war . It's working when i use my 2 steps method but it's a bit cumbersome. I'd like the jar with packaging dependencies be generated from only a mvn clean install at the same time that the war is created and then i call it from RunTime.exec() in my web app to do some background process( mailing , parse big files)...
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/23238199
type: Comment

http://stackoverflow.com/comment/35647117
type: Comment
score: 0
comment on: http://stackoverflow.com/a/23286787
type: AnswerComment
has text: How do I pass this to the adapter?

http://stackoverflow.com/q/23236347
has comment: http://stackoverflow.com/comment/35551707
has body: Right now I have a one class program that runs a bank app. I come from a JS background and new to Java. I essentially create a: User username = new User(Double startingMoney, String fName, String lName, String userName, String passWord); Then you would do things like: username.setBalance(Double balanceAmt); or username.getBalance(); Issue is, I'm not sure how to name the Object. I want my program to allow the user to register a new user account, and make whatever the username they have, be the name of the Object. In JS you can use a String as the object variable name. I'm not even sure if this is the right way to go about creating a new user. I'm not sure how I would even reference the specific object later on, to set the balance for the user. IE: I have two users... thus two user objects... one john and one betty. If betty was logged in currently, i'm not sure how i'd call betty.setBalance(20.00); Any suggestions or direction? Thanks.
favorite count: 0
answer count: 3
has title: Best way of creating a user profile in Java
has answer: http://stackoverflow.com/a/23237361
upvote count: 2
downvote count: 2
has answer: http://stackoverflow.com/a/23236448
has answer: http://stackoverflow.com/a/23236933
has comment: http://stackoverflow.com/comment/35552389
accepted answer: http://stackoverflow.com/a/23236933
type: AnsweredQuestion
tagged with: java
type: Question
score: 0
possible better answer: http://stackoverflow.com/a/23237361

http://stackoverflow.com/q/23261948
has title: Usage of WiFi-Direct in Game Development (Android)
answer count: 1
favorite count: 0
tagged with: android
has answer: http://stackoverflow.com/a/23264090
tagged with: wifi-direct
accepted answer: http://stackoverflow.com/a/23264090
upvote count: 4
type: AnsweredQuestion
downvote count: 0
has body: I am developing board game in android. I want to make this game playable on two separate devices, for that I need to use WiFi-Direct. I want to know is there any library available which will help me to Find and connect with device Send and receive board coordinates between two devices after touch-listener event I am interested in built-in library. OR If possible please share implemented example of client/server architecture.
type: Question
tagged with: wifip2p
tagged with: argument-passing
tagged with: java
score: 4

parsing
tags question: http://stackoverflow.com/q/23195878
tags question: http://stackoverflow.com/q/23172790
tags question: http://stackoverflow.com/q/23234085
tag name: parsing
tags question: http://stackoverflow.com/q/23159339
tags question: http://stackoverflow.com/q/23157039
tags question: http://stackoverflow.com/q/23246666
tags question: http://stackoverflow.com/q/23169761
tags question: http://stackoverflow.com/q/23246215
tags question: http://stackoverflow.com/q/23204407
type: Tag
tags question: http://stackoverflow.com/q/23281836
tags question: http://stackoverflow.com/q/23195052
tags question: http://stackoverflow.com/q/23204658
tags question: http://stackoverflow.com/q/23235631
tags question: http://stackoverflow.com/q/23160627
tags question: http://stackoverflow.com/q/23285481
tags question: http://stackoverflow.com/q/23242211
tags question: http://stackoverflow.com/q/23138806
tags question: http://stackoverflow.com/q/23282077
tags question: http://stackoverflow.com/q/23183173
tags question: http://stackoverflow.com/q/23255801

http://stackoverflow.com/q/23285301
has answer: http://stackoverflow.com/a/23285356
score: 1
has comment: http://stackoverflow.com/comment/35641988
tagged with: java
has comment: http://stackoverflow.com/comment/35642711
has comment: http://stackoverflow.com/comment/35642600
tagged with: pdfbox
tagged with: manifest
tagged with: classpath
has body: I have a java jar file i got below error when executing in ubuntu terminal . Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/pdfbox/pdmodel/PDDocument at com.example.pdfbox.pdfbox.main(pdfbox.java:41) Caused by: java.lang.ClassNotFoundException: org.apache.pdfbox.pdmodel.PDDocument 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) ... 1 more and my code is like: package com.example.pdfbox; import java.io.BufferedWriter; import java.io.File; import org.apache.pdfbox.pdmodel.PDDocument; import org.apache.pdfbox.pdmodel.PDDocumentCatalog; import org.apache.pdfbox.pdmodel.interactive.form.PDAcroForm; import org.apache.pdfbox.util.PDFTextStripper; public class pdfbox { public static void main(String[] args) { PDDocument pd; BufferedWriter wr; String kunde = args[0]; String sted = args[1]; String plassering = args[2]; try { File input = new File("/home/processdrive/Desktop/SKI108RE.PDF"); pd = PDDocument.load(input);// line number 41 System.out.println(pd.getNumberOfPages()); System.out.println(pd.isEncrypted()); PDDocumentCatalog catalog = pd.getDocumentCatalog(); PDAcroForm form = catalog.getAcroForm(); form.getField("Kunde").setValue(kunde); form.getField("Sted").setValue(sted); form.getField("Plassering").setValue(plassering); pd.save("/home/processdrive/Desktop/CopyOfInvoice.pdf"); PDFTextStripper stripper = new PDFTextStripper(); stripper.setStartPage(1); stripper.setEndPage(1); } catch (Exception e){ e.printStackTrace(); System.out.println("Error occured"); } } } The 41 line is pd = PDDocument.load(input); My calss path is like &lt;classpath&gt;&lt;classpathentry kind="src" path="s…
has comment: http://stackoverflow.com/comment/35642057
type: Question
answer count: 3
has answer: http://stackoverflow.com/a/23286559
downvote count: 0
tagged with: jar
has comment: http://stackoverflow.com/comment/35642477
favorite count: 0
accepted answer: http://stackoverflow.com/a/23286559
has comment: http://stackoverflow.com/comment/35641932
has comment: http://stackoverflow.com/comment/35644985
has title: Exception in main thread when executing java jar file
has comment: http://stackoverflow.com/comment/35642240
has comment: http://stackoverflow.com/comment/35642405
has comment: http://stackoverflow.com/comment/35641925
has answer: http://stackoverflow.com/a/23285498
upvote count: 1
possible better answer: http://stackoverflow.com/a/23285356
type: AnsweredQuestion

http://stackoverflow.com/q/23170323
tagged with: javascript
score: 0
answer count: 1
has title: angularjs java and velocity app
has answer: http://stackoverflow.com/a/23816852
tagged with: angularjs
has body: I'm simply just trying to create an angularjs app inside my current java/velocity webapp that I have running locally. I am coming across issues where I am getting: Uncaught Error: [$injector:modulerr] Failed to instantiate module... Now by simply googling this issue it tells me to import angular-route.js, which I already am, but still seem to be getting this error. Here is what is currently in the head. Here is the html/vm file where I define the html for my app. (this is located inside the body of the page) {{actor.name}} {{actor.character}} And here is the javascript I have loading in my main.js var myApp = angular.module('myApp', ['ngRoute']); myApp.factory('Avengers', function() { var Avengers = {}; Avengers.cast = [{ name: "Robert Downey Jr.", character: "Tony Stark / Iron Man" }, { name: "Chris Evans", character: "Steve Rogers / Captain America" }, { name: "Mark Buffalo", character: "Bruce Banner / The Hulk" }]; return Avengers; }) function AvengersCtrl($scope, Avengers) { $scope.avengers = Avengers; } For the life of me I cant quite figure out why I continue to get that error. Curious to know if this is an issue with my current java app build and how angular might have issues running in that environment? but I really have no idea. Thanks in advance.
tagged with: velocity
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36245028
tagged with: java
type: Question

http://stackoverflow.com/comment/129421834
score: 1
comment on: http://stackoverflow.com/q/23201676
type: Comment
type: QuestionComment
has text: @haventchecked No problem!!, I could able to solve the issue. Thanks for your reply :)

http://stackoverflow.com/comment/35526239
score: 0
type: QuestionComment
has text: Keep both the class inside same package or else keep in import the Ena inside Duo class as import package.Ena
type: Comment
comment on: http://stackoverflow.com/q/23222201

http://stackoverflow.com/q/23232951
tagged with: java
has title: Skipping in my File Reader
type: Question
has answer: http://stackoverflow.com/a/23232990
score: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23234120
has body: public void file(){ String fileName = "hello.txt"; fileName = FileBrowser.chooseFile(true); //Open a file and store the information into the OurList try { String s = ""; File file = new File(fileName); FileReader inputFile = new FileReader(file); while( inputFile.read() != -1) { System.out.println(inputFile.read()); System.out.println(); } } catch(Exception exception) { System.out.println("Not a real file. List is already built"); } } So i am having trouble with this piece of code. I want to just read in character by character from the file, but right now its skipping every other one. I know why its skipping, its in the while loop and when I try to print it, but as far as I can tell there isn't another way to stop FileReader then to make it != to -1. How can I get it to not skip?
has answer: http://stackoverflow.com/a/23232991
tagged with: filereader
answer count: 4
has answer: http://stackoverflow.com/a/23232973

http://stackoverflow.com/comment/35514266
has text: May be,but issue is coming before that.Check is failing as I've shown in the question.Once it passes that statement,I can check for what you are saying.
type: Comment
score: 0
comment on: http://stackoverflow.com/q/23212322
type: QuestionComment

http://stackoverflow.com/q/23273989
tagged with: swing
has answer: http://stackoverflow.com/a/23274629
tagged with: java
has body: I've added my JPanel derived class to the JFrame. Now when I want to draw an oval (using fillOval in my JPanel's paintComponent method) I see two ovals being painted. The problem disappears when I invoke super.paintComponent or when I invoke setContentPane in the JFrame class with my JPanel as parameter. The question is, why does it happen? Of course when the upper left corner of both JPanel and JFrame are in the same place, it doesn't happen. But somehow the JPanel isn't opaque unless I invoke super.paintComponent. The main question is why does it paint BOTH on the default content pane AND my JPanel. Thanks for help.
type: Question
tagged with: jpanel
score: 0
answer count: 1
tagged with: paintcomponent
type: UnansweredQuestion
has title: JPanel derived class in JFrame - painting duplicate

http://stackoverflow.com/comment/35422346
has text: Regarding performance of using a List, I disagree with your analysis. The lookup times depend on your usage pattern. In particular, if you want to iterate over positions, then your lookup times could actually be _faster_ than a sufficiently sparse 2D array because you will avoid a lot of `null` checks. If the access pattern has any sort of locality, then you may be able to iterate from your last accessed location for significant speedup. But even with a random access pattern, lookups are only **`log n`** using binary search, not linear.
score: 2
type: AnswerComment
comment on: http://stackoverflow.com/a/23162927
type: Comment

http://stackoverflow.com/comment/61077311
type: Comment
has text: Awesome! You should totally write that as an answer, as to help future visitors to the site (and to solidify your own learning too) :)
type: QuestionComment
comment on: http://stackoverflow.com/q/23185241
score: 0

http://stackoverflow.com/q/23139490
type: AnsweredQuestion
score: -2
has comment: http://stackoverflow.com/comment/35380840
has body: Trying to delete the last comma and instead add an end bracket. How to go about this? My code: @Override public String toString(){ String str="["; for(double d:data) str+=d+", "; return str; } Example data: stat1 data = [ stat1 data = [50.0, 60.0, stat1 data = [70.0, 80.0, stat1 data = [90.0, 100.0, stat1 data = [100.0, 110.0, stat1 data = [
answer count: 2
downvote count: 2
duplicate of: http://stackoverflow.com/q/18279622
favorite count: 0
has title: To string with adding bracket
upvote count: 0
has answer: http://stackoverflow.com/a/23139587
linked to: http://stackoverflow.com/q/18279622
tagged with: java
has answer: http://stackoverflow.com/a/23139572
accepted answer: http://stackoverflow.com/a/23139572
type: Question
possible better answer: http://stackoverflow.com/a/23139587
tagged with: tostring

http://stackoverflow.com/comment/35625162
has text: let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/51370/discussion-between-ravinder-and-extremeswat)
type: Comment
score: 1
comment on: http://stackoverflow.com/a/23275254
type: AnswerComment

http://stackoverflow.com/comment/35573300
type: Comment
comment on: http://stackoverflow.com/a/23248176
type: AnswerComment
has text: I've posted the code for the Button in an EDIT. The actionlistener is properly applied, does **other** actions just fine. But that if statement doesn't seem to run, even if the tester is true.
score: 0

http://stackoverflow.com/q/23231430
tagged with: java
answer count: 2
accepted answer: http://stackoverflow.com/a/23293594
downvote count: 0
favorite count: 0
has title: gwt project: error in external library "cannot be abstract"
type: AnsweredQuestion
has body: I'm building an application with gwt but after upgrading to gwt 2.6 I get this error message when I compile: Compiling module it.twain.MYPROJECT [ERROR] Errors in 'gwtupload/client/DecoratedFileUpload.java' [ERROR] Line 358: Rebind result 'gwtupload.client.DecoratedFileUpload.DecoratedFileUploadImpl' cannot be abstract Can someone explain to me what can I do to fix this?
has answer: http://stackoverflow.com/a/23293594
upvote count: 1
has comment: http://stackoverflow.com/comment/35548026
possible better answer: http://stackoverflow.com/a/23262132
type: Question
tagged with: gwt
has answer: http://stackoverflow.com/a/23262132
score: 1

http://stackoverflow.com/comment/35694714
has text: Oracle is extremely restricted in the number and kind of authentication methods it supports. Since the intent of "one DB user" per user is actually authorization, this is a big problem.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23314217
type: AnswerComment

http://stackoverflow.com/a/23239476
upvote count: 1
has body: If you will be only using this CustomList with subclasses of A, than you can declare the CustomList class as: public class CustomList&lt;T extends ClassA&gt; extends ArrayList&lt;T&gt; But if not, than you have to rethink your design.
answers question: http://stackoverflow.com/q/23239393
downvote count: 0
type: Answer
score: 1

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

http://stackoverflow.com/comment/35439025
type: AnswerComment
has text: The stacktrace with the `@ImportResource` annotation?
type: Comment
comment on: http://stackoverflow.com/a/23172871
score: 0

http://stackoverflow.com/q/23219945
has comment: http://stackoverflow.com/comment/35522576
has body: I should write a program that reads balance and interest rate, and displays the value of the account in ten years with anually, monthly and daily compounds. I have written for yearly compounding and for monthly. In the second loop for monthly rate, program reads value of "balance" after compounding yearly, while I need it read primary value. How is it possible to separate two loops, so they do not influence each other? Here is my code: import java.util.Scanner; public class BankInterest { public static void main(String []args) { System.out.println("Please enter your balance: "); Scanner keyboard = new Scanner(System.in); double balance = keyboard.nextDouble(); int years = 0; int months = 0; int days = 0; System.out.println("Please enter the ann1ual interest rate in decimal form: "); double interestRate = keyboard.nextDouble(); while (years&lt;10) { double interest = balance * interestRate; balance = balance + interest; years++; } System.out.println("Balance after 10 years with annual interest is " + balance); while (months&lt;120) { double interest = balance * interestRate/12; balance = balance + interest; months++; } System.out.println("Balance after 10 years with monthly interest rate is " + balance); } } When program is run and I input 100 for balance and 0.02 to interest rate, yearly compounding works well and displays: Balance after 10 years with annual interest is 121.89944199947573 And second loop takes this value as balance and displays: Balance after 10 years with monthly interest rate is 148.86352955791543 While, if my code was right it should display this number: 122.119943386
has comment: http://stackoverflow.com/comment/35522003
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35522791
has title: Separate two loops in java
tagged with: java
has answer: http://stackoverflow.com/a/23220890
tagged with: loops
downvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/23220890
has comment: http://stackoverflow.com/comment/35522507
has comment: http://stackoverflow.com/comment/35522102
score: -1
possible better answer: http://stackoverflow.com/a/23220383
has answer: http://stackoverflow.com/a/23220383
has comment: http://stackoverflow.com/comment/35522430
answer count: 2
upvote count: 0
has comment: http://stackoverflow.com/comment/35522010
has comment: http://stackoverflow.com/comment/35522218
favorite count: 0

http://stackoverflow.com/q/23177286
linked to: http://stackoverflow.com/q/13648357
has title: The form:hidden tag declares that it accepts dynamic attributes but does not implement the required inter
score: 0
answer count: 0
has comment: http://stackoverflow.com/comment/35447170
type: UnansweredQuestion
tagged with: spring
has comment: http://stackoverflow.com/comment/35447765
has body: I am using spring3 and hibernate to develop this simple form: &lt;form:form method="post" action="addClass" commandName="trainingclass"&gt; &lt;form:hidden path="id" /&gt; and the corresponding command: @Entity @Table(name="TrainingClass") public class TrainingClass { @Id @Column(name="ID") // @GeneratedValue private Integer id; .... } I am getting the exception in the title. I tried to use some transient property such as: @Entity @Table(name="TrainingClass") public class TrainingClass { @Id @Column(name="ID") // @GeneratedValue private Integer id; private Integer dim; } &lt;form:form method="post" action="addClass" commandName="trainingclass"&gt; &lt;form:hidden path="dim" /&gt; Still the exception is there. Then I tried: &lt;form:form method="post" action="addClass" commandName="trainingclass"&gt; &lt;form:hidden path="dim" value="dummy"/&gt; Still the same problem. I searched google and everywhere it seemed to be using without any issues. The exception trace: org.apache.jasper.JasperException: /WEB-INF/jsp/trainingClassForm.jsp (line: 13, column: 2) The form:hidden tag declares that it accepts dynamic attributes but does not implement the required interface org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:42) org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:443) org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:149) org.apache.jasper.compiler.Validator$ValidateVisitor.visit(Validator.java:832) org.apache.jasper.compiler.Node$CustomTag.accept(Node.java:1538) org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2375) org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2427) org.apache.jasper.compiler.Validator$ValidateVisitor.visit(Validator.java:895) org.apache.jasper.compiler.Node$CustomTag.accept(Node.java:1538) org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2375) org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2427) org.apache.jasper.compiler.Node$Visitor.…
tagged with: java
tagged with: hibernate
type: Question

bash
tags question: http://stackoverflow.com/q/23217698
tags question: http://stackoverflow.com/q/23261954
tags question: http://stackoverflow.com/q/23224912
tags question: http://stackoverflow.com/q/23195228
tags question: http://stackoverflow.com/q/23172970
type: Tag
tag name: bash
tags question: http://stackoverflow.com/q/23274869

http://stackoverflow.com/comment/35397226
score: 0
comment on: http://stackoverflow.com/q/23149203
has text: It depend by your application server. If you are using jboss [this should help you][1]. [1]: http://stackoverflow.com/questions/3197438/jboss-session-timeout
type: QuestionComment
type: Comment

http://stackoverflow.com/a/23298867
answers question: http://stackoverflow.com/q/23228214
upvote count: 1
score: 1
has body: They customized ViewPager, the widget is called WeatherViewPager that it's unfortunately unavailable, looks like a ViewPager with a sort of parallax You may take a look at https://play.google.com/store/apps/details?id=com.desarrollodroide.repos it's a collection of usable opensource libraries e.g. Utils-&gt;Paralloid or Utils-&gt;ParallaxScroll
downvote count: 0
type: Answer

http://stackoverflow.com/comment/35396597
has text: @Garf1eld, Does your Adapter bind those values correctly to the views?
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/23141351

http://stackoverflow.com/a/23134179
has comment: http://stackoverflow.com/comment/35372062
score: 1
has body: Liquibase uses the JDBC types for columns. The JDBC/SQL type FLOAT is not the same as the SQL Server type FLOAT. The JDBC type FLOAT is a 32 bit single precision floating point. You should specify DOUBLE if you want 64 bit double precision (FLOAT(53) in SQL Server). Likely liquibase translates the request for type="FLOAT" to a column of type FLOAT(24) in SQL Server, which is insufficient to store a Java double with full precision.
upvote count: 1
has comment: http://stackoverflow.com/comment/35375621
answers question: http://stackoverflow.com/q/23133574
type: Answer
downvote count: 0

http://stackoverflow.com/comment/35410630
type: QuestionComment
score: 0
has text: This is such a horrible hack that I'm not prepared to propose it as an answer. You will need to execute this code once the scene is actually displayed: `Node arrowButton = titledPane.lookup(".arrow-button");` `arrowButton.translateXProperty().bind(titledPane.widthProperty().subtract(32));`
comment on: http://stackoverflow.com/q/23149162
type: Comment

http://stackoverflow.com/comment/35541624
comment on: http://stackoverflow.com/q/23229735
type: Comment
type: QuestionComment
has text: Believe it or not - I study Java from the book "Java Softwre Solutions". This point is not perfectly clear in the book, so I decided to ask here. Besides, even if I use a book/tutorial, it's reasonable that I don't understand it fully. That's why this forum exists.
score: 0

http://stackoverflow.com/comment/35404854
type: Comment
has text: Please show how did you call that dialog? Maybe you called it two times ?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23153669

http://stackoverflow.com/q/23260344
has answer: http://stackoverflow.com/a/23475609
tagged with: jms
favorite count: 0
upvote count: 2
type: UnansweredQuestion
tagged with: java-ee-7
answer count: 4
score: 2
has answer: http://stackoverflow.com/a/23354642
has comment: http://stackoverflow.com/comment/35770348
tagged with: java
has body: I need to keep a counter for couple of pages that each user visits. Lets say I need to keep counter for page 1 and 2. UserA visits page 1 for 10 times therefore its counter should be 10, and userB visits page 1 for 5 times and page 2 for 7 times so user's counter for page 1 should be 5 and page 2 should be 7. CounterTable ( shows number of times that each page has been visited by each user) Username Page Counter A 1 10 B 1 5 B 2 7 To achieve this, I have a table in DB which keep the usernames, page numbers and counters, every time that user visits a page the associated counter in db will be incremented. My question is that, if I increment the required counter, every time that I want to retrieve the pages (1 or 2) the user needs to wait for the application to get the required record updated before visiting the page. To avoid this, should I use JMS to send asynchronous requests to increment the counters in database? Another option, is to use ajax maybe to send async request to the server. Is there any more efficient method to do it? if not which one is more efficient?
has comment: http://stackoverflow.com/comment/35768546
type: Question
has answer: http://stackoverflow.com/a/23358014
downvote count: 0
has title: How to track users viewing habit
has answer: http://stackoverflow.com/a/23355200
has comment: http://stackoverflow.com/comment/35775378

http://stackoverflow.com/q/23188511
possible better answer: http://stackoverflow.com/a/23192292
has answer: http://stackoverflow.com/a/23192292
tagged with: java
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/23189451
has body: I get following structure: project |---+build |---+dist |---+nbproject |----src |-------client |----------stuff |-------------controller |----------------DefaultController.java |-------------files |-------------fxml |----------------DefaultFXML.fxml |-------------img |-------------lib |---------------ContentManager.java |-------------root |---------------StartClass.Java |---+build.xml |---manifest.mf I'm setting in the ContentManager the fxml-Files like: public static final String DEFAULT_SCREEN_FXML = "../fxml/Default.fxml"; But i get allways a nullPointerException. And i dont want to work with absolute Path. So how to finde out the relative path? And is it right to set the controller of the fxml-file with: fx:id="client.stuff.controller.DefaultController" ??
tagged with: path
type: AnsweredQuestion
tagged with: javafx
accepted answer: http://stackoverflow.com/a/23189451
has title: javafx find the right path
type: Question

http://stackoverflow.com/a/23354000
downvote count: 0
has comment: http://stackoverflow.com/comment/35767746
has comment: http://stackoverflow.com/comment/35767466
has comment: http://stackoverflow.com/comment/35767864
has comment: http://stackoverflow.com/comment/35767781
answers question: http://stackoverflow.com/q/23260775
has comment: http://stackoverflow.com/comment/35767642
type: Answer
has comment: http://stackoverflow.com/comment/35768041
score: 2
has comment: http://stackoverflow.com/comment/35795715
upvote count: 2
has body: JVM is throwing ClassNotFoundException as there is no MyServ class under WEB-INF present within the project. Refactor the servlet by moving the Servlet Java class within a package and include the fully qualified class under web.xml belonging to the project & not tomcat. Servlet class inside web.xml should be: MyServ packagename.MyServ
has comment: http://stackoverflow.com/comment/35767552
has comment: http://stackoverflow.com/comment/35767762
has comment: http://stackoverflow.com/comment/35769528
has comment: http://stackoverflow.com/comment/35767535
has comment: http://stackoverflow.com/comment/35767499
has comment: http://stackoverflow.com/comment/35767649
has comment: http://stackoverflow.com/comment/35767782
has comment: http://stackoverflow.com/comment/35767486
has comment: http://stackoverflow.com/comment/35767718
has comment: http://stackoverflow.com/comment/35767905

http://stackoverflow.com/a/53283339
score: -2
has body: You should use public int collectedDots variable rather than private int collectedDots variable
type: Answer
downvote count: 2
upvote count: 0
answers question: http://stackoverflow.com/q/23189672

http://stackoverflow.com/q/23192553
has comment: http://stackoverflow.com/comment/35482816
has comment: http://stackoverflow.com/comment/35473414
upvote count: 3
has title: Do Java Library has abstract classes ??
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23192634
type: Question
tagged with: java
tagged with: native
answer count: 2
downvote count: 4
favorite count: 0
tagged with: abstract-class
has answer: http://stackoverflow.com/a/23192604
has body: Recently I had an interview in java and the interviewer asked me about the abstract classesgiven by java by default, is there any? Thinking about this I couldn't figure out the answer because since we cannot instantiate an abstract class and while doing code in java we mostly make an object of library classes given by java so that means it is not an abstract class. So can someone tell me is there any java library given abstract class because as I query on web the links given mostly about defining an abstract class or use of abstract class.. Thank you..
score: -1

http://stackoverflow.com/comment/35641631
score: 0
comment on: http://stackoverflow.com/q/23284943
type: QuestionComment
has text: @LalitPoptani where is the styleable folder ??
type: Comment

http://stackoverflow.com/a/23255719
has comment: http://stackoverflow.com/comment/35587171
type: AcceptedAnswer
downvote count: 0
score: 1
has body: Both of these are in the same folder. Try BufferedImage image = ImageIO.read(getClass().getResourceAsStream("HeatMap.png")); int w = image.getWidth(); int h = image.getHeight(); You can try other options also. Read comments. // Read from same package ImageIO.read(getClass().getResourceAsStream("c.png")); // Read from absolute path ImageIO.read(new File("E:\\SOFTWARE\\TrainPIS\\res\\drawable\\c.png")); // Read from images folder parallel to src in your project ImageIO.read(new File("images\\c.jpg"));
answers question: http://stackoverflow.com/q/23255609
accepted answer of: http://stackoverflow.com/q/23255609
type: Answer
upvote count: 1

http://stackoverflow.com/a/23239364
has comment: http://stackoverflow.com/comment/35557474
has comment: http://stackoverflow.com/comment/35556899
accepted answer of: http://stackoverflow.com/q/23239224
downvote count: 4
score: -2
type: AcceptedAnswer
has body: try this s.matches("\\d*[1-9](_\\d+)*")
has comment: http://stackoverflow.com/comment/35557609
type: Answer
has comment: http://stackoverflow.com/comment/35557301
has comment: http://stackoverflow.com/comment/35557077
has comment: http://stackoverflow.com/comment/35557816
answers question: http://stackoverflow.com/q/23239224
has comment: http://stackoverflow.com/comment/35556975
upvote count: 2
has comment: http://stackoverflow.com/comment/35558062

double
tags question: http://stackoverflow.com/q/23290341
tags question: http://stackoverflow.com/q/23137719
tags question: http://stackoverflow.com/q/23270269
tags question: http://stackoverflow.com/q/23228440
tags question: http://stackoverflow.com/q/23129880
tag name: double
type: Tag
tags question: http://stackoverflow.com/q/23188628
tags question: http://stackoverflow.com/q/23278685
tags question: http://stackoverflow.com/q/23170703
tags question: http://stackoverflow.com/q/23181918
tags question: http://stackoverflow.com/q/23148704
tags question: http://stackoverflow.com/q/23218024

http://stackoverflow.com/comment/35493482
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23203872
score: 0
has text: Adding to @AleksG comment, `checkGroup` must also be thread-safe.

http://stackoverflow.com/q/23237846
has comment: http://stackoverflow.com/comment/35561114
has comment: http://stackoverflow.com/comment/35555306
favorite count: 0
has title: GIT: fetch-merge vs pull
has comment: http://stackoverflow.com/comment/35724752
type: UnansweredQuestion
answer count: 0
upvote count: 2
score: 1
tagged with: java
downvote count: 1
has comment: http://stackoverflow.com/comment/35554979
tagged with: git
type: Question
tagged with: version-control
has comment: http://stackoverflow.com/comment/35554311
has comment: http://stackoverflow.com/comment/35559377
has body: I understand that fetch-merge and pull are the same thing, however sometimes by doing fetch-merge I get some conflicts which I would not get if I just did pull. Does anybody know why?

http://stackoverflow.com/a/23252318
downvote count: 0
has comment: http://stackoverflow.com/comment/35581925
accepted answer of: http://stackoverflow.com/q/23247910
has comment: http://stackoverflow.com/comment/35638462
answers question: http://stackoverflow.com/q/23247910
has comment: http://stackoverflow.com/comment/35696961
type: Answer
has comment: http://stackoverflow.com/comment/35594976
has body: JRebel features Remoting facility, which can be used to sync the changes via HTTP to the remote machine. For that, you should enable JRebel on remote Tomcat (via -javaagent:jrebel.jar) and enable JRebel remote plugin that create an HTTP endpoint for negotiating with the IDE plugin. -Drebel.remoting_plugin=true will do. For more information you can check the tutorial for setting up Remoting with IntelliJ IDEA and Tomcat. Otherwise, without remoting enabled, you can deploy the app with the rebel.xml config file which will point to the location where the exploded application is and JRebel will make Tomcat to load the resources from that specific location, so you could just synchronize from IntelliJ to that remote location via SSH. JRebel will then work as usual - monitoring the changes in the specified location and reloading the classes/resources as soon as they are being used in the application.
upvote count: 1
has comment: http://stackoverflow.com/comment/35650553
score: 1
type: AcceptedAnswer

selenium
tags question: http://stackoverflow.com/q/23186851
tags question: http://stackoverflow.com/q/23262051
tags question: http://stackoverflow.com/q/23159234
tags question: http://stackoverflow.com/q/23194353
tags question: http://stackoverflow.com/q/23194166
tags question: http://stackoverflow.com/q/23147560
tags question: http://stackoverflow.com/q/23252196
tags question: http://stackoverflow.com/q/23214254
tags question: http://stackoverflow.com/q/23191701
tags question: http://stackoverflow.com/q/23147663
tags question: http://stackoverflow.com/q/23211029
tags question: http://stackoverflow.com/q/23219937
tag name: selenium
tags question: http://stackoverflow.com/q/23212881
tags question: http://stackoverflow.com/q/23133024
tags question: http://stackoverflow.com/q/23217430
tags question: http://stackoverflow.com/q/23171162
tags question: http://stackoverflow.com/q/23269670
tags question: http://stackoverflow.com/q/23248400
tags question: http://stackoverflow.com/q/23247269
type: Tag
tags question: http://stackoverflow.com/q/23237142
tags question: http://stackoverflow.com/q/23270929
tags question: http://stackoverflow.com/q/23227074
tags question: http://stackoverflow.com/q/23149807
tags question: http://stackoverflow.com/q/23249011
tags question: http://stackoverflow.com/q/23227830
tags question: http://stackoverflow.com/q/23220575
tags question: http://stackoverflow.com/q/23172052
tags question: http://stackoverflow.com/q/23273507

http://stackoverflow.com/comment/35754519
type: AnswerComment
has text: Also the wizard to generate entity classe works partly. But may be there is another issue in the metadata, because the generated classes has no relations like lists of the related tables (classes). And the reference to another table has only the ID and not the other table as a class. I know the right behaviour from using this wizard in context with a oracle database.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23308939

http://stackoverflow.com/a/32014299
downvote count: 0
has comment: http://stackoverflow.com/comment/140150651
answers question: http://stackoverflow.com/q/23266464
score: 5
has comment: http://stackoverflow.com/comment/94915268
has body: To variabilize your file name, you can set a requiredProperty and use other properties to build it RouteBuilder${flowName.toUpperCase()}${flowWay.substring(0,1).toUpperCase()}${flowWay.substring(1)} Then name the template file : __routeBuilderFileName__.java
type: Answer
has comment: http://stackoverflow.com/comment/61434935
upvote count: 5

http://stackoverflow.com/comment/35446325
type: QuestionComment
type: Comment
score: 0
has text: is there something wrong with how it's done now?
comment on: http://stackoverflow.com/q/23176548

http://stackoverflow.com/comment/35478751
comment on: http://stackoverflow.com/a/23195200
score: 0
type: AnswerComment
type: Comment
has text: @Volodia, are you sure?? because I just ran a sample code, that creates and adds a new tab at the given index, shifting tabs (not replacing any of them). My tabbedPane had 3 tabs and I executed this line `jTabbedPane1.insertTab("tab new", null, new JPanel(), null, 0);` testing with various index value. it didn't replace any tab, but added new tab every time.

http://stackoverflow.com/q/23135289
type: Question
has body: I have a path to a file held in a variable set within the mule flow called certificateFilePath. In the SFTP I have set the identityFile attribute as follow: identifyFile="#['certificateFilePath']" However, I get that #['certificateFilePath'] is not found as an error when running my flow, as if the expression had not been evaluated. If I switch to identityFile="/my/actual/path/cert.pem", then it works. Can't I use a Mule expression for identityFile. I can use expressions for other attributes, like user, path, password. I would expect identityFile to be able to have a dynamic value. Is there a workaround for this? Thanks,
downvote count: 0
tagged with: sftp
favorite count: 0
type: UnansweredQuestion
has title: Mule: SFTP PKI File allowing Mule expression for path to file instead of string
answer count: 0
score: 1
tagged with: java
tagged with: mule
has comment: http://stackoverflow.com/comment/35372571
upvote count: 1

http://stackoverflow.com/comment/35519357
type: Comment
type: AnswerComment
has text: try this to search in your home folder: `grep -r JAVA_HOME ~`
comment on: http://stackoverflow.com/a/23218161
score: 0

http://stackoverflow.com/a/24870500
score: 1
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/23288991
downvote count: 0
has body: I solved this by deleting the working directory of my Tomcat server, cleaning, and republishing. For reference, my working directory was: {eclipse-workspace}/.metadata/.plugins/org.eclipse.wst.server.core And my server was tmp0. I've seen other people have servers under different directories. I found this path after double clicking on the Tomcat server in eclipse. That brings up a configuration menu and it lists the "Server Location".

http://stackoverflow.com/comment/35636804
type: AnswerComment
type: Comment
has text: Note that both of these methods actually iterate through the array for you, but much less readbly and efficiently. Use a for loop.
score: 1
comment on: http://stackoverflow.com/a/23282340

http://stackoverflow.com/comment/35516745
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23216715
type: Comment
has text: Although your code didn't help me much, the fact that it worked for you helped me looking elsewhere for the problem. The problem was that I was still printing out chosen.nick, and not the elements in the new array. How foolish. Thanks a lot, though :)

http://stackoverflow.com/q/23152531
tagged with: dbfit
answer count: 0
type: UnansweredQuestion
tagged with: oracle-database
downvote count: 0
score: 1
favorite count: 0
type: Question
upvote count: 1
has body: Is anyone know how to change default dateformat in DBFit/Fitnesse? When I execute alter session set nls_date_format='ddmmyyyy'; and then try to insert some date in this format it gets me unparsable date exception. I've read documentation but there is nothing about it. I also searched over forums and didn't find nothing. Thank in advance Przemek Woźniak
tagged with: java
has title: Change dbfit default date format
tagged with: testing

http://stackoverflow.com/q/23174265
has comment: http://stackoverflow.com/comment/35441621
favorite count: 0
has answer: http://stackoverflow.com/a/38362882
has answer: http://stackoverflow.com/a/23174692
has answer: http://stackoverflow.com/a/66375878
has answer: http://stackoverflow.com/a/49361611
has answer: http://stackoverflow.com/a/49175920
linked to: http://stackoverflow.com/q/905611
has answer: http://stackoverflow.com/a/78878633
has comment: http://stackoverflow.com/comment/35441981
has answer: http://stackoverflow.com/a/47906080
has answer: http://stackoverflow.com/a/31622733
has answer: http://stackoverflow.com/a/39793984
has answer: http://stackoverflow.com/a/28019658
has answer: http://stackoverflow.com/a/29358730
has answer: http://stackoverflow.com/a/29383652
has answer: http://stackoverflow.com/a/49238793
has comment: http://stackoverflow.com/comment/35443219
has comment: http://stackoverflow.com/comment/35441892
accepted answer: http://stackoverflow.com/a/23174638
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/39143701
upvote count: 101
has title: How to specify jdk path in eclipse.ini on windows 8 when path contains space
tagged with: eclipse
type: Question
has body: This doesn't work -vm %JAVA_HOME%/bin/javaw.exe How can I replace %JAVA_HOME% with full path on Windows 8 when path contains space ("Program Files" directory)
has answer: http://stackoverflow.com/a/23174638
has answer: http://stackoverflow.com/a/50562620
possible better answer: http://stackoverflow.com/a/29383652
has comment: http://stackoverflow.com/comment/35443197
score: 101
downvote count: 0
answer count: 16

http://stackoverflow.com/q/23271557
upvote count: 1
type: Question
tagged with: typesafe-config
has body: Is there anyway to merge two config files the following way: val conf1= .... val conf2= .... conf1.withFallbackToPath(conf2,"root.branch2") **conf1.conf** root { branch1 { value="Hello i am source" } } **conf2.conf** value = "I am merged" The result of this merge should be : root { branch1 { value="Hello i am source" } branch2 { value = "I am merged" } }
downvote count: 0
tagged with: playframework
answer count: 1
tagged with: typesafe
favorite count: 0
type: UnansweredQuestion
tagged with: scala
has answer: http://stackoverflow.com/a/23278127
has title: Merging Config library
score: 1
tagged with: java

http://stackoverflow.com/q/23187979
has comment: http://stackoverflow.com/comment/35466045
tagged with: bufferedreader
has comment: http://stackoverflow.com/comment/35466227
score: -3
has answer: http://stackoverflow.com/a/23188295
downvote count: 4
type: AnsweredQuestion
tagged with: fileinputstream
has comment: http://stackoverflow.com/comment/35466198
has comment: http://stackoverflow.com/comment/35466189
has title: Separate numbers from string
favorite count: 0
type: Question
tagged with: dictionary
accepted answer: http://stackoverflow.com/a/23188295
has comment: http://stackoverflow.com/comment/35465703
has body: /THIS IS A HOMEWORK QUESTION/ I have a .txt file containing the information: 000001 commercial 200000.00 101 000002 commercial 200000.00 101 000003 residential 100000.00 102 I need to separate this data into a set, to organize by commercial/residential, and add double value based on the 101,102 ID's.
tagged with: java
tagged with: set
upvote count: 1
answer count: 1

http://stackoverflow.com/comment/35517517
comment on: http://stackoverflow.com/q/23217414
has text: Well what did you try so far? Did you try getFilesDir() and getExternalFilesDir()? By the way: if exportDir for "" (which idea lies behind ""?) does not exist you cannot create it so remove the mkdirs().
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35470847
type: Comment
type: QuestionComment
has text: so I have String str = scan.nextLine(); StringTokenizer stkn = new StringTokenizer(str,"\\n"); ts.add(stkn.nextToken()); But I am not getting a good result how would I add fields in to an Arraylist or set?
comment on: http://stackoverflow.com/q/23190792
score: 0

http://stackoverflow.com/a/23285456
type: Answer
has comment: http://stackoverflow.com/comment/35643347
score: 2
has comment: http://stackoverflow.com/comment/35643582
upvote count: 2
has comment: http://stackoverflow.com/comment/35645272
has comment: http://stackoverflow.com/comment/35644825
accepted answer of: http://stackoverflow.com/q/23285294
has comment: http://stackoverflow.com/comment/35642904
has comment: http://stackoverflow.com/comment/35645805
answers question: http://stackoverflow.com/q/23285294
has comment: http://stackoverflow.com/comment/35644376
has body: To elaborate on my comment: When you call writer.write( ), it expects you to give it a parameter that tells it what to write. Without that parameter, your code should not be compiling. String s = "foobar" writer.write(s) or just: writer.write("foobar") will write a String value to file. A second problem you have is that FileWriter (or more accurately, Writer, which it derives from) is only capable of writing Strings, chars and ints by itself. If you want to write arbitrary Objects to file, you'll need to use an ObjectOutputStream: RandomObject rando = new RandomObject(); FileOutputStream fout = new FileOutputStream(FILE_PATH); ObjectOutputStream oos = new ObjectOutputStream(fout); oos.writeObject(rando); You might find this tutorial useful.
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/35644381

http://stackoverflow.com/comment/35495256
type: QuestionComment
comment on: http://stackoverflow.com/q/23204407
has text: @AlaaM. I have added this question to the top. Feel free to correct/add details.
score: 0
type: Comment

http://stackoverflow.com/a/23253514
has body: Yes, you're missing the fact that &lt;fmt:message&gt; accepts parameters, and uses the standard MessageFormat class behind the scenes. So you just need &lt;fmt:message key="wasVsNow"&gt; &lt;fmt:param value="${price}"/&gt; &lt;fmt:param value="${salePrice}"/&gt; &lt;/fmt:message&gt; in your JSP, and, in your properties files containing the internationalized messages: wasVsNow=Was {0} - now {1}
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23253421
upvote count: 2
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/23253421

http://stackoverflow.com/q/23250507
has answer: http://stackoverflow.com/a/23250583
type: UnansweredQuestion
has body: Consider the following code: public static void resize(int[] x){ x = new int[x.length*2]; System.out.println(x.length + " "); } public static void main(String[] args){ int[] x = {1,2}; resize(x); System.out.println(x.length); } The output is "4 2". The question is: I thought that when we are defining an array in the code of the new length, the other array (the previous one with length 2) would be discarded, as now the value of the array points to the "larger" array. So, why would then print out at the end as length 2? I used Arrays.toString to verify, and indeed, the actual values of the array after the void method are {1,2}. This is confusing, as I thought that the array itself would be changed as the value is a pointer to the memory address (in contrast with using the method on a char/int variable, which would not affect the value of the variable).
tagged with: java
has answer: http://stackoverflow.com/a/23250666
linked to: http://stackoverflow.com/q/40480
has answer: http://stackoverflow.com/a/23250716
downvote count: 1
type: Question
linked to: http://stackoverflow.com/q/3700971
has title: Arrays and Referencing
duplicate of: http://stackoverflow.com/q/40480
tagged with: arrays
score: -1
answer count: 3
has comment: http://stackoverflow.com/comment/35576833
upvote count: 0
favorite count: 0

http://stackoverflow.com/q/23186288
has body: When I encrypt text using AES128 it works fine, then when I try to decrypt using the same encrypted data and key it gives me a javax.crypto.IlliegalBlockSizeException: input must be a multible of 16 when decrypting with a padded cipher error this only happens after my previous fix of adding an IvParameterSpec AES128 Java Class: package xcrypt; import java.security.SecureRandom; import javax.crypto.Cipher; import javax.crypto.KeyGenerator; import javax.crypto.SecretKey; import javax.crypto.spec.IvParameterSpec; import javax.crypto.spec.SecretKeySpec; public class AES128 { byte[] iv = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; IvParameterSpec ivSpec = new IvParameterSpec(iv); private 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(); return raw; } public byte[] encrypt(byte[] raw, byte[] clear) throws Exception { SecretKeySpec skeySpec = new SecretKeySpec(getRawKey(raw), "AES"); Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding"); cipher.init(Cipher.ENCRYPT_MODE, skeySpec, ivSpec); byte[] encrypted = cipher.doFinal(clear); return encrypted; } public byte[] decrypt(byte[] raw, byte[] encrypted) throws Exception { SecretKeySpec skeySpec = new SecretKeySpec(getRawKey(raw), "AES"); Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding"); cipher.init(Cipher.DECRYPT_MODE, skeySpec, ivSpec); byte[] decrypted = cipher.doFinal(encrypted); return decrypted; } } here's where the methods are being called (main class): public byte[] Encryption_AES128(byte[] plain , byte[] key) throws Exception { AES128 aes128 = new AES128(); return aes128.encrypt(key, plain); } public byte[] Decryption_AES128(byte[] cipher , byte[] key) throws Exception { AES128 aes128 = new AES128(); return aes128.decrypt(key, cipher); }
tagged with: aes
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/35463567
has comment: http://stackoverflow.com/comment/35462735
type: Question
has title: AES128 decryption error: javax.crypto.IlliegalBlockSizeException: input must be a multible of 16 when decrypting with a padded cipher
has comment: http://stackoverflow.com/comment/35464713
score: 0
has comment: http://stackoverflow.com/comment/35472519
has comment: http://stackoverflow.com/comment/35462491
has comment: http://stackoverflow.com/comment/35462660
type: UnansweredQuestion
tagged with: encryption
tagged with: cryptography

http://stackoverflow.com/a/23137534
downvote count: 0
has comment: http://stackoverflow.com/comment/35376814
has comment: http://stackoverflow.com/comment/35380939
score: 1
accepted answer of: http://stackoverflow.com/q/23137404
answers question: http://stackoverflow.com/q/23137404
upvote count: 1
type: AcceptedAnswer
type: Answer
has body: You can do: int numberOfDays = endDay &gt;= startDay ? endDay - startDay : 8 - (startDay - endDay); for (int i = startDay; i &lt;= startDay + numberOfDays; i++) { int day = (i - 1) % 7 + 1; } This makes use of the % modulo operator to ensure all values remain within 1 - 7. For example, once i becomes 8 the calculation will wrap day back to 1: (8 - 1) % 7 + 1 == 1.
has comment: http://stackoverflow.com/comment/35377314

http://stackoverflow.com/q/23156400
tagged with: eclipse
upvote count: 5
downvote count: 0
has title: What does "__JVM_DefineClass__" as a classloader location mean?
type: AnsweredQuestion
tagged with: jvm
favorite count: 0
has answer: http://stackoverflow.com/a/23156478
has body: I am debugging the reason as to why eclipse cannot load the source code when remote debugging dynamically compiled and loaded classes. I am seeing with the -verbose:class argument that my dynamically compiled class files are coming from __JVM_DefineClass__. I assume this to mean that they come from the JVM heapspace itself, as I have the compiler output the compiled bytes into a "FileManager" that caches the compiled bytes in memory. It seems that the only way for the source to be view-able when debugging is if I specify in the source lookup path where the actual loaded class came from... and it doesn't seem to work if I specify the directory where the class is being compiled from. I feel that if I save the compiled bytes to disk, the source loading might work. So, what does __JVM_DefineClass__ mean? Is my assumption correct?
type: Question
tagged with: classloader
score: 5
answer count: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/23156478

http://stackoverflow.com/comment/35555031
type: QuestionComment
type: Comment
has text: maybe this can help:http://stackoverflow.com/questions/6901764/get-concrete-class-name-from-abstract-class
comment on: http://stackoverflow.com/q/23237137
score: 0

http://stackoverflow.com/comment/35436305
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/23171322
type: Comment
has text: but both the response-with-error and list-of-items are valid, i just want to differentiate between them. Is it right to put the no-error format in the catch block?

http://stackoverflow.com/comment/35633473
has text: @AnubianNoob There is nothing here about finalizers.
type: AnswerComment
type: Comment
score: 1
comment on: http://stackoverflow.com/a/23280431

http://stackoverflow.com/q/23144236
type: Question
has answer: http://stackoverflow.com/a/23144365
downvote count: 0
has body: Can you use BigInteger.isProbablePrime() to generate cryptographically secure primes? What certainty is necessary for them to be "secure"?
answer count: 3
tagged with: public-key-encryption
tagged with: cryptography
has title: Use of BigInteger.isProbablePrime() to generate cryptographically secure primes
accepted answer: http://stackoverflow.com/a/23144365
favorite count: 0
possible better answer: http://stackoverflow.com/a/23144354
tagged with: primes
has answer: http://stackoverflow.com/a/23144856
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23144354
tagged with: biginteger
score: 1
tagged with: java
linked to: http://stackoverflow.com/q/6325576
upvote count: 1
linked to: http://stackoverflow.com/q/2385909

http://stackoverflow.com/comment/35540083
has text: @user3229011 I don't understand why you want to complicate this problem so much, if saying *it is for learning purposes* you won't learn something really valuable. Divide the problem into two steps: validate the email using a regex, then after validating it, obtain the desired substring from the email. The most simple you keep the solution, the most value you can generate.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23229511
type: Comment

http://stackoverflow.com/a/23281757
score: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/23225147
answers question: http://stackoverflow.com/q/23225147
has body: A representative from Google Enterprise Support named Jordan gave me the revised appcfg.cmd file below. It helped get me past the error I was having. Unfortunately there's another issue now, but I think the solution below addresses the original error I posted about. Thanks Heeryu and Tatiana for your offers of help. @echo off rem Copyright 2013 Google Inc. All Rights Reserved. cmd /c "python "%~dp0bootstrapping\prerun.py" --command-name=appcfg-java --component-id=gae-java --check-credentials --check-updates" IF %ERRORLEVEL% NEQ 0 ( EXIT /B %ERRORLEVEL% ) SETLOCAL set TMPFILE=%APPDATA%\gcloud\tmp-env-info-%RANDOM%.txt cmd /c "python "%~dp0bootstrapping\print_env_info.py" gae_java_path &gt; "%TMPFILE%" IF %ERRORLEVEL% NEQ 0 ( EXIT /B %ERRORLEVEL% ) set /p credential_path= &lt; "%TMPFILE%" del "%TMPFILE%" cmd /c ""%~dp0..\platform/appengine-java-sdk\bin\appcfg.cmd" --oauth2 --oauth2_config_file="%credential_path%" %*" IF %ERRORLEVEL% NEQ 0 ( EXIT /B %ERRORLEVEL% ) ENDLOCAL
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35675533

http://stackoverflow.com/comment/35632554
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23279779
has text: @bartektartanus this looks like homework, so I guess `List` usage would be innapropiate.

http://stackoverflow.com/a/23192859
upvote count: 1
type: AcceptedAnswer
type: Answer
downvote count: 0
has body: Do you want to deploy a single jar, that contains all the jars (or whatever files) of all the projects? Then use one of the maven plugins that builds all dependencies into a single jar. shade and assembly both do it, there may be others. You can also use the ear or war goals, but they have particular connotations and don't sound suitable for your aim.
score: 1
accepted answer of: http://stackoverflow.com/q/23192717
answers question: http://stackoverflow.com/q/23192717

http://stackoverflow.com/comment/35484482
score: 1
comment on: http://stackoverflow.com/q/23197505
type: Comment
type: QuestionComment
has text: You can attempt to learn reflection. `java.lang.reflect`

http://stackoverflow.com/a/23278274
score: 0
has body: Problem seems to be the space in the directory name, where it tries to print temporary file. Work around steps that solved this problem for me: 1) Create some new empty directory with no spaces in the path, for example, D:\google-cloud-sdk\tmp 2) Modify D:\google-cloud-sdk\bin\appcfg.cmd file by replacing %APPDATA%\gcloud\ with your newly created directory path D:\google-cloud-sdk\tmp\
type: Answer
answers question: http://stackoverflow.com/q/23225147

http://stackoverflow.com/comment/35574711
type: QuestionComment
has text: Look at the loooooong list of related questions on the right.
score: 5
comment on: http://stackoverflow.com/q/23249331
type: Comment

http://stackoverflow.com/comment/35629868
comment on: http://stackoverflow.com/q/23278867
score: 0
has text: "How may I 'wait' for input from an actionListener?" - you can't. Basically, the way a GUI works is that the GUI toolkit already runs a loop processing events. To maintain responsivity, these events must be handled quickly, which means no waiting for anything in them. Just do whatever is appropriate when the `ActionListener` that would submit a move is fired, unless that would take a long time.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35601748
comment on: http://stackoverflow.com/a/23156031
type: AnswerComment
score: 0
has text: Thanks sorry for accepting it late ! Worked very well !
type: Comment

http://stackoverflow.com/comment/35389311
has text: @amit I disagree. Generally you want to return a primative, and int's are used a lot more than longs. You could write another method called "longFactorial" but...
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/23144311
type: Comment

http://stackoverflow.com/q/23174101
has answer: http://stackoverflow.com/a/23174505
downvote count: 0
answer count: 1
favorite count: 0
has title: elastic search client using R packages
tagged with: http://stackoverflow.com/tag/r
has body: I am using elastic search as data store. In my project i need to analyze the elastic search data using R. In java i did these operations using es client. But i couldn't find any packages in R that support elastic search operations. I have tried using RCurl packages like this: count &lt;- fromJSON(getURL("http://localhost:9200/myindex/mytype/_count")) But this is not i want. Is there any packages in CRAN or other repositories that perform elastic search operations? Thanks
tagged with: elasticsearch
accepted answer: http://stackoverflow.com/a/23174505
upvote count: 2
tagged with: cran
score: 2
type: AnsweredQuestion
tagged with: java
type: Question

http://stackoverflow.com/comment/35627844
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23277774
has text: Sorry I thought I did paste my code in
type: Comment

http://stackoverflow.com/q/23204166
has answer: http://stackoverflow.com/a/24321998
type: UnansweredQuestion
has body: i'm trying to use tomcat + mysql to develop Web Application and this is my configuration: persistence.xml org.hibernate.jpa.HibernatePersistenceProvider java:comp/env/jdbc/EntityMappings <exclude-unlisted-classes>false</exclude-unlisted-classes> ENABLE_SELECTIVE NONE <property name="javax.persistence.schema-generation.database.action" value="none" /> web.xml MySQL Datasource example jdbc/EntityMappings javax.sql.DataSource Container context.xml(under tomcat/config) <Resource name="jdbc/EntityMappings" auth="Container" type="javax.sql.DataSource" maxActive="50" maxIdle="30" maxWait="10000" username="XXX" password="XXX" driverClassName="com.mysql.jdbc.Driver" url="jdbc:mysql://localhost:3306/EntityMappings"/> My schema is EntityMappings. After running it i got some errors: Name [java:comp/env/jdbc/EntityMappings] is not bound in this Context. Unable to find [java:comp]. Unable to lookup JNDI name [java:comp/env/jdbc/EntityMappings] javax.persistence.PersistenceException: Unable to build entity manager factory i have placed the mysql driver under my tomcat/lib (mysql-connector-java-5.1.30-bin.jar)
upvote count: 4
tagged with: spring-mvc
downvote count: 0
tagged with: mysql
tagged with: tomcat7
has comment: http://stackoverflow.com/comment/35494392
type: Question
tagged with: java
has title: Tomcat + Mysql - Unable to find java:comp
score: 4
tagged with: servlets
answer count: 1
favorite count: 0

http://stackoverflow.com/comment/35364562
type: Comment
comment on: http://stackoverflow.com/a/23131295
type: AnswerComment
score: 0
has text: then i guess there might be something wrong with `EL`

http://stackoverflow.com/q/23144367
has answer: http://stackoverflow.com/a/23148833
has title: Why do I have lines going across my libgdx game using Tiled?
has comment: http://stackoverflow.com/comment/69702755
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/16062224
tagged with: java
accepted answer: http://stackoverflow.com/a/23148833
has comment: http://stackoverflow.com/comment/35389654
type: Question
has comment: http://stackoverflow.com/comment/35390386
has body: I'm using LibGdx and Tiled and when moving around the screen, there are both horizontal and vertical lines appearing on the game. I can post any code you need, if necessary. How do I get these lines to stop? Here's a gfycat gif of the lines: http://gfycat.com/FastUnnaturalAmericanwirehair Edit: Here's a small bitbucket repository, as small as I could get it that has the same glitch in it: https://bitbucket.org/Chemical_Studios/example-of-line-glitch/src/8eeb153ec02236d836763072611bd7aa55d38495/minimalExample/src/com/weebly/chemicalstudios/minEx/?at=master
upvote count: 9
tagged with: libgdx
has comment: http://stackoverflow.com/comment/35389114
possible better answer: http://stackoverflow.com/a/44030809
tagged with: tiled
tagged with: lines
has answer: http://stackoverflow.com/a/44030809
has comment: http://stackoverflow.com/comment/35389028
answer count: 2
has comment: http://stackoverflow.com/comment/35389638
downvote count: 0
has comment: http://stackoverflow.com/comment/35389095
has comment: http://stackoverflow.com/comment/35389699
favorite count: 0
linked to: http://stackoverflow.com/q/26908317
score: 9
tagged with: visual-glitch

http://stackoverflow.com/a/23169324
score: 0
has comment: http://stackoverflow.com/comment/35433388
answers question: http://stackoverflow.com/q/23169217
has body: It's known sad issue (which is still unresolved in JDK): http://bugs.java.com/view_bug.do?bug_id=4724038 But even though there's no public API for that there's a dangerous workaround (use at your own risk): https://community.oracle.com/message/9387222 An alternative is not to use huge MappedByteBuffers and hope that they eventually will be garbage-collected. In case what is needed is for different programs that want to map this file use their very own MappedByteBuffer copy out of this File, MapMode.PRIVATE could help. Hope that helps.
has comment: http://stackoverflow.com/comment/35432838
type: Answer
has comment: http://stackoverflow.com/comment/35432652
has comment: http://stackoverflow.com/comment/35433214

http://stackoverflow.com/a/23139946
answers question: http://stackoverflow.com/q/23137719
has body: I tried to reproduce your arithmetic, and got 549.09999999999990905052982270717620849609375 as result. If rounded to two decimal places for display, it would be 549.10, so I don't think your issue is floating point precision, although I do agree BigDecimal would be a better choice for this application. (I'm only using BigDecimal in my program to get exact printout of the result.) Here's my program. I suggest working out what is different about the arithmetic in yours, and investigating that. import java.math.BigDecimal; public class Test { public static void main(String[] args) { String[] cant = {"10", "10"}; String[] pret = {"27.10", "27.81"}; double totaltest=0; for (int j = 0; j &lt; cant.length; j++) { Double temp = Double.parseDouble(cant[j]) * Double.parseDouble(pret[j]); totaltest = totaltest + temp; } System.out.println(new BigDecimal(totaltest)); } }
downvote count: 0
type: Answer
upvote count: 1
score: 1

http://stackoverflow.com/q/23186564
has comment: http://stackoverflow.com/comment/35485345
has comment: http://stackoverflow.com/comment/35463029
type: Question
tagged with: oop
tagged with: java
score: 0
has comment: http://stackoverflow.com/comment/35493094
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35463102
has body: I am a newbie to java technology and have a little idea about design patterns. I have to write a java application that contains 3 independent threads: the first thread is used to write on a file "A" the second one is used to write on a file "B" and when the writing on file done an another independent thread "C" merge these two file. I have to write the application as efficient as possible. I am thinking about using design pattern. Is there any design pattern that fits the scenario best?
tagged with: design-principles
answer count: 0
tagged with: multithreading
has title: Suitable Design Pattern for Multi Threaded Java Application
tagged with: design-patterns

http://stackoverflow.com/q/23283584
type: Question
has answer: http://stackoverflow.com/a/23283611
tagged with: for-loop
answer count: 1
tagged with: user-interface
has comment: http://stackoverflow.com/comment/35638851
has comment: http://stackoverflow.com/comment/35638977
tagged with: awt
has comment: http://stackoverflow.com/comment/35638863
score: 0
has title: for loop (i) variable used outside the loop or possible solution?
has comment: http://stackoverflow.com/comment/35638840
linked to: http://stackoverflow.com/q/23284722
tagged with: swing
accepted answer: http://stackoverflow.com/a/23283611
type: AnsweredQuestion
has body: I am trying to find a way for my startTextFieldListener to gain access to some variables in my for loop. Is there a way to do this? I'm sorry if there is an easy solution to this but I am not quite sure how to work around this. I have seen some examples but I did not know how to apply it to my program. Any help would be greatly appreciated. public class TextArea1{ JTextArea text; JFrame frame; JTextField textField; public int k; public ArrayList aList; public String correctAnswer; public static void main (String [] args) { TextArea1 gui = new TextArea1(); gui.go(); } private String textLine; public void go() { frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JPanel panel = new JPanel(); textField = new JTextField(""); textField.addActionListener(new startTextFieldListener(aList)); JButton startButton = new JButton ("Start!"); startButton.addActionListener(new startButtonListener(aList)); text = new JTextArea (30, 60); text.setLineWrap(true); JScrollPane scroller = new JScrollPane(text); scroller.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); scroller.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); panel.add(scroller); frame.getContentPane().add(BorderLayout.CENTER, panel); frame.getContentPane().add(BorderLayout.WEST, startButton); frame.getContentPane().add(BorderLayout.SOUTH, textField); frame.setSize(350, 300); frame.setVisible(true); } class startButtonListener implements ActionListener { ArrayList aList; startButtonListener(ArrayList passedInList) { aList = passedInList; } @Override public void actionPerformed(ActionEvent event) { String fileName = "test.txt"; String line; ArrayList aList = new ArrayList(); try { try (BufferedReader input = new BufferedReader (new FileReader(fileName))) { if (!input.ready()) { throw new IOException(); } while ((line = input.readLine()) !=null) { aList.add(line); }} } catch (IOException e) { System.out.println(e); } int sz = aList.size(); for (i…
tagged with: java

http://stackoverflow.com/a/23212548
answers question: http://stackoverflow.com/q/23204181
accepted answer of: http://stackoverflow.com/q/23204181
has comment: http://stackoverflow.com/comment/35521742
upvote count: 2
type: AcceptedAnswer
has body: In short: this is currently (version 2.0/2.1) not supported. Pagination is quite a complicated beast when it comes to security as an @PostFilterapproach doesn't really work due to the fact that you'd create invalid results if you filtered items from the page after it has been loaded. A correct solution to this issue requires the security constraint being incorporated into the query executed. We have a ticket in Spring Data Commons to keep track of the general infrastructure required for this, as well as a somehow related one on the support for soft deletes in Spring Data JPA which you might wanna track on progress on that topic.
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/35527972
downvote count: 0

http://stackoverflow.com/q/23180028
accepted answer: http://stackoverflow.com/a/23180459
has comment: http://stackoverflow.com/comment/35452161
type: AnsweredQuestion
tagged with: android-fragments
tagged with: java
tagged with: sharedpreferences
has answer: http://stackoverflow.com/a/23180459
type: Question
has body: I'm using this code to apply the editTextPreference title when the user put a value inside the box. The problem is that when I click on "ok" it doesn't change the title but only if I re-click on the editTextPreference it applies the before-written value. public void handleTEST(){ final EditTextPreference pref = (EditTextPreference)findPreference("test"); pref.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener(){ @Override public boolean onPreferenceClick(Preference preference) { pref.setTitle(pref.getText()); return true; } }); } So how can I apply the title on "OK" click?
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/35452120
has title: Set Edit Text Preference Title on "OK" click
possible better answer: http://stackoverflow.com/a/23180087
has answer: http://stackoverflow.com/a/23180087
tagged with: android
has comment: http://stackoverflow.com/comment/35452204
has comment: http://stackoverflow.com/comment/35451858

masking
tag name: masking
tags question: http://stackoverflow.com/q/23164012
type: Tag

http://stackoverflow.com/comment/35387293
type: Comment
comment on: http://stackoverflow.com/q/23143344
score: 0
has text: What is hard to understand that one line is simpler than a 5 line `if-else` that has the same effect?
type: QuestionComment

http://stackoverflow.com/comment/35419308
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23154514
has text: I add to the topic the code where I use the hasPermission method. How I should complement the method call to match the implementations I have? Or, if I add a method with 1 argument, how I could get the list of authorities from logged user? Any thoughts?

http://stackoverflow.com/comment/35420568
type: AnswerComment
score: 0
has text: We may disagree on this, but it's certainly not because my definition of "answer" is skewed. I'd estimate that by my definition over 99% of answers at SO that don't get deleted qualify. That's based on having done thousands of reviews and nearly always going back to check how others voted, and on having raised roughly 300 "not an answer" flags and only having one declined. That's a pretty clear indication that my understanding of what is and isn't an answer is not out of step with community standards.
type: Comment
comment on: http://stackoverflow.com/a/23157183

http://stackoverflow.com/comment/35443250
comment on: http://stackoverflow.com/a/23175235
type: AnswerComment
has text: You can create new tasks (see the [Ant manual](https://ant.apache.org/manual/develop.html#writingowntask)) if the [built-in ones](https://ant.apache.org/manual/tasklist.html) don't do what you need.
score: 0
type: Comment

http://stackoverflow.com/a/23273580
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23273579
type: Answer
accepted answer of: http://stackoverflow.com/q/23273579
score: 2
downvote count: 0
has body: AFAIK, it is not possible to get the JMXConnectorServer which is automatically created by getPlatformMBeanServer(), but you can make the platform MBean server use a connector server instance that you created yourself. When you do this, it is important that the com.sun.management.jmxremote* system properties are unset, so that the platform MBean server does not automatically set up a connector server. Example: If you configured the JMX remote access with the system properties -Dcom.sun.management.jmxremote.port=1919 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false remove these system properties and configure your own connector server programmatically with the following code: int jmxPort = 1919; LocateRegistry.createRegistry(jmxPort); MBeanServer beanServer = ManagementFactory.getPlatformMBeanServer(); // or: MBeanServer beanServer = MBeanServerFactory.createMBeanServer(); // doesn't register the default platform MBeans JMXServiceURL jmxUrl = new JMXServiceURL("service:jmx:rmi:///jndi/rmi://localhost:" + jmxPort + "/jmxrmi"); JMXConnectorServer connectorServer = JMXConnectorServerFactory.newJMXConnectorServer(jmxUrl, null, beanServer); connectorServer.start(); This tech note from Oracle contains another example for a manual connector server setup when you want to use authentication and SSL.
upvote count: 2

http://stackoverflow.com/a/23343470
has body: You can create your own class inheriting ViewPager and override onInterceptTouchEvent like this: @Override public boolean onInterceptTouchEvent(MotionEvent arg0) { // TODO Auto-generated method stub if(arg0.getAction() == MotionEvent.ACTION_UP) { //Your code here return false; } else { //Do this to keep swipes working. It will also make vertical swiping work. You can avoid the latter by handling MotionEvent action and x,y directions. return super.onInterceptTouchEvent(arg0); } } Don't forget to replace the ViewPager object in your xml with com.example.yourpackagename.YourViewPagerClass
answers question: http://stackoverflow.com/q/23136309
has comment: http://stackoverflow.com/comment/122193029
score: 0
type: Answer

http://stackoverflow.com/q/23169495
has comment: http://stackoverflow.com/comment/35432938
answer count: 1
score: 0
has comment: http://stackoverflow.com/comment/35432988
tagged with: jframe
type: UnansweredQuestion
has body: I have this code : if(false) { this.setUndecorated(true); this.setExtendedState(this.MAXIMIZED_BOTH); } else { this.setSize(1024, 768); this.setLocationRelativeTo(null); this.setResizable(false); } My app runs in a window mode but when i change the false statement to true, it runs in Full screen mode. I don't get what represent the false statement in If? Thank you for your time
has title: Full screen & window mode Jframe
tagged with: swing
has answer: http://stackoverflow.com/a/23169580
tagged with: java
type: Question

http://stackoverflow.com/comment/35590453
type: AnswerComment
type: Comment
has text: @sleepless: heck, you never specify for us what the error is! I'm guessing a NullPointerException as your pseudo-constructor never gets called.
comment on: http://stackoverflow.com/a/23257646
score: 0

http://stackoverflow.com/comment/35368265
type: AnswerComment
type: Comment
has text: According to your post update, I take it that IYO it's better because you're free to inherit from something else even with this shared data, right? In that case, IMO it depends on the semantics of the classes. If an inheritance hierarchy makes sense with respect to the real world represented by the classes, I would go with inheritance.
score: 1
comment on: http://stackoverflow.com/a/23133165

http://stackoverflow.com/comment/35604187
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23256779
has text: Regarding sound, to get good visual results, you will need to process the FFT data quite a bit since ATM you're only dealing with the raw results, not taking into account perceptual weighting for example. Start with very simple tests/sketches and begin by looking at the fft averaging and beat detection samples. Use simple audio at the start and minimal graphics until you get the hang of creating a meaningful link between what you see and what you hear. You can always improve and do more complex things later. Also simple graphics will help the brain focus more on sound and make the links itself
type: AnswerComment

http://stackoverflow.com/comment/35522218
score: 0
type: Comment
type: QuestionComment
has text: Excuse me, I am beginner in Java. How is it possible to reset it? Thank you
comment on: http://stackoverflow.com/q/23219945

http://stackoverflow.com/comment/35386176
type: QuestionComment
has text: Use `mainpagetry.this` instead only `this` as first parameter of ArrayAdapter constructor
type: Comment
comment on: http://stackoverflow.com/q/23142767
score: 0

http://stackoverflow.com/q/23195795
score: 3
favorite count: 0
tagged with: session-variables
type: UnansweredQuestion
tagged with: session-timeout
tagged with: spring
tagged with: spring-mvc
has title: Spring MVC redirect user to login page once session is expired
upvote count: 3
tagged with: java
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/35491356
downvote count: 0
has answer: http://stackoverflow.com/a/23248632
linked to: http://stackoverflow.com/q/5834558
has body: I have stored a user bean in session as @SessionAttributes({"UserBean"}) in my controller. My aim is to redirect user to login/error page if session is expired. Following is my code snippet @RequestMapping(value = "searchOpportunity.htm", method = RequestMethod.GET) public ModelAndView searchOpportunity(@ModelAttribute("UserBean") UserBean userBean) { functionName = "searchOpportunity"; logger.info("HERE !!! In " + className + " - " + functionName + " "); System.out.println("HERE !!! In " + className + " - " + functionName + " "); try { if (userBean == null) { System.out.println(userBean); return new ModelAndView("userLogout", "command", null); } } catch (Exception e) { e.printStackTrace(); } return new ModelAndView("opportunity/opportunitySearch", "command", new SearchOpportunityBean()); } However when the session is expired i get the following error. org.apache.catalina.core.StandardWrapperValve invoke SEVERE: Servlet.service() for servlet mintDispatcher threw exception org.springframework.web.HttpSessionRequiredException: Session attribute 'UserBean' required - not found in session at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter$ServletHandlerMethodInvoker.raiseSessionRequiredException(AnnotationMethodHandlerAdapter.java:761) at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.resolveModelAttribute(HandlerMethodInvoker.java:758) at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.resolveHandlerArguments(HandlerMethodInvoker.java:356) at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:171) at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:436) at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:424) at org.springframework.web.servlet.DispatcherServlet.doDispatch(Dispatch…
has answer: http://stackoverflow.com/a/23247564

http://stackoverflow.com/comment/35473913
type: Comment
has text: as i said iterate over all children, use getChildCount and getChildAt
type: QuestionComment
comment on: http://stackoverflow.com/q/23187772
score: 0

http://stackoverflow.com/comment/35390386
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23144367
has text: Ok, there's a very large set of issues that could be happening here, and I don't have too much LibGDX experiance. You have seem to have put some effort into this, so I'm going to grab your code and try to find the issue.
score: 0

http://stackoverflow.com/comment/35611500
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23267239
has text: @user3568400: Start [here](http://docs.oracle.com/javase/tutorial/uiswing/dnd/intro.html).
type: Comment

http://stackoverflow.com/q/23149349
has body: I have created a program in which a window opens which says click to start.When we press start button it opens another window and make it fullscreen. I have add keylistener to this fullscreen window to move an image.But its not working. If you wanna see the code please ask me . public g1(){ panel = new JPanel(); cake = new ImageIcon("G:\\naman1.jpg").getImage(); start = new JButton("Start"); restart = new JButton("Restart"); exit = new JButton("EXIT"); panel.add(start); panel.setFocusable(true); start.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent arg0) { new g1().run(); //this method is from superclass it calls init } } ); panel.setBackground(Color.GRAY); } public void init(){ super.init(); //it makes the window fullscreen Window w = s.getFullScreenWindow(); w.setFocusable(true); w.addKeyListener(this);}
tagged with: keyboard
type: UnansweredQuestion
tagged with: swing
has comment: http://stackoverflow.com/comment/35398281
tagged with: java
has title: Keylistener not working with fullscreen
type: Question
tagged with: fullscreen
has answer: http://stackoverflow.com/a/23154432
has comment: http://stackoverflow.com/comment/35397424
score: 0
has comment: http://stackoverflow.com/comment/35404260
has comment: http://stackoverflow.com/comment/35397477
answer count: 1

http://stackoverflow.com/comment/35511463
score: 0
type: AnswerComment
has text: In which place I should you use?
type: Comment
comment on: http://stackoverflow.com/a/23213738

http://stackoverflow.com/comment/92058660
type: Comment
has text: There's currently no support for Spring Web Services; just Spring Web (REST) annotations.
comment on: http://stackoverflow.com/a/23280949
type: AnswerComment
score: 0

http://stackoverflow.com/q/23206461
has answer: http://stackoverflow.com/a/23206764
type: UnansweredQuestion
has title: Replacing a line of text in Java
has body: I have an ATM and I need to open a text file that contains the account info in the following format: Account number Last Name First Name Balance (there would be no blanks but this site wouldn't let me) The file name is Accountnfomation.txt. Basically, I need to be able to replace/change the Balance value depending on what the user wants. I know how to find the account number in the text file, but I don't know how to skip the next two lines and edit it. Here is some code I've written: try { Scanner Account= new Scanner(new File ("AccountInformation.txt")); FileOutputStream Account2= new FileOutputStream ("AccountInformation.txt",true); while (Account.hasNextLine()) { String nextToken = Account.next(); if (nextToken.equalsIgnoreCase(MyLoginID)) { //searches for specific match // the idea here would to be to edit balance amount } } } This is what I have so far. It finds the account number, but I don't know what to do next.
tagged with: java
has answer: http://stackoverflow.com/a/23206657
type: Question
has comment: http://stackoverflow.com/comment/35498705
score: 0
answer count: 2
tagged with: file-io

http://stackoverflow.com/q/23278267
type: Question
score: 3
has title: I can not change the corner color of a ScrollPane in JavaFX
has body: My css code for it looks like this yet it still doesn't work. scrollpane? .scroll-pane:corner &gt; .viewport { -fx-background-color : #191A19; } Is there a problem with my syntax or does the whole view port issue not allow me to edit any other aspect of the
upvote count: 3
answer count: 2
favorite count: 0
has answer: http://stackoverflow.com/a/23278791
type: UnansweredQuestion
tagged with: css
tagged with: java-8
has answer: http://stackoverflow.com/a/34242241
downvote count: 0
tagged with: java
tagged with: javafx

http://stackoverflow.com/comment/35653330
comment on: http://stackoverflow.com/a/23279260
score: 0
type: AnswerComment
has text: Now error: itemsRelated is not mapped [from models.aquilesModels.entity.Item where itemsRelated IS NOT EMPTY order by createDate desc]
type: Comment

http://stackoverflow.com/a/23285237
has comment: http://stackoverflow.com/comment/35642732
answers question: http://stackoverflow.com/q/23284509
type: Answer
has comment: http://stackoverflow.com/comment/35642201
has comment: http://stackoverflow.com/comment/35643488
has comment: http://stackoverflow.com/comment/35643073
score: 3
has body: As Makoto suggested, there is simply nothing special about final in variable declarations as far as GC is concerned. In your example code private final Object obj = new Object(); will be garbage collected at the same time as private Object obj = new Object(); Both are strong references, but are invalidated and garbage collected together with their parent class TestFinalGC instance. That is because when the instance is GC'd, the reference fields are destroyed as well and the references do not exist any more. obj's reference count thus decreases by one. However, should you write something like Object x = myTestFinalGC.obj; // only works if your obj is not private, of course Then the object will not be garbage collected because it will still have one reference lingering around (assuming this particular line of code is in another class instance that remains alive when myTestFinalGC is garbage collected. tl;dr: memory allocations are garbage collected when their hard reference count drops to zero (and the collector runs, of course). final doesn't change this fact.
has comment: http://stackoverflow.com/comment/35642264
upvote count: 3
has comment: http://stackoverflow.com/comment/35641973
has comment: http://stackoverflow.com/comment/35642506
has comment: http://stackoverflow.com/comment/35641888
has comment: http://stackoverflow.com/comment/35642397
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/35642641
accepted answer of: http://stackoverflow.com/q/23284509

http://stackoverflow.com/comment/35599387
comment on: http://stackoverflow.com/q/23250112
type: Comment
type: QuestionComment
has text: I would also need to add the external .jar of Bouncy Castle to the project and add it as a provider right? How do you add it as a provider?
score: 0

http://stackoverflow.com/comment/35402749
comment on: http://stackoverflow.com/a/23150691
score: 0
type: AnswerComment
type: Comment
has text: Thank you Alex :-) you're very kind

http://stackoverflow.com/comment/35581914
has text: And the compile/link logs both come back clean for your shader program?
score: 0
comment on: http://stackoverflow.com/q/23252513
type: Comment
type: QuestionComment

copy
tags question: http://stackoverflow.com/q/23289098
type: Tag
tags question: http://stackoverflow.com/q/23279140
tag name: copy

http://stackoverflow.com/comment/35440980
has text: @Jeffrey I don't think so, you can just one of them at random - and it will favor a path starting with this direction (if such shortest path exists). No fault with this I believe (unless you have some counter-example...?)
comment on: http://stackoverflow.com/a/23171756
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/23196832
has comment: http://stackoverflow.com/comment/35492904
accepted answer of: http://stackoverflow.com/q/23195562
answers question: http://stackoverflow.com/q/23195562
upvote count: 2
type: AcceptedAnswer
has body: The first error message says it all. You're attempting SSL to a plaintext port. Try disabling SSL, or use the correct port for SSL. The second one says that your truststore doesn't trust the server certificate. If it's self-signed, you will need to import it into your truststore.
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/35480340
score: 2
has comment: http://stackoverflow.com/comment/35481112

http://stackoverflow.com/q/23250516
has comment: http://stackoverflow.com/comment/35577125
tagged with: java
has comment: http://stackoverflow.com/comment/35576826
type: Question
score: 0
answer count: 1
tagged with: jackson
has title: How to get jackson to ignore non-DTO objects
tagged with: spring
has answer: http://stackoverflow.com/a/23300372
has body: We recently upgraded to GlassFish Jersey 2.7 from the Sun Jersey implementation. When we did this Jackson started trying to deserilize our Domain objects. Which in our case isn't what we want. We have Domain setup so that domain objects are never directly sent out via the web services. Everything is transformed in to a DTO and then sent out. So basically we just call return Response.ok(new SomeFooBarDTOObject(someFooBarDomainObject)).build() and this use to work with the previous version of Jersey/Jackson. With the more up to date code we're getting errors like the following: Conflicting setter definitions for property "preferredItem": com.foo.domain.FooBar#setPreferredItem(1 params) vs com.foo.domain.FooBar#setPreferredItem(1 params) Even though we never try to send out the actual domain object. How do we tell Jackson to only look at objects that are actually received or sent via a web service. Here is the web service that is causing the issue I've simplified it down to just this. If I take out the RestaurantItemDTO restaurantItemDTO from the method parameters it works, but if I keep it in there it doesn't. RestaurantItemDTO only has base types in it's fields. The only way it references a domain object is through a constructor parameter, and there is also a public no parameter constructor as well. So it's not the only constructor. @Controller @Path("/restaurant/restaurantItem") public class RestaurantItemWebService { @PUT @Path("/ordersheets/{ordersheetId}/{locationId}/restaurantItems/{restaurantItemId}") @Produces(value = MediaType.APPLICATION_JSON) @Consumes(value = MediaType.APPLICATION_JSON) @Transactional @PreAuthorize("hasRole('" + PermissionNames.SOME_PERMISSION+ "')") public Response saveExistingRestaurantItem(@PathParam("ordersheetId") Long orderSheetID, @PathParam("restaurantItemId") Long restaurantItemID, RestaurantItemDTO restaurantItemDTO) { return Response.ok(restaurantItemDTO).build(); }
type: AnsweredQuestion
tagged with: jersey
accepted answer: http://stackoverflow.com/a/23300372

http://stackoverflow.com/comment/35541100
comment on: http://stackoverflow.com/q/23217691
type: Comment
type: QuestionComment
score: 0
has text: i've tried probably all examples

http://stackoverflow.com/comment/35523744
type: AnswerComment
comment on: http://stackoverflow.com/a/23214339
type: Comment
score: 0
has text: but i changed the code "select name,content,image,dt from DIARY where _id=?" it has stopped again, why

http://stackoverflow.com/comment/35603211
type: AnswerComment
score: 0
type: Comment
has text: yeah because i'm leaving them as 0....whats the point of setting them to 0, you can add buffer[2] = 0; if it make you feel better, but it has no effect, the char can only be 2 bytes...so only use 2 bytes...4 bytes are padding
comment on: http://stackoverflow.com/a/23263503

http://stackoverflow.com/a/23269382
downvote count: 0
answers question: http://stackoverflow.com/q/23269248
upvote count: 2
has body: It often makes our code flexible. Imagine a program where, if I typed in 128 instead of 127, we would get inaccurate results. I agree, that the int type does bring with it an unwanted overhead, but that overhead is negligible in the grand scheme of the application (for most cases).
type: Answer
score: 2

http://stackoverflow.com/q/23138281
has comment: http://stackoverflow.com/comment/35377751
score: 0
has comment: http://stackoverflow.com/comment/35378176
has comment: http://stackoverflow.com/comment/35377748
answer count: 1
has comment: http://stackoverflow.com/comment/35377792
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23138507
accepted answer: http://stackoverflow.com/a/23138507
has body: The connection url which we all use for mySql in java is :- Connection c = DriverManager.getConnection("jdbc:mysql://localhost/THE_DB", "root", ""); But I want to know that is it possible to use a url like C:\\Documents\\Folder\\THE_DB as the connection URL? If yes, then please tell me what the connection URL would be...
tagged with: java
tagged with: mysql
has title: Is it possible in mySql to have a user determined path as connection URL
type: Question

http://stackoverflow.com/a/23226211
has comment: http://stackoverflow.com/comment/35533291
upvote count: 4
downvote count: 0
score: 4
has body: BufferedReader#readLine() returns a String not StringBuffer. Change the type of S1. Also, choose a better variable name. You're storing the string replaced with special characters in result, but you're printing S1.
type: Answer
answers question: http://stackoverflow.com/q/23226182

http://stackoverflow.com/comment/35490397
comment on: http://stackoverflow.com/a/23202248
type: Comment
score: 0
type: AnswerComment
has text: @TheGuy: Thank you, removed the second part of the answer.

http://stackoverflow.com/a/23286591
upvote count: 1
has body: You can't take the data already formatted, but you can input the data as a String and format at. Take a look at NumberFormat for formatting the number. If you want to get each digit from a string, try getting the char from the String for each number, and then convert it to an Integer or an int.
accepted answer of: http://stackoverflow.com/q/23286480
answers question: http://stackoverflow.com/q/23286480
type: AcceptedAnswer
downvote count: 0
score: 1
type: Answer
has comment: http://stackoverflow.com/comment/35644318

http://stackoverflow.com/a/23235348
has body: These are the main differences 1.Static variables take memory only 1 time during the lifetime of program. 2.You can call static variables or methods. without creating the object of that class by classname only. 3.Static variables can be called in static and non-static context. Mainly static variables are used to save memory because every object takes memory .
answers question: http://stackoverflow.com/q/23235257
has comment: http://stackoverflow.com/comment/35550583
has comment: http://stackoverflow.com/comment/35550467
has comment: http://stackoverflow.com/comment/35550544
has comment: http://stackoverflow.com/comment/35550531
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/35550399
has comment: http://stackoverflow.com/comment/35550303
has comment: http://stackoverflow.com/comment/35550491
has comment: http://stackoverflow.com/comment/35550425

http://stackoverflow.com/q/23138328
has body: My applet in the webpage does not open and the Java plugin becomes unresponsive and chrome freezes out. I am new to Java Web Services. Any help will be appreciated. Java Plug-in 10.55.2.14 Using JRE version 1.7.0_55-b14 Java HotSpot(TM) Client VM User home directory = ---------------------------------------------------- c: clear console window f: finalize objects on finalization queue g: garbage collect h: display this help message l: dump classloader list m: print memory usage o: trigger logging q: hide console r: reload policy configuration s: dump system and deployment properties t: dump thread list v: dump thread stack x: clear classloader cache 0-5: set trace level to &lt;n&gt; ---------------------------------------------------- cache: Initialize resource manager: com.sun.deploy.cache.ResourceProviderImpl@15b758 java.lang.NullPointerException at sun.awt.SunToolkit.getSystemEventQueueImplPP(Unknown Source) at sun.awt.SunToolkit.getSystemEventQueueImplPP(Unknown Source) at sun.awt.SunToolkit.getSystemEventQueueImpl(Unknown Source) at java.awt.Toolkit.getEventQueue(Unknown Source) at java.awt.EventQueue.invokeLater(Unknown Source) at sun.awt.windows.WToolkit.windowsSettingChange(Unknown Source) at sun.awt.windows.WToolkit.eventLoop(Native Method) at sun.awt.windows.WToolkit.run(Unknown Source) basic: Added progress listener: sun.plugin.util.ProgressMonitorAdapter@7544a6 security: Expected Main URL: http://soemething/applet.jar basic: Plugin2ClassLoader.addURL parent called for http://soemething/applet.jar security: Blacklist revocation check is enabled security: blacklist: created: NEED_LOAD, lastModified: 1397750579401 security: blacklist: hasBeenModifiedSince 1397750579477 (we have 1397750579401) security: Trusted libraries list check is enabled network: Cache entry found [url: http://soemething/applet.jar, version: null] prevalidated=false/0 cache: Adding MemoryCache entry: http://soemething/applet.jar cache: Resource http://soemething/applet.jar has expired.
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23144235
tagged with: freeze
score: 3
has title: Applet does not run and crashes 7u55 plugin in chrome, Firefox and IE work fine
downvote count: 0
tagged with: java
tagged with: google-chrome
has comment: http://stackoverflow.com/comment/35877893
type: Question
tagged with: crash
upvote count: 3
has comment: http://stackoverflow.com/comment/35671642
linked to: http://stackoverflow.com/q/17275259
answer count: 1
tagged with: applet
favorite count: 0

http://stackoverflow.com/comment/37787027
score: 1
has text: Thanks, it's the solution that i was looking for.
type: AnswerComment
comment on: http://stackoverflow.com/a/24353758
type: Comment

http://stackoverflow.com/comment/35545572
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23232834
has text: Use super. inside methodAvailableInSuper if you need to call the method of methodAvailableInSuper superclass. If you do this.methodAvailableInSuper you will end with a recursion. Same is out method: use super. to call not overrided method.
type: Comment

http://stackoverflow.com/comment/35460205
type: QuestionComment
has text: Some discussion about this on the scala-language alias: https://groups.google.com/forum/#!msg/scala-language/LJGpb1wDjI4/HgE8jcGbL0YJ
score: 0
comment on: http://stackoverflow.com/q/23147080
type: Comment

http://stackoverflow.com/a/23155814
has body: Well, there is a full example on the official website on how creating a NavigationDrawer with a ListView in it : http://developer.android.com/training/implementing-navigation/nav-drawer.html Once this down work on your scroll down problematic ...
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/23154802
answers question: http://stackoverflow.com/q/23154802
upvote count: 1
score: 1

http://stackoverflow.com/comment/35506028
type: Comment
has text: @user3555902 Works flawlessly, tested it!
type: AnswerComment
comment on: http://stackoverflow.com/a/23210785
score: 0

http://stackoverflow.com/q/23184806
has comment: http://stackoverflow.com/comment/35459440
has comment: http://stackoverflow.com/comment/35459464
has body: I was working on my project last night, I saved it as usual and closed down eclipse. I woke up today to continue with it as it's in for next week and this happens : I have no idea what to do. Is there any possibility I can get my classes back? thanks =/
type: AnsweredQuestion
tagged with: java
tagged with: eclipse
possible better answer: http://stackoverflow.com/a/23184840
accepted answer: http://stackoverflow.com/a/23184899
type: Question
has answer: http://stackoverflow.com/a/23184840
has comment: http://stackoverflow.com/comment/35460028
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/23184899
has title: The file does not exist
has comment: http://stackoverflow.com/comment/35459410

http://stackoverflow.com/comment/35636981
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23282162
type: Comment
has text: @ImmerAllein Then it should be flagged and closed, not taken down.

http://stackoverflow.com/comment/35530092
type: Comment
comment on: http://stackoverflow.com/a/23224269
type: AnswerComment
has text: I would also change LHS ArrayList<Byte> to List<Byte>
score: 0

http://stackoverflow.com/a/23135286
upvote count: 3
downvote count: 1
has comment: http://stackoverflow.com/comment/35372150
answers question: http://stackoverflow.com/q/23135121
has comment: http://stackoverflow.com/comment/35372185
has comment: http://stackoverflow.com/comment/35372430
has comment: http://stackoverflow.com/comment/35372290
type: Answer
has comment: http://stackoverflow.com/comment/35372516
score: 2
has body: You're trying to use constructs that are not allowed in Java: You can't use T.getManagers(), because it is a static method, and the class T won't be available at runtime (type erasure). If the getManagers() method exists in class Bar (and it should*), then use Bar.getManagers() instead. You can't use T.class for the same reason, the class T won't be available at runtime. Use fooClass instead. The code you provided should look like: public static &lt;T extends Bar&gt; T getFoo(Class&lt;T&gt; fooClass , String person) { T foo = null; try { Configuration config = Configuration.getConfiguration(person); foo = (T) Bar.getInstance(config, Bar.getManagers(), fooClass); } catch (Exception e) { logger.error("Error", e); } return foo; } (*) This method should be in Bar because it seems to be a common behaviour that you use here, and that you seem to expect from all Ts that could extend Bar. There is no such thing as inheritance for static methods.

http://stackoverflow.com/comment/35548756
type: Comment
has text: Bidirectional search in a graph with 500000^2 edges will still be too slow (the shortest paths can have length > 5 if I'm not mistaken)
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/23231453

http://stackoverflow.com/q/23247886
tagged with: jpa
has comment: http://stackoverflow.com/comment/35572659
answer count: 1
has comment: http://stackoverflow.com/comment/35573969
has body: I'm having some trouble with a JPA query. I should tell you now, I'm not an expert in JPA at all. I have two classes, Line and LineData. The relationship between Line and LineData is that a Line can potentially have 100s of LineData objects associated to it. The reason I haven't explicitly joined them is because most of the time when I retrieve a Line entity, I don't need the LineData (and seeing as there could be 100s, it would be a waste to load them all and then not use them). However, what I would like to be able to do, when retrieving a Line entity, is get the maximum LineData.value1 value as well and return that as a part of the Line entity, as Line.maxVal1 . I've tried doing this with the following query: SELECT l, l.maxVal1 = (SELECT MAX(d.value1) FROM LineData d WHERE d.name = l.name) FROM Line l WHERE l.name = example123 ORDER BY l.name ASC But Line.maxVal1 is coming back as null. I have tried the subquery on its own and it does return an actual value. Is it possibly to do what I'm trying here? If so, how? Here are simplified versions of my classes: public class Line { @Column(nullable = false, unique = true) public String name; @Column public boolean active; @Transient public Integer maxVal1; } public class LineData { @Column(nullable = false) public String name; @Column public Integer value1; @Column public Integer value2; @Column public Integer value3; ... @Column public Integer activeN; } EDIT Here's an example of the what the database values would look like: Line name | active ====================== example123 | true example234 | false example345 | true LineData name | value1 | value2 | ... | valueN ============================================ example123 | 1 | 2 | | 1 example123 | 3 | 2 | | 1 example345 | 1 | 2 | | 1 example123 | 14 | 2 | | 1 example123 | 2 | 2 | | 1 example123 | 2 | 2 | | 1 example123 | 3 | 2 | | 1 And the result of the query returning a Line object, with the values: name | active | maxVal1 ============================== example123 |…
type: UnansweredQuestion
has title: JPA select entity and use subquery to assign value in entity all within a single query
has comment: http://stackoverflow.com/comment/35573862
has comment: http://stackoverflow.com/comment/35573556
has answer: http://stackoverflow.com/a/23252480
score: 0
tagged with: java
tagged with: hibernate
tagged with: h2
has comment: http://stackoverflow.com/comment/35572884
has comment: http://stackoverflow.com/comment/35574240
type: Question
has comment: http://stackoverflow.com/comment/35573512

http://stackoverflow.com/q/23209675
tagged with: e4
has title: Eclipse 4 RCP Editor using SourceViewer Undo and Redo operations are not working
accepted answer: http://stackoverflow.com/a/23212878
has body: I'm creating an editor using 'SourceViewer'. Given below is the code snippet from my '@PostConstruct' method. // viewer is my SourceViewer instance viewer = new SourceViewer(parent,verticalRuler, styles); IUndoManager undoManager = new TextViewerUndoManager(25); undoManager.connect(viewer); viewer.setUndoManager(undoManager); Even though a default 'TextViewerUndoManager' associated with 'SourceViewer'. Ctrl+Z and Ctrl+Y is not working. Another alternative that I tried is to override the 'IUndoManager getUndoManager(ISourceViewer sourceViewer)' of 'SourceViewerConfiguration' subclass and return a 'TextViewerUndoManager'. This approach also doesn't give the desired result. Kindly let me know what I'm missing in the above approaches.
type: AnsweredQuestion
tagged with: java
tagged with: rcp
tagged with: eclipse
type: Question
possible better answer: http://stackoverflow.com/a/23992417
tagged with: text-editor
answer count: 2
has answer: http://stackoverflow.com/a/23992417
has answer: http://stackoverflow.com/a/23212878
score: 0

http://stackoverflow.com/comment/35650155
type: Comment
score: 0
has text: I checked out the ControlBus component you mentioned. I queried for the status of the "triggerAfterDelay" route, but at the moment of the error, the status is still Started.
type: AnswerComment
comment on: http://stackoverflow.com/a/23287917

http://stackoverflow.com/comment/35531387
type: QuestionComment
type: Comment
has text: @user1344545 The reason you use a direct buffer is that it is faster and uses less heap. If neither of these matter, what does matter?
score: 0
comment on: http://stackoverflow.com/q/23224616

http://stackoverflow.com/q/23233344
type: UnansweredQuestion
tagged with: google-app-engine
tagged with: maven
has title: Adding java facet for a GAE maven project
tagged with: java
has answer: http://stackoverflow.com/a/23257319
type: Question
has body: I created a Google App Engine maven project according to this documentation and it works successfully. Then after i import the same project into eclipse by using the option Existing Maven Project . But in eclipse its only just maven project without having java facet.Then i manually added facet by right clicking Project -> Properties -> Project Facet -> Tick on java option. Now eclipse shows java errors on my created application (for some app engine related classes). But this project works fine by using maven command like mvn clean install and mvn appengine:devserver. Here follows the pom for my maven project <?xml version="1.0" encoding="UTF-8"?> 4.0.0 com.google.appengine.demos guestbook 1.0-SNAPSHOT pom <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <appengine.target.version>1.9.0</appengine.target.version> com.google.appengine appengine-maven-plugin ${appengine.target.version} guestbook-war guestbook-ear
score: 0
answer count: 1

http://stackoverflow.com/a/23149083
has body: If you need more functionality than what JTS offers, you should check out GeoTools. It provides the ability to read and write most major cartographic formats, supports map projections and coordinate transformations, and is a much more full featured GIS suite. JTS is strictly geometry -- it deals with 2d shapes with no units attached.
downvote count: 0
type: Answer
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/23144550

http://stackoverflow.com/a/23136900
has body: You can use reflection on the fooClass object to obtain and execute the getManagers() method. It will fail at runtime if the class doesn't have the method though. public static &lt;T extends Bar&gt; T getFoo(Class&lt;T&gt; fooClass , String person) { T foo = null; try { Configuration config = Configuration.getConfiguration(person); Method getManagers = fooClass.getDeclaredMethod("getManagers"); foo = (T) Bar.getInstance(config, getManagers.invoke(null), T.class); } catch (Exception e) { logger.error("Error", e); } return foo; } This is not a great practice, but should work.
answers question: http://stackoverflow.com/q/23135121
type: Answer
score: 0

http://stackoverflow.com/comment/35582655
type: Comment
type: QuestionComment
has text: ArrayList resizes itself automatically. Why would you need to specify a specific size?
comment on: http://stackoverflow.com/q/23253527
score: 0

http://stackoverflow.com/q/23138528
tagged with: object
has title: How can I avoid unwanted XML Tags with JAXB. Too much binding?
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23138739
tagged with: java
tagged with: jaxb
has body: The Code Below allows me to write an Object into an XML file. public class BathGuest{ private String name = ""; private DateMinutesHours wakeUpTime; private int duration = 0; private DateMinutesHours _plannedTime; @XmlElement(name ="plannedTime") public DateMinutesHours get_plannedTime() { return _plannedTime; } @XmlElement(name = "ID") public String getName() { return _name; } ... } The problem I have is, that birthday is an other Class to handle my timeoperations. So the result of my XML File, is not really what i expected. What I get is: 3 Walter 481 485 And what I want is: 3 Walter 08:10 08:50 How can I reach the Second XMl-File?
type: Question
answer count: 1
downvote count: 0
score: 1
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0
tagged with: datetime
has answer: http://stackoverflow.com/a/23138739
upvote count: 1

http://stackoverflow.com/a/23257942
has comment: http://stackoverflow.com/comment/35618815
accepted answer of: http://stackoverflow.com/q/23256150
score: 0
answers question: http://stackoverflow.com/q/23256150
type: AcceptedAnswer
has body: David's answer does not address your problem. I believe you are trying to debug executable jars... if you have corresponding source on eclipse that is exactly in sync with the .jar that you are using, you can use the Remote Debugging feature of the jvm. Execute your jar with one of the following commands (specifying main class/classpath if you do not have a manifest, of course) Pre Java 1.5: java -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=[PortNumberHere] -jar [YourJarHere] Java 1.5+: java -agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=[PortNumberHere] -jar [YourJarHere] In Eclipse, create a debug configuration for a Remote Java Application. Ensure that the port number is the one that your app is listening on, that you are using the Socket Connect option, and that you have the correct project selected. Then, go to the source tab and add all of your source directories that you would like to debug. If done correctly the debugging should behave exactly as if you were debugging the jar in-house, except it being remote and all.
type: Answer
has comment: http://stackoverflow.com/comment/35617706
has comment: http://stackoverflow.com/comment/35623220
has comment: http://stackoverflow.com/comment/35612640
has comment: http://stackoverflow.com/comment/35632756
has comment: http://stackoverflow.com/comment/35619345

http://stackoverflow.com/comment/35492490
comment on: http://stackoverflow.com/q/23202988
score: 0
has text: @DecodingLife what is "UTF8" ? it is UTF-8 . For standards you can use StandardCharsets.UTF_8 . I tried your code it works very well after adding UTF_8 .
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35394169
type: AnswerComment
has text: Thanks Pravin, however, I need to have a button not a link.
score: 0
comment on: http://stackoverflow.com/a/23147248
type: Comment

http://stackoverflow.com/comment/35384749
comment on: http://stackoverflow.com/a/23141427
type: AnswerComment
has text: yes I did something quite similar and it worked great. Thanks!
score: 0
type: Comment

http://stackoverflow.com/comment/35660605
type: Comment
type: QuestionComment
has text: Can you use http://graphics.stanford.edu/~seander/bithacks.html#IntegerLogDeBruijn to compute the value of the highest set bit?
comment on: http://stackoverflow.com/q/23278164
score: 0

http://stackoverflow.com/comment/35546391
type: Comment
comment on: http://stackoverflow.com/a/23232859
score: 0
type: AnswerComment
has text: @DavidWallace I don't really care. I'm addressing what he wrote. I'm not interested in guesswork about whether he meant it, what he might have meant instead, ...

http://stackoverflow.com/q/23233480
has comment: http://stackoverflow.com/comment/35546903
has comment: http://stackoverflow.com/comment/35546774
tagged with: java
has comment: http://stackoverflow.com/comment/35546923
type: Question
has body: My problem is as follow : I am making an ajax call to a jsp and its success part is like this : success: function(msg){ alert(msg); if(msg.indexOf("false")&gt;=0) { var counter=$('#attemptsleft').value+1; $('#attemptsleft').val(counter); var left=3-counter; if(left&gt;=0) alert("You have "+left+" attemps left"); else alert("You have no attempts left"); } else{ alert("success"); } } Actually what i want to do is that to provide number of attempts to the user and if he exceeds those then tell that their are no more attempts left. In html am doing this : &lt;input type="hidden" id="attemptsleft" value="0"&gt;&lt;/input&gt; Where am doing wrong.As am not getting results which were expected.
tagged with: javascript
score: 0
has title: Counting Number of attemps left using ajax
has answer: http://stackoverflow.com/a/23234404
answer count: 2
tagged with: jsp
has answer: http://stackoverflow.com/a/23233574
tagged with: ajax
has comment: http://stackoverflow.com/comment/35546869
type: UnansweredQuestion

nullpointerexception
tags question: http://stackoverflow.com/q/23176290
tags question: http://stackoverflow.com/q/23188801
tags question: http://stackoverflow.com/q/23185162
tags question: http://stackoverflow.com/q/23179139
tags question: http://stackoverflow.com/q/23133235
tags question: http://stackoverflow.com/q/23167685
tags question: http://stackoverflow.com/q/23260112
tags question: http://stackoverflow.com/q/23281335
tags question: http://stackoverflow.com/q/23268818
tags question: http://stackoverflow.com/q/23289538
tags question: http://stackoverflow.com/q/23189065
tags question: http://stackoverflow.com/q/23243701
tags question: http://stackoverflow.com/q/23161519
tags question: http://stackoverflow.com/q/23153853
tags question: http://stackoverflow.com/q/23202827
type: Tag
tag name: nullpointerexception
tags question: http://stackoverflow.com/q/23212254
tags question: http://stackoverflow.com/q/23197525
tags question: http://stackoverflow.com/q/23195254
tags question: http://stackoverflow.com/q/23163999
tags question: http://stackoverflow.com/q/23187582
tags question: http://stackoverflow.com/q/23200712
tags question: http://stackoverflow.com/q/23281130
tags question: http://stackoverflow.com/q/23144596
tags question: http://stackoverflow.com/q/23258134
tags question: http://stackoverflow.com/q/23188807
tags question: http://stackoverflow.com/q/23249533
tags question: http://stackoverflow.com/q/23179305
tags question: http://stackoverflow.com/q/23282567
tags question: http://stackoverflow.com/q/23144334
tags question: http://stackoverflow.com/q/23249009
tags question: http://stackoverflow.com/q/23202906
tags question: http://stackoverflow.com/q/23184787
tags question: http://stackoverflow.com/q/23172800
tags question: http://stackoverflow.com/q/23285707
tags question: http://stackoverflow.com/q/23141252
tags question: http://stackoverflow.com/q/23214941
tags question: http://stackoverflow.com/q/23206237
tags question: http://stackoverflow.com/q/23188082
tags question: http://stackoverflow.com/q/23215988
tags question: http://stackoverflow.com/q/23189495
tags question: http://stackoverflow.com/q/23153292
tags question: http://stackoverflow.com/q/23143094
tags question: http://stackoverflow.com/q/23236811
tags question: http://stackoverflow.com/q/23242307

http://stackoverflow.com/comment/35674690
type: QuestionComment
comment on: http://stackoverflow.com/q/23207415
score: 0
has text: Take a look at this post: http://stackoverflow.com/questions/19713577/using-java-7-with-neo4j-on-os-x
type: Comment

http://stackoverflow.com/q/23154811
has comment: http://stackoverflow.com/comment/35406475
type: UnansweredQuestion
has title: How to display the user id in encryption form within the view section of the JEE web application?
has body: I have created my web application in standard MVC format (Controller, beans, DAO, JSP pages). Now within the view section i.e. in the JSP page a user can get the list of other co-users of the application and can visit their profiles by clicking on their names. For this the link should be having the id of the user. But I don't want the id to be displayed within view section as this will be the same id that is stored in the database so I'm concerned about the security issues. So my question is their a way through which I could encrypt this displayed id.
tagged with: encryption
type: Question
has comment: http://stackoverflow.com/comment/35406438
tagged with: java
has answer: http://stackoverflow.com/a/23155366
has comment: http://stackoverflow.com/comment/35406376
score: 0
has comment: http://stackoverflow.com/comment/35406324
answer count: 1
tagged with: jsp

http://stackoverflow.com/a/23203677
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/23203421
has body: The answer is that you need to correctly use namespaces and namespace prefixes: First, make your DocumentBuilderFactory namespace aware by calling this before you use it: factory.setNamespaceAware(true); Then do this to retrieve the value you want: XPathFactory xPathfactory = XPathFactory.newInstance(); XPath xpath = xPathfactory.newXPath(); xpath.setNamespaceContext(new NamespaceContext() { @Override public String getNamespaceURI(String prefix) { if (prefix.equals("soap")) { return "http://www.w3.org/2003/05/soap-envelope"; } if (prefix.equals("zmb")) { return "urn:zimbra"; } return XMLConstants.NULL_NS_URI; } @Override public String getPrefix(String namespaceURI) { throw new UnsupportedOperationException("Not supported yet."); } @Override public Iterator getPrefixes(String namespaceURI) { throw new UnsupportedOperationException("Not supported yet."); } }); XPathExpression expr = xpath.compile("/soap:Envelope/soap:Header/zmb:context/zmb:session"); String sessionId = (String)expr.evaluate(doc, XPathConstants.STRING); You may need to add a line to the beginning of your file to import the NamespaceContext class: import javax.xml.namespace.NamespaceContext; http://ideone.com/X3iX5N
has comment: http://stackoverflow.com/comment/35495625
has comment: http://stackoverflow.com/comment/35522851
has comment: http://stackoverflow.com/comment/35518617
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/35504927
type: Answer
accepted answer of: http://stackoverflow.com/q/23203421

http://stackoverflow.com/comment/35513008
score: 0
comment on: http://stackoverflow.com/q/23214677
type: QuestionComment
type: Comment
has text: Nicola I am fetching some data from a URL. Each entry contains items which have a NEWID in them. NEWID can be same for multiple entries. I want another ArrayList which would group the data accroding to this NEWID

http://stackoverflow.com/comment/35612201
comment on: http://stackoverflow.com/a/23269534
score: 0
type: AnswerComment
has text: this opens the file:try { mLogOutStream = new FileOutputStream(createLogFile(), true); } catch (FileNotFoundException e) { e.printStackTrace(); }
type: Comment

http://stackoverflow.com/comment/35551745
type: QuestionComment
score: 0
has text: can you give me code for upload file in database
type: Comment
comment on: http://stackoverflow.com/q/23236095

http://stackoverflow.com/a/23142044
has body: Assuming speed is the speed to move at and angle is the angle in degrees to move in: x += speed*Math.cos(Math.toRadians(angle)); y += speed*Math.sin(Math.toRadians(angle));
accepted answer of: http://stackoverflow.com/q/23141968
answers question: http://stackoverflow.com/q/23141968
has comment: http://stackoverflow.com/comment/42041626
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/42082050
type: Answer
has comment: http://stackoverflow.com/comment/42139345
score: 2
upvote count: 2

http://stackoverflow.com/comment/35581941
type: AnswerComment
type: Comment
has text: @user2288240: Don't explicitly form the old-train edges. BFS only on the new-train edges. I'll update the first paragraph of my answer to an algorithm that works shortly; I initially misread the problem to have new trains running alongside the old trains.
score: 0
comment on: http://stackoverflow.com/a/23231734

http://stackoverflow.com/a/23199761
accepted answer of: http://stackoverflow.com/q/23188050
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23188050
has body: Try setting a relative path like this: config.setBasePath(".." + environment.getApplicationContext().getContextPath());
type: Answer
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/35572298

tomcat7
tags question: http://stackoverflow.com/q/23184274
tags question: http://stackoverflow.com/q/23147683
tags question: http://stackoverflow.com/q/23226372
tags question: http://stackoverflow.com/q/23253538
tags question: http://stackoverflow.com/q/23239748
tags question: http://stackoverflow.com/q/23150251
tags question: http://stackoverflow.com/q/23199570
type: Tag
tags question: http://stackoverflow.com/q/23134163
tags question: http://stackoverflow.com/q/23153778
tags question: http://stackoverflow.com/q/23203827
tags question: http://stackoverflow.com/q/23144597
tag name: tomcat7
tags question: http://stackoverflow.com/q/23204166

http://stackoverflow.com/a/23249199
has comment: http://stackoverflow.com/comment/35576969
has body: Don't use a design tool to create the GUI. Its sounds like Netbeans is using a absolute layout which is not what your want. Use a proper layout manager. Maybe a FlowLayout that is right aligned. Read the section from the Swing tutorial on How to Use Flow Layout for more information and working examples.
type: Answer
has comment: http://stackoverflow.com/comment/35576151
has comment: http://stackoverflow.com/comment/35578800
has comment: http://stackoverflow.com/comment/35575819
accepted answer of: http://stackoverflow.com/q/23248710
answers question: http://stackoverflow.com/q/23248710
score: 0
type: AcceptedAnswer

http://stackoverflow.com/a/23137030
score: 0
has body: Check the Javadoc. @return a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
type: Answer
answers question: http://stackoverflow.com/q/23136998

http://stackoverflow.com/a/23200015
score: 7
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/35486230
type: Answer
answers question: http://stackoverflow.com/q/23199874
has body: The fundamental issue you are facing is that List&lt;Subclass&gt; is not a subtype of List&lt;Superclass&gt;. The way to solve your problem is to declare the variable using a generic bound: List&lt;? extends Organism&gt; search; then this will compile: search = foods; The declaration List&lt;? extends Organism&gt; means "A List of an unknown type that is a subtype of Organism". In code, elements of such a list are known to at least be an Organism, but the exact type is unknown.
accepted answer of: http://stackoverflow.com/q/23199874
upvote count: 7

http://stackoverflow.com/comment/35467711
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23183424
type: Comment
has text: I agree that CSS is a much cleaner approach. However, with each text line I read in I also read the formatting requirements (e.g., heading level, indent amount). So is it possible to do something like this "//Set the indent level. int indentLevel = Integer.parseInt(ymAwardDetails.getAdIndentLevel()); int indent = indentLevel * 18; lblTaskName.getElement().getStyle().setTextIndent(indent, Unit.PT);" in CSS? Regards, Glyn

http://stackoverflow.com/comment/35383508
type: Comment
has text: Solve the first error I mentioned. You need to read about the operator basics.
comment on: http://stackoverflow.com/a/23141216
type: AnswerComment
score: 0

http://stackoverflow.com/comment/35450988
has text: @maxx777> This is not so advanced though.
type: Comment
comment on: http://stackoverflow.com/a/23179695
score: 0
type: AnswerComment

http://stackoverflow.com/q/23176986
type: UnansweredQuestion
has title: Java FXML ComboBox value java.lang.ClassCastException: java.lang.String cannot be cast to
tagged with: combobox
type: Question
score: 0
answer count: 1
tagged with: java
tagged with: javafx
has answer: http://stackoverflow.com/a/23177404
has body: I need a combobox that displays the name of a customer and give the customerId when one of its items is selected. The combobox i realized works in right way, but when it loose the focus, or I hit the enter key, I get the following error: Exception in thread "JavaFX Application Thread" java.lang.ClassCastException: java.lang.String cannot be cast to kinema.classi.NomeCodice at kinema.ASediController$1.changed(ASediController.java:104) at com.sun.javafx.binding.ExpressionHelper$Generic.fireValueChangedEvent(ExpressionHelper.java:347) at com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(ExpressionHelper.java:80) at javafx.beans.property.ReadOnlyObjectWrapper$ReadOnlyPropertyImpl.fireValueChangedEvent(ReadOnlyObjectWrapper.java:176) at javafx.beans.property.ReadOnlyObjectWrapper.fireValueChangedEvent(ReadOnlyObjectWrapper.java:142) at javafx.beans.property.ObjectPropertyBase.markInvalid(ObjectPropertyBase.java:112) at javafx.beans.property.ObjectPropertyBase.set(ObjectPropertyBase.java:145) at javafx.scene.control.SelectionModel.setSelectedItem(SelectionModel.java:102) at javafx.scene.control.ComboBox$2.changed(ComboBox.java:221) at com.sun.javafx.binding.ExpressionHelper$Generic.fireValueChangedEvent(ExpressionHelper.java:347) at com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(ExpressionHelper.java:80) at javafx.beans.property.ObjectPropertyBase.fireValueChangedEvent(ObjectPropertyBase.java:105) at javafx.beans.property.ObjectPropertyBase.markInvalid(ObjectPropertyBase.java:112) at javafx.beans.property.ObjectPropertyBase.set(ObjectPropertyBase.java:145) at javafx.scene.control.ComboBoxBase.setValue(ComboBoxBase.java:167) at com.sun.javafx.scene.control.skin.ComboBoxListViewSkin.setTextFromTextFieldIntoComboBoxValue(ComboBoxListViewSkin.java:512) at com.sun.javafx.scene.control.skin.ComboBoxListViewSkin.access$200(ComboBoxListViewSkin.java:57) at com.sun.javafx.scene.control.skin.ComboBoxListViewSkin$3.handle(ComboBoxListViewSkin.java:162) at …

jpanel
tags question: http://stackoverflow.com/q/23224480
tags question: http://stackoverflow.com/q/23150971
tags question: http://stackoverflow.com/q/23283726
tags question: http://stackoverflow.com/q/23169264
tags question: http://stackoverflow.com/q/23204473
tags question: http://stackoverflow.com/q/23208477
tags question: http://stackoverflow.com/q/23188014
tags question: http://stackoverflow.com/q/23288235
tags question: http://stackoverflow.com/q/23231886
tags question: http://stackoverflow.com/q/23226320
tags question: http://stackoverflow.com/q/23177807
tags question: http://stackoverflow.com/q/23177932
tags question: http://stackoverflow.com/q/23229853
type: Tag
tags question: http://stackoverflow.com/q/23220943
tags question: http://stackoverflow.com/q/23271171
tags question: http://stackoverflow.com/q/23258601
tags question: http://stackoverflow.com/q/23249804
tags question: http://stackoverflow.com/q/23234134
tags question: http://stackoverflow.com/q/23153772
tags question: http://stackoverflow.com/q/23241473
tags question: http://stackoverflow.com/q/23175408
tags question: http://stackoverflow.com/q/23227027
tags question: http://stackoverflow.com/q/23177175
tags question: http://stackoverflow.com/q/23158604
tags question: http://stackoverflow.com/q/23156874
tags question: http://stackoverflow.com/q/23179053
tags question: http://stackoverflow.com/q/23273989
tags question: http://stackoverflow.com/q/23257590
tags question: http://stackoverflow.com/q/23189685
tags question: http://stackoverflow.com/q/23282133
tags question: http://stackoverflow.com/q/23253589
tags question: http://stackoverflow.com/q/23258988
tag name: jpanel
tags question: http://stackoverflow.com/q/23234780
tags question: http://stackoverflow.com/q/23234143
tags question: http://stackoverflow.com/q/23208564
tags question: http://stackoverflow.com/q/23130145
tags question: http://stackoverflow.com/q/23287329
tags question: http://stackoverflow.com/q/23204679

http://stackoverflow.com/q/23146323
accepted answer: http://stackoverflow.com/a/23146668
tagged with: java
has body: I just started learning and implementing builder patterns from Wiki. And also CH2 of Effective Java. This pertains to JSP servlets, this might be a little convoluted, but I just wanted to pass this by you guys to see how to do this correctly. Lets start with a scenario, where you can't build the object completely there are certain information that is not given. So most likely you have to put the object in session and then add variables to the session object later. How would I accomplish this with Build pattern? Here is a code example public class Widget(){ public static class Builder(){ public Builder(String id) {...} public Builder serialNumber (String val) {...} public Builder area (String val) {...} public Widget build() { return new Widget(this); } } private Widget(Builder builder){...} } JSP Servlet 1 // only have ID information Widget w = new Widget().Builder(id).build(); HttpSession session = request.getSession(); session.setAttribute("widget", w); JSP Servlet 2 // Now I have serial and area Widget.Builder w = (Widget.Builder) session.getAttribute("widget"); //** This is as far as I go ** w.serialNumber("something") // Now this works .area("sideArea") // .build() // &lt; I know if I do this I will be creating another Object. Is there a way to use build pattern without creating redundant obj? Thank you all...
type: Question
tagged with: session
tagged with: servlets
score: 0
linked to: http://stackoverflow.com/q/328496
answer count: 1
tagged with: jsp
has answer: http://stackoverflow.com/a/23146668
has title: Java Builder Pattern pass to session JSP servlet
has comment: http://stackoverflow.com/comment/35812516
has comment: http://stackoverflow.com/comment/35494702
type: AnsweredQuestion

http://stackoverflow.com/comment/98009390
type: AnswerComment
has text: hey @Paul Jowett, i build some code following your blog about converting doc to pdf , but i got a question, i was wondering if you can take a look to https://stackoverflow.com/questions/55621825 , i will appreciate
type: Comment
comment on: http://stackoverflow.com/a/55332391
score: 0

http://stackoverflow.com/a/23258654
answers question: http://stackoverflow.com/q/23258526
score: 0
type: AcceptedAnswer
type: Answer
has body: Your loops are a little confusing, basically, you want to loop for the number of lines and the loop for the number columns (which is the current line number)... int line = 0; while (line &lt; maxLines) { int col = 0; while (col &lt; line) { //... col++; } line++; } You're also no resetting the x_coord back to it's initial position, meaning that each new line will start at the end of the last line...just below it. You should also: Override paintComponent instead of paint. Take a look at Performing Custom Painting for more details Override getPreferredSize instead of using setSize. It will work better with the layout managers Make use of the FontMetrics in order to determine how many pixels you need to adjust for each line/column. Take a look at Measuring Text for more details
has comment: http://stackoverflow.com/comment/35593642
accepted answer of: http://stackoverflow.com/q/23258526

http://stackoverflow.com/a/58166027
upvote count: 1
downvote count: 0
type: Answer
has body: Proxy Hive Job Submission via the REST API allows users to submit jobs without creating a workflow XML on HDFS: https://oozie.apache.org/docs/5.1.0/WebServicesAPI.html#Proxy_Hive_Job_Submission You can also use FluentAPI to programatically build workflows: https://oozie.apache.org/docs/5.1.0/DG_FluentJobAPI.html#A_More_Verbose_Example https://github.com/apache/oozie/blob/master/fluent-job/fluent-job-api/src/test/java/org/apache/oozie/fluentjob/api/action/TestHive2ActionBuilder.java As mentioned above, Oozie Coordinator can be used to schedule &amp; regularly execute workflows. Beyond time dependency, you can also define data dependencies (such as existence of specific files on HDFS) for starting a workflow.
score: 1
answers question: http://stackoverflow.com/q/23275414

fileoutputstream
tags question: http://stackoverflow.com/q/23274590
tags question: http://stackoverflow.com/q/23174843
type: Tag
tags question: http://stackoverflow.com/q/23161934
tag name: fileoutputstream
tags question: http://stackoverflow.com/q/23207691
tags question: http://stackoverflow.com/q/23183348
tags question: http://stackoverflow.com/q/23215188
tags question: http://stackoverflow.com/q/23269297

http://stackoverflow.com/q/23244060
has answer: http://stackoverflow.com/a/23244478
has comment: http://stackoverflow.com/comment/35565546
has comment: http://stackoverflow.com/comment/35565705
score: 0
accepted answer: http://stackoverflow.com/a/23244478
tagged with: generics
has title: Generic list in java to hold any objects
has comment: http://stackoverflow.com/comment/35565269
type: AnsweredQuestion
tagged with: list
possible better answer: http://stackoverflow.com/a/23244472
tagged with: java
has answer: http://stackoverflow.com/a/23244472
has body: I am new to Java. I want to make an array List which will be able to hold any objects. I am wondering how to achie this. I am trying to use Class, but I am not sure how do I get the object from that. Here is what I am tring to do &lt;T&gt; List&lt;T&gt; ConvertToList(&lt;Map &lt;String, List&lt;Long&gt;&gt;map, Class&lt;T&gt; clazz) { //I want to extract all values from the map and store into an object as refered //by clazz and put that into list. ... ... List&lt;T&gt; list = new ArrayList&lt;T&gt;(); } Is it possible and if yes how to do that?
has comment: http://stackoverflow.com/comment/35569338
type: Question
has comment: http://stackoverflow.com/comment/35565181
answer count: 2

http://stackoverflow.com/a/23197565
downvote count: 0
has body: I think you are inflating fragments inside other fragments. Instead of getSupportFragmentManager().beginTransaction() .add(R.id.container, new TheMapFrag()).commit(); use getSupportFragmentManager().beginTransaction() .replace(R.id.container, new TheMapFrag()).commit(); For difference between Add and Replace refer this
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/35481810
upvote count: 1
answers question: http://stackoverflow.com/q/23197283

android
tags question: http://stackoverflow.com/q/23143593
tags question: http://stackoverflow.com/q/23180028
tags question: http://stackoverflow.com/q/23135063
tags question: http://stackoverflow.com/q/23155794
tags question: http://stackoverflow.com/q/23151348
tags question: http://stackoverflow.com/q/23199764
tags question: http://stackoverflow.com/q/23186035
tags question: http://stackoverflow.com/q/23227143
tags question: http://stackoverflow.com/q/23190505
tags question: http://stackoverflow.com/q/23241106
tags question: http://stackoverflow.com/q/23253235
tags question: http://stackoverflow.com/q/23197793
tags question: http://stackoverflow.com/q/23217511
tags question: http://stackoverflow.com/q/23277646
tags question: http://stackoverflow.com/q/23178691
tags question: http://stackoverflow.com/q/23176122
tags question: http://stackoverflow.com/q/23195880
tags question: http://stackoverflow.com/q/23153622
tags question: http://stackoverflow.com/q/23196045
tags question: http://stackoverflow.com/q/23245670
tags question: http://stackoverflow.com/q/23200878
tags question: http://stackoverflow.com/q/23250400
tags question: http://stackoverflow.com/q/23194693
tags question: http://stackoverflow.com/q/23245051
tags question: http://stackoverflow.com/q/23197892
tags question: http://stackoverflow.com/q/23241104
tags question: http://stackoverflow.com/q/23218907
tags question: http://stackoverflow.com/q/23267915
tags question: http://stackoverflow.com/q/23189166
tags question: http://stackoverflow.com/q/23129893
tags question: http://stackoverflow.com/q/23176324
tags question: http://stackoverflow.com/q/23253164
tags question: http://stackoverflow.com/q/23262938
tags question: http://stackoverflow.com/q/23168742
tags question: http://stackoverflow.com/q/23260208
tags question: http://stackoverflow.com/q/23260421
tags question: http://stackoverflow.com/q/23221441
tags question: http://stackoverflow.com/q/23184851
tags question: http://stackoverflow.com/q/23229974
tags question: http://stackoverflow.com/q/23282629
tags question: http://stackoverflow.com/q/23218322
tags question: http://stackoverflow.com/q/23228417
tags question: http://stackoverflow.com/q/23284943
tags question: http://stackoverflow.com/q/23217313
tags question: http://stackoverflow.com/q/23265696
tags question: http://stackoverflow.com/q/23166104
tags question: http://stackoverflow.com/q/23214919
tags question: http://stackoverflow.com/q/23186192
tags question: http://stackoverflow.com/q/23250919
tags question: http://stackoverflow.com/q/23279599
tags question: http://stackoverflow.com/q/23186553
tags question: http://stackoverflow.com/q/23211625
tags question: http://stackoverflow.com/q/23192126
tags question: http://stackoverflow.com/q/23246363
tags question: http://stackoverflow.com/q/23227449
tags question: http://stackoverflow.com/q/23139313
tags question: http://stackoverflow.com/q/23207339
tags question: http://stackoverflow.com/q/23221005
tags question: http://stackoverflow.com/q/23174403
tags question: http://stackoverflow.com/q/23184923
tags question: http://stackoverflow.com/q/23265752
tags question: http://stackoverflow.com/q/23265807
tags question: http://stackoverflow.com/q/23230939
tags question: http://stackoverflow.com/q/23172484
tags question: http://stackoverflow.com/q/23154024
tags question: http://stackoverflow.com/q/23148928
tags question: http://stackoverflow.com/q/23196008
tags question: http://stackoverflow.com/q/23245137
tags question: http://stackoverflow.com/q/23170610
tags question: http://stackoverflow.com/q/23239036
tags question: http://stackoverflow.com/q/23271590
tags question: http://stackoverflow.com/q/23195697
tags question: http://stackoverflow.com/q/23138276
tags question: http://stackoverflow.com/q/23201663
tags question: http://stackoverflow.com/q/23144062
tags question: http://stackoverflow.com/q/23220502
tags question: http://stackoverflow.com/q/23232543
tags question: http://stackoverflow.com/q/23132134
tags question: http://stackoverflow.com/q/23256311
tags question: http://stackoverflow.com/q/23162535

http://stackoverflow.com/comment/35598526
has text: The solution does not work which could be tested faster than posting a non-working answer. That’s the reason for the downvote.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23261777
type: AnswerComment

http://stackoverflow.com/a/23227113
has comment: http://stackoverflow.com/comment/35535493
score: 0
has comment: http://stackoverflow.com/comment/35556919
has body: If you choose procedural approach, right way to do things will be that: public class BinaryTree { private Node root = null; private static class Node { private Integer key; private String value; private Node left = null; private Node right = null; public Node(Integer key, String value) { this.key = key; this.value = value; } } public boolean insert(Integer key, String value) { if (root == null) { root = new Node(key, value); return true; } else { return insert(root, key, value); } } private boolean insert(Node node, Integer key, String value) { if (key.equals(node.key)) { // duplicate return false; } else if (key &lt; node.key) { if (node.left == null) { node.left = new Node(key, value); return true; } else { return insert(node.left, key, value); } } else if (key &gt; node.key) { if (node.right == null) { node.right = new Node(key, value); return true; } else { return insert(node.right, key, value); } } return false; } } Now compare it to OOP approach and choose, which one you like more: public class BinaryTree { private Node root = null; private static class Node { private Integer key; private String value; private Node left = null; private Node right = null; public Node(Integer key, String value) { this.key = key; this.value = value; } private boolean insert(Integer key, String value) { if (key.equals(this.key)) { // duplicate return false; } else if (key &lt; this.key) { if (left == null) { left = new Node(key, value); return true; } else { return left.insert(key, value); } } else if (key &gt; this.key) { if (right == null) { right = new Node(key, value); return true; } else { return right.insert(key, value); } } return false; } } public boolean insert(Integer key, String value) { if (root == null) { root = new Node(key, value); return true; } else { return root.insert(key, value); } } } Solution is simple. For insert operation: If there is no root in the tree yet, create one. Otherwise add a new value to the root node. Inserting a value to some node (starting fr…
type: Answer
has comment: http://stackoverflow.com/comment/35560400
answers question: http://stackoverflow.com/q/23226365
has comment: http://stackoverflow.com/comment/35557052

http://stackoverflow.com/comment/35517615
has text: solved!! i forgot to use close buffered output stream
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23213191

http://stackoverflow.com/comment/35443731
score: 0
has text: Yea I know, but I'm trying everything now. Configuration static, everything else not, and it isn't accessible.
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/23175078

http://stackoverflow.com/comment/35604261
score: 0
comment on: http://stackoverflow.com/a/23264865
has text: Sorry I don't get this part: _to get the max repeated occurrence subtract list from map size_.
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/35457110
has text: yep，I just thought of, If we deploy hbase and hadoop on the same cluster，We can use hbase as the"memory" shared by all nodes's task.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23172682

http://stackoverflow.com/comment/35457267
type: Comment
score: 0
comment on: http://stackoverflow.com/q/23183556
has text: @BackSlash I do not ask anyone to recommend or find a tool for me, I just ask about performance considerations
type: QuestionComment

oracle11g
tags question: http://stackoverflow.com/q/23165622
tags question: http://stackoverflow.com/q/23270529
type: Tag
tags question: http://stackoverflow.com/q/23203652
tag name: oracle11g

http://stackoverflow.com/a/23215391
type: Answer
has body: Instead of simple listview in navigation drawer u'll have to use expandable list view . you can follow this tutorials to get basic idea http://www.tutecentral.com/android-custom-navigation-drawer/
score: 0
answers question: http://stackoverflow.com/q/23214042

http://stackoverflow.com/a/23187819
answers question: http://stackoverflow.com/q/23187679
downvote count: 0
type: Answer
score: 3
has body: There are three problem in your code. Firstly you get an ArrayIndexOutOfBoundsException because here: B[i][j] = B[j][i]; you are trying to access non existing index in your array B. Size of B should be declared as int B[][] = new int[m[0].length][m.length];as you want B matrix to be a transpose of m. Secondly, you don't use the m array when you calculating B array. I also don't see why you use a temporary variable int temp, that should do what you need: B[j][i] = m[i][j]; The third problem is that you here: System.out.println(Transpose2D(m)); you are trying to print array as it is. That will not work. Try this: System.out.println(Arrays.deepToString(Transpose2D(m)))
upvote count: 3

http://stackoverflow.com/a/23273535
upvote count: 1
downvote count: 0
has body: Your error say that this.progress is null in your call bar.updateBar(5);. So that could be either because you don't launch startGui() function before or that graphics.addBar(0); return a null value.
type: Answer
answers question: http://stackoverflow.com/q/23273313
score: 1

http://stackoverflow.com/q/23165449
has title: Java: The constructor gerbil(int) is undefined
type: Question
has comment: http://stackoverflow.com/comment/35426188
answer count: 1
has comment: http://stackoverflow.com/comment/35466899
has comment: http://stackoverflow.com/comment/35426205
tagged with: constructor
score: 0
has answer: http://stackoverflow.com/a/23165458
has body: So I've read over all of the constructor undefined posts on stackoverflow and tried the solutions and they haven't worked for me. Maybe I'm trying it wrong. I keep getting "the constructor Gerbil(int) is undefined." The code that's the problem: GerbilArray[i] = new Gerbil(i); My full code: import java.util.Scanner; public class Gerbil { public String name; public String id; public String bite; public String escape; public Gerbil() { this.name = ""; this.id = ""; this.bite = ""; this.escape = ""; } public static void main(String[] args) { Scanner keyboard = new Scanner(System.in); System.out.println("How many foods?"); int totalFood = keyboard.nextInt(); System.out.println("How many gerbils in the lab?"); int numberOfGerbils = keyboard.nextInt(); Gerbil[] GerbilArray = new Gerbil[numberOfGerbils]; for(int i = 0; i &lt;= numberOfGerbils; i++){ GerbilArray[i] = new Gerbil(i); System.out.print("Lab ID:"); String id = keyboard.next(); System.out.print("Gerbil Nickname:"); String name = keyboard.next(); System.out.print("Bite?"); String bite = keyboard.next(); System.out.print("Escapes?"); String city = keyboard.nextLine(); for (int j = 0; j &lt; totalFood; j++) { System.out.println("How many of food " + (j+1) + "do you eat?:"); } } } } Also you've probably seen that my nested for-loop isn't finished as well. I'm trying to make an array inside of an object that will store "x" amount of integers inside of my object listed from the user (int totalFood) but I have no idea how.
type: AnsweredQuestion
tagged with: object
accepted answer: http://stackoverflow.com/a/23165458
tagged with: java

http://stackoverflow.com/q/23176290
has comment: http://stackoverflow.com/comment/35445210
has comment: http://stackoverflow.com/comment/35445234
has comment: http://stackoverflow.com/comment/35445506
type: Question
has comment: http://stackoverflow.com/comment/35445409
answer count: 1
has body: there is a code of my jsp: <%if (session.getAttribute("login") == null) {%> Username: Password: Remember me Not a member? Register | Lost your password? Fermer panneau <% } else {%> Déconnexion Bonjour: <%= session.getAttribute("login")%> <%}%> and there is my servlet: @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String login = request.getParameter("login") HttpSession session = request.getSession(); session.setAttribute("login", login); System.out.println(session.getAttribute("login")); getServletConfig().getServletContext().getRequestDispatcher("/recommandation.jsp").forward(request, response); } when i click on login butto, i have an error. INFO: appachito ATTENTION: ApplicationDispatcher[/RecommandationDefault] PWC1231: Servlet.service() for servlet jsp threw exception java.lang.NullPointerException at org.apache.jsp.recommandation_jsp._jspService(recommandation_jsp.java from :300) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:109) at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:406) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:483) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:373) at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1523) at org.apache.catalina.core.ApplicationDispatcher.doInvoke(ApplicationDispatcher.java:822) at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:684) at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:517) at org.apache.catalina.core.ApplicationDispatcher.doDispatch(ApplicationDispatcher.java:488) at org.apache.catalina.core.ApplicationDispatcher.dispatch(ApplicationDispatcher.java:379) at org.apache.catalina.core.ApplicationDispatcher.…
tagged with: java
score: 0
tagged with: authentication
has comment: http://stackoverflow.com/comment/35445382
has title: HTTP Status 500: org.apache.jasper.JasperException: java.lang.NullPointerException
has comment: http://stackoverflow.com/comment/35445125
has comment: http://stackoverflow.com/comment/35445256
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35445279
has answer: http://stackoverflow.com/a/23176478
tagged with: servlets
has comment: http://stackoverflow.com/comment/35445377
tagged with: nullpointerexception
has comment: http://stackoverflow.com/comment/35445430
tagged with: jsp

http://stackoverflow.com/a/23207690
has comment: http://stackoverflow.com/comment/35501017
has comment: http://stackoverflow.com/comment/35500796
has body: This is regex. A hyphen has a special meaning inside a character class. You need to place the hyphen as the first or last item in the class: [-.,:\n]
has comment: http://stackoverflow.com/comment/35508530
downvote count: 0
has comment: http://stackoverflow.com/comment/35500819
has comment: http://stackoverflow.com/comment/35500787
type: Answer
answers question: http://stackoverflow.com/q/23207667
score: 3
upvote count: 3

http://stackoverflow.com/comment/35638536
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23283303
has text: @NathanMerrill, Perhaps you could combine such an approach with decompilation to see whether the logic matched or not, but I do not think you would be able to automate that part.
type: AnswerComment

http://stackoverflow.com/comment/35443836
score: 1
comment on: http://stackoverflow.com/a/23164016
type: AnswerComment
type: Comment
has text: @melkir You should always be able to select preferred answer. Upvote may require reputation, but that thing is available for everybody.

http://stackoverflow.com/comment/39573101
type: Comment
type: QuestionComment
has text: See this at the bottom of your eclipse http://prntscr.com/4e90ox In the screenshot given, the max heap space allocated is 211M and 118M has been used. I made changes to eclipse.ini file which looks like this http://prntscr.com/4e92de
score: 1
comment on: http://stackoverflow.com/q/23196381

http://stackoverflow.com/q/23167006
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/35429061
has title: Getting data in fragment
possible better answer: http://stackoverflow.com/a/23167070
accepted answer: http://stackoverflow.com/a/23167088
tagged with: android
has answer: http://stackoverflow.com/a/23167070
type: AnsweredQuestion
tagged with: java
type: Question
has body: I have two classes: MoviiesPageActivity (extends FragmentActivity) and MoviesPageTab1 (extends Fragment). I need to send data from one to another. How can I get the data in the second sent from the first? MoviesPageActivity public class MoviesPageActivity extends FragmentActivity implements ActionBar.TabListener { private ViewPager viewPager; private TabsPagerAdapter mAdapter; private ActionBar actionBar; // Tab titles private String[] tabs = { "About movie", "Ratings", "Crew" }; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.movies_page); // Initilization viewPager = (ViewPager) findViewById(R.id.pager); actionBar = getActionBar(); mAdapter = new TabsPagerAdapter(getSupportFragmentManager()); viewPager.setAdapter(mAdapter); actionBar.setHomeButtonEnabled(false); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); // Getting contents Intent intentGet = getIntent(); String id = intentGet.getStringExtra("id"); MovieStruct info = new MovieStruct(); info = getArrInfo(id); // Adding contents // For example, how send string id? // Adding Tabs for (String tab_name : tabs) { actionBar.addTab(actionBar.newTab().setText(tab_name).setTabListener(this)); } //on swiping the viewpager make respective tab selected viewPager.setOnPageChangeListener(new ViewPager.OnPageChangeListener() { @Override public void onPageSelected(int position) { // on changing the page // make respected tab selected actionBar.setSelectedNavigationItem(position); } @Override public void onPageScrolled(int arg0, float arg1, int arg2) { //nothing } @Override public void onPageScrollStateChanged(int arg0) { //nothing } }); } } MoviesPageTab1 public class MoviesPageTab1 extends Fragment { @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.tab_1, container, false); // How can I get string id here? return rootView; } }
tagged with: android-fragments
linked to: http://stackoverflow.com/q/22504210
has answer: http://stackoverflow.com/a/23167088

http://stackoverflow.com/q/23149512
downvote count: 0
tagged with: java
tagged with: jtextpane
tagged with: swing
type: Question
has title: How to disable WordWrap in Java JTextPane?
accepted answer: http://stackoverflow.com/a/23149584
answer count: 2
score: 5
has comment: http://stackoverflow.com/comment/35410109
favorite count: 0
has answer: http://stackoverflow.com/a/23149584
upvote count: 5
possible better answer: http://stackoverflow.com/a/38294531
has body: My program has a problem.. It is WordWrap is abled... Exactly, I want to use linwrap but i don't want wordwrap... I searched this JTextPane textPane = new JTextPane(); JPanel noWrapPanel = new JPanel( new BorderLayout() ); noWrapPanel.add( textPane ); JScrollPane scrollPane = new JScrollPane( noWrapPanel ); When i use this code, Both linewrap and wordwrap are disabled.... I want to make use linewrap.... sorry my terrible English skill... I believe you can get what i mean please help me...
has answer: http://stackoverflow.com/a/38294531
tagged with: word-wrap
type: AnsweredQuestion

http://stackoverflow.com/comment/35648870
type: QuestionComment
has text: Check your libraries. It might be that you have tried adding/removing JPA, JSF or something like that.
score: 0
comment on: http://stackoverflow.com/q/23288991
type: Comment

http://stackoverflow.com/q/23151503
score: 0
has answer: http://stackoverflow.com/a/23152760
type: AnsweredQuestion
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/23152760
has title: Unzip a zipped folder with sub folder structure into a single folder
has body: I want to unzip a zipped folder which is having subfolder structure into a single file and not in the same subfolder form. I have below code which creates the subfolder structure of zip and copies the file. But I need to copy all the files in a single folder. Is it possible. Below is the code:- public class UnZip { List fileList; private static final String INPUT_ZIP_FILE = "C:\MyFile.zip"; private static final String OUTPUT_FOLDER = "C:\outputzip"; public static void main( String[] args ) { UnZip unZip = new UnZip(); unZip.unZipIt(INPUT_ZIP_FILE,OUTPUT_FOLDER); } /** * Unzip it * @param zipFile input zip file * @param output zip file output folder */ public void unZipIt(String zipFile, String outputFolder){ byte[] buffer = new byte[1024]; try{ //create output directory is not exists File folder = new File(OUTPUT_FOLDER); if(!folder.exists()){ folder.mkdir(); } //get the zip file content ZipInputStream zis = new ZipInputStream(new FileInputStream(zipFile)); //get the zipped file list entry ZipEntry ze = zis.getNextEntry(); while(ze!=null){ String fileName = ze.getName(); File newFile = new File(outputFolder + File.separator + fileName); System.out.println("file unzip : "+ newFile.getAbsoluteFile()); //create all non exists folders //else you will hit FileNotFoundException for compressed folder new File(newFile.getParent()).mkdirs(); FileOutputStream fos = new FileOutputStream(newFile); int len; while ((len = zis.read(buffer)) &gt; 0) { fos.write(buffer, 0, len); } fos.close(); ze = zis.getNextEntry(); } zis.closeEntry(); zis.close(); System.out.println("Done"); }catch(IOException ex){ ex.printStackTrace(); } } } Thanks in advance !!
tagged with: unzip
answer count: 1

http://stackoverflow.com/comment/140138039
score: 0
type: QuestionComment
has text: Tip: [`DATE`](https://www.postgresql.org/docs/current/datatype-datetime.html) type in Postgres, and in standard SOL. In JDBC 4.2+, maps to [`java.time.LocalDate`](https://docs.oracle.com/en/java/javase/23/docs/api/java.base/java/time/LocalDate.html).
type: Comment
comment on: http://stackoverflow.com/q/23224751

http://stackoverflow.com/comment/35430237
type: QuestionComment
has text: post `onStop()` method
score: 0
comment on: http://stackoverflow.com/q/23167647
type: Comment

http://stackoverflow.com/a/23229021
score: 0
type: Answer
has body: Try redirecting the error stream on the process by using a ProcessBuilder. In all likelyhood the command is writing out to STDErr. You could also get that stream by using Process.getErrorStream().
answers question: http://stackoverflow.com/q/23228593

http://stackoverflow.com/q/23246146
type: Question
has answer: http://stackoverflow.com/a/23246359
score: 0
has answer: http://stackoverflow.com/a/23246240
has body: I am working in singleton design pattern. I am using one static variable as member variable for my class. According to my code It is creating more than one instance even though i am I made singleton class. Please help me Is it correct way to do things? //This is my code public class MySingleton { public static MySingleton instance = null;// new MySingleton(); static int count; private MySingleton() { count++; } public static MySingleton getInstance() { if (instance == null) { synchronized (MySingleton.class) { instance = new MySingleton(); } } return instance; } /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub MySingleton news = new MySingleton().getInstance(); System.out.println(news.count); MySingleton news1 = new MySingleton().getInstance(); System.out.println(news1.count); MySingleton news2 = new MySingleton().getInstance(); System.out.println(news2.count); } }
answer count: 7
has answer: http://stackoverflow.com/a/23246206
has title: Singleton rule is not working with static member variables
type: UnansweredQuestion
tagged with: singleton
has answer: http://stackoverflow.com/a/23246406
tagged with: design-patterns
linked to: http://stackoverflow.com/q/70689
has answer: http://stackoverflow.com/a/23923118
tagged with: java
has answer: http://stackoverflow.com/a/23246387
has answer: http://stackoverflow.com/a/23246324
has comment: http://stackoverflow.com/comment/35570844

http://stackoverflow.com/comment/35651735
type: AnswerComment
comment on: http://stackoverflow.com/a/23266414
score: 0
has text: I have my class annotated with `@Component("componentA")` and I want to let customers to create a custom implementation annotated with `@Component("componentA-custom")` that should be picked up during the auto-wiring process. So basically I need to customize the way the class is found by name to look first by a different name and if not found - use the default mechanism.
type: Comment

http://stackoverflow.com/a/23221613
answers question: http://stackoverflow.com/q/23221440
has body: Or, just use the instance public enum BusinessUnit { ONE( BUSINESS_UNIT.ONE ), TWO( BUSINESS_UNIT.TWO ); private final BUSINESS_UNIT unit; BusinessUnit(BUSINESS_UNIT unit) { this.unit = unit; } public BUSINESS_UNIT getUnit() { return unit; } } public enum BUSINESS_UNIT { ONE, TWO, } and to get it: BusinessUnit.(ONE/TWO).getUnit() will return BUSINESS_UNIT ONE/TWO I'm dont want to create any methods to convert, I want to know if: Its possible And what version of SDK its possible No. BusinessUnit is an enum and BUSINESS_UNIT is another enum. They don't have anything in common and you cannot pass from one to another without use a method.
downvote count: 0
type: Answer
score: 2
upvote count: 2

android-layout
tags question: http://stackoverflow.com/q/23226430
tag name: android-layout
tags question: http://stackoverflow.com/q/23144300
tags question: http://stackoverflow.com/q/23177888
tags question: http://stackoverflow.com/q/23176122
tags question: http://stackoverflow.com/q/23265752
tags question: http://stackoverflow.com/q/23142471
type: Tag
tags question: http://stackoverflow.com/q/23166484
tags question: http://stackoverflow.com/q/23271548
tags question: http://stackoverflow.com/q/23234062
tags question: http://stackoverflow.com/q/23213968
tags question: http://stackoverflow.com/q/23180565
tags question: http://stackoverflow.com/q/23189024
tags question: http://stackoverflow.com/q/23222931
tags question: http://stackoverflow.com/q/23163258
tags question: http://stackoverflow.com/q/23187772

http://stackoverflow.com/q/23208002
tagged with: null
has answer: http://stackoverflow.com/a/23208033
possible better answer: http://stackoverflow.com/a/23208023
has answer: http://stackoverflow.com/a/23208023
has answer: http://stackoverflow.com/a/23208040
score: 0
type: Question
type: AnsweredQuestion
tagged with: java
has title: Return keywords for a boolean statement
has comment: http://stackoverflow.com/comment/35501342
has body: I am writing an incredibly primitive blackjack game for a high school programming class and I am playing with writing a boolean as such: public boolean DealerTracker() { if(a==11 || a==12|| a==13) { a = 10; } dealerHandValue = a + dealerHandValue; if(dealerHandValue&gt;21) { DealerHand.setText("The House went bust!! Everybody wins!!"); return true; } else if(dealerHandValue&lt;21) { return null; } else if(dealerHandValue==21) { return false; } } I keep getting an error saying that return null (I couldn't manage to get the fancy blockquote to work) is invalid. However, for this boolean to work I really need three return statements. So my question is this: Is there a way to make null work, or is there something I can put in its place that is still usuable, or am I just being stupid here. Please note that I do not really need this boolean, so if you think that there is no solution, just advise deletion of the boolean.
has comment: http://stackoverflow.com/comment/35501330
tagged with: boolean
accepted answer: http://stackoverflow.com/a/23208040
answer count: 3

http://stackoverflow.com/a/23234543
answers question: http://stackoverflow.com/q/23234480
type: Answer
has body: Declare the List&lt; Student &gt; studentList = new ArrayList&lt; Student &gt;(); outside the readStudent() Method, then if you call readStudent() method once it will get initialize and you can use it everywhere in ReadStudent class.
score: 0

http://stackoverflow.com/comment/35470936
comment on: http://stackoverflow.com/q/23190424
score: 0
type: Comment
type: QuestionComment
has text: Can you find your river jar in elasticsearch plugin folder???

http://stackoverflow.com/a/23254387
has body: From JavaMail API docs public void setDebug(boolean debug) Set the debug setting for this Session. Since the debug setting can be turned on only after the Session has been created, to turn on debugging in the Session constructor, set the property mail.debug in the Properties object passed in to the constructor to true. The value of the mail.debug property is used to initialize the per-Session debugging flag. Subsequent calls to the setDebug method manipulate the per-Session debugging flag and have no affect on the mail.debug property. Parameters: debug - Debug setting
accepted answer of: http://stackoverflow.com/q/23252140
score: 1
answers question: http://stackoverflow.com/q/23252140
has comment: http://stackoverflow.com/comment/35585345
upvote count: 1
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/comment/35444342
comment on: http://stackoverflow.com/q/23174843
has text: Got it, updated answer to successfully read `fileB` and prepend it to `fileA`.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35597593
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23261643
has text: So about saving the game state. how do i use this JSON or XML?
type: Comment

achartengine
tags question: http://stackoverflow.com/q/23284113
tags question: http://stackoverflow.com/q/23200456
tags question: http://stackoverflow.com/q/23253795
tag name: achartengine
type: Tag

http://stackoverflow.com/comment/35460238
type: QuestionComment
comment on: http://stackoverflow.com/q/23185086
has text: Did you bundle that jar in your deployment?
score: 0
type: Comment

http://stackoverflow.com/a/23253254
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23243153
has body: I found a solution myself and document it on my website. In short, this code works for me: public void moveToVisible(JFrame frame) { // Vertical position GraphicsDevice activeScreen = getGraphicsConfiguration().getDevice(); if (frame.getLocation().y &lt; 0) { frame.setLocation(getLocation().x, 0); } if ((frame.getLocation().y + frame.getHeight()) &gt; activeScreen.getDisplayMode().getHeight()) { frame.setLocation( frame.getLocation().x, (activeScreen.getDisplayMode().getHeight() - frame.getHeight()) ); } // Horizontal position int offsetRight = frame.getX() + frame.getWidth() - frame.getGraphicsConfiguration().getBounds().x + frame.getGraphicsConfiguration().getBounds().width; if (offsetRight &gt; 0) { setLocation(frame.getX() - offsetRight, frame.getY()); } int offsetLeft = frame.getX() - frame.getGraphicsConfiguration().getBounds().x; if (offsetLeft &lt; 0) { frame.setLocation(frame.getX() - offsetLeft, frame.getY()); } } If someone knows a more easier solution let me know :)
answers question: http://stackoverflow.com/q/23243153
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/136037967
score: 1

http://stackoverflow.com/comment/35647932
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/23288442
type: Comment
has text: Noob, it was my mistake while posting the question. I have been using `./import.io` . I will edit it in my question.

http://stackoverflow.com/comment/35529003
comment on: http://stackoverflow.com/q/23223756
type: Comment
type: QuestionComment
has text: @DesertIvy what i could understand is that he has a program in which he has made some changes but when he is running, the changes are not reflected. instead the old program runs. he has posted the relevent code. am i right @young?
score: 0

eclipse
tags question: http://stackoverflow.com/q/23242915
tags question: http://stackoverflow.com/q/23267099
tags question: http://stackoverflow.com/q/23182875
tags question: http://stackoverflow.com/q/23270886
tag name: eclipse
tags question: http://stackoverflow.com/q/23245051
tags question: http://stackoverflow.com/q/23151727
tags question: http://stackoverflow.com/q/23283704
tags question: http://stackoverflow.com/q/23143318
tags question: http://stackoverflow.com/q/23179675
tags question: http://stackoverflow.com/q/23224623
tags question: http://stackoverflow.com/q/23228417
tags question: http://stackoverflow.com/q/23130898
tags question: http://stackoverflow.com/q/23246363
tags question: http://stackoverflow.com/q/23243188
tags question: http://stackoverflow.com/q/23164857
tags question: http://stackoverflow.com/q/23249002
tags question: http://stackoverflow.com/q/23275928
tags question: http://stackoverflow.com/q/23141655
tags question: http://stackoverflow.com/q/23184559
tags question: http://stackoverflow.com/q/23272405
tags question: http://stackoverflow.com/q/23217355
tags question: http://stackoverflow.com/q/23249011
tags question: http://stackoverflow.com/q/23144090
tags question: http://stackoverflow.com/q/23143129
tags question: http://stackoverflow.com/q/23250358
tags question: http://stackoverflow.com/q/23268298
tags question: http://stackoverflow.com/q/23279478
tags question: http://stackoverflow.com/q/23166986
tags question: http://stackoverflow.com/q/23278950
tags question: http://stackoverflow.com/q/23179256
tags question: http://stackoverflow.com/q/23135805
tags question: http://stackoverflow.com/q/23142464
tags question: http://stackoverflow.com/q/23159328
tags question: http://stackoverflow.com/q/23159295
tags question: http://stackoverflow.com/q/23195311
tags question: http://stackoverflow.com/q/23209125
tags question: http://stackoverflow.com/q/23260726
tags question: http://stackoverflow.com/q/23186561
tags question: http://stackoverflow.com/q/23277255
tags question: http://stackoverflow.com/q/23180071
tags question: http://stackoverflow.com/q/23144597
tags question: http://stackoverflow.com/q/23193534
tags question: http://stackoverflow.com/q/23142325
tags question: http://stackoverflow.com/q/23289399
tags question: http://stackoverflow.com/q/23178051
tags question: http://stackoverflow.com/q/23175522
tags question: http://stackoverflow.com/q/23170893
tags question: http://stackoverflow.com/q/23281460
tags question: http://stackoverflow.com/q/23180433
tags question: http://stackoverflow.com/q/23163695
tags question: http://stackoverflow.com/q/23270237
tags question: http://stackoverflow.com/q/23167362
tags question: http://stackoverflow.com/q/23251353
tags question: http://stackoverflow.com/q/23228647
tags question: http://stackoverflow.com/q/23263234
tags question: http://stackoverflow.com/q/23223756
tags question: http://stackoverflow.com/q/23143715
tags question: http://stackoverflow.com/q/23258753
tags question: http://stackoverflow.com/q/23241347
tags question: http://stackoverflow.com/q/23194821
tags question: http://stackoverflow.com/q/23271686
tags question: http://stackoverflow.com/q/23169910
tags question: http://stackoverflow.com/q/23185350
tags question: http://stackoverflow.com/q/23196541
tags question: http://stackoverflow.com/q/23204407
tags question: http://stackoverflow.com/q/23146052
tags question: http://stackoverflow.com/q/23223075
tags question: http://stackoverflow.com/q/23250508
tags question: http://stackoverflow.com/q/23240965
tags question: http://stackoverflow.com/q/23192842
tags question: http://stackoverflow.com/q/23163113
tags question: http://stackoverflow.com/q/23285831
tags question: http://stackoverflow.com/q/23164627
tags question: http://stackoverflow.com/q/23169559
tags question: http://stackoverflow.com/q/23158933
tags question: http://stackoverflow.com/q/23270817
tags question: http://stackoverflow.com/q/23221898
tags question: http://stackoverflow.com/q/23147190
tags question: http://stackoverflow.com/q/23273021

http://stackoverflow.com/a/23282146
has comment: http://stackoverflow.com/comment/35636642
has comment: http://stackoverflow.com/comment/35636440
score: 0
has body: you're most probably getting a NullPointerException because menuitem is null. make sure menuitem is initialized before you call this constructor.
type: Answer
answers question: http://stackoverflow.com/q/23281801

spring-mvc
tags question: http://stackoverflow.com/q/23175199
tags question: http://stackoverflow.com/q/23161197
tags question: http://stackoverflow.com/q/23212410
tags question: http://stackoverflow.com/q/23272020
tags question: http://stackoverflow.com/q/23201507
tags question: http://stackoverflow.com/q/23187514
tags question: http://stackoverflow.com/q/23135709
tags question: http://stackoverflow.com/q/23135890
tags question: http://stackoverflow.com/q/23195795
tags question: http://stackoverflow.com/q/23261587
tags question: http://stackoverflow.com/q/23162770
tags question: http://stackoverflow.com/q/23216546
tags question: http://stackoverflow.com/q/23255649
tags question: http://stackoverflow.com/q/23246912
tags question: http://stackoverflow.com/q/23132822
tags question: http://stackoverflow.com/q/23160829
tags question: http://stackoverflow.com/q/23204166
tags question: http://stackoverflow.com/q/23154020
tags question: http://stackoverflow.com/q/23143591
tags question: http://stackoverflow.com/q/23239653
tags question: http://stackoverflow.com/q/23238876
tags question: http://stackoverflow.com/q/23229684
tags question: http://stackoverflow.com/q/23262986
tags question: http://stackoverflow.com/q/23131173
tags question: http://stackoverflow.com/q/23287242
tags question: http://stackoverflow.com/q/23148003
tags question: http://stackoverflow.com/q/23222468
tags question: http://stackoverflow.com/q/23237388
tags question: http://stackoverflow.com/q/23146988
tags question: http://stackoverflow.com/q/23203215
tags question: http://stackoverflow.com/q/23282948
tags question: http://stackoverflow.com/q/23282602
tags question: http://stackoverflow.com/q/23290527
tags question: http://stackoverflow.com/q/23172940
tags question: http://stackoverflow.com/q/23211280
tags question: http://stackoverflow.com/q/23244471
tags question: http://stackoverflow.com/q/23153993
tags question: http://stackoverflow.com/q/23145961
tag name: spring-mvc
tags question: http://stackoverflow.com/q/23251895
tags question: http://stackoverflow.com/q/23204181
tags question: http://stackoverflow.com/q/23133901
tags question: http://stackoverflow.com/q/23131681
tags question: http://stackoverflow.com/q/23223775
tags question: http://stackoverflow.com/q/23234592
tags question: http://stackoverflow.com/q/23219149
tags question: http://stackoverflow.com/q/23210366
tags question: http://stackoverflow.com/q/23190459
tags question: http://stackoverflow.com/q/23289997
tags question: http://stackoverflow.com/q/23263812
tags question: http://stackoverflow.com/q/23289916
tags question: http://stackoverflow.com/q/23252551
tags question: http://stackoverflow.com/q/23166017
tags question: http://stackoverflow.com/q/23250025
tags question: http://stackoverflow.com/q/23230342
type: Tag
tags question: http://stackoverflow.com/q/23192255
tags question: http://stackoverflow.com/q/23211243
tags question: http://stackoverflow.com/q/23262168
tags question: http://stackoverflow.com/q/23202749
tags question: http://stackoverflow.com/q/23141205
tags question: http://stackoverflow.com/q/23209559
tags question: http://stackoverflow.com/q/23284292
tags question: http://stackoverflow.com/q/23185047
tags question: http://stackoverflow.com/q/23254675
tags question: http://stackoverflow.com/q/23253156
tags question: http://stackoverflow.com/q/23239776
tags question: http://stackoverflow.com/q/23187885
tags question: http://stackoverflow.com/q/23248270
tags question: http://stackoverflow.com/q/23244894
tags question: http://stackoverflow.com/q/23219728
tags question: http://stackoverflow.com/q/23154239
tags question: http://stackoverflow.com/q/23133942
tags question: http://stackoverflow.com/q/23222970
tags question: http://stackoverflow.com/q/23193982
tags question: http://stackoverflow.com/q/23136270
tags question: http://stackoverflow.com/q/23268112
tags question: http://stackoverflow.com/q/23270817
tags question: http://stackoverflow.com/q/23272807
tags question: http://stackoverflow.com/q/23168891

http://stackoverflow.com/comment/35516213
type: Comment
comment on: http://stackoverflow.com/a/23216722
score: 0
has text: I actually tried this just before I posted this question, and it did not work for me.
type: AnswerComment

http://stackoverflow.com/comment/35591519
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23258251
has text: *"I can find the world"*?

http://stackoverflow.com/comment/35457046
type: AnswerComment
type: Comment
has text: @mbs exactly, use sharedpreferences to maintain game state.
comment on: http://stackoverflow.com/a/23183466
score: 0

xinclude
tags question: http://stackoverflow.com/q/23200891
tag name: xinclude
type: Tag

jdbc
tags question: http://stackoverflow.com/q/23147836
tags question: http://stackoverflow.com/q/23207151
tags question: http://stackoverflow.com/q/23140461
tags question: http://stackoverflow.com/q/23140539
tags question: http://stackoverflow.com/q/23189366
tags question: http://stackoverflow.com/q/23271176
tags question: http://stackoverflow.com/q/23272500
tags question: http://stackoverflow.com/q/23202609
tags question: http://stackoverflow.com/q/23277002
tags question: http://stackoverflow.com/q/23141409
tags question: http://stackoverflow.com/q/23199662
tags question: http://stackoverflow.com/q/23178781
tags question: http://stackoverflow.com/q/23208154
tags question: http://stackoverflow.com/q/23174060
tags question: http://stackoverflow.com/q/23141655
tags question: http://stackoverflow.com/q/23232254
tags question: http://stackoverflow.com/q/23253212
tags question: http://stackoverflow.com/q/23179604
tags question: http://stackoverflow.com/q/23269075
tags question: http://stackoverflow.com/q/23185418
tags question: http://stackoverflow.com/q/23285873
tags question: http://stackoverflow.com/q/23281460
tags question: http://stackoverflow.com/q/23169552
tags question: http://stackoverflow.com/q/23168120
tags question: http://stackoverflow.com/q/23147579
tags question: http://stackoverflow.com/q/23210218
type: Tag
tags question: http://stackoverflow.com/q/23216279
tags question: http://stackoverflow.com/q/23153250
tags question: http://stackoverflow.com/q/23238809
tags question: http://stackoverflow.com/q/23260202
tags question: http://stackoverflow.com/q/23212654
tags question: http://stackoverflow.com/q/23255766
tags question: http://stackoverflow.com/q/23263139
tags question: http://stackoverflow.com/q/23274781
tags question: http://stackoverflow.com/q/23171675
tags question: http://stackoverflow.com/q/23173905
tags question: http://stackoverflow.com/q/23146419
tags question: http://stackoverflow.com/q/23195918
tags question: http://stackoverflow.com/q/23279478
tags question: http://stackoverflow.com/q/23193143
tags question: http://stackoverflow.com/q/23204201
tags question: http://stackoverflow.com/q/23272833
tags question: http://stackoverflow.com/q/23135384
tags question: http://stackoverflow.com/q/23219733
tags question: http://stackoverflow.com/q/23138630
tags question: http://stackoverflow.com/q/23176436
tags question: http://stackoverflow.com/q/23135451
tags question: http://stackoverflow.com/q/23170836
tags question: http://stackoverflow.com/q/23267586
tags question: http://stackoverflow.com/q/23165011
tags question: http://stackoverflow.com/q/23266614
tags question: http://stackoverflow.com/q/23134955
tags question: http://stackoverflow.com/q/23179187
tags question: http://stackoverflow.com/q/23211428
tags question: http://stackoverflow.com/q/23143460
tags question: http://stackoverflow.com/q/23172199
tags question: http://stackoverflow.com/q/23282026
tags question: http://stackoverflow.com/q/23198869
tags question: http://stackoverflow.com/q/23230148
tags question: http://stackoverflow.com/q/23197923
tags question: http://stackoverflow.com/q/23153521
tags question: http://stackoverflow.com/q/23236592
tags question: http://stackoverflow.com/q/23263180
tags question: http://stackoverflow.com/q/23252967
tags question: http://stackoverflow.com/q/23186371
tags question: http://stackoverflow.com/q/23222632
tags question: http://stackoverflow.com/q/23217151
tags question: http://stackoverflow.com/q/23192849
tags question: http://stackoverflow.com/q/23138189
tag name: jdbc
tags question: http://stackoverflow.com/q/23172484
tags question: http://stackoverflow.com/q/23189677
tags question: http://stackoverflow.com/q/23174278
tags question: http://stackoverflow.com/q/23276891
tags question: http://stackoverflow.com/q/23256839
tags question: http://stackoverflow.com/q/23267971
tags question: http://stackoverflow.com/q/23230582
tags question: http://stackoverflow.com/q/23143199
tags question: http://stackoverflow.com/q/23154116

http://stackoverflow.com/a/23168971
has comment: http://stackoverflow.com/comment/35492337
type: Answer
has body: change golferName == "\n" to golferName.equals("\n") for Strings
answers question: http://stackoverflow.com/q/23168057
has comment: http://stackoverflow.com/comment/35449694
score: 0

http://stackoverflow.com/q/23189490
answer count: 1
favorite count: 0
has body: Below is the code.\ I imagine you use a for loop and then another but I cannot seem to make it work. I attempted research however most topics were too complex since I am a novice. I'm trying to find a way to get the fifth character out of each string within the variable. I'll use the information given to me so i can then solve the rest of my program. I have more to do public static void main (String[]args) { String[] decoder = {"Nexa2f5", "Z52Bizlm" , "Diskapr" , "emkem9sD", "LaWYrUs", "dAStn78L", "mPTuriye", "aaeeiuUu", "IL8Ctmpn"}; int character = 4; for(int i=0; i&lt;=decoder.length-1; i++) { } } I am trying to get the third and fourth characters of the odd numbered Strings. I am trying to put the letters into an array and decode the message. I am also trying to print the 5th character of all other words. I'm having issues commenting right and I've tried to reply a couple times but no dice.
type: UnansweredQuestion
has title: I am trying to find the specific character within a String Array. What must I end up using?
upvote count: 0
downvote count: 2
type: Question
score: -2
tagged with: java
has answer: http://stackoverflow.com/a/23189538
tagged with: arrays

http://stackoverflow.com/a/23280097
answers question: http://stackoverflow.com/q/23280052
downvote count: 0
type: Answer
upvote count: 1
has body: In your for loop, you want for (int i = 1; i &lt; coins; i++) { not for (int i = 1; i &lt;= coins; i++) { &lt;= will include coins, which is length - 1 - the last argument.
score: 1
has comment: http://stackoverflow.com/comment/35632511

http://stackoverflow.com/comment/35573495
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23248539
has text: are you removing any element from the map inside your iteration loop ? that can cause concurrent modification exception

http://stackoverflow.com/comment/35551698
comment on: http://stackoverflow.com/a/23235755
type: AnswerComment
has text: @CodeCamper What is the server?
type: Comment
score: 0

http://stackoverflow.com/comment/35596668
has text: What's wrong with `\n` or `\t` in trying to reverse a string? (They get treated as single characters, so they won't end up as `n\` if that's your concern)
type: Comment
comment on: http://stackoverflow.com/q/23261182
score: 3
type: QuestionComment

http://stackoverflow.com/q/23141029
score: 1
tagged with: java
tagged with: thread-safety
accepted answer: http://stackoverflow.com/a/23141195
has answer: http://stackoverflow.com/a/23141434
answer count: 3
downvote count: 0
favorite count: 0
possible better answer: http://stackoverflow.com/a/23141434
has body: I'm going to share a Matrix class between multiple threads in Java. The Matrix class is: https://github.com/vkostyukov/la4j/blob/master/src/main/java/org/la4j/matrix/sparse/CRSMatrix.java and the only method i'm going to call is getting a row which is defined by the following code: @Override public Vector getRow(int i) { int rowCardinality = rowPointers[i + 1] - rowPointers[i]; double rowValues[] = new double[rowCardinality]; int rowIndices[] = new int[rowCardinality]; System.arraycopy(values, rowPointers[i], rowValues, 0, rowCardinality); System.arraycopy(columnIndices, rowPointers[i], rowIndices, 0, rowCardinality); return new CompressedVector(columns, rowCardinality, rowValues, rowIndices); } So it is read-only. Would you please help me to understand if this will cause problems for my multithreaded program or i need to use synchronization or locks?
has answer: http://stackoverflow.com/a/23155117
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23141195
tagged with: multithreading
has title: Is my shared class thread-safe?
upvote count: 1
type: Question

http://stackoverflow.com/comment/35551715
score: 0
type: AnswerComment
type: Comment
has text: Thanks for the demo. I loved it. The data comes from HP archsight. So in that case if it conains = in username or value it will provide us a backslash for that. How to handle that. I am not so good in regex.
comment on: http://stackoverflow.com/a/23236286

http://stackoverflow.com/a/23799666
score: 1
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36612358
downvote count: 0
answers question: http://stackoverflow.com/q/23129994
type: Answer
accepted answer of: http://stackoverflow.com/q/23129994
has body: Instead of using java variables creating a struts variable works fine. &lt;s:set name="newVariable" value="%{#idx.index}" /&gt; whenever you need to access the newly created struts variable. You can use this &lt;s:property value="#newVariable" /&gt;

http://stackoverflow.com/a/70025212
answers question: http://stackoverflow.com/q/23136469
type: Answer
downvote count: 0
has body: You can use the name of an attribute found in the select clause as a sort property: @Query(value = "select a, count(b) as besCount from A a join a.bes b group by a", countQuery = "select count(a) from A a") Page<Tuple> findAllWithBesCount(Pageable pageable); You can now sort on property besCount : findAllWithBesCount(PageRequest.of(1, 10, Sort.Direction.ASC, "besCount"));
score: 1
upvote count: 1

http://stackoverflow.com/q/23220084
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/23221304
type: Question
tagged with: redraw
tagged with: canvas
has body: i've got a question about drawing animations in Java (SWT). I try to draw an animation of some process. When i use canvas.redraw() program firstly erases everything that has been drawn and then draws again. My program draws about 1000 of rectangles per time step (this big quantity is necessary) so animation doesn't looks smooth - it blinks all the time. Is there a way to make it look smoother, for example to paint new objects over old ones, without erasing them (that would look better anyway)?
answer count: 1
has comment: http://stackoverflow.com/comment/35523124
has title: Smooth animation (Java SWT)
score: 0
has comment: http://stackoverflow.com/comment/35522186
tagged with: swt
tagged with: animation
accepted answer: http://stackoverflow.com/a/23221304

http://stackoverflow.com/q/23264097
has comment: http://stackoverflow.com/comment/35601789
type: Question
has answer: http://stackoverflow.com/a/23264297
has body: In my program I'm using the pattern #.## in DecimalFormat as shown below: DecimalFormat df = new DecimalFormat("#.##"); By mistake I added an extra # as shown below: DecimalFormat df = new DecimalFormat("##.##"); But this does not affects my output. I've tried using different combinations of inputs. There is no difference in the output. Tried Googling, but no proper explanation. So what is the exact difference of using "#.##" and "##.##"? If both are same, why is it allowed in Java? If both are different, why output is same in both cases? EDIT: Sample program: import java.text.DecimalFormat; public class Decimals { public static void main(String[] args) { double d1[] = new double[] {100d, -1d, -0.111111d, 2.555666d, 55555555555d, 0d}; DecimalFormat df1 = new DecimalFormat("#.##"); DecimalFormat df2 = new DecimalFormat("##.##"); for (double d : d1) { System.out.println(df1.format(d)); System.out.println(df2.format(d)); } } } Output: 100 100 -1 -1 -0.11 -0.11 2.56 2.56 55555555555 55555555555 0 0
has comment: http://stackoverflow.com/comment/35601874
upvote count: 3
has answer: http://stackoverflow.com/a/23264449
accepted answer: http://stackoverflow.com/a/23264449
answer count: 2
possible better answer: http://stackoverflow.com/a/23264297
favorite count: 0
has title: What is the difference between #.## and ##.## pattern in Decimal Format?
tagged with: decimalformat
has comment: http://stackoverflow.com/comment/35601634
type: AnsweredQuestion
score: 3
downvote count: 0
tagged with: java

http://stackoverflow.com/a/23230828
accepted answer of: http://stackoverflow.com/q/23230639
type: Answer
has body: If i understood properly what you want to do, this is what you need: public class SubActivity extends BaseActivity { @Override protected void setTag(Activity activity) { super.setTag(this); } } However, there's a big possible issue in your code, your abstract class is declaring TAG as static hence, any new activity that calls the method setTag will modify the value of the TAG in "First" class, which is not what you might want, you may want to keep it virtual "non static" so each object created will keep its own version of TAG with the proper name of the class assigned in each SubActivity... Regards!
downvote count: 0
has comment: http://stackoverflow.com/comment/35542169
score: 3
upvote count: 3
answers question: http://stackoverflow.com/q/23230639
type: AcceptedAnswer

http://stackoverflow.com/a/26320754
score: 0
has body: I am really disappointed with Stackoverflow... Oh well.. Here is the modified FileChooser. Hope I could help someone out. PS: I noticed, that it wouldn't be a good idea to pack the write function inside the Filechooser. So best thing to do is to get the name + extension with the .getFullName(); method and send the name to a write function. import java.io.File; import javax.swing.Action; import javax.swing.JFileChooser; import javax.swing.filechooser.FileFilter; import javax.swing.filechooser.FileNameExtensionFilter; public class MyFileChooser extends JFileChooser { public MyFileChooser(String path, String defName) { super(path); FileFilter txtType = new FileNameExtensionFilter("Text File (.txt)", "txt"); FileFilter htmlType = new FileNameExtensionFilter("HTML File (.HTML)", "HTML"); this.addChoosableFileFilter(txtType); this.addChoosableFileFilter(htmlType); this.setSelectedFile(new File(defName)); Action details = this.getActionMap().get("viewTypeDetails"); details.actionPerformed(null); } public String getFullName() { String[] temp; String extens, temp2, temp3; temp3 = this.getSelectedFile().getName(); try { temp = this.getFileFilter().getDescription().split("[\\(||\\)]"); if (temp3.endsWith(temp[1])) { return temp3; }else{ return temp3 + temp[1]; } }catch (Exception e){ try { temp2 = this.getSelectedFile().getName(); extens = temp2.substring(temp2.lastIndexOf('.')).trim(); return temp3; }catch (Exception ee) { return temp3 + ".txt"; } } } public String getFolderPath() { String inputName = this.getSelectedFile().getName(); String fullPath = this.getSelectedFile().getPath(); String result = fullPath.replaceAll(""+ inputName + "$", ""); return result; } }
type: Answer
accepted answer of: http://stackoverflow.com/q/23164798
answers question: http://stackoverflow.com/q/23164798
type: AcceptedAnswer

http://stackoverflow.com/a/23222960
answers question: http://stackoverflow.com/q/23222632
has body: The hibernate property names in the configuration file are case sensitive. &lt;property name="hibernate.connection.URL"&gt; should be &lt;property name="hibernate.connection.url"&gt;
score: 34
accepted answer of: http://stackoverflow.com/q/23222632
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 34

http://stackoverflow.com/a/23142512
answers question: http://stackoverflow.com/q/23142325
accepted answer of: http://stackoverflow.com/q/23142325
has comment: http://stackoverflow.com/comment/35386227
score: 0
has body: I believe the application crashes because you are parsing the contents of your EditText to doubles even though they may be empty. The Double.parseDouble function will throw a NumberFormatException if it cannot parse a double out of the given String. To fix this, perform a check for empty string before trying to parse, or catch the exception. For example: double charge = 0.0; // some default value if (!Charge1.getText().toString().isEmpty()) { charge = Double.parseDouble(Charge1.getText().toString()); } double time = 0.0; // some default value if (!Time1.getText().toString().isEmpty()) { time = Double.parseDouble(Time1.getText().toString()); } double current = 0.0; // some default value if (!current1.getText().toString().isEmpty()) { current = Double.parseDouble(current1.getText().toString()); }
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35386063
type: Answer
has comment: http://stackoverflow.com/comment/35385962
has comment: http://stackoverflow.com/comment/35386127

http://stackoverflow.com/comment/35518446
has text: hmm ... how is this related to swingx?
score: 0
comment on: http://stackoverflow.com/q/23215415
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/35438249
has text: Are you trying to access the database in your local_machine through your phone???
comment on: http://stackoverflow.com/q/23172484
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35388192
type: Comment
has text: post the output of `mvn --version`
comment on: http://stackoverflow.com/q/23143905
score: 0
type: QuestionComment

http://stackoverflow.com/comment/35536887
type: QuestionComment
comment on: http://stackoverflow.com/q/23228108
has text: PERSONNEW TABLE 1 Ola Hansen 2 Tove Svendson 3 Kari Pettersen and the other table has 3 colums with the person id as the last coulmn orderid,ordero,personid
score: 0
type: Comment

http://stackoverflow.com/q/23186680
has answer: http://stackoverflow.com/a/23186808
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/35463618
upvote count: 0
tagged with: validation
favorite count: 0
has body: I am trying to validate user input into text boxes. I am checking whether the text box is populated or not and if it's not I need to alert the user to which text box isn't populated. My problem is that I need a way of returning which text box / variable is empty. I am aware I will need to pass 2 values in, one being the content of the text box and the other, an identifier of the text box. Currently I have this (found on StackOverflow) which checks if each variable in the array is populated. public boolean areAllNotEmpty(String... text){ for(String s : text) { if(s == null || "".equals(s)) { return false; } } return true; } I would like it to also return something like this (commented): public boolean areAllNotEmpty(String... text){ for(String s : text) { if(s == null || "".equals(s)) { // return textbox name / value OR show alert box with "Forename missing" etc return false; } } return true; } I implemented this method before on a C# project but it requires passing in one text box at a time with multiple method calls which I'm guessing isn't great. public static bool IsFieldNull(TextBox currentText, string type) { bool allOk = false; if (currentText.Text == "") { MessageBox.Show("Error - '" + type + "' field cannot be left blank, please enter some data in this field"); currentText.Focus(); return allOk; } else { allOk = true; return allOk; } This is how it is called in C#. Validation.IsFieldNull(txtBoxFixtureDate, "Fixture Date") &amp;&amp; Validation.IsFieldNull(txtBoxTime, "Time") If any of that doesn't make sense, let me know. Thanks for any help.
has answer: http://stackoverflow.com/a/23186996
type: UnansweredQuestion
tagged with: swing
tagged with: jtextfield
has comment: http://stackoverflow.com/comment/35463228
downvote count: 1
has title: Validating user input in JTextFields (Java)
tagged with: java
score: -1

http://stackoverflow.com/a/23233099
has body: The @DefaultValue represents a default value for a form parameter, query parameter, cookie, and a few others, as described in the javadoc. These various parameters and values are sent as part of the request. The http server receives them as Strings and your jax-rs container parses them and converts them appropriately. @DefaultValue provides the value as a string and let's the container convert it as it would with a provided value. So just provide the string representation of the int value and the container will make the correct conversion
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23233052
downvote count: 0
answers question: http://stackoverflow.com/q/23233052
type: Answer
upvote count: 1
score: 1

http://stackoverflow.com/comment/35645112
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23265691
has text: @Downvoter : Please explain the down voting atleast..
score: 0

http://stackoverflow.com/comment/35528648
type: QuestionComment
comment on: http://stackoverflow.com/q/23220479
has text: Unfortunately this doesn't work. I mean context is running, and tests are running either. The problem is that they are failing with the message above.
score: 0
type: Comment

http://stackoverflow.com/comment/35577600
has text: You don't seem to understand what "class" means, which makes it rather hard to understand your question.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23250937

http://stackoverflow.com/q/23162164
tagged with: java
has title: Log4j2 creates log file but doesn't write to it
score: 0
answer count: 2
tagged with: tomcat
has answer: http://stackoverflow.com/a/23166336
has answer: http://stackoverflow.com/a/65304426
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/65304426
has body: I'm using Tomcat 8.0.3 and log4j 2.0-rc1 to deploy a GWT application (servlet 2.5). I believe I fixed the usual log configuration errors, but still nothing is logged to the console or file. Head of my web.xml: org.apache.logging.log4j.core.web.Log4jServletContextListener log4jServletFilter org.apache.logging.log4j.core.web.Log4jServletFilter log4jConfiguration file:///C:/Users/name/Desktop/log4j2.xml log4jServletFilter /* REQUEST FORWARD INCLUDE ERROR This is the log4j2.xml configuration: <?xml version="1.0" encoding="UTF-8"?> <PatternLayout pattern="[%p] %c{1}: %m%n"/> <PatternLayout pattern="[%p] %c{1}: %m%n"/> <Appender-Ref ref="Console"/> <Appender-Ref ref="infoFile"/> I added both the log4j2 api and core to my Maven dependencies and I can see them exploded in WEB-INF\classes\. I've also removed them from the skipJar list in catalina.properties. When the war is deployed, no errors or warnings are thrown in the localhost or catalina log. This is the localhost log: INFO ContextListener: contextInitialized() INFO SessionListener: contextInitialized() INFO Log4jServletContextListener ensuring that Log4j starts up properly. INFO Log4jServletFilter initialized. The strange thing is that the info.log file is created, but never written to. I'm also using Hibernate whose logs do show up in the console, could this be the problem? Finally, this is how I'm using the logger: import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; private static final Logger LOG = LogManager.getLogger(MyClass.class.getName()); public void myMethod() { LOG.info("Logging some message"); } (The log4j2 config file is temporarily on my desktop because it seems that I can't use spaces in the path)
accepted answer: http://stackoverflow.com/a/23166336
tagged with: log4j2
tagged with: logging
type: Question
tagged with: configuration

http://stackoverflow.com/comment/35380174
has text: I get an Error parsing data org.json.JSONException: Value null of type org.json.JSONObject$1 cannot be converted to JSONObject error
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23131145

http://stackoverflow.com/a/23162051
has body: When you are setting node = node.getLeftChild(); (or symetrically node = node.getRightChild(); you are changing the value of the local variable node, and not the reference to this node from the father. You are missing something like:node.father.left = ....(or node.father.right = ...). You should change the values in the tree itself, and not only the references you hold in the method.
score: 1
upvote count: 1
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/23161855
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23161855

http://stackoverflow.com/a/26433529
answers question: http://stackoverflow.com/q/23177407
has comment: http://stackoverflow.com/comment/41589455
has comment: http://stackoverflow.com/comment/41532618
has comment: http://stackoverflow.com/comment/41653427
has body: Six months later, I have a decent, not-altogether-inelegant way to access everything that I needed to below main JFrame, in the context of a menu option action that sets all tool tips to "": private void tipsOff(Container container) { Component [] c = container.getComponents(); Component s; for (Component cc : c) { ((JComponent)cc).setToolTipText(""); if(cc instanceof JPanel) tipsOff((Container) cc); if(cc instanceof JScrollPane) tipsOff(((JScrollPane)cc).getViewport()); } } private void mniPrefTooltipsActionPerformed(java.awt.event.ActionEvent evt) { tipsOff(gui.getContentPane()); tipsOff(gui.mbrMenuBar); } Note recursive call to tipsOff. Also note comments and Answer about using ToolTipManager (in this thread, which works in the context of my original question to reduce all the code to one line. Point here is that any other operation could be applied instead of ""-ing tool tips--e.g., setting invisible or disabling... etc. Thanks to maaartinus for the JScrollPane line in tipsOff.
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41591045
type: Answer
has comment: http://stackoverflow.com/comment/41591023
has comment: http://stackoverflow.com/comment/41666148
accepted answer of: http://stackoverflow.com/q/23177407

http://stackoverflow.com/q/23210530
type: Question
has title: HibernateTemplate has incompatible types error after upgrading from Spring 3 to Spring 4
answer count: 1
has comment: http://stackoverflow.com/comment/35524575
favorite count: 0
accepted answer: http://stackoverflow.com/a/23224446
has comment: http://stackoverflow.com/comment/47526395
linked to: http://stackoverflow.com/q/2770321
has body: I'm trying to upgrade an application to use the latest version of Spring. It currently uses Spring 3.0.7 and Hibernate 3.5.6. I'm able to successfully upgrade it to Spring 3.2.8, but if I upgrade it to Spring 4, I get compilation errors like the following: [ERROR] /Users/mraible/dev/foo-upgrades/foo-core/src/main/java/com/company/foo/dao/companydb/impl/hibernate/InFaxDAOImpl.java:[71,82] incompatible types [ERROR] required: java.util.List&lt;com.company.foo.common.domain.FaxPage&gt; [ERROR] found: java.util.List&lt;capture#49 of ?&gt; The method call looks like the following: List&lt;FaxPage&gt; faxPages = getHibernateTemplate().findByNamedQueryAndNamedParam(queryName, hqlParams, values); I can fix the compilation error by casting to the list type, but that doesn't seem right. List&lt;FaxPage&gt; faxPages = (List&lt;FaxPage&gt;) getHibernateTemplate().findByNamedQueryAndNamedParam(queryName, hqlParams, values); What is it about Spring 4 that breaks HibernateDaoSupport so it's not backwards compatible?
has comment: http://stackoverflow.com/comment/35525542
has comment: http://stackoverflow.com/comment/35525186
upvote count: 2
has comment: http://stackoverflow.com/comment/40282336
tagged with: spring
downvote count: 1
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23224446
score: 1
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/35512403

http://stackoverflow.com/comment/35437775
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23172229
type: QuestionComment
has text: I want to store the output in date object not string object

http://stackoverflow.com/comment/35488909
has text: AtomicInteger is built for concurrency. For this use case taking two integers and incrementing them should be more than enough.
type: Comment
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/23201468

http://stackoverflow.com/comment/35500237
score: 0
has text: @John It ran in the Command Line successfully.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23206154

http://stackoverflow.com/q/23188165
has answer: http://stackoverflow.com/a/23189574
has comment: http://stackoverflow.com/comment/35471370
tagged with: java
tagged with: jcomponent
tagged with: swing
type: Question
score: 0
tagged with: japplet
has title: Jcomponent content pane
answer count: 1
has body: My question is , if the top level containers like frames,dialog and applet has a content pane with boarder layout as default which are inherited from JComponent as the oracle doc says then what is the relation between frames,app,dialog and jcomponent as all are top level containers?
tagged with: jframe
type: UnansweredQuestion

http://stackoverflow.com/a/55403621
answers question: http://stackoverflow.com/q/23260057
score: 0
type: Answer
has body: For my case, it was my code calling System.exit(0). Here is the extract about it from te documentation: Surefire does not support tests or any referenced libraries calling System.exit() at any time. If they do so, they are incompatible with Surefire and you should probably file an issue with the library/vendor.

http://stackoverflow.com/q/23164154
favorite count: 0
has answer: http://stackoverflow.com/a/23164166
has body: I am trying to make a little game in java. I made a class that I call Game and some subclasses. I use the subclass Body for all kinds of objects in the game. I want a method in Game for spawning objects. This method should add a reference to a list so that interactions with other bodies may be calculated later. The Game class looks something like this: import java.util.*; class Game { public List&lt;Body&gt; bodies = new ArrayList&lt;Body&gt;(); public void spawn( Body body ) { bodies.add( body ); } } Right, I think that works. Now I want to be able to deSpawn the bodies as well. I tried this: import java.util.*; class Game { public List&lt;Body&gt; bodies = new ArrayList&lt;Body&gt;(); public void spawn( Body body ) { bodies.add( body ); } public void despawn( Body body ) { body = null; } } It doesn't work as expected. I guess it just removes this reference to the object, if that is correct I would have no idea how to remove all references to the object. I guess I could iterate over the array, but that just seems stupid since I have a reference to the actual object. Shouldn't I be able to destroy it? More elegant alternatives?
accepted answer: http://stackoverflow.com/a/23164167
possible better answer: http://stackoverflow.com/a/23164166
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/23164167
answer count: 2
downvote count: 0
has title: Java effectively deleting object

http://stackoverflow.com/comment/52306672
score: 3
type: AnswerComment
comment on: http://stackoverflow.com/a/23262469
type: Comment
has text: Is there anyway to do this without using a playRunHook then?

http://stackoverflow.com/a/23229782
accepted answer of: http://stackoverflow.com/q/23229483
has comment: http://stackoverflow.com/comment/35540719
has comment: http://stackoverflow.com/comment/35541009
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35592217
type: Answer
has comment: http://stackoverflow.com/comment/35540398
has body: Yes. Java 7 EE has HTML5 functionality although I'm not sure about specific tags. Also, there are external packages, like one from Intel freely available and you can always extend the functionality yourself in some way or another. Edit: addendum to my 2nd suggestion (implementing the topic in the linked question) The Intel JWebEngine (which might be what you are already looking for) documentation says: What are the advantages versus the built-in Java HTML editor? The built-in Java HTML editor of Java is very limited. It only supports HTML 3.2 with some features of HTML 4 and CSS. The support of CSS is wrong in many cases, especially when it comes to cascading selectors. The text is often too small and on many web sites Java only shows an error instead of a incorrectly formatted page. Here are some further differences: JWebEngine can display the ACID 1 test correctly - Java does not JWebEngine can display the ACID 2 test partly - Java only displays a blank page because an error occurs JWebEngine basically shows HTML pages like a browser with JavaScript disabled In cases where the CSS and HTML specifications are not explicit about implementation JWebEngine is designed to mirror Mozilla FireFox's behavior.
downvote count: 0
answers question: http://stackoverflow.com/q/23229483
score: 1

http://stackoverflow.com/comment/35624859
type: Comment
has text: @mvmn I cannot remove it. I am using a library where I need to pass integer but it only accepts constant. The value for this should come from property file.
comment on: http://stackoverflow.com/q/23273936
score: 0
type: QuestionComment

http://stackoverflow.com/comment/35628959
has text: And that `loop` procedure is pretty strange. The action to be taken from a given state usually depends on input or some such.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23278359

http://stackoverflow.com/q/23141014
upvote count: 2
has answer: http://stackoverflow.com/a/23143477
type: AnsweredQuestion
tagged with: java
has body: I am facing following problem while inserting data into table using single inheritance in jpa. run: [EL Info]: 2014-04-17 22:40:45.947--ServerSession(863001717)--EclipseLink, version: Eclipse Persistence Services - 2.2.0.v20110202-r8913 [EL Info]: 2014-04-17 22:40:46.387--ServerSession(863001717)--file:/C:/Users/xone/Documents/NetBeansProjects/JPAAditiDAS/build/classes/_TESTJPAPU login successful [EL Warning]: 2014-04-17 22:40:46.469--ClientSession(1037426453)--Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.2.0.v20110202-r8913): org.eclipse.persistence.exceptions.DatabaseException Internal Exception: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'customerjpa.sequence' doesn't exist Error Code: 1146 Call: UPDATE SEQUENCE SET SEQ_COUNT = SEQ_COUNT + ? WHERE SEQ_NAME = ? bind =&gt; [2 parameters bound] Query: DataModifyQuery(name="SEQUENCE" sql="UPDATE SEQUENCE SET SEQ_COUNT = SEQ_COUNT + ? WHERE SEQ_NAME = ?") Exception in thread "main" Local Exception Stack: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.2.0.v20110202-r8913): org.eclipse.persistence.exceptions.DatabaseException Internal Exception: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'customerjpa.sequence' doesn't exist Error Code: 1146 Call: UPDATE SEQUENCE SET SEQ_COUNT = SEQ_COUNT + ? WHERE SEQ_NAME = ? bind =&gt; [2 parameters bound] Query: DataModifyQuery(name="SEQUENCE" sql="UPDATE SEQUENCE SET SEQ_COUNT = SEQ_COUNT + ? WHERE SEQ_NAME = ?") at org.eclipse.persistence.exceptions.DatabaseException.sqlException(DatabaseException.java:324) at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.executeDirectNoSelect(DatabaseAccessor.java:798) at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.executeNoSelect(DatabaseAccessor.java:864) at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.basicExecuteCall(DatabaseAccessor.java:583) at org.eclipse.persistence.internal.databaseaccess.DatabaseAccess…
type: Question
accepted answer: http://stackoverflow.com/a/23143477
tagged with: jpa
answer count: 1
downvote count: 0
has title: Table 'customerjpa.sequence' doesn't exist JPA
favorite count: 0
score: 2

http://stackoverflow.com/comment/35613996
type: Comment
comment on: http://stackoverflow.com/a/23270700
has text: @giozh why is that?? why not you can use if you do it properly
score: 0
type: AnswerComment

http://stackoverflow.com/comment/36149181
has text: Thanks @BalazsZsoldos There are really a lot of unnecessary bundles to install, so I've modified my sample [my answer below]. With your sample you are using Jetty 9.1.0 which depends on javax.servlet 3.1.0 version. unfortunately, org.eclipse.equinox.http.servlet_1.1.400.v20130418-1354 bundle has a constraint: javax.servlet; version="[2.3.0,3.1.0)"' and this bundle is a constraint for org.eclipse.jetty.osgi.httpservice_9.1.0.v20131115 with HttpService implementation. That's why I have to use javax.servlet 3.0.1 version and Jetty 8.0.4 - this set of dependencies doesn't have any problems.
comment on: http://stackoverflow.com/q/23290506
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23196456
score: 3
has body: I am using Mockito for some unit testing. I have the following classes: public class Base { public void say() { System.out.println("Base"); // some work in the base class } } public class Derived extends Base { @Override public void say() { super.say(); // do the base class work System.out.println("Derived"); // some additional work in the derived class } } Now I want to test the Derived class's say() method while mocking the base say() method. I followed the suggestion here: Mockito How to mock only the call of a method of the superclass and I now have. public class DerivedTest { @Test public void testSay() { Derived obj = Mockito.spy(new Derived()); Mockito.doNothing().when((Base)obj).say(); obj.say(); // assert only "Derived" was output } } But this doesn't work as it mocks both the base and the derived class implementation. I want to test just the extra logic in the derived class. How can I do this. Update: My solution Since I couldn't change the base class as suggested, I modified my derived class to extract all the extra logic in a a separate method and just tested that method. public class Derived extends Base { @Override public void say() { super.say(); // do the base class work doAdditionalWork(); // some additional work in the derived class } void doAdditionalWork() { System.out.println("Derived"); } } public class DerivedTest { @Test public void testDoAdditionalWork() { Derived obj = new Derived(); obj.doAdditionalWork(); // assert only "Derived" was output } } This means that I am still not testing the derived say() method but given that the logic there is quite simple now, I hope I can be excused for this. The other downside is that I can't have a visibility stricter than package-private for the doAdditionalWork() method.
tagged with: java
type: Question
tagged with: mockito
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/23196929
has title: Mockito - Mock base implementation while testing derived class implementation of same method
upvote count: 3
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/3467801
tagged with: unit-testing

http://stackoverflow.com/comment/35475588
score: 0
type: Comment
type: QuestionComment
has text: you added it as a jar? If yes that is wrong
comment on: http://stackoverflow.com/q/23193534

http://stackoverflow.com/a/52096555
score: -1
upvote count: 0
type: Answer
downvote count: 1
answers question: http://stackoverflow.com/q/23143697
has body: Just copy the property files into the Tomcat lib folder. Or enhance conf/catalina.properties:common.loader with a folder for the property files as described here: How to add external resources (properties file) on to the classpath so that war can read?

http://stackoverflow.com/a/23227199
has comment: http://stackoverflow.com/comment/35536809
has comment: http://stackoverflow.com/comment/35536572
score: 0
has body: 04-22 19:19:20.860: E/AndroidRuntime(23765): at com.gianni.app.partenze.CheckRow(partenze.java:92) That is only one line in the log output which tells you part of where the error occurs, but not what actually happened. You need to show more of the stack trace. list=(ListView)getActivity().findViewById(R.id.listView2); Change this to call list = (ListView) getView().findViewById(R.id.listView2); If that doesn't work, there may be something wrong with your XML (maybe it's not returning a list view). Post the XML.
has comment: http://stackoverflow.com/comment/35536348
type: Answer
has comment: http://stackoverflow.com/comment/35538637
answers question: http://stackoverflow.com/q/23226355
has comment: http://stackoverflow.com/comment/35536026
has comment: http://stackoverflow.com/comment/35536771

http://stackoverflow.com/q/23157784
downvote count: 0
has title: Keeping reference to actor system
has answer: http://stackoverflow.com/a/23180149
tagged with: akka
answer count: 1
score: 1
tagged with: embedded-jetty
favorite count: 0
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/35451846
has body: I have a desktop application with embedded jetty and some SWING UI in Java. I want to utilise akka for sending messages from embedded jetty servlets to my application classes ( with ability for actor to update swing UI on incoming message). As i understand i need to have single actor system for the whole application. The question is what is the best approach to handle reference to it? Should i make some sort of singleton that wraps reference to actor system ? Can there be an issue with classloaders as jetty might use it's own classloader ?
upvote count: 1
type: Question

http://stackoverflow.com/comment/35542804
comment on: http://stackoverflow.com/q/23231215
has text: Show us the code where you use it.
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/q/23290000
has answer: http://stackoverflow.com/a/55143671
type: Question
linked to: http://stackoverflow.com/q/24508773
has title: Assertion failed. convertPointsFromHomogenous
answer count: 1
downvote count: 0
has body: A get the following error when executing my code: Caused by: CvException [org.opencv.core.CvException: cv::Exception: /home/reports/ci/slave_desktop/50-SDK/opencv/modules/calib3d/src/fundam.cpp:1152: error: (-215) npoints >= 0 &amp;&amp; (src.depth() == CV_32F || src.depth() == CV_32S) in function void cv::convertPointsFromHomogeneous(cv::InputArray, cv::OutputArray) Here is the code I am using: Mat res = new Mat(); // Result mat for triangulation Mat P1 = new Mat(3,4,CvType.CV_32F); double[] diagVal = {1,0,0,0, 0,1,0,0, 0,0,1,0}; P1.put(0, 0, diagVal); int[] max = new int[4]; for(int i = 0; i &lt; max.length; i++) max[i] = 0; Mat P2 = buildCameraMatrix(R1, T1); Calib3d.triangulatePoints(P1, P2, objLeft, objRight, res); TriangulatePoints results in a (914,4) Mat of Type CV_32F (res.type() == 5 is true). What Am I doing wrong?
favorite count: 0
has comment: http://stackoverflow.com/comment/42792068
type: UnansweredQuestion
tagged with: opencv
score: 3
upvote count: 3
tagged with: java

http://stackoverflow.com/comment/35472296
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23191387
score: 0
has text: @angel_navarro: No they are in two projects. Web service project depends on the other one. Can you please tell me how to update them?

http://stackoverflow.com/a/38244558
score: 1
upvote count: 1
has body: Flume provides an Application class to run the conf file using a Java program. Please find the below program. import org.apache.flume.node.Application; import org.apache.log4j.BasicConfigurator; public class flume { public static void main(String[] args) { String[] args1 = new String[] { "agent","-nTwitterAgent","-fflume.conf" }; BasicConfigurator.configure(); Application.main(args1); System.setProperty("hadoop.home.dir", "/"); } } In the Application class you need provide your agent, agentname and the flume.conf file path. Here in my case flume.conf file is in my project classpath only so i have just specified as -fflume.conf. If it is in a different directory you need to specify the full path there. After this you can run it as a normal java program itself.
has comment: http://stackoverflow.com/comment/64235653
downvote count: 0
answers question: http://stackoverflow.com/q/23211927
type: Answer

http://stackoverflow.com/q/23272905
has comment: http://stackoverflow.com/comment/35620061
tagged with: glassfish
answer count: 1
tagged with: jax-rs
has answer: http://stackoverflow.com/a/23278804
favorite count: 0
upvote count: 2
tagged with: web-services
score: 2
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/23278804
has body: In Beginning Java EE 7 by Antonio Goncalves it is written: In the section Writing RESTful Web Services -> Life Cycle and Callback: Thus, the life cycle of a RESTful web service is per request so the service does not have to worry about concurrency and can use instance variables safely. Yet a couple lines later he writes: Remember that a RESTful web service can also be annotated with @Stateless or @Singleton to benefit from the services of session beans. So what is it? Lifecycle per request only or can it be session too? In addition to that, if the life cycle is session, how does it handle the @Context annotation when injecting HttpHeaders into an attribute? The headers could vary during the session, so is this attribute always updated after each request?
type: Question
has title: RESTful web service life cycle is *always* per request?
tagged with: jersey
downvote count: 0

http://stackoverflow.com/comment/35456259
has text: Can someone please help me figure out what I'm doing wrong?
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23181443
type: QuestionComment

http://stackoverflow.com/a/23187297
upvote count: 2
has body: You should use .equals() to compare strings in Java. Example: public void modifyExam(String [] names) { String name; Scanner scanner = new Scanner(System.in); System.out.println("Please enter the name of the student whose grade you would like to modify: "); name = scanner.nextLine(); boolean nameMatch = false; for (int i=0; i&lt;names.length; i++) { if( names[i].equals(name) ) { // do your logic here ... } } }
answers question: http://stackoverflow.com/q/23187254
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23187254
type: Answer
score: 2
downvote count: 0

http://stackoverflow.com/q/23183522
score: 0
answer count: 1
has title: convert form.showDialog from vb to Java
has body: I need a similar code of form.showDialog from vb to Java to show a Frame up to its parent Frame. I've tried something like this : private void button1ActionPerformed(java.awt.event.ActionEvent evt) { Frame2 form = new Frame2(); form.setVisible(true); } and i got 2 problems, the first : the new frame wont stay on the top alway, that mean i can select the old form and the second problem : when i close the new form the parent form will close too !
type: UnansweredQuestion
tagged with: vb.net
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/23183568

http://stackoverflow.com/q/23132916
has title: JSF2 using JSP2.0 - custom components issue
has body: We are migrating JSF1.2 to JSF2.0 using JSP2. JSF 2.0 with JSP2 on RAD 8 is the exact specification we are lookig for. We are getting some issues on custom tags and component classes. how can i configure component classes and custom tags in JSP( by using TLD file or *.taglib.xml) note: not for JSTL tags on this combination, no concrete solutions were available even from the internet and from other sources. Requesting leads and expertise to resolve this. Thanks Prabhakar Reddy
upvote count: 0
tagged with: java
type: Question
score: -1
has answer: http://stackoverflow.com/a/23134129
tagged with: jsf-2
answer count: 1
downvote count: 1
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/a/23248632
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23195795
has body: You can do it by the help of HandlerInterceptorAdapter. The preHandle() method should return true if the execution chain should proceed with the next interceptor or the handler( your controller) itself. Else, DispatcherServlet assumes that this interceptor has already dealt with the response itself. public class YourInterceptor extends HandlerInterceptorAdapter { public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { UserBean userBean = (UserBean) WebUtils.getSessionAttribute(request, "UserBean"); if(userBean == null){ //whatever you want to do return throw new ModelAndViewDefiningException(new ModelAndView("userLogout", "command", null)); }else{ return true; } } } and specify this interceptor in your handler mapping definitions as: YourController

http://stackoverflow.com/comment/35389956
comment on: http://stackoverflow.com/q/23144864
type: QuestionComment
type: Comment
score: 0
has text: @ajb I've never really given much thought to converting C++ to Java. For simple cases, it does seem fairly straightforward, but you are obviously right. For instance in C++ you can extend several classes and you cannot in Java. This would be difficult, I would think, to handle automatically.

http://stackoverflow.com/q/23271227
has body: Method calculating percentages (from array which I don't want to be changed but it is): private float values[] = { AGREE, DISAGREE }; private float[] calculateData(float[] data) { // TODO Auto-generated method stub float total = 0; for (int i = 0; i &lt; data.length; i++) { total += data[i]; } // 180 is the amount of degrees of the circle - setting it up to half // circle 360 means full circle for (int i = 0; i &lt; data.length; i++) { data[i] = 180 * (data[i] / total); } Calling the method: float[] degrees = calculateData(values); If I log the values of array before this method was called I get 1.0,1.0 but after method was called I get 90.0,90.0 why? If I don't change values[]. I know that it is happening here in that method because when I remove it I get 1.0,1.0 (what I actually want to get) EDIT: Thank you for the answers so if I understand it correctly: if parameter of the method is changed also the object set to be parameter, when method was called, becomes changed.
linked to: http://stackoverflow.com/q/5785745
has comment: http://stackoverflow.com/comment/35614982
answer count: 4
type: AnsweredQuestion
tagged with: arrays
has answer: http://stackoverflow.com/a/23271331
favorite count: 0
accepted answer: http://stackoverflow.com/a/23271330
possible better answer: http://stackoverflow.com/a/23271263
type: Question
has answer: http://stackoverflow.com/a/23271263
has answer: http://stackoverflow.com/a/23271289
score: 0
linked to: http://stackoverflow.com/q/40480
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/35615092
has title: Method is changing values of my array unexpectedly
has answer: http://stackoverflow.com/a/23271330
tagged with: java

http://stackoverflow.com/comment/35609250
score: 2
comment on: http://stackoverflow.com/a/23268161
has text: It may be how *your* world works, but it's certainly not how *my* world works. For example, I'm very happy that `StringBuilder.setLength` will throw an exception if you pass it a negative number - you would rather have a separate `checkLength` call but let `setLength` just change the state to something invalid? (As for making the field non-private - I prefer to separate my API from my implementation, thanks.)
type: AnswerComment
type: Comment

http://stackoverflow.com/q/23191517
tagged with: tomcat
has comment: http://stackoverflow.com/comment/35474323
has comment: http://stackoverflow.com/comment/35498490
has body: Ok, I change my connection factory code, I'm using PoolProperties class and now I'm getting this error: Data source rejected establishment of connection, message from server: "Too many connections" In my InsertandGetObject Method I log a message in order to test that the connection is closing and it is, I also debbug on server. Any ideas for this issue? :s This is my connection Pool: public static Connection getConnection() throws DatabaseConnectionException { PoolProperties p = new PoolProperties(); p.setName("jdbc/MetaData"); p.setUrl("jdbc:mysql://localhost:3306/db_name"); p.setDriverClassName("com.mysql.jdbc.Driver"); p.setUsername("root"); p.setPassword(""); p.setInitialSize(3); p.setMaxActive(10); p.setMaxIdle(8); p.setMinIdle(2); p.setRemoveAbandoned(true); p.setMaxWait(10000); Connection conn = null; try { DataSource dataSource = new org.apache.tomcat.jdbc.pool.DataSource(p); conn = dataSource.getConnection(); } catch (SQLException e) { LOGGER.debug("MSJ SQLExp: " + e.getMessage()); throw new DatabaseConnectionException(e); } return conn; } This is the method that close the connection: public Concept insertAndGetObject(Concept object) throws SQLException, DatabaseConnectionException { try { connection = ConnectionFactory.getConnection(); connection.setAutoCommit(false); statement = connection.prepareStatement(INSERT_CONCEPTS); statement = ConceptMapperUtil.setStatementParameters(statement, object); statement.executeUpdate(); connection.commit(); LOGGER.debug("Inserted concept row "); } catch (SQLException e) { connection.rollback(); if (e.getErrorCode() == SQL_INSERT_ERROR_CODE) { LOGGER.debug("Concept already exists!"); } else { throw e; } } finally { object = findConceptByUniqueFk(object.dataSource.getIdDataSource(), object.conceptType.getIdConcept(), object.idMetadataVersion.getIdMetaDataVersion()); DbUtil.close(statement); // connection.setAutoCommit(true); DbUtil.close(connection); } return object; }
upvote count: 1
answer count: 1
favorite count: 0
tagged with: connection-pooling
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35498570
downvote count: 0
has comment: http://stackoverflow.com/comment/35498643
score: 1
tagged with: java
type: Question
has title: Too many connections (New Error)
has answer: http://stackoverflow.com/a/23207045
accepted answer: http://stackoverflow.com/a/23207045

http://stackoverflow.com/comment/35512017
score: 2
comment on: http://stackoverflow.com/q/23214103
type: Comment
has text: org.apache.ws.commons.schema.XmlSchemaElement is packaged in a seperate jar ( i guess XmlSchema jar or something .Check it . I am not 100% ) I suspect when you create ``your`` jar you did not include it in your packaged jar . Hence when you try running it now it is not found .
type: QuestionComment

http://stackoverflow.com/comment/35528104
type: AnswerComment
has text: Hadoop user `slot` to divide computer resources. Computer resources include memory and cpu.
type: Comment
comment on: http://stackoverflow.com/a/23201181
score: 0

http://stackoverflow.com/comment/35498297
comment on: http://stackoverflow.com/a/23206288
has text: Will accept as answer in 3min. Thank you, very insightful! I was looking towards the objects for the error, would have taken ages to even start looking at the frame.
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/a/23272372
has comment: http://stackoverflow.com/comment/35617723
has comment: http://stackoverflow.com/comment/35617197
has comment: http://stackoverflow.com/comment/35617709
has body: I think your query should be: stmt.executeQuery("SELECT PLAYER_NO,FIRST_NAME,SURNAME," + "EMAIL,PHONE_NO FROM PLAYER" + "WHERE NOT EXISTS(SELECT PLAYER_NO FROM EVENT_PLAYER_LIST " + "WHERE EVENT_NO = "+eventKey+" AND " + "EVENT_PLAYER_LIST.PLAYER_NO = PLAYER.PLAYER_NO);"); Note the use of AND instead of $. The latter is the Bitwise AND Note that the way you are constructing your query is not the best and you are usually advised to use prepared statements instead (for both security and performance reasons)
upvote count: 1
score: 1
accepted answer of: http://stackoverflow.com/q/23272077
answers question: http://stackoverflow.com/q/23272077
has comment: http://stackoverflow.com/comment/35617331
has comment: http://stackoverflow.com/comment/35617138
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/35617436

http://stackoverflow.com/q/23162562
tagged with: http://stackoverflow.com/tag/c
has answer: http://stackoverflow.com/a/23163192
has comment: http://stackoverflow.com/comment/35421058
has body: I have a huge map, and tiles on it. It's a dungeon, so there clearly is a lot of empty space, where I'd store nulls. Obviously, having a huge 2D array is an option, but I think it's not the most elegant one. Also when I want to save it to file, it's not very neat to store tons of null marks. Something like this, but A LOT bigger: +--------------+ | X X | | XXX XX | | XXXXXXX | | X XX | | XXX XXX | | X X | +--------------+ What other alternatives to width×height array do I have? Only something like Map&lt;IntCoord, Tile&gt;? Or is there some widely-used solution for similar scenario?
answer count: 2
possible better answer: http://stackoverflow.com/a/23163192
downvote count: 0
has comment: http://stackoverflow.com/comment/35420966
favorite count: 0
tagged with: design-patterns
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35421144
upvote count: 2
tagged with: java
has answer: http://stackoverflow.com/a/23162927
has comment: http://stackoverflow.com/comment/35421102
type: Question
accepted answer: http://stackoverflow.com/a/23162927
has title: Efficiently storing sparsely populated 2D grid

http://stackoverflow.com/comment/35746919
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23190908
has text: Yes that link was helpfull :),but what is idea behind this RESTfull , do u know any history related to invention of this RESTfull?
type: Comment

http://stackoverflow.com/q/23275299
answer count: 1
score: 0
has title: What should I use straight FK fields or Entity objects?
has comment: http://stackoverflow.com/comment/35623466
type: Question
type: AnsweredQuestion
has body: I'm newbie with Hibernate and I don't which is the best approach for doing this: @Entity @Table(name = "alumno") public class Alumno implements Serializable { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "id") private Integer id; @Column(name = "salon_id") private Integer salonId; } Where salonId field is mapped to a database field which is a fk refering to Salon table id or this: @Entity @Table(name = "alumno") public class Alumno implements Serializable { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "id") private Integer id; private Salon salon; } Which are the advantages of one vs the other?
has answer: http://stackoverflow.com/a/23275682
accepted answer: http://stackoverflow.com/a/23275682
tagged with: java
tagged with: hibernate
tagged with: jpa

http://stackoverflow.com/comment/35550877
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23204293
has text: Doing something like `@ContextConfiguration(locations = "classpath:/META-INF/spring/context.xml")` in the Test does work

http://stackoverflow.com/comment/35545389
type: AnswerComment
has text: Even if this works, I think it may be hiding some underlying issue with how you are using Tasks. Whether a task onTaskSucceeded is called really shouldn't be related to the daemon status of a thread.
type: Comment
comment on: http://stackoverflow.com/a/23232203
score: 0

http://stackoverflow.com/a/23280059
answers question: http://stackoverflow.com/q/23274911
type: Answer
has body: In your examples, you are assuming that an object is created without a "new". That is an incorrect assumption. The object was created with "new" in the second example as well. Just because you can't see the "new" doesn't mean it's not called in the function.
score: 0

http://stackoverflow.com/a/23252855
accepted answer of: http://stackoverflow.com/q/23252646
answers question: http://stackoverflow.com/q/23252646
downvote count: 0
score: 1
has body: You have a disorganized way of constructing your BankAccount objects where whether you get an ID assigned or not depends on which constructor you use. If you rewrite your constructors so that they are chained together, with a primary constructor that takes care of all core responsibilities and a secondary constructor that assigns default values and delegates to the primary one, then initialization will have consistent results. (The terminology is Scala's, constructor-chaining is mandatory in that language.) Here the primary constructor would be: public BankAccount(double initialBalance){ balance = initialBalance; lastAssignedNumber++; accountNumber = lastAssignedNumber; } and add a secondary constructor: public BankAccount() { this(0); } and you will get an id generated regardless of which you call. (This is similar to Lorenzo's answer, which I upvoted for clearly describing the problem. The difference is that his chaining is going in the other direction, so that the default value gets assigned and then overwritten.)
upvote count: 1
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/comment/35438364
comment on: http://stackoverflow.com/a/23166234
type: Comment
has text: @user3550919 Try opening up your browser's network console. When you click the submit button, what requests does the console say is sent?
score: 0
type: AnswerComment

http://stackoverflow.com/comment/35494817
has text: Whether the unguarded `get()` can throw exceptions is implementation-specific, and the conditions that lead to problems have varied over the years. In some versions, it was reported that an infinite loop could occur, so you wouldn't even get an exception to ignore. There are better solutions that are efficient and guaranteed to be correct by the Java memory model.
type: Comment
score: 1
comment on: http://stackoverflow.com/a/23202696
type: AnswerComment

jbutton
tags question: http://stackoverflow.com/q/23245725
tags question: http://stackoverflow.com/q/23207987
tags question: http://stackoverflow.com/q/23252229
tags question: http://stackoverflow.com/q/23177932
tags question: http://stackoverflow.com/q/23140907
tags question: http://stackoverflow.com/q/23259662
tags question: http://stackoverflow.com/q/23177807
tags question: http://stackoverflow.com/q/23255669
tags question: http://stackoverflow.com/q/23258889
type: Tag
tags question: http://stackoverflow.com/q/23181288
tags question: http://stackoverflow.com/q/23137331
tags question: http://stackoverflow.com/q/23242063
tags question: http://stackoverflow.com/q/23260801
tags question: http://stackoverflow.com/q/23249399
tags question: http://stackoverflow.com/q/23178563
tags question: http://stackoverflow.com/q/23266605
tags question: http://stackoverflow.com/q/23206079
tags question: http://stackoverflow.com/q/23263009
tags question: http://stackoverflow.com/q/23223174
tags question: http://stackoverflow.com/q/23144873
tags question: http://stackoverflow.com/q/23149150
tags question: http://stackoverflow.com/q/23244905
tag name: jbutton

http://stackoverflow.com/comment/35597823
comment on: http://stackoverflow.com/q/23241078
has text: I can paste the URL in a browser of the browser embedded in the Notes client, and I get a response. the code is similar as in this example: http://stackoverflow.com/questions/20696245/java-nullpointerexception-in-java-agent . so when I invoke the domino agent it seems to me I can not establish the http connection. am i wrong?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23209349
accepted answer of: http://stackoverflow.com/q/23208998
score: 1
has body: This should be enough to get you started. I leave implementing hexDecode and sorting out malformed input as an exercise for you. public String decode(String encoded) { StringBuilder sb = new StringBuilder(); for (int i = 0; i &lt; encoded.length(); i++) { if (encoded.charAt(i) == '\' &amp;&amp; (i + 3) &lt; encoded.length() &amp;&amp; encoded.charAt(i + 1) == 'x') { sb.append(hexDecode(encoded.substring(i + 2, i + 4))); i += 3; } else { sb.append(encoded.charAt(i)); } } return sb.toString; }
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23208998
type: Answer
upvote count: 1

http://stackoverflow.com/comment/134981992
has text: After fixing what?
comment on: http://stackoverflow.com/a/23271089
score: 1
type: AnswerComment
type: Comment

http://stackoverflow.com/q/23239991
type: Question
has title: Exception Exception: s4s-elt-invalid-content. Element 'assert' is invalid, misplaced, or occurs too often
tagged with: java
has comment: http://stackoverflow.com/comment/35593640
has comment: http://stackoverflow.com/comment/35593721
tagged with: saxparser
has body: Currently i am using Altova IDE for desgning XSD now in Altove XSD looks ok and validate the XMl, but whenever i am trying to Validating XML against same XSD in Java code it will give me Exception, I am using XSD 1.1 version. I have used All and assert tag in XSD. My Java code is: import java.io.File; import java.io.IOException; import javax.xml.XMLConstants; import javax.xml.transform.stream.StreamSource; import javax.xml.validation.Schema; import javax.xml.validation.SchemaFactory; import javax.xml.validation.Validator; import org.xml.sax.SAXException; public class XMLValidation { public static void main(String[] args) { System.out.println("SampleXML_1 validates against final_schema.xsd? Status is :"+validateXMLSchema("src/final_schema.xsd", "src/SampleXML_1.xml")); } public static boolean validateXMLSchema(String xsdPath, String xmlPath){ try { SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); Schema schema = factory.newSchema(new File(xsdPath)); Validator validator = schema.newValidator(); validator.validate(new StreamSource(new File(xmlPath))); } catch (IOException | SAXException e) { System.out.println("Exception: "+e.getMessage()); return false; } return true; } } I have tries this also: factory.setProperty("http://saxon.sf.net/feature/xsd-version", "1.1"); My XSD Code. &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:vc="http://www.w3.org/2007/XMLSchema-versioning" elementFormDefault="qualified" vc:minVersion="1.1"&gt; &lt;xs:element name="modes"&gt; &lt;xs:complexType&gt; &lt;xs:sequence&gt; &lt;xs:element ref="A" minOccurs="0" maxOccurs="unbounded"/&gt; &lt;/xs:sequence&gt; &lt;/xs:complexType&gt; &lt;/xs:element&gt; &lt;xs:attributeGroup name="enabled-attributes"&gt; &lt;xs:attribute name="attr1" type="xs:string" use="optional"/&gt; &lt;xs:attribute name="attr2" type="xs:string" use="optional"/&gt; &lt;/xs:attributeGroup&gt; &lt;xs:attributeGroup name="disable…
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/35568281
tagged with: xsd
tagged with: http://stackoverflow.com/tag/xml
answer count: 0
type: UnansweredQuestion
score: 1
tagged with: xsd-validation
upvote count: 1
has comment: http://stackoverflow.com/comment/35593770

http://stackoverflow.com/q/23241363
answer count: 2
downvote count: 0
has body: Reading the Esper documentation I would like to make use of on-demand queries. However, is it possible to create an on-demand query that runs for a certain amount of time? Does Esper support this or would I need to write my own implementation, I know I should use prepared statements for repeated executions. Esper Documentation: http://esper.codehaus.org/esper-4.0.0/doc/reference/en/html/api.html#api-runtime
favorite count: 0
accepted answer: http://stackoverflow.com/a/23243305
tagged with: esper
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/23248150
type: Question
has answer: http://stackoverflow.com/a/23243305
possible better answer: http://stackoverflow.com/a/23248150
has title: Esper Repeated On-Demand Queries

http://stackoverflow.com/q/23272460
answer count: 2
favorite count: 0
type: AnsweredQuestion
score: 2
has answer: http://stackoverflow.com/a/61461865
has title: GSON "NoClassDefFoundError com/google/gson/Gson"
downvote count: 0
tagged with: java
tagged with: gson
type: Question
has answer: http://stackoverflow.com/a/23272795
has body: I'm trying to get gson to work on a java project, but get the above error every time I run it. I am not using any flash IDEs, just vim and every question I have seen related to my question is to do with eclipse and their deployment settings. I hope someone can spot something wrong in my tactics. Note: I have the gson jar file renamed to gson.jar To compile my code: javac myProgram.java -cp gson.jar and to run my code: java myProgram -cp gson.jar The program will compile fine, but it will throw an error as soon as I attempt to initiliaze a Gson object. Full error: Exception in thread "main" java.lang.NoClassDefFoundError: com/google/gson/Gson
accepted answer: http://stackoverflow.com/a/23272795
upvote count: 2
possible better answer: http://stackoverflow.com/a/61461865

http://stackoverflow.com/comment/88876411
type: AnswerComment
type: Comment
has text: are you able to provide me links on how to do this in nginx? Or perhaps a sample config file in nginx. I would really appreciate it. Thanks! Artranis.
comment on: http://stackoverflow.com/a/23291884
score: 0

http://stackoverflow.com/q/23162703
favorite count: 0
accepted answer: http://stackoverflow.com/a/23162754
tagged with: flowlayout
has title: Cannot see anything in Flow Layout
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23162754
type: Question
tagged with: java
score: 0
upvote count: 1
downvote count: 1
answer count: 1
has body: I coded a application so far so it only shows the widgets so I can see if everything is in order before I add Action Listeners and such. The problem is when I run it, nothing shows up at all, just a blank screen. I attached a picture of what the layout should look like. I am new to this website so apparently I cannot post any images until 10 rep. Here is a link to PhotoBucket. http://i930.photobucket.com/albums/ad149/Wolverino5/pic_zpsa4599592.png Here is my code so far. import javax.swing.*; import java.awt.*; import java.awt.event.*; public class Project9 extends JFrame { private JTextField idLabel; private JTextField idField; private JTextField priceLabel; private JTextField priceField; private JTextField numInStockLabel; private JTextField numInStockField; private JTextField codeLabel; private JTextField codeField; private JTextField transaction; private JButton insert; private JButton delete; private JButton display; private JButton displayOne; private JButton hide; private JButton clear; private Container c = getContentPane(); public static void main(String[] args) { JFrame frame = new JFrame(); frame.setSize(650,700); frame.setVisible(true); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } public Project9() { setTitle("BOOK DataBase Application"); c.setLayout(new FlowLayout()); Label main = new Label("Data Entry: Best Bargian Book Store"); c.add(main); idLabel = new JTextField("Enter ID",15); idLabel.setEditable(false); c.add(idLabel); idField = new JTextField(); c.add(idField); priceLabel = new JTextField("Enter Price:",15); priceLabel.setEditable(false); c.add(priceLabel); priceField = new JTextField(); c.add(priceField); numInStockLabel = new JTextField("Enter Number In Stock:",15); numInStockLabel.setEditable(false); c.add(numInStockLabel); numInStockField = new JTextField(); c.add(numInStockField); codeLabel = new JTextField("Enter Code: 1,2,3 or 4:",15); codeLabel.setEditable(false); c.add(codeLabel); codeField = new JTextField(); c.add(codeField…

ruby
tags question: http://stackoverflow.com/q/23181615
tag name: ruby
tags question: http://stackoverflow.com/q/23248604
type: Tag
tags question: http://stackoverflow.com/q/23266223

http://stackoverflow.com/q/23209280
has comment: http://stackoverflow.com/comment/35503591
score: -1
has comment: http://stackoverflow.com/comment/35503540
has body: I'm transitioning from Java 1.6 to 7. It compiles, but gives an incompatible types error on my switch statement which is using a string (compiler complains that it should be an int type): switch ("hello") { ... } thus, I don't think it's seeing version 7. However, when I type java -version I see: java version "1.7.0_25" Java(TM) SE Runtime Environment (build 1.7.0_25-b15) Java HotSpot(TM) 64-Bit Server VM (build 23.25-b01, mixed mode) When I type javac -version it shows javac 1.6.0_30. How to fix this?
has comment: http://stackoverflow.com/comment/35503809
has answer: http://stackoverflow.com/a/23209378
has comment: http://stackoverflow.com/comment/35503632
answer count: 2
has comment: http://stackoverflow.com/comment/35503738
favorite count: 0
has comment: http://stackoverflow.com/comment/35503872
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23439757
has comment: http://stackoverflow.com/comment/35503573
tagged with: java
has comment: http://stackoverflow.com/comment/35503766
has title: Java: how to ensure command-line compiling uses correct java version?
has comment: http://stackoverflow.com/comment/35503515
downvote count: 1
type: Question
upvote count: 0

http://stackoverflow.com/comment/35592369
type: Comment
comment on: http://stackoverflow.com/a/23258740
type: AnswerComment
has text: it told me to use BorderLayout
score: 0

http://stackoverflow.com/q/23206054
type: UnansweredQuestion
score: -4
has comment: http://stackoverflow.com/comment/35497540
type: Question
has comment: http://stackoverflow.com/comment/35497589
has title: how to fix an error when calling a method?
favorite count: 0
answer count: 1
tagged with: java
downvote count: 4
has answer: http://stackoverflow.com/a/23206213
has comment: http://stackoverflow.com/comment/35497588
upvote count: 0
has body: I have to call the method that takes an array list of parameter and moves the minimum value in front of the list. I keep getting an error int this line: System.out.printf("Display numbers\n", myList.minInteger); Here's the code: import java.util.*; public class MinToFront{ public static void main (String [] args){ MinToFront myList = new MinToFront(); ArrayList&lt;Integer&gt; list = new ArrayList&lt;Integer&gt;(); list.add(3); list.add(8); list.add(92); list.add(4); list.add(2); list.add(17); list.add(9); myList.minToFront(list); System.out.printf("Display numbers\n", myList.minInteger); }// end of main public static void minToFront (ArrayList&lt;Integer&gt; minInteger){ int result = 0; int min = minInteger.get(0); for (int i = 0; i &lt; minInteger.size(); i++){ if (minInteger.get(i)&lt; min) { min = minInteger.get(i); result = min; } } minInteger.add(0, minInteger.remove(result)); }// end of method }//end of class

http://stackoverflow.com/q/23284421
has comment: http://stackoverflow.com/comment/35644245
type: Question
score: 9
possible better answer: http://stackoverflow.com/a/29451832
upvote count: 9
has answer: http://stackoverflow.com/a/29451832
has comment: http://stackoverflow.com/comment/35665010
linked to: http://stackoverflow.com/q/21833537
answer count: 2
tagged with: functional-interface
downvote count: 0
has answer: http://stackoverflow.com/a/23284422
has body: I am using an interface that looks something along the lines of this: public interface ObjectListener { public void objectAdded(Object o); public void objectRemoved(Object o); } And I am currently using an anonymous class to implement the interface, but I don't care about one of the two methods. Something along the lines of this: someObject.addListener(new ObjectListener() { @Override public void objectAdded(Object o) { doSomething(o); } @Override public void objectRemoved(Object o) {} }); Now, I've been using the new lambda expressions in Java 8 wherever I'm able, and I would like to use the added simplicity in a situation like this. After all, I'm only implementing one of the methods, but since there are two methods in the interface, I can't use it in a lambda expression. Is there a way for me to get around this restriction?
favorite count: 0
has title: Is there a way to turn an existing interface into a functional interface?
tagged with: lambda
tagged with: java-8
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23284422
tagged with: java

http://stackoverflow.com/a/23135720
upvote count: 1
type: Answer
has body: Hi dude you can create dir in hadoop. hadoop fs -mkdir /user/dirname
downvote count: 0
has comment: http://stackoverflow.com/comment/35373928
score: 1
answers question: http://stackoverflow.com/q/23135444

http://stackoverflow.com/comment/35454913
comment on: http://stackoverflow.com/q/23181844
has text: The problem is probably elsewhere. Is `number` possibly a static member of `Entry`?
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/35649517
has text: Change it where, exactly?
comment on: http://stackoverflow.com/a/23289108
type: AnswerComment
type: Comment
score: 1

http://stackoverflow.com/q/23224826
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/31726504
has body: Does anyone know how to add a tooltip to a column header in a TableView ? There are many places where are explained how to add the tooltip to data cells, but I didn't find a way to add the tooltip to header. Using the tool ScenicView, I can see that the headers are Labels inside a TableColumnHeader object, but It seems that It is not a public object. Any suggestions ?
tagged with: java
tagged with: javafx
has answer: http://stackoverflow.com/a/23224903
type: Question
has answer: http://stackoverflow.com/a/43383187
downvote count: 0
tagged with: javafx-8
answer count: 3
tagged with: user-interface
accepted answer: http://stackoverflow.com/a/23224903
favorite count: 0
score: 16
tagged with: java-8
has title: How to add a tooltip to a TableView header cell in JavaFX 8
upvote count: 16
possible better answer: http://stackoverflow.com/a/31726504

http://stackoverflow.com/q/23281399
score: 0
answer count: 2
tagged with: binary-tree
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/23281600
has title: Finding the depth of a Binary Tree
type: Question
has body: Hi I am trying to find the depth of the binary tree. I was trying a different method than the conventional way to do it. My logic is trying to find max of the levels while doing a depth traversal. Following is the code. This approach is not working as the max value is always zero once it reaches the else part. I am not understanding why. public class BinaryTree { public static void main(String args[]) { Node root = new Node(1); Node two = new Node(2); Node three = new Node(3); Node four = new Node(4); Node five = new Node(5); Node six = new Node(6); Node seven = new Node(7); Node eight = new Node(8); root.left = two; root.right = three; two.left = four; two.right = five; three.left = six; three.right = seven; five.left = eight; findDepth(root,0,0); } public static void findDepth(Node root,int level, int max) { if(root==null) return ; else{ if(root.left==null &amp;&amp; root.right==null) { if(max&lt;level) { max=level; } level=level-1; } findDepth(root.left,level+1,max); findDepth(root.right,level+1,max); } } } // The Node class public class Node { int data; Node left; Node right; public Node(int i) { this.data = i; } } I did this and it worked perfectly public static int findDepth(Node root,int level, int max1, String str) { if(root==null) return 0; if(max&lt;level) { max=level; } findDepth(root.left,level+1,max,"left"); findDepth(root.right,level+1,max,"right"); return max; } Here max is static member of the class. But i want to point out to another article in stack overflow where they said the value will propagate down to the next recursive call. Print all paths from root to leaf in a Binary tree Here the old value of list is getting propagated to all recursive calls
linked to: http://stackoverflow.com/q/18854264
possible better answer: http://stackoverflow.com/a/23281710
accepted answer: http://stackoverflow.com/a/23281600
has answer: http://stackoverflow.com/a/23281710

http://stackoverflow.com/a/23136394
downvote count: 0
type: AcceptedAnswer
has body: This is the way you specify the generic type to a static method. It has been available since generics were released in Java 5. List&lt;String&gt; emptyListOfStrings = Collections.&lt;String&gt; emptyList(); In your case both forms work fine because the getController method returns an object of the specified generic type. See here for a discussion.
type: Answer
accepted answer of: http://stackoverflow.com/q/23135799
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/23135799

http://stackoverflow.com/comment/35446643
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23175969
has text: Whether your approach might deadlock really depends on what your threads are doing, your implementation, what resources are being held, etc. I think your approach looks sound (other than using Thread.stop), but that doesn't mean there aren't opportunities for deadlocks.

http://stackoverflow.com/comment/35888789
type: AnswerComment
comment on: http://stackoverflow.com/a/23397113
has text: @lpiepiora Thank you for your solution! What I actually need is to binding all the HTTP headers into one object. So I have to create a custom binding. And I am sorry about the late reply. I was working on several projects so I haven't have a chance to try your solution. I will reply once I verify it. It should be early next week! Thanks again!
type: Comment
score: 0

http://stackoverflow.com/comment/35590706
score: 2
type: Comment
comment on: http://stackoverflow.com/q/23257844
type: QuestionComment
has text: You may want to (1) briefly summarize the problem statement here, (2) perhaps add a high-level description of your code, or some comments, and (3) include some screenshots of desired versus actual results.

http://stackoverflow.com/q/23286291
has comment: http://stackoverflow.com/comment/35644422
has body: Is it compulsory to override the methods equals() and hashCode() for final classes? Note : as all Wrapper classes are final and immutable and overrides the equals and hashCode methods. Thanks in advance
has answer: http://stackoverflow.com/a/23286325
accepted answer: http://stackoverflow.com/a/23286325
upvote count: 2
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/35644458
score: 2
tagged with: equals
has title: Is it compulsory to override equals() and hashCode() methods for final classes
type: Question
has comment: http://stackoverflow.com/comment/35643773
type: AnsweredQuestion
tagged with: hashcode
tagged with: java

http://stackoverflow.com/comment/35610304
has text: Thank you @dcharms for your answer. Unfortunately the "Cannot resolve symbol" message just shifted from "builder" to "getConstructors". =(
score: 0
comment on: http://stackoverflow.com/a/23257336
type: AnswerComment
type: Comment

http://stackoverflow.com/q/23194519
type: AnsweredQuestion
tagged with: java.util.scanner
upvote count: 1
type: Question
score: 1
tagged with: java
has title: Using Scanner, and nextLine for ending programm
has answer: http://stackoverflow.com/a/23194722
downvote count: 0
answer count: 1
favorite count: 0
has body: i am supposed to create a program which keeps reading user input from the command line until the user types quit I shall also use the indexOf to get the position of all space characters. I tried following: import java.util.Scanner; import java.lang.String; public class Aufgabe6b { public static void main(String[] args) { Scanner scanner=new Scanner(System.in); String a; System.out.println("Bitte Eingabe machen!"); while(true){ a=scanner.nextLine(); if("quit".equals(a)){ break; } } System.out.println(a.indexOf(" ")); } } While a.indexOf is only giving me the position of the first " " it founds, i still have an issue with the scanner and the quit. If i type: Hello this is a test quit, it doesnt quit. if i type just quit, it breaks of the queue. if i type quit hello this ist a test, i doesnt quit. I am supposed only to use indexOf and the Scanner as well as the nextLine method. Is this possible, what did i wrong?
accepted answer: http://stackoverflow.com/a/23194722

http://stackoverflow.com/q/23170836
has comment: http://stackoverflow.com/comment/35435543
answer count: 2
tagged with: sqlite
has answer: http://stackoverflow.com/a/54797910
favorite count: 0
has answer: http://stackoverflow.com/a/30662412
upvote count: 5
type: UnansweredQuestion
has title: JDBC for SQLCipher
tagged with: sqlcipher
tagged with: jdbc
has comment: http://stackoverflow.com/comment/35435442
has comment: http://stackoverflow.com/comment/35497598
downvote count: 0
tagged with: java
type: Question
score: 5
has comment: http://stackoverflow.com/comment/35438418
has body: Is there any JDBC driver exist for SQLCipher? I want to write program with javaSE and encrypted SQLite. I searched on the Internet and found nothing much on SQLCipher JDBC. Or any other free solution on encrypted SQLite beside using SQLCipher? I'm using JavaSE.

http://stackoverflow.com/comment/138238335
score: 0
type: AnswerComment
type: Comment
has text: this answer can be merged https://stackoverflow.com/a/70985786/15435022
comment on: http://stackoverflow.com/a/67112502

http://stackoverflow.com/q/23175625
tagged with: bounce
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23175768
tagged with: java
type: Question
answer count: 1
tagged with: gravity
tagged with: position
has title: Gravity in a Java ball bouncing program that refreshes every game tick
score: 0
has body: Hey I am trying to figure out the best way to implement gravity in my program that is simply a ball bouncing. The program uses a method that is called 50 times a second (the rate at which the gametimer ticks) and in this method I call the gravity method. In the gravity method I currently have public void Gravity(){ this.currentPositionY = this.currentPositionY + 9; if (this.currentPositionY &gt;= 581){ this.currentPositionY=581; } } Problems with my code: In gravity velocity is not constant it varies with the time, but I am unsure of how to implement time with the gravity method being called so often. Also currently I have it so that the ball stops at 581, so that it does not fall through the screen. How would I implement a bounce that is higher when the ball falls for longer and shorter when the ball falls less? Thanks for your time!
has answer: http://stackoverflow.com/a/23175768

http://stackoverflow.com/comment/35494987
type: Comment
type: QuestionComment
has text: There is no error. there is problem with method xDD, i dont know what should i do
comment on: http://stackoverflow.com/q/23204373
score: 0

http://stackoverflow.com/q/23289064
tagged with: java
has comment: http://stackoverflow.com/comment/35650451
has answer: http://stackoverflow.com/a/23289324
has comment: http://stackoverflow.com/comment/35649709
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25756820
has title: Java GUI MasterMind
downvote count: 0
score: 1
favorite count: 0
type: Question
answer count: 2
upvote count: 1
has body: I am going to make a game in Java which is Number Mastermind. Now the AI generates 4 numbers from 1-6 and then the user has to guess it. Now I've got 20 mins of GUI interface and I'm struggling on how to best approach this and the use of the layouts. But my question is this: If a random number is 1122 how do I compare it to a guess and output values according to the users input. For example 1122 and the user guesses 1133 how can I output RRWW r means correct number and location and W means wrong? Not been doing java too long so kinda new to me.

http://stackoverflow.com/comment/35601112
has text: For hiding you must have to use POST method to send data
type: Comment
comment on: http://stackoverflow.com/a/23263344
score: 0
type: AnswerComment

http://stackoverflow.com/a/23155004
accepted answer of: http://stackoverflow.com/q/23154116
has body: An offline discussion with @Ali revealed that he was using an old version of the ADT that does not create the libs folder as shown in the folder hierarchy on the android developers web site Manually creating this folder solved the problem for him. Note: The name of the folder is libs with a "s" at the end. It is easy to miss that and create lib instead.
answers question: http://stackoverflow.com/q/23154116
upvote count: 2
type: Answer
score: 2
downvote count: 0
type: AcceptedAnswer

http://stackoverflow.com/q/23225450
has title: Swing Components Doubling
type: UnansweredQuestion
tagged with: swing
tagged with: java
type: Question
answer count: 2
has body: So I am trying to create a simple paint program and I have been having a problem. The program has a window, on the left of the window is a bar with pen size control, and the rest of the window is the drawing pane. However, whenever I draw on the pane, the side bar is basically copied onto the pane, but it can be drawn over. Here is my CHPaint class (main): package paint; import java.awt.BorderLayout; import java.awt.Color; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.awt.event.MouseMotionListener; import javax.swing.BoxLayout; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; public class CHPaint{ JFrame frame; JLabel penSizeLabel; PaintPanel panel; JButton upButton; JButton downButton; JPanel left; JPanel main; int penSize = 1; public static void main(String[] args){ CHPaint gui = new CHPaint(); System.out.println("gui built"); gui.go(); } public void go() { frame = new JFrame("Caleb's Paint"); panel = new PaintPanel(); upButton = new JButton("Up"); downButton = new JButton("Down"); penSizeLabel = new JLabel("Size: " + penSize); left = new JPanel(); main = new JPanel(); panel.addMouseListener(new Painting()); panel.addMouseMotionListener(new Painting()); upButton.addActionListener(new UpButton()); downButton.addActionListener(new DownButton()); left.setLayout(new BoxLayout(left, BoxLayout.Y_AXIS)); main.setLayout(new BorderLayout()); left.add(upButton); left.add(penSizeLabel); left.add(downButton); left.setBackground(Color.gray); penSizeLabel.setBackground(Color.gray); frame.getContentPane().add(BorderLayout.CENTER, main); main.add(BorderLayout.WEST, left); main.add(BorderLayout.CENTER, panel); frame.setSize(600, 600); frame.setVisible(true); } class UpButton implements ActionListener{ public void actionPerformed(ActionEvent e){ panel.changePenSize(1); penSize++; penSizeLabel.setText("Size: " + pen…
has comment: http://stackoverflow.com/comment/35532472
has comment: http://stackoverflow.com/comment/35531883
has answer: http://stackoverflow.com/a/23229026
score: 0
has comment: http://stackoverflow.com/comment/35538590
has answer: http://stackoverflow.com/a/23229132

http://stackoverflow.com/comment/36111576
type: Comment
type: QuestionComment
has text: I've [cross-posted your question to the jOOQ user group](https://groups.google.com/forum/#!topic/jooq-user/J620BGd-o6Q). Very interesting question, let's see if someone can share their experience
comment on: http://stackoverflow.com/q/23187622
score: 0

http://stackoverflow.com/a/23173031
has comment: http://stackoverflow.com/comment/35439786
has body: I would agree that your current algorithm might not perform well. If you say your matrix has dimension M*N, a runtime analysis might look like: max_val = get_max_val(); // O(M*N) for i from max_val to 0: // O(max_val) // O(M*N) for x from 0 to M: for y from 0 to N: do_stuff; In other words, this works out to O(M*N*max_val). This is dangerous if your max_val is very large; especially since the actual algorithm doesn't have to depend on what the values are (just which ones are the same). An alternative algorithm which only depends on M and N: HashMap&lt;Integer, ArrayList&lt;Coords&gt;&gt; coordsMap = new HashMap&lt;Integer, ArrayList&lt;Coords&gt;&gt;(); for (int i = 0; i &lt; labels.length; i++) { for (int j = 0; j &lt; labels[i].length; j++) { if (coordsMap.containsKey(labels[i][j])) { ArrayList&lt;Coords&gt; coords = coordsMap.get(labels[i][j]); coordsMap.put(labels[i][j], coords.add(new Coords(i, j)); } } } // collect results ArrayList&lt;ArrayList&lt;Coords&gt;&gt; coordsList = new ArrayList&lt;ArrayList&lt;Coords&gt;&gt;(); for (Integer label : coordsMap.keySet()) { coordsList.add(coordsMap.get(label)); } return coordsList; The runtime on this is M*N*(HashMap get/put time). If you want to have an ArrayList for every value from 0 to max_val, where an absence of coordinates with that label is represented by an empty ArrayList, you could change the // collect results portion to look something like: // collect results for (int i = 0; i &lt; max_val; i++) { if (coordsMap.containsKey(i)) { coordsList.add(coordsMap.get(i)); } else { coordsList.add(new ArrayList&lt;Coords&gt;()); } } As Marco13's comment on your question suggests, the actual performance will likely depend somewhat on how your data actually looks.
downvote count: 0
has comment: http://stackoverflow.com/comment/35440115
type: Answer
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/23172602
has comment: http://stackoverflow.com/comment/35439621

io
tags question: http://stackoverflow.com/q/23229046
tags question: http://stackoverflow.com/q/23195620
tags question: http://stackoverflow.com/q/23210603
tags question: http://stackoverflow.com/q/23190596
tags question: http://stackoverflow.com/q/23160471
tags question: http://stackoverflow.com/q/23135184
tag name: io
tags question: http://stackoverflow.com/q/23205605
tags question: http://stackoverflow.com/q/23131857
tags question: http://stackoverflow.com/q/23248474
tags question: http://stackoverflow.com/q/23235150
tags question: http://stackoverflow.com/q/23230422
tags question: http://stackoverflow.com/q/23215933
type: Tag
tags question: http://stackoverflow.com/q/23217918
tags question: http://stackoverflow.com/q/23154704
tags question: http://stackoverflow.com/q/23167319
tags question: http://stackoverflow.com/q/23251346
tags question: http://stackoverflow.com/q/23143655
tags question: http://stackoverflow.com/q/23134548

http://stackoverflow.com/comment/35584489
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/23232761
score: 0
has text: I have edited 1st post... Newistance in println is null... look MainActivity and arrivi.java in -------RE EDITED------

http://stackoverflow.com/q/23212154
has body: I need to make a generic SwingWorker process to use it in all my program. My class is like this: public class LoadingSwingWorker extends SwingWorker&lt;Integer, Integer&gt; { private WaitingDiag diag; private Statistics st = new Statistics(); public LoadingSwingWorker(GraphEditor editor, Statistics st) { //st variable this.st = st; Window mainWindow = SwingUtilities.windowForComponent(editor .getGraphComponent().getParent()); diag = new WaitingDiag(mainWindow, "Loading data..."); } @Override protected Integer doInBackground() throws Exception { st.loadInitialData(); //st method return 42; } @Override protected void done() { diag.dispose(); } public void openDiag() { diag.setVisible(true); } } For all my program, I may need to create SwingWorker classes as much as I need for long_time tasks (st variable in that case), is not possible to implement generic one
score: 0
answer count: 0
type: UnansweredQuestion
tagged with: swing
has title: Reusable SwingWorker sub-class for whole program
has comment: http://stackoverflow.com/comment/35508757
tagged with: java
has comment: http://stackoverflow.com/comment/35508477
has comment: http://stackoverflow.com/comment/35508421
type: Question
tagged with: swingworker

http://stackoverflow.com/comment/35559657
type: QuestionComment
has text: It seems that your set contains something like "name", "description" and "location_id", in that order. And the isLocationExists() method returns false
score: 0
comment on: http://stackoverflow.com/q/23240702
type: Comment

http://stackoverflow.com/q/23207339
tagged with: c++
has body: I'm writing a simple UI activity, the intention of which is to create an offscreen OpenGL surface and have a GL test render into it in a background GL thread. The rendering should start at a click of the button and the TextView should display some environment information (OpenGL version, etc.) as well as the test progress (as it may take a while) and result. In the sample I'm providing I have a 5 second delay in the 'run' function of the Runnable, but in the actual app code I have a JNI call to a native library that has the GL rendering code. I've verified that the problem I'm experiencing exists with the 5 second delay as well as the original JNI call. The problem is that while the test is running (a 5 second delay in this sample), UI seems to be frozen and does not update until the test is done. The text that I'm setting to my TextView only appears when the test is finished. I thought that "queueEvent(new TestRunnable());" starts the runnable in a separate GL thread so that UI thread can continue with no interruptions, but it does not seem to be the case, or something else is missing. Do you guys/gals have any idea what I'm doing wrong? The simplified layout: &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:keepScreenOn="true" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"&gt; &lt;Button android:id="@+id/startTestButton" android:textSize="18sp" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/startTestButton" android:onClick="onStartTestClick"/&gt; &lt;ScrollView android:layout_width="wrap_content" android:layout_height="wrap_content"&gt; &lt;TextView android:id="@+id/logView" android:textSize="18sp" android:layout_width="wrap_content" android:layout_height="wrap_content" /&gt; &lt;/ScrollView&gt; &lt;com.company.name.MyView android:id="@+id/myView" android:layout_width="match_parent" android:layout_height="match_parent"/&gt; &lt;/…
tagged with: java
answer count: 0
type: UnansweredQuestion
has title: UI update with GLSurfaceView
downvote count: 0
score: 1
tagged with: opengl-es
favorite count: 0
type: Question
tagged with: multithreading
tagged with: android
upvote count: 1

http://stackoverflow.com/comment/35561164
type: QuestionComment
comment on: http://stackoverflow.com/q/23241708
has text: try jackson , Gson etc.
score: 0
type: Comment

http://stackoverflow.com/q/23241287
has body: In my MainActivity I call this code to change to a new fragment, I pass a bundle with parcelable object, itemModel to the fragment: Bundle bundle = new Bundle(); bundle.putParcelable(ItemModel.ParcelableKey, itemModel); fragment = new AppFragment(); fragment.setArguments(bundle); FragmentTransaction ft = getFragmentManager().beginTransaction(); ft.replace(R.id.frame_container, fragment).addToBackStack(null).commit(); In the fragment, I receive the parcel back like this: public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { super.onCreate(savedInstanceState); mItemModel = getArguments().getParcelable(ItemModel.ParcelableKey); //....other code..... } When I test it locally, the code works fine on my test device, mItemModel is able to be retrieved back properly, however, I have integrated crash report system into the app (Crashlytics), and the report states a log like this on a release: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.temp.test/com.temp.test.MainActivity}: java.lang.NullPointerException at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2114) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2139) at android.app.ActivityThread.access$700(ActivityThread.java:143) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1241) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:137) at android.app.ActivityThread.main(ActivityThread.java:4960) at java.lang.reflect.Method.invokeNative(Method.java) at java.lang.reflect.Method.invoke(Method.java:511) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1038) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:805) at dalvik.system.NativeStart.main(NativeStart.java) Caused by: java.lang.NullPointerException at android.os.Parcel.readStringArray(Parcel.java:931) at com.temp.test.data.ItemModel.&lt;init&gt;(ItemModel.java:47…
type: UnansweredQuestion
upvote count: 1
type: Question
tagged with: android-fragments
tagged with: java
tagged with: parcelable
downvote count: 0
score: 1
favorite count: 0
tagged with: android
has comment: http://stackoverflow.com/comment/35562152
has title: Why does getArguments().getParcelable(key) behave differently in local test device vs production release?
has comment: http://stackoverflow.com/comment/35560485
answer count: 0

http://stackoverflow.com/comment/35403780
comment on: http://stackoverflow.com/a/23148576
score: 0
type: Comment
has text: I comment out 'myStringList = toStringList(entryLogs);' and debugged. I can clearly see after `entryLogs.add(dl);` in the value of entryLogs. the first data is replaced and a second has been inserted to the ArrayList.
type: AnswerComment

http://stackoverflow.com/comment/35532751
comment on: http://stackoverflow.com/q/23225359
has text: maybe repaint() before sleep()?
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/23162100
score: 1
has body: import org.json.JSONObject; ...... String jsonStr = "{'my_hobbies': ... }"; JSONObject jObj = new JSONObject(jsonStr);
upvote count: 1
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/23160918
answers question: http://stackoverflow.com/q/23160918
downvote count: 0

acm.graphics
tag name: acm.graphics
tags question: http://stackoverflow.com/q/23281145
type: Tag

http://stackoverflow.com/a/23169999
accepted answer of: http://stackoverflow.com/q/23168955
answers question: http://stackoverflow.com/q/23168955
type: AcceptedAnswer
score: 0
type: Answer
has body: You seem to have two textViews one with id = textView51 id = textViewC51 in your onCreate you are trying to find the first textview and pass it to another textViewC51 = (TextView) findViewById(R.id.textView51); Try to change the previous line with: textViewC51 = (TextView) findViewById(R.id.textViewC51); and see if it works for you.

http://stackoverflow.com/comment/35629615
comment on: http://stackoverflow.com/q/23277719
score: 0
has text: @MarkusWMahlberg depends on what the game is. If you have an asychronous "thinking" AI, then something else would have to be done (or it could watch for state changes in the board and then start thinking). If its a simpler game, like tic tac toe or checkers, then an AI could quickly size up the situation and make a good move. I've built a Dominion AI that needed to know almost nothing about the state of the game that was a pretty strong player
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23133593
accepted answer of: http://stackoverflow.com/q/23133525
upvote count: 2
has body: In short, both methods are fine, your String will be kept, but you should prefer method 1 as it does not create unnecessary objects, as @Paul pointed out. But A has a visibility limited to method getSomeC(..) The variable A has this visibility, not the object pointed by A. What happens inside java in this case? Does the reference A be destroyed at the end of getSomeC(.) while the object remains alive because referred by instanceofC.subject? The String object will exist outside of the method's scope, as long as some reference to it is kept somewhere. And this is the case. Indeed, a reference is kept in your C object, that's why you're fine.
type: AcceptedAnswer
downvote count: 1
has comment: http://stackoverflow.com/comment/35369049
has comment: http://stackoverflow.com/comment/35369277
type: Answer
has comment: http://stackoverflow.com/comment/35368965
score: 1
has comment: http://stackoverflow.com/comment/35368983
answers question: http://stackoverflow.com/q/23133525

http://stackoverflow.com/a/23147432
type: AcceptedAnswer
score: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/23146988
answers question: http://stackoverflow.com/q/23146988
has body: Found the problem. Guess it might help if I scan the packages in my sessionFactory.

http://stackoverflow.com/q/23179935
downvote count: 1
type: Question
score: -1
answer count: 2
upvote count: 0
tagged with: connection
favorite count: 0
has title: Java Socket: Why client don't reply server
has comment: http://stackoverflow.com/comment/35451621
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23180186
tagged with: sockets
tagged with: client
tagged with: java
has answer: http://stackoverflow.com/a/23180133
has body: I want to write a client-sever program in which server and client send messages to each other. First, my server send a message to client, then the client reply. Next, my server send another message, the client reply. The problem is, on my first message induced by the server, the client does not respond. My server: public class Server { public void go() { try { ServerSocket serverSocket = new ServerSocket(9999); System.out.println("Server listening ..."); Socket socket = serverSocket.accept(); try ( PrintWriter printWriter = new PrintWriter(socket.getOutputStream()); BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(socket.getInputStream())); ) { String input; printWriter.println(new Scanner(System.in).nextLine()); while ((input = bufferedReader.readLine()) != null) { System.out.println(input); printWriter.println(new Scanner(System.in).nextLine()); if(input == "Bye") break; } } } catch (IOException ioException) { ioException.printStackTrace(); } } public static void main(String[] args) { Server server = new Server(); server.go(); } } My client: public class Client { public void go() { try { try ( Socket socket = new Socket("localhost", 9999); PrintWriter printWriter = new PrintWriter(socket.getOutputStream()); BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(socket.getInputStream())); ) { String input; while ((input = bufferedReader.readLine()) != null) { System.out.println("1"); System.out.println(input); printWriter.println(new Scanner(System.in).nextLine()); } } } catch (UnknownHostException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } public static void main(String[] args) { Client client = new Client(); client.go(); } } Are there some problems with my code?

http://stackoverflow.com/a/23175658
has body: I don't know what your input looks like, but getPara is always going to return 0. You read a single line and pass it to getPara. In getPara the str array will always contain one element since you are attempting to split on "\r\n". You then only increment count if str.length > 1, which it never will be, so count is never incremented and the method will always return 0 (zero).
has comment: http://stackoverflow.com/comment/35443949
has comment: http://stackoverflow.com/comment/35444141
score: 0
answers question: http://stackoverflow.com/q/23175476
type: Answer
has comment: http://stackoverflow.com/comment/35443888
has comment: http://stackoverflow.com/comment/35444371

http://stackoverflow.com/a/29275676
answers question: http://stackoverflow.com/q/23152786
has body: I did it this way: public static void showOnScreen(Window frame) { GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); GraphicsDevice[] gd = ge.getScreenDevices(); final GraphicsDevice frameDevice = frame.getParent().getGraphicsConfiguration().getDevice(); for (GraphicsDevice graphicsDevice : gd) { if (frameDevice.equals(graphicsDevice) || frameDevice.getIDstring().equals(graphicsDevice.getIDstring())) { final Rectangle monitorBounds = graphicsDevice.getDefaultConfiguration().getBounds(); final int x = monitorBounds.x + (monitorBounds.width - frame.getWidth()) /2; final int y = monitorBounds.y + (monitorBounds.height - frame.getHeight()) / 2; frame.setLocation(x, y); } } } The code searches for the device the parent of the given frame uses. It then centers the frame on that specific monitor. I only tested this code in a dual monitor configuration.
type: Answer
score: 1
upvote count: 1
downvote count: 0

http://stackoverflow.com/q/23265752
tagged with: android-layout
tagged with: android-fragments
tagged with: java
type: UnansweredQuestion
tagged with: navigation-drawer
has title: Navigation Drawer xith Linear Layout Fail
type: Question
tagged with: android
has answer: http://stackoverflow.com/a/29266567
score: 0
has body: First, sorry for my bad english. In my application I want to have a Navigation Drawer on the left. It works fine if I do it with a single ListView. Now I want to do it on a Linear Layout. But it don't works. In facts, the linearLayout is displayed at the beginning and I can't hide it with sliding or home button or item on the list. When I touch an Item or Home button, the application crash. I give you my code. activity_main.xml: &lt;android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/drawer_layout" android:layout_width="match_parent" android:layout_height="match_parent" &gt; &lt;RelativeLayout xmlns:tools="http://schemas.android.com/tools" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="@color/grisFond"&gt; [ ... ] &lt;FrameLayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_above="@+id/Player" android:id="@+id/container"&gt; &lt;/FrameLayout&gt; &lt;/RelativeLayout&gt; &lt;LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/lin" android:gravity="left"&gt; &lt;ListView android:id="@+id/my_drawer" android:layout_width="248dp" android:layout_height="fill_parent" android:layout_gravity="start" android:choiceMode="singleChoice" android:divider="@android:color/transparent" android:dividerHeight="0dp" android:background="@color/fondMenu"/&gt; &lt;/LinearLayout&gt; &lt;/android.support.v4.widget.DrawerLayout&gt; I Precise that DrawerLayout is the root, and it has 2 children. The first child is the frameLayout who contains my fragments and the second one is my navigation drawer Now My MainActivity.java file: package org.witixradio.app; import android.app.ActionBar; import android.app.AlertDialog; import android.app.ProgressDialog; import android.content.Context; import android.content.DialogInterface; import android.content.res.Configuration; import android.media.AudioManager; im…
answer count: 1

http://stackoverflow.com/comment/35843684
type: QuestionComment
score: 0
has text: Suggestion: make a call of `MessageDigest.getInstance("MD5")` in your `main` method right after the application start and before you create second thread.
comment on: http://stackoverflow.com/q/23200186
type: Comment

http://stackoverflow.com/comment/35430252
type: QuestionComment
comment on: http://stackoverflow.com/q/23167830
score: 0
has text: Do you *really* need the `toHex` part? By the time you've converted it to base64, it's ASCII text anyway... as for the `SHA1` part, a search for SHA1 and Java should get you lots of hits...
type: Comment

http://stackoverflow.com/comment/35625177
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23211174
has text: I think this may be a JPA issue: Can you try a test run of the query using the low level java API: https://developers.google.com/appengine/docs/java/datastore/
score: 0

http://stackoverflow.com/q/23278148
tagged with: filenotfoundexception
has comment: http://stackoverflow.com/comment/35628444
has comment: http://stackoverflow.com/comment/35628866
answer count: 2
has comment: http://stackoverflow.com/comment/35628539
score: 2
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/35628381
upvote count: 2
type: UnansweredQuestion
tagged with: sockets
tagged with: reset
has comment: http://stackoverflow.com/comment/35628488
has comment: http://stackoverflow.com/comment/35628896
has body: Ok so I have a block of code that is supposed to send multiple files over a socket. The way I am doing this in a for loop I am opening a socket -> transferring a file -> closing socket then repeat for other files. The said code it below: for (int i = 0; i &lt; fname.size(); i++) { Socket sok = new Socket("localhost",4444); PrintStream oos = new PrintStream(sok.getOutputStream()); oos.println("1"); try { System.out.println(fname.get(i)); File myFile = new File(path+fname.get(i)); byte[] mybytearray = new byte[(int) myFile.length()]; FileInputStream fis = new FileInputStream(myFile); BufferedInputStream bis = new BufferedInputStream(fis); // bis.read(mybytearray, 0, mybytearray.length); DataInputStream dis = new DataInputStream(bis); dis.readFully(mybytearray, 0, mybytearray.length); OutputStream os = sok.getOutputStream(); // Sending file name and file size to the server DataOutputStream doss = new DataOutputStream(os); doss.writeUTF(myFile.getName()); doss.writeLong(mybytearray.length); doss.write(mybytearray, 0, mybytearray.length); doss.flush(); sok.close(); System.out.println("File " + fname.get(i) + " sent to Server."); } catch (Exception e) { System.err.println("File does not exist! (May not be true) Generated Error: "+e); } //sendFile(path+fname.get(i)); //sock.close(); } } catch (Exception e) { System.err.println(e); } Now what happens is the client doesn't spit out any errors, matter of fact, it actually says the files were sent to the server. Now the server spits out random errors. Sometimes the server receives some files (never all of them) and sometimes it receives no files and the errors that come out are random as well. The errors are one or a combination of the following: java.io.EOFException java.io.FileNotFoundException java.net.SocketException: Connection reset java.io.UTFDataFormatException All those errors are on the Server side while trying to transfer. I am not sure what is going on here =/ SERVER CODE: public void receiveFile() { try { int byte…
has answer: http://stackoverflow.com/a/23278327
tagged with: eofexception
tagged with: java
has answer: http://stackoverflow.com/a/23282516
has title: Random errors while transferring over socket
type: Question

http://stackoverflow.com/a/23217558
answers question: http://stackoverflow.com/q/23217419
has comment: http://stackoverflow.com/comment/35517789
type: Answer
has comment: http://stackoverflow.com/comment/35517618
has body: Use playerName.replace(' ', '_')
has comment: http://stackoverflow.com/comment/35517797
upvote count: 3
score: 3
has comment: http://stackoverflow.com/comment/35517636
has comment: http://stackoverflow.com/comment/35517904
has comment: http://stackoverflow.com/comment/35517568
downvote count: 0

http://stackoverflow.com/a/23144235
answers question: http://stackoverflow.com/q/23138328
type: Answer
has body: There is a multitude of known bugs regarding NullPointerException when calling EventQueue.invokeLater() after 7u25. Some of them are: 8017776, which was fixed in 8 and backported to 7u60 (b01). 8019274. Attempted fixes include this solution. The fix for 8019274 might help you if the fix for 8017776 did not.
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/37618604
has comment: http://stackoverflow.com/comment/36414389
downvote count: 0

http://stackoverflow.com/comment/35398732
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23149036
score: 0
has text: Have you tried to implement the "GQL kinda-like" query (from the python question) with the Java low level datastore API? With the datastore you can also "cheat" by storing the first N characters of the username in a separate property, and query against it with an equality filter. Sucks for sure but better than nothing...

http://stackoverflow.com/comment/35554539
score: 1
has text: @assylias - Yes - but the **best** way is to use a random sequence that is as near to a [one-time pad](http://en.wikipedia.org/wiki/One-time_pad) as possible because only a one-time pad is uncrackable. I accept that most modern algorithms would take the age of the universe to crack but they still do not beat the holy grail of the one-time pad.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23230695

http://stackoverflow.com/comment/35512381
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/23214454
type: Comment
has text: Could you commit the considered structure to the github or some other online source repository so we could check it out and try running?

http://stackoverflow.com/a/23152611
has body: If you are calculating the amount of rainfall today then you should go for Linear Regression which will best suits this problem. Since amount belongs to R(real) then it is a concrete value, if you have classification especially a binary classification then you must go with Logistic Regression. suppose there are 6 attributes in calculating the amount of rainfall today then your model must be:- y = w(0)+x(1)w(1)+x(2)w(2)+x(3)w(3)+x(4)w(4)+x(5)w(5)+x(6)w(6) y is amount of rainfall you want to predict. Where x(1)...x(6) are attributes and w(0)...w(6) what you have to calculate. Then you should a loss function which you have reduce:- Now you want to calculate w(0)...w(6). Now use gradient descent in it. //Actually i donot have any image of gradient descent but i can make you understand from this. theta(j) is w(j) and alpha is learning rate. And E is J(theta) ,t(p) is given value where y(p) is predictive value which is original y. And feature scaling is done when data is too sparse this can be done dividing all elements by maximum element.This is done to normalize the independent data.So first feature selection then scaling. More about Linear regression. Why logistic regression cannot be applied here? Because in logistic regression we get s-shaped curved which best suits for binary classification . Above 0.5 take 1 or true or below 0.5 take 0 or false. Hope this is useful to you.
has comment: http://stackoverflow.com/comment/35402673
type: Answer
score: 1
accepted answer of: http://stackoverflow.com/q/23152446
upvote count: 1
downvote count: 0
answers question: http://stackoverflow.com/q/23152446
type: AcceptedAnswer

numberformatexception
tags question: http://stackoverflow.com/q/23234688
tag name: numberformatexception
tags question: http://stackoverflow.com/q/23224596
type: Tag
tags question: http://stackoverflow.com/q/23210181

http://stackoverflow.com/a/23166909
answers question: http://stackoverflow.com/q/23166041
downvote count: 0
has body: Found that this is an issue with the Decrypter. Problem was decrypted Assertion wasn't properly rooted. By calling setRootInNewDocument(true) of the Decrypter before the decryption, you can have properly rooted Assertion. So Signature validation will succeed.
score: 3
has comment: http://stackoverflow.com/comment/58150279
upvote count: 3
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/58560279
type: Answer
accepted answer of: http://stackoverflow.com/q/23166041

http://stackoverflow.com/comment/35628912
type: Comment
type: QuestionComment
score: 1
has text: Typically, the "dostuff" functions would be able to change the machine's state.
comment on: http://stackoverflow.com/q/23278359

http://stackoverflow.com/q/23184599
linked to: http://stackoverflow.com/q/13776576
has comment: http://stackoverflow.com/comment/35459042
has answer: http://stackoverflow.com/a/23184799
duplicate of: http://stackoverflow.com/q/13776576
has body: HashMap&lt;K,V&gt; stores data as array of entry. i.e Entry&lt;K,V&gt;[] table and type of key and value inside Entry are K and V respectively. But.. ArrayList&lt;E&gt; stores data as array of object. i.e. Object[] elementData So wondering why ArrayList doesn't use array of type E ??
has comment: http://stackoverflow.com/comment/35470472
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/23184799
type: Question
score: 0
answer count: 1
has title: Implementation of type parameter in HashMap vs ArrayList
tagged with: generics
has comment: http://stackoverflow.com/comment/35459055

class
tags question: http://stackoverflow.com/q/23254133
tags question: http://stackoverflow.com/q/23232536
tags question: http://stackoverflow.com/q/23163251
tags question: http://stackoverflow.com/q/23245257
tags question: http://stackoverflow.com/q/23178196
tags question: http://stackoverflow.com/q/23251823
tags question: http://stackoverflow.com/q/23235475
tags question: http://stackoverflow.com/q/23237423
tags question: http://stackoverflow.com/q/23254958
tags question: http://stackoverflow.com/q/23171955
tags question: http://stackoverflow.com/q/23148154
tags question: http://stackoverflow.com/q/23281145
tags question: http://stackoverflow.com/q/23133952
tags question: http://stackoverflow.com/q/23180890
tags question: http://stackoverflow.com/q/23179840
tags question: http://stackoverflow.com/q/23229735
tags question: http://stackoverflow.com/q/23211800
tags question: http://stackoverflow.com/q/23262774
tags question: http://stackoverflow.com/q/23188913
tags question: http://stackoverflow.com/q/23138989
tags question: http://stackoverflow.com/q/23181799
tags question: http://stackoverflow.com/q/23280563
tags question: http://stackoverflow.com/q/23269357
tags question: http://stackoverflow.com/q/23271686
tags question: http://stackoverflow.com/q/23227465
tags question: http://stackoverflow.com/q/23167194
type: Tag
tags question: http://stackoverflow.com/q/23243413
tags question: http://stackoverflow.com/q/23276251
tags question: http://stackoverflow.com/q/23180226
tags question: http://stackoverflow.com/q/23282626
tags question: http://stackoverflow.com/q/23187843
tags question: http://stackoverflow.com/q/23180770
tags question: http://stackoverflow.com/q/23275281
tags question: http://stackoverflow.com/q/23206150
tags question: http://stackoverflow.com/q/23187111
tags question: http://stackoverflow.com/q/23273936
tags question: http://stackoverflow.com/q/23188454
tags question: http://stackoverflow.com/q/23161665
tags question: http://stackoverflow.com/q/23208018
tags question: http://stackoverflow.com/q/23250937
tag name: class
tags question: http://stackoverflow.com/q/23177770
tags question: http://stackoverflow.com/q/23161367
tags question: http://stackoverflow.com/q/23175244
tags question: http://stackoverflow.com/q/23232767
tags question: http://stackoverflow.com/q/23130817
tags question: http://stackoverflow.com/q/23167085
tags question: http://stackoverflow.com/q/23194702
tags question: http://stackoverflow.com/q/23177900
tags question: http://stackoverflow.com/q/23257093
tags question: http://stackoverflow.com/q/23174116
tags question: http://stackoverflow.com/q/23160896
tags question: http://stackoverflow.com/q/23184403

http://stackoverflow.com/q/23147895
downvote count: 0
favorite count: 0
has title: Java program runs fine in Eclipse but not as a .jar file
has comment: http://stackoverflow.com/comment/35418102
has comment: http://stackoverflow.com/comment/35415887
has comment: http://stackoverflow.com/comment/35395202
has comment: http://stackoverflow.com/comment/35397429
type: AnsweredQuestion
score: 3
upvote count: 3
tagged with: java
tagged with: eclipse
type: Question
has comment: http://stackoverflow.com/comment/35395939
has answer: http://stackoverflow.com/a/23161290
accepted answer: http://stackoverflow.com/a/23161290
tagged with: executable-jar
has comment: http://stackoverflow.com/comment/35395863
has body: I've got an issue with my .jar file. It runs fine in Eclipse but as soon as I export it, it won't open. I've checked the manifest file and it looks like it's okay. I've tried exporting it as a runnable jar, as well as just using the jar builder. Nothing worked. I've tried to run it in command prompt and it says it can't access the jar file... I've searched around a while on here and haven't found an answer yet. I'm not sure what I'm doing wrong. The only thing I can think of is I'm not getting my images correctly. I'm using .png files for the program's sprites and here's an example of how I get them for my program. This code begins the building of a level from a .png file. public class SpawnLevel extends Level{ public SpawnLevel(String path) { super(path); } protected void loadLevel(String path){ try{ System.out.println("classpath is: " + System.getProperty("java.class.path")); BufferedImage image = ImageIO.read(SpawnLevel.class.getResource(path)); int w = width = image.getWidth(); int h = height= image.getHeight(); tiles = new int[w*h]; image.getRGB(0,0,w,h,tiles,0,w); }catch(IOException e){ e.printStackTrace(); System.out.println("EXEPTION FOUND!!! Could not load the level file!"); } } protected void generateLevel(){ System.out.println("Tiles: " + tiles[0]); } } I've made one other .jar before for another program and didn't have a problem. Any help would be greatly appreciated. If it helps, I used this code to display the resource folder path information. System.out.println("classpath is: " + System.getProperty("java.class.path")); Here's what my current path for my resources folder looks like. Before I export it from eclipse. classpath is: C:\Users\name\workspace\Rpg_Game\bin;C:\Users\name\workspace\Rpg_Game\res After I export to .jar classpath is: 2ndGameTest.jar
has comment: http://stackoverflow.com/comment/35418435
answer count: 1

http://stackoverflow.com/comment/35443064
comment on: http://stackoverflow.com/a/23175078
score: 0
type: AnswerComment
type: Comment
has text: Ok, so I'm a bit confused now. I've un-static-ized everything but the singleton, and still nothing. I then tried re-static-izing everything but the Configuration, but still nothing.

http://stackoverflow.com/comment/35589522
comment on: http://stackoverflow.com/q/23250407
has text: Finally, delete the project with SWT 32bit.
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/35565449
type: AnswerComment
type: Comment
has text: Yes you need to ask the incoming [BundleEvent](http://www.osgi.org/javadoc/r4v43/core/org/osgi/framework/BundleEvent.html) for its state: static int UPDATED - The bundle has been updated.
comment on: http://stackoverflow.com/a/23243681
score: 0

http://stackoverflow.com/q/23285005
answer count: 0
downvote count: 0
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has body: I have a JSON response which I parse into an Array. This response have multiple entries with similar NewsSourceId I want to catogorize the the entries with similar NewsSourceId and assign a color to them. I have the colors in a array: String[] colorPallete =new String[] {"#1F1A17", "#62934D", "#F9B03F", "#7959BC", "#74B8DE", "#E65641", "#7CC8BB", "#D7CE5D", "#D6BE95", "#B694D1"}; JSON parsing:- private class GetList extends AsyncTask&lt;String, String, ArrayList&lt;HashMap&lt;String, String&gt;&gt;&gt;{ protected ArrayList&lt;HashMap&lt;String, String&gt;&gt; doInBackground(String... params) { // TODO Auto-generated method stub JSONArray jObject; try { jObject = new JSONArray(params[0]); for (int i = 0; i &lt; jObject.length(); i++) { JSONObject menuObject = jObject.getJSONObject(i); String title= menuObject.getString("Title"); String description= menuObject.getString("BodyText"); String thumbnail= menuObject.getString("ThumbnailPath"); String newsUrl = menuObject.getString("Url"); String body = menuObject.getString("Body"); String newsBigImage = menuObject.getString("ImageBlobUrls"); String newsComments = menuObject.getString("NumberOfComments"); String newsViews = menuObject.getString("NumberOfViews"); String publishedDate = menuObject.getString("PublishedDate"); String articleGuid = menuObject.getString("ArticleGuid"); String newsSourceId = menuObject.getString("NewsSourceId"); String newsId = menuObject.getString("ID"); String publisherName = menuObject.getString("AuthorDisplayName"); String newsSourceTitle = menuObject.getString("NewsSourceTitle"); map = new HashMap&lt;String,String&gt;(); map.put(NEWSSOURCETITLE, title); map.put(TITLE, description); map.put(THUMBNAILPATH, thumbnail); map.put(BODY, body); map.put(NEWSSOURCEID, newsSourceId); map.put(PUBLISHER,publisherName); myNewsList.add(map); } } here myNewsList is a ArrayList>. I want to pass myNewsList to a ListAdapter to display in a listview. ArrayList&lt;HashMap&lt;String, String&gt;&gt; getList = new G…
type: Question
tagged with: hashmap
has title: Add new value to Arrayrecieved from JSON android
tagged with: arraylist
upvote count: 1
favorite count: 0
type: UnansweredQuestion
tagged with: android

http://stackoverflow.com/comment/35584544
has text: jaja! you're right, probably forgot to set it back after a test or something. Thank you for pointing it out.
type: Comment
comment on: http://stackoverflow.com/q/23252974
score: 1
type: QuestionComment

http://stackoverflow.com/q/23169600
answer count: 0
type: UnansweredQuestion
type: Question
has body: Im Developing an App / a Game. I try to check the collision between EVERY OBJECT from one Arraylist and EVERY OBJECT from another Arraylist! The Problem is that with my code the collision only works for the last Object! Here is my Code (Names changed): for (Object1Class objects1 : Object1Arraylist) for (Object2Class objects2 : Object2Arraylist) { if (Intersector.overlaps(objects1.getCollisionRec(), object2.getCollisionRec())) { objects1.attack(); // And Some unimportant Methods for now } else { objects1.move(); } if (Intersector.overlaps(objects2.getCollisionRec(), objects1.getCollisionRec())) { objects2.attack(); // And Some unimportant Methods for now } else { objects2.move(); } } The ".getCollisionRec()" method gets the Rectangle that is created in the Class of the Object (Object1Class &amp; Obect2Class) and moves on top of the objects. Here is the part of classes where the Rectangle is created: CollisionRec = new Rectangle(); CollisionRec.set(position.x + 20, position.y + 30, 15, 30); and simply public Rectangle getCollisionRec() { return CollisionRec; } I really don't know what i should change so that the collision works and how i can delete the object after the collision :/
tagged with: libgdx
tagged with: java
has title: Java (LibGDX) Collision between 2 Arraylist, Only last Object collides
has comment: http://stackoverflow.com/comment/35483393
tagged with: arraylist
score: 0
tagged with: android
has comment: http://stackoverflow.com/comment/35539729
tagged with: collision
has comment: http://stackoverflow.com/comment/35567709

http://stackoverflow.com/comment/35602303
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23263610
type: Comment
has text: Thank you. I missed that part.

http://stackoverflow.com/comment/123387492
has text: Why this will be considered off-topic @Chris ? It's well programming related
score: 0
type: Comment
comment on: http://stackoverflow.com/a/69801796
type: AnswerComment

http://stackoverflow.com/comment/35420834
comment on: http://stackoverflow.com/a/23162220
score: 0
type: AnswerComment
type: Comment
has text: I already tested using Postman... now when i need to implement this through code in Java.. I was expecting it to be simple enough... to just spill the beans, maybe like create a WebService Client object, add a parameter (for eg. productId) and then execute the url. In case of update, create aJSON object and add it to the WebService Client object and execute the url. Am I simplifying this a lot? Is it more complex than that?

http://stackoverflow.com/comment/35540269
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23229751
has text: What do you mean by -1? This is an example of a custom class. If you want to sort integers, than you should use `Integer` class. It is already comparable.

http://stackoverflow.com/comment/35449284
has text: Not a good idea to reuse the ResultSet subResult without closing with query2
type: QuestionComment
comment on: http://stackoverflow.com/q/23178678
score: 0
type: Comment

http://stackoverflow.com/q/23261128
score: 12
has answer: http://stackoverflow.com/a/23270752
possible better answer: http://stackoverflow.com/a/23261485
has comment: http://stackoverflow.com/comment/35596597
accepted answer: http://stackoverflow.com/a/23261412
has answer: http://stackoverflow.com/a/23261485
has answer: http://stackoverflow.com/a/23262007
has comment: http://stackoverflow.com/comment/35606333
has comment: http://stackoverflow.com/comment/35610784
favorite count: 0
has answer: http://stackoverflow.com/a/23268387
downvote count: 1
has comment: http://stackoverflow.com/comment/35596561
upvote count: 13
has body: Let me start off by saying that this is not a homework question. I am trying to design a cache whose eviction policy depends on entries that occurred the most in the cache. In software terms, assume we have an array with different elements and we just want to find the element that occurred the most. For example: {1,2,2,5,7,3,2,3} should return 2. Since I am working with hardware, the naive O(n^2) solution would require a tremendous hardware overhead. The smarter solution of using a hash table works well for software because the hash table size can change but in hardware, I will have a fixed size hash table, probably not that big, so collisions will lead to wrong decisions. My question is, in software, can we solve the above problem in O(n) time complexity and O(1) space?
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35600978
has comment: http://stackoverflow.com/comment/35596777
tagged with: java
has comment: http://stackoverflow.com/comment/35608026
has answer: http://stackoverflow.com/a/23261412
has comment: http://stackoverflow.com/comment/35605659
has comment: http://stackoverflow.com/comment/35596827
type: Question
has answer: http://stackoverflow.com/a/23261912
has title: Determining the element that occurred the most in O(n) time and O(1) space
has comment: http://stackoverflow.com/comment/35606638
tagged with: algorithm
tagged with: http://stackoverflow.com/tag/c
answer count: 6

http://stackoverflow.com/a/23134533
has body: The problem is you are missing the variable name when instancing the game: public class GameLauncher{ public static void main(String[] args){ GuessGame game= new GuessGame(); //game is the variable game.startGame(); } }
type: AcceptedAnswer
type: Answer
score: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23134472
answers question: http://stackoverflow.com/q/23134472
upvote count: 2

http://stackoverflow.com/comment/35503542
type: AnswerComment
type: Comment
has text: if (isPowerOfTwo(i+1)== true) It has to be added + 1... that was getting mixed upp
comment on: http://stackoverflow.com/a/23209074
score: 0

http://stackoverflow.com/comment/75783598
type: Comment
score: 0
comment on: http://stackoverflow.com/a/23270294
type: AnswerComment
has text: @HarishAmarnath https://stackoverflow.com/questions/24068672/how-is-class-level-locking-achieved-in-java/24069242#24069242

http://stackoverflow.com/comment/35618310
has text: @ᴋᴇʏsᴇʀ Oh man, I feel dumb. Java habit of putting the ; at the end of a line!
comment on: http://stackoverflow.com/q/23272683
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/35619759
has text: You can have a look at: http://stackoverflow.com/questions/17554085/how-to-create-a-file-in-src-main-resources
comment on: http://stackoverflow.com/q/23273562
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35368899
type: QuestionComment
has text: I added the code for the part I'm describing above. Hope it makes more sense!
score: 0
comment on: http://stackoverflow.com/q/23133453
type: Comment

http://stackoverflow.com/a/23167596
has body: You're trying to concatenate a Date object to a String. Even if that works, then the date isn't surrounded with quotes in the query. Use SimpleDateFormat to format the Date to a String. Try this: DateFormat df = new SimpleDateFormat("MM/dd/yyyy"); String query = "select * from bill_details " + " where status='active' " + " AND date(add_date) BETWEEN date('" + df.format(startDate) + "')" + " AND date('" + df.format(endDate) + "') " + + " order by add_date desc limit " + pagesize;
upvote count: 1
has comment: http://stackoverflow.com/comment/35429834
answers question: http://stackoverflow.com/q/23167501
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/a/23139587
has body: It's better to just print the data in the toString method and add the typographical elements like '[' or comma separately accompanied with an if statement. However if you insist to stick just to the toString method, add a boolean field to the class and set it to true if something is the last object and inside the toString method, check that field and do the right decision.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23139490

http://stackoverflow.com/a/58324586
answers question: http://stackoverflow.com/q/23182576
score: 0
type: Answer
has body: The underlying cause for me was leaving out a designated "manager-script" role user in tomcat-users.xml <role rolename="manager-gui"/> <role rolename="manager-script"/> <!-- <user username="tomcatadmin" password="s3cret" roles="manager-gui"/> --> <user username="tcat-gui" password="asdf" roles="manager-gui"/> <user username="tcat-script" password="psswrd" roles="manager-script"/> So in addition to designating a manager-script role you need to create an actual manager-script user and this is the user you plug into the Web-apps POM. My environment is IntelliJ and Maven project. org.apache.maven.plugins maven-compiler-plugin 3.8.1 1.8 1.8 org.apache.tomcat.maven tomcat7-maven-plugin 2.3-SNAPSHOT http://localhost:8080/manager/text TomcatServer tcat-script psswrd Good luck!

http://stackoverflow.com/a/23162851
upvote count: 9
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23162559
answers question: http://stackoverflow.com/q/23162559
has body: It looks like your class should have an implementation of Iterable&lt;ClientInterface&gt; as a class member, like ArrayList. Let's use this as an example: public class Bus { private ArrayList&lt;Person&gt; riders; ... //constructors and other methods public Iterable&lt;Person&gt; getRiders() { return riders; } ... //other methods }
score: 9
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/a/23214374
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23213968
has comment: http://stackoverflow.com/comment/35517465
has comment: http://stackoverflow.com/comment/35577366
has comment: http://stackoverflow.com/comment/35513348
answers question: http://stackoverflow.com/q/23213968
type: Answer
has comment: http://stackoverflow.com/comment/35513453
has comment: http://stackoverflow.com/comment/35512635
score: 2
downvote count: 0
has body: Android provides already functionality (well documented) to have a multilanguage app. Instead of replacing your text and having severall versions of your app for each language, its better to use the frameworks function. In that case the app chooses a suitable language from the available languages you provided depending on the device locale settings. So basically you would start by creating the required directory structure (link above): MyProject/ res/ values/ strings.xml values-fa/ strings.xml and then you fill in String values into the files, e.g.: English (default locale), /values/strings.xml: <?xml version="1.0" encoding="utf-8"?> My Application Hello World! Persian, /values-fa/strings.xml: <?xml version="1.0" encoding="utf-8"?> ... ... (quoted and adapted from the link above) Solution for reshape farsi language The reshape function has to be used for every Farsi String value, so setting string in the XML layout isn't possible (AFAIK), so the following proposals assume, that all String values are set programatically. Using a global static wrapper function #1 public static final String getLocalizedString(int resId) { if(Locale.getDefault().toString().equals("fa_IR")) { return PersianReshape.reshape(getResources().getString(resId)); }else{ return getResources().getString(resId); } You can now use this function to load the String (you have to change each occurence) or you override e.g. the getRessource method. I personally would prefer using a static function instead of overriding because of possible other problems regarding loading resources of other type than String, side effects etc. Creating a custom class with overriding setText() for each used ui widgets #2 Another possibility is to create custom ui widgets that do a call to PersianReshape.reshape() when display. E.g. for EditText: class CustomTextField extends EditText { @Override public void setText(String text) { super.setText(PersianReshape.reshape(text)); } } [...] CustomTextField myTextBox = new CustomTe…
has comment: http://stackoverflow.com/comment/35518797
has comment: http://stackoverflow.com/comment/35516833
has comment: http://stackoverflow.com/comment/35519647
upvote count: 2
has comment: http://stackoverflow.com/comment/35516027
has comment: http://stackoverflow.com/comment/35515072

http://stackoverflow.com/q/23278447
has comment: http://stackoverflow.com/comment/35628992
has comment: http://stackoverflow.com/comment/35628941
tagged with: java
has title: Does an Array's specified capacity include 0?
has comment: http://stackoverflow.com/comment/35628939
has comment: http://stackoverflow.com/comment/35682977
accepted answer: http://stackoverflow.com/a/23278507
answer count: 2
has comment: http://stackoverflow.com/comment/35673389
upvote count: 0
tagged with: arrays
has comment: http://stackoverflow.com/comment/35667125
favorite count: 0
has body: When you declare an array: int[] array = new int[2] When you specify the capacity of it (in this case 2) does this include 0 or not? If it did include 0 the indexes would be: 0,1,2 and if it didn't it would be 1,2 Please answer this question as I really need to know. Thanks in advance :)
possible better answer: http://stackoverflow.com/a/23278508
has answer: http://stackoverflow.com/a/23278508
has comment: http://stackoverflow.com/comment/35629323
score: -6
downvote count: 6
has answer: http://stackoverflow.com/a/23278507
has comment: http://stackoverflow.com/comment/35629023
has comment: http://stackoverflow.com/comment/35670573
type: Question
type: AnsweredQuestion

http://stackoverflow.com/q/23281886
tagged with: junit
has comment: http://stackoverflow.com/comment/35636018
has body: I am running jUnit tests on a java project. My classes are located in the directory: /home/dario/testEnv/151337/prefix/rhino/build/classes And my tests in the directory: /home/dario/testEnv/151337/prefix/rhino/evosuite-tests/org/mozilla/javascript The test I am trying to run is "EcmaErrorEvoSuiteTest.java", which is part of the package org.mozilla.javascript My classpath is set to: /home/dario/testEnv/151337/prefix/rhino/build/classes:home/dario/testEnv/151337/prefix/rhino/evosuite-tests:home/dario/testEnv/684131/prefix/rhino/lib/xbean.jar:/home/dario/evosuite/target/evosuite-0.1-SNAPSHOT-jar-minimal.jar When I try compiling I get no error: javac evosuite-tests/org/mozilla/javascript/EcmaErrorEvoSuiteTest.java However, when I try running the tests I get the following: java org.junit.runner.JUnitCore org.mozilla.javascript.EcmaErrorEvoSuiteTest JUnit version 4.11 Could not find class: org.mozilla.javascript.EcmaErrorEvoSuiteTest Time: 0.002 Anybody got any suggestions? Beginning of test-class: /* * This file was automatically generated by EvoSuite */ package org.mozilla.javascript; import static org.junit.Assert.*; import org.junit.Test; import org.mozilla.javascript.Context; import org.mozilla.javascript.EcmaError; import org.mozilla.javascript.NativeGlobal; import org.mozilla.javascript.Scriptable; public class EcmaErrorEvoSuiteTest { //Test case number: 0 /* * 2 covered goals: * 1 org.mozilla.javascript.EcmaError.getName()Ljava/lang/String;: root-Branch * 2 org.mozilla.javascript.EcmaError.&lt;init&gt;(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ILjava/lang/String;I)V: root-Branch */ @Test public void test0() throws Throwable { // Undeclared exception! try { Context.getContext(); fail("Expecting exception: RuntimeException"); } catch(RuntimeException e) { // // No Context associated with current Thread // } } //Test case number: 1 /* * 2 covered goals: * 1 org.mozilla.javascript.EcmaError.details()Ljava/lang/String;: root-Branch * 2 org.mozilla.javascrip…
has comment: http://stackoverflow.com/comment/35635969
has comment: http://stackoverflow.com/comment/35635871
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35635830
tagged with: java
has title: Error in setting classpath with junit
has comment: http://stackoverflow.com/comment/35635941
tagged with: classpath
type: Question
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/23282074
accepted answer: http://stackoverflow.com/a/23282074
has comment: http://stackoverflow.com/comment/35635990
has comment: http://stackoverflow.com/comment/35635851

http://stackoverflow.com/comment/35466102
comment on: http://stackoverflow.com/q/23188228
has text: You are asking for how to generate the *cartesian product*. There are countless duplicates here on SO.
score: 3
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23151743
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/35471512
upvote count: 2
answers question: http://stackoverflow.com/q/23151104
has body: Your web.xml and struts.xml are fine. The JARs versions are a little different from the required dependencies for Struts 2.0: xwork should be 2.0.7, commons-io should be 1.0, and so on. Btw, since it seems you are starting today with a new Struts2 project, I STRONGLY suggest you to start with the latest Struts2 libraries for at least the following reasons: There is absolutely not a single reason to use a 6 years old library; if your company has this rule, then fight with your bosses to change this rule, especially for the following arguments; Struts2 versions before 2.3.15.3 are affected by a serious security bug; Struts2 has evolved significantly in terms of power, efficiency, speed, bugfixing, and has deprecated several old and buggy libraries, like Struts2-Dojo and the aforementioned FilterDispatcher (since Struts 2.1.3, you must use the new filter, that is the StrutsPrepareAndExecuteFilter, as written in the FilterDispatcher documentation) With new Struts2 versions, you can use the new plugins out there, that will add real values to your webapp, especially: Struts2 Convention Plugin Struts2 jQuery Plugin (take a look at the showcase) Struts2 JSON Plugin Then start a new project with the latest libraries (currently 2.3.16.1), preferibly with Maven, or either by hand paying attention to the required dependencies and their versions. Download a Release of Apache Struts
type: Answer

http://stackoverflow.com/a/23172683
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/35439073
has comment: http://stackoverflow.com/comment/35438840
has comment: http://stackoverflow.com/comment/35438654
has comment: http://stackoverflow.com/comment/35439122
has comment: http://stackoverflow.com/comment/35438725
answers question: http://stackoverflow.com/q/23172588
downvote count: 0
has comment: http://stackoverflow.com/comment/35438751
type: Answer
has body: Yes, you should use SSL such as the SSLSocketFactory. You will have to have a look at JSSE, here is a tutorial in case you are curious. Taken from the linked tutorial: SSLSocketFactory factory = (SSLSocketFactory)SSLSocketFactory.getDefault(); SSLSocket socket = (SSLSocket)factory.createSocket("www.verisign.com", 443); /* * send http request * * Before any application data is sent or received, the * SSL socket will do SSL handshaking first to set up * the security attributes. * * SSL handshaking can be initiated by either flushing data * down the pipe, or by starting the handshaking by hand. * * Handshaking is started manually in this example because * PrintWriter catches all IOExceptions (including * SSLExceptions), sets an internal error flag, and then * returns without rethrowing the exception. * * Unfortunately, this means any error messages are lost, * which caused lots of confusion for others using this * code. The only way to tell there was an error is to call * PrintWriter.checkError(). */ socket.startHandshake(); This shows how a client might implement SSL. Note, this is only part of what is a pretty complicated client/server interaction in Java. UPDATE: For examples on how to do this with Netty, see their examples at their github: https://github.com/netty/netty/tree/master/example/src/main/java/io/netty/example/http/websocketx/sslserver

http://stackoverflow.com/q/23204630
upvote count: 1
type: Question
tagged with: java
has title: OpenDaylight Rest API with Java
answer count: 2
has body: Before posting this question I search alot to be sure how to ask. I am trying to connect to the OpenDaylight controller with Java, I am trying to connect by consuming the rest services given by the controller. My problem is, when I send the http request I cannot get any further than the login, I am not sure if its possible. Instead of getting the topology or other answer from the controller, I am getting the html of the login form. Also, I am not sure if I should be connecting like this. Any help/guidance is very appreciated. :) My code for creating the connection is: public String getContent(String urls) throws IOException { String cont=""; CloseableHttpClient httpclient = HttpClients.createDefault(); HttpPost httpPost = new HttpPost(urls); List <NameValuePair> nvps = new ArrayList <NameValuePair>(); nvps.add(new BasicNameValuePair("j_username", "username")); nvps.add(new BasicNameValuePair("j_password", "password")); httpPost.setEntity(new UrlEncodedFormEntity(nvps)); CloseableHttpResponse response2 = httpclient.execute(httpPost); try { System.out.println(response2.getStatusLine()); HttpEntity entity2 = response2.getEntity(); BufferedReader reader =new BufferedReader(new InputStreamReader(entity2.getContent())); String line=""; while((line=reader.readLine())!=null){ cont+=line+"\n"; } } finally { response2.close(); } return cont; } When I run the code, this is what is printed: HTTP/1.1 200 OK OpenDaylight - Login Log In
has answer: http://stackoverflow.com/a/23247513
downvote count: 0
has comment: http://stackoverflow.com/comment/35557193
favorite count: 0
linked to: http://stackoverflow.com/q/22018227
tagged with: rest
tagged with: connection
has answer: http://stackoverflow.com/a/23533916
tagged with: opendaylight
type: UnansweredQuestion
score: 1
tagged with: authentication

http://stackoverflow.com/a/23254593
has body: Could be done on many ways, depending what do you need. One solution could be to make toString() method to accept parameter, like this: //in class A @Override String toString(){ return toString(true); } /** @Param subclass Should subclass info be included */ String toString(boolean subclass){ String text = /* details from current class */; if (subclass &amp;&amp; bRef != null) text += bRef.toString(false); return text; } Same can be applied for class B, just replace bRef with a And when you need String from some object, just call toString() (without arguments) However, if you have cases where you have references like this for example: a1 -&gt; b1; b1 -&gt; a2; a2 -&gt; b2; b2 -&gt; a1 Then this approach would be better: //in class A @Override String toString(){ return toString(new Stack&lt;Object&gt;()); } /** @Param stack Holds all objects that have been called */ String toString(Stack stack){ String text = /* details from current class */; if (bRef != null &amp;&amp; stack != null &amp;&amp; stack.search(bRef) == -1) { stack.push(bRef); text += bRef.toString(stack); } return text; }
type: Answer
score: 0
answers question: http://stackoverflow.com/q/23254330
has comment: http://stackoverflow.com/comment/35584773

http://stackoverflow.com/q/23168910
has body: I was reading about Non-blocking I/O, java NIO and tomcat connectors, looked at the code of tomcat's NIO Connector, and found this in NioEndpoint.bind(): serverSock.configureBlocking(true); //mimic APR behavior I don't have experience with NIO, so can someone explain how it is non-blocking when the socket is configured to be blocking?
tagged with: java
has title: Why Tomcat's Non-Blocking Connector is using a blocking socket?
type: Question
has answer: http://stackoverflow.com/a/23169175
score: 4
tagged with: nio
upvote count: 4
has answer: http://stackoverflow.com/a/23170097
has answer: http://stackoverflow.com/a/23169114
answer count: 3
accepted answer: http://stackoverflow.com/a/23169114
has comment: http://stackoverflow.com/comment/35432526
downvote count: 0
tagged with: tomcat
favorite count: 0
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/23170097

http://stackoverflow.com/a/23178287
upvote count: 1
type: AcceptedAnswer
type: Answer
has body: Use the playlists#list method with a channelId parameter to get the playlists and, for each playlist, call playlistItems#list with the playlistId parameter.
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/23174991
accepted answer of: http://stackoverflow.com/q/23174991

http://stackoverflow.com/comment/35600275
type: AnswerComment
type: Comment
score: 0
has text: Yes, I understand that. But why it works fine at web project (the CRM that I wrote previously) and here it fails.. The objects and services are the same..
comment on: http://stackoverflow.com/a/23263285

http://stackoverflow.com/comment/35452406
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23180433
has text: Are you positive that it have gotten a GPS location before (first-fix). Might have been network based location. which would leave your getLastKnownLocation null, as it is restricted to GPS. Just in case you have not seen this answer in your search: http://stackoverflow.com/questions/19825256/error-getting-location-android-gps-and-network/19825506#19825506
score: 0

http://stackoverflow.com/comment/35556929
type: Comment
type: QuestionComment
has text: while importing project if anyone made any mistake then it gives error in console. I am asking about that. and I knew it, runtime error gives in Logcat ..I am asking about console error
score: 0
comment on: http://stackoverflow.com/q/23239036

http://stackoverflow.com/comment/35383798
score: 0
comment on: http://stackoverflow.com/a/23141351
type: AnswerComment
type: Comment
has text: @Garf1eld, There's no info on what your SimpleAdapter does, post its code.

http://stackoverflow.com/comment/35545608
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23231252
has text: Check `Bitmap#isPremultiplied()` to see if the Bitmap is expecting pre-multiplied alpha.

http://stackoverflow.com/comment/35605743
has text: cross-check the xml and declaration of the variable: map
score: 0
comment on: http://stackoverflow.com/q/23266229
type: QuestionComment
type: Comment

http://stackoverflow.com/a/23185036
type: Answer
answers question: http://stackoverflow.com/q/23184918
has body: You can simply extract the digits of an integer in java like this and do whatever you want with them: public static void getnum() { int num; do{ System.out.println("Please enter a five digit number"); num = input.nextInt(); if (num &lt; 10000 || num &gt; 99999) { System.out.println("The number is not five digits"); } }while (num &lt; 10000 || num &gt; 99999); } public static int separate_number(int num) { String numStr = num +""; String[] digits = numStr.split(""); String separatedDigits = ""; for (String s: digits) { separatedDigits += s + " "; System.out.println(s); } // you can return separatedDigits just change the type of the method to String return Integer.parseInt(numStr);//Very nonesense! }
score: 0

http://stackoverflow.com/a/23270116
answers question: http://stackoverflow.com/q/23244348
has body: Check out http://dev.wechat.com/ for details on the WeChat SDK for iPhone and Android
score: 0
type: Answer

http://stackoverflow.com/comment/35419548
type: Comment
has text: i have tested that code with while loop ..its working for me..separate all the lines by enter key...
type: AnswerComment
comment on: http://stackoverflow.com/a/23161333
score: 0

http://stackoverflow.com/comment/35610477
type: Comment
has text: Larta, I wanted to keep it as private for the setAmount() because that code is part of the private modifier section. I already put a comment on my code, if I made my code public, I would be able to access the method. Is there a way to pass the object as Dollar. This is the intention of my question.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23268161

http://stackoverflow.com/q/23131872
type: Question
linked to: http://stackoverflow.com/q/8710619
has comment: http://stackoverflow.com/comment/35366923
has comment: http://stackoverflow.com/comment/35367828
tagged with: eclipse-plugin
score: 0
has comment: http://stackoverflow.com/comment/35366330
has title: Does does the java-o-o extension support the "+=" operator?
answer count: 0
has comment: http://stackoverflow.com/comment/35366414
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35366140
has comment: http://stackoverflow.com/comment/35365605
tagged with: operator-overloading
has comment: http://stackoverflow.com/comment/35366834
has body: Simple question but if it does then what is its equivalent verbal function name(that is substituted by +=)? Edit: By "java-o-o" I mean the java-o-o (Java-operator-overloading) plugin (hack) for java. Any insight will be helpful!
tagged with: java

http://stackoverflow.com/comment/35444141
type: Comment
score: 0
type: AnswerComment
has text: I should add that there are some "edge cases" to consider, e.g. if the file starts or ends with blank lines, or a paragraph is separated by two or more blank lines, but hopefully that is enough to get you started.
comment on: http://stackoverflow.com/a/23175658

http://stackoverflow.com/comment/35485509
score: 0
type: AnswerComment
type: Comment
has text: Thanks for that solution. I updated the packet but now i'm getting this output on the Server: Listening number received: 6 number now decreased to: 4 Listening number received: 4 number now decreased to: 2 Listening number received: 6 number now decreased to: 4 Listening number received: 2 number now decreased to: 0 Listening and on the Client i'm getting: Insert number: 6 number received: 4 number received: 2 On the client, I wanted to include 0 as well, as it's part of the loop, but on the Server it repeats the number 6.
comment on: http://stackoverflow.com/a/23198820

http://stackoverflow.com/q/23206782
tagged with: scripting
favorite count: 0
has body: I'm writing a program that incorporates the Rhino Scripting Engine. I would like to be ale to expose a couple of the program's enums, but I can't figure out how to do that, if it's even possible. Is there a way to make a java enum usable in the scripts?
upvote count: 1
type: AnsweredQuestion
tagged with: enums
has answer: http://stackoverflow.com/a/29720444
tagged with: rhino
score: 1
tagged with: java
has title: Exposing Java Enums in the Rhino JavaScript engine
accepted answer: http://stackoverflow.com/a/29720444
type: Question
answer count: 1
downvote count: 0
tagged with: javascript
has comment: http://stackoverflow.com/comment/35585565

http://stackoverflow.com/q/23147013
upvote count: 0
type: UnansweredQuestion
type: Question
has answer: http://stackoverflow.com/a/23147062
linked to: http://stackoverflow.com/q/290884
tagged with: java
score: -1
has body: I have learned that fields are like global variables which can be accessed by the methods inside the same class. I have done it this way before and never had a problem. I have now a class where I have some fields but the methods cannot access them without having to make them static fields. I get the error "cannot make static reference to non-static..." I thought static was to access fields on other classes without having to create an object reference to the class. The only difference I have with this code is that I have a single class and my main() method within this class. Does having main() inside this class make a difference?
has comment: http://stackoverflow.com/comment/35393728
answer count: 3
has comment: http://stackoverflow.com/comment/35393793
downvote count: 1
favorite count: 0
has title: static fields in Java
tagged with: static
tagged with: field
duplicate of: http://stackoverflow.com/q/290884
has answer: http://stackoverflow.com/a/23147031
has answer: http://stackoverflow.com/a/23147997

http://stackoverflow.com/comment/35552004
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23236162
score: 0
has text: @CODEFISH For the non-split solution, added a more general solution in case you're not sure whether the `name=` token follows `user`

http://stackoverflow.com/comment/35432681
has text: Ok, thank you very much for everything. Will post a solution when and if I figure it out :)
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/23131403
type: Comment

points
tag name: points
type: Tag
tags question: http://stackoverflow.com/q/23188765

http://stackoverflow.com/comment/35529574
has text: @BlackPOP Java version 1.7. I'm deploying to ES 1.1
comment on: http://stackoverflow.com/q/23190424
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23279478
has title: Not able to retrieve data after executing preparatory statement in Eclipse after JDBC Connection
has answer: http://stackoverflow.com/a/23279625
has answer: http://stackoverflow.com/a/23279606
tagged with: java
tagged with: eclipse
type: Question
answer count: 2
score: 0
tagged with: sql
tagged with: jdbc
has body: Here is the preparatory statement I am using after making jdbc connection (Using SQL Developer) but on execution I am getting the following error resultsetoracle.jdbc.driver.OracleResultSetImpl@762f5aa3 I am able to retrieve data from database if not using preparatory statement. Not sure if the problem with the resultset I am using to see the results. System.out.println("resultset" + rs); Please help. Thanks in advance I am using the following jar (OJDBC6-11.2.0.2.0) public static void main(String[] argv) { Connection conn= null; PreparedStatement pstmt = null; try{ Class.forName("oracle.jdbc.driver.OracleDriver"); System.out.println("connecting to a database"); //Making JDBC connection conn = DriverManager.getConnection(url,userName,password); System.out.println("Database connection successfully"); System.out.println("creating statement"); String query = "select * from event where externaleventid=?"; PreparedStatement pstmt = conn.prepareStatement(query); //Bind values into the parameters. pstmt.setString(1,"1256294"); ResultSet rs = pstmt.executeQuery(); System.out.println("resultset" + rs); conn.close(); } catch(SQLException se){ se.printStackTrace(); } catch(Exception e){ e.printStackTrace(); } finally{ try{ if(stmt!=null) conn.close(); }catch(SQLException se){ } }try { if(conn!=null) conn.close(); }catch(SQLException se){ se.printStackTrace(); } }
type: UnansweredQuestion

http://stackoverflow.com/q/23152927
tagged with: keypad
has answer: http://stackoverflow.com/a/23153013
tagged with: java
has body: Is there a method in Java that executes an action button is pressed?, I need this because I want to make a KeyListener that when you press a button on the keypad '5 'launched me button in the gui description '5'; EDIT i got ActionListener with : public void actionPerformed(ActionEvent event){ if(button.getLabel().equals("1")){ // do something } } and KeyListener with public void keyPressed(KeyEvent e){ if (e.getKeyCode() == VK_NUMPAD1) { // do what would happen if I pressed the mouse on the button // I do not know how to execute it thought that it was pressing down the // button with the label '1 ' } }
tagged with: keylistener
type: Question
has title: KeyListener java, executes button's action
has comment: http://stackoverflow.com/comment/35403255
has answer: http://stackoverflow.com/a/23153184
score: 0
answer count: 2
tagged with: button
has comment: http://stackoverflow.com/comment/35403262
type: UnansweredQuestion

http://stackoverflow.com/comment/35572408
type: AnswerComment
score: 0
has text: But would it goes well even if I have a process running over the port that I am trying to communicate ?
type: Comment
comment on: http://stackoverflow.com/a/23248060

http://stackoverflow.com/comment/35616102
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23271602
has text: Well... a) Limiting keys to ASCII is nonsense. b) Possible charset differences. Use binary data. c) Memory problems in your C++ part. Valgrind. d) If you´ve fixed all that, try to encrypt the same data in both languages and compare the output. Different bytes at the start and/or end? e) As soon as you know how to extract the real AES part, you can think of decrypting. Not before that.
type: Comment

http://stackoverflow.com/a/23254628
type: Answer
has body: Your card object dont implement a good equals if you see the implementation of the equals on the ArrayList (actually AbstractList), you see that iterates on both list and try to the equals the elements.
score: 0
answers question: http://stackoverflow.com/q/23254319

http://stackoverflow.com/a/23149388
has comment: http://stackoverflow.com/comment/35399694
has comment: http://stackoverflow.com/comment/35400970
has body: 15 or you can do using Java Code : session.setMaxInactiveInterval(15 * 60); //15 minutes The HttpSession#setMaxInactiveInterval() doesn't change much here by the way. It does exactly the same as in web.xml, with the only difference that you can change/set it programmatically during runtime. The change by the way only affects the current session instance, not globally (else it would have been a static method). -1 You can use -1 where the session never expires. Since you do not know how much time it will take for the thread to complete.
score: 0
answers question: http://stackoverflow.com/q/23149203
has comment: http://stackoverflow.com/comment/35398744
type: Answer
has comment: http://stackoverflow.com/comment/35398880
has comment: http://stackoverflow.com/comment/35398831
has comment: http://stackoverflow.com/comment/35401141
has comment: http://stackoverflow.com/comment/35399375

http://stackoverflow.com/comment/35452890
score: 0
type: Comment
has text: how can somebody send something to the other?
comment on: http://stackoverflow.com/a/23180133
type: AnswerComment

http://stackoverflow.com/q/23167297
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35435130
accepted answer: http://stackoverflow.com/a/23175774
type: Question
has comment: http://stackoverflow.com/comment/35445670
tagged with: selenium-webdriver
has comment: http://stackoverflow.com/comment/35434222
has comment: http://stackoverflow.com/comment/35429752
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/35434071
answer count: 1
has title: How to mouse over on link in selinium
has answer: http://stackoverflow.com/a/23175774
has comment: http://stackoverflow.com/comment/35434365
has comment: http://stackoverflow.com/comment/35434498
has body: I am trying to mouse over of Investor link in spicejet page, which is under menu. This is the code that I'm using: Actions builder=new Actions(driver); driver.findElement(By.xpath("//html/body/div[3]/div[1]/div/div[2]/div[2]/div/ul/li[4]/a")); Actions mouseoveracActions=(Actions) builder.moveToElement(element).build(); But I'm getting the exception: org.openqa.selenium.NoSuchElementException: no such element How to solve this?

http://stackoverflow.com/a/23265703
type: Answer
downvote count: 1
has comment: http://stackoverflow.com/comment/35604646
has comment: http://stackoverflow.com/comment/35604849
has body: Do you ever close the stream? Try calling oos.close() after oos.writeObject().
answers question: http://stackoverflow.com/q/23240064
upvote count: 0
has comment: http://stackoverflow.com/comment/35604862
has comment: http://stackoverflow.com/comment/35604776
has comment: http://stackoverflow.com/comment/35604696
score: -1

folding
tags question: http://stackoverflow.com/q/23222257
type: Tag
tag name: folding

bnd
tags question: http://stackoverflow.com/q/23149966
type: Tag
tag name: bnd

http://stackoverflow.com/comment/35385332
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/23141711
has text: wait, so put the code u just typed into my code or delete it? and if not delete it, then what should i delete?

http://stackoverflow.com/q/23289239
tagged with: java
type: Question
has body: For SOAP Based Web Services, why one should choose Spring WS over JAX-WS. I had gone through some article even Spring WS doc feature but still I am not clear. If I need to convince someone to use Spring WS I can't. So I want the difference in simple terms that any Web Service Developer can understand. Thanks in advance.
has title: Which feature make one to use Spring WS over JAX-WS
has answer: http://stackoverflow.com/a/23289907
downvote count: 0
answer count: 1
favorite count: 0
type: UnansweredQuestion
score: 2
upvote count: 2
tagged with: spring-ws

http://stackoverflow.com/comment/35455792
type: Comment
type: QuestionComment
has text: What line is the dead code warning?
score: 0
comment on: http://stackoverflow.com/q/23182862

http://stackoverflow.com/comment/35491648
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23202831
type: AnswerComment
has text: mServ = ((MusicService.ServiceBinderbinder).getService();

http://stackoverflow.com/comment/35474989
type: QuestionComment
comment on: http://stackoverflow.com/q/23192750
score: 0
has text: read about `arbitrary precision arithmetic`
type: Comment

http://stackoverflow.com/q/23257659
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/23261843
answer count: 2
has answer: http://stackoverflow.com/a/23261346
has title: SpringBatch - How to catch a Read Exception when resource doesn't exist
possible better answer: http://stackoverflow.com/a/23261843
tagged with: spring-batch
score: 0
accepted answer: http://stackoverflow.com/a/23261346
has body: I have a Spring job that reads data from a flat file resource. When the job can't find the resource file (it works with a quartz) it throws an ItemStreamException that causes the job overfills my app's log. org.springframework.batch.core.step.AbstractStep: Encountered an error executing the step org.springframework.batch.item.ItemStreamException: Failed to initialize the reader at org.springframework.batch.item.support.AbstractItemCountingItemStreamItemReader.open(AbstractItemCountingItemStreamItemReader.java:137) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:318) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150) at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131) at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202) at com.sun.proxy.$Proxy4.open(Unknown Source) at org.springframework.batch.item.support.CompositeItemStream.open(CompositeItemStream.java:93) at org.springframework.batch.core.step.tasklet.TaskletStep.open(TaskletStep.java:301) at org.springframework.batch.core.step.AbstractStep.execute(AbstractStep.java:192) at org.springframework.batch.core.job.SimpleStepHandler.handleStep(SimpleStepHandler.java:135) at org.springframework.ba…
tagged with: spring
type: AnsweredQuestion

http://stackoverflow.com/comment/35496363
type: Comment
comment on: http://stackoverflow.com/a/23160976
type: AnswerComment
has text: @DanB `StringBuilder.toString()`
score: 0

http://stackoverflow.com/comment/35493657
type: AnswerComment
type: Comment
has text: Thank You so much rgettman. I knew it was something simple but didnt think it was that simple.
comment on: http://stackoverflow.com/a/23203978
score: 0

http://stackoverflow.com/q/23211034
tagged with: arrays
has answer: http://stackoverflow.com/a/23211078
answer count: 6
score: 0
has title: Array confusion
favorite count: 0
accepted answer: http://stackoverflow.com/a/23211121
has answer: http://stackoverflow.com/a/23211072
possible better answer: http://stackoverflow.com/a/23211081
has answer: http://stackoverflow.com/a/23211098
has answer: http://stackoverflow.com/a/23211081
has answer: http://stackoverflow.com/a/23211070
type: AnsweredQuestion
has body: I am not a get programmer and I have been having problems with my code. I get the error: `java.lang.ArrayIndexOutOfBoundsException: 0` Some help will be appreciated. Thank you. My code: import java.util.Scanner; public class Gradebook1D { public static void main(String[] args) { Scanner input = new Scanner(System.in); int[] id = new int[0]; double[] quiz1 = new double[0]; double[] quiz2 = new double[0]; double[] quiz3 = new double[0]; int idStudent = 0; System.out.print("Enter how student's are in your class: "); idStudent = input.nextInt(); double[] sum = new double[0]; for (int i = 0; i &lt; idStudent; i++){ System.out.println("Enter student ID: "); id[i] = input.nextInt(); System.out.print("\n Enter score for Quiz1: "); quiz1[i] = input.nextInt(); System.out.print("\n Enter score for Quiz2: "); quiz2[i] = input.nextInt(); System.out.print("\n Enter score for Quiz3: "); quiz3[i] = input.nextInt(); sum[i] = quiz1[i] + quiz2[i] + quiz3[i]; } } }
upvote count: 2
tagged with: java
downvote count: 2
has comment: http://stackoverflow.com/comment/35506651
has comment: http://stackoverflow.com/comment/35506423
type: Question
has answer: http://stackoverflow.com/a/23211121

http://stackoverflow.com/q/23256483
tagged with: bluej
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/35588402
has title: GUI doesn't display the background i set for it(compiles)
has body: I am trying to create a GUI for a game I am trying to make, the game is irrelevant. what this should do according to me is show me a GUI, with a frame, with a picture, however, just the frame displays, the image is nowhere to be found :( Could anyone tell me what I did wrong? Thank you for your time! import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.ImageIcon; import javax.swing.JLabel; import javax.swing.*; import java.awt.BorderLayout; import java.awt.*; public class Graph { int maxX,maxY; private JFrame frame; Graph() { Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); maxX = screenSize.width; maxY = screenSize.height; frame = new JFrame("My Application"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(maxX, maxY); frame.setLocationRelativeTo(null); JLabel label = new JLabel(icon); JPanel panel = new JPanel(new BorderLayout()); panel.add(label, BorderLayout.CENTER); frame.add(panel, BorderLayout.CENTER); frame.setVisible(true); } public String g() { return this.getClass().getProtectionDomain().getCodeSource().getLocation().getPath().replaceAll("´ 20", " "); } public static void main(String args[]) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { Graph g = new Graph(); } }); } }
has comment: http://stackoverflow.com/comment/35588922
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35588601
tagged with: java
has comment: http://stackoverflow.com/comment/35588889
has answer: http://stackoverflow.com/a/23256900
accepted answer: http://stackoverflow.com/a/23256900
type: Question
has comment: http://stackoverflow.com/comment/35588434
has comment: http://stackoverflow.com/comment/35588656
has comment: http://stackoverflow.com/comment/35588696
has comment: http://stackoverflow.com/comment/35588377
has comment: http://stackoverflow.com/comment/35588504
has comment: http://stackoverflow.com/comment/35588452

http://stackoverflow.com/comment/35478811
type: Comment
comment on: http://stackoverflow.com/a/23188661
type: AnswerComment
has text: It is not hard. It is hard for you, because you don't read well. I clearly said that `setRequestProperty` sends request headers, which are not used to transmit form data. You **have** to try to understand what's going on, and once you put enough effort in, you'll see that it is not really hard.
score: 0

http://stackoverflow.com/comment/95585954
score: 0
type: Comment
comment on: http://stackoverflow.com/a/43950733
has text: @SiddhartRathi - https://stackoverflow.com/questions/54386406/no-referrer-when-downgrade-error-integrating-java-service Any help on my questions, somewhat similar to what u answeres
type: AnswerComment

http://stackoverflow.com/a/23137862
has body: You need to have the class instance to call the getSort() method or make the getSort() to static Do like System.out.println("the TreeSet of ArrayList is : "+ new classname().getSort(List)); or make the method static public static TreeSet getSort (ArrayList list){ TreeSet set =new TreeSet(list); return set; }
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23137758
type: Answer
answers question: http://stackoverflow.com/q/23137758
upvote count: 7
score: 7

http://stackoverflow.com/q/23221789
tagged with: spring-data
has answer: http://stackoverflow.com/a/24551889
type: Question
has comment: http://stackoverflow.com/comment/36811416
downvote count: 0
has title: Custom join table makes Spring Data throw IllegalArgumentException: Expected id attribute type
answer count: 1
accepted answer: http://stackoverflow.com/a/24551889
favorite count: 0
has body: I have three tables; Account, Event and AccountEventRelation. The last one acts as a normal Many-to-Many relation between user and events, with the small but important exception that it allows one to have properties on the relation. (Imagine an event with many users, but some users can also be an moderator of an event. The boolean property on account-event relation indicates that.) I can make this work perfectly if I write my own DAO or use plain JDBC and SQL, but with Spring Data it fails terribly. Adding to that, the error message is confusing; Caused by: java.lang.IllegalArgumentException: Expected id attribute type [class lan.localhost.entity.EventAccountRelationPk] on the existing id attribute [SingularAttributeImpl[EntityTypeImpl@1443927423:Account [ javaType: class lan.localhost.entity.Account descriptor: RelationalDescriptor(lan.localhost.entity.Account --&gt; [DatabaseTable(user_account)]), mappings: 4],org.eclipse.persistence.mappings.ManyToOneMapping[account]]] on the identifiable type [EntityTypeImpl@1204999057:EventAccountRelation [ javaType: class lan.localhost.entity.EventAccountRelation descriptor: RelationalDescriptor(lan.localhost.entity.EventAccountRelation --&gt; [DatabaseTable(event_account_rel)]), mappings: 4]] but found attribute type [class lan.localhost.entity.Account]. at org.eclipse.persistence.internal.jpa.metamodel.IdentifiableTypeImpl.getId(IdentifiableTypeImpl.java:200) at org.springframework.data.jpa.repository.support.JpaMetamodelEntityInformation$IdMetadata.&lt;init&gt;(JpaMetamodelEntityInformation.java:212) ... And the error message only appears when I have an interface extending JpaRepository which is autowired. What do I do wrong? Have I misunderstood the JPA technology or am I just using Spring Data incorrectly? Note: I have a repository on GitHub with the a test case as a Maven project, but here are snippets from my classes; @Entity @Table(name = "user_account") public class Account { @Id @Column(name = "id") @GeneratedValue(s…
tagged with: spring
type: AnsweredQuestion
score: 3
upvote count: 3
tagged with: java

http://stackoverflow.com/comment/35378626
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23138636
has text: iterate thru arraylist : `for (vehicles car : cars) { //..use your car }`
score: 0

http://stackoverflow.com/a/23139063
has body: I changed recursive method from niiraj874u's answer to return a value. So now it gives list of hash sets as you wanted. static List&lt;Set&lt;Integer&gt;&gt; sum_up_recursive(List&lt;Integer&gt; numbers, Set&lt;Integer&gt; partial , int sizeOfset) { List&lt;Set&lt;Integer&gt;&gt; result = new ArrayList&lt;Set&lt;Integer&gt;&gt;(); if(partial.size() == sizeOfset) result.add(partial); for (int i = 0; i &lt; numbers.size(); i++) { ArrayList&lt;Integer&gt; remaining = new ArrayList&lt;Integer&gt;(); int n = numbers.get(i); for (int j = i + 1; j &lt; numbers.size(); j++) remaining.add(numbers.get(j)); Set&lt;Integer&gt; partial_rec = new HashSet&lt;Integer&gt;(partial); partial_rec.add(n); result.addAll(sum_up_recursive(remaining, partial_rec, sizeOfset)); } return result; } public static void main(String args[]) { Integer[] numbers = { 1, 5, 7, 9 }; int size = 2; List&lt;Set&lt;Integer&gt;&gt; allCombinations = sum_up_recursive(Arrays.asList(numbers), new HashSet&lt;Integer&gt;(), size); for (Set&lt;Integer&gt; set : allCombinations) { for (Integer num : set) System.out.print(num + " "); System.out.println(); } }
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/23131039
upvote count: 1

http://stackoverflow.com/a/23150133
has comment: http://stackoverflow.com/comment/35426931
accepted answer of: http://stackoverflow.com/q/23149751
has body: You have got your properties wrong. Kindly refer to the sling docs to know what each property that you have set does. The property sling.servlet.paths should be used instead of sling.servlet.resourceTypes to provide the path under which the servlet is accessible as a Resource. Thus for your requirement, the following annotations would suffice. sling.servlet.methods - For the request methods supported by the servlet. sling.servlet.paths - For the request path that is handled by this servlet. @Component(immediate = true, metatype = false, label = "feedServlet") @Service(Servlet.class) @Properties(value = { @org.apache.felix.scr.annotations.Property(name = "sling.servlet.methods", value = "POST"), @org.apache.felix.scr.annotations.Property(name = "sling.servlet.paths", value ="/bin/feedServlet")) }) public class FeedServlet extends SlingAllMethodsServlet { private static final long serialVersionUID = -2139716879248038562L; @Override protected void doPost(SlingHttpServletRequest request, SlingHttpServletResponse response) throws ServerException, IOException { String feed = "test test test"; response.getWriter().write(feed); } }
answers question: http://stackoverflow.com/q/23149751
has comment: http://stackoverflow.com/comment/35422603
has comment: http://stackoverflow.com/comment/35438988
has comment: http://stackoverflow.com/comment/35439226
has comment: http://stackoverflow.com/comment/35433416
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35416924
downvote count: 0
has comment: http://stackoverflow.com/comment/35439392
type: Answer
score: 6
upvote count: 6
has comment: http://stackoverflow.com/comment/35438906

http://stackoverflow.com/comment/35553580
comment on: http://stackoverflow.com/q/23237460
has text: Where is `reader` declared? that's kind of weird you're getting a `memory error` with a file that is 126MB, I've loaded `1GB` files without issues. Read [Parsing huge file without reading into memory](http://www.coderanch.com/t/201866/Performance/java/Parsing-huge-file-reading-memory), also mind adding a pastebin for the Error Log(s).
score: 0
type: Comment
type: QuestionComment

persistence.xml
tags question: http://stackoverflow.com/q/23290722
tags question: http://stackoverflow.com/q/23263622
type: Tag
tag name: persistence.xml

http://stackoverflow.com/q/23252486
answer count: 1
has body: If I have point A and B on a map, how can I calculate the latitude and longitude of a point C which would form an equilateral triangle as you look at the map, for any given points A and B? I'm programming Android/Java but this is more about the maths required.
has comment: http://stackoverflow.com/comment/35580801
score: 0
tagged with: android
tagged with: google-maps-android-api-2
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/35580579
has title: Calculating a map point which forms a triangle
type: Question
has answer: http://stackoverflow.com/a/23278418
has comment: http://stackoverflow.com/comment/35580970

http://stackoverflow.com/comment/35434443
type: QuestionComment
score: 0
has text: Thanks for you answer. I used an asyncTask as shown in the post you attached in your comment. I created the socket in the asyncTask class and executed it. Now my socket is defined only in that task, which is not an activity, and therefor I cannot use many form elements such as buttons and textViews. How can I return the socket from the doInBackground function?
comment on: http://stackoverflow.com/q/23159972
type: Comment

http://stackoverflow.com/a/23190548
accepted answer of: http://stackoverflow.com/q/23190505
score: 2
answers question: http://stackoverflow.com/q/23190505
has body: No, never use some random delay to assume that is how long it takes for a request to complete. What you should do is implement an interface that is used as a callback for the oncomplete of the async task. You implement this interface where you need to know when and what is returned, and then pass in the interface object to the asynctask to be called in the oncomplete method. One other thing to think about, you may want to have your database work on a background thread as well if it can be intensive. here is what this might look like class EZAsyncTask extends AsyncTask&lt;Void, Void, String&gt; { private AsyncTaskListener listener; public EZAsyncTask(AsyncTaskListener listener) { super(); this.listener = listener; } @Override protected String doInBackground(Void... params) { //somethign to do return null; } @Override protected void onPostExecute(String result) { super.onPostExecute(result); listener.onCompletion(result); } public interface AsyncTaskListener { public void onCompletion(String result); } } the usage in your activity or whatever might look like this on a per use basis EZAsyncTask ezTask = new EZAsyncTask(new AsyncTaskListener() { @Override public void onCompletion(String result) { // TODO handle response } }); ezTask.execute(); or you could just let your class/activity implement it, like you might let your activity implement an OnClickListener Another way you could do this is through Handler, and there are other patterns you could do. But I much prefer to do it this way. easy, quick, clean.
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 2

http://stackoverflow.com/comment/35518357
score: 2
has text: what command did you use to create the project?
comment on: http://stackoverflow.com/q/23217454
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35591670
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23248710
has text: Matisse is not a [`LayoutManager`](http://docs.oracle.com/javase/8/docs/api/java/awt/LayoutManager.html), it is a part of the IDE that *uses* layout managers to size and position components. All JSE layout managers are in the `java.awt` package and the `javax.swing` package.
score: 0

http://stackoverflow.com/comment/35560048
type: QuestionComment
comment on: http://stackoverflow.com/q/23240965
has text: .. which also contains the expected format of the program arguments (at the very bottom).
score: 0
type: Comment

http://stackoverflow.com/comment/35544899
score: 1
has text: The problem statement says "Each of the new trains replaces an old one", so I think you *do* have to BFS the old-train routes too.
type: Comment
comment on: http://stackoverflow.com/a/23231734
type: AnswerComment

http://stackoverflow.com/comment/35420574
comment on: http://stackoverflow.com/q/23162219
has text: Indeed don't try to fix a car's engine with a banana, that makes no sense too.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35489932
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23201929
type: QuestionComment
has text: @BoristheSpider in fact, you can work with the data from the list using several threads (I did it previously using `ExecutorService`). The problem lies in the code that performs the calls.

http://stackoverflow.com/a/23240004
accepted answer of: http://stackoverflow.com/q/23239541
answers question: http://stackoverflow.com/q/23239541
has comment: http://stackoverflow.com/comment/35558102
has comment: http://stackoverflow.com/comment/35558830
type: Answer
has comment: http://stackoverflow.com/comment/35558194
upvote count: 2
has body: Interrupt will not stop the thread. it just sets the flag to true to signal the thread to stop the execution soon. to stop the execution add global variable as private volatile boolean exit = false; and you add one method in your 2nd class public void requestExit(){ exit = true; } inside run () of your thread do something like this if (exit == true){ return; } whenever you want to call just call this method requestExit() from your main() or wherever you want to stop this is the best way to stop the thread.. using stop() on thread is dangerous as it does not clear any resources and its not advisable to use even by oracle hence deprecated. let me know for any issues
has comment: http://stackoverflow.com/comment/35558553
score: 2
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/23212157
downvote count: 0
score: 1
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23200729
answers question: http://stackoverflow.com/q/23200729
type: Answer
has body: There are different ID generation strategies. If ID is generated based on sequence then its last number is immediately incremented whenever "next value" is requested. There won't be a problem you described if ID is generated based on table.

video-streaming
tags question: http://stackoverflow.com/q/23258112
tag name: video-streaming
type: Tag

http://stackoverflow.com/q/23149966
has body: the following, seemingly trivial issue has been driving me mad for the last day and a half: - the bundle "netty-worker-service" exports a simple interface that wraps around a type provided ( exported ) by io.netty.transport package com.github.andlaz.netty.worker.service.api; import io.netty.channel.nio.NioEventLoopGroup; public interface NettyWorkerService { public NioEventLoopGroup getWorkerGroup(); } it also implements this interface and declares it as a service: package com.github.andlaz.netty.worker.service.impl; import io.netty.channel.nio.NioEventLoopGroup; import aQute.bnd.annotation.component.Component; import com.github.andlaz.netty.worker.service.api.NettyWorkerService; @Component(immediate=true) public class NettyWorkerServiceImpl implements NettyWorkerService { private final NioEventLoopGroup workerGroup = new NioEventLoopGroup(); @Override public NioEventLoopGroup getWorkerGroup() { return workerGroup; } } bnd creates the following component xml: &lt;component name="com.github.andlaz.netty.worker.service.impl.NettyWorkerServiceImpl" immediate="true"&gt; &lt;implementation class="com.github.andlaz.netty.worker.service.impl.NettyWorkerServiceImpl"/&gt; &lt;service&gt; &lt;provide interface="com.github.andlaz.netty.worker.service.api.NettyWorkerService"/&gt; &lt;/service&gt; &lt;/component&gt; and manifest.mf: Manifest-Version: 1.0 Bnd-LastModified: 1397806521471 Bundle-ManifestVersion: 2 Bundle-Name: com.github.andlaz.netty.worker.service Bundle-SymbolicName: netty-worker-service Bundle-Version: 1.0.0 Created-By: 1.7.0_45 (Oracle Corporation) Export-Package: com.github.andlaz.netty.worker.service.api;version="1.0" ;uses:="io.netty.channel.nio" Import-Package: com.github.andlaz.netty.worker.service.api;version="[1.0 ,2)",io.netty.channel.nio;version="[4.0,5)" Private-Package: com.github.andlaz.netty.worker.service.impl Service-Component: OSGI-INF/com.github.andlaz.netty.worker.service.impl. NettyWorkerServiceImpl.xml Tool: Bnd-2.2.0.20130927-173417 Not too…
type: Question
has comment: http://stackoverflow.com/comment/64132220
answer count: 1
tagged with: bnd
score: 0
tagged with: osgi
tagged with: netty
has title: ClassNotFoundException for a type that is available to the OSGi runtime ( io.netty.common )
has answer: http://stackoverflow.com/a/23152037
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/23152037

http://stackoverflow.com/comment/35547875
comment on: http://stackoverflow.com/q/23233510
type: Comment
type: QuestionComment
has text: I could not see code where u are setting these metrices. Mostly View frustum ll be the culprit in your case. You need to set it up properly.
score: 0

http://stackoverflow.com/comment/35791149
type: Comment
comment on: http://stackoverflow.com/a/23366929
type: AnswerComment
has text: neither can be outside the if. The first because its what sets the sprites direction image, and the second if its outside the if the characters animation is always playing, not just when moving
score: 0

http://stackoverflow.com/comment/35544207
score: 0
type: Comment
has text: Someone has to save the salt in back end isnt it?. For example saving a sensitive data like credit card number. Security provider like Jasypt must save Credit card number with the salt. if it does not how is it going to internally decrypt ?
type: QuestionComment
comment on: http://stackoverflow.com/q/23227616

http://stackoverflow.com/a/23271529
has comment: http://stackoverflow.com/comment/35616038
has comment: http://stackoverflow.com/comment/35684985
has comment: http://stackoverflow.com/comment/35665932
has comment: http://stackoverflow.com/comment/35619540
has body: You should use EventQueue.invokeLater for all GUI updates since Swing in a way is singlethreaded. See http://docs.oracle.com/javase/6/docs/api/javax/swing/package-summary.html#threading You can start threads to do calculations etc, but should update the GUI using invokeLater.
upvote count: 3
has comment: http://stackoverflow.com/comment/35615559
has comment: http://stackoverflow.com/comment/35663126
has comment: http://stackoverflow.com/comment/35616838
answers question: http://stackoverflow.com/q/23271351
type: Answer
score: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/35619750

http://stackoverflow.com/q/23133038
possible better answer: http://stackoverflow.com/a/23133233
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/35367804
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/35375624
has answer: http://stackoverflow.com/a/23133233
has comment: http://stackoverflow.com/comment/35378552
score: 0
tagged with: abstract-class
answer count: 2
has comment: http://stackoverflow.com/comment/35367957
has comment: http://stackoverflow.com/comment/35367895
has comment: http://stackoverflow.com/comment/35367993
has comment: http://stackoverflow.com/comment/35367809
has answer: http://stackoverflow.com/a/23133165
accepted answer: http://stackoverflow.com/a/23133165
favorite count: 0
has title: Abstract class with no methods
downvote count: 2
has body: Is there a use case where we would need an abstract class with no methods defined in it? I bumped into creating such an abstract class just for the sake of generics so that users will pass only subtypes of this class. But I want to know if either is valid or there is a better way to do it.

http://stackoverflow.com/comment/35379977
comment on: http://stackoverflow.com/a/23139270
score: 0
type: AnswerComment
has text: Sorry for the horrible appeal of my answer. I answered from a phone. I'll hop on a computer to clean it up
type: Comment

http://stackoverflow.com/comment/35576038
type: Comment
type: QuestionComment
score: 1
has text: Show us how you use the `TelnetMailServerUserController` bean.
comment on: http://stackoverflow.com/q/23249879

http://stackoverflow.com/comment/35585365
type: QuestionComment
has text: Is the `/Receive` directory writable by the FTP server?
score: 0
comment on: http://stackoverflow.com/q/23229660
type: Comment

http://stackoverflow.com/a/23204582
has comment: http://stackoverflow.com/comment/35494694
has comment: http://stackoverflow.com/comment/35494765
has comment: http://stackoverflow.com/comment/35494610
has comment: http://stackoverflow.com/comment/35494859
has comment: http://stackoverflow.com/comment/35494755
has comment: http://stackoverflow.com/comment/35494986
score: 1
has comment: http://stackoverflow.com/comment/35495058
has comment: http://stackoverflow.com/comment/35494692
upvote count: 1
has body: i'd like to know how to detect the arguments type (int / bool / double / ...) In the case of primitives, you know the type, there is no need to detect which type it is as it is not dynamic. i.e. there is no way it could be different to what you know at compile time. For objects however, there is a number of way to detect this as a common one is to use instanceof e.g. Object o = ... if (o instanceof Integer) { } else if (o instanceof Boolean) { } else if (o insatanceof Double) { } else { // some error } A simple way to show that Java has passed a reference by value is to change the reference. public boolean visit(MethodInvocation node){ node = null; } MethodInvocation node = new MethodInvocation(); visit(node); // does it change to null System.out.println(node); // no it doesn't. node is unchanged. but r_type seems to be always empty. This could be because your test will always fail. i.e. it is always false. Or the list is always empty because you didn't put anything in it. I suggest you step through your code using your debugger to get a better understanding of what your program is doing.
answers question: http://stackoverflow.com/q/23204407
type: Answer
has comment: http://stackoverflow.com/comment/35494796
downvote count: 0
has comment: http://stackoverflow.com/comment/35494887

http://stackoverflow.com/comment/35552360
type: Comment
type: QuestionComment
has text: Be sure to check the JNLP using JaNeLA, available [here](https://drive.google.com/folderview?id=0B5B9wDXIGw9lUnJaUjA2cmlVRE0). Then check the [Bug Database](http://bugs.java.com/bugdatabase/) & if you don't see anything, raise a new one.
comment on: http://stackoverflow.com/q/23217131
score: 0

http://stackoverflow.com/comment/35503187
has text: Well, I tend to use something like `startValue + ((endValue - startValue) * fractionOverTime)` where `fractionOverTime` is a percentage of the time used from 0-1. This assumes you know the amount of time the movement has and how much time has passed
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23209060

http://stackoverflow.com/q/23162559
has comment: http://stackoverflow.com/comment/35420956
accepted answer: http://stackoverflow.com/a/23162851
type: Question
has title: Iterable as a return type
tagged with: iterable
has answer: http://stackoverflow.com/a/23162851
has comment: http://stackoverflow.com/comment/35421032
answer count: 3
downvote count: 3
upvote count: 10
has answer: http://stackoverflow.com/a/23163003
favorite count: 0
has body: I'm having trouble understanding a method. I have methods that I need to fill out, but I don't really understand the first one. How can Iterable be a return type and how is it used ? An example would be great.. @Override public Iterable&lt;ClientInterface&gt; getNeighbours() { return null; } @Override public void addNeighbour(ClientInterface newNeighbour){ //TODO Implement me! } @Override public void removeNeighbour(String clientID) { //TODO Implement me! }
has answer: http://stackoverflow.com/a/23162706
has comment: http://stackoverflow.com/comment/35420945
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/5849154
score: 7
tagged with: java
possible better answer: http://stackoverflow.com/a/23163003

http://stackoverflow.com/q/23260378
score: 0
answer count: 3
tagged with: junit
possible better answer: http://stackoverflow.com/a/23268540
favorite count: 0
has answer: http://stackoverflow.com/a/23268540
has comment: http://stackoverflow.com/comment/35595826
has title: tdd steps to write junit tests for decorator pattern
has answer: http://stackoverflow.com/a/23270462
has body: Is it possible to write unit tests for below piece of functionality ? or, Is it possible to develop below piece of functionality using TDD ? public ZipInputStream getZipInputStream(File zipFile) throws FileNotFoundException { ZipInputStream zipInputStream = new ZipInputStream( new FileInputStream(zipFile)); return zipInputStream; } I know that this question may sounds silly, but as a newbie to TTD, i am not able to find any solution for the above :) .
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35595204
tagged with: java
has comment: http://stackoverflow.com/comment/35596128
upvote count: 1
downvote count: 1
tagged with: unit-testing
type: Question
has answer: http://stackoverflow.com/a/23262892
accepted answer: http://stackoverflow.com/a/23270462
tagged with: tdd

http://stackoverflow.com/a/23163354
has body: Unless you deal with very sensitive data such as Banking. I would say don't worry about it. Do your best to secure the server itself.If you don't want to expose the password in config file. Then create a class for your java program that will hold them.Then compile the code. No matter what you do, you will still have to type in the password somewhere.
answers question: http://stackoverflow.com/q/23163118
score: 0
type: Answer

http://stackoverflow.com/a/23211151
answers question: http://stackoverflow.com/q/23211094
score: 0
type: Answer
has body: void method() { long endTimeMillis = System.currentTimeMillis() + 10000; while (true) { // method logic if (System.currentTimeMillis() &gt; endTimeMillis) { // do some clean-up return; } } }
has comment: http://stackoverflow.com/comment/35507246

http://stackoverflow.com/comment/35553004
score: 0
type: AnswerComment
type: Comment
has text: Your answer is perfect. But now I have accepted an answer and it had good explanation. I am very sorry for this. But I seriously loved your regex demo. Looking forward to gain knowledge from you on SO. I think you will don't mind.
comment on: http://stackoverflow.com/a/23236286

http://stackoverflow.com/a/23151215
has body: You must want to know the Java swing or AWT basics. For getting a text from the JTextField.You want to use this String text=capitalText.getText();//This will retrieve the value of the JTextField capitalText and store the it to the String variable named text. For setting a value to the JTextField.You want to use this. capitalText.setText("Some text");//This will set the String value "Some text" to the JTextField capitalText. As your question.You can use this to achieve,What you are looking for. String key=countryText.getText(); String value=capitalText.getText(); hashMap.put(key,val); Iam sure this will help you.Have a great day.
type: Answer
answers question: http://stackoverflow.com/q/23150698
score: 0

http://stackoverflow.com/comment/35623355
has text: Yes, it is possible. How about reading the documentation of String, Integer and Long?
type: Comment
comment on: http://stackoverflow.com/q/23275480
score: 0
type: QuestionComment

http://stackoverflow.com/q/23251166
has comment: http://stackoverflow.com/comment/35578036
downvote count: 3
has answer: http://stackoverflow.com/a/23251194
linked to: http://stackoverflow.com/q/2099431
has answer: http://stackoverflow.com/a/23251258
score: 12
type: Question
upvote count: 15
tagged with: intellij-idea
has body: When I try to create a package named implements using IntelliJ (community edition), I got a message which says "Not a valid package name". Is this because of the keyword being used?
has comment: http://stackoverflow.com/comment/35578055
has answer: http://stackoverflow.com/a/23251187
favorite count: 0
linked to: http://stackoverflow.com/q/7501494
has title: Can Java package name be a keyword?
answer count: 4
tagged with: package
tagged with: keyword
accepted answer: http://stackoverflow.com/a/23251194
possible better answer: http://stackoverflow.com/a/23251187
has answer: http://stackoverflow.com/a/23251201
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/a/23284865
has body: You can use Pattern and Matcher here: String str = "cards_NNS may_MD be_VB worth_JJ hundreds_NNS a_DT report_NN"; Matcher matcher = Pattern.compile("(\\w+?)_(?:NNS|JJ|NN)\\b").matcher(str); while (matcher.find()) { System.out.println(matcher.group(1)); } This will find all those sequence of words, which ends with _NNS or _JJ or _NN. Then the first capture group captures the string before _.
answers question: http://stackoverflow.com/q/23284736
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/37426327
downvote count: 0
type: Answer

http://stackoverflow.com/comment/35490555
type: Comment
score: 1
has text: Did you take into consideration that if factor%prime==0 we reset the counter to 0 and restart, although with a different factor
type: AnswerComment
comment on: http://stackoverflow.com/a/23201101

http://stackoverflow.com/q/23246484
has comment: http://stackoverflow.com/comment/35569741
duplicate of: http://stackoverflow.com/q/11045691
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35614180
linked to: http://stackoverflow.com/q/11045691
score: 2
answer count: 0
has comment: http://stackoverflow.com/comment/35570169
tagged with: java
has body: I have a java application running with following jvm parameters. -XX:+UseAdaptiveSizePolicy -XX:MaxGCPauseMillis=500 -XX:GCTimeRatio=19 -XX:NewRatio=3 -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:CMSInitiatingOccupancyFraction=70 -Xmx28g -Xms28g What I am expecting is total NewGen space to be 7GB and OldGen space to be 21GB. But when I looking at jconsole>java.lang>MemoryPool, NewGen space is around 148MB(Par EdenSpace&gt;Usage&gt;max&gt;139591680 + Par SurviverSpace&gt;Usage&gt;max&gt;17432576) and OldGen space is around 27.8GB (CMS OldGen&gt;Usage&gt;max&gt;29890314240) Can some one explain this pls? Edit: OS - ubuntu 12.04 64bit java - 1.6.0_45
type: Question
has comment: http://stackoverflow.com/comment/35570309
has title: java: JVM parameter -XX:NewRatio seems to not be taking effect
downvote count: 0
has comment: http://stackoverflow.com/comment/35596272
has comment: http://stackoverflow.com/comment/35594596
has comment: http://stackoverflow.com/comment/35605075
tagged with: jvm
favorite count: 0

http://stackoverflow.com/comment/35392324
comment on: http://stackoverflow.com/q/23146233
score: 0
type: QuestionComment
type: Comment
has text: The same way you got the errors to show up is how you get code to show up.

http://stackoverflow.com/comment/50076473
type: Comment
score: 1
type: AnswerComment
has text: Where is this string pool stored? As link http://java-performance.info/string-intern-in-java-6-7-8/ claims that interned Strings are stored in heap. So is it the same heap as where other objects are located or different? Any links to javadocs or java specification would be appreciated.
comment on: http://stackoverflow.com/a/23253122

http://stackoverflow.com/comment/35583108
has text: what will happen if there will not be error? When I use just rollingFileAppender I limit the size to be 20MB * 5. When I use my appender I can only give it ammount of events.
comment on: http://stackoverflow.com/q/23253527
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35460241
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23185180
score: 0
has text: There is no need to have an else there. Only exits if yes-option selected else the application keeps running.

http://stackoverflow.com/comment/35620334
has text: This is exactly what I was thinking..can you please give some sample code to perform this operation...I am new to java..
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23273654
type: AnswerComment

http://stackoverflow.com/q/23204181
tagged with: spring-data-rest
answer count: 1
favorite count: 0
has title: Spring Data REST Override findBy* Method
tagged with: spring
has answer: http://stackoverflow.com/a/23212548
tagged with: spring-mvc
has body: I am using spring-data-rest-webmvc 2.0.0.RELEASE w/ spring-data-jpa 1.5.0.RELEASE. I have a RoomRepository, RoomRepositoryCustom, and RoomRepositoryImpl class. I am trying to override a findBy* method so that I can provide custom logic to do the work of @PostFilter, but return paginated results. I originally had this in RoomRespository: @PostFilter("hasPermission(filterObject, '" + FIND + "')") @RestResource(rel = "byName", path = "byName") public List&lt;Room&gt; findByName(@Param("name") String name); It works well, but due to limitations on @PostFilter I must return a List and cannot return a Page. I'd like do away with @PostFilter like this: @RestResource(rel = "byName", path = "byName") public Page&lt;Room&gt; findByName(@Param("name") String name, Pageable p); But I still need to filter my results by the authenticated user's principal. (Which I hoped to do in my custom method) So I figured that I could override findByName by providing an implementation in RoomRespositoryImpl, but that doesn't appear to work properly. If I attempt to override findByName then Spring Data REST no longer picks up the method and never registers an endpoint for rooms/search/byName?name="test". I also tried using @Query to define a custom query for the finder. It works, but I don't believe it will work for my purposes since I need to use the authenticated user's principal as a query parameter. In summary: How best to go about implementing a /rooms/search/byName?name="test" endpoint with Spring Data REST that returns a Page of rooms with names that contain the parameter, but is also filtered by my own custom logic based on looking up the currently authenticated user's permissions in a separate table? Is there a way to add a custom link under /rooms/search/* ?
accepted answer: http://stackoverflow.com/a/23212548
score: 2
type: AnsweredQuestion
downvote count: 0
tagged with: java
tagged with: spring-data
type: Question
upvote count: 2

http://stackoverflow.com/a/23208941
has body: One problem is that the random generation of locations: int blobRow = (int) (Math.random() * 13 + 1); int blobCol = (int) (Math.random() * 13 + 1); Might not end up at a -, thus doesn't do anything (it doesn't go into the if-statement if you get a +). You can see in this demo that it does fill a cancer spot correctly if you pass it valid coordinates. Beyond this, you should actually run flood-fill a few times (once for each cancer spot). Something like: Look for a - (by looping through the entire grid) If found: Increment a counter (since you need to output the number of cancer spots) Proceed with flood-fill from there And repeat from #1
score: 1
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23208758
type: Answer
answers question: http://stackoverflow.com/q/23208758
has comment: http://stackoverflow.com/comment/35503660
upvote count: 1

http://stackoverflow.com/a/23288554
downvote count: 0
has comment: http://stackoverflow.com/comment/35655919
type: Answer
has body: Without looking too much at your code (as I see it's lacking alot) I will just explain how your requirement can be achieve. 1st : You need a MouseListener and implement the mousePressed. From the MouseEvent object, you can obtain the point clicked. See How to Write MouseListener if you are unsure. public void mousePressed(MouseEvent e) { Point p = e.getPoint(); } 2nd: Keep a List of your ellipses List&lt;Ellipse2D&gt; ellipses; 3rd: Keep a selectedEllipse variable to hold the select one. Ellipse2D selectedEllipse; 4th: After clicking the point, you loop through the list, checking if each Ellipse2D.contains the point. Then do something with the selected Ellipse public void mousePressed(MouseEvent e) { Point p = e.getPoint(); for (Ellipse2D ellipse : ellipses) { if (ellipse.contains(p) { selectedEllipse = ellipse; // do something with selectedEllipse break; } else { selectedEllipse = null; } } } 5th: Loop through your ellipses to paint the in the paintComponent method protected void paintComponent(Grapchics g) { super.paintComponent(g); Graphics2D g2 = (Graphics2D)g; for (Ellipse2D ellipse : ellipses) { g2.fill(ellipse): } } Side Notes You must call super.paintComponent in your paintComponent method protected void paintComponent(Graphics g) { super.paintComponent(g); } UPDATE After taking a closer look at your code, I see more of what you are trying to achieve. Looks like you want am 8 by 8 grid of your ellipses. Another option is just to create 64 panels. and paint each of them. First have a panel class where you can set the color public class EllipsePanel extends JPanel { private Color color; public EllipsePanel(Color color) { this.color = color; } protected void paintComponent(Graphics g) { super.paintComponent(g); g.setColor(color); g.fillOval(0, 0, getWidth(), getHeight()); } } Then you can use a panel to hold all those panel and use a GridLayout, but also keeping a JPanel[][] so you can easily refer to each panel. You can also a add a mouselistener to each panel…
score: 1
answers question: http://stackoverflow.com/q/23288235
upvote count: 1
has comment: http://stackoverflow.com/comment/35648646

http://stackoverflow.com/a/23290547
has body: First count the time in minutes minutes = (timeToReceive - Utils.currentTimeMillis()) / (1000 * 60) Then use / operation and % operation minutes / 60; // will just divide and truncate - gives you hours minutes % 60; // will give you the rest that is left after dividing - the part that was truncated when you used / operator
type: Answer
answers question: http://stackoverflow.com/q/23290427
score: 0

http://stackoverflow.com/comment/35453367
type: QuestionComment
has text: oh the question is that there could be any amount of args with any type so I dont know how to do that
score: 0
comment on: http://stackoverflow.com/q/23180890
type: Comment

http://stackoverflow.com/a/23160987
has body: "Aren't classes in Java equivalent to structures in c?" Short answer, No. My answer is too short cause the differences is the difference between two completely different paradigms, and it needs a complete book (not even a chapter) like : "Thinking in java".
type: Answer
answers question: http://stackoverflow.com/q/23160896
score: 3
downvote count: 0
upvote count: 3

http://stackoverflow.com/comment/35380462
type: Comment
type: QuestionComment
has text: Please show us full code of `onPostExecute`-method including your try-catch-block and the line causing NPE, too.
comment on: http://stackoverflow.com/q/23139364
score: 0

http://stackoverflow.com/comment/122925194
score: 0
type: Comment
has text: jbang brought me here
type: AnswerComment
comment on: http://stackoverflow.com/a/24353758

http://stackoverflow.com/a/23174839
has comment: http://stackoverflow.com/comment/35442514
score: 1
has comment: http://stackoverflow.com/comment/35443298
answers question: http://stackoverflow.com/q/23174629
upvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/35442487
has comment: http://stackoverflow.com/comment/35442532
has body: To dispose the parent Window you could call: new form3().setVisible(true); JButton btn = (JButton) e.getSource(); Window win = SwingUtilities.getWindowAncester(btn); win.dispose(); However this program design is not a good one.
has comment: http://stackoverflow.com/comment/35442593
downvote count: 0

http://stackoverflow.com/q/23211243
tagged with: javascript
tagged with: jquery
favorite count: 0
tagged with: spring
has body: How to achieve only partial the body content ? I have configured Spring tiles in my application by following below blog http://viralpatel.net/blogs/spring-3-mvc-tiles-plugin-tutorial-example-eclipse/ Now i want only to render only body content and i want to keep header,menu and footer static. How to do this please help me. I tried to achieve using below code but not successfull Spring.addDecoration(new Spring.AjaxEventDecoration({ elementId: "page1", formId: "page1Form", event: "onclick", params: {fragments: "body"} })); Thanks in advance.
answer count: 0
type: UnansweredQuestion
has title: Partial page rendering not working
upvote count: 1
tagged with: spring-mvc
score: 1
tagged with: java
type: Question
downvote count: 0

http://stackoverflow.com/comment/35444111
type: QuestionComment
comment on: http://stackoverflow.com/q/23175749
score: 0
has text: @sager89 I dont think its used by merge sort, its used by the other sorting algorithms that are above it
type: Comment

http://stackoverflow.com/comment/35508944
comment on: http://stackoverflow.com/a/23212192
score: 0
type: AnswerComment
type: Comment
has text: Means data is not coming from Page, or there can be any naming problem in that. So first check name of control that are given in `getParameter()` method.

http://stackoverflow.com/comment/35640638
comment on: http://stackoverflow.com/q/23284468
score: 0
type: Comment
type: QuestionComment
has text: Please log into admob website and see if there is some message waiting for you. Sometimes admob upgrades to a new version of api and if you dont recompile you app with the new version, then admob stops serving ads.

http://stackoverflow.com/comment/48002549
type: Comment
comment on: http://stackoverflow.com/a/23249888
has text: This seems to be the same for Dropwizard 0.8.1
score: 0
type: AnswerComment

http://stackoverflow.com/comment/35624030
type: QuestionComment
comment on: http://stackoverflow.com/q/23275852
has text: Why do you want your client to run automatically?
score: 0
type: Comment

http://stackoverflow.com/q/23223410
has title: Add Action To TextSelection in JTextPane
tagged with: jtextpane
upvote count: 1
has comment: http://stackoverflow.com/comment/41496446
tagged with: textselection
score: 1
tagged with: java
type: Question
tagged with: user-interface
downvote count: 0
has body: I would like to add an action to textSelection in JTextPanel. It is easy to retrieve the selection, to highlight it, or add styles like bold or italic, however, I can' add an action to this selection. I would like to support simple actions (mouse action or any other simple action)... down is the code snippet to highlight the selection with a color... Any help is really appreciated if (textPane.getSelectionStart()!=textPane.getSelectionEnd()){ int e = textPane.getSelectionEnd(); int s = textPane.getSelectionStart(); String text = textPane.getSelectedText(); // StyleContext sc = StyleContext.getDefaultStyleContext(); AttributeSet aset = sc.addAttribute(SimpleAttributeSet.EMPTY, StyleConstants.Background, Color.GREEN); textPane.setCharacterAttributes(aset, false);
favorite count: 0
answer count: 0
type: UnansweredQuestion

http://stackoverflow.com/a/23371160
score: 1
upvote count: 1
has body: If you create your jar through the jar command and want additional manifest entries (such as Main-Class), you'd need to use the m option jar cmf manifest-file jar-file content-files with a suitable manifest file (which can contain plain manifest entry lines).
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23188536
type: Answer
answers question: http://stackoverflow.com/q/23188536

http://stackoverflow.com/q/23287851
tagged with: boolean
has body: I want to make a method which checks if an array is sorted, with the smallest integer in the beginning of the array and the largest at the end. I named the array sequence. public boolean isSorted(){ int i = 1; while(i &lt; sequence.length &amp;&amp; sequence[i] &gt;= sequence[i-1]){ i++; } return i &gt;= sequence.length; } I got to this code with the help of a friend, however I don't entirely understand it. What is returned as a boolean? As far as I could understand, reading on other posts, it will return true only when i >= sequence.length. Given the conditions by while, i will be bigger or the same as sequence.length only when the array is sorted. Am I correct? Sorry if my formatting is terrible, I'm still new to stackoverflow.
tagged with: arrays
downvote count: 0
tagged with: sorting
has answer: http://stackoverflow.com/a/23287918
favorite count: 0
answer count: 3
has answer: http://stackoverflow.com/a/23287939
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23287939
upvote count: 1
has title: Boolean explanation
possible better answer: http://stackoverflow.com/a/23287955
has comment: http://stackoverflow.com/comment/35646321
type: Question
has answer: http://stackoverflow.com/a/23287955
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/35646346

http://stackoverflow.com/q/23133479
type: Question
answer count: 3
possible better answer: http://stackoverflow.com/a/23133978
has answer: http://stackoverflow.com/a/23134463
score: 0
has comment: http://stackoverflow.com/comment/35369319
has answer: http://stackoverflow.com/a/27150933
accepted answer: http://stackoverflow.com/a/27150933
has comment: http://stackoverflow.com/comment/35369242
tagged with: log4j
has comment: http://stackoverflow.com/comment/35368561
has title: Log4j is not logging into file
has answer: http://stackoverflow.com/a/23133978
tagged with: logging
has body: i have the following log4j configuration: # Root logger option log4j.rootLogger=file, stdout # Direct log messages to a log file log4j.appender.file=org.apache.log4j.RollingFileAppender log4j.appender.file.Threshold=WARN log4j.appender.file.File=logs/log.log log4j.appender.file.MaxFileSize=10MB log4j.appender.file.MaxBackupIndex=10 log4j.appender.file.Append=true log4j.appender.file.layout=org.apache.log4j.PatternLayout log4j.appender.file.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n # Direct log messages to stdout log4j.appender.stdout=org.apache.log4j.ConsoleAppender log4j.appender.stdout.Threshold=INFO log4j.appender.stdout.Target=System.out log4j.appender.stdout.layout=org.apache.log4j.PatternLayout log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n Logging into stdout works fine but nothing is logged into my file. There are definately outputs for the file but nothing happens. Why isnt he logging into my file?
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/q/23227138
accepted answer: http://stackoverflow.com/a/23227438
has comment: http://stackoverflow.com/comment/35535971
has comment: http://stackoverflow.com/comment/35536014
has comment: http://stackoverflow.com/comment/35534986
score: 0
has comment: http://stackoverflow.com/comment/35535045
has answer: http://stackoverflow.com/a/23227438
has comment: http://stackoverflow.com/comment/35536585
has title: Detect invalid character
has comment: http://stackoverflow.com/comment/35534902
has answer: http://stackoverflow.com/a/23227584
has comment: http://stackoverflow.com/comment/35535675
has comment: http://stackoverflow.com/comment/35535015
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35535604
has body: I am reading a tab delimited text file (exported from excel) into my java application but it is possible for the file to contain invalid characters that I don't want. For example, in a spreadsheet I have seen these characters show up (I do not generate the spreadsheet): ï¿½ Which when tab delimited show up as: � This is apparently the Unicode Character 'REPLACEMENT CHARACTER'. How do I detect this character in my Java string so I can abort the import? String invalidString = "1234 � test2"
tagged with: java
has comment: http://stackoverflow.com/comment/35538673
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/23227584
has comment: http://stackoverflow.com/comment/35536326

http://stackoverflow.com/q/23210215
has comment: http://stackoverflow.com/comment/35507231
tagged with: java-2d
accepted answer: http://stackoverflow.com/a/23211294
type: Question
answer count: 2
tagged with: swing
possible better answer: http://stackoverflow.com/a/23210380
has comment: http://stackoverflow.com/comment/35507770
tagged with: java
upvote count: 1
tagged with: graphics
has answer: http://stackoverflow.com/a/23211294
downvote count: 0
type: AnsweredQuestion
tagged with: user-interface
has title: Java Subtract lines
has comment: http://stackoverflow.com/comment/35505186
score: 1
has body: So I have a simple rectangle drawn on the screen with vertical lines that run down it's sides. So it looks something like this: That line is actually 1 full line running from the top of the screen all the way to the bottom, it just looks kinda cut off. But what I want to do is split that 1 line up into 2 lines where ever it intersects the rectangle. So it would look like this: What I was thinking was have a line running down the left side of the rectangle (from the top-left vertex to the bottom-left vertex) and then subtract that line from the full line to get the 2 resultant lines. But Java doesn't have a line subtract function so I'm kinda lost...plus I think there is some better way. Any ideas?
favorite count: 0
has answer: http://stackoverflow.com/a/23210380

http://stackoverflow.com/q/23227409
score: 0
has comment: http://stackoverflow.com/comment/35535856
has comment: http://stackoverflow.com/comment/35535637
has answer: http://stackoverflow.com/a/23227871
has body: I have two text files that have data like this below: File A: 4,12-98-1,38.4611,APO,Tue,Jan,07,14:31:34,2014 5,12-111-1,0.9520,APO,Tue,Jan,07,11:56:21,2014, 6,12-176-1,8.0510,APO,Tue,Jan,07,11:58:10,2014, 7,12-214-1,165.2349,APO,Tue,Jan,07,14:33:19,2014 8,12-293-1,61.2558,APO,Tue,Jan,07,14:35:11,2014 9,12-805-1,2.0987,APO,Tue,Jan,07,12:03:30,2014, 10,12-986-1,3.7740,APO,Tue,Jan,07,12:05:16,2014, File B: 4,12-98-1,43.6546,APO,Tue,Jan,07,10:26:32,2014, 5,12-111-1,1.0430,APO,Tue,Jan,07,10:28:18,2014, 6,12-176-1,13.5606,APO,Tue,Jan,07,10:30:04,2014, 7,12-214-1,44.7091,APO,Tue,Jan,07,10:35:27,2014, 8,12-293-1,44.3001,APO,Tue,Jan,07,10:37:14,2014, 10,12-805-1,2.6451,APO,Tue,Jan,07,10:39:01,2014, Each of those lines are stored in an array. I want to compare the first array element of the first line of File A with all the first array elements of all the lines in File B and then the first array element of the second line of File A with all the first array elements of all the lines in File B and keep going.... till the end of the file. I managed to get the ones that match while reading both text files. However I can`t get it to match for instance the last line on each file which first array element is 10 on both files. How can I do that? Here is what I have done: while ( (TKN24_line2 = TKN24br2.readLine()) != null &amp;&amp; (TKN2_line2 = TKN2br2.readLine()) != null){ TKN24_array2 = TKN24_line2.split(","); int b = 0; for(String s : TKN24_array2){ //System.out.println("values[" + b + "] = " + s); b++; } TKN2_array2 = TKN2_line2.split(","); int c = 0; for(String s : TKN2_array2){ //System.out.println("values[" + c + "] = " + s); c++; } if(TKN24_array2[0].contentEquals(TKN2_array2[0])){ //Print something. } } Any help is greatly appreciated!
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35535718
tagged with: java
accepted answer: http://stackoverflow.com/a/23227871
has comment: http://stackoverflow.com/comment/35535752
has comment: http://stackoverflow.com/comment/35536028
type: Question
has comment: http://stackoverflow.com/comment/35536197
tagged with: arrays
answer count: 1
has comment: http://stackoverflow.com/comment/35536283
has comment: http://stackoverflow.com/comment/35535903
has title: Comparing one array element to multiple array elements

http://stackoverflow.com/a/23201323
score: 0
has body: Here's the example you asked for: Although GridBagLayout can be pretty complex, it is extremely flexible. It's really not that hard either, once you get familiar with your options (weight, anchor, ipadx, ect..) I highly suggest you reading up on GridBagLayout and learn the features that come along with it. Unlike other layouts, GridBagLayout depends on another object (call the constraints) to set attributes to your components. All components typically share the same GridBagConstraints to avoid unnecessary object accolation import java.awt.Container; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.lang.reflect.InvocationTargetException; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.SwingUtilities; public class App { private static JFrame frame; public static void main(String[] args) { initFrame(); } private static void initFrame() { try { SwingUtilities.invokeAndWait(new Runnable() { //all swing actions should be handled on EDT public void run() { frame = new JFrame(); frame.setSize(500, 500); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //close process on X addComponents(frame.getContentPane()); //add components to frame frame.setLocationRelativeTo(null); //set frame in center of screen frame.setVisible(true); } }); } catch (InvocationTargetException | InterruptedException e) { e.printStackTrace(); } } private static void addComponents(Container pane) { pane.setLayout(new GridBagLayout()); GridBagConstraints gbc = new GridBagConstraints(); JButton button = new JButton("button1"); JButton button2 = new JButton("b2"); JButton button3 = new JButton("b3"); //we are anchroing our button to the bottom-left side of the screen gbc.anchor = GridBagConstraints.SOUTHWEST; //weightx and y specifiy that our comp isn't just mindlessly floating around //for weightx, if there is any extra space on the X axis, fill ass needed //same for weighty. if we didnt have these vars, our comp will float in the middle //basica…
type: Answer
answers question: http://stackoverflow.com/q/23200328

http://stackoverflow.com/q/23185348
downvote count: 0
has body: I start reading about jee 7 and one thing i read is: "Servlet technology has allowed only traditional (blocking) input/output during request processing since its inception. In the Servlet 3.1 release, the new Non-Blocking I/O API makes it possible for servlets to read or write without any blocking" How true is this statement since Servlet 3.0 introduced the AsyncContext and the asynch servlet? "This means that other tasks can be performed at the same time as a read or write is occurring, without any wait. This in turn means that now you can more easily accomplish Ajax and partial-page refreshes without making separate calls to the servlet for each update" So what is the new feature introduced in servlet 3.1 compared to 3.0 specs for asynch servlets ? Thanks
favorite count: 0
has title: What is the new asynch feature introduced in servlet 3.1?
has comment: http://stackoverflow.com/comment/35460815
type: Question
has answer: http://stackoverflow.com/a/23185472
score: 4
tagged with: java
answer count: 1
tagged with: jakarta-ee
has comment: http://stackoverflow.com/comment/35460995
accepted answer: http://stackoverflow.com/a/23185472
tagged with: servlet-3.0
tagged with: servlets
upvote count: 4
type: AnsweredQuestion

http://stackoverflow.com/comment/101965446
score: 0
type: Comment
comment on: http://stackoverflow.com/a/53039065
has text: Can't we do it in O(1) space?
type: AnswerComment

http://stackoverflow.com/a/29205067
has body: User @Daniel https://stackoverflow.com/users/1107657/daniel Gave a great answer to this in : Get same output as R console in Java using JRI
answers question: http://stackoverflow.com/q/23261686
type: AcceptedAnswer
score: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/23261686

http://stackoverflow.com/comment/35636018
comment on: http://stackoverflow.com/q/23281886
score: 0
has text: @tieTYT1 the path is /home/dario/testEnv/151337/prefix/rhino/evosuite-tests/org/mozilla/javascript/EcmaErrorEvoSuiteTest.class
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35594470
has text: The war files created using ***grails war*** as you said. I've deleted the ***temp*** and ****work*** directories, and it's not working.
comment on: http://stackoverflow.com/a/23251774
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/23269994
possible better answer: http://stackoverflow.com/a/23269995
upvote count: 15
has answer: http://stackoverflow.com/a/23270517
favorite count: 0
tagged with: command-line
has comment: http://stackoverflow.com/comment/35614480
has comment: http://stackoverflow.com/comment/35613376
type: AnsweredQuestion
downvote count: 0
has title: When a Java system property is set on the command line without value ("-Dkey"), what value does it get?
has body: According to the Oracle documentation, I can set system properties of a Java process on the command line with the following syntax: -Dproperty=value But what happens when I don't specify the value, i.e. when I omit the "equals value" part: -Dproperty What value will the system property be set to? true? An empty string? Or any string with an undefined, implementation specific value?
tagged with: java
has answer: http://stackoverflow.com/a/23269995
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/35613618
has comment: http://stackoverflow.com/comment/35612657
score: 15
accepted answer: http://stackoverflow.com/a/23270517

netty
tags question: http://stackoverflow.com/q/23248368
tags question: http://stackoverflow.com/q/23205664
tags question: http://stackoverflow.com/q/23249800
tags question: http://stackoverflow.com/q/23172588
type: Tag
tags question: http://stackoverflow.com/q/23226116
tags question: http://stackoverflow.com/q/23261778
tag name: netty
tags question: http://stackoverflow.com/q/23149966

http://stackoverflow.com/q/23217131
has answer: http://stackoverflow.com/a/23498109
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25013279
tagged with: java
tagged with: java-web-start
type: Question
has answer: http://stackoverflow.com/a/23679709
linked to: http://stackoverflow.com/q/842779
answer count: 8
score: 5
has answer: http://stackoverflow.com/a/23585490
has answer: http://stackoverflow.com/a/23686434
linked to: http://stackoverflow.com/q/23225144
has answer: http://stackoverflow.com/a/24504559
tagged with: jacorb
has comment: http://stackoverflow.com/comment/36521036
tagged with: classnotfoundexception
has comment: http://stackoverflow.com/comment/35552360
has body: Since updating to Java 7 update 55, I'm not able to run my WebStart java application. This application worked fine under Java 7 update 51 when launched via WebStart. It also works with update 55 when launched outside of WebStart. Any suggestions for further investigation points? org.omg.CORBA.INITIALIZE: can't instantiate default ORB implementation org.jacorb.orb.ORBSingleton vmcid: 0x0 minor code: 0 completed: No at org.omg.CORBA.ORB.create_impl_with_systemclassloader(Unknown Source) at org.omg.CORBA.ORB.init(Unknown Source) at org.jacorb.orb.CDRInputStream.&lt;init&gt;(CDRInputStream.java:186) at org.jacorb.orb.etf.ProfileBase.initFromProfileData(ProfileBase.java:252) at org.jacorb.orb.etf.ProfileBase.demarshal(ProfileBase.java:172) at org.jacorb.orb.etf.FactoriesBase.demarshal_profile(FactoriesBase.java:124) at org.jacorb.orb.ParsedIOR.decode(ParsedIOR.java:235) at org.jacorb.orb.ParsedIOR.parse_stringified_ior(ParsedIOR.java:460) at org.jacorb.orb.ParsedIOR.parse(ParsedIOR.java:375) at org.jacorb.orb.ParsedIOR.&lt;init&gt;(ParsedIOR.java:192) at org.jacorb.orb.ORB.string_to_object(ORB.java:1824) Caused by: java.lang.ClassNotFoundException: org.jacorb.orb.ORBSingleton at java.net.URLClassLoader$1.run(Unknown Source) at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Unknown Source) ... 56 more Edit 12th June 2014 Looks like this issue has been fixed here: https://bugs.openjdk.java.net/browse/JDK-8042789 This will hopefully be included in the next CPU on July 15th Looks like the change that caused this issue was reverted so it now uses the current thread classloader again. http://hg.openjdk.java.net/jdk8u/jdk8u-dev/corba/re…
possible better answer: http://stackoverflow.com/a/23238815
has title: Java 7 update 55 JacORB error when running via WebStart
favorite count: 0
upvote count: 5
downvote count: 0
has answer: http://stackoverflow.com/a/23695482
accepted answer: http://stackoverflow.com/a/25013279
has answer: http://stackoverflow.com/a/23238815

http://stackoverflow.com/comment/35382336
comment on: http://stackoverflow.com/q/23140698
has text: Third party libraries do it better. You'll want to url encode things as well.
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/a/23219058
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/23217879
type: AcceptedAnswer
downvote count: 0
has body: You need to put your values inside outputtext tags, like this: &lt;p:column&gt; &lt;h:outputText value="#{car.date}"/&gt; &lt;/p:column&gt;
upvote count: 2
answers question: http://stackoverflow.com/q/23217879

http://stackoverflow.com/a/23589598
has body: Please be more specific as to what you trying to do? If you are asking if the attributes of a component can be mapped to different columns then as per the documentation - and verified by you - you can do this: @Embedded @AttributeOverrides( { @AttributeOverride(name="iso2", column = @Column(name="bornIso2") ), @AttributeOverride(name="name", column = @Column(name="bornCountryName") ) } ) Country bornIn; This will map the iso2 field in Country class to bornIso2 and name to bornCountryName. Hope this helps
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/37044922
has comment: http://stackoverflow.com/comment/36229222
answers question: http://stackoverflow.com/q/23139541

http://stackoverflow.com/q/23248103
accepted answer: http://stackoverflow.com/a/23271203
has title: Example 8.1.2-1 Of Java Language Specification(Mutually Recursive Type Variable Bounds)
type: AnsweredQuestion
answer count: 1
favorite count: 0
linked to: http://stackoverflow.com/q/14947203
type: Question
has body: I was reading jls 8 and I got stuck on Example 8.1.2-1, Mutually Recursive Type Variable Bounds I searched stackoverflow, and found a question what is a mutually recursive type? but this was not in terms of Java. Example 8.1.2-1. Mutually Recursive Type Variable Bounds interface ConvertibleTo&lt;T&gt; { T convert(); } class ReprChange&lt;T extends ConvertibleTo&lt;S&gt;, S extends ConvertibleTo&lt;T&gt;&gt; { T t; void set(S s) { t = s.convert(); } S get() { return t.convert(); } } Question: What does Recursive Type and Mutually Recursive Type means in Java? Here what does T extends ConvertibleTo&lt;S&gt;, S extends ConvertibleTo&lt;T&gt; means? If I just use T extends ConvertibleTo&lt;S&gt; as type parameter for class ReprChange I am getting compile time error?
downvote count: 1
tagged with: jls
tagged with: recursion
has answer: http://stackoverflow.com/a/23271203
tagged with: java
upvote count: 7
score: 6

http://stackoverflow.com/a/29967201
has body: I have written an open source library aimed at effectively pretty-printing SOAP messages: xml-formatter-components-cxf. Features include: High-performance reformatting of XML Advanced filtering options Max text and/or CDATA node sizes Reformatting of XML within text and/or CDATA nodes Anonymize of element and/or attribute contents Removal of subtrees complete configuration reference for spring. Edit: The above library has been refactored to a more generic library which probably is better for most normal use-cases, i.e. no XML wrapped in XML.
has comment: http://stackoverflow.com/comment/77787190
type: Answer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/112191237
has comment: http://stackoverflow.com/comment/112202350
has comment: http://stackoverflow.com/comment/77779404
upvote count: 1
answers question: http://stackoverflow.com/q/23212313

http://stackoverflow.com/a/23264621
type: Answer
answers question: http://stackoverflow.com/q/23264517
accepted answer of: http://stackoverflow.com/q/23264517
score: 7
downvote count: 3
upvote count: 10
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35614004
has body: Please follow the instructions in the following link https://www.openshift.com/kb/kb-e1088-how-to-deploy-pre-compiled-java-applications-war-and-ear-files-onto-your-openshift-gear More details : You can use like this : Hit git and log into the git bash , and then do this: scp &lt;your local file name&gt; &lt;your hash number&gt;@&lt;your app name&gt;-&lt;your domain name&gt;.rhcloud.com:~/&lt;app name&gt;/data/ example: scp hello.csv 87b95e67477f442c9356a4ae49cd7c9e@cdapp-music.rhcloud.com:~/cdapp/data/ External Sources : from here

sql
tags question: http://stackoverflow.com/q/23167005
tags question: http://stackoverflow.com/q/23176551
tags question: http://stackoverflow.com/q/23148902
tags question: http://stackoverflow.com/q/23244669
tags question: http://stackoverflow.com/q/23189366
tags question: http://stackoverflow.com/q/23267390
tags question: http://stackoverflow.com/q/23148586
tags question: http://stackoverflow.com/q/23169507
tags question: http://stackoverflow.com/q/23222605
tags question: http://stackoverflow.com/q/23210357
tags question: http://stackoverflow.com/q/23178678
tags question: http://stackoverflow.com/q/23178781
tags question: http://stackoverflow.com/q/23203224
tags question: http://stackoverflow.com/q/23191374
tags question: http://stackoverflow.com/q/23208154
tags question: http://stackoverflow.com/q/23199378
tags question: http://stackoverflow.com/q/23232254
tags question: http://stackoverflow.com/q/23279478
tags question: http://stackoverflow.com/q/23144448
tags question: http://stackoverflow.com/q/23139707
tags question: http://stackoverflow.com/q/23174985
tags question: http://stackoverflow.com/q/23217429
tags question: http://stackoverflow.com/q/23145513
tags question: http://stackoverflow.com/q/23187696
tags question: http://stackoverflow.com/q/23169552
tags question: http://stackoverflow.com/q/23226485
tags question: http://stackoverflow.com/q/23262631
tags question: http://stackoverflow.com/q/23154746
tag name: sql
tags question: http://stackoverflow.com/q/23210218
type: Tag
tags question: http://stackoverflow.com/q/23234137
tags question: http://stackoverflow.com/q/23238809
tags question: http://stackoverflow.com/q/23255766
tags question: http://stackoverflow.com/q/23134946
tags question: http://stackoverflow.com/q/23287914
tags question: http://stackoverflow.com/q/23130955
tags question: http://stackoverflow.com/q/23278793
tags question: http://stackoverflow.com/q/23212491
tags question: http://stackoverflow.com/q/23218102
tags question: http://stackoverflow.com/q/23167501
tags question: http://stackoverflow.com/q/23184762
tags question: http://stackoverflow.com/q/23257782
tags question: http://stackoverflow.com/q/23244296
tags question: http://stackoverflow.com/q/23166986
tags question: http://stackoverflow.com/q/23286019
tags question: http://stackoverflow.com/q/23277777
tags question: http://stackoverflow.com/q/23204201
tags question: http://stackoverflow.com/q/23259555
tags question: http://stackoverflow.com/q/23285779
tags question: http://stackoverflow.com/q/23203652
tags question: http://stackoverflow.com/q/23219733
tags question: http://stackoverflow.com/q/23138630
tags question: http://stackoverflow.com/q/23228108
tags question: http://stackoverflow.com/q/23180027
tags question: http://stackoverflow.com/q/23138342
tags question: http://stackoverflow.com/q/23200729
tags question: http://stackoverflow.com/q/23288119
tags question: http://stackoverflow.com/q/23135451
tags question: http://stackoverflow.com/q/23231602
tags question: http://stackoverflow.com/q/23165011
tags question: http://stackoverflow.com/q/23177302
tags question: http://stackoverflow.com/q/23138945
tags question: http://stackoverflow.com/q/23212949
tags question: http://stackoverflow.com/q/23253494
tags question: http://stackoverflow.com/q/23178441
tags question: http://stackoverflow.com/q/23173928
tags question: http://stackoverflow.com/q/23282026
tags question: http://stackoverflow.com/q/23221021
tags question: http://stackoverflow.com/q/23178173
tags question: http://stackoverflow.com/q/23282739
tags question: http://stackoverflow.com/q/23192196
tags question: http://stackoverflow.com/q/23153521
tags question: http://stackoverflow.com/q/23201488
tags question: http://stackoverflow.com/q/23263180
tags question: http://stackoverflow.com/q/23181670
tags question: http://stackoverflow.com/q/23284062
tags question: http://stackoverflow.com/q/23191490
tags question: http://stackoverflow.com/q/23172303
tags question: http://stackoverflow.com/q/23174416

http://stackoverflow.com/comment/35560622
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23241276
has text: like it says [here](http://developer.android.com/tools/projects/projects-cmdline.html) ??

http://stackoverflow.com/q/23170687
has title: "expected NUMBER got binary" exception occurred during data retrieval
answer count: 1
tagged with: named-query
score: 0
tagged with: java
tagged with: hibernate
tagged with: param
has answer: http://stackoverflow.com/a/23187760
tagged with: null
type: UnansweredQuestion
has body: Below is the Entity class Node { Long id; Node parentId; } hibernate named query using : select n from Node n where n.parentId.id = :id param value passing is null , i mean "id" passing is null and getting the exception " Expected NUMBER got BINARY " Can any one suggest please how to overcome this exception . i tried different checks for :id in that named query , still getting the same exception , i saw in the blogs , they all mentioning , when the exception will occur , but no suggestions to overcome this exception
type: Question
has comment: http://stackoverflow.com/comment/35449130
has comment: http://stackoverflow.com/comment/35435452

http://stackoverflow.com/comment/36034959
type: Comment
comment on: http://stackoverflow.com/a/23238815
score: 0
type: AnswerComment
has text: I had the same issue within and OSGi envirornment. http://stackoverflow.com/questions/23217131/java-7-update-55-jacorb-error-when-running-via-webstart?lq=1

http://stackoverflow.com/comment/35539444
type: Comment
type: QuestionComment
score: 0
has text: @JoachimIsaksson Good idea. But since it was an interview question online, with exection time limit, I didn't even think of using regex.
comment on: http://stackoverflow.com/q/23228960

http://stackoverflow.com/comment/35618018
type: Comment
comment on: http://stackoverflow.com/a/23261412
has text: The algorithm discussed in the Wikipedia algorithm is solving the problem for a set of numbers drawn from the reals. It does not follow that it generalises to all classes of numbers. For example, it is trivially simply to do it in O(n) time and O(1) space for integers drawn from the interval [0,32). I believe that the set of numbers the asker is dealing with mean it is also possible for their collection (see my answer below).
type: AnswerComment
score: 0

http://stackoverflow.com/comment/35430322
type: Comment
type: QuestionComment
score: 0
has text: Also you should consider recycling the convertView properly, instead of inflating each time.
comment on: http://stackoverflow.com/q/23167685

http://stackoverflow.com/comment/35494131
has text: @EmadMahdy `executeUpdate()` doesn't return a `ResultSet` (think about it, you're updating a table, not querying a table), check the Javadoc to see what it actually gives you.
type: AnswerComment
comment on: http://stackoverflow.com/a/23203775
type: Comment
score: 1

http://stackoverflow.com/comment/35610943
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23268161
has text: Jon, looks like constructor would do the job as you mentioned. it would be public Dollar(double amount) {...}, and it would be able to access the private method setAmount(). The void add() in the Dollar class would be redundant. At the end, I still won't be able to pass the Dollar object as the parameter. Sorry, I am not trying to be difficult, perhaps the author of the book didn't mean to build a complete code from the example. The example of the classes (BankAccount, Dollar) are from a book so I didn't modify any :)
score: 0

http://stackoverflow.com/comment/35469811
has text: I described in the question as to why I need this information. Unfortunately, Chanel API isn't suitable for the per-minute rates are simply too restrictive - I can only serve one additional client per second, and if I'm really going with the whole 'scalable' idea, then this is not a good approach to build my app around.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23183846
type: QuestionComment

http://stackoverflow.com/comment/35468515
type: QuestionComment
comment on: http://stackoverflow.com/q/23189495
has text: Have you debugged your code?
score: 3
type: Comment

http://stackoverflow.com/a/29487717
has comment: http://stackoverflow.com/comment/80780371
type: Answer
score: 19
downvote count: 0
has comment: http://stackoverflow.com/comment/91052268
upvote count: 19
type: AcceptedAnswer
has body: driver.hideKeyboard() will only work with AppiumDriver. I am using java-client-2.2.0.jar that contains this capability.
accepted answer of: http://stackoverflow.com/q/23220067
answers question: http://stackoverflow.com/q/23220067

http://stackoverflow.com/comment/35603903
has text: Why do you have to add tabs? Because of different direction? Here is mixed Enghlish and Hebrew עברית text without any tabs.
comment on: http://stackoverflow.com/q/23265301
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/q/23249923
tagged with: java
tagged with: logback
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: maven-3
favorite count: 0
has title: Maven Test Scope
tagged with: slf4j
has body: If I have one project of mine myproject1 that has the following depenedencies: org.slf4j slf4j-api 1.7.6 ch.qos.logback logback-core 1.1.1 test ch.qos.logback logback-classic 1.1.1 test And i include myproject1 in myproject2 like so: com.mydomain myproject1 1.0 com.github.tony19 logback-android-core 1.1.1-2 com.github.tony19 logback-android-classic 1.1.1-2 I am still seeing logback classes being included in myproject2. My understanding is that the test scope should prevent those jars from bleeding into parent projects. Am I misunderstanding something? I am currently running into compilation issues as my parent project relies on logback-android and so I have multiple classes with the same name e.g. ch.qos.logback.classic.AsyncAppender.
type: Question
has answer: http://stackoverflow.com/a/23250860
tagged with: maven
upvote count: 1
accepted answer: http://stackoverflow.com/a/23250860
answer count: 1

http://stackoverflow.com/q/23199325
score: 0
tagged with: java
tagged with: android-mapview
has answer: http://stackoverflow.com/a/23199357
has title: MapView not showing up
type: AnsweredQuestion
tagged with: android
has body: So I've been trying to get a mapview to show up in my app but when I run it, the map doesn't load. I've been following the "MapView Tutorial" on the android developer page. https://developers.google.com/maps/documentation/android/v1/hello-mapview Any ideas on what I'm doing wrong?? Thanks for looking. Below is the manifest. <?xml version="1.0" encoding="utf-8"?> <uses-sdk android:minSdkVersion="17" android:targetSdkVersion="17" /> <uses-permission android:name="android.permission.INTERNET"/> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/> <uses-feature android:glEsVersion="0x00020000" android:required="true"/> <permission android:name="com.example.permission.MAPS_RECEIVE" android:protectionLevel="signature"/> <uses-permission android:name="com.example.permission.MAPS_RECEIVE"/> <uses-library android:name="com.google.android.maps" /> <meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="AIzaSyDgs5B5g2oizaQauB6yieC6aCp5-z0zrfc"/> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> /> Below is the xml file. <?xml version="1.0" encoding="utf-8"?> <TextView android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Derek's test map" /> <com.google.android.maps.MapView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/themap" android:layout_width="fill_parent" android:layout_height="fill_parent" android:clickable="true" android:apiKey="AIzaSyDgs5B5g2oizaQauB6yieC6aCp5-z0zrfc" /> And this is my class. import android.os.Bundle; import com.google.android.maps.MapActivity; import com.google.android.maps.MapView; public class MainActivity extends MapActivity { @Override public void onCreate(Bundle savedInstanceState) { sup…
type: Question
accepted answer: http://stackoverflow.com/a/23199357
answer count: 1

http://stackoverflow.com/a/23148742
has comment: http://stackoverflow.com/comment/35396653
has comment: http://stackoverflow.com/comment/35396933
answers question: http://stackoverflow.com/q/23148460
has comment: http://stackoverflow.com/comment/35397038
has comment: http://stackoverflow.com/comment/35398152
has comment: http://stackoverflow.com/comment/35396978
score: 0
has comment: http://stackoverflow.com/comment/35396821
type: Answer
has comment: http://stackoverflow.com/comment/35398121
has comment: http://stackoverflow.com/comment/35397015
has body: Here's what a moment's noodling brought me: import java.util.List; import java.util.LinkedList; public class subs { static List&lt;String&gt; allInitialSubstrings(String s) { List&lt;String&gt; r = new LinkedList&lt;String&gt;(); for (int i=0; i&lt;s.length(); i++) { r.add(s.substring(0, i+1)); } return r; } static List&lt;String&gt; allSubstrings(String s) { List&lt;String&gt; r = new LinkedList&lt;String&gt;(); for (int i=0; i&lt;s.length(); i++) { r.addAll(allInitialSubstrings(s.substring(i))); } return r; } public static void main(String ... args) { System.out.println(allSubstrings(args[0])); } } ~ $ javac subs.java ~ $ java subs 12345 [1, 12, 123, 1234, 12345, 2, 23, 234, 2345, 3, 34, 345, 4, 45, 5] If you want subsets instead of substrings, it's too much a pain in the neck for me to write it in an archaic language like Java, but here it is in the only-slightly elderly Python: def allSubsets(s): if len(s): car = s[0] cdr = allSubsets(s[1:]) return set([car + b for b in cdr]).union(cdr) else: return set([""]) allSubsets("12345")

http://stackoverflow.com/a/23266455
has body: If you only have TWO variations in formatting you could use this code: SimpleDateFormat iso = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssXX"); SimpleDateFormat other = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss XX"); String input = "2013/11/14 11:00:14 -0500"; Date result; if (input.indexOf('/') != -1) { // or: input.charAt(4) == '/' result = other.parse(input); } else { result = iso.parse(input); } Attention: For Android you have to use ZZ instead of XX, but I am not sure if ZZ on Android can parse the Z-symbol in ISO-inputs correctly. In case of doubt (testing!) you have another format variation which you have to handle in a specific way (using something like input.endsWith("Z")).
has comment: http://stackoverflow.com/comment/35606185
answers question: http://stackoverflow.com/q/23266120
score: 0
has comment: http://stackoverflow.com/comment/35606465
type: Answer

http://stackoverflow.com/comment/35425509
has text: Woah man I'm sitting here looking at this and I wonder how I didn't realize this. Haha I must have had such a brain fart. Thanks man and no the coin can't get hung in the air lul this is too simple for that.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23165072

http://stackoverflow.com/comment/35650929
type: AnswerComment
comment on: http://stackoverflow.com/a/23289801
type: Comment
score: 0
has text: k k, I have a xml file how can solve this two steps ?

http://stackoverflow.com/comment/35383339
has text: Have you tried to print/toast "city" and see you are getting valid value?
comment on: http://stackoverflow.com/q/23141282
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/60748021
score: 1
comment on: http://stackoverflow.com/a/23148514
type: AnswerComment
has text: @virgo47 you're right, I'm not sure what I'm doing here. I looked to see if the question had originally referenced default methods but it didn't. I will delete this. Er, can't delete it as it's accepted :(
type: Comment

http://stackoverflow.com/comment/35457374
comment on: http://stackoverflow.com/q/23179066
score: 0
has text: the client throws the exception
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35559243
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/23240702
type: Comment
has text: Please do a proper indentation

http://stackoverflow.com/comment/35501092
comment on: http://stackoverflow.com/a/23207416
has text: one more question actually, the curCNT-1, if the total curCNT is 8 then its 7, would that value carry over to the next for loop? or it would stay 7, for example in the next loop it will become 6.
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/35411458
type: QuestionComment
comment on: http://stackoverflow.com/q/23155868
score: 0
has text: Pixelperfect collision is slow. To get a perfomance boost you should sort out all far objects, before checking pixel perfect. So for example if you are near to the left border you cant collide with the right border, as it is to far, so sort it out.
type: Comment

http://stackoverflow.com/q/23261120
linked to: http://stackoverflow.com/q/26675381
linked to: http://stackoverflow.com/q/2056243
answer count: 2
tagged with: locking
downvote count: 0
score: 7
favorite count: 0
accepted answer: http://stackoverflow.com/a/23262127
type: AnsweredQuestion
has body: People tell about two types of multi-threaded locking - object and class. In my knowledge, locking is done on objects only. Case 1: On objects we create using new or factory methods etc. void synchronized myMethod(Type param) { //will lock on the instance used to call this method } or synchronized(this) { //will lock on current object } or synchronized(obj1) { //will lock on specified obj1 object } Case 2: On java.lang.Class objects This is called class lock, and can be used with static fields or methods or blocks, as they belong to class and shared among all the objects, and other class properties. static void synchronized method() { //will lock the Class object } or static { synchronized(SomeClass.class){ int a = 2; } } Why I am thinking this also as an object locking because classes are loaded into the Method Area in the JVM, and all the static properties of the class are wrapped inside a java.lang.Class object created by JVM. So behind abstraction, its object locking and in the picture, we see Class locking. So I can also infer one more thing. Just as objects locked by a thread can not be acquired by another thread as long as it is not released by first thread, class locking (the java.lang.Class instance) also works in same manner. I want to know in case of synchronized static methods, lock on which class is acquired by the thread in following two cases: This method is called from same class where it is defined. This method is called from derived class with derived class name. This is my understanding so far regarding the subject. Please add on or rectify.
tagged with: java
tagged with: multithreading
linked to: http://stackoverflow.com/q/24068672
tagged with: thread-synchronization
upvote count: 7
type: Question
possible better answer: http://stackoverflow.com/a/23270294
has answer: http://stackoverflow.com/a/23262127
has title: Difference between class locking and object locking in Java
has comment: http://stackoverflow.com/comment/70248200
has answer: http://stackoverflow.com/a/23270294

http://stackoverflow.com/comment/35410822
comment on: http://stackoverflow.com/a/23157322
has text: the way of AmmarCSE is much better clear and with your code you should use a switch
score: 4
type: AnswerComment
type: Comment

http://stackoverflow.com/a/23283073
has body: if you want them stacked vertically, wouldn't it be easier to keep using BoxLayout?
type: Answer
answers question: http://stackoverflow.com/q/23282816
score: 0

http://stackoverflow.com/a/23166243
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23166193
has comment: http://stackoverflow.com/comment/35427584
has body: You can use as below : if(arr1.length!=arr2.length) return false; for(int index=0;index&lt;arr1.length;index++) { if (arr1[index]!=arr2[index]) return false; } return true;

http://stackoverflow.com/comment/35529352
score: 0
has text: What is the purpose of your method? To delete the last element of the list? To delete the element with the specified value? To delete the last element of the list if it has the specified value?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23223915

http://stackoverflow.com/a/23144906
has body: First General Suggestions: First off, your code is begging you to use arrays or ArrayLists. This will simplify your code greatly and make it much easier to enhance, debug, and fix. Don't set the text to null but rather to "", the empty String. Don't set sizes or locations of any components but rather use the layout managers to do this for you. Now for your problem: I'm guessing here, because your code does not show us your error, but I suspect that you're calling setText(...) on the wrong references, on JButtons that aren't part of your displayed GUI. Is the listener code in a different class from that of the displayed GUI? Are you misusing inheritance by having the listener code class extend the GUI? Or does your code have more than one btnClear variable? Are you creating the button with a "shadow" variable, one that is re-declared in a construtor or method while the class field is null? ___________________________________________________________ Please show us more information and code for a more detailed and accurate answer. Edit Solution: it's my second point, that you're shadowing your btnClear variable. Don't re-declare it! e.g., public GradeCalculator(){ super("Grade Calculator"); // ... etc... // **** here **** JButton btnClear = new JButton("New Calculation"); // .... etc... } change to: public GradeCalculator(){ super("Grade Calculator"); // ... etc... // **** here **** btnClear = new JButton("New Calculation"); // .... etc... } The reason this is important, by re-declaring the variable in the constructor, you create a new variable that is visible only inside of the constructor. The btnClear field in the class is null since you never initialize it.
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23144873
has comment: http://stackoverflow.com/comment/35390061
has comment: http://stackoverflow.com/comment/35390156
answers question: http://stackoverflow.com/q/23144873
has comment: http://stackoverflow.com/comment/35390147
type: Answer
has comment: http://stackoverflow.com/comment/35390112
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/35390149
has comment: http://stackoverflow.com/comment/35390096

http://stackoverflow.com/comment/35650701
type: Comment
comment on: http://stackoverflow.com/a/23287917
has text: The second suggestion is a bit tricky, because I use a Camel Proxy as a bean in the current situation. At the moment I don't see/know how to incorporate your second suggestion in this proxy.
score: 0
type: AnswerComment

http://stackoverflow.com/q/23258496
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23258560
tagged with: java
tagged with: mysql
type: Question
has title: Java -> MySQL query issue
has answer: http://stackoverflow.com/a/23258625
has answer: http://stackoverflow.com/a/23258540
has comment: http://stackoverflow.com/comment/35591994
has body: I am trying to create a java query to insert to MySQl but i keep getting errors. please see the code below. PS the connection to the DB is fine. here is the query that is being called public String newEmpInsert() { return newEmpInsert; } private String newEmpInsert = "INSERT INTO empInfo" + "(firstName, lastName, SSN, address, salary, pin, empLevel, contactInfo) " + "VALUES ("+firstName+", "+lastName+", "+SSN+", "+address+", "+salary+", "+pin+","+empLevel+", "+contactInfo+")"; here is the handler that is being called from the main public void newEmpInsert() { // SQL Connection Connection conn = null; try { conn = MySQL_connection_test.getConnection(); // Create a statement Statement statement = conn.createStatement(); statement.executeQuery(queries.newEmpInsert()); } catch (SQLException e) { // TODO Auto-generated catch block //e.printStackTrace(); System.out.println("---------&gt;&gt;Invalid query!!!!&lt;&lt;--------------"); System.out.println("Your query has an error, please try again!!"); } // Close the connection finally { try { conn.close(); System.out.println("Database closed"); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } System.out.println("Database closed"); } } every time i run a query i am getting the invalid query catch. the variables are being set properly within the class and everything.
score: 0
answer count: 4
has answer: http://stackoverflow.com/a/68266521

http://stackoverflow.com/q/23196380
score: 0
answer count: 1
linked to: http://stackoverflow.com/q/4275111
type: UnansweredQuestion
tagged with: squirrel-sql
has title: Can't see any data in h2 database
has comment: http://stackoverflow.com/comment/35481037
tagged with: java
tagged with: hibernate
tagged with: h2
has comment: http://stackoverflow.com/comment/35479724
has answer: http://stackoverflow.com/a/23197244
type: Question
has comment: http://stackoverflow.com/comment/35479763
has body: I got some unit test that stores some Person data into the database. To do this i use the EntityManagerFactory. @Test public void findPersonById() { personDao.savePerson(new Person("Hans")); Person person = new Person("Peter"); personDao.savePerson(person); Long id = person.getId(); flushAndClear(); person = personDao.findById(id); assertThat(person.getName(), is("Peter")); } where private EntityManager entityManager; public Person savePerson(Person person) { entityManager.persist(person); return person; } and public Person findById(Long id) { Person person = entityManager.find(Person.class, id); return person; } with this Base-Test-class import javax.persistence.EntityManager; import javax.persistence.Persistence; import org.junit.After; import org.junit.Before; public class AbstractDaoTest { protected EntityManager entityManager = Persistence.createEntityManagerFactory("DefaultPersistenceUnit") .createEntityManager(); protected PersonDao personDao = new PersonDao(); @Before public void setUp() { personDao.setEntityManager(entityManager); entityManager.getTransaction().begin(); } @After public void tearDown() { entityManager.getTransaction().rollback(); } protected void flushAndClear() { entityManager.flush(); entityManager.clear(); } } My unit test runs green but when i debug this test, i can't see any data on the db (using squirrel). It doesn't matter in which step the debugger currently is, the Tables are always empty. I am using the following configuration for squirrel: jdbc:h2:file:~/test;DB_CLOSE_DELAY=-1;LOCK_MODE=0;AUTO_SERVER=TRUE with Driver: H2 Can you help with this issue?
has comment: http://stackoverflow.com/comment/35479703

http://stackoverflow.com/a/23226929
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35540292
answers question: http://stackoverflow.com/q/23226722
type: Answer
has comment: http://stackoverflow.com/comment/35547820
accepted answer of: http://stackoverflow.com/q/23226722
score: 8
has comment: http://stackoverflow.com/comment/35590363
downvote count: 0
upvote count: 8
has comment: http://stackoverflow.com/comment/35540086
has comment: http://stackoverflow.com/comment/35547826
has comment: http://stackoverflow.com/comment/35539972
has comment: http://stackoverflow.com/comment/35584910
has body: If you can rearrange your files, that's the simplest way to fix this. You want to put them like this: yourApp/ src/ main/ java/ res/ flav1/ java/ res/ flav2/ java/ res/ flav3/ java/ res/ Then in build.gradle, you can get rid of sourceSets entirely. Keep productFlavors. As far as the overriding of resources, it should be automatic: "The build system merges all the resources from the all the source directories. If different folders contain resources with the same name for a build variant, the priority order is the following: build type resources override those from the product flavor, which override the resources in the main source directory."

http://stackoverflow.com/a/23179056
answers question: http://stackoverflow.com/q/23163648
downvote count: 0
upvote count: 2
type: AcceptedAnswer
has body: Your approach is all right, you are just missing a few small things. If you want the default serialization to take place, you can overwrite the readResolve method as you would with standard Java Serialization API (method private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException) and call in.defaultReadObject(); in that method. Afterwards you could call your validation methods, or initialize transient fields or do whatever you want after deserialization. This is also explained in more detail on the XStream FAQ.
type: Answer
accepted answer of: http://stackoverflow.com/q/23163648
score: 2

http://stackoverflow.com/a/23210106
answers question: http://stackoverflow.com/q/23210056
accepted answer of: http://stackoverflow.com/q/23210056
has comment: http://stackoverflow.com/comment/35504945
upvote count: 5
score: 5
type: AcceptedAnswer
downvote count: 0
has body: All you need to do is this: <uses-permission android:name="android.permission.SEND_SMS"/> <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="19" /> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" />
type: Answer

http://stackoverflow.com/comment/35417488
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23144462
score: 0
has text: I found out what's going on. I had to restart the emulator to see the changes in the media player and pictures applications.

http://stackoverflow.com/comment/35621125
score: 1
has text: Also make sure you refactor out any implemented methods in the abstract parent into a child class.
comment on: http://stackoverflow.com/a/23274418
type: AnswerComment
type: Comment

multidimensional-array
tags question: http://stackoverflow.com/q/23186067
tags question: http://stackoverflow.com/q/23154464
tags question: http://stackoverflow.com/q/23141771
tags question: http://stackoverflow.com/q/23191701
tags question: http://stackoverflow.com/q/23212291
tags question: http://stackoverflow.com/q/23286480
tags question: http://stackoverflow.com/q/23233456
tags question: http://stackoverflow.com/q/23187679
tags question: http://stackoverflow.com/q/23149169
type: Tag
tags question: http://stackoverflow.com/q/23217169
tags question: http://stackoverflow.com/q/23251162
tags question: http://stackoverflow.com/q/23233688
tags question: http://stackoverflow.com/q/23176527
tags question: http://stackoverflow.com/q/23230854
tags question: http://stackoverflow.com/q/23233060
tags question: http://stackoverflow.com/q/23206047
tag name: multidimensional-array
tags question: http://stackoverflow.com/q/23280106

http://stackoverflow.com/q/23214080
tagged with: session
tagged with: java
tagged with: hibernate
score: 10
upvote count: 10
tagged with: validation
downvote count: 0
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/23214216
has body: I would like to know which approach to take to prevent Hibernate 4.3.4 (with Spring and Hibernate Vaidator) from flushing dirty entities. In my code, i use a manual implementation of Hibernate Validator (a .validate() method within the instance itself), which gets called just before saving an entity. The validate() method returns a list of errors, if any are found, otherwise a Session.update() is called to store the entity, followed by a commit of the transaction. This works, but when the instance itself is manipulated (posted/ request parameters are set in the entity) the entity and corresponding Hibernate session are marked 'dirty' and the entity is stored with the next Session.flush(). In my case, i would like to have explicit control over the entities which may be stored and prevent any dirty entity from being stored, how would i achieve this? EDIT: I know i can manually regulate this by evicting an entity (or clearing and reintroducing an entity via a merge), but this is not my aim. Rather than having to regulate the persistency manually, i would like to have the offset situation that no entity which was not explicitly saved and of which the transaction was not explicitly committed, will not get stored to the database (e.g. via an interceptor?).
linked to: http://stackoverflow.com/q/71659566
has title: Prevent Hibernate session from flushing/ storing invalid dirty entities
accepted answer: http://stackoverflow.com/a/23214216
has comment: http://stackoverflow.com/comment/139286176
type: Question
type: AnsweredQuestion

http://stackoverflow.com/comment/35430685
has text: There's a sudden flood of Big-O questions. Aren't you taught anything in the class?
score: 1
comment on: http://stackoverflow.com/q/23168135
type: QuestionComment
type: Comment

http://stackoverflow.com/q/23217355
tagged with: eclipse
type: Question
has answer: http://stackoverflow.com/a/23220632
tagged with: mopub
has title: Errors on importing MoPub SDK on Android in Eclipse
answer count: 1
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/23220632
tagged with: android
type: AnsweredQuestion
score: 3
has body: I'm facing a lot of errors while importing MoPub SDK to my workspace. It shows over 5000 errors. Could you tell me what I'm doing wrong? I've tried to import as Java Project, then as Android Project. I have set it as library, and referencing to it as a library from my main project. Any help will be appreciated. Thank you, Wojtek
upvote count: 3
tagged with: java

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

http://stackoverflow.com/q/23187539
has answer: http://stackoverflow.com/a/50482664
has answer: http://stackoverflow.com/a/45791863
favorite count: 0
has answer: http://stackoverflow.com/a/47709379
has answer: http://stackoverflow.com/a/58367115
has answer: http://stackoverflow.com/a/55204861
answer count: 37
has answer: http://stackoverflow.com/a/36223513
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/44087241
has answer: http://stackoverflow.com/a/36377498
has answer: http://stackoverflow.com/a/55770814
has body: I am trying to create a program that takes a string as an argument into its constructor. I need a method that checks whether the string is a balanced parenthesized expression. It needs to handle ( { [ ] } ) each open needs to balance with its corresponding closing bracket. For example a user could input [({})] which would be balanced and }{ would be unbalanced. This doesn't need to handle letters or numbers. I need to use a stack to do this. I was given this pseudocode but can not figure how to implement it in java. Any advice would be awesome. Update- sorry forgot to post what i had so far. Its all messed up because at first i was trying to use char and then i tried an array.. im not exactly sure where to go. import java.util.*; public class Expression { Scanner in = new Scanner(System.in); Stack&lt;Integer&gt; stack = new Stack&lt;Integer&gt;(); public boolean check() { System.out.println("Please enter your expression."); String newExp = in.next(); String[] exp = new String[newExp]; for (int i = 0; i &lt; size; i++) { char ch = exp.charAt(i); if (ch == '(' || ch == '[' || ch == '{') stack.push(i); else if (ch == ')'|| ch == ']' || ch == '}') { //nothing to match with if(stack.isEmpty()) { return false; } else if(stack.pop() != ch) { return false; } } } if (stack.isEmpty()) { return true; } else { return false; } } }
has answer: http://stackoverflow.com/a/67623614
has answer: http://stackoverflow.com/a/48663755
has answer: http://stackoverflow.com/a/42175007
has answer: http://stackoverflow.com/a/53099359
has answer: http://stackoverflow.com/a/23187721
has comment: http://stackoverflow.com/comment/35465248
has answer: http://stackoverflow.com/a/46405687
has comment: http://stackoverflow.com/comment/35464922
has answer: http://stackoverflow.com/a/69801796
tagged with: stack
tagged with: java
has answer: http://stackoverflow.com/a/39257039
upvote count: 26
has answer: http://stackoverflow.com/a/59964029
has comment: http://stackoverflow.com/comment/62090858
tagged with: pseudocode
has answer: http://stackoverflow.com/a/41833518
type: Question
has answer: http://stackoverflow.com/a/31456964
has answer: http://stackoverflow.com/a/63097001
has answer: http://stackoverflow.com/a/40628712
has comment: http://stackoverflow.com/comment/35465013
has answer: http://stackoverflow.com/a/43370466
has answer: http://stackoverflow.com/a/48970764
has answer: http://stackoverflow.com/a/57335733
has answer: http://stackoverflow.com/a/43360161
score: 26
has answer: http://stackoverflow.com/a/65800218
downvote count: 0
has answer: http://stackoverflow.com/a/49361709
linked to: http://stackoverflow.com/q/16874176
has answer: http://stackoverflow.com/a/58902424
has answer: http://stackoverflow.com/a/63053958
has answer: http://stackoverflow.com/a/57177878
has answer: http://stackoverflow.com/a/23187733
has title: Java balanced expressions check {[()]}
has answer: http://stackoverflow.com/a/42870306
has answer: http://stackoverflow.com/a/68518089
has answer: http://stackoverflow.com/a/55538700
has comment: http://stackoverflow.com/comment/35464920
has answer: http://stackoverflow.com/a/43459503
has answer: http://stackoverflow.com/a/59864394

http://stackoverflow.com/a/41148203
type: Answer
score: 2
answers question: http://stackoverflow.com/q/23211589
has body: I tried several of the other answers here with no joy. In the end I simply deleted the offending line and rewrote it directly into Android Studio. The error disappeared. Was this caused by me copying and pasting the line of code from youtube (or whatever random blog I was looking at at the time)?
downvote count: 0
upvote count: 2

http://stackoverflow.com/comment/35501339
has text: Sometimes it's better to start simpler. Try running through the program with an input of 1, and then when you're done with that, try 2.
score: 4
comment on: http://stackoverflow.com/q/23207931
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23145443
upvote count: 1
downvote count: 0
answers question: http://stackoverflow.com/q/23130111
has body: In your model layer on the set method for activeYear first find the row that currently has 1 and set it to 0 and then set the current row to 1.
has comment: http://stackoverflow.com/comment/35397622
type: Answer
score: 1

http://stackoverflow.com/comment/35469052
type: Comment
comment on: http://stackoverflow.com/q/23186851
has text: can you please show me how to do that, thank you in advance.
score: 0
type: QuestionComment

http://stackoverflow.com/q/23199975
score: -1
tagged with: netbeans
linked to: http://stackoverflow.com/q/549
tagged with: web-applications
tagged with: authentication
has body: I'm trying to make a java web application in netbeans. This project must contain jsp pages and the user must have the possibility to log in. I have no idea how to make the login mechanism. I'm using IDE netbeans , glassfish server and hibernate to connect with my mysql database.
downvote count: 1
accepted answer: http://stackoverflow.com/a/23252969
has comment: http://stackoverflow.com/comment/35487668
type: Question
has comment: http://stackoverflow.com/comment/35487051
type: AnsweredQuestion
has title: How to make a login mechanism for a java web application?
tagged with: java
upvote count: 0
answer count: 1
tagged with: jsp
favorite count: 0
has answer: http://stackoverflow.com/a/23252969

http://stackoverflow.com/comment/35448429
has text: Please feel free to ask for specific explanations or give concise change suggestions. If you have a new implementation idea please give an example (could be unrelated to my code or similar) and short description at why it's better. I can look up JavaDocs so don't feel like you need to teach me everything. I'll try and upload snapshots of changed code as I make them. Thanks again for any help!
comment on: http://stackoverflow.com/q/23178196
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35445125
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23176290
has text: have you deployed your app properly? was it working earlier? can you show us your deployment descriptor?
score: 0

http://stackoverflow.com/q/23165016
possible better answer: http://stackoverflow.com/a/23165035
type: AnsweredQuestion
has body: For example I have a programming assignment that wants me to make a coin class and a driver class that randomly flips a coin 40 times and then counts at the very end how many times it ends up heads and tails. Well I got the entire code so far it being: public class driver { public static void main(String[] args) { coin myCoin = new coin(); System.out.println("Coin initially is " + myCoin.getSideUp()); for (int i = 0; i &lt; 40; i++) { myCoin.toss(); System.out.println("Coin is now " + myCoin.getSideUp()); } } } public class coin { protected String sideUp; public coin() { if (Math.random() &lt; 0.5) this.sideUp = "heads"; else this.sideUp = "tails"; } public void toss() { if (Math.random() &lt; 0.5) this.sideUp = "heads"; else this.sideUp = "tails"; } public String getSideUp() { return this.sideUp; } } That's all done, but how do I count the instances of each heads or tails?
has answer: http://stackoverflow.com/a/23165035
accepted answer: http://stackoverflow.com/a/23165072
score: 0
type: Question
tagged with: java
tagged with: random
answer count: 2
has title: How to count the occurrences of random instances
has answer: http://stackoverflow.com/a/23165072
tagged with: count

http://stackoverflow.com/comment/35518961
type: Comment
score: 1
comment on: http://stackoverflow.com/a/23216435
has text: @kleopatra Apart from an intelligent layout manager, what other way is there to get the table to limit the row count?
type: AnswerComment

http://stackoverflow.com/comment/35413366
comment on: http://stackoverflow.com/q/23158386
has text: Why `j=Integer.toString(i);`? `j` is supposed to be an `int`. I think instead of `j` keepi9ng `i` in query could solve your issue. _PS:_ Moreover at the end of `sql` you dont need `;`
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23167376
linked to: http://stackoverflow.com/q/1457716
favorite count: 0
type: Question
has title: how to connect to multiple data base in online?
has comment: http://stackoverflow.com/comment/35429622
tagged with: database-connection
upvote count: 3
tagged with: java
tagged with: mysql
has comment: http://stackoverflow.com/comment/35432441
answer count: 1
has comment: http://stackoverflow.com/comment/35429668
has comment: http://stackoverflow.com/comment/35429824
has body: here i am trying to connect to multiple databases here is my code,this code works fine in local machine but when i upload it to online this is not working may i get any help thank you in advance. package dbase.sqlcon; import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; public class ConnectionHelper{ private String url; private String restrnturl; private String prptyurl; private String user= "root"; private String pass= "mysql"; private String userRestaurent= "root"; private String passRestaurent= "mysql"; private String userProperty= "root"; private String passProperty= "mysql"; private ConnectionHelper() { try { Class.forName("com.mysql.jdbc.Driver"); URLDecoder.decode(getClass().getClassLoader().getResource("flex/testdrive").toString(), "UTF-8"); url = "jdbc:mysql://192.168.10.1:3306/desisquare"; restrnturl="jdbc:mysql://192.168.10.1:3306/foodndine"; prptyurl="jdbc:mysql://192.168.10.1:3306/postaproperty"; } catch (Exception e) { e.printStackTrace(); } } public static Connection getConnection() throws SQLException { if (instance == null) { instance = new ConnectionHelper(); } return DriverManager.getConnection(instance.url, instance.user, instance.pass); } public static Connection getConnectionrestaurent() throws SQLException { if (instance == null) { instance = new ConnectionHelper(); } return DriverManager.getConnection(instance.restrnturl, instance.userRestaurent, instance.passRestaurent); } public static Connection getConnectionproperty() throws SQLException { if (instance == null) { instance = new ConnectionHelper(); } return DriverManager.getConnection(instance.prptyurl, instance.userProperty, instance.passProperty); } } when i asked my hosting provider what is the problem he has send me this which is very new to me INFO | jvm 1 | 2014/04/18 06:23:03 | Exception is ;java.sql.SQLException: Access denied for user 'postaproperty'@'localhost' (using password: YES) INFO | jvm 1 | 2014/04/18 06:23:03 | Exception is ;java.sql.SQ…
tagged with: database
type: UnansweredQuestion
score: 3
downvote count: 0
has answer: http://stackoverflow.com/a/23170252

http://stackoverflow.com/comment/35590265
has text: To fix it -- remove it. Again it serves no purpose other than to mess you up.
comment on: http://stackoverflow.com/q/23257181
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35463055
comment on: http://stackoverflow.com/q/23186549
score: 1
has text: Also see http://stackoverflow.com/questions/19804805/printing-an-int-value-right-after-a-string-value/
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35372677
score: 1
has text: What is the data type of Certificate column in your Access DB ?
comment on: http://stackoverflow.com/q/23135418
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23231257
has comment: http://stackoverflow.com/comment/35543048
has title: How to switch clients to second server during transmission when server disconnect
type: Question
has comment: http://stackoverflow.com/comment/35542877
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/23231561
has body: I am creating a client/server chat, and trying to create a redundant server. When the primary server fails, clients switch to the second server. In the client side I have a connection method where I initiate a socket, aninput stream and an output stream. I want to make a Remote object call using RMI repeatedly and every time this object is not reachable there will be an exception thrown. I am struggling how to implement this trick and make it work. The thing is not only when a client connects first to check the remote object, but also when the socket is connected and there is data going between through the streams the object should be checked. If you have any clue please do not hesitate. Thank you.
type: UnansweredQuestion
tagged with: sockets
has comment: http://stackoverflow.com/comment/35542936
has comment: http://stackoverflow.com/comment/35543194
tagged with: rmi
tagged with: java

jersey
tags question: http://stackoverflow.com/q/23145959
tags question: http://stackoverflow.com/q/23277807
tags question: http://stackoverflow.com/q/23172586
tags question: http://stackoverflow.com/q/23243211
tags question: http://stackoverflow.com/q/23248121
tags question: http://stackoverflow.com/q/23193920
tags question: http://stackoverflow.com/q/23185963
tags question: http://stackoverflow.com/q/23190079
tags question: http://stackoverflow.com/q/23224234
tags question: http://stackoverflow.com/q/23194249
tags question: http://stackoverflow.com/q/23185241
tags question: http://stackoverflow.com/q/23252615
tags question: http://stackoverflow.com/q/23139298
tags question: http://stackoverflow.com/q/23173816
tags question: http://stackoverflow.com/q/23250092
tags question: http://stackoverflow.com/q/23188050
tags question: http://stackoverflow.com/q/23250516
tags question: http://stackoverflow.com/q/23226372
tags question: http://stackoverflow.com/q/23272905
tag name: jersey
tags question: http://stackoverflow.com/q/23135728
tags question: http://stackoverflow.com/q/23136748
type: Tag
tags question: http://stackoverflow.com/q/23229936

http://stackoverflow.com/comment/35508050
type: AnswerComment
has text: You can iterate through arraylist, checking each elements. Otherwise, you will need another data structure than array list. Also, note that above code with `tttp` is preferred method than the bottom one unless different threads are modifying the list.
type: Comment
score: 0
comment on: http://stackoverflow.com/a/23210430

http://stackoverflow.com/comment/35626204
type: Comment
type: QuestionComment
score: 0
has text: Would the downvoter care to explain his downvote or did he misinterpret the question because it wasn't read carefully?
comment on: http://stackoverflow.com/q/23272331

http://stackoverflow.com/comment/58013725
type: Comment
has text: Rooting is no option. As for checking the install time: Sounded promising. However this uses the "wall clock time" which is changeable by the user. I have to compare it with System.currentMillis() - the method I don't want to use anymore.
comment on: http://stackoverflow.com/a/35102661
score: 0
type: AnswerComment

http://stackoverflow.com/q/23189791
has comment: http://stackoverflow.com/comment/35468972
has comment: http://stackoverflow.com/comment/35468960
accepted answer: http://stackoverflow.com/a/23189816
tagged with: text-files
has answer: http://stackoverflow.com/a/23189814
has body: Solved The first line of the text file in the array is the number of students. I need to scan this number, make my array the size of the number, and then print out each line of students and their corresponding information from the text file. I've reviewed the logic several times and can't seem to find what could be wrong with it. I can compile the method but when I run it I get a null pointer exception, which means I must be doing something wrong when assigning the array to the students information. My code right now is: import java.io.*; import java.util.Scanner; import java.util.Arrays; public class Main { public static void main(String[] args) throws IOException { Chart(); } public static void Chart() throws IOException { int n; Scanner fileScan; fileScan = new Scanner(new File("scores.txt")); n = fileScan.nextInt(); String[] students = new String[n]; for (int i = 0; i &gt; n; i++) { students[i] = fileScan.nextLine(); } Arrays.sort(students); for (int i = 1; i &gt; n; i++) { System.out.println(students[i]); } } } Am I doing everything right reading the lines in the text file into the array? If so what is causing the error?
has comment: http://stackoverflow.com/comment/35469353
possible better answer: http://stackoverflow.com/a/23189814
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/23189816
type: Question
answer count: 2
tagged with: arrays
has title: Null Pointer Exception Error When Printing Array of Strings from a Text File in Java
score: 0

http://stackoverflow.com/comment/35413137
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23158434
has text: He just want to remove a text between `" "`
score: 0

http://stackoverflow.com/q/23230269
has answer: http://stackoverflow.com/a/23398016
score: 4
favorite count: 0
has title: Decrypting hyperlocal with Signature Mismatch (Google RTB)
accepted answer: http://stackoverflow.com/a/23398016
tagged with: encryption
type: AnsweredQuestion
tagged with: java
tagged with: hmac
tagged with: hmacsha1
has body: Following Google's advice here and using their code as a guide. I've tried using their encrypted hyperlocal string to test the decryption method that I wrote (most of it from Google though as my own attempts at writing such a method caused me much headache). I'm getting Signature Mismatch for some reason even though I'm providing the proper integrity and encryption keys and I'm using the byte array that they provided in their example decryption (lower down Google's RTB decrypt hyperlocal page). I have the code here: package anon.bidder.adx; import java.io.ByteArrayOutputStream; import java.security.InvalidKeyException; import java.security.NoSuchAlgorithmException; import java.util.Arrays; import javax.crypto.Mac; import javax.crypto.SecretKey; import javax.crypto.spec.SecretKeySpec; import org.apache.commons.codec.binary.Hex; import org.apache.log4j.Logger; public class AdxBidRequestDecryptor { private static final int INITIALIZATION_VECTOR_SIZE = 16; private static final int SIGNATURE_SIZE = 4; private static final int BLOCK_SIZE = 20; public static class DecrypterException extends Exception { public DecrypterException(String message) { super(message); } } public static byte[] hexStringToByteArray(String s) { int len = s.length(); byte[] data = new byte[len / 2]; for (int i = 0; i &lt; len; i += 2) { data[i / 2] = (byte) ((Character.digit(s.charAt(i), 16) &lt;&lt; 4) + Character.digit(s.charAt(i+1), 16)); } return data; } public static void main(String args[]){ byte[] ciphertext = hexStringToByteArray("E2014EA201246E6F6E636520736F7572636501414243C0ADF6B9B6AC17DA218FB50331EDB376701309CAAA01246E6F6E636520736F7572636501414243C09ED4ECF2DB7143A9341FDEFD125D96844E25C3C202466E6F6E636520736F7572636502414243517C16BAFADCFAB841DE3A8C617B2F20A1FB7F9EA3A3600256D68151C093C793B0116DB3D0B8BE9709304134EC9235A026844F276797"); byte[] encryptionKey = {(byte)0x02, (byte)0xEE, (byte)0xa8, (byte)0x3c, (byte)0x6c, (byte)0x12, (byte)0x11, (byte)0xe1, (byte)0x0b, (byte) 0x9f, (byte) 0x88, …
type: Question
upvote count: 4
answer count: 1
downvote count: 0

opennlp
type: Tag
tag name: opennlp
tags question: http://stackoverflow.com/q/23146896

http://stackoverflow.com/q/23220518
tagged with: neomad
has body: The question is simple : Is there any possibilities to have native android code on Neomad ? Yes ? How to do that ? I can have windows phone native code, iOS native code but how to have Android native code ? when i am compiling my code, i only have .apk for Android ! No native code. Explanation ? Thank you
favorite count: 0
has answer: http://stackoverflow.com/a/23238517
tagged with: android
type: AnsweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/35522854
upvote count: 1
has comment: http://stackoverflow.com/comment/35524032
type: Question
possible better answer: http://stackoverflow.com/a/23220565
accepted answer: http://stackoverflow.com/a/23238517
has answer: http://stackoverflow.com/a/23220565
has comment: http://stackoverflow.com/comment/35524002
has title: Is there any possibilities to have native android code?
has comment: http://stackoverflow.com/comment/35524072
answer count: 2
downvote count: 0

http://stackoverflow.com/q/23139553
has comment: http://stackoverflow.com/comment/35380159
has title: Parse Exception Error
has comment: http://stackoverflow.com/comment/35380301
has comment: http://stackoverflow.com/comment/35380230
answer count: 0
has body: I am getting the below error on startup in informa.jar. I tried looking for this exception but couldn't find anything. Could you please provide any pointers. de.nava.informa.utils.FeedManagerException: ParseException: Error on line 57: The element type "link" must be terminated by the matching end-tag "&lt;/link&gt;". at de.nava.informa.utils.FeedManagerEntry.retrieveFeed(FeedManagerEntry.java:160) at de.nava.informa.utils.FeedManagerEntry.&lt;init&gt;(FeedManagerEntry.java:86) at de.nava.informa.utils.FeedManager.addFeed(FeedManager.java:262) at com.ubizen.og.reportcenter.news.InformaNewsProvider.addFeed(InformaNewsProvider.java:139) at Thanks, Praseel
type: UnansweredQuestion
score: 0
tagged with: java
type: Question
tagged with: parseexception
has comment: http://stackoverflow.com/comment/35380237
tagged with: hyperlink
tagged with: eclipse

http://stackoverflow.com/comment/35610096
comment on: http://stackoverflow.com/q/23268582
type: Comment
type: QuestionComment
has text: what is the browser and version that you are using?
score: 0

http://stackoverflow.com/q/23170163
tagged with: cql
tagged with: cassandra
score: 0
has comment: http://stackoverflow.com/comment/35435470
has comment: http://stackoverflow.com/comment/35469307
has comment: http://stackoverflow.com/comment/35439295
has comment: http://stackoverflow.com/comment/35475769
has comment: http://stackoverflow.com/comment/35443668
answer count: 0
tagged with: exception
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35472772
has title: cassandra java client throws string index out of range exception
tagged with: java
has comment: http://stackoverflow.com/comment/35450224
has body: I am getting following exception when running a query from Cassandra cql java client. java.lang.StringIndexOutOfBoundsException: String index out of range: -1 at java.lang.String.substring(String.java:1949) at org.apache.cassandra.cql.jdbc.CassandraResultSet.createColumn(CassandraResultSet.java:1159) at org.apache.cassandra.cql.jdbc.CassandraResultSet.populateMetaData(CassandraResultSet.java:220) at org.apache.cassandra.cql.jdbc.CassandraResultSet.&lt;init&gt;(CassandraResultSet.java:190) at org.apache.cassandra.cql.jdbc.CassandraStatement.doExecute(CassandraStatement.java:169) at org.apache.cassandra.cql.jdbc.CassandraStatement.executeQuery(CassandraStatement.java:229) at com.jolbox.bonecp.StatementHandle.executeQuery(StatementHandle.java:503) at com.wyh.cluster.node.connect.JDBCConnect.query(JDBCConnect.java:77) at com.wyh.service.TripWorker.runRouteQuery(TripWorker.java:3557) at com.wyh.service.TripWorker.getRouteInfo(TripWorker.java:3495) at com.wyh.service.TripWorker.run(TripWorker.java:607) at org.jppf.server.node.NodeTaskWrapper.run(NodeTaskWrapper.java:136) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) at java.util.concurrent.FutureTask.run(FutureTask.java:166) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) at java.util.concurrent.FutureTask.run(FutureTask.java:166) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1146) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:701) When I look at CassandraResultSet.java:1159 here http://code.google.com/a/apache-extras.org/p/cassandra-jdbc/source/browse/src/main/java/org/apache/cassandra/cql/jdbc/CassandraResultSet.java?spec=svn3be43d719cf12d92d067c20b3d1c23682c25a304&amp;r=61cefd982fd281f80fbb6485754c8f7831193114 It seems more …
type: Question
tagged with: database
has comment: http://stackoverflow.com/comment/35434567

http://stackoverflow.com/a/23217592
has comment: http://stackoverflow.com/comment/35518046
answers question: http://stackoverflow.com/q/23214254
score: -1
upvote count: 0
has comment: http://stackoverflow.com/comment/36011024
has body: Try to use different Eclipses.. I mean, start 2 eclipses &amp; run the same program in both the eclipses....
type: Answer
downvote count: 1

http://stackoverflow.com/comment/35389010
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23143829
has text: is this actual code ? Why do you have redundant local `Timer` in constructor ? and where do you initialize `this.timer` ?
score: 0

http://stackoverflow.com/comment/35451753
comment on: http://stackoverflow.com/q/23180012
score: 0
type: Comment
type: QuestionComment
has text: Do you want also to prevent `_` from being removed? If not then why is it in your `[^a-zA-Z_0-9]` regex?

http://stackoverflow.com/comment/35441852
has text: Can you share the code you are having problems with?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23174114
score: 0

server-side
tags question: http://stackoverflow.com/q/23238337
type: Tag
tag name: server-side

http://stackoverflow.com/comment/35500708
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23185995
has text: @assylias, would you look at that, Moose Morals understood exactly what I needed without editing my post and whining about not understanding what I wanted. He also realized that he didn't need to compile any code to help me.
score: 0

http://stackoverflow.com/comment/35429756
type: QuestionComment
has text: @VigneshKumar Please see updated codes
score: 0
comment on: http://stackoverflow.com/q/23167501
type: Comment

http://stackoverflow.com/comment/74857454
score: 0
type: Comment
type: QuestionComment
has text: Possible duplicate of [How to read an XML file with JAXB?](http://stackoverflow.com/questions/12053379/how-to-read-an-xml-file-with-jaxb)
comment on: http://stackoverflow.com/q/23206265

http://stackoverflow.com/a/23153184
has body: The below example is fine, all you have to put inside the if sentence is: if (e.getKeyCode() == VK_NUMPAD5) { nameOfButtonToClick.doClick(); } Obviously they have to be within the same scope which it should anyway since your buttons are probably declared as field values?
answers question: http://stackoverflow.com/q/23152927
score: 0
type: Answer

http://stackoverflow.com/q/23274495
has comment: http://stackoverflow.com/comment/35621343
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/35622211
has comment: http://stackoverflow.com/comment/35621345
tagged with: weak-references
tagged with: android
has comment: http://stackoverflow.com/comment/35622244
tagged with: memory-management
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/35621466
linked to: http://stackoverflow.com/q/18385362
has title: How to avoid OutOfMemoryError in Android
type: Question
has body: I'm working on an app which needs to store many bitmap images in memory. No surprise, that OutOfMemoryError is often caught on some devices, when bitmap collection becomes too big. And I need to avoid this somehow. Saying briefly, I need a kind of collection which will behave a kind of "add items one by one, until adding next item would cause OutOfMemoryError", but I'm not experienced enough to find a proper approach. I believe, some sort of weak-reference collection should be implemented. I like WeakHashMap, but there is one crucial problem with it - I cannot control how items will be discarded. In my app, bitmaps are added in order of priority: the most important bitmaps, that should be stored as long as possible, go first. WeakHashMap, as I understand, doesn't provide such prioritization. Any working approaches or ideas? P. S. This question is not about bitmap optimization. Imagine, there are some big objects instead of bitmaps, that cannot be compressed or optimized. The question is about storing items in memory directly controlling their priority, such that objects with low priority can be GC'd quickly or not added at all. P. P. S. So far, I discovered two possible solutions: 1) dividing a collection in 2 parts, such that first, more prioritized, will contain items themselves (i. e. strong references), and second will contain soft references. Control of adding can be processed using Runtime.getRuntime.maxMemory() and .totalMemory()--when totalMemory occupied by the heap exceeds some % of maxMemory, adding new items into collection should be prohibited; 2) using a collection of soft references and track items' finalize()--when it is invoked (i. e. corresponding object is going to be picked by GC), return this item as a soft reference back to the collection and replace another item--with least priority--by phantom reference. Theoretically, this would give more strict priority control, but I'm not sure how it will behave in practice.
has comment: http://stackoverflow.com/comment/35621803
has answer: http://stackoverflow.com/a/23274957
has comment: http://stackoverflow.com/comment/35621305
has comment: http://stackoverflow.com/comment/35621371
has comment: http://stackoverflow.com/comment/35622387
has comment: http://stackoverflow.com/comment/35621544

storage
tag name: storage
tags question: http://stackoverflow.com/q/23217023
tags question: http://stackoverflow.com/q/23222123
tags question: http://stackoverflow.com/q/23156128
type: Tag

http://stackoverflow.com/comment/35423931
has text: Post edited again sorry for those errors in fact my problem is bigger than that, I tried to make it simplier by creating this two classes so users won't have to read 4 or 5 different classes
comment on: http://stackoverflow.com/a/23163589
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/23295851
has body: There's a difference in handling null, too. The assertEquals throws a NullPointerExeption whereas the assertTrue simply fails.
score: 1
answers question: http://stackoverflow.com/q/23287702
downvote count: 0
type: Answer
upvote count: 1

http://stackoverflow.com/comment/35399202
comment on: http://stackoverflow.com/q/23150397
score: 0
type: Comment
type: QuestionComment
has text: Hey .. jUst try like this `yourList.get(0)` if the list having one element.. Check out for the documentation.

http://stackoverflow.com/comment/35598300
comment on: http://stackoverflow.com/q/23262160
type: QuestionComment
score: 1
has text: maybe duplicate of http://stackoverflow.com/questions/2622716/java-invalid-stream-header-problem
type: Comment

http://stackoverflow.com/comment/35420090
has text: Yes, and a string may not be the best way to represent a hand
type: QuestionComment
comment on: http://stackoverflow.com/q/23161992
type: Comment
score: 1

http://stackoverflow.com/a/23193479
accepted answer of: http://stackoverflow.com/q/23190459
score: 0
type: AcceptedAnswer
type: Answer
has body: getBean(String, Object ...) is applicable to bean's constructors or factory methods. Your CoreService should have CoreService(String s) constructor in order to use this method. If you want to create many CoreService instances with different parameters, you can create a factory bean which creates all instances for you and puts them together, like @Component public class CoreServiceFactoryBean { @Autowired ApplicationContext ctx; public CoreService getBean(String param) { CoreService coreService = ctx.getBean("coreService"); CoreDao coreDao = ctx.getBean("coreDao", parameter); coreService.setCoreDao(coreDao); return coreService; } } This way, the logic of creating bean and using it remains separate. Using factories is pretty common to configure prototype scoped beans.
answers question: http://stackoverflow.com/q/23190459

http://stackoverflow.com/comment/35657215
has text: Also, where is the definition of `hibernateTransactionManager`? Do you have other xml config files?
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23290699

http://stackoverflow.com/comment/35518168
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23217374
score: 0
has text: what is at `view_stud.xml` for which you have set `setContentView(R.layout.view_stud)` ?

http://stackoverflow.com/q/23232994
has comment: http://stackoverflow.com/comment/37081111
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/23233092
has body: import java.util.Scanner; public class Main { public static void main(String[] args){ Scanner startcommand = new Scanner(System.in); System.out.println("Say Start to start game:"); String command = startcommand.nextLine(); if(command.equalsIgnoreCase("start")){ for(int countdown = 10; countdown&gt;0; countdown--){ System.out.println("Starting game in " + countdown + " seconds"); if (countdown==1){ System.out.println("Game has started"); } } } } } How do I make the for loop occur(Say starting in 1, 2, 3, etc..) every second so the game actually starts in 10 seconds? I know this actually isn't a game. I am just practicing to use a different API.
type: Question
answer count: 2
tagged with: for-loop
has answer: http://stackoverflow.com/a/23233077
accepted answer: http://stackoverflow.com/a/23233077
score: 0
has comment: http://stackoverflow.com/comment/35545880
possible better answer: http://stackoverflow.com/a/23233092
has title: How can we make a for loop that happens every amount of time?

http://stackoverflow.com/comment/35425366
comment on: http://stackoverflow.com/q/23164913
score: 0
type: Comment
type: QuestionComment
has text: Any chance you could still reply though?

http://stackoverflow.com/q/23174722
tagged with: libgdx
tagged with: java
accepted answer: http://stackoverflow.com/a/23179059
type: Question
downvote count: 0
has body: Is there any listener in libgdx that would allow me to detect just mouse hover not pressed just hover. In the button class of scene 2D you have 2 methods isOver and isPressed but they do the same thing ... Anyone else having this problem? Is there another way to detect mouse hover over actor?
favorite count: 0
answer count: 1
upvote count: 6
has answer: http://stackoverflow.com/a/23179059
has title: Mouse hover - libgdx
tagged with: onclicklistener
score: 6
type: AnsweredQuestion

http://stackoverflow.com/comment/35408667
type: Comment
has text: I am only surprised that this didn't result in a compile-time "ambiguous type" error. I believe it *should* be an error because there is no sane way to reason about what the compiler would be supposed to do.
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/23155993

http://stackoverflow.com/q/23180338
type: AnsweredQuestion
upvote count: 0
accepted answer: http://stackoverflow.com/a/24646682
favorite count: 0
type: Question
tagged with: android
score: -1
has body: please I have need that you help me about using Jpair_v1.03 the bibliotheque. Because I don't understand how to he is working. About Jpair Jpair is a pure Java Implementation of bilinear pairing. It has no dependencies on external libraries. Although not fully tested, it should compatible with any Java version above 1.2. In fact, I've used it on the Android platform without changing any of the code. The source for documentation: https://personal.cis.strath.ac.uk/changyu.dong/jpair/jpair.html I am sorry for my bad level english That is what i made but he doesn't work: package jpair; import uk.ac.ic.doc.jpair.api.Pairing; import uk.ac.ic.doc.jpair.ibe.BFCipher; import uk.ac.ic.doc.jpair.ibe.BFCtext; import uk.ac.ic.doc.jpair.ibe.key.BFMasterPublicKey; import uk.ac.ic.doc.jpair.ibe.key.BFUserPrivateKey; import uk.ac.ic.doc.jpair.ibe.key.BFUserPublicKey; import uk.ac.ic.doc.jpair.pairing.*; import uk.ac.ic.doc.jpair.api.*; import java.security.KeyPair; import java.util.Random; public class main { public static void main(String[] args){ System.out.println("debut"); //using a predefined pairing Pairing e = Predefined.nssTate(); //get P, which is a random point in group G1 Point P = e.RandomPointInG1(new Random()); //get Q, which is a random point in group G2 Point Q = e.RandomPointInG2(new Random()); //compute e(P,Q) FieldElement epq =e.compute(P,Q); //the curve on which G1 is defined EllipticCurve g1 = e.getCurve(); //a is a 160-bit random integer BigInt a = new BigInt(160,new Random()); //Point aP is computed over G1 Point aP = g1.multiply(P, a); //The curve on which G2 is defined EllipticCurve g2 = e.getCurve2(); //b is a 160-bit random integer BigInt b = new BigInt(160,new Random()); //bQ is computed over G2 Point bQ = g2.multiply(Q, b); //compute e(aP,bQ) FieldElement res = e.compute(aP,bQ); //compute e(P,Q)^ab, this is done in group Gt BigInt ab = a.multiply(b); //get the field on which Gt is defined Field gt = e.getGt(); FieldElement res2 = gt.pow(epq,ab); //compar…
answer count: 1
downvote count: 1
has answer: http://stackoverflow.com/a/24646682
tagged with: java
has title: Please help me to Use Jpair

http://stackoverflow.com/a/23140399
downvote count: 0
has comment: http://stackoverflow.com/comment/35383879
answers question: http://stackoverflow.com/q/23139661
upvote count: 2
has body: One thing I can think of is 'Extract Class'. If you have the book 'Refactoring - Improving the design of existing code' by Martin Fowler, you'll find data clumps on page 81. It seems foo and bar are always together. They might be a data clump. A quote from the book: "A good test is to consider deleting one of the data values: if you did this, would the others make sense? If they don't, it's a sure sign that you have an object that's dying to be born." If you do extract a class, you'll end up with something that looks a lot like what Maurice suggested. However, I'd personally add final tags to foo and bar to make the object immutable.
type: Answer
score: 2

http://stackoverflow.com/comment/35543779
score: 0
type: Comment
has text: The for loop wouldn't cause the OOB as the increment happens at the bottom of the loop and would cause the exit condition to trigger at the top once it cause `index` to be `>= 10`. I'm guessing the array wasn't initialized properly in the first place.
type: AnswerComment
comment on: http://stackoverflow.com/a/23231727

http://stackoverflow.com/q/23232722
has comment: http://stackoverflow.com/comment/35545508
upvote count: 0
answer count: 1
linked to: http://stackoverflow.com/q/3286067
favorite count: 0
has body: This code is used to find if a book is available or not. Now IF the bookname for eg is Analog Electronics and if i Enter input just as Analog or electronics it will display the full bookname Analog electronics which means that the 1st n 2nd try/catch block were executed properly. But when i Enter input as Analog electronics with a space in between the two words it delivers an error and says "Check your internet connection " even when my internet connection is proper. It catches the error in the 1st try/catch block which should'nt have happened. I am getting an error all because of the "space". try { response = CustomHttpClient.executeHttpPost( "http://duh.com/lol.php?name="+input, postParameters); String result = response.toString(); try{ returnString = ""; JSONArray jArray = new JSONArray(result); for(int i=0;i&lt;jArray.length();i++){ JSONObject json_data = jArray.getJSONObject(i); Log.i("log_tag","ID: "+json_data.getInt("ID")+ ", Bookname: "+json_data.getString("Bookname")+ ); returnString += "\n" + "Book+ json_data.getString("Bookname"); } } catch(JSONException e){ Toast toast = Toast.makeText(getBaseContext(), "Book is not availabe" ,Toast.LENGTH_LONG); toast.show(); toast.getView().postDelayed(new Runnable() { @Override public void run() { startActivity(new Intent(getBaseContext(), MainActivity.class)); finish(); } }, 3500); } try{ tv.setText(returnString); } catch(Exception e){ Toast.makeText(getBaseContext(), "Error in Display" ,Toast.LENGTH_LONG).show();; } } catch (Exception e) { Toast toast = Toast.makeText(getBaseContext(), "Check your Internet connection" ,Toast.LENGTH_LONG); toast.show(); toast.getView().postDelayed(new Runnable() { @Override public void run() { startActivity(new Intent(getBaseContext(), MainActivity.class)); finish(); } }, 3500); }; } LOG cat error : 04-22 20:51:52.589: E/log_tag(1322): Check your internet connection!!java.lang.IllegalArgumentException: Illegal character in query at index 52: http://duh.com/lol.php?name=analog electon…
tagged with: android
has answer: http://stackoverflow.com/a/23233046
has comment: http://stackoverflow.com/comment/35545482
accepted answer: http://stackoverflow.com/a/23233046
has comment: http://stackoverflow.com/comment/35545536
type: AnsweredQuestion
tagged with: java
downvote count: 2
has comment: http://stackoverflow.com/comment/35545410
type: Question
tagged with: try-catch
score: -2
has title: Error in execution of Try/catch statement in Android
has comment: http://stackoverflow.com/comment/35545871

http://stackoverflow.com/q/23266229
has comment: http://stackoverflow.com/comment/35644598
has comment: http://stackoverflow.com/comment/35605586
has answer: http://stackoverflow.com/a/23266305
upvote count: 1
tagged with: android
has comment: http://stackoverflow.com/comment/35605743
favorite count: 0
downvote count: 0
has body: I use eclipse and android sdk.I want to pin point a location on map so i use this function when user click on a button: public void pinpointlocation(Context context){ map = ((SupportMapFragment) ((FragmentActivity) mContext).getSupportFragmentManager().findFragmentById(android.R.id.content)) .getMap(); Marker hamburg = map.addMarker(new MarkerOptions().position(HAMBURG) .title("Hamburg")); Marker kiel = map.addMarker(new MarkerOptions() .position(KIEL) .title("Kiel") .snippet("Kiel is cool") .icon(BitmapDescriptorFactory .fromResource(R.drawable.ic_launcher))); // Move the camera instantly to hamburg with a zoom of 15. map.moveCamera(CameraUpdateFactory.newLatLngZoom(HAMBURG, 15)); // Zoom in, animating the camera. map.animateCamera(CameraUpdateFactory.zoomTo(10), 2000, null); } but when i run the program in emulator it crash and get me these error : 04-24 06:16:35.327: E/AndroidRuntime(4070): java.lang.NullPointerException 04-24 06:16:35.327: E/AndroidRuntime(4070): at com.example.hach.Mhelper.pinpointlocation(Mhelper.java:59) 04-24 06:16:35.327: E/AndroidRuntime(4070): at com.example.hach.MainActivity$PlaceholderFragment$1.onClick(MainActivity.java:90) which line 59 is the first line of the function. Why the map is null?
type: AnsweredQuestion
has title: NullPointerException on Map Object
score: 1
has comment: http://stackoverflow.com/comment/35605655
tagged with: java
has comment: http://stackoverflow.com/comment/35605562
has comment: http://stackoverflow.com/comment/35605517
tagged with: eclipse
type: Question
accepted answer: http://stackoverflow.com/a/23266305
tagged with: google-maps
answer count: 1

http://stackoverflow.com/q/23277621
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/23277910
upvote count: 1
tagged with: swing
tagged with: video
type: AnsweredQuestion
score: 1
has title: Unable to see Video When using JavaFX JFXPanel within a JDialog
tagged with: java
tagged with: javafx
type: Question
accepted answer: http://stackoverflow.com/a/23277910
has body: I'm trying to embed a video in a JDialog box. Eventually I need to embed three seperate videos and therefore I have implemented the functionality in such a way as to define my own JFXPanel implementation for reuse. I am able to run the application and when I debug into it the createScene is being executed but I am not seeing any visible video and I am not getting any errors. I also attempted to output text and that was not visible either. I have been able to get the video I would like to embed to show in a pure JavaFX implementation so I know it is not the encoding or something. Can I please get somebody to review the following code and give me some suggestions. I am using Netbeans as an IDE if that is important. Thanks! /* * To change this template, choose Tools | Templates * and open the template in the editor. */ package swingjavafxtest; import javafx.embed.swing.JFXPanel; /** * * @author acarnes */ public class SwingJavaFXTestDialog extends javax.swing.JDialog { private static final String BURST_OPTION_1_VIDEO = "file:///c:/vids/burst_option1.MP4"; /** * Creates new form SwingJavaFXTestDialog */ public SwingJavaFXTestDialog(java.awt.Frame parent, boolean modal) { super(parent, modal); initComponents(); } /** * This method is called from within the constructor to initialize the * form. WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // &lt;editor-fold defaultstate="collapsed" desc="Generated Code"&gt; private void initComponents() { setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); setModalityType(java.awt.Dialog.ModalityType.APPLICATION_MODAL); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 400, Short.MAX_VALUE) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing…
downvote count: 0

jtextfield
tags question: http://stackoverflow.com/q/23233473
tags question: http://stackoverflow.com/q/23248657
tags question: http://stackoverflow.com/q/23186680
tags question: http://stackoverflow.com/q/23247887
tags question: http://stackoverflow.com/q/23206984
tags question: http://stackoverflow.com/q/23134329
tags question: http://stackoverflow.com/q/23280267
tags question: http://stackoverflow.com/q/23229827
tags question: http://stackoverflow.com/q/23149451
tags question: http://stackoverflow.com/q/23171455
tags question: http://stackoverflow.com/q/23140907
tags question: http://stackoverflow.com/q/23180528
tags question: http://stackoverflow.com/q/23155628
tags question: http://stackoverflow.com/q/23279253
tag name: jtextfield
type: Tag
tags question: http://stackoverflow.com/q/23150698
tags question: http://stackoverflow.com/q/23140862
tags question: http://stackoverflow.com/q/23201880
tags question: http://stackoverflow.com/q/23280563

http://stackoverflow.com/comment/35390060
type: Comment
type: QuestionComment
has text: how can I predict the URL ? you know better where is it located. I have to watch the entire video otherwise to answer that!
comment on: http://stackoverflow.com/q/23144597
score: 0

http://stackoverflow.com/a/23362907
type: Answer
answers question: http://stackoverflow.com/q/23282699
has body: Struts2 validation is not the purely server side validation and not a client side validation too. Its taken as front-end validation of web application. By the way you can use this as your preference. All the clients are not well support for html5. So its better to choose struts2 validation. You would be able to do it on separate validation xml file. But its not must.
has comment: http://stackoverflow.com/comment/35784186
score: 0
has comment: http://stackoverflow.com/comment/35815670

http://stackoverflow.com/a/23195043
answers question: http://stackoverflow.com/q/23194949
upvote count: 1
has body: select count(*) from x where key = something It will return a integer value. if value >0 = true. Else false.
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/q/23147941
has comment: http://stackoverflow.com/comment/35395756
upvote count: 3
tagged with: java
has body: I have a question regarding creating an array of variables; if I create an array of variables of the integer type, and I change the value of those variables outside of the array will the values inside the array also get update? I have tried this out in eclipse and it doesn't seem to work (see code below) int num1 = 1; int num2 = 2; int num3 = 3; int [] nums = {num1, num2, num3}; num1++; System.out.println(num1); System.out.println(nums[0]); What I am hoping for is for the two outputs (num1 and nums[0]) to be the same, but what I am experiencing so far is that nums[0] stays the same and doesn't get updated, any tips on how to get this value updated (without needing to go in and update it as well) is most appreciated
linked to: http://stackoverflow.com/q/23177900
possible better answer: http://stackoverflow.com/a/23148026
type: Question
has answer: http://stackoverflow.com/a/23148026
answer count: 2
has answer: http://stackoverflow.com/a/23147973
tagged with: arrays
downvote count: 0
tagged with: variables
favorite count: 0
accepted answer: http://stackoverflow.com/a/23147973
has title: creating an array of variables
type: AnsweredQuestion
score: 3

http://stackoverflow.com/comment/42520123
type: Comment
type: QuestionComment
has text: @VickyVilas Found any solution? I'm facing same issue.
score: 0
comment on: http://stackoverflow.com/q/23270818

http://stackoverflow.com/comment/35400519
type: QuestionComment
score: 0
has text: yes the return of arraylist is correct.
type: Comment
comment on: http://stackoverflow.com/q/23151306

http://stackoverflow.com/a/23213544
type: AcceptedAnswer
score: 0
type: Answer
has body: It's actually pretty simple. I only had to remove the first bar: "images/myimage.png" getting the following result: &lt;g:Image url="images/myimage.png" /&gt;
accepted answer of: http://stackoverflow.com/q/23207214
has comment: http://stackoverflow.com/comment/35559155
has comment: http://stackoverflow.com/comment/35545950
answers question: http://stackoverflow.com/q/23207214

http://stackoverflow.com/comment/35443403
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23175385
score: 0
has text: What is your expected result?

http://stackoverflow.com/comment/35572734
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23247069
has text: FYI, MATLAB is shipped with it's own java. Here's a support article that may be of use though: http://www.mathworks.com/matlabcentral/answers/103056-how-do-i-change-the-java-virtual-machine-jvm-that-matlab-is-using

http://stackoverflow.com/comment/35454244
type: Comment
type: QuestionComment
score: 0
has text: Add that to the question. It's _a lot_ more relevant than the code
comment on: http://stackoverflow.com/q/23176815

http://stackoverflow.com/comment/35632429
score: 1
has text: @Prem `props`, `refreshSecs` and `lastReadTimestamp` are all first read in the if condition _outside_ the synchronized block, which may make the threads skip entering the block and thus missing the changes.
comment on: http://stackoverflow.com/q/23273378
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23140720
has comment: http://stackoverflow.com/comment/35382716
downvote count: 0
answers question: http://stackoverflow.com/q/23140539
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23140539
has comment: http://stackoverflow.com/comment/35383182
type: Answer
score: 14
upvote count: 14
has body: The picture you have posted pertains to the Type-1 JDBC drivers, which is mostly legacy today. More generally, the picture explains the lower-level details which are not relevant to understanding C3P0. C3P0 is simply an implementation of the DataSource API, which conceptually sits just above the raw JDBC DriverManager. The main function of a DataSource is acquiring a standard JDBC Connection from it and releasing it in the end.

http://stackoverflow.com/q/23140265
type: UnansweredQuestion
tagged with: java
has body: I am trying to use Google AdMob to display InterstitialAd but I have a problem with Google services. After I run my app on device I receive the following message: The Google Play services resources were not found. Check your project configuration to ensure that the resources are included. This is my code: interstitial = new InterstitialAd(getActivity()); interstitial.setAdUnitId("id"); AdRequest adRequest = new AdRequest.Builder().build(); interstitial.loadAd(adRequest); @Override public void onResume(){ super.onResume(); if (interstitial.isLoaded()) { interstitial.show(); } } What could be a problem? Thanks!
type: Question
tagged with: admob
score: 0
has comment: http://stackoverflow.com/comment/35389164
tagged with: android
has title: The Google Play services resources were not found when running InterstitialAd
has comment: http://stackoverflow.com/comment/35384518
answer count: 0
has comment: http://stackoverflow.com/comment/35393121

http://stackoverflow.com/comment/35380148
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23139380
has text: @jameslarge What would `x instanceof Object` yield? `true`.
score: 0

http://stackoverflow.com/comment/35641676
has text: @Kon - it can be statc method of ATM
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23285177

http://stackoverflow.com/comment/35648681
type: Comment
has text: Very strange: all seems to work fine, the overridden getResources() on my activity is called dozend times during inflate, but not a single call to getColor on the returned CustomResources class.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23273860

http://stackoverflow.com/a/23253705
downvote count: 0
has comment: http://stackoverflow.com/comment/35583495
type: Answer
has body: Try: public RecursivePalindrome(String a) { word = a; } This code works, but it isn't a recursion! package recursion; public class RecursivePalindrome { static String word; public RecursivePalindrome(String a) { word = a; } public static boolean isPalindrome() { int start = 0; int end = word.length() - 1; char a = word.charAt(start); char z = word.charAt(end); Character.toLowerCase(a); Character.toLowerCase(z); while (start &lt; end) { if (Character.isLetter(a) &amp;&amp; Character.isLetter(z)) { if (a == z) { start++; end--; a = word.charAt(start); z = word.charAt(end); } else { return false; } } else if (!Character.isLetter(a)) { start++; } else if (!Character.isLetter(z)) { end--; } else { return false; } } return true; } public static void main(String[] args) { new RecursivePalindrome("testing"); if (isPalindrome()) System.out.println("Is!"); else System.out.println("Is not!"); } }
answers question: http://stackoverflow.com/q/23253637
score: 1
upvote count: 1

http://stackoverflow.com/q/23161245
tagged with: java
tagged with: database
has comment: http://stackoverflow.com/comment/35418562
type: Question
has answer: http://stackoverflow.com/a/23161333
has title: Only first row from array being added to database Java
has comment: http://stackoverflow.com/comment/35418585
answer count: 2
has comment: http://stackoverflow.com/comment/35418619
tagged with: arrays
accepted answer: http://stackoverflow.com/a/23162419
downvote count: 0
possible better answer: http://stackoverflow.com/a/23161333
favorite count: 0
has body: I am trying to add an array to a database. I could get the first row into the database but it doesn't add the remaining rows. Here is the values array string: [1, Ola, Hansen, Timoteivn, Sandnes , 2, Tove, Svendson, Borgvn, Stavanger , 3, Kari, Pettersen, Storgt, Stavanger] Here is my code to add: try { BufferedReader br = new BufferedReader(new FileReader( "newoutfile.txt")); // String line; for (String line = br.readLine(); line != null; line = br .readLine()) { String newline = line.substring(2); String newline2 = newline.trim(); String[] value = newline2.split(","); System.out.println("the array" + Arrays.toString(value)); connection.createStatement().execute( "insert into person10(personid,first_name,last_name,street,city)values('" + value[0] + "','" + value[1] + "','" + value[2] + "','" + value[3] + "','" + value[4] + "')"); } I have been pulling my hair all day trying to get this to work. Any help would be great. Thanks.
upvote count: 2
has comment: http://stackoverflow.com/comment/35418721
has answer: http://stackoverflow.com/a/23162419
has comment: http://stackoverflow.com/comment/35418633
score: 2
type: AnsweredQuestion

http://stackoverflow.com/q/23160584
favorite count: 0
has answer: http://stackoverflow.com/a/60131052
has answer: http://stackoverflow.com/a/23160672
has answer: http://stackoverflow.com/a/23160680
downvote count: 3
has answer: http://stackoverflow.com/a/23160631
upvote count: 1
type: AnsweredQuestion
has title: java get all values of an array in a method
score: -2
tagged with: java
has answer: http://stackoverflow.com/a/23160664
has answer: http://stackoverflow.com/a/23160883
tagged with: methods
has body: I'm creating a method to return values of an array. But, I have a problem. Let's assume the array values are: 771 11 141 1 11 79 7 arr[0] = 771, arr[1] = 11, arr[2] = 141,...arr[n] Then, this is my method: public static String split_in_string(int [] an){ int ans; String ansl = ""; for(int i = 0; i &lt; an.length; i++){ ans = an[i]; ansl = Integer.toString(ans); return ansl; } return ansl; } If I use below part in main method: int ans; String ansl = ""; for(int i = 0; i &lt; an.length; i++){ ans = an[i]; ansl = Integer.toString(ans); System.out.println(ansl+" "); } It works well. But, if I use split_in_string() method, it displays only the first array value. I expected 771 11 141 1 11 79 7 as the result, but I get only 771 What's wrong in my split_in_string() method? How can I fix it?
type: Question
possible better answer: http://stackoverflow.com/a/23160638
accepted answer: http://stackoverflow.com/a/23160631
tagged with: arrays
has comment: http://stackoverflow.com/comment/35417304
has answer: http://stackoverflow.com/a/23160638
answer count: 7

http://stackoverflow.com/q/23194073
type: AnsweredQuestion
has title: Why are different function being called when tomcat restarts?
tagged with: java
tagged with: dwr
has body: We have below overridden functions in java MailboxUtils.GetMailboxWithUIMap = function(p0, p1, p2, callback) { DWREngine._execute(MailboxUtils._path, 'MailboxUtils', 'GetMailboxWithUIMap', p0, p1, p2, callback); } MailboxUtils.GetMailboxWithUIMap = function(p0, p1, callback) { DWREngine._execute(MailboxUtils._path, 'MailboxUtils', 'GetMailboxWithUIMap', p0, p1, callback); } For some strange reason when tomcat server is started and the program executes, it calls the function with 4 arguments ie function(p0, p1, p2, callback) even though we have passed in only 3 arguments. Then if we restart tomcat server, the system starts behaving normally and starts calling the right function ie function(p0, p1, callback). This seems to be very random and the only way to fix it is to restart Tomcat many times until the problem gets resolved. Has anyone seen this kind of problem before? ANy way we can fix this?
type: Question
score: 0
answer count: 1
tagged with: javascript
accepted answer: http://stackoverflow.com/a/23711405
has answer: http://stackoverflow.com/a/23711405

http://stackoverflow.com/a/23172142
has body: (untested) Did you try this as mentioned in JavaDoc? FileWriter fileWriter = new FileWriter(file, true);
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/35437668
type: Answer
accepted answer of: http://stackoverflow.com/q/23172113
answers question: http://stackoverflow.com/q/23172113
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/35437596

http://stackoverflow.com/q/23172632
tagged with: performance
has comment: http://stackoverflow.com/comment/35439930
has comment: http://stackoverflow.com/comment/35439874
has comment: http://stackoverflow.com/comment/35438948
accepted answer: http://stackoverflow.com/a/23172806
has comment: http://stackoverflow.com/comment/35439550
has comment: http://stackoverflow.com/comment/35440216
linked to: http://stackoverflow.com/q/22230866
score: 2
linked to: http://stackoverflow.com/q/22391353
tagged with: graphics2d
answer count: 1
has comment: http://stackoverflow.com/comment/35439774
favorite count: 0
has comment: http://stackoverflow.com/comment/35440021
has comment: http://stackoverflow.com/comment/35638244
linked to: http://stackoverflow.com/q/22802772
has body: Suspicious fillRect() Speed Okay so let me get this straight. Java fills rectangles by iterating through an array and changing the rgb values to a designated color. If all it does is change the color then why is Texturepaint so expensive if all it is doing is changing the integer in the array? Does changing the integer in between take time to register? Fast fillRect() operation using setPaint(new Color()); setPaint(new Color(0,0,0)); fillRect(0,0,frame.getWidth(),frame.getHeight()); // Around 100+ fps repainting with timer set to zero milliseconds. Slow fillRect() operation using setPaint(new TexturePaint()); setPaint(new TexturePaint(image, rectangle)); fillRect(0,0,frame.getWidth(),frame.getHeight()); // Around 20+ fps repainting with timer set to zero milliseconds.
has comment: http://stackoverflow.com/comment/35439046
type: AnsweredQuestion
tagged with: paint
upvote count: 3
has title: Java fillRect() Inconsistencies
tagged with: java
tagged with: fill
downvote count: 1
type: Question
linked to: http://stackoverflow.com/q/23118515
has answer: http://stackoverflow.com/a/23172806

http://stackoverflow.com/q/23158798
has comment: http://stackoverflow.com/comment/35413853
has body: I was going through the following tutorials and I came across this code which I got stumped as to what it is doing: while (true) { if (myMap != null &amp;&amp; myMap.get() != null) { **myMap.get().put(i++, "test" + i);** System.out.println("im still working!!!!"); I have no idewa waht myMap.get().put() does, can you explain to me ?
type: UnansweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/23158897
has comment: http://stackoverflow.com/comment/35413984
type: Question
has title: understanding hashmap java syntax myMap.get().put()
has comment: http://stackoverflow.com/comment/35413789
score: 0
answer count: 1

http://stackoverflow.com/q/23194368
has answer: http://stackoverflow.com/a/23194705
has body: Scanner choice = new Scanner(System.in); while(!choice.hasNextInt()) { System.out.println("Invalid input"); choice.next(); } // Carry out appropriate method relating to user choice boolean done = false; // Loop is not finished while (!done) { int i = choice.nextInt(); // Save the user's choice as int i /* * A switch statement here would probably be more elegant but this works too * Problem: If the user inputs a non-integer number e.g. 2.3 the program explodes :( */ if (i == 1) { newGame(); // Call newGame method } else if (i == 2) { playGame(); // Call playGame method } else if (i == 3) { viewResults(); // Call viewResults method } else if (i == 4) { done = true; // If user quits, the loop is done quitGame(); // Call quitGame method } else { System.out.println("Invalid input"); } } The only valid input for this needs to be the numbers 1, 2, 3 and 4. If I enter a string it doesn't accept it. If i enter a number larger than 4 it doesn't accept it. However if I was to enter 2.3 or something the program crashes. I can't see what it causing this as 2.3 is not an integer and I don't know how it gets past the hasNextInt() method in Scanner. Anyone shed some light?
tagged with: java.util.scanner
linked to: http://stackoverflow.com/q/2496239
score: 1
tagged with: java
has title: Scanner class hasNextInt() method seems to allow a decimal to get through, or maybe it's caused by something else.
upvote count: 1
has answer: http://stackoverflow.com/a/23194505
type: Question
answer count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/35476525
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/q/23169761
upvote count: 1
has answer: http://stackoverflow.com/a/79513466
favorite count: 0
has body: I have this simple piece o code : DateTimeFormatter format = DateTimeFormat.forPattern("YYYY MM DD"); DateTime dateTime; String buffer = "2013 01 01"; dateTime = format.parseDateTime(buffer); System.out.println(dateTime.getMonthOfYear()); buffer = "2013 02 01"; dateTime = format.parseDateTime(buffer); System.out.println(dateTime.getMonthOfYear()); and output is: 1 1 but I would expect: 1 2 ...where is the problem? I don't need to get month of year, but I have problem with determining dayOfWeek, because dateTime has always January and not other months.
answer count: 3
possible better answer: http://stackoverflow.com/a/23175268
has answer: http://stackoverflow.com/a/23175268
tagged with: parsing
downvote count: 0
tagged with: time
has title: Joda time does not parse months correctly
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23169952
score: 1
tagged with: java
tagged with: date
type: Question
tagged with: jodatime
has answer: http://stackoverflow.com/a/23169952

http://stackoverflow.com/a/23207731
type: Answer
upvote count: 4
downvote count: 0
answers question: http://stackoverflow.com/q/23207693
has comment: http://stackoverflow.com/comment/35500944
accepted answer of: http://stackoverflow.com/q/23207693
score: 4
type: AcceptedAnswer
has body: Quote "When Sun was designing Java, it omitted multiple inheritance - or more precisely multiple implementation inheritance - on purpose. Yet multiple inheritance can be useful, particularly when the potential ancestors of a class have orthogonal concerns. This article presents a utility class that not only allows multiple inheritance to be simulated, but also has other far-reaching applications. Have you ever found yourself wanting to write something similar to: public class Employee extends Person, Employment { // detail omitted } Here, Person is a concrete class that represents a person, while Employment is another concrete class that represents the details of a person who is employed. If you could only put them together, you would have everything necessary to define and implement an Employee class. Except in Java - you can't. Inheriting implementation from more than one superclass - multiple implementation inheritance - is not a feature of the language. Java allows a class to have a single superclass and no more." One option to you is "Inheritance from Inheritance": public class Person extends Employee public class Employee extends Employment

http://stackoverflow.com/comment/35572203
has text: I have tried passing like this `parser.parse(new File("/XMLParsers/src/main/java/Employees.xml"), handler);`
comment on: http://stackoverflow.com/q/23246666
score: 0
type: Comment
type: QuestionComment

android-viewpager
tag name: android-viewpager
type: Tag
tags question: http://stackoverflow.com/q/23136309
tags question: http://stackoverflow.com/q/23218406
tags question: http://stackoverflow.com/q/23138613

http://stackoverflow.com/a/23227871
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23227409
type: Answer
has comment: http://stackoverflow.com/comment/35538208
score: 0
has body: If all the data doesn't fit in memory, you will have to open and read the file B for every line of file A: try (FileReader frA = new FileReader(filenameA); BufferedReader brA = new BufferedReader(frA)) { String lineA; while ((lineA = brA.readLine()) != null) { String value = lineA.split(",")[0]; try (FileReader frB = new FileReader(filenameB); BufferedReader brB = new BufferedReader(frB)) { boolean found = false; String lineB; while ((lineB = brB.readLine()) != null) { String[] values = lineB.split(","); if (value.equals(values[0])) { if (!found) { System.out.println("Matches for " + value + ":"); } System.out.println(lineB); found = true; } } } catch (IOException e) { e.printStackTrace(); } } } catch (IOException e) { e.printStackTrace(); } If the data does fit in memory, then you could read all the lines into two lists, and then process the lists using nested loops, or you could put the lines of file B into a Multimap indexed by the value at the beginning of the line, and then look up the matching lines directly. ListMultimap&lt;String, String&gt; fileB = ArrayListMultimap.create(); try (FileReader frB = new FileReader(filenameB); BufferedReader brB = new BufferedReader(frB)) { String lineB; while ((lineB = brB.readLine()) != null) { String[] values = lineB.split(","); fileB.put(values[0], lineB); // map from first value to full line } } catch (IOException e) { e.printStackTrace(); } try (FileReader frA = new FileReader(filenameA); BufferedReader brA = new BufferedReader(frA)) { String lineA; while ((lineA = brA.readLine()) != null) { String value = lineA.split(",")[0]; if (fileB.containsKey(value)) { System.out.println("Matches for " + value + ":"); for (String line : fileB.get(value)) { System.out.println(line); } } } } catch (IOException e) { e.printStackTrace(); }
answers question: http://stackoverflow.com/q/23227409

state
tag name: state
tags question: http://stackoverflow.com/q/23278359
type: Tag

http://stackoverflow.com/a/23147996
has body: You can use mvc frameworks like Struts(1.2 or 2) or Spring MVC which are built in frameworks for MVC pattern. In these frameworks you can configure your controller mapping through xml or annotation and requests will go through internal controller like DispatcherServlet which will pass the control to mapped custom controller classes.
answers question: http://stackoverflow.com/q/23147310
score: 0
type: Answer

http://stackoverflow.com/q/23267506
has comment: http://stackoverflow.com/comment/35608976
has comment: http://stackoverflow.com/comment/35612915
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35613588
has title: Java Servlet/JSP Custom Error Page
has comment: http://stackoverflow.com/comment/35611547
has comment: http://stackoverflow.com/comment/35613516
has comment: http://stackoverflow.com/comment/35610448
has comment: http://stackoverflow.com/comment/35609203
has comment: http://stackoverflow.com/comment/35610300
tagged with: java
has comment: http://stackoverflow.com/comment/35609002
has comment: http://stackoverflow.com/comment/35613711
has comment: http://stackoverflow.com/comment/35608875
has comment: http://stackoverflow.com/comment/35608735
has comment: http://stackoverflow.com/comment/35612815
has comment: http://stackoverflow.com/comment/35610342
has comment: http://stackoverflow.com/comment/35612356
has comment: http://stackoverflow.com/comment/35608370
type: Question
tagged with: try-catch
has comment: http://stackoverflow.com/comment/35609977
has comment: http://stackoverflow.com/comment/35608779
has comment: http://stackoverflow.com/comment/35609181
has comment: http://stackoverflow.com/comment/35608538
has comment: http://stackoverflow.com/comment/35610133
has comment: http://stackoverflow.com/comment/35609843
tagged with: servlets
has comment: http://stackoverflow.com/comment/35612517
score: 0
has comment: http://stackoverflow.com/comment/35613392
answer count: 2
has comment: http://stackoverflow.com/comment/35609554
has comment: http://stackoverflow.com/comment/35609029
has answer: http://stackoverflow.com/a/56053538
has comment: http://stackoverflow.com/comment/35613651
has body: I have a custom error page setup for basic debugging whilst I'm programming and for some reason none of the values from the try catches get through. The error page just says: "Null null null". If anyone can help with this I'd be very grateful. Servlet: package com.atrium.userServlets; import java.io.IOException; import java.util.regex.Matcher; import java.util.regex.Pattern; import javax.servlet.ServletException; 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 com.atrium.DAOs.UserDAO; import com.atrium.userBeans.UserRegistrationBean; @WebServlet("/Register") public class UserRegistrationServlet extends HttpServlet { private static final long serialVersionUID = 1L; public UserRegistrationServlet() { super(); } protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { try { HttpSession session = request.getSession(false); if (session == null) { response.sendRedirect(this.getServletContext() + "/Authenticate"); return; } request.getRequestDispatcher("/WEB-INF/register.jsp").forward(request, response); } catch(Throwable exception) { String errorMessage = exception.getMessage(); Throwable errorCause = exception.getCause(); String errorLocation = this.getServletName(); request.setAttribute("ErrorMessage", errorMessage); request.setAttribute("ErrorCause", errorCause); request.setAttribute("ErrorLocation", errorLocation); request.getRequestDispatcher("/WEB-INF/errorDisplay.jsp").forward(request, response); } } protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { try { String ErrorMessage = ""; //Check user name is supplied if (request.getParameter("Username") == null || request.getParameter("Username") == "") { ErrorMessage = "You must enter a username!"; request.setAttribute("Er…
has answer: http://stackoverflow.com/a/23267763
has comment: http://stackoverflow.com/comment/35613248
tagged with: jsp
has comment: http://stackoverflow.com/comment/35611347
has comment: http://stackoverflow.com/comment/35610762

http://stackoverflow.com/comment/35644208
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23286148
score: 0
has text: public link to Concurrency Visualizer image, feel free to post it here: http://yadi.sk/d/ykLwD4STNC8fV

http://stackoverflow.com/comment/85115604
score: 1
comment on: http://stackoverflow.com/a/23148589
type: AnswerComment
has text: Addresses the technicality
type: Comment

http://stackoverflow.com/comment/35412079
type: Comment
type: QuestionComment
has text: I might just be missing something but ... you already guarantee that `Holder1` and `Holder2` can only hold something that extends `Content` in their definitions.
score: 0
comment on: http://stackoverflow.com/q/23157636

http://stackoverflow.com/comment/35370159
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23134217
has text: price_lower_str = price_lower_trim(); i already did it.
score: 0

http://stackoverflow.com/a/23280095
type: Answer
answers question: http://stackoverflow.com/q/23221440
has body: You have to call methods but you neither have to define new methods nor to define interfaces. If I understood correctly you want to convert from one enum type to another by matching name: public class ConversionTest { enum BusinessUnit { ONE, TWO } enum BUSINESS_UNIT { ONE, TWO } @Test public void convert_BUSINESS_UNIT_to_BusinessUnit() { assertEquals(BusinessUnit.ONE, BusinessUnit.valueOf(BUSINESS_UNIT.ONE.name())); } @Test public void convert_BusinessUnit_to_BUSINESS_UNIT() { assertEquals(BUSINESS_UNIT.ONE, BUSINESS_UNIT.valueOf(BusinessUnit.ONE.name())); } }
score: 0

http://stackoverflow.com/q/23172425
type: AnsweredQuestion
downvote count: 0
type: Question
possible better answer: http://stackoverflow.com/a/23172538
linked to: http://stackoverflow.com/q/5758660
tagged with: enums
has answer: http://stackoverflow.com/a/23172538
has answer: http://stackoverflow.com/a/23172615
has body: This has to be something small, but I'm not getting it. Why is this causing an unchecked cast compiler warning, when it has the exact same generic declaration as in Enum's valueOf? public static final &lt;T extends Enum&lt;T&gt;&gt; Enum toValue(T for_value, String value) { try { return Enum.&lt;T&gt;valueOf((Class&lt;T&gt;)for_value.getClass(), value); } catch(RuntimeException rx) { throw new IllegalArgumentException(value); } } Compiler warning: R:\jeffy\programming\sandbox\xbnjava\xbn\util\EnumUtil.java:92: warning: [unchecked] unchecked cast Enum.&lt;T&gt;valueOf((Class&lt;T&gt;)for_value.getClass(), value); ^ required: Class&lt;T&gt; found: Class&lt;CAP#1&gt; where T is a type-variable: T extends Enum&lt;T&gt; declared in method &lt;T&gt;toValue(T,String,String) where CAP#1 is a fresh type-variable: CAP#1 extends Enum from capture of ? extends Enum R:\jeffy\programming\sandbox\xbnjava\xbn\util\EnumUtil.java:98: error: missing return statement } ^ 1 error 1 warning It also happens in one or both of the generics are removed from the function call, such as Enum.valueOf(for_value.getClass(), value); This is the closest question I've found: Enum.valueOf throws a warning for unknown type of class that extends Enum?. This enum's type is known.
tagged with: java
has answer: http://stackoverflow.com/a/23172681
accepted answer: http://stackoverflow.com/a/23172681
score: 4
has comment: http://stackoverflow.com/comment/35438300
answer count: 3
linked to: http://stackoverflow.com/q/7042424
has title: Calling Enum.<T>valueOf() giving unchecked cast warning, despite T being declared <T extends Enum<T>>
favorite count: 0
upvote count: 4
tagged with: generics

http://stackoverflow.com/comment/35587110
type: AnswerComment
score: 0
type: Comment
has text: @Chandan: sorry my previous suggestion didn't work. I've edited my answer to come up with another suggestion - does this work for you?
comment on: http://stackoverflow.com/a/23254111

http://stackoverflow.com/a/24028700
type: Answer
answers question: http://stackoverflow.com/q/23245670
has body: I tried it and had the same problem. I removed android:icon="@drawable/ic_action_search" (instead of adding the images because I'm lazy) and added the action_search string in the resource file to make sure the menu file wasn't referring to anything that didn't exist. After that, I tried changing android:id to android:title because I saw that it had worked for you, and this was curious. It caused an error after saving, and so I changed it back. After changing it back and saving, the original error in the MainActivity.java file disappeared, and R.id.action_search was resolved. I think the problem is just that R.java is not being updated, and you have to basically hit it with a hammer by forcing an error and fixing it, at least in my case. I don't know why using android:title worked for you. Hope this helps somehow.
downvote count: 1
score: -1
upvote count: 0

http://stackoverflow.com/q/23254620
answer count: 2
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/35592258
tagged with: orm
tagged with: database
has title: Hibernate @OneToMany association creates duplicates when saving parent entity
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23254939
tagged with: cascade
type: Question
has body: I have an association involving a Brand (for animals) and then the animal Species for which the brand can be applied to. In our case, there is the Brand model, the Species model, and a relational model BrandSpecies. The two that are relevant to my question are the Brand model and the BrandSpecies model. The form will be sending IDs for species that may already be associated with the brand. I am hoping to avoid having to loop through the set and check if the species has already been accounted for. I've tried calling clear() on the set of species and adding every ID sent from the server, but the old DB records still exist once the object has been persisted. My Brand association: public class PendingBrandModel implements Serializable, Comparable&lt;PendingBrandModel&gt; { . . . @JsonBackReference @OneToMany(mappedBy="pending_brand", cascade = {CascadeType.ALL}) private Set&lt;PendingBrandSpeciesModel&gt; selected_species; ... } The Brand-Species association: public class PendingBrandSpeciesModel implements Serializable { ... @JsonManagedReference @ManyToOne() @JoinColumn(name="pending_brand", referencedColumnName="id", nullable = false) private PendingBrandModel pending_brand; @JsonManagedReference @ManyToOne() @JoinColumn(name="species", referencedColumnName="id", nullable = false) private BrandSpeciesModel species; // below here are the hashCode and equals override methods... @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((id == null) ? 0 : id.hashCode()); return result; } /* (non-Javadoc) * @see java.lang.Object#equals(java.lang.Object) */ @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; PendingBrandSpeciesModel other = (PendingBrandSpeciesModel) obj; Boolean brandIDsMatch = false; Boolean speciesIDsMatch = false; if(pending_brand != null &amp;&amp; other.getPending_brand() != null) { if((pending_brand.getId() …
has answer: http://stackoverflow.com/a/39715086
score: 0

http://stackoverflow.com/a/23162706
score: 3
has body: Iterable&lt;T&gt; is an interface. What this means is that when you receive it as a return value from a method, you actually receive an implementation of it. So, although you don't know what the name of that implementation is (the name of the class that implements the Iterable&lt;T&gt; interface), you can still access the methods that it implements, and act upon it. Some built-in implementations include ArrayList, LinkedList, HashSet, PriorityQueue, and Stack. When you need to return an interface type, you must return an implementation of it.
upvote count: 3
type: Answer
answers question: http://stackoverflow.com/q/23162559
downvote count: 0

http://stackoverflow.com/q/23166984
possible better answer: http://stackoverflow.com/a/23167012
answer count: 5
has answer: http://stackoverflow.com/a/23167098
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23167050
downvote count: 0
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/23167077
upvote count: 2
has title: Package and visibility?
has answer: http://stackoverflow.com/a/23167012
has answer: http://stackoverflow.com/a/23167293
accepted answer: http://stackoverflow.com/a/23167293
favorite count: 0
has body: I'm making an SDK and I'm trying to separate classes to different packages, those classes use some other shared classes. The issue is if I made the shared classes public everyone will be able to see them, not only my classes. What's the right way to make them only accessible by my application? Package a MyClass1 Package b MyClass2 Package c public MySharedClass Because c is public MySharedClass will be able to access it, but the issue is that it will also will be visible to the world, how could I prevent that?

http://stackoverflow.com/comment/35391744
comment on: http://stackoverflow.com/q/23145290
has text: The problem is if I try to load all the info of the second Json file my laptop throws a heap space exception!
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23151804
tagged with: effect
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35401433
tagged with: java
has answer: http://stackoverflow.com/a/23151877
has title: How to draw a fading, dissolving color at Java?
type: Question
tagged with: graphics
tagged with: cloud
tagged with: fading
score: 0
has body: I would like to create a fading color effect, something like a cloud. A transition between two Color. I found a link. But, at this topic, the writer define an bitmap pixel by pixel. Is there an other way to do this, like a fadingDrawable class? Or this is the most effective way of fading?
answer count: 1
accepted answer: http://stackoverflow.com/a/23151877

http://stackoverflow.com/q/23180685
has answer: http://stackoverflow.com/a/23180713
downvote count: 1
has body: I'm still learning about sorting and Arrays. Came up with this code which does sorting letters or numbers on ascending order but I really don't get the last part where System.out.println(SampleArray[i]);. Why is it SapleArray[i]? can someone enlighten me please. public class TestClass { public static void main(String[] args) { String SampleArray[] = {"B","D","A","R","Z"}; Arrays.sort(SampleArray); for (int i=0; i &lt; SampleArray.length; i++) { System.out.println(SampleArray[i]); } } }
type: Question
has answer: http://stackoverflow.com/a/23180774
tagged with: sorting
has title: Understanding Java sorting
score: 0
has comment: http://stackoverflow.com/comment/35452824
has answer: http://stackoverflow.com/a/23180734
has answer: http://stackoverflow.com/a/23180763
accepted answer: http://stackoverflow.com/a/23180774
favorite count: 0
upvote count: 1
answer count: 4
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/23180713
tagged with: java

http://stackoverflow.com/comment/35500825
score: 0
type: Comment
has text: InfoStorage[0] = InfoStorage[0+1], therefore infoStorage[0] would have the value of [1] now, Okay I see it now but then that 1 is idx therefore idx++ would add one more to it being 2 for the next run for the loop am I correct?
type: AnswerComment
comment on: http://stackoverflow.com/a/23207416

http://stackoverflow.com/comment/35508514
type: Comment
has text: @PadawanDeveloper and what is the problem now?
type: AnswerComment
comment on: http://stackoverflow.com/a/23212098
score: 0

http://stackoverflow.com/a/23258268
type: Answer
downvote count: 1
has comment: http://stackoverflow.com/comment/35591570
score: -1
upvote count: 0
answers question: http://stackoverflow.com/q/23258191
has comment: http://stackoverflow.com/comment/35591649
has comment: http://stackoverflow.com/comment/35591691
has comment: http://stackoverflow.com/comment/35591587
has body: I think this little 'illustration' could help you Class String { public int CompareTo(String string2) { if (this==string2) return 1; //The == is completely wrong here but it gives you an idea on how it works else return 0; } } When you call string1.CompareTo(string2); in the method, this will reference the object itself, so here it references string1

http://stackoverflow.com/a/23145606
score: 1
has comment: http://stackoverflow.com/comment/35580019
downvote count: 0
type: Answer
has body: Try creating the FileWriter outside of any methods, then setting it to something in your onEnable()... Here's an example: public class Main extends JavaPlugin{{ FileWriter fw;//create the variable @Override public void onEnable(){ try{ fw = new FileWriter(this.getDataFolder() + "/messages.txt", true); //assign the variable to a value, and put the file in your plugin's folder } catch(IOException e){ e.printStackTrace(); } } @Override public void onDisable(){ try{ //try-catch just incase fw.close(); } catch(Exception e){ e.printStackTrace(); } } }
upvote count: 1
answers question: http://stackoverflow.com/q/23130395

http://stackoverflow.com/comment/35436509
has text: @user3479350> please replace your new code with your new edits with the current code on this page so as to I can see it, then I can understand what's your new problem?
type: Comment
comment on: http://stackoverflow.com/a/23171040
score: 0
type: AnswerComment

http://stackoverflow.com/q/23185661
upvote count: 1
answer count: 1
has answer: http://stackoverflow.com/a/23185715
has comment: http://stackoverflow.com/comment/35461050
type: AnsweredQuestion
downvote count: 0
score: 1
favorite count: 0
has body: I want to create new class instance by a string variable, pass int[] as a parameter to this constructor, and save this instance in an array list. What's more, that class derives from some other class, let's say Bar. And that array list is of type Bar. So: List&lt;Bar&gt; something = new ArrayList&lt;Bar&gt;(); String name = "Foo"; int[] arr = {1, 2, 3, 4, 5}; try { Class myClass = Class.forName(name); Class[] types = {Integer.TYPE}; Constructor constructor = myClass.getConstructor(types); Object[] parameters = {arr}; Object instanceOfMyClass = constructor.newInstance(parameters); something.add(instanceOfMyClass); } catch(ClassNotFoundException e) { // handle it } catch(NoSuchMethodException e) { // handle it } catch(InstantiationException e) { // handle it } catch(IllegalAccessException e) { // handle it } catch(InvocationTargetException e) { // handle it } This is what I've came up with, but unfortunately it doesn't work. How can I pass array of integers here (what would be the type)? How can I add this instance to the array list given here (it throws an error that I have to cast the instance of Foo class to Foo class)?
type: Question
accepted answer: http://stackoverflow.com/a/23185715
has title: How to create class instance by string name
has comment: http://stackoverflow.com/comment/35461109
has comment: http://stackoverflow.com/comment/35461181
tagged with: java

http://stackoverflow.com/q/23171073
has answer: http://stackoverflow.com/a/23175196
has body: The answer to this question seems obvious, but I need to be completely sure. So if answer can provide authoritative reference with clear non-ambiguous statements, that would be great. Say I have the following two methods public CollectionResponse&lt;Dog&gt; getDogs(Identification request){ MemcacheService syncCacheDog = MemcacheServiceFactory.getMemcacheService(); syncCacheDog.setErrorHandler(ErrorHandlers.getConsistentLogAndContinue(Level.INFO)); // ........ value = (byte[]) syncCacheDog.get(key); // read from cache if (value == null) { // get value from other source // ........ syncCacheDog.put(key, value); // populate cache } // ........ } public CollectionResponse&lt;Cat&gt; getCats(Identification request){ MemcacheService syncCacheCat = MemcacheServiceFactory.getMemcacheService(); syncCacheCat.setErrorHandler(ErrorHandlers.getConsistentLogAndContinue(Level.INFO)); // ........ value = (byte[]) syncCacheCat.get(key); // read from cache if (value == null) { // get value from other source // ........ syncCacheCat.put(key, value); // populate cache } // ........ } Are syncCacheDog and syncCacheCat pointing to the same map? Or if I want them to be pointing to the same map, do I have to create static MemcacheService syncCache = MemcacheServiceFactory.getMemcacheService(); and then use syncCache inside both methods? On the other hand, if it is a singleton, how do I maintain two different caches? I.e. can someone please copy and paste one of my methods and show it written with a namespace and instead of dealing with generic byte to deal with a specific object such as Dog?
has title: Is MemcacheService fundamentally a singleton
score: 1
tagged with: java
type: Question
answer count: 1
downvote count: 0
tagged with: google-app-engine
favorite count: 0
tagged with: google-cloud-endpoints
type: UnansweredQuestion
upvote count: 1
tagged with: memcached

http://stackoverflow.com/q/23227057
downvote count: 3
upvote count: 0
score: -3
tagged with: java-8
has comment: http://stackoverflow.com/comment/35922967
type: AnsweredQuestion
has body: I am using Java to format a poem in LaTeX and then compile it. The LaTeX-ization works perfectly fine, but I somehow can't run the command. Is this a problem with my LaTeX invocation? For some reason, when I use Java to write an equivalent batch file and then run it, Java will do nothing but when I run the batch file from the shell, it works. /** * * @param title the title of the poem * @param poem a List with one string for each line of the * poem. * @throws FileNotFoundException */ protected static void writePDF(final String title, List<String> poem) throws FileNotFoundException { final StringBuilder latex = new StringBuilder(0); // I know I shouldn't concatenate like this; I'll fix it later. // eeeewww escapes latex.append( "\\documentclass[letterpaper,12pt,article,oneside]{memoir}\n" + "\\usepackage[utf8]{inputenc}\n" + "\\usepackage{ebgaramond}\n" + "\\usepackage{hyperref}\n" + "\\usepackage[protrusion,expansion,kerning,tracking,spacing]{microtype}\n" + "\\linespread{1.3}\n" + "\\nonfrenchspacing\n" + "\\microtypecontext{spacing=nonfrench}\n" + "\\begin{document}\n" + "\\title{" + title + "}\n" + "\\author{}\n" + "\\date{\\today}\n" + "\\maketitle\n" + "\\setlength{\\parindent}{0pt}\n" + "\\setlength{\\parskip}{\\baselineskip}\n"); // Go Java 8! poem .stream() .map((String s) // Original poem's in HTML -> s.replace(" ", "\n\n").replace(" ", "\\\\\n")) .forEach(latex::append); latex.append("\n\\end{document}"); final String latexstr = latex.toString().replace("...", "\\ldots"); final String filename = title + ".tex"; final File file = new File(filename); try (final PrintWriter pw = new PrintWriter(new BufferedOutputStream(new FileOutputStream(file)))) { pw.print(latexstr); } final String path = file.getAbsolutePath() .substring(0, file.getAbsolutePath().lastIndexOf("\\")) + "\\"; System.out.println("Path: " + path); final String LaTeXcmd = "pdflatex \"" + path + title + "\""; final File script = new File("" + rand.nextDouble() + "compile" + title.replace(" ", "_…
tagged with: java
type: Question
has title: Java can't do system call
has answer: http://stackoverflow.com/a/23227158
answer count: 1
accepted answer: http://stackoverflow.com/a/23227158
favorite count: 0

http://stackoverflow.com/q/23237038
downvote count: 5
has comment: http://stackoverflow.com/comment/35553040
type: AnsweredQuestion
favorite count: 0
type: Question
tagged with: regex
has answer: http://stackoverflow.com/a/23237076
score: 0
tagged with: java
has body: How to match a fully qualified class name like com.mycompany.models.Friend using regex and strip away the package name so the result would be Friend for the example given?
answer count: 1
has title: How to strip the package name from a fully qualified class name
linked to: http://stackoverflow.com/q/5205339
upvote count: 5
accepted answer: http://stackoverflow.com/a/23237076

http://stackoverflow.com/a/23241739
type: Answer
upvote count: 1
score: 1
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23241617
has comment: http://stackoverflow.com/comment/35564390
answers question: http://stackoverflow.com/q/23241617
has body: Without knowing what problem you have exactly, I suppose the image isn't being moved. I looks you don't register a MouseMotionListener so do that and implement the mouseMoved method.
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35561312

pdfbox
tag name: pdfbox
tags question: http://stackoverflow.com/q/23290698
tags question: http://stackoverflow.com/q/23285301
tags question: http://stackoverflow.com/q/23223716
type: Tag

http://stackoverflow.com/comment/35605586
type: QuestionComment
has text: @Ramkiran yes it crash too.
score: 0
comment on: http://stackoverflow.com/q/23266229
type: Comment

http://stackoverflow.com/q/23214149
tagged with: line
type: Question
has answer: http://stackoverflow.com/a/23214225
accepted answer: http://stackoverflow.com/a/23214225
possible better answer: http://stackoverflow.com/a/23214936
has title: java : search for a word in a text and give its line
score: 0
answer count: 2
tagged with: string
has answer: http://stackoverflow.com/a/23214936
has body: i have a String output ( a paragraph ) having almost 140 lines , i want to search for a word in this paragraph and get its line in the paragraph for example i have : date : 08/12/2009 value : 589.236 smth : smth Fax : 25896217 i search for the word value , it gives me the line 2 in the paragraph , actually i used this code to get the number of lines : String resultat = "..." Matcher m = Pattern.compile("(\n)|(\r)|(\r\n)").matcher(resultat); int lines = 1; while (m.find()) { lines ++; } is there a predefined method in java that gives me the line of the found word ?
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35512053
tagged with: java
has comment: http://stackoverflow.com/comment/35511801

http://stackoverflow.com/q/23194777
has answer: http://stackoverflow.com/a/23195197
favorite count: 0
has title: JEE7 @Transactional annotation not always fires
has body: For several days I'm trying to manage with JPA transactions after moving to WildFly 8 server and JEE7 and I cannot understand why in some cases @Transactional (javax.transaction.Transactional) annotation doesn't intercept method annotated with it. I cannot see any rule why sometimes it works and sometimes not. Example of my not working code: import javax.inject.Inject; import javax.inject.Named; import javax.persistence.EntityManager; import javax.faces.view.ViewScoped; import com.i4u.app.domain.AppDomain; import com.i4u.app.mail.ComMailForm; import javax.transaction.Transactional; import com.i4u.qla.action.company.CmpFunctions; import com.i4u.qla.model.invoice.Invoice; @Named @ViewScoped public class InvMailForm extends ComMailForm&lt;Invoice&gt; { private static final long serialVersionUID = 1L; @Inject private AppDomain ad; @Inject private CmpFunctions cf; @Inject private InvEmailFunctions invEmail; @Inject private EntityManager entityManager; @Override public void sendMail(String type) { if (type.equals("invoice")) { sendInvoice(); inst = null; } } /** * Method sends invoice and marks it as printed */ private void sendInvoice() { try { invEmail.sendQlaInvoicePDFFile(inst, getSubject(), getContent(), getSendTo(), getBccTo()); // sent invoice should be marked as printed printed(); msg.message(msg.get("msg.Successful"), msg.get("msg.InvoiceWillBeSent")); } catch (Exception e) { msg.fatalMessage(msg.get("msg.Failed"), msg.get("msg.FailedToSendInvoice")); e.printStackTrace(); } setSendTo(null); setBccTo(null); } public void sendPrepare(Invoice inv) { super.sendPrepare(inv); setSendTo(cf.getInvoiceEmail(inst.getCompany())); setSubject(inst.getCompanyName() + " - " + ad.getCompany().getName() + " week " + inst.getCweek()); } /** * Method sets invoice as printed */ @Transactional private void printed() { inst = entityManager.find(Invoice.class, inst.getId()); inst.setPrinted(true); // on the line below exception is thrown entityManager.merge(inst); entityManager.flush()…
tagged with: java-ee-7
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: wildfly
accepted answer: http://stackoverflow.com/a/23195197
upvote count: 1
type: Question
tagged with: jta
tagged with: jpa
downvote count: 0
answer count: 1

http://stackoverflow.com/comment/35399957
type: Comment
comment on: http://stackoverflow.com/a/23150435
has text: getTimeInMillis() is necessary for alarmManager for the count. right sire ? why need to call getText.toString. I dont get it sire,
score: 0
type: AnswerComment

http://stackoverflow.com/a/23247036
score: 0
has comment: http://stackoverflow.com/comment/35644949
answers question: http://stackoverflow.com/q/23246834
type: Answer
has comment: http://stackoverflow.com/comment/35619102
has comment: http://stackoverflow.com/comment/35623481
has body: Delegation usually is a better design choice than inheritance. Foo has a Bar often gives you more options than Foo is a Bar. my clientThread extents Thread Don't do that. Your clientThread object should just be a plain Thread that is constructed with some ClientFoobar object that implements Runnable. class Client implements Runnable { private final DBConnectionManager dbConnectionManager; private ...other state... public Client(DBConnectionManager dbConnectionManager,...) { this.dbConnectionManager = dbConnectionManager; ... } @Override public void run() { ...interact with remote client... } } Thread clientThread = new Thread(new Client(dbConnectionManager,...)).start();

http://stackoverflow.com/comment/36056303
has text: I don't think your mailed got through the mailing list gateway, can you send again?
type: Comment
comment on: http://stackoverflow.com/a/23181996
score: 0
type: AnswerComment

http://stackoverflow.com/q/23267759
has comment: http://stackoverflow.com/comment/36073125
tagged with: java
has answer: http://stackoverflow.com/a/23598668
type: Question
type: AnsweredQuestion
answer count: 2
accepted answer: http://stackoverflow.com/a/23598668
has title: ESAPI canonicalize malforming url
possible better answer: http://stackoverflow.com/a/23344777
tagged with: validation
downvote count: 0
has answer: http://stackoverflow.com/a/23344777
has body: We have an application that accepts URLs from users. This data needs validation, and we're using ESAPI for this purpose. However, we're struggling with URLs containing ampersands. The problem appears when ESAPI canonicalizes the data before validation. &amp;pid=123 in the URL turns into πd=123 for example. Since π is not whitelisted, the validation fails. I've tried encoding it, but ESAPI is smarter than that and does canonicalization to avoid double encoding and mixed encoding. I'm a bit stumped here and I'm not sure how to proceed.
favorite count: 0
tagged with: esapi
has comment: http://stackoverflow.com/comment/36025606
linked to: http://stackoverflow.com/q/23434156
has comment: http://stackoverflow.com/comment/36070405
tagged with: owasp
score: 2
tagged with: canonicalization
upvote count: 2
has comment: http://stackoverflow.com/comment/35942586

http://stackoverflow.com/a/23194265
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23194250
type: Answer
has body: check you post method HttpServlet has doPost method which accepts HttpServleRequest and HttpServletResponse arguments protected void doPost(HttpServletRequest request, HttpServlet response) throws ServletException, IOException { to protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
upvote count: 2
answers question: http://stackoverflow.com/q/23194250
score: 2
type: AcceptedAnswer

http://stackoverflow.com/comment/35544635
has text: I am using HibernatePBEStringEncrypto that uses StandardPBEByteEncryptor. This has interesting settings like DEFAULT_ALGORITHM = "PBEWithMD5AndDES",DEFAULT_KEY_OBTENTION_ITERATIONS = 1000,DEFAULT_SALT_SIZE_BYTES = 8. 1. As these are final variables does size of the salt really depends on the algorithm being used or is it fixed with this final variable ? 2. Also since this is PBEWithMD5AndDES I think no one can decrypt the details. How does the description process happens (It many be a vague question)
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23227616

http://stackoverflow.com/q/23166224
has answer: http://stackoverflow.com/a/23166234
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35427604
tagged with: java
has comment: http://stackoverflow.com/comment/35427712
has title: HTTP method GET is not supported by this URL Tomcat
type: Question
has comment: http://stackoverflow.com/comment/35427476
score: 0
has body: I'm developing a web app using the following code, but I end up with an error: After i clicked submit button in html, the error 405 occurred. Please help check where i should make changes..Thanks alot
answer count: 1

http://stackoverflow.com/comment/35467803
type: QuestionComment
score: 0
has text: `this` refers to the non-static instance of the current class. Since you're in a different class, you'd need to have an instance of `NewSkillsMain` in your enum. You could have static variable in `NewSkillsMain` and set it equal to `this` in the constructor so that could could access it like `NewSkillsMain.INSTANCE`, or wrap it in `NetSkillsMain.getInstance()` like a Singleton. Note that this is not the best approach.
type: Comment
comment on: http://stackoverflow.com/q/23189140

http://stackoverflow.com/a/23261157
type: AcceptedAnswer
type: Answer
has body: Do something like below, private class MyAsyncTask extends AsyncTask&lt;String, String, String&gt; { @Override protected void onPreExecute() { super.onPreExecute(); } @Override protected String doInBackground(String... params) { String data="["15.493511","73.818659"]"; // Assuming that it is your static data try { JSONArray myArray=new JSONArray(data); String lattitude=myArray.getString(0); String longitudetude=myArray.getString(1); } } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } return null; } @Override protected void onPostExecute(String result) { super.onPostExecute(result); //update your UI or do your task; } } } And execute the AsyncTask like following, new MyAsyncTask().execute();
answers question: http://stackoverflow.com/q/23260977
accepted answer of: http://stackoverflow.com/q/23260977
score: 0

http://stackoverflow.com/q/23218228
favorite count: 0
type: UnansweredQuestion
tagged with: google-app-engine
tagged with: google-cloud-endpoints
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/37641347
has title: programmatically get base url from inside google app engine endpoint method
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/23223988
downvote count: 0
has body: I am creating a Google Appengine endpoint api. In one of the endpoint methods, I need to detect the base url. How might I do that in Java?
upvote count: 1

http://stackoverflow.com/a/23141351
has comment: http://stackoverflow.com/comment/35383420
has comment: http://stackoverflow.com/comment/35383798
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23141252
has comment: http://stackoverflow.com/comment/35383507
has comment: http://stackoverflow.com/comment/35398409
upvote count: 3
has comment: http://stackoverflow.com/comment/35383628
type: Answer
has comment: http://stackoverflow.com/comment/35383750
has body: As @Little Child mentioned, your ListView is null, and problem is the following line of code: listView = (ListView) getActivity().findViewById(R.id.lv_employee_list); which should really be: listView = (ListView) v.findViewById(R.id.lv_employee_list);
has comment: http://stackoverflow.com/comment/35396597
has comment: http://stackoverflow.com/comment/35383523
has comment: http://stackoverflow.com/comment/35396232
has comment: http://stackoverflow.com/comment/35383698
has comment: http://stackoverflow.com/comment/35383756
score: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/35415247
answers question: http://stackoverflow.com/q/23141252

http://stackoverflow.com/q/23279150
downvote count: 1
type: Question
has title: Random Numbers Java
has body: Just a quick question, i'm working on a project in which the user inputs a number, which in this case is x, then, when they click the 'calculate' button it is to do the following: Generate x random numbers Put each number into an array list Print out the array list Heres what i have thus far: String input; int int1; input = Input.getText(); int1 = Integer.parseInt(input); That just gets the user input and converts it to an integer.
score: -1
has answer: http://stackoverflow.com/a/23279248
has comment: http://stackoverflow.com/comment/35630473
tagged with: random
upvote count: 0
answer count: 1
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35630434
has comment: http://stackoverflow.com/comment/35630562
has comment: http://stackoverflow.com/comment/35630501
has comment: http://stackoverflow.com/comment/35630733
tagged with: java

http://stackoverflow.com/q/23159941
type: Question
tagged with: decimal
upvote count: 0
has body: How can I create a pattern for: this is the order from beginning to end: at least 0, at most 3 digits they are from 0-9 a decimal point after (has to be there) at least 0, at most two digits after they are from 0-9 Thanks! Don't have to but please explain! Example inputs: 444.56 3.44 33.44 3.44 .35 3. 3.0 2.22
answer count: 1
downvote count: 5
has answer: http://stackoverflow.com/a/23159989
favorite count: 0
tagged with: regex
has comment: http://stackoverflow.com/comment/35416055
type: AnsweredQuestion
score: -5
tagged with: java
accepted answer: http://stackoverflow.com/a/23159989
has title: Simple Regular Expression in Java

http://stackoverflow.com/comment/35467187
type: QuestionComment
has text: What is the "im" variable? That seems like the best candidate for being null and causing the exception.
score: 2
type: Comment
comment on: http://stackoverflow.com/q/23188801

http://stackoverflow.com/comment/35485142
comment on: http://stackoverflow.com/a/23198722
type: AnswerComment
score: 0
type: Comment
has text: Your parameters need to be separated by a comma, not a plus sign. `new Object[] {carbean.getMake(), carbean.getModel()};`

http://stackoverflow.com/comment/35494312
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23200464
has text: Sounds good; more candidates [here](http://stackoverflow.com/a/2486200/230513).
score: 0

http://stackoverflow.com/q/23204195
tagged with: apache-httpclient-4.x
accepted answer: http://stackoverflow.com/a/23205334
type: AnsweredQuestion
has title: How to print/log an Apache HttpClient request query string
tagged with: java
type: Question
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/23205334
has body: Is it possible to get hold of the actual query string that will be used for a HttpClient request (HttpPost, HttpGet etc.) either prior to or after calling client.execute(request)? I'd like to do this because my request is failing and I want to debug the actual query string that's being used (it's an S3 file upload using HttpPost, so the parameters are complex).

http://stackoverflow.com/q/23180870
answer count: 1
has title: In java socket programming, is it necessary to run server program first before client program?
score: 0
type: UnansweredQuestion
tagged with: sockets
tagged with: swing
has comment: http://stackoverflow.com/comment/35453008
has body: I am building a remote desktop viewer app using swing. When I run server first and then client, the app is working fine. But when I run client first and then server, the client gives exceptions as there is no listening server. What should I do so that if I run client first and then server the connection should be successful and client should not give exceptions? Thanks.
tagged with: java
has answer: http://stackoverflow.com/a/23181056
type: Question

http://stackoverflow.com/a/23225874
has comment: http://stackoverflow.com/comment/35532816
has comment: http://stackoverflow.com/comment/35533567
has comment: http://stackoverflow.com/comment/35533611
score: 0
has body: If you have a unique id for each account that you assign to people you can do this: //if you want to use a HashMap, then instantiate like below HashMap&lt;Integer, Account&gt; hash = new HashMap&lt;Integer, Account&gt;(); hash.put(acc1.getId(), acc1); //to get Account from Person from map hash.get(per1.getAccountId()); //iterating for (Map.Entry&lt;Integer, Account&gt; entry : hash.entrySet()) { System.out.println(entry.getKey() + "/" + entry.getValue().getPerson()); }
has comment: http://stackoverflow.com/comment/35533343
type: Answer
has comment: http://stackoverflow.com/comment/35532974
answers question: http://stackoverflow.com/q/23225590

http://stackoverflow.com/comment/35470958
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23188528
score: 0
has text: I figured it out, it was a simple mismatch of method names I had it on of the proxy strategies I used.

http://stackoverflow.com/q/23217002
possible better answer: http://stackoverflow.com/a/31040641
upvote count: 219
downvote count: 0
tagged with: executable-jar
answer count: 11
has answer: http://stackoverflow.com/a/63796139
has answer: http://stackoverflow.com/a/32889903
score: 219
has answer: http://stackoverflow.com/a/23217203
has answer: http://stackoverflow.com/a/31631812
has comment: http://stackoverflow.com/comment/35544444
favorite count: 0
has answer: http://stackoverflow.com/a/45156892
has answer: http://stackoverflow.com/a/49716696
linked to: http://stackoverflow.com/q/67518597
has body: Execution default of goal org.springframework.boot:spring-boot-maven-plugin:1.0.1.RELEASE:repackage failed: Unable to find a single main class from the following candidates My project has more than one class with a main method. How do I tell the Spring Boot Maven plugin which of the classes it should use as the main class?
has answer: http://stackoverflow.com/a/73275099
tagged with: maven
tagged with: spring
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35518038
accepted answer: http://stackoverflow.com/a/23217203
tagged with: spring-boot
tagged with: java
has answer: http://stackoverflow.com/a/52379434
has answer: http://stackoverflow.com/a/31040641
has answer: http://stackoverflow.com/a/24606025
has title: How do I tell Spring Boot which main class to use for the executable jar?
type: Question
has answer: http://stackoverflow.com/a/43818141

jdo
tags question: http://stackoverflow.com/q/23169963
tag name: jdo
type: Tag

jpql
tags question: http://stackoverflow.com/q/23179894
tags question: http://stackoverflow.com/q/23177655
tag name: jpql
type: Tag
tags question: http://stackoverflow.com/q/23186939
tags question: http://stackoverflow.com/q/23278793
tags question: http://stackoverflow.com/q/23158880
tags question: http://stackoverflow.com/q/23173273

http://stackoverflow.com/a/23168776
answers question: http://stackoverflow.com/q/23168742
type: Answer
score: 1
upvote count: 1
has body: Just delete fragment creation. The simplest Activity looks like this: public class MainActivity extends Activity{ @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } }
downvote count: 0

http://stackoverflow.com/q/23262091
possible better answer: http://stackoverflow.com/a/35936713
upvote count: 1
has comment: http://stackoverflow.com/comment/35682776
tagged with: dynamic-proxy
has comment: http://stackoverflow.com/comment/35685486
favorite count: 0
has comment: http://stackoverflow.com/comment/35683264
has answer: http://stackoverflow.com/a/23320499
has answer: http://stackoverflow.com/a/35936713
has comment: http://stackoverflow.com/comment/35636217
tagged with: classcastexception
has body: I would implement a security layer for java RMI, with dynamic proxy mechanism. I've some class with remote interface that bind in rmi registry, now I'm coding a class SecurityInvocationHandler, code below: import java.lang.reflect.InvocationHandler; import java.lang.reflect.Method; import java.rmi.RemoteException; import java.rmi.server.RMIClientSocketFactory; import java.rmi.server.RMIServerSocketFactory; /** * * @author andrew * @param &lt;T&gt; */ public class SecurityInvocationHandler&lt;T&gt; extends SuperRemoteInterface implements InvocationHandler { final T remoteInterface; public static &lt;T&gt; T newInstance(final T obj, RMIClientSocketFactory rcsf, RMIServerSocketFactory rssf) throws RemoteException { return (T) java.lang.reflect.Proxy.newProxyInstance(obj.getClass().getClassLoader(), obj.getClass().getInterfaces(), new SecurityInvocationHandler(obj, rcsf, rssf)); } private SecurityInvocationHandler(T remoteInterface, RMIClientSocketFactory csf, RMIServerSocketFactory ssf) throws RemoteException { super(csf, ssf); this.remoteInterface = remoteInterface; } @Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { System.out.println("Invoke method -&gt; " + method.getName()); //TODO return method.invoke(remoteInterface, args); } } SuperRemoteInterface is parent of all classes with Interface "Remote": import java.rmi.RemoteException; import java.rmi.server.RMIClientSocketFactory; import java.rmi.server.RMIServerSocketFactory; import Config.SysConfiguration; import java.rmi.server.UnicastRemoteObject; public class SuperRemoteInterface extends UnicastRemoteObject { protected SysConfiguration conf; protected SuperRemoteInterface() throws RemoteException { super(); } protected SuperRemoteInterface(RMIClientSocketFactory clientFactory, RMIServerSocketFactory serverFactory) throws RemoteException { super(0, clientFactory, serverFactory); } } In the main of Server RMI I proxy Object and bind it in rmiregistry: import /****/ publi…
type: AnsweredQuestion
has title: Binding proxy for remote Object in java RMI
has comment: http://stackoverflow.com/comment/35598243
has comment: http://stackoverflow.com/comment/35603020
has comment: http://stackoverflow.com/comment/35685179
downvote count: 0
has comment: http://stackoverflow.com/comment/35687596
score: 1
tagged with: rmi
has comment: http://stackoverflow.com/comment/35686241
tagged with: java
has comment: http://stackoverflow.com/comment/35687198
type: Question
has comment: http://stackoverflow.com/comment/35682670
has comment: http://stackoverflow.com/comment/35685468
answer count: 2
accepted answer: http://stackoverflow.com/a/23320499

http://stackoverflow.com/comment/35622122
type: QuestionComment
has text: resultSet = statement.executeQuery("SELECT password FROM cards.username WHERE username = '" + username + "' and password = '" + password + "'"); --> Replace your line with this line
score: 0
comment on: http://stackoverflow.com/q/23274735
type: Comment

http://stackoverflow.com/comment/35462246
score: 0
type: Comment
type: QuestionComment
has text: you have textview in `fragment_main.xml` while you initialize it in Activity. So it should crash.
comment on: http://stackoverflow.com/q/23185160

http://stackoverflow.com/q/23157794
tagged with: pubnub
tagged with: publish-subscribe
downvote count: 1
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26079865
score: 3
tagged with: java
has title: Pubnub herenow not returning UUID list
type: Question
upvote count: 4
answer count: 1
tagged with: javascript
accepted answer: http://stackoverflow.com/a/26079865
has comment: http://stackoverflow.com/comment/35434700
has comment: http://stackoverflow.com/comment/35434612
favorite count: 0
has body: I have recently started looking into pubnub, and I am trying to make pub-sub application using the same. I have my publisher in java and Subscriber in javascript. Following is the publisher code in java: Pubnub pubnub = new Pubnub("pub-c-key", "sub-c-key"); pubnub.hereNow("my_channel", cb); In my Callable for hereNow I did a Sysout for response and i get the following response: {"message":"OK","status":200,"uuids":[],"service":"Presence","occupancy":0} Here is my JS code: &lt;script src=http://cdn.pubnub.com/pubnub.min.js &gt;&lt;/script&gt; &lt;script&gt;(function(){ var pubnub = PUBNUB.init({ publish_key : 'pub-c-key', subscribe_key : 'sub-c-key' }); pubnub.subscribe({ channel : "my_channel", message : function(m){ document.getElementById("my_item").innerHTML = m; }, connect : publish }); function publish() { pubnub.publish({ channel : "my_channel", message : "Connected!" }); } })();&lt;/script&gt; But when I publish something to the channel, I get the result displayed on the webpage where the script is executed. pubnub.publish("my_channel","Offer!" , callback); Why is the hereNow not working in my case? Any help or lead would do. I have read the pubnub documentation but I couldn't get it.

http://stackoverflow.com/comment/35610749
comment on: http://stackoverflow.com/a/23268941
has text: How it can be solved in a single query. Beacause first i need a value from different table to update the table.
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/35467951
score: 1
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23161290
has text: Thanks for your help. After looking at my paths and using your ImageTest program, I discovered that my paths simply all had to be the correct case to load properly in my jar file.

http://stackoverflow.com/comment/35570512
type: Comment
comment on: http://stackoverflow.com/a/23231510
has text: The question is updated to hopefully be more clear. We're talking java/rhino on the server in both cases: One via the PHP CLI, the other via `mod_php`. I'll see whether I can find evidence of multiple version of java on the box.
type: AnswerComment
score: 0

http://stackoverflow.com/a/23181826
answers question: http://stackoverflow.com/q/23181757
downvote count: 0
score: 1
upvote count: 1
type: AcceptedAnswer
has body: You can use BufferReader instead : String line = ""; List&lt;Integer&gt; tall = new ArrayList&lt;Integer&gt;(); try { BufferedReader br = new BufferedReader(new FileReader(fileName)); while ((line = br.readLine())!= null) { tall.add(Integer.parseInt(line, 2)); } br.close(); }catch(IOException e) {}
accepted answer of: http://stackoverflow.com/q/23181757
type: Answer

http://stackoverflow.com/comment/35514628
has text: This is adding duplicate elements to the arraylist and when I remove those duplicate objects the order is getting change..?
type: Comment
comment on: http://stackoverflow.com/a/23213905
score: 0
type: AnswerComment

http://stackoverflow.com/a/23170681
has comment: http://stackoverflow.com/comment/35435164
upvote count: 0
has comment: http://stackoverflow.com/comment/35435052
score: -1
has comment: http://stackoverflow.com/comment/35454728
has body: If I had understood the question right then you just need to use mod(%) and check if the reminder is &lt;= 2 or >= 8. public static boolean nearTen(int num) { if (num==10 || num==1){ return true; } else if (num&lt;10 &amp;&amp; 10-num&lt;2){ return true; } else if (num%10&lt;=2 || num%10&gt;=8){ return true; } else{ return false; } }
answers question: http://stackoverflow.com/q/23170589
downvote count: 1
type: Answer

terminal-emulator
tag name: terminal-emulator
tags question: http://stackoverflow.com/q/23261954
type: Tag

http://stackoverflow.com/a/43360161
type: Answer
has body: public static void main(String[] args) { System.out.println("is balanced : "+isBalanced("(){}[]&lt;&gt;")); System.out.println("is balanced : "+isBalanced("({})[]&lt;&gt;")); System.out.println("is balanced : "+isBalanced("({[]})&lt;&gt;")); System.out.println("is balanced : "+isBalanced("({[&lt;&gt;]})")); System.out.println("is balanced : "+isBalanced("({})[&lt;&gt;]")); System.out.println("is balanced : "+isBalanced("({[}])[&lt;&gt;]")); System.out.println("is balanced : "+isBalanced("([{})]")); System.out.println("is balanced : "+isBalanced("[({}])")); System.out.println("is balanced : "+isBalanced("[(&lt;{&gt;})]")); System.out.println("is balanced : "+isBalanced("[")); System.out.println("is balanced : "+isBalanced("]")); System.out.println("is balanced : "+isBalanced("asdlsa")); } private static boolean isBalanced(String brackets){ char[] bracketsArray = brackets.toCharArray(); Stack&lt;Character&gt; stack = new Stack&lt;Character&gt;(); Map&lt;Character, Character&gt; openingClosingMap = initOpeningClosingMap(); for (char bracket : bracketsArray) { if(openingClosingMap.keySet().contains(bracket)){ stack.push(bracket); }else if(openingClosingMap.values().contains(bracket)){ if(stack.isEmpty() || openingClosingMap.get(stack.pop())!=bracket){ return false; } }else{ System.out.println("Only &lt; &gt; ( ) { } [ ] brackets are allowed ."); return false; } } return stack.isEmpty(); } private static Map&lt;Character, Character&gt; initOpeningClosingMap() { Map&lt;Character, Character&gt; openingClosingMap = new HashMap&lt;Character, Character&gt;(); openingClosingMap.put(Character.valueOf('('), Character.valueOf(')')); openingClosingMap.put(Character.valueOf('{'), Character.valueOf('}')); openingClosingMap.put(Character.valueOf('['), Character.valueOf(']')); openingClosingMap.put(Character.valueOf('&lt;'), Character.valueOf('&gt;')); return openingClosingMap; } Simplifying and making readable. Using One Map only and minimum conditions to get desired result.
answers question: http://stackoverflow.com/q/23187539
score: 0

http://stackoverflow.com/q/23232254
has comment: http://stackoverflow.com/comment/35546016
answer count: 1
has title: Best way to load data in MySQL DB using JDBC
has comment: http://stackoverflow.com/comment/35544659
has comment: http://stackoverflow.com/comment/35545465
tagged with: java
accepted answer: http://stackoverflow.com/a/23233671
tagged with: mysql
type: AnsweredQuestion
tagged with: sql
type: Question
has body: Here's a sample dataset of a much larger data file, I need to load into mysql db. The problem is the dataset is too large to manually add/append the insert statements and put the commas at the right locations. E 1 T 2006-11-02 22:01:34 U 6 andrevan N 70 node_ue V 1 62 2004-09-11 05:50:00 node V 1 27 2004-09-11 06:13:00 slowking V 1 11 2004-09-11 06:50:00 merovingian V 1 34 2004-09-11 12:11:00 norm V 1 10 2004-09-11 13:30:00 anÃ¡rion V 1 55 2004-09-11 15:20:00 thecustomoflife V 1 28 2004-09-11 15:21:00 neutrality V 1 8 2004-09-11 16:56:00 lst27 V 1 63 2004-09-11 18:00:00 zchangu V 1 5 2004-09-11 19:51:00 orthogonal V 1 26 2004-09-12 03:04:00 grunt V -1 25 2004-09-12 03:46:00 blankfaze V 1 56 2004-09-12 22:00:00 guanaco V 1 64 2004-09-12 22:51:00 beau99 V 1 19 2004-09-13 00:51:00 ffirehorse V 1 20 2004-09-13 01:27:00 michael V 1 7 2004-09-14 19:49:00 texture V 1 65 2004-09-16 05:01:00 friedmilk V 1 66 2004-09-17 13:56:00 ezhiki V 1 39 2004-09-18 07:34:00 squash Can someone please suggest the best way to load this into mysql db using JDBC? Thanks!
tagged with: jdbc
has comment: http://stackoverflow.com/comment/35545713
has answer: http://stackoverflow.com/a/23233671
has comment: http://stackoverflow.com/comment/35545423
score: 0

http://stackoverflow.com/comment/35531864
has text: So mine,I can't use an array list it wont gel with the rest of my program
type: Comment
comment on: http://stackoverflow.com/a/23224269
type: AnswerComment
score: 0

http://stackoverflow.com/comment/35441110
type: QuestionComment
has text: Please show the stack trace! We are not mind readers.
score: 1
comment on: http://stackoverflow.com/q/23174060
type: Comment

http://stackoverflow.com/comment/35570749
has text: @Jason C, I downloaded Apache Ant and gave it a try. I got the tutorial code working just fine. I then switched over to my sample code above, and got the same result as before! I have edited my original post to reflect this update.
type: Comment
comment on: http://stackoverflow.com/q/23240944
type: QuestionComment
score: 0

http://stackoverflow.com/q/23289701
has answer: http://stackoverflow.com/a/23289818
has answer: http://stackoverflow.com/a/23289974
has answer: http://stackoverflow.com/a/23293135
score: 0
answer count: 3
possible better answer: http://stackoverflow.com/a/23289818
has body: This is a exercise that computes compatibility between two persons based on https://en.wikipedia.org/wiki/Biorhythm, it works well. However when executing, the program shows the date as for example "Fri Apr 08 00:00:00 EET 2014", but I would like it to show this info without hours, minutes, seconds and time zone. What to do? import java.util.Scanner; import java.util.Date; import java.text.ParseException; import java.text.SimpleDateFormat; public class bior { public static void main(String[] args) { Scanner input = new Scanner(System.in); String nameOne; String nameTwo; String dobOneIn; String dobTwoIn; Date dobOne = new Date(); Date dobTwo = new Date(); boolean validEntry; SimpleDateFormat format = new SimpleDateFormat("MM/dd/yyyy"); System.out.println("Enter name of first person!"); nameOne = input.nextLine(); while (nameOne.equals("")) { System.out.println("Enter name of first person!"); nameOne = input.nextLine(); } System.out.println("Enter name of second person!"); nameTwo = input.nextLine(); while (nameTwo.equals("")) { System.out.println("Enter name of second person!"); nameTwo = input.nextLine(); } do { try { System.out.println("Enter date of birth of " + nameOne + "! (MM/DD/YYYY)"); dobOneIn = input.nextLine(); dobOne = format.parse(dobOneIn); validEntry = true; } catch (ParseException e) { validEntry = false; } } while (!validEntry); do { try { System.out.println("Enter date of birth of " + nameTwo + "! (MM/DD/YYYY)"); dobTwoIn = input.nextLine(); dobTwo = format.parse(dobTwoIn); validEntry = true; } catch (ParseException e) { validEntry = false; } } while (!validEntry); int diff = Math.abs((int)((dobOne.getTime() - dobTwo.getTime()) / (24 * 60 * 60 * 1000))); System.out.println(); System.out.println("Name of second person: " + nameTwo + "."); System.out.println("DOB of " + nameOne + ": " + dobOne + "."); System.out.println("DOB of " + nameTwo + ": " + dobTwo + "."); System.out.println("Difference between DOBs (days): " + diff + "."); float physicalBio = …
tagged with: date-format
has title: SimpleDateFormat showing too much info
type: AnsweredQuestion
tagged with: simpledateformat
tagged with: java
accepted answer: http://stackoverflow.com/a/23289974
type: Question

http://stackoverflow.com/q/23236561
has answer: http://stackoverflow.com/a/23236763
has answer: http://stackoverflow.com/a/23237247
answer count: 4
favorite count: 0
has answer: http://stackoverflow.com/a/23236778
has title: Regex in Java with multiple condition to extract arithmetic operator
upvote count: 1
type: AnsweredQuestion
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/23236763
type: Question
accepted answer: http://stackoverflow.com/a/23236739
downvote count: 0
has body: I am new to regular expression syntax, after one whole day digging on the google, still can't find a good regex in java to extract the thing I want from a string... for example:I have a stringA = "-3.5 + 2 * 3 / 2" stringB = "2 * 3 / 2 - 3.5"; the regex i used was regex="[\\+\\-\\*\\/]", --&gt;choose +,-,*,or / from the target; by doing this, I am able to capture ANY signs in the string including negative sign. However, I was to capture the negative sign(-) only when it is following by a whitespace. That is, I want the result from string A as [ +, *, /], these three signs and stringB as [ *, / , -] I realized I only need to add another condition into regex for the negative sign such as regex = "[\\+{\\-\\s}\\*\\/]" ---&gt; I want to choose same thing but with extra condition "-"sign has to follow by a whitespace. the square bracket does not work like this way..Is there anyone can kindly guide my how to add another condition into the original regex? or write a new regex to qualify the need? Thank you so much in advance.
has answer: http://stackoverflow.com/a/23236739
has comment: http://stackoverflow.com/comment/35552439
tagged with: regex

timer
tags question: http://stackoverflow.com/q/23283719
tag name: timer
tags question: http://stackoverflow.com/q/23247499
type: Tag
tags question: http://stackoverflow.com/q/23171197
tags question: http://stackoverflow.com/q/23253002
tags question: http://stackoverflow.com/q/23150422
tags question: http://stackoverflow.com/q/23249098
tags question: http://stackoverflow.com/q/23186035
tags question: http://stackoverflow.com/q/23137645
tags question: http://stackoverflow.com/q/23235027

http://stackoverflow.com/comment/36159735
has text: @ajc As i suggested you need install latest Liferay IDE.seems its realted to IDE not SDK as per the link which i shared.Please install latest IDE and give a try.
type: AnswerComment
comment on: http://stackoverflow.com/a/23205671
score: 0
type: Comment

http://stackoverflow.com/comment/35532808
type: Comment
comment on: http://stackoverflow.com/a/23220488
has text: let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/51203/discussion-between-user3296744-and-papacito)
type: AnswerComment
score: 0

http://stackoverflow.com/a/23172983
downvote count: 0
has comment: http://stackoverflow.com/comment/35441985
has body: assignments subclass of course, course subclass of term, term subclass of profile That doesn't sound right to me. Courses have Assignments, but Assignments aren't a type of Course themselves. Let's think about what methods they might have: Course Teacher getTeacher(); Student[] getStudents(); Date[] getLessonTimes(); Assignment Teacher getTeacher(); Date getDueDate(); String getTitle(); So though getTeacher() would be applicable to both, most aren't. You could put getTeacher() into a Teachable interface, but everything else indicates they're not really related. Plan out the methods for your other classes and see if there are any duplicates, then based on that decide on your class inheritance.
type: Answer
score: 1
answers question: http://stackoverflow.com/q/23172838
upvote count: 1

http://stackoverflow.com/comment/35525510
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23219826
has text: @user2335123 Glad I could help. Have a look at [this](http://stackoverflow.com/questions/3271249/difference-between-statement-and-preparedstatement) as well.
score: 0

http://stackoverflow.com/a/23143398
score: 3
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23143259
answers question: http://stackoverflow.com/q/23143259
type: Answer
upvote count: 3
has body: A private inner class is part of the implementation of the class, hidden from the outside, so from an OO standpoint you are free to do anything you want. You're not breaking encapsulation in any way. You can actually declare variables in the inner class as private and access them from the containing class without restriction. But if you decide you prefer to use methods to read and write them, up to you. Accessor methods give you more flexibility if you decide to change something, but what needs changing is limited to the containing class.

http://stackoverflow.com/a/23269948
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/35612750
accepted answer of: http://stackoverflow.com/q/23269821
has comment: http://stackoverflow.com/comment/35612831
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23269821
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/35612690
has body: textView.setText(test, 0, 10); cause IndexOutOfBoundsException because your char [] test doesn't have length of 10. So check the length of char [] test before trying to set it to TextView. Something like, if(test.length &gt;= 10) { textView.setText(test, 0, 10); }else { textView.setText(test, 0, test.length); }

http://stackoverflow.com/q/23178106
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/23180081
has body: I recently updated to JDK and I've come across a very strange problem. I have a JFrame that I call the method setLocationRelativeTo(parentJFrame) and for some reason the JFrame flashes to the correct position before jumping to the top left of my screen and slowly slides down until it hits the bottom of the screen. Why does it do this, and how can I fix it?
type: Question
answer count: 1
score: 0
has title: Java 8 - Why does JFrame move?
has comment: http://stackoverflow.com/comment/35448236
has comment: http://stackoverflow.com/comment/35448206
has answer: http://stackoverflow.com/a/23180081
has comment: http://stackoverflow.com/comment/35448246
has comment: http://stackoverflow.com/comment/35448223
tagged with: swing
tagged with: java-8

http://stackoverflow.com/comment/35506625
score: 0
type: Comment
type: QuestionComment
has text: The integer `08` is the same than `8`.
comment on: http://stackoverflow.com/q/23211146

mime-mail
type: Tag
tag name: mime-mail
tags question: http://stackoverflow.com/q/23260313

http://stackoverflow.com/q/23187989
upvote count: 30
has title: Using javafx.beans properties in model classes
has body: Is it a correct practice to use JavaFX beans properties in the model classes? I wonder if it is a good practice to use properties in model classes to be able to bind them easier with the view components. I'm not worried about the availability of those libraries in future because my program will be run on JRE8 or later but the nature of using the JavaFX libraries in the model classes make me skeptical and I'm worried about current and future incompabilities specially because I want to use Hibernate to persist those attributes. Note: I use a pure JavaFX environment and I will never need Swing compability in my application.
type: AnsweredQuestion
tagged with: java
tagged with: hibernate
tagged with: javafx
has answer: http://stackoverflow.com/a/23527862
type: Question
linked to: http://stackoverflow.com/q/34143370
possible better answer: http://stackoverflow.com/a/23188565
downvote count: 0
has answer: http://stackoverflow.com/a/28022731
has answer: http://stackoverflow.com/a/23188565
tagged with: persistence
answer count: 3
accepted answer: http://stackoverflow.com/a/23527862
favorite count: 0
score: 30
tagged with: model

netbeans-7
tags question: http://stackoverflow.com/q/23181364
tag name: netbeans-7
type: Tag
tags question: http://stackoverflow.com/q/23204799
tags question: http://stackoverflow.com/q/23222936

http://stackoverflow.com/q/23261075
answer count: 4
type: AnsweredQuestion
downvote count: 0
tagged with: java
tagged with: gradle
upvote count: 28
type: Question
has answer: http://stackoverflow.com/a/23261076
accepted answer: http://stackoverflow.com/a/23261076
has answer: http://stackoverflow.com/a/47176603
has answer: http://stackoverflow.com/a/57177829
has title: Compiling Scala before / alongside Java with Gradle
score: 28
favorite count: 0
has body: The default scala plugin task flow compiles Java before Scala so importing Scala sources within Java causes "error: cannot find symbol".
tagged with: compiler-errors
tagged with: scala
tagged with: cross-compiling
possible better answer: http://stackoverflow.com/a/47176603
has answer: http://stackoverflow.com/a/66707593

http://stackoverflow.com/q/23171901
answer count: 1
tagged with: ssl
type: AnsweredQuestion
tagged with: apache
downvote count: 0
tagged with: james
has answer: http://stackoverflow.com/a/23196020
score: 1
favorite count: 0
has title: error configuring apache james 2.3.2 to support ssl: NoSuchAlgorithmException
type: Question
tagged with: java
accepted answer: http://stackoverflow.com/a/23196020
has body: I've downloaded apache james 2.3.2. At the moment I just want to get it working on localhost with ssl encyption (but I know very little about ssl). Initially I managed to get it running, create accounts (by running james-2.3.2/bin/run.bat) and connect to these account using mozilla thunderbird mail client. The trouble comes when I try to create a self signed ssl certificate. I have tried two different methods. running keytool -genkeypair creates a keystore in .keystore in my home directory and running keytool -genkeypair -alias certificate -keystore my_keystore.pfx -storepass password -validty 365 -keyalg RSA -keysize 2048 -storetype pkcs12 creates a keystore in my_keystore.pfx. james-2.3.2 will accept the .keystore but Thunderbird won't and Thunderbird will accept my_keystore.pfx but James throws exceptions. I think the error might be in the james-2.3.2/apps/james/SAR-INF/conf.xml file. <sockets> <server-sockets> conf/my_keystore.pfx password password PKCS12 TLS SHA256withRSA false </server-sockets When i try to run james again from the batch file I get NoSuchAlgorithException. Have tried using allsorts for the algorithm tag instead of SHA256withRSA but nothing seems to work. If anyone knows the answer I'd be greatfull. Also if anyone knows how to turn on the logging so I can see it in the log file that too would be helpfull.
upvote count: 1

http://stackoverflow.com/q/23143735
has comment: http://stackoverflow.com/comment/35388375
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/35388206
favorite count: 0
has title: Java : Sort a List<Point> with neighbour
has body: I have a list of Point and I want to sort them with their neighbour. For exemple : List init (0,0); (1,0); (5,0); (6,0); (0,1); (1,1); (5,1); (6,1); List sorted (0,0); (1,0); (0,1); (1,1); (5,0); (6,0); (5,1); (6,1); How can I do that ? list.sort(new Comparator&lt;Point&gt;() { @Override public int compare(Point p1, Point p2) { // Euclidian distance or something like that return ; } });
has answer: http://stackoverflow.com/a/23143762
has comment: http://stackoverflow.com/comment/35387897
upvote count: 1
has answer: http://stackoverflow.com/a/23144392
downvote count: 1
tagged with: nearest-neighbor
type: AnsweredQuestion
tagged with: list
tagged with: java
accepted answer: http://stackoverflow.com/a/23144392
has comment: http://stackoverflow.com/comment/35389505
type: Question
possible better answer: http://stackoverflow.com/a/23143939
has answer: http://stackoverflow.com/a/23143939
tagged with: point
tagged with: sorting
has comment: http://stackoverflow.com/comment/35388624
has comment: http://stackoverflow.com/comment/35388533
has comment: http://stackoverflow.com/comment/35388085

http://stackoverflow.com/a/23280389
accepted answer of: http://stackoverflow.com/q/23280267
score: 1
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/23280267
type: AcceptedAnswer
downvote count: 0
has body: Have then nested so you have the class which gets the integer value inside the one which actually displays it E.g: //Note: this is only a rough representation of the concept // what I am trying to get across, it wouldn't really // work like this class Displayer{ ValueGetter valueGetter; JTextField textField; public Displayer(){ valueGetter = new ValueGetter(); } public void display(){ int value = valueGetter.workOutValue(); textField.setText(value); } }

http://stackoverflow.com/q/23154181
has comment: http://stackoverflow.com/comment/35409768
has comment: http://stackoverflow.com/comment/35406013
tagged with: conflict
has comment: http://stackoverflow.com/comment/35406921
upvote count: 3
has comment: http://stackoverflow.com/comment/35525251
has title: How to avoid Spring's @RequestMapping paths conflicts?
linked to: http://stackoverflow.com/q/5992637
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23156049
score: 3
tagged with: java
has comment: http://stackoverflow.com/comment/35406159
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/35525275
has body: I'd like to define REST API using Spring. I have these 2 @Controller methods: @RequestMapping(value = "/{machineId}/workspaces/{workspaceId}", method = RequestMethod.DELETE) public void removeWorkspace(@PathVariable String machineId, @PathVariable String workspaceId {...} @RequestMapping(value = "/{machineId}", method = RequestMethod.DELETE) public void removeVM(@PathVariable String machineId) {...} The problem is, that this definition causing path conflicts: if I attempt to call curl -X DELETE http://localhost/machine-1/workspaces/workspace-1 I would expect, that the "removeWorkspace" should be called, but the problem is, that the "removeVM" is called. Does anybody get idea how to avoid such conflict? {machineId} prefix probably cause this conflict. Of course I'd like to keep those paths unchanged. Thanks
downvote count: 0
accepted answer: http://stackoverflow.com/a/23156049
favorite count: 0
has answer: http://stackoverflow.com/a/23156082
has comment: http://stackoverflow.com/comment/35406642
has comment: http://stackoverflow.com/comment/35406071
tagged with: rest
has comment: http://stackoverflow.com/comment/35406831
tagged with: path
possible better answer: http://stackoverflow.com/a/23156082
tagged with: spring

http://stackoverflow.com/q/23228332
type: Question
has answer: http://stackoverflow.com/a/23228836
possible better answer: http://stackoverflow.com/a/50578943
answer count: 2
has body: I'm working on a project where I need to read in two files, and then compare them in order to find how many lines are different. For example, if I had two files: 1.Cat 2.Dog 3.Shark 4.Penguin and 1.Cat 2.Dog 3.Penguin 4.Octopus The end result would say, "These files are not the same, there are two differences." Here is my coding so far: I have read the files in and stored each line of the file in a new part of the list. Now I am just looking for a way to compare them properly in order to find there differences. The way i am comparing them now does not account for order :/ Here is my code: import java.io.*; import java.util.*; public class myfilereader { public static void main (String[] args) throws java.io.IOException { ArrayList&lt;String&gt; ArrayList1 = new ArrayList&lt;String&gt;(); ArrayList&lt;String&gt; ArrayList2 = new ArrayList&lt;String&gt;(); ArrayList&lt;String&gt; ArrayList3 = new ArrayList&lt;String&gt;(); try { Scanner File1 = new Scanner(new File("/Users/Home/Desktop/File1.txt")); while (File1.hasNext()) { ArrayList1.add(File1.next()); } Scanner File2 = new Scanner(new File("/Users/Home/Desktop/File2.txt")); while (File2.hasNextLine()) { ArrayList2.add(File2.next()); } } catch (FileNotFoundException ex) { ex.printStackTrace(); } for (String ArrayList : ArrayList1) { System.out.println("File 1: " + ArrayList1); } for (String ArrayList : ArrayList2) { System.out.println("File 2: " + ArrayList2); } ArrayList1.removeAll(ArrayList2); System.out.println(ArrayList1); } }
tagged with: string
favorite count: 0
tagged with: arraylist
score: 0
has title: Compare two Files and determine which lines are different
accepted answer: http://stackoverflow.com/a/23228836
tagged with: java.util.scanner
upvote count: 1
downvote count: 1
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/50578943
tagged with: java

http://stackoverflow.com/q/23237630
upvote count: 1
has answer: http://stackoverflow.com/a/23247928
tagged with: sap-ase
has comment: http://stackoverflow.com/comment/35557416
has answer: http://stackoverflow.com/a/23238093
has title: Getting the date representation in seconds in Java
has comment: http://stackoverflow.com/comment/35554618
tagged with: java
has comment: http://stackoverflow.com/comment/35554440
has answer: http://stackoverflow.com/a/23237800
downvote count: 0
type: UnansweredQuestion
score: 1
tagged with: sybase
type: Question
answer count: 3
has body: I have a date For Eg: 2014-04-22 08:22:41 and I have to get the representation of the date in seconds from GMT-5 timezone which is 12/31/1969 19:00:00. I have the following code: import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; import java.util.TimeZone; public class samp { public static void main(String args[]) { Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("GMT-5:00")); long temp; Date tempDate = null; temp = 0L; cal.clear(); try { tempDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse("2014-04-22 08:22:41"); } catch (Exception e) { } cal.setTime(tempDate); temp = cal.getTimeInMillis() / 1000L; cal.clear(); System.out.println("Second representation is " + (int) temp); } } The output is : Second representation is 1398135161 But when I get the same value from Sybase Database I get the value: select DateDiff(ss,'12/31/1969 19:00:00','04/22/2014 08:22:41') = 1398172961 Why is there a difference between the java result and the database value. Is there something wring in java code. Please clarify.
favorite count: 0

http://stackoverflow.com/comment/35428229
type: Comment
has text: little slow. My Simulator is little slow. I have uncommented as well
comment on: http://stackoverflow.com/a/23166667
score: 0
type: AnswerComment

http://stackoverflow.com/comment/35631825
has text: I installed the feature through Help->Add New Software and creating an archive repository and loading in the feature that way.
comment on: http://stackoverflow.com/q/23275780
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35640922
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23284722
has text: @DonyorM I'm not exactly sure what you mean. If it checks for it not matching, doesn't that mean that it also checks if it does match?
score: 0

http://stackoverflow.com/comment/35403740
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23153250
has text: Your table name is all lowercase, and you're querying in all uppercase. Depending on environment settings (and settings controlled in `my.cnf`, your identifier names could be case sensitive)
score: 0

http://stackoverflow.com/comment/35475174
has text: I already answered. But problem is that the maven-repository for the fork seems to be down.
comment on: http://stackoverflow.com/a/23193589
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/23197353
has comment: http://stackoverflow.com/comment/35503250
type: Question
tagged with: primefaces
has body: I am trying to get the user select value to my backing bean. I've posted my XHTML code below: &lt;p:selectManyCheckbox style="z-index: 1000" id="gencount" layout="grid" columns="1" valueChangeListener="#{subUserBean.degreeFilter}"&gt; &lt;p:ajax event="click"/&gt; &lt;f:selectItem itemValue="All" itemLabel="All"/&gt; &lt;f:selectItem itemValue="BE" itemLabel="BE"/&gt; &lt;f:selectItem itemValue="B.TECH" itemLabel="B.TECH"/&gt; &lt;f:selectItem itemValue="MCA" itemLabel="MCA"/&gt; &lt;/p:selectManyCheckbox&gt; Value change listener in my bean: public void degreeFilter(ValueChangeEvent dege) { System.out.println("Select degree--&gt;"+dege.getNewValue().toString()); } I am getting only the object value as "[Ljava.lang.String;@a33ca7", but I need the select value as "BE".
tagged with: http://stackoverflow.com/tag/xhtml
has comment: http://stackoverflow.com/comment/35484822
tagged with: jsf-2
score: 0
has title: How to get the selectManyCheckbox value in my bean using valueChangeListener?
upvote count: 1
downvote count: 1
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/23210367
accepted answer: http://stackoverflow.com/a/23210367
type: AnsweredQuestion
tagged with: netbeans
tagged with: java

http://stackoverflow.com/a/24280411
score: 1
downvote count: 1
answers question: http://stackoverflow.com/q/23253156
has body: I was facing the same problem and changing the JAVA SDK (File >> Project Structure >> Projects)from 1.8 to 1.6 or 1.7 helped remove the problem.
type: Answer
upvote count: 2

http://stackoverflow.com/a/23237264
has body: To find the intersection of two sets you can use the function retainAll. Set&lt;Integer&gt; s1; Set&lt;Integer&gt; s2; s1.retainAll(s2); After this, s1 will contain the intersection. You could also use this method for arrays if you don't mind converting them to a set or list first, e.g.: int a[] = {1,2,3}; Set&lt;Integer&gt; mySet = new HashSet&lt;Integer&gt;(Arrays.asList(a));
score: 2
downvote count: 0
upvote count: 2
answers question: http://stackoverflow.com/q/23237160
type: Answer

http://stackoverflow.com/comment/35583704
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23254088
has text: There are more benefits than runtime polymorphism...

http://stackoverflow.com/q/23171612
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/23171685
score: 0
has comment: http://stackoverflow.com/comment/35436725
has comment: http://stackoverflow.com/comment/35436749
has comment: http://stackoverflow.com/comment/35436649
has answer: http://stackoverflow.com/a/23171685
linked to: http://stackoverflow.com/q/1196586
tagged with: list
upvote count: 1
downvote count: 1
type: AnsweredQuestion
tagged with: java
linked to: http://stackoverflow.com/q/23163728
has comment: http://stackoverflow.com/comment/35436747
type: Question
has body: I recently asked this question: Box2D - Can&#39;t destroy multiple fixtures, but figured out it wasn't an issue with Box2D, but an issue with my java. Here is my code: public static void removeSpecifiedBodies() { for (Body body : bodiesToRemoveList) { Array&lt;Fixture&gt; fixtures = body.getFixtureList(); for (Fixture fixture : fixtures) { body.destroyFixture(fixture); } } bodiesToRemoveList.clear(); } What I'm doing is looping through all of the bodies in my bodiesToRemoveList. Then, each body has multiple fixtures, so I get all of them and loop through them, destroying each one. After all of this, I clear the bodiesToRemoveList. But, in my second for loop, when I destroy the fixtures, only one is getting destroyed. I did some debugging and found that the for loop only runs once. I'm not sure why this is happening. A google search showed other people with this issue, and I noticed they all removed or cleared items from a list, just like I'm doing. I see no issue with my code, but for some reason nothing I try will fix it. Does anybody seen any issue with my code? Thanks in advanced. Edit: I'm an idiot. Thanks to everybody who helped. Here is my code, if anybody wants to see it. public static void removeSpecifiedBodies() { Iterator&lt;Body&gt; i = bodiesToRemoveList.iterator(); while (i.hasNext()) { Body desBod = i.next(); //body.destroyFixture(fixture); WorldController.b2world.destroyBody(desBod); i.remove(); } bodiesToRemoveList.clear(); }
tagged with: for-loop
has title: Java - For loop only runs once

http://stackoverflow.com/q/23205445
upvote count: 6
has body: I have a third party tool that I want to detect right away that the database is missing, instead of creating the empty database. I cannot change the tool itself, but only configure it. Not getting any error during database connection gives the application the false impression that the database is there, with all necessary tables. So the application will fail only when it does not find the tables. I want an SQLException to be thrown as soon as the application tries to connect to a database that does not exist. For instance, if the connection URL is jdbc:h2:/x/y and the file /x/y.h2.db does not exist. Is there a way, using the connection URL, to specify that the database should not be created? In other words, is there a way to tell the H2 driver to treat the absence of data files as an error that should be reported? Is there anything like this? =&gt; jdbc:h2:/x/y?ifFileNotFoundThanThrowException=true
score: 6
type: Question
type: AnsweredQuestion
tagged with: java
tagged with: h2
has answer: http://stackoverflow.com/a/23210318
answer count: 1
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/23210318
has title: In an embedded H2 database, how to prevent it from creating a database, by means of the connection URL?

http://stackoverflow.com/a/23223658
has comment: http://stackoverflow.com/comment/35530239
score: 0
has comment: http://stackoverflow.com/comment/35530176
has comment: http://stackoverflow.com/comment/35530415
answers question: http://stackoverflow.com/q/23223304
has comment: http://stackoverflow.com/comment/35529496
has comment: http://stackoverflow.com/comment/35528804
has comment: http://stackoverflow.com/comment/35528873
type: Answer
has comment: http://stackoverflow.com/comment/35530559
has body: I think the first "printable" character is the space symbol, at index 32. So drop anything below 32 and you should be fine. Should be trivial to extend to cover the whole string. You can assign characters as int values, and they correspond like shown here. char[] chars = new char[4]; chars[0] = 31; // character for unit separator chars[1] = 65; // A chars[2] = 66; // B chars[3] = 67; // C // build a string from the printable and unprintable chars String s = new String(chars); // check length and how it prints out System.out.println("[" + s +"]"); System.out.println(s.length()); // if char at index 0 &lt; 32, drop it if(s.charAt(0) &lt; 32) s = s.substring(1, s.length()); // prints like previously, but length is now smaller System.out.println("[" + s +"]"); System.out.println(s.length());

http://stackoverflow.com/comment/35641023
comment on: http://stackoverflow.com/a/23284823
has text: It would be nice if you explain what is `ext parts` ??
type: AnswerComment
type: Comment
score: 0

http://stackoverflow.com/q/23232020
favorite count: 0
has comment: http://stackoverflow.com/comment/35544225
has answer: http://stackoverflow.com/a/23232186
upvote count: 6
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23232186
tagged with: java
downvote count: 2
has comment: http://stackoverflow.com/comment/35544431
has title: Find first empty slot in an array of objects
type: Question
tagged with: object
tagged with: arrays
score: 4
has body: This is for a school project where we have to create an object, and then create an array of 20 objects. The object contains 1 string, and 4 doubles. I understand how to use a constructer to initialize the objects vairables. However, the part I am stumped on is how to determine the first empty space in the array. I'm assuming that each object in the array is null until it is assigned variables via the constructer. How would I go about finding the first empty spot in the array? Forgive me if its a duplicate, but the ones I looked at either didn't have thorough questions or they were not what I think I'm looking for I tried to do this: int openArray; for(int i = 0; i&lt;markbook.length; i++) { if(markbook[i] = null) { openArray = 1; } } But it didn't seem to do anything, or work. -Jordan
answer count: 1

http://stackoverflow.com/comment/35905451
score: 0
comment on: http://stackoverflow.com/q/23246289
type: Comment
type: QuestionComment
has text: Do modules A and B have the same version as the parent, and subsequently each other?

http://stackoverflow.com/q/23283234
linked to: http://stackoverflow.com/q/9928330
downvote count: 0
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/35638393
possible better answer: http://stackoverflow.com/a/23283301
tagged with: compilation
has answer: http://stackoverflow.com/a/23283301
has comment: http://stackoverflow.com/comment/35638566
upvote count: 2
answer count: 2
linked to: http://stackoverflow.com/q/12672232
favorite count: 0
has answer: http://stackoverflow.com/a/23283303
accepted answer: http://stackoverflow.com/a/23283303
has comment: http://stackoverflow.com/comment/35638416
has title: How to prove that class file matches java file
has comment: http://stackoverflow.com/comment/35638446
has comment: http://stackoverflow.com/comment/35638361
has body: I recently accidentally submitted my .class file instead of the .java file for an assignment. After feedback from the grader, I submitted my .java file. Everything worked out fine from there, the grader trusted that it was an honest mistake. However, is there a simple way for the grader to check to see if the two files really match up? So far, I've only thought of two solutions: Compile the .java, and see if the .class outputted is identical/very similar. This is probably very compiler dependant. If the compilers were the same, are there other variables that would make the .class different? Decompile the .class file, and do a character comparison. This seems like a lot more work, and probably match the .java file even less than solution 1. Is there a reliable way to check this?
type: AnsweredQuestion
score: 2

event-handling
tag name: event-handling
type: Tag
tags question: http://stackoverflow.com/q/23140461
tags question: http://stackoverflow.com/q/23170538
tags question: http://stackoverflow.com/q/23135099

http://stackoverflow.com/comment/35469005
type: QuestionComment
comment on: http://stackoverflow.com/q/23188412
type: Comment
has text: In the reportEvent method, try to log the event.getAction() in the else case to see if there are some other events happening besides up and down. You can then check on http://developer.android.com/reference/android/view/MotionEvent.html#ACTION_CANCEL to see what these numbers are according to the constants. This might lend some more information.
score: 0

http://stackoverflow.com/a/23287917
score: 1
answers question: http://stackoverflow.com/q/23287039
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/35650155
has comment: http://stackoverflow.com/comment/35650701
has body: If you are on Camel 2.11.x or newer, you might be able to do that with the new ControlBus component. Maybe easier and also available in earlier Camel versions is to subclass org.apache.camel.support.ServiceSupport. If myBean extends ServiceSupport you have to implement the doStop() method. There you can set a flag (AtomicBoolean?) to signify that shutdown is on progress. In updateAfterDelay() you can check that flag.
upvote count: 1

iterator
tags question: http://stackoverflow.com/q/23171425
tags question: http://stackoverflow.com/q/23282073
tag name: iterator
tags question: http://stackoverflow.com/q/23231653
tags question: http://stackoverflow.com/q/23256237
tags question: http://stackoverflow.com/q/23189065
tags question: http://stackoverflow.com/q/23168493
tags question: http://stackoverflow.com/q/23138523
tags question: http://stackoverflow.com/q/23148144
tags question: http://stackoverflow.com/q/23132488
tags question: http://stackoverflow.com/q/23273420
tags question: http://stackoverflow.com/q/23171977
tags question: http://stackoverflow.com/q/23178926
tags question: http://stackoverflow.com/q/23245930
tags question: http://stackoverflow.com/q/23188528
tags question: http://stackoverflow.com/q/23239777
tags question: http://stackoverflow.com/q/23181844
type: Tag
tags question: http://stackoverflow.com/q/23131733

http://stackoverflow.com/a/23262054
downvote count: 0
has body: You just Need a while loop while(!isInputValid){ //Take your input if(check == input){ isInputValid = true; }else{ //Please enter valid input try again. } }
type: Answer
answers question: http://stackoverflow.com/q/23261959
upvote count: 1
score: 1

http://stackoverflow.com/a/23225382
score: 1
type: AcceptedAnswer
downvote count: 0
has body: One approach: As you read each image into your ListModel you will need to create a "thumbnail version" of the image. This will minimize the amount of memory needed to display the images in your JList. When you select an image to display in the label you will then need to reread the image so you can display the image at its original size.
type: Answer
answers question: http://stackoverflow.com/q/23225243
has comment: http://stackoverflow.com/comment/35533513
has comment: http://stackoverflow.com/comment/35532235
has comment: http://stackoverflow.com/comment/35533040
accepted answer of: http://stackoverflow.com/q/23225243
upvote count: 1

http://stackoverflow.com/a/23260642
accepted answer of: http://stackoverflow.com/q/23260450
type: Answer
answers question: http://stackoverflow.com/q/23260450
downvote count: 0
score: 3
upvote count: 3
has body: I have Two Options for you (I like 2nd one the most.) 1. http://home.ccil.org/~cowan/XML/tagsoup instead of parsing well-formed or valid XML, parses HTML as it is found in the wild: poor, nasty and brutish, though quite often far from short. TagSoup is designed for people who have to process this stuff using some semblance of a rational application design. By providing a SAX interface, it allows standard XML tools to be applied to even the worst HTML. TagSoup also includes a command-line processor that reads HTML files and can generate either clean HTML or well-formed XML that is a close approximation to XHTML. This the tool we are using. I mentioned another tool but im not using it. 2. http://htmlcleaner.sourceforge.net/download.php Just download the jar file and unzip it. and Run the jar file like below. Go to the Location java -jar htmlcleaner-2.8.jar src=http://google.com It will correct missing tags and give output. Eg - I have Html file with following contents Wrong Table it gives the out like below C:\Users\Lasitha Benaragama\Downloads\htmlcleaner-2.8>java -jar htmlcleaner-2.8. jar src=http://localhost/fun/test.html Apr 24, 2014 12:23:10 PM org.htmlcleaner.audit.HtmlModificationListenerLogger fi reHtmlError INFO: fireHtmlError:RequiredParentMissing(true) at tr Apr 24, 2014 12:23:10 PM org.htmlcleaner.audit.HtmlModificationListenerLogger fi reHtmlError INFO: fireHtmlError:UnclosedTag(true) at table Apr 24, 2014 12:23:10 PM org.htmlcleaner.audit.HtmlModificationListenerLogger fi reHtmlError INFO: fireHtmlError:UnclosedTag(true) at tbody Apr 24, 2014 12:23:10 PM org.htmlcleaner.audit.HtmlModificationListenerLogger fi reHtmlError INFO: fireHtmlError:UnclosedTag(true) at tr Apr 24, 2014 12:23:10 PM org.htmlcleaner.audit.HtmlModificationListenerLogger fi reHtmlError INFO: fireHtmlError:UnclosedTag(true) at td <?xml version="1.0" encoding="UTF-8"?> Wrong Table I tested your html also, The output is C:\Users\Lasitha Benaragama\Downloads\htmlcleaner-2.8>java -jar html…
type: AcceptedAnswer

http://stackoverflow.com/q/23162098
tagged with: java
type: Question
has body: I'm trying to make a calander app following this tut: How can I create a weekly calendar view for an Android Honeycomb application? But i need to add a view to the corresponding RelativeLayout but every time i try to run the app it chrashes. My fragment .java file: public class Calendar extends Activity { @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } /** * A placeholder fragment containing a simple view. */ public static class FragmentCalendar extends Fragment { public FragmentCalendar() { RelativeLayout activeDay = (RelativeLayout)getActivity(). findViewById(R.id.sundayRelativeLayout); View viw = new View(null); RelativeLayout.LayoutParams lay = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.FILL_PARENT,2); lay.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM); viw.setBackgroundColor(Color.BLUE); viw.setLayoutParams(lay); activeDay.addView(viw); } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_calendar, container, false); return rootView; } } My fragment_Calendar.xml <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context="com.TJ.rijschool_app.Calendar" android:orientation="vertical" android:padding="0dp" > <TextView android:id="@+id/currentMonthTextView" android:la…
linked to: http://stackoverflow.com/q/9355747
accepted answer: http://stackoverflow.com/a/27961954
score: 0
answer count: 1
has title: Add Dynamic View to RalativeLayout
tagged with: view
tagged with: addition
type: AnsweredQuestion
tagged with: dynamic
has answer: http://stackoverflow.com/a/27961954

http://stackoverflow.com/a/23181601
type: AcceptedAnswer
type: Answer
score: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23181570
has body: This is because static int num is not marked volatile. Java "knows" that num is not going to change after the first read, so it is not reading it again. Change the declaration to static volatile int num; to fix this problem. This will force memory reads on each access to num. Note: static variables are not a good way of communicating between threads.
answers question: http://stackoverflow.com/q/23181570
upvote count: 2

http://stackoverflow.com/a/23287968
score: 1
has comment: http://stackoverflow.com/comment/35647593
has comment: http://stackoverflow.com/comment/35647677
has comment: http://stackoverflow.com/comment/35647053
has comment: http://stackoverflow.com/comment/35646985
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23287839
answers question: http://stackoverflow.com/q/23287839
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/35648387
has body: It would be a whole lot better if you used the API provided by wunderground instead of using jsoup in order to screen scrape the page. The main reasons are that the implementation will be a lot cleaner and also your implementation will be immune to stylistic changes in wunderground web pages. Here is guide on how to consume a REST web service with Spring. Once you have retrieved the data from the API you could easily store the data in a database using an ORM framework like Hibernate since you would have already created the objects to retrieve the data. You can make your life even easier if you use Spring with Hibernate integration to save the data. Check out this guide. The guides mentioned above use Spring Boot to make it extremely easy to get started with the Spring framework (gone are the days where it would be almost impossible for a novice to get started with a Spring project all alone)
has comment: http://stackoverflow.com/comment/35647332
has comment: http://stackoverflow.com/comment/35647266

http://stackoverflow.com/q/23252743
tagged with: java
upvote count: 7
type: Question
has body: When following this Spring example I was expecting to see output like this: Creating tables Inserting customer record for John Woo Inserting customer record for Jeff Dean ... Instead, I got some DEBUG log messages interspersed between every line: Creating tables 12:31:16.474 [main] DEBUG o.s.jdbc.core.JdbcTemplate - Executing SQL statement [drop table customers if exists] 12:31:16.484 [main] DEBUG o.s.jdbc.datasource.DataSourceUtils - Fetching JDBC Connection from DataSource 12:31:16.484 [main] DEBUG o.s.j.d.SimpleDriverDataSource - Creating new JDBC Driver Connection to [jdbc:h2:mem] ... These various answers seem to indicate that this can be resolved by changing the log level in my log4j.properties file. However, in following the Spring example a log4j.properties file is never mentioned. Interestingly, Spring does appear to be using log4j internally: $ grep -R "log4j" * Binary file build/libs/gs-relational-data-access-0.1.0.jar matches I imagine I could use log4j to fix this problem, but the manual doesn't seem to have information on where to put log4j.properties or how to integrate it into this project. How do I change the log level to remove those DEBUG statements? If I need to use a log4j.properties file, where do I place it? Do I need to tie it to my build.gradle file, or reference it in my .java files somehow?
tagged with: spring-boot
linked to: http://stackoverflow.com/q/4733522
accepted answer: http://stackoverflow.com/a/23254829
has title: Change Spring framework log level in simple example project?
linked to: http://stackoverflow.com/q/10905578
downvote count: 0
answer count: 1
linked to: http://stackoverflow.com/q/21739578
favorite count: 0
tagged with: spring
tagged with: logging
has answer: http://stackoverflow.com/a/23254829
tagged with: spring-jdbc
type: AnsweredQuestion
score: 7

http://stackoverflow.com/q/23239036
has body: I am a newbie to android. the question maybe silly for you, so forgive me. Now i am receiving an android project and open it in ADT. When open the project there are two errors in two java files, which is the import com.viewpagerindicator cannot be resolved in the Problems. I have searched with google and find it's using ViewPagerIndicator. and also the jar name is android-support-v4.jar. I checked the project libs folder there is android-support-v4.jar and it's also in the Android Private Libraries. I thought maybe it's not configured in the build path. so i checked the Java Build Path tab in the project Properties window, it's also in the Libraries tab. screenshot is as below: Am i missing anything? Any help would be appreciated.
has title: the import com.viewpagerindicator cannot be resolved
favorite count: 0
score: 2
downvote count: 0
tagged with: eclipse-adt
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/35556789
tagged with: eclipse
has answer: http://stackoverflow.com/a/23239291
accepted answer: http://stackoverflow.com/a/23239291
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/35556700
answer count: 1
has comment: http://stackoverflow.com/comment/35556929
tagged with: android
has comment: http://stackoverflow.com/comment/35556964
has comment: http://stackoverflow.com/comment/35556702

http://stackoverflow.com/q/23239507
has answer: http://stackoverflow.com/a/23239688
accepted answer: http://stackoverflow.com/a/23239688
tagged with: gps
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/35557221
type: Question
has title: Calling a onCreate method inside onCreate method in android
answer count: 1
score: 0
has body: MainActivity.java public class MainActivity extends FragmentActivity { LocationManager locationManager; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE); if ( !locationManager.isProviderEnabled( LocationManager.GPS_PROVIDER ) ) { showDialog(); } } public void showDialog(){ //GPS-Dialog GpsEnablingDialog gpsAlert; try { gpsAlert = new GpsEnablingDialog(); gpsAlert.show(getSupportFragmentManager(), "GpsAlert_Tag"); } catch (Exception e) { // TODO Auto-generated catch block Log.d("My-Log-Msg",e.toString()); e.printStackTrace(); } } } I tried with:: import android.content.Context; import android.location.LocationManager; import android.os.Bundle; import android.support.v4.app.FragmentActivity; import android.util.Log; public class MainActivity extends FragmentActivity { LocationManager locationManager; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE); if ( !locationManager.isProviderEnabled( LocationManager.GPS_PROVIDER ) ) { showDialog(); try { onCreate(savedInstanceState); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); Log.d("My-Log-Msg",e.toString()); } } } public void showDialog(){ //GPS-Dialog GpsEnablingDialog gpsAlert; try { gpsAlert = new GpsEnablingDialog(); gpsAlert.show(getSupportFragmentManager(), "GpsAlert_Tag"); } catch (Exception e) { // TODO Auto-generated catch block Log.d("My-Log-Msg",e.toString()); e.printStackTrace(); } } } Log:: 04-23 14:22:19.969: D/My-Log-Msg(1586): java.lang.IllegalStateException: Already attached 04-23 14:22:20.419: D/gralloc_goldfish(1586): Emulator without GPU emulation detected. What i understand:: From the log i can clearly understand that i am trying to attach…
tagged with: android

twilio
tag name: twilio
tags question: http://stackoverflow.com/q/23246699
tags question: http://stackoverflow.com/q/23208868
type: Tag

http://stackoverflow.com/q/23288439
upvote count: 21
has answer: http://stackoverflow.com/a/23288503
downvote count: 1
type: Question
score: 20
has answer: http://stackoverflow.com/a/63126310
tagged with: arraylist
has answer: http://stackoverflow.com/a/46070293
has answer: http://stackoverflow.com/a/52189356
has answer: http://stackoverflow.com/a/23288480
answer count: 10
possible better answer: http://stackoverflow.com/a/23288642
favorite count: 0
has body: I get exception Exception in thread "main" java.lang.IndexOutOfBoundsException: Index: 1, Size: 0 for the below code. But couldn't understand why. public class App { public static void main(String[] args) { ArrayList&lt;String&gt; s = new ArrayList&lt;&gt;(); //Set index deliberately as 1 (not zero) s.add(1,"Elephant"); System.out.println(s.size()); } } Update I can make it work, but I am trying to understand the concepts, so I changed declaration to below but didnt work either. ArrayList&lt;String&gt; s = new ArrayList&lt;&gt;(10)
linked to: http://stackoverflow.com/q/2965747
has comment: http://stackoverflow.com/comment/35647513
has answer: http://stackoverflow.com/a/23288493
accepted answer: http://stackoverflow.com/a/23288493
has answer: http://stackoverflow.com/a/23288642
has answer: http://stackoverflow.com/a/23288478
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23288735
has answer: http://stackoverflow.com/a/23288534
tagged with: java
has comment: http://stackoverflow.com/comment/35647377
tagged with: indexoutofboundsexception
has title: IndexOutOfBoundsException when adding to ArrayList at index

http://stackoverflow.com/a/23210430
accepted answer of: http://stackoverflow.com/q/23210278
answers question: http://stackoverflow.com/q/23210278
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35505858
has body: Your TicTacToePiece contains x and y value public TicTacToePiece(int newX, int newY, int newPlayerNumber, String newSymbol) And your GamePieces is consist of TicTacToePieces GamePieces = new ArrayList&lt;TicTacToePiece&gt;(); And since your AddPiece function takes x,y,newPiece as inputs, you would probably have to check if the location (x,y) in the board is occupied, you can do this by iterating through the arraylist if the location is not occupied, add the new piece to the board (arraylist) after setting the newPieces x, y values appropriately if necessary. edit::: for (TicTacToePiece tttp : GamePieces) { /* Note that this 'tttp' is each element in the Gameieces arraylist You are just iterating through all elements in the array checking if condition meets */ if (tttp.x == x &amp;&amp; tttp.y == y) { //x and y value match, do something } } The above is equivalent to below code for (int i = 0; i &lt; GamePieces.size(); i++) { if (GamePieces.get(i).x == x &amp;&amp; GamePieces.get(i).y == y) //dosomething } }
type: Answer
has comment: http://stackoverflow.com/comment/35508050

http://stackoverflow.com/q/23193243
upvote count: 2
type: UnansweredQuestion
tagged with: spring-annotations
tagged with: spring
score: 2
has title: Import classes conditionally with Spring Annotation
tagged with: java
has answer: http://stackoverflow.com/a/23193340
type: Question
has body: I have to import classes conditionally in my Configuration class of Spring. So there are 3 Configuration classes with @Configuration annotation: @Configuration public SubClass1 { ... } @Configuration public SubClass2 { ... } @Configuration // something like this: @Import(if (flag) 'SubClass1.class' else 'SubClass2.class') public MainClass1 { ... } Is it possible to import classes conditionally by @import annotation? Or will I have to import all the classes?
answer count: 1
downvote count: 0
favorite count: 0

http://stackoverflow.com/q/23148451
has comment: http://stackoverflow.com/comment/35980845
has comment: http://stackoverflow.com/comment/35986077
has body: This is actually a semi-question, semi-discussion thread. I think a feature is needed in Java that a method(lets say "calcTotalX") can be defined via annotation in a class(i.e. ParallelExecuter) which will executed beforeStart/AfterEnd of another method (lets say doJob) in the same class. So that we can be sure that any class (lets say SortingParallelExecuter ) extending ParallelExecuter and overriding its "doJob" method don't have to know about X, risk forgetting processing X, handle operations events about X, etc. My Question is that, is there anything in Java that I can do it like that, except AOP. I don't choose AOP because, it makes the code so much distributed and difficult to read. Also the concern here is class/method/attribute specific. So replication of behaviour is not needed for other class/method/attributes. By the way, if you find this reasonable, please vote for the thread. Thnx Ok, for being concrete I am adding a sample class which I use for dividing &amp; paralelization. public abstract class PartitionedParallelExecutor&lt;T&gt; { private ExecutorService executorService; private final List&lt;PartitionErrorDesc&lt;T&gt;&gt; errorMap = new ArrayList&lt;PartitionErrorDesc&lt;T&gt;&gt;(); private final AtomicInteger totalExecutedJobCount = new AtomicInteger(); private boolean shutdownForced = false; private final int workerCount; private final int partitionCount; protected final List&lt;T&gt; sourceList; //Must be implemented via Extender class protected abstract PartitionErrorDesc&lt;T&gt; doWork(List&lt;T&gt; subList); public PartitionedParallelExecutor(int workerCount, int partitionCount, List&lt;T&gt; sourceList) { super(); this.workerCount = workerCount; this.partitionCount = partitionCount; this.sourceList = sourceList; } public Object onPerPartitionFail(List&lt;T&gt; subList, PartitionErrorDesc&lt;T&gt; ped){return null;}; public Object onPerPartitionSuccess(List&lt;T&gt; subList){return null;}; public Object onAnyFailDoOnce() {return null;} pu…
type: Question
has comment: http://stackoverflow.com/comment/35954868
score: 0
answer count: 2
tagged with: annotations
has answer: http://stackoverflow.com/a/23511704
possible better answer: http://stackoverflow.com/a/23148830
upvote count: 1
tagged with: language-features
downvote count: 1
has answer: http://stackoverflow.com/a/23148830
has comment: http://stackoverflow.com/comment/35979489
tagged with: java
tagged with: aop
has title: Java Inheritance & OOP & AOP
has comment: http://stackoverflow.com/comment/35996499
has comment: http://stackoverflow.com/comment/35977857
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23511704
has comment: http://stackoverflow.com/comment/35969446
favorite count: 0
has comment: http://stackoverflow.com/comment/36044153

http://stackoverflow.com/q/23135993
has body: We are issue with network printer on Windows Server 2008. Our java application running on JBoss 7.2 is looking for selected printer in available printers: PrintService[] services = PrintServiceLookup.lookupPrintServices(null, null); everything works fine, but in one moment, PrintService with name of selected printer disappears from the list. Printing from other applications on that server works fine in same time.
score: 0
tagged with: printing
tagged with: windows
has comment: http://stackoverflow.com/comment/35389795
tagged with: jboss7.x
type: UnansweredQuestion
has title: lookupPrintServices not found network printer on windows
has comment: http://stackoverflow.com/comment/36069433
answer count: 0
tagged with: java
type: Question

http://stackoverflow.com/comment/35553368
type: AnswerComment
has text: No. You just need to define your own Clock class or interface, and call `clock.newDateTime()` instead of `new DateTime()` to get the current time.
score: 2
type: Comment
comment on: http://stackoverflow.com/a/23236507

http://stackoverflow.com/q/23244471
has comment: http://stackoverflow.com/comment/35567136
tagged with: java
has comment: http://stackoverflow.com/comment/35566663
has body: I have already looked at a bunch of existing pages on stackoverflow for this but none of these helped: How to customize @RequestParam error 400 response in Spring MVC How to inform callers when required rquest parameter is missing? My problem is extremely similar: My application is really a REST api, returning json/xml data rather that html (ie I don't use jsps, but marshalling to transform java beans to json/xml) When I query the URL with a required parameter, I get a 400 status with nothing in the payload, no text, nada. I would like to return a json/xml payload using my ErrorResponse object that I use in other places. I am using Spring 3.2.5 I have a controller which maps a URL to a method with a required parameter(candidateBillDay) @Controller public class AccountController extends WsController { private static final String JSP_CANDIDATE_PDD = "candidatepdd"; @RequestMapping( value="/account/{externalId}/{externalIdType}/candidatepdd" , method = RequestMethod.GET) public String getCandidatePaymentDueDateInfo( ModelMap model , @PathVariable String externalId , @PathVariable Integer externalIdType , @RequestParam Integer candidateBillDay , @RequestParam(required=false) Boolean includeCurrent ){ ... model.addAttribute( CandidatePaymentDueDateResponse.ROOT_ELEMENT, ...)); return JSP_CANDIDATE_PDD; } } I have an exception handler that catches all types of exceptions, has some logic to do some specific bits for some types (instanceof): @ControllerAdvice public class BWSExceptionHandler extends ResponseEntityExceptionHandler { private static final Logger LOG = LoggerFactory.getLogger(BWSExceptionHandler.class); @ExceptionHandler(value = { Exception.class } ) public ResponseEntity&lt;Object&gt; handleOtherExceptions(final Exception ex, final WebRequest req) { LOG.error("Uncaught Exception: ", ex); ErrorResponse resp = null; ... if( ex instanceof MissingServletRequestParameterException ){ MissingServletRequestParameterException e = (MissingServletRequestParameterExceptio…
type: Question
linked to: http://stackoverflow.com/q/9045124
upvote count: 6
has comment: http://stackoverflow.com/comment/35566145
has comment: http://stackoverflow.com/comment/35566573
has comment: http://stackoverflow.com/comment/35566527
answer count: 1
has comment: http://stackoverflow.com/comment/35567225
linked to: http://stackoverflow.com/q/15941474
favorite count: 0
has answer: http://stackoverflow.com/a/23250323
accepted answer: http://stackoverflow.com/a/23250323
score: 6
tagged with: spring
tagged with: spring-mvc
type: AnsweredQuestion
has title: customizing error response message when @requestparam is missing
downvote count: 0
has comment: http://stackoverflow.com/comment/35566954

http://stackoverflow.com/comment/35414983
type: QuestionComment
comment on: http://stackoverflow.com/q/23159351
score: 0
has text: @njzk2 I think that best answers this question. Nothing is changed in the end outside of cleaner code.
type: Comment

http://stackoverflow.com/a/23154415
answers question: http://stackoverflow.com/q/23139438
upvote count: 1
type: AcceptedAnswer
type: Answer
has body: The expected behavior would be for X509TrustManager to catch a CertPathValidatorException from CertPathValidator and re-throw it as a CertificateException (a CertificateRevokedException when available in Android). CRL checking is disabled here, on line 362. Note that its not as easy as removing that line, since if a cert has no CRL, a CertPathValidatorException is also thrown. CertPathValidator is implemented here and as far as I can tell, by wandering through the source, it doesn't download the CRL's.
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/23139438

http://stackoverflow.com/comment/35528313
comment on: http://stackoverflow.com/q/23217023
score: 0
type: QuestionComment
type: Comment
has text: @blackbelt I'm pretty sure everything I'm trying to do will be unuseful when porting to kitkat... anyway thanks. If you respond to the question I'll vote and accept the answer.

http://stackoverflow.com/comment/35486909
comment on: http://stackoverflow.com/a/23200271
type: AnswerComment
has text: hehe, yeah. i cant figure out how to display that JTable in my GUI. I was able to display a resultset using string. But this way all information is hard to read, thats why i was looking for the way to use jtable
type: Comment
score: 0

http://stackoverflow.com/comment/35418740
has text: it's not just likely.. :)
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23161365
type: Comment

http://stackoverflow.com/comment/35640688
has text: yes, those programs explains in detail about the validation , but yet they are written using regex
comment on: http://stackoverflow.com/q/23284443
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23250203
has body: This is a 4-connectivity problem to put a name on it. And you are looking for the biggest region. Here http://en.wikipedia.org/wiki/Connected-component_labeling you have some algorithms. NB: m-connectivity and 8-connectivity are with diagonals, careful here.
type: Answer
score: 2
upvote count: 2
accepted answer of: http://stackoverflow.com/q/23249262
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23249262

http://stackoverflow.com/a/23239851
score: 0
accepted answer of: http://stackoverflow.com/q/23239177
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23239177
type: Answer
has body: Don't use XML to define onClick actions. It's error prone and very VERY slow. Set an OnclickListener via java code. As Thrakbad pointed out, if you want to go the XML way (which is a bad idea), you need to fix the method signature.

http://stackoverflow.com/comment/35600458
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23263369
has text: 1º private field is initialized & 2º the constructor is called
score: 1

http://stackoverflow.com/comment/35619656
type: Comment
comment on: http://stackoverflow.com/a/23273669
has text: This is the correct (and functioning) solution. Here's an [ideone](http://ideone.com/mbV1WD) for you, OP.
score: 1
type: AnswerComment

http://stackoverflow.com/q/23196624
possible better answer: http://stackoverflow.com/a/42957261
upvote count: 5
downvote count: 0
has answer: http://stackoverflow.com/a/23197032
has answer: http://stackoverflow.com/a/42957261
answer count: 2
accepted answer: http://stackoverflow.com/a/23197032
favorite count: 0
has body: I'm getting familiar with web services in Java using Jax-ws (or JAXB, not sure, anyway...). I've created small project with a single webservice. The WS has the only endpoint called transfer and returns objects inheriting ITransferResult interface. Web service contract //Service Endpoint Interface @WebService @SOAPBinding(style = Style.RPC) public interface IBankWebSrv { @WebMethod ITransferResult transfer(String accountNumber, double amount); } Web service implementation //Service Implementation @WebService(endpointInterface = "Contracts.IBankWebSrv") public class BankWebSrv implements IBankWebSrv { @Override public ITransferResult transfer(String accountNumber, double amount) { ITransferResult result = new TransferResult(); // TODO logic here result.setSuccessful(true); return result; } } TransferResult contract @XmlJavaTypeAdapter(TransferResult.class) public interface ITransferResult { boolean isSuccessful(); void setSuccessful(boolean successful); } TransferResult implementation public class TransferResult extends XmlAdapter&lt;TransferResult, ITransferResult&gt; implements ITransferResult { @XmlElement boolean successful; public boolean isSuccessful() { return this.successful; } public void setSuccessful(boolean successful) { this.successful = successful; } @Override public TransferResult marshal(ITransferResult v) throws Exception { return (TransferResult) v; } @Override public ITransferResult unmarshal(TransferResult v) throws Exception { return (ITransferResult) v; } } When I publish my web service, I get the following error: Exception in thread "main" javax.xml.ws.WebServiceException: Unable to create JAXBContext... Caused by: java.security.PrivilegedActionException: com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException: 1 counts of IllegalAnnotationExceptions ITransferResult is an interface, and JAXB can't handle interfaces. this problem is related to the following location: at ITransferResult I've looked over SO for the answer and applied to th…
tagged with: web-services
type: AnsweredQuestion
tagged with: java
has title: JAXB cannot handle an interface - what am I missing?
tagged with: jaxb
type: Question
score: 5

program-entry-point
tags question: http://stackoverflow.com/q/23258124
tag name: program-entry-point
type: Tag
tags question: http://stackoverflow.com/q/23179840

http://stackoverflow.com/q/23148144
tagged with: hashset
possible better answer: http://stackoverflow.com/a/23148276
has comment: http://stackoverflow.com/comment/35399237
has body: I investigate LinkedHashSet and HashSet collections. I wrote small program: public class LHSTest { public static void main(String[] args){ output(test(new LinkedHashSet())); System.out.println("========="); output(test(new HashSet())); } public static HashSet&lt;MyClass&gt; test(HashSet hashSet){ hashSet.add(new MyClass(1)); hashSet.add(new MyClass(2)); hashSet.add(new MyClass(3)); hashSet.add(new MyClass(4)); hashSet.add(new MyClass(5)); return hashSet; } public static void output(HashSet hashSet){ for(Iterator iterator = hashSet.iterator();iterator.hasNext();){ System.out.println(iterator.next()); } } } class MyClass{ int a; MyClass(int a){ this.a =a; } public int hashCode(){ return 15-a; } public String toString() { return a+""; } } output: 1 2 3 4 5 ========= 5 4 3 2 1 When I saw this behaviour I began research source code of collections. I noticed that both LinkedHashSet and HashSet use common toString() realization - from AbstractCollection and common iterator() from HashSet What were explain the different output for LinkedHashSet and HashSet in my code? Update after Ivan Babanin answer For LinkedHashSet and HashSet invoke different constructors: for LinkedHashSet - HashSet(int initialCapacity, float loadFactor, boolean dummy) { map = new LinkedHashMap&lt;E,Object&gt;(initialCapacity, loadFactor); } for HashSet - public HashSet() { map = new HashMap&lt;E,Object&gt;(); } iterator for both HashMap and -LinkedHasMap (from HashSet) public Iterator&lt;E&gt; iterator() { return map.keySet().iterator(); } Research keySet() method: HashMap: public Set&lt;K&gt; keySet() { Set&lt;K&gt; ks = keySet; return (ks != null ? ks : (keySet = new KeySet())); } LinkedHashMap cannot especial realization for keySet method and uses HashMap realization. map.keySet().iterator() is : public class HashMap&lt;K,V&gt; extends AbstractMap&lt;K,V&gt; implements Map&lt;K,V&gt;, Cloneable, Serializable{ ... private final class EntrySet extends AbstractSet&lt;Map.Entry&lt;K,V&gt;&gt; { public …
answer count: 2
tagged with: iterator
accepted answer: http://stackoverflow.com/a/23149641
downvote count: 0
favorite count: 0
has title: Where in the source code is it implemented that iterators from LinkedHashSet and HashSet have different behaviour?
tagged with: linkedhashset
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/23149641
tagged with: collections
has answer: http://stackoverflow.com/a/23148276
type: Question

http://stackoverflow.com/comment/35607716
comment on: http://stackoverflow.com/a/23248420
type: Comment
score: 0
has text: Please read the example here: http://docs.oracle.com/javase/tutorial/displayCode.html?code=http://docs.oracle.com/javase/tutorial/2d/images/examples/LoadImageApp.java
type: AnswerComment

http://stackoverflow.com/comment/35413268
type: Comment
has text: I found something interesting.The logcat show me 181 records while the application display 189. How can I change the onLoadFinished so that my list items are not recorded twice?
comment on: http://stackoverflow.com/a/23154660
type: AnswerComment
score: 0

http://stackoverflow.com/comment/35439350
type: Comment
comment on: http://stackoverflow.com/a/23173044
type: AnswerComment
has text: Thank you. I knew I was overlooking something trivial.
score: 0

http://stackoverflow.com/comment/35576254
score: 4
comment on: http://stackoverflow.com/q/23250174
type: Comment
type: QuestionComment
has text: initialise `counter = 20;` ????

http://stackoverflow.com/q/23268818
type: UnansweredQuestion
tagged with: java
type: Question
has body: I am making an android app that downloads an xml file and creates a list view where the downloaded data are shown. The app was working fine. Suddenly the screen appears empty. I did not make any change. I have a variable that shows the length of the arrayadapter and it appears to be 0. The logcat shows a NullPointerException in the file below: package com.makemyandroidapp.example.stacksites; import java.io.BufferedReader; import java.io.FileInputStream; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.List; import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserFactory; import android.content.Context; public class SitesXmlPullParser { /*static final String KEY_SITE = "site"; static final String KEY_NAME = "name"; static final String KEY_LINK = "link"; static final String KEY_ABOUT = "about"; */ static final String KEY_SITE = "pozicioni"; static final String KEY_KOMPANIA = "kompania"; static final String KEY_POZICIONI = "pozicioni"; static final String KEY_KATEGORIA = "kategoria"; static final String KEY_QYTETI = "qyteti"; static final String KEY_IMAGE_URL = "image"; public static List&lt;StackSite&gt; getStackSitesFromFile(Context ctx) { // List of StackSites that we will return List&lt;StackSite&gt; stackSites; stackSites = new ArrayList&lt;StackSite&gt;(); // temp holder for current StackSite while parsing StackSite curStackSite = null; // temp holder for current text value while parsing String curText = ""; try { // Get our factory and PullParser XmlPullParserFactory factory = XmlPullParserFactory.newInstance(); XmlPullParser xpp = factory.newPullParser(); // Open up InputStream and Reader of our file. FileInputStream fis = ctx.openFileInput("StackSites.xml"); BufferedReader reader = new BufferedReader(new InputStreamReader(fis)); // point the parser to our file. xpp.setInput(reader); // get initial eventType int eventType = xpp.getEventType(); boolean done = false; int count=0; // Loop through pull events until we r…
has comment: http://stackoverflow.com/comment/35611914
has comment: http://stackoverflow.com/comment/35610420
has answer: http://stackoverflow.com/a/23268953
score: 0
has title: java.lang NullPointerException in android
answer count: 1
tagged with: nullpointerexception
tagged with: android
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/35610424
has comment: http://stackoverflow.com/comment/35610589

http://stackoverflow.com/a/23213118
downvote count: 0
type: AcceptedAnswer
type: Answer
has body: A common use case is to test if an object is marked with this interface: if (obj instanceof kiran) { // do something }
score: 4
accepted answer of: http://stackoverflow.com/q/23213065
upvote count: 4
answers question: http://stackoverflow.com/q/23213065

http://stackoverflow.com/comment/35611393
has text: Why should it throw an error?
comment on: http://stackoverflow.com/q/23269333
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35567090
score: 0
type: AnswerComment
has text: Frankly, I'm going to leave "if root is null" problem as an exercise for the reader.
type: Comment
comment on: http://stackoverflow.com/a/23228395

http://stackoverflow.com/comment/35489379
score: 0
type: AnswerComment
type: Comment
has text: No, there are 8 specific substrings I want to find, but thank you for the example
comment on: http://stackoverflow.com/a/23190833

http://stackoverflow.com/q/23278288
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/35628655
has answer: http://stackoverflow.com/a/23278348
has comment: http://stackoverflow.com/comment/35628666
has comment: http://stackoverflow.com/comment/35628836
type: UnansweredQuestion
has body: I've got a client/server setup in Java. The client currently transmits a calculated value to the server (via socket, in addition to login/password) in order to authenticate. However, there is currently nothing preventing a maliciously decompiled and refactored client from connecting, because all it would need to do is send the same authentication data. Given that decompilation reveals everything my client is doing, is there really any way to reasonably prevent connections from modified clients? It seems to me that the only way to accomplish this is to generate a unique token that a modified client (with identical token-generation logic) would, somehow, be incapable of generating.
tagged with: java
has comment: http://stackoverflow.com/comment/35962155
has title: Preventing connections from illegitimate clients
has comment: http://stackoverflow.com/comment/35670248
type: Question
tagged with: security

http://stackoverflow.com/a/39600836
answers question: http://stackoverflow.com/q/23260057
downvote count: 0
score: 1
upvote count: 1
has body: I ran into this problem during Jenkins builds on an Ubuntu machine. /var/log/syslog reported Out of memory: Kill process 19557 (java) score 207 or sacrifice child. I therefore gave the Ubuntu machine more swap space. Since then, the problem is gone.
type: Answer

http://stackoverflow.com/comment/35654408
has text: The client doesn't ask for the connection. The server asks for the connection.
type: Comment
comment on: http://stackoverflow.com/a/23282313
score: 0
type: AnswerComment

http://stackoverflow.com/comment/35422236
type: AnswerComment
type: Comment
has text: I just tried it and it seems to work... my `JFrame` is up but I can still call `scanner.nextLine()` [after `scanner = new Scanner(system.in)`] and it gets the data. (This is on Windows.) Definitely agree that this is a poor interface, although maybe OK as a temporary debugging measure during development if it works.
comment on: http://stackoverflow.com/a/23163165
score: 0

http://stackoverflow.com/q/23185963
downvote count: 0
favorite count: 0
has body: I'm trying to get JSON from object, but I'm getting exception: org.glassfish.jersey.message.internal.MessageBodyProviderNotFoundException: MessageBodyWriter not found for media type=application/json, type=class Controllers.MyJax, genericType=class Controllers.MyJax. I don't know why it doesn't work. My code is similar to code from official documentatin. I filled up all three conditions: Resource method, which should return wrapped JSON, needs to be annotated with @JSONP annotation. MessageBodyWriter for application/json media type, which also accepts the return type of the resource method, needs to be registered (see JSON section of this chapter). (by annotation @Produces) User's request has to contain Accept header with one of the JavaScript media types defined (see below). I have tried like this: @Produces("application/json") and @Produces(MediaType.APPLICATION_JSON) My code: @GET @Path("new") @JSONP @Produces("application/json") public MyJax ewUser() { return new MyJax("jsonp"); } and: package Controllers; import javax.xml.bind.annotation.XmlRootElement; @XmlRootElement public class MyJax { private String value; public MyJax() {} public MyJax(final String value) { this.value = value; } public String getValue() { return value; } public void setValue(final String value) { this.value = value; } }
type: UnansweredQuestion
score: 1
tagged with: java
upvote count: 1
type: Question
tagged with: jersey
tagged with: http://stackoverflow.com/tag/json
has answer: http://stackoverflow.com/a/23186283
has title: JSONP with Jersey
answer count: 1

http://stackoverflow.com/a/23271771
answers question: http://stackoverflow.com/q/23271598
score: -3
has body: You could use this : if(Arrays.binarySearch(newAlphabet, letters) &lt; 0){ newAlphabet[I] = letters; } You should either include a while loop to make sure each index of the array is filled before moving to the next or you could make use of the return value of Arrays.binarySearch which is (-(insertion index) - 1) to fill the array and exit when the array is filled up.
downvote count: 3
type: Answer
upvote count: 0

http://stackoverflow.com/q/23177078
tagged with: field
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35446788
score: 2
downvote count: 0
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has title: Java - Specify fields to return in REST
has comment: http://stackoverflow.com/comment/35446906
has comment: http://stackoverflow.com/comment/35446570
type: Question
upvote count: 2
has body: I am implementing REST based services in Java, but I don't want to return the full entity in JSON for each GET call. What i have right now is this @GET @Path("movie/{id}") @Produces({"application/json"}) public Movie find(@PathParam("id") Integer id) { return getEntityManager().find(Movie.class, id); } With the above code I can get a full JSON representation of the movie specified by id however I would like to do something like this: GET&gt;http://mydomain.com/movie/id=1?fields=title,year Here, I pass the id of the movie and the fields that I'd like returned in a JSON formatted response. Is there a simple way to do this or an existing library that alraedy does this? EDIT: Yes A.J i ended up finding the same example but i cant make it work In that example they have a file with all the configurations necessary @ApplicationPath("/") public class SelectableEntityFilteringApplication extends ResourceConfig { public SelectableEntityFilteringApplication() { // Register all resources present under the package. packages("org.glassfish.jersey.examples.entityfiltering.selectable"); // Register entity-filtering selectable feature. register(SelectableEntityFilteringFeature.class); // Configure MOXy Json provider. register(new MoxyJsonConfig().setFormattedOutput(true).resolver()); property(SelectableEntityFilteringFeature.QUERY_PARAM_NAME, "select"); } } but since im using J2EE the file generated by my IDE was this @javax.ws.rs.ApplicationPath("webresources") public class ApplicationConfig extends Application { @Override public Set&lt;Class&lt;?&gt;&gt; getClasses() { //register(SelectableEntityFilteringFeature.class); Set&lt;Class&lt;?&gt;&gt; resources = new java.util.HashSet&lt;&gt;(); addRestResourceClasses(resources); return resources; } and i cant register the class, do i really have to extend ResourceConfig? Doesnt seem to be compatible with javax.ws.rs.core.Application
tagged with: rest
has answer: http://stackoverflow.com/a/23177415
answer count: 1
tagged with: jax-rs
favorite count: 0
has comment: http://stackoverflow.com/comment/35446422

http://stackoverflow.com/a/23213244
answers question: http://stackoverflow.com/q/23188014
score: 0
has comment: http://stackoverflow.com/comment/35530594
type: Answer
has body: The problem is that you add the two panels to the same place: the default JFrame's layout is BorderLayout, and BorderLayout's add(panel) defaults to add(panel, BorderLayout.CENTER). So either specify the position explicitly, say: content.add(infoPanel, BorderLayout.CENTER); content.add(playerPanel, BorderLayout.SOUTH); Or use a different layout with the frame: frame.setLayout(new FlowLayout()); Also you should make the frame visible after you add all components. You might want to add frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); However, I would highly recommend using a visual gui designer such as the one in netbeans. (Unless you need to build the gui dynamically)

http://stackoverflow.com/q/23274355
tagged with: java
type: Question
has body: I am trying to use a Guava function to remove duplicates from a List. The reasoning for this is that a "duplicate" is based on a comparison between two items in the list, and whether these objects are "duplicate" requires a fair amount of logic. Here is my attempt at the function: private Function&lt;List&lt;BaseRecord&gt;, List&lt;BaseRecord&gt;&gt; removeDuplicates = new Function&lt;List&lt;BaseRecord&gt;, List&lt;BaseRecord&gt;&gt;() { public List&lt;BaseRecord&gt; apply(List&lt;BaseRecord&gt; records) { List&lt;BaseRecord&gt; out = Lists.newArrayList(); PeekingIterator&lt;BaseRecord&gt; i = Iterators.peekingIterator(records.iterator()); while (i.hasNext()) { BaseRecord current = i.next(); boolean isDuplicate = false; if ( i.hasNext() ) { BaseRecord next = i.peek(); // use a ComparisonChain to compare certain fields, removed isDuplicate = compareCertainObjects(o1, o2); } if ( !isDuplicate ) { out.add(current); } } return out; } }; I then try to call it with Lists.transform(originalRecords, removeDuplicates) Unfortunately, Eclipse isn't happy: The method transform(List&lt;F&gt;, Function&lt;? super F,? extends T&gt;) in the type Lists is not applicable for the arguments (List&lt;BaseRecord&gt;, Function&lt;List&lt;BaseRecord&gt;,List&lt;BaseRecord&gt;&gt;). BaseRecord is an abstract class, with at least two subtypes. The fields being compared are all parent of BaseRecord, not the child classes. Did I just make a dumb mistake?
has answer: http://stackoverflow.com/a/23275084
score: 0
answer count: 3
has title: Method transform() in Type Lists Not Applicable
has answer: http://stackoverflow.com/a/32546773
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23274559
tagged with: guava

http://stackoverflow.com/comment/35366122
has text: @Alexander_Winter Thanks for your reply. I putted it into my method getYearAcad() but it doesn't work, it doesn't find any fields and variables with my year. In ADF I got default generated getYearAcad with constructor /*return (String) getAttributeInternal(YEARACAD);*/
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23131751

http://stackoverflow.com/comment/49702190
type: QuestionComment
has text: Having the same problem, because I'm using [`grpc`](https://github.com/grpc/grpc-java) whose `grpc-auth` subpackage depends on `javaee-api`. Did you ever find a solution?
score: 0
comment on: http://stackoverflow.com/q/23211625
type: Comment

http://stackoverflow.com/a/23301065
upvote count: 1
has body: You are attempting to write some clever code. This will hurt the long term maintainability and may lead to people trying to 'fix' your clever code and break it. The correct thing to do is to write it simply and clearly what you are doing: boolean val = false; val |= fA(); val |= fB(); function(val); There is no question what the parameter val is, or if fB() is being called when fA() return false. The code may take up a few more lines than other clever versions, but it is clear and concise and shows exactly what it is doing and intends to do in a way that does not suggest to someone some other functionality.
has comment: http://stackoverflow.com/comment/86801121
answers question: http://stackoverflow.com/q/23222724
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/comment/35586077
type: QuestionComment
comment on: http://stackoverflow.com/q/23254958
has text: I understood that it wouldn't run without a main a method, I was just trying to figure out why my professor was able to run it. So I am trying to see what I am missing.
score: 0
type: Comment

http://stackoverflow.com/q/23141696
has answer: http://stackoverflow.com/a/23141780
linked to: http://stackoverflow.com/q/7810074
tagged with: arrays
downvote count: 0
answer count: 1
duplicate of: http://stackoverflow.com/q/7810074
favorite count: 0
accepted answer: http://stackoverflow.com/a/23141780
has comment: http://stackoverflow.com/comment/35384332
tagged with: generics
score: 2
type: AnsweredQuestion
upvote count: 2
has body: I am trying to make a generic array in java - in which i am having some issues - how can i make an array of Tuples which is of size 6 and has size a byte[] and a Integer inside? Thanks private Tuple&lt;byte[], Integer&gt;[] alternativeImages1 = new Tuple&lt;byte[], Integer&gt;[6]; class Tuple&lt;F, S&gt; { public final F first; public final S second; public Tuple(final F first, final S second) { this.first = first; this.second = second; } @Override public boolean equals(final Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; final Tuple tuple = (Tuple) o; return this.first == tuple.first &amp;&amp; this.second == tuple.second; } @Override public int hashCode() { int result = this.first != null ? first.hashCode() : 0; result = 31 * result + (this.second != null ? second.hashCode() : 0); return result; } }
type: Question
has title: Create a generic array in java
tagged with: java

http://stackoverflow.com/a/23253796
downvote count: 1
has comment: http://stackoverflow.com/comment/35583243
has comment: http://stackoverflow.com/comment/35615766
has comment: http://stackoverflow.com/comment/35587024
has comment: http://stackoverflow.com/comment/35583481
has comment: http://stackoverflow.com/comment/35583369
answers question: http://stackoverflow.com/q/23253525
has comment: http://stackoverflow.com/comment/35584953
score: 0
has body: form.submit() operation cannot send JSON format properly. You can use Ext.Ajax.Request. I think this is a better approach. An example is in here.
has comment: http://stackoverflow.com/comment/35585472
type: Answer
has comment: http://stackoverflow.com/comment/35596038
upvote count: 1

http://stackoverflow.com/comment/35505474
type: Comment
type: QuestionComment
has text: Are you passing a number (0001) to CSVWriter? Can you post some code snippet here?
score: 0
comment on: http://stackoverflow.com/q/23210316

http://stackoverflow.com/q/23159693
has body: I've recently had cause to back off from a couple of unrelated frameworks and start from scratch. In the one case, Javascript driven form UI and in the other the same for Java Swing. I realized I can make a simple JSON object defining my UI elements from fields to event bindings. Before I go too terribly far down the rabbit hole, I started wondering: is there an emerging or existing standard anyone has seen for this sort of thing? Below is one flavor of what I was kicking around. I'm playing with using a JSON object to define a Swing UI layout as well as (separately) web facing JavaScript generated web forms. The two variable stem from my build up which was initially a simple grid control where I needed fields before I thought it would be good to have a form too. It could be folded into one JSON structure, of course. var app = { forms: form1, bindings: [], layout:[{ width: 400, height: 300, bgcolor: '#fefefe', color: 'black' }] } var form1 = { "formfield1": { itype: "text", tag: "input", iclass: "frminput", defaultval: "text input", label: "Text Value 1", validation: '/[a-z][A-Z][0-9]/', error: "No special characters allowed - only numbers or letters for this input", bindings: [{ ievent: 'click', fx: function(){ validateTest(this); } },{ ievent: 'blur', fx: function(){ blurTest(this); } }] }, "formfield2": { itype: "select", tag: "select", iclass: "frminput", defaultval: "apples", label: "Test Select", options: [["apples","Apples"], ["oranges","Oranges"], ["peaches","Peaches"]] }, "formfield3": { itype: "date", tag: "input", iclass: "date", label: "Test Date", defaultval: new Date() }, "formfield4": { itype: "text", tag: "input", iclass: "frminput", label: "Text field 2", defaultval: "text input other" }, "objectproperty": { itype: "button", tag: "button", iclass: "btn btn-small", label: "test magnitude button", defaultval: "", bindings: [{ ievent: 'click', fx: function(){ buttonAction(this); } }] } }; What I would most like to find is that someone else has put more…
linked to: http://stackoverflow.com/q/12806386
has comment: http://stackoverflow.com/comment/35415707
tagged with: user-interface
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/23201979
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35489940
score: 2
has comment: http://stackoverflow.com/comment/35415771
upvote count: 2
tagged with: java
tagged with: swing
has title: Is there an accepted or emerging JSON form and field definition format?
type: Question
has comment: http://stackoverflow.com/comment/35489742
has comment: http://stackoverflow.com/comment/35489885
tagged with: http://stackoverflow.com/tag/json
has answer: http://stackoverflow.com/a/38226411
answer count: 2

http://stackoverflow.com/comment/35624940
type: AnswerComment
score: 0
type: Comment
has text: Nothing happens, I get the negative of the IF statement, the loginsuccess isn't getting itself to true
comment on: http://stackoverflow.com/a/23275254

http://stackoverflow.com/a/23304549
has body: The reason that g cannot be resolved is that it does not exist in the keyPressed() method. g is what is called a parameter of the method paint(). This means that you can only refer to it within the method paint(). You can declare another variable named g outside the method paint(), but it won't be the same g. It won't even have to have the same type. That said, you do not need to reference g directly at all in order to solve your problem. The paint() method already handles drawing a circle. You just need to change where the circle is and tell the application to repaint it. If you assign new values to x and y and then invoke repaint(), the circle will move. Notice that repaint() is already called at the end of the keyPressed() method. Here is an example. Replace the code on the right hand side of the equals with whatever may be appropriate to your problem. else if(keyCode == KeyEvent.VK_Z) { x = x + radius; y = y + radius; } If you look at the other if/else clauses, you will see that this is what they are doing as well.
answers question: http://stackoverflow.com/q/23234594
downvote count: 0
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/comment/35589094
comment on: http://stackoverflow.com/q/23256921
type: Comment
type: QuestionComment
has text: The variable's name is `books`, not `bookList`
score: 0

http://stackoverflow.com/a/23170115
upvote count: 3
accepted answer of: http://stackoverflow.com/q/23170052
answers question: http://stackoverflow.com/q/23170052
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 3
has body: I guess in while(x[i]!=p_x&amp;&amp;y[i]!=p_y) should be || instead of &amp;&amp; Also in run, entered, setradius and drawenemies methods for loop should be: for(int i=0; i &lt; a; i++) because arrays in Java are numerated from 0 to n-1 where n is the size of array. Your code will generate ArrayIndexOutOfBoundsException In keyPressed method you could replace this four if with one switch statement. You could also consider changing your mehtods names to camelCase

http://stackoverflow.com/a/23290914
downvote count: 0
answers question: http://stackoverflow.com/q/23288050
score: 1
type: AcceptedAnswer
upvote count: 1
type: Answer
has body: In intiGUI() method, replace frame with 'this'. frame.setSize(500, 500); frame.add(getContentPane()); frame.setTitle("Bar Code Scanner"); frame.setVisible(true); Use the below code: this.setSize(500, 500); this.add(getContentPane()); this.setTitle("Bar Code Scanner"); this.setVisible(true); Here current class itself is a JFrame and you have added the components to current content pane. hence you need to set size and visibility to the current JFrame i.e. current class. public static void main(String[] args) { System.out.println("This Is It"); new getData(); // ** You need to instantiate the class }
accepted answer of: http://stackoverflow.com/q/23288050

http://stackoverflow.com/a/66005554
answers question: http://stackoverflow.com/q/23260057
downvote count: 0
score: 1
upvote count: 1
has body: this error I was able to remove after adding profile: surefire-windows-fork-disable Windows org.apache.maven.plugins maven-surefire-plugin 0 false seems that this is a windows problem regarding maven surefire forks
type: Answer

http://stackoverflow.com/a/23205275
has comment: http://stackoverflow.com/comment/35496751
has comment: http://stackoverflow.com/comment/35496358
score: 2
accepted answer of: http://stackoverflow.com/q/23205071
has body: You say to use redirect but you're using forwarding. Anyway, if the resources (CSS, JS, etc) files are not in the same path of your JSP, then you should append the request context for each of these. Here are two ways: Using Expression Language only: &lt;link rel="stylesheet" type="text/css" href="${request.contextPath}/style.css"&gt; Using JSTL &lt;c:url&gt; tag: &lt;link rel="stylesheet" type="text/css" href="&lt;c:url value='/style.css'/&gt;"&gt; From your comment: The problem was I cant use servlet urlPatterns = {"/"} with this pattern You can have a servlet with url pattern "/". It means that your servlet will handle every single request in your application, note that requests to the resources (CSS, JS, images, etc) are GET requests (you can easily verify this by opening a browser like Firefox with Firebug or Chrome, press F12 and check for the network tab to see all the requests done to the server) so your servlet will handle them as well. This will be so painful to handle manually using a single servlet unless you want to implement Front Controller Pattern by yourself (IMO you should not try to do it unless you really know what you're doing). A better recommendation would be to use an exact url pattern for your servlets, in order to avoid such problems.
answers question: http://stackoverflow.com/q/23205071
has comment: http://stackoverflow.com/comment/35496142
has comment: http://stackoverflow.com/comment/35496775
has comment: http://stackoverflow.com/comment/35496310
upvote count: 2
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/35496172
type: Answer

http://stackoverflow.com/q/23262509
has comment: http://stackoverflow.com/comment/35598979
type: AnsweredQuestion
tagged with: enums
accepted answer: http://stackoverflow.com/a/23262916
upvote count: 5
tagged with: java
has title: How to implement equals and hashcode for enum classes
has body: I have an interface name Types public interface Types { public String getName(); } Two enum classes are extending this interface like public enum AlphaTypes implements Types { Alpha("alpha"),Common("common") private String name; private AlphaTypes(String name) { this.name = name; } @Override public String getName() { return name; } } public enum BetaTypes implements Types { Beta("beta"),Common("common") private String name; private BetaTypes(String name) { this.name = name; } @Override public String getName() { return name; } } The requirement is have a map which takes Types as key like Map&lt;Types,Object&gt; map; How to implement equals and hashcode, such that the map keys are unique even for common enum values?
type: Question
score: 5
tagged with: hashmap
has comment: http://stackoverflow.com/comment/35598914
downvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/23262916
has comment: http://stackoverflow.com/comment/35598841
favorite count: 0
linked to: http://stackoverflow.com/q/2964704

http://stackoverflow.com/a/23174587
has body: Documents and indexes are stored in HR Datastore Documents and indexes are saved in a separate persistent store optimized for search operations The Document class represents documents. Each document has a document identifier and a list of fields. The Document class represents documents. Each document has a document identifier and a list of fields. It's all in Google's documentation
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23172275
upvote count: 2
type: Answer
score: 2
answers question: http://stackoverflow.com/q/23172275

http://stackoverflow.com/comment/35580881
type: Comment
has text: Wow Wonderfully explained, short and precise. Thanks
comment on: http://stackoverflow.com/a/23252563
type: AnswerComment
score: 0

http://stackoverflow.com/a/23134202
has comment: http://stackoverflow.com/comment/35373934
type: Answer
has comment: http://stackoverflow.com/comment/35375615
answers question: http://stackoverflow.com/q/23133954
has comment: http://stackoverflow.com/comment/35374173
has comment: http://stackoverflow.com/comment/35374013
has body: This bit right here: while (in.hasNextLine()) { lastNames.add(in.nextLine()); } You're reading the entire line in and adding it to lastNames. The data is tab-delimited, so to get rid of the extra fields, you should do this before you put it into lastNames: while (in.hasNextLine()) { String lastNameLine = in.nextLine(); String [] parts = lastNameLine.split("\\t"); // Split by tabs. if(parts == null || parts.length &lt; 0) { /* uh-oh... error condition */ } String lastName = parts[0]; lastNames.add(lastName); }
score: 0

http://stackoverflow.com/q/23246947
favorite count: 0
possible better answer: http://stackoverflow.com/a/23247002
has answer: http://stackoverflow.com/a/23247002
has answer: http://stackoverflow.com/a/23247148
tagged with: regex
has title: Insert character before specific character Java
answer count: 4
accepted answer: http://stackoverflow.com/a/23247148
score: 1
has answer: http://stackoverflow.com/a/23247722
upvote count: 1
has body: I have been taking a look at the regular expressions and how to use it in Java for the problem I have to solve. I have to insert a \ before every ". This is what I have: public class TestExpressions { public static void main (String args[]) { String test = "$('a:contains(\"CRUCERO\")')"; test = test.replaceAll("(\")","$1%"); System.out.println(test); } } The ouput is: $('a:contains("%CRUCERO"%)') What I want is: $('a:contains(\"CRUCERO\")') I have changed % for \\ but have an error StringIndexOutofBounds don't know why. If someone can help me I would appreciate it, thank you in advance.
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/23247133
type: Question
downvote count: 0
tagged with: string

http://stackoverflow.com/comment/35455996
type: QuestionComment
has text: Can you please explain what it means by "train the recognition algorithm"? Does it mean like the 5 samples of a person in that training data is used to produce a feature vector for that person? I am really lost. Thanks.
score: 0
comment on: http://stackoverflow.com/q/23182866
type: Comment

http://stackoverflow.com/comment/35589451
comment on: http://stackoverflow.com/q/23257060
type: Comment
has text: The validation checker has two lines and I suspect it is not. Can you check my edit. I pasted the validation check code in it.
score: 0
type: QuestionComment

http://stackoverflow.com/a/23143193
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/35387872
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/23143068
has comment: http://stackoverflow.com/comment/35387463
has comment: http://stackoverflow.com/comment/35387152
has body: You're not actually reading from the file, but printing the binary representation of the first five characters of the name of the file. Use fin.read() to read bytes from the file. You can also use DataInputStream to read 32 bit big endian integers directly, instead of reading them as 4 individual bytes.

http://stackoverflow.com/a/23204371
score: 3
answers question: http://stackoverflow.com/q/23204309
type: AcceptedAnswer
downvote count: 0
has body: No, in terms of the operations that you need to perform, this is as fast as it gets: searching an ArrayList for a specific object is always linear (i.e. O(n)). In terms of readability, however, you could improve upon this by hiding the search in a helper method that takes a list and a type, and finds the first occurrence of the item: public static &lt;E&gt; E findFirst(List&lt;E&gt; list, Class&lt;E&gt; itemType) { for (E element : list) { if (itemType.isInstance(element)) { return element; } } return null; } If you need your search to go faster than that, you would need a different data structure.
type: Answer
upvote count: 3
accepted answer of: http://stackoverflow.com/q/23204309

http://stackoverflow.com/comment/35426472
score: 0
comment on: http://stackoverflow.com/q/23165611
type: QuestionComment
type: Comment
has text: `food[j] = keyboard.nextInt();`. Whose food is this?

http://stackoverflow.com/a/23185634
type: Answer
answers question: http://stackoverflow.com/q/23185608
has body: The contents are all separated by a whitespace, so that should be your delimiter. I would scan in an entire line and split it by white spaces.
score: 0

http://stackoverflow.com/q/23289743
tagged with: java
has body: In Netbeans, when I call an overridable method from a constructor, it clearly displays a warning. In Eclipse however, I do not get such a warning message for this specific use case. I would like to have Eclipse generate a warning here, to detect as much potential code flaws as possible. Are there any "warning packs" available for Eclipse? Should I install a plugin?
upvote count: 1
downvote count: 1
type: Question
tagged with: compiler-warnings
tagged with: eclipse
score: 0
has comment: http://stackoverflow.com/comment/35650073
has answer: http://stackoverflow.com/a/23289861
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/35650633
type: UnansweredQuestion
has title: How to import Eclipse warnings?

http://stackoverflow.com/a/23189580
downvote count: 0
has body: It's because you're using both nextLine() and nextInt(), what's going on is that nextLine() is searching for a new line (enter) and nextInt will automatically stop the search if any integer is typed through System.in. Rule of thumb: Just use Scanner.nextLine() for your input, then convert your string from Scanner.nextLine() accordingly through Integer.parseInt(string), etc.
score: 3
upvote count: 3
answers question: http://stackoverflow.com/q/23189546
type: Answer
has comment: http://stackoverflow.com/comment/35468838
has comment: http://stackoverflow.com/comment/35468771

http://stackoverflow.com/q/23249790
answer count: 1
downvote count: 0
accepted answer: http://stackoverflow.com/a/23249908
favorite count: 0
has body: I'm trying to come up to speed on the Streams API, but I'm really used to the simplicity of the C# Linq Extension functions and the ability to use the yield keyword to create iterators. Normally I would use: list.Aggregate(set, (acc, a) =&gt; { acc.add(a.Id); return acc}); Or something like that, but I'm not immediately seeing how this maps to the Streams API. List&lt;SomeObject&gt; objs = ... Set&lt;String&gt; ids = new HashSet&lt;&gt;(); for (SomeObject a : objs) { ids.add(a.getId()); } assertThat(ids.size(), objs.size()); EDIT: Changed SomeObject.getId() to a.getId() in the for loop.
score: 2
type: AnsweredQuestion
upvote count: 2
tagged with: java-8
type: Question
tagged with: java
has title: What is the Aggregate/Reduce version of this loop using Java streams?
has answer: http://stackoverflow.com/a/23249908

http://stackoverflow.com/a/23418923
has comment: http://stackoverflow.com/comment/35888410
has body: I'm in a process of figuring out the same thing. Just wanted to share some answers from Artemis developer about this case which leaves us without answer actually but worth mentioning: http://slick.ninjacave.com/forum/viewtopic.php?p=20125#p20125 http://slick.ninjacave.com/forum/viewtopic.php?p=20136#p20136 Honestly, Artemis is "still considered experimental". It's a new paradigm I wanted to look at, it is promising, but there are still those issues that I haven't really found answers to, how big a role do systems play, what you do not put into entities/components, etc. There's some battle going on inside my head about how big a role entities/components play when it comes to what appears to be a non-entity thing, like terrain, background music, etc. Also another hint given by him is to distinguish like: Systems "it can do" on/with entities. ("it can" AcquireEnemyTarget(System), "it can" SpawnNewBaddies(System)) Components are table rows in a corresponding component table, and contain data for specific functionality/state. So looks like it is up to us to explore the actual solution as the paradigm isn`t mature enough to have a "right" answer
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23222053

email
tags question: http://stackoverflow.com/q/23245172
tags question: http://stackoverflow.com/q/23130620
tags question: http://stackoverflow.com/q/23290014
tags question: http://stackoverflow.com/q/23165990
tags question: http://stackoverflow.com/q/23263963
tags question: http://stackoverflow.com/q/23243488
tags question: http://stackoverflow.com/q/23258715
tags question: http://stackoverflow.com/q/23273510
tags question: http://stackoverflow.com/q/23148927
tags question: http://stackoverflow.com/q/23262440
tags question: http://stackoverflow.com/q/23242934
tags question: http://stackoverflow.com/q/23210366
type: Tag
tag name: email

http://stackoverflow.com/comment/35454026
comment on: http://stackoverflow.com/q/23181358
has text: It's a huge mess. I'd advise you make local variables for the `Gdx.input.getY()` etc which you use in the loop. It'll be easier on eyes and also much more efficient.
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/35457753
type: Comment
comment on: http://stackoverflow.com/a/23169013
score: 0
type: AnswerComment
has text: I've updated my question, would you mind to take a look. thanks!

http://stackoverflow.com/q/23273619
answer count: 2
has body: I have a Java web app and am using Ant to produce the WAR file for me. Here is my project structure: src/main/java/ &lt;Java sources&gt; src/main/config/ web.xml mvc-dispatcher-servlet.xml pages/ home.jsp cool.jsp lib/main/ &lt;Libs&gt; gen/ bin/ dist/ I need a Java WAR produced with the following directory structure: myapp.war/ META-INF/ WEB-INF/ web.xml mvc-dispatcher.xml pages/ home.jsp cool.jsp classes/ &lt;Compiled Java binaries&gt; lib/ &lt;All lib JARS&gt; Here is my WAR task: &lt;target name="package" depends="compile"&gt; &lt;war destfile="gen/dist/myapp.war" webxml="src/main/config/web.xml" basedir="gen/bin" includes="src/main/config"&gt; &lt;classes dir="gen/bin" /&gt; &lt;lib dir="lib/main" /&gt; &lt;/war&gt; &lt;/target&gt; When I run this target, it produces a WAR with the following structure: myapp.war/ META-INF/ WEB-INF/ web.xml classes/ &lt;Compiled Java binaries&gt; lib/ &lt;All lib JARS&gt; Notice how mvc-dispatcher-servlet.xml and the entire pages directory is missing? What am I doing wrong?
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/35619743
tagged with: war
accepted answer: http://stackoverflow.com/a/23276394
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/23275297
tagged with: build.xml
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/23275297
upvote count: 1
has title: How to include config files in Ant WAR task?
has comment: http://stackoverflow.com/comment/35619927
type: Question
tagged with: ant
has answer: http://stackoverflow.com/a/23276394

http://stackoverflow.com/q/23207693
type: Question
has comment: http://stackoverflow.com/comment/35500960
linked to: http://stackoverflow.com/q/22003802
tagged with: inheritance
has answer: http://stackoverflow.com/a/23207731
favorite count: 0
tagged with: subclass
has comment: http://stackoverflow.com/comment/35501065
has title: Is it possible to have a class with more than one superclass?
linked to: http://stackoverflow.com/q/2515477
has comment: http://stackoverflow.com/comment/35500782
has comment: http://stackoverflow.com/comment/35808577
has body: I am creating an incredibly primitive blackjack game for my high school programming class using Swing, therefore, all my resource classes extend JPanel. I created the following resource classes: DealerBox ClubsBox SpadesBox HeartsBox My problem is that I want to create a handful of public integers such that I have public int DealerTotal, ClubsTotal, SpadesTotal, HeartsTotal; I want to do this so I can track the values of everybody's hands and determine winners and losers. I had a lightbulb go off and thought that making the Dealerbox a superclass to Clubs, Spades, and Hearts was the solution to all my troubles as I could have simple code in the superclass getting values for the above integers and do all the checking I need. So I wrote this for one of my subclasses: public class ClubsBox extends JPanel, DealerBox implements Runnable { //fun code } The problem now is that I keep getting an error. I assumed it had something to do with listing ClubsBox as being the subclass of JPanel AND DealerBox. So I stackoverflowed my problem and found an answer that stated that one cannot have a class that has 2 superclasses. Another answer to a similar question said that one COULD have a class that has two superclasses. Now we get to the main question: Is it possible to have a class that has two superclasses? If so, how do I code it? If not, is there a way around the restriction? EDIT: 21 APRIL 2014, 44 MINUTES AFTER ORIGINAL POST I have a new problem. I used the method that everyone suggested which was to make DealerBox extend JPanel then to have everything else extend DealerBox. My GUI went from this: To This: The bottom one is clearly incredibly screwed up. Somehow labels from other areas ended up being copied and stuff got mixed around. If you need the code let me know, but I need serious help fixing this. Please keep in mind the inheritance tree looks like this:
possible better answer: http://stackoverflow.com/a/23207739
accepted answer: http://stackoverflow.com/a/23207731
has comment: http://stackoverflow.com/comment/35502931
tagged with: swing
has answer: http://stackoverflow.com/a/23207739
downvote count: 1
has comment: http://stackoverflow.com/comment/35500833
tagged with: superclass
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/61800357
has answer: http://stackoverflow.com/a/23207754
upvote count: 5
tagged with: java
answer count: 6
score: 4
has answer: http://stackoverflow.com/a/52860939
has answer: http://stackoverflow.com/a/23207782

http://stackoverflow.com/q/23214330
has comment: http://stackoverflow.com/comment/35514178
has comment: http://stackoverflow.com/comment/35513078
has body: I have this code I am persisting like that: for (int i = 0; i &lt; listofplusieurdrapage.size(); i++) { persist(listofplusieurdrapage.get(i)); } I have two values in litsofplusieurdrapage =&gt; litsofplusieurdrapage.get(0) = 1 =&gt;litsofplusieurdrapage.get(1) = 2 but when i check the database I found them in this order: 2 1 and when I add just a system.out.println to the code I have the good order for (int i = 0; i &lt; listofplusieurdrapage.size(); i++) { System.out.println(" Persist : " + listofplusieurdrapage.get(i)); persist(listofplusieurdrapage.get(i)); } 1 2 do you have an explication of the problem ? and how I can keep the good order with out adding the system.out.println to my code ? public void persist(Object object) { em.persist(object); }
answer count: 1
tagged with: jpa
has comment: http://stackoverflow.com/comment/35512631
type: UnansweredQuestion
has title: how to write in the database with the same persist order
has answer: http://stackoverflow.com/a/23218350
tagged with: java
tagged with: mysql
type: Question
linked to: http://stackoverflow.com/q/8746519
linked to: http://stackoverflow.com/q/2643641
score: 0

http://stackoverflow.com/q/23237145
tagged with: eclipse-memory-analyzer
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23424666
tagged with: java
tagged with: heap-dump
type: Question
upvote count: 4
answer count: 2
has answer: http://stackoverflow.com/a/25942374
downvote count: 0
score: 4
has body: I am analyzing a OutOfMemory issue. I got a dump of 800 MB (.hprof file) when i open it in MAT it shows heap size 53.2 MB as below Same dump i opened in Java VisualVM and I see Heap size around 769 MB Date taken: Tue Mar 18 05:25:59 IST 2014 File: C:\Users\ABC\Desktop\Memory\MemoryDump.hprof File size: 789.1 MB Total bytes: 768,683,549 Total classes: 9,288 Total instances: 7,081,010 Classloaders: 2,924 GC roots: 2,496 Number of objects pending for finalization: 0 I read one article which shows MAT skips unreachable objects so doesnt report exact heap size. What does Total Bytes of VisulaVM shows here : Heap Size or (Heap + Non Heap size) or anything else?
tagged with: visualvm
favorite count: 0
has title: Does Java VisualVM gives correct Heap Size of heap dump (.hprof file)

file
tags question: http://stackoverflow.com/q/23187128
type: Tag
tags question: http://stackoverflow.com/q/23267890
tags question: http://stackoverflow.com/q/23286383
tags question: http://stackoverflow.com/q/23195620
tags question: http://stackoverflow.com/q/23181757
tags question: http://stackoverflow.com/q/23268212
tags question: http://stackoverflow.com/q/23186470
tags question: http://stackoverflow.com/q/23236601
tags question: http://stackoverflow.com/q/23224287
tags question: http://stackoverflow.com/q/23158708
tag name: file
tags question: http://stackoverflow.com/q/23263096
tags question: http://stackoverflow.com/q/23239933
tags question: http://stackoverflow.com/q/23208267
tags question: http://stackoverflow.com/q/23143655
tags question: http://stackoverflow.com/q/23134548
tags question: http://stackoverflow.com/q/23230025
tags question: http://stackoverflow.com/q/23282686
tags question: http://stackoverflow.com/q/23149169
tags question: http://stackoverflow.com/q/23245068
tags question: http://stackoverflow.com/q/23161934
tags question: http://stackoverflow.com/q/23171002
tags question: http://stackoverflow.com/q/23182968
tags question: http://stackoverflow.com/q/23268123
tags question: http://stackoverflow.com/q/23158218
tags question: http://stackoverflow.com/q/23231428
tags question: http://stackoverflow.com/q/23266033
tags question: http://stackoverflow.com/q/23165283
tags question: http://stackoverflow.com/q/23158871
tags question: http://stackoverflow.com/q/23268339
tags question: http://stackoverflow.com/q/23287307
tags question: http://stackoverflow.com/q/23254850
tags question: http://stackoverflow.com/q/23252506
tags question: http://stackoverflow.com/q/23172127
tags question: http://stackoverflow.com/q/23276407
tags question: http://stackoverflow.com/q/23254958
tags question: http://stackoverflow.com/q/23181064
tags question: http://stackoverflow.com/q/23248792
tags question: http://stackoverflow.com/q/23248474
tags question: http://stackoverflow.com/q/23164798
tags question: http://stackoverflow.com/q/23215188
tags question: http://stackoverflow.com/q/23249312
tags question: http://stackoverflow.com/q/23212890
tags question: http://stackoverflow.com/q/23251357
tags question: http://stackoverflow.com/q/23138797
tags question: http://stackoverflow.com/q/23154391

http://stackoverflow.com/comment/35519386
type: Comment
comment on: http://stackoverflow.com/a/23218479
has text: Small mistake on my part, it definitely wouldn't be static. Just commonly how I declare my nested classes :)
score: 0
type: AnswerComment

http://stackoverflow.com/comment/35568228
has text: you are right, i've rewritten my question
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23245642

http://stackoverflow.com/a/23250000
downvote count: 0
has comment: http://stackoverflow.com/comment/35608506
score: 2
upvote count: 2
type: Answer
has body: When you create NewJFrameForm using Netbeans, In Design view you can drag and drop all the components available in palette. In order to set initially invisible / hidden at starting you have to do it manually. Click on source above, Now you can see generated source of that frame you designed. You will see constructor as: public NewJFrame() { initComponents(); } Generated itself. now you have to put your own code to update like in my case i will set invisible my compnents like: jPanel1.setVisible(false); OR specific components: jButton1.setVisible(false); jToggleButton1.setVisible(false); jLabel1.setVisible(false); if prefer this like: public NewJFrame() { initComponents(); mySettings(); } public void mySettings(){ //Hide or set initial Values of components } Note: all your generated code is in initComponents(); you can not edit it in source, have to do it in design view
accepted answer of: http://stackoverflow.com/q/23234298
has comment: http://stackoverflow.com/comment/35609349
answers question: http://stackoverflow.com/q/23234298
type: AcceptedAnswer

http://stackoverflow.com/comment/35586144
type: AnswerComment
has text: I assume he is using threads for a reason other than "fun". There isn't even a main method in the post, so I would not assume their program is doing nothing else (they said it is a 2D game)
comment on: http://stackoverflow.com/a/23255259
type: Comment
score: 0

http://stackoverflow.com/q/23212428
score: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/35509270
favorite count: 0
has title: how to retrieve the column which is of datetime in the resultset using mysql
type: UnansweredQuestion
answer count: 0
has comment: http://stackoverflow.com/comment/35509458
tagged with: java
tagged with: mysql
downvote count: 1
type: Question
has body: I have a table exam which has a column name,id,examstartdate,examenddate Now while retrieving using resultset. I get like rs.getString("name"); rs.getInt("id"); Now since examstartdate and examenddate are in datetime datatype How to retriev it do i have to give rs.getString("examstartdate") or what has to be given.

http://stackoverflow.com/comment/35441119
has text: Short answer: you've broken the HashMap assumption that the hash code of a key won't change after you've added it then :) It's very odd to have a map with a key where equality is *only* based on a single `boolean` value anyway, to be honest.
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/23173876

http://stackoverflow.com/a/23358562
upvote count: 1
score: 1
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/23228960
has body: What about using a regular expression? String regex = ".*((?=[^q]*s)(?=[^q]*p)(?=[^q]*r)(?=[^q]*t)[sprt][^q]+([sprt])(?&lt;!ss|pp|rr|tt))"; Matcher m = Pattern.compile(regex).matcher("spqrstrupvqw"); while (m.find()) { System.out.println(m.group(1)); } This prints out: strup This can also be wrapped in a method which generates dynamically the regular expression for variable inputs: import java.util.ArrayList; import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; public class MatchString { public static void main(String[] args) { System.out.println(getMinimalSubstrings("spqrstrupvqw", "sprt", "q")); System.out.println(getMinimalSubstrings("A question should go inside quotations.", "qtu", "op")); System.out.println(getMinimalSubstrings("agfbciuybfac", "abc", "xy")); } private static List&lt;String&gt; getMinimalSubstrings(String input, String mandatoryChars, String exceptChars) { List&lt;String&gt; list = new ArrayList&lt;String&gt;(); String regex = buildRegEx(mandatoryChars, exceptChars); Matcher m = Pattern.compile(regex).matcher(input); while (m.find()) { list.add(m.group(1)); } return list; } private static String buildRegEx(String mandatoryChars, String exceptChars) { char[] mandChars = mandatoryChars.toCharArray(); StringBuilder regex = new StringBuilder("[^").append(exceptChars).append("]*("); for (char c : mandChars) { regex.append("(?=[^").append(exceptChars).append("]*").append(c).append(")"); } regex.append("[").append(mandatoryChars).append("][^").append(exceptChars).append("]+([").append(mandatoryChars).append("])(?&lt;!"); for (int i = 0; i &lt; mandChars.length; i++) { if (i &gt; 0) { regex.append("|"); } regex.append(mandChars[i]).append(mandChars[i]); } regex.append("))"); return regex.toString(); } } This prints out: [strup] [quest] [agfbc, bfac]

http://stackoverflow.com/q/23260253
has body: I am trying deploy a J2EE app in Netbeans v8 with Glassfish v4. When I run app, log file of Glassfish show following exception: Grave: Exception during lifecycle processing org.glassfish.deployment.common.DeploymentException: CDI deployment failure:Exception List with 3 exceptions: Exception 0 : org.jboss.weld.exceptions.DeploymentException: WELD-001408 Unsatisfied dependencies for type [ComponentEnvManager] with qualifiers [@Default] at injection point [[BackedAnnotatedField] @Inject private org.glassfish.appclient.client.acc.AppClientContainer.componentEnvManager] at org.jboss.weld.bootstrap.Validator.validateInjectionPointForDeploymentProblems(Validator.java:403) at org.jboss.weld.bootstrap.Validator.validateInjectionPoint(Validator.java:325) at org.jboss.weld.bootstrap.Validator.validateGeneralBean(Validator.java:177) at org.jboss.weld.bootstrap.Validator.validateRIBean(Validator.java:208) at org.jboss.weld.bootstrap.Validator.validateBean(Validator.java:519) at org.jboss.weld.bootstrap.Validator.validateBeans(Validator.java:505) at org.jboss.weld.bootstrap.Validator.validateDeployment(Validator.java:480) at org.jboss.weld.bootstrap.WeldBootstrap.validateBeans(WeldBootstrap.java:536) at org.glassfish.weld.WeldDeployer.event(WeldDeployer.java:216) at org.glassfish.kernel.event.EventsImpl.send(EventsImpl.java:131) at org.glassfish.internal.data.ApplicationInfo.load(ApplicationInfo.java:328) at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:493) 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.Comma…
favorite count: 0
tagged with: netbeans-8
type: UnansweredQuestion
has title: CDI Error in Glassfish v4 with j2ee and netbeans
score: 1
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/23261225
type: Question
tagged with: glassfish
has comment: http://stackoverflow.com/comment/35594903
has comment: http://stackoverflow.com/comment/35595866
answer count: 1
downvote count: 0

http://stackoverflow.com/comment/70237395
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23133196
has text: I'm confused about one thing what is `path` while calling controller in the above code?
score: 0

http://stackoverflow.com/a/23498109
type: Answer
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/36106702
answers question: http://stackoverflow.com/q/23217131
has body: Did some more digging and I found a commit to ORB.java that is causing the issue. changeset: 817:a8d27c3fc4e4 tag: jdk7u55-b05 user: msheppar date: Tue Jan 21 12:46:58 2014 +0000 summary: 8025005: Enhance CORBA initializations This commit changed the way the ORB Singleton class was created. Instead of using the Thread context class loader it is now hard coded to use the SystemClassLoader. - singleton = create_impl(className); + singleton = create_impl_with_systemclassloader(className); } } return singleton; } + private static ORB create_impl_with_systemclassloader(String className) { + + try { + ReflectUtil.checkPackageAccess(className); + ClassLoader cl = ClassLoader.getSystemClassLoader(); + Class&lt;org.omg.CORBA.ORB&gt; orbBaseClass = org.omg.CORBA.ORB.class; + Class&lt;?&gt; singletonOrbClass = Class.forName(className, true, cl).asSubclass(orbBaseClass); + return (ORB)singletonOrbClass.newInstance(); + } catch (Throwable ex) { + SystemException systemException = new INITIALIZE( + "can't instantiate default ORB implementation " + className); + systemException.initCause(ex); + throw systemException; + } + } Putting the JacORB classes on the endorsed dirs or ext classpath is a valid work around. However, this definitely changes previous behavior. Has anyone filed a bug for it? --- UPDATE --- There is a bug related to this issue: https://bugs.openjdk.java.net/browse/JDK-8042789 It is available in Java 8u22. https://jdk8.java.net/download.html
downvote count: 0

http://stackoverflow.com/comment/35399950
comment on: http://stackoverflow.com/a/23150303
type: AnswerComment
score: 0
has text: I am using http://sourceforge.net/projects/sqlitebrowser/ ....... i extract the database file from data/data/package/databases/MyDatabase .... then open the file with that software .... there i can see the column names and database ... but the values are not inserted :(
type: Comment

http://stackoverflow.com/comment/35490016
score: 0
comment on: http://stackoverflow.com/q/23201896
type: Comment
type: QuestionComment
has text: @deanosaur it's there twice because for say, for unigrams, the first word will be israeli. Then it needs to add the second, officials. It adds that bigram to the arraylist as israeli:officals. Then it needs to jump back and take the word officials, and combine it with are, and add officals:are to the array list of bigrams

http://stackoverflow.com/a/23274955
answers question: http://stackoverflow.com/q/23274911
score: 6
type: Answer
downvote count: 1
upvote count: 7
has body: There is no difference. The second example is a factory method. You pass in a few parameters and that method will call new at some point on the actual instance class of the Path.

http://stackoverflow.com/comment/35460693
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23184964
score: 0
has text: suppose future represent a compute result which is a normal value or a exception, i feel it should be a way set the exception to the future, it is better than set null.

keylistener
tags question: http://stackoverflow.com/q/23229853
tags question: http://stackoverflow.com/q/23174840
type: Tag
tags question: http://stackoverflow.com/q/23208477
tags question: http://stackoverflow.com/q/23153772
tags question: http://stackoverflow.com/q/23164683
tags question: http://stackoverflow.com/q/23234594
tags question: http://stackoverflow.com/q/23249399
tags question: http://stackoverflow.com/q/23227983
tags question: http://stackoverflow.com/q/23241617
tags question: http://stackoverflow.com/q/23181146
tags question: http://stackoverflow.com/q/23176863
tags question: http://stackoverflow.com/q/23207440
tags question: http://stackoverflow.com/q/23253589
tags question: http://stackoverflow.com/q/23275840
tags question: http://stackoverflow.com/q/23254166
tags question: http://stackoverflow.com/q/23152927
tags question: http://stackoverflow.com/q/23206807
tag name: keylistener
tags question: http://stackoverflow.com/q/23205965
tags question: http://stackoverflow.com/q/23234143
tags question: http://stackoverflow.com/q/23163237

http://stackoverflow.com/comment/35523029
type: QuestionComment
has text: @PatriciaShanahan the exact wording, i hope it looks clear to you.
score: 0
comment on: http://stackoverflow.com/q/23209769
type: Comment

http://stackoverflow.com/q/23192311
has title: Blackjack wins calculation error: counting too many hands
type: Question
score: 0
has comment: http://stackoverflow.com/comment/35476053
has comment: http://stackoverflow.com/comment/35473080
has comment: http://stackoverflow.com/comment/35473132
tagged with: blackjack
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35481421
has body: I'm trying to code a Black Jack simulator program. It asks a user for how many decks of cards to use and how many hands to simulate, as well as whether or not to show the outcome of each hand. Then it runs the program based off of Black Jack strategy and is supposed to output accurate win/lose percentages. However, when I run it, my player win count/dealer win count numbers are greater than the number of hands I wanted to play. I think it's my push and split methods, but I'm unsure how to fix them. Currently, my push method deals a new hand and determines the winner of the hand, then adds the push amount to the wins of either the player or dealer. however, this treats it as a new hand within the loop for the current hand, therefore giving me an extra hand. My split method works in a similar fashion. Any suggestions for how I could rewrite them correctly would be greatly appreciated, thanks. import java.util.*; import java.text.*; public class Game { int decks = 4; int hands = 1; int myCardsSum = 0; int dealerCardsSum = 0; final int DECK_SIZE = 52; final int BLACKJACK = 21; String display; boolean displayData = true; boolean myHardHand = true; boolean dealerHardHand = true; boolean doubleAllowed = true; boolean splitAllowed = true; boolean surrenderAllowed = true; Deck myDecks; int myWins = 0; int dealerWins = 0; int push = 0; Card myFirst; Card mySecond; Card dealerFirst; Card dealerSecond; // Input prompt removed // asks user for decks, hands, and display information public void play() { // A deck of cards made of all the decks selected by the user myDecks = new Deck(); myDecks.setCardsInDeck(4 * decks); for (int i = hands; i &gt; 0; i--) { deal(); } double winPercent = (double) myWins / hands; double losePercent = (double) dealerWins / hands; // Output removed } public void deal() { myHardHand = true; dealerHardHand = true; splitAllowed = true; doubleAllowed = true; surrenderAllowed = true; myDecks.shuffle(decks); // shuffles if the deck is half empty or less myFi…
tagged with: java

http://stackoverflow.com/comment/35565589
comment on: http://stackoverflow.com/q/23242176
type: Comment
type: QuestionComment
score: 0
has text: At least check that you are using EclipseLink version which is compatible with JDK 1.5 (EL 2.4+ require 1.6 as a minimum). And you **must really consider to move to newer JDK**.

http://stackoverflow.com/a/54978330
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/23211589
score: 1
upvote count: 1
has body: Simply go in notepad plus plus and open your file and in encoding option at the top bar just select utf8

http://stackoverflow.com/q/23189379
score: 0
has body: This is a problem that I have encountered several times, and asked about previously on SO with no responses. The issue that I'm having is that sometimes when I start up Eclipse to work on my Android projects, I get tons of errors. What I realized now is that the folders Android 4.4.2 and Android Private Libraries are missing, which is clearly causing the error. I tried updating my SDK and cleaning the project, neither of which resolved the issue. I have 2 questions: What is the proper way to fix this problem? I understand that I can just copy the Android 4.4.2 folder into my project, but that is a very hacky and temporary solution. I am looking for something that will actually resolve this. How can I prevent this from happening again/why is this happening. Two possible thoughts I had were that it either happens when Eclipse force-quits, or when there are Android updates that I have to install, but I don't see why either of these would cause a problem.
answer count: 1
tagged with: android
accepted answer: http://stackoverflow.com/a/23189431
has title: Eclipse error on Startup in every project
has answer: http://stackoverflow.com/a/23189431
type: AnsweredQuestion
tagged with: java
tagged with: eclipse
type: Question

http://stackoverflow.com/comment/35442861
comment on: http://stackoverflow.com/q/23175067
score: 0
type: Comment
type: QuestionComment
has text: shouldn't the type for studentName be `String` instead of `double`?

http://stackoverflow.com/q/23228759
has body: I have two big numbers (&lt;10^9) n and m. I have to calculate [(n-1+m)!]/[(n-1)!*m!] if the answer is too big I have to get the modulus from (10^9+7). (ex : n%mod if n is too large that mod). int mod = 1000000000+7; I calculated it like below. (I calculated the upper half and bottom half separately) long up=1; for (long i = a+b-1; i&gt;=Math.max(a, b); i--) { up*=i%mod; } up=up%mod; long down=1; for (long i = Math.min(a, b); i&gt;0; i--) { down*=i%mod; } then print the answer as System.out.println((up%mod/down%mod)%mod); Is this approach correct. Will it gives the correct out put. I know (a*b*c)%d == [(a%d)*(b%d)*(c%d)]%d (correct me if i'm wrong) So is there any way like that to calculate [a/b]%d ?
has answer: http://stackoverflow.com/a/23229136
answer count: 1
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35538438
tagged with: java
has comment: http://stackoverflow.com/comment/35538607
type: Question
score: 0
has title: calculate the modulus of a fraction with big numbers

http://stackoverflow.com/a/23278768
answers question: http://stackoverflow.com/q/23278685
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/35630001
downvote count: 0
has body: why that don't throw ClassCastException in List&lt;Double&gt; listD = (List&lt;Double&gt;) listI;? At run-time all the type information is lost. You have mixed raw type with parametrized type that's why you are getting into trouble at runtime. Try this one List&lt;Integer&gt; listI = new ArrayList&lt;Integer&gt;(Arrays.asList(a, b, c, d)); List&lt;Double&gt; listD = (List&lt;Double&gt;) listI; // compilation error // Cannot cast from List&lt;Integer&gt; to List&lt;Double&gt; Sample code : // Here's a basic parameterized list. List&lt;Integer&gt; li = new ArrayList&lt;Integer&gt;(); // It is legal to assign a parameterized type to a nonparameterized variable List l = li; // This line is a bug, but it compiles and runs. // The Java 5.0 compiler will issue an unchecked warning about it. // If it appeared as part of a legacy class compiled with Java 1.4, however, // then we'd never even get the warning. l.add("hello"); // This line compiles without warning but throws ClassCastException at runtime. // Note that the failure can occur far away from the actual bug. Integer i = li.get(0); For more sample code have a look at Generic Types, Part 1 - O'Reilly Media
type: Answer

http://stackoverflow.com/q/23191520
score: 0
tagged with: linux
has title: Jboss crashes frequently
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35472023
tagged with: java
tagged with: jboss
type: Question
has comment: http://stackoverflow.com/comment/35471802
has comment: http://stackoverflow.com/comment/35471907
has body: I have a Java EE application running on jboss-4.0.4.GA in linux. Previously I have allocated 2 GB memory but the jboss crashed and the memory was full. Now I have increased the memory to 8 GB but still same problem. Still the jboss crashes because of full memory. What can be the cause for it because I think memory isn't the problem. Thanks in advance.

http://stackoverflow.com/a/23606713
has body: Java is having problems calling dbus to detect any HTTP proxies you may have setup. Do you have any proxies? If not you can turn this detection off by adding the following line to the following file: &lt;where you extracted the application to&gt;/import.io/import.io.ini This is the line you need to add to the file: -Dupdate.useSystemProxy=false
upvote count: 5
score: 5
downvote count: 0
answers question: http://stackoverflow.com/q/23288442
type: Answer

http://stackoverflow.com/q/23178148
upvote count: 3
tagged with: java-8
type: Question
score: 3
tagged with: java
has answer: http://stackoverflow.com/a/23178397
answer count: 1
downvote count: 0
has body: I see in and and or method of Predicate, the return type is Predicate, while in the return statement, there is a lambda expression doing logical and(or) with a boolean. So how the return statement is evaluate when the logical and(or) has one operand of Lamdba expression and another operand of boolean. Why is this valid ? Below is code for and method of java.util.function.Predicate: default Predicate&lt;T&gt; and(Predicate&lt;? super T&gt; other) { Objects.requireNonNull(other); return (t) -&gt; test(t) &amp;&amp; other.test(t); }
favorite count: 0
accepted answer: http://stackoverflow.com/a/23178397
has title: Java8: Why a lambda expression could do a logical and(or) with boolean
has comment: http://stackoverflow.com/comment/35448282
tagged with: lambda
tagged with: operator-precedence
type: AnsweredQuestion

http://stackoverflow.com/comment/35573535
has text: [Duplicate](http://stackoverflow.com/questions/6634344/problem-in-hibernate-dao-session-already-closed)?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23248566

http://stackoverflow.com/q/23152446
tagged with: machine-learning
has comment: http://stackoverflow.com/comment/35402489
has comment: http://stackoverflow.com/comment/35402430
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35402561
tagged with: feature-extraction
tagged with: java
type: Question
upvote count: 2
downvote count: 2
has answer: http://stackoverflow.com/a/23152611
accepted answer: http://stackoverflow.com/a/23152611
has title: Amount of rain fall today
answer count: 1
has body: I want to calculate the amount of rainfall today in mm.So I want to know first whether is Linear Regression or Logistic Regression problem and how to calculate if i have datasets with some attributes with large no. of instances. And how to know when to use feature scaling &amp; how my program effects if i don't use feature scaling where it is neccessary. Can I have java code of feature scaling.
favorite count: 0
score: 0
tagged with: regression

http://stackoverflow.com/comment/35621186
score: 0
type: Comment
type: QuestionComment
has text: If you change `Parent` from an abstract class to an interface, it *may* take slightly longer to call the methods polymorphically, since a class can implement multiple interfaces meaning the data structures behind them have to be a little more complex. However, this is just speculation and I haven't tried it.
comment on: http://stackoverflow.com/q/23274257

http://stackoverflow.com/q/23290698
has comment: http://stackoverflow.com/comment/35651502
has comment: http://stackoverflow.com/comment/35814973
has comment: http://stackoverflow.com/comment/35817146
has comment: http://stackoverflow.com/comment/35816997
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/35651543
has body: I am trying to create PDF through my Android app using PDFBox api, but getting the following error: java.lang.NoClassDefFoundError: org.apache.pdfbox.pdmodel.PDDocument I have already included the following jar files in the classpath of the project:- pdfbox-1.8.4 fontbox-1.8.4 In some posts I read that it is not possible to use pdfbox to create PDFs in Android since it uses awt and swing components which are not available in Android. If PDFBox is not right choice for creating PDFs through Android application then are there any other open source libraries available for performing the same task.Any help would be greatly appreciated. Thanks in advance.
type: Question
has comment: http://stackoverflow.com/comment/35815814
has comment: http://stackoverflow.com/comment/35651438
has comment: http://stackoverflow.com/comment/35975180
has comment: http://stackoverflow.com/comment/35771512
tagged with: pdfbox
has comment: http://stackoverflow.com/comment/35938400
has title: Creating PDF in Android using PDFBox
score: 2
tagged with: http://stackoverflow.com/tag/pdf
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/35651418
has comment: http://stackoverflow.com/comment/35673786
upvote count: 2
type: UnansweredQuestion
tagged with: android

http://stackoverflow.com/q/23154009
favorite count: 0
has answer: http://stackoverflow.com/a/23154093
has answer: http://stackoverflow.com/a/70151434
answer count: 5
accepted answer: http://stackoverflow.com/a/23154093
has title: How to convert outputStream to a byte array?
has body: How can I convert an OutputStream to a byte array? I have found that first I need to convert this OutputStream to a ByteArrayOutputStream. There is only write() method in this OutputStream class and I don't know what to do. Is there any idea?
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/43082143
tagged with: java
has comment: http://stackoverflow.com/comment/35405238
type: Question
possible better answer: http://stackoverflow.com/a/43082143
linked to: http://stackoverflow.com/q/2716596
has answer: http://stackoverflow.com/a/23154102
linked to: http://stackoverflow.com/q/43081008
upvote count: 66
has answer: http://stackoverflow.com/a/23154196
has comment: http://stackoverflow.com/comment/35405136
downvote count: 0
score: 66

http://stackoverflow.com/comment/35610549
comment on: http://stackoverflow.com/a/23266735
has text: Sure, although *nearly* the same information can be obtained from a TableModelEvent, the "oldValue" may be a bit tricky, so this class might come in handy here.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/23143150
has title: Java <> operator description
downvote count: 0
has answer: http://stackoverflow.com/a/23143217
answer count: 3
tagged with: operators
favorite count: 0
has answer: http://stackoverflow.com/a/23143492
possible better answer: http://stackoverflow.com/a/23143182
linked to: http://stackoverflow.com/q/4166966
has comment: http://stackoverflow.com/comment/35386870
has answer: http://stackoverflow.com/a/23143182
has body: I've been given some java code which contains a &lt;> operator. What is the function of this operator?. if(x &lt;&gt; 0) { doSomething(); } I've never seen it before and its not on the operators page of http://docs.oracle.com/ I'd have put it down to a typo but it shows up twice in the same piece of code.
has comment: http://stackoverflow.com/comment/35387205
type: AnsweredQuestion
score: 3
has comment: http://stackoverflow.com/comment/35386908
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/35386828
has comment: http://stackoverflow.com/comment/35386995
accepted answer: http://stackoverflow.com/a/23143492
type: Question

http://stackoverflow.com/a/75508537
has body: Restriction to use reference-typed objects as synchronized(..) argument comes from the idea of encapsulation, when you and only you control who and how can access your lock (ref or value). Imagine the case when you want to take a lock on value-typed (primitive) lock int x = 5, then inside synchronized block another lock on int y = 0. In the same time other part of your project (or 3-rd party library) also takes these locks in opposite order - first int a = 0, then int b = 5. Result? Deadlock. Why? Because of lack of encapsulation - you can't control visibility of value-typed (primitive) variables. They always are public, by nature.
answers question: http://stackoverflow.com/q/23131810
score: 0
type: Answer

http://stackoverflow.com/comment/35371978
score: 1
comment on: http://stackoverflow.com/q/23135071
type: Comment
has text: The second picture is exactly what you are asking for @ShihabSoft. Be sure to read the whole question.
type: QuestionComment

http://stackoverflow.com/comment/35584510
type: Comment
comment on: http://stackoverflow.com/q/23254434
score: 0
has text: Google translate tried and failed to understand pig latin, why even bother?
type: QuestionComment

http://stackoverflow.com/q/23210316
tagged with: java
has comment: http://stackoverflow.com/comment/35505474
score: 2
type: AnsweredQuestion
downvote count: 0
linked to: http://stackoverflow.com/q/473282
favorite count: 0
has answer: http://stackoverflow.com/a/60607317
has title: Leading zeroes trim issue in CSVWriter in java
type: Question
tagged with: http://stackoverflow.com/tag/csv
has comment: http://stackoverflow.com/comment/35505294
has comment: http://stackoverflow.com/comment/35505322
upvote count: 2
accepted answer: http://stackoverflow.com/a/60607317
has body: I am using CSVWriter to create a csv file in java. The problem is that the leading zeroes are getting trimmed in the generated csv. For example: if I am giving 0001 then its writing 1 and all leading zeroes are trimmed. A solution to this problem was to append a = before the no. So ="0001" is giving me the right answer. But the problem is how to append = using csvwriter. CSVWriter automatically appends " " to the input so giving =0001 as input it generates "=0001" but I want ="0001". A solution to this was to use CSVWriter.NO_QUOTE_CHARACTER in the CSVWriter constructor and it doesn't append "". But now it is generating =0001 and I want ="0001". Any idea how can I keep quotes ("") and append an = before the number??
answer count: 1
has comment: http://stackoverflow.com/comment/35505441

http://stackoverflow.com/comment/35399628
type: Comment
has text: Well, right now the resolution is fixed, and so is character's height.
type: QuestionComment
comment on: http://stackoverflow.com/q/23150603
score: 0

http://stackoverflow.com/comment/35441470
comment on: http://stackoverflow.com/q/23174079
has text: @mostruash I think you're confusing things. Immutability is unrelated to the assignment operator. If `String` was mutable, this question and its answer would be the same: changing the value (the reference) that one variable holds does not change the value of any other variable.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23233837
has comment: http://stackoverflow.com/comment/35547773
answers question: http://stackoverflow.com/q/23233657
score: 0
has body: Note This is superseded by my later answer. I have left it here, rather than deleting it, in case the information in it is useful to you. Two problems. (1) You define list in the superclass, and presumably that's what you print out; but you add elements to newList, which is a different field. (2) You only add as many elements to your new list as there are in your old list. So you'll always have one element too few. In particular, when you first try to add an element, your list has zero elements both before and after the add. You should probably have just a single list, not two of them. Also, you should break that for loop into two separate loops - one loop to add the elements before the value that you're inserting, and a second loop to add the elements after it.
has comment: http://stackoverflow.com/comment/35547295
type: Answer
has comment: http://stackoverflow.com/comment/35547267
has comment: http://stackoverflow.com/comment/35547333
has comment: http://stackoverflow.com/comment/35548238
has comment: http://stackoverflow.com/comment/35547281

http://stackoverflow.com/q/23267586
has comment: http://stackoverflow.com/comment/35608548
answer count: 2
has comment: http://stackoverflow.com/comment/35608898
has title: java.io.NotSerializableException: For RowSet
has comment: http://stackoverflow.com/comment/35608229
has comment: http://stackoverflow.com/comment/35608873
has answer: http://stackoverflow.com/a/23267939
score: 0
has answer: http://stackoverflow.com/a/23267875
tagged with: jdbc
tagged with: rowset
type: UnansweredQuestion
has body: I am trying to print out the contents of row set to a file but I am getting java.io.NotSerializableException: Here is my program.. package k564; import java.io.*; import javax.sql.RowSet; import com.sun.rowset.JdbcRowSetImpl; public class Lab15a { public static void main(String[] args) { try{ Class.forName("com.mysql.jdbc.Driver"); RowSet rs= new JdbcRowSetImpl(); rs.setUrl("jdbc:mysql://localhost:3306/jdbc"); rs.setUsername("root"); rs.setPassword("123"); rs.setCommand("select cid,cname,cemail,cphone,camount from customer"); rs.execute(); while(rs.next()){ System.out.println(rs.getInt("cid")+"\t"+rs.getString("cname")+"\t"+rs.getString("cemail")+"\t"+rs.getInt("cphone")+rs.getInt("camount")); } rs.beforeFirst(); System.out.println("Serialixzing Rowset"); FileOutputStream fos = new FileOutputStream("d:\\rowset.txt"); ObjectOutputStream oos = new ObjectOutputStream(fos); oos.writeObject(rs); System.out.println("serialized"); }catch(Exception e){ e.printStackTrace(); } } } Error that I am getting. Error: java.io.NotSerializableException: java.lang.Object at java.io.ObjectOutputStream.writeObject0(Unknown Source) at java.io.ObjectOutputStream.writeObject(Unknown Source) at java.util.HashMap.writeObject(Unknown Source) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at java.io.ObjectStreamClass.invokeWriteObject(Unknown Source) at java.io.ObjectOutputStream.writeSerialData(Unknown Source) at java.io.ObjectOutputStream.writeOrdinaryObject(Unknown Source) at java.io.ObjectOutputStream.writeObject0(Unknown Source) at java.io.ObjectOutputStream.defaultWriteFields(Unknown Source) at java.io.ObjectOutputStream.writeSerialData(Unknown Source) at java.io.ObjectOutputStream.writeOrdinaryObject(Unknown Source) at java.io.ObjectOutputStream.writeObject0(Unknown Source) at java.io.ObjectOu…
type: Question
tagged with: java

http://stackoverflow.com/comment/35629846
type: Comment
type: QuestionComment
has text: And what is your question?? and current results?
score: 2
comment on: http://stackoverflow.com/q/23278834

http://stackoverflow.com/comment/35421584
score: 0
type: AnswerComment
has text: Well that helped a lot in fact! Now there is no thread anymore and the readLine is divided over the strings but yet nothing appears in my jTable.. Seems really really strange to me
type: Comment
comment on: http://stackoverflow.com/a/23161643

http://stackoverflow.com/comment/35526829
has text: Java is 6.0 - and try Eclipse. Domino Designer might have unmet dependencies. In Eclipse point to the Domino JVM
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23220827

hashtable
tags question: http://stackoverflow.com/q/23185923
tag name: hashtable
tags question: http://stackoverflow.com/q/23176279
type: Tag
tags question: http://stackoverflow.com/q/23225590

http://stackoverflow.com/a/23198722
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23198660
type: Answer
has comment: http://stackoverflow.com/comment/35484988
has body: You need to put the @Autowired annotation on your setter: @Autowired public void setJdbcTemplate(JdbcTemplate jdbcTemplate) { this.jdbcTemplate = jdbcTemplate; }
score: 5
upvote count: 5
has comment: http://stackoverflow.com/comment/35485142
answers question: http://stackoverflow.com/q/23198660

http://stackoverflow.com/a/24141601
has comment: http://stackoverflow.com/comment/37323302
has body: Maven uses the target/classes and target/test-classes directories to compose the classpath used to run unit tests. The content of your src/main/resources and src/test/resources gets copied to these locations together with the compiled java sources (the .class files). java.lang.ClassLoader.getResource returns a java.net.URL. In the unit test situation, ClassLoader.getResource returns a file:// schemed URL, and your code works as expected. When your code is executed when packaged in a jar file, ClassLoader.getResource no longer returns a file:// schemed URL. It can't because the resource is no longer a separate entity in a file system - it's buried inside the jar file. What you actually get is a jar:file:// schemed URL. jar: URLs cannot be accessed through a [java.io.File] object. If you only need to read the content of the resource you should use java.lang.ClassLoader.getResourceAsStream(...) and read the content from that. Note that it is not possible to update the content of class loader resources.
answers question: http://stackoverflow.com/q/23281062
type: Answer
has comment: http://stackoverflow.com/comment/37327939
has comment: http://stackoverflow.com/comment/37260874
score: 5
upvote count: 5
downvote count: 0

http://stackoverflow.com/comment/35430784
has text: Understand. I think you can do in other way like,
comment on: http://stackoverflow.com/a/23168177
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/23288254
tagged with: database
score: 0
answer count: 2
tagged with: jpa
type: UnansweredQuestion
has body: I am working on an application using Hibernate and I want to delete some records in the database. The relevant Entities are: @Entity public class Product { private String serialNumber; private Set&lt;Part&gt; parts = new HashSet&lt;Part&gt;(); @Id public String getSerialNumber() { return serialNumber; } void setSerialNumber(String sn) { serialNumber = sn; } @OneToMany public Set&lt;Part&gt; getParts() { return parts; } void setParts(Set parts) { this.parts = parts; } ... } @Entity public class Part implements Serializable { @Id @GeneratedValue private Long part_id; private String userCode = ""; //getters and setters .... } I have let Eclipse implement equals and hashCode in Entity Part based on part_id and userCode. There is also an Entity Factory from which 'begin' all the associations to the other Entities. Therefore, in order to save all the changes it only necessary to execute the comand: session.update(factory); All the changes are saved successfully except from the delete from parts. I do: products.getParts.remove(part); The issues comig out are: 1) In some cases is part from the Set not removed although the comparison to a part in the Set with equals true returns (the part is in Set according to equals but it is not removed) 2) Even if the remove in the Set succeeds, the record in the database is not deleted. Based on the above ascertainments what is the best way to remove the records in this case using not loads of queries?
has answer: http://stackoverflow.com/a/23288633
has answer: http://stackoverflow.com/a/23289396
type: Question
has title: Delete a record on an OneToMany association with Hibernate
tagged with: java
tagged with: hibernate

http://stackoverflow.com/comment/35459538
score: 0
type: Comment
type: QuestionComment
has text: even if I remove finish() the problem is still there
comment on: http://stackoverflow.com/q/23184208

http://stackoverflow.com/q/23208703
type: Question
upvote count: 5
tagged with: http://stackoverflow.com/tag/json
has answer: http://stackoverflow.com/a/34089598
has comment: http://stackoverflow.com/comment/35506264
has title: java how to convert a string to net.sf.json.JSONObject
score: 5
answer count: 3
downvote count: 0
tagged with: couchdb
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/68197503
tagged with: java
has answer: http://stackoverflow.com/a/26419165
has body: I get tweets and use org.json.simple api to convert a string to a object. JSONParser jsonParser = new JSONParser(); Object json = jsonParser.parse(in); and I would like to insert the obj into couchdb using couchdb4j api Session myDbSession = new Session("localhost",5984) Database myCouchDb = myDbSession.getDatabase("db-name"); Document newdoc = new Document(); Document newdoc = new Document(JSONObject json); myCouchDb.saveDocument(newdoc); The error is: org.json.simple.JSONObject cannot be cast to net.sf.json.JSONObject how to solve this problem or anyone can give a solution to insert a json format string or object into couchdb

http://stackoverflow.com/q/23241106
tagged with: java
type: Question
tagged with: dll
has comment: http://stackoverflow.com/comment/35560323
answer count: 1
tagged with: encapsulation
favorite count: 0
has title: Android hide the implementation of class?
has answer: http://stackoverflow.com/a/23241276
accepted answer: http://stackoverflow.com/a/23241276
upvote count: 1
tagged with: android
has body: I am new to android development and need some solution for this problem, I have created a class that does some encryption work and have to give that to another person but I can't let them know the implementation of this class, so what i've done is encapsulated the methods.. I read that Creating a jar library is for a complete application.. since i need to give only a single file i can't make a jar library.. any solution for this??? Any help would be great.. thanks in advance..
downvote count: 0
has comment: http://stackoverflow.com/comment/35560302
type: AnsweredQuestion
score: 1

http://stackoverflow.com/comment/35422703
type: AnswerComment
has text: I have not defined any package for the Game class, this class is just in the root directory. What should I write then?
comment on: http://stackoverflow.com/a/23160577
type: Comment
score: 0

http://stackoverflow.com/a/23164143
has body: Primitive types are not objects. They don't have methods. So, no, it's not possible unless you use the wrapper class (Integer). And even then, Integer doesn't have a setTag() method.
has comment: http://stackoverflow.com/comment/35423790
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/35423826
upvote count: 1
answers question: http://stackoverflow.com/q/23164126
has comment: http://stackoverflow.com/comment/35423803
has comment: http://stackoverflow.com/comment/35423994
downvote count: 0

http://stackoverflow.com/q/23143132
score: 1
tagged with: java
upvote count: 1
tagged with: swing
type: Question
answer count: 1
downvote count: 0
has body: Currently Im trying to update my rectangle position at keyevent but I dont know how to call the paintComponent method from another class or how to achieve this Paint class package com.raggaer.frame; import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics; import javax.swing.JPanel; public class Elements extends JPanel { public Elements() { } public void paintComponent(Graphics g) { super.paintComponent(g); g.drawRect(250, 250, 10, 10); } public Dimension getPreferredSize() { return new Dimension(500, 500); } } And my listener class package com.raggaer.frame; import java.awt.Graphics; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; public class Listener implements KeyListener { public void keyPressed(KeyEvent e) { System.out.println(e.getExtendedKeyCode()); } public void keyReleased(KeyEvent e) { } public void keyTyped(KeyEvent e) { } public void paintComponent(Graphics g) { g.drawRect(10, 10, 20, 20); } } I tried adding a method inside the listener class called paintComponent but I need to pass a graphic object.. dont know how to achieve this. I was thinking on drawing a rectangle using variables and at keyevent modify that variables but I dont know if thats the correct way to do it.
favorite count: 0
has answer: http://stackoverflow.com/a/23143197
linked to: http://stackoverflow.com/q/8961938
tagged with: jframe
accepted answer: http://stackoverflow.com/a/23143197
type: AnsweredQuestion
tagged with: paint
has title: Java JFrame paint at keyevent

http://stackoverflow.com/q/23238199
tagged with: java
has comment: http://stackoverflow.com/comment/35555177
upvote count: 1
has answer: http://stackoverflow.com/a/34829341
answer count: 1
tagged with: executable-jar
tagged with: maven-3
has body: Question is in the title. I sucess to first to do a jar (project packaging jar)....then i move it before id do mvn clean to keep it elsewhere. Or i'm a in a war project so i have to rename project packaging to war then i have to do a mvn clean install I got my war. I then import the first jar to use from my war. Is there a clearer way do that with maven shade plugin to generate both war and jar. <plugin> org.apache.maven.plugins maven-shade-plugin 2.1 package shade ${project.artifactId}-final com.clb.genomic.lyon.external.MainExternal META-INF/spring.handlers META-INF/spring.schemas META-INF/spring.tooling The packaging follow war/jar in project description at the begining of the file and i have to change it each time i throw maven. Thanks
favorite count: 0
tagged with: maven-shade-plugin
linked to: http://stackoverflow.com/q/23223909
type: UnansweredQuestion
tagged with: war
has title: maven-shade-plugin : make a jar whereas we are in war Project?
downvote count: 0
has comment: http://stackoverflow.com/comment/35555111
type: Question
score: 1

http://stackoverflow.com/a/23291934
has comment: http://stackoverflow.com/comment/35657530
type: Answer
has comment: http://stackoverflow.com/comment/35654386
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/23280533
has comment: http://stackoverflow.com/comment/35654173
has body: I guess that forcing cell type to HSSFCell.CELL_TYPE_STRING might be the reason of getting null. A more robust way to obtain a string value from any type of cell (you might also have dates, formulas, etc.) is to use DataFormatter: import org.apache.poi.ss.usermodel.DataFormatter; static DataFormatter dataFormatter = new DataFormatter(); static String getStringValue(Cell cell) { return dataFormatter.formatCellValue(cell); } It is especially useful when you want to get exactly the same what is displayed in Excel (e.g numbers rounded to given decimal places).
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23280533

http://stackoverflow.com/comment/35367888
type: Comment
comment on: http://stackoverflow.com/a/23132820
type: AnswerComment
has text: Hey, I put that in instead but now I am getting The import com.example.clubnightsdeals.R cannot be resolved
score: 0

http://stackoverflow.com/q/23185358
has answer: http://stackoverflow.com/a/28322720
has answer: http://stackoverflow.com/a/28106424
has answer: http://stackoverflow.com/a/28699077
has answer: http://stackoverflow.com/a/28230351
tagged with: java-home
has answer: http://stackoverflow.com/a/27388879
has answer: http://stackoverflow.com/a/32238431
has title: Android Studio error: "Environment variable does not point to a valid JVM installation"
upvote count: 23
has answer: http://stackoverflow.com/a/26585767
has answer: http://stackoverflow.com/a/50921249
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/24898684
has body: When trying to run Android Studio on my computer, I get the following error: The Environment variable JAVA_HOME (with a value of C:\Program Files(x86)\Java\jdk1.7.0_51\bin) does not point to a valid JVM installation I tried to remove the \bin extension on my JAVA_HOME environment variable, but it gives me the following error: No JVM Found. Please install a 64-bit JDK. If you already have a JDK installed, define a JAVA_HOME variable in Computer > System Properties > System Settings > Environment Variables My System: Windows 8.1 Update 1 x64 (64 bit) Java Directory: C:\Program Files (x86)\Java\jdk1.7.0_51\bin
tagged with: java
has answer: http://stackoverflow.com/a/23186825
has answer: http://stackoverflow.com/a/29555214
score: 23
type: Question
has answer: http://stackoverflow.com/a/28146370
has answer: http://stackoverflow.com/a/33019733
has answer: http://stackoverflow.com/a/36708135
downvote count: 0
has answer: http://stackoverflow.com/a/31650605
has answer: http://stackoverflow.com/a/54698068
has answer: http://stackoverflow.com/a/30019024
has answer: http://stackoverflow.com/a/28251958
possible better answer: http://stackoverflow.com/a/25622913
accepted answer: http://stackoverflow.com/a/23186825
has answer: http://stackoverflow.com/a/47523156
has answer: http://stackoverflow.com/a/25622913
tagged with: android
has answer: http://stackoverflow.com/a/28282924
has answer: http://stackoverflow.com/a/23185430
tagged with: jvm
answer count: 22
favorite count: 0
has answer: http://stackoverflow.com/a/32687476

http://stackoverflow.com/a/23198755
type: Answer
answers question: http://stackoverflow.com/q/23186851
score: 0
has body: Regarding your By.id statement, it looks like you have passed an XPath instead of just the id. So this: element = myDynamicElement(By.id("//*[@id='p_13838465-p']")); //this locator is an XPath should become this: element = myDynamicElement(By.id('p_13838465-p')); //this is just the ID However, if this ID is dynamically generated, then it won't work reliably, and you may need to considering finding it by a different locator. Then, once you've identified the element, to type in it, you use .sendKeys("your text here"), like this: element.sendKeys("your text here"); or you could combine it into one line by skipping the element = part and just say: myDynamicElement(By.id('p_13838465-p')).sendKeys("your text here");

http://stackoverflow.com/a/23224850
has comment: http://stackoverflow.com/comment/35532429
has body: in your structure you show where the .java is, but you´re missing the .class. The path where it resides is the one the classloader will use. There should be your resources EDIT: to clarify a bit. In your post you mention the path to App.java. but the classloader only cares about App.class, so let´s say you have \src |...(App.java and whatever, these will be ignored) \bin | |--App.class | \bin\resources\...(properties and whatever, these will be read) you should make sure you have properties and spring directories under bin. If you only have the .java in src it will be ignored by the classloader.
has comment: http://stackoverflow.com/comment/35532059
type: Answer
answers question: http://stackoverflow.com/q/23224767
has comment: http://stackoverflow.com/comment/35530824
score: 0

http://stackoverflow.com/a/23283611
has comment: http://stackoverflow.com/comment/35638889
type: Answer
has comment: http://stackoverflow.com/comment/35640449
has comment: http://stackoverflow.com/comment/35639541
has comment: http://stackoverflow.com/comment/35639511
has comment: http://stackoverflow.com/comment/35640345
has comment: http://stackoverflow.com/comment/35639355
upvote count: 3
accepted answer of: http://stackoverflow.com/q/23283584
has comment: http://stackoverflow.com/comment/35639189
has comment: http://stackoverflow.com/comment/35639087
has comment: http://stackoverflow.com/comment/35639840
has body: You could attempt to do this by trying to make the variables accessible to the entire class. To implement this, you can add the variable declaration where you have declared your User Interface items, after the class declaration. You could then access this variable in another class. Example Code: public class TextArea1{ JTextArea text; JFrame frame; JTextField textField; public int sampleIntToBeUsed; You could also implement this with various get/set methods. How to Make a Constructor: (Put the name of the class with no return type) class startButtonListener implements ActionListener { ArrayList aList; startButtonListener(ArrayList passedInList) { aList = passedInList; } New Second ActionListener class startTextFieldListener implements ActionListener { String correctAnswer; startTextFieldListener(String answer) { correctAnswer = answer; } @Override public void actionPerformed(ActionEvent event) { if (text.getText().equals(correctAnswer)) { JOptionPane.showMessageDialog(null, "Hooray!"); } else { JOptionPane.showMessageDialog(null, "Wrong!"); } } } }
answers question: http://stackoverflow.com/q/23283584
has comment: http://stackoverflow.com/comment/35639067
has comment: http://stackoverflow.com/comment/35639672
score: 3
has comment: http://stackoverflow.com/comment/35639951
has comment: http://stackoverflow.com/comment/35640178
has comment: http://stackoverflow.com/comment/35638882
has comment: http://stackoverflow.com/comment/35640089
has comment: http://stackoverflow.com/comment/35640776
has comment: http://stackoverflow.com/comment/35639700
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/35640545
has comment: http://stackoverflow.com/comment/35639882
has comment: http://stackoverflow.com/comment/35640631

http://stackoverflow.com/comment/35450826
type: QuestionComment
has text: See also: http://stackoverflow.com/questions/3369287/synchronized-block-lock-object-question
comment on: http://stackoverflow.com/q/23160386
score: 0
type: Comment

http://stackoverflow.com/a/23270693
has body: You need to handle IOException because it is a checked exception and method in.readLine() specifically declares it with a throws clause. That means IO Exception can be thrown at run time, so you should handle it. Hope this helps.
downvote count: 0
answers question: http://stackoverflow.com/q/23270513
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/a/23187338
score: 1
has comment: http://stackoverflow.com/comment/35465478
has comment: http://stackoverflow.com/comment/35464539
downvote count: 0
has comment: http://stackoverflow.com/comment/35467064
has body: Since you want to convert each element from a Set to an ArrayList, you'll have to do at least a little of this with an explicit loop, I think (unless you're using Java 8 or a third-party library): Set&lt;Set&lt;String&gt;&gt; data = . . . ArrayList&lt;List&lt;String&gt;&gt; transformed = new ArrayList&lt;List&lt;String&gt;&gt;(); for (Set&lt;String&gt; item : data) { transformed.add(new ArrayList&lt;String&gt;(item)); } Note that I changed the type of the transformed list from ArrayList&lt;ArrayList&lt;String&gt;&gt; to ArrayList&lt;List&lt;String&gt;&gt;. Generally it's preferable to program to an interface, but if you really need a list that must contain specifically instances of ArrayList, you can switch it back.
type: Answer
has comment: http://stackoverflow.com/comment/35466849
answers question: http://stackoverflow.com/q/23187294
upvote count: 1
has comment: http://stackoverflow.com/comment/35466465

http://stackoverflow.com/comment/35535780
has text: To get a random number across the entire range of possible `int` values, just use the [`Random` class's `nextInt()` method](http://docs.oracle.com/javase/8/docs/api/java/util/Random.html#nextInt--).
comment on: http://stackoverflow.com/a/23227239
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/35366339
type: Comment
has text: "I am not supposed to expose an api from this server." Any particular reason why you don't want to deploy your service on a web server?
comment on: http://stackoverflow.com/q/23132243
score: 0
type: QuestionComment

http://stackoverflow.com/comment/35617432
type: AnswerComment
has text: Alright, then I think your point here better answers the OP than your current answer ;)
type: Comment
score: 0
comment on: http://stackoverflow.com/a/23272098

http://stackoverflow.com/comment/58214525
score: 0
type: Comment
has text: I would prefer endpoints. You could reuse any code you already wrote for validation and consistency checks etc.
type: AnswerComment
comment on: http://stackoverflow.com/a/23204036

http://stackoverflow.com/comment/35458260
score: 0
comment on: http://stackoverflow.com/a/23184037
type: Comment
has text: Thanks thought I might have to use a thread but I still don't get why the other way wouldn't work.
type: AnswerComment

http://stackoverflow.com/comment/35539013
has text: possible duplicate of http://stackoverflow.com/questions/21613540/casting-to-superclass-and-calling-overriden-method
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23229116
score: 1

http://stackoverflow.com/q/23278399
tagged with: multithreading
upvote count: 1
has answer: http://stackoverflow.com/a/23278463
answer count: 1
has comment: http://stackoverflow.com/comment/35629012
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23278463
downvote count: 0
has title: JAVA - ScheduledExecutorService don't quits threads
score: 1
has body: I'm using ScheduledExecutorService.scheduleWithFixedDelay() to schedule periodic launch of thread. It works but threads are accumulating in ThreadStackTrace (with Waiting state). I'm sure that thread which is periodically launched is finished, see example. Can someone tell me how to launch thread periodically and solve this problem? class TestThread extends Thread{ @Override public void run(){ int countThreads = Thread.getAllStackTraces().keySet().size(); int running = 0; for (Thread t : Thread.getAllStackTraces().keySet()) { if (t.getState()==Thread.State.RUNNABLE) running++; System.out.println(t.getName()+" "+t.getState().toString()); } System.out.println("TotalThreads:"+countThreads+" Running:"+running+"\n\n"); } } public class JavaApplication2 { private static final ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(10); public static void main(String[] args) { scheduler.scheduleWithFixedDelay(new TestThread(), 0, 10, TimeUnit.SECONDS); } } Many thanks
favorite count: 0
type: Question
tagged with: executorservice
tagged with: java

http://stackoverflow.com/comment/35500351
type: Comment
has text: As I don't know what it is you're trying to accomplish, it's pretty difficult to tell you exactly how to fix it (which is why I didn't try). Either remove the local variable declaration, and access the outer one instead, or initialize the local one before you try to use it. I'm suspecting you want to do the first, which simply means deleting the `Image playbutton` from within your `paintComponent` method.
type: AnswerComment
comment on: http://stackoverflow.com/a/23176077
score: 0

http://stackoverflow.com/comment/88876365
score: 0
has text: I need, so I think some others need also.
type: Comment
comment on: http://stackoverflow.com/a/50938260
type: AnswerComment

http://stackoverflow.com/comment/35454917
has text: Done. Let me know if any more detail is required :)
comment on: http://stackoverflow.com/q/23173876
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/23180460
answers question: http://stackoverflow.com/q/23180364
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 2
upvote count: 2
accepted answer of: http://stackoverflow.com/q/23180364
has body: The main advantage of a client-server architecture over the file-database architecture is that it is possible for multiple users to share the same database at the same time. It is also possible to connect to your database via a network, without the need to create a file share. There is a performance hit as can be seen in this comparison table: http://h2database.com/html/performance.html More information about client-server architecture can be found here: http://en.wikipedia.org/wiki/Client-Server

http://stackoverflow.com/q/23168490
has comment: http://stackoverflow.com/comment/35432425
downvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/23168630
linked to: http://stackoverflow.com/q/1463284
tagged with: performance
tagged with: hashset
has answer: http://stackoverflow.com/a/23169156
score: 6
has answer: http://stackoverflow.com/a/23168650
answer count: 3
has comment: http://stackoverflow.com/comment/35439593
favorite count: 0
possible better answer: http://stackoverflow.com/a/23168650
has answer: http://stackoverflow.com/a/23168630
type: AnsweredQuestion
has body: I read about how TreeSet is slower than HashSet, (that adding elements into a TreeSet is slower) so i made a performance test, i'm trying to find out if it's better to add elements to HashSet and then move them into a TreeSet or put them in there in the first place. It looks like that inserting elements into a HashSet is faster but only when i insert a large amount of elements, why? I've read that if i don't need the elements sorted, always use HashSet, but apparently, sometimes it's slower. When I insert a concrete value("1") instead of random numbers, TreeSet is also faster because there is no sorting, so how can i know when to use HashSet or TreeSet? And my second question, when i create TreeSet like this, why don't i have access to "NavigableSet" methods? Set&lt;Integer&gt; treeSet = new TreeSet&lt;Integer&gt;(); //cant type treeSet.lower(e: E) TreeSet&lt;Integer&gt; treeSet = new TreeSet&lt;Integer&gt;(); //can type treeSet.lower(e: E) Thanks for helping me with this. Here are the results: 5 000 000 (random numbers) 5 000 000 (numbers "1") 500 000 (random numbers) 50 000 (random numbers) Here is my code: package performancetest; import java.text.DecimalFormat; import java.util.HashSet; import java.util.InputMismatchException; import java.util.Scanner; import java.util.TreeSet; public class HashSet_vs_TreeSet { private static DecimalFormat df = new DecimalFormat("#.#####"); private static double hashTime, treeTime, hashToTreeTime; private static int numbers = 0; public static void main(String[] args){ start(); hashSetTest(); treeSetTest(); fromHashToTreeSet(); difference(); } /** * in this method, instead of "System.exit(1)" i try'ed "start()" but when i did lets say three mistakes, after correct input the * methods hashSetTest();treeSetTest();fromHashToTreeSet();difference(); were running 4 times... i made this method exactly for the * purpose to repeat itself in case of a input mistake. */ public static void start(){ System.out.print("Enter a number(a advise b…
has comment: http://stackoverflow.com/comment/35432473
tagged with: treeset
has comment: http://stackoverflow.com/comment/35431279
has title: HashSet and TreeSet performance test
tagged with: java
upvote count: 7

http://stackoverflow.com/q/23219149
type: Question
linked to: http://stackoverflow.com/q/22172115
has comment: http://stackoverflow.com/comment/35520604
score: 0
duplicate of: http://stackoverflow.com/q/22172115
tagged with: tomcat
tagged with: spring-security
has comment: http://stackoverflow.com/comment/35522156
type: UnansweredQuestion
tagged with: spring-mvc
has title: sequentially deploy war on Tomcat on every time when its restart a server also specified order
answer count: 0
tagged with: java
tagged with: hibernate
has body: I have multiple war files to deploy, for example. coll.war, egg.war, etc., each one will specify an application module. In our application I have some specification that coll.war should deploy first and rest has to deploy in specific sequence such like. coll.war egg.war chick.war Can somebody help me out to do it with my sequence process when i will start a tomcat server.
has comment: http://stackoverflow.com/comment/35521390
linked to: http://stackoverflow.com/q/6698646

http://stackoverflow.com/a/23232456
has body: The key thing to realize here is that your search algorithm always stays exactly the same. The only thing that changes is your actual comparison function. I would recommend using a standard sort in the Arrays or Collections class, but writing your own custom Comparable class or Comparator, whose compare method will use the data the user supplies. This is actually kind of interesting - I've only ever written Comparable classes that use fixed data, but this is exactly a use case for them. All you need to do is write the function public int compare(Row row1, Row row2) { // iterate over the columns *in order of the user-supplied priority* // return appropriately } Here's documentation on the Comparable class. And Comparator. Which one you need depends on what you're implementing, I forget the details but should be straightforward. The key #2 thing here is that you can instantiate your ColumnPrioritiesComparable class before the priorities are set. e.g. class ColPriComp implements Comparable&lt;ColPriComp&gt; { private volatile int[] priorities; // possibly static, or obtained some other way, // so there's only one shared among all classes @Override public int compareTo(ColPriComp other) { // use "priorities" to do the comparison } public void setPriorities(int[] newPriorities) { this.priorities = newPriorities; } }
has comment: http://stackoverflow.com/comment/35544976
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/35544951
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23232413
answers question: http://stackoverflow.com/q/23232413
upvote count: 2
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35544933

http://stackoverflow.com/comment/35459807
type: AnswerComment
score: 0
has text: No, the `indentityFile` is configured on the SFTP connector, which you'll need to configure in XML. Thanks for the book, BTW using transports with the Mule client is explained in chapter 12.
type: Comment
comment on: http://stackoverflow.com/a/23174005

http://stackoverflow.com/q/23190569
tagged with: java
has title: How nodes in cluster communicate in ElasticSearch and also how we decide in which node we should store document and later from where to retrieve?
type: Question
tagged with: indexing
has body: Being new to elastic search I have few questions on it. 1) How nodes in cluster communicate with Cluster in Elastic-Search? 2) How we decide in which node we should store document or how can we distribute our documents over different nodes? 3) Also at the time of searching where we should query means if data in on node 2 then can we query it from node 1 ? I am using Java API for this. Thanks in advance.
has answer: http://stackoverflow.com/a/23192260
accepted answer: http://stackoverflow.com/a/23192260
tagged with: search
upvote count: 1
answer count: 1
favorite count: 0
tagged with: elasticsearch
type: AnsweredQuestion
downvote count: 0
score: 1

http://stackoverflow.com/comment/35590586
has text: Im in a 3D world, trying to position the camera behind my 'player' object, I can't get the camera to follow the object
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23257757

http://stackoverflow.com/q/23207432
has answer: http://stackoverflow.com/a/23224754
has comment: http://stackoverflow.com/comment/35500372
answer count: 3
possible better answer: http://stackoverflow.com/a/23207549
has answer: http://stackoverflow.com/a/23207549
has title: Removing elements from ArrayList in ascending order
has comment: http://stackoverflow.com/comment/35500326
accepted answer: http://stackoverflow.com/a/23224754
has body: I'm trying to remove the elements in the ArrayList in ascending order. I have it down for descending order, but can't figure it out the other way. I've tried: for (int r = 0; r &lt; s.size(); r++) but it only shows the original elements and the elements minus the element indexed at 0. So far I have: public class test { public static void main(String[] args) { ArrayList &lt;String&gt; s = new ArrayList&lt;&gt; (4); s.add("A"); s.add("B"); s.add("C"); s.add("D"); //removes elements in descending order for(int r = s.size()-1; r &gt;=0; r--){ System.out.println(s); s.remove(r); } System.out.println(s.size()); } } Any thoughts?
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23207883
score: 0
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/35500325
tagged with: arraylist

http://stackoverflow.com/q/23205266
answer count: 1
has answer: http://stackoverflow.com/a/23207581
type: UnansweredQuestion
has body: Suppose, that I want all connections via SSL in my Java application ask user permission, when untrusted or expired server certificate is encountered (like most of web browsers do). It seemed, that the most natural way to do so is to substitute default SSL context on application startup. Here is the minimal working example: public class ClientAuthentication { public static final String SERVER_URL = "https://my.test.server"; public static void main(String[] args) throws Exception { SSLContext defaultContext = SSLContext.getInstance("TLS"); defaultContext.init(null, new TrustManager[]{new MyX509TrustManager()}, null); // defaultContext.init(null, null, null); SSLContext.setDefault(defaultContext); HttpURLConnection connection = (HttpURLConnection) new URL(SERVER_URL).openConnection(); System.out.println(connection.getResponseCode()); } private static class MyX509TrustManager implements X509TrustManager { @Override public void checkClientTrusted(X509Certificate[] x509Certificates, String s) throws CertificateException { throw new UnsupportedOperationException("Won't be called by client"); } @Override public void checkServerTrusted(X509Certificate[] chain, String s) throws CertificateException { if (userAcceptsCertificate(chain)) { System.out.format("Certificate '%s' accepted%n", chain[0].getIssuerX500Principal().getName()); } } @Override public X509Certificate[] getAcceptedIssuers() { return new X509Certificate[0]; } private boolean userAcceptsCertificate(X509Certificate[] x509Certificates) { // ... return true; } } } Unfortunately, it doesn't work, when server requires client authentication. Even, when key store containing client certificate is properly specified via -Djavax.net.ssl.keyStore VM option, connection fails with javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure, because client certificate wasn't sent at all (traced in Wireshark). Such behavior is a bit surprising, because JavaDoc for SSLContext#init(KeyManager[], TrustManager[], S…
tagged with: java
type: Question
tagged with: jsse
has title: Java key store is not found when default SSL context is redefined
tagged with: ssl
score: 0

http://stackoverflow.com/comment/35601661
comment on: http://stackoverflow.com/q/23263296
type: Comment
type: QuestionComment
has text: `Location` needs an `equals` method since you are using multiple instances of Location for the same position.
score: 0

http://stackoverflow.com/q/23229221
type: UnansweredQuestion
tagged with: android
has title: How to define proguard to keep java interface for IMEI (using Phonegap for Android)?
tagged with: cordova-plugin-proguard
has body: I've been searching (this site and others) for an answer for a couple weeks now. I'm pretty sure my problem lies with how I've defined my keep options in the proguard-project.txt. I've added a javainterface to my app so it's able to use TelephonyManager to get the IMEI. This works fine when I dont use ProGuard in the build. When I use Proguard, the getIMEI function doesnt work anymore. Here's the GetNativeTelephonyManager.java code: package com.abc.myapp1; import org.apache.cordova.DroidGap; import android.content.Context; import android.telephony.TelephonyManager; import android.webkit.WebView; public class GetNativeTelephonyManager { private WebView mAppView; private DroidGap mGap; public GetNativeTelephonyManager(DroidGap gap, WebView view){ mAppView = view; mGap = gap; } public String getIMEI(){ TelephonyManager tm = (TelephonyManager) mGap.getSystemService(Context.TELEPHONY_SERVICE); String imeiId = tm.getDeviceId(); return imeiId; } } Here's the MainActivity.java code: package com.abc.myapp1; import android.os.Bundle; import org.apache.cordova.DroidGap; public class MainActivity extends DroidGap { GetNativeTelephonyManager gntm; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); super.init(); gntm = new GetNativeTelephonyManager(this, appView); appView.addJavascriptInterface(gntm, "GetNativeTelephonyManager"); super.loadUrl("file:///android_asset/www/index.html"); } } Here's the proguard-project.txt options: -keep public class * extends com.phonegap.api.Plugin -keep public class * extends org.apache.cordova.api.Plugin -keep public class org.apache.cordova.DroidGap -keep public class org.apache.cordova.** -keep public class **.GetNativeTelephonyManager { *; } -keepclassmembers public class **.GetNativeTelephonyManager { *; } -libraryjars libs/cordova-2.1.0.jar -dontwarn android.webkit.* -dontwarn org.apache.** Using dex2jar and JD-GUI, I've been able to inspect the MainActivity and GetNativeTelephonyManager classes a…
tagged with: java
type: Question
answer count: 1
score: 0
tagged with: proguard
tagged with: cordova
has answer: http://stackoverflow.com/a/23445945

http://stackoverflow.com/a/23251955
answers question: http://stackoverflow.com/q/23251346
type: Answer
has body: You can use the below code to create Zip File. import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.util.zip.ZipEntry; import java.util.zip.ZipOutputStream; public class ZipFileTest { public static void main( String[] args ) { byte[] buffer = new byte[1024]; try{ FileOutputStream fos = new FileOutputStream("C:\\MyFile.zip"); ZipOutputStream zos = new ZipOutputStream(fos); ZipEntry ze= new ZipEntry("spy.log"); zos.putNextEntry(ze); FileInputStream in = new FileInputStream("C:\\spy.log"); int len; while ((len = in.read(buffer)) &gt; 0) { zos.write(buffer, 0, len); } in.close(); zos.closeEntry(); //remember close it zos.close(); System.out.println("Done"); }catch(IOException ex){ ex.printStackTrace(); } } }
has comment: http://stackoverflow.com/comment/35580221
score: 0

http://stackoverflow.com/q/23166195
type: Question
has body: I need to create uberjar, which will contain the java-dependencies and the configuration directory will be located out of the jar? any ideas? The structure should be something like this: MyOutputDir | ----- MyApp(jar-with-dependencies) ----- conf Thanks in advance
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/23166321
type: UnansweredQuestion
tagged with: maven
tagged with: java
has title: How to create an uber-jar with external resource configuration
tagged with: maven-assembly-plugin

http://stackoverflow.com/a/23239580
downvote count: 0
answers question: http://stackoverflow.com/q/23239224
has comment: http://stackoverflow.com/comment/35564534
has comment: http://stackoverflow.com/comment/35558493
upvote count: 3
has comment: http://stackoverflow.com/comment/35564429
has comment: http://stackoverflow.com/comment/35557706
has comment: http://stackoverflow.com/comment/35557760
has body: If you want each number to have at least one non-zero digit you may try something like this (updated with help of Tims comments): ^0*[1-9]\\d*(_0*[1-9]\\d*)*$ The [1-9] makes sure there is (at least) one non-zero digit in each group, where as the 0* before allows any number of zeros. After that one non-zero digit, any digits including (but not only) zero can be allowed: \\d*. Update 2: Added anchors as suggested by Daniël to make sure the whole string is matched.
type: Answer
score: 3

http://stackoverflow.com/comment/35796303
score: 0
type: AnswerComment
type: Comment
has text: Yes, now (after having re-patched UcanAccessMetaData), if I select the table with the Foreign Key, I can see the related table added. After that I can see the OneToMany and ManyToOne annotations in the code of the generated entities. You can find patched code in the svn trunk (if you want to rebuild the ucanaccess.jar): http://sourceforge.net/p/ucanaccess/code/HEAD/tree/ucanaccess/trunk/src/main/java/net/ucanaccess/jdbc/UcanaccessDatabaseMetadata.java. UCanAccess 2.0.5 will be released in May.
comment on: http://stackoverflow.com/a/23308939

http://stackoverflow.com/q/23194353
type: UnansweredQuestion
tagged with: scripting
tagged with: selenium-webdriver
tagged with: java
tagged with: selenium
has answer: http://stackoverflow.com/a/23195480
type: Question
has answer: http://stackoverflow.com/a/23196013
has body: How can I verify if the calculated date is correct through selenium web driver? Consider the following examples below: From Date: 01/01/2001 Duration: 10 To Date: 01/10/2001 I will instruct selenium to input a date on from date field and duration. The system shall automatically calculates the To date based on the inputted from date and duration. I wonder if there's a way to verify if the calculated To Date is correct given that the inputted values on from date and duration fields may change time to time. Static values for from date and duration fields is okay too - I guess. Thanks!
tagged with: date
has title: Date calculator : Selenium Web Driver
score: 0
answer count: 2

http://stackoverflow.com/q/23201545
type: UnansweredQuestion
answer count: 0
score: 1
tagged with: java
upvote count: 1
tagged with: eclipse
type: Question
tagged with: libgdx
tagged with: ios
downvote count: 0
has title: Using libGDX for developing social games for iOS
has body: I was using XCode and SpriteKit for developing iOS games that could implement Facebook and Parse (analytics). Because everything was in XCode and Objective-C, I had no problem with Facebook and Parse SDK. Recently, I decided to use libGDX and I have to write code in Java (I started using Eclipse). Because I am fairly new in this area I was wondering what happens to implementation of Facebook and Parse SDK? Could I just write an Objective-C class in Eclipse that includes these two and use its methods in Java???!! Any other magic or trick you could think of, I really appreciate it if you could share it with me.
favorite count: 0

http://stackoverflow.com/a/23170517
type: Answer
answers question: http://stackoverflow.com/q/23169465
score: 2
downvote count: 0
has body: For great GUI, I think you should use javafx. in java 8, javafx looks more stable now. You can use javafx control to you current swing application. About database interaction, if you have bulk data in any table then please do not try to fetch whole data to javafx tableview control as It will leads to "Insufficient memory" problem. always process your data in database and dont give load to JVM. so for bulk data, I suggest you can use current JTable but javafx is pretty cool you can start exploring it. start it from http://docs.oracle.com/javase/8/javase-clienttechnologies.htm
type: AcceptedAnswer
upvote count: 2
accepted answer of: http://stackoverflow.com/q/23169465

http://stackoverflow.com/q/23258936
has comment: http://stackoverflow.com/comment/35592844
has comment: http://stackoverflow.com/comment/35592807
has answer: http://stackoverflow.com/a/23259036
favorite count: 0
has answer: http://stackoverflow.com/a/23259076
type: UnansweredQuestion
tagged with: addition
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/35592730
has comment: http://stackoverflow.com/comment/35664599
has title: Java - Error: no suitable method found for add(int, java.lang.String)
downvote count: 1
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/35593538
score: 0
has body: I am in the middle of a homework assignment and I am stuck. At this point in my code I think I should have a gui window that opens and allows me to type "insert text number". At this point that information is not going anywhere but it will be going into a linkedlist once I get past this problem. I am getting two of the same error for the lines tt.add(index, element); and I can't seem to get past it. The error is "no suitable method found for add(int, java.lang.String)". Code is below, please advise. To clarify - this should NOT be a method error since this is a linked list. No method should be involved. import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.util.*; import java.util.Scanner; import java.util.LinkedList; public class TopTenList extends JFrame { private TopTenList tt; private JTextArea listView; private JTextField cmdTextField; private JTextField resultTextField; // This is the code for the GUI Window public TopTenList() { tt = new TopTenList(); listView = new JTextArea(); cmdTextField = new JTextField(); //Create panel and label for the command text field JPanel cmdPanel = new JPanel(new GridLayout(1,2)); cmdPanel.add(new JLabel ("Enter New Score: ")); cmdPanel.add(cmdTextField); add(cmdPanel, BorderLayout.NORTH); cmdTextField.addActionListener(new CmdTextListener()); // Set up the frame setTitle("Top Ten Scoreholders"); // Window Title setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // Behavior on close pack(); setVisible(true); // Display the window // Put the textArea in the center of the frame add(listView); listView.setEditable(false); listView.setBackground(Color.WHITE); } // Private class that responds to the new score entered by the user private class CmdTextListener implements ActionListener { public void actionPerformed(ActionEvent evt) { String cmdText = cmdTextField.getText(); Scanner sc = new Scanner(cmdText); String cmd = sc.next(); if (cmd.equals("insert")) { if(sc.hasNextInt()) { // add index element int index=sc…

http://stackoverflow.com/a/23144788
has comment: http://stackoverflow.com/comment/35389807
has comment: http://stackoverflow.com/comment/35396085
accepted answer of: http://stackoverflow.com/q/23144596
has comment: http://stackoverflow.com/comment/35390570
downvote count: 0
upvote count: 1
type: AcceptedAnswer
has body: As Szymon pointed out you should not call same method twice. To make your original solution slightly more readable by combining all your nested null checks into one: BookImages bImages = null; Domains domains = null; Defaults defaults = null; List&lt;String&gt; domain = null; String firstDomain = null; if ((bImages = book.getBookImages()) != null &amp;&amp; (domains = bImages.getDomains()) != null &amp;&amp; (defaults = domains.getDefaults()) != null &amp;&amp; (domain = defaults.getDomain() != null &amp;&amp; domain.size() &gt; 0) { firstDomain = domain.get(0); }
type: Answer
has comment: http://stackoverflow.com/comment/35389848
answers question: http://stackoverflow.com/q/23144596
score: 1

http://stackoverflow.com/comment/35502494
score: 0
type: Comment
type: QuestionComment
has text: remember that arrays are indexed from 0 to length - 1, so you may not want to check if i is a power of two.
comment on: http://stackoverflow.com/q/23208710

http://stackoverflow.com/a/26079865
answers question: http://stackoverflow.com/q/23157794
accepted answer of: http://stackoverflow.com/q/23157794
has body: I figured out that we had to enable Presence feature for each key on the PubNub dashboard for this to work. Silly thing I missed out..
score: 6
has comment: http://stackoverflow.com/comment/76911786
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 6

http://stackoverflow.com/a/23171362
has comment: http://stackoverflow.com/comment/35436387
answers question: http://stackoverflow.com/q/23171289
has body: HashSet does not expose that information. You can set the initial capacity yourself if you want (e.g., HashSet h = new HashSet(22);). The javadoc indicates that the default capacity is 16. Internally, the HashSet is just wrapping a HashMap via the HashSet.map field. I suppose you could use reflection to grab the map field and then interrogate it for the initial capacity. I can't see why you would want to do this though.
type: Answer
upvote count: 1
score: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/35436363

http://stackoverflow.com/a/23282288
score: 2
has comment: http://stackoverflow.com/comment/35663192
has body: Use a DataOutputStream and a DataInputStream. Instead of lines, use writeUTF() and readUTF(). For efficiency, put buffered streams underneath, and flush the output before you read.
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23229046
accepted answer of: http://stackoverflow.com/q/23229046
upvote count: 2
type: Answer

http://stackoverflow.com/comment/35502611
score: 0
type: Comment
type: QuestionComment
has text: In your loop, you're redeclaring `newArr` every iteration. The last iteration in which the else condition was reached is the only one that sticks. Well, it *would*, if it compiled.
comment on: http://stackoverflow.com/q/23208710

http://stackoverflow.com/q/23195311
has body: i have some problem with the Disruptor Framework. The publishEvent method in the ringBuffer doesn't work. and i get this error message. The method publishEvent(EventTranslatorOneArg, ByteBuffer) is undefined for the type RingBuffer here is my java class. import java.nio.ByteBuffer; import com.lmax.disruptor.RingBuffer; import com.lmax.disruptor.EventTranslatorOneArg; import com.lmax.disruptor.EventTranslatorTwoArg; import com.lmax.disruptor.*; public class LongEventProducerWithTranslator { /** * @param args */ private final RingBuffer&lt;LongEvent&gt; ringBuffer; public static void main(String[] args) { // TODO Auto-generated method stub } public LongEventProducerWithTranslator(RingBuffer&lt;LongEvent&gt; ringBuffer) { this.ringBuffer = ringBuffer; } private static final EventTranslatorOneArg&lt;LongEvent, ByteBuffer&gt; TRANSLATOR = new EventTranslatorOneArg&lt;LongEvent, ByteBuffer&gt;() { public void translateTo(LongEvent event, long sequence, ByteBuffer bb) { event.set(bb.getLong(0)); } }; public void onData(ByteBuffer bb) { ringBuffer.publishEvent(TRANSLATOR, bb); } }
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/24054276
type: AnsweredQuestion
tagged with: java
has title: publishEvent doesn't work
tagged with: eclipse
type: Question
has answer: http://stackoverflow.com/a/24054276

http://stackoverflow.com/q/23214919
answer count: 0
type: UnansweredQuestion
tagged with: authentication
has comment: http://stackoverflow.com/comment/35514537
has comment: http://stackoverflow.com/comment/35514313
has comment: http://stackoverflow.com/comment/35514603
has comment: http://stackoverflow.com/comment/35515127
has title: how to Authenticate using HttpURLconnection
tagged with: java
has comment: http://stackoverflow.com/comment/35515100
type: Question
linked to: http://stackoverflow.com/q/11617210
score: 0
linked to: http://stackoverflow.com/q/4062307
has comment: http://stackoverflow.com/comment/35514736
has body: i'm trying to read a website as html using the following code(i.e &lt; html >&lt; body >.....&lt; /body >&lt; /html >, but i need to provide authentication credentials, i have tried providing using java.net.Authenticator but it still dosen't seem to work, (if i enter www.google.com it works since no authentication is required)(I wish to implement this code in my android application) package com.test.connection; import java.io.BufferedInputStream; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.net.Authenticator; import java.net.MalformedURLException; import java.net.PasswordAuthentication; import java.net.URL; import java.net.HttpURLConnection; public class Authenticate { String username="myuser"; String password="mypass"; URL url=null; String webHtmlData=null; public static void main(String[] args) { Authenticate au=new Authenticate(); au.setConnectionToWS("https://mysite/New/"); //if i enter www.google.com it works } public void setConnectionToWS(String inpUrl){ Authenticator myAuth = new Authenticator() { @Override protected PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication(username, password.toCharArray()); } }; Authenticator.setDefault(myAuth); try { url = new URL(inpUrl); } catch (MalformedURLException e) { e.printStackTrace(); } HttpURLConnection urlConnection = null; try { urlConnection = (HttpURLConnection) url.openConnection(); urlConnection.connect();//on debugging the code fails on this line. } catch (IOException e) { e.printStackTrace(); } try { InputStream in = null; try { in = new BufferedInputStream(urlConnection.getInputStream()); } catch (IOException e) { e.printStackTrace(); } } finally { webHtmlData=readStream(urlConnection); System.out.println(webHtmlData); System.out.println("Done!!!"); } } //read data as a browser private String readStream(HttpURLConnection urlConnection) { StringBuffer response = null; try { BufferedReader…
tagged with: android
tagged with: httpurlconnection

http://stackoverflow.com/q/23179835
has answer: http://stackoverflow.com/a/23195169
score: 0
tagged with: listgrid
answer count: 1
tagged with: smartgwt
type: UnansweredQuestion
has body: I want to change this filter icon to another one, I have tried this method setFilterButtonProperties(newButton); but it doesn't work. here the image which I want to change.
tagged with: css
tagged with: java
has title: SmartGWT- how to change filter button icon in listGrid?
type: Question
tagged with: gwt

http://stackoverflow.com/q/23188082
answer count: 1
downvote count: 0
favorite count: 0
upvote count: 1
has title: Nullpointer Exception when assigning value to Integer array
type: AnsweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/35465767
type: Question
tagged with: arrays
has answer: http://stackoverflow.com/a/23188108
has body: This seems a bit strange to me. I created a static Integer array and then I am trying to assign a value to it. But I get a Null pointer exception at the degree[i] = 0 line. Since I am not reading the value before assigning it, I do not understand why the NullPointer exception. private static Integer[] degree; public static void initDegree(int num_of_vertices) throws Exception{ for (int i = 0; i &lt; num_of_vertices; i++) { degree[i] = 0; } }
tagged with: nullpointerexception
accepted answer: http://stackoverflow.com/a/23188108

http://stackoverflow.com/comment/35445379
score: 0
type: Comment
type: QuestionComment
has text: String is a special Object, mostly in that it's immutable.
comment on: http://stackoverflow.com/q/23176334

ssh
tags question: http://stackoverflow.com/q/23247910
tags question: http://stackoverflow.com/q/23130265
tags question: http://stackoverflow.com/q/23261954
type: Tag
tag name: ssh

http://stackoverflow.com/comment/35475060
type: QuestionComment
has text: no, where would I do this? os is my Outputstream, the `Input` class is my only inputting code
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23193539

http://stackoverflow.com/q/23278467
type: Question
has body: I'm relatively new to log4j (v2), but I believe I've exhausted my resources, so I come to ask my question here. I have a working log4j configuration, which I will append to the end of my question. The application is run every x minutes using a cronjob. The log4j behaviour I'd like to see is the following: All INFO (and up) logging is done to file A All ERROR (and up) logging is done to file B In case of an ERROR (or up), a mail is sent containing the DEBUG (and up) lines of the given execution. I have achieved 1 and 2 using the configuration below. Is number 3 also possible using log4j (if not, why not?) and if so, how? The current configuration: <?xml version="1.0" encoding="UTF-8"?> <PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/> <PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/> <PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/> <SMTP name="MailError" subject="Error occurred" to="a@b.com" smtpHost="mail.foo.bar" from="b@c.net"/> <AppenderRef ref="LogFile"/> <AppenderRef ref="ErrorLogFile"/> <AppenderRef ref="MailError"/> <AppenderRef ref="Console" level="INFO"/> <AppenderRef ref="Async" level="INFO"/> <AppenderRef ref="Errors" level="ERROR"/>
has answer: http://stackoverflow.com/a/23285453
accepted answer: http://stackoverflow.com/a/23285453
upvote count: 1
answer count: 1
tagged with: log4j
favorite count: 0
has comment: http://stackoverflow.com/comment/35711978
has title: log4j - on ERROR, log DEBUG?
tagged with: log4j2
tagged with: logging
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35634594
downvote count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/35643808
has comment: http://stackoverflow.com/comment/35650225

http://stackoverflow.com/comment/39511483
type: Comment
score: 1
comment on: http://stackoverflow.com/a/24480117
type: AnswerComment
has text: I had the same problem and found that this worked (also in 2.49), but it would be helpful to know if there's a solution that doesn't require setting environment variables -- for example, a library/dll that can be loaded from java.

http://stackoverflow.com/q/23204194
has comment: http://stackoverflow.com/comment/35663238
has comment: http://stackoverflow.com/comment/35684953
has comment: http://stackoverflow.com/comment/35630725
has answer: http://stackoverflow.com/a/23206957
score: 0
has title: Geb to() is not working for Page List
has comment: http://stackoverflow.com/comment/35628982
tagged with: groovy
has comment: http://stackoverflow.com/comment/35662011
has comment: http://stackoverflow.com/comment/35673469
type: UnansweredQuestion
has body: I am trying to implement the to() checker on the Page Object for the case when clicking a button may stay on the page if there is an error or go to a new page if there are no errors. When I use a List to provide all the possible Page Classes only the first Page is at() checked and then the validation fails. It never checks the other Pages in the List. My implementation is almost exactly like the Geb Manual. class LandingPage extends Page { static at = { title == "Welcome" } static content = { loginBtn(to: [AccountPage, LandingPage]) { $("button", id: "login") } } class AccountPage extends Page { static at = { title == "My Account" } static content = { // Page Contents } class LoginTest() extends GebReportingTest { @Test public void checkErrorDisplayed() { to LandingPage loginBtn.click() } } In the example above the browser goes to the Landing Page and when you click the button without any fields filled in it should display an error and remain on the LandingPage. But with the current implementation of LandingPage it attempts to do an at() check on AccountPage and then fails. If I switch the placement of [AccountPage, LandingPage] in the to() statement for loginBtn, then the negative test case will pass, but the good path will fail. Any ideas? http://www.gebish.org/manual/current/pages.html#to EDIT: Including stack trace title.contains("My Account") | | | false Welcome at org.codehaus.groovy.runtime.InvokerHelper.assertFailed(InvokerHelper.java:398) at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.assertFailed(ScriptBytecodeAdapter.java:646) at com.website.pages.AccountPage$__clinit__closure1.doCall(AccountPage.groovy:10) at com.website.pages.AccountPage$__clinit__closure1.doCall(AccountPage.groovy) at sun.reflect.GeneratedMethodAccessor16.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90) at groovy.lang.MetaMethod.doMethodInvoke…
tagged with: testing
has comment: http://stackoverflow.com/comment/35660957
has comment: http://stackoverflow.com/comment/35673285
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/35660400
tagged with: geb
tagged with: automated-tests
answer count: 1
has comment: http://stackoverflow.com/comment/35659912

http://stackoverflow.com/a/54142293
has body: Suppose your application need 4 .yml files. application.yml application-dev.yml application-uat.yml application-prod.yml and you have to set different setting for each file. You just need to set your setting on appropriate environment such as dev, uat ot prod level and the have to add just one property in application.yml file. spring: profiles: active: dev application: /* optional */ name: Application Name
answers question: http://stackoverflow.com/q/23134869
upvote count: 12
downvote count: 0
score: 12
type: Answer

http://stackoverflow.com/comment/35612771
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23256008
type: AnswerComment
has text: @user3566271 It should work , in which case 2 digit number it giving you '0'

http://stackoverflow.com/comment/35383582
has text: I read following in Mockito docs. "Mockito does not delegate calls to the passed real instance, instead it actually creates a copy of it." Does this statement mean that when i call fun() by spying Abc class, then Mockito create a copy of the fun() method and executes it?? If yes, then what is the benefit of doing this? I mean , why take an overhead to create a copy, when u have a real implementation available..
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23140315
score: 0

http://stackoverflow.com/q/23257903
has answer: http://stackoverflow.com/a/23258489
has comment: http://stackoverflow.com/comment/35591263
has body: For my end of semester project I have to do a solitaire klondike game on java. So far, I've made a class called Card, with all the attributes. I've also made a jFrame. It has an ArrayList with all the cards, which I've already put in random order, and divided them into the other 7 decks. The problem is at the moment of painting the cards, only one deck has one card visible under the other. For the resting decks I can't seem to achieve it. Also, I' can't put the card facing down. Here's my code and an Image of the graphic interface. GUI Code package solitario; import java.util.ArrayList; import java.util.Collections; import java.awt.*; /** * * @author Andres */ public class Applet extends javax.swing.JApplet { //Creo el ArrayList del mazo principal private ArrayList&lt;Carta&gt; mazoPrincipal; private ArrayList&lt;Carta&gt; mazoUno; private ArrayList&lt;Carta&gt; mazoDos; private ArrayList&lt;Carta&gt; mazoTres; private ArrayList&lt;Carta&gt; mazoCuatro; private ArrayList&lt;Carta&gt; mazoCinco; private ArrayList&lt;Carta&gt; mazoSeis; private ArrayList&lt;Carta&gt; mazoSiete; /** * Initializes the applet Applet */ @Override public void init() { /* Set the Nimbus look and feel */ //&lt;editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "&gt; /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(Applet.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(Applet.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (Illega…
has title: Solitaire Klondike on Java
answer count: 2
favorite count: 0
has comment: http://stackoverflow.com/comment/35590991
has answer: http://stackoverflow.com/a/23309308
score: 0
type: UnansweredQuestion
upvote count: 1
tagged with: swing
downvote count: 1
type: Question
tagged with: java

http://stackoverflow.com/a/61809941
downvote count: 0
answers question: http://stackoverflow.com/q/23286893
upvote count: 2
has body: Dmitri and Imen's answers are correct. Here is a working example project. It uses Gradle and includes instructions on how to build and execute it. It should be a good reference point. https://github.com/dgroomes/jmeter-playground Also, here is the official JMeter documentation on making your custom plugin available in the JMeter tool: https://jmeter.apache.org/usermanual/get-started.html#classpath.
type: Answer
score: 2

http://stackoverflow.com/comment/44949045
comment on: http://stackoverflow.com/q/23203778
type: Comment
type: QuestionComment
has text: https://bitbucket.org/victor_kifer/dct_compressor/overview
score: 0

http://stackoverflow.com/comment/35396445
score: 0
type: Comment
has text: In principle, the way to resolve issues with libraries is to follow the official documentation carefully when writing the code calling them. Usually Java libraries are pretty good about having solid documentation because of the ease of use of Javadoc, but I agree Spring configuration seems to be a bit of an exception. While I'm not as sanguine as you about the effectiveness of stepping through Spring library code, you should be able to download the source jar and view it in whatever way you want, though you may need to use and IDE to step through it.
type: AnswerComment
comment on: http://stackoverflow.com/a/23147816

http://stackoverflow.com/q/23172932
score: 0
has comment: http://stackoverflow.com/comment/35439156
answer count: 1
has title: JFrame, JPanel, KeyListener questions
accepted answer: http://stackoverflow.com/a/23173967
tagged with: swing
has body: I will be making a simple game with Timer and thought how I should put everything together. I've just started with Swing and Keyboard controls. I imagine I'll have a class for the main Frame with JFrame, a class for the Board with JPanel and then I'll add all the objects to the Board, like JLabel in this example. I'll use composition to glue everything together. I'll have my methods for keyboard controls in the object classes I want to control. How good or bad is this design and how could I improve it? Any advice would be great. import javax.swing.JFrame; public class Main extends JFrame { public Board board = new Board(); public Main() { add(board); setDefaultCloseOperation(EXIT_ON_CLOSE); pack(); setVisible(true); } public static void main(String args[]) { new Main(); } } import javax.swing.JPanel; public class Board extends JPanel { public TextLabel textLabel1 = new TextLabel("Hi", "Hello", "Bye"); public TextLabel textLabel2 = new TextLabel("Bye", "GoodBye", "Farewell"); public Board() { addKeyListener(textLabel1); //this could be a ball in my game addKeyListener(textLabel2); //this could be something else... add(textLabel1); add(textLabel2); setFocusable(true); } } import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import javax.swing.JLabel; public class TextLabel extends JLabel implements KeyListener { private String txt1, txt2; public TextLabel(String text, String txt1, String txt2) { setText(text); this.txt1 = txt1; this.txt2 = txt2; } public void keyPressed(KeyEvent e) { int key = e.getKeyCode(); if (key == KeyEvent.VK_A) { setText(txt1); } if (key == KeyEvent.VK_L) { setText(txt2); } } @Override public void keyReleased(KeyEvent e) { // TODO Auto-generated method stub } @Override public void keyTyped(KeyEvent e) { // TODO Auto-generated method stub } }
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23173967
tagged with: java
type: Question

http://stackoverflow.com/comment/35460987
score: 0
has text: @T.J. Look at my edit, it is possible to do it without creating a second `Q` matrix, and retracing your steps using the original `D` matrix.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23181395

http://stackoverflow.com/comment/35488076
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/23138105
has text: Can you show me the code that you have currently? Just edit your question above, and put in the code.

http://stackoverflow.com/comment/35592936
comment on: http://stackoverflow.com/q/23259005
has text: What would you recommend? I honestly thought the same, but I'm not even sure what's wrong so unsure what to specify...
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23248824
upvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/23252924
has answer: http://stackoverflow.com/a/27153560
possible better answer: http://stackoverflow.com/a/27153560
answer count: 2
has title: Error stream blocking when running external command with Java
downvote count: 0
score: 1
favorite count: 0
has body: Working on SEAndroid, I call Setools commands from my Java application. It works perfectly with small SEAndroid policy and now I need to test my tool with real SEAndroid policy. But unfortunately, I face a problem with an error stream. Here my code I used to call external commands : public static BufferedReader runCommand(final String[] args) throws IOException { BufferedReader stdInput = null; BufferedReader stdError = null; try { Process p = Runtime.getRuntime().exec(args); stdInput = new BufferedReader(new InputStreamReader(p.getInputStream())); stdError = new BufferedReader(new InputStreamReader(p.getErrorStream())); // read any errors from the attempted command String s = null; StringBuilder err = new StringBuilder(); while ((s = stdError.readLine()) != null) { err.append(s + "\n"); } if (err.length() != 0) { throw new IOException(err.toString()); } return stdInput; } finally { if (stdError != null) { stdError.close(); } } } So, as you can see, I call an external command. Then read the error stream and throw an exception if there is any errors, otherwise I return the InputStream, so I can parse it later. With a real SEAndroid policy, the error stream seems to block (even if I read a single char) and I can't parse the result of the command. If I close the error stream without reading anything, the application works fine, but I want to handle errors if any. If I type the command in a console, it works fine too. In the first case (with small SEAndroid policy), the output of the command is small ( ~350 lines). In the second case (with a real SEAndroid policy), the output of the command is larger ( >1500 lines). Is it possible that the size of the output stream influences the error stream? The two streams are two distinctive resources, isn't it? The fact that I do not read the output stream immediately have an importance? I fear that its not a "programming" problem but more a system problem... Any suggestion? Thanks in advance for your help=) Edit: I try to read the…
has answer: http://stackoverflow.com/a/23252924
type: AnsweredQuestion
tagged with: runtime.exec
tagged with: java
tagged with: stream

http://stackoverflow.com/q/23281335
tagged with: nullpointerexception
type: Question
has comment: http://stackoverflow.com/comment/35635360
has comment: http://stackoverflow.com/comment/35635239
upvote count: 2
tagged with: spring
tagged with: kundera
has body: I'm trying to write a simple Spring app and I'm having trouble getting the Spring Repository to work right. I'm getting a NullPointerException at com.impetus.kundera.query.KunderaQuery.initEntityClass(KunderaQuery.java:390). The exception is ultimately caused by collectionRepository.findAll(). Full stack trace: java.lang.NullPointerException at com.impetus.kundera.query.KunderaQuery.initEntityClass(KunderaQuery.java:390) at com.impetus.kundera.query.KunderaQuery.postParsingInit(KunderaQuery.java:353) at com.impetus.kundera.query.QueryResolver.getQueryImplementation(QueryResolver.java:80) at com.impetus.kundera.persistence.PersistenceDelegator.getQueryInstance(PersistenceDelegator.java:557) at com.impetus.kundera.persistence.PersistenceDelegator.createQuery(PersistenceDelegator.java:527) at com.impetus.kundera.persistence.EntityManagerImpl.createQuery(EntityManagerImpl.java:379) at com.impetus.kundera.persistence.EntityManagerImpl.createQuery(EntityManagerImpl.java:717) at com.impetus.kundera.persistence.EntityManagerImpl.createQuery(EntityManagerImpl.java:704) 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.springframework.orm.jpa.SharedEntityManagerCreator$SharedEntityManagerInvocationHandler.invoke(SharedEntityManagerCreator.java:241) at com.sun.proxy.$Proxy33.createQuery(Unknown Source) at org.springframework.data.jpa.repository.support.SimpleJpaRepository.getQuery(SimpleJpaRepository.java:471) at org.springframework.data.jpa.repository.support.SimpleJpaRepository.findAll(SimpleJpaRepository.java:264) at org.springframework.data.jpa.repository.support.SimpleJpaRepository.findAll(SimpleJpaRepository.java:60) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMe…
has comment: http://stackoverflow.com/comment/35678000
tagged with: java
type: UnansweredQuestion
has title: NullPointerException: Spring configuration error or Kundera JPA bug
score: 2
tagged with: jpa
answer count: 0
downvote count: 0
favorite count: 0

http://stackoverflow.com/a/23263008
upvote count: 2
type: AcceptedAnswer
downvote count: 0
has body: This is a problem than jvm send when executes any functionality of the native code. Maybe your problem comes caused by the use of the rxtx libraries, so i reccomend you to change the 'serial' into 'file' of the printer mode.
has comment: http://stackoverflow.com/comment/50322811
type: Answer
answers question: http://stackoverflow.com/q/23242133
score: 2
accepted answer of: http://stackoverflow.com/q/23242133

http://stackoverflow.com/q/23287455
tagged with: android-asynctask
tagged with: android
accepted answer: http://stackoverflow.com/a/23296286
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35646186
has comment: http://stackoverflow.com/comment/35645934
tagged with: java
score: -4
tagged with: http
has body: I was working on a application. I am stuck to make http post request and i have to use Async task because my main work is in service. I look on web and i got the piece of code and i modified a bit but it's not working. public class MainActivity extends Activity implements OnClickListener{ private EditText value; private Button btn; private ProgressBar pb; private EditText t1; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.home_layout); value=(EditText)findViewById(R.id.editText1); t1= (EditText) findViewById(R.id.editText2); btn=(Button)findViewById(R.id.button1); pb=(ProgressBar)findViewById(R.id.progressBar1); pb.setVisibility(View.GONE); btn.setOnClickListener(this); } @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.main, menu); return true; } public void onClick(View v) { // TODO Auto-generated method stub if(value.getText().toString().length()&lt;1){ // out of range Toast.makeText(this, "please enter something", Toast.LENGTH_LONG).show(); }else{ pb.setVisibility(View.VISIBLE); new MyAsyncTask().execute(value.getText().toString()); } } private class MyAsyncTask extends AsyncTask&lt;String, Integer, Double&gt;{ @Override protected Double doInBackground(String... params) { // TODO Auto-generated method stub postData(params[0]); return null; } protected void onPostExecute(Double result){ pb.setVisibility(View.GONE); Toast.makeText(getApplicationContext(), "command sent", Toast.LENGTH_LONG).show(); } protected void onProgressUpdate(Integer... progress){ pb.setProgress(progress[0]); } public void postData(String valueIWantToSend) { // Create a new HttpClient and Post Header HttpClient httpclient = new DefaultHttpClient(); t1.setText("asdas"); HttpPost httppost = new HttpPost("http://www.cise.ufl.edu/~rrohit/cps/test.php"); try { // Add your data List&lt;NameValuePair&gt; nameValuePairs = new ArrayList&lt;NameValuePair&gt;(); nameValuePairs.add(new Basic…
type: Question
has comment: http://stackoverflow.com/comment/35647590
linked to: http://stackoverflow.com/q/3280141
has answer: http://stackoverflow.com/a/23296286
has title: Async Http post request is not working
downvote count: 4
upvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/35645646
favorite count: 0

http://stackoverflow.com/comment/35517397
type: AnswerComment
has text: Thanks but i did that. still getting the same error.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23217197

http://stackoverflow.com/q/23277646
has comment: http://stackoverflow.com/comment/35628134
type: AnsweredQuestion
score: 3
has title: Android XML File java.lang.nullpointerexception
tagged with: rendering
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/73003308
has answer: http://stackoverflow.com/a/23315556
downvote count: 0
has comment: http://stackoverflow.com/comment/35627488
favorite count: 0
has answer: http://stackoverflow.com/a/23277751
tagged with: exception
has comment: http://stackoverflow.com/comment/35628269
tagged with: android
has body: I am building a brand new android project. It's not my 1st android app so I'm much more frustrated not being able to get rid of this error... I use an XML File, which has for now only 3 items and NO error in the XML tab : &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/container" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".gaming..MainActivity" &gt; &lt;ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/fondipad" android:contentDescription="@string/FondDesc" /&gt; &lt;RelativeLayout android:layout_height="300dp" android:layout_width="fill_parent" android:background="@drawable/cadremenu"&gt; &lt;/RelativeLayout&gt; &lt;/RelativeLayout&gt; Pretty simple, yay ? However, the visual tab is not rendering the cadremenu drawable (but the "fond" does)... But the cadremenu.png is in the drawable folder ! I can launch the app but only the background is rendered... I really don't know what to do... The xml file returns this exception java.lang.NullPointerException at android.graphics.Bitmap_Delegate.createBitmap(Bitmap_Delegate.java:598) at android.graphics.Bitmap_Delegate.createBitmap(Bitmap_Delegate.java:120) at android.graphics.Bitmap_Delegate.createBitmap(Bitmap_Delegate.java:102) at com.android.layoutlib.bridge.impl.ResourceHelper.getDrawable(ResourceHelper.java:233) at android.content.res.BridgeTypedArray.getDrawable(BridgeTypedArray.java:782) at android.view.View.&lt;init&gt;(View.java:3554) at android.view.View.&lt;init&gt;(View.java:3484) at android.view.ViewGroup.&lt;init&gt;(ViewGroup.java:464) at android.widget.RelativeLayout.&lt;init&gt;(RelativeLayout.java:236) at sun.reflect.GeneratedConstructorAccessor37.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessor…
answer count: 4
tagged with: http://stackoverflow.com/tag/xml
accepted answer: http://stackoverflow.com/a/23315556
possible better answer: http://stackoverflow.com/a/30195688
upvote count: 3
has answer: http://stackoverflow.com/a/30195688

http://stackoverflow.com/comment/35465657
type: Comment
type: QuestionComment
has text: maybe related http://stackoverflow.com/questions/1087339/using-mockito-to-test-abstract-classes http://www.rallydev.com/community/engineering/easy-way-test-abstract-classes-mockito http://www.java-producties.nl/testing/unit-testing-a-abstract-class-with-mockito/
score: 0
comment on: http://stackoverflow.com/q/23185638

http://stackoverflow.com/comment/35620589
comment on: http://stackoverflow.com/q/23272635
type: Comment
type: QuestionComment
score: 0
has text: took me a while but I got it. The exception that is.

http://stackoverflow.com/q/23269894
has title: Can I generate my own keytab programmatically in Java?
answer count: 3
has answer: http://stackoverflow.com/a/41702338
upvote count: 9
tagged with: apacheds
tagged with: java
type: UnansweredQuestion
tagged with: kerberos
has answer: http://stackoverflow.com/a/23279643
downvote count: 0
has answer: http://stackoverflow.com/a/23561814
favorite count: 0
score: 9
type: Question
has body: I was wondering if there was a way to generate my own keytab in java without going to the kdc? I found code similar to this in an ApachDS test: Keytab keytab = Keytab.getInstance(); KerberosTime timeStamp = new KerberosTime(KerberosUtils.UTC_DATE_FORMAT.parse("20070217235745Z")); Map&lt;EncryptionType, EncryptionKey&gt; keys = KerberosKeyFactory .getKerberosKeys(principalName, userPassword); KeytabEntry keytabEntry = new KeytabEntry( principalName, 1L, timeStamp, (byte) 0, keys.get(EncryptionType.DES_CBC_MD5)); List&lt;KeytabEntry&gt; entry = Arrays.asList(keytabEntry); keytab.setEntries(entry); keytab.write(keytabFile); return keytabFile; I'm able to a klist on a keytab that i create: Vno Type Principal Date Aliases 0 des-cbc-md5 ssh/localhost@EXAMPLE.COM 2007-02-17 Also, if this is not possible, is there a way to programmatically get a keytab using ApacheDS or any other java library?

http://stackoverflow.com/q/23131235
tagged with: java
linked to: http://stackoverflow.com/q/3478133
type: Question
upvote count: 2
answer count: 2
has answer: http://stackoverflow.com/a/23133285
accepted answer: http://stackoverflow.com/a/23133285
tagged with: validation
possible better answer: http://stackoverflow.com/a/23133867
has title: Skip validation of Primefaces Inputtext on keyup event but validate on submit
favorite count: 0
has body: I have two requirements for my InputText: value of the p:inputText should be immediately displayed on screen in h:outputText with keyup-event the value should be unique in database I'm using Primefaces 4.0, JSF 2.2 with Glassfish 4 and Java 7 My code looks like this at the moment Example.xhtml &lt;h:form&gt; &lt;p:inputText id="value" value="#{myBean.value}" &gt; &lt;p:ajax event="keyup" update="example" process="@this" /&gt; &lt;f:validator binding="#{uniqueValueValidator}" /&gt; &lt;/p:inputText&gt; &lt;h:outputText id="example" value="#{myBean.value}"&gt; &lt;p:commandButton value="Save" action="#{myBean.saveValue}"/&gt; &lt;/form&gt; MyBean.java @Named @RequestScoped public class MyBean { @Inject private DBService service; private String value; //getter, setter public String saveValue() { service.saveValue(value); return "showall"; } } UniqueValueValidator.java @Named public class UniqueValueValidator implements Validator { @Inject private DBService service; @Override public void validate(FacesContext context, UIComponent component, Object value) throws ValidatorException { if(service.isValueNotUnique(value.toString()) { // throw ValidatorException } } } My problem is now, that on every keyup-event the value is validated and a call to the database is made. But I want to validate the value only when the form is submitted. My first solution was to move the validation into the saveValue method. public String saveValue() { if(service.isValueNotUnique(value) { // add a FacesMessage return null; } else { service.saveValue(value); return "showall"; } } But here I think it is not good practice to mix validation code and logic code in one method. So I hope you have a nicer solution for me ;)
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23133867
tagged with: jsf
downvote count: 0
tagged with: primefaces

http://stackoverflow.com/comment/111025734
score: 0
type: Comment
has text: There are some compile and logic errors in the code. I've edited to correct these.
comment on: http://stackoverflow.com/a/23231357
type: AnswerComment

http://stackoverflow.com/comment/35564718
type: Comment
type: AnswerComment
has text: Ok i agree with you I just have one last problem above Jakub is saying I should write Set<Object> and monocell is saying Set<Object> should not be taken.Could you plz tell me who is right?
score: 0
comment on: http://stackoverflow.com/a/23242709

http://stackoverflow.com/comment/35585449
has text: Interesting question. But I think the underlying design is questionable...
comment on: http://stackoverflow.com/q/23254330
type: Comment
type: QuestionComment
score: 1

broadcastreceiver
tags question: http://stackoverflow.com/q/23152613
tags question: http://stackoverflow.com/q/23141422
tag name: broadcastreceiver
tags question: http://stackoverflow.com/q/23169438
type: Tag
tags question: http://stackoverflow.com/q/23286792
tags question: http://stackoverflow.com/q/23273237

http://stackoverflow.com/a/23290233
type: Answer
answers question: http://stackoverflow.com/q/23287039
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23287039
has body: Currently I have a working solution by using the following filter. However I'm still interested in "native" camel ways to do this. public class CamelFilter implements ApplicationContextAware { public boolean isMyBeanNotAvailable() { boolean notAvailable = false; try { notAvailable = this.applicationContext.getBean("myBean") == null; } catch (BeanCreationNotAllowedException bcnae) { notAvailable = true; } return notAvailable; } } With the following route: ... 20000 <method ref="camelFilter" method="isMyBeanNotAvailable"/> <stop/> <bean ref="myBean" method="updateAfterDelay"/>
score: 0

http://stackoverflow.com/comment/35734352
type: Comment
score: 0
comment on: http://stackoverflow.com/a/23202527
has text: @Cristian Reyes do you use java 8 ? did you try my answer ?
type: AnswerComment

http://stackoverflow.com/comment/35454042
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23181249
score: 0
has text: @MightyPork I agree.. it seems to me that the threads will do nothing just to run in parallel and give start and end times.. it's not necessary to use threads just for that, if that's the case..

http://stackoverflow.com/q/23197128
type: AnsweredQuestion
score: 1
tagged with: java
linked to: http://stackoverflow.com/q/409784
has answer: http://stackoverflow.com/a/23197168
type: Question
upvote count: 2
answer count: 2
has answer: http://stackoverflow.com/a/23197177
accepted answer: http://stackoverflow.com/a/23197177
downvote count: 1
has body: So I have this List&lt;> which contains boolean arrays: static List&lt;boolean[]&gt; myList = new ArrayList&lt;&gt;(); And these are the arrays I add into the list: boolean[] myBooleanArray = new boolean[8]; So now when I go trough the myList with a for() loop, using this: myList.get(i); My output is something like this in console: [Z@65e7c41f But I want to into thoes objects too. How do I do this?
has comment: http://stackoverflow.com/comment/35480934
possible better answer: http://stackoverflow.com/a/23197168
favorite count: 0
has title: Unable to access my boolean list
has comment: http://stackoverflow.com/comment/35480896

http://stackoverflow.com/comment/35578150
score: 0
has text: @TBM I put if same you.It's error same above.Thanks
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23251047

http://stackoverflow.com/q/23203224
has body: I recently made an account using Amazon Web Services - hoping to get access to a 24/7 database in postgresql. However, there is little documentation as to how to connect to a postgresql database instance using straight java code. So my question is, how would I connect to my made database?? Please be specific. some .getConnection code would be helpful. AND AGAIN. I WANT TO USE JAVA CODE. No extensions or toolkits. heres some connection code: try { Properties props = new Properties(); //Uncomment the following line if using a keystore. props.setProperty("ssl", "true"); props.setProperty("user", "BruceWayne"); props.setProperty("password", "password"); connection = DriverManager.getConnection("jdbc:postgresql://batcomputer.cu2oezud659w.us-west-2.rds.amazonaws.com:5432",props); } catch (SQLException e) { System.out.println("Connection Failed! Check output console"); e.printStackTrace(); return; } my guess is that the problem is at the line where "connection" is. and here is the error at the terminal: 1291-121-25:SQLGUI student$ javac -cp postgresql2.jar:. JDBCExample.java 1291-121-25:SQLGUI student$ java -cp postgresql2.jar:. JDBCExample -------- PostgreSQL JDBC Connection Testing ------------ PostgreSQL JDBC Driver Registered! Connection Failed! Check output console java.sql.SQLException: No suitable driver found for jdbc:postgresql://batcomputer.cu2oezud659w.us-west-2.rds.amazonaws.com:5432 at java.sql.DriverManager.getConnection(DriverManager.java:596) at java.sql.DriverManager.getConnection(DriverManager.java:187) at JDBCExample.main(JDBCExample.java:38) any help is highly appreciated!!!
tagged with: sql
has comment: http://stackoverflow.com/comment/35495829
has title: How do i connect to a postrgresql database instance using Amazon Web Services in java code?
type: AnsweredQuestion
tagged with: java
tagged with: database
type: Question
answer count: 1
tagged with: amazon-web-services
tagged with: postgresql
has answer: http://stackoverflow.com/a/23208613
score: 0
accepted answer: http://stackoverflow.com/a/23208613

http://stackoverflow.com/a/29086150
has body: GGrec's solution doesn't work for me. I managed to fixed this issue by adding to pom.xml this: finalName maven-compiler-plugin 3.1 1.8 1.8 UPDATE: In addition I figured out that everytime you run mvn install command on this pom.xml it overrides previous configuration. The right solution is either remove this version from pom.xml and set it up in eclipse options or just use configuration from pom.xml.
type: Answer
score: 29
upvote count: 29
has comment: http://stackoverflow.com/comment/76989081
answers question: http://stackoverflow.com/q/23183931
has comment: http://stackoverflow.com/comment/105521646
downvote count: 0

http://stackoverflow.com/comment/35388104
score: 0
type: AnswerComment
has text: @DavidWallace tried, yes seems that can use Metal methods but get the same error cannot be applied at the line `list.set(i, ma);`
comment on: http://stackoverflow.com/a/23143423
type: Comment

http://stackoverflow.com/comment/35611442
score: 0
has text: @SreeVeni no. The file is already on hdfs. And actually trying -file on hadoop2, looks it is not supported. Or perhaps I'm missing something?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23267158

http://stackoverflow.com/comment/35571373
type: QuestionComment
type: Comment
has text: So to clarify, those 12 records also have the same uUrl?
comment on: http://stackoverflow.com/q/23211174
score: 0

http://stackoverflow.com/a/23199306
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35487203
answers question: http://stackoverflow.com/q/23198602
has comment: http://stackoverflow.com/comment/35485623
has comment: http://stackoverflow.com/comment/35486216
type: Answer
has comment: http://stackoverflow.com/comment/35486674
has body: It looks like maybe your PHP code is not returning any value at all. I'm not sure if this matters, but shouldn't you be using mysqli_num_rows() instead of mysql_num_rows()? EDIT: $password=$_GET['password']; According to your error, there is no 'password' value sent in your request. Check for a typo, and make sure a value is actually being sent for the password. EDIT 2: You're using post in your Android code (HttpPost), but get in PHP ($_GET). Change your $_GET to $_REQUEST or $_POST instead. EDIT 3: Add password to your select. You are trying to access it from your result array without having selected it in SQL. $product["name"]=$arr["arr"]; should be $product["name"]=$arr["name"]; EDIT 4: Move this: $response["get"]=array(); before the while loop, and move this: echo json_encode($response); (both of them) after the while loop. Then you should have a JSON structure like this: { "success":1, "post":[ {"name":"Abc","password":null}, {‌​"name":"Def","password":null}, {"name":"Ghi","password":null‌​}, {"name":"Jkl","password":null}, {"na‌​me":"Mno","password":null} ] } As you can see your results are in a JSONArray (signified by the [ ] tags) called "post". So something like this: JSONArray results = json_data.getJSONObject("post"); for (int i = 0; i &lt; results .size(); i++) { JSONObject item = results.getJSONObject(i); String name = item.getString("name"); }
has comment: http://stackoverflow.com/comment/35485609
has comment: http://stackoverflow.com/comment/35485197
has comment: http://stackoverflow.com/comment/35486014
score: 0
has comment: http://stackoverflow.com/comment/35484981
accepted answer of: http://stackoverflow.com/q/23198602

http://stackoverflow.com/comment/35448830
comment on: http://stackoverflow.com/a/23177320
type: Comment
has text: Highlight the string. Press cmd+1. Then select the extract String option for the ide to do this for you. You will understand after it is done. Check the res folder.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/35548191
has text: Oh you are trying to go back and for with this reference? That won't work. I didn't understand your question. The easiest way to save this would be using SharedPreferences if you want to keep it
type: Comment
comment on: http://stackoverflow.com/a/23234297
score: 1
type: AnswerComment

http://stackoverflow.com/comment/35394443
has text: @ambigram_maker You may look over the content of the question first, I think the answers are already there.
comment on: http://stackoverflow.com/q/23147128
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35448362
comment on: http://stackoverflow.com/a/23178153
score: 1
has text: +1 for `Never design your own crypto` and `Never implement your own crypto`. Thank you.
type: AnswerComment
type: Comment

http://stackoverflow.com/a/23235182
type: Answer
answers question: http://stackoverflow.com/q/23235147
has comment: http://stackoverflow.com/comment/35550041
upvote count: 1
score: 1
downvote count: 0
has body: Ignoring any other potential errors in your code (or due to its presentation to us here), you are attempting to declare another method in main. public int SearchSortAlgorithm () { TestQuickSort&lt;Integer&gt; aSortedArray = new TestQuickSort&lt;Integer&gt;(); aSortedArray = quickSort(anArray, 5000); } This needs to be moved out of main. And also fixed to actually return an int. And main's signature should be public static void main(String[] args). Although, it should really be returning an int[] instead... public static int[] searchSortAlgorithm (final int[] anArray) { TestQuickSort&lt;Integer&gt; aSortedArray = new TestQuickSort&lt;Integer&gt;(); return quickSort(anArray, 5000); } ...and called in your main method like this... int[] aSortedArray = searchSortAlgorithm(anArray); for (int k = 0; k &lt;= 50; k++) { // would be better to use aSortedArray.length System.out.print(aSortedArray[k] + " "); }

input
tags question: http://stackoverflow.com/q/23200374
tags question: http://stackoverflow.com/q/23288977
tags question: http://stackoverflow.com/q/23167381
tags question: http://stackoverflow.com/q/23172460
tags question: http://stackoverflow.com/q/23228534
tags question: http://stackoverflow.com/q/23250954
tags question: http://stackoverflow.com/q/23178724
tags question: http://stackoverflow.com/q/23137392
tags question: http://stackoverflow.com/q/23183023
tags question: http://stackoverflow.com/q/23137669
tag name: input
tags question: http://stackoverflow.com/q/23264129
type: Tag
tags question: http://stackoverflow.com/q/23252284

http://stackoverflow.com/q/23260427
tagged with: physics
type: UnansweredQuestion
has title: Collision Response of ball at Corners of rectangle
has answer: http://stackoverflow.com/a/23268127
type: Question
tagged with: java
tagged with: collision-detection
has body: i have a fixed rectangle. When ball hits a vertex of a triangle, i calculate tangent at point of contact(rectangle vertex). Then i rotate Velocity vector to coincide with the tangent, flip the y value of velocity and rotate it back. Here is my code for top-left corner: double c1x=rec.x-ball.getX(); double c1y=rec.y-ball.getY(); if(c1*c1+c2*c2&lt;ball.getRadius()*ball.getRadius()) { double angle=Math.atan2(-c1x,c1y); //angle made by tangent Vector2D v=ball.velocity.rotate(angle); //rotate velocity vector by 'angle' if(v.y&lt;0.0f) //ball is already moving away from corner return; v.setY(-v.y); //flip y ball.velocity=v.rotate(-angle); //rotate back return; } But this code doesnot works. When ball strikes the corner it gets stuck, moves along the top edge and then falls off, not bouncing back. Am i doing it correct?
answer count: 1
score: 0

http://stackoverflow.com/q/23176532
has answer: http://stackoverflow.com/a/23176561
has comment: http://stackoverflow.com/comment/35445584
has comment: http://stackoverflow.com/comment/35445490
type: Question
has comment: http://stackoverflow.com/comment/35445512
tagged with: java
has title: Check if string starts or ends with specific letter - java
has body: I have a little problem checking if a string have a letter in it. Right now, i have a server/client situation where the server sends back a command to the client. That command can be: RM20 B RM20 L RM20 I RM20 A "User input" RM20 C How do i check the letter if its a B, L, I or A or C?? Right now i made this code: if ((fromServer.startsWith("RM20 A"))) { else if ((fromServer.startsWith("RM20 C"))) else { } does this work? or will the if statement and else if statement be the same? i can't use ends with, because the RM20 A have an input in the end which can be alot. is there a way to check whats in the middle. when you get, lets says "RM20 A 123213124" as a String?
has answer: http://stackoverflow.com/a/23176617
answer count: 3
has comment: http://stackoverflow.com/comment/35445517
accepted answer: http://stackoverflow.com/a/23176617
has answer: http://stackoverflow.com/a/23176623
score: 0
has comment: http://stackoverflow.com/comment/35445570
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/23176561

http://stackoverflow.com/a/23173967
upvote count: 1
answers question: http://stackoverflow.com/q/23172932
score: 1
accepted answer of: http://stackoverflow.com/q/23172932
type: AcceptedAnswer
downvote count: 0
has body: If you want your simple game to be memory/cpu efficient, I suggest taking a totally different route. Use a GameLoop. It seems as if you aren't using any type of action listener or loop to handle updates. You need something to handle updates, such as when a player moves from point A to point B, you need a way to keep increasing your entity's coordinates until it's at its destination. An ActionListener and using Swing timers will work for simple games, but if you wanna get serious about game dev In the future, start off the right way. public class Main { public static void main(String[] args) { Game game = new Game(); //init JFrame and add game to it game.start(); while(game.isRunning()) { game.update(); game.repaint(); } } } class Game extends Canvas { private boolean running = true; private Ball ball = new Ball(0, 0, 50, 50); public void start() { running = true; } public void stop() { //clean-up running = false; } public void update() { //update game logic ball.update(); } @Override public void paint(Graphics g) { //render game super.paint(g); //clears previous graphics ball.render(g); //passes graphics down to entity } } This will give you a clear view on the design of your game, aswell separate rendering from game logic. Here's what the ball class would look like class Ball { private int currentX, currentY, width, height; public Ball(int x, int y, int w, int h) { currentX = x; currentY = y; width = w; height = h; } public void update() { currentX++; //moves ball to right } public void render(Graphics g) { g.setColor(Color.BLUE); g.fillRect(currentX, currentY, width, height); } } You'll notice that when running something like this, your CPU usage will be rather high. It's because the while loop controlling your game is looping at an extremely fast rate. There are many ways to slow this down in a precisely timed manner. I'll show you a pretty simple way: int fps = 30; int oneNanoSec = 1000000000; int secondsPerLoop = oneNanoSecond/fps; //divide a second into 30 sli…
type: Answer

http://stackoverflow.com/comment/36012377
type: QuestionComment
has text: I am experiencing a similar issue. Trying to fix it as well, will report back with anything that works.
comment on: http://stackoverflow.com/q/23233673
score: 0
type: Comment

http://stackoverflow.com/comment/35638847
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23283487
has text: Just want an ArrayList called List to get a string 101010101 per line instead of just '1' bit per line
score: 0

http://stackoverflow.com/q/23257093
accepted answer: http://stackoverflow.com/a/23257336
has body: [EDIT: I've rewritten the code to further simplify it and focus on the issue at hand] I'm working on this particular piece of code: class SimpleFactory { public SimpleFactory build() {return null} } class SimpleFactoryBuilder { public Object build(final Class builderClazz) { return new SimpleFactory() { @Override public SimpleFactory build() { return new builderClazz.newInstance(); } }; } } However, the builder in the return statement triggers the error "Cannot find symbol newInstance". It's as if builderClazz wasn't recognized as a class object. How can I make it work? EDIT: SOLUTION (thanks to dcharms!) The code above is a partial simplification of the code I was dealing with. The code below is still simplified but includes all the components involved and includes the solution provided by dcharms. package com.example.tests; interface IProduct {}; interface ISimpleFactory { public IProduct makeProduct(); } class ProductImpl implements IProduct { } class SimpleFactoryBuilder { public ISimpleFactory buildFactory(final Class productMakerClazz) { return new ISimpleFactory() { @Override public IProduct makeProduct() { try { // the following line works: thanks dcharms! return (IProduct) productMakerClazz.getConstructors()[0].newInstance(); // the following line -does not- work. // return new productMakerClazz.newInstance(); } catch (Exception e) { // simplified error handling: getConstructors() and newInstance() can throw 5 types of exceptions! return null; } } }; } } public class Main { public static void main(String[] args) { SimpleFactoryBuilder sfb = new SimpleFactoryBuilder(); ISimpleFactory sf = sfb.buildFactory(ProductImpl.class); IProduct product = sf.makeProduct(); } }
type: Question
has comment: http://stackoverflow.com/comment/35589459
has comment: http://stackoverflow.com/comment/35611149
has comment: http://stackoverflow.com/comment/35612344
has comment: http://stackoverflow.com/comment/35610402
has comment: http://stackoverflow.com/comment/35589395
tagged with: class
has comment: http://stackoverflow.com/comment/35611014
tagged with: symbols
answer count: 1
has title: Type symbol not found in inner class
has comment: http://stackoverflow.com/comment/35611096
tagged with: anonymous
has answer: http://stackoverflow.com/a/23257336
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35589547
score: 0
tagged with: java

http://stackoverflow.com/q/23223989
has comment: http://stackoverflow.com/comment/35529431
type: Question
has comment: http://stackoverflow.com/comment/35530271
score: 0
has comment: http://stackoverflow.com/comment/35530024
tagged with: traveling-salesman
has title: Travelling Salesman Brute Force Nearest Neighbour Algorithm, looping issues
answer count: 0
has comment: http://stackoverflow.com/comment/35529927
type: UnansweredQuestion
has body: Been fiddling around with my main method's looping for the last hour or so, to no avail. The issue is coming from Array Out of Bounding in both the values array and the identity matrix. Assume all other methods etc. are functional. public static void main(String args[]) { double adjacency_matrix[][] = new double[80][80]; double[] values = new double[160]; String[]contents = new String[160]; FileIO reader = new FileIO(); contents = reader.load("C:\\Users\\Mark\\Documents\\Java Workspace\\CS211\\src\\TSP\\locations.txt"); double temp1,temp2,temp3,temp4; int count = 0,count2 = 0; for(int i=0; i&lt;values.length; i++) { values[i] = Double.parseDouble(contents[i].substring(0,contents[i].length()-1)); } for(int i=0; i&lt;=79;i++) { for(int j=0; j&lt;=79; j++) { if(i == j) { adjacency_matrix[i][j] = 0.0; count2+=1; } else { temp1 = values[i+count]; temp2 = values[i + count + 1]; temp3 = values[j + count2]; temp4 = values[j +count2 + 1]; adjacency_matrix[i][j] = GPSDistanceHarversine.gpsDistance(temp1, temp2, temp3, temp4); count2+=1; } count+=1; count2 = 0; } } System.out.println("The cities are visited as follows:"); TspMain tspNearestNeighbour = new TspMain(); tspNearestNeighbour.tsp(adjacency_matrix); } The nested distance checking loop is causing the issues. Can anyone see what could be screwing up?
tagged with: algorithm
tagged with: java

http://stackoverflow.com/q/23157424
type: Question
has title: py4j - How would I go about on calling a python method in java
downvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/23170212
favorite count: 0
has comment: http://stackoverflow.com/comment/35434203
linked to: http://stackoverflow.com/q/14450173
tagged with: py4j
accepted answer: http://stackoverflow.com/a/23170212
type: AnsweredQuestion
tagged with: java
score: 10
upvote count: 10
has body: I've recently discovered py4j and was able to call static java methods from python. Now I want to call python methods from java. I couldn't find much documentation so this is the last place I can think of that might tell me if it's possible, and how.

http://stackoverflow.com/comment/35555970
type: Comment
type: QuestionComment
has text: where this `amazing` comes from ( amazing.split(" ") )
comment on: http://stackoverflow.com/q/23238716
score: 0

http://stackoverflow.com/a/23239889
answers question: http://stackoverflow.com/q/23239653
type: Answer
has comment: http://stackoverflow.com/comment/35558103
has body: Check out Spring MVC Test that was added to Spring in version 3.2. Here are some tutorials: 1, 2, 3
has comment: http://stackoverflow.com/comment/35559714
score: 0

http://stackoverflow.com/q/23272924
tagged with: gridpane
has comment: http://stackoverflow.com/comment/35699530
accepted answer: http://stackoverflow.com/a/23323167
type: AnsweredQuestion
has title: Dynamically add elements to a fixed-size GridPane in JavaFX
tagged with: java
tagged with: javafx
has answer: http://stackoverflow.com/a/23320691
has comment: http://stackoverflow.com/comment/35625398
has body: I would like to display a grid containing a various number of rectangles in JavaFX. It is important that this grid cannot be resized. I chose the GridPane layout. I dynamically add javafx.scene.shape.Rectangle to it. Here's how my grid looks like with 2 rows and 4 columns. Upon resizing, I would like it to keep the same overall shape, that is to say each Rectangle having the same size and keeping an horizontal and vertical gaps between my Rectangles. However, here's what I get with a 4x4 grid: The problems being: The last row and last column do not have the same size as the rest of the Rectangles. The gaps have disappeared. Here is my code responsible for refreshing the display: public void refreshConstraints() { getRowConstraints().clear(); getColumnConstraints().clear(); for (int i = 0; i &lt; nbRow; i++) { RowConstraints rConstraint = new RowConstraints(); // ((nbRow - 1) * 10 / nbRow) = takes gap into account (10% of height) rConstraint.setPercentHeight(100 / nbRow - ((nbRow - 1) * 10 / nbRow)); getRowConstraints().add(rConstraint); } for (int i = 0; i &lt; nbColumn; i++) { ColumnConstraints cConstraint = new ColumnConstraints(); cConstraint.setPercentWidth(100 / nbColumn - ((nbColumn - 1) * 10 / nbColumn)); getColumnConstraints().add(cConstraint); } } Using the setFillWidth and setHgrow yields no result either, the gap is kept between my Rectangles, but the Rectangles aren't resized and they overlap the rest of my GUI elements. EDIT: MCVE code: import javafx.application.Application; import javafx.application.Platform; import javafx.beans.value.ChangeListener; import javafx.beans.value.ObservableValue; import javafx.scene.Scene; import javafx.scene.control.Label; import javafx.scene.control.TextField; import javafx.scene.layout.BorderPane; import javafx.scene.layout.ColumnConstraints; import javafx.scene.layout.GridPane; import javafx.scene.layout.HBox; import javafx.scene.layout.RowConstraints; import javafx.scene.paint.Paint; import javafx.scene.shape.Rectangl…
type: Question
possible better answer: http://stackoverflow.com/a/23320691
upvote count: 5
has answer: http://stackoverflow.com/a/23323167
answer count: 2
score: 5
downvote count: 0
favorite count: 0

http://stackoverflow.com/comment/35637016
type: AnswerComment
score: 1
has text: @Anubian Noob : Both methods are better than iterating via a loop. Second can also be made faster using multiple cores at the same time. So in terms of performance, although it may not seem fast now, it is suitable for performance optimizations in future.
type: Comment
comment on: http://stackoverflow.com/a/23282340

gmail
type: Tag
tags question: http://stackoverflow.com/q/23243488
tags question: http://stackoverflow.com/q/23242934
tag name: gmail
tags question: http://stackoverflow.com/q/23146698

http://stackoverflow.com/q/23143905
has comment: http://stackoverflow.com/comment/35408431
tagged with: macos
has comment: http://stackoverflow.com/comment/35418172
favorite count: 0
tagged with: maven
has comment: http://stackoverflow.com/comment/35388467
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23823099
score: 3
has title: Maven 3.2.1 on Mac OSX 10.9.2 is incorrectly using JRE 7 and not JDK 7
upvote count: 3
tagged with: osx-mavericks
tagged with: java
accepted answer: http://stackoverflow.com/a/23823099
type: Question
possible better answer: http://stackoverflow.com/a/23693211
has answer: http://stackoverflow.com/a/23693211
has body: I have tried following the instructions at After Installing Java JDK 7 For Mac OS X - mvn -version still shows java version 1.6.0_31 but they do not fix my issue. :-( When I run: mvn clean install I get the following issue: [INFO] Scanning for projects... [INFO] [INFO] Using the builder org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder with a thread count of 1 [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building JBehave JUnit Runner 1.2.0-SNAPSHOT [INFO] ------------------------------------------------------------------------ [INFO] [INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ jbehave-junit-runner --- [INFO] Deleting /Users/skurlow/IdeaProjects/mygithubforks/jbehave-junit-runner/target [INFO] [INFO] --- maven-enforcer-plugin:1.0:enforce (enforce-maven) @ jbehave-junit-runner --- [INFO] [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ jbehave-junit-runner --- [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] skip non existing resourceDirectory /Users/skurlow/IdeaProjects/mygithubforks/jbehave-junit-runner/src/main/resources [INFO] [INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ jbehave-junit-runner --- [INFO] Changes detected - recompiling the module! [INFO] Compiling 5 source files to /Users/skurlow/IdeaProjects/mygithubforks/jbehave-junit-runner/target/classes [INFO] ------------------------------------------------------------- [ERROR] COMPILATION ERROR : [INFO] ------------------------------------------------------------- [ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK? [INFO] 1 error [INFO] ------------------------------------------------------------- [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 5.164 s [INFO] F…
has comment: http://stackoverflow.com/comment/35388192
answer count: 2
downvote count: 0

http://stackoverflow.com/a/23227239
answers question: http://stackoverflow.com/q/23227191
type: AcceptedAnswer
downvote count: 0
has body: The double literal 99.9999999999999 can be represented as a double which is less than 100, so the cast to int truncates the decimal part and 99 is the result. The double literal 99.999999999999999999999999999999999999999 has the closest actual value of 100, and casting to int is simply 100 here. System.out.println(99.9999999999999); System.out.println((int)(99.9999999999999)); System.out.println(99.9999999999999 == 100.0); System.out.println(99.999999999999999999999999999999999999999); System.out.println((int)(99.999999999999999999999999999999999999999)); System.out.println(99.999999999999999999999999999999999999999 == 100.0); I used 100.0 as a double literal here, to compare 2 double values to see if they are the exact same double value. This prints out: 99.9999999999999 99 false 100.0 100 true The JLS, Section 3.10.2 covers floating point literals: The details of proper input conversion from a Unicode string representation of a floating-point number to the internal IEEE 754 binary floating-point representation are described for the methods valueOf of class Float and class Double of the package java.lang. And Double.valueOf javadocs state: Otherwise, s is regarded as representing an exact decimal value in the usual "computerized scientific notation" or as an exact hexadecimal value; this exact numerical value is then conceptually converted to an "infinitely precise" binary value that is then rounded to type double by the usual round-to-nearest rule of IEEE 754 floating-point arithmetic, which includes preserving the sign of a zero value. (emphasis mine) That is, the value is rounded to produce the actual double value.
has comment: http://stackoverflow.com/comment/35535594
has comment: http://stackoverflow.com/comment/35535423
score: 5
type: Answer
has comment: http://stackoverflow.com/comment/35535780
has comment: http://stackoverflow.com/comment/35535965
has comment: http://stackoverflow.com/comment/35535268
has comment: http://stackoverflow.com/comment/35535250
upvote count: 5
accepted answer of: http://stackoverflow.com/q/23227191

http://stackoverflow.com/a/23222004
type: Answer
has comment: http://stackoverflow.com/comment/35526243
accepted answer of: http://stackoverflow.com/q/23221563
has comment: http://stackoverflow.com/comment/35526484
answers question: http://stackoverflow.com/q/23221563
has body: I don't think you can achieve this using the same layout XML file. Use 4 different layouts, and inflate it randomly. All your IDs will always work if you keep the same in each XML file. @Override public void onCreate(final Bundle bundle) { super.onCreate(bundle); setContentView(randomLayout()); RadioGroup rg = (RadioGroup) findViewById(R.id.radioGroup); // ... } public static int randomLayout() { final int n[] = { R.layout.layout1, R.layout.layout2, R.layout.layout3, R.layout.layout4 } Random random = new Random(); return n[random.nextInt(n.length)]; }
type: AcceptedAnswer
score: 0

http://stackoverflow.com/a/23289210
accepted answer of: http://stackoverflow.com/q/23289168
has comment: http://stackoverflow.com/comment/35648869
type: Answer
has body: Will this erase the stack and allocate new memory? Yes, older objects will be GCed if they don't have any live reference. Can we re-size the variable/object and re-dimension it this way? No, Java arrays can't grow dynamically. Their size are always fixed. If it's other object, you can change the state of the object. For Ex : ArrayList, You can change the size of a list after you create it. Probably just an additional question. If this is only allocating new memory and the old one taken care of by GC, is it ok to do the following: MyObject myobject = new MyObject(byte[20]) ... myobject= new MyObject(byte[10]); Yes, It's perfectly correct. You are re assigning a new object to a older reference myobject.
score: 7
upvote count: 7
answers question: http://stackoverflow.com/q/23289168
has comment: http://stackoverflow.com/comment/35648877
has comment: http://stackoverflow.com/comment/35649524
downvote count: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35649440
has comment: http://stackoverflow.com/comment/35648941

http://stackoverflow.com/comment/35622358
type: Comment
comment on: http://stackoverflow.com/a/23274957
type: AnswerComment
has text: dig into LruCache source to get better insight into how it does this, it seems the underpinnings are correct for your needs and you could perhaps roll your own LruCache implementation
score: 0

http://stackoverflow.com/comment/35373196
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23135722
has text: My main question is how to work out the list part? What would be the better to split the index in equal size and use them. For multithreading I am using Java's executor service with fixed thread pool.

http://stackoverflow.com/q/23232413
has body: I'm working on a project where I have a table in memory, for example: field1 field2 field3 field4 field5 somevalue somevalue somevalue somevalue somevalue somevalue somevalue somevalue somevalue somevalue . . . . v What is the best way to write a function that would allow a user to specify some non-predetermined permutation of fields by which to sort? (ex./ sort by field2, then field1, then field5). The best method I thought of so far is a recursive function, but it gets ugly pretty quick, especially with creating and managing 'subgroups' of rows within each column. Can somebody point me in a more efficient direction before I commit to this convoluted approach? By the way, my table is stored as a list of arrays.
score: 1
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/23232456
tagged with: sorting
accepted answer: http://stackoverflow.com/a/23232456
answer count: 1
downvote count: 0
favorite count: 0
has title: Most efficient way to sort by multiple fields in Java
upvote count: 1
tagged with: recursion
type: AnsweredQuestion
tagged with: list

http://stackoverflow.com/comment/35395583
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23148109
has text: Checked that page out. But in vain
score: 0

http://stackoverflow.com/comment/35634970
type: Comment
has text: Oh wait, now I get it! Thanks for all the help guys! You guys were very quick to answer my questions.
comment on: http://stackoverflow.com/a/23281162
score: 0
type: AnswerComment

http://stackoverflow.com/comment/35431390
type: QuestionComment
type: Comment
has text: @Perseids Thats what I will do with pointers in linked list in C.
comment on: http://stackoverflow.com/q/23168493
score: 0

http://stackoverflow.com/q/23213454
type: AnsweredQuestion
upvote count: 2
tagged with: java
has title: Usage of compiled XSL transformations
accepted answer: http://stackoverflow.com/a/23262375
tagged with: xslt
type: Question
has body: I am producing compiled .class files (Translet) from XSL transformation files with using TransformerFactory which is implemented by org.apache.xalan.xsltc.trax.TransformerFactoryImpl. Unfortunately, I couldn't find the way how to use these translet classes on XML transformation despite my searchings for hours. Is there any code example or reference documentation may you give? Because this document is insufficient and complicated. Thanks.
tagged with: transformation
answer count: 1
downvote count: 0
tagged with: compiled
favorite count: 0
has answer: http://stackoverflow.com/a/23262375
has comment: http://stackoverflow.com/comment/35548280
tagged with: http://stackoverflow.com/tag/xml
score: 2

http://stackoverflow.com/comment/35640982
type: Comment
has text: Do this step by step. Add System.out call into your mouseClicked() and check whether it's called. Then you will know the problem one of the 2 possible - 1) listener is not added/fired or 2) sort doesn't work. Then debug into the source one. You can post here SSCCE to let us check it
type: QuestionComment
comment on: http://stackoverflow.com/q/23283944
score: 0

http://stackoverflow.com/q/23196045
tagged with: java
accepted answer: http://stackoverflow.com/a/23196121
type: AnsweredQuestion
has body: the web service on opening on browser shows a popup box asking for username and password, how do i supply username and password via code to login and retrieve the html code. please suggest a way to on how to supply credentials . heres my code package com.test.connection; import java.io.BufferedInputStream; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.Writer; import java.net.Authenticator; import java.net.HttpURLConnection; import java.net.PasswordAuthentication; import java.net.URL; import java.io.BufferedWriter; import java.io.File; import java.io.FileWriter; import java.io.IOException; import org.apache.catalina.connector.InputBuffer; import org.apache.http.client.HttpClient; public class ReadWebSiteHtml { public static void main(String[] args) throws IOException { final String username="name"; final String password="pass"; URL url = new URL("https:/myservice/today"); //on entering google.com it retrives the html code from google.com since it does not require username and password, but how do i supply credentials to my web service?. Authenticator.setDefault(new Authenticator() { protected PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication(username, password.toCharArray()); } }); HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection(); try { BufferedReader in = new BufferedReader(new InputStreamReader(urlConnection.getInputStream())); /* InputStream in = new BufferedInputStream(urlConnection.getInputStream());*/ String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { response.append(inputLine); } WriteToFile(response); System.out.println(response); in.close(); } finally { urlConnection.disconnect(); } } public static void WriteToFile(StringBuffer response){ try { File file = new File("d://test//writtenfile//htmlFile.html"); if (!file.exists()) { file.createNewFile(); } F…
type: Question
tagged with: android
tagged with: basic-authentication
tagged with: client
has title: login using android app to a web service by supplying credentials
score: 0
tagged with: authentication
answer count: 1
has answer: http://stackoverflow.com/a/23196121

javassist
tags question: http://stackoverflow.com/q/23147241
tags question: http://stackoverflow.com/q/23157279
type: Tag
tags question: http://stackoverflow.com/q/23167148
tags question: http://stackoverflow.com/q/23195426
tag name: javassist

http://stackoverflow.com/q/23225068
downvote count: 0
answer count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/61976623
has comment: http://stackoverflow.com/comment/35537735
type: Question
has comment: http://stackoverflow.com/comment/35531328
upvote count: 1
has comment: http://stackoverflow.com/comment/61921929
favorite count: 0
type: UnansweredQuestion
has title: How to tell if Android screen lock setting is set to None
tagged with: android
tagged with: lockscreen
has body: I need check if the Screen Lock setting is set to "None" (or not). I am deploying an app that is being sent out to users on pre-configured tablets. This pre-configuration is done manually by the tablet supplier. One of the settings to pre-configure is to set the Screen lock to None (It would be a bad thing if the tablet reached the end user with the screen lock still enabled). The last thing that the person configuring the device does is to start the app, where they will be able to see a check list to confirm that the settings have been set accordingly in order to help avoid any missed/incorrect settings. The Screen Lock is the only setting that I have been unable to find a way to either read or set programmatically. The tablets are rooted and running 4.2.2. Assume that the end user is incapable of interacting in any way with the tablet - other than powering it on and reading the display.

http://stackoverflow.com/q/23239357
accepted answer: http://stackoverflow.com/a/23307935
tagged with: android
possible better answer: http://stackoverflow.com/a/23239585
has body: Android activities A which is a list activity , B is a detail information about list item A is calling B and send data Id and Category ListView lv = getListView(); lv.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) { // getting values from selected ListItem String newsid = ((TextView) view.findViewById(R.id.idTV)) .getText().toString(); Bundle bndl=new Bundle(); bndl.putString("id", newsid); bndl.putString("cat", "sport"); bndl.putString("prev", "SPORTPANEL"); Intent in = new Intent("com.contact.lebadagency.SINGLECONTACTACTIVITY"); //in.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); //in.putExtra("id", newsid); //in.putExtra("cat", "sport"); in.putExtras(bndl); startActivity(in); } }); and the second Activity B : Intent in=new Intent(); in=getIntent(); Bundle bundle = this.getIntent().getExtras(); String news = bundle.getString("id").toString(); String cat = bundle.getString("cat").toString(); When i install and run the application i click on any item on A activity and the correct data shown , the problem is that first selected data is stuck in Activity B , Stuck forever on the Activity B, i click on other items in list A and the old (first selected item) is stuck. I hope i describe my problem well, any help ?
type: AnsweredQuestion
tagged with: java
has title: Activity keep showing same data that first called
type: Question
has answer: http://stackoverflow.com/a/23239585
score: 0
answer count: 2
linked to: http://stackoverflow.com/q/8615417
has answer: http://stackoverflow.com/a/23307935

http://stackoverflow.com/comment/35368854
type: Comment
comment on: http://stackoverflow.com/a/23133504
has text: Thank you, but the problem remains the same.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/35606360
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23266605
has text: In `makeItSo`, why not set some boolean to indicate that it is running? Then check this boolean before calling the worker execute.

http://stackoverflow.com/a/23133196
type: Answer
has comment: http://stackoverflow.com/comment/70237469
has comment: http://stackoverflow.com/comment/70237118
has comment: http://stackoverflow.com/comment/70236988
score: 21
upvote count: 21
has comment: http://stackoverflow.com/comment/106722566
accepted answer of: http://stackoverflow.com/q/23132302
has comment: http://stackoverflow.com/comment/106722486
has comment: http://stackoverflow.com/comment/70236491
has comment: http://stackoverflow.com/comment/70237395
downvote count: 0
has body: Your MainController doesn't have a zero-argument constructor. If the FXMLLoader encounters a fx:controller attribute on the root element, it attempts to create an instance of that controller by (effectively) calling the zero-argument constructor of the class specified in the attribute. To fix this (the simplest way), remove the fx:controller attribute from the FXML file, and set the controller "by hand" on the FXMLLoader. You need to create an FXMLLoader instance instead of relying on the static load(...) method: FXMLLoader loader = new FXMLLoader(getClass().getResource("main.fxml")); loader.setController(new MainController(path)); Pane mainPane = loader.load();
has comment: http://stackoverflow.com/comment/106759653
has comment: http://stackoverflow.com/comment/70236685
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23132302
has comment: http://stackoverflow.com/comment/70237158

http://stackoverflow.com/a/23247513
has comment: http://stackoverflow.com/comment/35636303
answers question: http://stackoverflow.com/q/23204630
has comment: http://stackoverflow.com/comment/35666285
has body: This link gives you the full reference to all RESTConf Api's for ODL: OpenDaylight_Controller:MD-SAL:Model_Reference Another good place to start is here: OpenDaylight OpenFlow Plugin:User Guide For instance, if you want to find the topology you have to send a GET request to: http://:8080/restconf/operational/network-topology:network-topology/topology/flow:1/ So, the URN name space tells you what module/bundle in the ODL controller you want to talk to.. Another example is http://:8080/restconf/operational/opendaylight-inventory:nodes/node/openflow:1, which will give you information about the openflow node 'openflow:1'.. If you want to push something, such as openflow rules, just attach the XML body to the PUT together with headers Content-Type' : 'application/xml' and 'Accept':'application/xml. This is the 'lib' I have created in python for my application. You might find some inspiration. import sys import json import httplib2 #Base URLs for Config and operational baseUrl = 'http://192.168.231.246:8080' confUrl = baseUrl + '/restconf/config/' operUrl = baseUrl + '/restconf/operational/' #"Old" REST APIs that still are used sdSalUrl = baseUrl + '/controller/nb/v2/' #Specific REST URLs findNodes = operUrl + '/opendaylight-inventory:nodes/' findTopo = operUrl + '/network-topology:network-topology/' findNodeConnector = operUrl + '/opendaylight-inventory:nodes/node/node-connector/' findTopology = operUrl + '/network-topology:network-topology/topology/flow:1/' findFlow = confUrl +'/opendaylight-inventory:nodes/node/openflow:1/table/0/' h = httplib2.Http(".cache") h.add_credentials('admin', 'admin') #Functions for def get(url): resp, xml = h.request( url, method = "GET", headers = {'Content-Type' : 'application/xml'} ) return xml def put(url, body): resp, content = h.request( url, method = "PUT", body = body, headers = {'Content-Type' : 'application/xml', 'Accept':'application/xml'} ) return resp, content def delete(url): resp, content = h.request( url, method = "DELETE" ) …
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/35652472

http://stackoverflow.com/comment/35365636
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23131173
score: 0
has text: Would you please try model.addObject instead of model.addAttribute

http://stackoverflow.com/comment/35540021
has text: I want to use regex for it..and not substring and indexOf
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23229511
type: AnswerComment

http://stackoverflow.com/comment/35452410
score: 0
comment on: http://stackoverflow.com/q/23180478
has text: I'm not running my application on iOS, just connecting an iOS device to my PC.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23222970
favorite count: 0
upvote count: 2
has body: First of all I want to mention that I fully agree to only make the service layer transactional, but sometimes world is not perfect, and right now I´m in the middle of that situation. Basically I have been assigned into a wonderful project with a legacy code of 4+ years. The thing is that the developers did not follow any pattern where to introduce the bussines logic so you can image multiples services call from the controller and after that some extra call to private method into the controller. No budget to refactor, and we have many issues with ACID so the only solution that I found is make the controllers transactional and at least then have a full rollback if something in the middle of the request/response go wrong. The problem is that I cannot make it works. I will describe you my configuration to see if you can help me out guys. I have a DispatcherServlet that invoke webmvc-config.xml where I have the declaration of the controllers &lt;context:component-scan base-package="com.greenvalley.etendering.web.controller**" use-default-filters="false"&gt; &lt;context:include-filter expression="org.springframework.stereotype.Controller" type="annotation"/&gt; &lt;/context:component-scan&gt; Then the contextConfiguration invoke my applicationContext.xml where I have all the rest of my Spring configuration. After read so many tickets I tried many convination, for example try to declare again my controllers into the application context. &lt;tx:annotation-driven mode="aspectj"/&gt; I tried with proxy as well &lt;context:component-scan base-package="com.greenvalley.etendering.web.controller.*" /&gt; But still nothing. In the configuration of my txManager I dont do nothing fancy, just add the reference to the entityManagerFactory and that´s it &lt;tx:annotation-driven transaction-manager="transactionManager"/&gt; &lt;bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager"&gt; &lt;property name="entityManagerFactory" ref="entityManagerFactory"/&g…
type: UnansweredQuestion
tagged with: spring
tagged with: spring-mvc
has comment: http://stackoverflow.com/comment/35530051
answer count: 0
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/35527733
type: Question
has comment: http://stackoverflow.com/comment/35555293
tagged with: jpa
score: 2
has title: @Transactional in the controller
downvote count: 0
has comment: http://stackoverflow.com/comment/35527863

http://stackoverflow.com/comment/35651029
type: Comment
comment on: http://stackoverflow.com/a/23288963
score: 1
type: AnswerComment
has text: That's right, you need to write your own cross field validators which takes more than one field into consideration, as stated by user3551612. Regarding your issue with resetting the invalid data to their last valid state, you can either invoke discard() on your FieldGroup after a failed field validation to revert any changed value, or you discard() only the affected fields in your form.

http://stackoverflow.com/a/23205334
downvote count: 0
answers question: http://stackoverflow.com/q/23204195
type: Answer
upvote count: 1
score: 1
accepted answer of: http://stackoverflow.com/q/23204195
has body: Not sure if you've tried it, but the HTTP Client library has some logging settings you can enable. http://hc.apache.org/httpcomponents-client-4.3.x/logging.html
type: AcceptedAnswer

http://stackoverflow.com/q/23262432
has title: Getting IndexOutOfBoundsException while using CYaHPConverter.convertToPdf method
type: UnansweredQuestion
answer count: 0
score: 1
tagged with: java
upvote count: 1
type: Question
has body: I am using CYaHPConverter.convertToPdf for converting HTML pages in my application to PDF. I have a specific scenario where there is a JSP which includes another sub JSP in it. While trying to convert from HTML to PDF I get the following error. 12:39:27,837 ERROR [stderr] (http--127.0.0.1-8080-10) Caused by: org.allcolor.yahp.converter.IHtmlToPdfTransformer$CConvertException: ERROR: An unhandled exc eption occured: Index: 80, Size: 80 12:39:27,855 ERROR [stderr] (http--127.0.0.1-8080-10) at org.allcolor.yahp.cl.converter.CHtmlToPdfFlyingSaucerTransformer.transform(CHtmlToPdfFlyingSaucerT ransformer.java:791) 12:39:27,875 ERROR [stderr] (http--127.0.0.1-8080-10) at org.allcolor.yahp.converter.CYaHPConverter.convertToPdf(CYaHPConverter.java:247) 12:39:27,885 ERROR [stderr] (http--127.0.0.1-8080-10) at com.wf.gib.compliance.service.PdfGenerationService.htmlToPdfFile(PdfGenerationService.java:57) 12:39:27,896 ERROR [stderr] (http--127.0.0.1-8080-10) ... 60 more 12:39:27,907 ERROR [stderr] (http--127.0.0.1-8080-10) Caused by: java.lang.IndexOutOfBoundsException: Index: 80, Size: 80 12:39:27,916 ERROR [stderr] (http--127.0.0.1-8080-10) at java.util.ArrayList.RangeCheck(ArrayList.java:547) 12:39:27,926 ERROR [stderr] (http--127.0.0.1-8080-10) at java.util.ArrayList.get(ArrayList.java:322) 12:39:27,937 ERROR [stderr] (http--127.0.0.1-8080-10) at org.xhtmlrenderer.newtable.TableSectionBox.cellAt(TableSectionBox.java:102) 12:39:27,947 ERROR [stderr] (http--127.0.0.1-8080-10) at org.xhtmlrenderer.newtable.TableRowBox.calcRowHeight(TableRowBox.java:346) 12:39:27,957 ERROR [stderr] (http--127.0.0.1-8080-10) at org.xhtmlrenderer.newtable.TableRowBox.calcLayoutHeight(TableRowBox.java:312) 12:39:27,967 ERROR [stderr] (http--127.0.0.1-8080-10) at org.xhtmlrenderer.render.BlockBox.layout(BlockBox.java:829) 12:39:27,981 ERROR [stderr] (http--127.0.0.1-8080-10) at org.xhtmlrenderer.newtable.TableRowBox.layout(TableRowBox.java:88) 12:39:27,992 ERROR [stderr] (http--127.0.0.1-8080-10) at…
tagged with: indexoutofboundsexception
has comment: http://stackoverflow.com/comment/35598910
downvote count: 0
has comment: http://stackoverflow.com/comment/35600934
favorite count: 0

http://stackoverflow.com/comment/35606642
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23266397
type: Comment
has text: When you want it to arrive at the other end. What is the need for this question?

http://stackoverflow.com/comment/35433795
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23169886
has text: where to write the above two lines. in my case it will www.domain.com -> localhost/login
score: 0

http://stackoverflow.com/a/23288091
has comment: http://stackoverflow.com/comment/35649717
type: Answer
answers question: http://stackoverflow.com/q/23288039
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/35650049
has comment: http://stackoverflow.com/comment/35649418
has comment: http://stackoverflow.com/comment/35649747
upvote count: 2
has comment: http://stackoverflow.com/comment/35649883
has comment: http://stackoverflow.com/comment/35649531
has body: Match it against the following regex: controller(\w+)?\.jsp Demo

http://stackoverflow.com/a/23233848
type: Answer
has comment: http://stackoverflow.com/comment/35547497
accepted answer of: http://stackoverflow.com/q/23233130
answers question: http://stackoverflow.com/q/23233130
score: 0
has comment: http://stackoverflow.com/comment/35562038
type: AcceptedAnswer
has body: Statics are statics -- they are global to the process. So their value will last for the lifetime of the process, which is usually much longer than an individual activity instance. Source: https://groups.google.com/forum/#!topic/android-developers/PZXbCXliRbo

http://stackoverflow.com/a/23286593
answers question: http://stackoverflow.com/q/23285977
score: 0
type: Answer
has body: About the port, run Tomcat on 80 instead of 8080. Refer to this

http://stackoverflow.com/comment/35423735
type: Comment
type: QuestionComment
has text: It's not java, just an algorithm
score: 0
comment on: http://stackoverflow.com/q/23163926

http://stackoverflow.com/comment/35581000
type: QuestionComment
has text: @Joost: The original poster says that he wants to write a 2D game. Passing in the coordinates as vec2, and not applying a transformation, sounds perfectly fine for this case. I'd probably use 0.0 instead of -1.0 for the z-coordinate, but either one should work. Yes, need fragment shader, and the parts of the Java code that set up the vertex data.
score: 2
comment on: http://stackoverflow.com/q/23252513
type: Comment

http://stackoverflow.com/q/23147171
answer count: 2
has answer: http://stackoverflow.com/a/23147230
accepted answer: http://stackoverflow.com/a/23147230
has answer: http://stackoverflow.com/a/23147249
tagged with: blur
has body: Im trying to blur an image depending on a user input. If it is 1 then the blur image will average a 3X3 square and put it into the middle one. P P P All the pixels will be averaged and put into S. P S P P P P I think I have come up with a correct solution that takes into the edges but the image is turning completely black. Can anyone find a problem with this code or is it another problem? int range = blur_slider.getValue(); for (int x = 0; x &lt; source.getWidth(); x++) { for (int y = 0; y &lt; source.getHeight(); y++) { double red_sum = 0.0; double green_sum = 0.0; double blue_sum = 0.0; // finds the min x and y values and makes sure there are no out of bounds exceptions int x_range_min = x - range; if (x_range_min &lt; 0) { x_range_min = 0; } int x_range_max = x + range; if (x_range_max &gt;= new_frame.getWidth()) { x_range_max = new_frame.getWidth() - 1; } int y_range_min = y - range; if (y_range_min &lt; 0) { y_range_min = 0; } int y_range_max = y + range; if (y_range_max &gt;= new_frame.getHeight()) { y_range_max = new_frame.getHeight() - 1; } // averages the pixels within the min and max values and puts it into the pixel at the center. copy new frame is the frame that has previous // work done on it, it is used so that new blur pixels that are set do not affect later pixels. new_frame is the main frame that will be set. for (int k = x_range_min; k &lt; x_range_max; k++) { for (int j = y_range_min; j &lt; y_range_max; j++) { Pixel p = copy_new_frame.getPixel(x, y); red_sum += p.getRed(); green_sum += p.getGreen(); blue_sum += p.getBlue(); } } double num_pixels = x_range_max * y_range_max; ColorPixel tempPixel = new ColorPixel(red_sum / num_pixels, green_sum / num_pixels, blue_sum / num_pixels); new_frame.setPixel(x, y, tempPixel); } } frame_view.setFrame(new_frame);
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/23147249
type: Question
has title: Blur algorithm with RGB
tagged with: algorithm
tagged with: java
tagged with: rgb
tagged with: image
score: 0

http://stackoverflow.com/q/23224094
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/35529557
has body: I am getting exception thrown and i think it has to with the ArrayIndexOutOfBounds at the sub string and also do you think the below method would work for getting data passed to my array after parsing I want this to be read from a txt file like this, on each line: 1 0 1 0 0 1 0 ONE INTEGER PER LINE!! String fileName = "input.txt"; File file = new File(fileName); Scanner scanner = new Scanner(file); while(scanner.hasNextLine()){ data1 = scanner.nextLine(); } for ( int i = 0; i &lt; data1.length(); i++) { covertDataArray[i] = Byte.parseByte(data1.substring( i, i+1)); } This is previous working version but it reads from the console. where it would be : 1010101001 System.out.println("Enter the binary bits"); data1 = in.next(); for ( int i = 0; i &lt; data1.length(); i++) { covertDataArray[i] = Byte.parseByte(data1.substring( i, i+1)); }
accepted answer: http://stackoverflow.com/a/23224269
score: 0
tagged with: file-io
has comment: http://stackoverflow.com/comment/35529665
answer count: 1
has title: Reading from a file rather than from the console
has answer: http://stackoverflow.com/a/23224269
type: AnsweredQuestion

http://stackoverflow.com/a/23256690
score: 0
answers question: http://stackoverflow.com/q/23256590
has comment: http://stackoverflow.com/comment/35619067
type: Answer
has body: Right now you are checking if they are the exact same. So it will only return true if they are exactly the same, ie. 10.1 == 10.1.... however 10.1 != 10.2 Try using if(ballYPos-aBall.getRadius() &lt;= paddleXPos+width ) //checking for yPos-radius { return true; } However this seems like a clunky way to calculate it anyway. You are comparing the ball's Y value to the paddles X value.

http://stackoverflow.com/comment/35544091
has text: @MingtaoZhang I register a AbstractBinder. edit my question to add this details
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23231511
score: 0

http://stackoverflow.com/a/23232710
upvote count: 1
has body: Since you tagged this with CORBA, you could use the Event Service to broadcast a notice to all interested clients.
downvote count: 0
answers question: http://stackoverflow.com/q/23211610
type: Answer
score: 1

http://stackoverflow.com/q/23287769
answer count: 1
has answer: http://stackoverflow.com/a/23287868
has title: why is html content not displayed in email with attachments
tagged with: html-email
has body: I am using JavaMail to send E-mails with html content and attachments. But when sending an E-mail containing both html content and attachments, the html content is diplayed as plain text. I have set the Content-Type headers as text/html; charset=us-ascii but in the E-mail I receive, the Content-Type is shown as text/plain. Why is this happening? Here's my code: if(f!=null){ // f is an array containing the attachment file objects Multipart mp=new MimeMultipart("mixed"); BodyPart mbody=new MimeBodyPart(); mbody.setHeader("Content-Type", "text/html; charset=us-ascii"); mbody.setHeader("Content-Transfer-Encoding","7bit"); mbody.setText(content); mp.addBodyPart(mbody); for(File file:f){ BodyPart mbody2=new MimeBodyPart(); DataSource ds=new FileDataSource(file.getAbsolutePath()); mbody2.setDataHandler(new DataHandler(ds)); mbody2.setFileName(ds.getName()); System.out.println(ds.getName()); mbody2.setHeader("Content-Type", "multipart/mixed"); mp.addBodyPart(mbody2); } m.setContent(mp); //m.setHeader("Content-Type", "multipart/mixed"); //m.setHeader("Content-Transfer-Encoding","base64"); } else{ m.setContent(content,"text/html"); m.setHeader("Content-Type", "text/html; charset=us-ascii"); m.setHeader("Content-Transfer-Encoding","7bit"); } m.saveChanges(); If I uncomment m.setHeader("Content-Type", "multipart/mixed");, then the attachment(s) are displayed as noname without an extension and the content isn't present at all. If I send the E-mail without attachments, the html content is displayed properly. Thanks for any help.
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/23287868
type: Question
tagged with: email-attachments
score: 0
tagged with: jakarta-mail

http://stackoverflow.com/a/23259076
score: 0
answers question: http://stackoverflow.com/q/23258936
type: Answer
has body: The various add() methods that your TopTenList is inheriting from JFrame, and indirectly from java.awt.Container and java.awt.Component, do not provide for adding String objects, just other Component objects. I think maybe you instead want a javax.swing.JList with a javax.swing.DefaultListModel, as the DefaultListModel.add() method would take the parameters you want.

http://stackoverflow.com/comment/35547066
type: QuestionComment
type: Comment
has text: If only allowed modifier is `final`, that suggests to me that you're inside a method when you declare this method. Check the curly-braces before this code.
comment on: http://stackoverflow.com/q/23233688
score: 0

http://stackoverflow.com/q/23272683
linked to: http://stackoverflow.com/q/15571608
answer count: 3
has answer: http://stackoverflow.com/a/23272766
tagged with: generics
possible better answer: http://stackoverflow.com/a/23272741
has body: I've been trying to create a generic DAO by following this: http://www.ibm.com/developerworks/java/library/j-genericdao/index.html I'm stuck on the actual use of it, though. There's a line that looks like this: GenericDao dao = (GenericDao); I don't understand what is going on here, mostly on the right-hand side of the equation. Eclipse is giving me two markers on this line: GenericDao is a raw type and should be parameterized. (This is on the GenericDao on the left) GenericDao cannot be resolved to a variable. (This on the GenericDao on the right) I've never seen a class/interface name in parentheses all by itself on the right side of an assignment, so I'm not sure what to make of it. An explanation of what is going on in this line so that I can figure out what I should be doing with it to make it work would be very much appreciated. (Using Eclipse Kepler, Hibernate 4.3.5, Spring IDE 3.5, M2E 1.4.1 if any of that makes any difference)
has comment: http://stackoverflow.com/comment/35618277
tagged with: spring
has comment: http://stackoverflow.com/comment/35618440
downvote count: 1
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: hibernate
has title: Don't repeat the DAO! Using the generic DAO
type: Question
upvote count: 2
has answer: http://stackoverflow.com/a/23272741
has comment: http://stackoverflow.com/comment/35617868
accepted answer: http://stackoverflow.com/a/23272766
has comment: http://stackoverflow.com/comment/35672504
has comment: http://stackoverflow.com/comment/35618310
favorite count: 0
has comment: http://stackoverflow.com/comment/35672631
has answer: http://stackoverflow.com/a/23272754
has comment: http://stackoverflow.com/comment/35617765

http://stackoverflow.com/a/23263230
type: Answer
upvote count: 0
score: -1
answers question: http://stackoverflow.com/q/23263139
has body: You can have a look at the setAutoCommit() method of the Connection class. More details here
downvote count: 1
has comment: http://stackoverflow.com/comment/35603193

http://stackoverflow.com/comment/128276117
has text: TO_NUMBER() gave invalid sql statement error
comment on: http://stackoverflow.com/a/64904251
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/23197905
has title: keytool: import certificate chain from several .cer files
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23417911
upvote count: 2
downvote count: 1
type: Question
tagged with: java
tagged with: certificate
tagged with: ssl
has body: Our IT dept gave me 4 .cer files, that constitute certificate chain: thawte_root.cer->intermediate1_pem.cer->intermediate2_pem.cer->our_company.cer. I need to sign some code (via jarsigner) using our_company.cer. Therefore, I have to create a keystore, containing our_company.cer and the chain-to-the-root. I've tried to simply concatenate these 4 files into one using notepad and then import the resulting file, but keystore imports only the first one and when I try to launch jarsigner, I get "jarsigner: Certificate chain not found for: our_company. our_company must reference a valid KeyStore key entry containing a private key and corresponding public key certificate chain." I get the same message when I import only our_company.cer or when I import each certificate one-by-one. So the question is: how can I import 4 certificates as one chain? Thanks in advance. Vitaly.
answer count: 2
score: 1
tagged with: keytool
favorite count: 0
has answer: http://stackoverflow.com/a/41676117

http://stackoverflow.com/a/23174327
type: AcceptedAnswer
downvote count: 0
has body: Just use the modulo operator (%): for (int i = 1; i &lt;= 366; i++) { System.out.format("%s:%d%n", days[(i - 1) % days.length], i); }
score: 4
type: Answer
accepted answer of: http://stackoverflow.com/q/23174304
has comment: http://stackoverflow.com/comment/35441650
answers question: http://stackoverflow.com/q/23174304
upvote count: 4

http://stackoverflow.com/q/23179604
type: Question
has answer: http://stackoverflow.com/a/23179651
score: 1
tagged with: java
has body: String sql = "INSERT INTO Student_Info(name,roll_no,address,phone_no) VALUES('101', 1, 'Fatma', '25')"; String sql = "insert into Student_Info(name,roll_no,address,phone_no) VALUES("+student.getName()+","+student.getRoll_no()+","+student.getAddress()+","+student.getPhone_no()+")"; the last query shows an error: java.sql.SQLException: ORA-00917: missing comma at statement.executeUpdate(sql); Can anyone rule out where am I missing the comma?
answer count: 3
has comment: http://stackoverflow.com/comment/35450868
has answer: http://stackoverflow.com/a/23179686
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/35450864
tagged with: jdbc
type: UnansweredQuestion
upvote count: 1
has answer: http://stackoverflow.com/a/23179629
has title: Oracle query inside java

http://stackoverflow.com/q/23208112
answer count: 1
score: 0
has answer: http://stackoverflow.com/a/23212131
tagged with: trigonometry
has body: I am trying to calculate 4 points of a square in three dimensional space that is perpendicular to a line formed by two given points. This square must be: Perpendicular to the line defined by two given points Of thickness (or width/length) 1 aligned so that two sides are always perpendicular to the Y axis I have tried coding this myself, and i somewhat succeeded, but it is not exactly what i wanted. Here is a code snippet of what i have: Note: Vert is a class that stores a coordinate in 3 variables, x, y, and z. FourVert is a class that stores 4 Verts, and the constructor is what i am trying to develop. The two Vert parameters are the given points, and the float t is the thickness or separation required between the output 4 points. Add is a function that add the given Vert's coordinate value as an offset to all 4 points of the FourVert. This is only used to reposition the points on the right place, the first Vert. I might have weird naming conventions, but i write it in a way that i understand it. EDIT: Added comments as requested public FourVert(Vert V1, Vert V2, float t) { float dx = V2.x - V1.x; //Position our points at the origin to convert into float dy = V2.y - V1.y; //polar coordinates using Math.atan2(); float dz = V2.z - V1.z; float d = (float) Math.sqrt(dx*dx+dz*dz); //Get the lateral distance to use float axz = (float) -Math.atan2(dx, dz); //in relation with the y value to float ady = (float) Math.atan2(d, dy); //calculate the altitude angle float px = (float) (Math.cos(axz) * t); float py = (float) (Math.cos(ady + 1.570796327) * t); //add half PI float ny = (float) (Math.cos(ady - 1.570796327) * t); float pz = (float) (Math.sin(axz) * t); v1 = new Vert(px, py, pz); //Use the calculated values to produce 4 points v2 = new Vert(-px, py, -pz); //v1, v2, v3, and v4 are our Vert fields of the v3 = new Vert(-px, ny, -pz); //FourVert class v4 = new Vert(px, ny, pz); add(V1); //take our FourVert back to where we want it, not on the origin. } I already have the re…
favorite count: 0
tagged with: geometry
upvote count: 1
tagged with: line
downvote count: 1
accepted answer: http://stackoverflow.com/a/23212131
type: AnsweredQuestion
has title: Calculate 4 points of a square based on 2 points of a line
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/35502302
tagged with: point
has comment: http://stackoverflow.com/comment/35501529

http://stackoverflow.com/q/23167816
downvote count: 0
has title: NetBeans and OpenOffice open plugin
score: 1
tagged with: ubuntu
favorite count: 0
possible better answer: http://stackoverflow.com/a/23611774
type: Question
tagged with: plugins
tagged with: libreoffice
tagged with: netbeans
has answer: http://stackoverflow.com/a/27100013
has body: I use NetBeans 8.0 and trying to install open office extension to develope plugin for LibreOffice I take plugin from this url: http://people.apache.org/~cmarcum/devtools/ But the only version i can install is 3.0.0 alfa all other give that error https://i.sstatic.net/vuwB4.png
answer count: 2
upvote count: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/27100013
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23611774

http://stackoverflow.com/q/23266614
has answer: http://stackoverflow.com/a/23271742
tagged with: jdbc
tagged with: azure-sql-database
has body: Hibernate connection works well with local postgresql and it automatically creates tables, but when we want to use Azure SQL Server (Microsoft SQL Server) and we change driver name etc., we didn't get any error but it didn't work. (didn't create tables) jdbc.driverClassName=com.microsoft.sqlserver.jdbc.SQLServerDriver jdbc.databaseurl=jdbc:sqlserver://xxxx.database.windows.net:1433;database=xxxx jdbc.password=xxxx jdbc.user=xxx@xxxx jdbc.encrypt=true jdbc.hostNameInCertificate=*.database.windows.net jdbc.loginTimeout=30; jdbc.dialect=org.hibernate.dialect.SQLServerDialect com.xxx.entity ${jdbc.dialect} 5 20 60 100
upvote count: 3
tagged with: java
tagged with: hibernate
type: Question
score: 3
answer count: 2
tagged with: azure
downvote count: 0
has title: Connecting to Azure SQL Server using Hibernate JDBC connection
has comment: http://stackoverflow.com/comment/59007574
has answer: http://stackoverflow.com/a/35655343
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/q/23183829
answer count: 1
has comment: http://stackoverflow.com/comment/35804239
has comment: http://stackoverflow.com/comment/38576447
favorite count: 0
tagged with: linux
has title: Interpret /dev/input/mice in Java
tagged with: mouse
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
linked to: http://stackoverflow.com/q/11451618
has comment: http://stackoverflow.com/comment/35804486
type: Question
tagged with: raspberry-pi
linked to: http://stackoverflow.com/q/15882665
has body: I'm currently attempting to write a program that needs to read /dev/input/mice in order to gain mouse input. My only problem is that when I read from /dev/input/mice all I get is gibberish. Online (Google), I found very few helpful webpages. I've attempted to use OD's output, but thats even worse than just trying to read from the file. I've attempted to use third-party libraries, but as I am working with an ARM architecture, many libraries will not run or compile. Does anyone know what format this data is in, and how to parse this data into understandable data. Libraries I've tried to Use: https://code.google.com/p/jnativehook/ (Won't recompile on ARM) http://sdljava.sourceforge.net/ (Can't even get this one to compile x86!) EDIT: I'm using a raspberry pi, with no X server installed. (NO AWT)
has comment: http://stackoverflow.com/comment/35699885
has answer: http://stackoverflow.com/a/23374164
accepted answer: http://stackoverflow.com/a/23374164
upvote count: 1

http://stackoverflow.com/q/23284484
tagged with: java
has answer: http://stackoverflow.com/a/23289354
accepted answer: http://stackoverflow.com/a/23289354
tagged with: geolocation
possible better answer: http://stackoverflow.com/a/23428911
tagged with: servlets
type: Question
has answer: http://stackoverflow.com/a/23428911
upvote count: 2
answer count: 2
has body: 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 javaQuery.importClass.javaQueryBundle; import javaQuery.j2ee.GeoLocation; /** * Servlet implementation class IP */ public class IP extends HttpServlet { private static final long serialVersionUID = 1L; /** * @see HttpServlet#HttpServlet() */ public IP() { super(); // TODO Auto-generated constructor stub } /** * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub String ipAddress = request.getRemoteAddr(); System.out.println(ipAddress); response.setContentType("text/html;charset=UTF-8"); PrintWriter out = response.getWriter(); //Print out the IP address of the caller out.println(request.getRemoteAddr()); GeoLocation $gl = javaQueryBundle.createGeoLocation(); System.out.println(ipAddress); $gl.MAPTargetByIP(ipAddress, "test"); System.out.println($gl.Latitude); System.out.println($gl.Longitude); System.out.println($gl.Country); System.out.println($gl.City); System.out.println($gl.State); System.out.println($gl.GoogleMap_URL); System.out.println($gl.GoogleMap_URL_Bubble); } /** * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) */ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub } } This is my code snippest.I am getting IP address of visitor but not location information. It gives : java.net.SocketException: Connection reset at java.net.SocketInputStream.read(Unknown Source) at java.net.SocketInputStream.read(Unknown Source)
has comment: http://stackoverflow.com/comment/35647305
has comment: http://stackoverflow.com/comment/35648810
favorite count: 0
score: 2
downvote count: 0
tagged with: javaquery
has title: I am trying to get location information from ip address in JAVA but I am getting a java.net.SocketException: Connection reset error
tagged with: sockets
has comment: http://stackoverflow.com/comment/35642248
type: AnsweredQuestion

http://stackoverflow.com/comment/35495818
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23204874
has text: In your paintComponent method, do you call the super method, and then call this private draw method? Also, can you just use the transform method instead? To use that method, you would create a new Graphics object from g.Create(), then with that new object call transform, then draw your line, and call dispose on it. It leaves the Graphics object used by the rest of Swing alone.

http://stackoverflow.com/q/23227084
has comment: http://stackoverflow.com/comment/35536831
has comment: http://stackoverflow.com/comment/35536496
upvote count: 4
downvote count: 4
answer count: 3
has comment: http://stackoverflow.com/comment/35536839
has comment: http://stackoverflow.com/comment/35535207
favorite count: 0
has answer: http://stackoverflow.com/a/23227372
has answer: http://stackoverflow.com/a/23227761
has answer: http://stackoverflow.com/a/23228733
has comment: http://stackoverflow.com/comment/35535249
possible better answer: http://stackoverflow.com/a/23227372
type: AnsweredQuestion
tagged with: biginteger
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/35535119
type: Question
has title: Can't Generate Large Prime Numbers
has body: I'm trying to generate large prime numbers in Java. I use BigIntegers for this. Here is my code to generate and store 10 prime numbers inside an array. public static void primeGenerator() { BigInteger[] primeList = new BigInteger[10]; BigInteger startLine = new BigInteger("10"); int startPower = 6; BigInteger endLine = new BigInteger("10"); int endPower = 9; int j = 0; for (BigInteger i = fastExp(startLine,startPower); i.compareTo(fastExp(endLine,endPower)) &lt;= 0; i = i.add(BigInteger.ONE)) { if (checkPrimeFermat(i) == true &amp;&amp; j &lt; 10) { primeList[j] = i; j++; } } System.out.println(primeList[0]); System.out.println(primeList[1]); System.out.println(primeList[2]); System.out.println(primeList[3]); System.out.println(primeList[4]); System.out.println(primeList[5]); System.out.println(primeList[6]); System.out.println(primeList[7]); System.out.println(primeList[8]); System.out.println(primeList[9]); } I wrote my own fastExp function to generate numbers faster. Here are my other functions. public static BigInteger getRandomFermatBase(BigInteger n) { Random rand = new Random(); while (true) { BigInteger a = new BigInteger (n.bitLength(), rand); if (BigInteger.ONE.compareTo(a) &lt;= 0 &amp;&amp; a.compareTo(n) &lt; 0) { return a; } } } public static boolean checkPrimeFermat(BigInteger n) { if (n.equals(BigInteger.ONE)) return false; for (int i = 0; i &lt; 10; i++) { BigInteger a = getRandomFermatBase(n); a = a.modPow(n.subtract(BigInteger.ONE), n); if (!a.equals(BigInteger.ONE)) return false; } return true; } public static void main(String[] args) throws IOException { primeGenerator(); } public static BigInteger fastExp (BigInteger x, int n){ BigInteger result=x; int pow2=powof2leN(n); int residue= n-pow2; for(int i=1; i&lt;pow2 ; i=i*2){ result=result.multiply(result); } for(int i=0 ; i&lt;residue; i++){ result=result.multiply(x); } return result; } private static int powof2leN(int n) { for(int i=1; i&lt;=n; i=i*2){ if(i*2&gt;2) return 1; } return 0; } } So …
accepted answer: http://stackoverflow.com/a/23228733
linked to: http://stackoverflow.com/q/4027225

http://stackoverflow.com/q/23284855
accepted answer: http://stackoverflow.com/a/23918277
score: 0
answer count: 1
tagged with: redis
tagged with: spring
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23918277
tagged with: java
tagged with: jedis
type: Question
has title: How to access multiple remote redis with JedisConnectionFactory?
has body: I made a manager/Service Server system. Manager server collects data from database and send that data to multiple Service servers. My code works nice when I have only 1 server. My configuration like below.(root-context.xml) &lt;bean id="connectionFactory" class="org.springframework.data.redis.connection.jedis.JedisConnectionFactory"&gt; &lt;property name="hostName" value="127.0.0.1"/&gt; &lt;property name="port" value="6379"/&gt; &lt;/bean&gt; The Problem is Service servers should be multiple. Is there any way to set multiple connection list with spring configurations? Thanks:D P.S I know the way to use JedisHelper.java which can be found easily in github. However, what I want to do is figure this out in spring root-context.xml.
tagged with: configuration

http://stackoverflow.com/comment/35603939
comment on: http://stackoverflow.com/a/23265049
type: AnswerComment
score: 0
type: Comment
has text: what about primitive arrays e.g. int[] ?

http://stackoverflow.com/q/23212509
score: -1
has body: &lt;script&gt; $(document).ready(function(){ $("#button").click(function(){ if(diff1&gt;31) { alert("You can't extend more than one month"); } else { var jspcall = "thnks.jsp"; window.location.href = jspcall; } }); }); &lt;/script&gt; And here is my jsp code Date date=edate; System.out.println("extend date" + date); java.sql.Date content = new java.sql.Date(date.getTime()); java.util.Date exp_date = new java.util.Date(content.getTime()); java.util.Date cur_date = new java.util.Date(); System.out.println(cur_date); long diff= exp_date.getTime() - cur_date.getTime(); long diff1=diff/(24 * 60 * 60 * 1000); %&gt; &lt;li&gt; &lt;button class="submit"&gt; submit &lt;/button&gt; This all in same jsp page. Any other suggestion apart from this?
has answer: http://stackoverflow.com/a/23212635
tagged with: java
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/35514728
tagged with: javascript
linked to: http://stackoverflow.com/q/10488367
duplicate of: http://stackoverflow.com/q/10488367
upvote count: 0
has title: Call a java value in javascript which is in jsp page
has comment: http://stackoverflow.com/comment/35508988
answer count: 1
tagged with: jsp
favorite count: 0
has comment: http://stackoverflow.com/comment/35511159
type: UnansweredQuestion

http://stackoverflow.com/comment/35424965
type: AnswerComment
type: Comment
score: 0
comment on: http://stackoverflow.com/a/23164304
has text: thanks I cant believe i for that the initialize it. also Now im just getting java.lang.ArrayIndexOutOfBoundsException. if(numbers2[i] > numbers2[j + 1])

http://stackoverflow.com/comment/35682977
comment on: http://stackoverflow.com/q/23278447
has text: @devnull and everyone here I am announcing that I will be going back with Yahoo answers cos it's way better!! I am sick of loosing reputation and then gaining some and then loosing some again! Everyone is so mean!
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/23225243
tagged with: jlist
tagged with: compression
tagged with: swing
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/35531538
tagged with: image
type: Question
has body: I am creating an image viewing application where I am displaying all images from a selected folder in a jlist. So they will be displayed in a line and then as a user goes through the list the image is displayed on another jlabel in the same window. The problem is that it's working well for small images but for wallpapers and other folders with large images, I get a Java heap exception. What is the best way to solve this? public void loadImages(File directory) throws IOException, URISyntaxException { File[] imageFiles = directory.listFiles(); model.removeAllElements(); for (int ii=0; ii&lt;imageFiles.length; ii++) { model.addElement(ImageIO.read(imageFiles[ii])); } }
answer count: 1
has answer: http://stackoverflow.com/a/23225382
accepted answer: http://stackoverflow.com/a/23225382
has title: Using a JList to display images for an Image Viewer
score: 0

http://stackoverflow.com/comment/35603169
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/23263877
type: Comment
has text: A comment to your check logic: at the end, it should say `if (!accessible) field.setAccessible(false)` to revert to the former state.

http://stackoverflow.com/q/23155157
has answer: http://stackoverflow.com/a/23157178
has body: My document structure is like this { "_id" : { "Owner" : 651668690, "WeekOfTheYear" : 2 }, "calldetails" : { "426743784" : { "TotalDuration" : 204, "count" : 4 }, "752982293" : { "TotalDuration" : 206, "count" : 6 } }, "totalDuration" : 410, "totalcalls" : 10, "totaluniquecallers" : 0 } I would like to increment the totaluniquecallers field only when there is new sub document is created inside calldetails. I am using mongodb java driver and upsert is enabled. my query looks this BasicDBObject Query = new BasicDBObject(); Query.put("_id.Owner", id); Query.put("_id.WeekOfTheYear", week); //update BasicDBObject update = new BasicDBObject(); BasicDBObject incrementFields = new BasicDBObject(); incrementFields.put("totalDuration", logdetails.getInt("duration")); incrementFields.put("totalcalls",1); incrementFields.put("calldetails."+logdetails.get("Phonenumber")+".TotalDuration",logdetails.getInt("duration")); incrementFields.put("calldetails."+logdetails.get("Phonenumber")+".count",1); update.put("$inc", incrementFields); WriteResult result1 = collection3.update(Query, update, true, false); I tried $addToSet or $set but it seems increment is not allowed inside that.So can any one please help me in this use case where i basically need a count of subdocuments inside a document or count of total documents inside "calldetails" field; Please note: I am trying to do preagregation hence I upsert/update every time iIinsert a new record. so i need the "totaluniquecallers" field to be incremented every time when there is new entry created inside "calldetails" document
has title: Incrementing a counter on insertion of embedded document MONGODB
tagged with: java
has comment: http://stackoverflow.com/comment/35407514
type: Question
tagged with: mongodb
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/35407216
type: UnansweredQuestion
tagged with: aggregation-framework

http://stackoverflow.com/comment/35429081
score: 0
type: AnswerComment
has text: so, what i have to do. please elaborate it .
type: Comment
comment on: http://stackoverflow.com/a/23167111

http://stackoverflow.com/comment/83313357
score: 0
comment on: http://stackoverflow.com/a/23184418
has text: I had 1 and 2 above in place. The only change I made was the Java facet version and that seems to have done it for me. The Dynamic Web Module seemed to be taking over from Maven so I left it out. All good now, thanks.
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/35574689
type: Comment
has text: @Volodia, you use dialog.getRootPane() and add the Key Bindings to the root pane.
type: AnswerComment
comment on: http://stackoverflow.com/a/23228055
score: 0

http://stackoverflow.com/comment/35540444
comment on: http://stackoverflow.com/a/23229163
score: 0
type: AnswerComment
has text: put this way... this is only the first question of the exam and there are more 13 to follow.....LOL
type: Comment

http://stackoverflow.com/q/23228593
score: 0
tagged with: windows
answer count: 1
tagged with: linux
has title: How to use Runtime.getRuntime().exec(command) in windows?
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23229021
has comment: http://stackoverflow.com/comment/35544427
tagged with: java
type: Question
has body: How to use Runtime.getRuntime().exec(command) in windows? 1. command = "cat data.json"; // works in linux terminal Runtime.getRuntime().exec(command) // runs in linux =&gt; Runs OK 2. command = "type data.json"; // works in windows cmd Runtime.getRuntime().exec(command) // runs in windows =&gt; Fails to run 3. command = "cmd /C type data.json"; // works in windows cmd Runtime.getRuntime().exec(command) // runs in windows =&gt; Runs OK BufferedReader input = new BufferedReader(new InputStreamReader(p.getInputStream())); // Output is empty In the third scenario, the output from input.readLine() is empty, but if I use command "type data.json" in cmd, it'll print the json the same way it would on linux with "cat data.json". I'm confused to what is going on? I'd like to run the COMMAND on both windows and linux. Any help is appreciated! Thanks!

permissions
tag name: permissions
tags question: http://stackoverflow.com/q/23159295
tags question: http://stackoverflow.com/q/23139213
type: Tag
tags question: http://stackoverflow.com/q/23210056
tags question: http://stackoverflow.com/q/23244593
tags question: http://stackoverflow.com/q/23268339

http://stackoverflow.com/comment/35389164
type: Comment
type: QuestionComment
has text: @AlexBcn, I've done that but this error still displays.
comment on: http://stackoverflow.com/q/23140265
score: 0

sensors
type: Tag
tags question: http://stackoverflow.com/q/23167879
tag name: sensors

http://stackoverflow.com/q/23281130
has body: I'm still learning the basics of Java so please bear with me. I'm creating a simple soccer simulator game, right now I'm trying to populate the game with players from different countries. I've created a for loop to go through an array of the instantiated object for players but I keep getting a null pointer exception. Here is my code: public static void main(String[] args) { SoccerPlayers[] newPlayer = new SoccerPlayers[5]; for (int i = 0; i &lt; newPlayer.length; i++){ newPlayer[i].PlayerCountry(); newPlayer[i].PlayerPosition(); newPlayer[i].PlayerName(); newPlayer[i].PlayerAge(); newPlayer[i].PrintSoccerPlayer(); } } I don't know if it's the way I did my for loop or the way the other class handles the method since it's pointing to the first method used. Here is a sample of the method from the other class. public class SoccerPlayers extends SoccerMain { public String playerContinent = ""; public String playerPosition = ""; public String playerCountry = ""; public String playerFirstName = ""; public String playerLastName = ""; public String playerName = ""; public int playerAge = 0; public void PlayerCountry(){ int continent = randomNum.nextInt(6) + 1; int country = 0; if (continent == 1){ playerContinent = "North America"; }else if (continent == 2){ playerContinent = "South America"; }else if (continent == 3){ playerContinent = "Europe"; }else if (continent == 4){ playerContinent = "Africa"; }else if (continent == 5){ playerContinent = "Asia"; }else{ playerContinent = "Oceanica"; } if (playerContinent == "North America"){ country = randomNum.nextInt(100) + 1; if (country &gt; 0 &amp;&amp; country &lt; 11){ playerCountry = "Canada";
score: 0
tagged with: nullpointerexception
has comment: http://stackoverflow.com/comment/35634246
has title: How to properly use a for loop with object instances - I keep getting null pointer exception (Java)
tagged with: instance-variables
has answer: http://stackoverflow.com/a/23281162
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/23281169
tagged with: java
has answer: http://stackoverflow.com/a/23281169
has comment: http://stackoverflow.com/comment/35634308
accepted answer: http://stackoverflow.com/a/23281162
type: Question
answer count: 2

http://stackoverflow.com/comment/35424651
has text: Also, as @tjg184 says, it is a good idea to get into the habit of closing streams in finally blocks anyway.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/23164626
type: Comment

http://stackoverflow.com/comment/35497876
score: 0
has text: I need to project each point from 105d to 3d, for example. That's the part I don't know how to do id. Then I want plot the projected points.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23206047

http://stackoverflow.com/a/23234352
score: 1
type: Answer
upvote count: 1
has body: The instance of button1 you are comparing with is not the instance of button1 which triggered the event... Basically, you are shadowing your variables... // Declare instance variable here... private JButton button1; public test() { //... // Redeclared as local variable here JButton button1 = new JButton("Click me PLEASE!"); If you add... System.out.println("button1 = " + button1); to you Listener1, you will find that it is null Remove the local declaration... button1 = new JButton("Click me PLEASE!");
has comment: http://stackoverflow.com/comment/35548246
has comment: http://stackoverflow.com/comment/35548267
has comment: http://stackoverflow.com/comment/35548416
accepted answer of: http://stackoverflow.com/q/23234322
answers question: http://stackoverflow.com/q/23234322
has comment: http://stackoverflow.com/comment/35548330
downvote count: 0
has comment: http://stackoverflow.com/comment/35548215
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35548251

http://stackoverflow.com/a/23134787
has body: I'm guessing this is some kind of homework, so here's some pseudo code: int[] result = new int[no. columns] for (i = 1 to number of columns) { int sum = 0; for (j = 1 to number of rows) { sum += data[column, row] } result[i] = sum }
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23134544

http://stackoverflow.com/comment/35620722
comment on: http://stackoverflow.com/a/23273377
has text: changing the selected item box is my priority. The other would be nice to have but not very important.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/23143267
type: Answer
has comment: http://stackoverflow.com/comment/35387523
upvote count: 0
has body: First, be careful interpreting log files. Whatever prints the log files might insert escape sequences. While parsing a string in a JSON document, \n will be replaced with a newline character. \n is perfectly legal though: The \ character will be replaced with a single \, and then you just have an ordinary n. So instead of a string with a newline character, you get a string with a backslash character followed by an n character delivered by the parser. The parser shouldn't have any problems with that. In your l4j2Logger.warn, you use two strings containing newline characters. It seems that in the JSON document, "message" has a string value that represents the first argument. The "throwable" value seems has a string value that represents source code. The line in your log file is: "throwable":"java.lang.Exception: ex1...\\n...ex2\\n\tat test.Test.log(Test.java:73)\\n\tat......" This will be parsed as the string java.lang.Exception: ex1...\n...ex2\n at test.Test.log(Test.java:73)\n at......" I'd check what tools read these log files; this seems to be intended.
has comment: http://stackoverflow.com/comment/35387471
score: -1
downvote count: 1
answers question: http://stackoverflow.com/q/23142915

http://stackoverflow.com/q/23284259
has answer: http://stackoverflow.com/a/23284330
has title: External files into 2d arrays
tagged with: arrays
answer count: 1
has comment: http://stackoverflow.com/comment/35639978
has comment: http://stackoverflow.com/comment/35639958
score: 0
favorite count: 0
type: UnansweredQuestion
upvote count: 1
downvote count: 1
linked to: http://stackoverflow.com/q/13500432
tagged with: java
type: Question
has body: So I've been researching on how to place an external file into a 2d array using a scanner. However, I don't really understand how to make it work and I was hoping I could get some help on how to write it. For example, if I have a file that looks like this (5x5): 45 67 89 12 -3 -3 -6 -7 -4 -9 96 81 -8 52 12 14 -7 72 29 -1 19 43 28 63 87 Then I read the file with the scanner with this(very rough outline): Scanner reader = new Scanner(new File("Insert File Location")); while(reader.hasNext()) { How can I store this data into a 2d array using this format? I'm not really sure on how it works and I have an exam in a couple of weeks. I was planning on asking my professor, but he hasn't been here for the last few days. Could someone please show me how I can do this to store the file into a 2d array? If there are any other ways that may be more efficient, I would be open to all ideas (still a beginner). I really appreciate all the help.

http://stackoverflow.com/a/52193148
score: 0
has body: I solved this using Pattern instead of JSoup for pattern matching: Pattern pattern = Pattern.compile("[\\w-]+(\\.[\\w-]+)*\\s?@\\s?[A-Za-z0-9-]+(\\.[A-Za-z0-9-]+)*(\\.[A-Za-z]{2,4})"); Document doc = cleaner.clean(Jsoup.connect(url).get()); String text = doc.text(); Matcher matcher = pattern.matcher(text); while (matcher.find()) { System.out.println(matcher.group()); }
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/23208233
accepted answer of: http://stackoverflow.com/q/23208233

http://stackoverflow.com/q/23243107
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: web-hosting
tagged with: ip
type: Question
has title: How can I set up a Java Server with specific IP and Port with a normal Webhosting Package?
answer count: 1
has answer: http://stackoverflow.com/a/23244584
downvote count: 0
favorite count: 0
has body: I want to create a Java Webserver with some existing Web Hosting/Space with IP/Port so that I can test Socket Programming Features. I already have a Webhosting Package at https://alfahosting.de/ Is it possible to do socket programming with this webhosting package? If it is not possible to do Socket programming with this webhosting package. How is it possible? Are their special webhosting packages that support socket programming with an own IP and Port? I also would like to know if their is a tutorial how to set up a java webserver socket in a web hosting package. Thanks!
tagged with: sockets
tagged with: port
accepted answer: http://stackoverflow.com/a/23244584
upvote count: 1

http://stackoverflow.com/q/23234085
answer count: 1
accepted answer: http://stackoverflow.com/a/23234610
has comment: http://stackoverflow.com/comment/35547881
tagged with: parsing
has body: Here's my code. However, whenever I enter an expression such as "2*3+6/3", it prints out the output as "36/3+2*" which isn't the correct postfix format. Anyone see any errors in my code? Much appreciated! package expressiontree; import java.util.LinkedList; import java.util.List; class Stack { private List stack = new LinkedList(); public void push(TreeNode node) { stack.add(node); } public TreeNode pop() { int top = stack.size()-1; if (top &lt; 0) return null; TreeNode node = (TreeNode)stack.get(top); stack.remove(top); return node; } } class TreeNode { TreeNode left; TreeNode right; char data; TreeNode(){} TreeNode(char c) { this.data = c; } } public class ExpressionTree { String expression; TreeNode tree; Stack operandstack = new Stack(); Stack operatorstack = new Stack(); private boolean isOperator(char c) { String operator = "+-*/"; if(operator.indexOf(c)==-1) return false; return true; } // parses an expression and creates two stacks private void parseExpression(String exp) { for(int i=0; i &lt; exp.length(); i++) { char c = exp.charAt(i); if(isOperator(c)) operatorstack.push(new TreeNode(c)); else{ operandstack.push(new TreeNode(c)); } } } private TreeNode create_tree() { TreeNode node = new TreeNode(); while((node = operatorstack.pop())!=null) { TreeNode oper1 = operandstack.pop(); TreeNode oper2 = operandstack.pop(); TreeNode exp = create_expression(oper1, node, oper2); operandstack.push(exp); } return operandstack.pop(); } private TreeNode create_expression(TreeNode oper1, TreeNode operator, TreeNode oper2) { TreeNode expression = new TreeNode(operator.data); expression.left = oper1; expression.right = oper2; return expression; } public static void postfix(TreeNode tn){ if (tn == null){ return; } else{ postfix(tn.left); postfix(tn.right); System.out.print(tn.data); } } public static void main(String[] args) { ExpressionTree et = new ExpressionTree(); String expression = "2*3+6/3"; et.parseExpression(expression); TreeNode tn = et.create_tree(); postfix(tn);…
has answer: http://stackoverflow.com/a/23234610
tagged with: tree
type: AnsweredQuestion
tagged with: java
type: Question
score: 0
has title: Issue with printing out post-order expression from expression tree. (Java)

http://stackoverflow.com/a/23223923
score: 5
upvote count: 5
answers question: http://stackoverflow.com/q/23223898
type: Answer
has body: The modifier * matches 0 or more instances. You probably wanted to use + in order to ensure that the string contains a digit. In order to negate a given character, you could make use of negated character classes: [^_]
downvote count: 0

http://stackoverflow.com/comment/35512185
has text: There is no simple way to do it - you could filter the elements or limit the number of elements but you can't easily break the forEach on a random condition.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23214318

http://stackoverflow.com/comment/35455304
type: AnswerComment
has text: Ow and thanks for the reply the contain method is far better than what I used before :D.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23181908

http://stackoverflow.com/q/23257842
has answer: http://stackoverflow.com/a/23257924
has answer: http://stackoverflow.com/a/23258295
possible better answer: http://stackoverflow.com/a/23257924
has answer: http://stackoverflow.com/a/23258109
score: 0
answer count: 3
has title: How can I best make a class hold something for another class?
linked to: http://stackoverflow.com/q/4818699
accepted answer: http://stackoverflow.com/a/23258109
tagged with: design-patterns
type: AnsweredQuestion
tagged with: java
has body: I'm encountering a couple awkward situations that seem, in some sense, dual to each other, and was wondering if anyone had any thoughts about how to handle them cleanly. External initialization class Human { Collection &lt;Human&gt; nextDoorNeighbors; } class Neighborhood { Collection &lt;Human&gt; humans; Neighborhood() { // Make humans // Then, let them all know who their neighbors are. } } This is awkward because the humans (in this situation) never have to change their next-door neighbors once they've been set up (they are effectively write-once), but this setup can't be done in the Human constructor because the neighbors that need to be put in the nextDoorNeighbors collection don't all exist when the human is constructed. Holding something for another Suppose I want to be able to store Humans in a tree-based map. To do so, the Human has to hold a Comparable ID, even if that isn't logically significant to the concept of a Human. The Human constructs this ID, but it never uses it. Only the map uses it (or even should use it).
type: Question

http://stackoverflow.com/a/23250788
downvote count: 0
has comment: http://stackoverflow.com/comment/35756412
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/35588274
score: 1
has body: Finding the sources is trivial; just ask each vertex whether it has any incoming edges. For the rest, basically you want to extract a spanning tree from the graph; there are several algorithms out there for doing this.
answers question: http://stackoverflow.com/q/23240079

http://stackoverflow.com/a/23272619
score: 1
has body: I think your problem lies here (condensed code slightly for readability): ResultSet searchRs = stmt.executeQuery(searchQuery); //User name is available if (searchRs.next() == false) { bean.setExists(false); } //User name is not available else if (searchRs.next() == true) { bean.setExists(true); } if (bean.getExists() == true) { //Return error and prevent registration bean.setSuccess(false); return bean; } next() moves the ResultSet's internal cursor on to the next row. The implication of this is that subsequent calls to next() are not guaranteed to return the same result. So this: if (searchRs.next() == false) { Might not return the same thing as this a few lines later: else if (searchRs.next() == true) { This means that there is a potential pathway through this code where neither condition is ever true. Specifically, if the first invokation of next() returns true and the second invokation returns false, neither branch will execute. There's a whole bunch of approaches to fixing this. Personally I would do this: // Check the true condition first, no need for == true if (searchRs.next()) { // User already exists bean.setExists(true); bean.setSuccess(false); // Returning the bean object isn't strictly necessary because of side-effects return bean; } else { // User doesn't already exist bean.setExists(false); stmt.executeUpdate(insertQuery); // You'll need to commit the transaction for it to work properly: currentCon.commit(); bean.setSuccess(true); return bean; } Essentially, because the boolean comparisons in this context can only ever have two outcomes, you can use if {} else {} instead of if {} else if {}. Note: I am assuming that the return type of getExists() is Boolean instead of boolean (because boolean can't be null). With that in mind, I believe that you're not initialising the variable that sits behind getExists() because of the problem above, so it's still set at its default value, which for objects is null. Because the changes to bean are side effects, you …
has comment: http://stackoverflow.com/comment/35627719
has comment: http://stackoverflow.com/comment/35628157
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35626873
accepted answer of: http://stackoverflow.com/q/23268501
downvote count: 0
answers question: http://stackoverflow.com/q/23268501
has comment: http://stackoverflow.com/comment/35628502
has comment: http://stackoverflow.com/comment/35626030
type: Answer
has comment: http://stackoverflow.com/comment/35627841
has comment: http://stackoverflow.com/comment/35625668
has comment: http://stackoverflow.com/comment/35628763
upvote count: 1
has comment: http://stackoverflow.com/comment/35626780
has comment: http://stackoverflow.com/comment/35626673

hive
tags question: http://stackoverflow.com/q/23275414
tags question: http://stackoverflow.com/q/23135444
tags question: http://stackoverflow.com/q/23129896
type: Tag
tags question: http://stackoverflow.com/q/23186353
tag name: hive
tags question: http://stackoverflow.com/q/23163876
tags question: http://stackoverflow.com/q/23156749

http://stackoverflow.com/q/23194894
tagged with: jpa-2.0
score: 4
linked to: http://stackoverflow.com/q/1980452
accepted answer: http://stackoverflow.com/a/23195300
type: AnsweredQuestion
tagged with: java
tagged with: hibernate
has title: Exception in thread "main" java.lang.IncompatibleClassChangeError: Implementing class
type: Question
upvote count: 4
has body: I am trying simple application for persisting object into the DB using JPA-(Hibernate Provider). I am very new to this JPA. I searched a lot on net but not getting solution of my problem. I don't know which Jars are required for this app. Plz resolve this problem. I have been trying this simple app for last 2 days. But it's not working. plz help me. Thank you very much in advance. This is my code : Entity.java package com.jpa; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.Table; @Entity @Table (name="student") public class EntityClass { @Id private int id; private String fName; private String lName; public int getId() { return id; } public void setId(int id) { this.id = id; } public String getfName() { return fName; } public void setfName(String fName) { this.fName = fName; } public String getlName() { return lName; } public void setlName(String lName) { this.lName = lName; } } this is my MainClass: package com.jpa; import java.util.HashMap; import java.util.Map; import javax.persistence.EntityManager; import javax.persistence.EntityManagerFactory; import javax.persistence.Persistence; public class MainClass { public static void main(String[] args) { EntityClass e= new EntityClass(); e.setfName("BNT"); e.setlName("SOFT"); EntityManagerFactory emFactory = Persistence.createEntityManagerFactory("persistence"); EntityManager eManager = emFactory.createEntityManager(); eManager.getTransaction().begin(); eManager.persist(e); eManager.getTransaction().commit(); eManager.close(); } } and this is my persistence.xml file: <persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd" version="2.0"> org.hibernate.ejb.HibernatePersistence com.jpa.EntityClass <property name="javax.persistence.jdbc.driver" value="com.mysql.jdbc.Driver" /> <property name="javax.persistence…
downvote count: 0
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/23195300

http://stackoverflow.com/q/23241706
type: Question
linked to: http://stackoverflow.com/q/3645143
tagged with: filesystems
has body: We are using EhCache 2.6.2. Because we need high survivability we use only DiskStorage and not MemoryStorage. After every data update we have in the program, we flush the data to the disk. After a while, the cache.data file exceeded max of 1 gb. When the data file was 250 mb, the flush took 250ms and when it's 1gb, it takes 3.5 sec. Our objects are about 20kb each, so there are millions of them. Is there a way to split the data file to few smaller files and let EhCache handle it? We would prefer to have solution involving only configuration changes and not code change, cause it's in production environment. Environment details: Running WebSphere 7 with IBM Java 1.6 with EhCache 2.6.2 on AIX 6.1 64bit.
has answer: http://stackoverflow.com/a/23359299
score: 0
tagged with: file-io
answer count: 1
has title: Why every DiskStorage flush in EhCache takes 4 seconds?
tagged with: ehcache
type: UnansweredQuestion
tagged with: performance
tagged with: java

http://stackoverflow.com/comment/35445455
type: AnswerComment
has text: @maaartinus - I'm doubtful of the chances. But I agree with you that it is worth a try.
type: Comment
comment on: http://stackoverflow.com/a/23165066
score: 0

http://stackoverflow.com/a/23178130
has comment: http://stackoverflow.com/comment/35493904
answers question: http://stackoverflow.com/q/23174985
has body: Database connection pooling solve is very similar to the thread pooling you have mentioned here. Here are the main reasons. Main purpose of the db connection pool is to create some db connections and keep them in the pool and reuse them whenever your application code need to execute queries to db. Because creation of connections is a very costly operation, Connection pooling allows us to save that effort. It is perfectly fine to create 128 connections and keep them in the pool. No 128 concurrent selects on one connection may not work properly. With connection pooling you get the connection from the pool and the use it to fire all the queries that are required for the operation and then you return the connection back to the pool. So you would need 128 connections to run the concurrent selects. Generally you let the container handle the connection pooling. You can configure connection pooling in web.xml or in the container specify configuration file and associate a JNDI name with data source that is connected to the pool. Then you lookup that DataSource and get the connections from there. Here is the example code for getting connections. public static Connection getConnection() { Connection con = null; try { Context initContext = new InitialContext(); Context envContext = (Context) initContext.lookup("java:/comp/env"); DataSource dataSource = (DataSource) envContext.lookup("jdbc/db"); con = dataSource.getConnection(); } catch (NamingException e) { e.printStackTrace(); } catch (SQLException e) { e.printStackTrace(); } return con; } Database will assume that the connection are still alive and its the responsibility of the application server to keep the connections in the pool alive (of course by the configuration by user) and avoid the connection timeouts. When your application code requests the connection to be closed by calling connection.close(), This connection is not closed and is actually returned to the pool so that further requests for connections from the pool …
has comment: http://stackoverflow.com/comment/61554324
type: AcceptedAnswer
downvote count: 0
score: 6
type: Answer
upvote count: 6
has comment: http://stackoverflow.com/comment/35462133
accepted answer of: http://stackoverflow.com/q/23174985

http://stackoverflow.com/a/23203037
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/23202906
has body: Your 'currentSession' variable in line 274 is null. Exception occurs when you try to call 'get' on null. Try if(comparing 'currentSession != null &amp;&amp; currentSession.get("isInternetExplorerAvailable") != null) { ......}
upvote count: 1

http://stackoverflow.com/comment/35562208
type: AnswerComment
has text: Hi Tilman. I'll take a look at the constructor then. I need to be sure it uses similar ImageIO method to load images. Thanks.
type: Comment
score: 1
comment on: http://stackoverflow.com/a/23224766

http://stackoverflow.com/q/23279213
tagged with: maven
has comment: http://stackoverflow.com/comment/35746146
tagged with: war
score: 2
type: AnsweredQuestion
has body: I´m trying to deploy a Spring boot application on Jboss. I follow this tutorial for convert my jar in to a war file. But when i try to run the application on Jboss it´s give me this error: 17:02:31,462 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/ldap-service-1.0-SNAPSHOT]] (MSC service thread 1-2) Exception starting filter applicationContextIdFilter: java.lang.InstantiationException: org.springframework.boot.actuate.autoconfigure.EndpointWebMvcAutoConfiguration$ApplicationContextFilterConfiguration$1 at java.lang.Class.newInstance(Class.java:359) [rt.jar:1.7.0_51] at org.jboss.as.web.deployment.WebInjectionContainer.newInstance(WebInjectionContainer.java:80) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final] at org.jboss.as.web.deployment.WebInjectionContainer.newInstance(WebInjectionContainer.java:72) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final] at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:441) [jbossweb-7.0.13.Final.jar:] at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3269) [jbossweb-7.0.13.Final.jar:] at org.apache.catalina.core.StandardContext.start(StandardContext.java:3865) [jbossweb-7.0.13.Final.jar:] at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentService.java:90) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final] at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_51] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_51] at java.lang.Thread.run(Thread.java:744) [rt.jar:1.7.0_51] 17:02:31,472 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/ldap-service-1.0-SNAPSHOT]] (MSC service thread 1-2) Exception starting filter webRequestLoggingFilt…
has title: Spring boot war doesn´t work on Jboss 7.1
upvote count: 2
tagged with: java
has comment: http://stackoverflow.com/comment/35638181
type: Question
tagged with: spring-boot
has answer: http://stackoverflow.com/a/37687925
tagged with: jboss
linked to: http://stackoverflow.com/q/22365365
has comment: http://stackoverflow.com/comment/35746384
has comment: http://stackoverflow.com/comment/35745796
answer count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/35714894
has comment: http://stackoverflow.com/comment/35754872
possible better answer: http://stackoverflow.com/a/32320199
has comment: http://stackoverflow.com/comment/35775911
favorite count: 0
has answer: http://stackoverflow.com/a/32320199
has comment: http://stackoverflow.com/comment/35631616
has comment: http://stackoverflow.com/comment/35637950
accepted answer: http://stackoverflow.com/a/37687925

http://stackoverflow.com/a/23250860
has comment: http://stackoverflow.com/comment/35578515
has body: You can exclude transitive dependencies from myproject1 and you have two options here. Optional dependency. Mark logback-core in myproject1 as optional: ch.qos.logback logback-core 1.1.1 test true Excluded dependency. Exclude logback-core when including myproject1: com.mydomain myproject1 1.0 ch.qos.logback logback-core Also I think if you run build with tests off (-Dmaven.test.skip=true) logback-core will not be included anyway. Run mvn dependency:tree to see origin of your dependencies and their scope.
has comment: http://stackoverflow.com/comment/35578469
accepted answer of: http://stackoverflow.com/q/23249923
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/23249923
has comment: http://stackoverflow.com/comment/35577870
has comment: http://stackoverflow.com/comment/35577425
has comment: http://stackoverflow.com/comment/35578282
has comment: http://stackoverflow.com/comment/35577506
upvote count: 1
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/a/23298851
accepted answer of: http://stackoverflow.com/q/23284062
answers question: http://stackoverflow.com/q/23284062
downvote count: 0
score: 1
has body: Attributes inside HTML tags are separated by spaces. That's why you're supposed to use quotes around the attribute values. BAD: &lt;input type="text" name="id" value=&lt;%=res.getString("comments")%&gt;&gt; GOOD: &lt;input type="text" name="comments" value="&lt;%=res.getString("comments")%&gt;" /&gt;
upvote count: 1
type: AcceptedAnswer
type: Answer

subclass
tags question: http://stackoverflow.com/q/23233839
type: Tag
tags question: http://stackoverflow.com/q/23283954
tags question: http://stackoverflow.com/q/23163681
tags question: http://stackoverflow.com/q/23207693
tag name: subclass

z3
tags question: http://stackoverflow.com/q/23192058
type: Tag
tag name: z3

http://stackoverflow.com/a/33757854
has comment: http://stackoverflow.com/comment/121067332
has comment: http://stackoverflow.com/comment/58628764
has comment: http://stackoverflow.com/comment/102193386
has comment: http://stackoverflow.com/comment/104835109
has comment: http://stackoverflow.com/comment/93512435
upvote count: 225
has comment: http://stackoverflow.com/comment/89572399
has comment: http://stackoverflow.com/comment/120834001
has comment: http://stackoverflow.com/comment/88638896
has body: I had the same problem and solved by adding: -Xmx1024m -XX:MaxPermSize=256m The whole plugin element is: org.apache.maven.plugins maven-surefire-plugin 3 true -Xmx1024m -XX:MaxPermSize=256m
has comment: http://stackoverflow.com/comment/119178774
downvote count: 2
score: 223
has comment: http://stackoverflow.com/comment/115674390
has comment: http://stackoverflow.com/comment/81275056
has comment: http://stackoverflow.com/comment/110615716
type: Answer
has comment: http://stackoverflow.com/comment/109104314
answers question: http://stackoverflow.com/q/23260057
has comment: http://stackoverflow.com/comment/103909541

http://stackoverflow.com/comment/35618277
type: QuestionComment
comment on: http://stackoverflow.com/q/23272683
has text: @NathanHughes I'm not super-familiar with Spring. I'm trying to learn it in combination with Hibernate while I'm waiting to start my new job. My team gave me a lot of reading about the tech we'll be using (Spring and Hibernate included), but just reading about it wasn't working for me. I'm trying to put some fairly simple projects together so I have at least some clue how these things work when I start. I'll try looking up the spring-data jpa, thanks!
score: 0
type: Comment

http://stackoverflow.com/a/23273860
downvote count: 0
has comment: http://stackoverflow.com/comment/77095979
has comment: http://stackoverflow.com/comment/35647003
score: 4
has comment: http://stackoverflow.com/comment/35620747
type: Answer
has comment: http://stackoverflow.com/comment/35648681
has comment: http://stackoverflow.com/comment/35623449
answers question: http://stackoverflow.com/q/23272696
has comment: http://stackoverflow.com/comment/35648138
has comment: http://stackoverflow.com/comment/116914752
has body: Yes. I have code for this here. https://github.com/slightfoot/android-edge-effect-override/blob/master/EdgeEffectOverride.java
has comment: http://stackoverflow.com/comment/35647562
upvote count: 4
has comment: http://stackoverflow.com/comment/35623725
accepted answer of: http://stackoverflow.com/q/23272696
type: AcceptedAnswer

http://stackoverflow.com/a/23152760
has comment: http://stackoverflow.com/comment/35404321
answers question: http://stackoverflow.com/q/23151503
has comment: http://stackoverflow.com/comment/35403867
has body: Take this import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.util.zip.ZipEntry; import java.util.zip.ZipInputStream; public class Unzip { public static final String OUTPUT_FOLDER = "/tmp/zipoutput"; public static final String INPUT_ZIP_FILE = "/tmp/ziptest.zip"; public static void main(String[] args) { UnZip unZip = new UnZip(); unZip.unZipIt(INPUT_ZIP_FILE, OUTPUT_FOLDER); } public static class UnZip { /** * Unzip it * * @param zipFile input zip file * @param output zip file output folder */ public void unZipIt(String zipFile, String outputFolder) { byte[] buffer = new byte[1024]; try { //create output directory is not exists File folder = new File(outputFolder); if (!folder.exists()) { folder.mkdir(); } //get the zip file content ZipInputStream zis = new ZipInputStream(new FileInputStream(zipFile)); //get the zipped file list entry ZipEntry ze = zis.getNextEntry(); while (ze != null) { String fileName = ze.getName(); if (ze.isDirectory()) { ze = zis.getNextEntry(); continue; } System.out.println("origin file: " + fileName); fileName = new File(fileName).getName(); File newFile = new File(outputFolder + File.separator + fileName); System.out.println("file unzip : " + newFile.getAbsoluteFile()); //create all non exists folders //else you will hit FileNotFoundException for compressed folder new File(newFile.getParent()).mkdirs(); FileOutputStream fos = new FileOutputStream(newFile); int len; while ((len = zis.read(buffer)) &gt; 0) { fos.write(buffer, 0, len); } fos.close(); ze = zis.getNextEntry(); } zis.closeEntry(); zis.close(); System.out.println("Done"); } catch (IOException ex) { ex.printStackTrace(); } } } }
has comment: http://stackoverflow.com/comment/35404082
has comment: http://stackoverflow.com/comment/35409531
accepted answer of: http://stackoverflow.com/q/23151503
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35404120
score: 0
type: Answer

http://stackoverflow.com/q/23153735
tagged with: java
has comment: http://stackoverflow.com/comment/35420001
linked to: http://stackoverflow.com/q/141734
score: 0
tagged with: gwt-rpc
has comment: http://stackoverflow.com/comment/35419923
has title: gwt 503 Service Temporarily Unavailable after 20 minutes
answer count: 1
has comment: http://stackoverflow.com/comment/35420051
has answer: http://stackoverflow.com/a/23215018
accepted answer: http://stackoverflow.com/a/23215018
type: AnsweredQuestion
has body: I have a GWT 2.5 application with gxt 2.3.1 with which I made a RPC longer than 30 min. But before I got the response the application pop up a an Error windows With message 503 Service Temporarily message with all the usual details The server itself in the meantime still processing the data so actually the server is available. It's realy looks like a session time out but in the web.xml i set up a 1 day long timeout 1440 And after the processing completed I do not got the response on the client side. So my second guess is the rpc time what I currently currently trying to find out how to set up without success so far.
has comment: http://stackoverflow.com/comment/35511884
has comment: http://stackoverflow.com/comment/35419968
type: Question
tagged with: gwt

http://stackoverflow.com/comment/35429379
score: 0
has text: okay thanks but can I know how you convert hex to signed int, because all calculator I use say immediately that 94 in hex is 148 in dec so how does the conversion to signed dec work ?
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23164054

http://stackoverflow.com/a/23137644
has comment: http://stackoverflow.com/comment/35376678
type: Answer
has comment: http://stackoverflow.com/comment/35376817
score: 11
downvote count: 0
has body: Create your own Rectangle class and store those values in it. List&lt;Rectangle&gt; rectangles = new ArrayList&lt;&gt;(); rectangles.add(new Rectangle("Foo", 20, 30));
answers question: http://stackoverflow.com/q/23137604
type: AcceptedAnswer
upvote count: 11
accepted answer of: http://stackoverflow.com/q/23137604

http://stackoverflow.com/q/23159634
has title: Bound mismatch: The type Foo is not a valid substitute
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23160020
score: 1
tagged with: java
upvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/23160020
answer count: 1
downvote count: 0
tagged with: generics
has body: I need to do something like: class AbstractA&lt;PARAM extends AbstractB&lt;AbstractA&lt;PARAM&gt;&gt;&gt; { public AbstractA(PARAM arg) { arg.doStuff(this); } } class AbstractB&lt;T extends AbstractA&lt;?&gt;&gt; { public void doStuff(T onWhat) { System.out.println(onWhat); } } class A extends AbstractA&lt;Foo&gt; { public A(Foo arg) { super(arg); } } class Foo extends AbstractB&lt;A&gt; { } However, I'm getting this error at "class A extends AbstractA {": Bound mismatch: The type Foo is not a valid substitute for the bounded parameter &lt;PARAM extends AbstractB&lt;AbstractA&lt;PARAM&gt;&gt;&gt; of the type AbstractA&lt;PARAM&gt; How's that possible? When i try to work out the generics, it looks correct.
favorite count: 0

group-by
tags question: http://stackoverflow.com/q/23214677
tag name: group-by
type: Tag
tags question: http://stackoverflow.com/q/23138342

http://stackoverflow.com/a/23227364
accepted answer of: http://stackoverflow.com/q/23227189
has comment: http://stackoverflow.com/comment/35538086
has comment: http://stackoverflow.com/comment/35540193
answers question: http://stackoverflow.com/q/23227189
has comment: http://stackoverflow.com/comment/35538720
has comment: http://stackoverflow.com/comment/35535843
downvote count: 0
has comment: http://stackoverflow.com/comment/35538989
score: 1
has comment: http://stackoverflow.com/comment/35536530
has body: NetBeans may be running the application on a different JVM than explorer, or maybe altering some of its properties (the -DXXX options). Try setting RenderingHints.KEY_FRACTIONALMETRICS to VALUE_FRACTIONALMETRICS_ON. (more at: http://docs.oracle.com/javase/7/docs/api/java/awt/RenderingHints.html#KEY_FRACTIONALMETRICS )
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35536207
has comment: http://stackoverflow.com/comment/35539010
upvote count: 1
type: Answer

http://stackoverflow.com/a/23277389
type: Answer
answers question: http://stackoverflow.com/q/23136769
has body: Check this one. This is how I would solve it if I were not to use ThreadPooling (which is very correct as the others have said) and so that I can see how wait(),notify() and Thread.sleep() work. Checking google you will see (e.g. Thread.sleep and object.wait) that the mainly wait() and notify() are used for communication between threads and Thread.sleep is used so that you can pause your program. -Part of this answer is based on this: http://tutorials.jenkov.com/java-concurrency/thread-signaling.html#missedsignals. You can check in the code to see the steps that you need to take (comment out some parts of the code) in order to make your program hang, so that you realize how to work with missed signals. The iterations needed for your program to hang are not fixed. -The programm will run forever. You will need to work on it a bit in order to fix that. Main public class Main { public static void main(String[] args) { Manager mgr = new Manager("manager"); mgr.start(); } } Manager public class Manager extends Thread { private final Object lock = new Object(); private boolean wasSignalled = false; private DoWork[] workThreads = new DoWork[5]; public Manager(String name){ super(name); workThreads[0] = new DoWork(this,"work 0"); workThreads[1] = new DoWork(this,"work 1"); workThreads[2] = new DoWork(this,"work 2"); workThreads[3] = new DoWork(this,"work 3"); workThreads[4] = new DoWork(this,"work 4"); } public void wakeUP() { synchronized (this.lock) { wasSignalled = true; this.lock.notify(); } } public void pauseAndWait() { synchronized (this.lock) { if(!wasSignalled) { try { this.lock.wait(); } catch (InterruptedException e) { e.printStackTrace(); } } //clear signal and continue running. wasSignalled = false; } } public void run () { int i=0; while(true) { i++; System.out.println(" manager ...: "+i+" "); int choose = 0 + (int)(Math.random() * ((4 - 0) + 1)); //choose=0; for debugginng if(!workThreads[choose].isAlive()){ workThreads[choose].start(); } else{ workThreads[cho…
score: 0

http://stackoverflow.com/a/23244688
type: Answer
score: 8
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23244426
has body: The reflection warning tells you that you need to clarify which write method is to be called in #(.write wrtr (row-fn %)). So you'll need to type-hint wrtr and (row-fn %): #(.write ^java.io.Writer wrtr ^String (row-fn %)) Incidentally, adding type hints to fn forms or function literals has no effect. (Well, adding primitive hints does make the resulting function implement the relevant clojure.lang.IFn$[OLD]+ interface, but those hints would need to be attached to the parameter vector and/or the individual symbols naming the parameters.) (In contrast, adding type hints to function names in defn forms does have the effect of placing :tag metadata on the resulting Vars; this will be used by the compiler to disambiguate Java method calls.)
answers question: http://stackoverflow.com/q/23244426
upvote count: 8
type: AcceptedAnswer

http://stackoverflow.com/comment/35608692
type: Comment
comment on: http://stackoverflow.com/q/23257439
type: QuestionComment
has text: And has a fillrate of 0%
score: 0

http://stackoverflow.com/comment/35606447
type: QuestionComment
type: Comment
score: 1
comment on: http://stackoverflow.com/q/23266605
has text: I have read that doing it that way is very brittle (Which i think means "would not be reliable and could cause issues"). Im seeking to get the "official" way to handle something like this.

http://stackoverflow.com/comment/35615663
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23271598
type: Comment
has text: I haven't learned to use Set, I will ask my teacher when I do see her soon.

http://stackoverflow.com/q/23211174
has body: I want to fetch distinct multiple columns from Google app engine Datastore in endpoint class. For that i am using below code but problem is that if i try to fetch only single column then only it works properly and returns DISTINCT data. If i try to fetch multiple columns then DISTINCT doesn't work and it returns all records without any effect of Distinct query. I don't know what is wrong with my code. Please suggest any solution and guide me where i am going wrong. Thank you. Code: @SuppressWarnings({ "unchecked" }) @ApiMethod(name = "getDistinctFollow", httpMethod = HttpMethod.GET, path = "userendpoint/userName_fk3") public ObjectListContainer getDistinctFollower( @Named("followName") ArrayList&lt;String&gt; lstFollower, @Nullable @Named("cursor") String cursorString, @Nullable @Named("limit") Integer limit) { EntityManager mgr = null; Cursor cursor = null; List&lt;Object[]&gt; lstNames; List&lt;String&gt; lstString; ObjectListContainer object; try { mgr = getEntityManager(); Query query = mgr.createQuery("select distinct f.uFullName,f.uUrl from UMaster f where f.uName in (:followName)"); query.setParameter("followName", lstFollower); if (cursorString != null &amp;&amp; cursorString != "") { cursor = Cursor.fromWebSafeString(cursorString); query.setHint(JPACursorHelper.CURSOR_HINT, cursor); } if (limit != null) { query.setFirstResult(0); query.setMaxResults(limit); } lstNames = (List&lt;Object[]&gt;) query.getResultList(); cursor = JPACursorHelper.getCursor(lstNames); if (cursor != null) cursorString = cursor.toWebSafeString(); lstString = new ArrayList&lt;String&gt;(); for (Object obj[] : lstNames) { lstString.add(obj != null ? obj[0].toString() : null); lstString.add(obj != null ? obj[1].toString() : null); } object = new ObjectListContainer(); object.setObjectsList(lstString); } finally { mgr.close(); } return object; }
tagged with: google-cloud-datastore
answer count: 1
has comment: http://stackoverflow.com/comment/35549261
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/35532617
type: UnansweredQuestion
tagged with: google-app-engine
tagged with: android
has title: DISTINCT query on multiple columns doesn't work - Google App engine Datastore
has comment: http://stackoverflow.com/comment/35550428
tagged with: google-cloud-endpoints
has comment: http://stackoverflow.com/comment/35551783
has comment: http://stackoverflow.com/comment/35571373
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/35594173
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/35625177
has answer: http://stackoverflow.com/a/23695306
has comment: http://stackoverflow.com/comment/35529722

http://stackoverflow.com/comment/35421144
score: 1
has text: Okay, Fair enough. It's easier too, I'm probably over-engineering things again.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23162562

http://stackoverflow.com/q/23169552
downvote count: 0
linked to: http://stackoverflow.com/q/1912095
has title: Are my sql jdbc methods safe from sql injection attack?
has body: I was just googling for "how to add records into a database with ' in them" and then stumbled upon a possible vulnerability to my program, "sql injection". I don't know much about this; I saw it first on this page. People are saying something about parametrized query. Here is my code in java: public int addItem(String name, String manufacturer, String desc, String id, String category, double cost) throws SQLException{ String additem = "INSERT INTO item VALUES(" + addComma(returnInQuotes(id)) + addComma(returnInQuotes(name)) + addComma(returnInQuotes(manufacturer)) + addComma(returnInQuotes(desc)) + addComma(returnInQuotes(category)) + cost + ")"; Statement statement = con.createStatement(); return statement.executeUpdate(additem); } public int removeItemById(String id) throws SQLException{ String removeitembyid = "DELETE FROM item WHERE id = " + returnInQuotes(id); Statement statement = con.createStatement(); return statement.executeUpdate(removeitembyid); } private String returnInQuotes(String str){ return "'" + str + "'"; } private String addComma(String str){ return str + ","; } addComma and returnInQuotes are methods I made because I was sick of typing them in in the methods that need them. So far I've tried my queries without the quotes, derby jdbc doesn't seem to work without them.
tagged with: sql
tagged with: sql-injection
tagged with: jdbc
favorite count: 0
has answer: http://stackoverflow.com/a/23169681
upvote count: 2
type: UnansweredQuestion
score: 2
has comment: http://stackoverflow.com/comment/35433141
linked to: http://stackoverflow.com/q/1812891
has comment: http://stackoverflow.com/comment/35433268
tagged with: java
tagged with: derby
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/23169595

http://stackoverflow.com/a/23189645
score: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/23189526
answers question: http://stackoverflow.com/q/23189526
has body: My hunch is that String[] words = str.split(":"); is probably not returning an array of length 2. Changing the last line of the for statement to if(words != null &amp;&amp; words.length &gt; 1) { menu.clanowner.put(words[0], words[1]); } should eliminate the IndexOutOfBoundsException. As a debugging practice, it also helps to know exactly what it going in there, so make sure that List&lt;String&gt; s = getConfig().getStringList("clanowner"); truly is giving you output that should produce arrays of length 2 or more either by debugging or manually inserting values that should work, or both.
type: AcceptedAnswer

http://stackoverflow.com/q/23153622
has answer: http://stackoverflow.com/a/23154016
has answer: http://stackoverflow.com/a/23153669
type: Question
has body: I have an alert dialog, which offers the user two options: yes and no. When no is selected it the AlertDialog closes but when yes is selected it takes the user online to give them directions but when I go back to the application the AlertDialog is still visible and I can't seem to make it disappear automatically when yes is clicked. Below is my code: AlertDialog.Builder alert_confirm = new AlertDialog.Builder(TrackingServiceActivity.this); alert_confirm.setMessage("Are you sure you want directions to " + data.name +"! Tracking will be suspended if it has started!"); alert_confirm.setCancelable(false). alert_confirm.setPositiveButton("Yes", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { getDirections(latitude, longitude, data.lat, data.lon); stopTracker(); return; } }); alert_confirm.setNegativeButton("No",new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { return; } }); AlertDialog alert = alert_confirm.create(); alert.show();
has answer: http://stackoverflow.com/a/23153872
has comment: http://stackoverflow.com/comment/35405576
has title: AlertDialog will not close
has answer: http://stackoverflow.com/a/23153664
downvote count: 0
favorite count: 0
type: UnansweredQuestion
tagged with: android
answer count: 4
score: 1
tagged with: java
upvote count: 1

http://stackoverflow.com/a/23256689
answers question: http://stackoverflow.com/q/23249909
accepted answer of: http://stackoverflow.com/q/23249909
upvote count: 0
score: -2
type: AcceptedAnswer
downvote count: 2
type: Answer
has body: I would not recommend trying to sub-class Jackson's default serializers: this is fragile. But if you do want to do it, have a look at MapSerializer: my guess is that its createContextual() method ends up constructing a differently configured instance. You may need to override one of other methods which handled creationg of such instances; you just need those to construct instanceof MyMapSerializer instead of default MapSerializer.

http://stackoverflow.com/comment/35449389
type: Comment
type: QuestionComment
has text: Why dont you specify the column name.Something like INSERT into [stockDB]([USERNAME],[SIZE],[QUANTITY],[PRICE]) values (?,?,?,?)";
score: 0
comment on: http://stackoverflow.com/q/23178781

http://stackoverflow.com/comment/35460893
type: AnswerComment
type: Comment
has text: It would be clearer/cleaner to make `Y()` package private.
comment on: http://stackoverflow.com/a/23180758
score: 0

mfcc
type: Tag
tag name: mfcc
tags question: http://stackoverflow.com/q/23278185
tags question: http://stackoverflow.com/q/23283482

http://stackoverflow.com/comment/35390877
type: QuestionComment
has text: Yeah, thats what i was thinking.
comment on: http://stackoverflow.com/q/23145276
score: 0
type: Comment

http://stackoverflow.com/q/23140217
tagged with: http://stackoverflow.com/tag/csv
tagged with: http://stackoverflow.com/tag/xml
type: Question
score: 0
answer count: 1
has title: Java - script to convert CSV to XML isn't splitting by row
tagged with: java
has answer: http://stackoverflow.com/a/23140490
tagged with: transformation
has body: I'm extremely new to Java and have been following this tutorial to convert a CSV file to XML in Mule ESB, using a Java class that makes use of Flatpack. Here is the input file I'm using: Item1|Item2|Item3|Item4 Item5|Item6|Item7|Item8 And here is my desired output: Item1 Item2 <c>Item3</c> <d>Item4</d> Item5 Item6 <c>Item7</c> <d>Item8</d> I've used the Java script exactly as it's given in the tutorial: public class CsvConverter { private static char delimiter = '|'; private static char qualifier = '"'; private static boolean ignoreFirstRecord = false; public CsvConverter() { } public String convert(String csv) { StringReader sr = new StringReader(csv); FileReader fr = null; //Get the configuration file for csv processing try { fr = new FileReader("src/main/resources/usermap.xml"); } catch (FileNotFoundException e) { e.printStackTrace(); } //The csv parser Parser p = DefaultParserFactory.getInstance().newDelimitedParser(fr, sr,delimiter, qualifier, ignoreFirstRecord); DefaultDataSet d = (DefaultDataSet) p.parse(); //Build the xml DocumentBuilderFactory dFact = DocumentBuilderFactory.newInstance(); DocumentBuilder build; Document doc=null; try { build = dFact.newDocumentBuilder(); doc = build.newDocument(); } catch (ParserConfigurationException e) { e.printStackTrace(); } Element root = doc.createElement("root"); doc.appendChild(root); Element Details = doc.createElement("rows"); root.appendChild(Details); while (d.next()) { String[] colums = d.getColumns(); for(int i=0; i<colums.length;i++ ){ Element name = doc.createElement(colums[i]); name.appendChild(doc.createTextNode(d.getString(colums[i]))); Details.appendChild(name); } } TransformerFactory tf = TransformerFactory.newInstance(); Transformer transformer=null; StringWriter writer = null; try { transformer = tf.newTransformer(); writer = new StringWriter(); transformer.transform(new DOMSource(doc), new StreamResult(writer)); } catch (TransformerConfigurationException e) { e.printStackTrace(); } catch (Transformer…
accepted answer: http://stackoverflow.com/a/23140490
tagged with: flatpack
type: AnsweredQuestion

http://stackoverflow.com/a/23249499
has body: I think the problem in mentioning cluster name.. Use lik following Settings settings = ImmutableSettings.settingsBuilder() .put("cluster.name", "elasticsearch").build(); Hope it helps..!
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23242729
accepted answer of: http://stackoverflow.com/q/23242729
type: Answer
upvote count: 4
downvote count: 0
score: 4

http://stackoverflow.com/comment/35559478
has text: I don't think it will help him, because the TreeMap is ordered but you cannot get an absolute position of an item in it, and it is backed up as with a tree. Getting the entries as an array is no more optimal than his existing idea.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23240714
score: 1

memory-management
tags question: http://stackoverflow.com/q/23222296
tags question: http://stackoverflow.com/q/23272227
tags question: http://stackoverflow.com/q/23274495
tags question: http://stackoverflow.com/q/23136337
type: Tag
tag name: memory-management

http://stackoverflow.com/q/23161512
has answer: http://stackoverflow.com/a/23161609
tagged with: java
tagged with: swing
downvote count: 1
accepted answer: http://stackoverflow.com/a/23161609
type: Question
possible better answer: http://stackoverflow.com/a/23161599
has answer: http://stackoverflow.com/a/23161599
tagged with: math
score: -1
has comment: http://stackoverflow.com/comment/35418965
tagged with: awt
answer count: 3
has comment: http://stackoverflow.com/comment/35420872
upvote count: 0
has body: My program generates radnom math problems. Onclick it shows the answer to the math problems. Every answer is wrong and I cannot figure out what the relevance of the numbers shown as answers is. Here is the full program, Driver Class import java.awt.EventQueue; import java.awt.GridLayout; import java.awt.event.*; import javax.swing.*; public class Driver extends MathProblems { MathProblems problems = new MathProblems(); String s = "Welcome Students!"; String b = "Start!"; private JFrame f; private JPanel p; JFrame frame = new JFrame(); JButton b1 = new JButton(b); JLabel jl = new JLabel(s); int i; public Driver () { gui(); } public void gui() { f = new JFrame("Flash Card Program"); p = new JPanel(); f.setLayout( new GridLayout( 2, 1 ) ); f.add(jl); f.add(p); p.setLayout( new GridLayout( 2, 1 ) ); p.add(b1); jl.setHorizontalAlignment(JLabel.CENTER); // pack the frame for better cross platform support f.pack(); // Make it visible f.setVisible(true); f.setSize(560,400); // default size is 0,0 f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); b1.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e){ if(b1.getText().equals("Click For Answer")) { problems.run(); jl.setText(problems.toString()); b = "Next Question"; b1.setText(b); } else { problems.run(); jl.setText(problems.getQuestion()); b = "Click For Answer"; b1.setText(b); } } }); } public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { new Driver(); } }); } // End main Method } // End class Driver MathProblems Class import java.util.Random; public class MathProblems { private static final int MAX_NUMBER = 10; private static final Random random = new Random(); private int expected = 0; private String question = ""; public void run() { final int a = random.nextInt(MAX_NUMBER); final int b = random.nextInt(MAX_NUMBER); final int type = random.nextInt(4); switch (type) { case 0: add(a, b); break; case 1: subtract(a, b); break; case 2: multiply(a,…
favorite count: 0
has title: Random Math Java Program Showing Incorrect Answers
has answer: http://stackoverflow.com/a/23161622
type: AnsweredQuestion

http://stackoverflow.com/q/23220542
has comment: http://stackoverflow.com/comment/35523003
score: 2
has title: Files.walk how to swallow the exception and continue walking in the filesystem
answer count: 0
tagged with: java-stream
upvote count: 2
type: UnansweredQuestion
tagged with: java-8
has comment: http://stackoverflow.com/comment/35545592
tagged with: java
tagged with: nio
linked to: http://stackoverflow.com/q/22867286
type: Question
downvote count: 0
duplicate of: http://stackoverflow.com/q/22867286
has comment: http://stackoverflow.com/comment/35526611
favorite count: 0
has body: I am try using the following code: Files.walk(Paths.get("/home"), FileVisitOption.FOLLOW_LINKS) .map(p -&gt; p.getFileName()) .map(f -&gt; f.toString()) .filter(s -&gt; s.endsWith(".rb")) .forEach(o -&gt; System.out.println(o)); When I run it as a regular user, I got AccessDeniedException Wrapped in UncheckIOException..And when Run as root, I got the correct result. $ java helloJava8.LambdaExpr Exception in thread "main" java.io.UncheckedIOException: java.nio.file.AccessDeniedException: /home/lost+found at java.nio.file.FileTreeIterator.fetchNextIfNeeded(FileTreeIterator.java:88) at java.nio.file.FileTreeIterator.hasNext(FileTreeIterator.java:104) at java.util.Iterator.forEachRemaining(Iterator.java:115) at ....... $sudo java helloJava8.LambdaExpr hello.rb I do know the cause of the problem, but what I want to know how to swallow this exception, because if i wrap the above code in Try-Catch block, I got the method walk finish its work and stop walk-though the fs.

http://stackoverflow.com/q/23136569
has answer: http://stackoverflow.com/a/23140696
favorite count: 0
has comment: http://stackoverflow.com/comment/35374884
has comment: http://stackoverflow.com/comment/35375119
tagged with: code-coverage
accepted answer: http://stackoverflow.com/a/23140696
tagged with: maven
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35374985
has comment: http://stackoverflow.com/comment/35524012
upvote count: 5
tagged with: java
has comment: http://stackoverflow.com/comment/35374882
has comment: http://stackoverflow.com/comment/35528370
has comment: http://stackoverflow.com/comment/35490879
tagged with: sonarqube
has comment: http://stackoverflow.com/comment/35375360
type: Question
has body: Scenario: a team works on a Java/Maven/JUnit project using some kind of SCM. We would like to increase test coverage, meaning all developers should test code more intensively. Measuring overall test coverage improvements using something like SonarQube is easy enough, but you need to do it per developer in order to be able to recognise the outliers: engineers which have the best test coverage and engineers whose coverage is worst. How would you answer the question "what is the test coverage of code modified by developer X during the last month?" Is there a surrogate, approximate measure that could be followed more easily?
score: 5
has comment: http://stackoverflow.com/comment/35376310
answer count: 1
tagged with: junit
has comment: http://stackoverflow.com/comment/35375297
downvote count: 0
has title: How to measure Java code unit test coverage per developer?

http://stackoverflow.com/comment/35648687
has text: well I was doing a little desktop cleaning today, but I can't think of what could I have deleted or removed regarding to my eclipse project. I'm posting my web.xml, but I haven't touched it at all (I'm using anotations).
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23288991
score: 0

http://stackoverflow.com/comment/35604100
type: Comment
type: QuestionComment
has text: http://docs.oracle.com/javase/tutorial/uiswing/components/filechooser.html
comment on: http://stackoverflow.com/q/23265379
score: 0

http://stackoverflow.com/a/23206764
score: 1
has body: In your problem, it would be nice to get to the line you want to change, change it, and leave everything else the same. Unfortunately a file isn't a collection of lines, it is a collection of bytes. If you want to change "10" to "1000" you need to insert some new bytes, that means everything behind it needs to move down a few bytes (likely four or so, assuming utf8). In the real world we get around this by not storing data in flat files. Assuming you still want a really simple, file based, human readable, format: Use one file per entry. You'll have a directory with a lot of files, but the hard work of rewriting changed files and indexing by file name would be done by the os. Use a fixed field width format. Define the width of each field then skip to the data you want. You could access your data like a big array. Use a predetermined format with readily available tools for parsing and manipulation. XML and CSV come to mind
downvote count: 0
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/23206461

http://stackoverflow.com/comment/35557123
score: 0
comment on: http://stackoverflow.com/q/23239224
type: Comment
type: QuestionComment
has text: @Tum: 'logn as partInt(number) return 0 is not OK' - can you expand on that? Is the constraint that each number in the pattern must contain at least one non-zero digit?

http://stackoverflow.com/comment/35512635
comment on: http://stackoverflow.com/a/23214374
has text: thank's alex,project has values-fa resource directory,but problem in reshaping.reshape method will call every time that use Persian string.
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/35541815
has text: Good catch. In that case @Onik, he is already doing what you suggested by inflating the Fragment layout for his Activity.
type: Comment
comment on: http://stackoverflow.com/q/23230600
score: 0
type: QuestionComment

http://stackoverflow.com/a/23154847
accepted answer of: http://stackoverflow.com/q/23154391
upvote count: 2
type: AcceptedAnswer
type: Answer
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/35406738
has body: You can try something like this I think. Not very efficient algorithm though. public class Main { public static void main(String[] args) { String s = "(0, 0) (1, 2)"; String[] rawCoords = s.split("\\) \\("); Point p1 = parsePoint(rawCoords[0]); Point p2 = parsePoint(rawCoords[1]); System.out.println(p1.distance(p2)); } private static Point parsePoint(String s) { //remove all brackets and white spaces and split by comma String[] rawXY = s.replaceAll("[\\)\\(\\s]", "").split(","); return new Point(Integer.parseInt(rawXY[0]), Integer.parseInt(rawXY[1])); } public static class Point { private final int x; private final int y; public Point(int x, int y) { this.x = x; this.y = y; } public double distance(Point another) { return Math.sqrt(Math.pow(x - another.x, 2) + Math.pow(y - another.y, 2)); } @Override public String toString() { return "Point{" + "x=" + x + ", y=" + y + '}'; } } }
answers question: http://stackoverflow.com/q/23154391

http://stackoverflow.com/a/23227164
type: Answer
downvote count: 0
score: 3
accepted answer of: http://stackoverflow.com/q/23226059
answers question: http://stackoverflow.com/q/23226059
has body: Your block for if(user?.profile) { def profile = new Profile(params ) user.profile = profile } will replace the profile on the user instance if there already exists a profile. If the user doesn't have a profile, you don't create one, but then proceed to try to assign values to it. You want to flip your if statement to if (!user?.profile) so a profile is assigned when it doesn't exist.
upvote count: 3
type: AcceptedAnswer

http://stackoverflow.com/comment/35541982
type: Comment
comment on: http://stackoverflow.com/q/23227806
type: QuestionComment
score: 2
has text: read the api doc of SingleFrame/Application (fttomh, I think you need to register an ExitListener or override the method that's invoked on exit - myself, I don't have access to the doc right now ..)

http://stackoverflow.com/comment/35493013
type: QuestionComment
has text: No it doesn't work...
comment on: http://stackoverflow.com/q/23203469
score: 0
type: Comment

http://stackoverflow.com/a/23200271
answers question: http://stackoverflow.com/q/23200216
has comment: http://stackoverflow.com/comment/35487431
has comment: http://stackoverflow.com/comment/35486794
type: Answer
has comment: http://stackoverflow.com/comment/35486834
has comment: http://stackoverflow.com/comment/35487148
has comment: http://stackoverflow.com/comment/35486747
has body: To answer your direct question: No you can't display a JTable inside of a JTextArea, not without completely perverting the JTextArea and its functionality. I'm not sure why you'd even want to do such of a thing, since a JTextArea displays text, and you can't display a component inside of it, not without completely messing up its functionality. That is, unless I'm misinterpreting your question, and if so, please clarify it. What exactly are you trying to display in the JTextArea? The JTable's data? If so, that's a completely different thing. If that's the case, then sure, this can be done: Set the JTextArea's font to be mono-spaced Use String formatting via String.format(...) to allow you to display columns of data in a tabular fashion. As with any solution the details of the solution will depend on the details of the problem.
has comment: http://stackoverflow.com/comment/35486909
has comment: http://stackoverflow.com/comment/35486976
has comment: http://stackoverflow.com/comment/35486882
score: 0

http://stackoverflow.com/comment/35429852
type: Comment
has text: @user3435571: **In** the question. Links rot, and people shouldn't have to go off-site to help you.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/23167148

http://stackoverflow.com/comment/35625414
has text: Hi Lubomir, thanks for your comment. My servers encountered SSL connection issue when i turn on Use JSSE SSL. Do you know the reason for this?
comment on: http://stackoverflow.com/a/23262356
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/23183697
linked to: http://stackoverflow.com/q/11421223
type: Question
has answer: http://stackoverflow.com/a/23316870
accepted answer: http://stackoverflow.com/a/23316870
has answer: http://stackoverflow.com/a/23183728
has body: I am trying to update the app layout based on user preference. After the preference is made, the app requires restart for the preference to come into effect. I want it to happen immediately without restart. Here is my Activity class. public class MainActivity extends Activity implements OnClickListener { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.mainactivity); SharedPreferences getPrefs = PreferenceManager .getDefaultSharedPreferences(getBaseContext()); theme = getPrefs.getString("themelist", "0"); switch(theme){ case "0": setContentView(R.layout.mainactivity); break; case "1": setContentView(R.layout.mainactivity_black); break; } initialize(); setClickListeners(); }
linked to: http://stackoverflow.com/q/7020446
score: 0
answer count: 3
has title: SharedPreferences doesn't update preferences immediately. Requires app restart
tagged with: android
has answer: http://stackoverflow.com/a/67731746
possible better answer: http://stackoverflow.com/a/23183728
type: AnsweredQuestion
tagged with: java
tagged with: sharedpreferences

http://stackoverflow.com/q/23281839
tagged with: java
has answer: http://stackoverflow.com/a/23281863
tagged with: ascii
possible better answer: http://stackoverflow.com/a/39705794
has body: I'm trying to print an ASCII table with each number and its corresponding value, but I don't know how to get the character associated with the number. public static void main(String[] args) { for(char letter= ' ';letter&lt;274;letter++) System.out.print(letter); } How can I print the associated character with the number?
downvote count: 0
has comment: http://stackoverflow.com/comment/35635785
favorite count: 0
answer count: 3
accepted answer: http://stackoverflow.com/a/23281863
has title: How to print an ASCII table?
upvote count: 6
score: 6
type: Question
has answer: http://stackoverflow.com/a/34521181
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/39705794

http://stackoverflow.com/comment/35472217
type: QuestionComment
type: Comment
has text: @user3505394 plz provide the whole program.
comment on: http://stackoverflow.com/q/23191190
score: 0

http://stackoverflow.com/q/23211257
tagged with: md5
type: AnsweredQuestion
has body: i recently started to do some encryption with Apache DigestUtils. I simply want to use md5 hashes for authorization, but i'm an absolute beginner in this topic and in general not really experienced in Java. The API of this library provided me the methods md5, md5hex. If i'm not mistaken the result of these just differs in the output as a hexString (i'm not even sure whats this means) and regular bytes. String b1 = DigestUtils.md5hex("Some String"); String b2 = DigestUtils.md5hex("Some String"); The result is 83beb8c4fa4596c8f7b565d390f494e2 &amp; 83beb8c4fa4596c8f7b565d390f494e2 But a comparison with == results in false if (b1 == b2){ System.out.println("Matching") } I'm pretty confused and i can't find a source for an introduction around this topic(for java!)
accepted answer: http://stackoverflow.com/a/23211291
tagged with: java
has title: Why does this md5 not match
duplicate of: http://stackoverflow.com/q/513832
possible better answer: http://stackoverflow.com/a/23211636
type: Question
has comment: http://stackoverflow.com/comment/35506802
answer count: 2
tagged with: encoding
has answer: http://stackoverflow.com/a/23211291
score: 0
linked to: http://stackoverflow.com/q/513832
has answer: http://stackoverflow.com/a/23211636

http://stackoverflow.com/a/23239009
downvote count: 0
answers question: http://stackoverflow.com/q/23238937
type: Answer
accepted answer of: http://stackoverflow.com/q/23238937
has comment: http://stackoverflow.com/comment/35557069
score: 7
has comment: http://stackoverflow.com/comment/35557155
upvote count: 7
type: AcceptedAnswer
has body: For a generic method, the caller can specify the type argument - so I should be able to use: Connection foo = new IoConnectionStub(); Integer x = foo.&lt;Integer&gt;getVersion(); That's clearly not going to work in your case. It sounds like if you really need this (which I think is slightly odd for a version property...) you would want to make the interface generic - that way IoConnectionStub could implement Connection&lt;String&gt; for example, and you'd end up with code of: Connection&lt;String&gt; foo = new IoConnectionStub(); String version = foo.getVersion(); You couldn't ask for an Integer version number, because IoConnectionStub wouldn't implement Connection&lt;Integer&gt;.

http://stackoverflow.com/comment/89336543
has text: There are different ways in `rxJava` to split a sequence into parallel threads. Some of the techniques involve [using `observeOn()` within a `flatMap()`](https://tomstechnicalblog.blogspot.com/2015/11/rxjava-achieving-parallelization.html), [the new `.parallel()` and `sequential()` operators](https://dzone.com/articles/rxjava-idiomatic-concurrency-flatmap-vs-parallel), etc... `rxJava` is far more complex. Also, using `forEach()` doesn't look like using reactive programming as it was meant to be. `flatMap()` should be more appropriate in most cases.
comment on: http://stackoverflow.com/a/35758176
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/23151245
has title: difference between dates in array
has comment: http://stackoverflow.com/comment/35400722
possible better answer: http://stackoverflow.com/a/23151676
has comment: http://stackoverflow.com/comment/35400405
has answer: http://stackoverflow.com/a/23152076
has answer: http://stackoverflow.com/a/23151676
type: AnsweredQuestion
tagged with: java
has body: I have to sort through a Date[] and calculate what the largest span between entries is in days. The values are parsed to Date from string values (being passed from the database) An example date array would look like so: Date[] myDateArray = {01/01/2014,03/01/2014,04/01/2014,07/01/2014,19/01/2014}; This is a snippet of my method. temp = i_value = j_value = max = maxdiff = diff = 0; for (int i = 0; i &lt; dateValues.length; i++) { for (int j = i + 1; j &lt; dateValues.length; j++) { cal.setTime(dateValues[i]); i_value = (cal.get(Calendar.YEAR) * 365) + cal.get(Calendar.DAY_OF_YEAR); cal.setTime(dateValues[j]); j_value = (cal.get(Calendar.YEAR) * 365) + cal.get(Calendar.DAY_OF_YEAR); max = Math.abs(i_value - j_value); } diff = Math.abs(max - max2); if (maxdiff &lt; diff) { maxdiff = diff; } temp = maxdiff; } return temp;
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/35401388
accepted answer: http://stackoverflow.com/a/23152076
has comment: http://stackoverflow.com/comment/35400502
linked to: http://stackoverflow.com/q/5927109
score: 0
has comment: http://stackoverflow.com/comment/35400847
has comment: http://stackoverflow.com/comment/35400795

http://stackoverflow.com/a/23286755
answers question: http://stackoverflow.com/q/23286383
score: 2
type: AcceptedAnswer
downvote count: 0
has body: If you already have the folder names as a String list in the desired order, why do you use File.listFiles()? Just create the File objects from the names in the order they are listed, like this: List&lt; String &gt; arrayList = Arrays.asList("Folder3", "Folder1", "Folder2"); File parent = new File("/path"); File[] arr = new File[arrayList.size()]; for ( int i = 0; i &lt; arr.length; i++ ) arr[i] = new File(parent, arrayList.get(i)); // Now arr will contain File objects in the order they are listed in arrayList
type: Answer
upvote count: 2
accepted answer of: http://stackoverflow.com/q/23286383

http://stackoverflow.com/comment/127453418
comment on: http://stackoverflow.com/a/23139903
has text: @PauloGuedes The method reference it's is transformed into something that that implements `Functional`. In this case, the two arguments to `func` would be propagated to `method`, invoked on example`.
score: 1
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/35432006
type: Comment
type: AnswerComment
has text: IDEA doesn't let me define another JPA facet for `persistence.xml`, just orm.xml, and I need to `main/persitence.xml` (obviously). As I have mentioned, I am missing something from the general flow here, so I would be more than grateful if you could elaborate. Thank you!
score: 0
comment on: http://stackoverflow.com/a/23160474

http://stackoverflow.com/q/23147190
linked to: http://stackoverflow.com/q/965692
tagged with: eclipse
possible better answer: http://stackoverflow.com/a/23147231
type: Question
has answer: http://stackoverflow.com/a/23147231
answer count: 2
has title: How can I add classes in different folder to my .java file in my package?
score: 0
accepted answer: http://stackoverflow.com/a/23147232
has body: I'm using Eclipse Java EE IDE for Web Developers. In Eclipse I have a folder that contains two classes I'm using for a web project: I tried to import them in my .java file in my package, but they are not recognized by Eclipse and an error appears. "The import CookieUtilities cannot be resolved" and "The import LongLivedCookie cannot be resolved" Importing by: import CookieUtilities.*; import LongLivedCookie.*; How can I import these classes to my .java file in my package? BTW: These classes have an icon with a J010 on them, which I'm not sure what that means. If you click on the file it states: "Source not found" There is no source file attached to the class file LongLivedCookie.class.
duplicate of: http://stackoverflow.com/q/965692
has answer: http://stackoverflow.com/a/23147232
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/35544218
comment on: http://stackoverflow.com/a/23232029
type: AnswerComment
score: 0
has text: @fstd That's a bit soon to downvote, already amended.
type: Comment

http://stackoverflow.com/comment/35418595
comment on: http://stackoverflow.com/q/23161177
score: 0
has text: @Arjit you mean like this? jl.setText(toString()); instead do jl.setText.String.valueOf(expected); ???
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23170190
has comment: http://stackoverflow.com/comment/35434191
upvote count: 1
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/35434205
answers question: http://stackoverflow.com/q/23170143
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/23170143
has body: "C" is definitely the right answer. Any answer that requires package xcom is incorrect, because TestXcom is outside the xcom package Answer "B" is incorrect, because it does not let us use class B, only class A. This leaves us with answer "C". Note that this test is too easy to guess. A choice for "B" saying B. import xcom.A; import xcom.B; would be a lot harder to answer, because the student would need to examine main() more closely to see that only the xcom.B class is used, not xcom.A. The fact that B extends A does not make it a requirement to import A in the code that uses B. Using import xcom.* would be another valid possibility.

http://stackoverflow.com/a/23194076
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/35479558
type: Answer
has comment: http://stackoverflow.com/comment/35479589
answers question: http://stackoverflow.com/q/23193534
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/35479775
accepted answer of: http://stackoverflow.com/q/23193534
has body: You need to reference AppCompat. Download the support library under extras from Android sdk Manager. AppCompat is located @ android sdk/extras/android/support/v7/appcompat/ Import the library project into workspace. Select File > Import. Select Existing Android Code Into Workspace and click Next. Browse ( android sdk/extras/android/support/v7/appcompat/) and click finish Right click on your project. Goto properties. Android. Add. Browse and Reference AppCOmpat. Done. Snaps Library project imported to eclipse Referenced AppCompat
has comment: http://stackoverflow.com/comment/35479131

http://stackoverflow.com/q/23206713
tagged with: java
tagged with: ssl
has body: I have got a server with self-signed certificate. I've imported it with a keytool on my computer and use -Djavax.net.ssl.trustStore=blabla compile argument. When I try to run the following code: SSLSocketFactory factory = HttpsURLConnection.getDefaultSSLSocketFactory(); SSLSocket socket = (SSLSocket) factory.createSocket("MY_URL_DIGITS", 443); OutputStream os = socket.getOutputStream(); os.write("Test request \n".getBytes()); os.flush(); os.close(); Everything goes alright and I can see the "Test request" on the server. However, when I run: URL url = new URL("https://MY_URL_DIGITS"); HttpsURLConnection con = (HttpsURLConnection) url.openConnection(); OutputStream os = con.getOutputStream(); os.write("Test request \n".getBytes()); os.flush(); os.close(); I've got the javax.net.ssl.SSLHandshakeException: java.security.cert.CertificateException: No subject alternative names present So what is the principal difference between these two snippets?
has title: Where SSLSocketFactory and HttpsURLConnection work diffrerently?
answer count: 2
has answer: http://stackoverflow.com/a/23207945
downvote count: 0
score: 1
tagged with: ssl-certificate
favorite count: 0
has answer: http://stackoverflow.com/a/23207688
type: UnansweredQuestion
upvote count: 1
type: Question
linked to: http://stackoverflow.com/q/8744607

http://stackoverflow.com/comment/35485549
comment on: http://stackoverflow.com/q/23199206
score: 0
type: Comment
type: QuestionComment
has text: If it really isn't a race condition, then I would guess that somehow you are not actually accessing the same map. Could you add more of the relevant code?

http://stackoverflow.com/comment/35565484
score: 0
has text: I thought I'd covered that by saying it is changing the pointer to the existing `Object`. I agree though, this might come off a little vague.
type: Comment
comment on: http://stackoverflow.com/a/23237753
type: AnswerComment

http://stackoverflow.com/comment/35529528
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23223891
has text: so the JRE isnt required??
type: AnswerComment

http://stackoverflow.com/q/23215882
tagged with: java
type: Question
has body: I am working for my customer in a Java EE project, where we use JGoodies for binding JTable rows to text fields below the table. This works fine, but in one dialog, there are filtering check boxes. When all the check boxes - three in number - are clicked, all items become visible. If non are checked, the table remains empty. It is possible to filter out some rows, but JGoodies, which uses the table model, is not aware of this filtering. When clicking the first row in the filtered table, the first row elements of the unfiltered table are displayed in the text fields below. Is there a way to circumvent this problem? To my opinion, the problem is not a JGoodies problem, but binding a text field with JGoodies using the table model of a table that has been filtered. I attached an example, where I couldn't manage to bind the text field with the Bindings.bind method, but it shows the problem. I adopted some code found on the Internet for my purposes. The table is filtered according to the combo box contents. If the GENERAL type of eating is selected, the binding of the text field below is fine. If, however, the combo box selects parts of the table contents, the text field below still gets the information from the (unfiltered) table model. Here, I need information how can I do this in the proper way. Thank you for your help in advance! import java.awt.event.MouseEvent; import java.awt.event.MouseListener; /** * A simplified mouse listener that reacts when the mouse has been clicked or pressed. * * @since 2013-08-12 */ public abstract class ASimpleMouseListener implements MouseListener { /** * Event method that is called when the mouse has been clicked or pressed. * * @param mouseEvent the mouse event */ public abstract void mouseClickedOrPressed(final MouseEvent mouseEvent); /** * {@inheritDoc} */ @Override public void mouseClicked(final MouseEvent mouseEvent) { mouseClickedOrPressed(mouseEvent); } /** * {@inheritDoc} */ @Override public void mousePressed(final MouseEvent m…
upvote count: 3
has comment: http://stackoverflow.com/comment/35521870
tagged with: jgoodies
favorite count: 0
has title: How to bind a filtered table using the JGoodies library?
type: UnansweredQuestion
tagged with: swing
score: 3
downvote count: 0
answer count: 0

http://stackoverflow.com/comment/35444060
type: Comment
has text: Here is the output: http://pastebin.com/Wp6bFZVx
score: 0
comment on: http://stackoverflow.com/q/23175564
type: QuestionComment

http://stackoverflow.com/comment/35525150
type: Comment
has text: i dont use pop up windows much but try adding your button to the xml file, (R.layout.storemenu) and then putting a touch listener onto your button. in that on press you would want pw.dismiss, and pw should be a field variable for this. also as opposed to expanding with new questions in the comment start a new question if this one is solved.
comment on: http://stackoverflow.com/a/23220786
score: 0
type: AnswerComment

http://stackoverflow.com/a/23179807
score: 0
has body: Try this.. If you declare ActivityB.class in manifest this should work. Intent i = new Intent(MainActivity.this, ActivityB.class); startActivity(i);
type: Answer
answers question: http://stackoverflow.com/q/23179795

http://stackoverflow.com/comment/35586725
comment on: http://stackoverflow.com/q/23254166
type: QuestionComment
score: 0
has text: Answer edited with example
type: Comment

http://stackoverflow.com/comment/35449751
type: Comment
type: QuestionComment
score: 0
has text: Most of the time, error messages aren't the best "programmer advisory" when it comes to fixing coarse syntax errors. After `new ArrayList<Double>` you don't put a pair of brackets `[]` but a pair of parentheses `()`!
comment on: http://stackoverflow.com/q/23178942

http://stackoverflow.com/comment/35557878
type: Comment
comment on: http://stackoverflow.com/a/23239806
score: 0
type: AnswerComment
has text: If the execution in run method is in mid-way , how could i use a return or break loop based on interrupt flag??

mime-message
tags question: http://stackoverflow.com/q/23260313
tag name: mime-message
type: Tag

http://stackoverflow.com/q/23234215
upvote count: 1
answer count: 1
tagged with: arrays
has comment: http://stackoverflow.com/comment/35547911
favorite count: 0
has comment: http://stackoverflow.com/comment/35547962
has comment: http://stackoverflow.com/comment/35547951
has answer: http://stackoverflow.com/a/23234245
accepted answer: http://stackoverflow.com/a/23234245
has comment: http://stackoverflow.com/comment/35547933
has comment: http://stackoverflow.com/comment/35548036
has comment: http://stackoverflow.com/comment/35548017
has comment: http://stackoverflow.com/comment/35548225
has comment: http://stackoverflow.com/comment/35548034
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/35584063
score: -1
has body: I know that if you want to declare an array in Java you should use syntax like: class Dog { Dog[] pets = new Dog[7]; } but I saw another format in "Head First Java" (p83) that Eclipse gives me a syntax error for: class Dog { Dog[] pets; pets = new Dog[7]; } Could somebody please explain the reason? Thanks
type: Question
downvote count: 2
has title: different ways of declaring and defining a variable in java
has comment: http://stackoverflow.com/comment/35548830

http://stackoverflow.com/q/23184134
favorite count: 0
tagged with: ajax
tagged with: http://stackoverflow.com/tag/html
has answer: http://stackoverflow.com/a/24158353
score: 2
upvote count: 2
tagged with: twitter-bootstrap
type: UnansweredQuestion
has body: I have a form login that do the loginCheck using ajax, If I type the wrong password, it just displays an alert message, but if I use the correctly password it redirect me to the admin page. The problem is if I call $('html').html(data); after the login check in ajax, the bootstrap components are not rendered perfectly. For example, nothing happens if I click the dropdown menu, but if I admin page directly, everything works perfectly. Is there something wrong with using$('html').html(data); when also using bootstrap? Code: $(document).ready(function() { $('#formlogin').on('submit', function(e) { // don't let the browser submit the form e.preventDefault(); var login = $('#usuario').val(); var senha = $('#senha').val();; if(login.length &gt; 1 &amp;&amp; senha.length &gt; 1) { $.ajax({ url: 'http://localhost:8080/Test/doLogin', async: true, cache: false, type: 'POST', data: {"usuario.nome":$("#usuario").val(), "usuario.senha":$("#senha").val(), dataType: 'text', }, success: function(data) { $('html').html(data); } }); } else { alert("Login e Senha devem ser preenchidos."); } return false; }); });
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/35461172
has title: Bootstrap not 100% using $('html').html(data);
answer count: 1
downvote count: 0
tagged with: vraptor

http://stackoverflow.com/q/23164402
has comment: http://stackoverflow.com/comment/35424350
has answer: http://stackoverflow.com/a/23164466
tagged with: substring
has body: Suppose I have a string like this one: "(...) Example: Hello world. Description: Here is a long text, with words and ponctuation. This is the part I need. This part I do not need: End of the example. (...)" How do I get only this substring: Here is a long text, with words and ponctuation. This is the part I need. Where I wrote (...) is the continuation of the string, I'm dealing with a long text but want to get just the Description in this case. I want everything (words, dots, commas, etc) between "Description:" and the word(s) before the next ":" The exact example: Job Title: Java Programmer Date: 18/04/2014 Quantity: 4 vacancies Job Description: Implement systems under a software factory, work with Agile, Spring, Hibernate and GWT. Higher Education in computer science. TDD course. Knowledge in agile methodologies, described activities, TDD and BDD. Having good communication. Notes: Benefits: Healthcare / Medical Group, Ticket-feeding, Transportation voucher scheme Hiring: CLT (Permanent) Hours: Monday to Friday from 8am to 17h30 with 1h30 lunch. I need: Implement systems under a software factory, work with Agile, Spring, Hibernate and GWT. Higher Education in computer science. TDD course. Knowledge in agile methodologies, described activities, TDD and BDD. Having good communication. The substring after "Description:" and before "Note:" in this case, but this second word (Note:) can be any word(s). That's why I thing I need a regular expression, but don't know what is it.
type: Question
has comment: http://stackoverflow.com/comment/35424258
has comment: http://stackoverflow.com/comment/35424314
has title: How to get the substring between ":"
score: 0
answer count: 3
tagged with: regex
has comment: http://stackoverflow.com/comment/35424359
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23164483
tagged with: java
has answer: http://stackoverflow.com/a/23164581

http://stackoverflow.com/q/23154387
downvote count: 0
has comment: http://stackoverflow.com/comment/35405642
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
accepted answer: http://stackoverflow.com/a/24565505
tagged with: android
type: AnsweredQuestion
tagged with: java
type: Question
score: 5
has body: I'm using in my style.xml as main app theme &lt;style name="AppTheme" parent="Theme.AppCompat.Light"&gt; And all AlertDialogs using same white/blue colors. But i have Activities which working as Dialog parent="android:Theme.Dialog" and this box use dark theme. How could I change it to AppCompat.Light theme? I tryed Theme.AppCompat.Light.Dialog but as you know it doesn't working well. Thanks.
linked to: http://stackoverflow.com/q/18453939
upvote count: 5
has answer: http://stackoverflow.com/a/24565505
has title: Change android:Theme.Dialog to Light AppCompat Dialog
answer count: 1
has comment: http://stackoverflow.com/comment/35405731

http://stackoverflow.com/a/23179465
has body: Put the HTML in the same directory as the Jar(s) for local and server, and the answer for both is the same - ".". The . means 'current directory'.
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/23174281
downvote count: 0
type: Answer

http://stackoverflow.com/q/23217167
has title: Time based thread synchronization in java
type: Question
has answer: http://stackoverflow.com/a/23221168
has comment: http://stackoverflow.com/comment/35516960
downvote count: 0
has comment: http://stackoverflow.com/comment/35516919
has comment: http://stackoverflow.com/comment/35517863
possible better answer: http://stackoverflow.com/a/23217277
answer count: 3
has answer: http://stackoverflow.com/a/23217277
tagged with: synchronization
favorite count: 0
accepted answer: http://stackoverflow.com/a/23221168
has body: Wondering if there is any time based synchronization in java. for example the below synchronization locks an object and waits until //my application processor finishes the task. synchronize (myobject) { //my application processor. } With the same, is there any way to say synchronize for only 1 min or 2 min. synchronize (only for 1 min &amp;&amp; object) { //my application processor } or is there any other way in Java synchronization method. P.S: I don't want to run another ThreadManager to monitor the above. And I don't want to run while loop.
tagged with: multithreading
has answer: http://stackoverflow.com/a/23218402
upvote count: 1
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35517039
score: 1
tagged with: java

nullable
tag name: nullable
type: Tag
tags question: http://stackoverflow.com/q/23266441

http://stackoverflow.com/comment/35367239
has text: Why are you using 3 different arraylist for handling your data , make custom class which is having all these data types , and use array list of that class
comment on: http://stackoverflow.com/q/23132571
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/35540944
score: 0
type: AnswerComment
has text: Oddly the method is `void` - so you can not return anything. Maybe just print something or so.
type: Comment
comment on: http://stackoverflow.com/a/23229751

http://stackoverflow.com/comment/35382191
type: Comment
type: QuestionComment
has text: any error or exception you are geting?
comment on: http://stackoverflow.com/q/23140461
score: 0

http://stackoverflow.com/q/23148572
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/23148609
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/23148739
has comment: http://stackoverflow.com/comment/35396822
tagged with: facebook-graph-api
favorite count: 0
linked to: http://stackoverflow.com/q/14621688
type: UnansweredQuestion
tagged with: android
tagged with: facebook
has title: facebook login button works for my account but not for my friend's account
has body: I'm writing an app with facebook login (using facebook login button). I succeeded loging in with my user in facebook but failed logging in with my friend's {Session state:CLOSED_LOGIN_FAILED, token:{AccessToken token:ACCESS_TOKEN_REMOVED permissions:[]}, appId:131390430364547} after the user press OK on the permission dialog. this is my code: public class FacebookLogin3Activity extends BaseActivity { private Session.StatusCallback callback = new Session.StatusCallback() { @Override public void call(Session session, SessionState state, Exception exception) { // String hashNew = getHash(); onSessionStateChange(session, state, exception); if (session.isOpened()) { StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder() .permitAll().build(); StrictMode.setThreadPolicy(policy); Log.e("user", "session established"); Request.newMeRequest(session, new Request.GraphUserCallback() { @Override public void onCompleted(GraphUser user, Response response) { if (user != null) { Log.e("user", "loged user"); // buildUserInfoDisplay(user); } } }).executeAsync(); } else { Log.e("user", "session not established"); } } private void onSessionStateChange(Session session, SessionState state, Exception exception) { } }; private String getHash() { PackageInfo info; String hash = "no data"; try { info = getPackageManager() .getPackageInfo("com.example.manyexampleapp", PackageManager.GET_SIGNATURES); for (Signature signature : info.signatures) { MessageDigest md = MessageDigest.getInstance("SHA"); md.update(signature.toByteArray()); hash = Base64.encodeToString(md.digest(), Base64.DEFAULT); Log.d("KeyHash:", Base64.encodeToString(md.digest(), Base64.DEFAULT)); } } catch (NameNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (NoSuchAlgorithmException e) { // TODO Auto-generated catch block e.printStackTrace(); } return hash; } private UiLifecycleHelper uiHelper; // and in the on create method to use // the login button public void onCreate(Bund…
tagged with: java
upvote count: 1

http://stackoverflow.com/comment/101763021
comment on: http://stackoverflow.com/a/23264495
score: 0
type: AnswerComment
type: Comment
has text: @jacobhyphenated, `LocalDateTime` always uses system-default timezone. That's what "Local" means in its name.

http://stackoverflow.com/a/23541037
type: Answer
has comment: http://stackoverflow.com/comment/36136708
accepted answer of: http://stackoverflow.com/q/23269546
has comment: http://stackoverflow.com/comment/36116936
score: 0
has body: After login click you need some wait for element. When title will be changed you could check, but not before that event.
answers question: http://stackoverflow.com/q/23269546
type: AcceptedAnswer

debugging
tags question: http://stackoverflow.com/q/23288402
tags question: http://stackoverflow.com/q/23147726
tag name: debugging
tags question: http://stackoverflow.com/q/23161197
tags question: http://stackoverflow.com/q/23181306
tags question: http://stackoverflow.com/q/23241878
tags question: http://stackoverflow.com/q/23206154
type: Tag
tags question: http://stackoverflow.com/q/23142741
tags question: http://stackoverflow.com/q/23150971
tags question: http://stackoverflow.com/q/23258988
tags question: http://stackoverflow.com/q/23167232
tags question: http://stackoverflow.com/q/23234134

http://stackoverflow.com/comment/35497288
type: Comment
comment on: http://stackoverflow.com/q/23205867
type: QuestionComment
has text: it is one of the glorious things about programming.
score: 0

http://stackoverflow.com/a/23228055
has comment: http://stackoverflow.com/comment/35558799
type: Answer
has comment: http://stackoverflow.com/comment/35539386
has comment: http://stackoverflow.com/comment/35558957
downvote count: 0
score: 3
has body: Add KeyListener on the component. public void keyReleased(KeyEvent event) { if(event.getKeyCode()==KeyEvent.VK_CONTROL){ // ctrl key is released } }
answers question: http://stackoverflow.com/q/23227983
upvote count: 3
has comment: http://stackoverflow.com/comment/35558850
accepted answer of: http://stackoverflow.com/q/23227983
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35570886
has comment: http://stackoverflow.com/comment/35574689

http://stackoverflow.com/comment/133710441
comment on: http://stackoverflow.com/a/48197071
has text: Like I said, I don't know the spring batch specifics anymore and I'm assuming jobs that failed previously don't keep the "running" status. If they do, there's not much to filter on and you'll have to take a look at your exception handling to make sure they get the "error" status.
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/35644376
score: 0
type: AnswerComment
type: Comment
has text: @drewmore just to clarify does it mean that i can`t use a Filewriter to save arrays, i have to use object output stream to save the array? I have edited my code above. Could you help me check if i did it right please?
comment on: http://stackoverflow.com/a/23285456

http://stackoverflow.com/comment/35614034
has text: read the error log. `Dialog.java:21`. `ImageView cannot be cast to TextView`. (close as typo)
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23270704

http://stackoverflow.com/comment/97799720
comment on: http://stackoverflow.com/q/23260821
has text: The reason for closing this question is doubtful. As shown, the question can be answered concisely enough.
score: 0
type: Comment
type: QuestionComment

deserialization
type: Tag
tags question: http://stackoverflow.com/q/23195843
tag name: deserialization
tags question: http://stackoverflow.com/q/23244383
tags question: http://stackoverflow.com/q/23263353

http://stackoverflow.com/q/23170448
has comment: http://stackoverflow.com/comment/35434965
has comment: http://stackoverflow.com/comment/35434720
has answer: http://stackoverflow.com/a/23170777
has answer: http://stackoverflow.com/a/23170482
linked to: http://stackoverflow.com/q/18084776
linked to: http://stackoverflow.com/q/1552301
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35434848
downvote count: 0
tagged with: string
favorite count: 0
has body: I know that the title of the question is not very clear, sorry about that, did not know how to put it up. I have a very basic java implementation question which I want to focus on application performance, but it also involves String creation pattern in java. I understand the immutability concept of Strings in Java. What I am not sure about is that, I have read somewhere that the following will not make two different String objects: String name = "Sambhav"; String myName= "Sambhav"; I want to know how does Java do that? Does it actually look for a String value in the program memory and check for its existence and if it does not exist then creates a new String object? In that case obviously it is saving memory but there are performance issues. Also lets say I have a code like this: public void some_method(){ String name = "Sambhav"; System.out.println(name); // or any random stufff } Now on each call of this function, is there a new String being made and added to memory or am I using the same String object? I am just curious to know about the insights of how all this is happening? Also if we say that String name = "Sambhav"; String myName= "Sambhav"; will not create a new object because of reference, what about String name = new String("Sambhav"); String myName= new String("Sambhav"); Will Java still be able to catch that the string are the same and just point myName to the same object as created in the previous statement?
has answer: http://stackoverflow.com/a/33427614
type: Question
linked to: http://stackoverflow.com/q/2486191
has comment: http://stackoverflow.com/comment/35435324
has comment: http://stackoverflow.com/comment/35434752
has comment: http://stackoverflow.com/comment/35434744
score: 4
tagged with: performance
has answer: http://stackoverflow.com/a/23170750
tagged with: java
has comment: http://stackoverflow.com/comment/35435492
has title: Java String Immutability and Using same string value to create a new string
upvote count: 4
accepted answer: http://stackoverflow.com/a/33427614
answer count: 4
possible better answer: http://stackoverflow.com/a/23170482

http://stackoverflow.com/comment/35582808
type: QuestionComment
has text: As in the collasped menu button in the header?
comment on: http://stackoverflow.com/q/23253638
score: 0
type: Comment

http://stackoverflow.com/comment/35544224
type: QuestionComment
comment on: http://stackoverflow.com/q/23201031
has text: You're not being clear. What does 'unknown error' mean? Do you get the 'Pincode city:' part of the output? This mightn't be a Base64 problem at all, just an I/O problem.
score: 0
type: Comment

http://stackoverflow.com/comment/134800441
type: AnswerComment
has text: Readers copying this slick solution should be aware, though, that CSV allows for the separator characters comma and newline to appear in the data if properly escaped. `Files.lines()` as well as `line.split(",")` will produce wrong results in these cases.
type: Comment
comment on: http://stackoverflow.com/a/23202527
score: 1

http://stackoverflow.com/a/23186602
has comment: http://stackoverflow.com/comment/35463261
answers question: http://stackoverflow.com/q/23186592
has comment: http://stackoverflow.com/comment/35463368
type: Answer
has comment: http://stackoverflow.com/comment/35463323
upvote count: 2
has comment: http://stackoverflow.com/comment/35463048
has body: Your class name don't (and can't) have () so why you do extends sistemi()? Just extends sistemi
score: 2
has comment: http://stackoverflow.com/comment/35463091
has comment: http://stackoverflow.com/comment/35463108
has comment: http://stackoverflow.com/comment/35463175
has comment: http://stackoverflow.com/comment/35463024
has comment: http://stackoverflow.com/comment/35463185
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/35463085
accepted answer of: http://stackoverflow.com/q/23186592

http://stackoverflow.com/comment/35647652
type: QuestionComment
type: Comment
score: 0
has text: what is the purpose of `Thread.sleep(20)`??
comment on: http://stackoverflow.com/q/23288595

search-engine
type: Tag
tags question: http://stackoverflow.com/q/23242729
tag name: search-engine
tags question: http://stackoverflow.com/q/23192736

http://stackoverflow.com/q/23196541
type: Question
has comment: http://stackoverflow.com/comment/35555631
answer count: 2
has body: i have been trying to run a maven project as dynamic web project in local server to get hot re-deployment feature, which is currently not available appengine maven plugin with eclipse i referred : https://developers.google.com/appengine/docs/java/webtoolsplatform this project works fine when running using mvn:appengine devserver command, but we i tried to run on local server, i get the following error Error occurred during initialization of VM agent library failed to init: instrument Error opening zip file or JAR manifest missing : /Volumes/My any idea what this error means? Note: the ultimate goal was to some how synchronous changes in src war folder to be present in target directory to avoid stopping and starting server for every changes any solutions to solve this issue is most welcome! Thanks
has answer: http://stackoverflow.com/a/23207781
score: 0
tagged with: google-app-engine
type: UnansweredQuestion
tagged with: maven
tagged with: appengine-maven-plugin
has title: Appengine Maven Project run as wtp on local server issue
has answer: http://stackoverflow.com/a/23199251
tagged with: java
tagged with: eclipse

http://stackoverflow.com/comment/35462843
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23186470
score: 0
has text: What is the return type of `editText_note.getText()` ?

http://stackoverflow.com/a/23151102
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23151049
answers question: http://stackoverflow.com/q/23151049
has body: You can use Map&lt;String, Set&lt;Integer&gt;&gt;. In your case, you would get: "Mailbox" -&gt; {101, 102} Example: Map&lt;String, Set&lt;Integer&gt;&gt; map = new HashMap&lt;String, Set&lt;Integer&gt;&gt;(); // + some for loop here Set&lt;Integer&gt; ints = map.get(type); if(ints == null) { ints = new HashSet&lt;&gt;(); map.put(type, ints); } ints.add(intToAdd);
type: Answer
has comment: http://stackoverflow.com/comment/35402428
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/35404508

http://stackoverflow.com/q/23173285
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/35440772
has comment: http://stackoverflow.com/comment/35441404
has comment: http://stackoverflow.com/comment/35441605
has comment: http://stackoverflow.com/comment/35439740
has title: In Java, how to properly call the Arrays class methods?
score: -1
has answer: http://stackoverflow.com/a/23173326
upvote count: 3
answer count: 2
tagged with: methods
possible better answer: http://stackoverflow.com/a/23173330
has answer: http://stackoverflow.com/a/23173330
tagged with: java
has body: EDIT: Seriously, what's with the downvotes? I thought I described my issue with adequate details and researched this fairly well before posting even if I wasn't able to find the answer on my own. There is a built-in Arrays class in Java that has some useful methods for arrays, like binarysearch() and sort(), but for some reason I can't figure out how to call its methods correctly. I'm trying to search inside an array for a specific string, and I want to return the index if found, so I tried this: int rankID = Arrays.binarysearch(cardRanks, myRank); Where "cardRanks" is my array and "myRank" is my passed in string parameter that I want to search for. I also tried this (although I suspect this returns a boolean rather than an integer): int rankID = Arrays.asList(cardRanks).contains(myRank); Whenever I try any of these I get this same error at compile: Error: cannot find symbol symbol: variable Arrays This error is basically telling me that the compiler doesn't recognize "Arrays" as the class and is treating it like a variable. From what I understand there isn't any "#include" type statement in Java, which was my first guess, and so I'm assuming that the built-in classes are just included (although this would be the source of my trouble if my assumption is wrong). I've looked up several tutorials on arrays and questions on forums about binarysearch() and the Arrays class (which is how I found out about the "aslist.contains" part) but I haven't been able to find this answer. What am I doing wrong? What is the proper way to call the Arrays class methods? Is there another way to tell the compiler that I want to use the java.util.Arrays library? This is the rest of the code I'm using in this particular class, in case the error lies elsewhere in my code: class PlayingCards { private static String[] cardRanks = {"Ace","2","3","4","5","6","7","8","9","10","Jack","Queen","King"}; private static String[] cardSuits = {"spades", "hearts", "clubs", "diamonds"}; private String rank…
accepted answer: http://stackoverflow.com/a/23173326
downvote count: 4
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35439818
tagged with: arrays
has comment: http://stackoverflow.com/comment/35439881

http://stackoverflow.com/q/23132375
tagged with: multithreading
upvote count: 16
type: Question
linked to: http://stackoverflow.com/q/2238272
tagged with: java
duplicate of: http://stackoverflow.com/q/2238272
linked to: http://stackoverflow.com/q/7759948
has comment: http://stackoverflow.com/comment/35366863
answer count: 2
has answer: http://stackoverflow.com/a/23132562
downvote count: 0
has comment: http://stackoverflow.com/comment/35366563
score: 16
favorite count: 0
has answer: http://stackoverflow.com/a/23132851
has title: Is it possible to run multithreaded application on a single core of multicore computer?
has comment: http://stackoverflow.com/comment/35366620
possible better answer: http://stackoverflow.com/a/23132851
tagged with: c++
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23132562
has body: I have an application that I need to run multithreaded but I want it to use only one core of the computer, as if my computer has single core (I know the behavior of multithreaded application on a computer with single core), although it is not. This application is going to be deployed on a customer computer (Windows XP &amp; 7) and I don't want my application to use more than one core. Can this be done? Does it depend on the programming language? Or all the thread management is left to the OS? Thanks in advance.

http://stackoverflow.com/comment/35364283
comment on: http://stackoverflow.com/a/23130977
has text: are you assuming that in the begining of the code the date value is Thu April 17 10:03:01 GMT 2014?
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/23165458
has comment: http://stackoverflow.com/comment/35426218
answers question: http://stackoverflow.com/q/23165449
has comment: http://stackoverflow.com/comment/35426192
type: AcceptedAnswer
has body: You don't have a constructor Gerbil(int a) in the class Gerbil and you try to call it! Just call it this way: GerbilArray[i] = new Gerbil();
upvote count: 1
type: Answer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23165449
score: 1

http://stackoverflow.com/comment/35520945
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23219330
has text: Ok i see your point. But what is the correct path to use ? I use Maven to manage my dependencies.In eclipse, when i made a clean install the jar are into the target directory inside WEB-INF/lib. Looks weird, and more , the path will change on deployement , no ?

http://stackoverflow.com/q/23213153
has title: How to handle network state and HTTP status codes correctly
tagged with: http
type: Question
has answer: http://stackoverflow.com/a/23216694
answer count: 2
score: 0
has comment: http://stackoverflow.com/comment/35510670
has answer: http://stackoverflow.com/a/23213258
tagged with: http-status-codes
type: UnansweredQuestion
tagged with: android
has body: Within a method I'm sending GET and POST requests using the HttpURLConnection. As you can see in the example code, I'm catching most of the exceptions. But I wonder if this is the correct way and how I actually should handle sitations like "no network available" and bad status codes in the response from the server? I ask this because I want to inform the user about the various problems. public static Bitmap getImage(String url) { HttpURLConnection conn = null; try { URL newUrl = new URL(url); conn = (HttpURLConnection) newUrl.openConnection(); conn.setDoInput(true); conn.setDoOutput(false); conn.setUseCaches(false); conn.setRequestProperty("Accept-Charset", "utf-8"); conn.setRequestProperty("Content-Type", "image/png"); conn.setRequestMethod("GET"); conn.connect(); int total = conn.getContentLength(); InputStream is = conn.getInputStream(); // ... read the image here! } catch (MalformedURLException e) { e.printStackTrace(); return null; } catch (NullPointerException e) { e.printStackTrace(); return null; } catch (IOException e) { e.printStackTrace(); return null; } finally { if (conn != null) conn.disconnect(); if (progress != null) progress.setProgress(1f); } }
tagged with: java

http://stackoverflow.com/q/23242519
has answer: http://stackoverflow.com/a/23242758
favorite count: 0
tagged with: android
has comment: http://stackoverflow.com/comment/35565200
has title: How to perform simple Http Post in android?
has comment: http://stackoverflow.com/comment/35565512
type: UnansweredQuestion
has body: I'm new to http Post. All i want to do is to send that access_id=44321 as a url like http://myurl.com/access_id=44321 will insert 44321 to access_id in the database how to perform this operation. Am I doing it Right ? Thanks for the help ! public class IvrsPushService { URL url; HttpURLConnection conn; Details details; String userId; void pushData() throws Exception { // Create a new HttpClient and Post Header HttpClient httpclient = new DefaultHttpClient(); HttpPost httppost = new HttpPost("http://myurl.com/Acces/DEFAULT2.ASPX?"); try { String accessid=Details.getAssetid(); String userid=Details.getUserid(); String datetime=Details.getDate()+"\""+Details.getTime(); String mobilenumber="9785"; // Add your data List&lt;NameValuePair&gt; nameValuePairs = new ArrayList&lt;NameValuePair&gt;(2); nameValuePairs.add(new BasicNameValuePair("access", accessid)); nameValuePairs.add(new BasicNameValuePair("user", userid)); nameValuePairs.add(new BasicNameValuePair("date", datetime)); nameValuePairs.add(new BasicNameValuePair("mobilenumber", mobilenumber)); httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs)); // Execute HTTP Post Request HttpResponse response = httpclient.execute(httppost); } catch (ClientProtocolException e) { // TODO Auto-generated catch block } catch (IOException e) { // TODO Auto-generated catch block } } }
downvote count: 3
has answer: http://stackoverflow.com/a/23242605
tagged with: java
score: -3
type: Question
answer count: 2
tagged with: http-post
upvote count: 0

http://stackoverflow.com/q/23241815
type: Question
tagged with: c#
has comment: http://stackoverflow.com/comment/35562414
has comment: http://stackoverflow.com/comment/35561746
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/35562809
upvote count: 1
has comment: http://stackoverflow.com/comment/35562239
has comment: http://stackoverflow.com/comment/35562508
tagged with: asp.net
favorite count: 0
tagged with: soap
has title: Consume a .NET WebService which returns a DataSet with a Java Client
has body: I have a .NET Web Service that returns a DataSet. I want to consume this Web Service in my Java client. I understand that Java doesn't have a corresponding datatype but I've heard that it's possible to manually parse the SOAP response. How do I do this? Is there a better way to convert a DataSet to a Java compatible datatype? I'm also open to suggestion to change the return type of the Web Service to something that is more compatible with my Java Client. What is the "most" compatible datatype between .NET and Java when working with database data?
downvote count: 0
answer count: 0
type: UnansweredQuestion
tagged with: web-services

http://stackoverflow.com/comment/35588739
comment on: http://stackoverflow.com/q/23256551
type: Comment
type: QuestionComment
has text: If you're using reflection to invoke the method, the handling of parameters inside the method is the same as if you would invoke the method regulary.
score: 1

http://stackoverflow.com/a/57133490
type: Answer
has body: Underscore-java can convert xml to json and back. There are methods U.xmlToJson(xml) and U.jsonToXml(json). I am the maintainer of the project.
upvote count: 1
answers question: http://stackoverflow.com/q/23261889
downvote count: 0
score: 1

http://stackoverflow.com/q/23263534
tagged with: css
upvote count: 2
linked to: http://stackoverflow.com/q/570642
has answer: http://stackoverflow.com/a/65308002
answer count: 2
tagged with: select
has comment: http://stackoverflow.com/comment/35600621
has answer: http://stackoverflow.com/a/23266665
has body: I have a select tag use on my jsp page. When the options are added for select then the dropdown list of option covers half of my page as well as width is also as per data and thus goes out of the page thus hides half of my data. How can I set the height so when I click on the down arrow of the select it shows me first 5 options with a scroll for the others? And how to code so that its width can be adjusted?
tagged with: java
has title: How to set the height and width of select tag option's drop down list
score: 2
downvote count: 0
tagged with: javascript
type: UnansweredQuestion
favorite count: 0
type: Question
tagged with: http://stackoverflow.com/tag/html

http://stackoverflow.com/q/23202103
has title: Add value to key in hashmap
accepted answer: http://stackoverflow.com/a/23202134
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35490000
tagged with: hashmap
tagged with: java
possible better answer: http://stackoverflow.com/a/23202158
has answer: http://stackoverflow.com/a/23202134
has answer: http://stackoverflow.com/a/23202158
answer count: 2
has body: I have a hashmap of my custom objects and each user should have many values. I figured out how to create the map and put one value to key but need help with a check like this (pseudo code): If key exists then add another value to key else add key and value I currently have: Map&lt;String, custom&gt; map = new HashMap&lt;String, custom&gt;(); for(customp : data) { map.put(p.getUser(), p); } Output: user1 / package.class@1231412 user2 / package.class@12fwf3 user3 / package.class@dc238d Code to get output: for (Map.Entry&lt;String, custom&gt; entry : map.entrySet()) { System.out.println(entry.getKey() + " / " + entry.getValue()); } Need: user1 / package.custom@1231412, package.custom@vfee, package.custom@2riopj user2 / package.custom@12fwf3, package.custom@cwfc3 user3 / package.custom@324rrf, package.custom@23d, package.custom@cvewff2 I will eventually be iterating over the map to get each object and use them but right now the key keeps replacing itself so I do not have all of my information.
has comment: http://stackoverflow.com/comment/35490187
score: 0

http://stackoverflow.com/comment/35369318
type: Comment
type: QuestionComment
has text: I don't think this has anything to do with changing from JavaFX2.2 to Java 8: your code would fail in either.
score: 0
comment on: http://stackoverflow.com/q/23132302

http://stackoverflow.com/q/23209220
answer count: 2
downvote count: 0
favorite count: 0
has body: Is there a way to inline implementation of an interface without having its default constructor? To understand my question better, Lets say I have an interface MyInterface and one implementation of it called MyImplementation. public interface MyInterface { void myFunction(); } public MyImplementation implements MyInterface { private final String someString; public MyImplementation(String someString) { this.someString = someString; } public void myFunction() { // do something. } } Is there a way to inline MyImplementation? If I didn't have to pass someString to constructor of implementation I could just say - MyInterface myInterface = new MyInterface() { public void myFunction() { // do something } };
has title: Inlining implementation of an interface
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23209257
upvote count: 1
has comment: http://stackoverflow.com/comment/35503439
has answer: http://stackoverflow.com/a/23209308
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/35503399
has comment: http://stackoverflow.com/comment/35503477
type: Question

http://stackoverflow.com/comment/35608735
has text: Do you do something similar to that in other places? what about the space in "Error Cause"?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23267506
score: 0

http://stackoverflow.com/q/23180053
has comment: http://stackoverflow.com/comment/77060200
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/35452499
has title: java_home not found on osx mavericks
tagged with: macos
has comment: http://stackoverflow.com/comment/35520050
answer count: 0
type: UnansweredQuestion
tagged with: java-home
has comment: http://stackoverflow.com/comment/35452756
linked to: http://stackoverflow.com/q/26252591
score: 3
has body: Can anyone help me figure out why every command I execute involving JAVA_HOME results in -bash: /usr/libexec/java_home: No such file or directory interestingly when i do an ls -al of /usr/libexec/java_home is listed as lrwxr-xr-x 1 root wheel 79 Apr 10 13:15 java_home -&gt; /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java_home I am unable to run any java based programs because JDK isn't working.
upvote count: 3
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/86085477

http://stackoverflow.com/a/29335747
answers question: http://stackoverflow.com/q/23217151
type: Answer
upvote count: 1
has body: This was a bug in neo4j-jdbc. It has been fixed now. Take a look at this github issue. It matches exactly your case.
score: 1
downvote count: 0

http://stackoverflow.com/a/23275717
answers question: http://stackoverflow.com/q/23275539
type: Answer
has body: Alternatevely you can do it this way String[] a3 = Arrays.copyOf(a1, a1.length + a2.length); System.arraycopy(a2, 0, a3, a1.length, a2.length);
upvote count: 4
downvote count: 0
score: 4

http://stackoverflow.com/comment/35390069
comment on: http://stackoverflow.com/q/23144873
has text: @Jared: never needed in this situation. Ever.
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/23251201
answers question: http://stackoverflow.com/q/23251166
type: Answer
score: 2
upvote count: 2
has body: You cannot use a Java keyword as package name. See JLS on Names and Identifiers
downvote count: 0

http://stackoverflow.com/q/23160644
has body: In Java, when I get a ResultSet I made a method that would map that to a specified class. It more or less looks like this: public &lt;T&gt; T mapRow(ResultSet results, Class&lt;T&gt; type) { So, when I actually call the class, it looks like this: mapRow(results, Row.class); Please help me understand this conceptually. Why can I not just do something like mapRow&lt;Row&gt;(results);? Also, the current way I'm invoking mapRow, is there an implied &lt;Row&gt; before the method call?
type: Question
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/23160789
tagged with: java
has comment: http://stackoverflow.com/comment/35417474
has answer: http://stackoverflow.com/a/23160689
accepted answer: http://stackoverflow.com/a/23160689
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/23160789
tagged with: generics
linked to: http://stackoverflow.com/q/313584
has title: Java generic row mapper

http://stackoverflow.com/q/23149715
favorite count: 0
has title: returning a String with X repeated characters without a loop
upvote count: 1
possible better answer: http://stackoverflow.com/a/23149882
has answer: http://stackoverflow.com/a/23150173
has answer: http://stackoverflow.com/a/23149803
tagged with: java
has answer: http://stackoverflow.com/a/23149882
has comment: http://stackoverflow.com/comment/35398125
answer count: 7
accepted answer: http://stackoverflow.com/a/23149803
has comment: http://stackoverflow.com/comment/35398332
has answer: http://stackoverflow.com/a/23149845
has comment: http://stackoverflow.com/comment/35398304
downvote count: 0
has answer: http://stackoverflow.com/a/52528056
has comment: http://stackoverflow.com/comment/35398467
has answer: http://stackoverflow.com/a/23149752
has answer: http://stackoverflow.com/a/23150055
type: Question
type: AnsweredQuestion
score: 1
tagged with: string
has body: I stuck a little. I have a method, which should return a new String contains X times repeated character "y". X and Y are arguments of method. So, simple solution wiil be like this: public String someMethod(int x,char y){ String result=""; for (int i=0;i&lt;x;i++) result+=y; return result; } And I've tried to figure out, is there any way to do the same just in one line, without looping. For example: public String someMethod(int x,char y){ return new StringBuilder().append('y', x); } But there isn't such method for StringBuilder or StringBuffer or etc. Can you give me any suggestions? Thanks in advance. Updated: So, the solution will be: public String someMethod(int x,char y){ return new String(new char[x]).replace("\0", String.valueOf(y)) } Thanks for help!

http://stackoverflow.com/q/23182933
has title: Converting an Image DataUrl to Image
has comment: http://stackoverflow.com/comment/35456270
score: 1
tagged with: java
upvote count: 1
type: Question
has body: I want to take picture using webcam in my java web application.Now to do this i am using Photobooth.js that provide facility to click images in web applications. Now my problem is that as soon as I click button to take picture I want to save it in my computer with a name say temp.png in a specified folder say C:/MyPictures.But the picture being clicked by using photobooth.js provides a dataUrl of the form : data:image/png;base64,iVBORw0KGgoAAAANSU and so on a long string. How can i get image to specified location now? My code for using photobooth and displaying the clicked image is as follow: &lt;script type="text/javascript"&gt; $(document).ready(function () { $('#photo').photobooth().on("image", function (event, dataUrl) { alert(dataUrl); $("#gallery").show().html('&lt;img src="' + dataUrl + '" &gt;'); }); }); &lt;/script&gt; In html part : &lt;div id="photo"&gt;&lt;/div&gt; &lt;div id="gallery"&gt;&lt;/div&gt; Here is the .js file am using : https://github.com/WolframHempel/photobooth-js/blob/gh-pages/photobooth_min.js I got this code to convert dataURL to blob .Can it be helpful in getting me image to particular location ? function dataURLtoBlob(dataUrl) { // Decode the dataURL var binary = atob(dataUrl.split(',')[1]); // Create 8-bit unsigned array var array = []; for (var i = 0; i &lt; binary.length; i++) { array.push(binary.charCodeAt(i)); } // Return our Blob object return new Blob([new Uint8Array(array)], { type: 'image/png' }); }
tagged with: javascript
has comment: http://stackoverflow.com/comment/35456444
downvote count: 0
answer count: 1
tagged with: jquery
favorite count: 0
tagged with: ajax
has answer: http://stackoverflow.com/a/23183249
type: UnansweredQuestion

intellij-idea
tags question: http://stackoverflow.com/q/23249135
tags question: http://stackoverflow.com/q/23225283
tags question: http://stackoverflow.com/q/23131403
tags question: http://stackoverflow.com/q/23239748
tags question: http://stackoverflow.com/q/23152600
tags question: http://stackoverflow.com/q/23194304
tags question: http://stackoverflow.com/q/23138501
tags question: http://stackoverflow.com/q/23278341
type: Tag
tag name: intellij-idea
tags question: http://stackoverflow.com/q/23193200
tags question: http://stackoverflow.com/q/23143344
tags question: http://stackoverflow.com/q/23253156
tags question: http://stackoverflow.com/q/23160271
tags question: http://stackoverflow.com/q/23165637
tags question: http://stackoverflow.com/q/23247910
tags question: http://stackoverflow.com/q/23251166
tags question: http://stackoverflow.com/q/23236634
tags question: http://stackoverflow.com/q/23222257
tags question: http://stackoverflow.com/q/23174491
tags question: http://stackoverflow.com/q/23254550
tags question: http://stackoverflow.com/q/23221957
tags question: http://stackoverflow.com/q/23258582
tags question: http://stackoverflow.com/q/23228594
tags question: http://stackoverflow.com/q/23270354
tags question: http://stackoverflow.com/q/23213230

http://stackoverflow.com/comment/35589647
score: 2
has text: Welcome to Stack Overflow! This question looks like homework to me. While asking homework questions is perfectly fine, there are some good guidelines for asking homework questions here: [How do I ask and answer homework questions?](http://meta.stackexchange.com/a/10812/238586). Summarized, they are: make an attempt to solve the problem yourself first; ask about specific problems with your existing code; let us know that the question is homework; make sure your class allows using Q&A for help; don't copy and paste an answer's code without first understanding what it does and how it works.
type: Comment
comment on: http://stackoverflow.com/q/23257194
type: QuestionComment

http://stackoverflow.com/q/23217080
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/35516756
type: Question
has comment: http://stackoverflow.com/comment/35517012
has comment: http://stackoverflow.com/comment/35530430
tagged with: ubuntu
has answer: http://stackoverflow.com/a/23217509
has title: file.getName() on a File object created in Android from a file path generated in Java produces strange results
has body: I have a huge problem with a program that I either didn't have before or I didn't notice. I have to submit my work in 3.5 hours so hopefully someone who can help me sees this before then. I have a Java program with which a user would select files and then the paths of those files are passed to an Android application. Within the Android application, I create a new File object using the path, and then later on I call fileObject.getName(). This produces different results depending on if the Java program was run in Ubuntu or Windows. If run from Ubuntu then the Android app succesfully extracts the file name, however if run from windows then the Android app extracts the full path. I initially had the path which is sent to Android be the Canonical path, and I've since changed it to Absolute path because I wasn't sure if that was causing the issue. This hasn't resolved the problem. Is this issue a result of creating a File object within Android using a windows path? I thought that it wouldn't matter but I guess I was wrong. If anyone could help me within the next couple of hours you might save my degree, because this is an important project and I have already had to submit my report which does not mention this issue I have now encountered, so I can't even explain it any more I just have to fix it. For clarification, if I select a file in windows which has the path C:\Users\Username\Pictures\picture.jpeg and then pass it to Android, the getName() method return's that exact path from the method Whereas if I do it from ubuntu with the path /home/username/Pictures/picture.jpeg and pass it to Android then getName() returns just picture.jpeg which is exactly what I need. Many thanks.
tagged with: windows
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/35519993
tagged with: android
accepted answer: http://stackoverflow.com/a/23217509
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35517093
score: 1

android-gridview
type: Tag
tags question: http://stackoverflow.com/q/23152529
tag name: android-gridview

http://stackoverflow.com/q/23164750
type: Question
score: 0
has comment: http://stackoverflow.com/comment/35425629
has comment: http://stackoverflow.com/comment/35426243
has body: I'm having some trouble getting a search to work correctly. The first thing I'm doing is adding 2 values from 2 separate jtextfields and adding one to key and one to value of a hashmap. This also adds the value to a jlist. The second is a jtextfield and jbutton that is supposed to search for the key and highlight it's corresponding value in the jlist field. For the first button's action performed ( the one that adds the value/key ) I have the following code: if (capitalText.getText().equals("")) { capitalText.requestFocusInWindow(); } else if (countryText.getText().equals("")) { countryText.requestFocusInWindow(); } else { lm.addElement(capitalText.getText()); capitalText.setText(value); countryText.setText(key); String key=countryText.getText(); String value=capitalText.getText(); hashMap.put(key,value); searchButton.setEnabled(true); } For the search button I have the following code: String value=hashMap.get(key); searchText.setText(search); if(searchText.getText().equals(key)) { searchText.setText(search); String search = (String) jList1.getSelectedValue(); } else { JOptionPane.showMessageDialog(null,"That search term could not be found","Search Inquiry",JOptionPane.WARNING_MESSAGE); } It appears to add and set the value/key, but when I attempt to search it always does the "else" statement and throws the joptionpane. Are the value/key actually being added correctly? Or is the search not working? Or both? Thank you for any advice/help!!
has title: Searching a hashmap using a jtextfield and jbutton
answer count: 0
type: UnansweredQuestion
tagged with: java

http://stackoverflow.com/comment/35433405
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23169557
has text: Neither Java nor C or C++ can make any guarantees beyond those made by the operating system. If you need real-time behaviour you need a real-time operating system.
score: 4

http://stackoverflow.com/comment/35556464
comment on: http://stackoverflow.com/q/23234784
score: 0
has text: @NoobEditor i just updated my code please check :D
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23272183
score: 0
tagged with: java
has body: I am usig the OpenCV api for java. And I'm trying to use the MatOfPoint3f element. I find that you can initialize and insert all the data you need but once. After I insert some data, I want to add new data or modify an element. How can I do that? I have to try it, but when I insert new data using the methods .fromArray() or .fromList() of the class MatOfPoint3f, the data, already inserted, is cleared, and just the new data stays there. I have this code int i = 2; int j = 4; double k = 0.0; Point3[] point = new Point3[2]; point[0] = new Point3(i, j, k); point[1] = new Point3(2*i, 2*j, 2*k); System.out.println("Point3: "+point); MatOfPoint3f objectCorners; objectCorners = new MatOfPoint3f(point[0]); System.out.println("1-objectCorners"+objectCorners.toList()); objectCorners.fromArray(point); System.out.println("2-objectCorners:"+objectCorners); objectCorners.fromArray(point[1]); System.out.println("3-objectCorners"+objectCorners.toList()); And I get this results in console: Point3: [Lorg.opencv.core.Point3;@5e222e 1-objectCorners[{2.0, 4.0, 0.0}] 2-objectCorners:Mat [ 2*1*CV_32FC3, isCont=true, isSubmat=false, nativeObj=0x539a320, dataAddr=0x539e310 ] 3-objectCorners[{4.0, 8.0, 0.0}]
type: Question
tagged with: opencv
has title: How add a new element or modify one in a MatOfPoint3f ? (OpenCV, Java)
has comment: http://stackoverflow.com/comment/35663108
answer count: 1
has comment: http://stackoverflow.com/comment/35620264
has answer: http://stackoverflow.com/a/37667478
has comment: http://stackoverflow.com/comment/35639799
type: UnansweredQuestion

http://stackoverflow.com/a/23285457
downvote count: 0
score: 1
type: Answer
answers question: http://stackoverflow.com/q/23273507
has body: You could try URL encoding for same: driver.get(http://domainName%5Cusername:password@url); //%5C is url encode of \
upvote count: 1
has comment: http://stackoverflow.com/comment/35642448

kerberos
tags question: http://stackoverflow.com/q/23269894
tags question: http://stackoverflow.com/q/23140518
tag name: kerberos
tags question: http://stackoverflow.com/q/23254012
type: Tag

http://stackoverflow.com/q/23201984
tagged with: java
tagged with: user-interface
answer count: 1
downvote count: 0
tagged with: layout-manager
has answer: http://stackoverflow.com/a/23202086
favorite count: 0
has body: So I'm new in Java programming and have a problem. When I try to switch to a specific panel using .show(), nothing happens, but when I use .next(), it works. I need to switch to a panel called game1 using a button on my MainPanel panel. This is what I have: private void game1buttonActionPerformed(java.awt.event.ActionEvent evt) { CardLayout cardLayout = (CardLayout)(MainPanel.getLayout()); cardLayout.show(MainPanel, ""+game1); } Here is my full code: *Note: I'm using NetBeans to save time. package card; import java.awt.CardLayout; public class CardTester extends javax.swing.JFrame { /** * Creates new form CardTester */ public CardTester() { initComponents(); } /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // &lt;editor-fold defaultstate="collapsed" desc="Generated Code"&gt; private void initComponents() { MainPanel = new javax.swing.JPanel(); MainMenu = new javax.swing.JPanel(); jLabel1 = new javax.swing.JLabel(); game1button = new javax.swing.JButton(); game2button = new javax.swing.JButton(); game3button = new javax.swing.JButton(); game1 = new javax.swing.JPanel(); jLabel2 = new javax.swing.JLabel(); jButton1 = new javax.swing.JButton(); jTextField1 = new javax.swing.JTextField(); game2 = new javax.swing.JPanel(); jLabel3 = new javax.swing.JLabel(); game2menubutton = new javax.swing.JButton(); jScrollPane1 = new javax.swing.JScrollPane(); jList1 = new javax.swing.JList(); game3 = new javax.swing.JPanel(); jLabel4 = new javax.swing.JLabel(); jButton2 = new javax.swing.JButton(); jRadioButton1 = new javax.swing.JRadioButton(); jRadioButton2 = new javax.swing.JRadioButton(); jRadioButton3 = new javax.swing.JRadioButton(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); MainPanel.setLayout(new java.awt.CardLayout()); jLabel1.setText("Main Menu"); game1button.setText("Game 1"…
score: 2
type: AnsweredQuestion
upvote count: 2
accepted answer: http://stackoverflow.com/a/23202086
tagged with: swing
has title: java swing cardLayout.show() does nothing
type: Question
tagged with: cardlayout

http://stackoverflow.com/a/47709379
score: 1
answers question: http://stackoverflow.com/q/23187539
has body: Similar to one of the code above in JAVA but It needs one more else statement added in order to avoid stack comparison with characters other than braces : else if(bracketPair.containsValue(strExpression.charAt(i))) public boolean isBalanced(String strExpression){ Map&lt;Character,Character&gt; bracketPair = new HashMap&lt;Character,Character&gt;(); bracketPair.put('(', ')'); bracketPair.put('[', ']'); bracketPair.put('{', '}'); Stack&lt;Character&gt; stk = new Stack&lt;Character&gt;(); for(int i =0;i&lt;strExpression.length();i++){ if(bracketPair.containsKey(strExpression.charAt(i))) stk.push(strExpression.charAt(i)); else if(bracketPair.containsValue(strExpression.charAt(i))) if(stk.isEmpty()||bracketPair.get(stk.pop())!=strExpression.charAt(i)) return false; } if(stk.isEmpty()) return true; else return false; }
downvote count: 0
type: Answer
upvote count: 1

http://stackoverflow.com/comment/35660723
score: 0
type: Comment
has text: thanks, it works, why i have to use SwingUtilities.invokeLater() or EventQueue.invokeLater()? and why i have to use paintComponent instead of paint?
comment on: http://stackoverflow.com/a/23290622
type: AnswerComment

http://stackoverflow.com/comment/35437826
type: QuestionComment
score: 1
has text: @Hamamelis I am also not aware, I don't think there is way to do so in Android. Captcha is required on your web sites where any other user can run bot to do like 1 Lacs + registration like activity in a second. To solve this problem you use Captcha there
comment on: http://stackoverflow.com/q/23172082
type: Comment

http://stackoverflow.com/q/23265696
tagged with: eclipse
type: Question
has answer: http://stackoverflow.com/a/23266380
accepted answer: http://stackoverflow.com/a/23266380
answer count: 1
downvote count: 0
favorite count: 0
tagged with: android
tagged with: eclipse-kepler
type: AnsweredQuestion
has body: In eclipse SurroundWith offers default options like try/catch, while, switch etc. I want to add another option to that list how to do that? In SurroundWith pop up there is one option at bottom Configure Template where we can configure template it also shows list of predefine template but my question is how to use one of those template and place it on pop up menu.......
score: 1
tagged with: java
has title: How to use custom SurroundWith feature of eclipse
upvote count: 1

waveform
tag name: waveform
type: Tag
tags question: http://stackoverflow.com/q/23275713

http://stackoverflow.com/q/23225007
type: Question
has title: Different SWT browser IE versions during runtime
downvote count: 0
favorite count: 0
has body: I want to create SWT IE browsers with different versions during program execution. I know firstly we take IE version from HKEY_LOCAL_MACHINE \ Software \ Microsoft \ Internet Explorer \ Version. Then we look if there is a parameter HKEY_CURRENT_USER \ Software \ Microsoft \ Internet Explorer \ Main \ FeatureControl \ FEATURE_BROWSER_EMULATION \ java.exe (javaw.exe). If not, we create it with the above value. How can I make SWT browser to take actual value from the registry HKEY_CURRENT_USER \ Software \ Microsoft \ Internet Explorer \ Main \ FeatureControl \ FEATURE_BROWSER_EMULATION \ java.exe (I change it via jna). If I changed the value in the registry during runtime, SWT doesn't swap it. And I don't understand how SWT understands that it need to emulate the version from the registry. I'm using jdk 1.6, windows 7 x64, IE 11, SWT 4.3.
answer count: 0
type: UnansweredQuestion
tagged with: swt
upvote count: 1
tagged with: internet-explorer
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/35557143

http://stackoverflow.com/a/23197939
has comment: http://stackoverflow.com/comment/35483556
has comment: http://stackoverflow.com/comment/35483418
type: Answer
answers question: http://stackoverflow.com/q/23197892
has comment: http://stackoverflow.com/comment/35483988
upvote count: 1
has body: The below probably causes NullPointerException. ListView listView = (ListView) getView().findViewById(R.id.listView1); So change to ListView listView ; public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_attendance_mark, container, false); listView = (ListView) rootView.findViewById(R.id.listView1); // Generate list View from ArrayList displayListView(); checkButtonClick(); return rootView; } Or as laalto suggested displayListView(rootView); Then private void displayListView(View View) { ListView listView = (ListView) view.findViewById(R.id.listView1); } or In onActivityCreated ListView listView = (ListView) getView().findViewById(R.id.listView1); Edit: checkButtonClick(rootView); Then private void checkButtonClick(View view) { Button myButton = (Button) view.findViewById(R.id.butBdaySelectNext);
has comment: http://stackoverflow.com/comment/35484088
accepted answer of: http://stackoverflow.com/q/23197892
score: 1
has comment: http://stackoverflow.com/comment/35483196
has comment: http://stackoverflow.com/comment/35483375
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/35483230
has comment: http://stackoverflow.com/comment/35484122
has comment: http://stackoverflow.com/comment/35483388

http://stackoverflow.com/a/23282684
score: 1
has body: Try creating a new temporary Set off of one and running operations off of that. AND(){ public Set operate(Set one, Set two){ Set temp = new HashSet&lt;Integer&gt;(one); temp.retainAll(two); return temp; } }, OR(){ public Set operate(Set one, Set two){ Set temp = new HashSet&lt;Integer&gt;(one); temp.addAll(two); return one; } };
answers question: http://stackoverflow.com/q/23282665
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/35637344
type: Answer
accepted answer of: http://stackoverflow.com/q/23282665
has comment: http://stackoverflow.com/comment/35637376
has comment: http://stackoverflow.com/comment/35637778
upvote count: 1

http://stackoverflow.com/q/23146956
has title: Can jetty have an infinite websocket timeout
upvote count: 2
type: UnansweredQuestion
tagged with: jetty
has body: I am using jetty to set up multiple servers with one proxy that then talks to a client. The servers should be able to be connected for an infinite amount of time without stopping. But whenever a test it after a little bit of time of inactivity the servers throw a read-timeout exception: Session: localhost/127.0.0.1:8884 caused:java.net.SocketTimeoutException: Timeout on Read Connection closed: Session: localhost/127.0.0.1:8884 caused:java.io.EOFException: Connection has been closed locally I am not setting a timeout time because I assumed that no time would assume forever. Is there a way to set it for forever?
score: 2
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/35393658
type: Question
tagged with: timeout
has comment: http://stackoverflow.com/comment/35394214
has comment: http://stackoverflow.com/comment/35426523
tagged with: websocket
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/35395837

http://stackoverflow.com/comment/35599443
type: Comment
type: QuestionComment
score: 0
has text: Resources r = getResources(); Drawable[] layers = new Drawable[2]; layers[0] = r.getDrawable(R.drawable.compass); layers[1] = r.getDrawable(R.drawable.travelarrow); LayerDrawable layerDrawable = new LayerDrawable(layers); imageGPSMapDrawView.setImageDrawable(layerDrawable); Bitmap anArrowImage = ((BitmapDrawable) layers[1]).getBitmap(); BitmapDrawable dd = new BitmapDrawable(getResources(),anArrowImage); // dd.setGravity(Gravity.RIGHT); tried with 1, 2, etc, no idea what would be right value
comment on: http://stackoverflow.com/q/23180936

http://stackoverflow.com/comment/35525697
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23221838
has text: Do you mind voting up my comment because it's the same as the answer below :)
score: 0

http://stackoverflow.com/comment/35504277
has text: yeah I know, that is why I said that the decision of whether to use public field is upto the developer.
comment on: http://stackoverflow.com/a/23209722
type: AnswerComment
type: Comment
score: 0

http://stackoverflow.com/comment/35523035
type: Comment
type: QuestionComment
has text: Is `storemenuid` inside `mainlayout.xml`?
comment on: http://stackoverflow.com/q/23220568
score: 0

http://stackoverflow.com/q/23222117
tagged with: sockjs
upvote count: 1
tagged with: stomp
downvote count: 0
has body: I'm using the official example (Greeting example) of spring located in: http://spring.io/guides/gs/messaging-stomp-websocket/ everything seems to work just fine, when i press the connect i can see that the connection agaisnt the server is being made. But, after connection when i submit a "name" to the server i get no error and no request reaches the GreetingController. I tried to put the log level on trace and i see the following lines when i execute the "send": 22 Ar 2014 17:10:52 DEBUG DispatcherServlet - Successfully completed request 22 Apr 2014 17:10:52 DEBUG ExceptionTranslationFilter - Chain processed normally 22 Apr 2014 17:10:52 DEBUG HttpSessionSecurityContextRepository - SecurityContext is empty or contents are anonymous - context will not be stored in HttpSession. 22 Apr 2014 17:10:52 DEBUG SecurityContextPersistenceFilter - SecurityContextHolder now cleared, as request processing completed 22 Apr 2014 17:10:52 DEBUG LoggingWebSocketHandlerDecorator - Connection established, SockJS session id=taxwn2fu, uri=/MyWebApp/hello/535/taxwn2fu/websocket 22 Apr 2014 17:10:52 DEBUG SubProtocolWebSocketHandler - Started WebSocket session=taxwn2fu, number of sessions=1 22 Apr 2014 17:10:53 DEBUG StompDecoder - Decoded [Payload byte[0]][Headers={stompCommand=CONNECT, nativeHeaders={heart-beat=[10000,10000], accept-version=[1.1,1.0]}, simpMessageType=CONNECT, id=0686dda9-afa3-7a54-756c-89279ea33126, timestamp=1398175853000}] 22 Apr 2014 17:10:53 DEBUG StompEncoder - Encoded STOMP command=CONNECTED headers={heart-beat=[0,0], version=[1.1]} 22 Apr 2014 17:10:53 DEBUG StompDecoder - Decoded [Payload byte[0]][Headers={stompCommand=SUBSCRIBE, nativeHeaders={id=[sub-0], destination=[/topic/greetings]}, simpMessageType=SUBSCRIBE, simpSubscriptionId=sub-0, simpDestination=/topic/greetings, id=653538d3-0722-0325-2c23-8314abd70cc0, timestamp=1398175853008}] 22 Apr 2014 17:10:53 DEBUG DefaultSubscriptionRegistry - Adding subscription id=sub-0, destination=/topic/greetings 22 Apr …
has answer: http://stackoverflow.com/a/23326034
type: AnsweredQuestion
has title: Spring 4 websocket And stomp - controller is not reached
tagged with: websocket
score: 1
favorite count: 0
has answer: http://stackoverflow.com/a/23254022
type: Question
answer count: 2
tagged with: spring
possible better answer: http://stackoverflow.com/a/23254022
accepted answer: http://stackoverflow.com/a/23326034
tagged with: java

http://stackoverflow.com/comment/35515601
score: 0
type: Comment
has text: p.S. You don't need to specify the port for port 80
comment on: http://stackoverflow.com/a/23216400
type: AnswerComment

http://stackoverflow.com/q/23279253
tagged with: string
type: UnansweredQuestion
tagged with: swing
has comment: http://stackoverflow.com/comment/35630798
tagged with: java
tagged with: jtextfield
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/35630901
has body: I have one class Names and it has a JTextField. I am trying to place getText from this textfield and save it in the variable nameString1. I then want the other class Game to call Names and place the string collected from ``the JTextField onto a label. For some reason it is not displaying. Please let me know if there are any rookie errors, I am only year 10. Names package com.aqagame.harrykitchener; import java.awt.BorderLayout; import java.awt.GridLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.BorderFactory; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTextArea; import javax.swing.JTextField; import javax.swing.SwingUtilities; public class Names { private JLabel player1Label; private JTextField player1Input; private JButton nextButton; public String nameString1; public Names() { final JFrame window = new JFrame("Player 1 username"); JPanel firstPanel = new JPanel(new GridLayout(3,2)); player1Label = new JLabel("Player 1"); player1Input = new JTextField(); nextButton = new JButton("Next"); firstPanel.add(player1Label); firstPanel.add(player1Input); firstPanel.add(nextButton); nextButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { nameString1 = player1Input.getText(); System.out.print(nameString1); Names2 names2Call = new Names2(); window.dispose(); } }); window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); window.getContentPane().add(firstPanel); window.setSize(250, 150); window.setLocationRelativeTo(null); window.setVisible(true); } public static void main(String args[]) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { new Names(); } }); } } Game package com.aqagame.harrykitchener; import java.awt.Color; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.GridLayout; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPan…
score: 0
has title: getText from JTextField in 1 class and place it on a label in the other
has answer: http://stackoverflow.com/a/23279462
has answer: http://stackoverflow.com/a/23292226
has comment: http://stackoverflow.com/comment/35631561

http://stackoverflow.com/a/23250543
type: Answer
has body: you are initializing markbook after and trying to use it before for(int i = 0; i &lt; markbook.length; i++) { if(markbook[i].getAssignment(name) == null) { // java.lang.NullPointerException is thrown here openSpot = i; break; } } markbook[openSpot] = new Mark(name, totalMark, mark, weight);//you are initializing markbook after and trying to use it before it should be like following //initialize first markbook[openSpot] = new Mark(name, totalMark, mark, weight); //use later for(int i = 0; i &lt; markbook.length; i++) { if(markbook[i].getAssignment(name) == null) { // java.lang.NullPointerException is thrown here openSpot = i; break; } }
accepted answer of: http://stackoverflow.com/q/23250438
score: 0
answers question: http://stackoverflow.com/q/23250438
type: AcceptedAnswer

http://stackoverflow.com/comment/35577151
has text: @AndreaLigios i have cleaned
comment on: http://stackoverflow.com/q/23246258
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35537930
type: Comment
comment on: http://stackoverflow.com/q/23203771
score: 0
type: QuestionComment
has text: There are many ways to store text into a file, most of them are straightforward. Would you mind to elaborate what your issue is exactly?

http://stackoverflow.com/q/23236242
has answer: http://stackoverflow.com/a/23236265
type: AnsweredQuestion
downvote count: 2
accepted answer: http://stackoverflow.com/a/23236265
type: Question
has body: I would like to check JsonArray existTeamMemberships is null or not? I would like to use IF statement next to this code to check JsonArray has null or not?How could check this? JsonArray existTeamMemberships = (JsonArray) userQueryResponse.getResults().get(0).getAsJsonObject().get("TeamMemberships"); Thanks
score: -2
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has title: How to check JsonAraay is null or not?
has comment: http://stackoverflow.com/comment/35553357
upvote count: 0
tagged with: arrays
answer count: 1
has comment: http://stackoverflow.com/comment/35551730
favorite count: 0

http://stackoverflow.com/q/23253696
tagged with: java
type: Question
upvote count: 4
answer count: 2
tagged with: playframework
downvote count: 0
score: 4
has title: Detect application mode (DEV, TEST, PROD) during build in Play Framework 2.x application
has answer: http://stackoverflow.com/a/23262469
linked to: http://stackoverflow.com/q/14706300
has answer: http://stackoverflow.com/a/36844364
has body: Good day all, I'd like to be able to detect the mode that a Play application will use during build. Meaning I'd like to execute certain tasks within my Build.scala/build.sbt depending on whether the application is started in DEV or in PROD mode for instance. The reason I need this is because we (the team) have implemented Grunt.js into the build process by adding it to the playRunHooks. Depending on whether the application is running in DEV mode or not we want to enable/disable some Grunt tasks. I know I can check the application mode from within the actual application using Play.isDev and the like, is there a similar mechanism available for within the build files? If not I would really only need to know the command that was issued by the developer (run, start, dist, stage etc.) but I can't seem to find a straight forward way of getting to know this either. Can anyone point me in the right direction? Thank you in advance!
favorite count: 0
tagged with: playframework-2.2
tagged with: scala
possible better answer: http://stackoverflow.com/a/36844364
type: AnsweredQuestion
tagged with: sbt
accepted answer: http://stackoverflow.com/a/23262469

http://stackoverflow.com/a/23254343
score: 2
has comment: http://stackoverflow.com/comment/35606433
has comment: http://stackoverflow.com/comment/35585266
downvote count: 0
answers question: http://stackoverflow.com/q/23254234
upvote count: 2
type: Answer
has body: 1) Yes, if you use the JDK at all, you want the JRE (runtime environment) to come from the JDK (development environment) (a JDK necessarily includes a JRE). 2) Likely your path variable is set so that you invoke Java from your Java 6 installation; you need to find the equivalent for your Java 8 installation and set the path for that. Without information about your operating system, we can't help you do that.

http://stackoverflow.com/a/43833312
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/23163948
has body: I face the same error as well &amp; able to fix. Exception in thread "JavaFX Application Thread" java.lang.IllegalArgumentException: argument type mismatch Here is how your code suppose to look like @FXML public void loadDC1(ActionEvent event){ ToggleButton btnSelected = (ToggleButton) event.getSource(); String name=btnSelected.getId().toString(); if(name.equalsIgnoreCase("toggleDC1")){ //do something } } in JavaFX, you need to define all fx:id, #action in your fxml files into controller class like; @FXML private ToggleButton toggleDC1; // as a class field @FXML public void loadDC1(ActionEvent event){} // method
type: Answer
upvote count: 1

http://stackoverflow.com/comment/35642055
type: Comment
has text: I would like it to do it line by line if possible
type: AnswerComment
comment on: http://stackoverflow.com/a/23285115
score: 0

http://stackoverflow.com/comment/35622612
type: AnswerComment
type: Comment
has text: The static method is not necessarily creating the object, it may be stored and you are just retrieving its reference. This is not the case in the example provided.
comment on: http://stackoverflow.com/a/23274976
score: 1

http://stackoverflow.com/a/23135969
upvote count: 6
type: Answer
downvote count: 0
score: 6
has comment: http://stackoverflow.com/comment/35374662
accepted answer of: http://stackoverflow.com/q/23135416
has body: You have mapped the values map in Attribute using 'value' instead of 'attribute'. The @OneToMany annotation should be specified as below: @OneToMany(fetch = FetchType.EAGER, mappedBy = "attribute", cascade = CascadeType.ALL)
answers question: http://stackoverflow.com/q/23135416
type: AcceptedAnswer

jsf-2
tags question: http://stackoverflow.com/q/23153742
type: Tag
tags question: http://stackoverflow.com/q/23202735
tag name: jsf-2
tags question: http://stackoverflow.com/q/23197353
tags question: http://stackoverflow.com/q/23288954
tags question: http://stackoverflow.com/q/23152600
tags question: http://stackoverflow.com/q/23160271
tags question: http://stackoverflow.com/q/23285809
tags question: http://stackoverflow.com/q/23216155
tags question: http://stackoverflow.com/q/23259744
tags question: http://stackoverflow.com/q/23265354
tags question: http://stackoverflow.com/q/23172961
tags question: http://stackoverflow.com/q/23236592
tags question: http://stackoverflow.com/q/23218148
tags question: http://stackoverflow.com/q/23132916

http://stackoverflow.com/q/23264314
has title: GWT Geolocation..getCurrentPosition always times out?
downvote count: 0
favorite count: 0
tagged with: http://stackoverflow.com/tag/html
answer count: 0
type: UnansweredQuestion
score: 1
tagged with: java
tagged with: geolocation
upvote count: 1
type: Question
tagged with: gwt
has body: I am try to get the users gelocation coordinates in a GWT project, but I always end up with a time out error even when the a time-out value of 18000 (3 mins) is used. I don't even get any permission popup from chrome in devmode ? Geolocation geoLoc = Geolocation.getIfSupported(); if(geoLoc != null){ log.info("Geolocation is supported!"); Geolocation.PositionOptions options = new Geolocation.PositionOptions(); options.setMaximumAge(0); options.setTimeout(18000); options.setHighAccuracyEnabled(false); geoLoc.getCurrentPosition(new Callback&lt;Position, PositionError&gt;() { @Override public void onSuccess(Position result) { // never called Coordinates coords = result.getCoordinates(); final double lat = coords.getLatitude(); final double lng = coords.getLongitude(); log.info("Coordinates: (" + lat + ", " + lng + ")"); } @Override public void onFailure(PositionError error) { // always called String message = ""; switch (error.getCode()) { case PositionError.UNKNOWN_ERROR: message = "Unknown Error"; break; case PositionError.PERMISSION_DENIED: message = "Permission Denied"; break; case PositionError.POSITION_UNAVAILABLE: message = "Position Unavailable"; break; case PositionError.TIMEOUT: message = "Time-out"; break; default: message = "Unknown error code."; } log.error("Can't Get Current Position: " + message); // ... Time-out } }, options); }

http://stackoverflow.com/q/23280692
type: Question
answer count: 2
tagged with: 3d
has comment: http://stackoverflow.com/comment/35633959
downvote count: 0
possible better answer: http://stackoverflow.com/a/42154171
has comment: http://stackoverflow.com/comment/35636207
favorite count: 0
has comment: http://stackoverflow.com/comment/35636410
has comment: http://stackoverflow.com/comment/35633510
has comment: http://stackoverflow.com/comment/35633666
has body: I am rendering in 3D multiple objects with textures that have alpha. All the textures load fine but when I try to render them in front of each other I get the following: Left is what I have. Right is what it should be. The grid is just to help visualize the perspective. The texture in front of the red circle texture is clipped. I searched around for an answer and it says for me to use: GLES20.glEnable( GLES20.GL_BLEND ); GLES20.glBlendFunc(GLES20.GL_SRC_ALPHA, GLES20.GL_ONE_MINUS_SRC_ALPHA ); But I am using it and it still isn't working. My setup in which I correctly placed in the onSurfaceCreated() function is: GLES20.glClearColor( 0.75f, 0.85f, 1f, 1.0f ); GLES20.glEnable( GLES20.GL_BLEND ); GLES20.glBlendFunc(GLES20.GL_SRC_ALPHA, GLES20.GL_ONE_MINUS_SRC_ALPHA ); GLES20.glEnable( GLES20.GL_DEPTH_TEST ); GLES20.glDepthFunc( GLES20.GL_LEQUAL ); GLES20.glDepthMask( true ); GLES20.glClearDepthf( 1f ); My fragment shader is: uniform sampler2D texture; varying vec2 texCoord; void main(){ gl_FragColor = texture2D( texture, texCoord ); } Do I have to include anything in the Android manifest to enable alpha testing? I do not want to end up having to manually organize my polygons or use alpha discard() because I need and want some pixels to be translucent. How do I get 3D alpha testing depth buffers to work?
linked to: http://stackoverflow.com/q/2738586
has answer: http://stackoverflow.com/a/23283256
tagged with: android
has comment: http://stackoverflow.com/comment/35633746
has comment: http://stackoverflow.com/comment/35636139
tagged with: opengl-es-2.0
tagged with: depth-buffer
score: 13
has title: OpenGL ES2 Alpha test problems
has comment: http://stackoverflow.com/comment/35635716
upvote count: 13
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23283256
tagged with: java
has answer: http://stackoverflow.com/a/42154171
linked to: http://stackoverflow.com/q/11866686
has comment: http://stackoverflow.com/comment/35633713
has comment: http://stackoverflow.com/comment/35635553
has comment: http://stackoverflow.com/comment/35633585

http://stackoverflow.com/comment/35452414
type: Comment
score: 0
comment on: http://stackoverflow.com/q/23180528
type: QuestionComment
has text: "Program stop working" - did it throw any exception? What do you mean by "stop working"?

http://stackoverflow.com/q/23176624
possible better answer: http://stackoverflow.com/a/30790366
upvote count: 23
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/30790366
has answer: http://stackoverflow.com/a/34429067
tagged with: java
tagged with: javafx
score: 23
has answer: http://stackoverflow.com/a/25282801
type: Question
has answer: http://stackoverflow.com/a/30996535
has title: JavaFX Freeze on Desktop.open(file), Desktop.browse(uri)
accepted answer: http://stackoverflow.com/a/34429067
tagged with: linux
has body: I'm running some code in Java on Ubuntu 12.04 LTS 64 Bit (with Gnome Shell), using Oracle JDK 1.8.0_05 via NetBeans8.0. The following function works perfectly when called either in Main or in an otherwise empty Java Project, however when called from any JavaFX application, it causes the window to freeze and stop responding (although the project complies perfectly), requiring it to be Force Closed. Can anyone suggest any issues with what I've written which might be causing an issue or loop? Alas, due to the mode of failure, there is no error message that I can supply or analyse. Any suggestions gratefully received, thanks in advance. public static void desktopTest(){ Desktop de = Desktop.getDesktop(); try { de.browse(new URI("http://stackoverflow.com")); } catch (IOException | URISyntaxException e) { System.out.println(e); } try { de.open(new File("/home/aaa/file.ext")); } catch (IOException e){ System.out.println(e); } try { de.mail(new URI("mailto:email@example.com")); } catch (URISyntaxException | IOException e){ System.out.println(e); } }
downvote count: 0
favorite count: 0
tagged with: netbeans
tagged with: gnome-3
answer count: 5
has answer: http://stackoverflow.com/a/23320897

http://stackoverflow.com/a/23174073
has body: The go routine is poorly written. You re-set the main window (why?). You re-assign the view to a TextView (why?). You then set the TextView's text (why?). I would comment out the 1st and the 3rd line in go and change the 4th from op1.setText("X"); to r1b1.setText("X");
downvote count: 0
type: Answer
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/23173979

http://stackoverflow.com/comment/35497982
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23206237
has text: Do you have a stacktrace to post?
score: 1

http://stackoverflow.com/q/23165611
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/23165717
has title: Java: creating an array inside of an object class?
type: Question
tagged with: for-loop
tagged with: arrays
downvote count: 0
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/35466730
has comment: http://stackoverflow.com/comment/35426781
has answer: http://stackoverflow.com/a/23165717
has comment: http://stackoverflow.com/comment/35426472
upvote count: 1
has comment: http://stackoverflow.com/comment/35426597
tagged with: object
type: AnsweredQuestion
has body: I'm attempting to save an x amount of integers inside of an object class. I'm trying it via an array but am not sure if this is possible and as of now eclipse is giving me two errors. One asking me to insert an Assignment operator inside of my Gerbil() class and another saying that I can't make a static reference to to the non-static field food. The result I'm looking for is food 1 = first input; food 2 = second input; until it hits the total amount of food. Here's my code so far: import java.util.Scanner; public class Gerbil { public String name; public String id; public String bite; public String escape; public int[] food; public Gerbil() { this.name = ""; this.id = ""; this.bite = ""; this.escape = ""; this.food[]; // I'm not sure what I should put here. This is where I want to store } // the different integers I get from the for loop based on the // total number of foods entered. So if totalFoods is 3, there should // be 3 integers saved inside of the object class based on what's typed // inside of the for-loop. Or if totalFoods = 5, then 5 integers. public static void main(String[] args) { Scanner keyboard = new Scanner(System.in); System.out.println("How many foods?"); int totalFood = keyboard.nextInt(); System.out.println("How many gerbils in the lab?"); int numberOfGerbils = keyboard.nextInt(); Gerbil[] GerbilArray = new Gerbil[numberOfGerbils]; for(int i = 0; i &lt;= numberOfGerbils; i++){ GerbilArray[i] = new Gerbil(); System.out.print("Lab ID:"); String id = keyboard.next(); System.out.print("Gerbil Nickname:"); String name = keyboard.next(); System.out.print("Bite?"); String bite = keyboard.next(); System.out.print("Escapes?"); String city = keyboard.nextLine(); for (int j = 0; j &lt; totalFood; j++) { System.out.println("How many of food " + (j+1) + "do you eat?:"); food[j] = keyboard.nextInt(); } } } }

http://stackoverflow.com/comment/35580759
comment on: http://stackoverflow.com/a/23252599
type: AnswerComment
has text: This doesn't give me divider itself. I need it to add mouse listener.
type: Comment
score: 0

http://stackoverflow.com/comment/35547969
type: Comment
type: QuestionComment
has text: `while (counter == 1) {` in `paintComponent`...that won't cause any problems :P
score: 0
comment on: http://stackoverflow.com/q/23234143

http://stackoverflow.com/comment/35632633
type: Comment
has text: Here is an example: http://stackoverflow.com/questions/22028399/log4j2-property-substitution-default
comment on: http://stackoverflow.com/a/23277944
type: AnswerComment
score: 0

http://stackoverflow.com/comment/35622696
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23275084
has text: It sounds like you should just have a function containing several perfectly normal function calls. You haven't yet shown any examples where `Lists.transform` would actually help.

http://stackoverflow.com/q/23233386
has answer: http://stackoverflow.com/a/23234431
type: UnansweredQuestion
tagged with: java
has body: I have a switch statement that allows you to search for a user in a database. The search is basically just searching for a matching character whether it is numeric or alphabetic. It doesn't seem to be working though, any ideas? Here is main.java package hartman; import java.util.ArrayList; import java.util.Scanner; public class Main { public static void main(String[] args) { Printer.printWelcome(); Scanner keyboard = new Scanner(System.in); ArrayList&lt;Person&gt; personList = new ArrayList&lt;&gt;(); boolean keepRunning = true; while (keepRunning) { Printer.printMenu(); Printer.printPrompt("Please enter your operation: "); String userSelection = keyboard.nextLine(); switch (userSelection) { case "1": Database.addPerson(personList); break; case "2": Database.printDatabase(personList); break; case "3": Printer.printSearchPersonTitle(); String searchFor = keyboard.nextLine(); Database.findPerson(searchFor); break; case "4": keepRunning = false; break; default: break; } } Printer.printGoodBye(); keyboard.close(); } } Here is Database.java package hartman; import java.util.ArrayList; import java.util.Scanner; public class Database { static Scanner keyboard = new Scanner(System.in); private static ArrayList&lt;Person&gt; personList = new ArrayList&lt;Person&gt;(); public Database() { } public static void addPerson(ArrayList&lt;Person&gt; personList) { Printer.printAddPersonTitle(); Printer.printPrompt(" Enter first name: "); String addFirstName = keyboard.nextLine(); Printer.printPrompt(" Enter last Name: "); String addLastName = keyboard.nextLine(); Printer.printPrompt(" Enter social Security Number: "); String addSocial = keyboard.nextLine(); Printer.printPrompt(" Enter year of birth: "); int addYearBorn = Integer.parseInt(keyboard.nextLine()); System.out.printf("\n%s, %s saved!\n", addFirstName, addLastName); Person person = new Person(); person.setFirstName(addFirstName); person.setLastName(addLastName); person.setSocialSecurityNumber(addSocial); person.setYearBorn(a…
has comment: http://stackoverflow.com/comment/35546472
type: Question
has title: Am I doing this right? ArrayList searching
has comment: http://stackoverflow.com/comment/35546624
has answer: http://stackoverflow.com/a/23234827
tagged with: arraylist
score: 0
answer count: 2

http://stackoverflow.com/q/23273040
has answer: http://stackoverflow.com/a/38737681
downvote count: 0
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/37498809
score: 5
tagged with: android
has answer: http://stackoverflow.com/a/31339893
tagged with: java
has title: How do I change the font for tab titles created from PagerSlidingTabStrip?
has body: Here is the library in question: https://github.com/astuetz/PagerSlidingTabStrip I figure it has something to do with .setTypeface() but I have no idea how to use it. I put the font I want in the assets folder. Here's my code. Start.java import android.app.AlertDialog; import android.content.DialogInterface; import android.graphics.Typeface; import android.graphics.drawable.Drawable; import android.os.Bundle; import android.os.Handler; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentActivity; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentPagerAdapter; import android.support.v4.view.ViewPager; import android.text.Editable; import android.util.TypedValue; import android.view.Menu; import android.view.MenuItem; import android.widget.EditText; import android.widget.TextView; import android.widget.Toast; import com.astuetz.PagerSlidingTabStrip; public class Start extends FragmentActivity { private final Handler handler = new Handler(); private PagerSlidingTabStrip tabs; private ViewPager pager; private MyPagerAdapter adapter; private int currentColor = 0xFF547CC1; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_start); tabs = (PagerSlidingTabStrip) findViewById(R.id.tabs); pager = (ViewPager) findViewById(R.id.pager); adapter = new MyPagerAdapter(getSupportFragmentManager()); pager.setAdapter(adapter); final int pageMargin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 4, getResources() .getDisplayMetrics()); pager.setPageMargin(pageMargin); tabs.setViewPager(pager); tabs.setIndicatorColor(currentColor); /*Typeface tf = Typeface.createFromAsset(getAssets(), "RobotoCondensed-Regular.ttf"); tabs.setTypeface(tf,Typeface.NORMAL);*/ } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.start, menu); …
has answer: http://stackoverflow.com/a/23273560
answer count: 4
upvote count: 5
type: UnansweredQuestion

http://stackoverflow.com/comment/35365742
score: 0
type: Comment
has text: @cybersam Thanks... I observed an infinite `for` loop in `Looper.loop()` which keeps the thread busy...
type: AnswerComment
comment on: http://stackoverflow.com/a/23131521

http://stackoverflow.com/a/23238035
upvote count: 1
answers question: http://stackoverflow.com/q/23237808
downvote count: 0
has body: Take, for example, string "ABCD". backward(0) { backward(1) { backward(2) { backward(3) { print D } print C } print B } print A }
type: Answer
score: 1

http://stackoverflow.com/a/23142549
has comment: http://stackoverflow.com/comment/35386188
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/35386411
has comment: http://stackoverflow.com/comment/35385979
has comment: http://stackoverflow.com/comment/35386319
has comment: http://stackoverflow.com/comment/35386204
has comment: http://stackoverflow.com/comment/35385836
has comment: http://stackoverflow.com/comment/35387007
has comment: http://stackoverflow.com/comment/35386282
has comment: http://stackoverflow.com/comment/35386126
answers question: http://stackoverflow.com/q/23142471
upvote count: 1
has comment: http://stackoverflow.com/comment/35386385
has comment: http://stackoverflow.com/comment/35387018
has comment: http://stackoverflow.com/comment/35386608
has body: layout1 is null, maybe you are not using setContentView line, or this view not exist in your layout.
has comment: http://stackoverflow.com/comment/35385961
type: Answer
has comment: http://stackoverflow.com/comment/35386621

http://stackoverflow.com/comment/35905689
type: Comment
type: QuestionComment
score: 0
has text: thanks @pathfinder:: yes that is the issue i think,, actually i replaced it with other xsd and it is working now. But i am facing other problems now..
comment on: http://stackoverflow.com/q/23290699

http://stackoverflow.com/a/23223481
has comment: http://stackoverflow.com/comment/35569857
has comment: http://stackoverflow.com/comment/44053407
upvote count: 7
has comment: http://stackoverflow.com/comment/35551242
accepted answer of: http://stackoverflow.com/q/23219239
answers question: http://stackoverflow.com/q/23219239
score: 7
has body: With generic types you will always face problems with type erasure. As a workaround you can perform unchecked type-cast like this: @SuppressWarnings("unchecked") public static &lt;C, T extends C&gt; C mapJsonToObject(String jsonString, Class&lt;T&gt; result) { // ... stuff ... return (C) parsedObject; } However this is pretty ugly considering the fact that you don't control what classes will Jackson actually use for the collection entries. For a better result, you can use Jackson's special type system: @SuppressWarnings("unchecked") public static &lt;C&gt; C mapJsonToObject(String jsonString, JavaType type) { // ... stuff ... return (C) parsedObject; } // Check answer comments on TypeFactory#collectionType deprecation List&lt;MyBean&gt; result = mapJsonToObject("[]", TypeFactory.collectionType(ArrayList.class, MyBean.class)); Or you can use Jackson's type references: public static &lt;T&gt; T mapJsonToObject(String jsonString, TypeReference&lt;T&gt; type) { // ... stuff ... } List&lt;MyBean&gt; result = mapJsonToObject("[]", new TypeReference&lt;List&lt;Object&gt;&gt;() {}); I kind of like the first approach (via JavaType) as that will not create a anonymous class for every method invocation you write. UPDATE Why is the first option ugly: The first option works because there is close to zero relation between the generic parameter T and C. While T will be inferred based on the passed argument, C will be inferred based on the result assignment. The only constraint between those is that T MUST extend C. That is just a formality to prevent completely incorrect calls like String s = mapJsonToObject("", List.class). The option is ugly, because you are not saying anything about the contents of the map. I.e. it is up to Jackson to decide what kind of classes it wants to use. For example { "foo": "xxx", "bar": 1 } will be probably mapped to Map with these entries: String "foo" => String "xxx" String "bar" => Integer 1 But for { "foo": { "bar": 1 } } it will be probably somet…
has comment: http://stackoverflow.com/comment/44057288
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/35569468
type: Answer

http://stackoverflow.com/a/23287731
upvote count: 5
answers question: http://stackoverflow.com/q/23287702
score: 5
has body: Because expectedKey.getClass() gives the Class object of runtime type of the expectedKey, which may be different from Key class. However, with instanceof, even if expectedKey runtime type is some subclass of Key class, the result will be true, because an instance of subclass, is also an instanceof the super class.
downvote count: 0
type: Answer

http://stackoverflow.com/comment/35543406
score: 0
type: Comment
type: QuestionComment
has text: Okay! You need one loop where you find your shortest and your longest array. After that you can copy the max-array in the place of the min-array as @Anubian Noob already suggested
comment on: http://stackoverflow.com/q/23231387

http://stackoverflow.com/a/23281600
type: AcceptedAnswer
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/35635780
has comment: http://stackoverflow.com/comment/35635654
downvote count: 1
answers question: http://stackoverflow.com/q/23281399
accepted answer of: http://stackoverflow.com/q/23281399
score: 0
has body: As an argument variable, max will behave like a local variable. Meaning each recursion will have it's own copy of the variable max. And since you are not returning anything back, you will throw that value away, so by the end of the whole recursion the value of max in the first call into the function is still zero. Consider making max a static variable within the function instead of passing it as an argument. As an aside, your approach still has a problem that your function findDepth doesn't "find" anything since it's not returning anything. You could also return max at each level but ignore it always, so only the caller into findDepth actually deals with max. But this approach is gently nudging you back towards the original way to do it :). Update Asker had a follow up question. But i want to point out to another article in stack overflow where they said the value will propagate down to the next recursive call. As user430788 explained, max is a primitive type int, passed by value, while the ArraList&lt;Integer&gt; is not, so it will be passed by reference and will be shared by all instances of that function call.

http://stackoverflow.com/comment/35632271
type: Comment
has text: @DmitriyR I have read what you have written. You made a sweeping generalization which you claim is justified by a NASA document. Robert Harvey and I have tried to point out that the NASA document is written for one particular application domain, real-time controllers with strictly bounded resource requirements, and does not apply outside that domain. You have yet to supply any supporting evidence or logic that the recommendations for that domain generalize to all computing.
score: 0
comment on: http://stackoverflow.com/a/23228610
type: AnswerComment

http://stackoverflow.com/q/23261215
linked to: http://stackoverflow.com/q/64958428
type: Question
score: 3
has answer: http://stackoverflow.com/a/23261394
has answer: http://stackoverflow.com/a/23263262
upvote count: 3
has title: Maven: How to include ${project.version} in multi-module project
answer count: 2
favorite count: 0
type: UnansweredQuestion
tagged with: maven
has body: I am using maven 3.2.1 mvn -version Apache Maven 3.2.1 (ea8b2b07643dbb1b84b6d16e1f08391b666bc1e9; 2014-02-14T09:37:52-08:00) Maven home: /usr/local/Cellar/maven/3.2.1/libexec Java version: 1.7.0_55, vendor: Oracle Corporation Java home: /Library/Java/JavaVirtualMachines/jdk1.7.0_55.jdk/Contents/Home/jre Default locale: en_US, platform encoding: UTF-8 OS name: "mac os x", version: "10.9.2", arch: "x86_64", family: "mac" My module structure projectA/ pom.xml core/ pom.xml business/ pom.xml persistence/ pom.xml rest/ pom.xml federated_services/ pom.xml ProjectA/pom.xml com.org projectA pom ${global.version} <global.version>1.0-SNAPSHOT</global.version> core/pom.xml projectA com.org ${global.version} .. Things are fine until here meaning core/xml can find ${project.version}. But when I do persistence/pom.xml core com.org ${global.version} ../../ The pom complains [ERROR] The project com.org:persistence:${global.version} (/Users/harith/IdeaProjects/project/core/persistence/pom.xml) has 1 error [ERROR] Non-resolvable parent POM: Could not transfer artifact com.org:core:pom:${global.version} from/to local central mirror (http://maven.corp.org.com:9999/repository/public): Illegal character in path at index 68: http://maven.corp.org.com:9999/repository/public/com/org/core/${global.version}/core-${global.version}.pom and 'parent.relativePath' points at wrong local POM @ line 5, column 13 -> [Help 2] Question - How can I have persistence/pom.xml inherit ${project.version} from projectA/pom.xml?
tagged with: http://stackoverflow.com/tag/xml
downvote count: 0
tagged with: java

http://stackoverflow.com/comment/35405597
comment on: http://stackoverflow.com/q/23153983
type: Comment
type: QuestionComment
has text: is that compile? You doesn't return result in `getView` method if `convertedView!=null`
score: 0

http://stackoverflow.com/q/23171557
tagged with: java
has comment: http://stackoverflow.com/comment/35456531
type: Question
has title: Regexp issue in java
upvote count: 0
has comment: http://stackoverflow.com/comment/35436632
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/23171635
tagged with: regex
has body: All, Below is the pseudo code for pattern matching, When am passing both regexp and input as String literals, am getting valid response matchPattern(Pattern.compile("^IN\\|Web\\|Track\\|Shop\\|","IN|Coy|") Pattern ^IN\|Web\|Track\|Shop\| ,matched false for IN|Coy but when the same regexp is passed derived from bean , i get incorrect response Bean.PatternValue ="^IN\\|Web\\|Track\\|Shop\\|"; matchPattern(Pattern.compile(Bean.PatternValue ),"IN|Coy|") Pattern ^IN\\|Web\\|Track\\|Shop\\| ,matched true for IN|Coy| And matchPattern does the following. Matcher matcher = pattern.matcher(value); if (matcher.find()) { matched= true; }
downvote count: 2
has comment: http://stackoverflow.com/comment/35437912
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23171635
score: -2

http://stackoverflow.com/a/23217678
has comment: http://stackoverflow.com/comment/35518360
has body: Try this one import com.google.gwt.event.dom.client.KeyCodes; import com.google.gwt.i18n.client.DateTimeFormat; import com.google.gwt.user.client.Event; import com.google.gwt.user.client.Event.NativePreviewEvent; ... Event.addNativePreviewHandler(new Event.NativePreviewHandler() { @Override public void onPreviewNativeEvent(final NativePreviewEvent event) { if (event.getTypeInt() == Event.ONKEYPRESS) { if (event.getNativeEvent().getKeyCode() == KeyCodes.KEY_BACKSPACE) { System.out.println("Back space is pressed"); } } } }); t1.sinkEvents(Event.ONKEYPRESS);
has comment: http://stackoverflow.com/comment/35520840
has comment: http://stackoverflow.com/comment/35518465
accepted answer of: http://stackoverflow.com/q/23215746
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35534509
has comment: http://stackoverflow.com/comment/35534602
score: 0
answers question: http://stackoverflow.com/q/23215746
type: Answer

http://stackoverflow.com/comment/35577598
type: AnswerComment
comment on: http://stackoverflow.com/a/23240891
type: Comment
has text: Is there a guide to setting up the JDK to compile your java code from a C Compiler? (Ideally an eclipse set up)
score: 0

http://stackoverflow.com/q/23129837
type: Question
downvote count: 0
accepted answer: http://stackoverflow.com/a/23130253
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/35362394
has title: Hibernate : Can a class A have several collections of class B objects?
type: AnsweredQuestion
tagged with: many-to-many
has answer: http://stackoverflow.com/a/23130253
score: 1
has body: I'm trying to implement a specific behavior with Hibernate (3.6), on wich I'm not able to find any information. Basically, I'd like to have a many-to-many relationship between 2 tables, as show below : class Task { private Long id; private Set&lt;Person&gt; personsInCharge; private Set&lt;Person&gt; contributors; private Set&lt;Person&gt; validators; } class Person { private Long id; private Set&lt;Task&gt; tasks; } My issue is that a same person can have different roles depending on the task, or different roles for the same task, therefore it's not possible to define a "fixed" role for the person. So, it would be convenient if I could have a join table on which I could add a specific "role" as a third primary key, and then use custom loaders in my mapping files. Is there a way to define this using Hibernate, or should I create a specific transitional POJO (or "handmade" table) ? Thanks in advance for any feedback.
tagged with: java
tagged with: hibernate
upvote count: 1

http://stackoverflow.com/comment/35439226
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23150133
has text: Thanks for the pointer. Think I found the issue. My OSGi bundle does not have the "serviceComponents.xml" file in the OSGI-INF folder. As I said earlier I'm using cqblueprints structure and eclipse. No idea why this is not generating.

http://stackoverflow.com/a/32029607
has body: a nice variant would be to use the GroovyShell. def c = """ package de.myCorp.test class Test { def a def b def c Test(String c){ this.c = c} public String greet(){ return "hello "+a } public void count(){ (1..4).each{ println it } } } def class UsingTest { Test mytest = null UsingTest (Test test){ this.mytest = test } def using(){ mytest.greet(); } } """ GroovyShell gs = new GroovyShell() //I hope this is not a too bad hack ^^ def erg = gs.evaluate(c+";['test':Test, 'using':UsingTest];") def testclass = erg["test"].newInstance("Charlotte on Ice") testclass.a = "hugo" testclass.b = "sepp" testclass.count() assert testclass.greet() == "hello hugo" assert testclass.c == "Charlotte on Ice" assert testclass.class.name == "de.myCorp.test.Test" def usingclass = erg['using'].newInstance(testclass) usingclass.mytest.a = "Fritzl" assert usingclass.using() == "hello Fritzl" ...and especially notice the GroovyShell.evaluate(URI uri) types... GroovyShellDoc
answers question: http://stackoverflow.com/q/23160278
downvote count: 0
upvote count: 2
type: Answer
score: 2

http://stackoverflow.com/comment/35639465
has text: Java GUIs might have to work on a number of platforms, on different screen resolutions & using different PLAFs. As such they are not conducive to exact placement of components. To organize the components for a robust GUI, instead use layout managers, or [combinations of them](http://stackoverflow.com/a/5630271/418556), along with layout padding & borders for [white space](http://stackoverflow.com/q/17874717/418556).
type: Comment
comment on: http://stackoverflow.com/a/23261137
score: 0
type: AnswerComment

http://stackoverflow.com/comment/35614318
type: QuestionComment
has text: Just a syntax trick: `flag == false` is pretty uncommon, `!flag` is shorter to write (and, my opinion, more readable) :)
comment on: http://stackoverflow.com/q/23270153
score: 0
type: Comment

http://stackoverflow.com/comment/35451898
has text: Thanks, but I don't understand why there is a conflicting access at all, because when I lock and release an object with synchronized, do I have to care if the first thread made a local copy of it? When the object is getting unlocked, isn't it then guaranteed that the next thread gains access to the modified object?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23180132
type: Comment

http://stackoverflow.com/a/23193636
has body: The following example uses ThriftDeserializer class as the SerDe for the table. You can create your own SerDe (implement Serializer/Deserialiser interfaces of Hive) and provide that when creating your table. CREATE EXTERNAL TABLE IF NOT EXISTS test ROW FORMAT SERDE 'org.apache.hadoop.hive.serde2.thrift.ThriftDeserializer' with serdeproperties("serialization.format"="org.apache.thrift.protocol.TCompactProtocol", "serialization.class"="some.package.ClassName") STORED AS SEQUENCEFILE
type: Answer
answers question: http://stackoverflow.com/q/23186353
score: 0

http://stackoverflow.com/comment/35474689
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23192768
type: AnswerComment
has text: I don't think it's good practice to use `File.separator` in this way. It can cause problems with portability (specifically, a class that is compiled on one OS will have File.separator inlined as that OS's value, so it may not work as expected when run on a different OS). It is better to use `new File(dirName, childName)` which always works. In your case, `new File(new File("C:", "hello"), "hi.txt");`. Not sure about `new File("C:")`, I've never tried that (not a regular user of Windows).

http://stackoverflow.com/a/23281325
score: 0
has body: what about this ? public static void main(String[] args) { //min and max value int min = -1000; int max = 1000; //collection to store numbers ArrayList&lt;Integer&gt; numbers = new ArrayList&lt;Integer&gt;(); Random random = new Random(); //receive input Scanner myScanner = new Scanner(System.in); int numberFromUser = Integer.parseInt(myScanner.nextLine()); for (int i = 0; i &lt; numberFromUser; i++) { numbers.add(random.nextInt(max - min + 1) + min); } System.out.println("Unsorted :" + numbers); // sort the numbers Collections.sort(numbers); System.out.println("Sorted :" + numbers); numbers.clear(); }
type: Answer
answers question: http://stackoverflow.com/q/23281206

http://stackoverflow.com/q/23157838
type: Question
has title: Callback when the activity is fully displayed
has comment: http://stackoverflow.com/comment/35411851
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/23158034
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/35412074
has body: I want to fade in application's logo when the main page is loaded. I put the code in onResume function, the problem is that the fading starts before the page is displayed and I see it in the middle or sometimes even when it already ended. How can I run it when the page is fully displayed to the user?
tagged with: java
has answer: http://stackoverflow.com/a/23157930

http://stackoverflow.com/comment/35528152
type: QuestionComment
comment on: http://stackoverflow.com/q/23222468
score: 0
has text: Check this answer :) : http://stackoverflow.com/questions/11324372/how-to-make-spring-inject-value-into-a-static-field
type: Comment

http://stackoverflow.com/comment/35551623
score: 0
type: Comment
type: QuestionComment
has text: Oh that's much cleaner thank you
comment on: http://stackoverflow.com/q/23236054

http://stackoverflow.com/comment/35427414
comment on: http://stackoverflow.com/a/23166086
type: AnswerComment
has text: yes you can do that by calling finish() instead of starting new activity also
score: 0
type: Comment

http://stackoverflow.com/comment/35522193
type: QuestionComment
comment on: http://stackoverflow.com/q/23206583
score: 0
type: Comment
has text: Correct. This is a basic issue, and you do well to fix those without stackoverflow :) You might want to remove this question, as it won't help anyone else, being too specific.

http://stackoverflow.com/a/23161614
accepted answer of: http://stackoverflow.com/q/23161328
has comment: http://stackoverflow.com/comment/35899213
type: AcceptedAnswer
downvote count: 0
has body: The correct way is to ensure that the Id and the version of the stored entity was never changed during it's roundtrip to other parts of the application. Then take that detached storedEntity, and call merge on it: YourEntity attachedEntity = entityManager.merge(storedEntity); You can make further changes to the entity after attachment by using the attached entity reference, not the original storedEntity detached copy. In general the version field should not be modified by the application, Hibernate will handle this. At most this field can be copied around between entities and DTOs.
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/35424799
upvote count: 1
answers question: http://stackoverflow.com/q/23161328

rest
tags question: http://stackoverflow.com/q/23135709
tags question: http://stackoverflow.com/q/23178414
tags question: http://stackoverflow.com/q/23219344
tags question: http://stackoverflow.com/q/23280931
tags question: http://stackoverflow.com/q/23268681
tags question: http://stackoverflow.com/q/23256999
tags question: http://stackoverflow.com/q/23186279
tags question: http://stackoverflow.com/q/23242360
tags question: http://stackoverflow.com/q/23238876
tags question: http://stackoverflow.com/q/23195835
tags question: http://stackoverflow.com/q/23250429
tags question: http://stackoverflow.com/q/23197207
tags question: http://stackoverflow.com/q/23255523
tags question: http://stackoverflow.com/q/23173816
tags question: http://stackoverflow.com/q/23286721
tags question: http://stackoverflow.com/q/23245578
tags question: http://stackoverflow.com/q/23204630
tags question: http://stackoverflow.com/q/23257697
tags question: http://stackoverflow.com/q/23262620
tags question: http://stackoverflow.com/q/23177078
tags question: http://stackoverflow.com/q/23255649
tags question: http://stackoverflow.com/q/23226430
tags question: http://stackoverflow.com/q/23198394
tags question: http://stackoverflow.com/q/23191239
tags question: http://stackoverflow.com/q/23179823
tags question: http://stackoverflow.com/q/23287895
tags question: http://stackoverflow.com/q/23210303
tags question: http://stackoverflow.com/q/23154181
tags question: http://stackoverflow.com/q/23270093
tags question: http://stackoverflow.com/q/23209167
tags question: http://stackoverflow.com/q/23223946
tags question: http://stackoverflow.com/q/23215221
type: Tag
tags question: http://stackoverflow.com/q/23267483
tags question: http://stackoverflow.com/q/23198231
tags question: http://stackoverflow.com/q/23229936
tags question: http://stackoverflow.com/q/23217234
tags question: http://stackoverflow.com/q/23190565
tags question: http://stackoverflow.com/q/23156123
tags question: http://stackoverflow.com/q/23254675
tag name: rest
tags question: http://stackoverflow.com/q/23211076
tags question: http://stackoverflow.com/q/23133665
tags question: http://stackoverflow.com/q/23274616
tags question: http://stackoverflow.com/q/23254425
tags question: http://stackoverflow.com/q/23248121
tags question: http://stackoverflow.com/q/23259687
tags question: http://stackoverflow.com/q/23136748
tags question: http://stackoverflow.com/q/23224234

http://stackoverflow.com/q/23234169
answer count: 1
tagged with: string
has comment: http://stackoverflow.com/comment/35548355
favorite count: 0
linked to: http://stackoverflow.com/q/513832
has comment: http://stackoverflow.com/comment/35547988
has title: Inconceivable Java String Discrepancy?
has body: This is my first posted question on Stack Overflow. I have developed an application that stores a user's text in a simple encrypted form in a text file. The application also is meant to decrypt the text and display it on the screen at the user's demand. The code below shows my "UnEncrypt" method. This method effectively separates the encrypted text into four character intervals. It then runs these four character intervals through an encryption key method to convert the four characters into a single character. I also have this method run a "test" string. The value of the "test" string is "85jf" which corresponds to the character "t" in the "UnKey" method. Now for the problem: strings "c" and "test" both hold the exact same value; however, the "test" string is effectively converted into the character "t" and the "c" string returns an error ("E"). I have included evidence of this below: the "UnEncrypt" method. So to conclude here: strings "test" and "c" have the exact same value, however, those values were created different ways (as seen in the code). When "test" and "c" run through the same method "UnKey", two different values are returned. My question is why this is happening? I need "c" to return a valid character for my application to work. My only guess as to why this is happening is because when the for loop generates the string "c", it looks the same on the outside but some inner value is different and therefor incompatible with my method "UnKey". I have tried to be as clear as possible. Please ask me questions if needed. Thanks in advance for any help! Edit: string s being passed into "UnEncrypt" is "85jf" public static String UnEncrypt(String s){ char one = 0; char two = 0; char three = 0; char four = 0; String c = ""; String fnl = ""; String test = "85jf"; for(int i = 0; i&lt;= ((s.length()/4)-1); i++){ one = s.charAt((i*4)+0); c += one; two = s.charAt((i*4)+1); c += two; three = s.charAt((i*4)+2); c += three; four = s.charAt((i*4)+3); c += four; System.out.p…
has comment: http://stackoverflow.com/comment/35548597
has answer: http://stackoverflow.com/a/23234250
downvote count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35548253
type: Question
has comment: http://stackoverflow.com/comment/35547919
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/35548383
upvote count: 1
has comment: http://stackoverflow.com/comment/35548410

http://stackoverflow.com/q/23233623
tagged with: multithreading
has comment: http://stackoverflow.com/comment/35547028
type: Question
possible better answer: http://stackoverflow.com/a/27024746
has title: Java Locks and Conditions
tagged with: java
answer count: 2
tagged with: locking
upvote count: 1
has body: Say I have three threads, thread 1, thread 2, and thread 3 all sharing the same lock. Thread 2 acquires the lock, does some work and then blocks via a call to the await method. Thread 1 then acquires the lock, does some work, and during the middle of it, thread 3 tries to acquire the lock but is blocked since thread 1 is holding it. Thread 1 finishes working and, before terminating, signals thread 2 that it can reacquire the lock. So what happens then? Will thread 2 or thread 3 acquire the lock next? Thank you so much for your time and help in advance.
favorite count: 0
has answer: http://stackoverflow.com/a/27024746
has answer: http://stackoverflow.com/a/23233776
accepted answer: http://stackoverflow.com/a/23233776
type: AnsweredQuestion
downvote count: 0
score: 1

http://stackoverflow.com/comment/35565922
comment on: http://stackoverflow.com/q/23244390
type: QuestionComment
score: 1
has text: Possible duplicate of [Java RegEx Matcher.groupCount returns 0](http://stackoverflow.com/questions/12413974/java-regex-matcher-groupcount-returns-0).
type: Comment

http://stackoverflow.com/a/23341346
answers question: http://stackoverflow.com/q/23136512
type: Answer
score: 0
has body: I don't have a perfect solution for, just an idea .. (maybe dumb, no guarantee): I get it that you need to compute it extremely fast. So traversing along every point like: area = 0; foreach(point p : points) { area += testIfInsidePolygon(p); } is not an option. I believe that there is no analytical solution to this problem that would result in a such nice algorithm that you provided. So my idea is: traverse along each polygon vertex and using Bresenham's line algorithm (http://en.wikipedia.org/wiki/Bresenhams_line_algorithm) compute if particular point is on the edge of the polygon store point locations in 2D k-d tree (http://en.wikipedia.org/wiki/K-d_tree) which is extremely efficient for space partitioning if some point is already stored inside k-d tree, it means that you are dealing with situation like with your lover-right corner point find the top-most and lower-most points using k-d tree traverse from top-most to lower-most coordinate, cast the ray from the side and query k-d tree again for ray &lt;-> polygon edge intersection points using sum of differences between intersection points X coordinates you can calculate your area Some need for special case corrections is extremely likely :) This algorithm is by far faster than O(n^2) of traversing all points. However, you'll pay with complexity.

http://stackoverflow.com/comment/35578252
has text: Sorry to hijack an answer, but there's no other way. Please take more care when performing tag wiki excerpt edits. You've added excerpts to tags with obvious typos, added dictionary definitions that were blatantly wrong (did not match the actual use of the tag), and worst of all, you're copying and pasting content from other sites without attribution. If you aren't more careful, the system is going to end up blocking your ability to edit!
score: 0
comment on: http://stackoverflow.com/a/23207058
type: Comment
type: AnswerComment

http://stackoverflow.com/a/23265296
answers question: http://stackoverflow.com/q/23265157
downvote count: 0
upvote count: 2
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/23265157
type: AcceptedAnswer
has body: This means your heap is full. You have too many and/or heavy objects in memory. Possible causes: you keep references to unused objects, and create too many of them Solution: check for memory leaks you actually need all those references, but your heap is too small Solution: increase the heap Since your exception happens after a long time, I believe the first one is probably your problem.

http://stackoverflow.com/q/23139616
tagged with: sqlite
answer count: 1
tagged with: android-adapter
favorite count: 0
upvote count: 2
has answer: http://stackoverflow.com/a/23139688
has body: I am developing a Notepad app. NotesDbAdapter is the ContentProvider. NoteEdit ( edit the note) and NoteList ( display the notes already created from database). When I make an intent from NoteList to NoteEdit class,the app crash and appear this fatal error. My LogCat 04-17 17:49:41.981: E/Trace(26753): error opening trace file: No such file or directory (2) 04-17 17:49:45.071: E/AndroidRuntime(26753): FATAL EXCEPTION: main 04-17 17:49:45.071: E/AndroidRuntime(26753): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.note/com.example.note.contentprovider.NoteEdit}: android.database.CursorIndexOutOfBoundsException: Index 0 requested, with a size of 0 04-17 17:49:45.071: E/AndroidRuntime(26753): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2074) 04-17 17:49:45.071: E/AndroidRuntime(26753): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2099) 04-17 17:49:45.071: E/AndroidRuntime(26753): at android.app.ActivityThread.access$600(ActivityThread.java:138) 04-17 17:49:45.071: E/AndroidRuntime(26753): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1205) 04-17 17:49:45.071: E/AndroidRuntime(26753): at android.os.Handler.dispatchMessage(Handler.java:99) 04-17 17:49:45.071: E/AndroidRuntime(26753): at android.os.Looper.loop(Looper.java:137) 04-17 17:49:45.071: E/AndroidRuntime(26753): at android.app.ActivityThread.main(ActivityThread.java:4929) 04-17 17:49:45.071: E/AndroidRuntime(26753): at java.lang.reflect.Method.invokeNative(Native Method) 04-17 17:49:45.071: E/AndroidRuntime(26753): at java.lang.reflect.Method.invoke(Method.java:511) 04-17 17:49:45.071: E/AndroidRuntime(26753): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:798) 04-17 17:49:45.071: E/AndroidRuntime(26753): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:565) 04-17 17:49:45.071: E/AndroidRuntime(26753): at dalvik.system.NativeStart.main(Native Method) 04-17 17:49:45.071…
tagged with: android-contentprovider
type: AnsweredQuestion
tagged with: java
has title: FATAL ERROR - CursorIndexOutOf BoundsException:Index 0 requested , with a size of 0
type: Question
accepted answer: http://stackoverflow.com/a/23139688
score: 2
downvote count: 0
tagged with: android

http://stackoverflow.com/q/23283655
has body: String[][] 2dArray = new String[counter][2]; 2dArray [counter][column1] = String.valueOf(counter); 2dArray [counter][column2] = "something something something"; for(int i = 0; i &lt; 2dArray.length-1; i++){ for(int j = i + 1; j &gt; 0; j--){ if(2dArray[i][j] &lt; 2dArray[i-1][j]){ int[][] temp = 2dArray[i-1][j]; 2dArray[i-1][j] = 2dArray[i][j]; 2dArray[i][j] = temp; } } } Attempting to sort the array so that column 1 is ascending. I've studied the other references on here and mimic'd them but for some reason my IDE does not like the above...
answer count: 5
upvote count: 1
has answer: http://stackoverflow.com/a/23284728
type: AnsweredQuestion
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/23283830
accepted answer: http://stackoverflow.com/a/23283829
has comment: http://stackoverflow.com/comment/35639041
has title: Bubble sort on 2D Array Java
has comment: http://stackoverflow.com/comment/35639075
type: Question
has answer: http://stackoverflow.com/a/23283767
has answer: http://stackoverflow.com/a/23283829
tagged with: arrays
has comment: http://stackoverflow.com/comment/35639017
tagged with: bubble-sort
has comment: http://stackoverflow.com/comment/35639033
has comment: http://stackoverflow.com/comment/35639056
has answer: http://stackoverflow.com/a/23283830
has comment: http://stackoverflow.com/comment/35639101
has comment: http://stackoverflow.com/comment/35639507
downvote count: 0
has answer: http://stackoverflow.com/a/23283689
has comment: http://stackoverflow.com/comment/35639079
favorite count: 0

http://stackoverflow.com/q/23173076
tagged with: augmented-reality
has title: Augmented Reality measurement technics/methods
score: 3
tagged with: java
type: Question
has body: I am going to perform a comparative analysis against two AR application built respectively in: JavaScript and HTML5 (Mobile Web-App), and: Java (Mobile App) Could you please advise me as to what tools/methods should I use to measure things like: Application start time, or: Time needed to refresh the displayed 3D model Thank you for your attention.
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/23181178
linked to: http://stackoverflow.com/q/14124913
tagged with: javascript
tagged with: android
tagged with: http://stackoverflow.com/tag/html
favorite count: 0
upvote count: 3
type: UnansweredQuestion

http://stackoverflow.com/q/23229160
tagged with: ejb
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/23229281
answer count: 1
tagged with: jpa
downvote count: 0
has body: I would like to understand what is the correct means of catching a JPA exception from within an EJB. Typically the exceptions would be a result of a database constraint being violated or some other database related error. I have tried using a try/catch block around the relevant EntityManager call (e.g. remove to delete a record from a database table) but the exception is not caught. If I put a couple of System.out.println statements immediately before and after the relevant EntityManager call then both printlns appear in the system log which would suggest the EntityManager call itself isn't throwing the exception and that something else is throwing the exception. The application I've developing uses a JSF front end, whilst I could catch the "javax.ejb.EJBException: Transaction aborted" exception and then unwrap it to find the root cause within the JSF backing bean, I would have to do the same with any other front ends that are developed in the future and potentially resulting in duplicate code. The only solution I've managed to find so far is using an @AroundInvoke interceptor which puts a try/catch block around the InvocationContext.proceed() function call which catches a javax.persistence.PersistenceException and then unwraps the exception using the getCause() method to see whether the cause is an instanceof a number of hardcoded exceptions such as java.sql.SQLIntegrityConstraintViolationException and if the cause is found throws an custom exception which I have created. Whatever code called the EJB function can then report the exception back to the user in a user friendly way rather than as a rather unhelpful "javax.ejb.EJBException: Transaction aborted". Whilst this approach works it doesn't seem the most elegant or correct way of catching JPA exceptions. To provide a concrete example I have an EJB which contains a method that uses em.remove() to delete a record from a database table. Another table within the database has a foreign key constraint on this table w…
favorite count: 0
score: 1
upvote count: 1
has answer: http://stackoverflow.com/a/23229281
has title: What is the correct way to catch a JPA exception within an EJB
tagged with: jakarta-ee
type: AnsweredQuestion

http://stackoverflow.com/a/52033799
has comment: http://stackoverflow.com/comment/112496900
type: Answer
answers question: http://stackoverflow.com/q/23260057
has comment: http://stackoverflow.com/comment/99698031
downvote count: 0
score: 190
has body: In my case the issue was related to too long log outputting into IntelliJ IDEA console (OS windows 10). Command: mvn clean install This command solved the issue to me: mvn clean install &gt; log-file.log
has comment: http://stackoverflow.com/comment/101004844
has comment: http://stackoverflow.com/comment/120241629
has comment: http://stackoverflow.com/comment/98162429
has comment: http://stackoverflow.com/comment/106629840
has comment: http://stackoverflow.com/comment/131640258
has comment: http://stackoverflow.com/comment/124406659
has comment: http://stackoverflow.com/comment/116894591
has comment: http://stackoverflow.com/comment/123417223
has comment: http://stackoverflow.com/comment/106014287
has comment: http://stackoverflow.com/comment/104604223
upvote count: 190
has comment: http://stackoverflow.com/comment/102658033
has comment: http://stackoverflow.com/comment/97829923
has comment: http://stackoverflow.com/comment/116726202
has comment: http://stackoverflow.com/comment/124537812

http://stackoverflow.com/q/23283853
tagged with: exception
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35639815
tagged with: spring
has answer: http://stackoverflow.com/a/23942943
has answer: http://stackoverflow.com/a/23874038
has comment: http://stackoverflow.com/comment/35642407
downvote count: 0
has comment: http://stackoverflow.com/comment/36657725
tagged with: java
has comment: http://stackoverflow.com/comment/35639373
type: Question
has comment: http://stackoverflow.com/comment/36657529
score: 5
has comment: http://stackoverflow.com/comment/35639540
has title: Null pointer exception while running Spring project
has comment: http://stackoverflow.com/comment/36657566
tagged with: tomcat
has comment: http://stackoverflow.com/comment/35639884
answer count: 3
has comment: http://stackoverflow.com/comment/35642763
has body: I am unable to figure out reason for NullPointer exception in my Spring project. Sometime project works fine but some time its throwing null pointer Exception here is full stacktrace. org.apache.jasper.JasperException: javax.servlet.ServletException: java.lang.NullPointerException org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:585) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:455) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334) javax.servlet.http.HttpServlet.service(HttpServlet.java:728) org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:322) org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:116) org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83) org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113) org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:103) org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:113) org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:54) org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProx…
has comment: http://stackoverflow.com/comment/35642490
has answer: http://stackoverflow.com/a/23822148
favorite count: 0
upvote count: 5

http://stackoverflow.com/comment/35402019
has text: Object[] obj = myArrayList.get(0)
type: Comment
comment on: http://stackoverflow.com/q/23152199
score: 0
type: QuestionComment

http://stackoverflow.com/q/23141302
tagged with: google-app-engine
has answer: http://stackoverflow.com/a/23144893
tagged with: java
accepted answer: http://stackoverflow.com/a/23144893
tagged with: google-plugin-eclipse
has title: Possible to use Google Modules with Google Plugin for Eclipse?
answer count: 1
has body: My goal is to develop Java applications that use the new Google Modules. I’d like to use the Google Plugin for Eclipse because it’s simple to debug and upload to Google. The problem is I can’t tell if it’s possible to use the Google Plugin for Eclipse for Java applications that use Google Modules. According to this comment it’s possible to use Google Modules with the Eclipse Web Tools Platform with Google App Engine. And according to this documentation, Eclipse Web Tools Platform with Google App Engine is a component included in Google Plugin for Eclipse. But does that mean it’s possible to use the Google Plugin for Eclipse for Java applications that use Google Modules?
linked to: http://stackoverflow.com/q/22941772
tagged with: google-eclipse-plugin
tagged with: eclipse
linked to: http://stackoverflow.com/q/22732977
score: 2
type: AnsweredQuestion
downvote count: 0
favorite count: 0
type: Question
upvote count: 2

http://stackoverflow.com/q/23249909
downvote count: 0
possible better answer: http://stackoverflow.com/a/78767841
favorite count: 0
has title: How to use extended Jackson MapSerializer in Hashmap
has body: I'm trying to extend the com.fasterxml.jackson.databind.ser.std.MapSerializer to include some of my own defined functions to be used in serialize() method. public class MyMapSerializer extends MapSerializer{ //have constructors //override method @Override public void serialize(Map&lt;?,?&gt; value, JsonGenerator jgen, SerializerProvider provider){} } Then I add the annotation to my map as folllowing: @JsonSerialize(using = org.entities.generator.MyMapSerializer.class) private Map&lt;ObjectA,ObjectB&gt; myObject; But when I add a breakpoint in the MapSerializer, it does not even go into it. And I tried to extend JsonSerializer>, it goes into it. Anyone knows how to use the extended MapSerializer? Thanks for the help
tagged with: dictionary
accepted answer: http://stackoverflow.com/a/23256689
type: AnsweredQuestion
upvote count: 2
tagged with: java
type: Question
tagged with: jackson
has answer: http://stackoverflow.com/a/78767841
answer count: 2
has answer: http://stackoverflow.com/a/23256689
score: 2

http://stackoverflow.com/q/23272029
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/35618914
has title: Spring-JMS: Sending a JMSObjectMessage to WebSphere MQ, but receiving a JMSBytesMessage
favorite count: 0
tagged with: ibm-mq
has comment: http://stackoverflow.com/comment/35616929
has comment: http://stackoverflow.com/comment/35616776
accepted answer: http://stackoverflow.com/a/23286913
has comment: http://stackoverflow.com/comment/35616697
tagged with: spring
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/35617019
type: Question
has comment: http://stackoverflow.com/comment/35618613
linked to: http://stackoverflow.com/q/6150006
has answer: http://stackoverflow.com/a/23286913
has body: I use Spring's JmsTemplate to send an ObjectMessage to a MQ Queue: this.jmsTemplate.send(this.queue, new MessageCreator() { public Message createMessage(Session session) throws JMSException { MyPayload payload = new MyPayload(); payload.setSomething(...); return session.createObjectMessage(payload); } }); The sent message is of type com.ibm.jms.JMSObjectMessage, but the corresponding destination receives a message of type com.ibm.jms.JMSBytesMessage: Message message = this.jmsTemplate.receive(this.queue); Any idea, why and where the conversion takes place? This similar question is not really answered. Further information: A TextMessage is received as com.ibm.jms.JMSTextMessage, an ObjectMessage with just a string inside is converted to a com.ibm.jms.JMSBytesMessage, too.
has comment: http://stackoverflow.com/comment/35616637
tagged with: spring-jms

http://stackoverflow.com/a/23293769
has body: You can call import install4j.runtime.installer.ContextImpl.InstallationComponentSetupImpl; String id = ((InstallationComponentSetupImpl)component).getInternalId() to get the internal ID of an installation component.
accepted answer of: http://stackoverflow.com/q/23273252
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23273252
type: Answer
score: 2
upvote count: 2

http://stackoverflow.com/a/23148276
has comment: http://stackoverflow.com/comment/134922847
downvote count: 1
has body: LinkedHashSet maintains insertion order, but HashSet doesn't. Quote from LinkedHashSet's javadoc: Hash table and linked list implementation of the Set interface, with predictable iteration order. This implementation differs from HashSet in that it maintains a doubly-linked list running through all of its entries. This linked list defines the iteration ordering, which is the order in which elements were inserted into the set (insertion-order). Any constructor of LinkedHashSet invokes super constructor of HashSet: HashSet(int initialCapacity, float loadFactor, boolean dummy) { map = new LinkedHashMap&lt;&gt;(initialCapacity, loadFactor); } And LinkedHashMap is hash table and linked list implementation of the Map interface, with predictable iteration order.
has comment: http://stackoverflow.com/comment/134917150
type: Answer
answers question: http://stackoverflow.com/q/23148144
upvote count: 0
has comment: http://stackoverflow.com/comment/35395729
score: -1

http://stackoverflow.com/comment/35400578
type: QuestionComment
has text: Actually I have concat two values at the time of selection.sometimes I will get Cap metacin 20(example).So 20 is correct but if there is null in place of 20 then replace it with " ".
type: Comment
score: 0
comment on: http://stackoverflow.com/q/23151292

http://stackoverflow.com/comment/35428072
type: QuestionComment
comment on: http://stackoverflow.com/q/23166551
score: 1
type: Comment
has text: What do you mean which line? When you don't know the methods that a class provides, you read its javadoc. The link above is the `Map` class' javadoc. You can follow through and check the `Map.Entry` class. If you read it carefully, you'll notice `Entry` doesn't have a `remove()` method.

http://stackoverflow.com/q/23268430
tagged with: android-emulator
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/35610406
has comment: http://stackoverflow.com/comment/35610005
has answer: http://stackoverflow.com/a/23268537
downvote count: 0
has comment: http://stackoverflow.com/comment/35609833
tagged with: media-player
has comment: http://stackoverflow.com/comment/35610483
tagged with: url
has title: Android: cant play the mp3 file from the given url
favorite count: 0
accepted answer: http://stackoverflow.com/a/23268537
tagged with: android
upvote count: 1
possible better answer: http://stackoverflow.com/a/23268513
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23268513
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/35609662
has body: I want to know about the android media player. I have designed a media player such that it will take the url and play the song when i select the play button when i tested in my tablet it is not working if i select the button it will not play or give the error neither crashing is happening. i have a question in mind that whether the authentication is needed like example while researching i saw the android.drm etc because i am linking the url to the server can anyone help me in this i have posted the code which i have used even the logcat details as well. logcat will tell about GPU so i tested in my tablet as well still i cant listen to the mp3 file public class MainActivity extends Activity { static final String AUDIO_PATH = "url"; private MediaPlayer mediaPlayer; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); } public void doClick(View view) { switch(view.getId()) { case R.id.play: try { playAudio(AUDIO_PATH); } catch (Exception e) { e.printStackTrace(); } break; case R.id.stop: if(mediaPlayer != null) { mediaPlayer.stop(); } break; } } private void playAudio(String url) throws Exception { killMediaPlayer(); mediaPlayer = new MediaPlayer(); mediaPlayer.setDataSource(url); mediaPlayer.prepare(); mediaPlayer.start(); } @Override protected void onDestroy() { super.onDestroy(); killMediaPlayer(); } private void killMediaPlayer() { if(mediaPlayer!=null) { try { mediaPlayer.release(); } catch(Exception e) { e.printStackTrace(); } } }} main.xml file is as shown below &lt;EditText android:id="@+id/EditTextSongURL" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="0.54" android:ems="10" android:inputType="textMultiLine" &gt; &lt;requestFocus /&gt; &lt;/EditText&gt; &lt;ImageButton android:id="@+id/ButtonTestPlayPause1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/play" /&gt; &lt;SeekBar android:id="@+…

http://stackoverflow.com/comment/35429524
type: Comment
comment on: http://stackoverflow.com/a/23167293
type: AnswerComment
has text: The convention is to name such packages `internal`, e.g. `com.google.common.base.internal`
score: 0

http://stackoverflow.com/q/23287895
score: 0
answer count: 1
tagged with: rest
has answer: http://stackoverflow.com/a/23288672
accepted answer: http://stackoverflow.com/a/23288672
has title: Mysql query in java
tagged with: netbeans
tagged with: mysql
has body: I have a service rest from database generated in netbeans. This creates entity classes for each table . @Entity @Table(name = "users") @XmlRootElement @NamedQueries({ @NamedQuery(name = "Users.findAll", query = "SELECT u FROM Users u"), @NamedQuery(name = "Users.findById", query = "SELECT u FROM Users u WHERE u.id = :id"), @NamedQuery(name = "Users.findByName", query = "SELECT u FROM Users u WHERE u.name = :name"), @NamedQuery(name = "Users.findByTelephone", query = "SELECT u FROM Users u WHERE u.telephone = :telephone"), @NamedQuery(name = "Users.findByYear", query = "SELECT u FROM Users u WHERE u.year = :year")}) public class Users implements Serializable { private static final long serialVersionUID = 1L; @Id @Basic(optional = false) @NotNull @Column(name = "id") private Integer id; @Size(max = 25) @Column(name = "name") private String name; @Column(name = "telephone") private Integer telephone; @Column(name = "year") private Integer year; public Users() { } public Users(Integer id) { this.id = id; } public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public Integer getTelephone() { return telephone; } public void setTelephone(Integer telephone) { this.telephone = telephone; } public Integer getYear() { return year; } public void setYear(Integer year) { this.year = year; } @Override public int hashCode() { int hash = 0; hash += (id != null ? id.hashCode() : 0); return hash; } @Override public boolean equals(Object object) { // TODO: Warning - this method won't work in the case the id fields are not set if (!(object instanceof Users)) { return false; } Users other = (Users) object; if ((this.id == null &amp;&amp; other.id != null) || (this.id != null &amp;&amp; !this.id.equals(other.id))) { return false; } return true; } @Override public String toString() { return "glee.Users[ id=" + id + " ]"; } How I can query the db with this class fr…
type: AnsweredQuestion
tagged with: java
type: Question

netbeans
tags question: http://stackoverflow.com/q/23269434
tags question: http://stackoverflow.com/q/23232706
tags question: http://stackoverflow.com/q/23211172
tags question: http://stackoverflow.com/q/23261643
tags question: http://stackoverflow.com/q/23197353
tags question: http://stackoverflow.com/q/23273267
tags question: http://stackoverflow.com/q/23143005
tags question: http://stackoverflow.com/q/23287895
tags question: http://stackoverflow.com/q/23132302
tags question: http://stackoverflow.com/q/23190614
tags question: http://stackoverflow.com/q/23193152
tags question: http://stackoverflow.com/q/23180885
tags question: http://stackoverflow.com/q/23163237
tags question: http://stackoverflow.com/q/23167816
tags question: http://stackoverflow.com/q/23185418
tags question: http://stackoverflow.com/q/23228320
tags question: http://stackoverflow.com/q/23196200
tags question: http://stackoverflow.com/q/23187128
type: Tag
tags question: http://stackoverflow.com/q/23276251
tags question: http://stackoverflow.com/q/23255766
tags question: http://stackoverflow.com/q/23248710
tags question: http://stackoverflow.com/q/23280162
tags question: http://stackoverflow.com/q/23234509
tags question: http://stackoverflow.com/q/23256193
tags question: http://stackoverflow.com/q/23281946
tags question: http://stackoverflow.com/q/23175745
tags question: http://stackoverflow.com/q/23180428
tags question: http://stackoverflow.com/q/23227027
tags question: http://stackoverflow.com/q/23210359
tags question: http://stackoverflow.com/q/23208203
tags question: http://stackoverflow.com/q/23176624
tags question: http://stackoverflow.com/q/23277422
tags question: http://stackoverflow.com/q/23158604
tags question: http://stackoverflow.com/q/23189282
tags question: http://stackoverflow.com/q/23229604
tags question: http://stackoverflow.com/q/23227132
tags question: http://stackoverflow.com/q/23199975
tags question: http://stackoverflow.com/q/23243488
tags question: http://stackoverflow.com/q/23267479
tags question: http://stackoverflow.com/q/23170118
tags question: http://stackoverflow.com/q/23282739
tags question: http://stackoverflow.com/q/23220204
tags question: http://stackoverflow.com/q/23140908
tags question: http://stackoverflow.com/q/23179094
tags question: http://stackoverflow.com/q/23184063
tags question: http://stackoverflow.com/q/23185778
tags question: http://stackoverflow.com/q/23242360
tags question: http://stackoverflow.com/q/23188536
tags question: http://stackoverflow.com/q/23234298
tags question: http://stackoverflow.com/q/23227189
tags question: http://stackoverflow.com/q/23172920
tags question: http://stackoverflow.com/q/23281316
tags question: http://stackoverflow.com/q/23159915
tags question: http://stackoverflow.com/q/23158708
tags question: http://stackoverflow.com/q/23160622
tag name: netbeans
tags question: http://stackoverflow.com/q/23195878
tags question: http://stackoverflow.com/q/23210049
tags question: http://stackoverflow.com/q/23204503
tags question: http://stackoverflow.com/q/23250580
tags question: http://stackoverflow.com/q/23246649
tags question: http://stackoverflow.com/q/23155678
tags question: http://stackoverflow.com/q/23237331
tags question: http://stackoverflow.com/q/23203884
tags question: http://stackoverflow.com/q/23146909
tags question: http://stackoverflow.com/q/23274717
tags question: http://stackoverflow.com/q/23161904
tags question: http://stackoverflow.com/q/23224611
tags question: http://stackoverflow.com/q/23208604

http://stackoverflow.com/comment/35647415
comment on: http://stackoverflow.com/q/23274682
has text: you mean adding a reference to it like __ __ or embedding it inside the xml itself? (not sure if this is even possible)
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35365194
comment on: http://stackoverflow.com/a/23131521
score: 0
type: AnswerComment
type: Comment
has text: A good answer... can you please elaborate the sentence `"main thread is blocked while the queue is empty"`... how it is blocked? does it goes to sleep? or just sits on `while(true)` conditions as kedarnath said?

http://stackoverflow.com/q/23234509
tagged with: ireport
tagged with: netbeans
has comment: http://stackoverflow.com/comment/35548815
upvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/35548464
type: Question
has comment: http://stackoverflow.com/comment/35548547
has comment: http://stackoverflow.com/comment/35548467
downvote count: 3
has title: Can you help me with this Error Message?
answer count: 1
has comment: http://stackoverflow.com/comment/38328267
has body: Error loading the report template Message: net.sf.jasperreports.engine.JRException: org.xml.sax.SAXParseException; lineNumber: 145; columnNumber: 39; cvc-complex-type.2.4.d: Invalid content was found starting with element 'paragraph'. No child element is expected at this point. Level: SEVERE Stack Trace: org.xml.sax.SAXParseException; lineNumber: 145; columnNumber: 39; cvc-complex-type.2.4.d: Invalid content was found starting with element 'paragraph'. No child element is expected at this point. net.sf.jasperreports.engine.xml.JRXmlLoader.loadXML(JRXmlLoader.java:243) net.sf.jasperreports.engine.xml.JRXmlLoader.loadXML(JRXmlLoader.java:226) net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:214) com.jaspersoft.ireport.designer.JrxmlLoader.reloadJasperDesign(JrxmlLoader.java:73) com.jaspersoft.ireport.designer.JrxmlVisualView.run(JrxmlVisualView.java:512) org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1432) org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2042) cvc-complex-type.2.4.d: Invalid content was found starting with element 'paragraph'. No child element is expected at this point. com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:198) com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:134) com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:437) com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:368) com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:325) com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator$XSIErrorReporter.reportError(XMLSchemaValidator.java:458) com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.reportSchemaError(XMLSchemaValidator.java:3237) com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.handleStartElement(XMLSchemaValidator.java:1800) com…
favorite count: 0
has comment: http://stackoverflow.com/comment/35548491
has comment: http://stackoverflow.com/comment/35548850
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35548468
score: -3
has comment: http://stackoverflow.com/comment/35548454
has answer: http://stackoverflow.com/a/23235187

http://stackoverflow.com/q/23263226
tagged with: android-intent
type: Question
type: AnsweredQuestion
tagged with: dropbox
has answer: http://stackoverflow.com/a/23263347
answer count: 1
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/23263347
tagged with: android
score: 2
has body: I'm trying to implement a "Share Image" button in my Android app. Since the image might be private for the user, I did not want it to be saved on the device publicly, so I chose to use the cache. Before I figured out that the cache directory only was accessible by the owner app, I noticed that sharing the image to Dropbox worked just fine (whereas other apps threw Exceptions). How does Dropbox access that file if its located in my apps cache? My share-bitmap method (stripped of exception handling): final File outputFile = new File(getCacheDir(), filename); // Save file FileOutputStream out = new FileOutputStream(outputFile); bitmap.compress(Bitmap.CompressFormat.PNG, 100, out); // Get path of file Uri bmpUri = Uri.parse(outputFile.getAbsolutePath()); // Share image final Intent intent = new Intent(android.content.Intent.ACTION_SEND); intent.setData(bmpUri); intent.putExtra(Intent.EXTRA_STREAM, bmpUri); intent.setType("image/*"); startActivity(Intent.createChooser(intent,"Share Image"));
upvote count: 2
tagged with: java
has title: How does Dropbox app access my app-cache? (Android)

http://stackoverflow.com/comment/35599325
has text: you can add namespace for jpa in your spring config file and then can use it: http://www.springframework.org/schema/data/jpa http://www.springframework.org/schema/data/jpa/spring-jpa.xsd
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/23262675
type: Comment

http://stackoverflow.com/comment/35629355
type: Comment
type: QuestionComment
has text: and i just added the saveFile method
comment on: http://stackoverflow.com/q/23278439
score: 0

http://stackoverflow.com/a/23161686
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/48356924
upvote count: 2
type: AcceptedAnswer
downvote count: 0
has body: I suggest providing a .bat script for Windows and an .sh script for Linux and Mac; no compilation needed. Or if you must provide a native binary, C is nicer because it can easily be compiled on all platforms. Visual Basic is Windows specific and not very typically used for new projects.
accepted answer of: http://stackoverflow.com/q/23161634
answers question: http://stackoverflow.com/q/23161634

http://stackoverflow.com/a/23207097
has body: If you don't want to go through the trouble that is Java reflection, you can write a simple static factory method that takes a String and returns the appropriate object. public static Blender createBlender(String type){ switch(type){ case "Cuisinart": return new Cuisinart(); case "Oster": return new Oster(); //etc } } Then you just pass in your command line argument into it and you'll have whatever Blender you need. The only possible design issue is that you would have to type out a line for every class that implements Blender, so you'd have to update the method if you added more types later.
type: Answer
upvote count: 1
score: 1
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23207000
answers question: http://stackoverflow.com/q/23207000

http://stackoverflow.com/q/23146988
has title: HIbernate not returning results when passing class name in createCriteria or get
has body: I can't for the life of me figure out why Hibernate is not returning results or even executing the query when I pass the class name into the createCriteria() or get() methods. I've looked everything over and don't know what I'm missing. My jsp is calling a service, which calls the DAO, which retrieves the data. When I execute this statement, it does not work, in fact it doesn't even run the SQL at all (as it's not displayed in the console): List&lt;StyleChooser&gt; temp = sessionFactory.openSession().createCriteria(StyleChooser.class).list(); However when I run this, it works (console displays Hibernate: select * from css): List&lt;StyleChooser&gt; temp = sessionFactory.openSession().createSQLQuery("select * from css").list(); StyleChooser.java @Entity @Table(name="css") public class StyleChooser { @Id @GeneratedValue @Column(name="ID") public Integer id; @Column(name="HrefColor") public String hrefColor; @Column(name="ButtonBackColor") public String buttonBackColor; @Column(name="ButtonTextColor") public String buttonTextColor; @Column(name="TextSize") public Integer textSize; @Transient public CommonsMultipartFile file; public CommonsMultipartFile getFile() { return file; } public void setFile(CommonsMultipartFile file) { this.file = file; } public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public String getHrefColor() { return hrefColor; } public void setHrefColor(String hrefColor) { this.hrefColor = hrefColor; } public String getButtonBackColor() { return buttonBackColor; } public void setButtonBackColor(String buttonBackColor) { this.buttonBackColor = buttonBackColor; } public String getButtonTextColor() { return buttonTextColor; } public void setButtonTextColor(String buttonTextColor) { this.buttonTextColor = buttonTextColor; } public Integer getTextSize() { return textSize; } public void setTextSize(Integer textSize) { this.textSize = textSize; } }
type: Question
tagged with: spring-mvc
has answer: http://stackoverflow.com/a/23147432
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23147432
tagged with: java
tagged with: hibernate
answer count: 1
score: 0

http://stackoverflow.com/q/23231121
downvote count: 1
answer count: 1
linked to: http://stackoverflow.com/q/3685952
tagged with: jsp
favorite count: 0
has title: Display date in jsp
type: UnansweredQuestion
has body: In a jsp i would like to display the date of the year &lt;%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %&gt; &lt;jsp:useBean id="date" class="java.util.Date" pattern="yyyy" /&gt; &lt;fmt:formatDate value="${date}" /&gt; but i get for servlet jsp threw exception java.lang.IllegalArgumentException: Cannot convert 4/22/14 5:23 PM of type class java.util.Date to Number i saw on How to print current date in JSP? this is the way to go so i don't really understand.
has answer: http://stackoverflow.com/a/23231242
upvote count: 0
tagged with: java
duplicate of: http://stackoverflow.com/q/3685952
type: Question
score: -1

http://stackoverflow.com/q/23244686
has comment: http://stackoverflow.com/comment/35566282
tagged with: java
has answer: http://stackoverflow.com/a/23245423
has comment: http://stackoverflow.com/comment/35566379
has comment: http://stackoverflow.com/comment/35566756
type: Question
tagged with: qr-code
has comment: http://stackoverflow.com/comment/35566453
has body: I am developing an application that involves QR scanning.I am able to get scanner application working by using Zxing library, which is launched from my application A. I need to store the information of the scanned product in textbox or editbox and later use it for some other purpose . public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Intent intent = new Intent(MainActivity.this, CaptureActivity.class); // Intent intent = new // Intent("com.google.zxing.client.android.SCAN"); intent.putExtra("SCAN_MODE", "QR_CODE_MODE"); startActivityForResult(intent, 0); } @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 onActivityResult(int requestCode, int resultCode, Intent intent) { if (requestCode == 0) { if (resultCode == 1) { // Handle successful scan String capturedQrValue = intent.getStringExtra("RESULT"); // String format = intent.getStringExtra("SCAN_RESULT_FORMAT"); Toast.makeText(MainActivity.this,"Scan Result:" + capturedQrValue, Toast.LENGTH_SHORT).show(); finish(); Intent it=new Intent(MainActivity.this,ThirdActivity.class); it.putExtra("Code", capturedQrValue); startActivity(it); Please help me on the same.
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/35566797
has title: QR scanner android ,displaying Scanned Value In textbox
has comment: http://stackoverflow.com/comment/35566809
has answer: http://stackoverflow.com/a/23245198
has comment: http://stackoverflow.com/comment/35566696
linked to: http://stackoverflow.com/q/2091465
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/35566405
has comment: http://stackoverflow.com/comment/35566930
has comment: http://stackoverflow.com/comment/35567177

http://stackoverflow.com/q/23245979
type: Question
answer count: 2
tagged with: hashmap
has comment: http://stackoverflow.com/comment/35568929
score: 0
has body: Pls help me with this problem. I have Graph represent by Structure HashMap> graf; and i need to go throught that hashmap and set and remove some edges. How can i do that ? code give me this exception Exception in thread "main" java.util.ConcurrentModificationException at java.util.HashMap$HashIterator.nextEntry(Unknown Source) at java.util.HashMap$KeyIterator.next(Unknown Source) public String vratCestu() { String vrat = ""; for(String s: this.graf.keySet()){ if (this.graf.get(s).size() != 0) for(String k : this.graf.get(s)){ this.graf.get(s).remove(k); this.graf.get(k).remove(s); vrat += k + "; "; } } return vrat; }
type: UnansweredQuestion
has title: Exception in thread "main" java.util.ConcurrentModificationException - go through the set and delet
tagged with: multithreading
linked to: http://stackoverflow.com/q/602636
has answer: http://stackoverflow.com/a/23246049
has answer: http://stackoverflow.com/a/23246040
tagged with: java

http://stackoverflow.com/a/23179413
has comment: http://stackoverflow.com/comment/35451035
downvote count: 1
type: Answer
upvote count: 27
accepted answer of: http://stackoverflow.com/q/23178952
answers question: http://stackoverflow.com/q/23178952
has body: Spring is using any design patterns which will avoid checked exceptions ? Not a design pattern but Best Practices for Exception Handling. Consider below code: public void consumeAndForgetAllExceptions(){ try { ...some code that throws exceptions } catch (Exception ex){ ex.printStacktrace(); } } What is wrong with the code above? Once an exception is thrown, normal program execution is suspended and control is transferred to the catch block. The catch block catches the exception and just suppresses it. Execution of the program continues after the catch block, as if nothing had happened. How about the following? public void someMethod() throws Exception{ } This method is a blank one; it does not have any code in it. How can a blank method throw exceptions? Java does not stop you from doing this. I want to know why spring handles only unchecked exceptions? Personally I prefer unchecked exceptions declared in the throws cause. I hate having to catch exceptions when I'm not interested in them. I agree the spec needs to a few more exception types, but I disagree that they should be checked. Most frameworks rely on unchecked exceptions, not only Spring framework. Best Practices for Designing the API If the client can take some alternate action to recover from the exception, make it a checked exception. If the client cannot do anything useful, then make the exception unchecked. By useful, I mean taking steps to recover from the exception and not just logging the exception. The Java API has many unchecked exceptions, such as NullPointerException, IllegalArgumentException, and IllegalStateException. I prefer working with standard exceptions provided in Java rather than creating my own. They make my code easy to understand and avoid increasing the memory footprint of code. See Also: Unchecked Exceptions Best practices in exception handling
has comment: http://stackoverflow.com/comment/35460800
score: 26
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/104566449

http://stackoverflow.com/comment/35601789
has text: Updated the question with sample program.
comment on: http://stackoverflow.com/q/23264097
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23237717
upvote count: 2
has comment: http://stackoverflow.com/comment/35554178
has comment: http://stackoverflow.com/comment/35554103
type: Answer
has body: this.name refers the instance name object and name refers the local name object. It should be - public User(String name,int age){ this.name=name; this.age=age; } name=this.name; here local reference is assigned instance reference which assigned null as default so it is getting null.
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/35554259
answers question: http://stackoverflow.com/q/23237665

http://stackoverflow.com/comment/35532673
score: 0
comment on: http://stackoverflow.com/q/23224616
type: Comment
type: QuestionComment
has text: @user1344545 When you obtain a blob, can you read it straight from/to a ByteBuffer or is it a Stream? i.e. how can you access the data with a minimum of copies. ;)

http://stackoverflow.com/comment/35434365
comment on: http://stackoverflow.com/q/23167297
type: QuestionComment
type: Comment
has text: I taken that Xpath by Using Firebug,I also tryed by takeing link also
score: 0

http://stackoverflow.com/comment/35476786
comment on: http://stackoverflow.com/q/23194397
score: 0
has text: when you click on navigation drawer that is overlapping action bar tabs ...?is my guess correct?
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23295290
type: Answer
has body: Input file XYZ London Method call: Tagvalue = getvalue(databuffer,"Name"); Method public String getvalue(String buffer, String tagname) { String startTag, endTag,elementdata = null; int startposition,endposition; try { startTag = "<"+ tagname + ">"; endTag = "</"+ tagname + ">"; startposition = buffer.indexOf(startTag); startposition = startposition + startTag.length(); endposition = buffer.indexOf(endTag); elementdata = buffer.substring(startposition, endposition); } return elementdata; }
answers question: http://stackoverflow.com/q/23273484
accepted answer of: http://stackoverflow.com/q/23273484
score: 0
type: AcceptedAnswer

google-oauth
type: Tag
tags question: http://stackoverflow.com/q/23190797
tag name: google-oauth

http://stackoverflow.com/comment/35481727
has text: One thing is quite clear; if you rollback, your changes won't be visible in the database! If you want your inserts to be visible you have to commit!
type: Comment
score: 0
comment on: http://stackoverflow.com/a/23197244
type: AnswerComment

http://stackoverflow.com/a/23202590
upvote count: 2
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/23201235
has comment: http://stackoverflow.com/comment/35495227
answers question: http://stackoverflow.com/q/23201235
has comment: http://stackoverflow.com/comment/35494383
has body: I believe the 1.2 is a typo.. I'm not aware of box2D lights have a version 1.2 as of yet, unless it's coming and they pre-emptively had it put in ahead of schedule to be called instead of v1.1. For my eclipse build, I was able to compile it after changing all references of 1.2 to 1.1, and my gradle built just fine. The setup worked even though I got those errors when using the gdx ui provided for the gradle build. (at the very bottom of your gradle file, I noticed in the :core area, you still have a reference to boxlights 1.2, which you should change to 1.1)
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/23135071
has comment: http://stackoverflow.com/comment/35371890
has comment: http://stackoverflow.com/comment/37286178
upvote count: 2
type: UnansweredQuestion
score: 2
tagged with: java
type: Question
tagged with: gridbaglayout
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/35371978
favorite count: 0
has title: Multiple GridBagConstraints?
has answer: http://stackoverflow.com/a/23135340
has body: I'm a bit confused, is it possible to have multiple GridBagConstraints? I have two panels using GridBagLayout, both affected by the same constraints. This gives me an issue when it comes to putting smaller components next to larger ones as illustrated below. The size of the panel on the left, means the cell on that row is very large, centering the panel on the right and it's components. I've tried using separate constraints for each panel but I haven't seen any differences, I think I'm doing something wrong. How can I achieve two panels positioned next to each other, however have the components of each influenced by separate constraints? Here's what I currently have: Created with: // layout GridBagConstraints c = new GridBagConstraints(); // components JPanel supplier = new JPanel(new GridBagLayout()); // grab the suppliers Suppliers.Supplier[] suppliers = new Suppliers.Supplier[Suppliers.supplier.size()]; for (int i = 0; i &lt; Suppliers.supplier.size(); i++) { suppliers[i] = Suppliers.supplier.get(i); } JPanel resultsPanel = new JPanel(); JScrollPane scrollpane = new JScrollPane(resultsPanel, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); scrollpane.setPreferredSize(new Dimension(120, 300)); // style properties c.gridx = 0; c.gridy = 0; c.insets = new Insets(10, 10, 10, 10); supplier.add(scrollpane, c); int position = 0; for (int i = 0; i &lt; Suppliers.supplier.size(); i++) { b_supplierSuppliers.add(new JButton(suppliers[i].getName())); b_supplierSuppliers.get(i).setActionCommand(suppliers[i].getId()); b_supplierSuppliers.get(i).addActionListener(this); // style properties c.gridx = 0; c.gridy = position; c.insets = new Insets(10, 10, 10, 10); c.gridwidth = 1; resultsPanel.add(b_supplierSuppliers.get(i), c); position++; } JPanel resultsPaneltwo = new JPanel(new GridBagLayout()); // style properties c.gridx = 1; c.gridy = 0; supplier.add(resultsPaneltwo, c); // code label l_supplierCode = new JLabel("Supplier Code"); // style prope…

http://stackoverflow.com/q/23198220
has comment: http://stackoverflow.com/comment/35485701
has comment: http://stackoverflow.com/comment/35485789
tagged with: executorservice
has body: I have some incoming concurrent requests that should be processed in serial. I have attempted to achieve this by converting the requests to messages and post to a jms queue. Then Use an mdb to process the queue. Using vendor specific config, I understand I can limit mdb to one instance, but what is the recommended and portable way to solve this problem? Edit: forgot to mention I don't really need the features of jms (reliability etc).
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35485067
tagged with: java-ee-7
has comment: http://stackoverflow.com/comment/35485581
type: Question
has comment: http://stackoverflow.com/comment/35484952
has comment: http://stackoverflow.com/comment/35486196
tagged with: java
has comment: http://stackoverflow.com/comment/35484643
has title: serial execution in Java-ee
has comment: http://stackoverflow.com/comment/35484533
has comment: http://stackoverflow.com/comment/35484752
score: 0
answer count: 1
tagged with: jms
has answer: http://stackoverflow.com/a/23199444

http://stackoverflow.com/q/23211118
type: UnansweredQuestion
tagged with: encryption
tagged with: php
has answer: http://stackoverflow.com/a/23211340
has answer: http://stackoverflow.com/a/35131289
score: 1
tagged with: java
upvote count: 1
type: Question
has title: How to increase the mcrypt-generic-init key size from 8 to 16?
answer count: 2
has body: When I run the encryption, I got an error: Warning: mcrypt_generic_init() [function.mcrypt-generic-init]: Key size too large; supplied length: 16, max: 8 My Code: $size = mcrypt_get_block_size('des', 'ecb'); $input = pkcs5_pad($input, $size); $key = '*5hS7e6$23N#2m7s'; $td = mcrypt_module_open('des', '', 'ecb', ''); $iv = mcrypt_create_iv (mcrypt_enc_get_iv_size($td), MCRYPT_RAND); mcrypt_generic_init($td, $key, $iv); $data = mcrypt_generic($td, $input); mcrypt_generic_deinit($td); mcrypt_module_close($td); $data = base64_encode($data); return $data; I am trying to write an encryption &amp; decryption in between Java(code provided by Java developer) &amp; PHP. But Java only support 16 characters. Thanks.
downvote count: 0
favorite count: 0

http://stackoverflow.com/q/23144625
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/23144758
type: Question
has title: BubbleSort on Custom LinkedList
has body: I am trying to sort the 'Data'. The Data is suppose to be sorted by numbers. I am trying to implement BubbleSort(), but unable to process the same. public void bubbleSort() { if (isEmpty()) { System.out.println("The Empty List Is Already Sorted"); } else if (first.next == null) { System.out.println("One Element List Is Already Sorted"); } else { Node current = first; boolean swapDone = true; while (swapDone) { swapDone = false; while (current != null) { if (current.next != null &amp;&amp; current.value.getScore() &gt; current.next.value.getScore()) { Data temp = current.value; current.value.setScore(current.next.value.getScore()); current.value.setName(current.next.value.getName()); current.next.value.setScore(temp.getScore()); current.next.value.setName(temp.getName()); } current = current.next; } current = first; } }
tagged with: customization
has answer: http://stackoverflow.com/a/23144838
tagged with: bubble-sort
has answer: http://stackoverflow.com/a/23148863
answer count: 3
has comment: http://stackoverflow.com/comment/35389631
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35389586
tagged with: linked-list

http://stackoverflow.com/q/23238742
tagged with: java
has title: Get Fields in Java class by Getter Method with annotation
linked to: http://stackoverflow.com/q/1805200
has comment: http://stackoverflow.com/comment/35556077
type: Question
has comment: http://stackoverflow.com/comment/35556164
has answer: http://stackoverflow.com/a/23239782
has answer: http://stackoverflow.com/a/23243137
accepted answer: http://stackoverflow.com/a/23243137
has answer: http://stackoverflow.com/a/23239051
upvote count: 1
has comment: http://stackoverflow.com/comment/35556055
favorite count: 0
possible better answer: http://stackoverflow.com/a/23239396
has body: Here is My Model Class @Entity @Table(name = "user", catalog = "userdb") @JsonIgnoreProperties(ignoreUnknown = true) public class User implements java.io.Serializable { private Integer userId; private String userName; private String emailId; private String encryptedPwd; private String createdBy; private String updatedBy; @Id @GeneratedValue(strategy = IDENTITY) @Column(name = "UserId", unique = true, nullable = false) public Integer getUserId() { return this.userId; } public void setUserId(Integer userId) { this.userId = userId; } @Column(name = "UserName", length = 100) public String getUserName() { return this.userName; } public void setUserName(String userName) { this.userName = userName; } @Column(name = "EmailId", nullable = false, length = 45) public String getEmailId() { return this.emailId; } public void setEmailId(String emailId) { this.emailId = emailId; } @Column(name = "EncryptedPwd", length = 100) public String getEncryptedPwd() { return this.encryptedPwd; } public void setEncryptedPwd(String encryptedPwd) { this.encryptedPwd = encryptedPwd; } public void setCreatedBy(String createdBy) { this.createdBy = createdBy; } @Column(name = "UpdatedBy", length = 100) public String getUpdatedBy() { return this.updatedBy; } public void setUpdatedBy(String updatedBy) { this.updatedBy = updatedBy; } } I want to get the field names of the class by passing the Column names annotated in getter methods. Suppose I have two String values. List&lt;String&gt; columnNames = new ArraList&lt;String&gt;(); columnNames.add("UserName"); columnNames.add("EmailId"); //If you see those Strings are there in getter methods annotated with Column name. I want to get the fields userName and emailId by using that List. The result can be either in String array or List Class clazz = User.class; for(Method method : clazz.getDeclaredMethods()){ //What to do here }
has comment: http://stackoverflow.com/comment/35556453
answer count: 4
type: AnsweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/23239396
score: 1

http://stackoverflow.com/q/23175275
has body: I'm trying to make a simple widget for the first time using some online tutorials and some decompiled code I found online. But I'm having trouble with this method below. I get error Unreachable code. private void Update(Context paramContext, AppWidgetManager paramAppWidgetManager, int[] paramArrayOfInt) { RemoteViews localRemoteViews = new RemoteViews(paramContext.getPackageName(), R.xml.widget); WifiManager localWifiManager = (WifiManager)paramContext.getSystemService("wifi"); try { int i = localWifiManager.getWifiState(); if (i == 3) { localRemoteViews.setImageViewResource(R.xml.widget, R.drawable.off); link(localRemoteViews, paramContext, paramAppWidgetManager); if ((paramArrayOfInt == null) || (paramArrayOfInt.length &lt;= 0)) break; paramAppWidgetManager.updateAppWidget(paramArrayOfInt, localRemoteViews); } while (true) { return; if (i == 1) { localRemoteViews.setImageViewResource(R.xml.widget, R.drawable.on); break; } localRemoteViews.setImageViewResource(R.xml.widget, R.drawable.off); break; paramAppWidgetManager.updateAppWidget(this.THIS_WIDGET, localRemoteViews); } } catch (Exception localException) { break; } } This is the whole class: package com.wifiswitch.bestwifiswitch; import android.app.PendingIntent; import android.appwidget.AppWidgetManager; import android.appwidget.AppWidgetProvider; import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.net.wifi.WifiManager; import android.os.Bundle; import android.widget.RemoteViews; public class WifiWidget extends AppWidgetProvider { static final String THIS_INTENT = "com.wifiswitch.bestwifiswitch.toggle"; final ComponentName THIS_WIDGET = new ComponentName("com.wifiswitch.bestwifiswitch", "com.wifiswitch.bestwifiswitch.WifiWidget"); private void Toggle(Context paramContext, String paramString) { if ("com.wifiswitch.bestwifiswitch.toggle".equals(paramString)) { WifiManager localWifiManager = (WifiManager)paramContext.getSystemService("wifi"); try { in…
upvote count: 0
has title: WiFi on-off widget...Unreachable code
answer count: 1
favorite count: 0
type: UnansweredQuestion
tagged with: android
score: -1
tagged with: widget
tagged with: java
has answer: http://stackoverflow.com/a/23175541
downvote count: 1
type: Question

http://stackoverflow.com/comment/35405871
comment on: http://stackoverflow.com/a/23154485
has text: How can I iterate the 2D Array
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/23245977
answer count: 1
has body: GAE Images Service promises very high performance and a huge code semplification, however I'd like to know some additional details about before using it: is the url obtained by getServingUrl persistent? i.e. a static reference to the blobkey representing the image in the blobstore? if it is, then it is better to create it once when a new image is uploaded so as to eventually store also the reverse association blobkey->url right? When I need to delete an image: If I remove the blob from the blobkey then the image will be anyway visible from the urlfor max. 24h right? If I remove only the url reference using the deleteServingURL method how does the imagesservice behave? same way as before? And what if I delete both? Does this service have any additional cost? Is it really efficient and responsive as it says to be?
type: UnansweredQuestion
tagged with: google-app-engine
has answer: http://stackoverflow.com/a/23246497
has title: Google apps engine - some questions about ImageService url serving
tagged with: java
type: Question
tagged with: image
score: 0

http://stackoverflow.com/a/56809436
downvote count: 0
upvote count: 2
type: Answer
score: 2
has body: I ran into this issue as well on MacOS while remote debugging Selenium test code on port 5005. The problem turned out to be caused by a leftover surefire-forked-JVM that remained running. Log output to the Eclipse IDE terminal did not show the underlying issue which was Address already in use. The log message was only shown when I ran the same command in a MacOS terminal that Eclipse was actually trying to run: /bin/sh -c cd /path/to/your/project/directory &amp;&amp; /Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home/jre/bin/java -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005 -jar /path/to/target/surefire/surefirebooter230340673926465933.jar /path/to/target/surefire 2019-06-28T10-50-02_140-jvmRun1 surefire6455775580414993159tmp surefire_02461993428448591420tmp Killing the rogue JVM instance (look for a java process name in Activity Monitor) fixed the issue. By the way I am running the surefire plugin version 2.21.0 with no issues with open jdk 8 (v1.8.0_212). Note that all paths will be specific to your build environment and possibly the port (address=5005).
answers question: http://stackoverflow.com/q/23260057

getpixel
type: Tag
tag name: getpixel
tags question: http://stackoverflow.com/q/23133670

http://stackoverflow.com/q/23258788
has title: Android - NullPointerException with Fragment and Spinner
tagged with: android-fragments
score: 1
tagged with: java
tagged with: webview
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/35592474
has answer: http://stackoverflow.com/a/23259097
has comment: http://stackoverflow.com/comment/35592563
answer count: 2
possible better answer: http://stackoverflow.com/a/23259722
has answer: http://stackoverflow.com/a/23259722
tagged with: spinner
favorite count: 0
upvote count: 2
has body: My fragment needs to create a spinner to control what gets displayed in the webview. There is also a progress bar that shows the loading from the spinner selection. Everything works well in a standard activity but moving it to a fragment is proving problematic. I will post the fragment and error. Thanks! the error occurs at this line: spLoadFrom.setAdapter(spinnerArrayAdapter); Here is the code: package com.example.fragmenttest.app; import android.app.Activity; import android.net.Uri; import android.os.Bundle; import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.webkit.WebChromeClient; import android.webkit.WebView; import android.webkit.WebViewClient; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.EditText; import android.widget.LinearLayout; import android.widget.ProgressBar; import android.widget.Spinner; public class BlankFragment extends Fragment { // TODO: Rename parameter arguments, choose names that match // the fragment initialization parameters, e.g. ARG_ITEM_NUMBER private static final String ARG_PARAM1 = "param1"; private static final String ARG_PARAM2 = "param2"; public static final int DIALOG_DOWNLOAD_PROGRESS = 0; ProgressBar pd = null; public static final String PREFS_NAME2 = "SearchFile"; Spinner spLoadFrom; WebView wv; private LinearLayout container; private Button nextButton, closeButton; private EditText findBox; private ArrayAdapter<CharSequence> spinnerArrayAdapter; String name[] = { "mystuff" }; String displayName[] = { "mystuff" }; // TODO: Rename and change types of parameters private String mParam1; private String mParam2; private OnFragmentInteractionListener mListener; /** * Use this factory method to create a new instance of * this fragment using the provided parameters. * * @param param1 Parameter 1. * @param param2 Parameter 2. * @return A new instance of fragment Bla…
tagged with: android
accepted answer: http://stackoverflow.com/a/23259097
type: AnsweredQuestion

http://stackoverflow.com/a/23218518
has comment: http://stackoverflow.com/comment/35520845
score: 1
answers question: http://stackoverflow.com/q/23218292
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35521062
has comment: http://stackoverflow.com/comment/35519564
has body: Like this: TOKEN : { &lt; LETTER : (["A"-"Z", "a"-"z"])&gt; } Reference: A character list describes a set of characters. A legal match for a character list is any character in this set. A character list is a list of character descriptors separated by commas within square brackets. Each character descriptor describes a single character or a range of characters (see character descriptor below), and this is added to the set of characters of the character list. If the character list is prefixed by the "~" symbol, the set of characters it represents is any UNICODE character not in the specified set. Note that the rule: TOKEN : { &lt; LETTER : (["A"-"Z", "a"-"z"])&gt; } is equivalent to: TOKEN : { &lt; LETTER : ["A"-"Z", "a"-"z"]&gt; } which both match a single letter. If you want to repeat the class, you do need the parentheses and append a + quantifier: TOKEN : { &lt; LETTERS : (["A"-"Z", "a"-"z"])+ &gt; }
has comment: http://stackoverflow.com/comment/35520168
type: Answer
has comment: http://stackoverflow.com/comment/35520546
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23218292

http://stackoverflow.com/a/23285102
has comment: http://stackoverflow.com/comment/35641753
has comment: http://stackoverflow.com/comment/35641824
answers question: http://stackoverflow.com/q/23284722
score: 0
has body: Minor mistake you added a new line each time you append to the textArea.. that why its not comparing due to the extra new line if you have new line in you file no problem the arrayList has it already when you parse the file so no need to add new line. solution: public class TextArea1{ JTextArea text; JFrame frame; JTextField textField; public int k; public String correctAnswer; public static void main (String [] args) { TextArea1 gui = new TextArea1(); gui.go(); } private String textLine; public void go() { frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JPanel panel = new JPanel(); textField = new JTextField(""); //textField.addActionListener(new startTextFieldListener("correct answer")); JButton startButton = new JButton ("Start!"); startButton.addActionListener(new startButtonListener()); text = new JTextArea (30, 60); text.setLineWrap(true); JScrollPane scroller = new JScrollPane(text); scroller.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); scroller.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); panel.add(scroller); frame.getContentPane().add(BorderLayout.CENTER, panel); frame.getContentPane().add(BorderLayout.WEST, startButton); frame.getContentPane().add(BorderLayout.SOUTH, textField); frame.setSize(350, 300); frame.setVisible(true); } class startButtonListener implements ActionListener { ArrayList aList; startButtonListener() { } public void actionPerformed(ActionEvent event) { String fileName = "test.txt"; String line; String string = ""; try { try (BufferedReader input = new BufferedReader (new FileReader(fileName))) { if (!input.ready()) { throw new IOException(); } while ((line = input.readLine()) !=null) { string += line; //aList.add(line); } System.out.println("List ready to check. values in list are :"+aList); } } catch (IOException e) { System.out.println(e); } if (string.equals(textField.getText())) { JOptionPane.showMessageDialog(null, "Hooray!"); } else { JOptio…
has comment: http://stackoverflow.com/comment/35641701
has comment: http://stackoverflow.com/comment/35641794
type: Answer
has comment: http://stackoverflow.com/comment/35641879
has comment: http://stackoverflow.com/comment/35642553

date
tags question: http://stackoverflow.com/q/23169761
tags question: http://stackoverflow.com/q/23194353
tags question: http://stackoverflow.com/q/23154746
tag name: date
tags question: http://stackoverflow.com/q/23219564
tags question: http://stackoverflow.com/q/23283996
tags question: http://stackoverflow.com/q/23221332
tags question: http://stackoverflow.com/q/23208018
tags question: http://stackoverflow.com/q/23218025
tags question: http://stackoverflow.com/q/23256639
tags question: http://stackoverflow.com/q/23184947
tags question: http://stackoverflow.com/q/23132145
type: Tag
tags question: http://stackoverflow.com/q/23251250
tags question: http://stackoverflow.com/q/23130340
tags question: http://stackoverflow.com/q/23222659
tags question: http://stackoverflow.com/q/23195335
tags question: http://stackoverflow.com/q/23187355
tags question: http://stackoverflow.com/q/23254168

http://stackoverflow.com/q/23249632
has comment: http://stackoverflow.com/comment/35575277
type: Question
tagged with: java
score: 0
has title: Error with BSTree insert
answer count: 1
has comment: http://stackoverflow.com/comment/35575237
type: UnansweredQuestion
has body: BSTree Insert Node: import java.util.*; import java.io.*; public class BSTree { private Node root; private int size; public BSTree(){root = null; size = 0;} public Node root(){return root;} public boolean isEmpty(){return root == null;} public int size(){return size;} public void insert(String s){ root = new Node (s, root, null, null); size++; } private void insert(String s,Node node){ if (root.setLeft() &lt; 0 || root.hasLeft() &gt; 0) // Currrently I have error on this line of code root = new Node (s, root, node, node); else { Node cursor = root; Node next = cursor.getRight(); while (next != null &amp;&amp; next.compareTo(s) &lt;= 0 ) { // I also having error on the next.compareTo(s). cursor = next; next = next.getRight(); } cursor.setRight(new Node(s, next, next, next)); } size++; } Can anyone help me solve the error? I'm new to BSTree, hence I'm not sure where went wrong. However my Node class is fine. Thanks :)
has answer: http://stackoverflow.com/a/23249759
tagged with: binary-search-tree

http://stackoverflow.com/comment/35627737
score: 1
comment on: http://stackoverflow.com/q/23277583
has text: You can use GraphicsEnvironment, see these [answers](http://stackoverflow.com/questions/4627553/java-show-jframe-in-a-specific-screen-in-dual-monitor-configuration). 74 comes from the "free area" without a 26 pixel toolbar 1000 - 74 - 26 = 900.
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/35686241
has text: Now InvocationHandler run server-side.. but RMI is angry: `java.rmi.UnmarshalException: error unmarshalling return; nested exception is: java.io.WriteAbortedException: writing aborted; java.io.NotSerializableException: package.SecurityInvocationHandler at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source) at java.rmi.Naming.lookup(Naming.java:84) at login_web.GetRemoteInterface.getAInterface(GetRemoteInterface.java:36)... `
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23262091
type: QuestionComment

http://stackoverflow.com/a/23130977
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35364283
has body: tl;dr A Date has no timezone associated with it, so you cannot create a method that adjusts the timezone of a date object. You need to work with Calendar objects if you want to retain TZ information or, preferably, take a look at Joda-Time. Explanation of Your Output A Date value has no timezone information; it's merely the number of milliseconds since the epoch. With that in mind, let's see what you're doing: SimpleDateFormat sdf = new SimpleDateFormat(); sdf.setTimeZone(timeZone); sdf.applyPattern("dd-MM-yyyy HH:mm:ss"); String newDate = sdf.format(date); This part of your code creates a formatter that will print the date in the London timezone. So the result you'll get at the time of writing is approximately: 17-04-2014 11:38:15 (assuming you just created your date object). sdf.setTimeZone(TimeZone.getTimeZone("UTC")); try { Date nd = sdf.parse(newDate); return nd; } catch (ParseException e) { return null; } Here you tell the date parser to read the date as though it were a UTC date. It uses that information to know how many milliseconds since the epoch have passed. The date object you get back still has no timezone associated with it. UTC is an hour behind British Summer Time, so it will create a date object that appears an hour ahead when printed in the BST timezone. So when I print nd, I get: Thu Apr 17 12:38:15 BST 2014.
type: Answer
accepted answer of: http://stackoverflow.com/q/23130340
downvote count: 0
answers question: http://stackoverflow.com/q/23130340
has comment: http://stackoverflow.com/comment/35369568
has comment: http://stackoverflow.com/comment/35369341
has comment: http://stackoverflow.com/comment/35364385
score: 1

http://stackoverflow.com/comment/35679866
type: Comment
type: QuestionComment
score: 0
has text: it's generally not possible (or very much toolkit dependent). X11 protocol is low level and know nothing about intended behavior / api of any widget.
comment on: http://stackoverflow.com/q/23280056

http://stackoverflow.com/comment/35381545
type: AnswerComment
has text: @user3440136 sure, you can iterate through the objects outputting their fields or methods. But I would need to see what is the structure of objects (Student) to figure out how to output their data.
type: Comment
comment on: http://stackoverflow.com/a/23137481
score: 0

http://stackoverflow.com/comment/35379421
has text: Irrespective of varaible name, when you set back the variable to false, the super.start would call again which will try to start the thread which is already completed. which is wrong
comment on: http://stackoverflow.com/a/23138764
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/35502129
score: 0
type: AnswerComment
has text: I made my DefaultTableModel object tblModel as global and tried to do whta you suggested but now i get NullPointerException. tblModel.setRowCount(0);
type: Comment
comment on: http://stackoverflow.com/a/23203016

http://stackoverflow.com/a/23212039
has body: this is my suggestion: create an event using an interface in Fragment 1 implement the interface by the Activity add the unImplemented method of the interface. on onAttach() method of the fragment register the listener of the activity. when the user press your button send an event to the activity via the method of the interface. call a public method of Fragment 2 from the activity that passes a parameter with your info. this is Fragement1: package com.example.tester; import android.app.Activity; import android.app.Fragment; public class Fragment1 extends Fragment { private OnRadioButtonChecked radioBtnListent; @Override public void onAttach(Activity activity) { // TODO Auto-generated method stub radioBtnListent=(OnRadioButtonChecked)activity;//this is the registration super.onAttach(activity); } public interface OnRadioButtonChecked { public String radioBtnChecked(String yourInfo); } } this is Fragment 2 : package com.example.tester; import android.app.Fragment; public class Fragment2 extends Fragment { public void reciveTextFromActivity(String info) { //set your TextView here } } this is the Activity that hosts the two Fragments: package com.example.tester; import android.app.Activity; import android.app.Fragment; import android.os.Bundle; public class HostActivity extends Activity implements Fragment1.OnRadioButtonChecked { Fragment2 fragment2; @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); fragment2=new Fragment2(); } @Override public String radioBtnChecked(String yourInfo) { // TODO Auto-generated method stub fragment2.reciveTextFromActivity(yourInfo); return null; } }
type: Answer
score: 0
answers question: http://stackoverflow.com/q/23211252

http://stackoverflow.com/q/23267889
type: AnsweredQuestion
score: 1
tagged with: java
type: Question
upvote count: 2
has answer: http://stackoverflow.com/a/23268077
has body: I am using the ExecutorService to create a Thread Pool. After adding all tasks, the threadPool is shutdown. Now the Java Doc for Future.get() says Waits if necessary for the computation to complete, and then retrieves its result. I am not able to understand the "if necessary" part. When does the future.get() method wait and how much time will it wait? If it waits till the thread execution is over, is there a need threadPool.awaitTermination? ExecutorService threadPool = Executors.newFixedThreadPool(numberOfThreads); List&lt;Future&lt;?&gt;&gt; futureObjList = new ArrayList&lt;Future&lt;?&gt;&gt;(); for (int i = 0; i &lt; numberOfThreads; i++) { ... Future&lt;?&gt; future = threadPool.submit(myThread); futureObjList.add(future); ... } threadPool.shutdown(); for(Future&lt;?&gt; future : futureObjList){ try { future.get(); } catch (Exception e1) { //if any thread fails, all other thread should stop their execution. threadPool.shutdownNow(); } } try { threadPool.awaitTermination(Long.MAX_VALUE, TimeUnit.MILLISECONDS); } catch (InterruptedException e1) { throw e1; }
answer count: 3
favorite count: 0
has answer: http://stackoverflow.com/a/23268377
accepted answer: http://stackoverflow.com/a/23268377
has title: Do i need to use threadPool.awaitTermination after future.get();
tagged with: multithreading
has answer: http://stackoverflow.com/a/23268152
downvote count: 1
possible better answer: http://stackoverflow.com/a/23268077

ondraw
type: Tag
tags question: http://stackoverflow.com/q/23280685
tag name: ondraw

http://stackoverflow.com/comment/35502078
has text: @JeroenVannevel How exactly should I go about doing that?
comment on: http://stackoverflow.com/q/23208416
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35525582
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23221838
score: 0
has text: this is my full code `$curdir = getcwd(); chdir('./Programs'); echo getcwd(); $result=shell_exec('cmd.exe /b /c runfile.bat'); echo $result; chdir($curdir);`

http://stackoverflow.com/comment/120025212
type: AnswerComment
has text: Could ypu please edit your answer to reflect that Step 1 outputs chain.cer whether Step 2 searches for chain.pem. Probably, all certs in Step 1 should be in pem format, otherwise there is an error "unable to load certificates" during Step 2 (here is the explanation: https://robertwray.co.uk/blog/unable-to-load-certificates-when-using-openssl-to-generate-a-pfx)
type: Comment
score: 0
comment on: http://stackoverflow.com/a/41676117

http://stackoverflow.com/a/26290698
type: Answer
answers question: http://stackoverflow.com/q/23172704
score: 0
has body: // Set the variables int numPowersOf2; //How many powers of 2 to compute int nextPowerOf2 = 1; //Current power of 2 int exponent = 0; /* User input here */ // Loop and print results do { System.out.println ("2^" + exponent + " = " + nextPowerOf2); nextPowerOf2 = nextPowerOf2*2; exponent ++; } while (exponent &lt; numPowersOf2);

http://stackoverflow.com/comment/35465713
comment on: http://stackoverflow.com/q/23182573
type: Comment
type: QuestionComment
has text: Add a `MouseAdapter` and call `getSelectedIndex` from inside `mouseEntered`.
score: 0

http://stackoverflow.com/comment/35398048
type: Comment
has text: It does not matter. the list is empty because the output is `[]`. `ArrayList` recursively invoke `toString()` of its elements, the only way to get an `someArrayList.toString()` to print `[]` is if `someArrayList` is empty.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/23149672

http://stackoverflow.com/comment/35531408
score: 2
comment on: http://stackoverflow.com/q/23224948
type: Comment
has text: `When I try to display my JTable I have no problems.` - I don't believe that because the table header is not displayed if you don't add the table to the scrollpane and then add the scrollpane to the frame. The only add(...) statement in your code should be something like `panel.add(scrollPane)`. You should NOT add the table to a panel.
type: QuestionComment

http://stackoverflow.com/comment/35548433
comment on: http://stackoverflow.com/q/23231441
score: 0
type: Comment
type: QuestionComment
has text: Well what should the "Server name" be when I try use the .udl file on the host machine? "CEDAVILLE-CS-VM"? "192.168.56.1/CEDAVILLE-CS-VM"?

http://stackoverflow.com/comment/35644411
type: AnswerComment
score: 0
type: Comment
has text: "@raghunandan" i highly thank you for your help and your concern,you are the real teacher, i solve the problem,it was silly thing.i wish to remove the question because it was bad asked and miss informed.it was really copy paste problem.my bad.thanks again.
comment on: http://stackoverflow.com/a/23266305

http://stackoverflow.com/a/23289938
has body: Use String#replace() instead of String#replaceAll(). The later one uses regex pattern for replacement, where * is a meta-character, and needs to be escaped.
answers question: http://stackoverflow.com/q/23289902
score: 5
upvote count: 6
downvote count: 1
type: Answer

http://stackoverflow.com/comment/35562837
comment on: http://stackoverflow.com/q/23242548
has text: Your equals method should really check before doing the cast. You are putting it in a set<Object> so it's pure luck that you don't get a class cast exception...
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23268145
type: Question
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/35609597
has answer: http://stackoverflow.com/a/23268446
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35609355
tagged with: java
has title: cannot find symbol: variable TestUtils
has body: I have written a Java program that analyze .soft file of data on gene expressions and write it to txt package il.ac.tau.cs.sw1.bioinformatics; import org.apache.commons.math3.stat.inference.TestUtils; import java.io.*; import java.util.Arrays; /** * * Gene Expression Analyzer * * Command line arguments: * args[0] - GeoDatasetName: Gene expression dataset name (expects a corresponding input file in SOFT format to exist in the local directory). * args[1] - Label1: Label of the first sample subset * args[2] - Label2: Label of the second sample subset * args[3] - Alpha: T-test confidence level : only genes with pValue below this threshold will be printed to output file * * Execution example: GeneExpressionAnalyzer GDS4085 "estrogen receptor-negative" "estrogen receptor-positive" 0.01 * * @author software1-2014 * */ public class GeneExpressionAnalyzer { public static void main(String args[]) throws IOException { // Reads the dataset from a SOFT input file String inputSoftFileName = args[0] + ".soft"; GeneExpressionDataset geneExpressionDataset = parseGeneExpressionFile (inputSoftFileName); System.out.printf ("Gene expression dataset loaded from file %s. %n",inputSoftFileName); System.out.printf("Dataset contains %d samples and %d gene probes.%n%n",geneExpressionDataset.samplesNumber, geneExpressionDataset.genesNumber); // Writes the dataset to a tabular format String tabularFileName = args[0] + "-Tabular.txt"; writeDatasetToTabularFile(geneExpressionDataset,tabularFileName); System.out.printf ("Dataset saved to tabular file - %s.%n%n",tabularFileName); // Identifies differentially expressed genes between two sample groups and writes the results to a text file String label1 = args[1]; String label2 = args[2]; double alpha = Double.parseDouble(args[3]); String diffGenesFileName = args[0] + "-DiffGenes.txt"; int numOfDiffGenes = writeTopDifferentiallyExpressedGenesToFile(diffGenesFileName,geneExpressionDataset, alpha, label1, label2); System.out.printf ("%d differentially e…
has answer: http://stackoverflow.com/a/23269306

http://stackoverflow.com/comment/35486130
type: QuestionComment
comment on: http://stackoverflow.com/q/23198492
score: 0
has text: @Dov Thomas the exact compile error i am getting is literally "incompatible types". i have explained my troubleshooting steps in the question as well and jeroen i don't understand what you mean as something you can execute because there's really no way i am posting all my classes up on here where they all aggregate with each other.
type: Comment

http://stackoverflow.com/a/23134957
has body: Logic error: You were using the same iterator in both arrays, while retrieving the value from s[], you should be using the for loop iterator, kk. public static void main(String...a) { String s[]={"a","b","c","-","g","t","-","q","-","a","s","d","-","a","b","y"}; String[] sdf=new String[100]; int sop = 0; for(int kk=0;kk&lt;s.length;kk++) { if(!s[kk].equals("-")) { sdf[sop]=s[kk]; sop++; } } }
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23134812

http://stackoverflow.com/comment/35565954
type: Comment
comment on: http://stackoverflow.com/a/23243696
has text: i have tried the second link, when i try this line in the code bw.write(bp); it cause me an error tells (error: no suitable method found for write(BodyPart) bw.write(bp);) .. sorry but i'm new for java how i can solve it ?
type: AnswerComment
score: 0

http://stackoverflow.com/comment/35614870
type: Comment
has text: Are you asking about [dialog boxes](http://docs.oracle.com/javase/tutorial/uiswing/components/dialog.html)?
score: 0
comment on: http://stackoverflow.com/q/23271171
type: QuestionComment

http://stackoverflow.com/a/23179956
downvote count: 0
type: Answer
has body: Unix (Linux, MacOS): cd &lt;path&gt;/Crawler java -cp out/production/Crawler:lib/jsoup-1.7.3.jar App.App Windows: cd &lt;path&gt;\Crawler java -cp "out\production\Crawler;lib\jsoup-1.7.3.jar" App.App
upvote count: 1
accepted answer of: http://stackoverflow.com/q/23179761
score: 1
answers question: http://stackoverflow.com/q/23179761
type: AcceptedAnswer

http://stackoverflow.com/a/23181845
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/23153250
answers question: http://stackoverflow.com/q/23153250
has body: Table name is case sensitive. Use proper case for it
score: 0

http://stackoverflow.com/comment/105041552
score: 4
type: Comment
comment on: http://stackoverflow.com/a/23214299
has text: Please note the answer to the linked duplicate includes an alternative solution using Guava: `Map<String, String> byNameMap = Maps.transformValues(people, Person::getName);` "which wraps the original Map and does the conversion when you do the get, meaning you only pay the conversion cost when you actually consume the value. "
type: AnswerComment

http://stackoverflow.com/comment/35400919
score: 2
has text: You can use tokens.Generate a token for each user when he logs.Along with each request send this token.If the token matches with your db entry allow him to post a comment.
comment on: http://stackoverflow.com/q/23151467
type: Comment
type: QuestionComment

web-services
tags question: http://stackoverflow.com/q/23254168
tags question: http://stackoverflow.com/q/23198394
type: Tag
tags question: http://stackoverflow.com/q/23267483
tags question: http://stackoverflow.com/q/23194057
tags question: http://stackoverflow.com/q/23283704
tags question: http://stackoverflow.com/q/23143005
tags question: http://stackoverflow.com/q/23135039
tags question: http://stackoverflow.com/q/23196624
tags question: http://stackoverflow.com/q/23156123
tags question: http://stackoverflow.com/q/23178892
tags question: http://stackoverflow.com/q/23265755
tags question: http://stackoverflow.com/q/23219707
tags question: http://stackoverflow.com/q/23172937
tags question: http://stackoverflow.com/q/23133665
tags question: http://stackoverflow.com/q/23196220
tags question: http://stackoverflow.com/q/23144597
tags question: http://stackoverflow.com/q/23259687
tags question: http://stackoverflow.com/q/23160121
tags question: http://stackoverflow.com/q/23192842
tags question: http://stackoverflow.com/q/23229936
tags question: http://stackoverflow.com/q/23257203
tags question: http://stackoverflow.com/q/23267068
tags question: http://stackoverflow.com/q/23218063
tags question: http://stackoverflow.com/q/23190565
tags question: http://stackoverflow.com/q/23159909
tags question: http://stackoverflow.com/q/23256193
tags question: http://stackoverflow.com/q/23151445
tags question: http://stackoverflow.com/q/23257782
tags question: http://stackoverflow.com/q/23233282
tags question: http://stackoverflow.com/q/23242360
tags question: http://stackoverflow.com/q/23213911
tags question: http://stackoverflow.com/q/23244571
tags question: http://stackoverflow.com/q/23193355
tags question: http://stackoverflow.com/q/23280339
tags question: http://stackoverflow.com/q/23185609
tags question: http://stackoverflow.com/q/23270803
tags question: http://stackoverflow.com/q/23168402
tags question: http://stackoverflow.com/q/23241121
tags question: http://stackoverflow.com/q/23175860
tags question: http://stackoverflow.com/q/23263735
tags question: http://stackoverflow.com/q/23162194
tags question: http://stackoverflow.com/q/23279574
tags question: http://stackoverflow.com/q/23163578
tags question: http://stackoverflow.com/q/23273298
tags question: http://stackoverflow.com/q/23289062
tags question: http://stackoverflow.com/q/23151679
tags question: http://stackoverflow.com/q/23227127
tags question: http://stackoverflow.com/q/23241815
tags question: http://stackoverflow.com/q/23186279
tags question: http://stackoverflow.com/q/23197896
tags question: http://stackoverflow.com/q/23190998
tags question: http://stackoverflow.com/q/23289826
tags question: http://stackoverflow.com/q/23149800
tags question: http://stackoverflow.com/q/23195835
tags question: http://stackoverflow.com/q/23200096
tag name: web-services
tags question: http://stackoverflow.com/q/23129893
tags question: http://stackoverflow.com/q/23250163
tags question: http://stackoverflow.com/q/23148928
tags question: http://stackoverflow.com/q/23257697
tags question: http://stackoverflow.com/q/23238841
tags question: http://stackoverflow.com/q/23290391
tags question: http://stackoverflow.com/q/23242963
tags question: http://stackoverflow.com/q/23233052
tags question: http://stackoverflow.com/q/23272905
tags question: http://stackoverflow.com/q/23212857
tags question: http://stackoverflow.com/q/23205260
tags question: http://stackoverflow.com/q/23236315

http://stackoverflow.com/comment/35619636
comment on: http://stackoverflow.com/a/23273286
type: Comment
has text: servlet 1: www.example.servlet1 servlet 2: www.example.servlet2 .servlet 1 has to send as a response a form to the browser. This form contains userName. When it sends it to the browser, the clients modifies this userName and by clicking the send button, the new value is sent back to servlet 1. Now, servlet1 sends this modified userName to servlet 2 who also modifies it and sends back to servlet 1. My question is: Is there a way I can establish a continuous connection between the two servlets and how will I know that servlet2 has finished modifying the file so that servlet1 can get it again?
type: AnswerComment
score: 0

http://stackoverflow.com/comment/35631308
has text: The problem is I am passing an object through 5 functions and want to assign the values using hibernate. When I do obj = getObj(), it loses it's pass by reference and the changes are not reflected back to the main function. I am trying to do a temp = getObj() and try and copy values from temp to obj. I don't think your example would work, as I will be back at square one if I use obj = deepCopy (temp)
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23279522

http://stackoverflow.com/q/23130395
has title: How do I close this file writer? (Java, Bukkit)
tagged with: bukkit
type: Question
possible better answer: http://stackoverflow.com/a/23145606
has answer: http://stackoverflow.com/a/23145606
has body: try { FileWriter fw = new FileWriter("plugins/TestMessage/messages.txt", true); } catch (IOException e) { e.printStackTrace();} } Hey guys, I know this may sound noobish but how do I close this FileWriter. The code is in java. I have an onDisable() method that gets called when the server is stopped but when I put fw.close(); It says fw cannot be resolved. Please help! The relevant section of the code is public class MAIN extends JavaPlugin{{ try { FileWriter fw = new FileWriter("plugins/TestMessage/messages.txt", true); } catch (IOException e) { e.printStackTrace();} } public void onEnable(){ Logger.getLogger("Minecraft").info("MessageBroadcaster made by cheeseballs500 aka weakwizardsucks2"); } public void onDisable(){ fw.close();//fw cannot be resolved } EDIT: Fixed :D
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/23130443
accepted answer: http://stackoverflow.com/a/23130443
tagged with: plugins
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/q/23172484
answer count: 3
tagged with: android
tagged with: jdbc
has comment: http://stackoverflow.com/comment/35438623
has comment: http://stackoverflow.com/comment/35438249
type: AnsweredQuestion
type: Question
has answer: http://stackoverflow.com/a/23196297
tagged with: java
tagged with: mysql
has title: Android MySql : JDBC CommunicationsException
possible better answer: http://stackoverflow.com/a/23172534
accepted answer: http://stackoverflow.com/a/23196297
has answer: http://stackoverflow.com/a/23172534
score: 0
has body: I am using Eclipse and Android Emulator. I can access to 10.0.2.2 in emulator browser. But in my app, this code not run : Connection con = DriverManager.getConnection("jdbc:mysql://10.0.2.2/stu", "user", "pass"); Anybody has some idea? The error is : com.mysql.jdbc.CommunicationsException I am confused that why i have access to phpMyAdmin in emulator's browser, but not inside the code! :( Note that full code is this : public class LearningActivity extends Activity { private static final String url = "jdbc:mysql://10.0.2.2/stu"; private static final String user = "root"; private static final String pass = "11111"; private Button button; private TextView tv; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); button = (Button)this.findViewById(R.id.button1); tv = (TextView)this.findViewById(R.id.textView1); button.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { // Perform action on click Connect(); } }); } private class Connect extends AsyncTask&lt;String, Void, String&gt; { @Override protected String doInBackground(String... urls) { String response = ""; try { Class.forName("com.mysql.jdbc.Driver"); Connection con = DriverManager.getConnection(url, user, pass); // System.out.println("Database connection success"); String result = "Database connection success\n"; Statement st = con.createStatement(); ResultSet rs = st.executeQuery("select * from users"); ResultSetMetaData rsmd = rs.getMetaData(); while(rs.next()) { result += rsmd.getColumnName(1) + ": " + rs.getInt(1) + "\n"; result += rsmd.getColumnName(2) + ": " + rs.getString(2) + "\n"; result += rsmd.getColumnName(3) + ": " + rs.getString(3) + "\n"; } tv.setText(result); } catch(Exception e) { e.printStackTrace(); tv.setText(e.toString()); } return response; } @Override protected void onPostExecute(String result) { tv.setText(result); } } public void Connect() { Connect task = new Connect(); task.execute(); …
has answer: http://stackoverflow.com/a/23172614
has comment: http://stackoverflow.com/comment/35438596
has comment: http://stackoverflow.com/comment/35438543

http://stackoverflow.com/q/23175680
has comment: http://stackoverflow.com/comment/35443933
accepted answer: http://stackoverflow.com/a/23175702
type: Question
has body: I'm new to Java and I was trying to do the following on eclipse: import javax.swing.*; public class Hello_World { public class HelloWorld extends JFrame { public static void main(String[] args) { JFrame frame = new HelloWorld(); frame.setSize( 300, 200 ); frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE ); frame.setTitle( "Hello world" ); frame.setVisible( true ); } } } I have no idea what I doing wrong here. The compiler gives me following error: Main method not found in class Hello_World, please define the main method as: public static void main(String[] args) or a JavaFX application class must extend javafx.application.Application Can someone tell me what I'm doing wrong?
answer count: 2
upvote count: 0
has comment: http://stackoverflow.com/comment/35443953
has title: Getting error in Java, Have no idea what I'm doing wrong
favorite count: 0
score: -1
has comment: http://stackoverflow.com/comment/35443908
has answer: http://stackoverflow.com/a/23175702
has comment: http://stackoverflow.com/comment/35443948
tagged with: swing
has answer: http://stackoverflow.com/a/37188309
downvote count: 1
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35443936
tagged with: java
possible better answer: http://stackoverflow.com/a/37188309

http://stackoverflow.com/q/23242197
score: 16
downvote count: 0
has answer: http://stackoverflow.com/a/57798699
tagged with: java
tagged with: unirest
has answer: http://stackoverflow.com/a/35242912
type: Question
has answer: http://stackoverflow.com/a/23243982
upvote count: 16
has title: how to make Unirest(java) ignore certificate error
favorite count: 0
has answer: http://stackoverflow.com/a/37064306
linked to: http://stackoverflow.com/q/19517538
has body: I am using Unirest (java version) to make GET and POST request.But I encounter a problem when accessing SSL encrypted site , since my program is behind a corporate network and the network admin setup a firewall mapping for me. For example foobar.com is mapped to 56.1.89.12:4444. But when I make request to the address, I will received the following ssl certificate error: com.mashape.unirest.http.exceptions.UnirestException: javax.net.ssl.SSLException: hostname in certificate didn't match: &lt;56.1.89.12&gt; != &lt;www.foobar.com&gt; at com.mashape.unirest.http.HttpClientHelper.request(HttpClientHelper.java:131) at com.mashape.unirest.request.BaseRequest.asString(BaseRequest.java:52) I see Unirest has advance configuration to use custom httpclient.So I use Unirest.setHttpClient(MyHttpClient.makeClient()); HttpResponse&lt;String&gt; res = null; try { res = Unirest.get(urlstr).asString(); } catch (UnirestException e) { e.printStackTrace(); } String jsonstr = res.getBody(); the makeClient method of MyHttpClient is: public static HttpClient makeClient(){ SSLContextBuilder builder = new SSLContextBuilder(); CloseableHttpClient httpclient = null; try { // builder.loadTrustMaterial(null, new TrustSelfSignedStrategy()); builder.loadTrustMaterial(null, new TrustStrategy(){ public boolean isTrusted(X509Certificate[] chain, String authType) throws CertificateException { return true; } }); SSLConnectionSocketFactory sslsf = new SSLConnectionSocketFactory( builder.build()); httpclient = HttpClients.custom().setSSLSocketFactory( sslsf).build(); System.out.println("custom httpclient called"); System.out.println(httpclient); } catch (NoSuchAlgorithmException e) { e.printStackTrace(); } catch (KeyStoreException e) { e.printStackTrace(); } catch (KeyManagementException e) { e.printStackTrace(); } return httpclient; } the main idea is taken from Ignoring SSL certificate in Apache HttpClient 4.3 But still this didn't work.Any suggestions?
tagged with: apache-httpclient-4.x
answer count: 5
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/35485145

http://stackoverflow.com/a/23251173
type: Answer
accepted answer of: http://stackoverflow.com/q/23251103
score: 0
has body: Integer.toString(int); There is a class representing each primitive type. They contain tools. If you must grab them as Strings and convert to int: Switch your scanner from nextInt() to next(), and use Integer.parseInt(string);
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23251103

http://stackoverflow.com/q/23160365
has title: classpath error in java
has comment: http://stackoverflow.com/comment/35416903
score: 0
has answer: http://stackoverflow.com/a/23167099
tagged with: java
has comment: http://stackoverflow.com/comment/35416999
answer count: 3
tagged with: classpath
has comment: http://stackoverflow.com/comment/35417101
has answer: http://stackoverflow.com/a/23160710
has body: I have written a java program where I am using a .jar library (Jinterface). I compile it using: javac -classpath lib/OtpErlang.jar Game.java Actions.java where the lib dir is inside my project folder. There is no error when compiling but I get a runtime error like this: Exception in thread "main" java.lang.NoClassDefFoundError: com/ericsson/otp/erlang/OtpErlangObject at Game.main(Game.java:7) Caused by: java.lang.ClassNotFoundException: com.ericsson.otp.erlang.OtpErlangObject 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) ... 1 more And I think that it has to do with the classpath, what is wrong? Here is the Game class: import java.io.IOException; public class Game { public static void main(String[] args) throws IOException { Actions server = new Actions(); server.moveRight(); } }
accepted answer: http://stackoverflow.com/a/23167099
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23160577
has comment: http://stackoverflow.com/comment/35416837
possible better answer: http://stackoverflow.com/a/23160577
type: Question

http://stackoverflow.com/a/23278471
type: Answer
has comment: http://stackoverflow.com/comment/35632150
upvote count: 1
downvote count: 1
answers question: http://stackoverflow.com/q/23277807
score: 0
has body: I do not think that there is a default media type that has the character encoding you want. Although an alternative to a filter could be to introduce a constant that contains your desired mimetype + character encoding. So something as simple as: private static final String APPLICATION_JSON_UTF8 = MediaType.APPLICATION_JSON + ";charset=UTF-8"; The only reason for this is so that the "application/json;charset=UTF-8" isn't polluting your code as plain text (imagine refactoring if you need to change the character encoding with the 'magic string' everywhere :) )

http://stackoverflow.com/comment/35549844
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23234955
has text: Autowiring it appears to help the controller see it, but it is unable to "marshall" spewing a MarshalException.

http://stackoverflow.com/comment/138068185
type: QuestionComment
has text: Do you know what the exception is when you print "Problem found when classifying the text"?
comment on: http://stackoverflow.com/q/23275600
score: 0
type: Comment

http://stackoverflow.com/q/23280409
answer count: 2
linked to: http://stackoverflow.com/q/9523917
has title: Java: Convert MST to EST
has comment: http://stackoverflow.com/comment/35632852
has body: I've been trying to convert the time since epoch until today and display it in Eastern Standard Time. Here is what outputs on the remote machine (it's remotely hosted): Date now = new Date(System.currentTimeMillis()); System.out.println(now.toString()); // Thu Apr 24 14:36:11 MST 2014 No idea what MST is, but I want to get the current milliseconds since epoch in EST, and display the result in EST. No matter what I do, I can't get daylights savings to work (it's currently Daylights Savings Time in the EST Time Zone); I either end up in PST, GMT or UTC, and when I do get "EST" it's either some random value or 1 hour behind or 3 hours behind. I would like the output to be formatted using this DateFormat: DateFormat EXPIRE_FORMAT = new SimpleDateFormat("MMM dd, yyyy h:mm a z");
has comment: http://stackoverflow.com/comment/35633134
tagged with: date-format
has comment: http://stackoverflow.com/comment/35633529
tagged with: datetime
has comment: http://stackoverflow.com/comment/35632922
has comment: http://stackoverflow.com/comment/35633271
favorite count: 0
has comment: http://stackoverflow.com/comment/35633583
score: 2
has comment: http://stackoverflow.com/comment/35633472
downvote count: 0
tagged with: timezone
has comment: http://stackoverflow.com/comment/35633100
has answer: http://stackoverflow.com/a/23280550
accepted answer: http://stackoverflow.com/a/23280550
possible better answer: http://stackoverflow.com/a/23281509
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35632903
tagged with: java
has comment: http://stackoverflow.com/comment/35632862
type: Question
has answer: http://stackoverflow.com/a/23281509
upvote count: 2

http://stackoverflow.com/q/23225731
has comment: http://stackoverflow.com/comment/35532933
has body: I already checked around if my issue has been solved but I can't find it out. I want to do a drawer menu, using DrawerItemClickListener. I'm using API 19 to Android 4.4.2 Here's my import : import android.app.Activity; import android.app.Fragment; import android.content.Intent; import android.os.Bundle; import android.support.v4.app.ActionBarDrawerToggle; import android.support.v4.view.GravityCompat; import android.support.v4.widget.DrawerLayout; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.EditText; import android.widget.ListView; import android.widget.RelativeLayout; import android.widget.TextView; import android.app.SearchManager; import android.content.res.Configuration; import android.view.MenuInflater; import android.widget.AdapterView; import android.widget.Toast; It's kinda weird because I downloaded a sample from android developers website which work well with Drawer. At first I thougth I didn't have the good library but I replaced mine with my sample, nothing change! I don't know how to solve that problem... public class MainActivity extends Activity { final String TEST = "user_password"; private DrawerLayout mDrawerLayout; private ListView mDrawerList; private ActionBarDrawerToggle mDrawerToggle; private CharSequence mDrawerTitle; private CharSequence mTitle; private String[] mPlanetTitles; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); RelativeLayout layout = (RelativeLayout) RelativeLayout.inflate(this, R.layout.fragment_main, null); setContentView(layout); TextView text = (TextView) layout.findViewById(R.id.textView1); text.setText("Calculez votre IMC !"); Button b = (Button) layout.findViewById(R.id.button1); final TextView text2 = (TextView) layout.findViewById(R.id.textView2); final EditText poids = (EditText)…
has comment: http://stackoverflow.com/comment/35532967
has title: DrawerItemClickListener cannot be resolved to a type - Android app
has comment: http://stackoverflow.com/comment/35532846
favorite count: 0
downvote count: 0
has comment: http://stackoverflow.com/comment/35532804
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/35533060
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/35532661
has comment: http://stackoverflow.com/comment/35532900
tagged with: eclipse
has comment: http://stackoverflow.com/comment/35532885
type: Question
has answer: http://stackoverflow.com/a/26036718
linked to: http://stackoverflow.com/q/20088247
has comment: http://stackoverflow.com/comment/35532629
answer count: 1
has comment: http://stackoverflow.com/comment/35532769
has comment: http://stackoverflow.com/comment/35532944
has comment: http://stackoverflow.com/comment/35532864
has comment: http://stackoverflow.com/comment/35532767
upvote count: 1

http://stackoverflow.com/comment/35404831
type: AnswerComment
has text: Policy -> Wrap all elements, every element on new line
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23153843

http://stackoverflow.com/q/23145276
tagged with: colors
type: UnansweredQuestion
tagged with: swing
has title: Can't paint objects from an instantiated class in another class
has comment: http://stackoverflow.com/comment/35390877
downvote count: 1
has comment: http://stackoverflow.com/comment/35390841
tagged with: java
score: -1
type: Question
has answer: http://stackoverflow.com/a/23145370
upvote count: 0
answer count: 1
has body: I can't paint my rectangle and circle in a class. The class that this forms have been created is instantiated in my main class, but I can't paint there, only in their own classes. I'm not good with words. Just look at code. Class Game: @Override public void paint(Graphics g) { super.paint(g); Graphics2D graficos = (Graphics2D) g; /* switch (corAtualR) { case PRETO: { graficos.setColor(Color.black); graficos.fillRect((int) mb.x, (int) mb.y, 60, 60); break; } case VERMELHO: { graficos.setColor(Color.red); graficos.fillRect((int) mb.x, (int) mb.y, 60, 60); break; } case AZUL: { graficos.setColor(Color.blue); graficos.fillRect((int) mb.x, (int) mb.y, 60, 60); break; } case AMARELO: { graficos.setColor(Color.yellow); graficos.fillRect((int) mb.x, (int) mb.y, 60, 60); break; } case VERDE: { graficos.setColor(Color.green); graficos.fillRect((int) mb.x, (int) mb.y, 60, 60); break; } default: { graficos.setColor(Color.black); graficos.fillRect(0, 0, 0, 0); break; } } */ mb.paint(graficos); graficos.dispose(); } } The commented-out code is the code that I couldn't paint from my instantiated class. And here is my MenuBar class: // Ações do Retângulo public void acoesRetangulo() { // Action Listeners dos botões para pintar o retângulo da respectiva cor. pretoR.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { corAtualR = PRETO; } }); } } @Override public void paint(Graphics g) { switch (corAtualR) { case PRETO: { g.setColor(Color.black); g.fillRect((int) x, (int) y, 60, 60); break; } case VERMELHO: { g.setColor(Color.red); g.fillRect((int) x, (int) y, 60, 60); break; } case AZUL: { g.setColor(Color.blue); g.fillRect((int) x, (int) y, 60, 60); break; } case AMARELO: { g.setColor(Color.yellow); g.fillRect((int) x, (int) y, 60, 60); break; } case VERDE: { g.setColor(Color.green); g.fillRect((int) x, (int) y, 60, 60); break; } default: { g.setColor(Color.black); g.fillRect(0, 0, 0, 0); break; } } g.dispose(); } } See that the same code,…
has comment: http://stackoverflow.com/comment/35390888
favorite count: 0
has comment: http://stackoverflow.com/comment/35390614

http://stackoverflow.com/comment/35395017
has text: I figured my DDMS is empty, when I right click on it, it gives me close, what should I add? Or where?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23147551
score: 0

http://stackoverflow.com/q/23138636
has body: Here is my array ArrayList cars = new ArrayList(); cars.add(new vehicles ("CAR","Peugot","3008",12500.00)); cars.add(new vehicles ("CAR","BMW","316",4995.00)); cars.add(new vehicles ("CAR","Ford","Fiesta",2995.00)); and i want a way to put these in order from cheapest first but i dont want to use a compare method. Maybe create a temporary variable and check this variable with the values and overwrite the values if theyre cheaper. Ive tried this public static void main(String[] args){ ArrayList carsArray = new ArrayList(); carsArray.add(new vehicles ("CAR","Peugot","3008",12500.00)); carsArray.add(new vehicles ("CAR","BMW","316",4995.00)); carsArray.add(new vehicles ("CAR","Ford","Fiesta",2995.00)); vehicles lowestPrice = (vehicles) carsArray.get(0); for(vehicles car : carsArray){ if(car.Cost&lt;lowestPrice.Cost){ lowestPrice = car; } } } Yet i still get a mistake :/The 'carsArray' in the forloop is underlined in red
has comment: http://stackoverflow.com/comment/35378424
has title: How to get the lowest value in an ArrayList without using 'comparable'
has comment: http://stackoverflow.com/comment/35378458
answer count: 4
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/23138761
has answer: http://stackoverflow.com/a/23138761
has answer: http://stackoverflow.com/a/23138906
has comment: http://stackoverflow.com/comment/35378476
tagged with: java
has comment: http://stackoverflow.com/comment/35378626
has comment: http://stackoverflow.com/comment/35378406
type: Question
has comment: http://stackoverflow.com/comment/35378358
has answer: http://stackoverflow.com/a/23138734
tagged with: sorting
has comment: http://stackoverflow.com/comment/35378429
tagged with: arraylist
accepted answer: http://stackoverflow.com/a/23138734
score: 0
has answer: http://stackoverflow.com/a/23138749

jakarta-ee
tags question: http://stackoverflow.com/q/23153104
tags question: http://stackoverflow.com/q/23254197
tags question: http://stackoverflow.com/q/23219951
tags question: http://stackoverflow.com/q/23237705
type: Tag
tags question: http://stackoverflow.com/q/23158933
tags question: http://stackoverflow.com/q/23149484
tags question: http://stackoverflow.com/q/23220430
tags question: http://stackoverflow.com/q/23265594
tags question: http://stackoverflow.com/q/23185348
tags question: http://stackoverflow.com/q/23189106
tags question: http://stackoverflow.com/q/23183101
tags question: http://stackoverflow.com/q/23191100
tags question: http://stackoverflow.com/q/23206942
tags question: http://stackoverflow.com/q/23242360
tags question: http://stackoverflow.com/q/23213911
tags question: http://stackoverflow.com/q/23148121
tags question: http://stackoverflow.com/q/23162053
tags question: http://stackoverflow.com/q/23244894
tags question: http://stackoverflow.com/q/23154704
tag name: jakarta-ee
tags question: http://stackoverflow.com/q/23178915
tags question: http://stackoverflow.com/q/23138851
tags question: http://stackoverflow.com/q/23177655
tags question: http://stackoverflow.com/q/23231602
tags question: http://stackoverflow.com/q/23212410
tags question: http://stackoverflow.com/q/23133095
tags question: http://stackoverflow.com/q/23139327
tags question: http://stackoverflow.com/q/23238161
tags question: http://stackoverflow.com/q/23138662
tags question: http://stackoverflow.com/q/23246405
tags question: http://stackoverflow.com/q/23147310
tags question: http://stackoverflow.com/q/23147220
tags question: http://stackoverflow.com/q/23154020
tags question: http://stackoverflow.com/q/23233282
tags question: http://stackoverflow.com/q/23285977
tags question: http://stackoverflow.com/q/23192931
tags question: http://stackoverflow.com/q/23213670
tags question: http://stackoverflow.com/q/23131173
tags question: http://stackoverflow.com/q/23254133
tags question: http://stackoverflow.com/q/23132141
tags question: http://stackoverflow.com/q/23260313
tags question: http://stackoverflow.com/q/23129994
tags question: http://stackoverflow.com/q/23211625
tags question: http://stackoverflow.com/q/23160949
tags question: http://stackoverflow.com/q/23188115
tags question: http://stackoverflow.com/q/23227712
tags question: http://stackoverflow.com/q/23271060
tags question: http://stackoverflow.com/q/23172793
tags question: http://stackoverflow.com/q/23232522
tags question: http://stackoverflow.com/q/23191385
tags question: http://stackoverflow.com/q/23252551
tags question: http://stackoverflow.com/q/23201031
tags question: http://stackoverflow.com/q/23263691
tags question: http://stackoverflow.com/q/23262569
tags question: http://stackoverflow.com/q/23197884
tags question: http://stackoverflow.com/q/23217739
tags question: http://stackoverflow.com/q/23174582
tags question: http://stackoverflow.com/q/23150138
tags question: http://stackoverflow.com/q/23178892
tags question: http://stackoverflow.com/q/23185047
tags question: http://stackoverflow.com/q/23229160

http://stackoverflow.com/q/23158399
type: UnansweredQuestion
has body: I have a reader class with the a sql property. String sql; The class containts a setter method for this string. public void setSql (String sql) {...bunch of code...} My configuration file looks like this. &lt;bean id="carryOverReader" class=...&gt; &lt;property name="sql" value="OVERRIDDEN" /&gt; &lt;/bean&gt; My question is how does Spring set sql to the value "OVERRIDEN". Does it implicitly call the setter method? Or does it accomplish this another way? I'm asking this because the setter for sql contains more code, and I'm wondering if that is going to be executed by the property wiring?
tagged with: spring
type: Question
tagged with: java
score: 0
has answer: http://stackoverflow.com/a/23162056
has title: Spring Batch property configuration
answer count: 1

http://stackoverflow.com/q/23206965
downvote count: 0
has comment: http://stackoverflow.com/comment/35499520
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35499633
has body: I'm a new programmer, I have a problem with this code. public static String getString() throws IOException { String content = null; File folder = new File("C:\\Soluzioni.txt"); content = FileUtils.readFileToString(folder) + "\n"; String remainingString = content.substring(content.indexOf("["), content.lastIndexOf("]") + 1); System.out.println(remainingString); // Output 1. return remainingString; } When I use this method public static String[] arg() throws IOException { String[] strArray = getString().split("\\s+,0"); System.out.println(Arrays.toString(strArray)); //Output 2. return strArray; } My Problem is this: First output: [-2,-8] [8,-4] [-3,2] [4,-1] Second output: [[-2,-8] [8,-4] [-3,2] [4,-1]]. Now I would like to have the same output (identical). How can I do it? Thank you!
has comment: http://stackoverflow.com/comment/35499553
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/35499476
upvote count: 2
tagged with: split
answer count: 3
has comment: http://stackoverflow.com/comment/35499566
has answer: http://stackoverflow.com/a/23207205
favorite count: 0
has answer: http://stackoverflow.com/a/23207042
has answer: http://stackoverflow.com/a/23207321
has comment: http://stackoverflow.com/comment/35499501
has title: Particular Split Java
score: 2
has comment: http://stackoverflow.com/comment/35499562

http://stackoverflow.com/a/23237453
score: 1
downvote count: 0
has body: You might try generics: private &lt;T&gt; List&lt;Animals&gt; createAnimalsInstance(Class&lt;T&gt; cls) { T typeCastedObject = (T) getObjectBySomeCalculation(); } Then you can simply use this method as usual: List&lt;Animals&gt; animals = createAnimalsInstance(Dog.class); FYI: If you want to do instanceof you can use Class.isAssignableFrom: if (obj instanceOf AClass) is equivalent with if (AClass.isAssignableFrom(obj.getClass()))
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/35560249
answers question: http://stackoverflow.com/q/23237423

http://stackoverflow.com/q/23226372
tagged with: raspberry-pi
tagged with: jersey
downvote count: 0
has title: Raspberry Pi and Tomcat -> pi4j unsatisfied link error
has body: I am using a Raspberry Pi (type B) that runs a java web application on Tomcat7. I am using the "Jersey" java framework in collaboration with Pi4J, to control the GPIO on the Pi.The ultimate purpose is to control a relay switch, but I won't go into that. When I try to access the web service, it throws a tomcat error (shown below): I have used the build tool Maven to create the web application, making it dead easy to import the libraries. Can anybody notice anything I'm doing wrong with my simple code to make the gpio "blink" below? I can confirm my jersey setup is correct because it works when Pi4J isn't involved. Web Service class (ignore the name XMLService for now) @Path("") public class XMLService { GPIORelay gpio = new GPIORelay(); @Path("/blinktest") @GET public String blinkTest(){ try{ gpio.blink(); return "successful"; } catch(Exception e){ return "failed"; } } GPIORelay class public class GPIORelay { GpioController gpio; GpioPinDigitalOutput pin; String currentStatus; public GPIORelay(){ gpio = GpioFactory.getInstance(); pin = gpio.provisionDigitalOutputPin(RaspiPin.GPIO_00, "Pin 17", PinState.LOW); } public void blink(){ try{ pin.high(); Thread.sleep(1000); pin.low(); gpio.unprovisionPin(pin); } catch(InterruptedException e){ System.out.print("Exception "); } } } Doing some initial reading, it could be because I need to install the pi4J libraries on the Raspberry pi itself in addition or maybe I need to configure the java.library.path but I still find it unclear. Any help from somebody that has worked with Pi4J before would be great! Thanks.
favorite count: 0
answer count: 0
upvote count: 2
type: UnansweredQuestion
tagged with: maven
tagged with: tomcat7
score: 2
tagged with: java
type: Question

http://stackoverflow.com/comment/35491356
score: 0
type: QuestionComment
has text: Check this http://stackoverflow.com/a/5841795/2182351
type: Comment
comment on: http://stackoverflow.com/q/23195795

http://stackoverflow.com/q/23263299
has answer: http://stackoverflow.com/a/23263449
tagged with: audio
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35600492
has comment: http://stackoverflow.com/comment/35600363
tagged with: java
has comment: http://stackoverflow.com/comment/35600263
has body: I'm coding this in java and put my sounds folder with the bgmusic.wav in there but it doesn't seem to still identify it. Am I doing something wrong? Here is my Sound class: import java.applet.Applet; import java.applet.AudioClip; import java.io.File; import java.net.MalformedURLException; public class Sound { private AudioClip myClip; public Sound(String fileName) { try { File file = new File(fileName); if (file.exists()) { myClip = (AudioClip) Applet.newAudioClip(file.toURI().toURL()); } else { throw new RuntimeException("Sound: file not found: " + fileName); } } catch (MalformedURLException e) { throw new RuntimeException("Sound: malformed URL: " + e); } } public void play() { myClip.play(); } } This is then ran as an Object in my other class to run the bgmusic.wav: String fileName = "bgmusic.wav"; String soundDir = "." + File.separator + "sounds" + File.separator; String filePath = soundDir + fileName; Sound bgMusic = new Sound(filePath); bgMusic.play(); If I'm not mistaken I think I have everything setup correctly but I get a Sound: file not found: ./sounds/bgmusic.wav which is returned from to throw exception in my Sound class. Since I have the sounds folder as a subdirectory of the main java folder passing ./sounds/bgmusic.wav should be correct right?
accepted answer: http://stackoverflow.com/a/23263449
type: Question
linked to: http://stackoverflow.com/q/23255943
has title: Sound file not found, not in directory?
has comment: http://stackoverflow.com/comment/35600353
linked to: http://stackoverflow.com/q/1464291
possible better answer: http://stackoverflow.com/a/23263406
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/23263406

http://stackoverflow.com/comment/35396674
comment on: http://stackoverflow.com/q/23148859
type: Comment
type: QuestionComment
has text: Is this exactly the project that you've run yesterday?
score: 0

http://stackoverflow.com/comment/35369078
comment on: http://stackoverflow.com/q/23133510
type: QuestionComment
type: Comment
score: 1
has text: And note that the return value from those `sequence(n)` calls is falling on the floor. The calls have no effect whatsoever (other than to cause infinite recursion).

http://stackoverflow.com/comment/35572599
type: AnswerComment
comment on: http://stackoverflow.com/a/23247564
has text: Please check the following example: https://blog.trifork.com/2014/02/28/session-timeout-and-concurrent-session-control-with-spring-security-and-spring-mvc/
type: Comment
score: 0

http://stackoverflow.com/a/23139244
has body: Remember, the ApplicationContext is a container to manage all your beans and their inter-dependencies. It is the entry point to your application. Once you've set it up, all the managed objects are linked up and ready to go. Is there a better way to get to the "HelloWorld" with less code and more annotation in Spring 4? It depends where you want to get it. If you want to get it from outside the ApplicationContext, then you need to do what you did. If you want to get into another bean, just inject it and the ApplicationContext will do the rest. @Component class SomeOtherBean { @Autowired private HelloWorld helloWorldBean; // do something with it }
accepted answer of: http://stackoverflow.com/q/23138773
answers question: http://stackoverflow.com/q/23138773
type: AcceptedAnswer
score: 0
type: Answer

http://stackoverflow.com/a/23234008
upvote count: 0
score: -1
has body: public class HelloWorld{ public static int[][] concatenateArr2d(int[][] t, int[][] s) { int jLength=0; // The below line of code is to determine second dimension size of new array jLength=Math.max(s[0].length, t[0].length); int sIterate=0; //new array created using size of first+second array for First dimension and maximum size for second dimension int[][] xx = new int[t.length + s.length][jLength]; //first array copy for(int i = 0; i &lt; t.length; i++) { for(int j = 0; j &lt; t[0].length; j++) { xx[i][j] =t[i][j]; } } //second array copy for(int i = t.length; i &lt; xx.length; i++) { for(int j = 0; j &lt; s[0].length; j++) { xx[i][j] =s[sIterate][j]; } sIterate++; } return xx; } public static void main(String []args){ int a[][]={{1,2},{2,3},{1,1}}; int b[][]={{1,2,3},{2,3,4}}; int c[][]=HelloWorld.concatenateArr2d(a,b); //Output iteration for(int i = 0; i &lt; c.length; i++) { for(int j = 0; j &lt; c[0].length; j++) { System.out.print(c[i][j]); } System.out.println(); } } } note : The blanks filled by 'primitive type default value' like, for int its 0. Output : 120 230 110 123 234
has comment: http://stackoverflow.com/comment/35548496
answers question: http://stackoverflow.com/q/23233688
has comment: http://stackoverflow.com/comment/35648068
type: Answer
downvote count: 1
has comment: http://stackoverflow.com/comment/35547896

http://stackoverflow.com/comment/35565750
score: 0
has text: `onsubmit="return sendAjax()"`(or add the event handler in the head as prescribed) and in sendAjax add a `return false;` to the end. Also you assign something to a `$('#login')`which does not exist
type: Comment
comment on: http://stackoverflow.com/q/23244397
type: QuestionComment

http://stackoverflow.com/comment/35427424
type: Comment
has text: it's not. In the out look sender email and name is shown. Still it is recognized as "unknown sender".
type: QuestionComment
comment on: http://stackoverflow.com/q/23165990
score: 0

http://stackoverflow.com/comment/35363547
comment on: http://stackoverflow.com/a/23130271
type: Comment
type: AnswerComment
score: 0
has text: That did it! Didnt know response and request are implicitly available! Thanks! :)

http://stackoverflow.com/q/23289566
type: Question
upvote count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/35649882
has comment: http://stackoverflow.com/comment/35649871
has comment: http://stackoverflow.com/comment/35650486
answer count: 1
has body: I have xml file to java to configure i can't load this that files in beans javas main.java: ApplicationContext appContext = new ClassPathXmlApplicationContext("applicationContext.xml"); PDF2HTMLService service = appContext.getBean(PDF2HTMLService.class); Error: Exception in thread "main" java.lang.RuntimeException: Uncompilable source code - incompatible types: org.springframework.context.support.ClassPathXmlApplicationContext cannot be converted to org.springframework.context.ApplicationContext at pdf2html.Main.main(Main.java:27) Java Result: 1 how can i solve this problems... XML FILE: &lt;beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:beans="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context" xmlns:aop="http://www.springframework.org/schema/aop" 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/aop http://www.springframework.org/schema/aop/spring-aop.xsd"&gt; &lt;aop:aspectj-autoproxy /&gt; &lt;context:component-scan base-package="pdf2html" /&gt; &lt;/beans&gt;
has comment: http://stackoverflow.com/comment/35649790
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35650186
tagged with: spring
has answer: http://stackoverflow.com/a/23289801
score: 2
tagged with: java
has comment: http://stackoverflow.com/comment/35649779
has comment: http://stackoverflow.com/comment/35650120
has title: How to load xml to ClassPathXmlApplicationContext in java without errors?

http://stackoverflow.com/comment/35563514
type: Comment
score: 0
comment on: http://stackoverflow.com/a/23228395
type: AnswerComment
has text: How would you change the line(s) which leads the fail?

http://stackoverflow.com/q/23181735
type: AnsweredQuestion
has body: In many of the projects I have worked on we often have a lot of classes that map content from one domain model to another. For example from a WSDL generated model to a project specific one. for example public class FooBarContentMapper { public static Foo fromWsToDomain(FooType fooType) { ... } } this can also be a non-static method and the service layer can have a mapper object field instead of calling the static method: public class FooBarContentMapper { public Foo fromWsToDomain(FooType fooType) { ... } } I find both ways used a lot, but: is one of the solutions more efficient in any way? are any of the solutions considered best practice?
downvote count: 0
favorite count: 0
has title: Should domain model mappers be static?
type: Question
score: 21
has answer: http://stackoverflow.com/a/23181876
answer count: 2
upvote count: 21
has answer: http://stackoverflow.com/a/36076850
tagged with: java
accepted answer: http://stackoverflow.com/a/23181876
has comment: http://stackoverflow.com/comment/35454841
possible better answer: http://stackoverflow.com/a/36076850

http://stackoverflow.com/a/23290335
type: Answer
has body: Not sure if this will work for you but try JPanel panel = new JPanel(); panel.setBackground(Color.BLACK); or you could try setting the colour in the JFrame and leaving the colour out of the pannel JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setTitle("MyFirstFrame"); frame.setBackground(Color.BLACK); frame.setLocation(0,0); frame.setSize(150,150);
score: 0
answers question: http://stackoverflow.com/q/23290189

java-8
tags question: http://stackoverflow.com/q/23196257
tags question: http://stackoverflow.com/q/23263490
tags question: http://stackoverflow.com/q/23178148
tags question: http://stackoverflow.com/q/23219006
tags question: http://stackoverflow.com/q/23175805
tags question: http://stackoverflow.com/q/23170405
tags question: http://stackoverflow.com/q/23220043
tags question: http://stackoverflow.com/q/23196461
tags question: http://stackoverflow.com/q/23250248
tags question: http://stackoverflow.com/q/23194428
tags question: http://stackoverflow.com/q/23164562
tags question: http://stackoverflow.com/q/23200646
tags question: http://stackoverflow.com/q/23230604
tags question: http://stackoverflow.com/q/23215299
tags question: http://stackoverflow.com/q/23266866
tags question: http://stackoverflow.com/q/23218874
tags question: http://stackoverflow.com/q/23213891
tags question: http://stackoverflow.com/q/23178106
tags question: http://stackoverflow.com/q/23133243
tags question: http://stackoverflow.com/q/23227057
tags question: http://stackoverflow.com/q/23259318
tags question: http://stackoverflow.com/q/23139725
tags question: http://stackoverflow.com/q/23278267
tags question: http://stackoverflow.com/q/23238631
tags question: http://stackoverflow.com/q/23284421
tags question: http://stackoverflow.com/q/23265112
tags question: http://stackoverflow.com/q/23202516
tags question: http://stackoverflow.com/q/23249790
tags question: http://stackoverflow.com/q/23162738
tags question: http://stackoverflow.com/q/23275519
tags question: http://stackoverflow.com/q/23224826
tags question: http://stackoverflow.com/q/23219162
tags question: http://stackoverflow.com/q/23262560
tags question: http://stackoverflow.com/q/23156499
tags question: http://stackoverflow.com/q/23220542
tag name: java-8
tags question: http://stackoverflow.com/q/23250358
tags question: http://stackoverflow.com/q/23136533
tags question: http://stackoverflow.com/q/23261803
tags question: http://stackoverflow.com/q/23202828
tags question: http://stackoverflow.com/q/23235761
tags question: http://stackoverflow.com/q/23184964
tags question: http://stackoverflow.com/q/23199570
tags question: http://stackoverflow.com/q/23181978
type: Tag
tags question: http://stackoverflow.com/q/23170832
tags question: http://stackoverflow.com/q/23155907
tags question: http://stackoverflow.com/q/23214318
tags question: http://stackoverflow.com/q/23188948
tags question: http://stackoverflow.com/q/23224875

http://stackoverflow.com/comment/108342476
type: AnswerComment
comment on: http://stackoverflow.com/a/61241959
type: Comment
has text: You need to add a simple description when you put up an answer. So users can get a rough idea on what they about to see. And better if you could put comments too.
score: 0

http://stackoverflow.com/comment/35509426
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23212752
has text: Check this out. http://stackoverflow.com/questions/40480/is-java-pass-by-reference
score: 0

http://stackoverflow.com/comment/35660254
has text: You should show some code for better results and explain what you want passed and if the state should be shared and updated. The context is not clear enough to get _correct_ answer.
comment on: http://stackoverflow.com/q/23284922
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23190636
tagged with: element
has answer: http://stackoverflow.com/a/23190664
accepted answer: http://stackoverflow.com/a/23190664
has answer: http://stackoverflow.com/a/23190673
tagged with: zero
upvote count: 1
has title: How to fix first three elements of an array (keep showing up as zero)?
has comment: http://stackoverflow.com/comment/35471068
type: AnsweredQuestion
has body: I'm new to java and this is also my first time asking a question here. I have to write a program using an array that will store input data. I'm trying to prompt for six values between 70 and 90. Right now it only lets me input three numbers and then the other three are zeros, but I can't figure out what to change to fix that. Here's what I have: Scanner scanner = new Scanner(System.in); int[] values = new int[6]; int i; int sum = 0; for (i = 0; i &lt; values.length; i++) { System.out.print("Enter a number between 70 and 90: "); values[i] = scanner.nextInt(); i++; if (i == 6) { break; } sum = sum + values[i]; } double average = (sum / 6); Arrays.sort(values); System.out.println(Arrays.toString(values)); System.out.println("Average is " + average); Arrays.sort(values); int min = values[0]; System.out.println("Minimum is " + min); System.out.println("Its index is " + Arrays.asList(values).indexOf(min)); int max = values[values.length - 1]; System.out.println("Maximum is " + max); System.out.println("The difference between the largest and smallest elements is " + (max - min)); scanner.close();
score: 1
tagged with: java
type: Question
tagged with: int
answer count: 2
possible better answer: http://stackoverflow.com/a/23190673
tagged with: arrays
downvote count: 0
favorite count: 0

http://stackoverflow.com/comment/35633529
score: 2
has text: @PeterLawrey - Also, thanks for mentioning the issue with abbreviations. [Time zone abbreviations](http://en.wikipedia.org/wiki/Time_zone_abbreviations) are highly ambiguous and overlapping - yet some folks seem to think they are unique keys. :)
type: Comment
comment on: http://stackoverflow.com/q/23280409
type: QuestionComment

http://stackoverflow.com/a/23198415
has comment: http://stackoverflow.com/comment/35484105
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23191185
type: Answer
has comment: http://stackoverflow.com/comment/35485792
upvote count: 1
has body: There is no way that I can think of, you would just have to have a variable called count and increment it each and every time. int count = 0; server.accept(); count++;
score: 1
answers question: http://stackoverflow.com/q/23191185
type: AcceptedAnswer

http://stackoverflow.com/q/23269981
downvote count: 0
linked to: http://stackoverflow.com/q/1220751
favorite count: 0
has answer: http://stackoverflow.com/a/23271337
tagged with: rijndael
tagged with: aes
score: 2
has body: I have a php code that encrypts a plain text using rijndael algorithm in the EBC mode, and a 17-charachter key length. I'm looking to use an equivalent AES algorithm with Java This is my php code: &lt;?php $key=" 4288f0b8060ca1b "; $mcryptAlgo= MCRYPT_RIJNDAEL_128 ; $mcryptMode= MCRYPT_MODE_ECB ; $data = "text_to_crypt_with_aes" ; $mcryptedData = mcrypt_encrypt ($mcryptAlgo, $key, $data, $mcryptMode); $parametres_chiffres = urlencode( base64_encode ($mcryptedData)); echo($parametres_chiffres); ?&gt; It returns as a result the encrypted message: 4LepwOstJA0R2bg5FrdQXeoxesxmKV4pkf514F3VDqU%3D However, the following Java code that I've built doesn't return the same message: public static void main(String[] args) { StringBuilder sb = new StringBuilder(); sb.append("text_to_crypt_with_aes"); String clearText = sb.toString(); StringBuilder sbKey = new StringBuilder(" 4288f0b8060ca1b "); for (int i = 0; i &lt; 7; i++) { sbKey.append("\0"); } try { Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding"); Key key = new SecretKeySpec(sbKey.toString().getBytes("UTF-8"), "AES"); cipher.init(Cipher.ENCRYPT_MODE, key); byte[] encryptedMessageInBytes = cipher.doFinal(clearText .getBytes("UTF-8")); byte[] b64 = Base64.encodeBase64(encryptedMessageInBytes); String scrambled_text = new String(b64, Charset.forName("US-ASCII")); System.out.println(scrambled_text); } catch (Exception e) { e.printStackTrace(); } } It returns actually: 4LepwOstJA0R2bg5FrdQXRutIOZlJi06f0D8NnnIG5Q= How can I adapt my Java code to return exactly the same as in php ?
type: UnansweredQuestion
tagged with: encryption
tagged with: php
type: Question
has title: How to adapt rijndael (php) algorithm to aes (java)
tagged with: java
upvote count: 2
has comment: http://stackoverflow.com/comment/35618406
answer count: 1

http://stackoverflow.com/comment/35649405
type: Comment
comment on: http://stackoverflow.com/a/23289608
type: AnswerComment
has text: actually, I'm unsure of whether you want it to be up until the . or th e first end quote or the final end quote.
score: 0

http://stackoverflow.com/comment/35437325
has text: Ok, but how can I put {}
comment on: http://stackoverflow.com/q/23171947
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/comment/35388467
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23143905
score: 0
has text: Edited posted above to include the output you wanted

http://stackoverflow.com/q/23167501
score: 0
answer count: 2
tagged with: sql
has comment: http://stackoverflow.com/comment/35429698
has answer: http://stackoverflow.com/a/23167596
has answer: http://stackoverflow.com/a/23167649
accepted answer: http://stackoverflow.com/a/23167649
has comment: http://stackoverflow.com/comment/35429558
has comment: http://stackoverflow.com/comment/35429613
has body: Why this query is not returning any value. There are values in my database with in that range value input are Date startDate = (Date) data.get("startDate");//2014-04-01 Date endDate = (Date) data.get("endDate");//2014-04-30 int pagesize=10; sql query is String query = "select * from bill_details " + " where status=? " + " AND date(add_date) BETWEEN " + startDate + " AND " + endDate + " order by add_date desc limit " + pagesize; ps = con.prepareStatement(query); ps.setString(1, dataStatus); System.out.println("Before execution"); res = ps.executeQuery();
has title: Why query is not returning value
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/23167596
has comment: http://stackoverflow.com/comment/35429673
has comment: http://stackoverflow.com/comment/35429584
tagged with: java
tagged with: mysql
has comment: http://stackoverflow.com/comment/35429575
has comment: http://stackoverflow.com/comment/35429756
type: Question

http://stackoverflow.com/comment/35454966
has text: @Marichyasana: My eyes don't seem to be as good as they used to be. FYI, obeying the contract is not only matching the signature, but also satisfying what's required in the Javadoc, see e.g. [here](http://hg.openjdk.java.net/jdk8/jdk8/jdk/file/687fd7c7986d/src/share/classes/java/lang/Object.java#l70).
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23175805

http://stackoverflow.com/q/23176968
has comment: http://stackoverflow.com/comment/35446283
downvote count: 2
score: -2
has body: Alright so for my computer science course I have to make two separate arrays, fill them with user input from two separate methods. I'm stuck on actually making the input from my code be stored in my two arrays. I don't even know where to start with it. I've tried searching for examples, but I haven't found anything. I am also rather new to coding. import java.util.Scanner; /** * @author SH * */ public class SearchSort { Scanner console = new Scanner(System.in); public void inputFavoriteMovies(){ System.out.println("Enter 6 of your favorite movies"); int x = 0; while(x&lt;6){ String movies = console.nextLine(); x++; } } public void inputFavoriteMusic(){ System.out.println("Enter 5 of your Favorite Songs"); int y = 0; while(y&lt;5){ String music = console.nextLine(); y++; } } public static void main(String[] args) { new SearchSort().inputFavoriteMovies(); new SearchSort().inputFavoriteMusic(); String[] myFavoriteMovies = new String[6]; String[] myFavoriteMsuic = new String[5]; } }
tagged with: java
has answer: http://stackoverflow.com/a/23177161
has answer: http://stackoverflow.com/a/23177026
type: Question
upvote count: 0
tagged with: arrays
has title: Storing user input (STRING) into Array JAVA
answer count: 2
has comment: http://stackoverflow.com/comment/35446237
favorite count: 0
has comment: http://stackoverflow.com/comment/35446272
type: UnansweredQuestion

http://stackoverflow.com/comment/35565712
comment on: http://stackoverflow.com/q/23205664
has text: there are a lot of client side examples https://github.com/netty/netty/tree/master/example/src/main/java/io/netty/example/http/snoop (look at the client code files)
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/comment/35366573
type: Comment
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/23132400
has text: Please paste the stack trace.

http://stackoverflow.com/comment/35518976
type: AnswerComment
comment on: http://stackoverflow.com/a/23183854
type: Comment
has text: Timeout timer is normal. Look for lines that drop the message, retransmissions or malformed requests.
score: 0

heap-memory
tag name: heap-memory
tags question: http://stackoverflow.com/q/23167965
tags question: http://stackoverflow.com/q/23196381
type: Tag
tags question: http://stackoverflow.com/q/23169240
tags question: http://stackoverflow.com/q/23176974
tags question: http://stackoverflow.com/q/23209866
tags question: http://stackoverflow.com/q/23219853
tags question: http://stackoverflow.com/q/23265157
tags question: http://stackoverflow.com/q/23266786
tags question: http://stackoverflow.com/q/23273569

http://stackoverflow.com/comment/51342515
type: Comment
comment on: http://stackoverflow.com/a/28407333
has text: I am trying to use Google-play-service-lib in my project when I check checkbox from Properties -> Java Build Path ->Order and Export I am getting error "unable to execute dex java heap space java heap space in eclipse"and if I unchecked and added .jar files of google play services libs I am getting an error "java.lang.NoClassDefFoundError:Lcom/google/android/gms/common/GooglePlayServicesUtil;" what to do? please help me I am trying to fix this error last 2 days. Also, change setting of eclipse.ini :( but not luck
score: 0
type: AnswerComment

osx-mavericks
type: Tag
tags question: http://stackoverflow.com/q/23204768
tags question: http://stackoverflow.com/q/23157352
tags question: http://stackoverflow.com/q/23265112
tags question: http://stackoverflow.com/q/23143905
tag name: osx-mavericks

http://stackoverflow.com/comment/35498461
comment on: http://stackoverflow.com/q/23206309
score: 1
has text: @HarryBlargle I'm OK that it's confusing to read, but I hope there's no Java compiler out there that is confused with that ^^
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23198231
tagged with: rest
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23266320
score: 1
favorite count: 0
type: Question
upvote count: 1
tagged with: maven
answer count: 1
accepted answer: http://stackoverflow.com/a/23266320
has title: Null MultiPartConfig when creating GrizzlyHttpServer
tagged with: grizzly
tagged with: java
has body: I´m trying to create a Grizzly HTTP Server from a main method and I am getting this IllegalArgumentException: java.lang.IllegalArgumentException: The MultiPartConfig instance we expected is not present. Have you registered the MultiPartConfigProvider class? I have tried to register manually both a new instance of MultiPartConfigProvider and the class itself (see commented lines). What could I be missing? This is the code: public class ResourceServer { public static final String HOST = "localhost"; public static final int PORT = 8080; public static final String ROOT = "dummy"; public static final URI BASE_URI = ResourceUriBuilder.getBaseURI(HOST, PORT, ROOT); private static final String BASE_PACKAGE_NAME = "com.mycompany.myapp.resource"; public static HttpServer startServer() { final ResourceConfig rc = new ResourceConfig().packages(true, BASE_PACKAGE_NAME); // rc.register(new MultiPartConfig()); // // MultiPartConfigProvider provider = new MultiPartConfigProvider(); // rc.register(provider); // rc.register(MultiPartConfig.class); return GrizzlyHttpServerFactory.createHttpServer(BASE_URI,rc); } public static void main(String[] args) throws IOException { final HttpServer server = startServer(); // ... } } This is the stacktrace: java.lang.IllegalArgumentException: The MultiPartConfig instance we expected is not present. Have you registered the MultiPartConfigProvider class? at com.sun.jersey.multipart.impl.MultiPartReaderClientSide.<init>(MultiPartReaderClientSide.java:102) com.mycompany.myapp.resource.server.ResourceServer.startServer(ResourceServer.java:37) at com.mycompany.myapp.resource.server.ResourceServer.main(ResourceServer.java:47) And these are the relevant dependencies in the POM file: org.glassfish.jersey jersey-bom ${jersey.version} pom import com.google.guava guava 16.0.1 org.apache.httpcomponents httpclient 4.2.6 org.glassfish.jersey.containers jersey-container-grizzly2-http org.glassfish.jersey.media jersey-media-moxy com.sun.jersey.contribs jersey-mul…
downvote count: 0

http://stackoverflow.com/q/23263909
has answer: http://stackoverflow.com/a/23264391
tagged with: jpa
downvote count: 0
answer count: 1
tagged with: jpa-2.0
favorite count: 0
has body: I have a OneToMany mapping as below Parent: @OneToMany(mappedBy = parent, orphanRemoval = true, cascade = { CascadeType.ALL}) private List&lt;Child&gt; childs = new ArrayList&lt;Child&gt;(); Child: @ManyToOne @JoinColumn(name = "parentid") private Parent parent; While updating the Parent entity, I am getting an exception: A collection with cascade="all-delete-orphan" was no longer referenced by the owning entity instance My code: parent.getChild().clear(); parent.setChild(childList)
type: UnansweredQuestion
has title: JPA: Delete children in OneToMany
score: 1
tagged with: java
upvote count: 1
type: Question
tagged with: children

http://stackoverflow.com/comment/35436328
score: 0
comment on: http://stackoverflow.com/a/23171345
type: Comment
has text: moving "@Value" annotated attribute to service class(as it is not created through "new" and annotated "@Service") solved the issue. Thx
type: AnswerComment

http://stackoverflow.com/comment/35580081
type: QuestionComment
comment on: http://stackoverflow.com/q/23240944
score: 0
type: Comment
has text: @mystakonnfewshn Definitely wondering about quirk mentioned in my previous comment then. If somebody else could create a similar test to verify that would support that. For now as a workaround consider not using the same names for those two static methods (it doesn't make a difference anyways, you aren't actually "overriding" the one in B, just hiding A's implementation, so just pick a different name).

http://stackoverflow.com/a/23290704
score: 0
type: Answer
has body: Check out this answer to change background color import javax.swing.JFrame; import java.awt.Color; import java.awt.EventQueue; public class ColoredFrame { public static void main( String[] args ) { EventQueue.invokeLater( new Runnable() { @Override public void run() { JFrame frame = new JFrame( "TestFrame" ); frame.getContentPane().setBackground( Color.PINK ); //frame contains nothing, so set size frame.setSize( 200, 200 ); frame.setVisible( true ); frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE ); } } ); } } Reference of Robin's answer.
answers question: http://stackoverflow.com/q/23290189

http://stackoverflow.com/q/23153916
favorite count: 0
has title: RSyntaxTextArea not showing line numbers
accepted answer: http://stackoverflow.com/a/23156208
type: AnsweredQuestion
type: Question
tagged with: java
has body: I'm using RSyntaxTextArea for a minimized IDE I'm working on, Everything seems to be really working smoothly except for the line numbering, which I couldn't really make it show: RSyntaxTextArea textArea = new RSyntaxTextArea(20, 60); textArea.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_C); textArea.setCodeFoldingEnabled(true); textArea.setAntiAliasingEnabled(true); RTextScrollPane sp = new RTextScrollPane(textArea); sp.setLineNumbersEnabled(true); sp.setFoldIndicatorEnabled(true); if ( sp.getLineNumbersEnabled() ) { System.out.println("Enabled"); // it prints the line but it's not showing } contentPane.add(/*textEditorScrollPane*/ textArea, BorderLayout.CENTER); I can't figure out why it's not showing the line numbers..
has answer: http://stackoverflow.com/a/23156208
possible better answer: http://stackoverflow.com/a/48218052
has answer: http://stackoverflow.com/a/48218052
upvote count: 4
tagged with: rsyntaxtextarea
answer count: 2
downvote count: 0
score: 4

http://stackoverflow.com/comment/35729784
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23289916
has text: i am not able to post .jrxml file.File size is more .please tel me how to post the file
score: 0

http://stackoverflow.com/comment/35926746
has text: *pls-send-me-the-code* questions are not well received by the community, and putting a bounty on it is an even bigger mistake.
comment on: http://stackoverflow.com/q/23289387
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23189526
has comment: http://stackoverflow.com/comment/35468535
tagged with: java
tagged with: indexoutofboundsexception
type: Question
has comment: http://stackoverflow.com/comment/35468540
has comment: http://stackoverflow.com/comment/35468649
has answer: http://stackoverflow.com/a/23189645
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/23189645
has title: Getting a java.lang.indexoutofboundsexception, but no idea why?
type: AnsweredQuestion
has body: List&lt;String&gt; s = getConfig().getStringList("clanowner"); if (!(s.isEmpty())) { for (String str : s) { String[] words = str.split(":"); menu.clanowner.put(words[0], words[1]); } } So, I am getting a java.lang.indexoutofboundsexception, but I have no idea why this is happening. Will somebody please help me?
has comment: http://stackoverflow.com/comment/35468561

http://stackoverflow.com/q/23234062
has body: Here is the library: https://github.com/astuetz/PagerSlidingTabStrip I'm trying to implement it but my app keeps crashing on startup. I've tried to understand the sample app that is posted but don't think I'm doing something right. Here is my code: MainActivity.java import android.graphics.Color; import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.Drawable; import android.graphics.drawable.LayerDrawable; import android.graphics.drawable.TransitionDrawable; import android.os.Build; import android.os.Bundle; import android.os.Handler; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentActivity; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentPagerAdapter; import android.support.v4.view.ViewPager; import android.util.TypedValue; import android.view.Menu; import android.view.MenuItem; import android.view.View; import com.astuetz.PagerSlidingTabStrip; public class MainActivity extends FragmentActivity { private final Handler handler = new Handler(); private PagerSlidingTabStrip tabs; private ViewPager pager; private MyPagerAdapter adapter; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); tabs = (PagerSlidingTabStrip) findViewById(R.id.tabs); pager = (ViewPager) findViewById(R.id.pager); adapter = new MyPagerAdapter(getSupportFragmentManager()); pager.setAdapter(adapter); tabs.setViewPager(pager); } @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) { retu…
type: Question
possible better answer: http://stackoverflow.com/a/23234129
tagged with: android-layout
accepted answer: http://stackoverflow.com/a/23234309
score: 10
answer count: 3
has answer: http://stackoverflow.com/a/23234309
has answer: http://stackoverflow.com/a/67244382
upvote count: 10
favorite count: 0
tagged with: android
has title: Can someone show me a simple working implementation of PagerSlidingTabStrip?
type: AnsweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/23234129
tagged with: java

http://stackoverflow.com/comment/35400197
comment on: http://stackoverflow.com/q/23150971
score: 0
type: Comment
type: QuestionComment
has text: Try adding a `repaint()` or a `revalidate()` **after** the `removeAll` call. But again, that's not the right way to do what you want.

http://stackoverflow.com/q/23175989
upvote count: 2
tagged with: datainputstream
type: UnansweredQuestion
tagged with: sockets
score: 2
tagged with: pipe
tagged with: java
has title: Broken pipe using DataInputStream and DataOutputStream and sockets
type: Question
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/23176941
has body: I set up a client and server sockets. When I use classes ObjectOutputStream and ObjectInputStream and the method readObject/writeObject everything works fine. It simulates communication with a robot that I know for sure interprets correctly only method DataOutputStream.writeBytes. So I set up the new architecture for simulation since the robot is not available for testing on a daily basis. In the following code where ObjectOutputStream/ObjectInputStream readObject/writeObject were replaced with DataInputStream/DataOutputStream writeBytes and IOutils.toByteArray. The server socket correctly receives the message but when it tries to write back a response I get a broken pipe as if the connection was closed somewhere. Notice that I never close sockets or streams because the robot can answer even after 30 seconds. Any help to make DataOutputStream.writeBytes work would be appreciated. Here's the non-working code: Client: Socket serverSocket = new Socket("server", 9899); DataOutputStream outputStream = new DataOutputStream(serverSocket.getOutputStream()); //ObjectOutputStream outputStream = new ObjectOutputStream(serverSocket.getOutputStream()); //outputStream.writeObject("\n" + "message" + "\r"); outputStream.writeBytes("\n" + "message" + "\r"); outputStream.flush(); DataInputStream inputStream = new DataInputStream(serverSocket.getInputStream()); //ObjectInputStream inputStream = new ObjectInputStream(serverSocket.getInputStream()); byte [] bytes = IOUtils.toByteArray(inputStream); String serverResponse = new String(bytes,"UTF-8"); // String serverResponse = (String)inputStream.readObject(); Server: ServerSocket serverSocket = new ServerSocket(9899); while (true) { Socket socket = serverSocket.accept(); //ObjectInputStream inputStream = new ObjectInputStream(socket.getInputStream()); DataInputStream inputStream = new DataInputStream(socket.getInputStream()); byte [] bytes = IOUtils.toByteArray(inputStream); String message = new String(bytes,"UTF-8"); //String message = …
favorite count: 0

http://stackoverflow.com/comment/35469690
comment on: http://stackoverflow.com/a/23190195
has text: yup, thats what I do before, I separate it in different if blocks.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/35532790
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23224948
has text: Your updated code still doesn't show any info about how are you adding JScrollPane?

http://stackoverflow.com/q/23165067
answer count: 1
downvote count: 1
favorite count: 0
tagged with: primitive-types
tagged with: constructor
type: UnansweredQuestion
tagged with: java
has body: Im receiving an error on this particular line of code y = totalfood[c].getAmountFood() + y; in the method below public static String averageFood(){ int x = 0; int y = 0; int percent = 0; String average = null; for(int a = 0; a &lt; population; a++){ gerbil[a].getfoodeaten(); for (int b=0; b &lt; foodeats.length; b++){ x += foodeats[b+1]; } for( int c = 0; c &lt; maxfood.length; c++){ y = totalfood[c].getAmountFood() + y; } percent = (int)((x/y*100)); average = gerbil[a].getId()+" ("+gerbil[a].getName()+" "+percent+"%"; System.out.println(average); } return average; } the error message reads Cannot invoke getAmountFood() on the primitive type int. What does this mean, and how do I resolve this? Here is the rest of my code for reference: Class gerbillab package gerbillab; import java.util.Scanner; import gerbillab.Gerbil; public class gerbillab{ public static int population; public static int[] maxfood; public static int[] foodeats; public static int types; public static String[] idnumber; public static String g; public static String gerbilId; public static Gerbil[] gerbil; public static String amountoffoodeaten; public static String gerbilsearch; public static String thisgerbil; public static void main(String args[]){ Scanner keyboard = new Scanner(System.in); System.out.println("How many types of food do the gerbils eat?"); String f = keyboard.nextLine(); int totalF = Integer.parseInt(f); String[] food = new String[totalF]; maxfood = new int[totalF]; for (int a = 0; a&lt;food.length; a++){ System.out.println("Name of food number " + (a+1)); String foodname = keyboard.nextLine(); food[a] = foodname; System.out.println("Max amount of food " + (a+1)); String m = keyboard.nextLine(); int maximum = Integer.parseInt(m); maxfood[a] = maximum; } System.out.println("How many gerbils are in the lab?"); String numberofGerbils = keyboard.nextLine(); population = Integer.parseInt(numberofGerbils); idnumber = new String[population]; String[] nickname = new String[population]; boo…
tagged with: eclipse
has answer: http://stackoverflow.com/a/23165102
type: Question
has title: invoking constructor on primitive type int
has comment: http://stackoverflow.com/comment/35425460
has comment: http://stackoverflow.com/comment/35439738
score: 0
upvote count: 1

http://stackoverflow.com/q/23190285
upvote count: 0
has answer: http://stackoverflow.com/a/23190306
favorite count: 0
type: UnansweredQuestion
has body: package project; /** * * @author manish */ public class ClassA { String str; public void SerString(String _str) { str = _str; } public String GetString() { return str; } } package project; /** * * @author manish */ public class ClassB extends ClassA { /** * @param args * the command line arguments */ String strB; public void SerStringB(String _strB) { strB = _strB; } public String GetStringB() { return strB; } public String output() { ClassA a = new ClassA(); return strB + a.GetString(); } public static void main(String[] args) { ClassA A = new ClassA(); A.SerString("data"); ClassB B = new ClassB(); B.SerStringB("firm"); System.out.println(B.output()); // TODO code application logic here } } Output: firmnull I am supposed to get not null values. How can i fix it?
has title: Null Value returned in java
tagged with: java
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/23190452
score: -1
answer count: 2

http://stackoverflow.com/comment/35661027
has text: Yes, I know. That's not the problem. ;-)
comment on: http://stackoverflow.com/a/23271303
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/35671341
type: Comment
type: QuestionComment
score: 0
has text: we already have 4 job configured with clustered scheduler and the new Job requirement is to make it non clustered . so we will need 2 scheduler clustered and non-clustered in the same JVM . is this is the only solution ?
comment on: http://stackoverflow.com/q/23287754

http://stackoverflow.com/comment/35459666
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23184496
score: 0
has text: where do you hardcode the 99?

http://stackoverflow.com/comment/35367125
comment on: http://stackoverflow.com/a/23132619
has text: Hi my apologies, i had just changed that for testing. This still doesnt work because its taking the first value of the string when the App starts (the string value at the start is null) . It needs to take the value of the string when after its been modified by the user.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/23211076
has title: BindException thrown instead of MethodArgumentNotValidException in REST application
linked to: http://stackoverflow.com/q/7172784
tagged with: spring
tagged with: exceptionhandler
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/78191950
tagged with: java
has comment: http://stackoverflow.com/comment/38558828
score: 12
type: Question
accepted answer: http://stackoverflow.com/a/26895518
answer count: 2
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/26895518
tagged with: rest
possible better answer: http://stackoverflow.com/a/78191950
has comment: http://stackoverflow.com/comment/42344371
has body: I have a simple Spring Rest Controller with some validation. My understanding is that validation failures would throw a MethodArgumentNotValidException. However, my code throws a BindException instead. In debug messages, I also see the app returning a null ModelAndView. Why would a Rest Controller throw BindException or return a null ModelAndView? Note: I am testing my web application using curl and making an HTTP POST curl -X POST http://localhost:8080/tasks I am intentionally omitting the "name" parameter which is a required field marked with @NotNull and @NotBlank annotations. My Controller: @RestController public class TasksController { private static Logger logger = Logger.getLogger(TasksController.class); @Autowired private MessageSource messageSource; @Autowired private Validator validator; @InitBinder protected void initBinder(WebDataBinder binder){ binder.setValidator(this.validator); } @RequestMapping(value = "/tasks", method = RequestMethod.POST) public Task createTask(@Valid TasksCommand tasksCommand){ Task task = new Task(); task.setName(tasksCommand.getName()); task.setDue(tasksCommand.getDue()); task.setCategory(tasksCommand.getCategory()); return task; } } My "command" class (that contains validation annotations) public class TasksCommand { @NotBlank @NotNull private String name; private Calendar due; private String category; ... getters &amp; setters ommitted ... } My RestErrorHandler class: @ControllerAdvice public class RestErrorHandler { private static Logger logger = Logger.getLogger(RestErrorHandler.class); @Autowired private MessageSource messageSource; @ExceptionHandler(MethodArgumentNotValidException.class) @ResponseStatus(HttpStatus.BAD_REQUEST) @ResponseBody public ErrorsList processErrors(MethodArgumentNotValidException ex){ logger.info("error handler invoked ..."); BindingResult result = ex.getBindingResult(); List&lt;FieldError&gt; fieldErrorList = result.getFieldErrors(); ErrorsList errorsList = new ErrorsList(); for(FieldError fieldEr…
upvote count: 12

http://stackoverflow.com/comment/35639653
comment on: http://stackoverflow.com/q/23283954
has text: @Jeeter probably means `super.withdraw(w)`.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35623406
score: 0
has text: @SotiriosDelimanolis No, not a duplicate at all, because my string has another characters, not only numbers, which makes it more complex.
type: QuestionComment
comment on: http://stackoverflow.com/q/23275480
type: Comment

struts2
tags question: http://stackoverflow.com/q/23173158
tags question: http://stackoverflow.com/q/23194997
tags question: http://stackoverflow.com/q/23178892
tags question: http://stackoverflow.com/q/23244626
tags question: http://stackoverflow.com/q/23177963
tags question: http://stackoverflow.com/q/23282699
tags question: http://stackoverflow.com/q/23171202
tags question: http://stackoverflow.com/q/23238455
tags question: http://stackoverflow.com/q/23250791
tag name: struts2
tags question: http://stackoverflow.com/q/23129994
tags question: http://stackoverflow.com/q/23138631
tags question: http://stackoverflow.com/q/23164113
tags question: http://stackoverflow.com/q/23289985
tags question: http://stackoverflow.com/q/23273420
tags question: http://stackoverflow.com/q/23197169
tags question: http://stackoverflow.com/q/23246258
tags question: http://stackoverflow.com/q/23215847
tags question: http://stackoverflow.com/q/23224957
tags question: http://stackoverflow.com/q/23179921
tags question: http://stackoverflow.com/q/23264367
tags question: http://stackoverflow.com/q/23151104
tags question: http://stackoverflow.com/q/23129880
type: Tag
tags question: http://stackoverflow.com/q/23249425

http://stackoverflow.com/q/23144585
tagged with: java
score: -1
type: Question
tagged with: vector
has body: let's say I have this vector [20, 17, 29, 0] and I want it to become [21, 18, 30, 1] as you can see all the elements were simply upped by one. how do I do this without it looking like lousy code
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/23144593
has title: increment all elements from a vector
upvote count: 0
type: UnansweredQuestion
downvote count: 1

http://stackoverflow.com/comment/35566177
comment on: http://stackoverflow.com/q/23244306
type: Comment
has text: C is not simple, change your tags then.
score: 0
type: QuestionComment

http://stackoverflow.com/comment/35648970
comment on: http://stackoverflow.com/a/23288588
score: 0
type: Comment
has text: It's ok! I solved it! I'll post my answer in a second.
type: AnswerComment

http://stackoverflow.com/comment/35378822
comment on: http://stackoverflow.com/q/23138307
has text: The apache poi jar or one of its dependencies is not in your classpath at runtime. How are you running it?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35634972
has text: Which method the one I am Invoking
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23281252

http://stackoverflow.com/comment/35408117
has text: For me it would be best if I could control the program from a web page on the server (Apache), not sure if that is possible. I have looked into [Java Management](http://docs.oracle.com/javase/1.5.0/docs/guide/management/overview.html) as an alternative, but I leaning towards listening on socket.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23137669
score: 0

http://stackoverflow.com/q/23262189
has comment: http://stackoverflow.com/comment/35601758
has comment: http://stackoverflow.com/comment/35599048
score: 0
answer count: 1
has title: Why should the length property at hibernate mapping file be a power of 2?
has answer: http://stackoverflow.com/a/23262858
type: UnansweredQuestion
tagged with: java
tagged with: hibernate
has body: I have read somewhere that the length property at the hibernate mapping file should be power of 2 i.e. it should be either 2, 4, 8, 16, 32, ... and so on. Is it correct? And if so: What is that for?
type: Question

http://stackoverflow.com/comment/35651012
comment on: http://stackoverflow.com/a/23267182
score: 0
type: AnswerComment
type: Comment
has text: haven't had a chance to check this yet, but bounty on way it its this simple.

http://stackoverflow.com/comment/35478157
type: Comment
has text: please post stack tarce of exception
comment on: http://stackoverflow.com/q/23195254
score: 0
type: QuestionComment

http://stackoverflow.com/q/23186067
has comment: http://stackoverflow.com/comment/35461883
tagged with: constructor
has title: constructor not reading int[]
tagged with: multidimensional-array
type: Question
answer count: 1
has comment: http://stackoverflow.com/comment/57291229
has answer: http://stackoverflow.com/a/23186107
score: 0
tagged with: java
has body: for the following code System.out.println("How many gerbils are in the lab?"); int population = keyboard.nextInt(); Gerbil[] gerbil = new Gerbil[population]; gerbil = new Gerbil[population]; int b; for (b = 0; b &lt; population; b++) { System.out.println(b + "start"); System.out.println("What is the id number of gerbil " + (b + 1)); String idnumberx = keyboard.next(); if (b == 0) { System.out.println(idnumberx + "0"); } else { for (int c = 0; c &lt; gerbil.length; c++) { if (idnumberx.equals(gerbil[c].getId())) { System.out.println("Repeat, try again"); System.out.println(idnumberx); b--; System.out.println("1"); } else { System.out.println("2"); break; } System.out.println("3"); } System.out.println("4"); } System.out.println("5"); System.out.println(idnumberx); System.out.println("What is the name for gerbil " + idnumberx); String nicknamex = keyboard.next(); foodeats = new int[F]; for (int e = 0; e &lt; foodeats.length; e++) { System.out.println("how much " + food[e].foodname + " does " + nicknamex + " eat"); int gerbileats = keyboard.nextInt(); foodeats[e] = gerbileats; //if (gerbileats &gt; maximum){ // { //System.out.println("You stoopid, try again"); //e--; //else // { // } // } // } System.out.println(foodeats[e]); } for (int d = 0; d &lt; population; d++) { System.out.println("Does " + nicknamex + " bite? Please enter True or False"); String doesitbite = keyboard.next(); if (doesitbite.equalsIgnoreCase("true")) { bite = Boolean.parseBoolean(doesitbite); break; } else if (doesitbite.equalsIgnoreCase("false")) { bite = Boolean.parseBoolean(doesitbite); break; } else System.out.println("Repeat, try again"); d--; } for(int d = 0; d &lt; population; d++) { System.out.println("Does " + nicknamex + " escape? Please enter True or False"); String doesitescape = keyboard.next(); if (doesitescape.equalsIgnoreCase("true")) { escape = Boolean.parseBoolean(doesitescape); break; } else if (doesitescape.equalsIgnoreCase("false")) { escape = Boolean.parseBoolean(doesitescap…
tagged with: eclipse
type: UnansweredQuestion

http://stackoverflow.com/q/23288442
tagged with: web-scraping
downvote count: 1
has comment: http://stackoverflow.com/comment/35647496
type: Question
score: 3
has answer: http://stackoverflow.com/a/25575393
tagged with: java
has comment: http://stackoverflow.com/comment/35651630
has comment: http://stackoverflow.com/comment/35648237
has comment: http://stackoverflow.com/comment/35647430
upvote count: 4
has comment: http://stackoverflow.com/comment/35728621
answer count: 3
has answer: http://stackoverflow.com/a/25803543
has comment: http://stackoverflow.com/comment/35696771
tagged with: import.io
favorite count: 0
has comment: http://stackoverflow.com/comment/35649541
has comment: http://stackoverflow.com/comment/35647932
has answer: http://stackoverflow.com/a/23606713
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35728809
tagged with: ubuntu-12.04
has body: I have download import.io as per the link, https://import.io/download/linux. As it says, I have extracted and get inside the folder import.io in terminal. But when I tried running ./import.io, I am getting this error(Given below). Kindly advice me to resolve this issue. I appreciate your help. I am using Ubuntu 12.04. Java version java version "1.7.0_51" Java(TM) SE Runtime Environment (build 1.7.0_51-b13) Java HotSpot(TM) 64-Bit Server VM (build 24.51-b03, mixed mode) Error Starting application... # # A fatal error has been detected by the Java Runtime Environment: # # SIGSEGV (0xb) at pc=0xdedda7e4, pid=12312, tid=4149622464 # # JRE version: 7.0_09-b05 # Java VM: Java HotSpot(TM) Client VM (23.5-b02 mixed mode linux-x86 ) # Problematic frame: # C [libdbus-1.so.3+0x277e4] [error occurred during error reporting (printing problematic frame), id 0xb] # Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again # # An error report file with more information is saved as: # /home/user/import.io/hs_err_pid12312.log # [ timer expired, abort... ] Aborted (core dumped) This is the log !SESSION 2014-04-25 14:25:17.199 ----------------------------------------------- eclipse.buildId=unknown java.version=1.7.0_09 java.vendor=Oracle Corporation BootLoader constants: OS=linux, ARCH=x86, WS=gtk, NL=en_IN Command-line arguments: -os linux -ws gtk -arch x86 !ENTRY org.eclipse.osgi 4 0 2014-04-25 14:25:17.712 !MESSAGE Application error !STACK 1 org.eclipse.swt.SWTError: No more handles [gtk_init_check() failed] at org.eclipse.swt.SWT.error(SWT.java:4387) at org.eclipse.swt.widgets.Display.createDisplay(Display.java:914) at org.eclipse.swt.widgets.Display.create(Display.java:900) at org.eclipse.swt.graphics.Device.&lt;init&gt;(Device.java:156) at org.eclipse.swt.widgets.Display.&lt;init&gt;(Display.java:498) at org.eclipse.swt.widgets.Display.&lt;init&gt;(Display.java:489) at org.eclipse.swt.widgets.Display.get…
has title: A fatal error has been detected by the Java Runtime Environment when running .\import.io
has comment: http://stackoverflow.com/comment/35727589

http://stackoverflow.com/comment/35537932
comment on: http://stackoverflow.com/a/23228375
type: Comment
has text: I think you need i-1 because in String.substring(i, j) i is inclusive and j is exclusive. For example "Bill Gates".substring(1,3) would return "il"
score: 0
type: AnswerComment

http://stackoverflow.com/a/23236294
answers question: http://stackoverflow.com/q/23236162
score: 5
upvote count: 5
downvote count: 0
has body: If you want to split only on spaces that are right before tokens which have = righ after it such as user=... then maybe add look ahead condition like split("\\s(?=\\S*=)") This regex will split on \\s space (?=\\S*=) which has zero or more * non-space \\S characters which ends with = after it. Also look-ahead (?=...) is zero-length match which means part matched by it will not be included in in result so split will not split on it. Demo: String user_name = "id=123 user=aron nicols name=aron app=application"; for (String s : user_name.split("\\s(?=\\S*=)")) System.out.println(s); output: id=123 user=aron nicols name=aron app=application From your comment in other answer it seems that = which are escaped with \ shouldn't be treated as separator between key=value but as part of value. In that case you can just add negative-look-behind mechanism to see if before = is no \, so (?&lt;!\\\\) right before will require = to not have \ before it. BTW to create regex which will match \ we need to write it as \\ but in Java we also need to escape each of \ to create \ literal in String that is why we ended up with \\\\. So you can use split("\\s(?=\\S*(?&lt;!\\\\)=)") Demo: String user_name = "user=Dist\\=Name1, xyz src=activedirectorydomain ip=10.1.77.24"; for (String s : user_name.split("\\s(?=\\S*(?&lt;!\\\\)=)")) System.out.println(s); output: user=Dist\=Name1, xyz src=activedirectorydomain ip=10.1.77.24
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23236162
type: Answer
has comment: http://stackoverflow.com/comment/35551838

http://stackoverflow.com/comment/35366876
comment on: http://stackoverflow.com/a/23131539
type: Comment
has text: I had to check this... MSDN says the following: The asterisk should only be used as a wild-card character when executing via DAO, or directly from Microsoft Access. When using ADO or ADO.NET the percent symbol should be used. This is not ODBC or OLEDB, so I am not sure.
score: 0
type: AnswerComment

http://stackoverflow.com/a/23183277
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23182875
has body: Although this question has already been answered, I thought I'd go ahead and add this: Sometimes, you want to have variables that are common to all objects. This is accomplished with the static modifier. Fields that have the static modifier in their declaration are called static fields or class variables. They are associated with the class, rather than with any object. Every instance of the class shares a class variable, which is in one fixed location in memory. Link: http://docs.oracle.com/javase/tutorial/java/javaOO/classvars.html

http://stackoverflow.com/q/23261281
has comment: http://stackoverflow.com/comment/35597609
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35597243
tagged with: java
has comment: http://stackoverflow.com/comment/35597108
has comment: http://stackoverflow.com/comment/35598018
has answer: http://stackoverflow.com/a/23261641
has comment: http://stackoverflow.com/comment/35596968
type: Question
has comment: http://stackoverflow.com/comment/35597861
accepted answer: http://stackoverflow.com/a/23261641
has comment: http://stackoverflow.com/comment/35597911
has comment: http://stackoverflow.com/comment/35598198
score: 0
has comment: http://stackoverflow.com/comment/35597390
tagged with: filter
answer count: 1
linked to: http://stackoverflow.com/q/3659683
has title: doFilter method is not running?
has comment: http://stackoverflow.com/comment/35597495
has body: This is login.jsp page &lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8"&gt; &lt;title&gt;JSP Page&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;form action="checklogin" method="Post"&gt; &lt;h2&gt;Login tab&lt;/h2&gt; &lt;br&gt; Login id:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;input type="text" name="loginid"&gt;&lt;br&gt;&lt;br&gt; Password:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;input type="password" name="password"&gt;&lt;br&gt;&lt;br&gt; &lt;input type="submit" value="Submit"&gt; &lt;/form&gt; &lt;/body&gt; &lt;/html&gt; This is checklogin servlet protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { PrintWriter out=response.getWriter(); javax.servlet.http.HttpSession session = request.getSession(true); String username = (String)request.getParameter("loginid"); String password = (String)request.getParameter("password"); session.setAttribute("UserName", username); if(username.equals("Prashant") &amp;&amp; password.equals("123")) { response.sendRedirect("admin.jsp"); } else { out.println("&lt;h2&gt;"+"Sharam aani chahiye account banaya nahi aur login kar rahe ho"+"&lt;h2&gt;"); } } This is my filter which is mapped in filter in we.xml as this URL /admin.jsp/* public class adminfilter implements javax.servlet.Filter{ @Override public void init(FilterConfig filterConfig) throws ServletException { System.out.println("Sawagat nahi karoge init method ka"); } @Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { System.out.println("Sawagat nahi karoge doFilter method ka"); } @Override public void destroy() { System.out.println("Sawagat nahi karoge destroy method ka"); } } This is my web.xml file &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;web-app version="3.1" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2…

http://stackoverflow.com/comment/35661911
type: AnswerComment
type: Comment
has text: @MikkelLøkke , Thankyou. I add this link to bookmarks (just 01:53 of morning now :) ). How about client-server application? I know, it's weird, what newbie already learn it. But i don't want make application like this now. I just want ask, if it client-server application, game, like tic-tac-toe, do it need to use Connection Pool, or Singleton will more better solution?
comment on: http://stackoverflow.com/a/23290286
score: 0

http://stackoverflow.com/q/23269932
tagged with: design-patterns
type: Question
has comment: http://stackoverflow.com/comment/35615974
has answer: http://stackoverflow.com/a/23271099
tagged with: java
possible better answer: http://stackoverflow.com/a/23270067
has body: Imagine a class like shown below. I have to write some code which can sum up all values of a collection and of all values which satisfy a given criterion. class MyClass { private String name; private int value; } My current code looks like this. Is there more elegant design pattern for the following functionality? public static int sumFilter(Collection&lt;MyClass&gt; collection, String filter) { int result = 0; for (MyClass myClass : collection) { if (filter == null || filter.equals(myClass.getName()) { result += myClass.getValue(); } } return result; } public static int sumAll(Collection&lt;MyClass&gt; collection) { return sumFilter(collection, null); }
has answer: http://stackoverflow.com/a/23270067
score: 0
answer count: 2
has title: Two methods to return sum of all and sum of specific values in a collection
accepted answer: http://stackoverflow.com/a/23271099
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35612584
has comment: http://stackoverflow.com/comment/35612487

http://stackoverflow.com/a/23248797
has comment: http://stackoverflow.com/comment/35574060
answers question: http://stackoverflow.com/q/23248687
has body: The error is not in that method, surely you missed a } before
score: 0
type: Answer

stack-overflow
tags question: http://stackoverflow.com/q/23251448
tag name: stack-overflow
type: Tag
tags question: http://stackoverflow.com/q/23234241
tags question: http://stackoverflow.com/q/23187162

http://stackoverflow.com/a/24494675
has body: Did you allow the INTERNET permission in the manifest? &lt;uses-permission android:name="android.permission.INTERNET" /&gt; I had the same problem with ssh returning "permission denied" and it was because the app itself wasn't allowed internet access.
type: Answer
upvote count: 1
downvote count: 1
answers question: http://stackoverflow.com/q/23176763
score: 0

http://stackoverflow.com/comment/35522234
has text: I got this error suddenly after adding a servlet to my project.. These are the lines in the xml file.. <nbdeploy clientUrlPart="${client.urlPart}" debugmode="false" forceRedeploy="${forceRedeploy}"/>
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/23220204
type: Comment

http://stackoverflow.com/comment/35366834
type: QuestionComment
has text: @reubenjohn It wasn't clear to me that you were using a preprocessor addon. It is not one of the listed operators. I suggest you ask the developers via github whether this is supported or planned, if they don't know, no-one does.
comment on: http://stackoverflow.com/q/23131872
score: 0
type: Comment

http://stackoverflow.com/comment/35524954
comment on: http://stackoverflow.com/q/23221528
score: 3
type: Comment
type: QuestionComment
has text: Try adding components with a fixed size and call the `frame.pack()` method after (if your frame is not set to fixed dimensions).

http://stackoverflow.com/comment/35392047
has text: Add the error u get in the question. Also a better idea is as soon as user moves the seekbar the interest gets calculated
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23146052
score: 3

http://stackoverflow.com/a/23281096
downvote count: 0
has comment: http://stackoverflow.com/comment/35635164
has comment: http://stackoverflow.com/comment/35634823
upvote count: 2
type: Answer
score: 2
answers question: http://stackoverflow.com/q/23280681
has body: welcome to Stackoverflow.com :), i think you have an IndexOutofBounds Exception: java.lang.IndexOutOfBoundsException: Invalid index 1, size is 1 this is an example of how i play an .M3U8 using a VideoView: private VideoView myvideoview; private String urlStream; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); String streamV = "http://media.jorgesys.com/reforma.m3u8"; new playM3U8().execute(streamV); myvideoview = (VideoView)this.findViewById(R.id.myvideoview); myvideoview.setOnPreparedListener(new OnPreparedListener() { @Override public void onPrepared(MediaPlayer mp) { myvideoview.start(); } }); myvideoview.setOnErrorListener(new OnErrorListener() { @Override public boolean onError(MediaPlayer mp, int what, int extra) { Log.i("Exception", "url: " + url); return false; } }); } This class is an AyncTask to play the M3U8: class playM3U8 extends AsyncTask&lt;String, Void, Void&gt; { private Exception exception; protected Void doInBackground(String... urls) { urlStream = urls[0]; runOnUiThread(new Runnable() { @Override public void run() { myvideoview.setVideoURI(Uri.parse(urlStream)); } }); return null; } protected void onPostExecute(String feed) { Log.i("*** Streaming M3U8", "url: " + urlStream ); } }

http://stackoverflow.com/comment/35560537
score: 0
has text: adb shell am broadcast -W -a android.intent.action.VIEW -d "testappschema://Episode"
type: AnswerComment
comment on: http://stackoverflow.com/a/23240786
type: Comment

http://stackoverflow.com/q/23161248
accepted answer: http://stackoverflow.com/a/23161365
has answer: http://stackoverflow.com/a/23161365
has comment: http://stackoverflow.com/comment/35418536
tagged with: recursion
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23161405
tagged with: java
possible better answer: http://stackoverflow.com/a/23161405
has title: Recursively finding combinations of ABC in Java
type: Question
tagged with: combinations
score: 0
answer count: 2
has body: I'm trying to write a program that prints all the patterns one can make with ABC. I'm allowing the user to determine how long it characters should be, but I'm having trouble running the program because I get an error and I don't know what is wrong.. private static int userinput; public static void main(String[] args) { Scanner input = new Scanner(System.in); System.out.println("Enter the maximum number of characters"); userinput = input.nextInt(); combos(); } public static void combos() { combos(""); } private static void combos(String counter) { if (counter.length() == userinput) //base case System.out.println(counter); else //recursive case combos(counter + "A"); combos(counter + "B"); combos(counter + "C"); }

http://stackoverflow.com/q/23151957
has body: I am Having a trouble to create a ScrollView with drag and drop functionality to reorder it's all components. i don't want to create it using Listview. can anyone help me for this.?Thnaks :) public class ActivityDragAndDrop extends Activity { private CustomScrollView customScrollView; private LinearLayout llMain; private float defaultPos; private float heightRequestItem; private float halfitemHeight; private int lastAddedAt = -1; float lastY = -1; LayoutInflater inflater; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_drag_and_drop); initData(); initUI(); } private void initData() { heightRequestItem = getResources().getDimensionPixelSize( R.dimen.item_height); halfitemHeight = heightRequestItem / 2; } private void initUI() { customScrollView = (CustomScrollView) findViewById(R.id.scrollView); llMain = (LinearLayout) findViewById(R.id.llMain); inflater = (LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE); for (int i = 0; i &lt;= 5; i++) { View vTemp = inflater.inflate(R.layout.single_tv_tag_name, null); if (i != 4 &amp;&amp; i != 5) { TextView tvTagName = ((TextView) vTemp .findViewById(R.id.tvTagName)); tvTagName.setText("Tag" + i); tvTagName.setTag("" + i); } vTemp.setOnTouchListener(new ChoiceTouchListener()); vTemp.setOnDragListener(new ChoiceDragListener()); llMain.addView(vTemp); } } private final class ChoiceTouchListener implements OnTouchListener { @Override public boolean onTouch(View view, MotionEvent motionEvent) { if (motionEvent.getAction() == MotionEvent.ACTION_DOWN) { defaultPos = view.getY(); ClipData data = ClipData.newPlainText("", ""); DragShadowBuilder shadowBuilder = new View.DragShadowBuilder( view); view.startDrag(data, shadowBuilder, view, 1); return true; } else { return false; } } } private class ChoiceDragListener implements OnDragListener { @Override public boolean onDrag(View v, DragEvent event) { // handle drag events switch (event.getAction())…
type: Question
has title: Android :Scrollview with drag and drop to reorder child component
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/23166907
tagged with: android
has comment: http://stackoverflow.com/comment/35401682
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
accepted answer: http://stackoverflow.com/a/23166907

http://stackoverflow.com/a/23178348
type: Answer
answers question: http://stackoverflow.com/q/23178173
accepted answer of: http://stackoverflow.com/q/23178173
has comment: http://stackoverflow.com/comment/35448885
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35448880
score: 0
has body: Do you see any problem with the code? variable names should NOT start with an upper case character ("Table" should be "table"). Your select statement isn't doing a search. You are selecting a column name. When you do a search you should have a "where" clause that contains the string your are searching for. Use a PreparedStatement when creating your SQL statement. It will build the query with the proper delimiters so you don't need to worry about making a syntax error.

http://stackoverflow.com/comment/35479311
comment on: http://stackoverflow.com/a/23195567
type: AnswerComment
score: 0
type: Comment
has text: The error now is just: `Invalid task '1': you must specify a valid lifecycle phase, or a goal in the format plugin:goal or pluginGroupId:pluginArtifactId:pluginVersion:goal`

http://stackoverflow.com/q/23234033
type: UnansweredQuestion
has title: access a value in a dif method in same class
has body: I'm trying to create a method in a class that calculates loan amounts. the method should return "totalPay" but it is saying that it isn't declared, do you see why? public loan(double anualInterestRate, int numberOfYears, double loanAmount){ double base = (double) ( loanAmount * (1+anualInterestRate/12)); double exponent = (double) (numberOfYears * 12); double totalPay = (double) Math.pow(base, exponent); } and the total payment method that isn't seeing "totalPay" for some reason: /** * * @return total payment */ public double totalPayment(){ return totalPay; }
tagged with: java
has answer: http://stackoverflow.com/a/23234041
type: Question
answer count: 1
score: 0

http://stackoverflow.com/a/23267033
answers question: http://stackoverflow.com/q/23266605
has body: Use ActionListener instead of MouseListener why you use ActionListener, An ActionListener is used to handle the logical click of a button. A click happens - when the mouse is pressed then released on a button, - when the keyboard shortcut of that button is used, - when the button has the focus and the space bar is pressed, - when the button is the default button and Enter is pressed, - when the button's click() method is called programmatically A MouseListener only handles low-level mouse events.
type: Answer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/35609973
upvote count: 1

http://stackoverflow.com/q/23194479
has body: Sorry, but I am afraid! I have mouse listener attached to my custom tab component. When I click on this tab I want to translate mouse Point to coordinates of parent JTabbedPane. How to do this in swing? Thanks friends!
has answer: http://stackoverflow.com/a/23194872
score: 1
upvote count: 1
tagged with: swing
type: Question
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/23194872
answer count: 1
downvote count: 0
has title: How to translate mouse point of Tab to Point of JTabbedPane?
favorite count: 0
tagged with: jtabbedpane

testing
tags question: http://stackoverflow.com/q/23140315
tags question: http://stackoverflow.com/q/23174304
tags question: http://stackoverflow.com/q/23185638
tags question: http://stackoverflow.com/q/23252095
tags question: http://stackoverflow.com/q/23152531
tag name: testing
tags question: http://stackoverflow.com/q/23181064
tags question: http://stackoverflow.com/q/23153633
tags question: http://stackoverflow.com/q/23131747
tags question: http://stackoverflow.com/q/23208916
tags question: http://stackoverflow.com/q/23274989
tags question: http://stackoverflow.com/q/23192774
type: Tag
tags question: http://stackoverflow.com/q/23206356
tags question: http://stackoverflow.com/q/23220524
tags question: http://stackoverflow.com/q/23204194

http://stackoverflow.com/a/23133170
upvote count: 4
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23130255
has comment: http://stackoverflow.com/comment/35383409
type: Answer
accepted answer of: http://stackoverflow.com/q/23130255
has body: SHA-256 returns 32 bytes by default (256 / 8 = 32), not 16. The normal way to use a part of a hash is to use the first (leftmost) 16 bytes of the resulting hash. You can do this by applying the Java copyOf method on the result of SHA-256. Please use a real hexadecimal encoder to display the result (not to return a value, you don't need any String instances at all). Using BigInteger is error prone and may add or remove bytes. Try for instance: public static byte[] sha256digest16(String[] list) throws NoSuchAlgorithmException, UnsupportedEncodingException { MessageDigest digest = MessageDigest.getInstance("SHA-256"); digest.reset(); for(String s: list){ digest.update(s.getBytes("UTF-8")); } // so you have 32 bytes here byte[] b = digest.digest(); // you can return it directly or you can cut it to 16 bytes return Arrays.copyOf(b, 16); } For display as hexadecimals use: public static String tohex(byte[] data) { StringBuilder sb = new StringBuilder(data.length * 2); for (int i = 0; i &lt; data.length; i++) { sb.append(String.format("%02X", data[i] &amp; 0xFF)); } return sb.toString(); } Or use one of the hex encoders of the Apache commons codec, Bouncy Castle or Guava.
score: 4

http://stackoverflow.com/comment/35555111
comment on: http://stackoverflow.com/q/23238199
score: 0
type: Comment
type: QuestionComment
has text: I suppose you want to add some of your code to a jar and add it to the war afterwards?

http://stackoverflow.com/comment/35446748
type: AnswerComment
type: Comment
has text: Hi, thanks for answer, just one correction to your answer. `getUnsafe()` is a custom method which will return a Unsafe instance without throwing `java.lang.SecurityException` BUT your answer is still very helpful :)
comment on: http://stackoverflow.com/a/23177227
score: 0

http://stackoverflow.com/comment/35446076
comment on: http://stackoverflow.com/q/23171289
type: Comment
type: QuestionComment
has text: Why? What good does it do to know it?
score: 1

http://stackoverflow.com/comment/35637720
type: Comment
type: QuestionComment
has text: what is your question?
comment on: http://stackoverflow.com/q/23282908
score: 0

http://stackoverflow.com/a/23234562
type: AcceptedAnswer
type: Answer
has body: Yes, it is possible to only create the ArrayList once and perform operations on it on multiple other methods. A way to do this is as follows: Define a global variable at the top of class readStudent, say studentList Instead of returning a list in method readStudent(), add each new Student object to the global variablestudentList In each method call where you query studentList, simply refer to the global variable instead of running readStudent() again. A sample implementation of this global variable may look like: public class readStudent { public static List&lt;Student&gt; studentList = new ArrayList&lt;Student&gt;(); public static void main(String[] args) { readStudent(); //to initialize studentList //other methods here } public static void readStudent() throws Exception { Scanner input = new Scanner(new File("students.txt")); while (input.hasNext()) { int id = input.nextInt(); String lastName = input.next(); String firstName = input.next(); int gradYear = input.nextInt(); Student student = new Student(id, firstName, lastName, gradYear); studentList.add(student); } } } and for allRecords(), public static void allRecords() throws Exception { int size = studentList.size(); for (int i=0; i&lt;size; i++) { System.out.printf("%-5d %10s %10s %15d\n", studentList.get(i).returnId(), studentList.get(i).returnFirst(), studentList.get(i).returnLast(), studentList.get(i).returnGrad()); } }
accepted answer of: http://stackoverflow.com/q/23234480
answers question: http://stackoverflow.com/q/23234480
score: 0

http://stackoverflow.com/a/23300372
type: Answer
accepted answer of: http://stackoverflow.com/q/23250516
answers question: http://stackoverflow.com/q/23250516
type: AcceptedAnswer
has body: Well I wasn't able to figure out why Jackson behaved the way it did, but I did find that the issue was that I had a constructor for the DTO that referenced the domain object, and even though Jackson should have never called that constructor since there was a default public parameterless constructor available, it still tried to map the domain object. I got around this but using @JsonIgnore on the constructor that referenced the domain object.
score: 0

http://stackoverflow.com/a/60072738
downvote count: 0
has comment: http://stackoverflow.com/comment/116736921
answers question: http://stackoverflow.com/q/23218874
type: Answer
score: 6
upvote count: 6
has body: Collection.forEach() uses the collection's iterator (if one is specified). That means that the processing order of the items is defined. In contrast, the processing order of Collection.stream().forEach() is undefined. In most cases, it doesn't make a difference which of the two we choose. Parallel streams allow us to execute the stream in multiple threads, and in such situations, the execution order is undefined. Java only requires all threads to finish before any terminal operation, such as Collectors.toList(), is called. Let's look at an example where we first call forEach() directly on the collection, and second, on a parallel stream: list.forEach(System.out::print); System.out.print(" "); list.parallelStream().forEach(System.out::print); If we run the code several times, we see that list.forEach() processes the items in insertion order, while list.parallelStream().forEach() produces a different result at each run. One possible output is: ABCD CDBA Another one is: ABCD DBCA

http://stackoverflow.com/a/23147925
has comment: http://stackoverflow.com/comment/35396416
has body: I Think In your Database table have Supplier_id column as Integer... Add Supplier id in Your form... When click on jtable supplier Id also displayed in textfield.. like this.. private void jButton6ActionPerformed(java.awt.event.ActionEvent evt) { try{ String url = "jdbc:odbc:mydata"; Connection conn = DriverManager.getConnection(url,"",""); String value1=tfSupName1.getText(); String value2=tfType1.getText(); String value3=tfStock1.getText(); String sql="UPDATE User set SupplierName='"+value1+"' ,MarbleType='"+value2+"' ,InStock='"+value3+"' Where Supplier_id=1"; pst=conn.prepareStatement(sql); pst.execute(); } catch(Exception e){JOptionPane.showMessageDialog(null,e);} }
has comment: http://stackoverflow.com/comment/35396490
has comment: http://stackoverflow.com/comment/35395407
has comment: http://stackoverflow.com/comment/35396492
upvote count: 2
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23147766
has comment: http://stackoverflow.com/comment/35396651
answers question: http://stackoverflow.com/q/23147766
has comment: http://stackoverflow.com/comment/35396608
type: Answer
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/35396334
has comment: http://stackoverflow.com/comment/35396867
has comment: http://stackoverflow.com/comment/35395446

http://stackoverflow.com/comment/35449007
has text: +1 this is how a question about a homework should be asked.
comment on: http://stackoverflow.com/q/23178543
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/comment/35451967
has text: @cYrixmorten your answer is not to the point that is why its seems invalid. Please shorten it down to the snippet that is required.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23180087
type: AnswerComment

http://stackoverflow.com/comment/35595531
has text: Connection pool? i disable the cache by using okHttpClient.setResponseCache(null); okHttpClient.setOkResponseCache(null);
comment on: http://stackoverflow.com/a/23244575
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/23133024
answer count: 2
has comment: http://stackoverflow.com/comment/35373959
favorite count: 0
upvote count: 2
has body: There is a form in which there are 3 fields with 3 different ID's: FIELD1 FIELD2 FIELD3 Now, there is a Story in our scrum process which places FIELD3 at the top of the page, above FIELD1, so that the new order of fields will be 3, 1, 2. My question is: Is there a way to verify/assert the order? If yes, how do I test this automatically using Selenium Webdriver (java)?
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35369176
tagged with: java
has comment: http://stackoverflow.com/comment/35396709
tagged with: selenium
has answer: http://stackoverflow.com/a/23133898
has answer: http://stackoverflow.com/a/73665784
tagged with: webdriver
type: Question
accepted answer: http://stackoverflow.com/a/23133898
possible better answer: http://stackoverflow.com/a/73665784
downvote count: 0
has title: Can I test on the order of elements using Selenium Webdriver?

http://stackoverflow.com/a/23169774
score: 1
has body: You can retrieve to user with the Principal parameter : public ModelAndView newUser(ModelMap model, Principal principal) { User activeUser = (User) ((Authentication) principal).getPrincipal(); } SecurityContextHolder is a part of Spring Security. If you want to use this component, you have to set up Spring Security for the log in of your application to be able to retrieve, in your REST controller, the current user (javax.security.Principal) Spring Security Documentation
has comment: http://stackoverflow.com/comment/35436589
upvote count: 1
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/35434838
answers question: http://stackoverflow.com/q/23169136

http://stackoverflow.com/a/23199737
score: 1
has comment: http://stackoverflow.com/comment/35618801
has comment: http://stackoverflow.com/comment/35490245
downvote count: 0
has comment: http://stackoverflow.com/comment/35485798
has body: Changing directories to where your test is located is a mistake. The java program will start from the classpath you give it and assume the package directory structure starts from there, so if you are in C:\Sample\com\company\division\junit\ and you give the java command -cp = "." then it will look for the class com.company.division.junit.EventTests in C:\Sample\com\company\division\junit\com\company\division\junit\. Also if you don't include your classes in the classpath (your last example is the only one to include them) then the java exe won't find them. You need to add the current directory to the classpath, first changing directories so that the top of the package structure is at your current directory: cd c:\Sample java -cp ".;lib\*.jar" org.junit.runner.JUnitCore com.company.division.junit.EventTests This way . points to where your packages are defined. If you would rather use absolute paths then try java -cp "C:\Sample;C:\Sample\lib\*.jar" org.junit.runner.JUnitCore com.company.division.junit.EventTests You can use the * as a wildcard to include multiple jars starting with jdk 6. For the future, consider using the directory layout used by default in Maven. Keeping tests separate from code is typically a good thing. I wonder if part of this problem isn't that test-only dependencies are located in a different spot than other libraries. Right-click on your project in Eclipse and find the menu Build Path -&gt; Configure Build Path, and make sure you know where Eclipse is getting these jars from.
has comment: http://stackoverflow.com/comment/35489825
type: Answer
has comment: http://stackoverflow.com/comment/35489320
upvote count: 1
answers question: http://stackoverflow.com/q/23198687

http://stackoverflow.com/q/23156685
tagged with: user-interface
tagged with: arrays
favorite count: 0
has body: I send a array of int to constructor panel, in the first time this create the gui, but with the next array no update the panel/jframe. class panel extends JPanel{ public panel(int matriz[][]) { this.setPreferredSize(new Dimension(300, 300)); this.setLayout(new GridLayout(5, 5)); this.revalidate(); for (int i = 0; i &lt; 5; i++) { for (int j = 0; j &lt; 5; j++) { if(matriz[i][j]==1) { JButton boton = new JButton(""); boton.setBackground(Color.yellow); this.add(boton); boton.revalidate(); boton.repaint(); } else { JButton boton = new JButton(""); this.add(boton); boton.revalidate(); boton.repaint(); } if(j==4) //imprimo pa ver si realmente me esta enviando datos desde creandoVida System.out.println("n"+matriz[i][j]); else System.out.print(matriz[i][j]); } } System.out.println("---"); this.doLayout(); this.revalidate(); this.repaint(); } public void paintComponent(Graphics g){ super.paintComponent(g); this.revalidate(); }
answer count: 1
has title: Update button array in jpanel
tagged with: updatepanel
score: -1
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23156828
tagged with: swing
downvote count: 1
tagged with: java
type: Question
upvote count: 0

jax-ws
tags question: http://stackoverflow.com/q/23257697
tags question: http://stackoverflow.com/q/23290391
tags question: http://stackoverflow.com/q/23215799
tags question: http://stackoverflow.com/q/23205260
type: Tag
tags question: http://stackoverflow.com/q/23149800
tag name: jax-ws
tags question: http://stackoverflow.com/q/23238631

http://stackoverflow.com/comment/35610011
has text: Suppose i have 10 threads. All Threads takes random amount of time to complete. Consider the 4th or 5th Thread throws a RuntimeException. Now if i am iterating over the future objects then it will catch the exception and the rest of the threads will be closed. But if i await for Termination it wont exist till all threads have completed.
score: 0
comment on: http://stackoverflow.com/a/23268152
type: Comment
type: AnswerComment

http://stackoverflow.com/a/23220252
has comment: http://stackoverflow.com/comment/35522441
answers question: http://stackoverflow.com/q/23219733
score: 0
has body: use by your modification like below if (rs != null &amp;&amp; rs.first()) { do { returnValue = rs.getString(("display_name"); } while (rs.next()); }
type: Answer
upvote count: 1
downvote count: 1

http://stackoverflow.com/q/23272185
tagged with: maven
has comment: http://stackoverflow.com/comment/78757168
tagged with: maven-mojo
answer count: 0
score: 1
has body: I am developing a Maven plugin and I make use of the Assembly API to do some custom assembly construction. When my code runs, I get this stack trace: java.lang.NullPointerException: null at org.apache.maven.plugin.assembly.interpolation.AssemblyInterpolator.buildInterpolator(AssemblyInterpolator.java:177) at org.apache.maven.plugin.assembly.interpolation.AssemblyExpressionEvaluator.(AssemblyExpressionEvaluator.java:44) at org.apache.maven.plugin.assembly.io.DefaultAssemblyReader.mergeComponentsWithMainAssembly(DefaultAssemblyReader.java:470) at org.apache.maven.plugin.assembly.io.DefaultAssemblyReader.readAssembly(DefaultAssemblyReader.java:390) at org.apache.maven.plugin.assembly.io.DefaultAssemblyReader.addAssemblyFromDescriptor(DefaultAssemblyReader.java:328) at org.apache.maven.plugin.assembly.io.DefaultAssemblyReader.readAssemblies(DefaultAssemblyReader.java:120) From what I can tell, this is caused by DefaultAssemblyReader not having access to the default Maven project for the plugin. In my mojo, I have declared the Maven project and assembly reader like this: @Component (role=org.apache.maven.project.MavenProject.class, hint="default") protected MavenProject project; @Component(role=org.apache.maven.plugin.assembly.io.AssemblyReader.class, hint="default") protected AssemblyReader defaultReader; The AssemblyReader class doesn't have any setter to set the project on it, and I'm not sure how I can get project injected in to defaultReader. One solution I thought of would be to extend SingleAssemblyMojo and give it a setter for the project and pass that configuration object to the assembly reader, but that seems like a bit of a kludge. Is there a more elegant/proper way?
tagged with: java
upvote count: 1
type: Question
downvote count: 0
tagged with: maven-plugin
favorite count: 0
has title: Injecting default Maven project into other Maven components
type: UnansweredQuestion

http://stackoverflow.com/q/23273237
tagged with: java
has answer: http://stackoverflow.com/a/23306442
has comment: http://stackoverflow.com/comment/35620162
type: Question
tagged with: broadcastreceiver
score: 0
answer count: 1
tagged with: service
has comment: http://stackoverflow.com/comment/35622094
has comment: http://stackoverflow.com/comment/35643745
tagged with: httpurlconnection
has body: I have an HttpURLConnection uploading a file, and my server then emails it. It works great. However, I don't want it in an Activity, I want it in the SMS receiver OnRecieve(), yet I can't seem to get it to work. Please help? When I put the code into OnReceive(), it simply fails:( Here's my code, it's quite simple: StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build(); StrictMode.setThreadPolicy(policy); try{ int serverResponseCode = 0; final String upLoadServerUri = "http://MY_URL_EXAMPLE/upload_file_functions.php"; String fileName = "/mnt/sdcard/MyFile.dat"; HttpURLConnection conn = null; DataOutputStream dos = null; String lineEnd = "\r\n"; String twoHyphens = "--"; String boundary = "*****"; int bytesRead, bytesAvailable, bufferSize; byte[] buffer; int maxBufferSize = 1 * 1024 * 1024; File sourceFile = new File("/mnt/sdcard/MyFile.dat"); // open a URL connection to the Servlet FileInputStream fileInputStream = new FileInputStream(sourceFile); URL url = new URL(upLoadServerUri); // Open a HTTP connection to the URL conn = (HttpURLConnection) url.openConnection(); conn.setDoInput(true); // Allow Inputs conn.setDoOutput(true); // Allow Outputs conn.setUseCaches(false); // Don't use a Cached Copy conn.setRequestMethod("POST"); conn.setRequestProperty("Content-Type", "multipart/form-data;boundary=" + boundary); dos = new DataOutputStream(conn.getOutputStream()); dos.writeBytes(twoHyphens + boundary + lineEnd); dos.writeBytes("Content-Disposition: form-data; name=\"file\";filename=\""+ fileName + "\"" + lineEnd); dos.writeBytes(lineEnd); // create a buffer of maximum size bytesAvailable = fileInputStream.available(); bufferSize = Math.min(bytesAvailable, maxBufferSize); buffer = new byte[bufferSize]; // read file and write it into form... bytesRead = fileInputStream.read(buffer, 0, bufferSize); while (bytesRead &gt; 0) { dos.write(buffer, 0, bufferSize); bytesAvailable = fileInputStream.available(); bufferSize = Math.min(bytesAvaila…
has title: How do I put HttpURLConnection into BroadcastReceiver OnReceive()?
type: UnansweredQuestion

http://stackoverflow.com/comment/35661717
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23271007
has text: Thanks, but I'm not encrypting or decrypting. I'm studying. And trying to find out the weaknesses of using a seeded Java SecureRandom object.

http://stackoverflow.com/q/23254166
tagged with: swing
tagged with: java
has comment: http://stackoverflow.com/comment/35586725
tagged with: keylistener
type: Question
has answer: http://stackoverflow.com/a/23254218
has title: Did I structure this key listener properly?
score: 0
linked to: http://stackoverflow.com/q/8961938
has body: I'm asking because I want the addShot() method in my GamePanel class to be called when the user hits enter," this initializes a shot object representing a missile fired from a ship, but it doesn't do anything. Is there a visibility issue here, or did I just structure the key event and listener relationship wrong? I'm only posting relevant code, but I can post the rest if necessary. Here's the code: public static class GameTest extends JFrame { private static final int WINDOW_WIDTH = 800; private static final int WINDOW_HEIGHT = 500; public GamePanel gamePanel; public GameTest() throws IOException { super("Deep Fried Freedom"); setResizable(false); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setSize(WINDOW_WIDTH, WINDOW_HEIGHT); setLayout(new BorderLayout()); gamePanel = new GamePanel(); add(gamePanel); center(this); setVisible(true); this.addKeyListener(new aKeyListener()); this.setFocusable(true); } // end constructor public void center(JFrame frame) { GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); Point center = ge.getCenterPoint(); int w = frame.getWidth(); int h = frame.getHeight(); int x = center.x - w / 2, y = center.y - h / 2; frame.setBounds(x, y, w, h); frame.validate(); }//end of center method public class aKeyListener implements KeyListener { @Override public void keyTyped(KeyEvent e) { }//end empty keyTyped method @Override public void keyPressed(KeyEvent e) { switch (e.getKeyCode()) { case KeyEvent.VK_A: Launcher.lRun = -20; gamePanel.move(gamePanel); break; case KeyEvent.VK_D: Launcher.lRun = 20; gamePanel.move(gamePanel); break; case KeyEvent.VK_ENTER: gamePanel.addShot(); break; default: Launcher.lRun = 0; } }//end keyPressed method @Override public void keyReleased(KeyEvent e) { }//end empty keyReleased method }//end aKeyListener class }//end GameTest class
answer count: 1
type: UnansweredQuestion
tagged with: animation

http://stackoverflow.com/q/23186123
has title: How would I iterate through an array of colors so the color changes each mouseclick?
has answer: http://stackoverflow.com/a/23186548
tagged with: java
tagged with: eclipse
type: Question
has comment: http://stackoverflow.com/comment/35462370
tagged with: for-loop
tagged with: arrays
has comment: http://stackoverflow.com/comment/35462121
has comment: http://stackoverflow.com/comment/35462000
has body: So I want to iterate through an array of colors upon mouseclick and when it reaches the end of the array go back to the 0 space in the array. private Color _color = Color.BLACK; private Color[] _arrayOfColors = new Color[]{Color.GREEN, Color.RED, Color.BLUE, Color.BLACK}; @Override public void paint(Graphics g) { g.setColor(_color); g.drawRect(_x, _y, _size, _size); } @Override public void mousePressed(MouseEvent mev) { for(int i = 0; i&lt;_arrayOfColors.length; i++) { _color = _arrayOfColors[i]; } }
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/35461988
has comment: http://stackoverflow.com/comment/35462175
has comment: http://stackoverflow.com/comment/35462068
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/45068753
has answer: http://stackoverflow.com/a/33885348

http://stackoverflow.com/comment/35442235
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23174672
score: 1
has text: can you change background image of LinearLayout and than check.

code-collaborator
tags question: http://stackoverflow.com/q/23131196
tag name: code-collaborator
type: Tag

http://stackoverflow.com/comment/35461003
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23185350
score: 0
has text: @user3527318 Please google for a JFrame application tutorial.

http://stackoverflow.com/comment/35369031
type: AnswerComment
type: Comment
score: 1
comment on: http://stackoverflow.com/a/23133701
has text: Your first statement is incorrect. There is a relatively high probability that the same string object is used for two equal character sequences but it is not guaranteed. `"A" == "A"` can be false.

http://stackoverflow.com/comment/35510862
type: AnswerComment
comment on: http://stackoverflow.com/a/23213580
type: Comment
has text: so what should i set length condition in the loop to? length() - 1 ?
score: 0

http://stackoverflow.com/a/23188007
score: 0
answers question: http://stackoverflow.com/q/23187843
type: AcceptedAnswer
type: Answer
has body: I solved my problem by changing the exception type I am catching from ClassNotFoundException to Throwable.
accepted answer of: http://stackoverflow.com/q/23187843

http://stackoverflow.com/q/23256026
answer count: 1
has comment: http://stackoverflow.com/comment/35588006
has title: Concurrency : full collection or element
type: AnsweredQuestion
has body: I have collections that i need update every single second. I use for that ScheduledExecutorService. But i have question, do it's better give thread pool full collection or send each element of collection to thread pool?
tagged with: java
tagged with: concurrency
accepted answer: http://stackoverflow.com/a/23265606
type: Question
has comment: http://stackoverflow.com/comment/35587388
has comment: http://stackoverflow.com/comment/35587538
has answer: http://stackoverflow.com/a/23265606
score: 0
has comment: http://stackoverflow.com/comment/35588251
has comment: http://stackoverflow.com/comment/35588344

http://stackoverflow.com/q/23202827
has comment: http://stackoverflow.com/comment/35491979
favorite count: 0
tagged with: nullpointerexception
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35491709
has comment: http://stackoverflow.com/comment/35491835
has comment: http://stackoverflow.com/comment/35492519
has title: Receiving a java.lang nullpointer exception error in Processing
score: 1
tagged with: java
upvote count: 1
has body: I am receiving a java.lang nullpointer exception in my processing project, I think it has something to do with the cDistance but I'm not quite sure. I've moved some stuff around and am still getting this error. If anyone has an idea of where I went wrong it would be much appreciated. class Ball { int xpos, ypos; int ballDiam; color myColor; boolean visible = true; Ball(int tempdiam, color tempColor) { ballDiam=tempdiam; myColor=tempColor; } void update() { if (visible) { fill(myColor); ellipse(xpos, ypos, ballDiam, ballDiam); } } } Ball hole, gball;//declare a ball object for the golfball and the hole float cDistance = dist(gball.xpos, gball.ypos, hole.xpos, hole.ypos); int click;//to keep track of clicks String msg; int steps = 20; int difx, dify; Boolean moving = false; void setup() { msg=""; click=0; size(800, 400); hole= new Ball(50, #000000);//making the gball = new Ball(35, #ffffff); } void draw() { background(#009900); println("the click count is "+click); //set the hole ball as a golf hole right in the middle of the green hole.xpos = width/2; hole.ypos = height/2; hole.update(); if (click==0) { //when no click has happened make the gball ball follow the mouse, //after the click the ball will stay at the last position gball.xpos=mouseX; gball.ypos=mouseY; msg="please place the golf ball"; } else if (click==1) {//prompt the user to click again to shoot msg="now click again to shoot"; difx = gball.xpos-hole.xpos; dify = gball.ypos-hole.ypos; } else if (click==2) { cDistance = dist(gball.xpos, gball.ypos, hole.xpos, hole.ypos); if (cDistance&gt;hole.ballDiam/2) { moving = true; gball.xpos-=difx/steps; gball.ypos-=dify/steps; gball.xpos+=5; } else { moving = false; gball.visible=false; click=3; } } gball.update(); textSize(20); text(msg, 0, height-5); } void mouseClicked() { if (!moving) { click++; } } The stacktrace: java.lang.RuntimeException: java.lang.NullPointerException at processing.core.PApplet.runSketch(PApplet.java:10573) at processing.core.PApplet.main…
type: Question
tagged with: processing
has answer: http://stackoverflow.com/a/23203140
has answer: http://stackoverflow.com/a/23203114
tagged with: runtime-error
answer count: 2
downvote count: 0

http://stackoverflow.com/q/23129896
has title: Unable to instantiate an error in hive
type: Question
tagged with: hadoop
score: 0
answer count: 1
has body: Unable to instantiate org.apache.hadoop.hive.metastore.HiveMetaStoreClient I just installed hive on hbase and hadoop but when i try show databases and create table commands in the hive> prompt giving me the error as below: create database saty; FAILED: Error in metadata: java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.hive.metastore.HiveMetaStoreClient FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask please help me to create hive-site.xml and env-hive.sh config files .
has answer: http://stackoverflow.com/a/23133360
tagged with: hbase
type: UnansweredQuestion
tagged with: hive
tagged with: nosql
tagged with: java

http://stackoverflow.com/a/23167088
score: 0
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/23167006
answers question: http://stackoverflow.com/q/23167006
has body: Solution 1: Create object of MoviesPageTab1 and send and receive the data with the help of setter and getter functions. Solution 2: Use setArguments() method while loading the MoviesPageTab1 fragment. Solution 3: Use Callbacks for communication between the Fragment and its parent Activity.

http://stackoverflow.com/comment/35434079
type: QuestionComment
comment on: http://stackoverflow.com/q/23169557
has text: @Bratty You can call C/C++ from Java, in fact this is what Thread.sleep() does, can you explain what you mean?
score: 0
type: Comment

http://stackoverflow.com/comment/35585085
comment on: http://stackoverflow.com/a/23254684
has text: @Simplex Yes it does.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/35526725
comment on: http://stackoverflow.com/a/23219069
score: 0
has text: Math.random() is a static method, so an object doesn't have to be initialised. You probably don't have the object `random` initialised, so you can't call it's methods.
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/35500327
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23207093
has text: @John Ah, I feel stupid I converted the wrong thing
score: 0

http://stackoverflow.com/q/23143268
has body: I create a button that will onclick show in a separate window (like you see below) the list of all users from my database. But, they are displayed all in one line! Even though I put /n - it just wont work. I mean, it work in console when I use Sys.out but when I go to the Window and put it there it is all in one line :( What should I change in order to display all of the users one below another. public class ViewAll { private String listax = ""; ViewAll() throws ClassNotFoundException, InstantiationException, IllegalAccessException, SQLException{ ArrayList&lt;String[]&gt; allUsers = DbBroker.getArray("select * from user"); for(String[] usr : allUsers) listax += usr[0] + ")" + usr[1] + ", " + usr[2] + ", " + usr[3] + "\n"; } public void display() { JFrame lis = new JFrame("List of all users"); lis.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); lis.setLayout(new FlowLayout(FlowLayout.LEFT)); JPanel pane = new JPanel(new GridLayout(0,1)); lis.add(pane); pane.add(new JLabel("This is the complete list of all users in my db: ")); pane.add(new JLabel(listax)); lis.pack(); lis.setSize(500,400); lis.setVisible(true); }}
tagged with: jlabel
tagged with: jframe
type: UnansweredQuestion
tagged with: swing
has title: New line using JLabel and java variable from ArrayList
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/23143300
tagged with: arraylist
score: 0
answer count: 1

http://stackoverflow.com/q/23290189
upvote count: 3
tagged with: java
downvote count: 2
has comment: http://stackoverflow.com/comment/35650644
has body: I can't change the background color of a JFrame, or of a JPanel inside the JFrame, this is my code: public class MyFrame extends JFrame { public MyFrame(){ setSize(600,600); setResizable(false); panel = new MyPanel(); panel.setBackground(Color.BLACK); //getContentPane().setBackground(Color.BLACK); doesn't work getContentPane().add(panel); addWindowListener(new WindowAdapter(){ public void windowClosing(WindowEvent ev){ System.exit(-1); } public void windowClosed(WindowEvent ev){ System.exit(-1); } }); } public void paint(Graphics g){ super.paint(g); g.clearRect(0,0,600,600); synchronized (this){ if (positions!=null){ for (int i=0; i&lt;positions.length; i++){ P2d p = positions[i]; //int x0 = (int)(180+p.x*180); //int y0 = (int)(180-p.y*180); g.drawOval((int)p.x,(int)p.y,5,5); } } } } } i have tried in several ways, but I can not change the color, it's always white, how i can do?
tagged with: swing
linked to: http://stackoverflow.com/q/9029367
has answer: http://stackoverflow.com/a/23290622
has answer: http://stackoverflow.com/a/23290335
linked to: http://stackoverflow.com/q/7196889
duplicate of: http://stackoverflow.com/q/9029367
has comment: http://stackoverflow.com/comment/35650806
possible better answer: http://stackoverflow.com/a/23290335
answer count: 4
type: AnsweredQuestion
has title: How change background color of JFrame
has answer: http://stackoverflow.com/a/23290366
accepted answer: http://stackoverflow.com/a/23290622
score: 1
linked to: http://stackoverflow.com/q/18005505
favorite count: 0
has answer: http://stackoverflow.com/a/23290704
type: Question
tagged with: jframe
linked to: http://stackoverflow.com/q/9389187

http://stackoverflow.com/comment/45815601
type: Comment
comment on: http://stackoverflow.com/a/23476194
has text: SXSSFWorkbook cannot be used to read files, only to create new files. See the table on [POI website](https://poi.apache.org/spreadsheet/#SXSSF+%28Since+POI+3.8+beta3%29)
type: AnswerComment
score: 0

http://stackoverflow.com/comment/35397527
comment on: http://stackoverflow.com/q/23149289
score: 0
has text: Hi. Thanks for answering. I am writing the data to sdcard. The content length is -1 when I called getContentLength. Yes, I have set the permission WRITE_EXTERNAL_STORAGE.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35468554
type: QuestionComment
type: Comment
has text: I use tomcat container and use play2war plugin from declan to get the war which then hot deploys. Therefore, I cannot use start scripts as you would in production mode.
comment on: http://stackoverflow.com/q/23143955
score: 0

http://stackoverflow.com/comment/35440074
score: 0
type: Comment
has text: when I change it, diaries and _id complain that cannot be resolved to a variable....
comment on: http://stackoverflow.com/a/23173450
type: AnswerComment

http://stackoverflow.com/q/23275928
answer count: 1
type: UnansweredQuestion
tagged with: maven
tagged with: plugins
tagged with: java
tagged with: m2e
tagged with: eclipse
has answer: http://stackoverflow.com/a/23336670
type: Question
has body: We are using the m2e maven eclipse plugin (version 1.5.0.20140310-0533) for handling several projects/a multi-module project in Eclipse (version Kepler Service Release 2), respectivly. When changing the pom.xml of the projects, the projects mostly indicate an error, stating that "the project configuration is not up-to-date with pom.xml." However, when we update the project configuration by right-clicking on the project in the package explorer, an error window is shown: "Could not update project configuration Path must include project and resource name: /[Project name]". However, the project seems to be updated after performing this steps because the error disappears from the problems list of the project. How can one get rid of this annoying error message ("Could not update project configuration Path must include project and resource name: /[Project name]")?
has title: Annoying error message when updating m2e project
score: 0

http://stackoverflow.com/a/23215426
has body: In order to convert it to an instant you need to have a LocalDateTime instance, e.g.: LocalDate.now().atStartOfDay().toInstant(ZoneOffset.UTC)
has comment: http://stackoverflow.com/comment/35514947
has comment: http://stackoverflow.com/comment/121661454
has comment: http://stackoverflow.com/comment/136542731
score: 183
downvote count: 2
type: Answer
answers question: http://stackoverflow.com/q/23215299
upvote count: 185

http://stackoverflow.com/comment/35498208
score: 0
has text: If the member functions of Singleton that are context sensitive are few, you can try to use a `ThreadLocal` variable. If the variable is set, use the `ThreadLocal` context otherwise use the global context
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23206112

http://stackoverflow.com/comment/35504917
has text: i think you are going in the right direction :)
comment on: http://stackoverflow.com/q/23210049
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23260057
linked to: http://stackoverflow.com/q/20642673
has answer: http://stackoverflow.com/a/70783162
favorite count: 0
has comment: http://stackoverflow.com/comment/35595009
has answer: http://stackoverflow.com/a/76500853
has answer: http://stackoverflow.com/a/30223924
upvote count: 334
linked to: http://stackoverflow.com/q/3715967
has answer: http://stackoverflow.com/a/31719881
linked to: http://stackoverflow.com/q/33293930
has answer: http://stackoverflow.com/a/54784263
has answer: http://stackoverflow.com/a/52629580
has answer: http://stackoverflow.com/a/24001487
has answer: http://stackoverflow.com/a/53329802
has answer: http://stackoverflow.com/a/66818081
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/67112502
linked to: http://stackoverflow.com/q/20891108
has answer: http://stackoverflow.com/a/55742266
has answer: http://stackoverflow.com/a/55118294
has answer: http://stackoverflow.com/a/72799979
has answer: http://stackoverflow.com/a/63205759
has answer: http://stackoverflow.com/a/68407498
has comment: http://stackoverflow.com/comment/40550154
has title: The forked VM terminated without saying properly goodbye. VM crash or System.exit called
has answer: http://stackoverflow.com/a/50871537
tagged with: maven-surefire-plugin
has answer: http://stackoverflow.com/a/55403621
has comment: http://stackoverflow.com/comment/132164083
has answer: http://stackoverflow.com/a/26398738
has answer: http://stackoverflow.com/a/52033799
has answer: http://stackoverflow.com/a/77833320
has answer: http://stackoverflow.com/a/60023742
has answer: http://stackoverflow.com/a/79271194
has answer: http://stackoverflow.com/a/53385427
has answer: http://stackoverflow.com/a/40294442
has answer: http://stackoverflow.com/a/66801171
has answer: http://stackoverflow.com/a/77762980
has answer: http://stackoverflow.com/a/51708039
downvote count: 0
linked to: http://stackoverflow.com/q/46670582
tagged with: opendaylight
has answer: http://stackoverflow.com/a/67297758
has answer: http://stackoverflow.com/a/39287715
has comment: http://stackoverflow.com/comment/35594586
has answer: http://stackoverflow.com/a/53432511
has answer: http://stackoverflow.com/a/33757854
has answer: http://stackoverflow.com/a/58828764
tagged with: java
has answer: http://stackoverflow.com/a/51099769
has answer: http://stackoverflow.com/a/53247042
has body: Please help me to solve this issue. I do not exactly understand what the error in the log means. [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 21.749s [INFO] Finished at: Thu Apr 24 10:10:20 IST 2014 [INFO] Final Memory: 15M/37M [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.15:test (default-test) on project samples.simpleforwarding: Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:2.15:test failed: The forked VM terminated without saying properly goodbye. VM crash or System.exit called ? [ERROR] Command wascmd.exe /X /C ""C:\Program Files\Java\jdk1.7.0_55\jre\bin\java" -Xmx1024m -XX:MaxPermSize=256m -jar E:\OpenDayLight\controller\opendaylight\samples\simpleforwarding\target\surefire\surefirebooter53410321571238933.jar E:\OpenDayLight\controller\opendaylight\samples\simpleforwarding\target\surefire\surefire86076271125218001tmp E:\OpenDayLight\controller\opendaylight\samples\simpleforwarding\target\surefire\surefire_01846991116135903536tmp" [ERROR] -&gt; [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException
has answer: http://stackoverflow.com/a/69192199
has answer: http://stackoverflow.com/a/64613465
linked to: http://stackoverflow.com/q/46831762
has answer: http://stackoverflow.com/a/48140017
has answer: http://stackoverflow.com/a/38925634
has answer: http://stackoverflow.com/a/62631838
has answer: http://stackoverflow.com/a/73441577
has answer: http://stackoverflow.com/a/53078436
type: Question
has answer: http://stackoverflow.com/a/71220004
has comment: http://stackoverflow.com/comment/67326806
has answer: http://stackoverflow.com/a/39600836
score: 334
has answer: http://stackoverflow.com/a/58733352
has answer: http://stackoverflow.com/a/73881583
has answer: http://stackoverflow.com/a/35579151
has answer: http://stackoverflow.com/a/59615273
has answer: http://stackoverflow.com/a/41693994
has answer: http://stackoverflow.com/a/42995616
has comment: http://stackoverflow.com/comment/117265977
has answer: http://stackoverflow.com/a/64132709
has answer: http://stackoverflow.com/a/59143039
has answer: http://stackoverflow.com/a/28536501
has answer: http://stackoverflow.com/a/56809436
has answer: http://stackoverflow.com/a/50012107
has answer: http://stackoverflow.com/a/41871704
linked to: http://stackoverflow.com/q/53010200
has answer: http://stackoverflow.com/a/66842045

http://stackoverflow.com/q/23273252
has body: Is there any way to get the component ID for a component which also has a custom ID set? My use case is as follows: I have an installer with downloadable/external components and I want to display one of them in the GUI only if the .dat file is present in the installer layout. The problem is that the .dat file uses the component ID in its filename, whereas I have been using a custom ID throughout the installer in order to more easily identify each component. With a custom ID set, the getId() function returns said custom ID and not the regular one, so I can't use that in order to programatically build the component filename which is used to enable the component visibility in the GUI. Right now I'm using a workaround by not setting a custom ID for the components which I want invisible unless already present and then manually matching that ID with a particular component via its name (something like if(component.getName().equalsIgnoreCase("compName")) { context.setVariable("compNameID", component.getId()); }) and then using that compNameID variable in the rest of the scripts.
favorite count: 0
has answer: http://stackoverflow.com/a/23293769
upvote count: 1
type: AnsweredQuestion
has title: install4j - get component ID if customized ID set
tagged with: java
tagged with: install4j
type: Question
accepted answer: http://stackoverflow.com/a/23293769
answer count: 1
downvote count: 0
score: 1

http://stackoverflow.com/q/23278710
upvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/23278757
tagged with: static
possible better answer: http://stackoverflow.com/a/23278728
linked to: http://stackoverflow.com/q/3301635
has answer: http://stackoverflow.com/a/23278728
has answer: http://stackoverflow.com/a/23278796
answer count: 4
duplicate of: http://stackoverflow.com/q/3301635
tagged with: final
accepted answer: http://stackoverflow.com/a/23278757
downvote count: 1
has answer: http://stackoverflow.com/a/23278889
type: AnsweredQuestion
tagged with: java
score: -1
has title: Can final static change when referring to method?
type: Question
has body: Can the value of a final static field change when it refers to a method? For example, if you run the following code: private static final String example = Example.getExampleString(); Can the value of example change when the method getExampleString() returns something different?

http://stackoverflow.com/q/23156585
has answer: http://stackoverflow.com/a/23294426
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/23294426
possible better answer: http://stackoverflow.com/a/64805372
type: Question
has answer: http://stackoverflow.com/a/64805372
score: 102
has title: Process Thymeleaf variable as HTML code and not text
has answer: http://stackoverflow.com/a/75540688
tagged with: thymeleaf
answer count: 3
has body: I'm using Thymeleaf to process html templates, I understood how to append inline strings from my controller, but now I want to append a fragment of HTML code into the page. For example, lets stay that I have this in my Java application: String n=""+str+" \n"; final WebContext ctx = new WebContext(request, response, servletContext, request.getLocale()); ctx.setVariable("n", n); What do I need to write in the HTML page so that it would be replaced by the value of the n variable and be processed as HTML code instead of it being encoded as text?
downvote count: 0
favorite count: 0
upvote count: 102

http://stackoverflow.com/comment/35554735
type: Comment
type: QuestionComment
score: 0
has text: Could you list all files in deployed web(war) archive. I have created new project (in IntelliJ IDEA) with your sources and it works on Tomcat 8.0.3. Possibly your web.xml is missing or is in invalid directory.
comment on: http://stackoverflow.com/q/23236879

http://stackoverflow.com/comment/35640333
type: QuestionComment
comment on: http://stackoverflow.com/q/23284450
has text: Consider this first two set of data is in One XML file and other line in another XML... So I want compare this two file and print the uncommon things which is present in one file and not in other... I'm able to read the two file now I want to filter out? Using regular expression can I do??? HOw?? Coz Mozilla/4.0 ---- AND/OR are common things.. So I thought of using regular expression... So that I don't need to write all things in one of the XML... I'm thinking of useing like this... for EX: Mozilla/[0-9].0 (compatible; MSIE 6.0; Windows NT 5.0;) [A-Z] 1=1 -- Help me in solving this..
score: 0
type: Comment

http://stackoverflow.com/q/23290543
has comment: http://stackoverflow.com/comment/35651271
tagged with: multithreading
has body: I'm making a simple server-client application. I'm handling the message queue this way (class MessageQueue): private Vector&lt;String&gt; messages; //Runs from any thread public void add(String message) { synchronized(messages) { messages.add(message); //This is only way to unstuck messages.wait() messages.notifyAll(); } } //Runs from special thread private void readQueue() { Log.debug("Waiting for messages to send."); while(run) { synchronized(messages) { //STUCK HERE! try {messages.wait();}catch(InterruptedException e) {} //send messages ... } } } I designed the code using this answer, but it's wrong or I haven't interpreted it correctly. Here's what happens: Thread readQueue starts. Thread readQueue blocks messages by synchronized block. Thread readQueue blocks itself on messages.wait(). Another thread calls add("...") method. Another thread gets stuck on synchronized block. The messages.notifyAll() can never be called. Of course, originally, before searching, I was trying to do this: //Runs from special thread private void readQueue() { Log.debug("Waiting for messages to send."); while(run) { //Wait before getting noticed of new message try {messages.wait();}catch(InterruptedException e) {} //Block messages, read them, clear them synchronized(messages) { //send messages ... } } } This throws illegal monitor exception, which forces me to put wait into synchronized - and we're just where we begun - stuck.
has comment: http://stackoverflow.com/comment/35665175
linked to: http://stackoverflow.com/q/289434
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/139235228
upvote count: 0
tagged with: java
score: -1
has comment: http://stackoverflow.com/comment/35651160
type: Question
has answer: http://stackoverflow.com/a/23290838
answer count: 2
has answer: http://stackoverflow.com/a/23297080
accepted answer: http://stackoverflow.com/a/23297080
has title: Make a blocking thread for message queue
possible better answer: http://stackoverflow.com/a/23290838
downvote count: 1
linked to: http://stackoverflow.com/q/1537116
favorite count: 0

http://stackoverflow.com/comment/35620931
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23273889
has text: @Joshua Moore Then why it is able to pick the session when I hit the url directly in the browser?
score: 0

http://stackoverflow.com/a/23191304
accepted answer of: http://stackoverflow.com/q/23191155
type: Answer
answers question: http://stackoverflow.com/q/23191155
upvote count: 4
score: 4
type: AcceptedAnswer
downvote count: 0
has body: Your biggest problem is you are not resetting you vowels counting variable when you test a new word. The value just keeps accumulating the total vowels in the file. Change: int vowels = 0; while(input.hasNextLine()) { ... to: while(input.hasNextLine()) { int vowels = 0; ... As an aside, most of your code, including the isVowel() method, could be eliminated with a single line: int vowels = word.replaceAll("[^aeiouAEIOU]", "").length(); This works by eliminating from the word all characters that aren't vowels; what's left are the vowels, so just take the length to get the count.

dayofweek
type: Tag
tags question: http://stackoverflow.com/q/23137404
tag name: dayofweek

arraylist
tags question: http://stackoverflow.com/q/23197923
tags question: http://stackoverflow.com/q/23206603
tags question: http://stackoverflow.com/q/23173875
tags question: http://stackoverflow.com/q/23216463
tags question: http://stackoverflow.com/q/23218248
tags question: http://stackoverflow.com/q/23193996
tags question: http://stackoverflow.com/q/23160112
tags question: http://stackoverflow.com/q/23181358
tags question: http://stackoverflow.com/q/23228332
tags question: http://stackoverflow.com/q/23285005
tags question: http://stackoverflow.com/q/23148486
tags question: http://stackoverflow.com/q/23204608
tags question: http://stackoverflow.com/q/23286202
tags question: http://stackoverflow.com/q/23249372
tags question: http://stackoverflow.com/q/23284722
tags question: http://stackoverflow.com/q/23178238
tags question: http://stackoverflow.com/q/23222654
tags question: http://stackoverflow.com/q/23233386
tags question: http://stackoverflow.com/q/23169600
tags question: http://stackoverflow.com/q/23137555
tags question: http://stackoverflow.com/q/23161769
tags question: http://stackoverflow.com/q/23214088
tags question: http://stackoverflow.com/q/23238725
tags question: http://stackoverflow.com/q/23208416
tags question: http://stackoverflow.com/q/23162219
tags question: http://stackoverflow.com/q/23138636
tags question: http://stackoverflow.com/q/23212754
tags question: http://stackoverflow.com/q/23134737
tags question: http://stackoverflow.com/q/23191190
tags question: http://stackoverflow.com/q/23197525
tags question: http://stackoverflow.com/q/23235129
tags question: http://stackoverflow.com/q/23280821
tags question: http://stackoverflow.com/q/23245386
tags question: http://stackoverflow.com/q/23140189
tags question: http://stackoverflow.com/q/23240665
tags question: http://stackoverflow.com/q/23253527
tags question: http://stackoverflow.com/q/23263296
tags question: http://stackoverflow.com/q/23214677
tags question: http://stackoverflow.com/q/23205392
tags question: http://stackoverflow.com/q/23170999
tags question: http://stackoverflow.com/q/23204309
tags question: http://stackoverflow.com/q/23207700
tags question: http://stackoverflow.com/q/23241098
tags question: http://stackoverflow.com/q/23207432
tags question: http://stackoverflow.com/q/23281531
tags question: http://stackoverflow.com/q/23277836
tags question: http://stackoverflow.com/q/23258879
tags question: http://stackoverflow.com/q/23203872
tags question: http://stackoverflow.com/q/23198081
tags question: http://stackoverflow.com/q/23235475
tags question: http://stackoverflow.com/q/23251162
tags question: http://stackoverflow.com/q/23265157
tags question: http://stackoverflow.com/q/23186502
tags question: http://stackoverflow.com/q/23150397
tags question: http://stackoverflow.com/q/23146492
tags question: http://stackoverflow.com/q/23215933
tags question: http://stackoverflow.com/q/23172397
tags question: http://stackoverflow.com/q/23273985
tags question: http://stackoverflow.com/q/23143268
tags question: http://stackoverflow.com/q/23239393
tags question: http://stackoverflow.com/q/23260184
tags question: http://stackoverflow.com/q/23240238
tags question: http://stackoverflow.com/q/23159016
tags question: http://stackoverflow.com/q/23288439
tags question: http://stackoverflow.com/q/23133954
tags question: http://stackoverflow.com/q/23278685
tags question: http://stackoverflow.com/q/23171037
tags question: http://stackoverflow.com/q/23240307
tags question: http://stackoverflow.com/q/23235259
tags question: http://stackoverflow.com/q/23229124
tags question: http://stackoverflow.com/q/23206810
tags question: http://stackoverflow.com/q/23152199
tags question: http://stackoverflow.com/q/23234480
tags question: http://stackoverflow.com/q/23194290
tags question: http://stackoverflow.com/q/23182737
tags question: http://stackoverflow.com/q/23206900
tags question: http://stackoverflow.com/q/23233925
tags question: http://stackoverflow.com/q/23227678
tags question: http://stackoverflow.com/q/23218917
tags question: http://stackoverflow.com/q/23157274

http://stackoverflow.com/a/23245705
upvote count: 2
accepted answer of: http://stackoverflow.com/q/23245603
answers question: http://stackoverflow.com/q/23245603
has body: You shouldn't just add things because someone tells you to; you should add them when they're a requirement. As your code is right now, it simply constructs your Cars (keep in mind that an object is typically singular, not plural) object through the constructor. If you never want to be able to change the properties of a car after it has been created then you're fine as it is. A setter is there to provide manipulating access to the backing field. If you don't need or want this, then you shouldn't add it. Sidenote: it might still be a good idea to add it but make it private instead. If you want validation logic (for example to check that the price is not negative), then this should be done through a setter.
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/35568439
type: Answer
score: 2

http://stackoverflow.com/comment/35669279
type: AnswerComment
has text: Great answer, thanks. I beleive I remember reading somewhere about speed and setRGB, but im sure it wont slow me down that bad. Im trying to edit the pixels so as to draw some 3d graphics eventualy, I have all the formulas for 3d graphics, but no way to put that data on the screen. That's why im asking how to edit pixels. The 2d graphics API is an exellent Idea. Ill go check if it can draw triangles now... Thanks Again!
type: Comment
comment on: http://stackoverflow.com/a/23257622
score: 0

http://stackoverflow.com/comment/35533514
type: AnswerComment
has text: I was connecting to 8081 when 8443 was the HTTPS port
type: Comment
comment on: http://stackoverflow.com/a/23202257
score: 0

http://stackoverflow.com/comment/35569031
comment on: http://stackoverflow.com/a/23244360
has text: Actually is not Hibernate, is the data format in Java. Please check: http://docs.oracle.com/javase/7/docs/api/java/text/DateFormat.html
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/23190082
tagged with: java
has answer: http://stackoverflow.com/a/23190278
has comment: http://stackoverflow.com/comment/35469565
type: Question
has answer: http://stackoverflow.com/a/23190195
has comment: http://stackoverflow.com/comment/35469590
has answer: http://stackoverflow.com/a/23190183
score: 0
has comment: http://stackoverflow.com/comment/35469541
tagged with: android
has body: I try to check user input on my EditText, if there's one or more null value, the validation image will be changed into red color and it the page will be not moved until all field is filled. I'm using multiple if statement with different conditions in my case but I get a problem, when I input into two EditText and another EditText is null, the page move from current page into new page, when it should not be moved. this is my code : if (nama_pp.getText().toString().length()==0){img_namalengkap_pp.setImageResource(R.drawable.espaj_red_checklist);} if (ibu_pp.getText().toString().length()==0){img_namaibu_pp.setImageResource(R.drawable.espaj_red_checklist);} if (nomor_bukti_pp.getText().toString().length()==0){img_nomeridentitas_pp.setImageResource(R.drawable.espaj_red_checklist);} if (tempat_pp.getText().toString().length()==0){img_tempat_pp.setImageResource(R.drawable.espaj_red_checklist);} if (ttl_pp.getText().toString().length()==0){img_tgllahir_pp.setImageResource(R.drawable.espaj_red_checklist);} if (alamat_pp.getText().toString().length()==0){img_alamat_pp.setImageResource(R.drawable.espaj_red_checklist);} if (kota_pp.getText().toString().length()==0){img_kota_pp.setImageResource(R.drawable.espaj_red_checklist);} if (kdtlp1_pp.getText().toString().length()==0){img_telepon_pp.setImageResource(R.drawable.espaj_red_checklist);} if (telp1_pp.getText().toString().length()==0){img_telepon_pp.setImageResource(R.drawable.espaj_red_checklist);} else { getFragmentManager().beginTransaction().replace(R.id.frame_container, new TertanggungPolis()).setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN).commit(); } is there a faster way to code things like that and the best solution for my problem? thank you very much.
accepted answer: http://stackoverflow.com/a/23190183
favorite count: 0
has comment: http://stackoverflow.com/comment/35469537
has answer: http://stackoverflow.com/a/23190139
upvote count: 2
answer count: 5
has comment: http://stackoverflow.com/comment/35469615
downvote count: 2
possible better answer: http://stackoverflow.com/a/23190141
has title: multiple if statement with different conditions
has answer: http://stackoverflow.com/a/23190141
type: AnsweredQuestion
tagged with: if-statement

http://stackoverflow.com/q/23200520
has comment: http://stackoverflow.com/comment/35487545
has answer: http://stackoverflow.com/a/23210468
has body: So I wrote this loop but I'm having trouble analyzing its worst case time complexity. Any help would greatly be appreciated . factor is any arbitrary number primeNumber is a list of prime numbers between 2 and the original value of factor for (int i = 0; i &lt; primeNumbers.size() - 1; i++) { prime = primeNumbers.get(i); if(prime&lt;=factor) { if (factor % prime == 0) { factor = factor / prime; divisors.add(prime); i = 0; } if (factor &lt;= 3) break; } else break; }
has title: Worst case Analysis On a loop
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/35487255
has comment: http://stackoverflow.com/comment/35487799
tagged with: complexity-theory
type: UnansweredQuestion
tagged with: time
has answer: http://stackoverflow.com/a/23201101
has comment: http://stackoverflow.com/comment/35487549
tagged with: java
tagged with: analysis
type: Question
has comment: http://stackoverflow.com/comment/35487233
has comment: http://stackoverflow.com/comment/35487341

http://stackoverflow.com/comment/35438947
score: 0
type: AnswerComment
type: Comment
has text: I used val2 since I have to put val[2] values in it and redirect it in JComboBox.
comment on: http://stackoverflow.com/a/23172833

http://stackoverflow.com/comment/35569557
has text: You seem to have both a method named height() and a member variable named height, and you use them interchangeably in your set/get methods.
type: Comment
comment on: http://stackoverflow.com/q/23196214
score: 0
type: QuestionComment

http://stackoverflow.com/a/23195937
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/23195760
upvote count: 2
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23195760
has comment: http://stackoverflow.com/comment/35479370
has body: Use the below code Please us the below code. @Override public void onTabSelected(Tab tab, FragmentTransaction arg1) { int position = tab.getPosition(); switch(position){ case 0: //code for test break; case 1: //code for chat break; } }
type: Answer

http://stackoverflow.com/q/23285317
has body: I have tried reviewing old threads about this topic but none of the solutions seem to work for me. I have trying to write to a .txt file named "receipt.txt" but with the following code I am getting nothing. No file created (and obviously nothing in the file that doesn't exist) no errors just nothing. //Write to File String fileName = "receipt.txt"; try{ PrintWriter writer = new PrintWriter(fileName); writer.println("Thank you for shopping with us"); writer.println("Name: " + customerName); writer.println("Returning Customer: " + previousCustomer ); writer.println("Phone: " + phoneNumber); writer.println("Shirt Type: " + shirtType); writer.println("Shirt Color: " + shirtColor); writer.println("Shirt Material: " + shirtMaterial); writer.println("Item Amount: " + itmAmt); writer.println("Total Cost: " + fmt3.format(totalCostMsg)); writer.close(); writer.flush(); System.out.println("Receipt printed"); } catch (FileNotFoundException e) { e.printStackTrace(); }
accepted answer: http://stackoverflow.com/a/23285325
score: 0
has answer: http://stackoverflow.com/a/23285325
has title: PrintWriter wont write to .txt file
has answer: http://stackoverflow.com/a/23285335
tagged with: printwriter
type: AnsweredQuestion
tagged with: java
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/23285335

http://stackoverflow.com/a/23270242
upvote count: 1
type: Answer
downvote count: 0
score: 1
has body: Always add JTextArea to JScrollPane otherwise it will create a problem when the no of rows in text area is greater than frame's height. JScrollPane jScrollPane=new JScrollPane(messagesTextArea); container.add(jScrollPane, gc); and try gc.fill=GridBagConstraints.BOTH; gc.weighty=0.9; gc.weightx=0.8; use weighty and weightx to set the size in percent of the component. use fill to fill all the available space either horizontally or vertically or both. For more info have a look at How to Use GridBagLayout
accepted answer of: http://stackoverflow.com/q/23269966
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23269966

http://stackoverflow.com/comment/35379808
has text: Which line is line 95 of `PropertyView`
score: 1
comment on: http://stackoverflow.com/q/23139364
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/35443350
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23164130
has text: I see thank you for your explanation! Sorry I can't upvote (I think) because my points are so low
type: Comment

http://stackoverflow.com/q/23172436
has answer: http://stackoverflow.com/a/23267195
type: Question
has title: Android - AndEngine Apply Force
tagged with: java
tagged with: andengine
score: 0
answer count: 1
type: UnansweredQuestion
tagged with: android
has body: I'm using AndEngine and Box2d in android application. What do I have to do so that when pushing the "leftArrow" and "rightArrow" buttons, the player doesn't start moving too fast because of the too frequent call of the "Update Handler" method? I want the player to move constantly with the same speed. //same for leftArrow Sprite rightArrow = new Sprite(...) { @Override public boolean onAreaTouched(TouchEvent pSceneTouchEvent, float pTouchAreaLocalX, float pTouchAreaLocalY) { if(pSceneTouchEvent.isActionDown()) { goRight = true; } else if(pSceneTouchEvent.isActionUp()) { goRight = false; } return true; } }; private IUpdateHandler UpdateHandler = new IUpdateHandler(){ @Override public void onUpdate(float pSecondsElapsed) { if(goLeft) { playerBody.applyForce(-50, 0, body.getWorldCenter().x, body.getWorldCenter().y); } if(goRight){ playerBody.applyForce(50, 0, body.getWorldCenter().x, body.getWorldCenter().y); } } };

http://stackoverflow.com/comment/35509354
comment on: http://stackoverflow.com/q/23212752
score: 0
type: Comment
type: QuestionComment
has text: Please read about 'Pass by Value' and 'Pass by Reference'. That would answer your question. http://stackoverflow.com/questions/373419/whats-the-difference-between-passing-by-reference-vs-passing-by-value

http://stackoverflow.com/comment/35442020
type: AnswerComment
has text: yes, is true but if in your java program, you define result double so think that in you database the type of column is something decimal
type: Comment
score: 1
comment on: http://stackoverflow.com/a/23174305

http://stackoverflow.com/q/23276597
type: AnsweredQuestion
upvote count: 0
tagged with: java
type: Question
tagged with: algorithm
possible better answer: http://stackoverflow.com/a/23276675
tagged with: sorting
score: -1
answer count: 2
tagged with: for-loop
has comment: http://stackoverflow.com/comment/35629179
downvote count: 1
has body: I am working on a benchmarking assignment for various algorithms. The requirements are to run the programs with successive data sets of random integers totaling 10,000, 20,000, 100,000, 200,000, 1,000,000 respectively. I have written the programs so that I can manually input the data set sizes, but, I would prefer to use a loop to run the program once and automatically input the different data sets. I'm not really sure how to go about doing this; any advice is appreciated. Thanks in advance. package bubble.sort; public class BubbleSort { public static void main(String[] arg) throws Exception{ int array[] = new int [1000]; int i; for (int k = 1; k&lt;= 100; k++){ for (i=0;i&lt;array.length;i++){ //for loop that will populate array with random numbers array[i] = 1 + (int)(Math.random() * 10); }//end for loop // get the start time in nanoseconds long startTime = System.nanoTime(); //call mergesort to sort the entire array bubbleSort(array); // get the end time in nanoseconds long endTime = System.nanoTime(); // calculate elapsed time in nanoseconds long duration = endTime - startTime; // print the elapsed time in seconds (nanaoseconds/ 1 billion) System.out.printf("%12.8f %n", (double)duration/100000000) ; } } public static void bubbleSort( int [ ] array){ int temp = 0; for (int i = 0; i &lt; array.length; i++) { for (int j = 1; j &lt; (array.length - i); j++) { if (array[j - 1] &gt; array[j]) { temp = array[j - 1]; array[j - 1] = array[j]; array[j] = temp; } } } } }
favorite count: 0
has answer: http://stackoverflow.com/a/23276702
accepted answer: http://stackoverflow.com/a/23276702
has answer: http://stackoverflow.com/a/23276675
has title: Creating arrays with successive numbers of integers for benchmarking purposes using sorting algorithms

executorservice
type: Tag
tags question: http://stackoverflow.com/q/23235826
tag name: executorservice
tags question: http://stackoverflow.com/q/23232107
tags question: http://stackoverflow.com/q/23278399
tags question: http://stackoverflow.com/q/23151988
tags question: http://stackoverflow.com/q/23225648
tags question: http://stackoverflow.com/q/23198220
tags question: http://stackoverflow.com/q/23251241
tags question: http://stackoverflow.com/q/23204728

http://stackoverflow.com/q/23208203
has comment: http://stackoverflow.com/comment/53571615
has comment: http://stackoverflow.com/comment/35501747
downvote count: 1
has comment: http://stackoverflow.com/comment/54022638
favorite count: 0
has title: Netbeans 8.0 Unsupported major.minor version 52.0 error
tagged with: netbeans
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/46322109
upvote count: 4
has comment: http://stackoverflow.com/comment/35501802
has answer: http://stackoverflow.com/a/63803574
linked to: http://stackoverflow.com/q/32199584
score: 3
tagged with: java
has comment: http://stackoverflow.com/comment/35501656
has comment: http://stackoverflow.com/comment/120000783
type: Question
linked to: http://stackoverflow.com/q/22489398
answer count: 2
has body: I am having a problem with compiled .jar projects in netbeans. I recently upgraded to java 1.8 and netbeans 8.0. After updating every project I compile and put onto my server running java 1.7.0_55 I get the "Unsupported major.minor version 52.0" issue. I know this is due to incompatible java versions. I have tried changing the jdk used for building everywhere I can find it. I have tried building with 1.7.0_55 and 1.7.0_07 and still get this issue. Does anyone know what I am missing? Each time I have changed the build settings I make sure to recompile the project. It is not possible to update the version of java on the server just yet.

http://stackoverflow.com/a/23215097
has comment: http://stackoverflow.com/comment/35513637
answers question: http://stackoverflow.com/q/23214891
downvote count: 0
has body: The reason - The current thread is not the owner of the object's monitor.To call wait() method the current thread must own this object's monitor. In your case you are obtaining monitor on monitor object instead current object(this object).
type: Answer
has comment: http://stackoverflow.com/comment/35514156
upvote count: 1
score: 1

http://stackoverflow.com/comment/35402266
comment on: http://stackoverflow.com/q/23152199
has text: Something's wrong here: `for (int j=0; j<= columns; j++) row[j-1] = result.getString(j);` I believe `j` should start from 1.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23210860
accepted answer of: http://stackoverflow.com/q/23210218
upvote count: 2
type: AcceptedAnswer
has body: As any SQL resource you can prefix procedure name with schema name: "{call schema.TEST_PROC(?,?)}"
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/23210218

http://stackoverflow.com/q/23207981
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35501404
has title: Sending protobuf serialized object from c# to java server not working?
score: 1
possible better answer: http://stackoverflow.com/a/23211168
tagged with: protobuf-net
upvote count: 1
type: Question
tagged with: c#
has answer: http://stackoverflow.com/a/23211168
tagged with: java
has comment: http://stackoverflow.com/comment/35506347
answer count: 2
downvote count: 0
favorite count: 0
tagged with: serialization
has answer: http://stackoverflow.com/a/23212451
accepted answer: http://stackoverflow.com/a/23212451
tagged with: sockets
has body: I have simple c# client app which sends object to java based server app. Note:I am using protobuf-net on clinet side. For this application I have simple .proto file with only one field and .java class is generated by protoc compiler. .Proto file: message Person { required string id = 1; } C# client to send object MemoryStream ms = new MemoryStream(); Person per = new Person(); per.id = "TestId001"; Serializer.Serialize&lt;Person&gt;(ms, per); byte[] buffer = ms.ToArray(); clientSocket.SendTo(buffer, hostEP); Java based server to receive object DataInputStream inputStream=new DataInputStream(socket.getInputStream()); Person person = Person.parseFrom(socket.getInputStream()); System.out.println("Id: " + person.getId()); Problem: I not getting the serialized message as sent by the c# app.Even I am not getting any errors. That's why I was unable to figureout the problem.

http://stackoverflow.com/comment/35530088
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23224287
has text: By clearing do you mean deleting it? Or in any other way.

http://stackoverflow.com/a/23268200
has comment: http://stackoverflow.com/comment/35610068
type: Answer
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/35609796
has comment: http://stackoverflow.com/comment/35609513
has comment: http://stackoverflow.com/comment/35609463
upvote count: 2
accepted answer of: http://stackoverflow.com/q/23268045
type: AcceptedAnswer
has body: Different problems may be at play. Encoding: You are putting Arabic text in your source code. If you save your Java file using the wrong encoding, that text will become corrupt. If you compile your Java file using the wrong encoding, that text will become corrupt. And so on. I hope you get the idea. Store literal text like this: "لورانس العرب" to avoid problems like this. As documented in Chapter 11 of my book, right-to-left writing and Arabic ligatures are only supported in the context of PdfPCell and ColumnText. I see that you're using PdfPCell, but I don't see you using cell.setRunDirection(PdfWriter.RUN_DIRECTION_RTL); anywhere. That's wrong. You are using an object fontNormal, but you're not telling us which font you're actually using. For instance: if you're using the standard Type1 font Helvetica, no text will show up, because Helvetica doesn't know how to render Arabic text. Amendment: You've now updated your question, showing that you're using "arialuni.ttf". However, you are using the wrong encoding: CP1252 is the encoding for the Latin Alphabet. You should use BaseFont.IDENTITY_H. Update: looking at the update of your question as well as the extra comment, I see two major errors. You are assuming that the name of the font is "arialuni.ttf". That's the font file, but not the font name. Also: you are asking the FontFactory for this font, but did you tell the FontFactory where to look for fonts? Are you sure the FontFactory can locate c:/windows/fonts/ or whatever directory the file arialuni.ttf is stored. You are declaring a font, but you're not using it: Paragraph p = new Paragraph("حيسو"); creates a Paragraph using the default font. This is code that works: BaseFont bf = BaseFont.createFont( "c://windows/fonts/arialuni.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED); Font font = new Font(bf, 8); PdfPTable table = new PdfPTable(1); PdfPCell cell = new PdfPCell(new Phrase("حيسو", font)); cell.setRunDirection(PdfWriter.RUN_DIRECTION_RTL); table.addCell(cell); …
answers question: http://stackoverflow.com/q/23268045

http://stackoverflow.com/comment/35562758
comment on: http://stackoverflow.com/a/23242507
type: AnswerComment
has text: thanks for your answer, be so kind as to write an example, as I make the changes, and gives me error. @GET @Path("{year}") @Produces({"application/xml", "application/json"}) public Users.findByYear(@PathParam("year") Integer id) { return super.find(year);
score: 0
type: Comment

http://stackoverflow.com/q/23181943
tagged with: java
type: Question
score: 0
has title: How to make text pane accept pastes but block typing
has comment: http://stackoverflow.com/comment/35456273
has comment: http://stackoverflow.com/comment/35458743
answer count: 1
has answer: http://stackoverflow.com/a/23191365
accepted answer: http://stackoverflow.com/a/23191365
has body: My Goal is : having a text pane where user can paste text only(with OS not a button!!!) and can't type in to the pane because: can't have submit button (this is a must requirement - I know that it's not logical) after pasting: the text-pane becomes not editable for user, and the program will change background at specific chars. after button "clear filed" pressed - the program clears the pane and returns to initial state My Problem: How to make text pane accept pastes but block typing so far I made only JPanel with the text pane itself and all the controls will be in different JPanel public class textPanel extends JPanel{ private JTextPane text; public textPanel () { setLayout(new BorderLayout()); text = new JTextPane(); //12,81 text.setBorder(BorderFactory.createLoweredBevelBorder()); add(text,BorderLayout.CENTER); StyledDocument doc = text.getStyledDocument(); setBackground(Color.LIGHT_GRAY); setPreferredSize(new Dimension(1000, 210)); } thanks for help
tagged with: jtextpane
tagged with: swing
has comment: http://stackoverflow.com/comment/35458447
type: AnsweredQuestion

http://stackoverflow.com/q/23166972
tagged with: java
tagged with: listview
type: Question
has answer: http://stackoverflow.com/a/23167028
answer count: 1
score: 0
tagged with: android
has comment: http://stackoverflow.com/comment/35428888
type: UnansweredQuestion
has body: I am using this tutorial as reference: http://www.learn2crack.com/2013/10/android-custom-listview-images-text-example.html Instead of the predefined values i used values from a database Mainactivity.java package com.example.listview1; import android.os.Bundle; import android.view.View; import android.widget.AdapterView; import android.widget.ListView; import android.widget.Toast; import android.app.Activity; public class MainActivity extends Activity { ListView list; datamanager dm; String[] web; int[] imageId; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); dm=new datamanager(this); list=(ListView)findViewById(R.id.list); web=dm.getNames("Books"); imageId=getID(); CustomList adapter = new CustomList(MainActivity.this, web, imageId); list.setAdapter(adapter); list.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) { Toast.makeText(MainActivity.this, "You Clicked at " +web[+ position], Toast.LENGTH_SHORT).show(); } }); } public int[] getID() { int[] id=null; String[] str=dm.getID("Books"); for(int i=0;i&lt;str.length;i++) { id[i]=getResources().getIdentifier(str[i] , "drawable", getPackageName()); } return id; } } datamanager.java package com.example.listview1; import java.util.ArrayList; import android.content.Context; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteOpenHelper; public class datamanager { SQLiteDatabase DB1; private final String Db_NAME = "dbshopkart.db"; private final int DB_VERSION =3; Context c1; public datamanager(Context c) { c1=c; openingclass o=new openingclass(c); DB1=o.getWritableDatabase(); } public class openingclass extends SQLiteOpenHelper { public openingclass(Context c) { super(c,Db_NAME, null, DB_VERSION); } @Override public void onCreate(SQLiteDatabase arg0) { } @Overrid…
has title: Creating a custom listview using data from database

http://stackoverflow.com/comment/35421438
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23162807
has text: Note the stack trace: `(Cards.java:18)`, the `Cards.java` is the file with the exception, and the `18` is the line number it occurs on.
score: 0

http://stackoverflow.com/comment/35430458
type: QuestionComment
comment on: http://stackoverflow.com/q/23168001
type: Comment
has text: Grid view is grid view, but you want to set center align in your subviews of this grid view. What adapter you are using to populate?
score: 0

http://stackoverflow.com/comment/35497498
comment on: http://stackoverflow.com/q/23205997
has text: This is called polymorphism and no you don't have to downcast.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35599125
type: Comment
comment on: http://stackoverflow.com/a/23262256
has text: Are you deploying the wars directly or are you deploying them in ears?
score: 0
type: AnswerComment

http://stackoverflow.com/a/23236451
has comment: http://stackoverflow.com/comment/134681052
downvote count: 0
has comment: http://stackoverflow.com/comment/35552687
has comment: http://stackoverflow.com/comment/98955766
has comment: http://stackoverflow.com/comment/79861160
upvote count: 51
type: Answer
has comment: http://stackoverflow.com/comment/98956501
has body: You cannot mock a local variable. What you could do, however, is extract its creation to a protected method and spy it: public class A { public void methodOne(int argument) { //some operations methodTwo(int argument); //some operations } private void methodTwo(int argument) { DateTime dateTime = createDateTime(); //use dateTime to perform some operations } protected DateTime createDateTime() { return new DateTime(); } } public class ATest { @Test public void testMethodOne() { DateTime dt = new DateTime (/* some known parameters... */); A a = Mockito.spy(new A()); doReturn(dt).when(a).createDateTime(); int arg = 0; // Or some meaningful value... a.methodOne(arg); // assert the result }
answers question: http://stackoverflow.com/q/23236338
score: 51
has comment: http://stackoverflow.com/comment/98956545
has comment: http://stackoverflow.com/comment/79861236

http://stackoverflow.com/comment/35441861
has text: I have a nullpointerexceptor error when I try to type in the labID when running the program.
comment on: http://stackoverflow.com/a/23174307
score: 0
type: AnswerComment
type: Comment

postgresql
tags question: http://stackoverflow.com/q/23230148
tags question: http://stackoverflow.com/q/23277726
tags question: http://stackoverflow.com/q/23188959
tags question: http://stackoverflow.com/q/23224751
tags question: http://stackoverflow.com/q/23241275
tag name: postgresql
type: Tag
tags question: http://stackoverflow.com/q/23203224
tags question: http://stackoverflow.com/q/23232107
tags question: http://stackoverflow.com/q/23187696
tags question: http://stackoverflow.com/q/23231602
tags question: http://stackoverflow.com/q/23247539

http://stackoverflow.com/q/23139668
has body: I've build a DAL which uses Spring's Repositories to manage CRUD operations on a MySQL DB through Hibernate and JPA. In particular this is my Repository definition package my.dal.repository; import my.domain.dal.User; import org.springframework.data.querydsl.QueryDslPredicateExecutor; import org.springframework.data.repository.CrudRepository; import org.springframework.stereotype.Repository; @Repository public interface IUserRepository extends CrudRepository&lt;User, String&gt;, QueryDslPredicateExecutor&lt;User&gt;{ } With this definition I'm able to execute CRUD operations using QueryDSL Predicates through the extension of the QueryDslPredicateExecutor interface and the findAll(Predicate) method. The problem I'm facing is that this way I'm not able to make cross-table queries. Indeed, I cannot use QueryDSL's join facilities because I don't have a HibernateQuery. What is the right way to implement the join operation with Spring Repositories and QueryDSL? Thank you
has title: Write cross-table queries with QueryDSL and Spring's Repository
score: 6
has answer: http://stackoverflow.com/a/23144134
tagged with: querydsl
type: AnsweredQuestion
downvote count: 0
favorite count: 0
type: Question
tagged with: spring
accepted answer: http://stackoverflow.com/a/23144134
answer count: 1
upvote count: 6
tagged with: java
tagged with: spring-data

http://stackoverflow.com/comment/35660890
comment on: http://stackoverflow.com/q/23278950
type: Comment
type: QuestionComment
score: 0
has text: Show us where you tried instantiating the button in your java code. Should look something like `CustomFBButton button = (CustomFBButton) findViewById(R.id.login_button);`

http://stackoverflow.com/a/23228528
has body: How would you search a directory full of sub directories that are themselves full of sub directories and so on (like JB Nizet stated, tree nodes) or calculate a Fibonacci sequence with less ease than using recursion?
has comment: http://stackoverflow.com/comment/35538159
has comment: http://stackoverflow.com/comment/35537762
score: 0
answers question: http://stackoverflow.com/q/23228416
type: Answer

http://stackoverflow.com/comment/35553040
type: QuestionComment
comment on: http://stackoverflow.com/q/23237038
has text: Related: http://stackoverflow.com/questions/5205339/regular-expression-matching-fully-qualified-java-classes
score: 0
type: Comment

http://stackoverflow.com/q/23218236
upvote count: 2
tagged with: java
tagged with: jaxb
has body: i want to marshal my object in a ordered xml. My jaxb class is given below:- i have used Xmlordering but it doesn't work to order my xml. package mypackage; import java.util.ArrayList; import java.util.Calendar; import java.util.List; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; import mypackage.TourplanAvailabilityRequest.OptionInfoRequest.RoomConfig; import mypackage.TourplanAvailabilityRequest.OptionInfoRequest.RoomConfigs; import com.eos.hotels.data.HotelSearchQuery; @XmlRootElement(name = "Request") @XmlType(propOrder={"request"}) public class TourplanAvailabilityRequest { private OptionInfoRequest request; public TourplanAvailabilityRequest() { // TODO Auto-generated constructor stub } public TourplanAvailabilityRequest(HotelSearchQuery hsq) { this(hsq, "null"); } public TourplanAvailabilityRequest(HotelSearchQuery hsq, String optInfo) { OptionInfoRequest req = new OptionInfoRequest(); req.setAgentID("AATRAV"); req.setPassword("AATRAV"); req.setOpt("citycode???????"); req.setInfo("GS"); // req.setDateFrom(Calendar.getInstance().setTime(hsq.startDate)); // req.setDateTo(Calendar.getInstance().setTime(hsq.endDate) ); req.setRateConvert("N"); req.setReturnWarnings("N"); req.setCompressReply("N"); RoomConfigs roomsToBook = new RoomConfigs(); List rooms = new ArrayList (); for (int i = 0; i < hsq.rooms.length; i++) { RoomConfig room = new RoomConfig(); room.setAdults(hsq.rooms[i].adults.length); room.setChildren(hsq.rooms[i].children.length); room.setRoomType(hsq.m_roomType); rooms.add(room); } roomsToBook.setRoom(rooms); req.setConfig(roomsToBook); this.request = req; } @XmlElement(name = "OptionInfoRequest") public OptionInfoRequest getRequest() { return request; } public void setRequest(OptionInfoRequest request) { this.request = request; } public static class OptionInfoRequest { private String agentID; private String password; private String opt; private String info; priv…
has title: JAXB xml ordering or Sequence or property ordering
type: Question
has answer: http://stackoverflow.com/a/23220070
answer count: 2
tagged with: xml-binding
downvote count: 0
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
has answer: http://stackoverflow.com/a/23220239
type: UnansweredQuestion
score: 2

http://stackoverflow.com/comment/35494948
score: 0
type: Comment
has text: any references I should check?
comment on: http://stackoverflow.com/a/23204796
type: AnswerComment

http://stackoverflow.com/a/23229502
has body: This is a key feature of polymorphism. The object you instantiated is an instance of Child. Calling that object's test() is always going to result in the Child's (overridden) test() being called, even if you've assigned that instance to a variable of Parent type. In short, this is how you can achieve more specific behavior while only having to reference the object using a variable declared a superclass type. Often this is used in conjunction with the base class only providing an abstract method for the subclasses to override. A trivial example in beginner's books usually involves animals or cars: public abstract class Animal { private final String name; public Animal(String name) { this.name = name; } public void printName() { System.out.println(name); } // more animal general stuff followed by: public abstract void makeSound(); } public class Dog extends Animal { public Dog() { super("Dog"); } @Override public void makeSound() { System.out.println("Woof!"); } } List&lt;Animal&gt; aList = new ArrayList&lt;Animal&gt;(); aList.add(new Dog()); aList.add(new Cat()); // etc for (Animal a : aList) { a.printName(); a.makeSound(); // calls each subclasses' "makeSound()" } You can't call the Parent's test() unless you instantiate a Parent or call super.test() from within a method in Child. (I was actually thinking I could find a good duplicate for this that provided a decent answer, but I couldn't)
accepted answer of: http://stackoverflow.com/q/23229116
answers question: http://stackoverflow.com/q/23229116
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/35539734
type: Answer
upvote count: 1
score: 1

http://stackoverflow.com/comment/35499572
type: AnswerComment
comment on: http://stackoverflow.com/a/23206959
type: Comment
has text: You are correct in that. I added an example to the bottom. Good luck!
score: 0

http://stackoverflow.com/a/51099769
has comment: http://stackoverflow.com/comment/113860571
score: 58
has comment: http://stackoverflow.com/comment/137454563
downvote count: 3
has body: I have very similar problem (Maven build and maven-failsafe-plugin - The forked VM terminated without properly saying goodbye) and found three solutions which working for me: Problem description Problem is with maven plugin maven-surefire-plugin only in version 2.20.1 and 2.21.0. I checked and you use version 2.20.1. Solution 1 Upgrade plugin version to 2.22.0. Add in pom.xml: org.apache.maven.plugins maven-surefire-plugin 2.22.0 Solution 2 Downgrade plugin version to 2.20. Add in pom.xml: org.apache.maven.plugins maven-surefire-plugin 2.20 Solution 3 Use plugin configuration testFailureIgnore. Add in pom.xml: org.apache.maven.plugins maven-surefire-plugin true
has comment: http://stackoverflow.com/comment/98285673
has comment: http://stackoverflow.com/comment/108058853
answers question: http://stackoverflow.com/q/23260057
has comment: http://stackoverflow.com/comment/99505410
has comment: http://stackoverflow.com/comment/124718980
upvote count: 61
type: Answer
has comment: http://stackoverflow.com/comment/95117154
has comment: http://stackoverflow.com/comment/133710184
has comment: http://stackoverflow.com/comment/120831596
has comment: http://stackoverflow.com/comment/100093270

http://stackoverflow.com/a/23172833
has comment: http://stackoverflow.com/comment/35439100
type: Answer
has body: You never assigned val2. Additionally, next time attach stack-trace and use the error for the first debugging process.
answers question: http://stackoverflow.com/q/23172800
score: 2
has comment: http://stackoverflow.com/comment/35438947
has comment: http://stackoverflow.com/comment/35439066
downvote count: 0
upvote count: 2

http://stackoverflow.com/a/23196576
has comment: http://stackoverflow.com/comment/35480911
has body: First of all let me explain what's going on You use synchronous sendAndReceive operation. Before your message will be send it is enriched with TemporaryReplyQueue and the sender (producer) Thread is blocking to wait the reply from that replyQueue. That's why your all messages are processed serially. To go ahead we need to know the reason to use that operation in the one-way ItemWriter producer. Maybe the RabbitTemplate#convertAndSend would be enough for you ? UPDATE Maybe do you just need RabbitTemplate.ReturnCallback alongside with convertAndSend to determine, if your message was delivered or not? UPDATE 2 Another thought to achieve your requirement to use TaskExecutor to send and receive in parallel. With that you don't need to to wait the rely for first message to send the second: final List&lt;Object&gt; replies = new ArrayList&lt;Object&gt;(); ExecutorService executor = Executors.newCachedThreadPool(); for (T item : items) { executor.execute(new Runnable() { public void run() { Object reply = template.convertSendAndReceive(item.toString()); System.out.println("producer output: " + reply); replies.add(reply); } }); } executor.shutdown(); executor.awaitTermination(1, TimeUnit.MINUTES); And after that you can do something with all replies for current items.
answers question: http://stackoverflow.com/q/23196106
has comment: http://stackoverflow.com/comment/35481267
upvote count: 4
has comment: http://stackoverflow.com/comment/35484873
downvote count: 0
score: 4
has comment: http://stackoverflow.com/comment/35480020
has comment: http://stackoverflow.com/comment/35480798
has comment: http://stackoverflow.com/comment/35480549
type: Answer
has comment: http://stackoverflow.com/comment/35482683
has comment: http://stackoverflow.com/comment/35481211

http://stackoverflow.com/a/23283830
has body: If 2dArray is a two dimensional String array like String[][] 2dArray then the two strings can be compared using if(2dArray[i][j].compareTo(2dArray[i-1][j]) > 0)
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/23283655
downvote count: 0
type: Answer

http://stackoverflow.com/a/23249229
answers question: http://stackoverflow.com/q/23244397
type: Answer
has body: I had two problems with my code, I was lacking the return prior to the sendAjax(). The define Ajax problem was due to missing a full stop in $ajax so it should be $.ajax function sendAjax(){ var article = new Object(); article.username = $('#username').val(); article.password = $('#password').val(); $.ajax({ url: "http://localhost:8080/FishingTrax/LoginServlet", type: 'POST', dataType: 'json', data: JSON.stringify(article), contentType: 'application/json', mimeType: 'application/json', success: function (data) { }, error:function(data,status,er) { alert("error: "+data+" status: "+status+" er:"+er); } }); };
score: 0

http://stackoverflow.com/a/23149584
type: Answer
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/138174888
answers question: http://stackoverflow.com/q/23149512
has body: Here it is : Link for it // Override getScrollableTracksViewportWidth // to preserve the full width of the text public boolean getScrollableTracksViewportWidth() { Component parent = getParent(); ComponentUI ui = getUI(); return parent != null ? (ui.getPreferredSize(this).width &lt;= parent .getSize().width) : true; } Other link
accepted answer of: http://stackoverflow.com/q/23149512
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/23143282
upvote count: 3
has comment: http://stackoverflow.com/comment/35388819
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/35387573
accepted answer of: http://stackoverflow.com/q/23143148
has body: String fileName=null; JFileChooser chooser = new JFileChooser(); FileNameExtensionFilter filter = new FileNameExtensionFilter( "MP3 Files", "mp3"); chooser.setFileFilter(filter); int returnVal = chooser.showOpenDialog(parent); if(returnVal == JFileChooser.APPROVE_OPTION) { fileName= chooser.getSelectedFile().getName(); } MediaPlayer mediaPlayer = new MediaPlayer(new Media(fileName)); mediaPlayer.play(); Here's the complete working code import java.net.URL; import java.util.concurrent.CountDownLatch; import java.util.logging.Level; import java.util.logging.Logger; import javafx.embed.swing.JFXPanel; import javafx.scene.media.Media; import javafx.scene.media.MediaPlayer; import javax.swing.JFileChooser; import javax.swing.SwingUtilities; import javax.swing.filechooser.FileNameExtensionFilter; /** * * @author Mayank Aggarwal */ public class MyAudio { public static void main(String[] args) { new MyAudio().start(); } public void start() { String fileName = null; URL url; final CountDownLatch latch = new CountDownLatch(1); SwingUtilities.invokeLater(new Runnable() { public void run() { new JFXPanel(); // initializes JavaFX environment latch.countDown(); } }); try { latch.await(); } catch (InterruptedException ex) { Logger.getLogger(MyAudio.class.getName()).log(Level.SEVERE, null, ex); } JFileChooser chooser = new JFileChooser(); FileNameExtensionFilter filter = new FileNameExtensionFilter( "MP3 Files", "mp3"); chooser.setFileFilter(filter); int returnVal = chooser.showOpenDialog(null); if (returnVal == JFileChooser.APPROVE_OPTION) { fileName = chooser.getSelectedFile().toURI().toString(); } MediaPlayer mediaPlayer; mediaPlayer = new MediaPlayer(new Media(fileName)); mediaPlayer.play(); } }
score: 3
answers question: http://stackoverflow.com/q/23143148
has comment: http://stackoverflow.com/comment/35387816
has comment: http://stackoverflow.com/comment/35403447
has comment: http://stackoverflow.com/comment/35387890
has comment: http://stackoverflow.com/comment/35387632

http://stackoverflow.com/a/23256505
accepted answer of: http://stackoverflow.com/q/23256406
has comment: http://stackoverflow.com/comment/35588629
has body: No, the return type cannot be a deciding factor in making a method signature unique because you do not need to assign the returned value to anything, the compiler wouldn't know what to do in that case. Concrete example: ... C object = new C(); object.foo(); ... Which foo did I just call? Can't tell. To make this work you'll need to have either different method names or different parameter types in the interface methods. EDIT: assuming you have no control over the interfaces A and B (library classes or similar) this is the solution I'd take if I wanted to implement them in the same class: public class C { private objectA = new AImpl(); private objectB = new BImpl(); // Work with the objects here private class AImpl implements A { public int foo() { // ... } } private class BImpl implements B { public char foo() { // ... } } }
answers question: http://stackoverflow.com/q/23256406
type: AcceptedAnswer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/35588573
type: Answer
upvote count: 1

http://stackoverflow.com/q/23221508
type: Question
tagged with: ejb
has title: Remote ejb call with parameter
has comment: http://stackoverflow.com/comment/35525114
has body: I have ejb with method void create(A a); and class B which extends class A. i tried call ejb from client server ... B b = getB(); ... bean.create(new A()); // OK bean.create(new B()); // java.lang.ClassNotFoundException (class B is defined just on client server) bean.create(b); // No EJB receiver available for handling ... i have two questions: what is difference between second and third call ? why i get different errors? how can I call remote ejb with object of class B ?
score: 0
tagged with: serialization
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35525338
tagged with: java

http://stackoverflow.com/a/23277944
answers question: http://stackoverflow.com/q/23261020
upvote count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/35631919
type: Answer
has body: You can use Log4j Lookups with PropertySubstitution: See http://logging.apache.org/log4j/2.x/manual/configuration.html#PropertySubstitution and http://logging.apache.org/log4j/2.x/manual/lookups.html Here is an example on StackOverflow: Log4J2 property substitution - default (to make it short, you can use, as far as I know, the System Property using -Dkey=value) You can also try to use the ${bundle:com.package.Messages:MyKey} syntax to use a properties file (using log4j 2.0-rc1 or greater), see https://stackoverflow.com/a/19303208/1149528.
has comment: http://stackoverflow.com/comment/35632633
score: 1

http://stackoverflow.com/a/39793984
upvote count: 4
answers question: http://stackoverflow.com/q/23174265
downvote count: 0
score: 4
has comment: http://stackoverflow.com/comment/121682100
type: Answer
has body: All above answers didn't work for me. My Eclipse mars is x64 but I need to set registry dll to x86 for another software. At the end I put -vm argument at the end of shortcut and this did the trick. D:\mars\eclipse\eclipse.exe -vm "C:\Program Files\Java\jre7\bin\server\jvm.dll" According to this doc jvm.dll also work for some cases.
has comment: http://stackoverflow.com/comment/72192285

http://stackoverflow.com/comment/35664267
has text: but it's different. the login works for my user only - so the hash is OK
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23148609
type: Comment

http://stackoverflow.com/comment/35559587
type: Comment
type: QuestionComment
has text: what do you want to do if you found the string in a list? what do you want to do if multiple lists contain the string? where/how is the checking order (`list1->list2->listx..`) defined?
comment on: http://stackoverflow.com/q/23240665
score: 0

http://stackoverflow.com/a/68861514
has body: Take the absolute path from the local system if you'r in eclipse then right-click on the file and click on properties you will get the path copy it and put as below this worked for me In maven project keep the properties file in src/main/resources ` private static Properties properties = new Properties(); public Properties simpleload() { String filepath="C:/Users/shashi_kailash/OneDrive/L3/JAVA/TZA/NewAccount/AccountConnector/AccountConnector-DEfgvf/src/main/resources/sample.properties"; try(FileInputStream fis = new FileInputStream(filepath);) { //lastModi = propFl.lastModified(); properties.load(fis); } catch (Exception e) { System.out.println("Error loading the properties file : sample.properties"); e.printStackTrace(); } return properties; }`
score: 0
answers question: http://stackoverflow.com/q/23208267
type: Answer

http://stackoverflow.com/comment/35527653
comment on: http://stackoverflow.com/a/23195169
type: Comment
has text: Look at here `10:34:49.854:MOU2:WARN:Log:Specified ID: isc_Button_0`. Its a Warning. I also got it and its working. Try this one `newButton.setIcon("[SKIN]/RecordEditor/add.png");` and set the size also. I have added the snapshot also.
score: 1
type: AnswerComment

http://stackoverflow.com/comment/35447014
comment on: http://stackoverflow.com/a/23171296
type: AnswerComment
score: 0
has text: if you want the users to access the dmin folder without logging in, then I guess the only thing you want is to redirect to /admin/login.xhtml? For that you can use a filter. Inside the doFilter method, check if the request is for your welcomepage and then forward the request to the /admin/login.xhtml. I modify my original answer with the sample code of the doFilter method you can change for your purpose.
type: Comment

http://stackoverflow.com/comment/35431250
has text: No, this runs on WebSphere for me, but I am sure that it would work on embedded or external Tomcat. Have you done a clean stop and republish? Embedded Tomcat is sometimes capricious about properly deploying and updating.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23167772

http://stackoverflow.com/comment/35379316
has text: Ok. I manage to solve it using -javaagent:path_to_agent.jar at load time.
type: Comment
comment on: http://stackoverflow.com/a/23136388
score: 0
type: AnswerComment

http://stackoverflow.com/comment/35431839
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23160474
type: Comment
has text: Thus you need create `persistence-test.xml` file for one test entity and add it to Hibernate facets that already defined.

http://stackoverflow.com/comment/35395620
type: Comment
has text: @user3507894 yes. If not what is that you want??
comment on: http://stackoverflow.com/a/23148157
score: 0
type: AnswerComment

http://stackoverflow.com/comment/35454509
type: Comment
type: QuestionComment
has text: That would be the best solution, but the database is used by another applications and changing the schema would have a huge impact on these. I've temporarily solved the issue by executing native sql query to save these. The only problem I see with it is that my code now becomes database dependent.
comment on: http://stackoverflow.com/q/23142614
score: 0

http://stackoverflow.com/a/23270517
type: Answer
has comment: http://stackoverflow.com/comment/35614682
has body: It will return an empty string. According to System.getProperty(String key) null is returned only if there is no property with that key. So if we define a propety with -D it exists in the system
accepted answer of: http://stackoverflow.com/q/23269994
upvote count: 10
has comment: http://stackoverflow.com/comment/107863602
downvote count: 0
score: 10
answers question: http://stackoverflow.com/q/23269994
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35615421

http://stackoverflow.com/a/23202299
type: Answer
answers question: http://stackoverflow.com/q/23202298
has body: For now, I have found a (ugly) solution which is adding the following line before doing the update: Ebean.refreshMany(form.get(), "operations"); Another solution could be not to build the form the model class but on an another class, forcing me to map each field one by one.
score: 0

http://stackoverflow.com/comment/35447691
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23177724
has text: When I see a question saying that there was an error without specifying what the error was, I'll vote to close as "lacks sufficient information to diagnose the problem" 9 times out of 9. Unless you're using an Apple II, error messages actually say something other than just "Error", and they do that for a reason: The information is useful in diagnosing the problem.

http://stackoverflow.com/comment/35538937
type: Comment
type: QuestionComment
has text: @DerekParker That would be completely incorrect.
score: 0
comment on: http://stackoverflow.com/q/23229124

http://stackoverflow.com/comment/35600534
has text: Thank you Mehdi, I'll have a look today for you.
type: AnswerComment
comment on: http://stackoverflow.com/a/23221992
type: Comment
score: 0

http://stackoverflow.com/q/23257215
has answer: http://stackoverflow.com/a/23257400
has comment: http://stackoverflow.com/comment/35589903
has comment: http://stackoverflow.com/comment/59980997
has title: instanceof vs equals on defined string that identifies the Class
score: 4
has answer: http://stackoverflow.com/a/23257269
has comment: http://stackoverflow.com/comment/35589689
tagged with: java
has comment: http://stackoverflow.com/comment/35589632
has comment: http://stackoverflow.com/comment/35589658
upvote count: 4
answer count: 4
has answer: http://stackoverflow.com/a/23257318
has comment: http://stackoverflow.com/comment/35589656
downvote count: 0
possible better answer: http://stackoverflow.com/a/23257241
has answer: http://stackoverflow.com/a/23257241
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35589608
linked to: http://stackoverflow.com/q/4989818
favorite count: 0
accepted answer: http://stackoverflow.com/a/23257318
type: Question
has body: I can test the class type in a program where I'm working both with instanceof or getting a field that identifies the class appartenency. so the choice is between if(myObjec instanceof Something){ } And if(myObjec.geClassType().equals("Something")){ } What is the best in terms of efficency? geClassType() is a method present in the object of the program where I'm working(not a standard java method) and is a method that returns a string wih the name of the class. the name is passed as field when the object is created EDIT the field that I get in the second sample in my code doesn't identify exactly the class but a category and is used also for different routines, but I can use this also for this purpose since I use a specific object for each category. So I have reported this as getClassType to make my question more clear.

http://stackoverflow.com/comment/35597108
comment on: http://stackoverflow.com/q/23261281
score: 0
has text: @SanjayRajjadi I have posted my web.xml file
type: QuestionComment
type: Comment

http://stackoverflow.com/q/23158608
duplicate of: http://stackoverflow.com/q/8260881
has comment: http://stackoverflow.com/comment/35413401
tagged with: java
has answer: http://stackoverflow.com/a/23158720
possible better answer: http://stackoverflow.com/a/23158670
score: 0
has title: Test all values in a boolean[]
has answer: http://stackoverflow.com/a/23158670
has answer: http://stackoverflow.com/a/23158895
tagged with: arrays
has body: I'm wondering if there is a more 'neat' way to test if all the values in a boolean array are true/false than iterating through the array and testing each individually like this: for (boolean eval:booleanArray) { if (!eval) { return false; } } Essentially, i want to see if all of the values stored in an array of booleans is true, and if so, perform an action. I'm pretty sure that there is some form of method for this, like array.contains(false) but i may be wrong.
has comment: http://stackoverflow.com/comment/35413471
answer count: 4
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23158895
linked to: http://stackoverflow.com/q/8260881
has answer: http://stackoverflow.com/a/23158948
type: Question

http://stackoverflow.com/a/23214322
upvote count: 30
type: Answer
score: 30
has comment: http://stackoverflow.com/comment/86488861
has body: The easiest way to do so is: Map&lt;String, Integer&gt; map = new HashMap&lt;&gt;(); Map&lt;String, String&gt; mapped = map.entrySet().stream() .collect(Collectors.toMap(Map.Entry::getKey, entry -&gt; String.valueOf(entry.getValue()))); What you do here, is: Obtain a Stream&lt;Map.Entry&lt;String, Integer&gt;&gt; Collect the results in the resulting map: Map the entries to their key. Map the entries to the new values, incorporating String.valueOf. The reason you cannot do it in a one-liner, is because the Map interface does not offer such, the closest you can get to that is map.replaceAll, but that method dictates that the type should remain the same.
has comment: http://stackoverflow.com/comment/86450853
has comment: http://stackoverflow.com/comment/86488840
has comment: http://stackoverflow.com/comment/86450048
answers question: http://stackoverflow.com/q/23213891
downvote count: 0
has comment: http://stackoverflow.com/comment/86488804

http://stackoverflow.com/q/23278449
type: UnansweredQuestion
score: 1
tagged with: java
has body: I can't seem to connect and I dont know what is wrong here. I am debugging and all I get is a 404. My class ApiServer is in this directory A.B.C.api.users Jersey REST Service org.glassfish.jersey.servlet.ServletContainer com.sun.jersey.config.property.packages A.B.C.api 1 Jersey REST Service /users/* ......... @Path("/test") public class ApiServer { @GET @Path("/") public Response putContainer() { System.out.println("Hellooo"); .......... curl -v 192.168.92.128:8080/users/ .... Apr 25, 2014 10:26:19 AM org.glassfish.jersey.server.ApplicationHandler initialize INFO: Initiating Jersey application, version Jersey: 2.7 2014-03-12 18:11:31... There is nothing after this, does it mean that its not initialized completly? And How can I debug Jax-rs ?
type: Question
answer count: 2
has title: Jax-rs API url mapping
downvote count: 0
has answer: http://stackoverflow.com/a/23299357
has comment: http://stackoverflow.com/comment/35876158
has comment: http://stackoverflow.com/comment/35661034
upvote count: 1
has answer: http://stackoverflow.com/a/23278708
tagged with: jax-rs
linked to: http://stackoverflow.com/q/16216323
favorite count: 0

http://stackoverflow.com/q/23250358
favorite count: 0
has comment: http://stackoverflow.com/comment/35576699
accepted answer: http://stackoverflow.com/a/23250804
tagged with: java-8
score: 2
type: AnsweredQuestion
upvote count: 2
tagged with: java
has title: Eclipse internal compiler error
has comment: http://stackoverflow.com/comment/35576851
has comment: http://stackoverflow.com/comment/35576923
type: Question
has answer: http://stackoverflow.com/a/23250804
tagged with: eclipse
has body: When using this code in Eclipse: import java.util.Arrays; import java.util.HashSet; import java.util.List; import java.util.Set; public class Test { public static void main(String[] args) { List&lt;Object&gt; objs = Arrays.asList(new Object(), new Object()); Set&lt;String&gt; s = objs.stream().collect(HashSet::new, HashSet::add, Object::toString); System.out.println(s); } } I get: Internal compiler error: java.lang.ArrayIndexOutOfBoundsException: 0 at org.eclipse.jdt.internal.compiler.lookup.ConstraintExpressionFormula.reduceReferenceExpressionCompatibility(ConstraintExpressionFormula .java:273) I know that this is this line which is producing the error: Set&lt;String&gt; s = objs.stream().collect(HashSet::new, HashSet::add, Object::toString); Not sure if it's relevant but I'm using: Eclipse Kepler 4.3.2 Plugins: Eclipse Java Development Tools Patch with Java 8 support (for Kepler SR2) and Eclipse Plug-in Development Environment Patch with Java 8 support (for Kepler SR2) java.runtime.version=1.8.0-b132 Here's the screenshot: I know that the collect method is not correct but why I don't have a compiler error telling something like: - The method collect(Supplier&lt;R&gt;, BiConsumer&lt;R,? super Object&gt;, BiConsumer&lt;R,R&gt;) in the type Stream&lt;Object&gt; is not applicable for the arguments etc.
has comment: http://stackoverflow.com/comment/35576559
downvote count: 0
answer count: 1

http://stackoverflow.com/a/23148608
score: 0
has comment: http://stackoverflow.com/comment/35509858
type: Answer
has body: You placed ContainedIn annotation incorrectly. According the Hibernate Search documentation: Be careful. Because the data is denormalized in the Lucene index when using the @IndexedEmbedded technique, Hibernate Search needs to be aware of any change in the Place object and any change in the Address object to keep the index up to date. To make sure the Place Lucene document is updated when it's Address changes, you need to mark the other side of the bidirectional relationship with @ContainedIn. In your example, you need to: Make the relationship between classes bidirectional Mark the relationship in ClassB as ContainedIn In your case: ClassB { private Set&lt;ClassA&gt; linkedObjects; .... @OneToMany(mappedBy="place") @ContainedIn public Set&lt;ClassA&gt; getLinkedObjects() { return linkedObjects; } .... }
has comment: http://stackoverflow.com/comment/35410041
has comment: http://stackoverflow.com/comment/35397658
answers question: http://stackoverflow.com/q/23136352
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23136352
has comment: http://stackoverflow.com/comment/60168306

http://stackoverflow.com/a/35758176
has comment: http://stackoverflow.com/comment/89944196
has comment: http://stackoverflow.com/comment/90073935
has comment: http://stackoverflow.com/comment/90074583
has comment: http://stackoverflow.com/comment/90108657
has comment: http://stackoverflow.com/comment/89944264
has comment: http://stackoverflow.com/comment/90061639
has comment: http://stackoverflow.com/comment/90073806
score: 1
has comment: http://stackoverflow.com/comment/89943984
has comment: http://stackoverflow.com/comment/89336543
has comment: http://stackoverflow.com/comment/90108637
upvote count: 2
has comment: http://stackoverflow.com/comment/89844256
answers question: http://stackoverflow.com/q/23259205
downvote count: 1
type: Answer
has body: There is also a difference in threading. Stream#parallel splits the sequence into parts, and each part is processed in the separate thread. Observable#subscribeOn and Observable#observeOn are both 'move' execution to another thread, but don't split the sequence. In other words, for any particular processing stage: parallel Stream may process different elements on different threads Observable will use one thread for the stage E. g. we have Observable/Stream of many elements and two processing stages: Observable.create(...) .observeOn(Schedulers.io()) .map(x -&gt; stage1(x)) .observeOn(Schedulers.io()) .map(y -&gt; stage2(y)) .forEach(...); Stream.generate(...) .parallel() .map(x -&gt; stage1(x)) .map(y -&gt; stage2(y)) .forEach(...); Observable will use no more than 2 additional threads (one per stage), so no two x'es or y's are accessed by different threads. Stream, on the countrary, may span each stage across several threads.

jaxp
type: Tag
tag name: jaxp
tags question: http://stackoverflow.com/q/23222413
tags question: http://stackoverflow.com/q/23260417

http://stackoverflow.com/q/23228320
answer count: 2
tagged with: user-interface
favorite count: 0
has answer: http://stackoverflow.com/a/23228365
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23229918
score: -1
has title: Why won't my program print to my GUI?
tagged with: netbeans
tagged with: java
downvote count: 1
type: Question
upvote count: 0
has comment: http://stackoverflow.com/comment/35537895
has comment: http://stackoverflow.com/comment/35537994
has body: This is my code - when I try to run the program though, it won't print/display to the finalResult text field in my GUI. Any ideas? private void calculateButtonActionPerformed(java.awt.event.ActionEvent evt) { // Coding: int a = 1; userInput = minInput.getText(); int value1 = Integer.parseInt(userInput); userInput2 = maxInput.getText(); int value2 = Integer.parseInt(userInput2); while (a &lt;= value1) { //Print numbers inbetween user's value and 1: int square = value1*value1; //Print: finalResult.setText("" + square); //Modifier: value1 = value1 + 1; } for (a = 0; a &lt;= value1; a ++) { finalResult.setText("" + a*a); } while (value1 &lt; value2) { //Print numbers inbetween value 2 and valeu1: int square = value2*value2; //Print: finalResult.setText("" + square); //Modifier: value2 = value2 + 1; } for (a = 0; a &lt;= value2; a ++) { finalResult.setText("" + a*a); }

http://stackoverflow.com/comment/35372849
type: AnswerComment
score: 0
type: Comment
has text: so i guess you should provide us some more code and information what exactly are you doing.
comment on: http://stackoverflow.com/a/23135598

http://stackoverflow.com/a/23170075
score: 0
answers question: http://stackoverflow.com/q/23169837
type: Answer
has comment: http://stackoverflow.com/comment/35434382
has body: If you launch timers in different Threads, they will naturally be executed simulatenously: this is the purpose of Threads. If you want to synchronize them, for example, launch one thread when the previous one finishes, you can use the join() function, which will "pause" your code until the thread is finished. Thread t1 = new Thread(new MyThread(tx1, tx2, latch)); Thread t2 = new Thread(new MyThread(tx1, tx2, latch)); t1.start(); t1.join(); t2.start(); t2.join(); // ... Thus, t2 is started only after t1 finishes. You can apply this to a for loop, in which you keep track of the previous thread, and start the next one after oldThread.join(). Hope it could help you !

jetty-9
tag name: jetty-9
tags question: http://stackoverflow.com/q/23237169
type: Tag

http://stackoverflow.com/q/23227543
tagged with: ssl
score: 0
tagged with: cas
has body: I overheard a conversation where 2 developers were talking about an authentication system they were building and they were talking about a Java "key store" and also mentioned a "CAS server" as well as SSL. I went to the JASIG CAS website and it seems that its used for authentication systems where you want to control user logins and sessions. It seems that the Java keystore is a file (an embedded DB perhaps?) that stores encrypted CA certificates. I'm trying to figure out how these 3 technologies could be used together to create a secure, Java-based authentication system. So would a web app use the CAS client (in my case Java) to communicate with a running instance of the CAS server? If so, where and how do the keystore and SSL cert snap into the architecture? Does CAS store the SSL cert in the keystore, and then use it with the backend directory (ActiveDirectory, etc.) somehow? Can someone just give me a high-level overview of how this would all come together?
tagged with: keystore
has comment: http://stackoverflow.com/comment/35545473
has title: Java key stores, SSL and CAS
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35543393
has comment: http://stackoverflow.com/comment/35548037
tagged with: java
tagged with: authentication
has answer: http://stackoverflow.com/a/23233861
accepted answer: http://stackoverflow.com/a/23233861
type: Question
answer count: 1

http://stackoverflow.com/q/23206154
has comment: http://stackoverflow.com/comment/35498177
has comment: http://stackoverflow.com/comment/35498585
has comment: http://stackoverflow.com/comment/35497852
type: AnsweredQuestion
tagged with: java
upvote count: 1
has title: Eclipse keeps terminating my project when unauthorized to
downvote count: 1
type: Question
tagged with: debugging
accepted answer: http://stackoverflow.com/a/23306326
has comment: http://stackoverflow.com/comment/35502579
has comment: http://stackoverflow.com/comment/35546746
has comment: http://stackoverflow.com/comment/35500237
has comment: http://stackoverflow.com/comment/35679911
has comment: http://stackoverflow.com/comment/35587968
tagged with: eclipse
has comment: http://stackoverflow.com/comment/35501458
score: 0
has comment: http://stackoverflow.com/comment/35499928
answer count: 1
has comment: http://stackoverflow.com/comment/35498016
has body: Whenever I run/debug any of my projects I don't get a window anymore and after about 20 seconds eclipse terminates it. I've tried re-installing Eclipse IDE. I only see console Outputs in when I use System.out.println(); I've tried Exporting it to Netbeans IDE it launches normally with this exception: `Exception in thread "Thread-2" java.lang.ArrayIndexOutOfBoundsException: 480000 at com.Mafia.graphics.Render3D.renderWall(Render3D.java:150) at com.Mafia.graphics.Screen.render(Screen.java:33) at com.Mafia.Display.render(Display.java:153) at com.Mafia.Display.run(Display.java:122) at java.lang.Thread.run(Thread.java:745)` But it the console in eclipse says nothing about any errors in Run Mode. I just found this in my debug console when debug "Mafia"(one of my projects) &lt;terminated, exit value: -1073740940&gt;C:\Program Files\Java\jdk1.7.0_55\bin\javaw.exe (2014-04-22 9:48:56 PM) What does exit value mean and could it be linked to the problem? I'm running: Windows 7 sp1 JDK 1.7.0_55 (64-BIT) JRE 7 (64-BIT)
favorite count: 0
tagged with: netbeans-8
has answer: http://stackoverflow.com/a/23306326

http://stackoverflow.com/q/23146233
has comment: http://stackoverflow.com/comment/35392704
has answer: http://stackoverflow.com/a/23152671
has body: I'm doing an assignment in Computer Science, and I'm getting a couple of errors. I had to upload the code because I couldn't get it to work on Stackoverflow. Here's the link: http://txt.do/tqmh Here are the errors: 16 errors found: File: C:\Users\Om\Desktop\CYOA_Om_Malhar.java [line: 15] Error: Syntax error on token(s), misplaced construct(s) File: C:\Users\Om\Desktop\CYOA_Om_Malhar.java [line: 15] Error: Syntax error on token "int", @ expected File: C:\Users\Om\Desktop\CYOA_Om_Malhar.java [line: 32] Error: Syntax error on token(s), misplaced construct(s) File: C:\Users\Om\Desktop\CYOA_Om_Malhar.java [line: 32] Error: Syntax error on token "int", @ expected File: C:\Users\Om\Desktop\CYOA_Om_Malhar.java [line: 57] Error: Syntax error on token(s), misplaced construct(s) File: C:\Users\Om\Desktop\CYOA_Om_Malhar.java [line: 57] Error: Syntax error on token "int", @ expected File: C:\Users\Om\Desktop\CYOA_Om_Malhar.java [line: 83] Error: Syntax error on token(s), misplaced construct(s) File: C:\Users\Om\Desktop\CYOA_Om_Malhar.java [line: 83] Error: Syntax error on token "int", @ expected File: C:\Users\Om\Desktop\CYOA_Om_Malhar.java [line: 112] Error: Syntax error on token(s), misplaced construct(s) File: C:\Users\Om\Desktop\CYOA_Om_Malhar.java [line: 112] Error: Syntax error on token "int", @ expected File: C:\Users\Om\Desktop\CYOA_Om_Malhar.java [line: 137] Error: Syntax error on token(s), misplaced construct(s) File: C:\Users\Om\Desktop\CYOA_Om_Malhar.java [line: 137] Error: Syntax error on token "int", @ expected File: C:\Users\Om\Desktop\CYOA_Om_Malhar.java [line: 161] Error: Syntax error on token(s), misplaced construct(s) File: C:\Users\Om\Desktop\CYOA_Om_Malhar.java [line: 161] Error: Syntax error on token "int", @ expected File: C:\Users\Om\Desktop\CYOA_Om_Malhar.java [line: 184] Error: Syntax error on token(s), misplaced construct(s) File: C:\Users\Om\Desktop\CYOA_Om_Malhar.java [line: 184] Error: Syntax error on token "int", @ expected Please help!
has comment: http://stackoverflow.com/comment/35392347
answer count: 2
has comment: http://stackoverflow.com/comment/35392545
has comment: http://stackoverflow.com/comment/35392324
has title: Sytnax error on token(s), misplaced construct(s)
upvote count: 0
tagged with: string
favorite count: 0
type: UnansweredQuestion
score: -3
tagged with: variable-assignment
has answer: http://stackoverflow.com/a/23153329
has comment: http://stackoverflow.com/comment/35392334
tagged with: java
has comment: http://stackoverflow.com/comment/35392785
downvote count: 3
has comment: http://stackoverflow.com/comment/35392597
tagged with: methods
type: Question

http://stackoverflow.com/q/23180785
score: 0
answer count: 1
tagged with: user-interface
has body: Some parts of the GUI don't show up. public class HospitalRecord extends JFrame implements ActionListener, MouseListener, ItemListener{ BorderLayout bl; FlowLayout fl; GridLayout gl; JPanel jpSouth; JPanel jpCenter; JPanel jpNorth; JLabel lblName; JLabel lblSurname; JLabel lblPhone; JLabel lblHeight; JLabel lblBirthYear; JLabel lblDepartment; JTextField txtName; JTextField txtSurname; JTextField txtPhone; JTextField txtHeight; JRadioButton rbEmergency; JRadioButton rbControl; JRadioButton rbOperation; JCheckBox cbocigaretteusage; JCheckBox cboalcoholusage; JCheckBox cbodrugusage; JComboBox jcAgeEntries; JButton jbSubmit; JButton jbPrint; JList jLdepartment; public HospitalRecord() { super("Registration Form"); bl=new BorderLayout(); setLayout(bl); addMouseListener(this); setFocusable(true); jpSouth = new JPanel(); add(jpSouth,BorderLayout.SOUTH); south(); jpCenter = new JPanel(); add(jpCenter,BorderLayout.CENTER); center(); jpNorth = new JPanel(); add(jpNorth,BorderLayout.NORTH); north(); txtName.addActionListener(this); } public void north(){ lblBirthYear = new JLabel("Birth Year"); Integer[] comboData = new Integer[114]; for (int i = 0; i &lt; comboData.length; i++) { comboData[i] = 1900 + i; } jcAgeEntries = new JComboBox(comboData); jcAgeEntries.addMouseListener(this); String[] listData = new String[3]; listData[0] = "Accident and emergency"; listData[1] = "Ear nose and throat (ENT)"; listData[2] = "General surgery"; lblDepartment = new JLabel("Department Type"); jLdepartment= new JList(listData); jLdepartment.addMouseListener(this); jpNorth.add(lblBirthYear); jpNorth.add(jcAgeEntries); jpNorth.add(lblDepartment); jpNorth.add(jLdepartment); } public void center(){ gl = new GridLayout(3,3); jpCenter.setLayout(gl); lblName = new JLabel("Name"); lblSurname = new JLabel("Surname"); lblPhone = new JLabel("Phone"); lblHeight = new JLabel("Height"); txtName = new JTextField("Name"); txtSurname = new JTextField("Surname"); txtPhone = new JTextField("Phone"); txtHeight =…
has comment: http://stackoverflow.com/comment/35452867
has comment: http://stackoverflow.com/comment/35453126
tagged with: swing
has answer: http://stackoverflow.com/a/23181030
has title: GUI parts not showing up
has comment: http://stackoverflow.com/comment/35453323
type: AnsweredQuestion
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/35453239
accepted answer: http://stackoverflow.com/a/23181030
has comment: http://stackoverflow.com/comment/35452928

http://stackoverflow.com/q/23150231
has body: I need some help figuring out what i should do with this problem. I have created a class with a method called "procedure" that handles the communication between the server and client (sends some commands too the server, and gets something back). My code of this method you can see here: http://pastebin.com/1ibGNRnr This method "procedure" going through some steps. If i get an error in lets say step nr. 4, i should tell my program to run step 2 or 3 again. (Go back in lines if possible) With steps, i mean everything that is between these lines: So step 1 is the code between Verify opererator and ask operator for item number. // Verify operator // &lt;--- step 1 // Ask operator for item number &lt;--- step 2 // Search for item name and sends it back. &lt;--- step 3 // Ask operator to confirm name &lt;--- stop 4 and so on: So is there an easy way to do this? It should go a few steps back if error received, but NOT start from the start. Right now , the only solution i can think of, is to make a method of each step and just run the nessary step method if i get an error.
type: Question
has comment: http://stackoverflow.com/comment/35399451
has answer: http://stackoverflow.com/a/23150389
has comment: http://stackoverflow.com/comment/35399420
has comment: http://stackoverflow.com/comment/35398845
has title: Easy way to go some lines back in code? - in Java
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/23153091
type: UnansweredQuestion
tagged with: java

http://stackoverflow.com/q/23187679
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23187834
has answer: http://stackoverflow.com/a/23187819
score: 0
upvote count: 1
tagged with: matrix
downvote count: 1
possible better answer: http://stackoverflow.com/a/23187819
favorite count: 0
has body: i have come up with a code to calculate the transpose of a matrix, but it seems to giving an error... any advice regarding improving the code would be helpful. public class Prob1_Matrices { public static int[][] Transpose2D(int m[][]) { int B[][] = new int[m.length][m[0].length]; for (int i = 0; i &lt; m.length; i++) { for (int j = 0; j &lt; m[0].length; j++) { int temp = B[i][j]; B[i][j] = B[j][i]; // this is line 10 B[j][i] = temp; } } return B; } public static void main(String[] args) { int m[][] = {{2, 5, 8, 3, 6}, {4, 2, 9, 3, 1}, {8, 0, 9, 5, 2}}; System.out.println("Matrix:"); System.out.println(Transpose2D(m)); //this is line 22 } }
tagged with: multidimensional-array
has answer: http://stackoverflow.com/a/23187774
accepted answer: http://stackoverflow.com/a/23187808
answer count: 4
tagged with: java
has answer: http://stackoverflow.com/a/23187808
has comment: http://stackoverflow.com/comment/35465268
has title: How to working with matrices using java

http://stackoverflow.com/q/23205277
has title: Max absolute sum in a array
downvote count: 1
type: Question
possible better answer: http://stackoverflow.com/a/23205616
accepted answer: http://stackoverflow.com/a/23205348
tagged with: algorithm
score: 0
has answer: http://stackoverflow.com/a/23366276
has comment: http://stackoverflow.com/comment/35496132
answer count: 3
has comment: http://stackoverflow.com/comment/35497278
has comment: http://stackoverflow.com/comment/35497600
has body: I am came across this question recently but didn't get any idea about solving this. Can you some one help with pseudo code. Given an array with four integers A, B, C, D, shuffle them in some order. If the integers are unique then there are 24 shuffles. My task is get the best shuffle such that F(S) = abs(s[0]-s[1]) + abs(s[1]-s[2])+ abs(s[2]-s[3]) is maximum For example consider this example A=5, B= 3, C=-1, D =5 s[0]=5, s[1]=-1, s[2]= 5, s[3] =3 will give me maximum sum which is F[s] =14 The time and space complexity are O(1).
favorite count: 0
has answer: http://stackoverflow.com/a/23205348
has comment: http://stackoverflow.com/comment/35497382
has comment: http://stackoverflow.com/comment/35496398
has comment: http://stackoverflow.com/comment/35497553
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/23205616
upvote count: 1

http://stackoverflow.com/a/49815055
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/23249355
downvote count: 0
has body: Create a java class MyWebAppInitializer.java and in this file add your Configurer.java Then Test public class MyWebInitializer extends AbstractAnnotationConfigDispatcherServletInitializer { @Override protected Class&lt;?&gt;[] getServletConfigClasses() { return new Class[] { Configurer.class }; } @Override protected String[] getServletMappings() { return new String[] { "/" }; } @Override protected Class&lt;?&gt;[] getRootConfigClasses() { return null; } }
type: Answer

universe
type: Tag
tag name: universe
tags question: http://stackoverflow.com/q/23180177

http://stackoverflow.com/q/23201771
favorite count: 0
has title: Is the Clip class appropriate for 'heavy use'?
has body: I'm working on a program that plays a series of Clips (clip.start()), on average one each second. Meaning a clip is started, and a second later it is stopped and another clip is started, and so on for about 10 clips. The outcome isn't 'fluid', some clips don't even start or aren't heard. My question: is the Clip class appropriate for this kind of thing? Or are clips not supposed to handle being stopped and started very frequently? If Clip isn't appropriate, is there an alternative class or library you can suggest for this purpose? Or maybe some guidelines on how to work with Clips so what I described would work fluidly? (Maybe regarding threading or something).
tagged with: audio
type: UnansweredQuestion
score: 1
tagged with: java
upvote count: 1
type: Question
tagged with: clip
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/23202071

http://stackoverflow.com/comment/35504493
has text: Good. You're using an IDE. That makes it a lot easier then what we had when I started, like `vi` and `emacs`. So, what do you think `return Character.toLowerCase(c)-(int)'a';` does?
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/23209695
score: 0

http://stackoverflow.com/q/23212322
type: UnansweredQuestion
has body: I have recorded a session in scala. One request is failing even though I can see that tag in View source and Inspect Element. I tried all the other hidden fields but seems this one is not found. Here is the script: val scn = scenario("Scenario Name") .feed(csv("user_credentials.csv")) .exec(http("request_1") .get("/userLogin") .headers(headers_1) .check(regex("""&lt;input id="javax.faces.ViewState" """).saveAs("ViewState_id")) ).pause(1) .exec(http("request_999") .post("/userLogin") .headers(headers_1) .param("""loginForm""", """loginForm""") .param("""errorMsg""", """""") .param("""c_username""", "${username}") .param("""javax.faces.ViewState""", "${ViewState_id}") .param("""goButton""", """goButton""") ) The error which I'm getting is, c.e.e.g.h.a.GatlingAsyncHandlerActor - Request 'request_1' failed : Check 'exists' failed, found None I found the tag &lt;input id="javax.faces.ViewState" ..../&gt; in source but this script is not able to find it. I tried testing with other fields and some hidden fields also, all other components are found except this. How to solve this issue?
has comment: http://stackoverflow.com/comment/35526778
tagged with: jsf
tagged with: scala
has title: Check fails even if it exists in scala
upvote count: 1
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/23224575
tagged with: java
tagged with: gatling
score: 0
has comment: http://stackoverflow.com/comment/35529163
has comment: http://stackoverflow.com/comment/35508655
has comment: http://stackoverflow.com/comment/35526675
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/35514266

http://stackoverflow.com/a/23270682
score: 1
answers question: http://stackoverflow.com/q/23270513
has body: Because of the contract of the close() method. From the JavaDoc: Closes the stream and releases any system resources associated with it. Once the stream has been closed, further read(), ready(), mark(), reset(), or skip() invocations will throw an IOException. Closing a previously closed stream has no effect. When the buffered stream is closed, the BufferedReader can't read anything more and will notify the caller about this fact by throwing an IOException.
type: Answer
upvote count: 1
downvote count: 0

http://stackoverflow.com/q/23240528
tagged with: java
tagged with: authentication
has title: Is this a standard soap authentication request?
type: Question
answer count: 1
has answer: http://stackoverflow.com/a/23243123
score: 0
has comment: http://stackoverflow.com/comment/35559028
tagged with: soap
accepted answer: http://stackoverflow.com/a/23243123
tagged with: spring
has body: Below SOAP authentiation request returns a session id which is used for subsequent requests : &lt;soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:com.test"&gt; &lt;soapenv:Header/&gt; &lt;soapenv:Body&gt; &lt;urn:login&gt; &lt;urn:credential&gt; &lt;urn:companyId&gt;?&lt;/urn:companyId&gt; &lt;urn:username&gt;?&lt;/urn:username&gt; &lt;urn:password&gt;?&lt;/urn:password&gt; &lt;!--Optional:--&gt; &lt;urn:developerKey&gt;?&lt;/urn:developerKey&gt; &lt;/urn:credential&gt; &lt;!--Zero or more repetitions:--&gt; &lt;urn:param&gt; &lt;urn:name&gt;?&lt;/urn:name&gt; &lt;urn:value&gt;?&lt;/urn:value&gt; &lt;/urn:param&gt; &lt;/urn:login&gt; &lt;/soapenv:Body&gt; &lt;/soapenv:Envelope&gt; Is this related to "Basic access authentication" desribed at : http://en.wikipedia.org/wiki/Basic_access_authentication ? Currently I am using SAAJ to create the above request but is there a higher abstraction I should be using ? Reading about Spring (http://docs.spring.io/spring-ws/site/reference/html/client.html) and the WebServiceTemplate it does seem to provide an abstraction for authenticating but I don't know if this can be used to generate above SOAP authentication request?
type: AnsweredQuestion

http://stackoverflow.com/comment/35509676
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/23212666
has text: First, use `Executors.newXXX` rather than the constructor. Second, your question is unclear - you have a timeout set at 5 seconds (use `TimeUnit.SECONDS.toMillis(5)` there rather than `5000`), so the connection will timeout after 5 seconds. What do you mean by _the task will be kept running in the thread pool_?
type: Comment

http://stackoverflow.com/comment/35639047
score: 0
type: AnswerComment
has text: What indicates that `2dArray` contains chars?
type: Comment
comment on: http://stackoverflow.com/a/23283689

http://stackoverflow.com/comment/35611161
type: QuestionComment
has text: Okay, what have you tried? Have you build a user interface via [Swing](http://docs.oracle.com/javase/tutorial/uiswing/) or something? Do you have a problem with the [Drive API](https://developers.google.com/drive/v2/reference/)?
score: 0
comment on: http://stackoverflow.com/q/23268779
type: Comment

http://stackoverflow.com/comment/35397015
type: Comment
comment on: http://stackoverflow.com/a/23148742
type: AnswerComment
has text: "All possible subsets" is homologous to "the binary patterns of the numbers zero to 2^n - 1". 0000 means empty set, 0001 means only the first character, and so on.
score: 0

http://stackoverflow.com/comment/35611603
type: Comment
comment on: http://stackoverflow.com/a/23269442
has text: actually yes. the null check is stupid... recently read on SO an accusation that beginner Java programmers aggressively let things be null and null check.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/35369456
type: Comment
score: 1
has text: Actually I'm not using Spring AOP. This is a pure AspectJ Solution :)
comment on: http://stackoverflow.com/a/23133857
type: AnswerComment

http://stackoverflow.com/q/23254253
has answer: http://stackoverflow.com/a/23254455
tagged with: java
has answer: http://stackoverflow.com/a/23254606
downvote count: 0
type: UnansweredQuestion
score: 1
tagged with: exception
tagged with: regex
has body: I am getting a Pattern Syntax Exception for the following program. I have escaped the backslashes by using "\\", but there is a still an exception saying: Exception in thread "main" java.util.regex.PatternSyntaxException: Illegal/unsupported escape sequence near index 1 \left( ^ Here is the code: String[] paren = {"\\big(","\\Big(","\\bigg(","\\Bigg(","\\left("}; for(String x : paren){ if(line.contains(x)) line=line.replaceAll(x, "("); //error on this line } Thanks.
favorite count: 0
has title: Why is there a PatternSyntax Excpetion for the following program?
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/35584301
upvote count: 1

http://stackoverflow.com/comment/35446839
type: Comment
has text: Sorry but I am a total newbie and I don't know what you're talking about. Can you provide more detailed instructions on how to solve this problem?
comment on: http://stackoverflow.com/a/23177320
score: 0
type: AnswerComment

http://stackoverflow.com/comment/35447848
type: Comment
has text: Wow, thank you! Lots of great pieces of knowledge there for me to take in. Thanks!
comment on: http://stackoverflow.com/a/23177813
score: 0
type: AnswerComment

http://stackoverflow.com/a/23269797
has body: In fact there are four approaches, depending on how tight you want you classes have coupled. 1) Use a copy constructor: Note, that this term means to copy an instance, so that both are the same class. But it still works here also. class TypeA { String test; TypeA(TypeB input) { this.test = input.test; } } class TypeB { String test; } 2) Use a static from method in TypeA: This is essentially the same as the constructor, but might fit better, as you are free to design your constructors. class TypeA { String test; private TypeA() { /* private for demonstration purposes */ } static TypeA fromTypeB(TypeB input) { TypeA a = new TypeA(); a.test = input.test; return a; } } class TypeB { String test; } 3) Use a static to method in TypeB: This approach uses a conversion technique that is also seen in many libraries, including the JRE itself. Have a look at Collection.toArray. class TypeA { String test; } class TypeB { String test; static TypeA toTypeA() { TypeA a = new TypeA(); a.test = this.test; return a; } } 4) Use a conversion method as you did. The advantage is to not have any coupling between TypeA and TypeB. Which one you really choose, depends on your design, on your needs, and on the purposes of those classes.
answers question: http://stackoverflow.com/q/23269357
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/35613210
downvote count: 0
type: Answer

http://stackoverflow.com/comment/35620222
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23184587
has text: @ChamingaD in the future, if you are asking something that is homework, state that when asking the question. See http://meta.stackexchange.com/questions/10811/how-do-i-ask-and-answer-homework-questions
score: 0

http://stackoverflow.com/a/23277022
accepted answer of: http://stackoverflow.com/q/23257757
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: I would do on each frame after updating the player's position: camera.up.set(0,1,0); //Not sure if this is necessary. //Making sure up is always up after //last frame's lookAt() call. camera.postion.set(player.position) .add(-UNITS_BACK, UNITS_UP, 0) .rotate(Vector3.UP, player.angle); camera.lookAt(player.position); camera.update(); where player.angle is the number of degrees counter-clockwise the player is facing from the X-axis. That's a simple starting point. You'll probably want to smooth out the movement by limiting the speed at which the camera can move or giving it a second order interpolated movement to this target position and direction.
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/23257757

http://stackoverflow.com/q/23249312
tagged with: stream
tagged with: file
has title: How to calculate byte size of file if I declared it indirectly(BufferedReader with pathname?) (Java 6)
type: Question
has body: Hypothetically we have this line BufferedReader inStream = new BufferedReader(new FileReader("src.txt")); At opening and closure of file how to calculate its size (for example with length()) inStream.legth() ? at a System.out.println()?
has answer: http://stackoverflow.com/a/23249371
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/23249371
tagged with: size
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/q/23198442
has title: Opposite tag to @Override in Java
accepted answer: http://stackoverflow.com/a/23198466
has body: I know that in Java is tag @Override to annotate method which overrides method from superclass, if not there is a warning. My question: is there an opposite tag to annotate method which we do not want to override method from superclass (eg. by accident)? I know that I can set method in superclass final, but this solution involves changes in superclass code. That's what I don't want to do - just want to change my code :) I know that I can set another name for this method, but sometimes in super class there is a lot of methods and you simply not aware of them. So when you implement your own in subclass you might by accident use the same name. How to avoid this?
tagged with: annotate
tagged with: superclass
type: AnsweredQuestion
tagged with: java
tagged with: methods
has answer: http://stackoverflow.com/a/23198581
type: Question
has answer: http://stackoverflow.com/a/25083333
score: 5
upvote count: 5
tagged with: overriding
possible better answer: http://stackoverflow.com/a/25083333
answer count: 3
has answer: http://stackoverflow.com/a/23198466
downvote count: 0
favorite count: 0

http://stackoverflow.com/q/23180872
has body: I'm currently working on an Android project, in which I'm doing some calculation in C, using Android NDK. My application works fine as long as I do not run proguard, but when I do, a method "reportProgress", is stripped away by proguard. The method is part of a private inner class that extends AsyncTask private class CalculateTask extends AsyncTask I call my native code with a reference to the CalculateTask instance. The native code then call a member in this class, using the following code in JNI jclass taskClass = (*env)-&gt;GetObjectClass(env, task); jmethodID reportProgressMid = (*env)-&gt;GetMethodID(env, taskClass, "reportProgress", "(Ljava/lang/String;I)Z"); where task is the reference to the instance of CalculateTask. I'm having a hard time telling proguard not to strip away the public boolean reportProgress(String, int) method, which is only called via JNI. Until now I have taken the following approaches, none of which did the trick: Keeping the entire class: -keep class MYPACKAGENAME.CalculateScreen$CalculateTask Only keeping the mentioned method, by doing: -keep class MYPACKAGENAME.CalculateScreen$CalculateTask { public boolean reportProgress(java.lang.String,int); } Or this: -keepclassmembers class MYPACKAGENAME.CalculateScreen$CalculateTask { public boolean reportProgress(java.lang.String,int); } Using annotations (reusing a Google AdMob annotation): -keep class MYPACKAGENAME.CalculateScreen$CalculateTask { @com.google.android.gms.common.annotation.KeepName &lt;methods&gt;; } Or this: -keepclassmembers class MYPACKAGENAME.CalculateScreen$CalculateTask { @com.google.android.gms.common.annotation.KeepName &lt;methods&gt;; } My proguard configuration is based on the "optimize" distributed with Android SDK, named proguard-android-optimize.txt. Please note that proguard is run via Gradle, and I have made sure that the proguard task is cleaned and rerun.
has answer: http://stackoverflow.com/a/23189218
accepted answer: http://stackoverflow.com/a/23189218
downvote count: 0
tagged with: android-ndk
type: Question
score: 1
tagged with: java-native-interface
tagged with: java
linked to: http://stackoverflow.com/q/9298992
has comment: http://stackoverflow.com/comment/35453144
has title: Method in inner class stripped away by proguard
upvote count: 1
answer count: 1
favorite count: 0
tagged with: android
tagged with: proguard
type: AnsweredQuestion

http://stackoverflow.com/comment/35515263
comment on: http://stackoverflow.com/a/23195197
type: Comment
has text: Yes I've tried. I'm starting to give up. Maybe I should try with manual #UserTransaction.begin()/commit().
score: 0
type: AnswerComment

http://stackoverflow.com/a/39287715
answers question: http://stackoverflow.com/q/23260057
score: 0
type: Answer
has body: In my case, I forgot to add the dependency in the pom: org.aspectj aspectjweaver 1.8.5 Just make sure that you pick the right version (as for today 1.8.9 is latest)

http://stackoverflow.com/a/23359883
upvote count: 1
accepted answer of: http://stackoverflow.com/q/23226116
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35778018
answers question: http://stackoverflow.com/q/23226116
type: Answer
downvote count: 0
score: 1
has body: You forgot to call channel.flush() in your client after channel.write(new byte[] { 1, 2, 3, 4, 5, 6, 7, 8 }). Because it was never flushed, the server will never receive it. Alternatively, you can use writeAndFlush() which is a shortcut of write(...) and flush().

http://stackoverflow.com/q/23268501
has comment: http://stackoverflow.com/comment/35613740
type: Question
has comment: http://stackoverflow.com/comment/35609784
answer count: 2
has comment: http://stackoverflow.com/comment/35612384
has comment: http://stackoverflow.com/comment/35612585
has comment: http://stackoverflow.com/comment/35609746
tagged with: servlets
has comment: http://stackoverflow.com/comment/35614531
has comment: http://stackoverflow.com/comment/35610939
downvote count: 0
has body: I'm trying to enter data into a MySQL database with the following code. Any help would be greatly appreciated as I just can't work out why there is an exception. The request parameters are supplied by a HTML form and there don't appear to be any issues with that at all, the data gets through just fine. The issue seems to be occurring after the servlet is done and is probably somewhere in the DAO or connection manager. Thanks SO MUCH in advance! Relevant Servlet Code: UserRegistrationBean user = new UserRegistrationBean(); user.setUsername(request.getParameter("Username")); user.setPassword(request.getParameter("Password")); user.setEmail(request.getParameter("Email")); user = UserDAO.register(user); if (user.getExists() == true) { ErrorMessage = "The user name you entered has already been registered!"; request.setAttribute("ErrorMessage", ErrorMessage); request.getRequestDispatcher("/WEB-INF/register.jsp").forward(request, response); return; } UserDAO: public static UserRegistrationBean register(UserRegistrationBean bean) { Statement stmt = null; String username = bean.getUsername(); String password = bean.getPassword(); String email = bean.getEmail(); String searchQuery = "SELECT * FROM tblusers WHERE Username='" + username + "'"; String insertQuery = "INSERT INTO tblUsers (Username, Password, Email) VALUES ('" + username + "', '" + password + "', '" + email + "')"; try { currentCon = ConnectionManager.getConnection(); stmt = currentCon.createStatement(); //check if user exists ResultSet searchRs = stmt.executeQuery(searchQuery); //User name is available if (searchRs.next() == false) { bean.setExists(false); } //User name is not available else if (searchRs.next() == true) { bean.setExists(true); } if (bean.getExists() == true) { //Return error and prevent registration bean.setSuccess(false); return bean; } else { stmt.executeUpdate(insertQuery); bean.setSuccess(true); } } catch(Exception ex) { //exception available here } return bean; } ConnectionManager: public cl…
has comment: http://stackoverflow.com/comment/35615628
has answer: http://stackoverflow.com/a/23272619
linked to: http://stackoverflow.com/q/23267506
possible better answer: http://stackoverflow.com/a/23268848
favorite count: 0
has answer: http://stackoverflow.com/a/23268848
upvote count: 2
has comment: http://stackoverflow.com/comment/35613842
has title: Servlet - MySQL Error
has comment: http://stackoverflow.com/comment/35609787
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35609964
tagged with: java
has comment: http://stackoverflow.com/comment/35610020
has comment: http://stackoverflow.com/comment/35616407
accepted answer: http://stackoverflow.com/a/23272619
tagged with: mysql

http://stackoverflow.com/q/23238455
has comment: http://stackoverflow.com/comment/35556000
has comment: http://stackoverflow.com/comment/35556186
has answer: http://stackoverflow.com/a/23240899
tagged with: java
tagged with: hibernate
has title: NullPointerException while trying to add an ORM layer using Hibernate
has body: Well, I have been trying to add an ORM layer for past 3 weeks and I haven't been able to do so. I was trying to learn from the tutorial. I have done whatever the tutorial says. Here is the code: Student.java: package com.codinghazard.actions; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.Table; @Entity @Table(name="student") public class Student { @Id @GeneratedValue private int id; @Column(name="last_name") private String lastName; @Column(name="first_name") private String firstName; private int marks; public int getId() { return id; } public void setId(int id) { this.id = id; } public String getLastName() { return lastName; } public void setLastName(String lastName) { this.lastName = lastName; } public String getFirstName() { return firstName; } public void setFirstName(String firstName) { this.firstName = firstName; } public int getMarks() { return marks; } public void setMarks(int marks) { this.marks = marks; } } StudentDAO.java: package com.codinghazard.actions; import java.util.ArrayList; import java.util.List; import org.hibernate.Session; import org.hibernate.Transaction; import com.googlecode.s2hibernate.struts2.plugin. annotations.SessionTarget; import com.googlecode.s2hibernate.struts2.plugin. annotations.TransactionTarget; public class StudentDAO { @SessionTarget Session session; @TransactionTarget Transaction transaction; @SuppressWarnings("unchecked") public List<Student> getStudents() { List<Student> students = new ArrayList<Student>(); try { students = session.createQuery("from Student").list(); } catch(Exception e) { e.printStackTrace(); } return students; } public void addStudent(Student student) { try { session.save(student); } catch(Exception e) { System.out.println("Exception is "+e); } } } AddStudentAction.java: package com.codinghazard.actions; import java.util.ArrayList; import java.util.List; import com.opensymphony.xwork2.Actio…
type: Question
has comment: http://stackoverflow.com/comment/35555811
has comment: http://stackoverflow.com/comment/35556294
tagged with: configuration
tagged with: struts2
linked to: http://stackoverflow.com/q/22549634
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/35556327
has comment: http://stackoverflow.com/comment/35555952
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23241666
tagged with: struts2-s2hibernate

http://stackoverflow.com/comment/35396071
comment on: http://stackoverflow.com/q/23148471
has text: Please read this http://marioosh.5dots.pl/2014/02/12/java-8-default-and-static-methods-in-interfaces.html
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/comment/35500215
type: QuestionComment
has text: My class is implementing 'onChange' defined in 'SessionDirectoryNotification' as shown above. Sorry, could not fix the formatting even though I tried by referring to stackoverflow docs. I have been a reader for too long and recently tried to post questions and interact more. It is surprising that with < 15 reputation, one can't answer or contribute to any other discussions.
comment on: http://stackoverflow.com/q/23172160
score: 0
type: Comment

http://stackoverflow.com/a/23137699
downvote count: 0
upvote count: 2
type: Answer
score: 2
answers question: http://stackoverflow.com/q/23137464
has body: In Python, I would approach it like this: def interview(s): current = longest = 0 for index, char in enumerate(s): if index and char == s[index - 1]: longest, current = max(longest, current), 0 current += 1 return max(longest, current)

http://stackoverflow.com/comment/35452813
type: QuestionComment
has text: An XML document is only allowed a single DOCTYPE node or none at all, see http://www.w3.org/TR/xml/#NT-prolog. If a tool like JTidy creates two of them then it is broken or you are not using the right settings to have it output well-formed XML. As I am not familiar with JTidy I can't help with that. If you remove the two DOCTYPE nodes manually then I can't understand why you would still get the error message about doctype, that does not make sense to me. You might want to post a minimal but complete XML document for which Eclipse gives an error, then perhaps some with Eclipse can reproduce it
score: 0
comment on: http://stackoverflow.com/q/23179995
type: Comment

http://stackoverflow.com/a/23201794
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23201044
upvote count: 1
accepted answer of: http://stackoverflow.com/q/23201044
downvote count: 1
has body: With JDK1.6, you can use the built-in Javascript engine. this is tested and working . import java.io.*; import javax.script.ScriptEngineManager; import javax.script.ScriptEngine; import java.util.Scanner; import javax.script.ScriptException; public class MathExpress { public static void main(String[] args) throws ScriptException { Scanner console = new Scanner(System.in); System.out.println("Enter your arithematic oparation "); String Mathex= console.nextLine(); ScriptEngineManager mgr = new ScriptEngineManager(); ScriptEngine engine = mgr.getEngineByName("JavaScript"); System.out.println(engine.eval(Mathex)); } }
type: AcceptedAnswer

http://stackoverflow.com/q/23258601
tagged with: jpanel
has title: Java JList GUI formatting
has body: I am having trouble formatting the GUI for a program I am developing. I need to have four buttons with a JList above it. My JList keeps appearing besides all of my buttons instead of above them. Could anyone point me in the correct direction to solve my problem? import java.awt.BorderLayout; import java.awt.GridLayout; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JList; import javax.swing.JPanel; import javax.swing.JScrollPane; public class Test extends JPanel { private static final long serialVersionUID = 1L; private JList jlist; public static void main(String[] args) { JFrame boxOptions = new JFrame("Calculator"); boxOptions.setSize(0,0); boxOptions.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); boxOptions.setResizable(false); boxOptions.setLayout(new BorderLayout()); boxOptions.add(new Test(), BorderLayout.CENTER); boxOptions.pack(); boxOptions.setLocationRelativeTo(null); boxOptions.setVisible(true); } public Test(){ setLayout(new GridLayout(1, 4, 5, 5)); add(new JButton("add")); add(new JButton("Check In")); add(new JButton("Check Out")); add(new JButton("Delete")); String[] Titles = {"one", "two", "three"}; jlist = new JList(Titles); jlist.setVisibleRowCount(3); add(new JScrollPane(jlist), BorderLayout.NORTH); } }
possible better answer: http://stackoverflow.com/a/23258693
has answer: http://stackoverflow.com/a/23258693
type: AnsweredQuestion
tagged with: jlist
has comment: http://stackoverflow.com/comment/35592143
has answer: http://stackoverflow.com/a/23261709
type: Question
score: 0
answer count: 2
tagged with: swing
accepted answer: http://stackoverflow.com/a/23261709
has comment: http://stackoverflow.com/comment/35592243
tagged with: java

http://stackoverflow.com/comment/35596978
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23261317
score: 0
has text: all your sentence are same ?

http://stackoverflow.com/comment/35437988
type: Comment
comment on: http://stackoverflow.com/q/23172229
score: 0
type: QuestionComment
has text: I have added 17 days to the current date.

http://stackoverflow.com/a/23153889
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23153583
has body: In the class DiaryLogs.java you declare the strings timeEntry and entryEntered as static static String timeEntry; static String entryEntered; Remove the static modifier and you'll be fine. Static objects will have the same value for any instance of that class (and are accessible even without having an instance of it), so if you set the value in another object, every instance will use that value.
answers question: http://stackoverflow.com/q/23153583
has comment: http://stackoverflow.com/comment/35525253
has comment: http://stackoverflow.com/comment/35416002
type: Answer
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/35404900
upvote count: 2

http://stackoverflow.com/comment/35397671
comment on: http://stackoverflow.com/a/23149494
has text: Show a simple example. (and get +1)
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/23159909
answer count: 1
accepted answer: http://stackoverflow.com/a/23180922
has comment: http://stackoverflow.com/comment/35421168
has comment: http://stackoverflow.com/comment/35465314
linked to: http://stackoverflow.com/q/3030903
tagged with: cxf
has comment: http://stackoverflow.com/comment/35416186
tagged with: java
type: AnsweredQuestion
has title: Include WSDL in OSGi bundle
has comment: http://stackoverflow.com/comment/35420255
has body: I've got a bundle which needs to communicate with a web service. The client was generated using Apache CXF, the WSDL of the web service is a local file, because the target system doesn't host the WSDL. How can I integrate the WSDL into my OSGi bundle? Currently the web service client points to a file path of the WSDL which is pretty unuseful for deployment. Is there any way I can put the WSDL into the OSGi bundle? I tought about the resources folder, but there is none in my OSGi bundle. This is the relevant part of the Java class: @WebServiceClient(name = "WebService", targetNamespace = "http://company.com/target/namespace", wsdlLocation = "/tmp/WebService.wsdl") public class WebService After trying out this article, my code looks like this: static { URL url = null; WebServiceException e = null; try { url = XI07D2B3188DService.class.getClassLoader().getResource("WebService.wsdl"); } catch (Exception ex) { e = new WebServiceException(ex); } XI07D2B3188DSERVICE_WSDL_LOCATION = url; XI07D2B3188DSERVICE_EXCEPTION = e; } The error with the not found WSDL is now gone, but I've got a new error: 500 XML reader error: javax.xml.stream.XMLStreamException: ParseError at [row,col]:[1,1] Message: Content is not allowed in prolog. This is the beginning of my WSDL: &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;wsdl:definitions name="SI_PARTNER_OPENTIMES_OA" targetNamespace="http://company.ch/xi/partnernet/partner" xmlns:p1="http://company.ch/xi/partnernet/partner" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"&gt; &lt;wsdl:documentation /&gt; &lt;wsp:UsingPolicy wsdl:required="true" /&gt; &lt;wsp:Policy wsu:Id="OP_SI_PARTNER_OPENTIMES_OA" /&gt; I have already checked this question on SO. I tried changing it to UTF-16 but that didn't help. I also copied the content within Eclipse into a new file, but I've still got this error. Any…
has answer: http://stackoverflow.com/a/23180922
type: Question
has comment: http://stackoverflow.com/comment/35475054
tagged with: osgi
tagged with: wsdl
score: 0
has comment: http://stackoverflow.com/comment/35419694
tagged with: web-services

http://stackoverflow.com/comment/35383415
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23139060
has text: Path for OsX GUI apps is strange and confusing, posted some links in my answer for those interested. :)

http://stackoverflow.com/comment/35622054
has text: Is it a file permission issue? Are you running the IDE under the same user that you are running the command in the terminal?
comment on: http://stackoverflow.com/q/23274743
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23196130
type: Question
has title: Issue with encoding between java.text.Normalizer.Form.NFD and utf8 proc in C
has comment: http://stackoverflow.com/comment/35558958
tagged with: http://stackoverflow.com/tag/c
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/35480146
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/49072306
tagged with: java
has body: I would like to know if there are issues in handling special characters (like β) in German, Japanese ,korean languages in Java and utf8 in C. We are using java.text.Normalizer.Form.NFD in java side and passing the string to DB where we have custom function in C to normalize string .We have issues with names having ascents and special characters..eg : if name has ÄßÜ , after normalising DB changes it to "assu" in C function which is used to normalize. Is this an issue with UTF8 in C or is it is a mismatch between Java and C normalizer functions.How should we handle these special characters..
has comment: http://stackoverflow.com/comment/35559053
tagged with: character-encoding

http://stackoverflow.com/a/23202410
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/35490761
answers question: http://stackoverflow.com/q/23202279
has comment: http://stackoverflow.com/comment/35499538
has comment: http://stackoverflow.com/comment/35501989
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/35490644
type: Answer
accepted answer of: http://stackoverflow.com/q/23202279
has comment: http://stackoverflow.com/comment/35499278
has body: Since 7u25 you need Permissions: sandbox in the META-INF/MANIFEST.MF file (added with the m option of the jar command line utility). Here's an Oracle blog on the subject. It's there so that the jar can have its origin verified without raising privileges. Traditionally Java conflated verified origin with trust.

http://stackoverflow.com/comment/35606178
has text: Problem is I have a packet length of 13 how i will not that in two byte?
type: Comment
score: 0
comment on: http://stackoverflow.com/a/23263864
type: AnswerComment

http://stackoverflow.com/comment/35545000
type: Comment
has text: `I'm trying to apply reflection to this switch statement.` doesn't mean anything. Please clarify.
comment on: http://stackoverflow.com/q/23232535
score: 1
type: QuestionComment

http://stackoverflow.com/comment/35689291
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23269284
has text: I didn't, but what if I did? It's a poor question for which much documentation exists.

http://stackoverflow.com/a/23265022
has comment: http://stackoverflow.com/comment/35607160
has comment: http://stackoverflow.com/comment/35603801
has comment: http://stackoverflow.com/comment/35605120
has body: It should look like this: <?xml version="1.0" encoding="utf-8"?> <TextView android:id="@+id/textView1" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="20" android:gravity="center" android:text="hello world" android:textColor="@android:color/black" />
has comment: http://stackoverflow.com/comment/35604543
upvote count: 2
has comment: http://stackoverflow.com/comment/35604163
has comment: http://stackoverflow.com/comment/35606320
has comment: http://stackoverflow.com/comment/35604283
type: Answer
has comment: http://stackoverflow.com/comment/35605087
score: 2
has comment: http://stackoverflow.com/comment/35604454
accepted answer of: http://stackoverflow.com/q/23253795
downvote count: 0
has comment: http://stackoverflow.com/comment/35609176
has comment: http://stackoverflow.com/comment/35605984
has comment: http://stackoverflow.com/comment/35605591
answers question: http://stackoverflow.com/q/23253795
type: AcceptedAnswer

http://stackoverflow.com/a/23384683
has comment: http://stackoverflow.com/comment/35838957
has body: Well firstly you'll need to build a class that can wrap the native C++ function pointer in a TagCallback compatible base class: public class NativeTagCallback : TagCallback { protected long cppCallbackPtr; public NativeTagCallback( long callbackPtr ) { cppCallbackPtr = callbackPtr; } public native void NativeCallback( long callbackPtr, int arg0, String arg1, Set&lt;String&gt; arg2 ); public void callback(int arg0, String arg1, Set&lt;String&gt; arg2) { NativeCallback( cppCallbackPtr, arg0, arg2, arg2 ); } } The native code would be defined as follows: extern "C" jvoid Java_com_wrapper_NativeTagCallback_NativeCallback( JNIEnv* pEnv, jobject jCaller, jlong cppCallbackPtr, jint arg0, jstring arg1, jobject arg2 ) { MyCallback cppCallback = (MyCallback)cppCallbackPtr; const char* pCString = pEnv-&gt;GetStringUTFChars( arg1, 0); string arg1Str( pCString ); pEnv-&gt;ReleaseStringUTFChars( arg1, pCString ); set&lt; string &gt; arg2Set = ConvertJavaSetToCPPSet( arg2 ); // Perform your java to CPP set conversion here. cppCallbackPtr( (int)arg0, arg1Str, arg2Set ); } Then you would create the relevant class and pass it to your function from C++ as follows: void MyCpp::setTags(set&lt;string&gt; tags, MyCallback callback) { extern __thread JNIEnv* gpEnv; // Get the setTags function. jclass jWrapperClass = gpEnv-&gt;FindClass( "com/wrapper/cocoswrapper" ); // Insert the correct class name here. jmethodID jWrapperSetTag = gpEnv-&gt;GetStaticMethodID( jWrapperClass, "setTags", "(Landroid/content/Context;Ljava/util/Set;Lcom/wrapper/TagCallback)V;" ); // Get the TagCallback related function jclass jNativeTagCallbackClass = gpEnv-&gt;FindClass( "com/wrapper/NativeTagCallback" ); jclass jNativeTagCallbackConstructor = gpEnv-&gt;GetMethodID( jNativeTagCallbackClass, "&lt;init&gt;", "(J)V" ); jobject jNativeTagCallbackObject = gpEnv-&gt;NewObject( jNativeTagCallbackClass, jNativeTagCallbackConstructor, (jlong)callback) // Make function call. gpEnv-&gt;CallStaticVoidMethod( jWrapperClass,…
type: Answer
answers question: http://stackoverflow.com/q/23223058
upvote count: 4
accepted answer of: http://stackoverflow.com/q/23223058
score: 4
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/23143129
upvote count: 2
has body: I'm trying to make a simple calculator and need help with somthing import java.util.*; import javax.swing.*; public class HiWorld { public static void main(String[] args) { System.out.println("Type 2 Numbers"); Scanner input1 = new Scanner(System.in); Scanner input2 = new Scanner(System.in); answer = input1 + input2; System.out.println(answer); } It says that the operator + is undefined for the argument types java.util.scanner.
has comment: http://stackoverflow.com/comment/35386790
type: Question
type: AnsweredQuestion
tagged with: java
tagged with: eclipse
answer count: 2
has answer: http://stackoverflow.com/a/23143229
downvote count: 0
favorite count: 0
has title: Java Calculator errors java scanner
possible better answer: http://stackoverflow.com/a/23143187
has answer: http://stackoverflow.com/a/23143187
accepted answer: http://stackoverflow.com/a/23143229
score: 2

http://stackoverflow.com/q/23184559
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/35460318
favorite count: 0
has comment: http://stackoverflow.com/comment/35460287
tagged with: audio
type: AnsweredQuestion
has body: I am importing mp3transform into my java game. It is vital that I use mp3, and mp3transform works perfectly except for the fact it runs on the main thread, and therefore freezes the program. The already is a PlayerThread in the src, but it gives me a null pointer. I am new to the whole Java scene, and there seems to be no mp3transform help/docs D: Any help would be appreciated. Thanks.
tagged with: java
has answer: http://stackoverflow.com/a/23200210
upvote count: 1
tagged with: http://stackoverflow.com/tag/mp3
type: Question
has comment: http://stackoverflow.com/comment/35460243
tagged with: eclipse
tagged with: playback
has title: mp3transform | Playing (mp3's) on a Separate Thread
accepted answer: http://stackoverflow.com/a/23200210
answer count: 1

http://stackoverflow.com/q/23217454
score: 21
tagged with: java
has body: When I try create a new maven project (with several archetypes, not only the one below), I am facing this error: Unable to create project from archetype [org.apache.maven.archetypes:maven-archetype-quickstart:RELEASE] Unable to add module to the current project as it is not of packaging type 'pom' Anyone know why this is happening, and how to solve it?
tagged with: eclipse
type: Question
possible better answer: http://stackoverflow.com/a/34337237
has comment: http://stackoverflow.com/comment/35517466
downvote count: 0
answer count: 6
has answer: http://stackoverflow.com/a/34337237
has answer: http://stackoverflow.com/a/59338562
upvote count: 21
has title: Error when creating a new maven project
has answer: http://stackoverflow.com/a/78069044
favorite count: 0
has answer: http://stackoverflow.com/a/73508640
has comment: http://stackoverflow.com/comment/35517388
has comment: http://stackoverflow.com/comment/111480081
has answer: http://stackoverflow.com/a/23218364
accepted answer: http://stackoverflow.com/a/23218364
tagged with: maven
has comment: http://stackoverflow.com/comment/35518357
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/54675386

http://stackoverflow.com/q/23248535
type: Question
has title: Interface methods - implementation vs. definition
accepted answer: http://stackoverflow.com/a/23248624
score: 0
answer count: 1
tagged with: interface
type: AnsweredQuestion
has body: Please explain why the following isn't valid in Java (1.7). Having an interface: interface foo { mymethod(argument arg) } where argument also is an interface: interface argument{} an implementation of argument: class someArgument implements argument{} and an implementation of foo: class bar implements foo { mymethod(someArgument arg) {} } The class bar results in compilation errors, since mymethod isn't implemented. Is there anyway to accomplish the above with out the need of casting? Thanks!
has answer: http://stackoverflow.com/a/23248624
has comment: http://stackoverflow.com/comment/35573979
tagged with: java
has comment: http://stackoverflow.com/comment/35573418
has comment: http://stackoverflow.com/comment/35573350

http://stackoverflow.com/q/23162566
has comment: http://stackoverflow.com/comment/35423916
has answer: http://stackoverflow.com/a/23163071
type: UnansweredQuestion
has title: Error while create Progress Dialog on Database create
tagged with: java
has body: I would like to implement a progress dialog when the database load the data for the first time. this is my code DictionaryOpenHelper(Context context) { super(context, DATABASE_NAME, null, DATABASE_VERSION); mHelperContext = context; } @Override public void onCreate(SQLiteDatabase db) { mDatabase = db; mDatabase.execSQL(ENG_FRA_TABLE_CREATE); loadDictionaryEngFra(); new InitDB().execute(); } public class InitDB extends AsyncTask&lt;Void, Void, Void&gt; { @Override protected void onPreExecute() { super.onPreExecute(); pDialog = ProgressDialog.show(mHelperContext, "", "Wait", true); } @Override protected Void doInBackground(Void... params) { return null; } @Override protected void onPostExecute(Void result) { super.onPostExecute(result); pDialog.dismiss(); } } If i try to run the app with this progress dialog, it throw this error list 04-18 23:16:30.886: E/SQLiteLog(26059): (1) no such table: ENG_FRAdictionary 04-18 23:16:30.896: E/SQLiteDatabase(26059): Error inserting suggest_text_1=abbey suggest_text_2=n. a monastery ruled by an abbot 04-18 23:16:30.896: E/SQLiteDatabase(26059): android.database.sqlite.SQLiteException: no such table: ENG_FRAdictionary (code 1): , while compiling: INSERT INTO ENG_FRAdictionary(suggest_text_1,suggest_text_2) VALUES (?,?) 04-18 23:16:30.896: E/SQLiteDatabase(26059): at android.database.sqlite.SQLiteConnection.nativePrepareStatement(Native Method) 04-18 23:16:30.896: E/SQLiteDatabase(26059): at android.database.sqlite.SQLiteConnection.acquirePreparedStatement(SQLiteConnection.java:1113) 04-18 23:16:30.896: E/SQLiteDatabase(26059): at android.database.sqlite.SQLiteConnection.prepare(SQLiteConnection.java:686) 04-18 23:16:30.896: E/SQLiteDatabase(26059): at android.database.sqlite.SQLiteSession.prepare(SQLiteSession.java:588) 04-18 23:16:30.896: E/SQLiteDatabase(26059): at android.database.sqlite.SQLiteProgram.&lt;init&gt;(SQLiteProgram.java:58) 04-18 23:16:30.896: E/SQLiteDatabase(26059): at android.database.sqlite.SQLiteStatement.&lt;in…
has answer: http://stackoverflow.com/a/23164022
type: Question
answer count: 2
score: 0
tagged with: android
tagged with: android-asynctask

http://stackoverflow.com/q/23162686
accepted answer: http://stackoverflow.com/a/23163496
has body: I'm trying to do some image processing using with Java. As a start, before doing any filters or anything, I'm doing a convert process on my image to a byte array, then convert it back to an image and save it to see how that goes. I'm not getting the output image as the input one, there is some lost information/data, which causing the output to look different in colors. Please tell me what is the problem; what I am missing. import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import javax.imageio.ImageIO; public class Ola { BufferedImage img = null; public void loadImage() { try { img = ImageIO.read(new File("/home/a/Pictures/Tux-vegeta.png")); } catch (IOException e) { System.out.println("image(s) could not load correctly, try changing the path"); } } public byte[] convertToArray() { int w = img.getWidth(); int h = img.getHeight(); int bands = img.getSampleModel().getNumBands(); System.out.print(bands); if (bands != 4) { System.out.println("The image does not have 4 color bands"); } byte bytes[] = new byte[4 * w * h]; int index = 0; for(int y = 0; y &lt; h; y++) { for(int x = 0; x &lt; w; x++) { int pixel = img.getRGB(x, y); int alpha = (pixel &gt;&gt; 24) &amp; 0xFF; int red = (pixel &gt;&gt; 16) &amp; 0xFF; int green = (pixel &gt;&gt; 8) &amp; 0xFF; int blue = pixel &amp; 0xFF; bytes[index++] = (byte) alpha; bytes[index++] = (byte) red; bytes[index++] = (byte) green; bytes[index++] = (byte) blue; } } return bytes; } public void convertToImage(byte[] bytes) { try { int w = 300; int h = 300; int index = 0; BufferedImage resultPNG = new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB); for (int i = 0; i &lt; h; i++) { for (int j = 0; j &lt; w; j ++) { int pixel = (bytes[index] &lt;&lt; 24) | (bytes[index + 1] &lt;&lt; 16) | (bytes[index + 2] &lt;&lt; 8) | (bytes[index + 3]); resultPNG.setRGB(j, i, pixel); index += 4; } } File outputImage = new File("/home/a![enter image description here][1]/Pictures/test.png"); ImageIO.write(resultPNG,…
tagged with: eclipse
tagged with: image
answer count: 2
has title: Image to byte[] to Image
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/23163496
possible better answer: http://stackoverflow.com/a/23162828
has answer: http://stackoverflow.com/a/23162828
type: AnsweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/35421195
upvote count: 1
type: Question

http://stackoverflow.com/a/23237588
score: 1
has body: I was able to solve this problem by changing my template to the following which is a solution I found at http://swig.10945.n7.nabble.com/Converting-char-to-byte-String-in-Java-td276.html // knows about things like int *OUTPUT: %include "typemaps.i" // knows about int32_t %include "stdint.i" %include "arrays_java.i" %apply int[] {int *}; // convert char * to byte array %apply signed char[] {char* pchar}; %include "wchar.i"
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23234571
answers question: http://stackoverflow.com/q/23234571
type: Answer
downvote count: 0

http://stackoverflow.com/a/23133513
answers question: http://stackoverflow.com/q/23133274
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/35368832
upvote count: 1
downvote count: 0
has body: You may take an ArrayList of String instead of Array of String , and do it like : List&lt;String&gt; words = new ArrayList&lt;&gt;(); while (line!= null) { words.add(line); line = reader.readLine(); } int count=words.size(); System.out.println(count); OR, if you don't want to use List, You can do it like: while (line!= null) { text += line+"#"; line = reader.readLine(); } System.out.println(text); String words[] = text.split("#"); int count=words.length; System.out.println(count);

http://stackoverflow.com/q/23212890
answer count: 1
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23213558
score: 0
tagged with: java
tagged with: file
tagged with: resources
type: Question
has body: I have several resource files located in META-INF folder in my spring project. I want to filter those files based on the file name using wild cards Eg: Files located in META-INF folder as follows a-config.xml b-config.xml c-config.xml What I want is to filter these files using the wild card *-config.xml I already know that I can easily use spring ResourcePatternResolver for this. I tried to use java.io.FileFilter but even for that I have to pass a RegEx to filter the file names. eg: FileFilter customFilter = new FileFilter() { @Override public boolean accept(File pathname) { if(pathname.getName().matches("(.*)config(.*)")) { return true; } return false; } }; Are there any other ways to do this without using any third party dependencies (Spring,Google Guava etc) and RegEX? I want to use simple wild card characters to do the filtering. Your comments are highly appreciated.
has comment: http://stackoverflow.com/comment/35510146
tagged with: wildcard
has comment: http://stackoverflow.com/comment/35510323
has title: How to filter resource files based on wild card using only JAVA APIs
has comment: http://stackoverflow.com/comment/35509845
tagged with: filter
has comment: http://stackoverflow.com/comment/35509639

http://stackoverflow.com/q/23147273
answer count: 2
has answer: http://stackoverflow.com/a/23147363
has body: I was wondering whether user data gets wiped every time I debug my app/run in eclipse in the emulator? Also, do sharedPrefences get wiped everytime an app is killed? Thank you :)
upvote count: 1
downvote count: 0
favorite count: 0
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/23147398
has title: Is app data wiped every time debug/deploy? android Eclipse
score: 1
tagged with: java
tagged with: eclipse
type: Question

http://stackoverflow.com/comment/35403623
type: QuestionComment
has text: use substring function substring(15,29); it will give \img\image.jpg
comment on: http://stackoverflow.com/q/23153168
score: 0
type: Comment

http://stackoverflow.com/a/24331250
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/77593963
downvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/72352092
has comment: http://stackoverflow.com/comment/98016300
has body: I think it's necessary to set the smallIcon first when you create the notification. Notification.Builder notificationBuilder= new Notification.Builder(context); notificationBuilder.setSmallIcon(R.drawable.yourIcon); // then set other staff... Here is another simple example from Cousera Android class, Click here
upvote count: 38
answers question: http://stackoverflow.com/q/23148734
score: 37
accepted answer of: http://stackoverflow.com/q/23148734

http://stackoverflow.com/a/23165926
has body: In your Unit test, temporarily rename the file com/qn/config/StringBundles.properties, and then run the code. When the test is complete, rename it back.
answers question: http://stackoverflow.com/q/23165881
score: 0
type: Answer

http://stackoverflow.com/comment/35560753
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23186987
has text: So as people are saying, the class is being loaded both two classloaders. One of these is an OSGi bundle classloader, the other is something related to Java RMI due to the involvement of EJB. I can't help much beyond that because I haven't used RMI or EJB for many years (and good riddance to them!).
score: 0

http://stackoverflow.com/comment/35575982
type: Comment
type: QuestionComment
has text: @Invictus yes, but what does it do when this is the case ? There is a semicolomn closing the if statement. if (condition); is no op until condition has a side effect (then the if is useless).
score: 0
comment on: http://stackoverflow.com/q/23249533

http://stackoverflow.com/comment/35460028
type: QuestionComment
has text: Hint for the future: backup, version control.
comment on: http://stackoverflow.com/q/23184806
score: 0
type: Comment

http://stackoverflow.com/q/23151309
tagged with: tcp
tagged with: java
has comment: http://stackoverflow.com/comment/35400695
tagged with: mysql
type: Question
upvote count: 1
has answer: http://stackoverflow.com/a/23151407
has body: I have an Android Client which can send a Image to Java server on TCP socket , Java server insert's the Image received into MySQL as a Long Blob and also client ID. Now I want that the Java server to retrieve all the images saved in MySQL for a given client II, and send all the Images to Android client. Can anyone give an example or any Idea for doing this?
score: 0
tagged with: android
answer count: 1
downvote count: 1
favorite count: 0
type: UnansweredQuestion
tagged with: sockets
has title: Android Client /Java Server and Mysql DataBase Tcp Socket Programming

http://stackoverflow.com/comment/35535252
type: Comment
has text: @xQbert Thanks a lot. I appreciate your help. I too didn't see any better solution. I will go with this approach.
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23226095

http://stackoverflow.com/comment/64331010
type: AnswerComment
type: Comment
has text: So caprica, is the MRL correct? What is the correct MRL to be used for Windows files? For instance, for a file `D:\sample.mp4`.
comment on: http://stackoverflow.com/a/23285685
score: 0

http://stackoverflow.com/a/23171752
has comment: http://stackoverflow.com/comment/35443572
answers question: http://stackoverflow.com/q/23170177
has body: Parent-child entities should be used only for relationships that never change (e.g. a user and his photo). For dynamic relationships you have three options: (A) Store references to other objects as a property (e.g. userFriends property in a User entity). If a relationship is unidirectional (e.g. User A likes User B), then you can update only one entity. For bidirectional relationships, you update both entities. (B) Create a new entity type Relationship with two properties User A and User B. Create and delete these entities as necessary. (C) When User A likes User B, create a new entity Relationship as a child entity of User A and use an id of User B as an id for this new Relationship entity. The choice between these options depends on your data model and data access patterns.
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/35441964

http://stackoverflow.com/comment/35495528
score: 0
comment on: http://stackoverflow.com/q/23205061
type: Comment
type: QuestionComment
has text: It does cost, but this cost is so cheap that you should not worry about it.

http://stackoverflow.com/comment/35487166
score: 0
has text: Though I am still getting the error, but found a way to do what I wanted to achieve with a new feature, "Rest Mocking" , in soapUI 5.0.0. But if someone has an idea about this error, please let me know. Thanks.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23158232

http://stackoverflow.com/a/50335052
score: 3
upvote count: 3
downvote count: 0
has body: There is an implementation in Kotlin to start a sensor on a thread. For sensor's values can be handle in onSensorChanged class LightManager(context: Context) : SensorEventListener { private val sensorManager: SensorManager? private val lightSensor: Sensor? private var handlerThread: HandlerThread? = null init { this.sensorManager = context.getSystemService(Context.SENSOR_SERVICE) as SensorManager? this.lightSensor = sensorManager?.getDefaultSensor(Sensor.TYPE_LIGHT) this.handlerThread = HandlerThread(LightManager::class.java.simpleName) this.handlerThread?.start() val handler = Handler(this.handlerThread?.looper) this.sensorManager?.registerListener(this, this.lightSensor, SensorManager.SENSOR_DELAY_NORMAL, handler) } fun onStop() { sensorManager?.unregisterListener(this) if (this.handlerThread?.isAlive == true) this.handlerThread?.quitSafely() } override fun onAccuracyChanged(p0: Sensor?, p1: Int) { } override fun onSensorChanged(p0: SensorEvent?) { //handle your value here with p0?.values?.get(0)?.toInt() for example } }
type: Answer
answers question: http://stackoverflow.com/q/23209804

http://stackoverflow.com/a/23304559
accepted answer of: http://stackoverflow.com/q/23277853
type: Answer
answers question: http://stackoverflow.com/q/23277853
score: 1
upvote count: 1
has body: One word answer is NO. Slightly longer answer is: HBase does not process unneeded families during scanning at all. Every family is actually stored into different storage so it is obvious there is no need to search something into not specified family. If no family is specified, all families are scanned. Even more detailed explanation: at lease AFAIK for HBase 0.96 I see there is RegionScanner interface and RegionScannerImpl class which is member of HRegion. This scanner constructor checks if families are specified into your Scan object and additional scanners list is determined based on families array (per store).
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/23281862
accepted answer: http://stackoverflow.com/a/23288539
tagged with: grails
tagged with: servlets
has comment: http://stackoverflow.com/comment/35647748
downvote count: 0
tagged with: runtime
answer count: 1
favorite count: 0
has body: I have a scenario where, if a user gives my Grails app a certain type of input, I want to dynamically add a javax.servlet.Filter impl (MyCustomerFilter) so that all subsequent requests to the server get passed through this filter. In other words, when the Grails app starts up, MyCustomFilter is not activated and is not in the filter chain. But when the user does something (let's say makes an AJAX call back to a server-side controller) I want to add MyCustomFilter to the filter chain and activate it (for all future/subsequent requests). Is this possible? If so, how? If not, why?
has answer: http://stackoverflow.com/a/23288539
score: 2
has title: Add servlet filter to a Grails app dynamically
type: AnsweredQuestion
upvote count: 2
tagged with: servlet-filters
type: Question
has comment: http://stackoverflow.com/comment/35635835
tagged with: java
has comment: http://stackoverflow.com/comment/35635814

http://stackoverflow.com/comment/35622434
type: Comment
has text: @user3268216: Well it's *not* working if you're getting an error - you need to make it a static method (as I described in my answer).
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23274881

http://stackoverflow.com/comment/35463048
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23186602
has text: The error is the same that you can see on the question.
type: AnswerComment

http://stackoverflow.com/a/23278244
score: 3
upvote count: 3
accepted answer of: http://stackoverflow.com/q/23276471
has comment: http://stackoverflow.com/comment/35633484
type: AcceptedAnswer
downvote count: 0
has body: As people have mentioned in the comments loading the whole DOM into memory especially for large XMLs can be very inefficient therefore a better approach is to use the SAX parser that consumes constant memory. The drawback there is that you don't get the fluent API of having the whole DOM in memory and the visibility is quite limited if you want to perform complicated callback logic in nested nodes. If all you are interesting in doing is parsing particular nodes and node families rather than parsing the whole XML then there is a better solution that gives you the best of both worlds and has been blogged about and open-sourced. It's basically a very light wrapper on top of SAX parser where you are registering the XML elements you are interested in and when you are getting the callback you have at your disposal their corresponding partial DOM to XPath. This way you can keep your complexity at constant time (scaling to over 1GB of XML file as documented in the above blog) while maintaining the fluency of XPath-ing the DOM of the XML elements you are interested in.
type: Answer
answers question: http://stackoverflow.com/q/23276471

http://stackoverflow.com/a/23162798
type: Answer
has body: You have a list of NameValuePair...you could just as easily have a list of Obejct, or a list of Date. The list is the container object, and whats inside the '&lt; >' specifies what TYPE of objects it holds. Also in Java 1.7 they let us get lazy and you can drop the second parameter and just use: List&lt;NameValuePair&gt; params = new ArrayList&lt;&gt;(); Example: Lets create 2 lists List&lt;Object&gt; objectList = new ArrayList&lt;&gt;(); List&lt;Marbles&gt; marbleList = new ArrayList&lt;&gt;(); now lets create 2 objects Marble blueMarble = new Marble(); Checker redChecker = new Checker(); We can put both into the objectList since they are both objects. However we can only put the blueMarble into the marbleList, the checker is an invalid Type for that list. Typing allows you to control what data is valid, So later on in the code you dont have to check the object class type when you extract from the list. EDIT: From your added comments to the original question. Editor is the Inner class. Unless it extends SharedPreferences, it is not a child class of SharePreferences
score: 0
answers question: http://stackoverflow.com/q/23161665
has comment: http://stackoverflow.com/comment/35421955

http://stackoverflow.com/comment/35629547
score: 0
type: Comment
type: QuestionComment
has text: tri.tri[i] is i'th pascals triangle row with integers, but I can handle that, I mainly want it to look like on the first pic, so that every line is centered and there is just 1 row in each line
comment on: http://stackoverflow.com/q/23278691

http://stackoverflow.com/comment/35537892
has text: How could it be? it does exist!
comment on: http://stackoverflow.com/a/23228580
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/35377306
type: Comment
comment on: http://stackoverflow.com/q/23131494
type: QuestionComment
has text: i used the connector/J but im trying to extract the Last_SQL_Error. i didnt find way to to it. how can i process the resultset? thank you
score: 0

http://stackoverflow.com/a/23217539
accepted answer of: http://stackoverflow.com/q/23217222
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23217222
downvote count: 0
type: Answer
score: 2
upvote count: 2
has body: The problem is probably with (aResult.get(counter)).getAwayNumber(). It has a value of 20 and the aLeaderboard list does not have that index.

http://stackoverflow.com/q/23250025
score: 0
has comment: http://stackoverflow.com/comment/35608723
tagged with: tiles
has comment: http://stackoverflow.com/comment/35582957
has comment: http://stackoverflow.com/comment/35608849
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35607945
tagged with: spring-mvc
answer count: 0
tagged with: java
has title: Stackoverflow Exception with Apache Tiles
has comment: http://stackoverflow.com/comment/35597914
type: Question
tagged with: tiles-3
has body: I have a problem with tiles I have a template (mainLayout) which does basically the following: ... <jsp:include page="/services" /> ... The url /services is served by a Spring controller which uses Tiles3. The /services url is using a different layout (rawLayout) which just outputs a jsp. The problem is that the code is generating a stackoverflow error. Actually, when trying to render the /services url with a raw layout, Tiles is actually switching to mainLayout. I debugged Tiles, and even though the definition is correct (rawLayout), the BasicTilesContainer::getAttributeContext method is switching back to the originating layout (mainLayout). It seems that Tiles is not using the template from the definition, but takes it from an execution stack. My tiles definition: <put-attribute name="content" value=""/> <put-attribute name="content" value=""/> <put-attribute name="content" value="/WEB-INF/jsp/services.jsp" /> I hope this is clear enough. Thanks

http://stackoverflow.com/comment/35366844
type: Comment
comment on: http://stackoverflow.com/a/23132215
has text: Which app server (with which version) you are using for deployment?
type: AnswerComment
score: 0

http://stackoverflow.com/comment/35577888
has text: Hmmm... so your stack display is upside down. Interesting.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23250815
score: 0

http://stackoverflow.com/q/23132571
tagged with: android-listview
has comment: http://stackoverflow.com/comment/35369543
upvote count: 1
has comment: http://stackoverflow.com/comment/35369042
has body: i have developed an application that have one list view and that list view's one item contain one image view one text view and one check box so my question is how to handle check box checked and unchecked event of particular list view item Adapter class for list view package com.rk.test_facebook; import android.app.Activity; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.CheckBox; import android.widget.ImageView; import android.widget.TextView; import java.util.ArrayList; public class ListAdapter extends BaseAdapter { private ArrayList&lt;String&gt; imageUrl; private final ArrayList&lt;String&gt; name; private final ArrayList&lt;String&gt; birthday; private Activity activity; private static LayoutInflater inflater = null; public ImageLoader imageLoader; public ListAdapter(Activity activity, ArrayList&lt;String&gt; imageUrl, ArrayList&lt;String&gt; birthday, ArrayList&lt;String&gt; name) { this.activity = activity; this.imageUrl = imageUrl; this.name = name; this.birthday = birthday; inflater = (LayoutInflater) activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE); imageLoader = new ImageLoader(activity.getApplicationContext()); } public int getCount() { return name.size(); } public Object getItem(int position) { return position; } public long getItemId(int position) { return position; } public View getView(int position, View convertView, ViewGroup parent) { View view = convertView; if (convertView == null) view = inflater.inflate(R.layout.listelement, null); TextView text = (TextView) view.findViewById(R.id.text); ImageView image = (ImageView) view.findViewById(R.id.image); CheckBox checkBox = (CheckBox) view.findViewById(R.id.checkbox); text.setText((name.get(position))); imageLoader.DisplayImage(imageUrl.get(position), image); return view; } } main activity package com.rk.test_facebook; import android.app.Activity; import andr…
has answer: http://stackoverflow.com/a/23133966
favorite count: 0
has comment: http://stackoverflow.com/comment/35366893
tagged with: android
has answer: http://stackoverflow.com/a/23132908
linked to: http://stackoverflow.com/q/12602426
tagged with: android-adapter
has comment: http://stackoverflow.com/comment/35367239
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35370077
downvote count: 0
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/23132741
accepted answer: http://stackoverflow.com/a/23132741
type: Question
has title: how to handle check box event in list view item in android
possible better answer: http://stackoverflow.com/a/23132908
tagged with: listview
answer count: 3

http://stackoverflow.com/comment/35463093
type: QuestionComment
comment on: http://stackoverflow.com/q/23186549
score: 0
has text: @maxx777 Not sure what makes you think so. Added another one. That said this has been asked and answered scores of times.
type: Comment

http://stackoverflow.com/a/75105725
answers question: http://stackoverflow.com/q/23215299
has comment: http://stackoverflow.com/comment/133943328
type: Answer
has body: Using this I'm able to get the local datetime Instance: LocalDateTime.now().toInstant(ZoneOffset.UTC)
score: 0
upvote count: 1
downvote count: 1

http://stackoverflow.com/a/23289290
upvote count: 1
answers question: http://stackoverflow.com/q/23289168
downvote count: 0
has body: Assigning a new object to variable will make previous object eligible for garbage collection if it is not referenced by any live thread.. and you can do like you have done.. and Assigning one object to another just assigns the object reference (a pointer more or less). It does NOT copy member variables etc.. e.g. b=c;
score: 1
type: Answer

http://stackoverflow.com/comment/35473124
score: 0
type: Comment
type: QuestionComment
has text: To get an immobile disk in the collision computations, set its mass to infinity. http://www.vobarian.com/collisions/ seems to be a decent source for the mathematics, even if they too do not mention angular momentum.
comment on: http://stackoverflow.com/q/23180453

http://stackoverflow.com/q/23231441
has title: SQL Server 2008 connection issues
has answer: http://stackoverflow.com/a/23313230
has comment: http://stackoverflow.com/comment/35545645
answer count: 1
has body: So I'm working on a project using a SQL Server 2008 database. It uses Java with Hibernate. I was doing some work on it last week, it was working (relatively) fine. I came back to it today and all of the sudden Hibernate can't login or connect to the database. I suspect the problem is in SQL Server because I tried connecting to it with JDBC but that didn't work either. Server authentication is set to "SQL Server and Windows Authentication mode" my users "dummy" and "root" have "Grant" check on all explicit permissions. The username and password I enter are correct. I know this because I can log in o SQL Server Management Studio with those logins and run queries. The database is on a Windows XP virtual machine and I'm using Eclipse on my host machine. I have Port Forwarding and everything set up with Oracle VirtualBox (like I said, it was working fine last week). Any suggestions? --EDIT-- See the comments below the original post ---EDIT--- I made a discovery. My Java project is not even getting connected with the SQL Server. When I fail a log in with a .udl test, a log message is created for the failed login. But whenever I fail to login using my Java project on my host machine, there are logs created. I should also point out that I can connect to a MySQL database running on the same VM and run queries on it just fine. Is there something wrong with this URL String? "jdbc:sqlserver://192.168.56.1:1433;databaseName=MLB;user=dummy;password=123" I can confirm that the IP Address, Port number, database name, username, and password are all correct.
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/35545215
has comment: http://stackoverflow.com/comment/35543536
has comment: http://stackoverflow.com/comment/35543466
accepted answer: http://stackoverflow.com/a/23313230
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35549149
has comment: http://stackoverflow.com/comment/35545302
tagged with: sql-server
has comment: http://stackoverflow.com/comment/35543582
type: Question
tagged with: sql
has comment: http://stackoverflow.com/comment/35543277
tagged with: database-security
score: 0
has comment: http://stackoverflow.com/comment/35548433

http://stackoverflow.com/a/23245152
downvote count: 0
type: Answer
upvote count: 2
has body: You need to tell it to allow a privileged action. Using the AccessController. Try this: public void start() { AccessController.doPrivileged(new PrivilegedAction&lt;Object&gt;(){ @Override public Object run() { try{ BufferedReader br=new BufferedReader(new FileReader(new File("database.txt"))); BufferedWriter br2=new BufferedWriter(new FileWriter(new File("database1.txt"))); String st; while((st=br.readLine())!=null){ String []str=st.split(";"); br2.write(st+"\n"); } } catch(IOException e){} //catch your exceptions } } }); }
accepted answer of: http://stackoverflow.com/q/23245068
answers question: http://stackoverflow.com/q/23245068
score: 2
type: AcceptedAnswer

http://stackoverflow.com/q/23186750
has comment: http://stackoverflow.com/comment/35463450
has title: not able to scroll down
upvote count: 2
tagged with: swing
accepted answer: http://stackoverflow.com/a/23186810
score: 2
type: AnsweredQuestion
tagged with: java
has body: For some reason I am not able to scroll down any taught? I tried adding to a panel and then the panel to the scrollbar but nothing works. I need some help to solve this problem, i have been stock for hours. import java.applet.Applet; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Frame; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.Reader; import javax.swing.JApplet; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JList; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTextField; import javax.swing.event.AncestorListener; public class StartActivity extends JFrame implements ActionListener{ /** * */ private static final long serialVersionUID = -1470898831456146593L; private JTextField textField; public JTextField[] textStock = new JTextField[190]; public tags[] tags = new tags[90]; public String[] tg = new String[90]; public JList set = new JList(); private JPanel topPanel; @SuppressWarnings("resource") public StartActivity(){ setSize(1800, 900); // create an instance setBackground(Color.gray); setFocusable(true); setLayout(null); topPanel = new JPanel(); topPanel.setLayout( new BorderLayout() ); getContentPane().add( topPanel ); getContentPane().add(new JScrollPane()); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //FileReader file = null; // get the tags and their name //FileReader file2 = null; InputStreamReader file; InputStream is = getClass().getResourceAsStream("/resource/tagsName.txt"); InputStream is2 = getClass().getResourceAsStream("/resource/ref.txt"); file = new InputStreamReader(is); InputStreamReader file2 = new InputStreamReader(is2); //file = new FileReader("src/resource/tagsName.txt"); BufferedReader br = new BufferedRea…
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/23188147
tagged with: jscrollpane
has answer: http://stackoverflow.com/a/23188147
downvote count: 0
has answer: http://stackoverflow.com/a/23186810
has comment: http://stackoverflow.com/comment/35463376
favorite count: 0

http://stackoverflow.com/comment/35432855
comment on: http://stackoverflow.com/a/23167844
score: 0
type: AnswerComment
has text: That's not an error, that's the detail about the added file you asked for with 'v'. And the algorithm is deflated not deflected.
type: Comment

http://stackoverflow.com/comment/35647299
type: Comment
has text: Yes I did know about that , and I checked through Scala WS examples as well, but couldn't figure out how to work it out, I guess I will just have to find some other way around then. And thank you for the value able insights that you provided. And hopefully, the Java API I am using, gets ported in Scala as well.
type: AnswerComment
comment on: http://stackoverflow.com/a/23287161
score: 0

http://stackoverflow.com/comment/35594461
has text: That does not work for anonymous `OnClickListeners`. You need to do two separate ones. The event is only fired for the view it is attached to, so checking the id is pointless.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23259596

http://stackoverflow.com/q/23170589
downvote count: 3
score: -1
accepted answer: http://stackoverflow.com/a/23170840
has comment: http://stackoverflow.com/comment/35435223
type: Question
upvote count: 2
has title: Coding bat simple code logic in JAVA
has answer: http://stackoverflow.com/a/23170979
has answer: http://stackoverflow.com/a/23170840
has answer: http://stackoverflow.com/a/23170681
answer count: 3
favorite count: 0
has body: Coding bat is a website to test the candidate's logic and reasoning abilities using JAVA or Python. I am trying the following problem and am unable to proceed: Given a non-negative number "num", return true if num is within 2 of a multiple of 10. Note: (a % b) is the remainder of dividing a by b, so (7 % 5) is 2. See also: Introduction to Mod nearTen(12) → true nearTen(17) → false nearTen(19) → true . The code I have written is : { public boolean nearTen(int num) { if (num==10 || num==1){ return true;} else if (num&lt;10){ return false;} else if ((num+2)%10==0 || ((num-2)%10==0)){ return true;} else if ((num+1)%10==0 || ((num-1)%10==0)){ return true;} else{ return false;} } } Can anyone of you please tell my mistake so that I can improve on the same?
possible better answer: http://stackoverflow.com/a/23170979
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/35514566
type: AnswerComment
comment on: http://stackoverflow.com/a/23212476
score: 0
type: Comment
has text: where is the edit sir? WOW i saw your picture of the app...WOW

http://stackoverflow.com/a/23165906
answers question: http://stackoverflow.com/q/23165790
type: Answer
has comment: http://stackoverflow.com/comment/35446935
has body: I can't get that the program display all the image automatically, it only display the last image You are not using Threads correctly. Invoking the run() method is not how to start a Thread. Also, the Thread.sleep() causes the Event Dispatch Thread to sleep so the GUI can't repaint itself until all the code in the loop has been executed. Some suggestions: Don't keep an array or JLabels. Instead keep an Array of Icons. Then you just create a single label that you display on the GUI. For your animation you simple change the Icon of the label by using the setIcon(...) method. Don't attempt to use Threads. Instead you should use a Swing Timer for the animation. You start the Timer and every time the Timer fires you change the Icon of the label. Read the section from the Swing tutorial on How to Use Timers for a simple animation example.
score: 0

http://stackoverflow.com/comment/35373645
type: Comment
type: QuestionComment
has text: cant do that at the moment
comment on: http://stackoverflow.com/q/23135862
score: 0

http://stackoverflow.com/comment/35644458
type: Comment
type: QuestionComment
has text: Actually your note would suggest that you should believe the complete opposite of what your question title is.
comment on: http://stackoverflow.com/q/23286291
score: 0

http://stackoverflow.com/a/23265049
score: 2
has comment: http://stackoverflow.com/comment/35603939
has comment: http://stackoverflow.com/comment/35604077
has comment: http://stackoverflow.com/comment/35603869
has comment: http://stackoverflow.com/comment/35603841
has body: You've got a variable of type Object, and you're calling Arrays.asList. That means you've effectively called: List&lt;Object&gt; values = Arrays.asList(new Object[] {valueArr}); So you're creating a list of a single element, where that element is an array. That's not what you want... you want a List&lt;Object&gt; with as many elements as you had to start with. The simplest way to do that is to change your parameter type: public List&lt;TestTable&gt; find(String key, Object[] values) ... query.setParameter(key, Arrays.asList(values));
has comment: http://stackoverflow.com/comment/35604906
downvote count: 0
upvote count: 2
answers question: http://stackoverflow.com/q/23264935
type: Answer

http://stackoverflow.com/a/23272240
score: 2
has comment: http://stackoverflow.com/comment/35661303
upvote count: 2
has comment: http://stackoverflow.com/comment/35617758
has body: Thanks for the video; now I understand the "jerk" part. The explanation for that is simple: your code is doing this (simplified): while (running) { canvas = this.surfaceHolder.lockCanvas(); this.gameLogic.update(); this.gameLogic.render(canvas); surfaceHolder.unlockCanvasAndPost(canvas); } public void render(Canvas canvas) { if (!gameOver) { ...draw... } } If gameOver is true, your render() function doesn't draw anything, so you get the previous contents of the buffer. You might expect this to show whatever was drawn from the frame just before this one. However, the SurfaceView surface is double- or triple-buffered. So if you just keep calling lock/post without drawing anything, you'll cycle through the last two or three frames. Simple rule: if you lock the surface, you need to draw. If you don't want to draw when the game is over, you need to put your "game over" test back before you lock the canvas.
has comment: http://stackoverflow.com/comment/35660158
has comment: http://stackoverflow.com/comment/35624004
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35661109
downvote count: 0
answers question: http://stackoverflow.com/q/23250117
type: Answer
accepted answer of: http://stackoverflow.com/q/23250117

http://stackoverflow.com/q/23237142
tagged with: selenium
type: Question
has title: selenium webdriver function driver.get("string") does not respond because of window authentication popup
answer count: 2
score: 0
has body: I am using selenium 2.40 and java 6. I searched a lot for a solution for handling windows authentication popup window. I found some answers like using Robot ,Alert and AutoIT. But actually none of these are working for me because after the following line ,nothing is getting executed even println public class ViewStudentsPage { private WebDriver driver; private String baseUrl; private boolean acceptNextAlert = true; private StringBuffer verificationErrors = new StringBuffer(); @Before public void setUp() throws Exception { driver = new FirefoxDriver(); baseUrl = "http://stgmossfe01/"; System.out.println("******************TEST***********1"); driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); System.out.println("******************TEST***********2"); } @Test public void testViewStudentsPage() throws Exception { driver.get(baseUrl + "/Pages/default.aspx"); System.out.println("******************TEST***********3"); Robot robot; robot = new Robot(); robot.delay(5000); System.out.println("******************TEST***********4"); robot.keyPress(KeyEvent.VK_A); robot.keyPress(KeyEvent.VK_D); robot.keyPress(KeyEvent.VK_M); robot.keyPress(KeyEvent.VK_I); robot.keyPress(KeyEvent.VK_N); robot.delay(5000); robot.keyPress(KeyEvent.VK_P); robot.keyPress(KeyEvent.VK_A); robot.keyPress(KeyEvent.VK_S); robot.keyRelease(KeyEvent.VK_S); robot.keyRelease(KeyEvent.VK_W); robot.keyRelease(KeyEvent.VK_O); robot.keyRelease(KeyEvent.VK_R); robot.keyRelease(KeyEvent.VK_D); robot.delay(5000); robot.keyPress(KeyEvent.VK_ENTER); robot.keyRelease(KeyEvent.VK_ENTER); System.out.println("******************TEST***********5"); driver.findElement(By.cssSelector("a.MenuTasks &gt; span")).click(); // ERROR: Caught exception [ERROR: Unsupported command [mouseOver | xpath=/html/body/form/div[12]/div/div/div/div[2]/ul/li[2]/a/span | ]] // ERROR: Caught exception [ERROR: Unsupported command [mouseOver | xpath=/html/body/form/div[12]/div/div/div/div[2]/ul/li[2]/ul/li[3]/span | ]] driver.findElement(…
has answer: http://stackoverflow.com/a/23240363
has answer: http://stackoverflow.com/a/23243184
type: UnansweredQuestion
tagged with: java

http://stackoverflow.com/comment/35468575
score: 0
has text: However I get an error, do you know if there is any static substitute for "this"?
type: Comment
comment on: http://stackoverflow.com/q/23189140
type: QuestionComment

http://stackoverflow.com/comment/35460085
type: AnswerComment
comment on: http://stackoverflow.com/a/23184433
score: 0
type: Comment
has text: Yup, I like this one better, as it allows easier refactoring if the list of ages changes or can be passed into the function. @Makoto - it doesn't necessarily traverse over the entire list if it is found - if it's not found, it's no worse than the alternative of manually checking every value.

http://stackoverflow.com/q/23289253
tagged with: java
tagged with: apache-camel
has comment: http://stackoverflow.com/comment/35649865
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/35649960
favorite count: 0
has answer: http://stackoverflow.com/a/23343179
has title: Spring can't seem to find spring-beans-x.y.xsd during startup
tagged with: spring
tagged with: xsd
has body: I've packaged my application and its dependencies in a jar, and when I start I get an error message as it seems Spring tries to fetch the schema files over http: org.xml.sax.SAXParseException; lineNumber: 7; columnNumber: 123; schema_reference.4: Failed to read schema document 'http://www.springframework.org/schema/beans/factory/xml/spring-beans.xsd', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not &lt;xsd:schema&gt;. ... Caused by: java.net.ConnectException: Connection refused: connect ... My Spring xml file: &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;beans xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd"&gt; ... &lt;/beans&gt; When I search inside my jar I find these files: /org/springframework/beans/factory/xml/spring-beans-2.0.xsd /org/springframework/beans/factory/xml/spring-beans-2.5.xsd /org/springframework/beans/factory/xml/spring-beans-3.0.xsd /org/springframework/beans/factory/xml/spring-beans-3.1.xsd /org/springframework/beans/factory/xml/spring-beans-3.2.xsd and I assume that the factory/xml part of the path is part of the problem? I start the (Apache Camel) application like so: java -Dserver=acpt -jar my_app-1.0.0-SNAPSHOT-jar-with-dependencies.jar -ac META-INF/spring/my_app.xml Is my jar assembled incorrectly? Or need I somehow tell Spring about some path? Or should I set the classpath to something specific within the jar? Or might it be something to do with Camel (as I'm running org.apache.camel.spring.Main)? I really don't have a clue where to start, any suggestions welcome!
tagged with: http://stackoverflow.com/tag/xml
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35653522
upvote count: 2
has comment: http://stackoverflow.com/comment/35692276
accepted answer: http://stackoverflow.com/a/23343179
has comment: http://stackoverflow.com/comment/35650602
type: Question
has comment: http://stackoverflow.com/comment/35649311

http://stackoverflow.com/a/23208102
type: Answer
has body: The Serializable interface does not have any Methods. It may look like it is not needet or just an information addon. But internly java serialization (and other frameworks) use this interface to check wheather the class is serializable or not.
answers question: http://stackoverflow.com/q/23207948
score: 0

http://stackoverflow.com/comment/35376327
comment on: http://stackoverflow.com/q/23137464
score: 2
has text: So what's your question?
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23170805
answers question: http://stackoverflow.com/q/23170014
score: 1
upvote count: 1
has body: Spring will use it's SimpleApplicationEventMulticaster to fetch the event listeners using the getApplicationListeners(ApplicationEvent event) method inherited from AbtractApplicationEventMulticaster. To see if a listener support the given event type it typically wraps the listener in a GenericApplicationListenerAdapter which provides supportsEventType(Class&lt;? extends ApplicationEvent&gt; eventType), the method to test if the listeners generic type matches and the event is supported.
downvote count: 0
type: Answer

http://stackoverflow.com/a/23178514
has body: There is a difference between the field of an object and the object itself, in the following snippet : for (int count = 0; count &lt; 3; count++){ aPurchase = new Purchase(); aPurchase.amount = myScanner.nextDouble(); aPurchase.quantity = myScanner.nextInt(); } you initialize the object every time, but you should notice that amount and quantity are fields (variables that belong to the class) that get assigned too. So if you investigate the code carefully you'll see that there is something like this around : class Purchase{ //these are called the fields of the class double amount; int quantity; .... } To get a better understanding, at the start of your journey in the OOP, assume an object as (the realization of) an entity, like Box and the fields as it's properties, like width,height,color and etc.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23178486

http://stackoverflow.com/comment/35633168
type: Comment
has text: Please avoid backward compatibility zones like `"US/Eastern"`. Examples should prefer canonical zones like `"America/New_York"`. Thanks.
comment on: http://stackoverflow.com/a/23280550
type: AnswerComment
score: 2

http://stackoverflow.com/comment/35607071
type: QuestionComment
comment on: http://stackoverflow.com/q/23267099
has text: just delete gen folder, it will recreate automatically
score: 5
type: Comment

http://stackoverflow.com/comment/35461770
comment on: http://stackoverflow.com/q/23185975
has text: When compiling, the class files for all the classes are being generated. I can see that in the folder.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23187449
answers question: http://stackoverflow.com/q/23186141
score: 3
has body: The message brokers can be used without STOMP, take for example the RabbitMQ broker, it can be used with several other protocols; HTTP, AMQP, MQTT, AMQP. You can use them as a JMS implementation. As there are several instances of the application, the best alternative is really having a central messaging broker for handling messages that need to be published to the clients of all applications. Any alternative would imply doing something similar by hand, the servers in the backend need to communicate and notify each other of those events in some way. An alternative would be to write to the database certain events and have each server poll some table, but that is the type of design we try to avoid. Also concerning load balancing and web sockets, the load balancer needs to be configured to allow forwarding of the HTTP Upgrade headers, which is usually off by default. For example nginx needs some configuration to allow forwarding of the these headers, otherwise Websockets won't work. In that case SockJS will automatically use some of the fallback options that kick in when web sockets are not possible.
upvote count: 3
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/23186141
downvote count: 0

http://stackoverflow.com/a/23146814
has comment: http://stackoverflow.com/comment/35393383
type: Answer
answers question: http://stackoverflow.com/q/23146715
has body: You answered your own question with the first link: In Java what exactly does File.canExecute() do? The conclusion is that File.canExecute() simply translates into a native posix call to access(path, X_OK). SUGGESTION: If you simply want to check the file permission bits, use FilePermission instead.
has comment: http://stackoverflow.com/comment/35395655
has comment: http://stackoverflow.com/comment/35394044
score: 0

http://stackoverflow.com/a/23211230
score: 0
type: Answer
has body: There is no way I know of that you can hold those values in and int[] array. Instead use String[] array and convert to int values if needed.
answers question: http://stackoverflow.com/q/23211146

http://stackoverflow.com/comment/35603798
type: AnswerComment
type: Comment
has text: I think I can have the minimum and maximum characters that the upper case word will have. Can that help. Lets say for example my upper case word will have minimum 5 and max 7 characters
score: 0
comment on: http://stackoverflow.com/a/23264667

http://stackoverflow.com/comment/35448540
comment on: http://stackoverflow.com/q/23178289
score: 4
has text: Perhaps a `Scanner` with the right delimiter?
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23171037
type: UnansweredQuestion
tagged with: playframework-2.0
answer count: 0
tagged with: java
upvote count: 1
type: Question
has body: Good day! I am using Play framework and I have this class for the models. People.java package models; import java.util.*; import javax.persistence.*; import javax.validation.*; import play.data.Form; import play.data.validation.Constraints.MaxLength; import play.data.validation.Constraints.*; import play.db.ebean.*; import play.db.ebean.Model.Finder; @Entity public class People extends Model{ @Id public Long id; @Required @MaxLength(100) @Column(unique=true) public String label; @MaxLength(200) public String notes; public List<RelatedPeople> relatedPeoples = new ArrayList<RelatedPeople>(); public static Finder<Long, People> find = new Finder(Long.class, People.class); public People() {} public People(Long id, String label, String notes, RelatedPeople... relatedPeoples) { this.id = id; this.label = label; this.notes = notes; this.relatedPeoples = new ArrayList<RelatedPeople>(); for(RelatedPeople relatedPeople: relatedPeoples) { this.relatedPeoples.add(relatedPeople); } } public static List<People> all() { return find.all(); } public static void create(People people){ people.save(); } public static void delete(Long id){ find.ref(id).delete(); } public static void update(Long id, People people) { people.update(id); // updates this entity, by specifying the entity ID } public static class RelatedPeople { @Required public People people; public String relationship; public RelatedPeople() {} public RelatedPeople(People people, String relationship) { this.people = people; this.relationship = relationship; } } } I have this form that asks for the People's details, which includes the label, notes, relatedPeoples (which is also a People), and the relationship with that related people. The relatedPeoples are checked using a checkbox which should form an ArrayList of the items checked. summary.scala.html @(peoples: List[People], peopleForm: Form[People]) @import helper._ @import helper.twitterBootstrap._ @title = { Add a new people } @relatedPeopleGroup(field: Field, className: …
tagged with: arraylist
tagged with: playframework
downvote count: 0
score: 1
favorite count: 0
has title: Size of ArrayList always returns a zero

http://stackoverflow.com/a/23251085
type: Answer
answers question: http://stackoverflow.com/q/23250234
score: 0
has body: The question is not that clear. What I understand that you have the DefaultCalculator with tow method getX(P p, Q q) and getY(P p, Q q) and you want to call these methods without creating new object of type DefaultCalculator. Basically, if you want to call a method with in some class you have to creat an object of that class. But you can do one of the following: (Note: I don't know what you are trying to do, but that may helps) 1- I can see that you have the class ExtendedCalculator Which extends DefaultCalculator so you can create object ExtendedCalculator and call the methods getX(P p, Q q)and getY(P p, Q q)from that object as follow: ExtendedCalculator someObj=new ExtendedCalculator(); someObje.getX(someVar1,someVar2); 2- you can create static methods and call directly by class name.

http://stackoverflow.com/q/23227142
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35536603
has comment: http://stackoverflow.com/comment/35537130
tagged with: cmusphinx
has comment: http://stackoverflow.com/comment/35539697
score: 2
answer count: 0
has body: I am currently having some problems. I am using an XML file to run CMU Sphinx. The XML file finds paths by using path = resource:/(file path located within resource). This works when in eclipse but when I export to runnable to jar it is unable to locate resource. What could I do to fix this? Currently I have tried adding a source folder and adding the resource contents, I unpacked the jar and everything was located where it should be. I also tried building without a source folder holding the contents. Any help would be great. Thanks :) URL configURL = Transcriber.class.getResource("config.xml"); //works ConfigurationManager cm = new ConfigurationManager(configURL); //Also works From the xml &lt;property name="dictionaryPath" value="resource:/speechcapture/edu/cmu/sphinx/model/acoustic/HUB4_8GAU_13dcep_16k_40mel‌​_133Hz_6855Hz "/&gt; The above only works in eclipse but this will work in jar or eclipse &lt;property name="dictionaryPath" value="C:/project/speechcapture/resource/speechcapture/edu/cmu/sphinx/model/acoustic/HUB4_8GAU_13dcep_16k_40mel‌​_133Hz_6855Hz "/&gt; Exception in thread "main" Property exception component: 'wsjloader' property: 'location' - can't locate resource:/speechcapture/edu/cmu/sphinx/model/acoustic/HUB4_8GAU_13dcep_16k_40mel_133Hz_6855Hz edu.cmu.sphinx.util.props.InternalConfigurationException: Can't locate resource:/speechcapture/edu/cmu/sphinx/model/acoustic/HUB4_8GAU_13dcep_16k_40mel_133Hz_6855Hz
downvote count: 0
has comment: http://stackoverflow.com/comment/35536993
favorite count: 0
has comment: http://stackoverflow.com/comment/35538179
type: Question
has comment: http://stackoverflow.com/comment/35537087
has title: Finding path in XML not working when in jar
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/35539053
upvote count: 2
has comment: http://stackoverflow.com/comment/35537392
tagged with: java
has comment: http://stackoverflow.com/comment/35539954
has comment: http://stackoverflow.com/comment/35543241
has comment: http://stackoverflow.com/comment/35550043

http://stackoverflow.com/a/23173044
type: AcceptedAnswer
has body: The problem is when you use " bash tries to evaluate anything within it instead you should use ', try this: java -Xmx16g -cp .:lib/* edu.cuny.util.VectorToInstancesConverter train HandednessJ48 'SELECT * FROM collection1.Session1 WHERE Subj_Id!=402 and Subj_Id not in ( select Subj_id from collection1.Session2) AND Subj_Id IN ( SELECT Subj_Id FROM collection1.userdata WHERE 'DominantHand' = 'l' OR 'DominantHand' = 'r')' 12 J48 or as @bhesh has specified you can delimit the characters which bash will try to evaluate : java -Xmx16g -cp .:lib/* edu.cuny.util.VectorToInstancesConverter train HandednessJ48 "SELECT * FROM collection1.Session1 WHERE Subj_Id!=402 and Subj_Id not in \( select Subj_id from collection1.Session2\) AND Subj_Id IN \( SELECT Subj_Id FROM collection1.userdata WHERE 'DominantHand' = 'l' OR 'DominantHand' = 'r'\)" 12 J48
has comment: http://stackoverflow.com/comment/35462671
upvote count: 3
type: Answer
has comment: http://stackoverflow.com/comment/35446226
has comment: http://stackoverflow.com/comment/35455446
has comment: http://stackoverflow.com/comment/35439350
downvote count: 0
answers question: http://stackoverflow.com/q/23172970
accepted answer of: http://stackoverflow.com/q/23172970
score: 3
has comment: http://stackoverflow.com/comment/35446259

biginteger
tags question: http://stackoverflow.com/q/23204523
tag name: biginteger
tags question: http://stackoverflow.com/q/23142496
type: Tag
tags question: http://stackoverflow.com/q/23163175
tags question: http://stackoverflow.com/q/23227084
tags question: http://stackoverflow.com/q/23183707
tags question: http://stackoverflow.com/q/23144236
tags question: http://stackoverflow.com/q/23130261

http://stackoverflow.com/comment/35533250
score: 0
type: Comment
type: QuestionComment
has text: But if I use FutureTask, does it process everything on the same thread, just at the time you specify?
comment on: http://stackoverflow.com/q/23226096

http://stackoverflow.com/comment/35636348
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23282133
has text: http://docs.oracle.com/javase/7/docs/api/javax/swing/JPanel.html
score: 0

http://stackoverflow.com/comment/35514414
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23176941
has text: The robot I send messages to seems only to understand dataoutputstream.writebytes, is there a way not to close the stream when I read it?
score: 0

jenkins
tags question: http://stackoverflow.com/q/23149484
tag name: jenkins
tags question: http://stackoverflow.com/q/23269076
tags question: http://stackoverflow.com/q/23147180
tags question: http://stackoverflow.com/q/23197739
tags question: http://stackoverflow.com/q/23139344
tags question: http://stackoverflow.com/q/23157231
tags question: http://stackoverflow.com/q/23226162
tags question: http://stackoverflow.com/q/23286375
tags question: http://stackoverflow.com/q/23213038
type: Tag

http://stackoverflow.com/comment/129806420
has text: @EugeneMaysyuk iirc, weak semantics aren't speced but are de facto. See http://hg.openjdk.java.net/jdk9/jdk9/hotspot/file/910e24afc502/src/share/vm/classfile/stringTable.cpp#l193
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23253122
type: Comment

http://stackoverflow.com/a/23257666
answers question: http://stackoverflow.com/q/23257569
score: 0
type: Answer
has body: instead of int[] build and Integer[] and use custom toString() to print only not null values.

http://stackoverflow.com/comment/35466281
type: AnswerComment
comment on: http://stackoverflow.com/a/23188051
score: 0
type: Comment
has text: Oh, sorry. I was wrong. `Timer` is not `static` in your case. So it would be `instanceOfTimekeep.Timer` (where `instanceOfTimer` is the variable you created with `Timekeep instanceOfTimer = new Timekeep()`)

http://stackoverflow.com/comment/35600833
score: 0
comment on: http://stackoverflow.com/a/23261893
type: Comment
has text: how can i show success message to user and refresh the page
type: AnswerComment

http://stackoverflow.com/a/23154213
answers question: http://stackoverflow.com/q/23152428
has body: In the Eclipse's Project properties, in the GWT pane, remove the GWTTestModule that must have been added automatically at some point (if you renamed your module after creation, it might be that the Google Plugin for Eclipse forgot to take the rename into account everywhere)
score: 0
type: Answer

http://stackoverflow.com/comment/35541079
type: Comment
comment on: http://stackoverflow.com/q/23219006
score: 0
has text: I deleted my answer as it was a brain-fart. My 2 cents is it's a bug. If ClassC extends ClassB and provides no code, it shows `class, letter`. So it's not a case of only reporting about the immediate class.
type: QuestionComment

http://stackoverflow.com/a/23209299
has body: To handle vertical slopes, using angular measurements instead of slope would allow you to do so without this issue. Consider using java.lang.Math.atan2(double y, double x) to get a vertical angle when there is a zero change in the x value.
type: Answer
score: 0
answers question: http://stackoverflow.com/q/23208678

http://stackoverflow.com/comment/35439970
comment on: http://stackoverflow.com/q/23173367
has text: You shouldn't use Vector. It's old and has unnecessary synchronization (which doesn't help). Use [ArrayList](http://docs.oracle.com/javase/7/docs/api/java/util/ArrayList.html).
score: 3
type: QuestionComment
type: Comment

http://stackoverflow.com/a/23166016
has body: You can save the edittext value in SharedPreferences, thus making it available in all activity. By doing this you can fetch the value in other activity without any hassle. eg: SharedPreferences.Editor editor = preferences.edit(); editor.putString("edtTextValue", valueOfEditText); editor.commit(); Further fetching the value in other activity like this, preferences.getString("edtTextValue", "");
score: 0
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/23165813
answers question: http://stackoverflow.com/q/23165813

http://stackoverflow.com/comment/35547550
type: QuestionComment
comment on: http://stackoverflow.com/q/23233875
has text: better review the "scope" concept :) Or learn compiler.
score: 0
type: Comment

http://stackoverflow.com/a/23711405
upvote count: 1
score: 1
accepted answer of: http://stackoverflow.com/q/23194073
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/23194073
has body: It turns out that DWR/Javascript does not support function overload the code itself is written in java which supports function overloads but this code was then being ajaxified using DWR which does not support the overload. So every time the server was restarted , depending on which of the 2 functions was getting loaded last was getting executed. Had to rename one of the functions so as to stop overload

http://stackoverflow.com/q/23252196
tagged with: selenium-webdriver
score: 2
upvote count: 2
tagged with: java
tagged with: selenium
type: Question
has answer: http://stackoverflow.com/a/23261777
answer count: 3
has title: Accessing vendor specific CSS attribute in a style attribute? Selenium seems to ignore it by default
has answer: http://stackoverflow.com/a/23253300
downvote count: 0
has answer: http://stackoverflow.com/a/23277855
has body: I'm trying to check the css attributes of a tag that is updated via javasrcipt. They put the css directly in the tag like this: &lt;div class="myclass" style="color: red; display: block; -webkit-transform -translate3d(x,x,x); I can access the style attribute via the WebElements getAttribute method, however, it only returns the 'normal' CSS. i.e. In the example above, only the color:red;display:block would be returned. The -webkit (or anything similarly browser specific) does not get returned by Selenium's getAttribute method. Is there a way to access these values via Selenium?
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/35516567
comment on: http://stackoverflow.com/a/23214929
has text: Artyom, conn.disconnect is also not suspending the conn.getResponseCode call.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/35527863
comment on: http://stackoverflow.com/q/23222970
has text: Is tx:annotation-driven in the same Spring context that your controller beans loaded? tx:annotation-driven is a bean post processor, so it will only decorate @Transactional method on beans in the same context.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35641760
has text: class inside a Catch block why would you want to do that. Catch in exceptin handling is there for a specific purpose and that being handling exceptions or doing some cleanup or throwing exceptions. @halex above gave you an option
comment on: http://stackoverflow.com/q/23284940
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23286131
has comment: http://stackoverflow.com/comment/35643508
favorite count: 0
accepted answer: http://stackoverflow.com/a/23286314
type: Question
has body: Want to set the value RESULT from the following part and should retrieve it in the onActivityResult... Following is the code. Intent intent = new Intent(); intent.setType("image/*"); intent.setAction(Intent.ACTION_GET_CONTENT); System.out.println("Select Display Picture, but"); intent.putExtra("RESULT", "RESULT"); activity.startActivityForResult( Intent.createChooser(intent, "Select Display Picture"), Credentials.BROWSE_PIC); activity.setResult(Credentials.BROWSE_PIC, intent); @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == Credentials.BROWSE_PIC &amp;&amp; resultCode == Activity.RESULT_OK &amp;&amp; null != data) { //returning null always here.. System.out.println("OnActivityResult came in::: " + data.getStringExtra("RESULT")); Uri selectedImage = data.getData(); String[] filePathColumn = { MediaStore.Images.Media.DATA }; Cursor cursor = getContentResolver().query(selectedImage, filePathColumn, null, null, null); cursor.moveToFirst(); int columnIndex = cursor.getColumnIndex(filePathColumn[0]); String picturePath = cursor.getString(columnIndex); cursor.close(); }
linked to: http://stackoverflow.com/q/22759644
tagged with: android
has comment: http://stackoverflow.com/comment/35643328
upvote count: 1
answer count: 1
has answer: http://stackoverflow.com/a/23286314
tagged with: java
has comment: http://stackoverflow.com/comment/35643492
has title: onActivityResult to pick image with putExtra()
type: AnsweredQuestion
downvote count: 0
has comment: http://stackoverflow.com/comment/35643367
score: 1

http://stackoverflow.com/comment/35406633
score: 0
has text: I had populated only 1 object initially. It was only for reference. Anyways added the second one too, to avoid confusion. Basically i mentioned to loop through your list containing the data, and populate the values as shown above.
type: Comment
comment on: http://stackoverflow.com/a/23153937
type: AnswerComment

http://stackoverflow.com/comment/35627176
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23277422
has text: You should be able to just make a `Java Web` - `Web Application` with Netbeans. Which should set everything up for you. Then create a jsp webpage that both generates a form and handles the form submission
score: 0

http://stackoverflow.com/comment/35402428
type: AnswerComment
comment on: http://stackoverflow.com/a/23151102
score: 0
type: Comment
has text: @Vakh +1 for you.. I also want to add the ints values in sorted order. Should i use sortedset in that case ...

http://stackoverflow.com/a/23238115
has body: This is because public int hashcode() is wrong implementation of hashcode. This would be : public int hashCode()
type: Answer
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/23237665
downvote count: 0

http://stackoverflow.com/a/23218866
type: Answer
upvote count: 0
has comment: http://stackoverflow.com/comment/35523320
answers question: http://stackoverflow.com/q/23218322
score: -1
has body: use the below code to get the onclick in Surah.java inside the listView.setOnItemLongClickListener(....... after you create the dialog object dialog.findViewById(R.id.ok).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub Toast.makeText(getApplicationContext(), "it works", 2000).show(); } });
downvote count: 1

http://stackoverflow.com/a/23135865
type: AcceptedAnswer
has body: Your printer is in line_print mode, instead of ZPL or CPCL mode. If your printer is in line_mode, the SDK will not work. You can still use the communications classes, but the printer helper functions will not work in line_print mode. If you don't want to be in line print mode, you can change the printer's language by sending the following command : SGD.DO("device.languages", "zpl", printerConnection)
type: Answer
answers question: http://stackoverflow.com/q/23135167
accepted answer of: http://stackoverflow.com/q/23135167
score: 0

http://stackoverflow.com/comment/35466702
score: 1
has text: Alright, the object you are calling getIterator on is an instance of GameWorldProxy which _does not_ have a getIterator method. Did your classmate's GameWorldProxy also implement your Collection interface? In that case his would work because his class _would_ have this method in it.
comment on: http://stackoverflow.com/q/23188528
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35401468
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23151564
has text: I'll see if that helps this afternoon. But since I'm already getting an answer, it should be perfectly possible to specify the parameters with the way I'm doing it now. Which is really starting to piss me off because I can't figure out what's going wrong.

http://stackoverflow.com/q/23290185
tagged with: derby
answer count: 3
has answer: http://stackoverflow.com/a/25356275
has answer: http://stackoverflow.com/a/43160289
has comment: http://stackoverflow.com/comment/35655992
favorite count: 0
has body: I set the Environment Variable both System Path to DERBY_HOME\bin and User variable name DERBY_HOME and value to where I kept the bin.Then using the cmd I enter the command startNetworkServer.bat but it is throwing the exception mentioned. my derby version is 10.10.2.0 JDK version jdk1.7.0_07 JRE version jre7 I searched related exception but my JDK and JRE version are same. How I can correct when my system path variable points to JDK and JRE version 7 or 1.7 and in the installation their is no jdk or jre version 1.5 or 5.Do I need to use lower version od derby 10.8.1.2?
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23290349
has title: Exception in thread "main" java.lang.UnsupportedClassVersionError: org/apache/derby/derda/NetworkServerControl < Unsupported major.minor 49.0 >
score: 2
tagged with: java
type: Question
upvote count: 2
downvote count: 0

http://stackoverflow.com/q/23191635
has title: Is it possible read a pdf file in JAVA and save particular words alone?
downvote count: 1
type: Question
tagged with: pdf-reader
tagged with: java
has answer: http://stackoverflow.com/a/23191652
score: -1
has body: I am developing an application in java, In this application i have to read pdf file and save contents. For ex: A pdf file contains: Xxxxxxxxxxxx: yyyyyyyyyy yyyyyyyyyyyy: zzzzzz, zzzzzz ,zzzzzz ,yyyyyy I have to save the value of Xxxxxxx and yyyyyyyyyy in database are some where. Is it possible to do? Any Tutorials really its so helpful. Thanks in advance
upvote count: 0
answer count: 1
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/35585037
type: QuestionComment
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23254659
has text: Show the full stacktrace

http://stackoverflow.com/q/23258306
has answer: http://stackoverflow.com/a/23258395
has title: Different of Thread start()
type: UnansweredQuestion
tagged with: multithreading
has comment: http://stackoverflow.com/comment/35592182
has answer: http://stackoverflow.com/a/23258890
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/35591654
has body: In researching previous project coding: I found out that using Thread with 2 different way First is TimerThread tt=new TimerThread(); tt.start(); Second is TimerThread tt=new TimerThread(); new Thread(tt).start(); is there any different between these 2 code when run?
score: 0
answer count: 2

http://stackoverflow.com/a/23278458
downvote count: 0
score: 4
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35633058
answers question: http://stackoverflow.com/q/23278341
type: Answer
has body: There is a rather complicated process to make an executable jar with LWJGL. You need to use Jarsplice. Jarsplice has 4 steps which are pretty self explanatory but here they are anyway: 1: Add Jars. Add the jar you generated as well as all the libraries. That includes lwjgl.jar, and any other jars you used. 2: Add Natives. Add all the natives you used in your project. These are the files you referenced using -Djava.library.path. 3: Main Class Select the main class of your program. This could be something like com.example.game.EntryPoint. 4: Create Fat Jar Click "Create Fat Jar" to create your executable jar! You can also optionally create a Windows .exe, OSX .app, and Linux .sh executables as well.
accepted answer of: http://stackoverflow.com/q/23278341
upvote count: 4

http://stackoverflow.com/a/23218402
upvote count: 1
score: 1
has body: How about making you thread wait() and use a Timer to notify() your waiting object after 1min? So if your main process finishes it's work in time it would notify() the waiting thread and make it continue or otherwise it would be forced to work on after 1 min by the Timer.
downvote count: 0
answers question: http://stackoverflow.com/q/23217167
type: Answer

http://stackoverflow.com/comment/35562614
comment on: http://stackoverflow.com/q/23241473
score: 0
type: Comment
type: QuestionComment
has text: @AndrewThompson it appeared in grid cell (5,3) , you can compile the code i posted

http://stackoverflow.com/comment/35620118
comment on: http://stackoverflow.com/q/23273507
type: QuestionComment
type: Comment
has text: have you had a look at [this](http://stackoverflow.com/questions/1268689/j2se-proxy-authentication)?
score: 0

http://stackoverflow.com/comment/35454748
score: 1
type: QuestionComment
type: Comment
has text: `I'm trying to solve this in Java` then show us what you've tried and where your attempts failed.
comment on: http://stackoverflow.com/q/23181710

http://stackoverflow.com/a/23306333
answers question: http://stackoverflow.com/q/23279775
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35689595
type: Answer
has body: You must have defined your own class called Random. Don't do that. Rename it. Then r.nextInt() will work without a cast.
score: 0
accepted answer of: http://stackoverflow.com/q/23279775

http://stackoverflow.com/comment/35383750
type: Comment
score: 1
has text: @LittleChild, You got me
comment on: http://stackoverflow.com/a/23141351
type: AnswerComment

http://stackoverflow.com/q/23174840
has comment: http://stackoverflow.com/comment/35443472
has comment: http://stackoverflow.com/comment/35443970
tagged with: jfreechart
type: Question
accepted answer: http://stackoverflow.com/a/23175110
tagged with: keylistener
score: 0
has title: Java KeyListener not works
answer count: 1
tagged with: keyboard
has body: I tried simple code with JFreeChart and when I pressed "zoom" button, I want to cancel zoom with "escape" from keyboard, but KeyListener not works. Where is the problem? I also tried to add KeyListener to chartPanel and panel and it also not works. package test1; import java.awt.*; import java.awt.event.*; import javax.swing.*; import org.jfree.chart.*; import org.jfree.chart.axis.*; import org.jfree.chart.plot.*; import org.jfree.chart.renderer.xy.*; import org.jfree.data.xy.*; public class Test1 { public static final String Title = "JGrapher"; static JFrame frame; static double minX = -0.1, maxX = 1.1, minY, maxY; static XYSeriesCollection dataset; static ChartPanel chartPanel; static XYPlot xyplot; private static void display(){ XYSeries serie = new XYSeries("1"); serie.add(1, 1); serie.add(8, 8); dataset = new XYSeriesCollection(); dataset.addSeries(serie); NumberAxis domain = new NumberAxis("\u03C1"); NumberAxis range = new NumberAxis("g(\u03C1)"); XYSplineRenderer r = new XYSplineRenderer(20); xyplot = new XYPlot(dataset, domain, range, r); final JFreeChart chart = new JFreeChart(xyplot); ValueAxis xAxis = xyplot.getDomainAxis(); xAxis.setRange(-10, 10); ValueAxis yAxis = xyplot.getRangeAxis(); yAxis.setRange(-10, 10); chartPanel = new ChartPanel(chart){ @Override public Dimension getPreferredSize() { return new Dimension(640, 480); } }; chartPanel.setDomainZoomable(false); chartPanel.setRangeZoomable(false); frame = new JFrame(Title); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.add(chartPanel); frame.addKeyListener(new KeyListener() { // KEYLISTENER NOW WORKS :( @Override public void keyTyped(KeyEvent ke) {} @Override public void keyPressed(KeyEvent ke) { System.out.println("You pressed " + ke.getKeyChar()); } @Override public void keyReleased(KeyEvent ke) {} }); JPanel panel = new JPanel(new FlowLayout(FlowLayout.CENTER)); //buttons final JButton zoomFree = new JButton("Zoom"); panel.add(zoomFree); zoomFree.addActionListener(new ActionListene…
has answer: http://stackoverflow.com/a/23175110
tagged with: swing
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/q/23159045
type: AnsweredQuestion
has body: I am still fairly new to generics and binary search trees, and I am trying to add a custom Student object to a BST, and don't know exactly how to go about implementing it. I have my Student class declaration like follows: class Student &lt;E&gt;implements Serializable, Comparable { int studentNumber; String firstName; String lastName; String major; double gpa; Student leftChild; Student rightChild; public Student() { this(0, "", "", "", 0.0); } // end no-argument studentNumberRecordSerializable constructor public Student(int sNum, String first, String last, String major, double gpa) { setstudentNumber(sNum); setFirstName(first); setLastName(last); setMajor(major); setGPA(gpa); } // end four-argument studentNumberRecordSerializable constructor .... and then my Node class: class TreeNode&lt;E extends Comparable&lt;E&gt;&gt; { TreeNode&lt;E&gt; leftNode; E data; TreeNode&lt;E&gt; rightNode; public TreeNode(E nodeData) { data = nodeData; leftNode = rightNode = null; } // end TreeNode constructor public void insert(E insertValue) { if (insertValue.compareTo(data) &lt; 0) { if (leftNode == null) leftNode = new TreeNode&lt;E&gt;(insertValue); else leftNode.insert(insertValue); } // end if .... and then I'm trying to to declare Tree&lt;Student&gt; tree = new Tree&lt;Student&gt;(); and it is saying that that student is an invalid argument. I want also call tree.insertNode(new Student(studentNumber, firstName, lastName, major, gpa));to add it to the node. Is there an extra step that I am not following or something I am not doing right? I have done a lot of research on generics and also BSTs but I am having troubles tying the two together. please help!
tagged with: binary-search-tree
upvote count: 1
type: Question
score: 1
tagged with: java
has title: Adding custom objects to binary search tree
has answer: http://stackoverflow.com/a/23159162
accepted answer: http://stackoverflow.com/a/23159162
answer count: 1
downvote count: 0
favorite count: 0
tagged with: generics

http://stackoverflow.com/a/23176080
answers question: http://stackoverflow.com/q/23175798
score: 0
has body: This won't work because the return type of overriden method should be the same or a subtype of the return type declared in the original method. Look at this link about overriding and this about overloading
type: Answer

http://stackoverflow.com/comment/35397035
type: AnswerComment
has text: what if doExecuteMySpecialAlgorithm throws an exception which I expect the caller to handle? it wouldn't really look nice if all your getResult methods also throw this exception up?
type: Comment
comment on: http://stackoverflow.com/a/23149042
score: 0

http://stackoverflow.com/comment/35462971
comment on: http://stackoverflow.com/q/23185371
type: Comment
type: QuestionComment
has text: @ShashankBhagat: 'I am working on SWT browser' - does this mean your application is a desktop application, rather than a web application? In that case, why are you using JSPs?
score: 0

http://stackoverflow.com/q/23237706
tagged with: syntax
accepted answer: http://stackoverflow.com/a/23237753
has title: What does a type name in brackets mean?
tagged with: java
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/35565633
tagged with: casting
answer count: 3
downvote count: 0
has body: I was reading a program and saw the following syntax: Pet pet1 = (Pet) objIn.readObject(); Pet is a abstract class, objIn.readObjet() means read the objects from the file, but what does the syntax (Pet) mean? Does it set the every object read from file as a new Pet object? But Pet is an abstract class, how can set a object in it?
has answer: http://stackoverflow.com/a/23237753
score: 1
has answer: http://stackoverflow.com/a/23238087
favorite count: 0
linked to: http://stackoverflow.com/q/1031273
possible better answer: http://stackoverflow.com/a/23238049
has answer: http://stackoverflow.com/a/23238049
type: AnsweredQuestion

http://stackoverflow.com/comment/35638055
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23283041
has text: Would it be possible to display "Scanning..." delay 1 seconds then display "Scanning..." again? in the same try catch

http://stackoverflow.com/comment/35610965
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23268541
has text: @Jens Schauder: sorry, I'm wrong, my question about RMI distributed system could be "What is the inconvenient when using GC mark-and-sweep in RMI distributed system?" Thanks

http://stackoverflow.com/a/23152671
score: 0
answers question: http://stackoverflow.com/q/23146233
has comment: http://stackoverflow.com/comment/35469893
type: Answer
has comment: http://stackoverflow.com/comment/35477217
has body: I don't understand what you want to do but this code should work: import java.util.Scanner; public class CYOA_Om_Malhar { public static void main(String[]args) { Scanner in = new Scanner(System.in); String choice = ""; Introduction(); //Instructions System.out.println("Please type 'A' or 'B' to choose an option: "); while(!choice.equalsIgnoreCase("A") &amp;&amp; !choice.equalsIgnoreCase("B") ){ choice = in.nextLine(); } page1(choice); page2(choice); page3(choice); page4(choice); page5(choice); page6(choice); page7(); } public static void Introduction() { System.out.println("You are walking home one night after being fired from your job. "); System.out.println("You are late on your rent, and you have no money. "); System.out.println("As you are walking by, you see a black object out of the corner of your eye. "); System.out.println("You reach over to pick it up, and you realize that it's a wallet full of cash. "); System.out.println("You take it home to your rat infested apartment. "); System.out.println("You then start counting the money as soon as you sit on the squeaky chair of yours. "); System.out.println("You get surprised as you notice that the wallet has $10,000. What do you do?"); } //Page 1 public static int page1(String choice) { System.out.println("A. Take the wallet to the police station. "); System.out.println("B. Use the money to rent a new condo near Lakeshore Blvd., and lease a new BMW X6. "); if(choice.equalsIgnoreCase("A")) { System.out.println("Great decision. "); return 2; } else if(choice.equalsIgnoreCase("B")) { System.out.println("You're disonest. Start over. :("); return -1; } else { System.out.println("Invalid selection. Please try again. "); return -1; } } //Page 2 public static int page2(String choice) { System.out.println("Now, all you have to do is find a way to get to the police station - which is on the other side of the town. "); System.out.println("How do you get there? "); System.out.println("A. Hitchhike! Stand by the side of the r…
has comment: http://stackoverflow.com/comment/35591008
has comment: http://stackoverflow.com/comment/35647847

http://stackoverflow.com/comment/35559950
has text: That shouldn't compile. Are you sure you didn't change the access modifier on the target method after compiling `main`?
comment on: http://stackoverflow.com/q/23240944
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35554938
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23229030
has text: I don't see the advantages of the builder pattern here. It just makes the 40-arguments constructor private and have an additional class with getters and setters. To me this adds complexity in this case. If the arguments are just passed trough straight to the constructor then builder just adds another layer but no value. As Dreamer pointed out it does not integrate easily into JPA either.

http://stackoverflow.com/a/23244664
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23244522
has body: It's not that it only repaints once, it's that it only repaints after the loop ends. The repaint method doesn't repaint immediately, instead it marks the panel to be repainted as soon as possible (but not right now). Swing does not use threads, so only thing can run at a time. There are a lot of tasks Swing does behind the scenes, in-between calling your listeners, and one of those tasks is repainting windows that need to be repainted. Swing will not repaint a window while your listener is running. Also, even if repaint did repaint immediately, the animation would happen too fast for anyone to notice.
type: Answer
answers question: http://stackoverflow.com/q/23244522
upvote count: 1
score: 1

http://stackoverflow.com/a/23148805
has comment: http://stackoverflow.com/comment/35405167
type: Answer
downvote count: 0
score: 1
has body: Yes you can. Try to look at Label Decorator extension Point . And you decorator should implements org.eclipse.jface.viewers.ILightweightLabelDecorator. See also org.eclipse.jface.viewers.IDecoration
answers question: http://stackoverflow.com/q/23143318
upvote count: 1

hibernate
tags question: http://stackoverflow.com/q/23159330
tags question: http://stackoverflow.com/q/23210530
tags question: http://stackoverflow.com/q/23214080
tags question: http://stackoverflow.com/q/23194894
tags question: http://stackoverflow.com/q/23254620
tags question: http://stackoverflow.com/q/23264367
tags question: http://stackoverflow.com/q/23239776
tags question: http://stackoverflow.com/q/23290434
tags question: http://stackoverflow.com/q/23201929
tags question: http://stackoverflow.com/q/23191770
tags question: http://stackoverflow.com/q/23264869
tags question: http://stackoverflow.com/q/23129837
tags question: http://stackoverflow.com/q/23285809
tags question: http://stackoverflow.com/q/23285520
tags question: http://stackoverflow.com/q/23196539
tags question: http://stackoverflow.com/q/23257793
tags question: http://stackoverflow.com/q/23209640
tags question: http://stackoverflow.com/q/23220479
tags question: http://stackoverflow.com/q/23191387
tags question: http://stackoverflow.com/q/23251353
tags question: http://stackoverflow.com/q/23222970
tags question: http://stackoverflow.com/q/23226485
tags question: http://stackoverflow.com/q/23247457
tags question: http://stackoverflow.com/q/23247886
tags question: http://stackoverflow.com/q/23262631
tags question: http://stackoverflow.com/q/23174107
tags question: http://stackoverflow.com/q/23288119
tags question: http://stackoverflow.com/q/23277467
tags question: http://stackoverflow.com/q/23285831
tags question: http://stackoverflow.com/q/23236877
tags question: http://stackoverflow.com/q/23187989
tags question: http://stackoverflow.com/q/23170687
tags question: http://stackoverflow.com/q/23269284
tags question: http://stackoverflow.com/q/23275299
tags question: http://stackoverflow.com/q/23236918
tags question: http://stackoverflow.com/q/23212491
tags question: http://stackoverflow.com/q/23184762
tags question: http://stackoverflow.com/q/23275563
tags question: http://stackoverflow.com/q/23247280
tags question: http://stackoverflow.com/q/23189106
tags question: http://stackoverflow.com/q/23283996
tags question: http://stackoverflow.com/q/23264749
tag name: hibernate
tags question: http://stackoverflow.com/q/23243292
tags question: http://stackoverflow.com/q/23262189
tags question: http://stackoverflow.com/q/23274682
tags question: http://stackoverflow.com/q/23272683
tags question: http://stackoverflow.com/q/23282201
tags question: http://stackoverflow.com/q/23288254
tags question: http://stackoverflow.com/q/23204536
tags question: http://stackoverflow.com/q/23150762
tags question: http://stackoverflow.com/q/23221096
tags question: http://stackoverflow.com/q/23264688
tags question: http://stackoverflow.com/q/23158880
tags question: http://stackoverflow.com/q/23142614
tags question: http://stackoverflow.com/q/23167738
tags question: http://stackoverflow.com/q/23200729
tags question: http://stackoverflow.com/q/23217684
tags question: http://stackoverflow.com/q/23154610
tags question: http://stackoverflow.com/q/23266655
tags question: http://stackoverflow.com/q/23177286
tags question: http://stackoverflow.com/q/23188959
tags question: http://stackoverflow.com/q/23239474
tags question: http://stackoverflow.com/q/23214454
tags question: http://stackoverflow.com/q/23266614
tags question: http://stackoverflow.com/q/23222260
tags question: http://stackoverflow.com/q/23205417
tags question: http://stackoverflow.com/q/23219871
tags question: http://stackoverflow.com/q/23264935
tags question: http://stackoverflow.com/q/23197246
tags question: http://stackoverflow.com/q/23208977
tags question: http://stackoverflow.com/q/23171041
tags question: http://stackoverflow.com/q/23230148
tags question: http://stackoverflow.com/q/23139541
tags question: http://stackoverflow.com/q/23238455
tags question: http://stackoverflow.com/q/23169136
type: Tag
tags question: http://stackoverflow.com/q/23141917
tags question: http://stackoverflow.com/q/23251250
tags question: http://stackoverflow.com/q/23262986

http://stackoverflow.com/comment/35523353
has text: What is not correct about it? Are you using JavaScript to interact with the applet?
comment on: http://stackoverflow.com/a/23220753
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/23197182
downvote count: 0
has body: Here's an outline of how to do this in Swing: In a listener attached to your component's model, set a boolean when the model is changed; e.g. in a DocumentListener, set documentChanged = true. Add a WindowListener; in your windowClosing() handler, check documentChanged. If there's a change, use a JOptionPane to ask the user what to do.
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/23192557

http://stackoverflow.com/comment/35461835
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23185430
type: AnswerComment
has text: Ok, so they are the same, so I have to install both again, and in what order? JDK first?

http://stackoverflow.com/q/23289387
has comment: http://stackoverflow.com/comment/35651613
score: 9
has comment: http://stackoverflow.com/comment/35932520
downvote count: 0
accepted answer: http://stackoverflow.com/a/23445122
linked to: http://stackoverflow.com/q/7731742
has body: I am struggling to extract fast and efficiently words that are in rectangles from a BufferedImage. For example I have the following page : ( edit! ) the image is scanned, so it can contain noise, skewing and distortion. How can I extract the following images without the rectangle : ( edit! ) I can use OpenCv or any other library, but I'm absolutely new to advanced image processing techniques. EDIT I've used the method suggested by karlphillip here and it works decent. Here is the code : package ro.ubbcluj.detection; import java.awt.FlowLayout; import java.awt.image.BufferedImage; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.util.ArrayList; import java.util.List; import javax.imageio.ImageIO; import javax.swing.ImageIcon; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.WindowConstants; import org.opencv.core.Core; import org.opencv.core.Mat; import org.opencv.core.MatOfByte; import org.opencv.core.MatOfPoint; import org.opencv.core.Point; import org.opencv.core.Scalar; import org.opencv.core.Size; import org.opencv.highgui.Highgui; import org.opencv.imgproc.Imgproc; public class RectangleDetection { public static void main(String[] args) throws IOException { System.loadLibrary(Core.NATIVE_LIBRARY_NAME); Mat image = loadImage(); Mat grayscale = convertToGrayscale(image); Mat treshold = tresholdImage(grayscale); List&lt;MatOfPoint&gt; contours = findContours(treshold); Mat contoursImage = fillCountours(contours, grayscale); Mat grayscaleWithContours = convertToGrayscale(contoursImage); Mat tresholdGrayscaleWithContours = tresholdImage(grayscaleWithContours); Mat eroded = erodeAndDilate(tresholdGrayscaleWithContours); List&lt;MatOfPoint&gt; squaresFound = findSquares(eroded); Mat squaresDrawn = Rectangle.drawSquares(grayscale, squaresFound); BufferedImage convertedImage = convertMatToBufferedImage(squaresDrawn); displayImage(convertedImage); } private static List&lt;MatOfPoint&gt; findS…
has comment: http://stackoverflow.com/comment/35652379
linked to: http://stackoverflow.com/q/20703570
favorite count: 0
tagged with: extract
answer count: 5
has title: Extract words in rectangles from text
linked to: http://stackoverflow.com/q/10616234
has comment: http://stackoverflow.com/comment/35926746
has answer: http://stackoverflow.com/a/23445122
tagged with: bufferedimage
possible better answer: http://stackoverflow.com/a/23294362
linked to: http://stackoverflow.com/q/7755647
tagged with: opencv
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23294362
linked to: http://stackoverflow.com/q/10107258
has answer: http://stackoverflow.com/a/23292845
upvote count: 9
linked to: http://stackoverflow.com/q/20427759
has answer: http://stackoverflow.com/a/23498561
tagged with: java
linked to: http://stackoverflow.com/q/15744520
has answer: http://stackoverflow.com/a/23439707
tagged with: image-processing
has comment: http://stackoverflow.com/comment/35650547
has comment: http://stackoverflow.com/comment/35649679
type: Question

http://stackoverflow.com/q/23204008
has body: I am using the Play framework 2.2. I have a question concerning multiple checkboxes in a form and how to correctly bind plus process them. I am looking for a Java solution. Let's assume we have a blogging site. We want to implement the functionality that when users create/edit a blog entry, they have the option of adding zero to many tags to that blog entry. These tag options appear as a long list of checkboxes on the form. For instance, if he/she creates the blog entry "10 things to do on the moon in your spare time" and wants to associate it with the "star gazing", "walking", and "golf" tags, he/she would simply check the appropriate checkboxes in the creation process. I am unsure of how to bind the models to the view or how to process the list of checkboxes once the request has been submitted. Here is an experimental code sample. First we have the models: (They are ebean entities) public class Blog extends Model { ... @ManyToMany(cascade=CascadeType.REMOVE) public List&lt;Tag&gt; tags = new ArrayList&lt;&gt;(); ... } public class Tag extends Model { @Id public Long id; public String name; ... } In the view, we pass the full list of tags to the view: (I am not sure if this method is correct) @(tags: java.util.List[Tag], blogEntryForm: Form[Blog]) ... @form(routes.Application.create(), 'id -&gt; "blogEntryForm") { ... @for((tag, index) &lt;- tags.zipWithIndex) { &lt;div class="checkbox"&gt; &lt;label&gt; &lt;input type="checkbox" name="tags[@index]" value="@tag.id"&gt; @tag.name &lt;/label&gt; &lt;/div&gt; } ... } In the controller, we process the form: public static Result createBlogEntry() { Form&lt;Blog&gt; filledForm = Form.form(Blog.class).bindFromRequest(); if (filledForm.hasErrors()) { ... } // process checkboxes ??? } Any help would be much appreciated.
tagged with: playframework-2.0
tagged with: java
upvote count: 1
tagged with: forms
has title: How to bind and process a list of checkboxes in a form using the play framework 2
type: Question
has answer: http://stackoverflow.com/a/23206899
tagged with: playframework
answer count: 1
downvote count: 0
score: 1
favorite count: 0
type: UnansweredQuestion
tagged with: checkbox

http://stackoverflow.com/a/23271694
has body: if it inside your activity then you should write this: Toast.makeText(ActivityName.this ,message, Toast.LENGTH_LONG).show(); if it's outside your class, you'll need to get your activity context
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23271590

http://stackoverflow.com/q/23141075
tagged with: mybatis
has title: MyBatis: Map of list based on a column value
type: Question
has body: Is there a way create a Map of List in Mybatis based on some value of a column in the result set. To explain my scenario below is the result set. This is a result set of Oracle hierarchical query: SELECT * FROM ( SELECT * FROM MA0101.MESSAGE_NOTIFICATION START WITH ORIGINAL_MESSAGE_SEQ_NO IS NULL CONNECT BY PRIOR MESSAGE_SEQUENCE_NO = ORIGINAL_MESSAGE_SEQ_NO ORDER SIBLINGS BY LAST_UPDATED_DT DESC) WHERE (SENDER_NYL_ID = 'T57HI9H' OR RECEIVER_NYL_ID = 'T57HI9H') AND FISCAL_START_YR = '2013' Now for every Null(blank) value of ORIGINAL_MESSAGE_SEQ_NO, I need to create a new key in the Map(key will be MESSAGE_SEQUENCE_NO) and the value would be list of all the child messages under that message sequence number. For example: One of the map key would be MESSAGE_SEQUENCE_NO = 12 and the list would be messages with sequence 12, 13 and 15 Any help or ideas?
tagged with: ibatis
score: 0
has answer: http://stackoverflow.com/a/23296227
tagged with: spring
answer count: 1
tagged with: java
type: UnansweredQuestion

playframework-2.0
tags question: http://stackoverflow.com/q/23190566
tags question: http://stackoverflow.com/q/23258250
tags question: http://stackoverflow.com/q/23286749
tags question: http://stackoverflow.com/q/23171037
tags question: http://stackoverflow.com/q/23170825
type: Tag
tags question: http://stackoverflow.com/q/23259824
tags question: http://stackoverflow.com/q/23283418
tag name: playframework-2.0
tags question: http://stackoverflow.com/q/23183841
tags question: http://stackoverflow.com/q/23204008

http://stackoverflow.com/comment/35544049
type: Comment
score: 0
comment on: http://stackoverflow.com/q/23227616
type: QuestionComment
has text: It's only a generator, it won't save the zero bytes it creates. Why should it? It only output byte arrays with zero valued bytes of a certain length.

http://stackoverflow.com/comment/35454768
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23181710
has text: Why Java? ie Python is better suited for this kinda task.
score: 0

http://stackoverflow.com/comment/35672444
type: Comment
type: QuestionComment
has text: yes @Scott I'm looking for something easier to work with. I found Table very easy to work with for 2D structure but when it comes to 3D I didn't find something similar yet
comment on: http://stackoverflow.com/q/23196574
score: 0

methods
tags question: http://stackoverflow.com/q/23235257
tags question: http://stackoverflow.com/q/23151180
tags question: http://stackoverflow.com/q/23191032
tags question: http://stackoverflow.com/q/23189672
tags question: http://stackoverflow.com/q/23160584
tags question: http://stackoverflow.com/q/23161362
tags question: http://stackoverflow.com/q/23211309
tags question: http://stackoverflow.com/q/23135015
tags question: http://stackoverflow.com/q/23248687
tags question: http://stackoverflow.com/q/23256578
tag name: methods
tags question: http://stackoverflow.com/q/23206667
tags question: http://stackoverflow.com/q/23259038
tags question: http://stackoverflow.com/q/23258191
tags question: http://stackoverflow.com/q/23271686
type: Tag
tags question: http://stackoverflow.com/q/23161272
tags question: http://stackoverflow.com/q/23146233
tags question: http://stackoverflow.com/q/23250334
tags question: http://stackoverflow.com/q/23185162
tags question: http://stackoverflow.com/q/23164988
tags question: http://stackoverflow.com/q/23258045
tags question: http://stackoverflow.com/q/23137039
tags question: http://stackoverflow.com/q/23213990
tags question: http://stackoverflow.com/q/23219494
tags question: http://stackoverflow.com/q/23198442
tags question: http://stackoverflow.com/q/23197505
tags question: http://stackoverflow.com/q/23256590
tags question: http://stackoverflow.com/q/23204608
tags question: http://stackoverflow.com/q/23284486
tags question: http://stackoverflow.com/q/23189686
tags question: http://stackoverflow.com/q/23279779
tags question: http://stackoverflow.com/q/23173285
tags question: http://stackoverflow.com/q/23267981
tags question: http://stackoverflow.com/q/23184918
tags question: http://stackoverflow.com/q/23290423
tags question: http://stackoverflow.com/q/23235852
tags question: http://stackoverflow.com/q/23188162
tags question: http://stackoverflow.com/q/23180890
tags question: http://stackoverflow.com/q/23213084
tags question: http://stackoverflow.com/q/23185749
tags question: http://stackoverflow.com/q/23141094
tags question: http://stackoverflow.com/q/23137294
tags question: http://stackoverflow.com/q/23176118
tags question: http://stackoverflow.com/q/23203872

http://stackoverflow.com/comment/35421168
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23159909
has text: @McDowell I now tried your link. See updated question for more details. I can post you the whole web service code, but it's autogenerated and actually looks pretty ugly.
score: 0

http://stackoverflow.com/q/23188417
type: Question
has body: I am trying to calculate partitions of a natural number using the formula below. The formula generates two positive numbers, then two negative and so on. You stop when P(n) &lt; 0 An example is p(3) = p(2) + p(1) = 3 p(4) = p(3) + p(2) = 3 + 2 = 5 p(5) = p(4) + p(3) - p(0) = 5 + 3 - 1 = 7 p(6) = p(5) + p(4) - p(1) = 7 + 5 - 1 = 11 *P(0) = 1 by convention In other words in order to calculate say P(5) you would have to calculate P(4) which equals P(3) + P(2) and and P(3) which equals P(2) + P(1) and finally - P(0) which equals 1. You would have to traverse down for each to find what they equal and then sum them. So to find a partition of a number you would have to find the partitions of all other numbers each. I have tried something as you can see the code below but it does not work. k = counter in my code. Code: public static long SerialFib( long n ) { long exponent = 0; double ex; long counter = 1; ex = Math.pow(-1, counter - 1); exponent = (long) ex; if (n &lt; 0) { return 0; } else { return SerialFib((exponent * (n - ( (counter * ( (3 * counter) - 1)) / 2)))) + SerialFib((exponent * (n - ( (counter * ( (3 * counter) +1))/2)))); } }
tagged with: algorithm
score: 0
has title: complex recursion formula for finding partitions
answer count: 1
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23188839
tagged with: recursion
tagged with: java
upvote count: 1
downvote count: 1

http://stackoverflow.com/comment/35435934
comment on: http://stackoverflow.com/a/23171040
score: 0
has text: im trying to use this for the program, but i keep on getting a bunch of errors
type: AnswerComment
type: Comment

http://stackoverflow.com/q/23222179
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
score: 1
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/23222927
tagged with: java
tagged with: jaxb
tagged with: unmarshalling
answer count: 1
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/23222927
has title: JAXB and Inheritance
tagged with: xsd
has body: I have this xsd : <?xml version="1.0" encoding="UTF-8"?> I would like to know data on my class "Utilisateur" but with my xml : 0 nomok passok I can't make (instanceof) my class "TraitementDTO" or i can't use function with my class "Utilisateur", or Cast. but it's not working. my code java : StringReader sr = new StringReader(this.message); JAXBContext context = JAXBContext.newInstance("ActionMathML"); Unmarshaller decodeur = context.createUnmarshaller(); msgObject = decodeur.unmarshal(sr); System.out.println(" action" + msgObject); if (msgObject instanceof TraitementDTO) { System.out.println(" action"); } How I can take my Data because i try some solutions but it's not working. My Xsd is correct to retrieve my data ? Regards

http://stackoverflow.com/a/23232849
type: Answer
answers question: http://stackoverflow.com/q/23232805
has body: Replace your last loop with: for(j = 0; j &lt; longestRowLength; j++) { for(i = 0; i &lt; a.length; i++) { if(a[i].length &lt;= j) continue; System.out.print(a[i][j]); } System.out.println(); } Prints the columns one by one. Instead of: if(a[i].length &lt;= j) continue; you can do: if(a[i].length &lt;= j) { System.out.print(' '); continue; } to leave a space for arrays which are too short. This way you print the transposed “jagged” matrix.
score: 0

http://stackoverflow.com/comment/35490074
type: Comment
score: 0
comment on: http://stackoverflow.com/a/23202092
type: AnswerComment
has text: If I understand correctly, the OP doesn't want to extract the elements of a row (or a column) and sort them, he wants to sort the whole array according to the value in a given column, without losing information.

http://stackoverflow.com/q/23270113
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: hornetq
tagged with: spring-jms
downvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/23271326
favorite count: 0
tagged with: jms
has title: HornetQ Reconnect-attempts not working with DefaultMessageListenerContainer
accepted answer: http://stackoverflow.com/a/23271326
upvote count: 1
has body: I've configured spring for jms listener to consume messages from hornetQ as follows. <jms:listener-container connection-factory="connectionFactory" concurrency="1" > <jms:listener destination="kpQueue" ref="kpJmsDelegator" method="onMessage" /> </jms:listener-container> The code works fine when the hornetq server is up and running. However when I start the application and without starting the hornetq I'm getting, could not find queue in warn mode every 5seconds. which I found that the DefaultMessageListenerContainer class sets the default recovery time to 5seconds. However I'm expecting the recovery settings to be considered from connection factory and use recovery attempts to be for 10times and if still could not connect give the reconnect resulting in manual restart of the server if jms to reactivate. Since reattempt is not considered my log is bombarded with error message. I'm not sure where I'm going wrong, could someone point out what is the mistake I'm doing? Here is the stack trace 014-04-24 18:27:27,159 [org.springframework.jms.listener.DefaultMessageListenerContainer#1-227] WARN o.s.j.l.DefaultMessageListenerContainer - Setup of JMS message listener invoker failed for destination 'snmpQueue' - trying to recover. Cause: There is no queue with name kpQueue javax.jms.JMSException: There is no queue with name snmpQueue at org.hornetq.jms.client.HornetQSession.createQueue(HornetQSession.java:407) ~[hornetq-jms-2.2.21.Final.jar:2.2.21.SNAPSHOT (HQ_2_2_21_final, 122)] at org.springframework.jms.support.destination.DynamicDestinationResolver.resolveQueue(DynamicDestinationResolver.java:101) ~[spring-jms-3.2.3.RELEASE.jar:3.2.3.RELEASE] at org.springframework.jms.support.destination.DynamicDestinationResolver.resolveDestinationName(DynamicDestinationResolver.java:66) ~[spring-jms-3.2.3.RELEASE.jar:3.2.3.RELEASE] at org.springframework.jms.support.destination.JmsDestinationAccessor.resolveDestinationName(JmsDestinationAccessor.java:100) ~[spring-jms-3.2.3.RELEASE.jar…
type: Question

http://stackoverflow.com/q/23286539
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35644254
upvote count: 1
has comment: http://stackoverflow.com/comment/35644354
tagged with: linked-list
has title: add an element at the end of a linkedList
score: 1
tagged with: java
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/35644180
has answer: http://stackoverflow.com/a/23286677
downvote count: 0
has comment: http://stackoverflow.com/comment/35644500
has answer: http://stackoverflow.com/a/23286624
has comment: http://stackoverflow.com/comment/35644251
has body: Task is to append an element at the end of a linkedList using boolean /** * Appends the specified element to the end of this list * @param element element to add to the list * @return true * @throws NullPointerException when element is null */ My solution public boolean add(T element) { ListNode newElement = new ListNode (element); while (cur.link == !null) { cur = cur.link; cur.link = newElement(element, null); if (cur==null) { throw new NullPointerException; } } return true; } Need help in correcting my code.
favorite count: 0
has comment: http://stackoverflow.com/comment/35644125
has comment: http://stackoverflow.com/comment/35644154

http://stackoverflow.com/a/23231423
type: Answer
has comment: http://stackoverflow.com/comment/35543214
has body: The problem is with this: y = entry.indexOf(":", x+1); z = entry.substring(x+1, y); If there is no ":" after x+1 then y will be -1, and then the next call to entry.substring will fail. The method substring checks if the second value is less than the first value and throws an exception with the difference. That's why you get a strange number in the exception. To fix it, you can check if y is -1 like so: y = entry.indexOf(":", x+1); if (y == -1) break; z = entry.substring(x+1, y);
has comment: http://stackoverflow.com/comment/35543273
has comment: http://stackoverflow.com/comment/35543165
has comment: http://stackoverflow.com/comment/35543222
score: 0
answers question: http://stackoverflow.com/q/23231314

http://stackoverflow.com/q/23167381
type: Question
linked to: http://stackoverflow.com/q/13102045
tagged with: for-loop
upvote count: 1
favorite count: 0
has body: I'm trying to make a program that checks if a phrase is a palindrome or not. I first ask how many phrases they want to check, and then proceed to ask the user to type in the phrase. For some reason, when I put the amount of phrases to 1 while testing, the program skips over asking user for user input, and goes straight to printing out the results.. I'm guessing that the problem lies in the For loop used to ask for user input but I'm not sure.. I'll paste the main method of the program, as I don't think the other methods will be necessary for now.. public static void main(String [] args) { //vars String userInput; //scanner Scanner in = new Scanner(System.in); //user input System.out.println("\t Palindrome Checker"); System.out.print("How many do you want to test: "); int many = in.nextInt(); //Array String [] a = new String[many]; boolean [] det = new boolean[many]; for(int i = 0; i &lt; many; i++) { System.out.print("Input phrase one at a time: "); a[i] = in.nextLine(); } //object RecursivePalindrome pal = new RecursivePalindrome(); System.out.println(); //call methods for(int i = 0; i &lt; many; i++) { a[i] = RecursivePalindrome.helper(a[i]); det[i] = pal.palindrome(a[i]); } //print results System.out.println("=========================== Results ============================"); System.out.println(); System.out.printf(" %-30s%-11s%n", "Phrase or Word", "Palindrome?"); for(int i = 0; i &lt; a.length; i++) { System.out.printf(" %-30s%-11s%n", a[i], det[i]); } }
has title: Something wrong with my loop or scanner
tagged with: input
tagged with: java.util.scanner
has comment: http://stackoverflow.com/comment/35429556
answer count: 0
downvote count: 0
type: UnansweredQuestion
score: 1
has comment: http://stackoverflow.com/comment/35429471
duplicate of: http://stackoverflow.com/q/13102045
tagged with: loops
has comment: http://stackoverflow.com/comment/35429427
has comment: http://stackoverflow.com/comment/35429477
tagged with: java

http://stackoverflow.com/q/23242063
score: 0
has answer: http://stackoverflow.com/a/23249611
has body: I am trying to make a application where it will retrieve some data from database and will fill the data into JTable. In the table there will be 2 buttons which will update a status field of my database column (that is custom object of my model for that row) . After doing so ,the first button will get disabled and the second button will get enabled for that row/object. I tried to use JButtonColumn as a test but the problem is when i click 2 different button,the other buttons in between get disabled also. This is what i have tried so far: import java.awt.event.ActionEvent; import javax.swing.JFrame; import javax.swing.JScrollPane; import javax.swing.JTable; import javax.swing.table.AbstractTableModel; import java.awt.event.*; import java.util.*; import javax.swing.*; import javax.swing.table.*; public class JavaApplication1 extends JFrame { private static final long serialVersionUID = 1L; private JTable table; private MyTableModel myModel = new MyTableModel(); public JavaApplication1() { table = new JTable(myModel); addTableDatas(); table.setPreferredScrollableViewportSize(table.getPreferredSize()); JScrollPane scrollPane = new JScrollPane(table); add(scrollPane); ButtonColumn buttonColumn = new ButtonColumn(table, delete, 3); buttonColumn.setMnemonic(KeyEvent.VK_D); } public static void main(String[] args) { JavaApplication1 frame = new JavaApplication1(); frame.setDefaultCloseOperation(EXIT_ON_CLOSE); frame.pack(); frame.setVisible(true); } private void addTableDatas() { Vector&lt;String&gt; columnNameS = new Vector&lt;String&gt;(); columnNameS.add("Date"); columnNameS.add("String"); columnNameS.add("Decimal"); columnNameS.add("Remove"); myModel.setColumnNames(columnNameS); Vector&lt;Object&gt; row1 = new Vector&lt;Object&gt;(); row1.add(new Date()); row1.add("A"); row1.add(new Double(5.1)); row1.add("Remove"); myModel.addRow(row1); row1 = new Vector&lt;Object&gt;(); row1.add(new Date()); row1.add("B"); row1.add(new Double(6.2)); row1.add("Remove"); myModel.addRow(r…
answer count: 1
favorite count: 0
type: UnansweredQuestion
has title: Disabling JButton Inside JTable
has comment: http://stackoverflow.com/comment/35569849
has comment: http://stackoverflow.com/comment/35563150
tagged with: java
upvote count: 1
tagged with: swing
downvote count: 1
type: Question
tagged with: jbutton
tagged with: jtable

http://stackoverflow.com/a/23235172
downvote count: 0
answers question: http://stackoverflow.com/q/23235027
has comment: http://stackoverflow.com/comment/35550205
upvote count: 2
has body: This is happening because you are creating a new instance of time class (time t = new time(); ) inside the while loop. Instead do this : public static void main (String[] args) { time t = new time(); // create an instance of time class while (true) { //Something if (input[0].equals("r")) { // call RestartTimer on the same in t.RestartTimer(); } } } Also inside RestartTimer() function you are creating new instance of Timer. Change it as follows : public void RestartTimer() { ttimer.cancel(); timer.cancel(); timer = new Timer(); TimerTask ttimer = new TimerTask() { public void run() { System.out.println("ping"); } }; timer.scheduleAtFixedRate(ttimer, 10000, 10000); }
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35550186
has comment: http://stackoverflow.com/comment/35550358
type: Answer
has comment: http://stackoverflow.com/comment/35550485
score: 2
has comment: http://stackoverflow.com/comment/35550409
accepted answer of: http://stackoverflow.com/q/23235027

http://stackoverflow.com/q/23290424
possible better answer: http://stackoverflow.com/a/23291008
accepted answer: http://stackoverflow.com/a/23291118
has answer: http://stackoverflow.com/a/23291008
answer count: 2
score: 3
downvote count: 0
has body: I've got an issue with nested lists & was hoping someone could help.I would like to unmarshal the list in the below XML. I was hoping someone could point me in the right direction, I believe me annotations are off. When I try and unmarshall the MyList array it's returned null. I have an XML: <?xml version="1.0" encoding="UTF-8" standalone="yes"?> N1 T1 V1 N2 T2 V2 MyList object: @XmlRootElement(name = "myList") @XmlAccessorType(XmlAccessType.FIELD) public class MyList { @XmlValue private String name; @XmlValue private String type; @XmlValue private String version; Root Class: @XmlAccessorType(XmlAccessType.FIELD) @XmlRootElement public class Root { @XmlElementWrapper(name="myLists") @XmlElement(name="myList") private List list = new ArrayList (); Any help would be much appreciated.
favorite count: 0
has answer: http://stackoverflow.com/a/23291118
has title: JAX-B Nested Lists
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
upvote count: 3
tagged with: java
tagged with: jaxb
type: Question

http://stackoverflow.com/comment/35460577
score: 0
type: Comment
type: QuestionComment
has text: You could add a timeout: https://hc.apache.org/httpclient-3.x/apidocs/org/apache/commons/httpclient/params/HttpConnectionParams.html#setSoTimeout(int)
comment on: http://stackoverflow.com/q/23185209

http://stackoverflow.com/comment/35364439
comment on: http://stackoverflow.com/q/23131173
has text: Add your web.xml, make sure that it has a correct version if it is to low it will not have EL enabled.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23163118
has answer: http://stackoverflow.com/a/23163345
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/23163324
has comment: http://stackoverflow.com/comment/35422192
has comment: http://stackoverflow.com/comment/35422612
type: UnansweredQuestion
has title: Best way to store a password
has body: I have a java program that scraps web pages and store data on a db. This program has no user interface, it's run vy the linux boot sequence. what is the best way to store the db and sites password for a program like this? I alreasy tried pass them via configuration file or command line, but i'm not very satisfied. Thanks
tagged with: passwords
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/23163354

http://stackoverflow.com/comment/35507590
type: Comment
has text: Yes..I too suggest that.. If my answer helped you kindly accept it as answer..please.. @Rakesh
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23211399

http://stackoverflow.com/comment/35647134
has text: I guess the exception is thrown in your applet? If so, did you import the required namespaces, .e.g. `java.io.*` for `File`?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23287655
score: 0

http://stackoverflow.com/q/23261020
type: Question
upvote count: 4
answer count: 2
downvote count: 0
score: 4
has answer: http://stackoverflow.com/a/23261294
has answer: http://stackoverflow.com/a/23277944
tagged with: log4j
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0
type: UnansweredQuestion
has title: How to set value in log4j.xml using property file?
tagged with: properties
linked to: http://stackoverflow.com/q/22028399
tagged with: logging
has body: I would like to know if there is possibility to set an attribute in log4j.xml by using property file. For example the log4j.xml: <?xml version="1.0" encoding="iso-8859-1"?> <log4j:configuration> <level value="WARN"/> <level value="DEBUG"/> <appender-ref ref="FILE"/> <appender-ref ref="CONSOLE"/> </log4j:configuration> I wan to specify the path for the file using Properties file Any idea how can we do it ????
tagged with: java
linked to: http://stackoverflow.com/q/19277445

http://stackoverflow.com/a/23176016
score: 5
has comment: http://stackoverflow.com/comment/35454996
type: AcceptedAnswer
downvote count: 0
has body: Welcome to the amazing world of parallel processing. When using threads, no one can guarantee how their progress will be scheduled unless you're using sync mechanism like locks and barriers. What you're trying to do here is print a single unified output stream, supposedly showing how the threads are progressing. This means you're merging the printouts from the threads, but you can't tell how these prints get interleaved. Furthermore, the prints are not necessarily done in the order the functions are called, there are several layers of buffering, and worse - the actual call to the printing code is not atomically done with the read and the decrement. You can say that the variable is decremented repeatedly (although since it's not using any atomic/synchronizing mechanism you can't even say for sure that you won't see duplicated results and decrements getting overridden), and each thread will not print a higher value after it printed a lower value alreay, but between threads, the messages can get stalled and therefore print out of order. When you see in the first example - Thread-2:the number of tickets is 16 Thread-0:the number of tickets is 19 Thread 0 actually read and decremented the variable first, but the printing got delayed (due to a context switch or anything else). Thread 2 ran after a few other instances already did, but got to print its message right away, and only then did thread 0 get to finish that earlier instance. Note that you don't see here thread 0 printing any other value in between, its next iteration already reads 14. Edit: To elaborate a little further, here's a small example of possible interleaving. Say the machine code for each thread is - (in made up pseudo format) label: load [var] -&gt; rax dec rax store rax -&gt; [var] call print function // implicitly uses rax cmp rax, 0 jg label /// jump-if-greater (var is a memory location, on the stack for e.g.) And lets say you have 2 threads running. One possible interleaving could be - thread 0 | th…
accepted answer of: http://stackoverflow.com/q/23175867
answers question: http://stackoverflow.com/q/23175867
type: Answer
has comment: http://stackoverflow.com/comment/35445401
upvote count: 5
has comment: http://stackoverflow.com/comment/35445008

http://stackoverflow.com/comment/35644711
score: 0
type: Comment
type: QuestionComment
has text: See [this](http://www.javaprogrammingforums.com/awt-java-swing/23191-adding-items-jlist-using-jcombobox-problem-avoiding-duplicates.html) for help.
comment on: http://stackoverflow.com/q/23286680

http://stackoverflow.com/comment/35599644
comment on: http://stackoverflow.com/q/23252834
score: 0
type: Comment
has text: Please post your full strack trace.
type: QuestionComment

http://stackoverflow.com/comment/35424238
score: 0
comment on: http://stackoverflow.com/q/23164331
has text: Does the element with ID = 123 exist in your array?
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35589712
type: Comment
has text: Seems fine to me, at first glance. Have you tried cleaning and rebuilding your project?
comment on: http://stackoverflow.com/q/23257267
score: 0
type: QuestionComment

http://stackoverflow.com/comment/35402561
type: QuestionComment
has text: @alfa I already given answer to you!!!Then you asked similar question.
comment on: http://stackoverflow.com/q/23152446
score: 0
type: Comment

http://stackoverflow.com/q/23203778
has comment: http://stackoverflow.com/comment/44946228
tagged with: java
tagged with: image-processing
accepted answer: http://stackoverflow.com/a/23587567
has comment: http://stackoverflow.com/comment/44949045
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36043865
has title: DCT implementation
type: Question
has comment: http://stackoverflow.com/comment/35516646
tagged with: dct
has comment: http://stackoverflow.com/comment/35493276
has answer: http://stackoverflow.com/a/23587567
has comment: http://stackoverflow.com/comment/35508902
score: 0
tagged with: http://stackoverflow.com/tag/jpeg
answer count: 1
has body: I'm trying to implement image compression algorithm based on DCT for color JPEG. I'm newbie in image processing so I need some help. What I need is clarification of an algorithm. I'm using DCT implementation from here So, here is the algorithm as I understood it: Load an image using ImageIO into BufferedImage. Create 3 matrices (1 for each channel: red, green, blue): int rgb = bufferedImage.getRGB(i, j); int red = (rgb &gt;&gt; 16) &amp; 0xFF; int green = (rgb &gt;&gt; 8) &amp; 0xFF; int blue = rgb &amp; 0xFF; Increase matrices to the size so they can be split in chunks 8x8 (where 8 is the size of DCT matrix, N) For each matrix, split it into chunks of the size 8x8 (result: splittedImage) Perform forwardDCT on matrices from splittedImage (result: dctImage). Perform quantization on matrices from dctImage (result: quantizedImage) Here I don't know what to do. I can: merge quantizedImage matrices into one matrix margedImage, convert it into Vector and perform compressImage method. or convert small matrices from quantizedImage into Vector and perform compressImage method on them, and then marge them into one matrix So, here I got 3 matrices for red, green and blue colors. Than I convert those matrices into one RGB matrix and create new BufferedImage and using method setRGB to set pixel values. Then perform saving image to file. Extra questions: Is it better to convert RGB into YCbCr and perform DCT on Y, Cb and Cr? Javadoc of compressImage method says that it's not Huffman Encoding, but Run-Length encoding. So will the compressed image be opened by image viewer? Or I should use Huffman Encoding according to JPEG specification, and is there any open source Huffman Encoding implementation in Java?
tagged with: algorithm

http://stackoverflow.com/comment/35400105
has text: @ . laalto .....Hey i resolved ... i flushed out the old db file from DBMS and compiled again .... now i can see the values :)
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23150303

http://stackoverflow.com/q/23208530
answer count: 1
favorite count: 0
tagged with: jframe
type: UnansweredQuestion
has body: How would I go about creating a 4x4 grid of colored,clickable areas using swing? Ok, so I have the buttons I need. This is the updated code I have. I am now trying to to get a text field or jlabel to show up on the bottom left. But I can't get it to work. I thought making another panel could fix it but apparently not. import java.awt.*; import java.util.ArrayList; import javax.swing.*; public class Heist { ArrayList&lt;JButton&gt; buttons = new ArrayList&lt;JButton&gt;(); public Heist(){ JFrame frame = new JFrame("Hesit!"); frame.setLayout(new BorderLayout()); JPanel top = new JPanel(); top.setLayout(new BoxLayout(top,BoxLayout.LINE_AXIS)); top.add(new JTextField("Moves: ")); JPanel center = new JPanel(); center.setLayout(new GridLayout(4,4)); for(int i = 0; i &lt; 16; i++){ center.add(new JButton()); buttons.add(new JButton()); } JPanel bottom = new JPanel(); JPanel bottomR = new JPanel(); bottom.setLayout(new GridLayout(1,2)); bottomR.setLayout(new GridLayout(1,2)); bottomR.add(new JButton ("EMP")); bottomR.add(new JButton ("Reset")); bottom.add(new JTextField("Enter/Exit")); Container pane = frame.getContentPane(); pane.add(top, BorderLayout.NORTH); pane.add(center, BorderLayout.CENTER); pane.add(bottom, BorderLayout.SOUTH); pane.add(bottomR, BorderLayout.SOUTH); frame.pack(); frame.setSize(400,400); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true); } public static void main(String[] args){ Heist gui = new Heist(); } }
score: -3
has comment: http://stackoverflow.com/comment/35502276
has comment: http://stackoverflow.com/comment/35502169
upvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/35502247
has title: Setting an icon image to top right and bottom left buttons
tagged with: swing
has comment: http://stackoverflow.com/comment/35502181
type: Question
has comment: http://stackoverflow.com/comment/35502608
has comment: http://stackoverflow.com/comment/35502238
has comment: http://stackoverflow.com/comment/35502269
has answer: http://stackoverflow.com/a/23208590
tagged with: grid-layout
downvote count: 3
has comment: http://stackoverflow.com/comment/35502249

http://stackoverflow.com/a/23274258
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/23274038
score: 6
has comment: http://stackoverflow.com/comment/35627331
has comment: http://stackoverflow.com/comment/35620974
upvote count: 6
has comment: http://stackoverflow.com/comment/35641829
has comment: http://stackoverflow.com/comment/35621310
has comment: http://stackoverflow.com/comment/35621177
has body: Locking the assignment to b will, at the very least, introduce an acquire-fence before the assignment, and a release-fence after the assignment. This prevents instructions after the acquire-fence to be moved above the fence, and instructions before the release-fence to be moved below the fence. Using the ↓↑ notation: a = 5; ↓ b = 5; ↑ c = 5; The ↓ prevents instructions from being moved above it. The ↑ prevents instructions from being moved below it.
has comment: http://stackoverflow.com/comment/35621104

http://stackoverflow.com/a/23261843
score: 2
has comment: http://stackoverflow.com/comment/35614046
downvote count: 0
has body: If you don't care about is resource not present then just set strict mode off for reader then it will not throw exception.
upvote count: 2
type: Answer
answers question: http://stackoverflow.com/q/23257659

http://stackoverflow.com/q/23220224
possible better answer: http://stackoverflow.com/a/23220454
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23220454
has body: I have a text file which has the string, - "!- =========== ALL OBJECTS IN CLASS: FENESTRATIONSURFACE:DETAILED ===========" in it as you can see in the code below. IF the text file contains this string I need to read it from the text file and then print it out again. The problem is I cant work out why my code is not printing it. Any help would be appreciated thanks! public class Main { public static void main(String[] args) throws FileNotFoundException { File file = new File("C:/Users/Anton/Pictures/1 x geotransform0.5m shading.txt"); Scanner scan = new Scanner(file); while(scan.hasNext()){ String str = scan.next(); if(str == "!- =========== ALL OBJECTS IN CLASS: FENESTRATIONSURFACE:DETAILED ==========="){ System.out.print(str); } } scan.close(); } }
tagged with: java
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/23220590
score: 0
linked to: http://stackoverflow.com/q/513832
has comment: http://stackoverflow.com/comment/35522365
accepted answer: http://stackoverflow.com/a/23220590
tagged with: java.util.scanner
has comment: http://stackoverflow.com/comment/35522340
has comment: http://stackoverflow.com/comment/35522332
has title: Using scanner to read string from text file and then print out

http://stackoverflow.com/q/23246806
tagged with: textfield
has comment: http://stackoverflow.com/comment/35571485
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35571834
has comment: http://stackoverflow.com/comment/35599789
linked to: http://stackoverflow.com/q/17874717
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/35572012
type: Question
linked to: http://stackoverflow.com/q/5621338
has title: Text field changes size to fullscreen when i resize my window
has body: I have a text field set to size 100x400 (it's under icons and f(x) = ... text) and if i resize my window even by 1px when the applet is already running then it's changing to this: code for textfield: TextField textFieldA = new TextField("7.5", 35); ... add(aa); add(textFieldA); aa.setLocation(920, 600); textFieldA.setBounds((int)(920 + aa.getWidth() + 10),595,150,30); aa is the image with "a = "
has comment: http://stackoverflow.com/comment/35572142
score: 0
tagged with: applet
has comment: http://stackoverflow.com/comment/35572359

http://stackoverflow.com/q/23249618
answer count: 0
has comment: http://stackoverflow.com/comment/35581856
has comment: http://stackoverflow.com/comment/35601000
has title: Upload information from XML to Java and HTML
has comment: http://stackoverflow.com/comment/35577871
type: Question
tagged with: java
score: 0
has body: I have a collection of XML data which is as follows, information.xml name: How to display XML data I have in the HTML string. I did a series of data, but does not show me the HTML document. Help. <?xml version="1.0" encoding="UTF-8"?> name1 This is information1 name2 This is information2 JAVA: try { FileInputStream file = new FileInputStream(new File("///assets/information.xml")); DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = builderFactory.newDocumentBuilder(); Document xmlDocument = builder.parse(file); XPath xPath = XPathFactory.newInstance().newXPath(); String expression = "/Jugadores/Jugador[@id='1']/name"; NodeList nodeList = (NodeList) xPath.compile(expression).evaluate(xmlDocument, XPathConstants.NODESET); String html = " " + " " + " " + nodeList + " information "; //WebView TAG1 WebView webView = (WebView) findViewById(R.id.webView1); webView.getSettings().setJavaScriptEnabled(true); webView.setWebViewClient(new WebViewClient()); webView.loadData(html, "text/html", "UTF-8"); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (SAXException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } catch (ParserConfigurationException e) { e.printStackTrace(); } catch (XPathExpressionException e) { e.printStackTrace(); }
type: UnansweredQuestion
tagged with: http://stackoverflow.com/tag/html
tagged with: http://stackoverflow.com/tag/xml
tagged with: xpath

http://stackoverflow.com/q/23271602
possible better answer: http://stackoverflow.com/a/23271839
has answer: http://stackoverflow.com/a/23271839
type: Question
has answer: http://stackoverflow.com/a/23273116
has comment: http://stackoverflow.com/comment/35616102
score: 0
answer count: 2
accepted answer: http://stackoverflow.com/a/23273116
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. For c++, I refer to this page http://social.msdn.microsoft.com/Forums/ko-KR/bd1722e7-07b3-4119-b7de-10788f9f6e36/aes-string-encryption-in-c?forum=windowsmobiledev The result is defferent. In java abcd1234 7e77643ca7d46d46298be3239f1a5cdb abcd1234 In c++ Strange characters... What i have to do?
tagged with: encryption
tagged with: c++
type: AnsweredQuestion
has title: Encrypting a string in Java and decrypting it in C++. What i have to do more?
tagged with: java

http://stackoverflow.com/a/23163614
has body: You cannot simply call it from the browser by entering a URL. A web service requires the client to send a SOAP request. Try using a tool like SoapUI.
answers question: http://stackoverflow.com/q/23163578
has comment: http://stackoverflow.com/comment/35429821
score: 0
type: Answer

http://stackoverflow.com/comment/35395775
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23148157
type: AnswerComment
has text: @user3507894 first of all there is no mention of the video in your code. secondly you haven't understood my previous post and this. Thirdly you edited your question now. Fourthly no one is going to code for you.

http://stackoverflow.com/a/23235287
has comment: http://stackoverflow.com/comment/35550064
accepted answer of: http://stackoverflow.com/q/23235222
answers question: http://stackoverflow.com/q/23235222
type: Answer
score: 2
upvote count: 2
has body: As you're using android.support.v4.app.DialogFragment, you should pass to show() an instance of android.support.v4.app.FragmentManager which can be queried using an getSupportFragmentManager() call instead of getFragmentManager().
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/35562809
score: 0
type: Comment
type: QuestionComment
has text: set the return type of the method to be JSON. So other .net app wont bother because the webservice layer will convert the result to a dataset object eitherway but other language will parse the JSON string better. alos expecially with Dataset when it's a return as XML the column name is repeated twice for each value as for JSON it's only written once so data size wise it's better on Dataset/Datatable object.
comment on: http://stackoverflow.com/q/23241815

http://stackoverflow.com/comment/35379069
has text: Replace `textresult=="OK"` with `textresult.equals("OK")`. This is how you check equality for strings.
score: 1
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23138974

http://stackoverflow.com/a/23163960
upvote count: 2
has body: Here's some code that may help a bit. Read the integer and catch the exception in a loop. When the input is an integer, the loop exits. When an exception is thrown, the loop continues. Scanner sc = new Scanner(System.in); int i=0; while(true) { System.out.println("enter an integer:"); try { int i = sc.nextInt(); break; } catch(InputMismatchException ignore){} } // i has been read successfully
answers question: http://stackoverflow.com/q/23163764
downvote count: 0
type: Answer
score: 2

multithreading
tags question: http://stackoverflow.com/q/23156985
tags question: http://stackoverflow.com/q/23175867
tags question: http://stackoverflow.com/q/23169557
tags question: http://stackoverflow.com/q/23261120
tags question: http://stackoverflow.com/q/23255162
tags question: http://stackoverflow.com/q/23185049
tags question: http://stackoverflow.com/q/23213969
tags question: http://stackoverflow.com/q/23193749
tags question: http://stackoverflow.com/q/23179910
tags question: http://stackoverflow.com/q/23272350
tags question: http://stackoverflow.com/q/23217190
type: Tag
tags question: http://stackoverflow.com/q/23164580
tags question: http://stackoverflow.com/q/23287054
tags question: http://stackoverflow.com/q/23175316
tags question: http://stackoverflow.com/q/23263512
tags question: http://stackoverflow.com/q/23226096
tags question: http://stackoverflow.com/q/23169349
tags question: http://stackoverflow.com/q/23235826
tags question: http://stackoverflow.com/q/23180112
tags question: http://stackoverflow.com/q/23245979
tags question: http://stackoverflow.com/q/23171245
tags question: http://stackoverflow.com/q/23258306
tags question: http://stackoverflow.com/q/23286148
tags question: http://stackoverflow.com/q/23266866
tags question: http://stackoverflow.com/q/23141029
tags question: http://stackoverflow.com/q/23165042
tags question: http://stackoverflow.com/q/23181918
tags question: http://stackoverflow.com/q/23263486
tags question: http://stackoverflow.com/q/23205200
tags question: http://stackoverflow.com/q/23232107
tags question: http://stackoverflow.com/q/23193121
tags question: http://stackoverflow.com/q/23279744
tags question: http://stackoverflow.com/q/23253195
tags question: http://stackoverflow.com/q/23237595
tags question: http://stackoverflow.com/q/23251445
tags question: http://stackoverflow.com/q/23232579
tags question: http://stackoverflow.com/q/23267889
tags question: http://stackoverflow.com/q/23227529
tags question: http://stackoverflow.com/q/23170201
tags question: http://stackoverflow.com/q/23254133
tags question: http://stackoverflow.com/q/23272987
tags question: http://stackoverflow.com/q/23224273
tags question: http://stackoverflow.com/q/23178915
tags question: http://stackoverflow.com/q/23275360
tags question: http://stackoverflow.com/q/23167319
tags question: http://stackoverflow.com/q/23210904
tags question: http://stackoverflow.com/q/23278399
tags question: http://stackoverflow.com/q/23165581
tags question: http://stackoverflow.com/q/23154260
tags question: http://stackoverflow.com/q/23250117
tags question: http://stackoverflow.com/q/23271351
tags question: http://stackoverflow.com/q/23186564
tags question: http://stackoverflow.com/q/23151988
tags question: http://stackoverflow.com/q/23135412
tags question: http://stackoverflow.com/q/23200186
tags question: http://stackoverflow.com/q/23246834
tags question: http://stackoverflow.com/q/23274038
tags question: http://stackoverflow.com/q/23233623
tags question: http://stackoverflow.com/q/23255267
tags question: http://stackoverflow.com/q/23238384
tags question: http://stackoverflow.com/q/23135722
tags question: http://stackoverflow.com/q/23248386
tags question: http://stackoverflow.com/q/23208149
tags question: http://stackoverflow.com/q/23258357
tags question: http://stackoverflow.com/q/23271755
tags question: http://stackoverflow.com/q/23138066
tags question: http://stackoverflow.com/q/23247443
tags question: http://stackoverflow.com/q/23228822
tags question: http://stackoverflow.com/q/23136769
tags question: http://stackoverflow.com/q/23286771
tags question: http://stackoverflow.com/q/23290543
tags question: http://stackoverflow.com/q/23239541
tags question: http://stackoverflow.com/q/23225648
tags question: http://stackoverflow.com/q/23180442
tags question: http://stackoverflow.com/q/23273378
tags question: http://stackoverflow.com/q/23276665
tags question: http://stackoverflow.com/q/23187600
tags question: http://stackoverflow.com/q/23208346
tags question: http://stackoverflow.com/q/23159915

http://stackoverflow.com/comment/35520464
score: 0
has text: The [some logic] part is actually what's doing the retrieval of what getObject() returns (based on an argument, just wanted to keep my question as on topic as possible ;) ), so CQS is satisfied. I've gone with the private method approach, which is called by getObject() and getObjectValue() in the parent class. Thank you :)
type: Comment
comment on: http://stackoverflow.com/a/23215277
type: AnswerComment

http://stackoverflow.com/q/23213728
tagged with: deadlock
has answer: http://stackoverflow.com/a/23367116
downvote count: 0
answer count: 1
has title: EhCache Deadlock issue while using RMI Cache Replicator
tagged with: replication
favorite count: 0
tagged with: ehcache
upvote count: 2
type: UnansweredQuestion
tagged with: spring
score: 2
tagged with: java
has body: I am facing the cache deadlock issue in my application while RMI Cache Replicator strategy. Following is the exception log: net.sf.ehcache.transaction.DeadLockException: deadlock detected in cache [abcCache] on key [1] between current transaction [139003] and foreign transaction [138998] at net.sf.ehcache.transaction.local.LocalTransactionStore.put(LocalTransactionStore.java:200) at net.sf.ehcache.transaction.local.JtaLocalTransactionStore.put(JtaLocalTransactionStore.java:268) at net.sf.ehcache.Cache.putInternal(Cache.java:1434) at net.sf.ehcache.Cache.put(Cache.java:1367) at net.sf.ehcache.Cache.put(Cache.java:1339) Following is my ehcache configuration with RMI synchronization: &lt;transactionManagerLookup class="net.sf.ehcache.transaction.manager.DefaultTransactionManagerLookup" properties="jndiName=java:comp/UserTransaction" propertySeparator=";"/&gt; &lt;cacheManagerPeerProviderFactory class="net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory" properties="peerDiscovery=automatic, multicastGroupAddress=x.x.x.x, multicastGroupPort=xxxx, timeToLive=32"/&gt; &lt;cacheManagerPeerListenerFactory class="net.sf.ehcache.distribution.RMICacheManagerPeerListenerFactory" properties="port=40001, socketTimeoutMillis=2000"/&gt; &lt;cache name="abcCache" maxElementsInMemory="100" eternal="false" overflowToDisk="false" diskPersistent="false" timeToIdleSeconds="0" timeToLiveSeconds="86400" memoryStoreEvictionPolicy="LRU" transactionalMode="xa"&gt; &lt;cacheEventListenerFactory class="net.sf.ehcache.distribution.RMICacheReplicatorFactory" properties="replicatePuts=true, replicateUpdates=true, replicateRemovals=true, replicateUpdatesViaCopy=false, replicateAsynchronously=true, asynchronousReplicationIntervalMillis=500"/&gt; &lt;/cache&gt; I am using ehcache-core ver 2.4.3. Appreciate any help.
type: Question

http://stackoverflow.com/q/23263691
has body: I have a stateless session bean that creates a RuntimeFactory and Application object. Both classes are part of the Social Business Toolkit. Application is used to read the properties and managed-beans files, but this didn't happen because the RuntimeFactory was unable to get the Application object. AbstractRuntimeFactory has a Map with Application objects: private Map&lt;ClassLoader,AbstractApplication&gt; applications = new HashMap&lt;ClassLoader, AbstractApplication&gt;(); ClassLoader is set using this method: protected ClassLoader getContextClassLoader() { return Thread.currentThread().getContextClassLoader(); } The Application object is retrieved with this method: public Application getApplicationUnchecked() { ClassLoader cl = getContextClassLoader(); return applications.get(cl); } During debugging I noticed the Thread id stays the same, but there are two different instances of ClassLoader. How does this happen? There's only one session bean, RuntimeFactory and Application. Shouldn't getContextClassLoader() always give me the same object back? As I work around I now use: ClassLoader cl = this.getClass().getClassLoader(); Where this is the RuntimeFactory, but I'm not sure if this is a good solution.. it feels more like a workaround to the actual problem. ps: I'm using WebSphere Portal as application server.
has title: Thread.currentThread().getContextClassLoader() returns multiple object instances
tagged with: java
type: Question
tagged with: jakarta-ee
score: 0
answer count: 1
tagged with: ibm-sbt
has comment: http://stackoverflow.com/comment/35611517
has answer: http://stackoverflow.com/a/23366013
type: UnansweredQuestion

http://stackoverflow.com/q/23283996
score: 1
tagged with: java
tagged with: hibernate
tagged with: date
has answer: http://stackoverflow.com/a/23284170
answer count: 2
downvote count: 0
favorite count: 0
has title: Not able to save Calender Date in Data base in java
tagged with: spring
tagged with: http://stackoverflow.com/tag/xml
has answer: http://stackoverflow.com/a/23284266
type: UnansweredQuestion
upvote count: 1
type: Question
has body: I am trying to save date in database. Receiving the Date from partner system in XML and the jar file which is providing setter and getter methods for that XML tag is of java.util.Calender type This I need to save as Date type in my code. I am trying to use getTime() method but its not saving. I am not getting any exception but value is not storing in Database. java.util.Calender ls; ls.getDate() is the method which getting date from XML Tag its inside jar file XML tag is &lt;v2:EffDate&gt;2013-12-01T00:00:00Z&lt;/v2:Effdate&gt; Date date = (Date)ls.getEffDate().getTime(); // ls is the object and converting Calander to Date I also tried - Date date = ls.getEffDate().getTime(); now setting this value to DB Class SaveDate sd = new Savedate(); sd.setEffdate(date); when saving it as DomainObject for simple form controller of Spring its not reflecting in DB other values are saving fine for same object hibernate mapping is like &lt;property name = "effDate" type = "java.util.Date"&gt; &lt;column name = "Effective_Date"/&gt;&lt;/property &gt; EFFECTIVE_DATE is of Type Date in DataBase what is the way to save it ??

http://stackoverflow.com/a/23149641
has comment: http://stackoverflow.com/comment/35398963
upvote count: 1
has comment: http://stackoverflow.com/comment/35398356
answers question: http://stackoverflow.com/q/23148144
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/35400848
has comment: http://stackoverflow.com/comment/35398836
has body: You didn't dig very deep. HashSet.iterator() returns map.keySet().iterator() map.keySet() returns a HashMap.KeySet HashMap.KeySet.iterator() calls [HashMap.this.]newKeyIterator() LinkedHashMap overrides newKeyIterator().
has comment: http://stackoverflow.com/comment/35398239
accepted answer of: http://stackoverflow.com/q/23148144
type: Answer
has comment: http://stackoverflow.com/comment/35398745
score: 1

http://stackoverflow.com/a/48663755
type: Answer
answers question: http://stackoverflow.com/q/23187539
score: 0
has body: Please try this I checked it. It works correctly import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.HashMap; import java.util.Map; import java.util.Stack; public class CloseBrackets { private static Map&lt;Character, Character&gt; leftChar = new HashMap&lt;&gt;(); private static Map&lt;Character, Character&gt; rightChar = new HashMap&lt;&gt;(); static { leftChar.put('(', '('); rightChar.put(')', '('); leftChar.put('[', '['); rightChar.put(']', '['); leftChar.put('{', '{'); rightChar.put('}', '{'); } public static void main(String[] args) throws IOException { BufferedReader bf = new BufferedReader(new InputStreamReader(System.in)); String st = bf.readLine(); System.out.println(isBalanced(st)); } public static boolean isBalanced(String str) { boolean result = false; if (str.length() &lt; 2) return false; Stack&lt;Character&gt; stack = new Stack&lt;&gt;(); /* For Example I gave input * str = "{()[]}" */ for (int i = 0; i &lt; str.length(); i++) { char ch = str.charAt(i); if (!rightChar.containsKey(ch) &amp;&amp; !leftChar.containsKey(ch)) { continue; } // Left bracket only add to stack. Other wise it will goes to else case // For both above input how value added in stack // "{(" after close bracket go to else case if (leftChar.containsKey(ch)) { stack.push(ch); } else { if (!stack.isEmpty()) { // For both input how it performs // 3rd character is close bracket so it will pop . pop value is "(" and map value for ")" key will "(" . So both are same . // it will return true. // now stack will contain only "{" , and travers to next up to end. if (stack.pop() == rightChar.get(ch).charValue() || stack.isEmpty()) { result = true; } else { return false; } } else { return false; } } } if (!stack.isEmpty()) return result = false; return result; } }

http://stackoverflow.com/comment/35583763
score: 0
has text: I am not using a regular form because the target of the form is a hidden iframe for file download.
comment on: http://stackoverflow.com/q/23253525
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35565517
has text: I'm feeling this is getting a bit of topic. I'll shut up, but please try to run the following code and see for yourself. https://gist.github.com/monocell/11213277
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/23242548

http://stackoverflow.com/a/23262356
has comment: http://stackoverflow.com/comment/63429933
score: 0
has body: do you use apache proxy (mod_weblogic), or you direct requests directly to weblogic server. If second option is true, you have to make sure you have proper certificates on server. All must be valid. Also try to check/uncheck "Use JSSE SSL": Domain -&gt; Servers -&gt; choose managed node -&gt; Configuration -&gt; SSL -&gt; Advanced -&gt; Use JSSE SSL
has comment: http://stackoverflow.com/comment/35625414
type: Answer
answers question: http://stackoverflow.com/q/23259444

http://stackoverflow.com/comment/35572298
comment on: http://stackoverflow.com/a/23199761
has text: It actually worked setting config.setBasePath("../") On swagger ui calls are made to: http://myhost.com:9090/../something/1 which looks kinda hackish but works...
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/23144850
has answer: http://stackoverflow.com/a/23144886
has answer: http://stackoverflow.com/a/23145215
has title: Java retrieving object from array
accepted answer: http://stackoverflow.com/a/23145215
has body: I'm having an issue fetching an object from an array of said Object. My code is below. I'm basically trying to build a table and fill in the columns with the data from each object. However currently the table is just showing the object and not the data. See picture: Table: public void buildTable(JPanel panel) { File file = new File("C:\\Users\\user\\Desktop\\test.txt"); try { BufferedReader br = new BufferedReader(new FileReader(file)); String line; lineArray = new ArrayList&lt;Person[]&gt;(); while((line = br.readLine()) != null) { String[] temp = line.split("\\t"); Person p = new Person(temp[0], temp[1], temp[2], temp[3], temp[4], temp[5], temp[6], temp[7], temp[8]); lineArray.add(new Person[]{p}); } br.close(); } catch (FileNotFoundException e) { e.printStackTrace();} catch (IOException e) { e.printStackTrace(); } List&lt;String&gt; columns = new ArrayList&lt;String&gt;(); final List&lt;Person[]&gt; values = new ArrayList&lt;Person[]&gt;(); columns.add("First Name"); columns.add("Last Name"); columns.add("Address"); columns.add("Address 2"); columns.add("City"); columns.add("State"); columns.add("Zip Code"); columns.add("Phone"); columns.add("Email"); for (int i = 0; i &lt; lineArray.size(); i++) { values.add(lineArray.get(i)); //this is the line where I'm guessing the main problem is } TableModel tableModel = new DefaultTableModel(values.toArray(new Object[][] {}), columns.toArray()); final JTable table = new JTable(tableModel); JScrollPane tableContainer = new JScrollPane(table); tableContainer.setBounds(10, 36, 833, 219); panel.add(tableContainer); table.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { int selectedRow = table.convertRowIndexToModel(table.getSelectedRow()); contactName.setText((String) table.getValueAt(selectedRow, 0) + " " + table.getValueAt(selectedRow, 1)); contactAddress.setText((String) table.getValueAt(selectedRow, 2)); } }); } Object Class: public class Person { public String firstName; public String lastNam…
type: AnsweredQuestion
tagged with: object
has comment: http://stackoverflow.com/comment/35390385
score: 0
tagged with: java
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/35390131
tagged with: arrays
possible better answer: http://stackoverflow.com/a/23144886
has comment: http://stackoverflow.com/comment/35390313
tagged with: jtable

http://stackoverflow.com/q/23193177
favorite count: 0
tagged with: android-studio
has title: No line break after @Override annotation?
linked to: http://stackoverflow.com/q/15284911
score: 38
has answer: http://stackoverflow.com/a/23258356
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/23193631
type: Question
has answer: http://stackoverflow.com/a/23193631
has body: When overriding methods, android studio automatically inserts a line break after the @Override annotation. How can I have the IDE insert the @Override without the line break and have it immediately followed by the method declaration (ie on the same line ?): @Override public Fragment getItem(int position) { ... } instead of: @Override public Fragment getItem(int position) { ... }
downvote count: 0
tagged with: ide
accepted answer: http://stackoverflow.com/a/23258356
answer count: 3
upvote count: 38
has answer: http://stackoverflow.com/a/23193261

http://stackoverflow.com/comment/35598263
comment on: http://stackoverflow.com/a/23251891
score: 0
type: Comment
type: AnswerComment
has text: The code that is in the main method.

http://stackoverflow.com/a/23268644
has body: Java already has a function for that: http://docs.oracle.com/javase/6/docs/api/java/util/Collections.html#sort%28java.util.List,%20java.util.Comparator%29
upvote count: 2
type: Answer
answers question: http://stackoverflow.com/q/23268606
score: 2
downvote count: 0

http://stackoverflow.com/comment/35623332
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23275539
score: 1
has text: You want to make a bigger `String[]` containing the elements of the two other arrays?

http://stackoverflow.com/comment/35656375
type: Comment
type: QuestionComment
has text: I suspected because you have tns: prefix for classNumber1 but not to input.
score: 0
comment on: http://stackoverflow.com/q/23270996

http://stackoverflow.com/comment/35507479
type: Comment
type: QuestionComment
has text: Can you give some more information on what the system must do, ie, why is it seperate apps
comment on: http://stackoverflow.com/q/23211610
score: 0

http://stackoverflow.com/comment/35609174
score: 0
has text: @zencv, Anyidea of where I am making a mistake.
type: AnswerComment
comment on: http://stackoverflow.com/a/23267875
type: Comment

http://stackoverflow.com/a/23228659
answers question: http://stackoverflow.com/q/23219006
downvote count: 0
type: Answer
upvote count: 1
score: 1
has body: This is because you only have your method on Interface and ClassB, not on ClassA directly. However it sounds to me like a bug since I'd expect that property to showup on the list. I suspect Inrospector did not catch up with Java 8 features yet.

http://stackoverflow.com/q/23273420
has title: struts2 How read value iterator from jsp to action
tagged with: struts2
tagged with: iterator
downvote count: 0
answer count: 1
tagged with: jsp
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/35619991
accepted answer: http://stackoverflow.com/a/23276002
has comment: http://stackoverflow.com/comment/35619681
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35623884
tagged with: java
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/23276002
has body: I'm new to java and struts2, please help. from an action I have read and process a list created in a jsp my problem is, how do I have access to data from an action of an iterator? JSP PAGE <s:iterator value="settoriList" var="myObj"> <s:if test="#myObj.selected == 1"> <s:checkbox name="selected" fieldValue="%{cdSettore}" checked="checked"/> <s:property value="cdSettore" /> </s:if> <s:if test="#myObj.selected == 0"> <s:checkbox name="selected" value="false" fieldValue="%{cdSettore}" /> <s:property value="cdSettore" /> </s:if> <s:property value="dsSettore" /> <s:property value="dtIniVali" /> <s:property value="dtFineVali" /> </s:iterator> <s:hidden name="cdConve" /> <s:hidden name="process" value="saveSettori"/> </s:form> Here is how I am trying to access the data private List<GenSettori> settoriList; public List<GenSettori> getSettoriList() { return settoriList; } public void setSettoriList(List<GenSettori> settoriList) { this.settoriList = settoriList; } private String[] selected; public String[] getSelected() { return selected; } public void setSelected(String[] selected) { this.selected = selected; } -------- settoriList = new ArrayList<GenSettori>(); System.out.println("list sett: "+settoriList); for(int i=0;i<getSettoriList().size();i++){ if (getSelected()[i]!=""){ System.out.println("not selected "+getSelected()[i]); } } --------- My page is formed by selected field, a description and a date. Thanks in advance for any help

http://stackoverflow.com/comment/93007791
has text: There is a java client in each release. https://github.com/opensourceBIM/BIMserver/wiki/BimServerClient
type: AnswerComment
comment on: http://stackoverflow.com/a/25978122
score: 0
type: Comment

spring
tags question: http://stackoverflow.com/q/23204997
tags question: http://stackoverflow.com/q/23175199
tags question: http://stackoverflow.com/q/23213869
tags question: http://stackoverflow.com/q/23285259
tags question: http://stackoverflow.com/q/23184274
tags question: http://stackoverflow.com/q/23197207
tags question: http://stackoverflow.com/q/23213728
tags question: http://stackoverflow.com/q/23193781
tags question: http://stackoverflow.com/q/23208010
tags question: http://stackoverflow.com/q/23266655
tags question: http://stackoverflow.com/q/23177286
tags question: http://stackoverflow.com/q/23258462
tags question: http://stackoverflow.com/q/23228927
tags question: http://stackoverflow.com/q/23286721
tags question: http://stackoverflow.com/q/23188959
tags question: http://stackoverflow.com/q/23212410
tags question: http://stackoverflow.com/q/23132009
tags question: http://stackoverflow.com/q/23262360
tags question: http://stackoverflow.com/q/23178952
tags question: http://stackoverflow.com/q/23164152
tags question: http://stackoverflow.com/q/23272020
tags question: http://stackoverflow.com/q/23201507
tags question: http://stackoverflow.com/q/23187514
tags question: http://stackoverflow.com/q/23236095
tags question: http://stackoverflow.com/q/23138773
tags question: http://stackoverflow.com/q/23251214
tags question: http://stackoverflow.com/q/23272029
tags question: http://stackoverflow.com/q/23135890
tags question: http://stackoverflow.com/q/23195795
tags question: http://stackoverflow.com/q/23150201
tags question: http://stackoverflow.com/q/23261587
tags question: http://stackoverflow.com/q/23178414
tags question: http://stackoverflow.com/q/23216546
tags question: http://stackoverflow.com/q/23255649
tags question: http://stackoverflow.com/q/23207605
tags question: http://stackoverflow.com/q/23252095
tags question: http://stackoverflow.com/q/23252743
tags question: http://stackoverflow.com/q/23246912
tags question: http://stackoverflow.com/q/23288522
tags question: http://stackoverflow.com/q/23220988
tags question: http://stackoverflow.com/q/23290595
tags question: http://stackoverflow.com/q/23160829
tags question: http://stackoverflow.com/q/23224320
tags question: http://stackoverflow.com/q/23130658
tags question: http://stackoverflow.com/q/23178601
tags question: http://stackoverflow.com/q/23154020
tags question: http://stackoverflow.com/q/23267041
tags question: http://stackoverflow.com/q/23135094
tags question: http://stackoverflow.com/q/23169136
tags question: http://stackoverflow.com/q/23143591
tags question: http://stackoverflow.com/q/23153742
tags question: http://stackoverflow.com/q/23220630
tags question: http://stackoverflow.com/q/23239653
tags question: http://stackoverflow.com/q/23197896
tags question: http://stackoverflow.com/q/23143631
tags question: http://stackoverflow.com/q/23198660
tags question: http://stackoverflow.com/q/23211751
type: Tag
tags question: http://stackoverflow.com/q/23238876
tags question: http://stackoverflow.com/q/23153570
tags question: http://stackoverflow.com/q/23215575
tags question: http://stackoverflow.com/q/23225933
tags question: http://stackoverflow.com/q/23137134
tags question: http://stackoverflow.com/q/23262986
tags question: http://stackoverflow.com/q/23204721
tags question: http://stackoverflow.com/q/23131173
tags question: http://stackoverflow.com/q/23188143
tags question: http://stackoverflow.com/q/23275626
tags question: http://stackoverflow.com/q/23283853
tags question: http://stackoverflow.com/q/23207401
tags question: http://stackoverflow.com/q/23148003
tags question: http://stackoverflow.com/q/23222468
tags question: http://stackoverflow.com/q/23266175
tags question: http://stackoverflow.com/q/23215063
tags question: http://stackoverflow.com/q/23192454
tags question: http://stackoverflow.com/q/23237282
tags question: http://stackoverflow.com/q/23203215
tags question: http://stackoverflow.com/q/23222035
tags question: http://stackoverflow.com/q/23288816
tags question: http://stackoverflow.com/q/23239475

http://stackoverflow.com/comment/35548958
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23234803
has text: Thank you MadProgrammer, but just now I've come up with my own solution.
type: AnswerComment

http://stackoverflow.com/comment/36833779
type: QuestionComment
comment on: http://stackoverflow.com/q/23254197
has text: The solution is so simple... I asked the question today, too: http://stackoverflow.com/q/23906301/1183192 It must be RandomAccessFile instead of RandomAccessFileAppender
score: 0
type: Comment

http://stackoverflow.com/comment/35631689
comment on: http://stackoverflow.com/a/23274240
type: AnswerComment
score: 0
has text: @Voo You have a point that the spec doesn't prohibit it, only that AFAIK this doesn't happen. The memory barrier on Intel processors doesn't allow for such a reordering, but on an ARM processor or something else, perhaps it might.
type: Comment

http://stackoverflow.com/q/23234480
has comment: http://stackoverflow.com/comment/35575360
answer count: 5
type: AnsweredQuestion
has title: Reference an ArrayList from other methods without re-creating it
tagged with: java
has answer: http://stackoverflow.com/a/60986814
has answer: http://stackoverflow.com/a/23234562
type: Question
tagged with: arraylist
score: 0
possible better answer: http://stackoverflow.com/a/23234556
accepted answer: http://stackoverflow.com/a/23234562
has body: My program reads a text file with student information and puts each line of data into a new Student object with various properties. A loop then puts each of those Student objects into an ArrayList, allowing the student data to be searched using other methods. However, the only way I have been able to make this work is to call the readStudent method in each search method, meaning the input file is processed and the ArrayList recreated repeatedly. This is the method which reads the input file, creates the objects and puts the objects in the ArrayList: public class readStudent { public static List&lt; Student &gt; readStudent() throws Exception { Scanner input = new Scanner(new File("students.txt")); List&lt; Student &gt; studentList = new ArrayList&lt; Student &gt;(); while (input.hasNext()) { int id = input.nextInt(); String lastName = input.next(); String firstName = input.next(); int gradYear = input.nextInt(); Student student = new Student(id, firstName, lastName, gradYear); studentList.add(student); } return studentList; } This is one of the search methods, also in the readStudent class (slightly edited for brevity): public static void allRecords() throws Exception { List&lt; Student &gt; studentList = readStudent.readStudent(); int size = studentList.size(); for (int i=0; i&lt;size; i++) { System.out.printf("%-5d %10s %10s %15d\n", studentList.get(i).returnId(), studentList.get(i).returnFirst(), studentList.get(i).returnLast(), studentList.get(i).returnGrad()); } } The other search methods all begin with List&lt; Student > studentList = readStudent.readStudent(); to make the array available to be searched. My question is this: Is it possible to perform the readStudent method once to create the ArrayList, perhaps in the beginning of main, then reference that ArrayList from the search methods without having to re-run the entire readStudent method every time?
has answer: http://stackoverflow.com/a/23234556
has answer: http://stackoverflow.com/a/23234543
has answer: http://stackoverflow.com/a/23234537

http://stackoverflow.com/q/23164788
tagged with: random
tagged with: while-loop
tagged with: integer
has title: ArrayIndexOutOfBoundsException using random int
has body: I try to use this method for create random numbers and save that random number in a array int[] ndigitos = new int[313]; public int Imagenes(int cont) { do { nuevo = r.nextInt(313); for (int i = 0; i &lt; total; i++) { if (nuevo == ndigitos[i]) aux = 1; } if (aux == 0) { // agregar en la siguiente posicion el nuevo numero ndigitos[total] = nuevo; total++; } aux = 0; } while (total &lt; 313); return ndigitos[cont]; } but i have this error when run my app java.lang.ArrayIndexOutOfBoundsException: length=313; index=313 at com.goldapp.imagenesparawhatsapp.Metodos.Imagenes(Metodos.java:97) at com.goldapp.imagenesparawhatsapp.Main.onClick(Main.java:139) at android.view.View.performClick(View.java:4091) at android.view.View$PerformClick.run(View.java:17072) at android.os.Handler.handleCallback(Handler.java:615) at android.os.Handler.dispatchMessage(Handler.java:92) at android.os.Looper.loop(Looper.java:153) at android.app.ActivityThread.main(ActivityThread.java:5042) 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:821) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:584) at dalvik.system.NativeStart.main(Native Method)
possible better answer: http://stackoverflow.com/a/23164849
has answer: http://stackoverflow.com/a/23164843
accepted answer: http://stackoverflow.com/a/23164843
has answer: http://stackoverflow.com/a/23164849
type: AnsweredQuestion
tagged with: java
type: Question
tagged with: arrays
has comment: http://stackoverflow.com/comment/35424948
score: 0
answer count: 2

http://stackoverflow.com/q/23217261
has title: stanford cs106a Bouncing Ball code questions
type: UnansweredQuestion
type: Question
has answer: http://stackoverflow.com/a/23217428
tagged with: algorithm
tagged with: java
score: 0
upvote count: 1
has body: I am new learner of public sources of stanford cs106a. I got stucked when I read handout BouncingBall,here below are the complete codes I got from cs106a handout. The question is, for checkForCollision method code that is bottom of this page, why should the ball do the code ball.move(0, -2 * diff), especially execute the -2 * diff, I cannot understand this math code. Is it Ok for ball do the code ball.move(0, -diff)? what is the difference? what is the bounce logic? anyone here could help me to understand this code, I am not good at math. Thank you so much /* * File: BouncingBall.java *-------------------------- * This program graphically simulates a bouncing ball */ import acm.program.*; import acm.graphics.*; public class BouncingBall extends GraphicsProgram { /** Size (diameter) of the ball */ private static final int DIAM_BALL = 30; /** Amount Y velocity is increased each cycle * as result of gravity */ private static final double GRAVITY = 3; /** Animation delay or pause time between call moves */ private static final int DELAY = 50; /** Initial X and Y location of ball */ private static final double X_START = DIAM_BALL; private static final double Y_START = 100; /** X Velocity */ private static final double X_VEL = 5; /** Amount Y Velocity is reduced when it bounces */ private static final double BOUNCE_REDUCE = 0.9; /** Starting X and Y Velocities */ private doublexVel = X_VEL; private doubleyVel = 0.0; /* private instance variable */ private GOval ball; public void run() { setup(); // Simulation ends when ball goes off right hand // end of screen while (ball.getX() &lt; getWidth()) { moveBall(); checkForCollision(); pause(DELAY); } } /** Create and place a ball */ private void setup() { ball = new GOval (X_START, Y_START, DIAM_BALL, DIAM_BALL); ball.setFilled(true); add(ball); } /** Update and move ball */ private void moveBall() { // increase yVelocity due to gravity yVel += GRAVITY; ball.move(xVel, yVel); } /** Determine if collision with floor, update vel…
answer count: 1
downvote count: 1
favorite count: 0

http://stackoverflow.com/q/23173158
has body: I have configured Struts 2 Interceptor for validating the user session. On invalid session I am redirecting to an error page. The Interceptor is working fine for the normal calls to the action classes but the error page redirection is not working when I am calling an action class through ajax call. What I am currently doing for this is sestting a request attribute in the interceptor and on the JSP based on that attribute value redirecting from the JSP. But instead of what I am doing is there any way by which I dont need to write any thing in JSP for error page redirection to work in the similar way when calling the action class in a normal way and in the form of Ajax Thanks, Vinay
answer count: 1
has comment: http://stackoverflow.com/comment/35480478
downvote count: 0
has comment: http://stackoverflow.com/comment/35469588
tagged with: jsp
tagged with: ajax
upvote count: 1
has answer: http://stackoverflow.com/a/37012783
has title: Struts 2 Interceptor redirection not working with Ajax
accepted answer: http://stackoverflow.com/a/37012783
favorite count: 0
has comment: http://stackoverflow.com/comment/35483278
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: struts2
type: Question

http://stackoverflow.com/q/23178409
score: -1
linked to: http://stackoverflow.com/q/1944446
has comment: http://stackoverflow.com/comment/35448900
upvote count: 2
answer count: 2
downvote count: 3
has comment: http://stackoverflow.com/comment/35448937
has comment: http://stackoverflow.com/comment/35448891
has comment: http://stackoverflow.com/comment/35457027
favorite count: 0
has body: So when I click on X button the whole program closes but i only want to close the frame which I want to close i am using Net beans. I can't figure it out Google says to add closing event but as i see the X button is already there. What to do?
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23178609
has comment: http://stackoverflow.com/comment/35448789
linked to: http://stackoverflow.com/q/9554636
has comment: http://stackoverflow.com/comment/35448757
has comment: http://stackoverflow.com/comment/35448870
has answer: http://stackoverflow.com/a/23178516
has comment: http://stackoverflow.com/comment/35448758
has comment: http://stackoverflow.com/comment/35448799
tagged with: java
has comment: http://stackoverflow.com/comment/35449058
tagged with: swing
type: Question
has title: How to close the Jframe without closing other frames Netbeans

http://stackoverflow.com/comment/35422411
type: AnswerComment
comment on: http://stackoverflow.com/a/23163227
type: Comment
has text: @hexafraction oh yes, thank. i missed such simple thing :| . So i think if he adds an assignment statement before switch, the code would be fine.
score: 0

http://stackoverflow.com/comment/35555978
has text: Make two arrays from the two lines and just compare their 2nd items `line1[1].equals(line2[1])` even better use `equalsIgnoreCase`.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23238716
score: 1

http://stackoverflow.com/comment/35467197
score: 0
comment on: http://stackoverflow.com/a/23188756
type: AnswerComment
type: Comment
has text: and what else can I do better?

http://stackoverflow.com/a/23260306
accepted answer of: http://stackoverflow.com/q/23229660
downvote count: 0
has body: I ended up finding out what was missing. I just needed to add the following lines of code in the Server class. List&lt;Authority&gt; authorities = new ArrayList&lt;Authority&gt;(); authorities.add(new WritePermission()); user.setAuthorities(authorities);
score: 9
type: AcceptedAnswer
upvote count: 9
answers question: http://stackoverflow.com/q/23229660
type: Answer

http://stackoverflow.com/comment/35557720
score: 0
comment on: http://stackoverflow.com/q/23239218
type: Comment
has text: I think i am not getting your question clearly. Do you want to route all the requests to /bar into /foo ? or are those two endpoints doing entirely different jobs and you just want to deploy it on single server.
type: QuestionComment

http://stackoverflow.com/q/23245051
has title: ImageButton coming out small. Java-Android Development
has comment: http://stackoverflow.com/comment/35567119
has body: I have made my image buttons in XML using a relative layout. They look ok when I've made them but when I run it on my phone it comes out small! I want it to expand to the width of my device (or the width of any device it goes to) Here's my XML: &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" &gt; &lt;ImageButton android:id="@+id/prewedbutton" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignLeft="@+id/weddingbutton" android:layout_alignParentTop="true" android:layout_marginTop="90dp" android:contentDescription="@drawable/prewedbutton" android:src="@drawable/prewedbutton" /&gt; &lt;ImageButton android:id="@+id/weddingbutton" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:layout_centerHorizontal="true" android:layout_marginBottom="103dp" android:contentDescription="@drawable/weddingbutton" android:src="@drawable/weddingbutton" /&gt; &lt;/RelativeLayout&gt; And here is my Java: package com.example.ijazphotography; import android.os.Bundle; import android.app.Activity; import android.view.View; import android.view.View.OnClickListener; import android.widget.ImageButton; import android.content.Intent; public class PhotographyActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_photography); // Show the Up button in the action bar. ImageButton prewed = (ImageButton) findViewById(R.id.prewedbutton); prewed.setOnClickListener(new OnClickListener() { public void onClick(View v) { Intent intent = new Intent(v.getContext(), PreWedActivity.class); startActivityForResult(intent, 0); } }); ImageButton wed = (ImageButton) findViewById(R.id.weddingbutton); wed.setOnClickListener(new OnClickListener() { public void onClick(View v)…
type: AnsweredQuestion
tagged with: java
tagged with: eclipse
has comment: http://stackoverflow.com/comment/35567049
type: Question
accepted answer: http://stackoverflow.com/a/23245265
has answer: http://stackoverflow.com/a/23245176
has answer: http://stackoverflow.com/a/23245265
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/35567156
tagged with: android
possible better answer: http://stackoverflow.com/a/23245135
has comment: http://stackoverflow.com/comment/35567028
has answer: http://stackoverflow.com/a/23245135

http://stackoverflow.com/comment/61820029
score: 0
has text: @clankill3r, did any solution work for you? I am having the same problem now.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23270354

http://stackoverflow.com/comment/35567214
type: AnswerComment
comment on: http://stackoverflow.com/a/23245176
type: Comment
has text: fill_parent deprecated since API8
score: 0

http://stackoverflow.com/comment/35371894
has text: Show your code, what you have done so far.
comment on: http://stackoverflow.com/q/23135201
score: 0
type: Comment
type: QuestionComment

if-statement
tags question: http://stackoverflow.com/q/23143211
tag name: if-statement
tags question: http://stackoverflow.com/q/23281673
type: Tag
tags question: http://stackoverflow.com/q/23138829
tags question: http://stackoverflow.com/q/23289719
tags question: http://stackoverflow.com/q/23171947
tags question: http://stackoverflow.com/q/23247887
tags question: http://stackoverflow.com/q/23251720
tags question: http://stackoverflow.com/q/23207700
tags question: http://stackoverflow.com/q/23208483
tags question: http://stackoverflow.com/q/23256897
tags question: http://stackoverflow.com/q/23280723
tags question: http://stackoverflow.com/q/23140263
tags question: http://stackoverflow.com/q/23240998
tags question: http://stackoverflow.com/q/23190082
tags question: http://stackoverflow.com/q/23142325

fongo
tag name: fongo
tags question: http://stackoverflow.com/q/23244651
type: Tag

http://stackoverflow.com/q/23240293
has answer: http://stackoverflow.com/a/23251613
accepted answer: http://stackoverflow.com/a/23251613
tagged with: java
has body: I have an Access DB, to make the job easier, I did the queries into DB. How I can take data from the query instead of from tables? To take data from tables I used this code: Table table = db.getTable("matchTable"); Cursor cursor = CursorBuilder.createCursor(table); while (cursor.findNextRow(Collections.singletonMap("idMatch", 15))) { Row row = cursor.getCurrentRow(); ... }
type: Question
answer count: 1
downvote count: 0
score: 4
tagged with: jackcess
has title: How to retrieve data from a Query instead of from Tables with Jackcess
tagged with: ms-access
favorite count: 0
upvote count: 4
type: AnsweredQuestion

http://stackoverflow.com/comment/35618674
has text: I don't understand your question.
comment on: http://stackoverflow.com/a/23271326
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/q/23215933
has answer: http://stackoverflow.com/a/23216143
has comment: http://stackoverflow.com/comment/35514980
has title: How to use ArrayList while adding something to another Class's constructor ?
tagged with: arraylist
accepted answer: http://stackoverflow.com/a/23216030
answer count: 5
has comment: http://stackoverflow.com/comment/35514906
tagged with: io
possible better answer: http://stackoverflow.com/a/23216014
type: AnsweredQuestion
tagged with: constructor
has answer: http://stackoverflow.com/a/23216030
has answer: http://stackoverflow.com/a/23216107
type: Question
has body: I'm try to create one simple reservation system, we'll read a file, then we'll add Train, Bus, etc., then we'll writer everything to output. import java.io.*; import java.util.*; public class Company { private static ArrayList&lt;Bus&gt; bus = new ArrayList&lt;Bus&gt;(); static int buscount = 0, traincount = 0; public static void main (String[] args) throws IOException { FileParser(); } public Company() { } public static void FileParser() { try { File file = new File(); //i fill this later File file2 = new File(); // i fill this later FileInputStream fis = new FileInputStream(file); FileOutputStream fos = new FileOutputStream(file2); BufferedReader br = new BufferedReader(new InputStreamReader(fis)); BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(fos)); String line; while ((line = br.readLine()) != null) { String[] splitted = line.split(","); if(splitted[0].equals("ADDBUS")) { bus.add(buscount) = Bus(splitted[0],splitted[1],splitted[2],splitted[3],splitted[4],splitted[5]); } } } catch (FileNotFoundException fnfe) { } catch (IOException ioe) { } } } I try to read the file line by line. For example one of the line is "ADDBUS,78KL311,10,140,54" I split the line for "," then i try to add every pieces of array to Bus' class' constructor but i couldn't figured it out. My Bus Class is like ` public class Bus extends Vehicle{ private String command; private String busName; private String busPlate; private String busAge; private String busSpeed; private String busSeat; public Bus(String command, String busname, String busplate, String busage, String busspeed, String busseat) { this.command = command; this.busName = busname; this.busPlate = busplate; this.busAge = busage; this.busSpeed = busspeed; this.busSeat = busseat; } public String getBusName() { return busName; } public void setBusName(String busName) { this.busName = busName; } public String getBusPlate() { return busPlate; } public void setBusPlate(String busPlate) { this.busPlate = busPlate; } public S…
tagged with: java
has answer: http://stackoverflow.com/a/23216021
has answer: http://stackoverflow.com/a/23216014
score: 0

http://stackoverflow.com/q/23270459
has title: Is Overriding part of abstraction?
answer count: 2
upvote count: 0
has comment: http://stackoverflow.com/comment/35613626
accepted answer: http://stackoverflow.com/a/23270541
has body: When I override the OnCreate method in Android Development (or any method) am I making use of abstraction here? What I mean is, has the method I am overridng been marked as Abstract?
favorite count: 0
tagged with: android
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/23270500
downvote count: 1
has comment: http://stackoverflow.com/comment/35613622
type: Question
tagged with: object
has comment: http://stackoverflow.com/comment/35613668
possible better answer: http://stackoverflow.com/a/23270500
score: -1
has answer: http://stackoverflow.com/a/23270541

http://stackoverflow.com/q/23209167
type: UnansweredQuestion
downvote count: 0
tagged with: cookies
tagged with: java
has body: I am trying out HP ALM 12 and found REST api has changed but I could not figure out how to get it to work with the java code that works fine with ALM 11.5. with ALM 11.5 I send following http requests: http://myALM:8000/qcbin/rest/is-authenticated (which calls /authenticate) http://myALM:8000/qcbin/rest/domains/DEFAULT/projects/DEMO/requirements?login-form-required=y&amp;fields=father-name,name,req-priority,request-status,description,name,status&amp;query={status[NOT%20N/A]} Everything works fine above. With ALM 12, its REST documentation said that I need to explicitly call /rest/site-session resource to obtain the QCSession (which was returned automatically in ALM 11.5 at the first call to any resource), but I could not get the call to return QCSession. Below is the list of http requests sent in order to ALM 12: http://myALM:8000/qcbin/rest/is-authenticated (which calls authenticate) http://myALM:8000/qcbin/rest/site-session http://myALM:8000/qcbin/rest/domains/DEFAULT/projects/DEMO/requirements?login-form-required=y&amp;fields=father-name,name,req-priority,request-status,description,name,status&amp;query={status[NOT%20N/A]} The call to rest/site-session returns JSESSIONID as if it was the first request and obviously the rest of the code just failed. What am I doing wrong here?
has title: HP ALM 12 REST not returning QCSession cookie
type: Question
tagged with: session
answer count: 1
score: 4
favorite count: 0
tagged with: rest
has answer: http://stackoverflow.com/a/25385346
upvote count: 4

http://stackoverflow.com/q/23189391
type: Question
has body: I am currently working on a java implementation of LZW compression. So far my encoder works how it should. Reads a file and outputs phrase numbers which will be piped to the bit packer. I now have to bit pack those phrase numbers into a file and I am unsure how to go about this process. Also we have a maximum bits set for encoding which is 20. So when the numbers being encoded exceed 20 bits needed to encode them we reset the trie and start building a new one. So the first set of numbers we must bit pack will be 0-255 then 256-511 and so on so I know that some will be packed as 8 bits and then 9 bits and so on. If any guidance could be given on where to start and what to look over that may help would be greatly appreciated
has comment: http://stackoverflow.com/comment/35468424
upvote count: 3
has title: Bit Packing LZW Phrase numbers
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/35468311
type: UnansweredQuestion
tagged with: bit
has answer: http://stackoverflow.com/a/45508609
tagged with: lzw
score: 3
downvote count: 0
tagged with: java
tagged with: compression
has comment: http://stackoverflow.com/comment/35469973

http://stackoverflow.com/q/23184109
score: 0
answer count: 1
tagged with: generics
has title: Overloading methods in an interface using generics as parameters
tagged with: interface
tagged with: overloading
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23184267
tagged with: java
has comment: http://stackoverflow.com/comment/35458276
has body: I have a Java interface A defining a method which takes another interface B as a parameter. I want to know if it is possible to overload that method in an implementing class to give as a parameter an object which implements the interface B. Here's a sample code of what I mean: public interface SampleInterfaceA{ public void sampleMethod(SampleInterfaceB b); } public class ClassB implements SampleInterfaceB{} public class ClassC implements SampleInterfaceB{} public class SampleClassA implements SampleInterfaceA{ @Override public void sampleMethod(ClassB b){} } public class SampleClassB implements SampleInterfaceA{ @Override public void sampleMethod(ClassC c){} } Thanks in advance for your help.
type: Question
accepted answer: http://stackoverflow.com/a/23184267

http://stackoverflow.com/a/23262517
type: Answer
accepted answer of: http://stackoverflow.com/q/23262406
answers question: http://stackoverflow.com/q/23262406
has body: First you have to get the url, modify it, and then with javascript replace the "true" url with the one you just modified. Here is what I would do: //get the url $old_url = "http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; //then you modify it $new_url = ...; //then with javascript you replace the url with the new one &lt;script type="text/javascript"&gt; if(new_url != '') { window.history.replaceState({"html":'Title',"pageTitle":'Page Title'}, '', new_url); } &lt;/script&gt; This should do the trick, if you really want to use GET ; POST would be better, and you wouldn't have to hide the GET parameters.
score: 0
has comment: http://stackoverflow.com/comment/35598939
type: AcceptedAnswer

http://stackoverflow.com/comment/35539669
type: QuestionComment
comment on: http://stackoverflow.com/q/23229488
score: 0
has text: @djechlin The program will run IN THE CONSOLE, but the GUI just won't appear
type: Comment

http://stackoverflow.com/comment/35487318
comment on: http://stackoverflow.com/q/23200439
score: 0
type: Comment
type: QuestionComment
has text: The content doesn't matter, even empty function with only that empty for loop shows an error. By the way, this code has nothing to do with google maps :D

http://stackoverflow.com/a/23153758
accepted answer of: http://stackoverflow.com/q/23153315
score: 2
answers question: http://stackoverflow.com/q/23153315
upvote count: 2
type: AcceptedAnswer
type: Answer
has body: Your code seems to be correct Math.round(8.3391700279483738E17) = 833917002794837376 makes sense as 8.3391700279483738E17 mathematically means 8.3391700279483738 * 10^17 or 8339170027948373800 and not a decimal number. The small marginal difference is due to Delta error.
downvote count: 0

http://stackoverflow.com/a/23236199
type: Answer
has comment: http://stackoverflow.com/comment/35587914
has comment: http://stackoverflow.com/comment/35552279
answers question: http://stackoverflow.com/q/23212001
has comment: http://stackoverflow.com/comment/35560047
score: 0
has body: Solved by my lonesome; the issue I ran into was that; I wasn't accounting for white space between the close and opening tags. The the first div tag is on a separate 'line' than the second. Building a pattern that spans two lines doesn't work if you are reading in one line at a time and checking for a pattern in each line . :)
has comment: http://stackoverflow.com/comment/35551889

http://stackoverflow.com/q/23239239
tagged with: events
favorite count: 0
has title: Separate touch from mouse event
has comment: http://stackoverflow.com/comment/36385670
type: UnansweredQuestion
tagged with: mouse
has body: I use a touch monitor to control my nodes on the application. But i also want to control the nodes with mouse events, if the application is not running with a touch monitor, so that both events could be handled. I tried it the following way: private void initDraggable() { touchFilter = new EventHandler&lt;TouchEvent&gt;() { @Override public void handle(TouchEvent event) { System.out.println("Touch dragged"); touchTaskViewModel.actualClickPointProperty().set(new ClickPoint(event.getTouchPoint().getX(), event.getTouchPoint().getY())); touchTaskViewModel.sceneXProperty().set(event.getTouchPoint().getSceneX()); touchTaskViewModel.handleTaskMoved(); event.consume(); } }; addEventFilter(TouchEvent.TOUCH_MOVED, touchFilter); setOnTouchPressed(new EventHandler&lt;TouchEvent&gt;() { @Override public void handle(TouchEvent event) { touchTaskViewModel.entryClickPointProperty().set(new ClickPoint(event.getTouchPoint().getX(), event.getTouchPoint().getY())); touchTaskViewModel.taskSelectedProperty().set(true); event.consume(); } }); setOnTouchReleased(new EventHandler&lt;TouchEvent&gt;() { @Override public void handle(TouchEvent event) { touchTaskViewModel.taskSelectedProperty().set(false); event.consume(); } }); clickFilter = new EventHandler&lt;MouseEvent&gt;() { @Override public void handle(MouseEvent event) { if(!event.isSynthesized()){ System.out.println("Mouse dragged!"); touchTaskViewModel.actualClickPointProperty().set(new ClickPoint(event.getX(), event.getY())); touchTaskViewModel.sceneXProperty().set(event.getSceneX()); touchTaskViewModel.handleTaskMoved(); event.consume(); } } }; addEventFilter(MouseEvent.MOUSE_DRAGGED, clickFilter); setOnMousePressed(new EventHandler&lt;MouseEvent&gt;() { @Override public void handle(MouseEvent event) { if(!event.isSynthesized()){ touchTaskViewModel.entryClickPointProperty().set(new ClickPoint(event.getX(), event.getY())); touchTaskViewModel.taskSelectedProperty().set(true); event.consume(); } } }); setOnMouseReleased(new EventHandle…
upvote count: 3
tagged with: java
tagged with: javafx
has answer: http://stackoverflow.com/a/41292801
type: Question
score: 3
tagged with: touch
answer count: 1
downvote count: 0

http://stackoverflow.com/a/23760172
upvote count: 1
downvote count: 0
answers question: http://stackoverflow.com/q/23274682
type: Answer
has body: I had the same issue times ago. There are 3 solutions, I applied the former: In your Flatxml every first row should contains all the columns you are going to use/test for the given table. (I do not found any way to specify column sensing in spring+dbunit via annotation), in your case swap the rows. using DTD (cannot remember why I discarded this option that time), you specify a DTD in the beginning of your dataset xml file ie: &lt;!DOCTYPE dataset SYSTEM "dataset.dtd"&gt; (see below for the format) (Headache way) Define your own annotation or get rid of the annotations and fallback to the classic DbUnit/java where you have full control on things such as column sensing. the dataset DTD has this format (example): &lt;!ELEMENT dataset ( ACCOUNT*)&gt; &lt;!ELEMENT ACCOUNT EMPTY&gt; &lt;!ATTLIST ACCOUNT USER_ID CDATA #REQUIRED ACCOUNT_BALANCE CDATA #REQUIRED &gt;
score: 1

http://stackoverflow.com/comment/48451656
comment on: http://stackoverflow.com/a/23409625
type: AnswerComment
has text: The `Iterable<T>` interface itself only supports pull-based iteration, so iterables are observable only if you use some sort of 'cold' observable adapter, e.g., one provided by RxJava.
type: Comment
score: 1

http://stackoverflow.com/comment/35435956
comment on: http://stackoverflow.com/a/23171040
type: AnswerComment
score: 0
has text: @user3479350> Just copy and paste the second part (as you want scanner), it works very fine for me and I tested it with your input.
type: Comment

http://stackoverflow.com/comment/101408455
type: AnswerComment
comment on: http://stackoverflow.com/a/23173460
type: Comment
has text: will the usage of null instead of some specific view would help? @JsonView(null) // Goal: ignore all the time, except next line
score: 0

http://stackoverflow.com/q/23262938
has answer: http://stackoverflow.com/a/23263085
has body: I have call the GetXMLTask from my service and it will repeatedly call every 1 seconds to get data from the IP address (MyIP). MyService.java public class MyService extends Service { public int onStartCommand(Intent intent, int flags, int startId) { if (GlobalFunctions.isInternetAvailable(MyService.this) || GlobalFunctions.isWifi(MyService.this)) { MyTimerTask myTask = new MyTimerTask(); Timer myTimer = new Timer(); myTimer.schedule(myTask, 1000, 1000); } else { Toast.makeText(MyService.this, "No Internet Connection", 1000).show(); } return Service.START_STICKY; } class MyTimerTask extends TimerTask { public void run() { GetXMLTask task = new GetXMLTask(); task.execute(new String[] { MyIP }); } } } asynctask is use in the GetXMLTask.java. public class GetXMLTask extends AsyncTask&lt;String, Void, String&gt; { @Override protected String doInBackground(String... urls) { try { String output = null; for (String url : urls) { output = getOutputFromUrl(url); } return output; } catch (Exception e) { return null; } } } and now when the apps is running, i have change the ip address, but the "urls" still showing the previous ip address (see the data from eclipse debug mode) and it the "urls" will be updated after quite a long time. May i know what should i do so that urls in the asynctask can directly take newest ip address without long delay. thank you so much Updated 24/4/2014: I have make changes for the doinBackground code, but the data received from the IP address is still not the updated data. protected String doInBackground(String... urls) { try { String output = null; String[] newurl = {GlobalVariables.Global_URL + "/status.xml"}; for (String url : newurl) { output = getOutputFromUrl(url); } return output; } catch (Exception e) { return null; } } Any idea? Thank You Updated 25/4/2014: I have debug the code and notice that when IP address is changed, the asynctask seem like freeze for quite a long time. I have put the break point in the doinbackground, and it doesn't g…
tagged with: java
downvote count: 0
type: UnansweredQuestion
tagged with: android
score: 1
favorite count: 0
tagged with: android-asynctask
has title: Changing url/ip when asynctask is running repeatedly
type: Question
upvote count: 1
answer count: 1

http://stackoverflow.com/q/23279913
has comment: http://stackoverflow.com/comment/35631980
tagged with: java
has title: Single key & multiple values without using multimap - Java
has comment: http://stackoverflow.com/comment/35632285
has body: How can I store multiple values against single key in java , without using a hashmap or multi-map. Any one knows how to do it using arrays only? eg: Key : Id Value : a , b, c, d So instead of storing above as Id a , Id b ,Id c etc I want to store it as Id "a,b,c,d" . Ie one key against multiple values in the form of string . So I don't want to use any multimap or hashmap for this.
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/35632007
tagged with: arrays
tagged with: data-structures
has comment: http://stackoverflow.com/comment/35631989
has comment: http://stackoverflow.com/comment/35632042
score: 0
has answer: http://stackoverflow.com/a/23328099
has comment: http://stackoverflow.com/comment/35632115
has answer: http://stackoverflow.com/a/63073547
has comment: http://stackoverflow.com/comment/35631994
type: UnansweredQuestion

http://stackoverflow.com/q/23212752
linked to: http://stackoverflow.com/q/373419
has body: Today, while writing a simple program, I found some strange behaviour. I wrote simple sorting method in which returns another sorted array. public double[] sortMe(double[] array) { double[] narray=new double[array.length]; narray=array; for(int i=0;i&lt;narray.length;i++) { for(int j=0;j&lt;narray.length;j++) { if(narray[i]&lt;narray[j]) { double temp=narray[i]; narray[i]=narray[j]; narray[j]=temp; } } } // TODO Auto-generated method stub return narray; } In my driver class, when I called this sortMe method, it updated my testArray as well. Since testArray is out of scope for sortMe method, then when testArray got sorted ? double [ ] testArray = {3, 6, 2, 5, 8, 4, 1, 7}; double [ ] results; results = af.sortMe(testArray); af.printMe(results);
type: AnsweredQuestion
has title: Java parameter value changes itself
tagged with: java
linked to: http://stackoverflow.com/q/40480
has answer: http://stackoverflow.com/a/23212861
has comment: http://stackoverflow.com/comment/35509354
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/35509426
possible better answer: http://stackoverflow.com/a/23212861
score: -1
answer count: 2
upvote count: 0
has answer: http://stackoverflow.com/a/23212833
favorite count: 0
accepted answer: http://stackoverflow.com/a/23212833

http://stackoverflow.com/q/23282567
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/23282655
tagged with: nullpointerexception
tagged with: android
tagged with: fatal-error
type: AnsweredQuestion
has body: I'm experiencing a NullPointerException and ForceClose issue when clicking the back button after launching either the gallery or the default audio player using the android application I've built. I've seen a few examples that state I'll need to finish the activity or check for a back button press - but I'm not sure how exactly that would fit into this scenario. It's crashing on line 84 which is: Uri selectedImage = data.getData(); Source: public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); // if (resultCode == Activity.RESULT_OK) { if (requestCode == SELECT_VIDEO) { { Uri selectedVideo = data.getData(); Intent intent = new Intent(Intent.ACTION_VIEW); intent.setDataAndType(selectedVideo, "video/*"); startActivity(intent); } } else if (requestCode == SELECT_PHOTO) { Uri selectedImage = data.getData(); Intent intent = new Intent(); intent.setAction(Intent.ACTION_VIEW); intent.setDataAndType(selectedImage, "image/*"); startActivity(intent); } LogCat: 04-24 21:04:26.441: D/AndroidRuntime(4491): Shutting down VM 04-24 21:04:26.441: W/dalvikvm(4491): threadid=1: thread exiting with uncaught exception (group=0x41df5930) 04-24 21:04:26.451: E/AndroidRuntime(4491): FATAL EXCEPTION: main 04-24 21:04:26.451: E/AndroidRuntime(4491): java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=1, result=0, data=null} to activity {com.tablet.hairmax/com.tablet.hairmax.UI}: java.lang.NullPointerException 04-24 21:04:26.451: E/AndroidRuntime(4491): at android.app.ActivityThread.deliverResults(ActivityThread.java:3319) 04-24 21:04:26.451: E/AndroidRuntime(4491): at android.app.ActivityThread.handleSendResult(ActivityThread.java:3362) 04-24 21:04:26.451: E/AndroidRuntime(4491): at android.app.ActivityThread.access$1100(ActivityThread.java:141) 04-24 21:04:26.451: E/AndroidRuntime(4491): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1282) 04-24 21:04:26.451: E/Andro…
tagged with: java
linked to: http://stackoverflow.com/q/5309190
accepted answer: http://stackoverflow.com/a/23282655
tagged with: android-intent
has comment: http://stackoverflow.com/comment/35637142
type: Question
has title: Clicking back button causes force close / NullPointerException

http://stackoverflow.com/a/23178406
type: Answer
has body: Try Like this. Imaginary i3 =new Imaginary(i1.real+i2.real,i1.imaginary+i2.imaginary); If you want to add Object you can create method for addition. public static Imaginary add(Imaginary i1,Imaginary i2) { return new Imaginary(i1.real+i2.real,i1.imaginary+i2.imaginary); } And create Object from this Imaginary i3 =add(i1,i2);
upvote count: 6
answers question: http://stackoverflow.com/q/23178398
downvote count: 0
score: 6

http://stackoverflow.com/a/23207708
downvote count: 0
has body: I need to split on hyphen characters too, but this does not work...What am I missing or doing wrong? To answer your question first off on what's wrong in this picture, you have forward slashes inside of your character class around your hyphen. Instead you should be using the escape sequence character (\\) [.,:/-/\\n] ^^^ Remove these and replace with the escape sequence character (\\-) Within a character class [], you can place a hyphen (-) as the first or last character. You may also escape it ([.,:\\-\n]) to add the hyphen in order to be matched. String s = "hey,hi.foo:bar\nbaz-quz"; String[] parts = s.split("[.,:\n-]"); System.out.println(Arrays.toString(parts)); Output [hey, hi, foo, bar, baz, quz]
type: Answer
answers question: http://stackoverflow.com/q/23207667
upvote count: 2
score: 2

http://stackoverflow.com/comment/35592467
type: Comment
comment on: http://stackoverflow.com/a/23258740
has text: i got that line from thenewboston on youtube, i'm an ameture at windows in java
score: 0
type: AnswerComment

http://stackoverflow.com/comment/35549261
type: Comment
type: QuestionComment
has text: @PatrickCostello when i use `DISTINCT` with single column then it returns distinct data but if i use it with multiple columns then it returns duplicates.
comment on: http://stackoverflow.com/q/23211174
score: 0

http://stackoverflow.com/q/23186192
upvote count: 1
type: Question
has title: Texture partially off screen - performance difference
tagged with: performance-testing
downvote count: 0
answer count: 1
favorite count: 0
has body: On the picture is an example of two situations, where a textured polygon is being rendered. All done by Opengl ES2. A) the polygon is partially off the viewport B) the polygon is completely inside it My question: Is situation 'A)' going to consume less system/gpu resources*, because the texture is partially off screen, or will it perform just the same as if i rendered it inside of the viewport and why? *"Resources" - meaning speed, not memory. I know that opengl does calculate vertices first, before rendering texture and if the vertices are off screen/viewport, it skips any further calculations, but is that the same case with textured object that is partially off screen? Will it omit the part of the texture that is not visible?
tagged with: opengl-es-2.0
tagged with: android
has answer: http://stackoverflow.com/a/23186628
tagged with: textures
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23186628
score: 1
tagged with: java

http://stackoverflow.com/q/23153805
upvote count: 7
downvote count: 1
has body: I know CTRL+ SHIFT + F for formatting method but it gives 3-4 parameters in line. I want one parameter in one line foe eg: method(a,b,c,d,e,f) I want below result method(a, b, c, d, e, f)
type: Question
tagged with: eclipse
answer count: 1
has title: how to format method with more parameter in eclipse?
favorite count: 0
has answer: http://stackoverflow.com/a/23153843
accepted answer: http://stackoverflow.com/a/23153843
has comment: http://stackoverflow.com/comment/35777010
type: AnsweredQuestion
tagged with: java
score: 6

http://stackoverflow.com/comment/35425383
score: 0
comment on: http://stackoverflow.com/q/23150695
has text: I can't figure it out, because i found in debugging that ReadEvent thread normally reads the data and finishes it's job, i am still working on it to find the problem
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/35582095
score: 0
has text: you need to call Base.close() - this removes the connection from current thread and closes it at the same time
type: Comment
comment on: http://stackoverflow.com/a/23253223
type: AnswerComment

http://stackoverflow.com/a/23176291
answers question: http://stackoverflow.com/q/23176087
type: Answer
has comment: http://stackoverflow.com/comment/35445781
upvote count: 1
has comment: http://stackoverflow.com/comment/35445231
has comment: http://stackoverflow.com/comment/35445764
score: 1
downvote count: 0
has body: When you find yourself handling lots of different array types, it's probably best to take a breath, and think with objects. public class WeekDay { private int number; private String name; public WeekDay(int number, String name) { // Your constructor here. } /** GETTERS AND SETTERS **/ } Or use a record in Java 16+. record WeekDay ( int number , String name ) {} Then you create a List to contain them.. List&lt;WeekDay&gt; weekDays = new ArrayList&lt;WeekDay&gt;(); When the WeekDay Objects have been averaged, you can cycle through each one, and call getName() (you'll need to add this) to return the name of the day. This provides a much cleaner, more manageable and presentable code and it will help you conceptualise your goals a lot more efficiently. Honestly, OOP is awesome for complex situations. Edit The trick here is to map the index to the day name. Let's say you have an array like this.. [0] = 0 [1] = 0 . . . [34] = 3 [35] = 9 . . . [62] = 7 [63] = 0 Your numbers are between 34 and 62. Those values need mapping to days, so lets start by making a method. public String[] mapDays(int[] dayNumbers, int startNumber, int endNumber) { // Your code in here. } You pass in the array containing all of the numbers, and you pass in when the month's numbers start and end. Then, you're going to perform some checks. // First, you make a new array. String[] dayNames = new String[dayNumbers.length]; for(int x = startNumber; x &lt;= endNumber; x++) { // You now need to map the value of x, to the week day name. }
has comment: http://stackoverflow.com/comment/35445848

http://stackoverflow.com/comment/35457693
type: AnswerComment
score: 0
type: Comment
has text: thank you but i can't get it to work in the program because i am new to java. (before c/c++
comment on: http://stackoverflow.com/a/23158314

http://stackoverflow.com/q/23267390
type: UnansweredQuestion
has body: I am using Hibernate 4.2.4 and I am interested to know how Hibernate translate a session.get call to an equivalent sql query that is eventually used to retrieve rows from database. I do not want to log the generated sql in console. I want to use the same sql query in my application. Something like below. ... SessionFactory sessionFactory = configuration.buildSessionFactory(builder.buildServiceRegistry()); // I want the query string here String query = sessionFactory.someUnknownMethod(Some Paramters); Session session = sessionFactory.openSession(); // actual session.get query Comment comment = (Comment) session.get(Comment.class, new Integer(1)); ... I have seen this thread for Criteria query -> How to get SQL from Hibernate Criteria API (*not* for logging). I would like to know if similar procedure exists for session.get type queries. I have also seen this thread -> get SQL from hibernate get where the question is exactly same as mine, but the accepted solution talks about fetching statistics which, to my understanding, only accounts for the queries that have already been executed. Plus, from statistics I was able to catch hql/sql queries but not session.get queries. I want to know if there is a way for a user to generate and use the sql even before the actual session.get gets executed (possibly by following the same path as hibernate).
answer count: 0
upvote count: 3
linked to: http://stackoverflow.com/q/554481
tagged with: hibernate-criteria
has title: How does Hibernate generate sql string from session.get queries
type: Question
score: 3
tagged with: java
tagged with: hibernate
tagged with: hibernate-session
tagged with: sql
has comment: http://stackoverflow.com/comment/40026002
downvote count: 0
linked to: http://stackoverflow.com/q/16501084
favorite count: 0

http://stackoverflow.com/comment/35448393
type: Comment
has text: So you want to return 1 row but instead it is returning all of the rows? Or it is returning nothing?
score: 0
comment on: http://stackoverflow.com/q/23178173
type: QuestionComment

http://stackoverflow.com/comment/35476298
score: 0
type: QuestionComment
has text: @geoand, Actually I am new to spring technology.....and sevlet very well and I wants to use log and log out service so I followed some online tutorials but could not understand completly.
type: Comment
comment on: http://stackoverflow.com/q/23193982

http://stackoverflow.com/comment/70237118
score: 0
comment on: http://stackoverflow.com/a/23133196
type: Comment
has text: if we remove `fx:controller` attribute and add controller by hand we need to add all actions by hand because if there is no reference of controller in fxml file in shows more errors for buttons and other things against which we are defining action in xml.
type: AnswerComment

http://stackoverflow.com/q/23175188
tagged with: image
answer count: 2
has answer: http://stackoverflow.com/a/23175705
tagged with: aspect-ratio
has body: I want to draw some images into a panel, I need that the images conserves their aspect ratio with the biggest dimensions to be drawn over a panel. So given the panel dimensions I must create a Java code to maximize that dimensions. The only ideas that I had needed to solve some linear programming, and I don't know how to do it in Java. Which should be the easiest way to do what I need?
possible better answer: http://stackoverflow.com/a/23175440
has answer: http://stackoverflow.com/a/23175440
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23175705
has comment: http://stackoverflow.com/comment/35443330
score: 0
has title: How to resize image to maximize their dimensions into a panel without changing aspect ratio
type: Question
tagged with: maximize
tagged with: java

http://stackoverflow.com/a/23186950
score: 0
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/23186461
answers question: http://stackoverflow.com/q/23186461
has body: All the for loops in your program are accessing the same index from the scores array. Change the for loop: size-- to index++ as follows for (index = 0; index &lt;=size; index++) &lt;br&gt; { //Your code }

http://stackoverflow.com/q/23217739
downvote count: 0
has title: Setting cache control for css, images and js in web.xml
favorite count: 0
upvote count: 2
type: UnansweredQuestion
score: 2
answer count: 0
tagged with: java
tagged with: tomcat6
type: Question
tagged with: jakarta-ee
has body: I am trying to set the cache for CSS, images and JS files using the following third party library cachefilter2.0.jar. The corresponding library documentation can be found here The jar file can be found here imagesCache com.samaxes.filter.CacheFilter static true expirationTime 2592000 cssCache com.samaxes.filter.CacheFilter expirationTime 604800 jsCache com.samaxes.filter.CacheFilter private true expirationTime 216000 cssCache *.css jsCache *.js imagesCache *.png *.gif *.jpg The above method is working perfectly for sub directories in my local development server using eclipse. I am doing the same thing in external server but it is not working for sub directories in my external server. I had tried creating the own filter still facing the same problem.
tagged with: caching

http://stackoverflow.com/a/23189574
has comment: http://stackoverflow.com/comment/35471426
has comment: http://stackoverflow.com/comment/35471774
type: Answer
score: 2
downvote count: 0
has body: A JComponent is not a top level container. I consider the definition of a top level container to be: A top level container can be displayed on its own, without the programmer explicitly adding it to any other container. That is true of: JFrame JApplet JWindow JDialog As advised by @camickr, see the Swing tutorial on Using Top Level Containers for more information. ..and note that while the JFrame is clearly marked as "A Top-level Container", the content pane (a JComponent) is lacking that title.
has comment: http://stackoverflow.com/comment/35469605
answers question: http://stackoverflow.com/q/23188165
upvote count: 2
has comment: http://stackoverflow.com/comment/35471399

http://stackoverflow.com/a/23221959
score: 0
answers question: http://stackoverflow.com/q/23216596
type: Answer
has body: use the handler Handler h = new Handler(); h.postDelay(function, time);

http://stackoverflow.com/comment/35654822
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23263988
has text: I donot have any old versions of junit. Stil it isnt showing any console output. I get the same error too. I do get the output when I do maven build, but not when I run junit test cases.
type: AnswerComment

http://stackoverflow.com/comment/35439733
has text: @mfrankli It's rather simple, but as pointed out above: It makes the assumption that the values are *grouped*. While this seems to be the case here, your solution does *not* make this assumption, and thus, would be applicable for similar (but more general) tasks. Also, the "optional sorting stuff" that I mentioned in the comment to your answer can be considered as a neat additional feature of your solution.
type: AnswerComment
comment on: http://stackoverflow.com/a/23173114
score: 0
type: Comment

http://stackoverflow.com/comment/35516300
has text: Yes, that's clear. Actually I wanted to use something like `itemPanel.init()` or something like that.
comment on: http://stackoverflow.com/a/23214283
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/23275343
type: Question
has answer: http://stackoverflow.com/a/23275637
has comment: http://stackoverflow.com/comment/35623196
linked to: http://stackoverflow.com/q/1732348
score: 0
has comment: http://stackoverflow.com/comment/35623002
answer count: 1
has comment: http://stackoverflow.com/comment/35623321
favorite count: 0
accepted answer: http://stackoverflow.com/a/23275637
has body: I have the following XML String: &lt;asd1:content&gt;&lt;/asd1:content&gt; The namespace prefix asd1 could be different at different places in the XML file. I want to modify it to : &lt;asd1:content&gt;*&lt;/asd1:content&gt; I am trying to do it via regex as follows: myString.replaceAll("&lt;.*:content&gt;&lt;/.*:content&gt;","replacement text"); The problem is that I don,t want to lose the namespace prefix. What should I do?
tagged with: regex
has title: Modifying xml via regex in java
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35623230
tagged with: java
has comment: http://stackoverflow.com/comment/35623130
has comment: http://stackoverflow.com/comment/35623292
upvote count: 1
downvote count: 1

http://stackoverflow.com/q/23146471
has comment: http://stackoverflow.com/comment/35414122
tagged with: java
tagged with: flags
has body: I'm trying to make a traffic simulator and I completely underestimated how hard it was going to be to get all the classes to work together. I've finally gotten all the functions to work quite well, and am now I'm trying to put them together. On my lights algorithm I've gotten the lights to change fine on a timer, but then I needed to tie in a boolean that was attached to the lights color and then use it outside that class to tell the car to move or not (Failed Miserably). So now I've brought the Car classes .move/.draw to the lights class instead, although for some reason the booleans won't correspond to the switch their in although there's a variable that changes the light so I don't see why my boolean continually switches from true to false when the lights in that switch are staying the same I've put in println to show how the lights are changing fine but the flags arent. I've commented out a couple different places I've tried placing the car.draw sections. I've edited the code to just resemble how the boolean flags aren't corresponding with the lights changing. Also if I can get the flags to work how can I call upon that flag in another class? int greenX, greenY = 50; // Alphas of Green Lights (50 = OFF & 250 = ON) int redX, redY = 50; // Alphas of Red Lights (50 = OFF & 250 = ON) int yellowX, yellowY = 50; // Alphas of Yellow Lights (50 = OFF & 250 = ON) int time; // set to equal millis() int lastInterval; // Used to update time since last light change then used to take away from "time" in order to get amount of time specified float interval = 5; // Interval for Lights in Seconds float wait = 1000*interval; // turn interval from seconds to millis char lightX = 'G'; // Switch for Lights on X-Cords char lightY = 'R'; // Switch for Lights on Y-Cords boolean X, Y, Xy, Yy; // Booleans for Lights to corespond to draw/make car (Xy & Yy = yellow lights) void setup() { } void draw() { time = millis(); println("Last Interval Times is " + lastInterval/1000); if (time - las…
has title: Boolean flags aren't corresponding to the switch they are in
tagged with: boolean
score: 2
downvote count: 0
has answer: http://stackoverflow.com/a/23655727
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35392738
has comment: http://stackoverflow.com/comment/35396454
favorite count: 0
type: Question
upvote count: 2
accepted answer: http://stackoverflow.com/a/23655727
has comment: http://stackoverflow.com/comment/36333375
answer count: 1
has comment: http://stackoverflow.com/comment/35409831
tagged with: processing

http://stackoverflow.com/a/23276778
has body: You need a flag and synchronization: private boolean mReconnectNeeded; public synchronized void reconnectIfNeeded() { if (mReconnectNeeded) { mReconnectNeeded = false; // reconnect; if it fails, set the flag again } } public synchronized void setReconnectNeeded() { mReconnectNeeded = true; }
type: Answer
score: -1
downvote count: 1
answers question: http://stackoverflow.com/q/23276665
upvote count: 0

http://stackoverflow.com/comment/35474675
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23193054
score: 0
has text: u mean to say when u catch Exception, this.e is still null??

tomcat
tags question: http://stackoverflow.com/q/23139327
tags question: http://stackoverflow.com/q/23260775
tags question: http://stackoverflow.com/q/23163578
tags question: http://stackoverflow.com/q/23205133
tags question: http://stackoverflow.com/q/23284403
tags question: http://stackoverflow.com/q/23282786
tags question: http://stackoverflow.com/q/23167600
tags question: http://stackoverflow.com/q/23204893
tags question: http://stackoverflow.com/q/23193100
tags question: http://stackoverflow.com/q/23146581
tags question: http://stackoverflow.com/q/23285977
tags question: http://stackoverflow.com/q/23256999
tags question: http://stackoverflow.com/q/23220630
tags question: http://stackoverflow.com/q/23264517
tags question: http://stackoverflow.com/q/23207214
tags question: http://stackoverflow.com/q/23249355
tags question: http://stackoverflow.com/q/23283853
tags question: http://stackoverflow.com/q/23273733
tags question: http://stackoverflow.com/q/23151374
tags question: http://stackoverflow.com/q/23182576
tags question: http://stackoverflow.com/q/23288017
tags question: http://stackoverflow.com/q/23282602
tags question: http://stackoverflow.com/q/23269346
tags question: http://stackoverflow.com/q/23290527
tags question: http://stackoverflow.com/q/23245578
tags question: http://stackoverflow.com/q/23207088
tags question: http://stackoverflow.com/q/23257236
tags question: http://stackoverflow.com/q/23200602
tags question: http://stackoverflow.com/q/23284114
tags question: http://stackoverflow.com/q/23271984
tags question: http://stackoverflow.com/q/23169865
tags question: http://stackoverflow.com/q/23191517
tags question: http://stackoverflow.com/q/23279127
tags question: http://stackoverflow.com/q/23219149
tags question: http://stackoverflow.com/q/23157065
tag name: tomcat
tags question: http://stackoverflow.com/q/23147836
tags question: http://stackoverflow.com/q/23200941
tags question: http://stackoverflow.com/q/23286375
tags question: http://stackoverflow.com/q/23252974
tags question: http://stackoverflow.com/q/23272360
tags question: http://stackoverflow.com/q/23167654
tags question: http://stackoverflow.com/q/23273889
tags question: http://stackoverflow.com/q/23239748
tags question: http://stackoverflow.com/q/23143005
tags question: http://stackoverflow.com/q/23176717
tags question: http://stackoverflow.com/q/23168910
tags question: http://stackoverflow.com/q/23150251
tags question: http://stackoverflow.com/q/23260726
tags question: http://stackoverflow.com/q/23139213
tags question: http://stackoverflow.com/q/23289399
tags question: http://stackoverflow.com/q/23158855
tags question: http://stackoverflow.com/q/23254197
tags question: http://stackoverflow.com/q/23263234
tags question: http://stackoverflow.com/q/23217359
tags question: http://stackoverflow.com/q/23228968
tags question: http://stackoverflow.com/q/23259744
tags question: http://stackoverflow.com/q/23272350
type: Tag
tags question: http://stackoverflow.com/q/23153250
tags question: http://stackoverflow.com/q/23234310
tags question: http://stackoverflow.com/q/23288991
tags question: http://stackoverflow.com/q/23285649
tags question: http://stackoverflow.com/q/23143697
tags question: http://stackoverflow.com/q/23236879
tags question: http://stackoverflow.com/q/23153778
tags question: http://stackoverflow.com/q/23201039
tags question: http://stackoverflow.com/q/23290344
tags question: http://stackoverflow.com/q/23274616
tags question: http://stackoverflow.com/q/23144597
tags question: http://stackoverflow.com/q/23165637
tags question: http://stackoverflow.com/q/23248548
tags question: http://stackoverflow.com/q/23161197
tags question: http://stackoverflow.com/q/23247910
tags question: http://stackoverflow.com/q/23162164
tags question: http://stackoverflow.com/q/23158047

http://stackoverflow.com/comment/35551184
type: Comment
comment on: http://stackoverflow.com/a/23231242
score: 0
type: AnswerComment
has text: It worked for me.. Remove other code except above three lines (suggested by @christopher) from your jsp and run it.

http://stackoverflow.com/a/23246099
score: 1
answers question: http://stackoverflow.com/q/23246017
upvote count: 1
downvote count: 0
type: Answer
has body: Try the close method. From the JavaDOC: void close() Closes the line, indicating that any system resources in use by the line can be released. If this operation succeeds, the line is marked closed and a CLOSE event is dispatched to the line's listeners.

http://stackoverflow.com/comment/35420436
type: AnswerComment
type: Comment
has text: try tutorials nr 14 and 15: https://www.youtube.com/watch?v=4mANZ4MMbD4&list=PL4AFF701184976B25 Basically I will recommend to you the whole series. They are very useful and brain friendly.
comment on: http://stackoverflow.com/a/23151845
score: 0

http://stackoverflow.com/comment/35445340
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23176170
has text: It looks like you're violating the part "The implementor must also ensure that the relation is transitive: (x.compareTo(y)>0 && y.compareTo(z)>0) implies x.compareTo(z)>0". On the second thought it looks like there's no solution.

http://stackoverflow.com/comment/35596146
type: AnswerComment
score: 0
has text: @kai both would work, and in this case you're right that the strings can't be higher than 255, but for others who might be parsing larger hex strings, I felt that this would be more general purpose and usable. Thanks for the heads-up!
type: Comment
comment on: http://stackoverflow.com/a/23260886

http://stackoverflow.com/q/23233412
has body: I was wondering if anybody can point me some detailed documentation on how Java's thread join method internally works. I understand that if you use thread.join() then it makes parent thread to wait for the child thread but I am more interested on the implementation aspect of it. I kind of have a rough understanding (not sure how much correct it is), I believe when parent thread calls join method, it internally calls wait on some object(this?) and when child thread completes it may fire a notifyAll() on the same object. Can any body confirm this or point me to any detailed documentation here ? Thanks
type: Question
has comment: http://stackoverflow.com/comment/35546566
score: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/35546589
has title: How Thread.join() internally works
favorite count: 0
type: UnansweredQuestion
tagged with: multithreading
downvote count: 1
answer count: 0
tagged with: java

http://stackoverflow.com/comment/35411851
score: 1
has text: There are many (bad) ways to do this. You should show code.
comment on: http://stackoverflow.com/q/23157838
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35600158
type: Comment
comment on: http://stackoverflow.com/a/23260336
score: 1
type: AnswerComment
has text: Dropwizard is something like Jersey JAX-RS implementation backed by jetty, while CXF is also a JAX-RS implementation backed by Jetty. I think you need to figure out what you want to achieve by enabling DropWizard and how you think it would be convenient to use it. I think you could setup a DropWizard component in Camel the same way CXF-RS is setup, by annotating beans with @Path.. and then refer to beans (using spring or similar) them in endpoints.

speech-recognition
tags question: http://stackoverflow.com/q/23267448
tag name: speech-recognition
type: Tag

http://stackoverflow.com/a/23236893
answers question: http://stackoverflow.com/q/23222432
has comment: http://stackoverflow.com/comment/35568593
accepted answer of: http://stackoverflow.com/q/23222432
type: AcceptedAnswer
score: 0
has body: Mapper Implementation is created by mybatis as proxy class during the application startup. Your mapper xml file corresponding to the interface would be translated to plain java jdbc code and would be implemented in proxy class. And using the interface you access these proxy classes.
type: Answer

http://stackoverflow.com/comment/35591245
type: Comment
has text: isNotDecimal, how would I define that exactly? and the catch, would I add that into my catches I already have or replace them?
type: AnswerComment
comment on: http://stackoverflow.com/a/23258033
score: 0

http://stackoverflow.com/a/23280654
has body: As discussed in your previous similar question from 30 min ago: Use one JFrame. The other window should be a JDialog, although here a non-modal JDialog. Use a getter method to allow one class to get the score String from another class. The tricky part here that was not discussed as we did not have enough information at the time, is knowing when to pass the information to the Score JDialog. Here your main GUI should hold an instance of the Score JDialog, give this JDialog a setter method that would allow the main GUI to set the Score's score JTextField when the actual score changes.
upvote count: 1
answers question: http://stackoverflow.com/q/23280563
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/a/23185294
answers question: http://stackoverflow.com/q/23185047
score: 0
type: Answer
has body: I guess you may want this <property ...> Init-method will be called after injecting all properties and after constructor.

http://stackoverflow.com/q/23214042
tagged with: android
downvote count: 2
has answer: http://stackoverflow.com/a/23215391
tagged with: java
tagged with: navigation
tagged with: expandable
type: Question
has title: How I can do this using navigation drawer?
score: -2
has body: How can i do this please help me? It is using navigation drawer list view with sub items. How I can do this?
tagged with: listview
upvote count: 0
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/35511532
type: UnansweredQuestion

http://stackoverflow.com/comment/35519786
type: Comment
has text: @user3522121 if you want to send list to `site_index_groupadmin.jsp` then use `request.setAttribute("list", list);` then forward it. or better use servlets instead of jsp.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23218697

http://stackoverflow.com/q/23232519
has comment: http://stackoverflow.com/comment/35546237
has comment: http://stackoverflow.com/comment/35753473
has body: I'm getting some strange behaviour in one of my apps, objects (member variables) against one of my classes are being nullified before the lifecycle of my class has completed, obviously resulting in null pointer exceptions. It seems to happen after a period of time (presumably due to high memory usage or memory leak). I know that the GC shouldn't collect any objects which are referenced. But, in a low memory scenario, does this rule still apply and will referenced objects be put up for GC? I've knocked up a sample to demonstrate my code pattern: Thanks in advance. public class WebRequest implements Runnable { private WebRequest _Request; public WebRequest(WebRequest request) { _Request = request; } @Override public void run() { DoSomething1(); DoSomething2(); } private void DoSomething1() { String s = _Request.getAttribute(); //Works //Do something else, few hundred milliseconds } private void DoSomething2() { String s = _Request.getAttribute(); //Results in NullPointerException } }
has comment: http://stackoverflow.com/comment/35546346
has comment: http://stackoverflow.com/comment/35545211
has comment: http://stackoverflow.com/comment/35545913
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35545481
tagged with: garbage-collection
has title: Java Garbage Collection of referenced objects
tagged with: java
has comment: http://stackoverflow.com/comment/35576767
type: Question
has comment: http://stackoverflow.com/comment/35545631
score: 0
has comment: http://stackoverflow.com/comment/35545434

http://stackoverflow.com/comment/35596508
score: 0
comment on: http://stackoverflow.com/q/23260876
has text: maybe you're on of those who don't know the difference: `javascript != java`
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35550079
type: Comment
has text: I suppose raising the question, "Why do you need nearly every socket on the system, some of which may already be taken?" is a bit...much?
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/23235443

http://stackoverflow.com/comment/35504771
type: Comment
type: QuestionComment
has text: go with `DB.update()`
comment on: http://stackoverflow.com/q/23209979
score: 0

http://stackoverflow.com/q/23137445
score: 0
tagged with: java
type: Question
answer count: 1
has answer: http://stackoverflow.com/a/23137878
has title: ScrollView Does not Scrolll Smoothly
tagged with: android
tagged with: scrollview
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/35377164
type: UnansweredQuestion
has body: I am adding a ScrollView and several TextView together. I am populating data using a web service (php/mysql data from server). Everything is fine except one issue. When user scrolls the page/activity, the scroll is not as smooth as a listview. I am posting my xml here: &lt;ScrollView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="fill_parent" android:layout_height="wrap_content" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" android:focusable="true" android:id="@+id/scrolFullText" tools:context=".FullText" &gt; &lt;LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="vertical" &gt; &lt;TextView android:id="@+id/HEAD" android:text="@string/HEAD" android:layout_width="fill_parent" android:layout_height="wrap_content" android:textSize="20sp" android:textColor="@color/blue" /&gt; &lt;TextView android:id="@+id/WRITER" android:text="@string/WRITER" android:layout_width="fill_parent" android:layout_height="wrap_content" android:textSize="18sp" android:textColor="@color/darkgreen" /&gt; &lt;TextView android:id="@+id/CATEGORY" android:text="@string/CATEGORY" android:layout_width="fill_parent" android:layout_height="wrap_content" android:paddingTop="6dp" /&gt; &lt;TextView android:id="@+id/TEXT" android:text="@string/TEXT" android:layout_width="fill_parent" android:layout_height="wrap_content" android:paddingTop="6dp" /&gt; &lt;/LinearLayout&gt; &lt;/ScrollView&gt; How can I make my scroll a little smoother?
has comment: http://stackoverflow.com/comment/35376688

http://stackoverflow.com/q/23290668
has comment: http://stackoverflow.com/comment/35652330
tagged with: java
has comment: http://stackoverflow.com/comment/35652205
has body: I tried to use Jxlayer and PBar extensions (using the response of MadProgrammer from here) to add the zoom capability to my JPanel which is contained in a JScrollPanel. The zoom itself work fine but when the zoomed panel becomes larger than the containing JFrame the scrollbars doesn’t adjust and stay inactive. Here is my code: JFrame frame = new JFrame("Testing"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setLayout(new BorderLayout()); JPanel topPanel = new JPanel(); Integer[] zoomList = {50, 75, 100, 125, 150, 200}; JComboBox&lt;Integer&gt; zoomBox = new JComboBox&lt;&gt;(zoomList); zoomBox.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { int value = (int) zoomBox.getSelectedItem(); double scale = value / 100d; transformModel.setScale(scale); } }); topPanel.add(zoomBox); Panel centerPanel = new TestPane(); JScrollPane scrollPane = new JScrollPane(synopticPanel); scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); scrollPane.getViewport().setOpaque(false); scrollPane.setOpaque(false); frame.add(topPanel, BorderLayout.NORTH); frame.add(synopticPanel); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); and in the Testpane class public class TestPane extends JPanel { private JLayer&lt;JComponent&gt; layer; private JPanel content; public TestPane() { content = new JPanel(); content.setLayout(null); //Adding some components transformModel = new DefaultTransformModel(); transformModel.setScaleToPreferredSize(true); layer = TransformUtils.createTransformJLayer(content, transformModel, null); setLayout(new BorderLayout()); add(layer); } Thank you for your help
answer count: 0
downvote count: 0
type: UnansweredQuestion
score: 1
linked to: http://stackoverflow.com/q/21174997
tagged with: zooming
has comment: http://stackoverflow.com/comment/35651517
has title: scrollbars adjust when zooming using Jxlayer and PBar extensions
favorite count: 0
type: Question
upvote count: 1
tagged with: swing

http://stackoverflow.com/a/23285312
type: Answer
score: 11
has comment: http://stackoverflow.com/comment/35642130
has comment: http://stackoverflow.com/comment/35641974
downvote count: 0
has comment: http://stackoverflow.com/comment/35642125
has comment: http://stackoverflow.com/comment/35642151
has comment: http://stackoverflow.com/comment/35641941
upvote count: 11
accepted answer of: http://stackoverflow.com/q/23285290
answers question: http://stackoverflow.com/q/23285290
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35642173
has body: You are missing one "}" at the end of the program public class Hello { public static void main (String args[]) { System.out.println ("Hello World!"); } } and then try java -cp . Hello
has comment: http://stackoverflow.com/comment/35642310

http://stackoverflow.com/q/23249217
tagged with: jsf
downvote count: 0
tagged with: java
favorite count: 0
type: Question
score: 5
tagged with: shiro
tagged with: security
has title: Apache Shiro: IllegalArgumentException upon login
has answer: http://stackoverflow.com/a/23252242
accepted answer: http://stackoverflow.com/a/23252242
answer count: 1
upvote count: 5
has body: When using Apache Shiro, the following exception appears upon login: java.lang.IllegalArgumentException: Configuration error. Configuration error. Specified object [authc] with property [loginUrl] without first defining that object's class. Please first specify the class property first, e.g. myObject = fully_qualified_class_name and then define additional properties. shiro.ini # ----------------------------------------------------------------------------- [main] authc.loginUrl=/login.xhtml authc.successUrl=/hello.xhtml logout.redirectUrl=/hello.xhtml # Users and their (optional) assigned roles # username = password, role1, role2, ..., roleN # ----------------------------------------------------------------------------- [users] root = secret, admin guest = guest, guest # ----------------------------------------------------------------------------- # Roles with assigned permissions # roleName = perm1, perm2, ..., permN ----------------------------------------------------------------------------- [roles] admin = * schwartz = lightsaber:* goodguy = winnebago:drive:eagle5 #------------------------------------------------------------------------------ [urls] /hello.xhtml= authc Controller public void login() { Factory<SecurityManager> factory = new IniSecurityManagerFactory(); SecurityManager securityManager = factory.getInstance(); SecurityUtils.setSecurityManager(securityManager); Subject currentUser=SecurityUtils.getSubject(); if(!currentUser.isAuthenticated()){ UsernamePasswordToken token=new UsernamePasswordToken("root","secret"); token.setRememberMe(true); try{ currentUser.login(token); }catch(UnknownAccountException e){ System.out.println("username is incorrect"); }catch (IncorrectCredentialsException e) { System.out.println("password is incorrect"); }catch (LockedAccountException e) { System.out.println("account was locked"); }catch (AuthenticationException e) { System.out.println("there are some error"); } } } web.xml com.sun.faces.config.ConfigureListener Faces …
type: AnsweredQuestion

http://stackoverflow.com/comment/35638783
type: Comment
comment on: http://stackoverflow.com/a/23283433
type: AnswerComment
has text: And because the ListViewAdapter is on fragment , only one page Android Activity, this code is work!!
score: 0

http://stackoverflow.com/comment/35489892
comment on: http://stackoverflow.com/a/23202077
has text: This is close, but since you are using a multidimensional array you will have to handle that somewhere, either in the compare function or in the function that calls it. Depends if you are passing the 2d array in or just the array from the 2d array (current code looks like it should do the latter)
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/23276541
has title: Http Status 400 on android but 200 on desktop
score: 0
has body: I am trying to login to twitter using this code below: //private final String USER_AGENT = "Mozilla/5.0"; private final String USER_AGENT = "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.116 Safari/537.36"; public static void main(String[] args) throws Exception { runThisClass("This is a samplest tweet234!"); } public static void runThisClass(String tweet)throws Exception{ String url = "https://mobile.twitter.com/session/new"; String url2 = "https://mobile.twitter.com/session"; String url3 = "https://mobile.twitter.com"; String gmail = "https://mobile.twitter.com/compose/tweet"; HttpUrlConnectionExample http = new HttpUrlConnectionExample(); // make sure cookies is turn on CookieHandler.setDefault(new CookieManager()); // 1. Send a "GET" request, so that you can extract the form's data. String page = http.GetPageContent(url); String postParams = http.getFormParams(page, "username", "password"); // 2. Construct above post's content and then send a POST request for // authentication http.sendPost(url2, postParams); // 3. success then go to compose tweet page. String result = http.GetPageContent(gmail); //4.Construct another HTTP Post to tweet: postParams=http.getTweetFormParams(result,tweet); http.sendPostTweet(url3, postParams); } private void sendPost(String url, String postParams) throws Exception { URL obj = new URL(url); conn = (HttpsURLConnection) obj.openConnection(); // Acts like a browser conn.setUseCaches(false); conn.setRequestMethod("POST"); conn.setRequestProperty("Host", "twitter.com"); conn.setRequestProperty("User-Agent", USER_AGENT); conn.setRequestProperty("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); conn.setRequestProperty("Accept-Language", "en-US,en;q=0.5"); for (String cookie : this.cookies) { conn.addRequestProperty("Cookie", cookie.split(";", 1)[0]); } conn.setRequestProperty("Connection", "keep-alive"); conn.setRequestProperty("referer", "https://mobile.twitter.com/…
tagged with: http-post
has comment: http://stackoverflow.com/comment/35625691
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35625567
tagged with: android
tagged with: httpsurlconnection
answer count: 0
tagged with: java
tagged with: https
type: Question

http://stackoverflow.com/comment/35400905
has text: Also just to be clear, consumers will block if the message is still the one they got previously, even though the producer has a next message available, but is blocked since not all clients have peeked?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23147654
score: 0

http://stackoverflow.com/q/23183931
has comment: http://stackoverflow.com/comment/35457791
favorite count: 0
has answer: http://stackoverflow.com/a/29086150
has answer: http://stackoverflow.com/a/42667690
has comment: http://stackoverflow.com/comment/35457931
answer count: 12
tagged with: maven
possible better answer: http://stackoverflow.com/a/29086150
score: 19
accepted answer: http://stackoverflow.com/a/23184418
has answer: http://stackoverflow.com/a/40956004
type: AnsweredQuestion
upvote count: 19
has answer: http://stackoverflow.com/a/56301814
has answer: http://stackoverflow.com/a/50808111
has body: In my maven project, I have this Effective POM: <?xml version="1.0"?> 4.0.0 spring example 0.0.1-SNAPSHOT war example http://maven.apache.org <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> org.springframework spring-context 4.0.3.RELEASE compile org.springframework.ws spring-ws-core 2.1.4.RELEASE compile org.springframework.security spring-security-web 3.2.3.RELEASE compile org.springframework.security spring-security-config 3.2.3.RELEASE compile org.hibernate hibernate-core 4.3.5.Final compile org.hibernate hibernate-validator 5.1.0.Final compile org.springframework spring-orm 4.0.3.RELEASE compile org.springframework spring-tx 4.0.3.RELEASE compile false central Central Repository http://repo.maven.apache.org/maven2 never false central Central Repository http://repo.maven.apache.org/maven2 C:\Users\Kleber\Downloads\Projetos\example\src\main\java C:\Users\Kleber\Downloads\Projetos\example\src\main\scripts C:\Users\Kleber\Downloads\Projetos\example\src\test\java C:\Users\Kleber\Downloads\Projetos\example\target\classes C:\Users\Kleber\Downloads\Projetos\example\target\test-classes C:\Users\Kleber\Downloads\Projetos\example\src\main\resources C:\Users\Kleber\Downloads\Projetos\example\src\test\resources C:\Users\Kleber\Downloads\Projetos\example\target example-0.0.1-SNAPSHOT maven-antrun-plugin 1.3 maven-assembly-plugin 2.2-beta-5 maven-dependency-plugin 2.1 maven-release-plugin 2.0 org.apache.tomcat.maven tomcat7-maven-plugin 2.2 http://localhost:8080/manager/text TomcatServer /webappExample user001 123 maven-clean-plugin 2.4.1 default-clean clean clean maven-install-plugin 2.3.1 default-install install install maven-resources-plugin 2.5 default-resources process-resources resources default-testResources process-test-resources testResources maven-surefire-plugin 2.10 default-test test test maven-compiler-plugin 2.3.2 default-testCompile test-compile testCompile default-compile compile compile maven-war-plugin 2.1.1 default-war package war maven-d…
tagged with: java
has answer: http://stackoverflow.com/a/29363683
tagged with: eclipse
has title: Maven Java EE Configuration
has answer: http://stackoverflow.com/a/42517808
type: Question
has answer: http://stackoverflow.com/a/50952915
linked to: http://stackoverflow.com/q/18122336
has answer: http://stackoverflow.com/a/39698699
downvote count: 0
has answer: http://stackoverflow.com/a/57387984
has answer: http://stackoverflow.com/a/23184418
has answer: http://stackoverflow.com/a/41033775
linked to: http://stackoverflow.com/q/11483637

http://stackoverflow.com/q/23130930
type: AnsweredQuestion
score: 1
tagged with: java
type: Question
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/23130965
has title: concurrent modification exception for set iterator
favorite count: 0
tagged with: exception
accepted answer: http://stackoverflow.com/a/23130965
tagged with: concurrentmodification
has answer: http://stackoverflow.com/a/23131970
has body: Hi I have the following code structure Private Set&lt;String&gt; someset = null; //a class variable someclassfunction() { Set&lt;String&gt; st = mapA.keyset(); someset = mapA.keyset(); for (String s: st) { //this is where now the exception occurs someotherclassfunction(); } } someotherclassfunction() { Iterator&lt;String&gt; it = someset.iterator(); while (it.hasNext()) { String key = it.next(); if (somecondition) { it.remove(); //Earlier I did, someset.remove(key), this threw concurrent //modification exception at this point. So I found on stack //overflow that we need to use iterator to remove } } } But now the same exception occurs on the calling function for each loop. Why is that? I am not modifying the st set, I am modifying the someset (class variable). Please help.
possible better answer: http://stackoverflow.com/a/23131970
upvote count: 1
tagged with: collections

http://stackoverflow.com/a/23240988
has comment: http://stackoverflow.com/comment/35559914
has body: a tricky solution : public static void main(String[] args) throws Exception { ArrayList&lt;String&gt; l1 = new ArrayList&lt;&gt;(); ArrayList&lt;String&gt; l2 = new ArrayList&lt;&gt;(); int i = getIndex("key", l1, l2); switch (i) { case -1: break; case 0: break; case 1: break; default: break; } } public static int getIndex(String key, ArrayList&lt;String&gt;... arrayLists) { for (int i = 0; i &lt; arrayLists.length; i++) { if (arrayLists[i].contains(key)) return i; } return -1; }
type: Answer
has comment: http://stackoverflow.com/comment/35560061
score: 0
answers question: http://stackoverflow.com/q/23240665

http://stackoverflow.com/comment/35527117
type: QuestionComment
comment on: http://stackoverflow.com/q/23222296
score: 1
has text: Okay then. To answer your question directly, no. I don't think there is any such method built into the Java run-time.
type: Comment

http://stackoverflow.com/q/23241376
has answer: http://stackoverflow.com/a/23241765
type: AnsweredQuestion
tagged with: recursion
has comment: http://stackoverflow.com/comment/35560549
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/23241637
type: Question
has body: i've got a problem. I can't understand how to think when I get this code: public class MysteryClass { public static void mystery(int n) { if (n &gt; 0){ mystery(n-1); System.out.print(n * 4); mystery(n-1); } } public static void main(String[] args) { MysteryClass.mystery(3); } } The answer is 4 8 4 12 4 8 4 but i don't know how they got it.. could someone please explaine ?
answer count: 6
has title: Double recursion - Java
has comment: http://stackoverflow.com/comment/35560654
upvote count: 2
downvote count: 1
has answer: http://stackoverflow.com/a/23241893
has comment: http://stackoverflow.com/comment/35560901
possible better answer: http://stackoverflow.com/a/23241637
favorite count: 0
has answer: http://stackoverflow.com/a/23241625
has answer: http://stackoverflow.com/a/23241752
accepted answer: http://stackoverflow.com/a/23241625
has answer: http://stackoverflow.com/a/23241753

http://stackoverflow.com/comment/35618396
type: QuestionComment
has text: @monocell The main goal of all this is to make sure both `Resource` and `Diagnosis` works with the same type of `Facts`.
comment on: http://stackoverflow.com/q/23247816
score: 0
type: Comment

http://stackoverflow.com/a/23220062
accepted answer of: http://stackoverflow.com/q/23219972
upvote count: 2
type: AcceptedAnswer
downvote count: 0
has body: http://developer.android.com/reference/android/os/Build.VERSION.html#SDK_INT if(Build.VERSION.SDK_INT &gt; 8) { showAdsBanner(); mHandler.postDelayed(new Runnable() { public void run() { showAdsInterstitial(); } }, 2500); }
type: Answer
score: 2
answers question: http://stackoverflow.com/q/23219972

http://stackoverflow.com/q/23265994
type: Question
has body: I started to learn both programming and Java and I have an issue I'm not able to solve on my own so far. I'm running the program from the Linux terminal using: First javac to create the .class file javac -classpath acm.jar Chap6_ex1.java Want to add here that both the acm.file and the Chap5_ex3.java file are both at the same location as the terminal path. Then I run this command java -cp .:acm.jar Chap6_ex1 The output i get is : Exception in thread "main" acm.util.ErrorException: Cannot determine the main class. at acm.program.Program.main(Program.java:1358) I don't understand what's the problem, all my earlier programs worked with no issues. I suspect the issue is caused by the fact that the RandomGenerator class is based on another class called Random from the java.util package but i don't know who to make the program work. import acm.util.* ; import java.util.*; import acm.program.*; import java.awt.* ; class Chap6_ex1 extends ConsoleProgram { public void run() { println("This program displays a randomly schosen card."); int number = rgen.nextInt(1 ,13); int suit = rgen.nextInt(1 ,4); cardNumber(number); print(" of "); suitNumber(suit); } private void cardNumber(int n){ switch (n) { case 1 : println("Ace"); break; case 11 : println("Jack"); break; case 12 : println("Queen"); break; case 13: println("King"); break; default : println(""+n); break; } } private void suitNumber (int n) { if(n == 1 ){ print("Clubs");} else if (n ==2 ){ print("Diamonds");} else if (n == 3){ print("Hearts");} else { print("Spades");} } private RandomGenerator rgen = RandomGenerator.getInstance(); }
has comment: http://stackoverflow.com/comment/35605215
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/23277796
tagged with: linux
type: UnansweredQuestion
has title: Exception in thread "main" acm.util.ErrorException: Cannot determine the main class.
has comment: http://stackoverflow.com/comment/35605339
tagged with: java

http://stackoverflow.com/q/23174838
type: AnsweredQuestion
score: 3
upvote count: 3
has answer: http://stackoverflow.com/a/23176331
tagged with: java
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/23175103
downvote count: 0
has title: Recursion Issue with unique solutions
accepted answer: http://stackoverflow.com/a/23176331
possible better answer: http://stackoverflow.com/a/23175103
tagged with: unique
favorite count: 0
has body: Out of curiosity, I wrote a program that calculates different number of combinations of Ski Ball roles that produce a certain score. The holes have values [0,10,20,30,40,50,100] that are held as enumerated values. There are also nine ball rolls. I treated each roll as recursively calling the next roll while looping through the values of each roll: private static void scoreCalc(int targetScore, int score, int ballNumber) { for(SkiBallHoles hole : SkiBallHoles.values()) { score += hole.getValue(); ballNumber--; if (ballNumber &gt; 0) { scoreCalc(targetScore, score, ballNumber); } if (ballNumber == 0 &amp;&amp; score == targetScore) { frequency++; } ballNumber++; score -= hole.getValue(); } } The scores themselves are fed to this function from a for loop in the main function into a chain of set up functions: while(score &lt;= 900){ writer.println(calculateFrequency(score)); score += 10; } private static String calculateFrequency(int targetScore) { frequency = 0; scoreCalc(targetScore); return targetScore + ": " + frequency; } private static void scoreCalc(int targetScore) { scoreCalc(targetScore, 0, BALLCOUNT); } The problem with this approach, is that is does not count the number of unique solutions. i.e. 0 0 0 0 0 0 0 0 10 is counted as different from 10 0 0 0 0 0 0 0 0 while they are really the same combination of values to produce a score. How can I modify my approach to only count unique solutions? Thanks =)
tagged with: recursion

http://stackoverflow.com/comment/35588504
has text: You can edit it again and again. You said you changed the order of adding components vs building/displaying your frame. Show that.
score: 0
comment on: http://stackoverflow.com/q/23256483
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35370975
score: 0
type: Comment
type: QuestionComment
has text: Thank you, it works! The problem was, like you said, that the XModelValidationRule wasn't on the class path. Adding the dependency containing the class solved the problem.
comment on: http://stackoverflow.com/q/23132980

http://stackoverflow.com/comment/36229222
type: AnswerComment
has text: I know how it works for annotation. I need similar for XML mapping.
comment on: http://stackoverflow.com/a/23589598
type: Comment
score: 0

http://stackoverflow.com/a/23271334
upvote count: 5
type: Answer
has comment: http://stackoverflow.com/comment/35615722
has comment: http://stackoverflow.com/comment/35615467
downvote count: 0
has comment: http://stackoverflow.com/comment/35615832
score: 5
has comment: http://stackoverflow.com/comment/112067492
has body: You're missing the following jars: google-oauth-client-1.18.0-rc.jar google-oauth-client-appengine-1.18.0-rc google-oauth-client-java6-1.18.0-rc google-oauth-client-jetty-1.18.0-rc google-oauth-client-servlet-1.18.0-rc Which can be found here: https://developers.google.com/api-client-library/java/apis/oauth2/v2 in the lib folder
accepted answer of: http://stackoverflow.com/q/23270817
answers question: http://stackoverflow.com/q/23270817
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35615672

http://stackoverflow.com/a/23173332
has comment: http://stackoverflow.com/comment/35439885
answers question: http://stackoverflow.com/q/23173258
score: 0
type: Answer
has body: Here's your problem: no such table: diaries The problem is most likely, since you said you reinstalled the app, that you haven't created the database or the table you're selecting from. EDIT: Now you posted the database creation script, there's a syntax error: private static final String CREATE_TABLE="create table "+ Constants.TABLE_NAME+" ("+ Constants.KEY_ID+" integer primary key autoincrement, "+ Constants.TITLE_NAME+" text not null, "+ Constants.CONTENT_NAME+" text not null, " ; You're leaving the parenthesis after Constants.TABLE_NAME open. After Constants.CONTENT_NAME, write: +" text not null)"

http://stackoverflow.com/a/23154459
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35406955
score: 4
type: Answer
upvote count: 4
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23153742
has body: Remove the throws Exception from the init method. Use try catch to prevent any exception from being thrown. Once you remove the exception declaration, the compiler will show you of any exceptions that may be thrown, so add try catch there.
answers question: http://stackoverflow.com/q/23153742

http://stackoverflow.com/q/23223898
has answer: http://stackoverflow.com/a/23223921
answer count: 6
has answer: http://stackoverflow.com/a/23224145
score: 0
has comment: http://stackoverflow.com/comment/35529447
has answer: http://stackoverflow.com/a/23224892
type: UnansweredQuestion
tagged with: regex
has answer: http://stackoverflow.com/a/23224154
tagged with: java
has answer: http://stackoverflow.com/a/23224010
has answer: http://stackoverflow.com/a/23223923
has title: why does java-regex \d match underscore? how do I fix this?
type: Question
has body: I have this pattern to match digits (and digits ONLY). But somehow it is looking like it also matches underscores. Pattern pattern = Pattern.compile("(\\d)*"); Matcher matcher = pattern.matcher("_"); System.out.println(matcher.find()); (This prints true meaning _ matches (\\d)*) Is this a bug???? (I understand that underscores are now part of the numeric literals (as of Java 1.7+) How do I alter my pattern so it'd exclude underscores? Edit: From the suggestions below, I've tried this [^_]*\\d*(which didn't work, btw)

http://stackoverflow.com/a/23168630
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23168490
answers question: http://stackoverflow.com/q/23168490
type: Answer
has body: Well, when you talk about peformance of TreeSet and HashSet you should clearly understand how these structures are organized what consequences of its organization. Typically TreeSet is a structure where all elements are organized in a binary tree. Thus adding a member or accessing it is ~O(log(N)). In other hand HashSet is a structure similar to an array. The difference is that in an array index is an unique number, while in a HashSet each key needs to be translated into index with the help of a hash function. A hash function may produce the same results for different input data, the situation is called hash collision. A good hash function (yes, they could be bad and good) produces as many unique results on a given set of input data as possible. So accessing data in a hash set costs calculations of a hash function (in Java usually this is .hashCode()) and possible conflict resolution. That is its estimated as O(1) i.e. a constant number of operations. You should understand that O(1) is not always less than O(log(n)), it's less asymptotically and on big enough n. Also a proper choice of a hash function does matter.
score: 3
upvote count: 3
type: AcceptedAnswer

http://stackoverflow.com/comment/35536560
comment on: http://stackoverflow.com/a/23225881
type: AnswerComment
score: 0
type: Comment
has text: If the file is very long this code will create X strings everytime, use a StringBuilder.

http://stackoverflow.com/comment/35406012
comment on: http://stackoverflow.com/q/23154391
score: 0
type: Comment
type: QuestionComment
has text: @Joffrey Very true, I'm guessing though once I figure out how to split the line into the two separate points I'd be able to repeat that process for the numbers?

http://stackoverflow.com/q/23282201
type: UnansweredQuestion
has body: I am working through my first web app in Java, I am using spring MVC, Maven, JPA, and Hibernate. I develop in C#.NET all day so I am familiar with debugging, but these java bean errors have me scratching my head. I am trying to put up a simple CRUD app following the IntelliJ tutorial but I am unable to load anything but the simple hello world page. How can I tell what frameworks my errors lie in, I have been looking through the stack trace for hours now and fixed a few things, but I am stuck. This sure is not C#. POM file: http://maven.apache.org/maven-v4_0_0.xsd"> 4.0.0 com.springapp XYZapp war 1.0-SNAPSHOT central Maven Central http://repo1.maven.org/maven2/ XYZapp <spring.version>3.2.0.RELEASE</spring.version> org.springframework spring-core ${spring.version} org.springframework spring-web ${spring.version} javax.servlet servlet-api 2.5 javax.servlet.jsp jsp-api 2.1 provided org.springframework spring-webmvc ${spring.version} org.springframework spring-test ${spring.version} test junit junit 4.8.2 test jstl jstl 1.2 org.springframework.data spring-data-jpa 1.2.0.RELEASE org.hibernate.javax.persistence hibernate-jpa-2.0-api 1.0.0.Final org.hibernate hibernate-entitymanager 3.6.10.Final org.hsqldb hsqldb 2.2.9 org.json json 20080701 org.apache.maven maven-repository-metadata 2.0.8 XYZapp maven-compiler-plugin 1.6 1.6 maven-surefire-plugin **/*Tests.java </project> Persistence: <?xml version="1.0" encoding="UTF-8"?> http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"> org.hibernate.ejb.HibernatePersistence MVC-dispatcher-servlet.xml <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:jpa="http://www.springframework.org/schema/data/jpa" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/…
has comment: http://stackoverflow.com/comment/35644088
tagged with: spring
has title: Spring and JPA app, how do I tell which framework the errors are in?
tagged with: java
tagged with: hibernate
type: Question
linked to: http://stackoverflow.com/q/12087011
tagged with: jpa
has answer: http://stackoverflow.com/a/23286536
score: 0
answer count: 1

http://stackoverflow.com/q/23261778
has answer: http://stackoverflow.com/a/25423749
tagged with: netty
has answer: http://stackoverflow.com/a/25856285
upvote count: 6
favorite count: 0
has comment: http://stackoverflow.com/comment/35629144
type: UnansweredQuestion
has title: Memory leak in netty API
type: Question
has comment: http://stackoverflow.com/comment/35613082
tagged with: java
answer count: 2
downvote count: 0
has body: I am new to netty API and I am using netty3.5.2 to develop client and server communication server, but the app always run full GC, I use jmap to dump the memory and use jhat to show which object occupied the memory. And there are 6413363 instances of DefaultChannelFuture. can someone tell which thread create the DefaultChannelFuture instances and how and when they will be released? Top 4 instances suspected 6413363 instances of class org.jboss.netty.channel.DefaultChannelFuture 631971 instances of class org.jboss.netty.util.internal.LinkedTransferQueue$Node 630934 instances of class org.jboss.netty.buffer.BigEndianHeapChannelBuffer 630767 instances of class org.jboss.netty.channel.DownStreamMessageEvent
has comment: http://stackoverflow.com/comment/35603269
score: 6

http://stackoverflow.com/a/23228580
answers question: http://stackoverflow.com/q/23228534
has comment: http://stackoverflow.com/comment/35537892
has comment: http://stackoverflow.com/comment/35538122
has comment: http://stackoverflow.com/comment/35537956
has comment: http://stackoverflow.com/comment/35537908
has comment: http://stackoverflow.com/comment/35538055
type: Answer
has comment: http://stackoverflow.com/comment/35538096
score: 0
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/35537974
has body: Note that if the resource returns null (meaning it doesn't exist), you will get this error. Check the input returned like so: String path = "/puppy.png"; try { InputStream is = getClass().getResourceAsStream(path); if (is == null) { //resource doesn't exist } else { BufferedImage image = ImageIO.read(is); } } catch(Exception ex) { ex.printStackTrace(); } Note that you most likely should be using String path = "puppy.png", seeing as you will already be in the content of the project folder.

http://stackoverflow.com/q/23200712
downvote count: 2
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/35487727
has comment: http://stackoverflow.com/comment/35487925
has comment: http://stackoverflow.com/comment/35487883
has comment: http://stackoverflow.com/comment/35487559
tagged with: adt
score: -1
tagged with: eclipse
has comment: http://stackoverflow.com/comment/35487966
has body: META-EDIT #2: On second thought, that's what I will do, as mocking up the question I would ask if I did make a new question ended up with a far different question from this one. META-EDIT: This question is getting quite long, does not have an answer, and has shifted in topic somewhat (to the point where I would ask a much different question if rewriting it from scratch, despite it still being the same problem). Should I continue to update it, or should I make a new question? I'm new here, so I don't know what the standard etiquette is for this. I am building an Android application that will allow the user to navigate a campus by inputting the number of the room they are currently in and the number of the room which they wish to get to. I think I am nearly finished, but (despite several weeks of fruitless work) I have been unable to fix one particular bug, which causes the program to crash with: java.lang.IllegalStateException: Could not execute method of the activity at android.view.View$1.onClick(View.java:3633) at android.view.View.performClick(View.java:4240) at android.view.View$PerformClick.run(View.java:17721) at android.on.Handler.handleCallback(Handler.java:730) at android.on.Handler.dispatchMessage(Handler.java:92) at android.os.Looper.loop(Looper.java:137) at android.app.ActivityThread.main(ActivityThread.java:5103) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Mathod.java:525) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) at dalvik.system.NativeStart.main(Native Method) Caused by: java.lang.reflect.InvokationTargetExeption at java.lang.reflect.Method.invokeNative(Native Method) at Java.lang.reflect.Method.invoke(Method.java:525) at android.view.View$1.onClick(View.java:3628) ... 11 more Caused by: java.lang.NullPointerException at ghamas.navigator.WorldMap.makePath(WorldMap.java:669) at ghamas.navigator.MainActi…
has comment: http://stackoverflow.com/comment/35487848
has title: Why is my Android application crashing with a NullPointerException?
has answer: http://stackoverflow.com/a/23200971
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/35487841
tagged with: nullpointerexception
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/35487795
has comment: http://stackoverflow.com/comment/35488370
tagged with: java

http://stackoverflow.com/a/23177244
score: 0
has comment: http://stackoverflow.com/comment/35447097
type: Answer
answers question: http://stackoverflow.com/q/23177132
has body: I managed to make all the alerts work here I had to include a div with id "map-canvas" in the body and move the loadMarkers() out of the main.js file.

http://stackoverflow.com/comment/35505213
comment on: http://stackoverflow.com/q/23210278
type: Comment
type: QuestionComment
score: 1
has text: Just wondering why you want to set it up as an arraylist and not just a 2D array?

http://stackoverflow.com/a/23314217
has body: What a nice distraction from grading database security papers! Proponents of "one big application user" have a lot of bad company in developers, managers and administrators who don't want to bother to learn about the DBMS they are using. All these DBMSes have a wealth of auditing and security functionality that can be invaluable if you leverage database-level users. Conversely OBAU throws this away. So I would use named, identified database users. However, I would rather secure each such named database user with LDAP authentication than database. (You can use an Oracle LDAP server but that's not the point.) I'd store the LDAP session credentials in the web session. Note we want the credentials to expire after some number of days or hours anyway! Oracle also has implemented "lightweight" sessions (11gR2?) that you can keep open rather than pooling them. I was never completely sold on connection pooling - why are database connections the only resource that administrators never grow along a "Moore's Law" line? You can continue to centralize your access by collecting synonyms and views into a single schema. You can also store the tables there and secure it with VPD/DBMS_RLS and it's always worked bulletproof for me in every way except my personal aesthetic sense. Once you're connected, have your sessions ALTER SESSION SET CURRENT_SCHEMA = CENTRALIZED_OWNER so that your programmers don't have to prefix each database object with CENTRALIZED_OWNER.tablename. Try to write your procedures (in Oracle) using AUTHID CURRENT_USER (or in other DBMSes' equivalents) to keep the privilege management under the actual end user. When your developers scream for access to the tables, GRANT proxy access to them for the table-owner schemas in that installation. It's a fabulous feature. Have a great day! Andrew Wolfe
has comment: http://stackoverflow.com/comment/35887882
type: Answer
has comment: http://stackoverflow.com/comment/35766728
answers question: http://stackoverflow.com/q/23252967
has comment: http://stackoverflow.com/comment/35701114
has comment: http://stackoverflow.com/comment/35714442
score: 1
has comment: http://stackoverflow.com/comment/35724464
has comment: http://stackoverflow.com/comment/35694714
upvote count: 2
has comment: http://stackoverflow.com/comment/35714897
has comment: http://stackoverflow.com/comment/35701643
downvote count: 1

http://stackoverflow.com/q/23211029
tagged with: javascript
tagged with: jquery
answer count: 2
has body: I have a drop down as shown in snap below I Need to handle the multiselect by clicking on the checkbox corresponding to the name. I am using data-driven framework. I am fetching data from excel. Right now I have written code to click on the arrow in the drop down and then click on the corresponding checkbox. I need a better solution to handle multiple selection like this.
downvote count: 0
has comment: http://stackoverflow.com/comment/35507418
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23222509
has comment: http://stackoverflow.com/comment/35525465
has title: In Selenium Webdriver how to handle this kind of multi select dropdown which contains checkbox
tagged with: selenium-webdriver
score: 3
upvote count: 3
tagged with: java
tagged with: selenium
has answer: http://stackoverflow.com/a/23218732
has comment: http://stackoverflow.com/comment/35506906
type: Question

http://stackoverflow.com/comment/35712858
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23238765
type: Comment
has text: I have to add one thing. After learning some things about libgdx and android i realized that i have to use textures with "POWER OF TWO". Some of mine weren't power of two. After changing thouse it fixed completely and i don't have to reload all my textures. Still your method was usefull and i thank you for that.

http://stackoverflow.com/q/23132009
type: Question
has answer: http://stackoverflow.com/a/23132124
has comment: http://stackoverflow.com/comment/35368488
has comment: http://stackoverflow.com/comment/35368041
has comment: http://stackoverflow.com/comment/35390055
has comment: http://stackoverflow.com/comment/35368709
has comment: http://stackoverflow.com/comment/35365795
has comment: http://stackoverflow.com/comment/35367072
tagged with: file-io
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/35368871
favorite count: 0
has title: Java Large File Upload throws java.io.IOException: Map failed
has comment: http://stackoverflow.com/comment/35366057
has body: I am using Spring and Hibernate and try to upload large file but when i try to upload more then 150 Mb then it is generating error like Caused by: java.lang.OutOfMemoryError: Map failed at sun.nio.ch.FileChannelImpl.map0(Native Method) at sun.nio.ch.FileChannelImpl.map(FileChannelImpl.java:755) ... 157 more I am using windows 64bit OS. After lots of googling i find that this is bug available in JDK. Can any one help me to solve this issue? Some one write about this issue https://github.com/MLCL/Byblo/issues/78. but i am not sure this is bug or not. if bug then how can i resolve it. It any other appropriate solution for this.
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35365830
has comment: http://stackoverflow.com/comment/35365903
tagged with: spring
has comment: http://stackoverflow.com/comment/35365725
has comment: http://stackoverflow.com/comment/35367769
linked to: http://stackoverflow.com/q/19016512
downvote count: 0
has comment: http://stackoverflow.com/comment/35394045
score: 1
tagged with: java
linked to: http://stackoverflow.com/q/12688778
has comment: http://stackoverflow.com/comment/35367790

http://stackoverflow.com/q/23249135
accepted answer: http://stackoverflow.com/a/23249412
answer count: 1
downvote count: 1
favorite count: 0
has title: How to find maven dependency that are not used?
has answer: http://stackoverflow.com/a/23249412
tagged with: maven
has body: For IntelliJ Maven project how do I know which dependency in the POM was not used in the Java codes in the project, is there a tool for that?
type: AnsweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/35574336
type: Question
upvote count: 2
tagged with: intellij-idea

http://stackoverflow.com/comment/35534173
type: Comment
comment on: http://stackoverflow.com/a/23194405
score: 0
type: AnswerComment
has text: Thanks zoyd for your answer, i found the reason behind it, in my machine java 1.6_34 - where as in my friend's machine java 1.6_25 was installed. When we checked result after upgrading java, on both the machines result was same.

http://stackoverflow.com/q/23225687
score: 0
has answer: http://stackoverflow.com/a/23225983
tagged with: compare
has title: how can i compare two simpledateformat types in java with the following spec "dd/MM/yyyy hh:mm:ss a"
has body: Hi i have two strings created from the simpleDateFormat type in java. They are as follows: "dd/MM/yyyy hh:mm:ss a" How can i compare two strings that have that format and know which is the latest?
has comment: http://stackoverflow.com/comment/35532440
has comment: http://stackoverflow.com/comment/35532466
downvote count: 1
has comment: http://stackoverflow.com/comment/35532807
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23225835
accepted answer: http://stackoverflow.com/a/23225835
has comment: http://stackoverflow.com/comment/35532495
tagged with: simpledateformat
tagged with: java
linked to: http://stackoverflow.com/q/4216745
type: Question
answer count: 2
upvote count: 1
possible better answer: http://stackoverflow.com/a/23225983
favorite count: 0
has comment: http://stackoverflow.com/comment/35532402

http://stackoverflow.com/comment/35412661
type: Comment
comment on: http://stackoverflow.com/q/23158195
type: QuestionComment
has text: is that an android library or just java
score: 0

http://stackoverflow.com/a/23248462
has body: I don't recommend the NullObject pattern because I always find myself in one of these 2 situations: it does not make sense to use NullObject like an object, and it should stay null NullObject has too much meaning to be just a NullObject, and should be a true object itself (for instance, when it acts like a fully functional default value) According to our discussion in the comments, it seems to me that your NullObject behaves very much like the 0 value of your normal objects. What I would do is actually use 0 (or whatever default value makes more sense), and put a flag if you really need to know whether it has been initialized. This way, you will have 2 things to consider: all uninitialized values won't share the same instance with my solution for the very same reason, you are now able to initialize your object later without having to create a new instance Here is the kind of code I think of: public static class VerySimpleFoo implements Foo { private int value; private boolean initialized; public VerySimpleFoo() { this.value = 0; // whatever default value makes more sense this.initialized = false; } public VerySimpleFoo(int value) { this.value = value; this.initialized = true; } @Override public int compareTo(Foo f) { // possibly need some distinction here, depending on your default value // and the behavior you expect return Integer.valueOf(value).compareTo(f.getValue()); } @Override public int getValue() { return value; } public void setValue(int value) { this.value = value; this.initialized = true; } public boolean isInitialized() { return initialized; } }
answers question: http://stackoverflow.com/q/23246740
score: 2
type: Answer
has comment: http://stackoverflow.com/comment/35573212
has comment: http://stackoverflow.com/comment/35573269
upvote count: 2
has comment: http://stackoverflow.com/comment/35573261
downvote count: 0
has comment: http://stackoverflow.com/comment/35573370

http://stackoverflow.com/comment/35531926
has text: MATLAB blocks on fopen for sure. According this [document](http://www.mathworks.com/help/instrument/writing-and-reading-data_f16-57447.html#btfksnp), fscanf will work with just one argument. The unrestricted tcpip form does not change anything, although is a better way to do it.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23192158

http://stackoverflow.com/q/23258112
type: Question
score: 0
has comment: http://stackoverflow.com/comment/42984766
has body: I have an application that records a video and then uploads it to a server. However, when I try to play the video back, I find that its rotation changes without me doing such a thing. Do you have any idea why this happens ? knowing that when I play the video from the local storage, its rotation is preserved as it was recorded. So, whatever happens, happens during the upload.
tagged with: android
has title: Android video upload to server changes rotation 90° without any reason
tagged with: video
answer count: 0
type: UnansweredQuestion
tagged with: http
tagged with: video-streaming
tagged with: java
has comment: http://stackoverflow.com/comment/42975783

http://stackoverflow.com/comment/35368194
comment on: http://stackoverflow.com/q/23133272
score: 0
type: QuestionComment
type: Comment
has text: You might want to start by looking at swing: http://docs.oracle.com/javase/tutorial/uiswing/

http://stackoverflow.com/a/23174775
answers question: http://stackoverflow.com/q/23174748
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23174748
type: Answer
has body: Just Move the below line before calling frame.setOpacity(0.75f); frame.setUndecorated(true);
upvote count: 1
has comment: http://stackoverflow.com/comment/35442477
score: 1

http://stackoverflow.com/comment/35429670
comment on: http://stackoverflow.com/q/23167232
has text: `System.out.println("Inside my loadData() method");`
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35549451
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/23234780
has text: `I wanted the jscrollpane to be update (when I move a shape out of panel)` - then you use `panel.realidate()`.

http://stackoverflow.com/q/23188863
possible better answer: http://stackoverflow.com/a/23188882
has title: Make a double 0.00 display as 0.00 in Java
has answer: http://stackoverflow.com/a/23188947
has answer: http://stackoverflow.com/a/23188879
upvote count: 3
has answer: http://stackoverflow.com/a/23188923
has body: I am making a fake bank application, where they have a double that starts out at 0.00 Double dblCurrentBalance = 0.00; DecimalFormat decim = new DecimalFormat("##.00"); jlInput2.setText("Your Balance: $" + Double.parseDouble(decim.format(dblCurrentBalance))); But it seems to only display: Your balance: $0.0 When I want: Your balance: $0.00 If I have it set to 1.1111111 It'll display 1.11 So how do I get keep the second 0?
type: AnsweredQuestion
score: 3
tagged with: java
accepted answer: http://stackoverflow.com/a/23188879
type: Question
downvote count: 0
linked to: http://stackoverflow.com/q/3730019
favorite count: 0
has answer: http://stackoverflow.com/a/23188882
has comment: http://stackoverflow.com/comment/35467487
has comment: http://stackoverflow.com/comment/35467574
answer count: 4

http://stackoverflow.com/comment/85302483
comment on: http://stackoverflow.com/a/23157281
has text: Is there a Maven dependency for the same?
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/35445643
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23176551
has text: Yep got one will post in above

http://stackoverflow.com/comment/35380497
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23139380
has text: @jameslarge Yes they are.

http://stackoverflow.com/a/23261485
answers question: http://stackoverflow.com/q/23261128
type: Answer
upvote count: 3
score: 3
downvote count: 0
has body: As you say maximum element in your cache may e a very big number but following is one of the solution. Iterate over the array. Lets say maximum element that the array holds is m. For each index i get the element it holds let it be array[i] Now go to the index array[i] and add m to it. Do above for all the indexes in array. Finally iterate over the array and return index with maximum element. TC -> O(N) SC -> O(1) It may not be feasible for large m as in your case. But see if you can optimize or alter this algo.

http://stackoverflow.com/comment/35432046
has text: post xml this code looks fine
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/23168955

http://stackoverflow.com/comment/35540221
type: Comment
has text: Reading: http://glauche.de/2009/09/09/java-util-logging-vs-slf4j/
comment on: http://stackoverflow.com/q/23229763
score: 3
type: QuestionComment

http://stackoverflow.com/comment/35498016
comment on: http://stackoverflow.com/q/23206154
score: 0
type: Comment
type: QuestionComment
has text: No, but how would you run it from the command line?

http://stackoverflow.com/comment/35498620
score: 1
has text: You can use an application to recover deleted files (just search for *recover deleted files* in your favorite SEO and you will get plenty of apps that do this). And I don't think this is Eclipse's (nor any other IDE) doing, but your own OS or another application.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23206535

http://stackoverflow.com/q/23192136
has title: Get integer array in Hadoop's Reducer
has comment: http://stackoverflow.com/comment/35478066
has comment: http://stackoverflow.com/comment/35508449
score: 0
answer count: 2
has body: I am calling a cuda code to get a sum of all the values for each key. The purpose is to decrease the time taken by reducer by paralleling the operation. But, the values in the reducer are in IntWritable form. So, I have to convert them to an array of integers for passing to cuda code. Here is my reducer code: public static class IntSumReducer extends Reducer&lt;Text, IntWritable, Text, IntWritable&gt; { private IntWritable result = new IntWritable(); public void reduce(Text key, Iterable&lt;IntWritable&gt; values, Context context) throws IOException, InterruptedException { List&lt;Integer&gt; numbers = new ArrayList&lt;Integer&gt;(); for(IntWritable val : values) numbers.add(val.get()); } int[] ret = ArrayUtils.toPrimitive(numbers.toArray(new Integer[numbers.size()])); result.set(Main.sumNumbers(ret)); context.write(key,result); } } The problem is that for converting IntWritable to Integer array, I have to iterate through each of the value which is a serial operation. So, it is increasing the time even more. So, is there any way by which I do not have to iterate through each of the value and directly convert to int array? Here is the mapper code : public static class TokenizerMapper extends Mapper&lt;Object, Text, Text, IntWritable&gt; { private final static IntWritable one = new IntWritable(1); private Text word = new Text(); public void map(Object key, Text value, Context context) throws IOException, InterruptedException { StringTokenizer itr = new StringTokenizer(value.toString()); while (itr.hasMoreTokens()) { word.set(itr.nextToken()); context.write(word, one); } } } Here is my cuda code : #include &lt;stdio.h&gt; #ifndef _ADDARRAY_KERNEL_H_ #define _ADDARRAY_KERNEL_H_ #ifdef __cplusplus extern "C" { #endif __global__ void add_array(int *a, int *c, int N) { *c = 0; int i; for(i = 0; i&lt;N;i++) { *c = *c + a[i]; } } #ifdef __cplusplus } #endif #endif // #ifndef _ADDARRAY_KERNEL_H_ #ifdef __cplusplus extern "C" { #endif int cuda_sum(int *a_h, int N) { int *a_d, …
has comment: http://stackoverflow.com/comment/35484338
has answer: http://stackoverflow.com/a/23195448
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35479523
has comment: http://stackoverflow.com/comment/35484280
has answer: http://stackoverflow.com/a/23212468
tagged with: java
tagged with: mapreduce
type: Question
has comment: http://stackoverflow.com/comment/35480068
tagged with: hadoop

http://stackoverflow.com/comment/35539881
comment on: http://stackoverflow.com/q/23229613
score: 0
type: Comment
type: QuestionComment
has text: All the elements need to implement the Comparable interface. That should give you a big hint about how to start.

system-calls
type: Tag
tags question: http://stackoverflow.com/q/23163545
tag name: system-calls

http://stackoverflow.com/a/23144365
has body: I do not hold a degree in crypto, so take this with a grain of salt. You have two major areas of concern here: Your primes need to be unpredictably random. This means that you need to use a source such as SecureRandom to generate your primes. No matter how sure of your primality, if they are predictable, the entire cryptosystem fails to meet its goal. If you are using the BigInteger(int bitLength, int certainty, Random rnd) constructor, you can pass in your SecureRandom as it subclasses Random. Your potential primes need to be reasonably certain of being primes (I'm assuming that you are using an algorithm that relies on the hardness of factoring). If you get a probable prime, but an attacker can, with a good probability, factor it within 5 minutes because it had a factor that never got noticed by the primality test you ran, you are somewhat out of luck with your algorithm. Rabin-Miller is generally used, and this answer states that a certainty of 15 is sufficient for 32-bit integers. A value up to 40 is recommended, and anything beyond that is meaningless.
upvote count: 5
downvote count: 0
answers question: http://stackoverflow.com/q/23144236
has comment: http://stackoverflow.com/comment/35612386
has comment: http://stackoverflow.com/comment/35391616
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35391490
type: Answer
accepted answer of: http://stackoverflow.com/q/23144236
has comment: http://stackoverflow.com/comment/35715826
has comment: http://stackoverflow.com/comment/35601553
has comment: http://stackoverflow.com/comment/35638923
score: 5

http://stackoverflow.com/comment/35490698
type: Comment
comment on: http://stackoverflow.com/a/23202248
score: 1
has text: @Luiggi: That downvote makes no sense to me at all. Maybe OP wants that as a step to get to know `Scanner` and input. It is obviously nowhere near a complete program anyway.
type: AnswerComment

http://stackoverflow.com/comment/35430664
type: QuestionComment
score: 3
has text: Consider using a ProgressMonitorInputStream for this.
comment on: http://stackoverflow.com/q/23167319
type: Comment

http://stackoverflow.com/q/23285339
has comment: http://stackoverflow.com/comment/93118765
tagged with: java
downvote count: 3
type: Question
upvote count: 15
answer count: 2
tagged with: frameworks
tagged with: jboss
has answer: http://stackoverflow.com/a/39655298
score: 12
tagged with: jbpm
tagged with: redhat
has body: I am java developer. I am developing a new application. In this application am going to integrate JBPM, spring and hibernate also. So please, answer my below questions, what is JBPM? Why use it? What is workflow engine? please give any example. Thanks for your answer.
favorite count: 0
has answer: http://stackoverflow.com/a/23285372
type: UnansweredQuestion
has title: What is JBPM? Why use it?

http://stackoverflow.com/q/23185354
has comment: http://stackoverflow.com/comment/35460480
has comment: http://stackoverflow.com/comment/35460711
has body: I'm trying to send json (java Android): This is full code. HttpPost httppost = new HttpPost("http://example.com"); try { List&lt;NameValuePair&gt; nameValuePairs = new ArrayList&lt;NameValuePair&gt;(2); nameValuePairs.add(new BasicNameValuePair("login", "qwerty")); nameValuePairs.add(new BasicNameValuePair("password", "123457")); HttpEntity entity = new UrlEncodedFormEntity(nameValuePairs); httppost.setEntity(entity); // Headers httppost.setHeader("Content-Type", "application/json"); HttpResponse response = new DefaultHttpClient().execute(httppost); responseString = EntityUtils.toString(response.getEntity()); System.out.println(responseString); return responseString; } catch (Exception e) { System.out.println("error"); return ""; } Server php code: &lt;?php $response[] = array( 'postcount' =&gt; count($_POST), // Get count $_POST 'get' =&gt; count($_GET), 'request' =&gt; count($_REQUEST) ); echo json_encode($response); ?&gt; System.out.println(request) - // And i get [{"postcount":null,"get":null,"request":null}] Request send successfull, but parameters miss. Help please :)
has comment: http://stackoverflow.com/comment/35460641
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35460520
tagged with: android
has comment: http://stackoverflow.com/comment/35460799
has comment: http://stackoverflow.com/comment/35461085
has comment: http://stackoverflow.com/comment/35470184
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: post
has comment: http://stackoverflow.com/comment/35460586
type: Question
has comment: http://stackoverflow.com/comment/35460788
has comment: http://stackoverflow.com/comment/35460609
has comment: http://stackoverflow.com/comment/35460541
has title: Android json send data
score: 0

http://stackoverflow.com/comment/35535594
comment on: http://stackoverflow.com/a/23227239
type: Comment
score: 0
type: AnswerComment
has text: Thank you! So `(int)((Math.random() * ((long)Integer.MAX_VALUE-Integer.MIN_VALUE) + Integer.MIN_VALUE))` is a bad idea to choose a randome int, because it is nearly never Integer.MAX_VALUE?

http://stackoverflow.com/q/23234134
has body: There is a class which has a static method : ChangePanel which will change the content of a static JPanel to new content. Frame is the variable name of the static JPanel . public static void ChangePanel(JPanel jp) { Javaassignment1b.Driver.Frame.getContentPane().removeAll(); Javaassignment1b.Driver.Frame.add(jp); Javaassignment1b.Driver.Frame.validate(); } This static method works as expected when it is implemented on a JPanel whose functionality is added by actionlistener. Example public class AdminLoginPanel extends JPanel { AdminLoginPanel() { pwlabel = new JLabel("Password"); pwfield = new JPasswordField(20); loginbutton = new JButton("Login"); loginbutton.addActionListener(new LoginButtonListener()); add(pwlabel); add(pwfield); add(loginbutton); } private class LoginButtonListener implements ActionListener { public void actionPerformed(ActionEvent event) { char[] password = pwfield.getPassword(); //convert from char array to String String password2 = new String(password); admin = new Admin(); if (admin.checkPassword(password2)) { //show Admin panel //works in this case AdminMenuPanel amp = new AdminMenuPanel(); Utility.ChangePanel(amp); } else { //text box appear to state password is incorrect ErrorMessagePanel emp = new ErrorMessagePanel("Wrong password, please try again"); } } } JLabel pwlabel; JPasswordField pwfield; JButton loginbutton; Admin admin; } I dont understand why is it not working when I try to change the content of the static JPanel through the return value of JOptionPane public class RetryPanel extends JPanel { RetryPanel() { jp = new JOptionPane(); //reply will be 1 for No , 0 for yes int reply = JOptionPane.showConfirmDialog(null,"Would you like to start a new game ???","Message Title",JOptionPane.YES_NO_OPTION ); if ( reply == 0) { //player wants to play a new game , retry } else { //player wants to quit //doesnt work in this case SelectAdminUserPanel saup = new SelectAdminUserPanel(); Utility.ChangePanel(saup); } } JOptionPane jp; } Using a …
linked to: http://stackoverflow.com/q/5665156
has comment: http://stackoverflow.com/comment/35548021
has title: Static JPanel content is not being updated
answer count: 0
type: UnansweredQuestion
tagged with: swing
has comment: http://stackoverflow.com/comment/35547814
tagged with: debugging
tagged with: java
tagged with: jpanel
type: Question
score: 0
has comment: http://stackoverflow.com/comment/35547866

http://stackoverflow.com/a/23272870
has body: Have you ever heard about Feature Envy or Law of Demeter? Feature Envy: Methods that make extensive use of another class may belong in another class. Consider moving this method to the class it is so envious of. You should move your process mostly based on player values in the player class, resolving thus your problem and not involving ugly getters and setters. Metaphor: If I need every day an a money transfer to my account, I have two choices: Asking for all the data to the bank and prepare my transfer myself. Potentially error prone since I would be able to avoid any potential strict rules set by the bank. I tell the bank employee: "Please transfer this money to my account " (without needing to ask for any data !) Obviously, 2) is logically advised. Asking is against the essence object-oriented programming. Telling/Sending messages is THE essence. In very rare cases, asking is needed. Good habits are taken since the first year ;)
score: 1
has comment: http://stackoverflow.com/comment/35618332
has comment: http://stackoverflow.com/comment/35618108
answers question: http://stackoverflow.com/q/23272587
downvote count: 0
has comment: http://stackoverflow.com/comment/35618203
type: Answer
upvote count: 1

http://stackoverflow.com/a/23170774
type: Answer
score: 3
downvote count: 0
has body: You can use online tools like grepcode.com, which will identify you the jar names and maven artifacts. Here is an example for apache commons-lang StringUtils.
has comment: http://stackoverflow.com/comment/35435240
answers question: http://stackoverflow.com/q/23170684
upvote count: 3
has comment: http://stackoverflow.com/comment/35435261

http://stackoverflow.com/comment/35496351
comment on: http://stackoverflow.com/a/23204951
score: 0
type: AnswerComment
has text: I still cannot make my code run... Thx for your help though
type: Comment

http://stackoverflow.com/comment/35638551
score: 0
comment on: http://stackoverflow.com/q/23283365
has text: where you are passing Context in `ListViewAdapter` class constructor ?
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23290054
tagged with: google-cast
has title: integrating android chromecast application with a login page results in NullPointerException (NPE)
has comment: http://stackoverflow.com/comment/35760941
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/35691306
type: UnansweredQuestion
tagged with: android
tagged with: android-intent
has body: I have changed the CastVideos Android application (https://github.com/googlecast/CastVideos-android) to integrate a login page. Conceptually, instead of setting VideoBrowserActivity to be the main activity that launches when the app starts, I set my own login activity. My AndroidManifest.xml looks something like the following (details omitted). &lt;activity android:name="com.x.y.z.LoginActivity" android:noHistory="true"&gt; &lt;intent-filter&gt; &lt;action android:name="android.intent.action.MAIN" /&gt; &lt;category android:name="android.intent.category.LAUNCHER" /&gt; &lt;/intent-filter&gt; &lt;/activity&gt; &lt;activity android:name="com.x.y.z.VideoBrowserActivity"&gt; &lt;/activity&gt; Please note the android:noHistory="true" attribute for the LoginActivity. After a user logs into my application, I don't want the user to be able to get back to this activity by pressing the back button. When a user successfully logs in, the VideoBrowserActivity (unaltered, except for package name) is started. Intent intent = new Intent(this, com.x.y.z.VideoBrowserActivity); startActivity(intent); I then press the back button, and I immediately exit the app and to the home screen. This behavior is what I expect. However, when I long press the home button to get a list of apps, I get the message: Unfortunately, APP has stopped. LogCat shows the following NPE. 04-25 05:58:11.745: E/AndroidRuntime(8305): FATAL EXCEPTION: main 04-25 05:58:11.745: E/AndroidRuntime(8305): java.lang.NullPointerException 04-25 05:58:11.745: E/AndroidRuntime(8305): at com.google.sample.castcompanionlibrary.cast.VideoCastManager$UpdateNotificationHandlerCallback.handleMessage(VideoCastManager.java:2000) 04-25 05:58:11.745: E/AndroidRuntime(8305): at android.os.Handler.dispatchMessage(Handler.java:95) 04-25 05:58:11.745: E/AndroidRuntime(8305): at android.os.Looper.loop(Looper.java:137) 04-25 05:58:11.745: E/AndroidRuntime(8305): at android.app.ActivityThread.main(ActivityThread.java:5293) 04-25 05:58:11.745:…
answer count: 0
score: 1
tagged with: java
upvote count: 1
type: Question

http://stackoverflow.com/comment/35633713
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23280692
has text: Take a look at this question as well: http://stackoverflow.com/questions/11866686/opengl-es-depth-buffer-android-cant-get-to-work
score: 0

http://stackoverflow.com/comment/35629039
has text: Do you have other threads?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23278448

http://stackoverflow.com/a/23288493
score: 14
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23288439
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23288439
has body: ArrayList index starts from 0(Zero) Your array list size is 0, and you are adding String element at 1st index. Without adding element at 0th index you can't add next index positions. Which is wrong. So, Simply make it as s.add("Elephant"); Or you can s.add(0,"Elephant");
upvote count: 14
type: Answer

http://stackoverflow.com/comment/35456883
score: 0
has text: it is all OS dependent for windows/linux first search the command for getting RAM size. Now execute the command using java. For window it is "wmic ComputerSystem get TotalPhysicalMemory" use the following for running cmd commands `Runtime.getRuntime().exec(String.format("cmd /c %s", query));` where querty is command
type: Comment
comment on: http://stackoverflow.com/a/23179928
type: AnswerComment

http://stackoverflow.com/q/23187663
upvote count: 2
downvote count: 1
favorite count: 0
type: UnansweredQuestion
has title: Searching through a MongoDB database
tagged with: recursion
answer count: 0
has body: Sorry for the vague post title; I couldn't figure out how to describe my situation. I have a collection full of documents like this: { author: "Bob", category: "A" } { author: "Bob", category: "B" } { author: "Jeff", category: "B" } { author: "Jeff", category: "C" } { author: "Jim", category: "C" } { author: "TheOddOne", category: "D" } I want to get all of the documents that are associated with an author, then get all of the documents associated with the categories of those documents. I then want to get all of the documents associated with the authors of the matched documents, and then all of the documents in those authors' categories, and so on. I knew this would be hard to explain in words, so this is why I have a sample dataset and "query". Running this query using Bob should return all of the records in the above dataset except for the one in category D, because that document is not linked to the others. Thanks in advance. To be clear, I'm looking for a way to do this that isn't just a brute-force recursive algorithm that would have O(nn) queries for a certain dataset.
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/35465343
type: Question
tagged with: mongodb
tagged with: search

binary-search-tree
tags question: http://stackoverflow.com/q/23184957
tags question: http://stackoverflow.com/q/23159045
tags question: http://stackoverflow.com/q/23178926
tags question: http://stackoverflow.com/q/23161855
type: Tag
tags question: http://stackoverflow.com/q/23164940
tags question: http://stackoverflow.com/q/23249632
tags question: http://stackoverflow.com/q/23260112
tags question: http://stackoverflow.com/q/23250764
tag name: binary-search-tree
tags question: http://stackoverflow.com/q/23176905

http://stackoverflow.com/comment/35630049
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23278469
has text: **I'd say the biggest problem is that your results are probably rather [fictional](http://code.google.com/p/caliper/wiki/JavaMicrobenchmarks).** If you want to measure how it performs in reality, you really need caliper or [JMH](http://openjdk.java.net/projects/code-tools/jmh).
score: 0

http://stackoverflow.com/a/23197304
answers question: http://stackoverflow.com/q/23188597
score: 1
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: I figured it out. It is because I was using the grow attribute for each component. The proper attribute to use is growx. public static void main(String[] args) { JPanel panel1 = new JPanel(new MigLayout(new LC().fill())); panel1.add(new JTextField("text1"), "span, growx"); panel1.add(new JTextField("another text field"), "span, growx"); panel1.add(new JTextField("text3"), "span, growx"); JPanel panel2 = new JPanel(new MigLayout()); JTextArea textArea = new JTextArea(); textArea.setColumns(15); textArea.setRows(7); JScrollPane jsp = new JScrollPane(textArea); panel2.add(jsp, "span, grow"); JFrame frame = new JFrame(); frame.setLayout(new GridLayout(1, 2)); frame.add(panel1); frame.add(panel2); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); }
accepted answer of: http://stackoverflow.com/q/23188597
upvote count: 1

http://stackoverflow.com/comment/35477905
score: 0
has text: @maxx777 the generated servlet will recognize ${result.fname} as static value..
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23195247

http://stackoverflow.com/comment/35610461
type: QuestionComment
comment on: http://stackoverflow.com/q/23268582
score: 0
has text: Primary Safari Version 7.0.3, but also tried others(i.e Firefox).
type: Comment

http://stackoverflow.com/a/23208424
score: 0
answers question: http://stackoverflow.com/q/23208088
has body: Replacing your hsa.Console with a java.io.Console will fix your errors. I.e. import java.io.Console; ... c = System.console(); ... Then use c.printf(...) instead of c.println().
type: Answer
has comment: http://stackoverflow.com/comment/35502191

http://stackoverflow.com/q/23278907
linked to: http://stackoverflow.com/q/15449022
upvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/35630238
favorite count: 0
score: -3
has body: I looking for create mechanism for messaging when exiting and changes has been made. I want it to display a messagebox asking the user : ( Are you sure you don't want to save the changes - yes / no) Upon closing the form by clicking on the button named 'Exit' or when use close button, ''X". Don't know the syntax for it, can someone help me please?
has answer: http://stackoverflow.com/a/23279271
has comment: http://stackoverflow.com/comment/35630175
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35630102
tagged with: java
tagged with: messagebox
downvote count: 3
type: Question
has comment: http://stackoverflow.com/comment/35630938
has title: MessageBox when closing

http://stackoverflow.com/comment/35430854
has text: @qqilihq I was also looking at the ways I can reduce the number of times the iterator run.
comment on: http://stackoverflow.com/q/23167965
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23144353
answer count: 6
tagged with: java
has comment: http://stackoverflow.com/comment/65877098
linked to: http://stackoverflow.com/q/1793979
has body: My application has a personal keystore containing trusted self-signed certificates for use in the local network - say mykeystore.jks. I wish to be able to connect to public sites(say google.com) as well as ones in my local network using self-signed certificates which have been provisioned locally. The problem here is that, when I connect to https://google.com, path building fails, because setting my own keystore overrides the default keystore containing root CAs bundled with the JRE, reporting the exception sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target However, if I import a CA certificate into my own keystore(mykeystore.jks) it works fine. Is there a way to support both? I have my own TrustManger for this purpose, public class CustomX509TrustManager implements X509TrustManager { X509TrustManager defaultTrustManager; public MyX509TrustManager(KeyStore keystore) { TrustManagerFactory trustMgrFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); trustMgrFactory.init(keystore); TrustManager trustManagers[] = trustMgrFactory.getTrustManagers(); for (int i = 0; i &lt; trustManagers.length; i++) { if (trustManagers[i] instanceof X509TrustManager) { defaultTrustManager = (X509TrustManager) trustManagers[i]; return; } } public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException { try { defaultTrustManager.checkServerTrusted(chain, authType); } catch (CertificateException ce) { /* Handle untrusted certificates */ } } } I then initialize the SSLContext, TrustManager[] trustManagers = new TrustManager[] { new CustomX509TrustManager(keystore) }; SSLContext customSSLContext = SSLContext.getInstance("TLS"); customSSLContext.init(null, trustManagers, null); and set the socket factory, HttpsURLConnection.setDefaultSSLSocketFactory(customSSLContext.getSocketFactory());…
score: 25
tagged with: jsse
has answer: http://stackoverflow.com/a/54877748
downvote count: 0
tagged with: ssl
type: UnansweredQuestion
has title: How do I initialize a TrustManagerFactory with multiple sources of trust?
has answer: http://stackoverflow.com/a/65380810
has answer: http://stackoverflow.com/a/65323132
type: Question
has answer: http://stackoverflow.com/a/23254972
favorite count: 0
has answer: http://stackoverflow.com/a/35759057
has answer: http://stackoverflow.com/a/35462008
upvote count: 25
tagged with: x509

http://stackoverflow.com/q/23225144
has answer: http://stackoverflow.com/a/23481602
has answer: http://stackoverflow.com/a/23679585
has answer: http://stackoverflow.com/a/23535616
tagged with: eclipse-fragment
upvote count: 4
answer count: 3
downvote count: 0
tagged with: jacorb
favorite count: 0
has comment: http://stackoverflow.com/comment/36510195
tagged with: classloader
has comment: http://stackoverflow.com/comment/35540091
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35531343
score: 4
has comment: http://stackoverflow.com/comment/36254733
tagged with: java
tagged with: eclipse
type: Question
has title: Java 7u55 Eclipse System Fragment Classloader
has comment: http://stackoverflow.com/comment/37135582
has body: In previous versions of Java I was able to use a fragment that had a host of system-bundle in order to provide classes to the boot classloader. In my particular case this was to support using Jacorb in Eclipse. This all worked fine prior to Java 7u55. I created an osgi fragment that contained all the jars for Jacorb. The manifest looks like this: Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: org.jacorb.systemFragment Bundle-SymbolicName: org.jacorb.systemFragment Bundle-Version: 3.3.0.20140422-1108 Bundle-ClassPath: jars/slf4j-jdk14-1.6.4.jar, jars/slf4j-api-1.6.4.jar, jars/jacorb-3.3.jar Fragment-Host: system.bundle; extension:=framework Export-Package: org.jacorb.config;version="3.3.0", .... I also specify the following as vm args: -Dorg.omg.CORBA.ORBClass=org.jacorb.orb.ORB -Dorg.omg.CORBA.ORBSingletonClass=org.jacorb.orb.ORBSingleton -Dorg.omg.PortableInterceptor.ORBInitializerClass.standard_init=org.jacorb.orb.standardInterceptors.IORInterceptorInitializer When I ran my Eclipse application in Java 7u51 I am able to call ORB.init() successfully. When I run the same application in Java 7u55 I get the following: Caused by: java.lang.ClassNotFoundException: org.jacorb.orb.ORBSingleton at java.net.URLClassLoader$1.run(URLClassLoader.java:366) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:354) at java.lang.ClassLoader.loadClass(ClassLoader.java:425) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at java.lang.ClassLoader.loadClass(ClassLoader.java:358) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:270) at org.omg.CORBA.ORB.create_impl_with_systemclassloader(ORB.java:306) If I add the following as vmargs it works. -Djava.endorsed.dirs=${jacorb/lib} I confirmed that this effects Java 7u55 Java 6u30 and Java 8u5 I didn't need to do this before. Any ideas why? --- EDIT 04/30 -…

http://stackoverflow.com/a/23192453
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23192323
type: Answer
has comment: http://stackoverflow.com/comment/35473274
has body: I think this should answer your question. Taken from String docs Splits this string around matches of the given regular expression. This method works as if by invoking the two-argument split method with the given expression and a limit argument of zero. Trailing empty strings are therefore not included in the resulting array.
score: 3
upvote count: 3
accepted answer of: http://stackoverflow.com/q/23192323

http://stackoverflow.com/q/23150251
has title: Connection pool in tomcat 7
answer count: 1
downvote count: 0
accepted answer: http://stackoverflow.com/a/23156416
tagged with: tomcat
favorite count: 0
tagged with: connection-pooling
upvote count: 1
tagged with: tomcat7
has answer: http://stackoverflow.com/a/23156416
type: AnsweredQuestion
score: 1
tagged with: java
has body: Here is my current config &lt;Resource name="jdbc/data" auth="Container" type="javax.sql.DataSource" factory="org.apache.tomcat.jdbc.pool.DataSourceFactory" driverClassName="com.mysql.jdbc.Driver" url="jdbc:mysql://localhost:3306/TABLE_NAME" username="USER_NAME" password="PASSWORD" initialSize="10" maxActive="50" suspectTimeout="120" minIdle="10" maxIdle="20" maxWait="1000" testOnBorrow="true" timeBetweenEvictionRunsMillis="30000" minEvictableIdleTimeMillis="60000" validationQuery="SELECT 1 FROM DUAL" validationInterval="40" removeAbandoned="true" removeAbandonedTimeout="100" /&gt; This is in global context so multiple apps can use it. I am little confused about parameters.need some details. What I understand is initalSize a number of connection created when a pool started. maxActive maximum 50 connections can active at a time. minIdle 10 connections remain Idle when connection is not used else are closed after maxwait maxIdle 20 connections can be store as idle. But When I start tomcat server I can see a 30 IDLE connections which remains forever.Why this happens? Am I missing something ? According to my understanding about connection pool there should only 10 connections should created and can stay in IDLE mode. Is there any specific changes that I have to do with mysql my.cnf
type: Question

http://stackoverflow.com/comment/35646615
type: Comment
type: QuestionComment
has text: class getData seriously? Follow naming conventions.... looks like you gave method name to a class.
score: 2
comment on: http://stackoverflow.com/q/23288050

http://stackoverflow.com/comment/35495062
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23204885
score: 0
has text: Did you install JDK 32 bit ?

http://stackoverflow.com/comment/35397658
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23148608
has text: Hi @skapral, Thanks for the answer! I'm not sure what you means by "linkedObjects". Should it be Set<ClassA>?
score: 0

http://stackoverflow.com/comment/35537658
type: AnswerComment
has text: Well, that is indeed a problem :) Check for "INPUT=" perhaps? You could of course store the block_names with start- and end-characters to avoid misinterpretation?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23228375

http://stackoverflow.com/comment/35584798
comment on: http://stackoverflow.com/q/23254547
score: 2
has text: Object/getClass is not a static method. Call it on an object.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35536908
has text: I edited my answer to show you how to close the resources manually.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23218778
type: Comment

http://stackoverflow.com/q/23140907
tagged with: jbutton
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23151523
tagged with: java
tagged with: jtextfield
has body: I have two JTextField s and a JButton, one textfield saves to "key" and the other saves to "value" How do I get it to save this data from the JTextField and add to the key and value. Also, How do I take the "value" of the HashMap and add that to a JList? Thank you, this has been troubling me, everything I find about HashMap s is strings you enter in the code, not allowing the user to do so. EDIT This is what I have in the jbutton action performed section: ( I'm using designer in netbeans ) lm.addElement(capitalText.getText()); lm.addElement(countryText.getText()); (capitalText and countryText are what my two jtextfields are name ) This is the code I have preceding this: private String country; private String capital; private DefaultListModel&lt;String&gt; lm = new DefaultListModel&lt;&gt;(); Map&lt;String, String&gt; hashMap = new HashMap&lt;&gt;(); String key = country; String value = capital; Honestly I've just took different things I found online and tried to combine it to make something work and have been unsuccessful
type: Question
has title: Save user inputted values from jtextfield to a string that is used in hashmap
tagged with: hashmap
has comment: http://stackoverflow.com/comment/35382853
has comment: http://stackoverflow.com/comment/35383086
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/23151523
tagged with: jlist
has comment: http://stackoverflow.com/comment/35383135

http://stackoverflow.com/a/23174024
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/35441319
has comment: http://stackoverflow.com/comment/35441126
has comment: http://stackoverflow.com/comment/35441164
accepted answer of: http://stackoverflow.com/q/23173875
type: Answer
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/23173875
has body: define another Scanner Scanner console1 = new Scanner(System.in); and replace: String newText = console.next(); with: String newText = console1.nextLine(); it should work

http://stackoverflow.com/comment/35507797
comment on: http://stackoverflow.com/a/23211817
has text: @user13763 because %% syntax is used in like operator in MYSQL not in JAVA
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/35555645
type: QuestionComment
comment on: http://stackoverflow.com/q/23236601
has text: My application is windows based. I am thinking to comment second line and will call java method to write file contents to hard drive. Will it work?
score: 0
type: Comment

http://stackoverflow.com/a/23163406
accepted answer of: http://stackoverflow.com/q/23163223
type: Answer
answers question: http://stackoverflow.com/q/23163223
has body: If you want to use different functions for each child class you just have to use the "instanceof" operator and type casting like so: For example somewhere in a loop: if(items[i] instanceof Game) { Game g = (Game)items[i]; g.SomeGameSpecificFunc(); } else if(items[i] instanceof Book) { //... } You can also get a string with a name of the class of current object through reflection, but this is rather slow: String className = items[i].getClass().toString(); //in Java 7+ switch(className) { case "Book": //do something break; //etc } But you should use these techniques only if you really really have to use functions with different names and parameters.
type: AcceptedAnswer
score: 0

http://stackoverflow.com/comment/35461586
type: QuestionComment
comment on: http://stackoverflow.com/q/23185909
type: Comment
has text: Ummm.. and do _what_ with the images? Short answer, change your `Word` constructor to accept an Image. If that doesn't do it for you, clarify your question, so we actually know what you are talking about.
score: 0

http://stackoverflow.com/q/23220067
has answer: http://stackoverflow.com/a/48085736
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/29487717
accepted answer: http://stackoverflow.com/a/29487717
has answer: http://stackoverflow.com/a/55859809
downvote count: 0
has title: How to dismiss the keyboard in appium using Java?
tagged with: java
has answer: http://stackoverflow.com/a/23679377
has answer: http://stackoverflow.com/a/23518579
type: Question
has answer: http://stackoverflow.com/a/45451811
has answer: http://stackoverflow.com/a/70110474
has answer: http://stackoverflow.com/a/38409530
tagged with: appium
upvote count: 11
has answer: http://stackoverflow.com/a/79230030
answer count: 10
favorite count: 0
possible better answer: http://stackoverflow.com/a/23518579
has body: This code just aims to find the textbox and send some text to it. When it does that the keyboard appears on the android device.How to dismiss it after the sendKeys. @Test public static void test_demo() throws Exception { WebElement element = driver.findElement(By.id("mytextfield")); element.sendKeys("test"); //how do I dismiss keyboard which appears on my android device after sendKeys? }
has answer: http://stackoverflow.com/a/78740521
has comment: http://stackoverflow.com/comment/35522650
linked to: http://stackoverflow.com/q/21704358
tagged with: android
score: 11

http://stackoverflow.com/comment/35403926
score: 0
comment on: http://stackoverflow.com/q/23153333
type: Comment
type: QuestionComment
has text: Can you show your css? You should see some changes, but you need a bit more logic: only add the style if it's not already there, and remove it if your condition is false.

http://stackoverflow.com/comment/35491781
score: 1
type: Comment
type: QuestionComment
has text: I don't see you setting `UTF-8` anywhere in the reading code...
comment on: http://stackoverflow.com/q/23202988

http://stackoverflow.com/q/23192686
tagged with: portal
tagged with: websphere
has answer: http://stackoverflow.com/a/23201784
score: 0
answer count: 1
has body: I am working to research about Java portal application. I found IBM Websphere Portal as one of it and i choose to install its trial version. I've been download this application from this site, and those link contains 3 applications (Websphere Application Server, Installation Manager and its Portal). This is installation directory where i extract all file This is the Websphere Application Server directory and its content But when installing its Websphere Application Server, i've found the trouble which installer needs other disk(disk 2). It makes me confuse because WAS folder just has disk1 folder. Did i mis something? I've open that zip file but it same like extracted folder WAS. Any solutions? Thanks.
type: UnansweredQuestion
has title: IBM Websphere Portal Express Trial Installation
tagged with: websphere-portal
tagged with: java
type: Question

http://stackoverflow.com/a/23336670
answers question: http://stackoverflow.com/q/23275928
score: 0
has body: Try to import again the maven project into Eclipse... Did you check out the project from SVN?
type: Answer

http://stackoverflow.com/comment/35478967
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23195963
has text: what response you receive from url/api
type: AnswerComment

http://stackoverflow.com/a/23211162
type: Answer
has body: Problem may be in this line. private Fragment_Bread activity = this; you should use Utility.vibrate(getActivity()); instead. Happy 2 Help.
answers question: http://stackoverflow.com/q/23210766
score: 0

http://stackoverflow.com/q/23170603
type: AnsweredQuestion
has body: The task is to show 12 different figures (randomly shaped). The dilemma is: I can keep the 12 figures in the model. This seems to be preferrable to me as in my opinion looks more like classic MVC. A view will just represent what is inside the model. In the model we can create a method to return a new figure. Then a view just contains a loop which calls for a new figure 12 times. What troubles me is that this case seems to be a violation of MVC principles. As for where it all be applied to: Swing right now; web applications in future.
tagged with: swing
type: Question
tagged with: java
score: 0
has title: MVC: twelve figures in a model or twelve calls from view?
answer count: 1
has answer: http://stackoverflow.com/a/23171806
accepted answer: http://stackoverflow.com/a/23171806

http://stackoverflow.com/q/23210945
accepted answer: http://stackoverflow.com/a/23211062
type: AnsweredQuestion
has title: getting values from sharedpreferences display in list view
tagged with: java
tagged with: listview
type: Question
answer count: 2
upvote count: 1
has comment: http://stackoverflow.com/comment/35507875
has comment: http://stackoverflow.com/comment/35509867
favorite count: 0
has body: In my project, I have a button, when I click on button I want to add 'one' value to listview and when I click 2nd time again I want add 'two',this will continue up to 5 values added to listview as shown in image. After 5 values I don't want to allow to add list allow and I have another requirement i.e., I want to remove particular item in the listview when I long press item. Finally these all values saved in SharedPrerences and when ever activity open at that time I want to display all values in list view. For this I have a small issue i.e., suppose first I insert 3 values (one, two, three) and click on back button when I open activity again 3 values are not displayed but when I click on button it shows all previous values (one, two, three) and four for latest click. I want to display 3 values when ever activity called. mycode: public class ListViewDemo1 extends Activity { /** Called when the activity is first created. */ Button btn; static int count; private ListView list; public static ArrayList&lt;String&gt; values = new ArrayList&lt;String&gt;();; ArrayList countList = new ArrayList(); private ArrayAdapter adapter; SharedPreferences shared; Editor editor; private static ArrayList&lt;String&gt; sharedList; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); list=(ListView) findViewById(R.id.list); btn= (Button)findViewById(R.id.btn); shared = this.getSharedPreferences("Myprefernces",Context.MODE_WORLD_WRITEABLE); editor = shared.edit(); btn.setOnClickListener(new OnClickListener() { public void onClick(View v) { // TODO Auto-generated method stub sharedList = new ArrayList(); count++; if(count==1){ values.add("one"); countList.add(count); } if(count==2){ values.add("two"); countList.add(count); } if(count==3){ values.add("three"); countList.add(count); } if(count==4){ values.add("four"); countList.add(count); } if(count==5){ values.add("five"); countList.add(count); } if(count&gt;5){ --cou…
tagged with: android
downvote count: 4
possible better answer: http://stackoverflow.com/a/23211032
has answer: http://stackoverflow.com/a/23211032
score: -3
has answer: http://stackoverflow.com/a/23211062

spring-test-dbunit
type: Tag
tags question: http://stackoverflow.com/q/23153570
tag name: spring-test-dbunit

http://stackoverflow.com/comment/35607574
comment on: http://stackoverflow.com/a/23267207
type: Comment
score: 0
type: AnswerComment
has text: I am talking about code where you are using Criteria API.

http://stackoverflow.com/a/23165084
has body: How about hand.addAll(new ArrayList&lt;&gt;(hand))
score: 0
answers question: http://stackoverflow.com/q/23164816
type: Answer

http://stackoverflow.com/comment/35545063
has text: Well, unless you need to access `Grid` from a static context, it doesn't have to be `static`. If you remove that, it should be easy to access.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/23232536
type: Comment

http://stackoverflow.com/a/23251177
type: Answer
score: 0
answers question: http://stackoverflow.com/q/23251103
has body: You can just do the following: String str = theint + ""; or baseball.next() to get the string from Scanner

http://stackoverflow.com/q/23155794
tagged with: assertion
has answer: http://stackoverflow.com/a/60508215
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: gson
linked to: http://stackoverflow.com/q/15543607
has answer: http://stackoverflow.com/a/52949999
downvote count: 0
favorite count: 0
answer count: 3
tagged with: android
has title: App crashing when I run Proguard on GSON (which using enum)
has answer: http://stackoverflow.com/a/43452431
upvote count: 14
has body: I am using GSON in my Android app to parser the data. I have added an enum in my Model object. After adding an enum my app started crashing. When I made runProguard false everything works fine. I did everything I could find on internet to fix the problem when program is true. But still no luck. I have already done following thing in proguard-rule file -keep class com.google.** { *; } -keepattributes *Annotation* -keepattributes Signature -keepclassmembers enum * { public static **[] values(); public static ** valueOf(java.lang.String); } Enum Stuff example: public enum TypeX { @SerializedName("live") LIVE, @SerializedName("upcoming") UPCOMING, @SerializedName("replay") REPLAY; } My stack trace java.lang.AssertionError at com.google.gson.internal.bind.TypeAdapters$EnumTypeAdapter.&lt;init&gt;(Unknown Source) at com.google.gson.internal.bind.TypeAdapters$26.create(Unknown Source) at com.google.gson.Gson.getAdapter(Unknown Source) at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.&lt;init&gt;(Unknown Source) at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.createBoundField(Unknown Source) at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.getBoundFields(Unknown Source) at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.create(Unknown Source) at com.google.gson.Gson.getAdapter(Unknown Source) at com.google.gson.internal.bind.CollectionTypeAdapterFactory.create(Unknown Source) at com.google.gson.Gson.getAdapter(Unknown Source) at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.&lt;init&gt;(Unknown Source) at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.createBoundField(Unknown Source) at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.getBoundFields(Unknown Source) at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.create(Unknown Source) at com.google.gson.Gson.getAdapter(Unknown Source) at com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.write(Unknown Source) at …
type: UnansweredQuestion
type: Question
score: 14

http://stackoverflow.com/q/23280314
favorite count: 0
has comment: http://stackoverflow.com/comment/35633146
has comment: http://stackoverflow.com/comment/35632859
has comment: http://stackoverflow.com/comment/35633369
has comment: http://stackoverflow.com/comment/35633025
tagged with: makefile
has comment: http://stackoverflow.com/comment/35633431
has comment: http://stackoverflow.com/comment/35633001
type: AnsweredQuestion
score: 1
tagged with: java
has body: My java project makes use of some apache commons libraries. I want to be able to run my program in unix though so i made a makefile to compile it for me. My project has 4 Java classes and 4 external libraries (.jars). In my directory i have my four .Java files and a folder named "lib" which contain my .Jar files. Here's my make file: JFLAGS = -g JC = javac -sourcepath / -classpath lib/commons-httpclient-3.1.jar:lib/commons-io-2.4.jar:lib/commons-codec-1.9.jar:lib/commons-logging-1.1.3.jar .SUFFIXES: .java .class .java.class: $(JC) $(JFLAGS) $*.java CLASSES = \ SubmissionDriver.java \ FileAndArgs.java \ hashConverter.java \ InvalidAgeException.java default: classes classes: $(CLASSES:.java=.class) clean: $(RM) *.class And here's my error messages: I get like 14 error message that pertain to the actual class files though. Here's some examples: SubmissionDriver.java:74: error: cannot find symbol public static void httpSend() throws HttpException, IOException{ ^ symbol: class HttpException location: class SubmissionDriver SubmissionDriver.java:75: error: cannot find symbol HostConfiguration hf=new HostConfiguration(); ^ symbol: class HostConfiguration location: class SubmissionDriver SubmissionDriver.java:75: error: cannot find symbol HostConfiguration hf=new HostConfiguration(); ^ symbol: class HostConfiguration location: class SubmissionDriver SubmissionDriver.java:77: error: cannot find symbol PostMethod post = new PostMethod("myurl"); ^ Also it states this at the bottom of thsoe 14 error messages: 14 errors make: *** [SubmissionDriver.class] Error 1
upvote count: 1
has answer: http://stackoverflow.com/a/23280720
tagged with: libraries
has comment: http://stackoverflow.com/comment/35632949
type: Question
has comment: http://stackoverflow.com/comment/35633061
has title: Java: How to add multiple external libraries to makefile?
has comment: http://stackoverflow.com/comment/35632706
accepted answer: http://stackoverflow.com/a/23280720
answer count: 1
has comment: http://stackoverflow.com/comment/35633353
downvote count: 0
tagged with: external

http://stackoverflow.com/comment/35554271
has text: Great, the file indeed offers a `Last-modified` attribute as far as I can see in my browser. Could you point me to how I can only fetch the http HEAD with java? I'm doing the file download with apache `FileUtils.copyURLToFile(url, file, timeout)`, so that's not of any help with the headers here... Would I have to use `URL` and `URLConnection`?
comment on: http://stackoverflow.com/a/23237788
type: AnswerComment
score: 0
type: Comment

openshift
tags question: http://stackoverflow.com/q/23175265
tags question: http://stackoverflow.com/q/23286375
tag name: openshift
type: Tag
tags question: http://stackoverflow.com/q/23268133
tags question: http://stackoverflow.com/q/23248011
tags question: http://stackoverflow.com/q/23264517

http://stackoverflow.com/a/71693043
has comment: http://stackoverflow.com/comment/138279334
upvote count: 4
downvote count: 0
score: 4
answers question: http://stackoverflow.com/q/23209125
type: Answer
has body: Inside Module body add requires java.desktop;

http://stackoverflow.com/q/23223181
favorite count: 0
upvote count: 2
has answer: http://stackoverflow.com/a/23237525
has title: Super CSV and Grouping Separators
has body: We are trying to read a file that contains numbers in the following format: 123.456,78 (according to Wikipedia this is usual for some countries - e.g. Germany). Super CSV is configured to parse the column as BigDecimal: new ParseBigDecimal(new DecimalFormatSymbols(GERMANY)). That works well for numbers below 1k, but the grouping separator is not handled properly: '1.999,00' could not be parsed as a BigDecimal. I've seen that it is possible to write a custom cell processor, but perhaps someone knows if there is an easier way or if this is a known bug in Super CSV. UPDATE: Super CSV has integrated that feature and released it with version 2.2.0. It will work for all grouping separators that are supplied via the DecimalFormatSymbols parameter.
type: AnsweredQuestion
score: 2
has comment: http://stackoverflow.com/comment/35599635
tagged with: supercsv
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/23237525
tagged with: bigdecimal
answer count: 1
downvote count: 0

http://stackoverflow.com/comment/35447483
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23177720
has text: Care to share some code?

http://stackoverflow.com/comment/35497811
has text: HI... I have updated with the details. Could you check and tell me what changes i have to make. Thanks for your time.
comment on: http://stackoverflow.com/q/23198753
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/23225958
has comment: http://stackoverflow.com/comment/35532805
type: AnsweredQuestion
score: 1
tagged with: java
has title: Dragging between two Components in Swing
accepted answer: http://stackoverflow.com/a/31268101
tagged with: mouseevent
has comment: http://stackoverflow.com/comment/35535572
type: Question
upvote count: 1
has body: I am not trying to drag and drop, I think. I want to be able to drag a marker from one graph component to an adjacent graph component in Swing. The problem that I have now is that while I am holding drag, the MouseEvent's source field is always set to the component where the dragging started. Is there a way on mouse enter and/or exit to get Swing to stop generating MouseEvents on the Component that I was dragging over and start generating MouseEvents on the Component that I am currently dragging on?
tagged with: user-interface
answer count: 1
has answer: http://stackoverflow.com/a/31268101
favorite count: 0
tagged with: drag-and-drop
has comment: http://stackoverflow.com/comment/35534534
downvote count: 0
linked to: http://stackoverflow.com/q/16586562
tagged with: swing

http://stackoverflow.com/q/23222936
tagged with: netbeans-7
has comment: http://stackoverflow.com/comment/35528755
duplicate of: http://stackoverflow.com/q/4112686
tagged with: ajax
linked to: http://stackoverflow.com/q/10350433
type: UnansweredQuestion
has body: Is AJAX a hard program to use within netbeans, following tutorials and none of them work within netbeans. Trying to do tutorials below but in netbeans http://www.w3schools.com/ajax/ajax_aspphp.asp Anyone know any simple Ajax netbeans tutorials?. (Using JSP if possible) I already use the Dao and have written the servlet and don't want to change them for Ajax
answer count: 0
has comment: http://stackoverflow.com/comment/35529114
type: Question
tagged with: java
has title: Using Ajax in netbeans
score: 0
linked to: http://stackoverflow.com/q/4112686
has comment: http://stackoverflow.com/comment/35527392
tagged with: jsp

android-actionbar
type: Tag
tags question: http://stackoverflow.com/q/23179190
tags question: http://stackoverflow.com/q/23195760
tags question: http://stackoverflow.com/q/23149683
tag name: android-actionbar
tags question: http://stackoverflow.com/q/23245670
tags question: http://stackoverflow.com/q/23253164
tags question: http://stackoverflow.com/q/23152133

http://stackoverflow.com/q/23139471
has title: &#8211 is not getting decoded properly in android
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/35390993
has comment: http://stackoverflow.com/comment/35380096
answer count: 0
score: 1
tagged with: java
tagged with: decoder
upvote count: 1
has comment: http://stackoverflow.com/comment/35391087
type: Question
has body: So I went through other similar post and used the decoder like this excerptData = URLDecoder.decode(excerptData, "UTF-8"); excerptData = excerptData.replaceAll( "[\\u202C\\u202A]", "" ); _post.Excerpt = (Html.fromHtml(excerptData)); But #8211 and #8217 is not getting decoded to '-'. Am i missing here something. Help would appreciated. Thanks in advance
downvote count: 0
favorite count: 0

http://stackoverflow.com/a/23383083
upvote count: 26
has comment: http://stackoverflow.com/comment/40395382
has body: This bug has been reported here: https://bugs.eclipse.org/bugs/show_bug.cgi?id=404776 Fix described in comments that works for me too is to add this line at the end of your eclipse.ini file -Dorg.eclipse.swt.browser.DefaultType=mozilla
has comment: http://stackoverflow.com/comment/41706406
type: Answer
has comment: http://stackoverflow.com/comment/41706193
downvote count: 2
answers question: http://stackoverflow.com/q/23172416
has comment: http://stackoverflow.com/comment/36388398
has comment: http://stackoverflow.com/comment/42211560
has comment: http://stackoverflow.com/comment/36219958
score: 24

http://stackoverflow.com/q/23155850
type: Question
has comment: http://stackoverflow.com/comment/64845559
has title: Android Facebook API error: something went wrong please try again
has answer: http://stackoverflow.com/a/23193009
upvote count: 1
answer count: 1
tagged with: facebook-android-sdk
tagged with: facebook-graph-api
favorite count: 0
type: UnansweredQuestion
tagged with: android
tagged with: facebook
has body: i'm sorry to repost this question, but the other one was put on hold for no reason and i have an app out there that doesn't work because of this problem, and i need a fix as soon as possible. THIS IS THE ONLY INFO ECLIPSE AND THE APP ITSELF GIVES TO ME: i've developed an app for android that uses fb to share a link, when i share a post with MY fb account everything goes fine, except that no one sees that post! but when i do with my gf's it doesn't even post it and gives me back a toast saying that error and logcat is this: 04-18 15:57:57.650: E/Activity(16658): Error: com.facebook.FacebookException: Error publishing message there, i do this: FacebookDialog shareDialog = new FacebookDialog.ShareDialogBuilder(Favorites.this) .setDescription("xxxxxxxxxxxxxx") .setApplicationName("xxx") .setName("xxx") .setPicture(imagesURL+filenames.get(location)) .setLink("http://xxxxxxxxxx"+filenames.get(location)) .build(); uiHelper.trackPendingDialogCall(shareDialog.present());
downvote count: 0
score: 1
tagged with: java

http://stackoverflow.com/a/23205361
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35496457
has comment: http://stackoverflow.com/comment/35496270
answers question: http://stackoverflow.com/q/23205243
downvote count: 0
has comment: http://stackoverflow.com/comment/35496798
has comment: http://stackoverflow.com/comment/35496234
type: Answer
has body: Your XML Schema probably has a schema tag like the following. &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.example.org/XSD_Maths" xmlns:tns="http://www.example.org/XSD_Maths" elementFormDefault="qualified"&gt; Since it specifies a targetNamespace of http://www.example.org/XSD_Maths. Your XML will need to look like the following: &lt;create xmlns="http://www.example.org/XSD_Maths"&gt; &lt;name&gt; coco &lt;/name&gt; &lt;/create&gt; Note About Unmarshalling from a DOM If you unmarshalling from a DOM Document or Element make sure that the DOM parser you used was namespace aware. This is done by setting the following flag on the DocumentBuilderFactory. documentBuilderFactory.setNamespaceAware(true); For More Information Below is a link to an article on my blog where I go into more depth about JAXB and namespaces. http://blog.bdoughan.com/2010/08/jaxb-namespaces.html
score: 17
accepted answer of: http://stackoverflow.com/q/23205243
upvote count: 17
has comment: http://stackoverflow.com/comment/120160967

http://stackoverflow.com/a/23655727
accepted answer of: http://stackoverflow.com/q/23146471
type: Answer
answers question: http://stackoverflow.com/q/23146471
score: 0
type: AcceptedAnswer
has body: I was using !X to represent false. SOLVED. Revised class code posted below, for a light switch that includes green, yellow, and red lights. class LightAlg { int greenX, greenY = 50; // Alphas of Green Lights (50 = OFF &amp; 250 = ON) int redX, redY = 50; // Alphas of Red Lights (50 = OFF &amp; 250 = ON) int yellowX, yellowY = 50; // Alphas of Yellow Lights (50 = OFF &amp; 250 = ON) int time; // set to equal millis() int lastInterval; // Used to update time since last light change then used to take away from "time" in order to get amount of time specified float interval = 5; // Interval for Lights in Seconds float wait = 1000; // turn interval from seconds to millis char lightX = 'G'; // Switch for Lights on X-Cords char lightY = 'R'; // Switch for Lights on Y-Cords boolean X, Y, Xy, Yy; // Booleans for Lights to corespond to draw/make car (Xy &amp; Yy = whether intersection should be crossed if already entered by cars) LightAlg (float interval_) { //Constructor and specify light change time wanted interval = interval_; } void run() { time = millis(); //Sets time to time since program was executed println("Last Interval Times is " + lastInterval/1000); // Prints time since last time lights where changed println("X-Light = " + X); //Prints Boolean of X-Light println("Xy-Light = " + Xy); //Prints Boolean of X-Light when it supposed to be yellow in order to creat a flag for whether cars should continue throught intersection println("Y-Light = " + Y); //Prints Boolean of Y-Light println("Yy-Light = " + Yy);//Prints Boolean of Y-Light when it supposed to be yellow in order to creat a flag for whether cars should continue throught intersection if (time - lastInterval &lt; wait * interval) { // // If the Light has been green for less than wait time by taking millis() - time since last light change &lt; time wanted for light interval if (X == true &amp;&amp; Xy == true) { //If light is green and intersection is ok to enter my_array.draw_cars(); my_array.make_car(); my_array.…

http://stackoverflow.com/a/23189816
has body: for(int i = 0; i &gt; n; i++) { students[i] = fileScan.nextLine(); } This loop is not inserting values to the array. It must be, for(int i = 0; i &lt; n; i++) { students[i] = fileScan.nextLine(); }
type: Answer
has comment: http://stackoverflow.com/comment/35469024
answers question: http://stackoverflow.com/q/23189791
accepted answer of: http://stackoverflow.com/q/23189791
upvote count: 4
type: AcceptedAnswer
downvote count: 0
score: 4

http://stackoverflow.com/comment/35465707
has text: I dont know what you really mean with visible, but the app is running the whole time in the foreground.
comment on: http://stackoverflow.com/q/23187556
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35538236
has text: But isn't the regex more powerful than a parser? Cuz' parsing seems a bit costly operation for me since there will be enormous amounts of commands with numerous args being issued simultaneously.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23227490

http://stackoverflow.com/comment/35647849
has text: Oh I didn't know that thanks. but I still have to use list, is there any method for that ?
comment on: http://stackoverflow.com/a/23288705
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/35435711
type: Comment
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/23171053
has text: There's a bunch of errors in your code... you're mixing types: integers, strings, ... you put '' around integers, and getStrings instead of getting integers, ... you use integers for animal names, ... And you can't use `sum` as a column name (it's the name of a SQLite function) - Is it a patchwork or what?

http://stackoverflow.com/comment/35528374
has text: In my case I have put the file in src/main/resources and just referred it as "abc.xml" ... need not to give as src/main/resources ... just "abc.xml" will work fine ... if you created any folder say conf in src/main/resources then you need to provide "conf/abc.xml"
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23215090

http://stackoverflow.com/a/23216092
type: Answer
upvote count: 1
score: 1
accepted answer of: http://stackoverflow.com/q/23214103
answers question: http://stackoverflow.com/q/23214103
has comment: http://stackoverflow.com/comment/35515795
type: AcceptedAnswer
downvote count: 0
has body: The second error is caused because you are trying to access to args[0] and args1, while you haven't informed any argument at your command line. It should look similar to this: java -jar JavaWdslApp.jar valueForPath1 valueForFileName I recommend you to check the java command reference.

http://stackoverflow.com/a/23230814
has comment: http://stackoverflow.com/comment/35542189
answers question: http://stackoverflow.com/q/23230678
has comment: http://stackoverflow.com/comment/35542198
type: AcceptedAnswer
downvote count: 0
score: 1
type: Answer
has body: You want numbers, spaces, parenthesis, dot and AND, and OR. Here is one way to do it, by specifying the single characters inside the character class, and separating the two words using the OR operator |. Note that \b has the \ escaped, because \b is itself an string escape sequence. if (input.matches("^([\\d\\s().]|\\bAND\\b|\\bOR\\b)+$")) { // do something } Here is a test program on your input. import java.util.regex.*; public class Main{ public static void main(String[] args) { String[] myArray = new String[] {"0.10 AND 23","12 AND (15 OR 0.2)","12 OR 190","12 AND AND 12","12 A 233"}; String regex = "^([\\d\\s().]|\\bAND\\b|\\bOR\\b)+$"; for (int i = 0; i &lt; myArray.length; i++) System.out.println(myArray[i].matches(regex)); } } Output: true true true true false
accepted answer of: http://stackoverflow.com/q/23230678
upvote count: 1

http://stackoverflow.com/q/23208564
type: UnansweredQuestion
upvote count: 1
answer count: 0
score: 1
tagged with: java
tagged with: hide
tagged with: jpanel
has title: Java view system hidding/showing n jpanels
type: Question
has body: I'm starting a new project in java and I'm developing a "view control system" so far I've been doing good but as my first time developing a long term project I don't want to use this if I'm not 100% sure it will be good. I'd like you all to take a look at the code and throw any kind of suggestions. Code package Main; import Panels.BluePanel; import Panels.RedPanel; import javax.swing.JPanel; public class MainDialog extends javax.swing.JFrame { private BluePanel jpnBodyBlue; private RedPanel jpnBodyRed; private BodyPanels currentBodyPanel; /** * Creates new form Principal */ public MainDialog() { initComponents(); initPanels(); } // &lt;editor-fold defaultstate="collapsed" desc="Generated Code"&gt; private void initComponents() { jpnContenedor = new javax.swing.JPanel(); jpnIzquierdo = new javax.swing.JPanel(); jpnBody = new javax.swing.JPanel(); jToolBar1 = new javax.swing.JToolBar(); btnMenuPanel1 = new javax.swing.JButton(); btnMenuPanel2 = new javax.swing.JButton(); jMenuBar1 = new javax.swing.JMenuBar(); jMenu1 = new javax.swing.JMenu(); jMenu2 = new javax.swing.JMenu(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setBackground(java.awt.Color.white); jpnContenedor.setBackground(new java.awt.Color(255, 255, 255)); jpnIzquierdo.setBackground(new java.awt.Color(240, 240, 240)); javax.swing.GroupLayout jpnIzquierdoLayout = new javax.swing.GroupLayout(jpnIzquierdo); jpnIzquierdo.setLayout(jpnIzquierdoLayout); jpnIzquierdoLayout.setHorizontalGroup( jpnIzquierdoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 100, Short.MAX_VALUE) ); jpnIzquierdoLayout.setVerticalGroup( jpnIzquierdoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 321, Short.MAX_VALUE) ); jpnBody.setBackground(new java.awt.Color(65, 65, 65)); jpnBody.addComponentListener(new java.awt.event.ComponentAdapter() { public void componentResized(java.awt.event.ComponentEvent evt) { jpnBodyComponentResized(evt); } }); jpnBo…
tagged with: show
downvote count: 0
favorite count: 0
tagged with: view

http://stackoverflow.com/q/23255267
possible better answer: http://stackoverflow.com/a/23255782
has answer: http://stackoverflow.com/a/23255782
accepted answer: http://stackoverflow.com/a/23255443
answer count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/35587270
tagged with: synchronization
favorite count: 0
has title: How to use Semaphores for Signaling?
tagged with: multithreading
linked to: http://stackoverflow.com/q/18830875
tagged with: semaphore
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23255443
has body: Now I investigate semaphores. I googled following link about this theme: link Author of this link wrote about using semaphores for signaling. To show how it works he wrote custom semaphore. custom semaphore code: public class Semaphore { private boolean signal = false; public synchronized void take() { this.signal = true; this.notify(); } public synchronized void release() throws InterruptedException{ while(!this.signal) wait(); this.signal = false; } } about how use it in code he wrote following: public class SendingThread { Semaphore semaphore = null; public SendingThread(Semaphore semaphore){ this.semaphore = semaphore; } public void run(){ while(true){ //do something, then signal this.semaphore.take(); } } } public class RecevingThread { Semaphore semaphore = null; public ReceivingThread(Semaphore semaphore){ this.semaphore = semaphore; } public void run(){ while(true){ this.semaphore.release(); //receive signal, then do something... } } } main: Semaphore semaphore = new Semaphore(); SendingThread sender = new SendingThread(semaphore); ReceivingThread receiver = new ReceivingThread(semaphore); receiver.start(); sender.start(); As I understood order of execution should be following send - receive send - receive send - receive ... I tryed to write own code using this bluerprint public class SendReceiveWithCustomSemaphore { public static void main(String[] args) { MySemaphore mySemaphore = new MySemaphore(); new Send(mySemaphore).start(); new Receive(mySemaphore).start(); } } class MySemaphore { boolean flag = false; public synchronized void take() throws InterruptedException { flag = true; notify(); } public synchronized void release() throws InterruptedException { while (!flag) { wait(); } flag = false; } } class Send extends Thread { MySemaphore mySemaphore; public Send(MySemaphore semaphore) { this.mySemaphore = semaphore; } @Override public void run() { int i = 0; while (i++ &lt; 10) { System.out.println("send"); try { mySemaphore.take(); } catch (InterruptedE…
score: 1
tagged with: java
tagged with: concurrency
upvote count: 1
has comment: http://stackoverflow.com/comment/35587230
has comment: http://stackoverflow.com/comment/35586321
type: Question

http://stackoverflow.com/q/23242963
tagged with: web-services
tagged with: https
type: Question
tagged with: java
tagged with: wsimport
has answer: http://stackoverflow.com/a/23512522
accepted answer: http://stackoverflow.com/a/23512522
score: 0
answer count: 2
has title: "javax.xml.ws.WebServiceException: is not a valid service." proxy issue?
linked to: http://stackoverflow.com/q/19533904
tagged with: proxy
has answer: http://stackoverflow.com/a/23243241
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/23243241
has body: As a premise, I am not very experienced yet, but I have tried to read and search everything I possibly could, related to this topic, and still no luck. I was given a simple client to call a webservice but once it was fully setup (which included the use of a certificate and a couple more properties to set) I got the error mentioned in the title: javax.xml.ws.WebServiceException: {http://http://cert.controller.portaapplicativa.ictechnology.it//}MyService is not a valid service. Valid services are: at com.sun.xml.ws.client.WSServiceDelegate.&lt;init&gt;(WSServiceDelegate.java:187) at com.sun.xml.ws.client.WSServiceDelegate.&lt;init&gt;(WSServiceDelegate.java:159) at com.sun.xml.ws.spi.ProviderImpl.createServiceDelegate(ProviderImpl.java:82) at javax.xml.ws.Service.&lt;init&gt;(Service.java:56) at package.client.wsimport.MyService..&lt;init&gt;(MyService.java:46) at package.client.Client.doRicercaDEN(Client.java:55) at package.client.Client.main(Client.java:36) I tried generating the client again with JAX-WS: java -classpath C:\Programmi\Java\jdk1.6.0_38\lib\tools.jar com.sun.tools.internal.ws.WsImport -verbose C:\WsdlFile.wsdl -p package.client.wsimport -s C:\tmp\ws\ And I get the same issue. I am using a local copy of the wsdl because wsimport doesn't seem to like the certificate I'm trying to set in the properties (I'm most likely doing something wrong, but I opted for the simple workaround, given I have more pressing issues). Trying to use SoapUI to test the service, everything works fine, though I need to set the preferences for the proxy to "None". So I tried to make sure the connection doesn't use any proxy in my client as well: (...) systemSettings.remove("http.proxyHost"); systemSettings.remove("http.proxyPort"); systemSettings.remove("https.proxyHost"); systemSettings.remove("https.proxyPort"); System.setProperty("http.nonProxyHosts","*"); System.setProperty("https.nonProxyHosts","*"); (BTW, before "*", which as I understand it should work as a wildcard for "e…

http://stackoverflow.com/comment/35979389
has text: Nobody prevents you from doing it programmatically. If you don't succeed or if you have a question, feel free to post a question on SO, but don't hijack an existing question by another person.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23165956
score: 0

http://stackoverflow.com/a/23149057
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/23148460
answers question: http://stackoverflow.com/q/23148460
score: 1
has body: What you need to understand is how the comb2 method works. Basically, it calls itself. This is called recursion. When you call comb2("1234"), the result is a call to comb2("","1234"). comb2("","1234") prints "" (which has no effect), then starts a loop through the end of the string ("234"). The first thing it does in this loop is call comb2("1","234"). comb2("1", "234") prints "1", then starts a loop through the end of the string ("234"). The first thing it does in this loop is call comb2("12","34"). comb2("12", "34") prints "12", then starts a loop through the end of the string ("34"). The first thing it does in this loop is call comb2("123","4"). comb2("123", "4") prints "123", then starts a loop through the end of the string ("4"). The first thing it does in this loop is call comb2("1234",""). comb2("1234", "") prints "1234", then starts a loop through the end of the string (""). Since there is nothing to do, it returns immediately to its caller : comb2("123","4"). comb2("123", "4") now goes to the next step in its loop. Since there is none, it returns. comb2("12", "34") now goes to the next step in its loop. It calls comb2("124",""). comb2("124", "") prints "124", then starts a loop through the end of the string (""). There is nothing to do, so it returns immediately. This is how you get from "1234" to "124". Hopefully, from there, you shoud be able to understand the whole execution.

http://stackoverflow.com/comment/35582086
type: AnswerComment
has text: In theory having a reference to something like a `static final` primitive data type isn't going to pose a problem but in the case of an array of objects they're effectively going to be 'orphaned' if the `Activity` is destroyed and anything holding a reference will prevent the GC from cleaning up. A worst case scenario with a programmer using a static object, array of objects or a method in an Activity is that relevant data hasn't been set, objects haven't been initialised etc etc. In other words unknown state and the potential for NPEs.
type: Comment
comment on: http://stackoverflow.com/a/23250701
score: 0

http://stackoverflow.com/comment/35603152
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23239385
has text: @user3320956: You can use a stored procedure for storing the user actions to this table. Please let me know if I didn't make it clear.
score: 0

http://stackoverflow.com/q/23154733
type: AnsweredQuestion
has body: This code is supposed to be simple java game.There's one green moveable rectangle (player) and few other rectangles (enemies).I've set up key listener for frame, so green rectangle can be moveable.But to make change of player's x and y coords noticeable, I have to call repaint in paintCoponent method.When I do so I can move green rect but other rectangles are being generated over again on new coordinates.How to I stop this unwished effect? import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import java.util.Random; public class Drawing extends JPanel implements KeyListener { public static JFrame frame; public static int[] x=new int[10]; public static int[] y=new int[10]; public static int a; public static Random random; public static int p_x=0; public static int p_y=0; public static void drawframe(int width,int height) { frame=new JFrame("The game"); frame.setSize(width,height); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true); frame.setResizable(false); frame.addKeyListener(new Drawing()); } public void paintComponent(Graphics g) { super.paintComponent(g); drawenemies(g,6); setradius(g); setplayer(g); } public void drawenemies(Graphics g,int amount) { random=new Random(); a=amount; for(int i=1;i&lt;=amount;i++) { x[i]=random.nextInt(frame.getWidth()); y[i]=random.nextInt(frame.getHeight()); g.fillRect(x[i], y[i], 20, 20); } } public void setradius(Graphics g) { g.setColor(Color.RED); for(int i=1;i&lt;=a;i++) { g.drawRect(x[i]-15, y[i]-15, 50, 50); } } public void setplayer(Graphics g) { g.setColor(Color.GREEN); g.fillRect(p_x, p_y, 20, 20); } public static void main(String args[]) { drawframe(500,500); Drawing instance=new Drawing(); frame.add(instance); } @Override public void keyPressed(KeyEvent e) { if(e.getKeyCode()==39) { p_x=p_x+10; } } public void keyReleased(KeyEvent arg0){} public void keyTyped(KeyEven…
tagged with: java
has answer: http://stackoverflow.com/a/23155429
type: Question
accepted answer: http://stackoverflow.com/a/23155429
score: 0
answer count: 1
has title: Java drawing issue
tagged with: drawing

http://stackoverflow.com/comment/35600094
score: 0
has text: You could try to use an SVN Hook. Anyway I would not advice on that, for the possibility of doing partial commits. The obvious alternative is an OSB, with the tool of your choice (I prefer Ant).
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23263234

http://stackoverflow.com/comment/35613866
comment on: http://stackoverflow.com/q/23266239
has text: @webaib i don't have any exception
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23194084
downvote count: 5
has comment: http://stackoverflow.com/comment/35475902
answer count: 3
has title: i am unable to use all if statement in this program
tagged with: variables
has comment: http://stackoverflow.com/comment/35475958
favorite count: 0
has comment: http://stackoverflow.com/comment/35475953
has comment: http://stackoverflow.com/comment/35475909
has answer: http://stackoverflow.com/a/23194148
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23194217
tagged with: java
score: -4
has comment: http://stackoverflow.com/comment/35475838
tagged with: loops
upvote count: 1
has comment: http://stackoverflow.com/comment/35477266
type: Question
possible better answer: http://stackoverflow.com/a/23194271
has body: i am unable to use if statement in whole program i.e one in public program and another in case statement help and i want the program to print either whole date if no error or just error how can i do it public class date { public static void main(String[] args) { Scanner kbd = new Scanner(System.in); boolean yn = true; boolean bn = true; int date, month, year; System.out.println("Date:"); date = kbd.nextInt(); System.out.println("month:"); month = kbd.nextInt(); System.out.println("year:"); year = kbd.nextInt(); if (date &lt; 0 &amp;&amp; date &gt; 32) { System.out.println("**Error** invalid day value "); } while (yn) { System.out.println("**error** invalid month value"); month = kbd.nextInt(); switch (month) { case 1: System.out.println("January"); yn = false; break; case 2: if (date &lt; 0 &amp;&amp; date &gt; 30) { System.out.println("**Error** February has only 29 days "); } yn = false; break; case 3: System.out.println("March"); yn = false; break; case 4: System.out.println("April"); yn = false; break; case 5: System.out.println("May"); yn = false; break; case 6: System.out.println("June"); yn = false; break; case 7: System.out.println("July"); yn = false; break; case 8: System.out.println("August"); yn = false; break; case 9: System.out.println("September"); yn = false; break; case 10: System.out.println("October"); yn = false; break; case 11: System.out.println("November"); yn = false; break; case 12: System.out.println("December"); yn = false; break; default: System.out.println("Invalid month"); yn = true; break; } } } }
has answer: http://stackoverflow.com/a/23194271
accepted answer: http://stackoverflow.com/a/23194148

http://stackoverflow.com/q/23270153
has comment: http://stackoverflow.com/comment/35614318
score: 0
has answer: http://stackoverflow.com/a/23270243
answer count: 1
has comment: http://stackoverflow.com/comment/35744594
has title: Creating a class object with a different variable in a while loop
type: UnansweredQuestion
has body: I am pretty new to java so I understand my code will not be very good. However I am trying to create a new class object using a while loop which will have the like 1,2,3 etc as a variable and then in that it will have the games name after pulling it from a website. import java.io.*; import java.net.MalformedURLException; import java.net.URL; public class GameInformationPuller { public static void PullInformation() { String gameName = ""; String gameRating = ""; String gameGenre = ""; int count = 0; int i = 0; StringBuilder sb = new StringBuilder(); GameInformation name; boolean flag; try { URL url = new URL("http://www.mmorpg.com/gamelist.cfm/show/all/sCol/titleUC/sOrder/asc"); BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream())); BufferedWriter writer = new BufferedWriter(new FileWriter("C:\\data4.txt")); String line; while ((line = reader.readLine()) != null) { if(line.contains("http://www.mmorpg.com/gamelist.cfm/game/") || line.contains("&lt;span class=\"value rating\"&gt;") || line.contains("title=\"Not enough votes to tabulate\"&gt;") || line.contains("&lt;td class=\"genre\"&gt;")) { if(!line.contains("Jump to Random Game")) { sb.delete(0, sb.length()); //------------------------------------------------ if(line.contains("http://www.mmorpg.com/gamelist.cfm/game/")) { flag = false; count = 0; i = 0; while(i &lt; line.length() - 1 &amp;&amp; flag == false) { if(count &gt;= 2 &amp;&amp; flag == false) { if(line.charAt(i) == '&lt;') { flag = true; } else { if(!(line.charAt(i) == '.')) { sb.append(line.charAt(i)); gameName = new String(sb); } } } if(line.charAt(i) == '&gt;') { count++; } i++; } } //------------------------------------------------ name = new GameInformation(gameName); } //------------------------------------------------ } else { //Nothing } } } //Close reader and writer reader.close(); writer.close(); } catch (MalformedURLException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } } I want a ne…
tagged with: java
has comment: http://stackoverflow.com/comment/35613153
type: Question

http://stackoverflow.com/a/23238854
downvote count: 0
answers question: http://stackoverflow.com/q/23238543
type: Answer
has comment: http://stackoverflow.com/comment/35560385
upvote count: 5
has comment: http://stackoverflow.com/comment/35556413
has comment: http://stackoverflow.com/comment/35560237
has body: Please check thease options like Treelist 1 Treelist 2
score: 5

http://stackoverflow.com/comment/35456331
comment on: http://stackoverflow.com/q/23183171
score: 2
has text: IFS? (Comment must be at least 15 characters in length!)
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23156988
downvote count: 1
type: AnsweredQuestion
tagged with: java
score: -1
tagged with: hql
type: Question
has answer: http://stackoverflow.com/a/23157568
upvote count: 0
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/23157568
has body: This is the sentence HQL select r.response as response from Responsemix as r right join r.idOptQuestion as opt where opt.idQuestion=5 and opt.content='Other' or opt.content='Others' order by r.response asc
has title: How to do a OR in HQL when there is no value with which we are comparing it gives this error java.lang.NullPointerException?
tagged with: mysql

http://stackoverflow.com/comment/35449570
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23178883
score: 0
has text: Is this an interview question or something?

http://stackoverflow.com/comment/35579753
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23252025
has text: What is your date type? Integer,Float,Double?
score: 0

http://stackoverflow.com/comment/35608548
type: QuestionComment
has text: Even if your object was serializable, it would not be human readable if this is what you want.
score: 0
comment on: http://stackoverflow.com/q/23267586
type: Comment

http://stackoverflow.com/comment/35508445
comment on: http://stackoverflow.com/q/23208417
has text: Don't reinvent the wheel, just use [JDO](https://developers.google.com/appengine/docs/java/datastore/jdo/relationships). Seriously!
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/35618600
type: QuestionComment
comment on: http://stackoverflow.com/q/23273117
has text: So, you want the set union minus the intersection?
score: 2
type: Comment

http://stackoverflow.com/q/23256237
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35587937
has comment: http://stackoverflow.com/comment/35587893
type: Question
has answer: http://stackoverflow.com/a/23256434
has body: in all honesty, I've spent a few days looking at this and trying to figure it out, but have come up very short. The goal is to see if a trie node has a next, if so what it is. Where it's called by: public Iterator&lt;String&gt; iterator() { return new TrieIterator(); } calls this to implement my own iterator. I've tried using a position in the array + 1 for the hasNext(), also comparing things to size, and number or nodes, and children, and have come up short. My most recent try was something along the lines of (below) but doesn't work. hasNext() { return this.children.hasChildren(); /* doesn't work */ } public class TrieIterator implements Iterator&lt;String&gt; { public TrieIterator(){ } public boolean hasNext() { return false; } public String next() { return null; } public void remove() { throw new UnsupportedOperationException(); } } here's the trieNode class as well: public class TrieNode { protected char letter = ' '; protected TrieNode parentNode = null; protected boolean fullWord = false; protected TrieNode[] children = new TrieNode[26]; protected int prefixes = 0; public TrieNode(char letter, TrieNode parentNode){ this.letter = letter; this.parentNode = parentNode; } public boolean hasChildren(){ int index = 0; while(index &lt; children.length){ if(children[index] != null) { return true; } index++; } return false; } public TrieNode nodeForLetter(char ch) { return children[ch - 97]; } public boolean isEndOfWord() { return letter == '*'; } } and adding and deleting is as follows: public void addWord(String s) { if (hasWord(s)) return; int index = 0; TrieNode current = root; char[] letters = s.toCharArray(); while(index &lt; s.length()){ TrieNode child = current.children[letters[index] - 97]; if(child == null){ child = new TrieNode(letters[index], current); child.prefixes++; numOfNodes++; } current = child; index++; if(index == s.length()){ current.fullWord = true; numOfWords++; } } } public void deleteWord(String s) { if(s.length() == 0) return; if(size() == …
has title: java - overriding iterator?
tagged with: java
has comment: http://stackoverflow.com/comment/35587944
has comment: http://stackoverflow.com/comment/35587816
tagged with: trie
score: 0
tagged with: iterator
answer count: 1
tagged with: iteration
has comment: http://stackoverflow.com/comment/35587814

http://stackoverflow.com/q/23285459
tagged with: java
has answer: http://stackoverflow.com/a/23285968
accepted answer: http://stackoverflow.com/a/23285968
linked to: http://stackoverflow.com/q/6612316
type: Question
answer count: 2
tagged with: font-awesome
has title: Applying different fonts to text in a button in android
score: 4
possible better answer: http://stackoverflow.com/a/23285493
has body: I am creating an android button for reload. It want to have both icon and text in the button so I am using fontawesome. But how do I apply fontawesome font and custom font I am using in my app at same Time on the buttons text.
has comment: http://stackoverflow.com/comment/35642138
favorite count: 0
has comment: http://stackoverflow.com/comment/35642725
tagged with: android
has comment: http://stackoverflow.com/comment/35642338
linked to: http://stackoverflow.com/q/11145681
upvote count: 4
has comment: http://stackoverflow.com/comment/35642211
has answer: http://stackoverflow.com/a/23285493
type: AnsweredQuestion
downvote count: 0

http://stackoverflow.com/comment/35609330
type: Comment
has text: @user2900314 probably you have to use a diff. implementation as I had mentioned in my answer. I haven't tested the code though
comment on: http://stackoverflow.com/a/23267875
type: AnswerComment
score: 0

list
type: Tag
tags question: http://stackoverflow.com/q/23171425
tags question: http://stackoverflow.com/q/23138905
tags question: http://stackoverflow.com/q/23161294
tags question: http://stackoverflow.com/q/23199657
tags question: http://stackoverflow.com/q/23272628
tags question: http://stackoverflow.com/q/23171612
tags question: http://stackoverflow.com/q/23218248
tags question: http://stackoverflow.com/q/23194702
tags question: http://stackoverflow.com/q/23137604
tags question: http://stackoverflow.com/q/23244060
tags question: http://stackoverflow.com/q/23162459
tag name: list
tags question: http://stackoverflow.com/q/23286822
tags question: http://stackoverflow.com/q/23225227
tags question: http://stackoverflow.com/q/23251682
tags question: http://stackoverflow.com/q/23136226
tags question: http://stackoverflow.com/q/23236422
tags question: http://stackoverflow.com/q/23249372
tags question: http://stackoverflow.com/q/23288643
tags question: http://stackoverflow.com/q/23208455
tags question: http://stackoverflow.com/q/23274518
tags question: http://stackoverflow.com/q/23186376
tags question: http://stackoverflow.com/q/23232413
tags question: http://stackoverflow.com/q/23143735
tags question: http://stackoverflow.com/q/23258426
tags question: http://stackoverflow.com/q/23145807
tags question: http://stackoverflow.com/q/23204309
tags question: http://stackoverflow.com/q/23230394
tags question: http://stackoverflow.com/q/23287307

http://stackoverflow.com/q/23232113
tagged with: java
type: Question
has body: i have an arraylist storing data from the database and display it in a listview, when the user clicks an item the data in the database is updated, i want to know how to refresh the items in the listview to show the updated data. //Adding item to ArrayList Cursor cursor2=shoppingListDB.rawQuery("SELECT * FROM ITEMS;", null); if (cursor2.moveToFirst()){ addArrrayList.clear(); do{ String itemName = cursor2.getString(cursor2.getColumnIndex("ITEM_NAME")); addArrrayList.add(itemName); } while (cursor2.moveToNext()); //====CODE FOR SHOWING DATA AS A SIMPLE LIST ITEM========================================= ArrayAdapter &lt;String&gt; adapter=new ArrayAdapter&lt;String&gt;(MainActivity.this,android.R.layout.simple_list_item_1,addArrrayList); view_list.setAdapter(adapter); } else{ Toast.makeText(getApplicationContext(), "DATA NOT AVAILABLE", 3000).show(); } cursor2.close(); here's my setOnItemClickListener code view_list.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView&lt;?&gt; arg0, View arg1, int arg2,long arg3) { String click = (addArrrayList.get(arg2).toString()); String[] split = click.split("\\s+"); String fSplit = split[0]; String update = "UPDATE ITEMS SET FOUND = 'YES' WHERE ITEM_NAME =" + "'"+fsplit+"'"; shoppingListDB.execSQL(update); Toast.makeText(getApplicationContext(), " " + fSplit,3000).show(); } }); how can i use notifyDataSetChanged to refresh the listview?
tagged with: notifydatasetchanged
tagged with: listview
score: 0
has answer: http://stackoverflow.com/a/23232531
upvote count: 1
downvote count: 1
answer count: 1
favorite count: 0
type: UnansweredQuestion
tagged with: android
has title: Updating listview after the user clicks item android

http://stackoverflow.com/comment/35478772
type: Comment
has text: Then cover your piece of code in try-catch, which is doing some operation.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/23195862

dreamweaver
type: Tag
tag name: dreamweaver
tags question: http://stackoverflow.com/q/23176354

http://stackoverflow.com/q/23202609
favorite count: 0
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23202645
score: 1
tagged with: java
has body: I want to search the database by giving a voucher number as search criteria but vouch number is integer so i cannot do this with the following code, please suggest some other code for this. try{ String sql = "select item_type as 'Item Type', md_by as 'Made By', model as 'Model', selling_price as 'Selling Price', purchase_price as 'Purchase Price', purchase_date as 'Purchase Date', vouch_no as 'Voucher No.', vouch_date as 'Voucher Date', record_no as 'Record No.' from purchase" where vouch_no = ?; ps = con.prepareStatement(sql); ps.setString(1 , txt_vouchno_p.getText()); rs = ps.executeQuery(); Table_p.setModel(DbUtils.resultSetToTableModel(rs)); } catch(SQLException ex){ JOptionPane.showMessageDialog(null, "Error: " + ex); } catch(Exception ex){ JOptionPane.showMessageDialog(null, "Error: " + ex); }
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/23202742
has title: Searching a integer type database field through java
answer count: 2
possible better answer: http://stackoverflow.com/a/23202742
has answer: http://stackoverflow.com/a/23202645
tagged with: jdbc
downvote count: 0

http://stackoverflow.com/comment/35406275
has text: how about the wrapper type ?
type: Comment
score: 0
comment on: http://stackoverflow.com/a/23154613
type: AnswerComment

http://stackoverflow.com/q/23204391
has body: Hello guys I have a problem in my program. I have to call the class and write or not number in the main parameter to tell how much numbers will be printed and they have to be the biggest one's. The problem is that when I print few random numbers if they are equal or some negatives they only show up one time and sometimes they are not the biggest ones. if it is not clear I'll post the code and an example . for(a = 0; a &lt; array.length; a++){ for(b = 0; b &lt; array.length-1; b++){ if(array[b] &gt; array[b+1]){ aux = array[b]; array[b] = array[b+1]; array[b+1] = aux; } I used this code to sort them but i dont know if its alright. ps: i cant use sort methods or objects just simple logic.
upvote count: 1
has comment: http://stackoverflow.com/comment/35494674
has comment: http://stackoverflow.com/comment/35494268
has answer: http://stackoverflow.com/a/23204633
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35494306
tagged with: java
has comment: http://stackoverflow.com/comment/35494588
has answer: http://stackoverflow.com/a/23204592
type: Question
answer count: 2
score: -2
has title: Sorting array java
downvote count: 3

paintcomponent
tags question: http://stackoverflow.com/q/23231886
tag name: paintcomponent
tags question: http://stackoverflow.com/q/23179053
tags question: http://stackoverflow.com/q/23273989
tags question: http://stackoverflow.com/q/23189685
tags question: http://stackoverflow.com/q/23177999
tags question: http://stackoverflow.com/q/23261953
tags question: http://stackoverflow.com/q/23234780
tags question: http://stackoverflow.com/q/23236054
tags question: http://stackoverflow.com/q/23233758
tags question: http://stackoverflow.com/q/23234143
tags question: http://stackoverflow.com/q/23253306
tags question: http://stackoverflow.com/q/23163509
tags question: http://stackoverflow.com/q/23229853
type: Tag
tags question: http://stackoverflow.com/q/23257181

http://stackoverflow.com/comment/95375020
type: QuestionComment
has text: Related: https://stackoverflow.com/questions/3695372/what-does-inputstream-available-do-in-java/3695378
comment on: http://stackoverflow.com/q/23161119
score: 0
type: Comment

http://stackoverflow.com/a/23271326
answers question: http://stackoverflow.com/q/23270113
has comment: http://stackoverflow.com/comment/35618428
has comment: http://stackoverflow.com/comment/35653259
upvote count: 2
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35618674
has comment: http://stackoverflow.com/comment/35648135
has body: However I'm expecting the recovery settings to be considered from connection factory and use recovery attempts to be for 10times Both attributes are not part of the ConnectionFactory contract so there is no way for DefaultMessageListenerContainer to figure that out. You can rewrite your config as follows to use a 10 sec recovery interval: &lt;jms:listener-container connection-factory="connectionFactory" concurrency="1" recovery-interval="10000"&gt; &lt;jms:listener destination="kpQueue" ref="kpJmsDelegator" method="onMessage" /&gt; &lt;/jms:listener-container&gt; There is no way to limit the number of recoveries but it should be fairly easy for you to extend from DefaultMessageListenerContainer and create your own extension of recoverAfterListenerSetupFailure. You could retry a number of times and if that's not working, you could call stop on the container to stop listening on that queue. That means that if the broker is failing and resume after 20 min or so, your listener won't be enabled anymore...
type: Answer
accepted answer of: http://stackoverflow.com/q/23270113
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/35647033

http://stackoverflow.com/comment/35532661
comment on: http://stackoverflow.com/q/23225731
type: Comment
score: 0
has text: I think so. If I go on eclipse in "android private library", there is android-support-v4.
type: QuestionComment

http://stackoverflow.com/a/23211261
answers question: http://stackoverflow.com/q/23191364
accepted answer of: http://stackoverflow.com/q/23191364
type: Answer
upvote count: 1
score: 1
downvote count: 0
has body: There is add command in memcached that does what you want (list of commands). To avoid calling twice or more getTheResourceFromTheRemoteServer you should emulate write locks using memcached (combination of add and delete commands). So only a thread that successfully invokes add on same particular key (RESOURCE_KEY_LOCK) should call getTheResourceFromTheRemoteServer and put it into cache. Other threads should wait and call again get(RESOURCE_KEY)
type: AcceptedAnswer

http://stackoverflow.com/comment/35535771
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23227490
has text: This seems to work for most cases. But I'm trying to extract the strings in which there are escaped quotes as well. Tried with this: "aA Bb" cCc 123 4 5 6 7xy "\"z9" "\"z9$^" This is supposed to give me "z9 as 8th argument and "z9$^ as the 9th. Thanks.

http://stackoverflow.com/comment/35520531
type: Comment
comment on: http://stackoverflow.com/a/23218697
type: AnswerComment
has text: Also i checked for your code and it gives me error alert message in ajax call not success
score: 0

http://stackoverflow.com/q/23213368
tagged with: objectdb
favorite count: 0
type: Question
answer count: 1
has body: The following code: EntityManagerFactory emf = Persistence.createEntityManagerFactory("test.odb"); EntityManager em = emf.createEntityManager(); em.getTransaction().begin(); Point p = new Point(0, 0); em.persist(p); em.getTransaction().commit(); em.getTransaction().begin(); Query query = em.createQuery("UPDATE Point SET x = 1001 where x = 0"); int updateCount = query.executeUpdate(); em.getTransaction().commit(); TypedQuery&lt;Point&gt; myquery = em.createQuery("SELECT p from Point p where p.x = 1001", Point.class); List&lt;Point&gt; results = myquery.getResultList(); System.out.println("X coordinate is: " + results.get(0).getX()); em.close(); prints out: X coordinate is: 0 which is wrong because X coordinate should be 1001 But if I change the code to: EntityManagerFactory emf = Persistence.createEntityManagerFactory("test.odb"); EntityManager em = emf.createEntityManager(); em.getTransaction().begin(); Point p = new Point(0, 0); em.persist(p); em.getTransaction().commit(); em.getTransaction().begin(); Query query = em.createQuery("UPDATE Point SET x = 1001 where x = 0"); int updateCount = query.executeUpdate(); em.getTransaction().commit(); em.close(); em = emf.createEntityManager(); TypedQuery&lt;Point&gt; myquery = em.createQuery("SELECT p from Point p where p.x = 1001", Point.class); List&lt;Point&gt; results = myquery.getResultList(); System.out.println("X coordinate is: " + results.get(0).getX()); em.close(); The result is same as expected: X coordiate is: 1001 What have I done wrong in the first code snippet?
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/23215288
tagged with: jpa
type: UnansweredQuestion
downvote count: 0
score: 1
has title: Using update queries with objectdb

http://stackoverflow.com/comment/35630733
comment on: http://stackoverflow.com/q/23279150
score: 0
type: Comment
type: QuestionComment
has text: @manan s/integer/double/

http://stackoverflow.com/comment/35499567
score: 0
type: Comment
has text: a little problem is that I can have `6,082` instead of `6,082E-15` or `6.082483660549182E-15`
type: AnswerComment
comment on: http://stackoverflow.com/a/23175431

http://stackoverflow.com/a/23263191
type: Answer
has body: This should work: Image progressbar= ImageIO.read(DatasetExporterUI.class.getResource("/progreassbar.gif")); buttonExport.setIcon(new ImageIcon(progressbar));
score: 0
answers question: http://stackoverflow.com/q/23263009

http://stackoverflow.com/a/23254339
answers question: http://stackoverflow.com/q/23254234
type: Answer
upvote count: 4
downvote count: 0
score: 4
has comment: http://stackoverflow.com/comment/35584981
has body: The Java Platform offers both the JRE and the JDK in order for users to run Java programs. The JRE stands for the Java Runtime Environment, and the JDK stands for the Java Development Kit. The JDK is meant for Java developers - that is, those who build applications/write programs in Java. It contains tools that are needed for Java coding, including -javac to compile programs. The JRE is meant for regular users - those who only need to run Java programs on their computer and are not interested in development. The reason for the discrepancy in your case is because you're looking at the JRE and JDK and trying to compare the two. The current JDK that you have is Java 8, whereas the current JRE that you have is 1.6.0_65. It is problematic that your JRE version does not match your JDK version, but without your PATH variable or other information about your install, we can't help you fix your installation.

http://stackoverflow.com/a/23267453
has comment: http://stackoverflow.com/comment/35607801
answers question: http://stackoverflow.com/q/23267099
has body: Check R.java commentary: /* AUTO-GENERATED FILE. DO NOT MODIFY. * * This class was automatically generated by the * aapt tool from the resource data it found. It * should not be modified by hand. */ as Varun said, clean and build your project to generate a new R.java file
score: 0
type: Answer

http://stackoverflow.com/comment/35422708
comment on: http://stackoverflow.com/a/23163469
has text: I'm sorry I'm a beginner at Java and what does that mean?
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/23262120
answers question: http://stackoverflow.com/q/23261959
has body: is this what you want ? inputTruth = false; while(inputTruth == false) { for(x = 0; x &lt; studentIDs.length; ++x) { if(identInput.equals(studentIDs[x])) { JOptionPane.showMessageDialog(null, "The first name associated with \nStudent ID " + intID + " is: " + firstNames[x] + "\n" + firstNames[x] + "'s current GPA is: " + gPAs[x]); inputTruth = true; break; } } if (inputTruth == false) { identInput = JOptionPane.showInputDialog(null, "The Student ID you entered " + savedIntID + "\nis not valid. \nPlease enter another Student ID: "); } }
downvote count: 0
has comment: http://stackoverflow.com/comment/35598656
type: Answer
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/35598772
has comment: http://stackoverflow.com/comment/35598322

http://stackoverflow.com/comment/35451417
comment on: http://stackoverflow.com/a/23179865
type: AnswerComment
score: 0
type: Comment
has text: Damn, you StackOverflow guys are awesome. Spent 2.5 hours stressing over something so simple </3 Thanks buddy!

http://stackoverflow.com/q/23149169
has comment: http://stackoverflow.com/comment/35397632
has answer: http://stackoverflow.com/a/23149224
accepted answer: http://stackoverflow.com/a/23149224
tagged with: java
tagged with: file
type: Question
has comment: http://stackoverflow.com/comment/35397228
type: AnsweredQuestion
has title: Writing a 2D Array to a string, then to a .txt file - Java
has comment: http://stackoverflow.com/comment/35397439
score: 0
has body: I have a Method that calls a second method, the second method will: Create any missing directories Create a file Decode a 2D String[] to a String (Not working) Write content Write the decoded String to the file with a header (Not working) First method public static boolean store(Exception exception, String[][] flags){ return storePrivate(exception, location, flags); } Second Method (Not all code just relevant code) private static boolean storePrivate(Exception exception, String dir, String[][] flags){ String flag = ""; for(int i = 0; i &gt;= flags.length; i++){ flag = flag + "" + flags[i][0] + ": " + flags[i][1] + "\n"; } try { File directory = new File(dir); File file = new File(dir + id + ".txt"); if (!directory.exists()) { directory.mkdirs(); } file.createNewFile(); FileWriter filewriter = new FileWriter(file.getAbsoluteFile()); BufferedWriter writer = new BufferedWriter(filewriter); if(flag != ""){ writer.write("Flags by Developer: "); writer.write(flag); } writer.flush(); writer.close(); return true; } catch (IOException e) { return false; } } Call to the first method public static void main(String[] args) { try { test(); } catch (Exception e) { // TODO Auto-generated catch block ExceptionAPI.store(e, new String[][]{{"flag1", "Should be part of flag1"}, {"flag2", "this should be flag 2 contence"}}); } } public static void test() throws IOException{ throw new IOException(); } I cant find why this won't work. I think it has to do with the second method, particularly if(flag != ""){ writer.write("Flags by Developer: "); writer.write(flag); } Thanks if anyone can help me. Curlip
answer count: 1
tagged with: string
tagged with: multidimensional-array

http://stackoverflow.com/q/23197169
favorite count: 0
type: UnansweredQuestion
downvote count: 2
has body: I have two different modules. one module run on local network and other on web. The local module accepts different parameters. According to passed parameters it executes specific code snippet. I want to send input from web to module that runs locally so that it can run with given paramenter. but I am getting error : "XMLHttpRequest cannot load http://192.168.xx.xx:8080/myurl. Origin http://localhost:8080 is not allowed by Access-Control-Allow-Origin." In my case I have to send request to specific IP address (where servelet processes a input) from mydomain. How do I set cross domain request using jsp to resolve above given error?
tagged with: java
has answer: http://stackoverflow.com/a/23197222
type: Question
upvote count: 0
score: -2
answer count: 1
tagged with: jsp
tagged with: javascript
tagged with: struts2
has title: How to resolve "XMLHttpRequest cannot load" issue?

http://stackoverflow.com/q/23219801
tagged with: timeunit
has title: How do i set up a DelayQueue's Delay
has answer: http://stackoverflow.com/a/31785129
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/41380934
tagged with: java
accepted answer: http://stackoverflow.com/a/23220113
tagged with: queue
has body: I'm just starting out coding in java i'm in struggling with setting up a DelayQueue, I wanted to have it so, DelayQueue queue = new DelayQueue(); If (counter &gt; 0){ queue.offer(Integer, *A custom delay*) } Else { queue.offer(Integer, *A different custom delay*) } I'm just trying to learn all the basics and ive read over the API and cant seem to grasp it. Thanks in advance
type: Question
upvote count: 4
downvote count: 0
tagged with: delay
has answer: http://stackoverflow.com/a/23220113
score: 4
has answer: http://stackoverflow.com/a/23219985
possible better answer: http://stackoverflow.com/a/41380934
answer count: 4
favorite count: 0

http://stackoverflow.com/a/23158559
score: 2
accepted answer of: http://stackoverflow.com/q/23158493
answers question: http://stackoverflow.com/q/23158493
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 2
has body: You are trying to assign value to method call. It does not work like that. You need to create s setter for name variable. public void setName(String name) { this.name = name; } Then your if block would be if(pigArray[k].getName().trim().compareTo(pigArray[i].getName().trim())&lt; 0){ String temp = pigArray[i].getName(); pigArray[i].setName( pigArray[k].getName ); pigrray[k].setName(temp); }

http://stackoverflow.com/comment/35632819
type: QuestionComment
has text: Hey man, [array indexes start at 0](http://docs.oracle.com/javase/tutorial/java/nutsandbolts/arrays.html)
comment on: http://stackoverflow.com/q/23280052
score: 0
type: Comment

http://stackoverflow.com/comment/35661030
type: AnswerComment
has text: Read [Difference between paint, paintComponent and paintComponents in Swing](http://stackoverflow.com/questions/9389187/difference-between-paint-paintcomponent-and-paintcomponents-in-swing)
type: Comment
comment on: http://stackoverflow.com/a/23290622
score: 0

http://stackoverflow.com/comment/35438622
type: QuestionComment
comment on: http://stackoverflow.com/q/23168668
score: 0
has text: @Darkhogg please let me know if you have a solution
type: Comment

http://stackoverflow.com/comment/60409988
comment on: http://stackoverflow.com/a/36396654
type: AnswerComment
score: 4
type: Comment
has text: The above code will return rgb value. If you want to convert to hex, you can go to http://stackoverflow.com/questions/19668893/getcssvalue-color-in-hex-format-in-selenium-webdriver

http://stackoverflow.com/a/23143229
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23143129
type: Answer
has body: What you are doing there is creating two objects that read from standard input (your keyboard) and then, you are trying to add those objects together. For start, use: import java.util.*; public class HiWorld { public static void main(String[] args) { System.out.println("Type 2 Numbers"); Scanner input = new Scanner(System.in); int x = input.nextInt(); int y = input.nextInt(); int answer = x + y; System.out.println(answer); } }
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/23143129
upvote count: 1

http://stackoverflow.com/a/23202086
has comment: http://stackoverflow.com/comment/35490628
score: 0
accepted answer of: http://stackoverflow.com/q/23201984
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23201984
has body: When you add the child panel to his parent, you do this: MainPanel.add(game1, "card3"); "card3" is the name you must use to refer to that child panel, so then you must use: cardLayout.show(MainPanel, "card3");
type: Answer
has comment: http://stackoverflow.com/comment/35490800
has comment: http://stackoverflow.com/comment/35490500

http://stackoverflow.com/comment/35635043
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23281491
has text: Still i am getting same error. I am looking for unique result if it is available or not in specific externaleventid column in my java program
type: Comment

http://stackoverflow.com/comment/35383685
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/23141347
type: Comment
has text: 1) Use System.out.println(...) (or) debug mode to make sure value in that index is what you want 2) If value is correct, make sure you can talk to that machine by typing ping in ms-dos command prompt.

http://stackoverflow.com/q/23180478
has comment: http://stackoverflow.com/comment/35452532
has comment: http://stackoverflow.com/comment/35452410
has comment: http://stackoverflow.com/comment/35452518
tagged with: ipad
has comment: http://stackoverflow.com/comment/35453692
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35452395
answer count: 0
tagged with: java
has title: How to find USB product id of the iPad Air (For java usage)
type: Question
tagged with: ios
has body: I'm trying to find out what is the model number/product id of the iPad Air. I already have the numbers of other models, for example: iPhone3: 4759 / 4763 / 4764 iPad2: 0x129f / 0x12a2 / 0x12a3 iPad3: 4772 / 4779 I don't know where the other guy got them (can't ask him). Note: I'm connecting an iOS device to my PC and and then running my application on the PC. I also found this page, this is not what I'm looking for. Java code: public enum ProductID { iPhone1_1(4752), iPhone1_2(4754), iPhone2_1(4756), ... , iPad2_3(0x12a3), iPad3_1(4772), iPad3_2(4779), iPod5_1(4778), Unknown(-1); int id; ..... functions ..... public IOSDevice getDeviceName(){ switch(this){ case iPhone1_1: case iPhone1_2: ..... default: return IOSDevice.iphone; } } } UPDTAE I found this page, it might be helpful to people who search usb ids.
score: 0

http://stackoverflow.com/q/23131527
answer count: 1
type: UnansweredQuestion
has title: Hadoop - No job jar file set. User classes may not be found
tagged with: java
has answer: http://stackoverflow.com/a/23134885
type: Question
tagged with: hadoop
has body: I use the code here http://blog.cloudera.com/blog/2012/12/how-to-run-a-mapreduce-job-in-cdh4/. However, when I type sudo -u hdfs hadoop jar target/gapdeduce-1.0-SNAPSHOT.jar GapDeduceRunner /gaps/gaplog.txt /gaps/output It gives me the error like this: WARN mapred.JobClient: No job jar file set. User classes may not be found. See JobConf(Class) or JobConf#setJar(String). How can I solve this porblem?
score: 0

http://stackoverflow.com/comment/35493773
comment on: http://stackoverflow.com/q/23203309
has text: @ajb Well I am still in High School. My age is only (16 yrs). ;):)
type: Comment
type: QuestionComment
score: 2

http://stackoverflow.com/comment/35418633
has text: on 1 line the sample shows the input file
comment on: http://stackoverflow.com/q/23161245
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/a/23338977
has body: finally i got the answer in my AndroidManifest.xml i just removed this line android:targetSdkVersion="18"
downvote count: 0
score: 1
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23261125
answers question: http://stackoverflow.com/q/23261125
type: Answer

http://stackoverflow.com/q/23270929
answer count: 1
downvote count: 0
tagged with: har
favorite count: 0
has answer: http://stackoverflow.com/a/23277225
type: UnansweredQuestion
upvote count: 1
tagged with: selenium-webdriver
has title: Is there a way to capture cancelled requests using a har proxy?
score: 1
tagged with: java
tagged with: selenium
type: Question
tagged with: proxy
has body: in my project, I have some JavaScript responsible for tracking user actions in order to optimize the page's layout. These calls are executed when the user clicks something, including the links leading to further pages. I have the whole flow covered by automated tests written in Java and based on Selenium Webdriver. I'm using a Browsermob proxy to capture the requests and verify that the correct data is being passed to the user tracking service. In certain situations, the requests hitting the service do not get recorded by the proxy. The reason this happens is because the browser navigates to the next page before getting the response from the tracking service. The request actually hits the destination, which I can see by the state of the database. Because the browser does not wait for the responses, they happen not to be noticed by the proxy, despite the default 5 second wait, which just seems to be ignored in this case. This only happens once in a while, causing false negatives in my test reports. I can't force the browser to actually wait for those requests because I don't want the tracking to impede the user journey. What I'd like to do is to somehow configure the proxy to tell the difference between requests that have not been sent and the ones cancelled midway. This way I could attach this information to my reports. Is this possible to achieve using the Browsermob proxy? Perhaps some other tool would do a better job.

http://stackoverflow.com/comment/35575090
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23249428
score: 1
has text: The question is rather how to unit-test this method than to fix it...

http://stackoverflow.com/comment/35461762
score: 0
has text: why not do it in an ide
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23185975

http://stackoverflow.com/comment/35409152
score: 0
comment on: http://stackoverflow.com/a/23155993
type: Comment
has text: @PaulBellora What do you mean by bug? It passes through the compiler. Moreover, there are usecases where this can be useful. (Say getVal would return a value from the database then Test.<String>getVal(fld) and Test.<Integer>getVal(fld) could be used to return String and Integer respectively)
type: AnswerComment

http://stackoverflow.com/a/23207736
score: 0
has comment: http://stackoverflow.com/comment/35501612
answers question: http://stackoverflow.com/q/23207568
has comment: http://stackoverflow.com/comment/35539055
type: Answer
has body: Don't do this. Html is notorious in this regard. Some tags have no openning/closing &lt; > -- then there is all the malformed HTML just out there and browser quirkiness. Unless your professor explicitly excludes you from using a 3rd party lib then this is insanity to attempt on a robust scale. On XML, this is manageable. If you really, really must do this on your own, decent results can be had using regular expression Pattern p = Pattern.compile("&lt;(.*)&gt;") // will get your started. you can then do: Matcher m = p.matcher(); m.group( ... ) // this will get you everything between parentheses in the regex
has comment: http://stackoverflow.com/comment/35501003

http://stackoverflow.com/a/23139666
has comment: http://stackoverflow.com/comment/35380466
score: 2
answers question: http://stackoverflow.com/q/23138356
upvote count: 2
has body: The sequence would be this: Thread A calls getInstance. Thread A takes the lock for a while, time to check that instance is not null, which it isn't at this point. Thread LogThread completes it's execution, isRunning is set to false. instance is set to false, but is still retained by Thread A Thread A calls start on the instance. isRunning is false, therefore start is called, hence the crash. A quick fix would be to not set isRunning to false, since there is never any good reason for that instance to be available for starting again. It should then be renamed isStarted for consistency with what it does. A proper solution would be to use a newSingleThreadExecutor, as suggested by @Mani
accepted answer of: http://stackoverflow.com/q/23138356
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/a/23162185
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23162087
has body: If your object graph contains only Serializable classes, a common way to do a deep clone is to serialize the initial object and deserialize the result. You can do this using ObjectOutputStream and ObjectInputStream classes.
accepted answer of: http://stackoverflow.com/q/23162087
upvote count: 3
type: Answer
has comment: http://stackoverflow.com/comment/35420754
downvote count: 0
has comment: http://stackoverflow.com/comment/35420322
score: 3

http://stackoverflow.com/q/23250112
has comment: http://stackoverflow.com/comment/35576499
has body: I have been developing a software that uses AES-256 encryption to write a file. I am using Eclipse 64 bits and JDK7. The thing is that when I compile and execute the code, it works perfectly, both encrypt and decrypt algorythms. When I pack a Runnable JAR and run it, it works fine too...but when I pack the Runnable JAR to a Windows Executable (.exe) with Advanced Installer 9.4, install it (both W7 32 bits and 64 bits)...a NoSuchProviderException pops-up and anything gets encrypted/decrypted. I need to distribute this software to many users and cannot find a way to run the .exe public static String AES_Encode(String str, String key) throws Exception { Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding"); SecretKeySpec secretKey = new SecretKeySpec(key.getBytes("UTF-8"), "AES"); cipher.init(Cipher.ENCRYPT_MODE, secretKey); String encryptedString = Base64.encodeBase64String(cipher.doFinal(str.getBytes("UTF-8"))); return encryptedString; } public static String AES_Decode(String str, String key) throws Exception { Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding"); SecretKeySpec secretKey = new SecretKeySpec(key.getBytes("UTF-8"), "AES"); cipher.init(Cipher.DECRYPT_MODE, secretKey); String decryptedString = new String(cipher.doFinal(Base64.decodeBase64(str)),"UTF-8"); return decryptedString; } I have tried to show the providers available and SunJCE or JCE are not available when I run the software once installed in Windows; although they are when I run the JAR or the compiled code. Is there anything I can do? May I switch to Bouncy Castle? How (what JAR or similar do I need to integrate in my project?) Thanks for your time and help!
tagged with: nosuchproviderexception
has comment: http://stackoverflow.com/comment/35599919
tagged with: cryptography
tagged with: aes
score: 2
downvote count: 0
accepted answer: http://stackoverflow.com/a/23358765
tagged with: encryption
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35615759
has answer: http://stackoverflow.com/a/23358765
tagged with: java
type: Question
upvote count: 2
has title: AES 256 Encryption/Decryption NoSuchProviderException when packing in .exe (with Advanced Installer 9.4)
answer count: 1
has comment: http://stackoverflow.com/comment/35606171
favorite count: 0
has comment: http://stackoverflow.com/comment/35599387

http://stackoverflow.com/comment/35422669
has text: @Jongware imo anything but a 2D array is severly overcomplicating things. I only included the other two because they were mentioned. In theory, you could use a quadtree, in practice, anything but a 2D array is kinda pointless.
comment on: http://stackoverflow.com/a/23162927
type: AnswerComment
type: Comment
score: 0

http://stackoverflow.com/comment/35389028
score: 0
comment on: http://stackoverflow.com/q/23144367
type: Comment
type: QuestionComment
has text: Post a minimal working example if you can.

http://stackoverflow.com/comment/35593584
type: Comment
score: 0
type: AnswerComment
has text: Nit: 'Cannot find symbol' errors are not related to variable initialization; that's another problem.
comment on: http://stackoverflow.com/a/23259200

http://stackoverflow.com/q/23196876
tagged with: blur
has comment: http://stackoverflow.com/comment/35482062
favorite count: 0
tagged with: android
answer count: 0
downvote count: 0
type: UnansweredQuestion
score: 1
tagged with: bitmap
type: Question
has comment: http://stackoverflow.com/comment/35482911
has comment: http://stackoverflow.com/comment/35483862
tagged with: java
has body: I'm trying to create a very simple blur effect on a bitmap and although I do know that there are algorithms out there already, I'd still like to understand how they work. This is the code I have so far, there's nothing in there that resembles a blur algorithm at the moment, I just wanted to know how the setPixels method works a little better. public void blurTest(Bitmap sentBm) { Bitmap blurredBitmap = sentBm; int bmWidth = sentBm.getWidth(); int bmHeight = sentBm.getHeight(); int[] pixels = new int[bmWidth * bmHeight]; sentBm.getPixels(pixels, 0,bmWidth,0,0,bmWidth,bmHeight); for (int i = 0; i &lt; 200000; i++) { pixels[i] = Color.BLACK; } blurredBitmap.setPixels(pixels, 0, bmWidth, 0, 0, bmWidth, bmHeight); I've done some research on how blur algorithms work and while I do understand the theory behind them, I don't know how to apply it to each pixels. For example, how much is pixel is being blurred is often expressed using weight numbers. A pixel that is two pixels away from the center has a weight of 0.065 or something like that for example. It makes sense but how do I programmatically scan each pixel and add weights to the nearby pixels? I just need the simplest possible algorithm there is, to learn from. Or do make things even more simple - how do I add 25% pure blue to all pixels? This is what confuses me the most, how to add and subtract value from the individual pixels. Any help is appreciated, thanks!
has comment: http://stackoverflow.com/comment/35481085
upvote count: 1
has comment: http://stackoverflow.com/comment/35481674
linked to: http://stackoverflow.com/q/8218438
has title: How do I "control" a pixel array in Android? (Blur)

http://stackoverflow.com/q/23279091
favorite count: 0
score: 15
has comment: http://stackoverflow.com/comment/35804187
has comment: http://stackoverflow.com/comment/35770886
linked to: http://stackoverflow.com/q/320542
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/30900772
has comment: http://stackoverflow.com/comment/35792593
has title: Redux: How do I get Jython to use Python modules stored in Lib within its own jar file when running in Hadoop?
tagged with: java
has answer: http://stackoverflow.com/a/24006511
type: Question
upvote count: 15
tagged with: hadoop
answer count: 2
has comment: http://stackoverflow.com/comment/35770384
tagged with: jython
linked to: http://stackoverflow.com/q/1252965
has body: I'm attempting to use Jython for an implementation within Hadoop 1.2.1. I have seen strikingly little about Jython+Hadoop other than stale projects (like code.google.com/p/happy), and a stale implementation in $HADOOP_HOME/src/examples/python/WordCount.py, so perhaps I'm barking up the wrong tree to begin with... but this seems reasonable and possible. I am also very aware of Hadoop Streaming, with which I can use Python in Hadoop without using Jython, but that's not what I'm trying to do here. Basically, when I invoke the embedded/standalone Jython jar file using java -jar /full/path/to/myjythonjar.jar, the /full/path/to/myjythonjar.jar/Lib is in my Python sys.path, but when I invoke using bin/hadoop jar /full/path/to/myjythonjar.jar input output the ...jar/Lib is not in my path, and the script can't find the Python modules I'm referencing. Here's what I'm doing... I'm using the standalone version of the Jython jar, and using the JarRunner interface, roughly as described on SO here and other places; essentially as follows: cp jython-standalone-2.7-b1.jar jythonsalib_test.jar jar ufe jythonsalib_test.jar org.python.util.JarRunner __run__.py That is, take a copy of the standalone jar, add my script with name __run__.py, and change the Manifest to execute JarRunner -- many thanks to @Frank Wierzbicki for that gem. This all works fine when I'm running directly as, e.g., java -jar jythonsalib_test.jar My sys.path reports that it includes '/full/path/to/jar/file/jythonsalib_test.jar/Lib', which is exactly what I expect, and it is the path from which I'm getting the Python modules (empirically tested by setting sys.path to null-list (fails) and ONLY that path (works)). When I run this same jar in Hadoop, e.g., as bin/hadoop jar /full/path/to/jar/file/jythonsalib_test.jar input output sys.path only includes ['__classpath__', '__pyclasspath__'] I've also used the Jython standalone jar versions 2.5.4-rc1 (which has the same behavior described above) and 2.5.3 (that doesn't w…
downvote count: 0
tagged with: python

http://stackoverflow.com/comment/35511306
score: 0
comment on: http://stackoverflow.com/a/23213876
type: Comment
has text: True, and it all can be done easily with regex and grouping:)
type: AnswerComment

http://stackoverflow.com/comment/35384869
type: Comment
has text: I've always just used the command line version, to be honest. But if you are using [e(fx)clipse](http://www.eclipse.org/efxclipse/index.html) (which I recommend), there's a [brief tutorial](http://wiki.eclipse.org/Efxclipse/Tutorials/Tutorial1) which includes deployment.
score: 1
comment on: http://stackoverflow.com/q/23140450
type: QuestionComment

http://stackoverflow.com/a/23295534
has body: You should only use the olap4j interfaces. The mondrian implementations are, albeit visible publicly, subject to change without notice. If there are methods or fields that you think should have been part of the olap4j specifications but are not accessible, I'd encourage you to report your findings to the olap4j mailing list and we'll review the proposed changes. We're currently drafting the revision 2.0, so now's the best of time to do so.
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/23265579
answers question: http://stackoverflow.com/q/23265579
score: 1
upvote count: 1

http://stackoverflow.com/comment/35629681
has text: Ah, nice! I hadn't thought of that. Thanks!
comment on: http://stackoverflow.com/a/23278726
type: AnswerComment
type: Comment
score: 0

http://stackoverflow.com/comment/35543016
type: AnswerComment
has text: I don't have the JDK available at the moment, so please let me know if this code fails.
comment on: http://stackoverflow.com/a/23231357
type: Comment
score: 0

http://stackoverflow.com/q/23246289
tagged with: maven
upvote count: 7
type: Question
has comment: http://stackoverflow.com/comment/35905451
has answer: http://stackoverflow.com/a/23364769
answer count: 1
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/23364769
tagged with: cascade
has title: How to make cascade version set in maven?
type: AnsweredQuestion
has body: I have multimodule maven project and want to automate part of release preparing. Before release I increase the version of changed module A, and because I have module B depends on A, I also need to increase version of B. I know that there is "versions" and "release" maven plugins, but they doesn't cascade the update of version . Is it possible to make update of B version automaticly too? Some additions to make it clear: We don't use version of parent module, so i don't need to update it. Before version bump: parent module (1.0) | |-- A module (0.01.00) |-- B module (0.02.00) After version bump: parent module (1.0) | |-- A module (0.01.01) |-- B module (0.02.01)
has comment: http://stackoverflow.com/comment/35571019
tagged with: java
score: 7

http://stackoverflow.com/comment/35474305
type: Comment
has text: `setListAdapter` is a method of the `ListActivity` and `ListFragment` classes: http://developer.android.com/reference/android/app/ListActivity.html#setListAdapter(android.widget.ListAdapter) and http://developer.android.com/reference/android/app/ListFragment.html#setListAdapter(android.widget.ListAdapter)
comment on: http://stackoverflow.com/q/23193138
score: 1
type: QuestionComment

http://stackoverflow.com/comment/35587914
type: AnswerComment
comment on: http://stackoverflow.com/a/23236199
has text: @Mikkel - thanks, I plan to return to the DOM parser approach once I graduate. Two more assignments to go woot wooot!
score: 0
type: Comment

http://stackoverflow.com/a/23220109
has body: Something like bb = ByteBuffer.allocate(300).put(bb).put(bb2); should do the job: Create a buffer that is large enough to hold the contents of both buffers, and then use the relative put-methods to fill it with the first and the second buffer. (The put method returns the instance that the method was called on, by the way)
type: Answer
upvote count: 13
score: 13
answers question: http://stackoverflow.com/q/23219644
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23219644
has comment: http://stackoverflow.com/comment/63443779
has comment: http://stackoverflow.com/comment/63441194

http://stackoverflow.com/a/23212476
answers question: http://stackoverflow.com/q/23212238
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/35509427
has comment: http://stackoverflow.com/comment/35516105
has comment: http://stackoverflow.com/comment/35513994
has comment: http://stackoverflow.com/comment/35513123
type: Answer
accepted answer of: http://stackoverflow.com/q/23212238
has comment: http://stackoverflow.com/comment/35509578
has comment: http://stackoverflow.com/comment/35509806
has comment: http://stackoverflow.com/comment/35514940
score: 16
has comment: http://stackoverflow.com/comment/35515343
has comment: http://stackoverflow.com/comment/35508875
upvote count: 16
has comment: http://stackoverflow.com/comment/35514566
has body: You can make separate class for EnglishNumberToWords as in the example link. and in your button click you have to just call String return_val_in_english = EnglishNumberToWords.convert(YOUR_NUMBER_TO_CONVERT); public class EnglishNumberToWords { private static final String[] tensNames = { "", " ten", " twenty", " thirty", " forty", " fifty", " sixty", " seventy", " eighty", " ninety" }; private static final String[] numNames = { "", " one", " two", " three", " four", " five", " six", " seven", " eight", " nine", " ten", " eleven", " twelve", " thirteen", " fourteen", " fifteen", " sixteen", " seventeen", " eighteen", " nineteen" }; private static String convertLessThanOneThousand(int number) { String soFar; if (number % 100 &lt; 20) { soFar = numNames[number % 100]; number /= 100; } else { soFar = numNames[number % 10]; number /= 10; soFar = tensNames[number % 10] + soFar; number /= 10; } if (number == 0) return soFar; return numNames[number] + " hundred" + soFar; } public static String convert(long number) { // 0 to 999 999 999 999 if (number == 0) { return "zero"; } String snumber = Long.toString(number); // pad with "0" String mask = "000000000000"; DecimalFormat df = new DecimalFormat(mask); snumber = df.format(number); // XXXnnnnnnnnn int billions = Integer.parseInt(snumber.substring(0, 3)); // nnnXXXnnnnnn int millions = Integer.parseInt(snumber.substring(3, 6)); // nnnnnnXXXnnn int hundredThousands = Integer.parseInt(snumber.substring(6, 9)); // nnnnnnnnnXXX int thousands = Integer.parseInt(snumber.substring(9, 12)); String tradBillions; switch (billions) { case 0: tradBillions = ""; break; case 1: tradBillions = convertLessThanOneThousand(billions) + " billion "; break; default: tradBillions = convertLessThanOneThousand(billions) + " billion "; } String result = tradBillions; String tradMillions; switch (millions) { case 0: tradMillions = ""; break; case 1: tradMillions = convertLessThanOneThousand(millions) + " million "; break; default: tradMillions = conve…
has comment: http://stackoverflow.com/comment/35510154
has comment: http://stackoverflow.com/comment/35512438
has comment: http://stackoverflow.com/comment/35509721
has comment: http://stackoverflow.com/comment/35514752
has comment: http://stackoverflow.com/comment/35509106
has comment: http://stackoverflow.com/comment/35514811
has comment: http://stackoverflow.com/comment/35515303
has comment: http://stackoverflow.com/comment/35515014

http://stackoverflow.com/comment/35390288
type: AnswerComment
has text: I thought this was pretty good for giving a direction to go without just handing the OP the code.
comment on: http://stackoverflow.com/a/23145068
type: Comment
score: 2

http://stackoverflow.com/comment/35539631
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23228610
type: AnswerComment
has text: So how can you tell good or bad without knowing use case? You can't prove opposite, why do you put stupid comments? I request you to remove it.

http://stackoverflow.com/comment/35646797
comment on: http://stackoverflow.com/q/23288119
has text: You need to add an alias to the projection
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/35530374
type: QuestionComment
comment on: http://stackoverflow.com/q/23224491
has text: I'm pretty sure its impossible for java to detect external system events, as its too higher level and sits in its own JVM. You'd be better off using c++/c#.
score: 1
type: Comment

http://stackoverflow.com/a/23197028
has body: Integer.parseInt converts a string to an int (32 bits)
answers question: http://stackoverflow.com/q/23196934
score: 0
type: Answer

http://stackoverflow.com/a/23185139
type: Answer
answers question: http://stackoverflow.com/q/23185116
score: 0
has body: If you don't need to initialize something, just leave it blank. for(; num2==0; num2--){ test1 = num1*num2; test = String.valueOf(test1); }

http://stackoverflow.com/comment/35620506
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/23273634
has text: @John B: Even if you delete, any of the test case. Other test case will work.
score: 0

http://stackoverflow.com/comment/35377624
score: 0
type: Comment
has text: If the `main` function really must appear verbatim in your solution then you'll have to do something along these lines. I take issue with this assignment, though - much better would be to compute line, word, and character count in a single pass.
type: AnswerComment
comment on: http://stackoverflow.com/a/23138014

http://stackoverflow.com/a/71292542
answers question: http://stackoverflow.com/q/23206148
score: 0
has body: here you go!! class nested_loop { void display () { char i,j;//i loop controls number of lines and j controls number of times in each line for(i='A';i&lt;='E';i++) { { for(j='A';j&lt;='E';j++) { System.out.print(j); } System.out.println();//blank print statement takes control to the next line } } } }
type: Answer

http://stackoverflow.com/a/23246040
has body: Instead of enhanced for loop for(String s: this.graf.keySet()), use an Iterator You cannot modify the collection while iterating over it with the use of enhanced for loop.
has comment: http://stackoverflow.com/comment/35569102
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/23245979
has comment: http://stackoverflow.com/comment/35569006
downvote count: 0
score: 1

http://stackoverflow.com/comment/35510635
type: QuestionComment
has text: @Taba You extend `ActionBarActivity` in Words but i don't see `onCreate`. No layout set to the Activity and you iniitlaize `EditText`. It is probably meant to be a utility class. Its better you start with a tutorial
comment on: http://stackoverflow.com/q/23213381
score: 0
type: Comment

http://stackoverflow.com/comment/35479558
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23194076
type: Comment
has text: thanks u and I simply got tensed and frustated it is fault in SDk manager

http://stackoverflow.com/comment/35364284
type: QuestionComment
has text: @Kedarnath please read my question properly. even `while(true)` is also a work for thread. so do you mean UI thread just sits on `while(true)` condition when it is idle?
comment on: http://stackoverflow.com/q/23131002
score: 0
type: Comment

http://stackoverflow.com/q/23180992
has comment: http://stackoverflow.com/comment/35453915
score: 0
has title: libgdx: sprite break like a glass
answer count: 1
has comment: http://stackoverflow.com/comment/35454814
has body: I have a sprite which is ball. Let's say, it represents a glass ball. I am rendering the graphics with SpriteBatch. Is it possible in libgdx to have a breaking glass effect for the ball? Meaning, I want to split the sprite to different pieces with abnormal borders (not rectangular) and then draw them flying to different directions.
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23185989
tagged with: java
type: Question
tagged with: libgdx

http://stackoverflow.com/q/23238533
favorite count: 0
has title: Java: Can we reuse MBeanServerConnection without any issue?
has answer: http://stackoverflow.com/a/23238743
tagged with: jmx
upvote count: 1
type: AnsweredQuestion
score: 1
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/23238743
has body: Can we assign MBeanServerConnection object to a static variable and reuse? If yes, which moment we need to call JMXConnector.close() method? public class MyClass { public static JMXConnector jmxc = . . . public static MBeanServerConnection mbsc = jmxc.getMBeanServerConnection(); ......... public logSomeJmxStats() { mbsc.invoke(.....) } public updateSomeJmxStats() { mbsc.invoke(.....) } } This Java class is used by Java application running as a service.
downvote count: 0
answer count: 1

http://stackoverflow.com/q/23239304
tagged with: java
type: Question
upvote count: 4
accepted answer: http://stackoverflow.com/a/23489789
score: 4
tagged with: amazon-web-services
has body: I am trying to upload a file to a S3 container and before doing the upload, I am setting the metadata of the file. The upload fails with an error saying signature doesn't match. Below is the code I am using : public URL send(File f, HashMap&lt;String,String&gt; metadata, String type) throws Exception { String path = type+"/"+f.getName(); InitiateMultipartUploadRequest req = new InitiateMultipartUploadRequest(container, secretKey).withKey(path); req.setCannedACL(CannedAccessControlList.AuthenticatedRead); if (metadata != null) { ObjectMetadata objectMetadata = new ObjectMetadata(); Set&lt;String&gt; keys = metadata.keySet(); Iterator&lt;String&gt; i = keys.iterator(); while (i.hasNext()) { String key = i.next(); objectMetadata.addUserMetadata(key, metadata.get(key)); } req.setObjectMetadata(objectMetadata); } InitiateMultipartUploadResult res = s3client.initiateMultipartUpload(req); String uploadId = res.getUploadId(); long fileSize = f.length(); //check the size doesn't exceed max limit if (fileSize &gt; MAX_OBJ_SIZE) { throw new Exception("Object size exceeds repository limit"); } long chunkSize = 1024 * 1024 * 16; int chunks = (int) (fileSize/chunkSize + 2); List&lt;PartETag&gt; chunkList = new ArrayList&lt;PartETag&gt;(); long pos = 0; try { for (int i = 1; i &lt; chunks; i++) { if ((chunks -i) &lt; 2) { chunkSize = fileSize - pos; } UploadPartRequest upReq = new UploadPartRequest() .withBucketName(container).withKey(path) .withUploadId(uploadId).withPartNumber(i) .withFileOffset(pos).withFile(f) .withPartSize(chunkSize); PartETag pTag = null; // repeat the upload until it succeeds. boolean repeat; do { repeat = false; // reset switch try { // Upload part and add response to our list. pTag = s3client.uploadPart(upReq).getPartETag(); } catch (Exception ex) { repeat = true; // repeat } } while (repeat); chunkList.add(pTag); pos = pos + chunkSize; } CompleteMultipartUploadRequest compl = new CompleteMultipartUploadRequest( container, secretKey, uploadId, chunkList).…
has comment: http://stackoverflow.com/comment/35603517
downvote count: 0
answer count: 1
favorite count: 0
has title: Error with AWS Java SDK doing an upload with metadata
has comment: http://stackoverflow.com/comment/35578084
has answer: http://stackoverflow.com/a/23489789
type: AnsweredQuestion
tagged with: amazon-s3

http://stackoverflow.com/comment/35598701
score: 1
type: AnswerComment
has text: Consider two classes: `class A` and `class B extends A`. A has method `static synchronized int add()`. Now from B class, if I call `B.add()`, it will lock B class object right, and if I call `A.add()`, A class object will be locked right? And when B class object is locked, another thread can not modify other B static fields or methods etc.,. if they are synchronized. If not synchronized, can be modified by any number of threads simultaneously?
type: Comment
comment on: http://stackoverflow.com/a/23262127

http://stackoverflow.com/a/23235223
score: 4
type: Answer
answers question: http://stackoverflow.com/q/23218745
has body: The following solution worked for me: XStream xstream = new XStream(new DomDriver()); xstream.alias("EntityFields", EntityFields.class); xstream.addImplicitCollection(EntityFields.class, "entityFlds"); xstream.alias("EntityField", EntityField.class); EntityFields entityFields = (EntityFields)xstream.fromXML(buff.toString());
upvote count: 4
downvote count: 0

http://stackoverflow.com/comment/35580259
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23251473
has text: No they are not being converted. I inserted a file xxx.gwt.xml to my jar file so that GWT Compiler could understand those classes but it can not.

http://stackoverflow.com/q/23273298
type: AnsweredQuestion
has title: Amazon EC2 stops working unexpectedly
has answer: http://stackoverflow.com/a/23275948
accepted answer: http://stackoverflow.com/a/23275948
upvote count: 1
has comment: http://stackoverflow.com/comment/35619367
answer count: 1
tagged with: amazon-ec2
tagged with: amazon-web-services
favorite count: 0
has body: I am facing a problem that is burning my brain. I have an amazon ec2 instance that runs Linux AMI, I installed tomcat7 and I am deploying my webservice in it. This webservice connects itself with an amazon RDS instance where I have my mysql (that I use to validate user and password). When I start my tomcat7 service everything works great, after one hour I can't log in into my system. If i restart the tomcat7 service, everything works again. But why? I really don't know where is the problem. I can connect to my database directly from my project in eclipse, and via command line. I don't know why if I restart the service, my webservice works again. I know that the service hasn't stoped, because I can access the login page of my webapp. I really appreciate any kind of help, Rodrigo Araujo. ps: Last week, everything was working just fine.
has comment: http://stackoverflow.com/comment/35621685
downvote count: 0
score: 1
tagged with: java
tagged with: mysql
tagged with: web-services
type: Question

http://stackoverflow.com/comment/35492683
type: QuestionComment
has text: Both `String#format` and `PrintWriter#printf` have been around since Java 1.5.
score: 0
comment on: http://stackoverflow.com/q/23203469
type: Comment

http://stackoverflow.com/comment/35607235
type: Comment
type: QuestionComment
has text: Do you mean converting a web page to a *standalone* HTML page that can be used offline? Should it be a single HTML file or can it be a collection of files (possibly packaged as a zip file)? Please clarify by editing the question (including its title).
comment on: http://stackoverflow.com/q/23267017
score: 0

http://stackoverflow.com/comment/35640783
score: 0
comment on: http://stackoverflow.com/q/23284722
type: Comment
type: QuestionComment
has text: So where is the problem?

http://stackoverflow.com/a/23146153
has comment: http://stackoverflow.com/comment/35400190
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23146049
has body: It clearly says that "ClassNotFoundException". Check your apk file whether CropImageView class is there. Second do a clean build and create a apk file once again.

http://stackoverflow.com/q/23250937
has comment: http://stackoverflow.com/comment/35577557
has comment: http://stackoverflow.com/comment/35578183
has answer: http://stackoverflow.com/a/23251891
tagged with: syntax
tagged with: java
has body: Hi I have a JFrame with a menu and an item in its menu. Is it possible to call another my download.java file when that item is clicked ? If so how ? Thanks download.java public class download { public static void main(String[] args) throws IOException { String fileName = "C:/Users\\Kris\\Downloads\\Death Grips - Get Got.mp3"; URL link = new URL("http://www.last.fm/music/Death+Grips/_/Get+Got"); InputStream in = new BufferedInputStream(link.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(fileName); fos.write(response); fos.close(); System.out.println("Finished. Your File is Located at"+ fileName ); } } and from my menu class i need to add an actionListener. But how do I call my download.java file in the action listener is this possible ? Or how can I add my download.java code in the action listener? download.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { //code to download the file?? }}); FINAL ANSWER FOUND MYSELF AFTER THE STRUGGLE OF DOWN VOTING MY QUESTION. public void actionPerformed(ActionEvent e) { try { download.main(args); } catch (MalformedURLException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } This is the way to run a java file from a different file by adding the filename.main(args);
type: Question
has comment: http://stackoverflow.com/comment/35578454
has comment: http://stackoverflow.com/comment/35577886
has comment: http://stackoverflow.com/comment/35577824
has comment: http://stackoverflow.com/comment/35577999
answer count: 1
has comment: http://stackoverflow.com/comment/35577606
favorite count: 0
tagged with: class
has comment: http://stackoverflow.com/comment/35577837
downvote count: 3
score: -3
has comment: http://stackoverflow.com/comment/35577600
has title: Is it possible to call a .Java file when a button is clicked ? if so how?
upvote count: 0
has comment: http://stackoverflow.com/comment/35578165
has comment: http://stackoverflow.com/comment/35577748
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35577750
has comment: http://stackoverflow.com/comment/35578262

http://stackoverflow.com/comment/35456050
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23181249
type: QuestionComment
has text: @perencia just running in parallel and terminating when the endtime is equal to present datetime.

http://stackoverflow.com/q/23205020
has title: Java - Sort Strings like Windows Explorer
accepted answer: http://stackoverflow.com/a/23249000
tagged with: comparator
linked to: http://stackoverflow.com/q/4290541
downvote count: 0
tagged with: sorting
favorite count: 0
has answer: http://stackoverflow.com/a/23213601
has comment: http://stackoverflow.com/comment/35496091
has answer: http://stackoverflow.com/a/23205534
tagged with: windows
has answer: http://stackoverflow.com/a/60099948
has body: I am trying to use code suggested by Sander Pham on another question. I need my java ArrayList of string names to be sorted like Windows Explorer does. His code worked for everything but for one issue. I would have liked to comment onto that question, but I need more reputation points to comment. Anyways... He suggested to use a custom comparator implemented class and use that to compare the string names. Here is the code of that class: class IntuitiveStringComparator implements Comparator&lt;String&gt; { private String str1, str2; private int pos1, pos2, len1, len2; public int compare(String s1, String s2) { str1 = s1; str2 = s2; len1 = str1.length(); len2 = str2.length(); pos1 = pos2 = 0; int result = 0; while (result == 0 &amp;&amp; pos1 &lt; len1 &amp;&amp; pos2 &lt; len2) { char ch1 = str1.charAt(pos1); char ch2 = str2.charAt(pos2); if (Character.isDigit(ch1)) { result = Character.isDigit(ch2) ? compareNumbers() : -1; } else if (Character.isLetter(ch1)) { result = Character.isLetter(ch2) ? compareOther(true) : 1; } else { result = Character.isDigit(ch2) ? 1 : Character.isLetter(ch2) ? -1 : compareOther(false); } pos1++; pos2++; } return result == 0 ? len1 - len2 : result; } private int compareNumbers() { // Find out where the digit sequence ends, save its length for // later use, then skip past any leading zeroes. int end1 = pos1 + 1; while (end1 &lt; len1 &amp;&amp; Character.isDigit(str1.charAt(end1))) { end1++; } int fullLen1 = end1 - pos1; while (pos1 &lt; end1 &amp;&amp; str1.charAt(pos1) == '0') { pos1++; } // Do the same for the second digit sequence. int end2 = pos2 + 1; while (end2 &lt; len2 &amp;&amp; Character.isDigit(str2.charAt(end2))) { end2++; } int fullLen2 = end2 - pos2; while (pos2 &lt; end2 &amp;&amp; str2.charAt(pos2) == '0') { pos2++; } // If the remaining subsequences have different lengths, // they can't be numerically equal. int delta = (end1 - pos1) - (end2 - pos2); if (delta != 0) { return delta; } // We're looking at two equal-length …
upvote count: 11
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35495909
has answer: http://stackoverflow.com/a/23249000
answer count: 5
tagged with: explorer
score: 11
linked to: http://stackoverflow.com/q/7204663
type: Question
linked to: http://stackoverflow.com/q/60092486
tagged with: java
possible better answer: http://stackoverflow.com/a/23205286
has answer: http://stackoverflow.com/a/23205286
has comment: http://stackoverflow.com/comment/35496415

http://stackoverflow.com/q/23148962
has comment: http://stackoverflow.com/comment/35396827
has comment: http://stackoverflow.com/comment/35396925
has answer: http://stackoverflow.com/a/23149042
tagged with: java
has body: public abstract class A { private int result=-1; public void final doExecuteMySpecialAlgorithm() { result=0; //do something here and get a new result //it won't be -1. } public int getResult() { if(result==-1) throw new RuntimeException("Invoke my special algorithm first!"); return result; } } Isn't getResult method a bad design - It is forcing user to invoke another method before it is invoked? How would you workaround this? Would your rather return -1 or say null (in case of an object type) and let the caller figure out what to do will a null return? or if you are sure that it won't be null, but for the return to be not null, you would have to invoke another method before invoking getResult method, would you just throw a RuntimeException? (or a checked exception?)
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35396943
has comment: http://stackoverflow.com/comment/35396890
possible better answer: http://stackoverflow.com/a/23149042
score: 0
answer count: 2
tagged with: api
has answer: http://stackoverflow.com/a/23149002
has title: API design - Is it a good practice to dictate method order?
accepted answer: http://stackoverflow.com/a/23149002

http://stackoverflow.com/comment/35629288
has text: It just creates a blank file
type: QuestionComment
comment on: http://stackoverflow.com/q/23278439
score: 0
type: Comment

http://stackoverflow.com/comment/35481508
comment on: http://stackoverflow.com/q/23197468
score: 1
has text: Try [this](http://stackoverflow.com/questions/19557564/how-to-fetch-comments-from-a-oracle-11g-using-jdbc)
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23262998
type: Answer
has body: I think you can write a reducer job also.But i haven't tried yet.You can give a try. And you can also write an identity map only job for this, without specifying job.setNumReduceTasks(0); Why because while writing a Map only job with setting job.setNumReduceTasks(0); the output will be in multipe file(output file depends on no of map). If we are not specifying job.setNumReduceTasks(0); an identity reducer will run by default even though we are not writing a Reducer. And the results get stored in a single part-r-00000 file
score: 0
answers question: http://stackoverflow.com/q/23256347

http://stackoverflow.com/q/23201235
has answer: http://stackoverflow.com/a/23202590
tagged with: libgdx
has title: new libgdx setup build keeps failing
answer count: 1
downvote count: 0
has body: I downloaded the new libgdx-setup and every time I generate a project with box2dlights it fails and I can't import it because it keeps giving me an error about not finding box2dlights. I also had an issue with the older gdx-setup-ui where I couldn't access third party libraries so I am getting frustrated with libgdx. * What went wrong: A problem occurred configuring project ':android'. &gt; Could not resolve all dependencies for configuration ':android:_debugCompile'. &gt; Could not find com.badlogicgames.box2dlights:box2dlights:1.2. Required by: test:android:1.0 test:android:1.0 &gt; test:core:1.0 When I generate a project with no dependencies checked I can import it fine into eclipse, but I want to be able to select box2dlights as I am going to be using it. I can see box2dlights in my build.gradle so from what I have gathered, it should automatically download. Here is my build.gradle buildscript { repositories { mavenCentral() mavenLocal() } dependencies { classpath 'com.android.tools.build:gradle:0.9+' } } allprojects { apply plugin: "eclipse" apply plugin: "idea" version = '1.0' ext { appName = 'my-gdx-game' gdxVersion = '1.0.0' roboVMVersion = '0.0.11' } repositories { mavenLocal() mavenCentral() maven { url "https://oss.sonatype.org/content/repositories/snapshots/" } } } project(":desktop") { apply plugin: "java" dependencies { compile project(":core") compile "com.badlogicgames.gdx:gdx-backend-lwjgl:$gdxVersion" compile "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop" compile "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-desktop" compile "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-desktop" } } project(":android") { apply plugin: "android" configurations { natives } dependencies { compile project(":core") compile "com.badlogicgames.gdx:gdx-backend-android:$gdxVersion" natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86" natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi" …
tagged with: build.gradle
favorite count: 0
accepted answer: http://stackoverflow.com/a/23202590
tagged with: android
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
tagged with: gradle
type: Question

http://stackoverflow.com/comment/42594888
type: QuestionComment
has text: @VickyThakor Yes the issue is fixed for us. Actually we were getting this issue for our third party tool. We asked for the latest copy from them and then our application started working.
score: 0
comment on: http://stackoverflow.com/q/23270818
type: Comment

http://stackoverflow.com/comment/35492844
type: Comment
comment on: http://stackoverflow.com/a/23203479
has text: Thanks, that was a good idea, it now enters the Game controller, but doesn't save the name field (see the update to the question). Do you know why this would be? +1
type: AnswerComment
score: 0

http://stackoverflow.com/comment/79687459
comment on: http://stackoverflow.com/q/23287129
score: 0
type: Comment
type: QuestionComment
has text: Related more recent question: https://stackoverflow.com/questions/46363110/why-is-assigning-an-onclicklistener-to-autocompletetextview-giving-a-nullpointer

http://stackoverflow.com/comment/35482954
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23198298
has text: A better answer than mok's: it gives the answer code **and** explains the problem. 1+

http://stackoverflow.com/comment/35425864
type: AnswerComment
comment on: http://stackoverflow.com/a/23161290
type: Comment
has text: the test program worked when I ran it as a jar, so it is a problem with my code somewhere. Any tips on where to look next?
score: 0

http://stackoverflow.com/q/23225348
tagged with: generics
has body: I need help in this scenario using Generics: class A{ } class B{ } class AB{ A aInstance; B bInstance; //getter &amp; setter for the above. setA(); setB(); } Now, in other part/module I want to do the following: 1)I have just the class names i.e "A", "B" &amp; "AB" 2)I want to create an instance of Class A, B and AB (using the classnames) -- this is done using class.forName -- this is fine. something like this: Object objA= Class.forName("A").newInstance(); Object objB= Class.forName("B").newInstance(); Now I want to create instance of class AB and set objA &amp; objB using the setters in AB. How to do it through reflection? 3)Then I want to create a ArrayList -- List of type AB -- but note that I have only the class name "AB" not the type as such. How to do this ? Kindly Help.
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35531967
answer count: 0
has comment: http://stackoverflow.com/comment/35531741
has comment: http://stackoverflow.com/comment/35531697
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/35531766
has title: Creating object reflectively & setting fields
score: 0
has comment: http://stackoverflow.com/comment/35531707

http://stackoverflow.com/q/23171753
type: Question
has body: I have an application in JavaFX FXML by using Model View Controller. I want to move some sliders with keyboard. To do this in the main class I put a KeyEvent to hear what happens on the keyboard. In the controller class FXMLDocumentController where are FXML variables. These variables are passed to a third class. Where there sliders are changed when you click any. The problem is that when I pass the variables of the sliders in the third class are perfectly stored but when you run the code to modify sliders coming past the main class when clicked are FXML variables are null. Here you have the code: Main class: public class OpenPilot extends Application { Movements Movements = new Movements(); @Override public void start(Stage stage) throws Exception { Parent root = FXMLLoader.load(getClass().getResource("FXMLDocument.fxml")); Scene scene = new Scene(root); scene.setOnKeyPressed(new EventHandler&lt;KeyEvent&gt;() { @Override public void handle(KeyEvent Key) { Movements.GetKeys(Key); } }); stage.setScene(scene); stage.show(); } /** * @param args the command line arguments */ public static void main(String[] args) { launch(args); } } Controller: public class FXMLDocumentController implements Initializable { Movements Movements = new Movements(); @FXML public Slider SpeedSlider; @FXML public Slider TurnsSlider; @Override public void initialize(URL url, ResourceBundle rb) { //Send GUI Information Movements.GetSliders(SpeedSlider, TurnsSlider); } } Movements: public class Movements { //Define Data Variables public double SpeedValue; public double TurnsValue; //Define GUI Variables private Slider SpeedSlider; private Slider TurnsSlider; public void GetSliders(Slider SpeedSlider, Slider TurnsSlider) { this.SpeedSlider = SpeedSlider; this.TurnsSlider = TurnsSlider; } //Get Sliders public void GetKeys(KeyEvent Key) { System.out.println(Key.getCode()); System.out.println(SpeedSlider); Platform.runLater(new Runnable() { @Override public void run() { TurnsSlider.setValue(10); } })…
has title: Null FXML variables
has answer: http://stackoverflow.com/a/23172201
accepted answer: http://stackoverflow.com/a/23172201
upvote count: 1
answer count: 1
favorite count: 0
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
tagged with: scenebuilder
tagged with: javafx

http://stackoverflow.com/comment/35586955
has text: The documentation does *not* say it should work. `@Capturing` used to assign captured instances to a mock field, but it never did so for mock *parameters*.
comment on: http://stackoverflow.com/q/23250432
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/35775359
type: Comment
has text: yes but synchronize work only if the same thread call the same method twice. But in my case native method is declared in myObject, and we are doing new MyObject each time. so synchronized will not work? solution to be synchronized work is to externalize in a singleton call of native method and doing them synchronized i think, i have post some informations in my initial ask( C code, truss log etc...)
type: AnswerComment
comment on: http://stackoverflow.com/a/23355508
score: 0

http://stackoverflow.com/comment/35399435
type: Comment
type: QuestionComment
has text: What happens when you are trying to use `replaceAll` method?
comment on: http://stackoverflow.com/q/23150307
score: 0

http://stackoverflow.com/q/23150971
has comment: http://stackoverflow.com/comment/35400197
type: Question
accepted answer: http://stackoverflow.com/a/23151225
tagged with: debugging
answer count: 2
downvote count: 0
possible better answer: http://stackoverflow.com/a/23151167
has answer: http://stackoverflow.com/a/23151167
favorite count: 0
has title: User input causes frame.getContentPane.removeAll() to stop working
has body: Within a JFrame , i am replacing a Jpanel with another JPanel . package testing; import java.io.*; import java.util.*; import java.security.*; import javax.xml.bind.DatatypeConverter; import java.lang.*; import java.awt.*; import javax.swing.*; import java.awt.event.*; public class Testing extends JPanel { JLabel jl; ImageIcon icon; Point pointer; public static void main(String[] args) { JFrame jf = new JFrame(); JPanel jp1 = new JPanel(); JPanel jp2 = new JPanel(); JLabel jl1 = new JLabel("Hey1"); JLabel jl2 = new JLabel("Hey2"); jp1.add(jl1); jp2.add(jl2); jf.add(jp1); jf.setVisible(true); jf.pack(); Scanner myScanner= new Scanner(System.in); int x = myScanner.nextInt(); // the line causes the code to not work , // what is happening jf.getContentPane().removeAll(); jf.add(jp2); } } The weird part is that the code stops working the moment i try to read user input int x = myScanner.nextInt(); The code : jf.getContentPane().removeAll(); stops working and i cant remove the current JPanel and add in the new JPanel i need to read in the user input before the JPanel is replaced , how do i resolve this issue?? note : Even after i type in something , the jf.getContentPane().removeAll() still doesnt work
has comment: http://stackoverflow.com/comment/35400122
tagged with: swing
type: AnsweredQuestion
score: 3
has answer: http://stackoverflow.com/a/23151225
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/35400056
tagged with: jpanel

http://stackoverflow.com/comment/35443933
has text: Your `main` is inside a class, inside another class. it's not visible to the most exteriour class, `Hello_World`.
score: 1
comment on: http://stackoverflow.com/q/23175680
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23213665
score: 5
has comment: http://stackoverflow.com/comment/35511100
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23213452
type: Answer
upvote count: 5
downvote count: 0
has comment: http://stackoverflow.com/comment/35511489
has body: add this to your test method: @Test(expected=DataException.class) or use this : then(caughtException()).isInstanceOf(DataException.class); for a static-block there is no way other than try-catch. Another way is to change DataException to a RuntimeException.
answers question: http://stackoverflow.com/q/23213452

http://stackoverflow.com/q/23194821
has answer: http://stackoverflow.com/a/23332274
has comment: http://stackoverflow.com/comment/35477531
possible better answer: http://stackoverflow.com/a/23332429
has answer: http://stackoverflow.com/a/23332429
tagged with: java
has comment: http://stackoverflow.com/comment/35726345
accepted answer: http://stackoverflow.com/a/23332274
tagged with: eclipse
has comment: http://stackoverflow.com/comment/35594972
has title: Optimizing Eclipse
answer count: 2
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/35478073
has comment: http://stackoverflow.com/comment/35477889
has comment: http://stackoverflow.com/comment/35477918
favorite count: 0
has body: I am using eclipse IDE for Java EE Version: 4.3.2 Build id: M20140221-1700 My Compaq Laptop is a Core i3 M350 @ 2.27 Ghz with 8GB RAM running on windows 8.1 Pro 64bit. And The JDK version is 1.7.0_40 64bit I have disabled the validation check and the spell check but I have still noticed the IDE is lagging a lot and it freezes most of the time. the eclipse.ini file is: -vm C:\Java\jdk1.7.0_40\jre\bin\server\jvm.dll -vmargs -Xincgc -Xss500k -Dosgi.requiredJavaVersion=1.7 -Xms128m -Xmx768m -XX:NewSize=8m -XX:PermSize=512m -XX:MaxPermSize=1024m -XX:MaxPermHeapExpansion=10m -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=70 -XX:+UseCMSInitiatingOccupancyOnly -XX:+UseParNewGC -XX:+CMSConcurrentMTEnabled -XX:ConcGCThreads=2 -XX:ParallelGCThreads=2 -XX:+CMSIncrementalPacing -XX:CMSIncrementalDutyCycleMin=0 -XX:CMSIncrementalDutyCycle=5 -XX:GCTimeRatio=49 -XX:MaxGCPauseMillis=20 -XX:GCPauseIntervalMillis=1000 -XX:+UseCMSCompactAtFullCollection -XX:+CMSClassUnloadingEnabled -XX:+DoEscapeAnalysis -XX:+UseCompressedOops -XX:+AggressiveOpts What would be the best eclipse.ini setting for me? --UPDATE-- a copy of the workspace log file: !SESSION 2014-04-21 18:23:18.129 ----------------------------------------------- eclipse.buildId=4.3.2.M20140221-1700 java.version=1.7.0_40 java.vendor=Oracle Corporation BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=en_US Command-line arguments: -os win32 -ws win32 -arch x86_64 !ENTRY org.eclipse.egit.ui 2 0 2014-04-21 18:23:31.716 !MESSAGE Warning: EGit couldn't detect the installation path "gitPrefix" of native Git. Hence EGit can't respect system level Git settings which might be configured in ${gitPrefix}/etc/gitconfig under the native Git installation directory. The most important of these settings is core.autocrlf. Git for Windows by default sets this parameter to true in this system level configuration. The Git installation location can be configured on the Team &gt; Git &gt; Configuration preference page's 'System Se…
type: AnsweredQuestion
upvote count: 2
has comment: http://stackoverflow.com/comment/35477242
type: Question

http://stackoverflow.com/q/23164131
upvote count: 2
type: UnansweredQuestion
tagged with: line
tagged with: adjacency-matrix
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/35424749
has comment: http://stackoverflow.com/comment/35427167
tagged with: point
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/23171489
has body: What I'm trying to do is come up with a way to generate n random points on a graph (displaying it isn't necessary). A point is randomly selected and connected to the point closest to it (or the next closest if it's already connected to the best option) in a way so that no two lines intersect. This repeats until no more connections are possible. The vertices are meant to represent regions on a map, and connections represent adjacency. The following code I have thus far is as follows, taken from http://javaingrab.blogspot.com/2012/12/m-way-graph-coloring-with-backtracking.html: public class MWayGrColor{ /*G is graph's adjacency matrix and x is solution vector */ private int G[][],x[],n,m,soln; public void mColoring(int k){ //backtracking function for(int i=1;i&lt;=n;i++){ next_color(k); //coloring kth vertex if(x[k]==0) return; //if unsuccessful then backtrack if(k==n) //if all colored then show write(); else mColoring(k+1); /* successful but still left to color */ } } private void next_color(int k){ do{ int i=1; x[k]=(x[k]+1)%(m+1); if(x[k]==0) return; for(i=1;i&lt;=n;i++) if(G[i][k]!=0 &amp;&amp; x[k]==x[i]) /* checking adjacency and not same color */ break; if(i==n+1) return; //new color found }while(true); } private void write(){ System.out.print("\nColoring(V C) # "+(++soln)+"--&gt;"); for(int i=1;i&lt;=n;i++) System.out.print("\t("+i+" "+x[i]+")"); //solution vector } public void input(){ java.util.Scanner sc=new java.util.Scanner(System.in); System.out.print("Enter no. of vertices : "); n=sc.nextInt(); G=new int[n+1][n+1]; x=new int[n+1]; System.out.print("Enter no. of colors : "); m=sc.nextInt(); System.out.println("Enter adjacency matrix--&gt;"); for(int i=1;i&lt;=n;i++) for(int j=1;j&lt;=n;j++) G[i][j]=sc.nextInt(); } public static void main (String[] args) { MWayGrColor obj=new MWayGrColor(); obj.input(); obj.mColoring(1); if(obj.soln==0) System.out.println("\nNeed more than "+obj.m+" colors"); else System.out.print("\nTOTAL SOLN : "+obj.soln); } } As noted…
has title: Java - Adjacency matrix based on distance between vertices
favorite count: 0
score: 2

http://stackoverflow.com/q/23194011
tagged with: certificate
type: Question
answer count: 1
has answer: http://stackoverflow.com/a/23203908
has body: Hi I was wondering how you would verify that a PublicKey belongs to a certain individual or party during an RSA key exchange using a Certificate in java ? I need to know how to do this any help would be much appreciated and if you could provide a code example that would be awesome, thanks :) Also How do I create a Certificate object as I don't have a certificate file either ? P.S. My RSA keys are generated as shown for both sides KeyPairGenerator kpg = KeyPairGenerator.getInstance("RSA"); KeyPair kp = kpg.generateKeyPair(); PrivateKey pvtKey = kp.getPrivate(); PublicKey pubKey = kp.getPublic();
score: 0
has title: Create Certificate and verify embedded PublicKey
accepted answer: http://stackoverflow.com/a/23203908
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/35616575
has text: this is the answer i think but i did not try it yet http://www.dreamincode.net/forums/topic/181756-getting-jtable-to-recognize-changes-made-to-a-cell/
comment on: http://stackoverflow.com/a/23210581
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/35550162
has text: Dhana, It times out properly when I connect to different servers. But Unfortunately, my own proxy server (not www.myserver.com) neither connection times out, nor read times out. It responds very very slowly. Hence I wanted the calling client (thread) should be suspended after some time.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23212666
score: 0

http://stackoverflow.com/a/23194705
type: Answer
has body: You only check that choice.hasNextInt() for the first input. The second time round it is not checked. Move the check into the while loop so that it looks like this: boolean done = false; while (!done) { while(!choice.hasNextInt()) { System.out.println("Invalid input"); choice.nextLine(); // drop entire line, not just next token } int i = choice.nextInt(); // ... }
score: 0
answers question: http://stackoverflow.com/q/23194368

http://stackoverflow.com/q/23141094
has comment: http://stackoverflow.com/comment/35383269
type: UnansweredQuestion
downvote count: 2
tagged with: error-handling
has comment: http://stackoverflow.com/comment/35383926
tagged with: java
tagged with: methods
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/23141711
has answer: http://stackoverflow.com/a/23141216
upvote count: 0
score: -2
has comment: http://stackoverflow.com/comment/35383180
has body: I am trying to use the operator += for one of the methods in my program which takes the total of the amounts of food for the gerbils, and divides it by the number of gerbils, in kind of like an average. The errors are the following: "The operator += is undefined for the argument type(s) double, int[]" at the following code: average += g.getAmountFood(); "The operator / is undefined for the argument type(s) Gerbil, int" at the following code: average = gerbil[i] / gerbil.length Here is my code for my first main Class: import java.util.Scanner; public class Gerbilfood { static int n8; static int n3; static String n55; static String n35; static String n2; public static Gerbil[] gerbil; public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.println("Please input how many types of food items the gerbils eat as an integer"); String n0 = scanner.nextLine(); int n1 = Integer.parseInt(n0); String[] food = new String[n1]; for (int i = 0; i &lt; n1; i++) { System.out.println("Please enter a food name"); String n2 = scanner.nextLine(); food[i] = n2; int[] maximum = new int[n1]; System.out.println("Please enter maximum amount of this food per day"); String n33 = scanner.nextLine(); int n3 = Integer.parseInt(n33); maximum[i] = n3; } System.out.println("Please enter in the number of gerbils in the lab"); String n73 = scanner.nextLine(); int n4 = Integer.parseInt(n73); //gerbil = new Gerbil[n4]; gerbil = new Gerbil[n4]; int[] combo = new int[n4]; String[] ids = new String[n4]; for (int i = 0; i &lt; n4; i++) { //Gerbil g = new Gerbil(n1); System.out.println("Please enter in the lab id for one of the gerbils"); String n5 = scanner.nextLine(); //g.setId(n5); //ids[i] = n5; //String[] names = new String[n4]; System.out.println("Please enter in the name given to gerbil whose lab id you just entered"); String n6 = scanner.nextLine(); // gerbil name //g.setName(n6); //String[] amountfood = new String[n1]; int[] amountfood = new int[n1]; for (int j =…
has title: Error: The operator += is undefined for the argument type(s) double, int[]
favorite count: 0
has comment: http://stackoverflow.com/comment/35383272

http://stackoverflow.com/q/23133453
has comment: http://stackoverflow.com/comment/35369104
tagged with: java
has comment: http://stackoverflow.com/comment/35368899
has comment: http://stackoverflow.com/comment/35368596
has body: I'm working on a metaheuristic and I'm currently stuck in my construction heuristic. I have a set of lectures of courses (each course is a custom object Course with a few properties of that course) that need to be put in rooms a time table/schedule and each of them has an index on how restricted it is. My program starts by sorting the courses based on the highest index and then splits them into two Arraylists of high-priority courses and non-priority courses. The program then takes the high priority first, randomizes a course, and does: while there are still courses in the ArrayList while the course still has lectures that were unscheduled (lect>0) randomize a day and a room go through the periods of that day evaluate if the course can be placed in that period - day evaluate if the room on that period day is available if yes place a lecture there and decrement the number of lectures (lect--) if not go to the next period if you don't find a period on that day &amp; room, randomize a new day &amp; room and do the process over again When all the lectures are done exit If the course cannot be placed anywhere anymore then I enter an infinite loop in the while (lect>0) and my program does not run beyond that. How can I fix this? I was thinking of doing a count=MaxCount and decrement at the end of each while iteration that does not place a lecture and say IF(count==0) break the while. When I evaluate the period/day I need to decrement by the number of rooms while if I evaluate the room I need to decrement by 1, but then for some reason my count always gets to negative and when I say check IF(count&lt;=0) I have a lot of courses left out. ArrayList&lt;Course&gt; ALC = sortCourses(); ArrayList&lt;Course&gt; ALCP = new ArrayList&lt;Course&gt;(); float mean = meanCourseIndex(); while(ALC.get(0).getCourseIndex()&gt;=mean){ ALCP.add(ALC.get(0)); ALC.remove(0); } //Now, ALC refers to the non-priority courses //Choosing a random priority course to place while(!ALCP.isEmpty()){ //R…
score: 0
answer count: 0
type: UnansweredQuestion
has title: Infinite While Loop in a construction heurstic JAVA
has comment: http://stackoverflow.com/comment/35368591
type: Question

http://stackoverflow.com/q/23223714
has body: I'm trying to retrieve a list of indices using Jest, but I just got as far as: Stats statistics = new Stats.Builder().build(); result = client.execute(statistics); How can i retrieve the list of indices from the result? Do I have to use something else than Stats? It would also help if someone could show me a detailed documentation of Jest. The basics are really well documented, but with the different kinds of builders I'm really lost at the moment.
has answer: http://stackoverflow.com/a/23295579
answer count: 3
tagged with: elasticsearch-jest
tagged with: elasticsearch
favorite count: 0
has answer: http://stackoverflow.com/a/52223006
has comment: http://stackoverflow.com/comment/35642986
score: 6
possible better answer: http://stackoverflow.com/a/30314756
type: AnsweredQuestion
downvote count: 0
tagged with: java
accepted answer: http://stackoverflow.com/a/23295579
type: Question
has comment: http://stackoverflow.com/comment/35630929
has title: How to get a List of Indices from ElasticSearch using Jest
upvote count: 6
has answer: http://stackoverflow.com/a/30314756

http://stackoverflow.com/a/23822148
has comment: http://stackoverflow.com/comment/36651259
has comment: http://stackoverflow.com/comment/36734207
has comment: http://stackoverflow.com/comment/36654904
upvote count: 1
has comment: http://stackoverflow.com/comment/36650748
score: 1
has comment: http://stackoverflow.com/comment/36730187
answers question: http://stackoverflow.com/q/23283853
downvote count: 0
type: Answer
has body: The exception actually comes when the redirect page requires session and the page context setup machanism (PageContextImpl.java:146) tries to create a session. However the session id generator is somehow null this time ManagerBase.java:807..... protected String generateSessionId() { String result = null; do { if (result != null) { duplicates++; } result = sessionIdGenerator.generateSessionId(); //There is issue in the above line - sessionIdGenerator is null this time } while (sessions.containsKey(result)); return result; } Issue like this which occurs intermittently have been reported here and there is lots of comment on the issue. See if there is some hint which can help you out.
has comment: http://stackoverflow.com/comment/36730426

http://stackoverflow.com/q/23284736
has answer: http://stackoverflow.com/a/23284823
has title: String split and get particular string
has body: I have a string: "cards_NNS may_MD be_VB worth_JJ hundreds_NNS a_DT report_NN" Now i'm trying to get those words in a string array from given string which has _NNS and _NN and _JJ at the end of word. output: cards worth hundreds report what I have tried : string.split("[^_NNS]+"); please give me some idea.
answer count: 4
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23284823
has comment: http://stackoverflow.com/comment/35641066
upvote count: 2
tagged with: java
type: Question
tagged with: split
has answer: http://stackoverflow.com/a/23284891
has comment: http://stackoverflow.com/comment/35641183
possible better answer: http://stackoverflow.com/a/23284865
score: 2
has answer: http://stackoverflow.com/a/23284865
downvote count: 0
tagged with: string
favorite count: 0
has answer: http://stackoverflow.com/a/23284853

http://stackoverflow.com/q/23252519
answer count: 2
possible better answer: http://stackoverflow.com/a/23253123
downvote count: 0
has answer: http://stackoverflow.com/a/23253123
favorite count: 0
type: AnsweredQuestion
has title: How to get divider component in JSplitPane?
has answer: http://stackoverflow.com/a/23252599
tagged with: mouselistener
has body: I want to get divider component in JSplitPane. I want to attach MouseListener to it. How to get divider component of JSplitPane? Thanks!
upvote count: 1
tagged with: swing
type: Question
tagged with: jsplitpane
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/23252599

http://stackoverflow.com/comment/35518419
has text: It exported to the SD card again, i wanted it to export to the internal storage
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23217548

http://stackoverflow.com/q/23176392
has title: Simple output issue
answer count: 1
accepted answer: http://stackoverflow.com/a/23176513
downvote count: 0
has comment: http://stackoverflow.com/comment/35445635
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/35445548
has comment: http://stackoverflow.com/comment/35445310
type: AnsweredQuestion
has body: So in my class we're making simple programs and we're introducing inheritance. I've gotten everything to work properly, but I can't get this one bit of output to work correctly. It's when I'm asking for an input, but it skips one of my inputs and goes to the request for the second one. When I comment all the other things before that aren't needed, it doesn't skip the first input. I don't understand why this is, and if someone could help me decipher why it would be much appreciated. Thanks in advance and here are my two classes followed by the tester: Person class: public class Person{ private String name, address, phoneNumber; public Person(){ name="none"; address="none"; phoneNumber="none"; } public Person(String inName, String inAddress, String inPhoneNumber){ name=inName; address=inAddress; phoneNumber=inPhoneNumber; } public String getName(){ return name; } public void setName(String newName){ name = newName; } public String getAddress(){ return address; } public void setAddress(String newAddress){ address = newAddress; } public String getPhoneNumber(){ return phoneNumber; } public void setPhoneNumber(String newPhoneNumber){ phoneNumber = newPhoneNumber; } public String toString(){ return String.format("Name: " + name + "\nAddress: " + address + "\nPhone Number: " + phoneNumber); } public void clearPerson(){ name="none"; address="none"; phoneNumber="none"; } } Customer class: public class Customer extends Person{ private int customerNumber; private boolean mailingList; public Customer(){ customerNumber=0; mailingList=false; } public Customer(int inCustomerNumber, boolean inMailingList){ customerNumber=inCustomerNumber; mailingList=inMailingList; } public int getCustomerNumber(){ return customerNumber; } public void setCustomerNumber(int newCustomerNumber){ customerNumber=newCustomerNumber; } public boolean getMailingList(){ return mailingList; } public void setMailingList(boolean newMailingList){ mailingList=newMailingList; } public String toString(){ return "Cu…
has comment: http://stackoverflow.com/comment/35445365
has comment: http://stackoverflow.com/comment/35445652
tagged with: output
upvote count: 1
has answer: http://stackoverflow.com/a/23176513
has comment: http://stackoverflow.com/comment/35445576
type: Question
tagged with: java
tagged with: formatting

http://stackoverflow.com/comment/35553099
type: QuestionComment
comment on: http://stackoverflow.com/q/23234571
has text: If you just want to make it work properly as a Java string you're making this far more complicated than needed.
score: 0
type: Comment

http://stackoverflow.com/comment/96694381
has text: this also helped with table's auto-creation in the schema, but only when setting length to 64, it would not work when set on 255. do you have any info on why is 64 better than 255?
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/33259927

http://stackoverflow.com/comment/35424957
type: AnswerComment
comment on: http://stackoverflow.com/a/23163192
score: 0
type: Comment
has text: Actually I'm now saving it using my ION binary data storage system, and the format is somewhat like () = binary mark: (MAP)(WIDTH)(HEIGHT)(ENTRY)(X)(Y)(ID)(..extra data..)(ENTRY)....(ENTRY)...(END) so I think I've solved the efficiency of saving this way. Null tiles are simply skipped. If the map happens **not** to be sparse, then I will have overhead of two INTs and one SHORT per tile. Not too bad, I guess.

http://stackoverflow.com/q/23185250
favorite count: 0
has comment: http://stackoverflow.com/comment/35463543
answer count: 0
type: Question
tagged with: sockets
tagged with: android
has body: Im running a server on my localhost written in Java, and Im trying to get my device to communicate with it. I've tried many ways and I've read lots of posts about it, but still didnt come up with a solution. That's what I've written: public class MainActivity extends Activity { String hostName = "10.0.2.2"; int portNumber = 5667; private Socket echoSocket; private void runSecondThread() { new Thread() { @Override public void run() { try { Log.i("try", "enter try"); echoSocket = new Socket(hostName, portNumber); Log.i("taggg", "echoSocket"); } catch (UnknownHostException e) { Log.i("error", "Don't know about host " + hostName); System.exit(1); } catch (IOException e) { Log.i("error", "Couldn't get I/O for the connection to " + hostName); System.exit(1); } } }.start(); } @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); runSecondThread(); } I figured out that my echoSocket is null. My device is connected to the same wi-fi as my PC.
upvote count: 1
has comment: http://stackoverflow.com/comment/35463478
tagged with: localhost
has comment: http://stackoverflow.com/comment/35463504
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/35475197
has comment: http://stackoverflow.com/comment/35463115
has comment: http://stackoverflow.com/comment/35479562
downvote count: 1
type: UnansweredQuestion
has title: Geting a null socket - android communiction with local host

http://stackoverflow.com/comment/35455826
type: Comment
has text: That seemed to fix the problem! Thanks! I don't understand, though, why searching for hsqldb in mvnrepository yields such differing results.
type: AnswerComment
comment on: http://stackoverflow.com/a/23176131
score: 0

http://stackoverflow.com/q/23258369
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23258492
tagged with: offset
has comment: http://stackoverflow.com/comment/35591761
tagged with: java
downvote count: 1
has comment: http://stackoverflow.com/comment/35592845
type: Question
tagged with: encoding
has title: Java offset encoding
score: -1
upvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/35591726
favorite count: 0
has body: Write a program that takes in a string and an integer offset. In this program we want to encode the string by increasing each character by the integer offset in alphabetical order. So if the integer offset t given is 1, b becomes c. Furthermore, M becomes N, and z becomes a.

http://stackoverflow.com/q/23206900
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23206927
tagged with: java
downvote count: 3
has title: non-static method cannot be referenced from a static method
type: Question
accepted answer: http://stackoverflow.com/a/23206927
tagged with: arraylist
has body: I'm trying to print my HighRights object but it wont let me..keeps saying non-static method cannot be referenced from a static method. I basically want it to print out all the values that were added ("AAA","AACCA"..etc). import java.util.*; public class Ex8 { public void printHighUsers(ArrayList&lt;SecurityRights&gt; a){ for(SecurityRights m: a) { if(m instanceof HighRights) { System.out.println(HighRights.getName()); } } } public static void main(String [] a){ ArrayList&lt;SecurityRights&gt; ma=new ArrayList&lt;SecurityRights&gt;(); ma.add(new HighRights("AAA")); ma.add(new HighRights("AACCA")); ma.add(new HighRights("BB")); ma.add(new HighRights("AaaAA")); new Ex8().printHighUsers(ma); } } HighRights class: public class HighRights extends SecurityRights { private String name; public HighRights(String n){ super(true); this.name = n; } public String getName(){ return name; } public static void main(String[] a){ HighRights s= new HighRights("Lisa"); System.out.print(s.getName() +" "+s.getSecret()); } } Thank You.
upvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/35499362
favorite count: 0
score: -3

http://stackoverflow.com/a/23218497
upvote count: 2
answers question: http://stackoverflow.com/q/23218384
has comment: http://stackoverflow.com/comment/35521056
downvote count: 0
has body: ParameterMethodParameterBuilder is an inner class of whatever returning type of withParameter(MethodParameter parameter) method. You care creating a new object of that inner class ParameterMethodParameterBuilder which having outer reference returned by withParameter(parameter) method
type: Answer
score: 2

http://stackoverflow.com/q/23160271
possible better answer: http://stackoverflow.com/a/23175987
type: Question
answer count: 2
tagged with: primefaces
tagged with: intellij-idea
has title: XML namespaces for Primefaces 4.0
tagged with: jsf-2
upvote count: 1
has body: Using IntelliJ IDEA 13.1. Component stack: JSF 2.2 + Primefaces 4.0, Tomcat 7. Creating simple xhtml with code: &lt;ui:composition template="rootTemplate.xhtml" xmlns="http://www.w3.org/1999/xhtml" xmlns:p="http://primefaces.org/ui" xmlns:ui="http://java.sun.com/jsf/facelets"&gt; &lt;/ui:composition&gt; But IDEA can't fetch primefaces url and highlights it with red. Browser shows 404 error when trying to load http://primefaces.org/ui as well. What am I doing wrong?
has answer: http://stackoverflow.com/a/23171672
accepted answer: http://stackoverflow.com/a/23171672
has answer: http://stackoverflow.com/a/23175987
has comment: http://stackoverflow.com/comment/35436712
favorite count: 0
has comment: http://stackoverflow.com/comment/35436404
has comment: http://stackoverflow.com/comment/35436558
has comment: http://stackoverflow.com/comment/35436185
type: AnsweredQuestion
tagged with: jsf
downvote count: 0
score: 1
tagged with: java

http://stackoverflow.com/q/23231314
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35542972
tagged with: java
has answer: http://stackoverflow.com/a/23231423
has comment: http://stackoverflow.com/comment/35542980
type: Question
has comment: http://stackoverflow.com/comment/35542956
has title: Getting a -23 stringindexoutofboundsexception
has comment: http://stackoverflow.com/comment/35542975
has body: In my driver I have a try catch and I'm getting an a -23 StringIndexOutOfBoundsException. when I use this line in my driver: DbEntry dbe = new DbEntry(dabaLine); dabaLine is a simple line with the content: :Mr:Wilburforce:Gates: import java.util.ArrayList; public class DbEntry { private String entry; private ArrayList&lt;String&gt; fields = new ArrayList&lt;&gt;(); public DbEntry(String entry){ this.entry = entry; fields = new ArrayList&lt;&gt;(); int y = 0; int x = 0; int counter = 0; while(entry.indexOf(':', y) != -1){ counter++; String z = ""; String subString = ""; x = entry.indexOf(":", y); y = entry.indexOf(":", x+1); z = entry.substring(x+1, y); fields.add(z); System.out.println(z); System.out.print(counter); } } public String getValue(int fieldNumber){ //throws and indexOutOfBoundsException return fields.get(fieldNumber-1); } public String toString(){ return this.entry; } }
score: 0
has comment: http://stackoverflow.com/comment/35543008
answer count: 1
has comment: http://stackoverflow.com/comment/35543073

http://stackoverflow.com/comment/35442458
has text: I don't see any issue with your code and layout. Check your other part of code.
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23174672

http://stackoverflow.com/q/23204629
score: 1
tagged with: apklib
tagged with: maven-plugin
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/23321458
has body: I am writing an android library project and would like to add the support for maven. My library project pom file looks like this: 4.0.0 my_group_id my_artifactId 1.0.1 apklib My Library Project com.google.android android 4.1.1.4 provided <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> src ${project.artifactId} com.jayway.maven.plugins.android.generation2 android-maven-plugin 3.8.2 true 19 My main project pom file looks like this: <?xml version="1.0" encoding="UTF-8"?> 4.0.0 com.simpligility.android helloflashlight 1.0.0 apk HelloFlashlight com.google.android android 4.1.1.4 provided my_group_id my_artifactId 1.0.1 apklib <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> src ${project.artifactId} com.jayway.maven.plugins.android.generation2 android-maven-plugin 3.8.2 true 19 I am installing the library project to my local repository using: mvn clean install then I am compiling and installing the main project to my local repository using: mvn clean install and generating the apk using: mvn android:deploy Now the problem occurs when I compile the project with maven. The project compiles successfully, however when I am running the apk on the device I receive NullPointerException when trying to perform findById for resources that are inside the library project. Please note that part of the time findById does return value, but not always the correct type (e.g, expected layout but got a button). It is important to say that when running in eclipse without maven everything works perfectly. Please advise
tagged with: android
tagged with: maven
has title: Supporting android library projects with maven
accepted answer: http://stackoverflow.com/a/23321458
tagged with: java
upvote count: 1
answer count: 1
type: AnsweredQuestion
downvote count: 0

http://stackoverflow.com/comment/35635493
type: Comment
has text: Not quite sure what you mean. I am specifying the path to the class file, so that shouldn't matter.
comment on: http://stackoverflow.com/a/23281749
score: 0
type: AnswerComment

http://stackoverflow.com/comment/35518224
has text: There is not nearly enough information for us to be able to help you with this. What program did you try? How did you try it out? What results did you expect? What results did you get?
score: 3
comment on: http://stackoverflow.com/q/23217891
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35461365
has text: I didn't notice that you pass **this** in constructor
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23182634

http://stackoverflow.com/a/23133331
has body: Use javap additional arguments to print full information about class: javap -v -p -s -c For your example, source code of lambda will be: private static java.lang.Integer lambda$main$0(java.lang.Integer, java.lang.Integer); descriptor: (Ljava/lang/Integer;Ljava/lang/Integer;)Ljava/lang/Integer; flags: ACC_PRIVATE, ACC_STATIC, ACC_SYNTHETIC Code: stack=2, locals=2, args_size=2 0: aload_0 1: invokevirtual #17 // Method java/lang/Integer.intValue:()I 4: aload_1 5: invokevirtual #17 // Method java/lang/Integer.intValue:()I 8: imul 9: invokestatic #2 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer; 12: areturn LineNumberTable: line 10: 0 LocalVariableTable: Start Length Slot Name Signature 0 13 0 a Ljava/lang/Integer; 0 13 1 b Ljava/lang/Integer; }
score: 22
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/23133243
upvote count: 22
answers question: http://stackoverflow.com/q/23133243

http://stackoverflow.com/a/23149672
has body: You are printing the toString of an Array. employeeInfo is an ArrayList of Employees. Iterate and print employees like: for (Employee e : employeeInfo) { System.out.println(e.toString()); }
downvote count: 1
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/35398048
answers question: http://stackoverflow.com/q/23149597
has comment: http://stackoverflow.com/comment/35398001
upvote count: 1

http://stackoverflow.com/q/23228647
has title: Scrambling strings multiple times in eclipse
possible better answer: http://stackoverflow.com/a/23228728
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/23228728
has answer: http://stackoverflow.com/a/23228747
has answer: http://stackoverflow.com/a/23228878
answer count: 4
tagged with: eclipse
has comment: http://stackoverflow.com/comment/35538168
type: AnsweredQuestion
has body: I'm having some trouble with some code for a program I'm writing. The purpose of this program is to take a word from a separate text file, scramble it ten times, and display the scrambled letters of the word. The problem that I'm having is that I'm unsure as to how I would go about scrambling the letters ten times. I know that the actual scrambling takes place in my mixer method but the how eludes me. I thought about using a for loop but I'm not sure how to go about it. import java.io.*; import java.util.*; public class Scrambler { public static void main(String[] args) throws FileNotFoundException { Scanner input = new Scanner(new File("words.txt")); String text = input.next(); System.out.println("Original Word: " + text); System.out.println(); System.out.println("Scrambled Word:"); System.out.println("********"); separate(text); System.out.println("********"); } public static void separate(String text) { System.out .println(" " + text.charAt(0) + " " + text.charAt(1) + " "); System.out.println(text.charAt(2) + " " + text.charAt(3)); System.out .println(" " + text.charAt(4) + " " + text.charAt(5) + " "); } public static String mixer(String text) { Random r = new Random(); int r1 = r.nextInt(text.length()); int r2 = r.nextInt(text.length()); String a = text.substring(0, r1); char b = text.charAt(r1); String c = text.substring(r1 + 1, r2); char d = text.charAt(r2); String e = text.substring(r2 + 1, text.length()); text = a + b + c + d + e; return text; } }
has answer: http://stackoverflow.com/a/23228726
accepted answer: http://stackoverflow.com/a/23228878
type: Question

http://stackoverflow.com/q/23217879
type: Question
accepted answer: http://stackoverflow.com/a/23219058
has title: Can't export data table to excel from jsf page
tagged with: primefaces
answer count: 1
downvote count: 0
favorite count: 0
has body: I'm using jsf pages with prime faces 3.5 , my data table works fine on html page and all data showing in correct rows and coulmns but my problem when hit excel icon to export all the data i get it as in the link : http://content.screencast.com/users/tl4s.com.sa/folders/Default/media/40664996-d060-41f8-8a8c-428c114d57c1/excel.jpg sample from my html code : &lt;h:form id="hesham1"&gt; &lt;p:scrollPanel style="width:100%;height:100%"&gt; &lt;p:dataTable var="car" value="#{tableBean.carsSmall}" id="hesham" encoding="windows-1256" dir="rtl" emptyMessage="لا يوجد بيانات او تأكد من البيانات المستعلم عنها"&gt; &lt;f:facet name="header"&gt; تقرير عن صف &lt;/f:facet&gt; &lt;p:columnGroup type="header"&gt; &lt;p:row&gt; &lt;/p:row&gt; &lt;p:row&gt; &lt;p:column colspan="2" headerText="معلومات الطالب" style="text-align: center;" /&gt; &lt;p:column colspan="3" headerText="الحصة الاولى" style="text-align: center;" /&gt; &lt;p:column colspan="3" headerText="الحصة الثانية" style="text-align: center;" /&gt; &lt;p:column colspan="3" headerText="الحصة الثالثة" style="text-align: center;" /&gt; &lt;p:column colspan="3" headerText="الحصة الرابعة" style="text-align: center;" /&gt; &lt;p:column colspan="3" headerText="الحصة الخامسة" style="text-align: center;" /&gt; &lt;p:column colspan="3" headerText="الحصة السادسة" style="text-align: center;" /&gt; &lt;p:column colspan="3" headerText="الحصة السابعة" style="text-align: center;" /&gt; &lt;/p:row&gt; &lt;p:row&gt; &lt;p:column headerText="اسم الطالب" style="text-align: center;" /&gt; &lt;p:column headerText="التاريخ" style="text-align: center;" /&gt; &lt;p:column headerText="المعلم" style="text-align: center;" /&gt; &lt;p:column headerText="الماده" style="text-align: center;" /&gt; &lt;p:column headerText="الحاله" style="text-align: center;" /&gt; &lt;p:column headerText="المعلم" style="text-align: center;" /&gt; &lt;p:column headerText="الماده" style="text-align: center;" /&gt; &lt;p:column headerText="الحاله" style="text-align: center;" …
tagged with: http://stackoverflow.com/tag/html
tagged with: excel
type: AnsweredQuestion
tagged with: jsf
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/23219058
upvote count: 1

http://stackoverflow.com/comment/35577944
type: QuestionComment
comment on: http://stackoverflow.com/q/23235854
has text: Post the full stacktrace here
score: 0
type: Comment

http://stackoverflow.com/q/23281460
tagged with: jdbc
has comment: http://stackoverflow.com/comment/35641661
score: 0
tagged with: java
tagged with: eclipse
type: Question
has comment: http://stackoverflow.com/comment/35635165
has title: Using count sql query giving "Invalid column name" error in Java Program
has comment: http://stackoverflow.com/comment/35635797
has comment: http://stackoverflow.com/comment/35635440
has comment: http://stackoverflow.com/comment/35635205
answer count: 2
has answer: http://stackoverflow.com/a/23281491
has body: How can i use this sql query in Java Program. String SelectSQL = "SELECT (CASE WHEN cnt &gt;= 1 THEN 'True' ELSE 'False' END) result_str FROM ( SELECT COUNT(*) cnt FROM event WHERE externaleventid ='1256294' )"; I am using Preparatory statement to pass the externaleventid. Other query works fine when I am using column name but when I don't use column name I am getting the error "Invalid column name" When I run this query in SQL developer it executes successfully. Added java code: String query = " SELECT (CASE WHEN COUNT(*) &gt;= 1 THEN 'True' ELSE 'False' END) AS result_str FROM event WHERE externaleventid = ?"; PreparedStatement pstmt = conn.prepareStatement(query); pstmt.setString(1,"1256294"); ResultSet rs = pstmt.executeQuery(); while (rs.next()) { String externaleventid = rs.getString("DISPLAYNAME"); System.out.println("externaleventid : " + externaleventid); }
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23291588

http://stackoverflow.com/comment/35501656
comment on: http://stackoverflow.com/q/23208203
has text: You need to make sure that every project is compile to the same level. That is, either using the same Java Version or compatibility level. You will also need to ensure that any external libraries also support your targeted Java version...
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35428240
type: Comment
comment on: http://stackoverflow.com/a/23166667
score: 0
type: AnswerComment
has text: @user1509593 so what happens. It should not crash now

http://stackoverflow.com/comment/35428428
type: QuestionComment
has text: Ok can i afford 3 threads each per event (SELECT, Accept, READ)
comment on: http://stackoverflow.com/q/23150695
score: 0
type: Comment

http://stackoverflow.com/comment/98956501
type: Comment
score: 0
has text: @WesternGun in the above snippet, you supply an instance of `A` you want to spy. It has nothing to do with a default constructor - you can construct this instance however you wish.
comment on: http://stackoverflow.com/a/23236451
type: AnswerComment

http://stackoverflow.com/comment/35409777
type: AnswerComment
type: Comment
score: 0
comment on: http://stackoverflow.com/a/23156695
has text: What do you advise to me to do that? Is there another possibility to save/load it?

http://stackoverflow.com/a/23286913
type: Answer
has body: Found it, I was using the wrong transport type: <util:constant static-field="com.ibm.mq.jms.JMSC.MQJMS_CLIENT_NONJMS_MQ" /> Instead it should have been: <util:constant static-field="com.ibm.mq.jms.JMSC.MQJMS_CLIENT_JMS_COMPLIANT" />
answers question: http://stackoverflow.com/q/23272029
score: 0
accepted answer of: http://stackoverflow.com/q/23272029
type: AcceptedAnswer

http://stackoverflow.com/comment/35406986
has text: Well I'm looking for, when the user enters the country and capital, and then hits the add button, it will add the capital to the list on the right, if that is what that means, then yes.
type: Comment
comment on: http://stackoverflow.com/a/23155193
score: 0
type: AnswerComment

http://stackoverflow.com/q/23189292
answer count: 3
has answer: http://stackoverflow.com/a/23189351
has body: Below is the code.\ I imagine you use a for loop and then another but I cannot seem to make it work. I attempted research however most topics were too complex since I am a novice. I'm trying to find a way to get the fifth character out of each string within the variable. I'll use the information given to me so i can then solve the rest of my program. I have more to do public static void main (String[]args) { String[] decoder = {"Nexa2f5", "Z52Bizlm" , "Diskapr" , "emkem9sD", "LaWYrUs", "dAStn78L", "mPTuriye", "aaeeiuUu", "IL8Ctmpn"}; int character = 4; for(int i=0; i&lt;=decoder.length-1; i++) { } } I am trying to get the third and fourth characters of the odd numbered Strings. I am trying to put the letters into an array and decode the message. I am also trying to print the 5th character of all other words. I'm having issues commenting right and I've tried to reply a couple times but no dice.
tagged with: java
type: UnansweredQuestion
has title: I am trying to find the specific character within a String Array. What must I use?
linked to: http://stackoverflow.com/q/2275004
tagged with: arrays
type: Question
has answer: http://stackoverflow.com/a/23189348
has comment: http://stackoverflow.com/comment/35468117
has answer: http://stackoverflow.com/a/23189361
score: 0

http://stackoverflow.com/q/23255225
answer count: 1
type: UnansweredQuestion
has title: How to pass the scanner number to an ArrayList
tagged with: java
has answer: http://stackoverflow.com/a/23255306
type: Question
score: 0
has body: My method is working fine !! I am trying to get the information from the user instead of putting the numbers myself as i did in my code.. is there a way that i can get pass the numbers without storing them in different variables! thanks. import java.util.*; public class Interleave { public static void main(String[] args) { Scanner console = new Scanner(System.in); System.out.println("Welcome to Interleave program! "); System.out.println(); System.out.print("how many number for array 1:= "); int array1 = console.nextInt(); for (int i = 0; i &lt; array1; i++) { System.out.print("please enter nubmers := "); int num = console.nextInt(); } ArrayList&lt;Integer&gt; a1 = new ArrayList&lt;Integer&gt;(); a1.add(10); a1.add(20); a1.add(30); System.out.println(); System.out.print("how many number for array 2:= "); int array2 = console.nextInt(); for (int i = 0; i &lt; array2; i++) { System.out.print("please enter nubmers := "); int num2 = console.nextInt(); } ArrayList&lt;Integer&gt; a2 = new ArrayList&lt;Integer&gt;(); a2.add(4); a2.add(5); a2.add(6); a2.add(7); a2.add(8); System.out.println(); System.out.println(a1); System.out.println(a2); interleave(a1, a2); //parameters System.out.println(a1); }//end of main public static void interleave(ArrayList&lt;Integer&gt; list1, ArrayList&lt;Integer&gt; list2) { int sizeList1 = list1.size();//size of array int sizeList2 = list2.size();//size of array ArrayList&lt;Integer&gt; temp = new ArrayList&lt;Integer&gt;(); // for (int index = 0; index &lt; list1.size(); index++)// copy elements ferom list 1 temp.add(index, list1.get(index)); for (int index = 0; index &lt; list2.size(); index++)// copy elements ferom list 2 temp.add(index, list2.get(index)); int tempSize = temp.size(); //get temporary array size temp.clear(); //clear tepm array if (list1.size() &gt; list2.size()) { for (int index = 0, list1Index = 0, list2Index = 0; index &lt; sizeList1; index = index + 2, list1Index++, list2Index++ ) { temp.add(index, list1.get(list1Index));…

http://stackoverflow.com/q/23247900
has answer: http://stackoverflow.com/a/23268710
has comment: http://stackoverflow.com/comment/35608390
type: UnansweredQuestion
upvote count: 1
has comment: http://stackoverflow.com/comment/35583206
score: 1
tagged with: java
has title: Android Sqlite query two tables into an arraylist
type: Question
downvote count: 0
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/35608330
has body: I have the following situation: Android sqlite database with two tables: table1 ——1:N —— table2 table1 - int id (PK) - text field2 - text field3 - text field N… table2 int id (PK) int t1_id (FK) real field3 real field N… Next I have the following Android java structures: Class Table1 { int id; String field2; String field3; String fieldN…; ArrayList&lt;Table2&gt; atable2; } Class Table2 { int id; int t1_id; double field3; double fieldN…; } public ArrayList&lt;Table1&gt; atable1 = new ArrayList&lt;Table1&gt;(); So, I need to select data from database to the atable1 arraylist based on a condition like the following: select * from table1 where table1.field2 = ‘Italy’; The question is that the arraylist atable2 inside arraylist atable1 must be selected based on the field t1_id from table2 (table2.t1_id = table1.id). So anyone can help me to build an efficient form of doing a query (for Android sqlite) to get these data, including the data from table2? Thanks in advance! Best regards, PS
tagged with: android
tagged with: sqlite

http://stackoverflow.com/a/23188940
has body: "." means the current directory in Linux. so you'll need to substitute (or add) the path to where your .class file is.
accepted answer of: http://stackoverflow.com/q/23188780
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/23188780
score: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/35470757
type: AcceptedAnswer

http://stackoverflow.com/comment/35575442
has text: ^ if(count1 == null || count2 == null) then return false. Simples
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23249747

http://stackoverflow.com/comment/35548251
has text: @user3562855: I would recommend that you listen to mad's recs and follow them as he's right.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23234352
type: AnswerComment

http://stackoverflow.com/comment/35463014
type: Comment
comment on: http://stackoverflow.com/a/23183728
score: 0
type: AnswerComment
has text: The registerOnSharedPreferenceChangeListener() and unregisterOnSharedPreferenceChangeListener() preference listeners don't help. I tried.

http://stackoverflow.com/q/23263234
type: UnansweredQuestion
has title: Eclipse SVN commit direct change to tomcat remote server
tagged with: tomcat
has comment: http://stackoverflow.com/comment/35600349
has body: I have develop web application using spring and hibernate without maven for managing sub-version i am using SVN all those things working well. Now my problem is that when i done a little changes in my application then create war file and deploy using tomcat manager and it is more time consuming process for me to perform all those task for a small changes. Can i do like this when i commit using svn(or any other sub-version tools like git) then direct changes to my application which is running on tomcat remove server. Please help me to solve this problem?
has comment: http://stackoverflow.com/comment/35600241
type: Question
score: 0
has comment: http://stackoverflow.com/comment/35600959
tagged with: svn
tagged with: java
tagged with: eclipse
has comment: http://stackoverflow.com/comment/35600094
answer count: 0

http://stackoverflow.com/comment/35547420
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23233898
has text: That makes sense, but where is it being compared to 0, in the if statement?
type: AnswerComment

http://stackoverflow.com/comment/35614252
comment on: http://stackoverflow.com/a/23270646
score: 0
has text: Then like Raghunandan, you need to use `ASyncTask`. Stick this particular bit in a runnable and it run it on the Ui thread inside the `doInBackground` method if it needs to be in real time.
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/35649524
type: Comment
has text: @user907810 : Answer updated with your latest question.
score: 0
comment on: http://stackoverflow.com/a/23289210
type: AnswerComment

http://stackoverflow.com/q/23248987
favorite count: 0
tagged with: spring
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23251125
score: 3
tagged with: spring-integration
downvote count: 0
tagged with: java
has title: Runtime configurable dynamic routing in spring integration
has body: I want to build a scheme with several outbound gateways, that could be added in runtime (lets say it starts with 2 gateways but have ability to add 3rd-4th in runtime). I want to have http-outbound-gateways for their functionality but wanna build their instances in runtime. The problem is in registering channels subscribed to these gateways in spring context. Atm I have 3 desicions and cant choose right one. Register newely created channels to application context with registerBeanDefinition("&lt;my id&gt;", definition) or something similar. Not happy with this desicion cause would prefer not to have such rough access to already built context. Have predefined list of channels, and limit insertion of new outbound gateways with number of this predefined channels. Variant suits me since there's only few gateways planned and it seems quite safe for me, though not very neat. Searching for solution, I found org.springframework.integration.support.channel.BeanFactoryChannelResolver with org.springframework.integration.support.channel.HeaderChannelRegistry that seems suitable for me to use with prototyped channel bean. (map names that i have to refs i require). However since org.springframework.integration.support.channel.BeanFactoryChannelResolver doesnt have public setter for this registry, im not sure i can use it safely, though i consider using own ChannelResolver for this needs. What is the right way to solve this?
type: Question
has answer: http://stackoverflow.com/a/23251125
upvote count: 3
answer count: 1

http://stackoverflow.com/a/23147223
has body: This is an example of login to gmail account using python2.7, hope this helps you:- import urllib2 import getpass FEED_URL = 'https://mail.google.com/mail/feed/atom' def login(user, passwd): auth_handler = urllib2.HTTPBasicAuthHandler() auth_handler.add_password( realm='New mail feed', uri='https://mail.google.com', user='{user}@gmail.com'.format(user=user), passwd=passwd ) opener = urllib2.build_opener(auth_handler) urllib2.install_opener(opener) feed = urllib2.urlopen(FEED_URL) print feed.read() if __name__ == "__main__": user = raw_input("Enter username:") passwd = getpass.getpass("Enter Password:") login(user, passwd)
accepted answer of: http://stackoverflow.com/q/23146698
type: Answer
has comment: http://stackoverflow.com/comment/35468277
answers question: http://stackoverflow.com/q/23146698
upvote count: 1
type: AcceptedAnswer
downvote count: 0
score: 1

http://stackoverflow.com/comment/35588344
score: 0
has text: Ok..but..can't find you. add me https://vk.com/ensirius.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23256026

http://stackoverflow.com/comment/35364385
has text: @DiogoPinheiro When I ran the code to produce my example, the time was 17-04-2014 11:38:15 BST / 17-04-2014 10:38:15 GMT / 1397731095000ms since 01/01/1970.
type: AnswerComment
comment on: http://stackoverflow.com/a/23130977
score: 0
type: Comment

http://stackoverflow.com/a/23253304
answers question: http://stackoverflow.com/q/23252551
type: Answer
has body: For my projects, the '*-servlet.xml' file is empty: <?xml version="1.0" encoding="UTF-8"?> The 'web.xml' file has a context listener to read the configuration when spring application is booting: contextConfigLocation /WEB-INF/SpringAppServlet.xml org.springframework.web.context.ContextLoaderListener Then, the file pointed by the context listener ('/WEB-INF/SpringAppServlet.xm')contains your configuration: <?xml version="1.0" encoding="UTF-8"?> <bean name="/hello.htm" class="com.init.servlet.test.HelloController" />
has comment: http://stackoverflow.com/comment/35596563
has comment: http://stackoverflow.com/comment/35582601
score: 0

http://stackoverflow.com/a/35441015
score: 2
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/23163321
upvote count: 2
has body: Out of curiosity I wrote up a test: import javax.swing.*; import java.awt.Font; import java.awt.GraphicsEnvironment; import java.awt.EventQueue; public class FontCheck{ final static String string = "\u03C3\u0302"; public static void main(String[] args){ EventQueue.invokeLater(()-&gt;{ JFrame frame = new JFrame("font check!"); JPanel content = new JPanel(); content.setLayout(new BoxLayout(content, BoxLayout.PAGE_AXIS)); content.add(new JLabel(string)); String[] fonts = GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames(); for(String font: fonts){ JLabel label = new JLabel(font + " : " + string); label.setFont(new Font(font, Font.PLAIN, 12)); content.add(label); } frame.setContentPane(new JScrollPane(content)); frame.setSize(400, 600); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true); }); } } That shows all of the available fonts, and the first one is the default font. (Which works fine for me.)

http://stackoverflow.com/comment/35551456
type: QuestionComment
comment on: http://stackoverflow.com/q/23236000
score: 0
has text: @AndrewLogvinov Thank you! I've used your method and seems to be the most efficient way possible, please post it as an answer.
type: Comment

http://stackoverflow.com/q/23138381
accepted answer: http://stackoverflow.com/a/23138442
type: Question
tagged with: build
type: AnsweredQuestion
tagged with: java
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/23138485
linked to: http://stackoverflow.com/q/4157303
tagged with: compilation
has body: if you run with CLI (or CMD) the command "winver" you obtain build version... Compilation. Is it possible obtain the build (compilation) version of Windows with Java? EDIT Running winver open popup windows, I can't use it.
has answer: http://stackoverflow.com/a/23138442
possible better answer: http://stackoverflow.com/a/23138485
tagged with: windows
has title: Get Build Windows version with Java

http://stackoverflow.com/comment/35553753
type: Comment
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/23237460
has text: Use a streaming API like [the one](http://google-gson.googlecode.com/svn/trunk/gson/docs/javadocs/com/google/gson/stream/package-summary.html) in [Gson](https://code.google.com/p/google-gson/).

http://stackoverflow.com/comment/35540777
type: Comment
has text: Well if there are retransmissions then look for transport problem, wrong port/host or tcp/udp mismatch, bad contact etc. Can't tell anything without seeing the logs and pcaps.
comment on: http://stackoverflow.com/a/23183854
score: 0
type: AnswerComment

http://stackoverflow.com/comment/35429412
score: 0
type: AnswerComment
type: Comment
has text: Especially in this case, I think a coding style with opening braces without line break would save quite a lot of lines ;-)
comment on: http://stackoverflow.com/a/23167395

http://stackoverflow.com/q/23164857
has comment: http://stackoverflow.com/comment/35433343
has answer: http://stackoverflow.com/a/37208411
upvote count: 6
type: AnsweredQuestion
has body: I have been trying to start with studying OSGI for quiet a few days now. I've tried many tutorials to work on eclipse especially to start with apache felix or Equinox but the step by step tutorials never take me to the end of creating even one bundle. I even tried the console commands with no luck. Is OSGI out dated? All the tutorials on the alliance web site are also extremely old and I couldn't follow them to the end. I also tried the BndTools Totorial here but on eclipse it couldn't resolve "@Component" when I reach 4.3 so I stopped there. When following Osgi Book Preview, I also couldn't find "Make Bundle" so I stopped again. I'm really frustrated. Isn't there a way for beginners to get into OSGI? UPDATE: For other people who are interested in getting started with OSGI, I found the book Osgi in Action as very helpful and a good guide for beginners.
accepted answer: http://stackoverflow.com/a/23187087
has title: OSGI Beginners tutorials are outdated. Is there a new standard?
has comment: http://stackoverflow.com/comment/35433303
has comment: http://stackoverflow.com/comment/35445898
tagged with: java
tagged with: eclipse
has comment: http://stackoverflow.com/comment/35433297
type: Question
has answer: http://stackoverflow.com/a/23187634
downvote count: 0
has answer: http://stackoverflow.com/a/23166686
answer count: 6
has answer: http://stackoverflow.com/a/41701106
tagged with: apache-felix
has comment: http://stackoverflow.com/comment/35430955
tagged with: osgi
tagged with: bundle
favorite count: 0
has answer: http://stackoverflow.com/a/23166450
possible better answer: http://stackoverflow.com/a/37208411
has answer: http://stackoverflow.com/a/23187087
score: 6

http://stackoverflow.com/a/23229511
score: 0
type: AcceptedAnswer
has body: if(existingdomain.equals(emailPattern.matcher(x))){ You are comparing Matcher object with string. That's never going to evaluate to true. See Pattern.matcher(). You need to invoke the find() and group() methods on the matcher and compare the return value with your string. Update String x = "xyz@hotmail.com"; String y = "xyz@outlook.com"; Pattern p = Pattern.compile(".+@([^.]+)\\."); Matcher m = p.matcher(x); if (m.find()) { System.out.println("found: " + m.group(1)); } m = p.matcher(y); if (m.find()) { System.out.println("found: " + m.group(1)); } Output: found: hotmail found: outlook
type: Answer
has comment: http://stackoverflow.com/comment/35540021
has comment: http://stackoverflow.com/comment/35540606
has comment: http://stackoverflow.com/comment/35539774
accepted answer of: http://stackoverflow.com/q/23229449
answers question: http://stackoverflow.com/q/23229449
has comment: http://stackoverflow.com/comment/35539999
has comment: http://stackoverflow.com/comment/35540647
has comment: http://stackoverflow.com/comment/35540083
has comment: http://stackoverflow.com/comment/35540072
has comment: http://stackoverflow.com/comment/35539806

http://stackoverflow.com/comment/35546602
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23233312
has text: @Andrew Thompson: Edited the question. Provided short example. And the "ExcelParser" class is correct. My problem is that i cant add a JTable to an existing GUI.

http://stackoverflow.com/a/23224404
has body: I'm assuming that you're working in Swing and trying to extend a JFrame? Here is a simple program that does this: package com.example; import javax.swing.JFrame; public class HelloWorldSwing { public static void main(String[] args) { HelloWorldSwing helloWorldSwing = new HelloWorldSwing(); helloWorldSwing.execute(); } private void execute() { javax.swing.SwingUtilities.invokeLater(new Runnable() { public void run() { new SignUpScreen();; } }); } private class SignUpScreen extends JFrame { private static final long serialVersionUID = 1L; SignUpScreen() { super("No Layout Manager"); setLayout(null); // setTitle("Login"); setTitle("Sign Up"); // setSize(300, 300); setSize(500, 1500); show(); } } } Changing to the commented-out setTitle and setSize lines changes the title and size of the window for me, on Save. If you paste this code into your environment, and it doesn't change on Save, check Project -> Build Automatically as mentioned in the comments.
downvote count: 0
type: Answer
score: 1
answers question: http://stackoverflow.com/q/23223756
upvote count: 1

http://stackoverflow.com/comment/35369425
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23133701
has text: I'm also interested in, in which case the first statement will not be true? In my opinion, the JVM creates an internalized string at the first `"A"` and on the second it reuses exactly the same string. That's why the reference of these objects should always be equal, shouldn't it?

http://stackoverflow.com/comment/35557069
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23239009
has text: Thanks! Indeed, it throws a ClassCastException at runtime if the caller ask for the "wrong type". I wonder why the compiler let it go because String does not implement Comparable<? super T> but Comparable<String>. Type erasure?

http://stackoverflow.com/q/23215718
has answer: http://stackoverflow.com/a/24597639
type: AnsweredQuestion
downvote count: 0
tagged with: maven-3
favorite count: 0
type: Question
tagged with: maven-bundle-plugin
score: 1
has answer: http://stackoverflow.com/a/29853163
has body: A little unusual question, probably. I'm building apache-log4j-1.2.17 from sources, and everything works right, but I'd like to modify the process a bit and have no idea how. Namely, I'd like to remove Bnd-LastModified property from manifest file and timestamp comment from pom.properties file. Is there any configuration that I miss? I could remove them "manually" (shell script), but that just seems wrong.
answer count: 2
upvote count: 1
has title: Maven/Removing timestamps from build
tagged with: java
accepted answer: http://stackoverflow.com/a/29853163
possible better answer: http://stackoverflow.com/a/24597639

http://stackoverflow.com/comment/35530552
has text: Why can't you allocate a ByteBuffer with a capacity of 4 or 1024 bytes or 1 MB?
comment on: http://stackoverflow.com/q/23224616
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/35522916
type: Comment
score: 0
comment on: http://stackoverflow.com/a/23219916
type: AnswerComment
has text: How to close the scanner?, what I want is the program to keep the new value of n without printing it. Just that. Thanks.

http://stackoverflow.com/comment/35529889
type: QuestionComment
comment on: http://stackoverflow.com/q/23223986
has text: my attempt is already trying to run the piece of code. And i have already read the javadoc about the split. But the problem arises when I try this: public static String[] arg() throws IOException { String[] strArray = getString().split(" "); // System.out.println(Arrays.toString(strArray)); return strArray; }
score: 0
type: Comment

http://stackoverflow.com/comment/35576194
score: 0
comment on: http://stackoverflow.com/q/23249533
type: QuestionComment
has text: @NicolasDefranoux I found the line you were referring to and fixed it. Feel a bit silly for missing that, though it shouldn't do much as `target.exists` should always be false if that if statement evaluates to true. Thanks, though.
type: Comment

http://stackoverflow.com/q/23223052
has answer: http://stackoverflow.com/a/23224509
score: 0
answer count: 3
has title: XStream don't convert a xml tag
tagged with: http://stackoverflow.com/tag/xml
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23496968
has body: I have an xml. I want to convert to object , xstream convert well all tags except one of them it gives null. Any idea about this problem ? xml: nnn aaa ccc <countryco</country> Code java XStream _xstream = new XStream(); _xstream.setMode(XStream.NO_REFERENCES); _xstream.aliasType("person", PersonType.class); _xstream.aliasType("address", PersonType.class); _xstream.aliasField("city", AddressType.class, "city"); _xstream.aliasField("country", AddressType.class, "country"); When I inspect the object person , all variables are ok , but address is always null i tried this : _xstream.aliasType("person", PersonType.class); _xstream.aliasType("address", AddressType.class); _xstream.aliasField("city", AddressType.class, "city"); _xstream.aliasField("country", AddressType.class, "country"); but still don't work !
tagged with: java
type: Question
tagged with: xstream
has answer: http://stackoverflow.com/a/28599009

http://stackoverflow.com/comment/35431475
score: 0
type: AnswerComment
has text: Possible, but that would surprise me a lot. I would assume some other issue, maybe missing settings in your web.xml, session timeout set too short, ...
comment on: http://stackoverflow.com/a/23167772
type: Comment

http://stackoverflow.com/a/23147141
answers question: http://stackoverflow.com/q/23147075
score: 0
type: Answer
has body: It looks like you are trying to print the actual Node, which will just be the memory address that of that node. If you want to print the the integers, you should print the key to the node. print(node.getKey());

http://stackoverflow.com/comment/35507065
type: Comment
has text: Remove `sharedList = new ArrayList();` from buttonClick .
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23211062

http://stackoverflow.com/a/23203479
has comment: http://stackoverflow.com/comment/35493182
has comment: http://stackoverflow.com/comment/35534149
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/23203215
has comment: http://stackoverflow.com/comment/35507892
upvote count: 2
has body: I think you are redirecting to the url from the handleNext controller using post method but the target controller (the one to which the message is redirected) has only a Get method, so change get to post inside Game controller and try again. let me know for any issues.
has comment: http://stackoverflow.com/comment/35495354
has comment: http://stackoverflow.com/comment/35492844

http://stackoverflow.com/a/23195894
has body: Take a look at How do I read all classes from a Java package in the classpath? I was using https://code.google.com/p/reflections/, and now switched to this package com.clemble.test.reflection; import java.io.File; import java.io.IOException; import java.lang.annotation.Annotation; import java.lang.annotation.ElementType; import java.lang.annotation.Target; import java.lang.reflect.Constructor; import java.lang.reflect.Field; import java.lang.reflect.Method; import java.net.JarURLConnection; import java.net.URI; import java.net.URISyntaxException; import java.net.URL; import java.net.URLConnection; import java.util.ArrayList; import java.util.Enumeration; import java.util.LinkedHashSet; import java.util.List; import java.util.Set; import java.util.jar.JarEntry; import java.util.jar.JarFile; public class AnnotationReflectionUtils { /** URL prefix for loading from the file system: "file:" */ public static final String FILE_URL_PREFIX = "file:"; /** URL protocol for an entry from a jar file: "jar" */ public static final String URL_PROTOCOL_JAR = "jar"; /** URL protocol for an entry from a zip file: "zip" */ public static final String URL_PROTOCOL_ZIP = "zip"; /** URL protocol for an entry from a JBoss jar file: "vfszip" */ public static final String URL_PROTOCOL_VFSZIP = "vfszip"; /** URL protocol for a JBoss VFS resource: "vfs" */ public static final String URL_PROTOCOL_VFS = "vfs"; /** URL protocol for an entry from a WebSphere jar file: "wsjar" */ public static final String URL_PROTOCOL_WSJAR = "wsjar"; /** URL protocol for an entry from an OC4J jar file: "code-source" */ public static final String URL_PROTOCOL_CODE_SOURCE = "code-source"; /** Separator between JAR URL and file path within the JAR */ public static final String JAR_URL_SEPARATOR = "!/"; // Taken from https://stackoverflow.com/questions/1456930/how-do-i-read-all-classes-from-a-java-package-in-the-classpath public static &lt;T extends Annotation&gt; List&lt;Class&lt;?&gt;&gt; findCandidates(String baseP…
score: 0
accepted answer of: http://stackoverflow.com/q/23195723
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23195723
type: Answer

http://stackoverflow.com/comment/35633213
comment on: http://stackoverflow.com/q/23280533
type: Comment
type: QuestionComment
has text: Please post the exception message and stack trace, and indicate on which line the error has occurred. What are the values of `indiceLinha` and `indiceColuna`? Indexes into rows and columns are 0-based in Apache POI, so that "A1" corresponds to (0, 0), not (1, 1).
score: 2

http://stackoverflow.com/comment/35587707
type: Comment
type: QuestionComment
has text: How do you know the File reference isn't null, where is the TextFileInput?
comment on: http://stackoverflow.com/q/23256005
score: 0

jboss
tags question: http://stackoverflow.com/q/23138497
tags question: http://stackoverflow.com/q/23232522
tags question: http://stackoverflow.com/q/23162483
tags question: http://stackoverflow.com/q/23260932
tags question: http://stackoverflow.com/q/23192398
tags question: http://stackoverflow.com/q/23242927
tags question: http://stackoverflow.com/q/23268133
tags question: http://stackoverflow.com/q/23155835
tag name: jboss
tags question: http://stackoverflow.com/q/23223290
type: Tag
tags question: http://stackoverflow.com/q/23220430
tags question: http://stackoverflow.com/q/23220317
tags question: http://stackoverflow.com/q/23141975
tags question: http://stackoverflow.com/q/23206942
tags question: http://stackoverflow.com/q/23248270
tags question: http://stackoverflow.com/q/23290014
tags question: http://stackoverflow.com/q/23206074
tags question: http://stackoverflow.com/q/23285339
tags question: http://stackoverflow.com/q/23193100
tags question: http://stackoverflow.com/q/23287527
tags question: http://stackoverflow.com/q/23279213
tags question: http://stackoverflow.com/q/23264517
tags question: http://stackoverflow.com/q/23134291
tags question: http://stackoverflow.com/q/23191520
tags question: http://stackoverflow.com/q/23258910
tags question: http://stackoverflow.com/q/23241121
tags question: http://stackoverflow.com/q/23132791
tags question: http://stackoverflow.com/q/23288238
tags question: http://stackoverflow.com/q/23238161
tags question: http://stackoverflow.com/q/23175265

http://stackoverflow.com/comment/35388470
comment on: http://stackoverflow.com/a/23144036
type: AnswerComment
type: Comment
has text: "By value I mean any value not just a predefined value." I think he wants to have it uninitialized.
score: 0

http://stackoverflow.com/comment/58013877
has text: For Time Since First Boot:- Whenever user switch off the phone store SystemClock.elapsedRealtime() and current date and time in a sharePreference and when is switch on check the current date and time and from sharedPreference to get the time when the phone was switch off and also u have first boot in SystemClock.elapsedRealtime(), so u can use this approach to get elasped time
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/35145587
type: Comment

http://stackoverflow.com/q/23182737
has answer: http://stackoverflow.com/a/23182788
tagged with: arraylist
has body: ok here's the block of code i wrote : public ArrayList&lt;Location&gt; possibleMoves() { ArrayList&lt;Location&gt; a1 = new ArrayList&lt;Location&gt;(); // an array to contain all possible locations Board testB = new Board(); // a test board to test if locations are valid or not // locations have x &amp; y coordinates a1.add(new Location(getCurrentLocation().getx() - 1, getCurrentLocation().gety() + 1)); a1.add(new Location(getCurrentLocation().getx() + 1, getCurrentLocation().gety() - 1)); a1.add(new Location(getCurrentLocation().getx() - 1, getCurrentLocation().gety() - 1)); a1.add(new Location(getCurrentLocation().getx() + 1, getCurrentLocation().gety() + 1)); for (int i = 0; i &lt; a1.size(); i++) { try { Tower testTower = testB.getGrid()[a1.get(i).getx()][a1.get(i).gety()]; }catch(ArrayIndexOutOfBoundsException e) { a1.remove(a1.get(i)); } } return a1; }
has comment: http://stackoverflow.com/comment/35455663
score: 0
type: UnansweredQuestion
type: Question
tagged with: try-catch
has comment: http://stackoverflow.com/comment/35455603
has answer: http://stackoverflow.com/a/23182918
tagged with: java
has comment: http://stackoverflow.com/comment/35455573
answer count: 2
tagged with: game-engine
has title: Some elements are just magically not removed from ArrayList

http://stackoverflow.com/q/23225247
type: Question
tagged with: android
has comment: http://stackoverflow.com/comment/35531643
has title: Free sourcecode repository?
has comment: http://stackoverflow.com/comment/35531492
score: 0
tagged with: java
answer count: 1
has answer: http://stackoverflow.com/a/23225700
accepted answer: http://stackoverflow.com/a/23225700
has body: is there a free sourcecode repository for private sourcecode? I am looking for a sourcecode repository where I can upload my Android/Java projects with Eclipse. The sourcecode should not be visible to others. I have only found solutions like sourceforge which provide an open-source repository.
has comment: http://stackoverflow.com/comment/35532366
type: AnsweredQuestion
tagged with: repository

http://stackoverflow.com/q/23212754
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/23212929
tagged with: arraylist
has title: Update Tree node using pass by value in Java
accepted answer: http://stackoverflow.com/a/23213134
tagged with: pass-by-value
has comment: http://stackoverflow.com/comment/38965132
score: 0
tagged with: pass-by-reference
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/23212929
linked to: http://stackoverflow.com/q/40480
has answer: http://stackoverflow.com/a/23213134
has body: Before I show my problem what I understand is: Java uses pass by value. Said that, In below example, I pass "my_root" reference , to NodeModify(), and in line "NodeModify(my_root);" expect compiler to pass copy of memory address of "my_root " and inside function make "root = new_node;" i.e => expect root's memory location/address be updated to / point to location where "new_node" is. Surprisingly, it doesn't reflect back in main() function from where it was called, why is this so? package com.trees; public class NodeExample { public static void NodeModify(Node root){ System.out.println("[NodeModify] fresh root is : " + root); Node new_node = new Node(0); System.out.println("[NodeModify] new node is : " + new_node); root = new_node; System.out.println("[NodeModify] root is : " + root); } public static void main(String[]arg){ Node my_root = new Node(55); System.out.println("my root before NodeModify is: " + my_root); NodeModify(my_root); System.out.println("my root after NodeModify is: " + my_root); } } However, if I do the same with other reference, like ArrayList, it gets updated in main() as I expect! Example: package com.trees; import java.util.ArrayList; public class ArrayListUpdateClass { public static void updateMyArrayList(ArrayList&lt;String&gt; sample){ sample.add("was updated!"); } public static void main(String[]args){ ArrayList&lt;String&gt; my_list = new ArrayList&lt;String&gt;(); my_list.add("My list "); System.out.println("**Before call list is:**"); printArrayList(my_list); updateMyArrayList(my_list); System.out.println("\n**After call list is:**"); printArrayList(my_list); } private static void printArrayList(ArrayList&lt;String&gt; my_list) { for(String item:my_list){ System.out.println(item); } } } What am I missing here, I had hard time updating root node in making Binary tree.

http://stackoverflow.com/comment/35598366
comment on: http://stackoverflow.com/q/23261954
type: Comment
type: QuestionComment
score: 0
has text: Update your question with pertinent details, including actual code.

http://stackoverflow.com/comment/35460973
score: 0
comment on: http://stackoverflow.com/q/23185371
type: Comment
type: QuestionComment
has text: It's probably because your java call is in quotations. Try `var temp = <%= x %>`. If this is a JSP file, the value should be replaced before the JavaScript interpreter gets to it.

http://stackoverflow.com/q/23199488
answer count: 1
downvote count: 0
tagged with: generics
has comment: http://stackoverflow.com/comment/35488096
favorite count: 0
has comment: http://stackoverflow.com/comment/35487778
has body: I know that in the following method in Collection&lt;E&gt;: public void addAll(Collection&lt;? extends E&gt; subcollection); We use Collection&lt;? super E&gt; there to allow a collection that solely exists of sub-elements, example: List&lt;Drivable&gt; drivables = new ArrayList&lt;&gt;(); List&lt;Car&gt; cars = new ArrayList&lt;&gt;(); //we need the wildcard here, because of the following line: drivables.addAll(cars); However, are such bounded wildcards needed in my following method? public static &lt;E&gt; Collection&lt;E&gt; requireNonEmpty(final Collection&lt;E&gt; collection) throws NoSuchElementException { if (collection.isEmpty()) { throw new NoSuchElementException("collection must be non-empty"); } return collection; } This uses a similar idiom as Objects.requireNonNull(T object), which actually returns the T object. So, is there any benefit (or is it even wrong?) to write my method as the following? public static &lt;E&gt; Collection&lt;? super E&gt; requireNonEmpty(final Collection&lt;? extends E&gt; collection);
linked to: http://stackoverflow.com/q/12894335
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35485553
score: 1
linked to: http://stackoverflow.com/q/2723397
tagged with: java
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/35485782
tagged with: bounded-wildcard
has comment: http://stackoverflow.com/comment/35485610
has answer: http://stackoverflow.com/a/23199614
has title: Is there a need to use bounded wildcard generics in a passthrough method?
has comment: http://stackoverflow.com/comment/35485565

http://stackoverflow.com/q/23234528
type: Question
has answer: http://stackoverflow.com/a/23234680
tagged with: hashmap
tagged with: sorting
tagged with: arraylist
score: 0
has answer: http://stackoverflow.com/a/23234768
answer count: 3
tagged with: grouping
has answer: http://stackoverflow.com/a/23234792
type: UnansweredQuestion
has title: Group HashMap items according to a specific key
tagged with: java
has body: I have a ArrayList>> which holds certain key-value entries. Like:- ArrayList&lt;HashMap&lt;String, String&gt;&gt; myList = new ArrayList&lt;HashMap&lt;String,String&gt;&gt;(); HashMap&lt;String,String&gt; map = new HashMap&lt;String,String&gt;(); map.put("NewId", newId); map.put("Title", title); map.put("Description", description); myList.add(map); "NewId" can be similar for multiple entries. Also I have an Array of colors:- String[] colors = new String[]{"#1F1A17", "#62934D", "#F9B03F", "#7959BC", "#74B8DE", "#E65641", "#7CC8BB", "#D7CE5D", "#D6BE95", "#B694D1"}; I want to now group all the entries with same "NewId" together and assign them the first color, other entries with next similar "NewId" with the second color and so on till items with first 10 same "NewId" get assigned with their respective colors. eg:- before grouping NewId Title Description 101 title1 des1 102 title2 des2 103 title3 des3 101 title4 des4 102 title5 des5 103 title6 des6 after grouping NewId Title Description 101 title1 des1 ------&gt; color1 101 title4 des4 ------&gt; color1 102 title2 des2 ------&gt; color2 102 title5 des5 ------&gt; color2 103 title3 des3 ------&gt; color3 103 title6 des6 ------&gt; color3 How can I achieve this?

http://stackoverflow.com/comment/35588798
has text: im not sure what you mean by that?,
comment on: http://stackoverflow.com/q/23208432
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/q/23263806
has title: How to the keyboard BlueStacks on a java android project?
has body: How I can map the keyboard in java using BlueStacks? I try this but when I press any key does nothing. I need to use the arrow keys and the spacebar, thanks for the help. public static class KeyEvent { public static final int KEY_DOWN = 0; public static final int KEY_UP = 1; public int type; public int keyCode; public char keyChar; public String toString() { StringBuilder builder = new StringBuilder(); if (type == KEY_DOWN) builder.append("tecla pulsada, "); else builder.append("tecla levantada, "); builder.append(keyCode); builder.append(","); builder.append(keyChar); return builder.toString(); } public List&lt;KeyEvent&gt; getKeyEvents(); } Then call class: public void update(float deltaTime) { List&lt;TouchEvent&gt; touchEvents = juego.getInput().getTouchEvents(); List&lt;KeyEvent&gt; keyEvents = juego.getInput().getKeyEvents(); juego.getInput().getKeyEvents(); if (estado == EstadoJuego.Preparado) updateReady(touchEvents); if (estado == EstadoJuego.Ejecutandose) { updateRunning(touchEvents, deltaTime,keyEvents); } if (estado == EstadoJuego.Pausado) updatePaused(touchEvents); if (estado == EstadoJuego.FinJuego) updateGameOver(touchEvents); } private void updateRunning(List&lt;TouchEvent&gt; touchEvents, float deltaTime,List&lt;KeyEvent&gt; keyEvents) { //Reinicio valores de menus pausa, etc... msgx=360; listo=false; finmensaje=false; for(int i=0;i&lt;keyEvents.size();i++){ if(keyEvents.get(i).keyCode&gt;0){ Assets.sdisparo.play(1); } } if(juego.getInput().isKeyPressed(38)){ Log.e("Prueba", "Se ha tecleado arriba"); Assets.sdisparo.play(1); } } Sorry for my English ^^
tagged with: keyboard
favorite count: 0
type: UnansweredQuestion
tagged with: android
score: 2
answer count: 0
downvote count: 0
tagged with: java
type: Question
tagged with: bluestacks
upvote count: 2

http://stackoverflow.com/q/23224948
has comment: http://stackoverflow.com/comment/35530981
score: -1
favorite count: 0
has body: I try to put a JTable into a JScrollPane. Here's my code : String SQLquery="SELECT Name FROM Teacher"; PreparedStatement prepStat = con.prepareStatement(SQLquery); MyTableModel model= AccesBDGen.createTableModel(prepStat); JTable table = new JTable(model); JScrollPane scroll = new JScrollPane(table); getContentPane().add(scroll); And the AccesBDGen's method : public static MyTableModel createTableModel (PreparedStatement prepStat) throws SQLException {ResultSet data= prepStat.executeQuery(); ArrayList &lt;String&gt; nameColumn = createNomColonnes(data); ArrayList &lt;Object&gt; row= createRow(data); ArrayList &lt;Object&gt; objectTypes = createObjectTypes(data); MyTableModel model = new MonTableModel(nameColumn ,row, objectTypes ); return model; } But it doesn't work. When I try to display my JTable I have no problems. But when I try to display the JSCrollPane, it's empty.
linked to: http://stackoverflow.com/q/10619048
type: UnansweredQuestion
has title: JTable in a JScrollPane
tagged with: swing
duplicate of: http://stackoverflow.com/q/10619048
has comment: http://stackoverflow.com/comment/35532790
tagged with: java
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/35531408
has answer: http://stackoverflow.com/a/23225957
has comment: http://stackoverflow.com/comment/35530939
upvote count: 0
answer count: 1
tagged with: jtable
tagged with: jscrollpane

http://stackoverflow.com/comment/35564098
has text: You might be interested in [Serving RDF representation of Java model with Spring MVC?](http://stackoverflow.com/q/17313801/1281433). (I'm not sure whether it answers your question or not, but it's certainly related.)
score: 2
comment on: http://stackoverflow.com/q/23240770
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35543993
type: QuestionComment
has text: 1. RandomSaltGenerator does it save the internally generated salt with persisted value.?
comment on: http://stackoverflow.com/q/23227616
score: 0
type: Comment

http://stackoverflow.com/a/23191783
downvote count: 0
answers question: http://stackoverflow.com/q/23191701
accepted answer of: http://stackoverflow.com/q/23191701
type: Answer
has body: In javascript you have to write like below code. var type = $("#periodId").val(); if(type == "weekrange"){ // then put java script to hide the related element/select boxes. }else if(){ // then put java script to hide the related element/select boxes. }else{ // then put java script to hide the related element/select boxes. }
score: 1
upvote count: 1
type: AcceptedAnswer

http://stackoverflow.com/comment/35572533
comment on: http://stackoverflow.com/a/23248060
has text: Ok Steve. I would create a socket to do this ?
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/35427481
score: 0
type: QuestionComment
has text: @EJP actually i am using a third party library javacv which provides me audio samples as a Buffer array.
type: Comment
comment on: http://stackoverflow.com/q/23151038

http://stackoverflow.com/q/23178932
has body: Hi i want to create game launcher that check md5 so if user modified game files the game wouldn't start and display message to reinstall game and if user add more files to the game folder game start but it's will delete a file that user add. How the code look like? Thank you
type: Question
accepted answer: http://stackoverflow.com/a/23179845
score: -1
tagged with: java
tagged with: md5
answer count: 1
downvote count: 1
has title: How to check a modified files with md5 (java)
has comment: http://stackoverflow.com/comment/35449657
has answer: http://stackoverflow.com/a/23179845
type: AnsweredQuestion
upvote count: 0
linked to: http://stackoverflow.com/q/304268
tagged with: md5-file
favorite count: 0

http://stackoverflow.com/a/23231240
has comment: http://stackoverflow.com/comment/35543552
has comment: http://stackoverflow.com/comment/35543047
type: Answer
has comment: http://stackoverflow.com/comment/35543448
accepted answer of: http://stackoverflow.com/q/23230908
answers question: http://stackoverflow.com/q/23230908
has comment: http://stackoverflow.com/comment/35544175
has body: Bukkit has a built in YamlConfiguration class with methods which allow you to get a value or specify a default value to retrieve if none exist, such as getString(String path, String default). Gets the requested String by path, returning a default value if not found. If the String does not exist then the specified default value will returned regardless of if a default has been identified in the root Configuration. However it does not have a way to remove values from the configuration. If the new configuration is so different from the previous one, you might consider creating the new configuration, deleting the old and renaming the new to take it's place. Though I wouldn't be too concerned about it unless it's significantly different.
score: 0
type: AcceptedAnswer

http://stackoverflow.com/q/23284922
tagged with: swing
tagged with: java
has answer: http://stackoverflow.com/a/23285017
has body: i just want to know how to pass a value like string from JInternalFrame to JDialog. JDialog is a child form and JInternalFrame is a parent form. If you can please show me a simple example. here is my code , i want to pass id from ProductDetails to AddQuantity , i tried to use static but it's not working public class ProductDetails extends javax.swing.JInternalFrame { String id; public ProductDetails() throws Exception { initComponents(); } //This is a button to go to JDialog private void btnAddQuantityActionPerformed(java.awt.event.ActionEvent evt) { id = txtID.getText(); AddQuantity aq = new AddQuantity(null, true); aq.setLocationRelativeTo(aq); aq.setVisible(true); } } public class AddQuantity extends javax.swing.JDialog { ProductDetails pd; public AddQuantity(java.awt.Frame parent, boolean modal) { super(parent, modal); initComponents(); //i use showMessage to show result but it show me nothing JOptionPane.showMessageDialog(this, pd.id); txtCurrentID.setText(pd.id); } }
type: Question
answer count: 2
has title: How to pass value from JInternalFrame to JDialog
has answer: http://stackoverflow.com/a/23285170
tagged with: jdialog
has comment: http://stackoverflow.com/comment/35666570
has comment: http://stackoverflow.com/comment/35660254
tagged with: jinternalframe
type: UnansweredQuestion
score: 0

http://stackoverflow.com/comment/35624379
type: QuestionComment
has text: @PhilippeGeek Already upvoted.
comment on: http://stackoverflow.com/q/23275967
score: 0
type: Comment

http://stackoverflow.com/a/23176478
answers question: http://stackoverflow.com/q/23176290
type: Answer
has comment: http://stackoverflow.com/comment/35445541
has body: In Tomcat a .java and .class file will be created for every jsp files with in the application and the same can be found from the path below, Apache-Tomcat\work\Catalina\localhost\'ApplicationName'\org\apache\jsp\index_jsp.java In your case the jsp name is recommandation.jsp so the path should be something like below Apache-Tomcat\work\Catalina\localhost\'ApplicationName'\org\apache\jsp\recommandation_jsp.java in line no 300 you are trying to access a null object which results in null pointer exception. If you are using Glassfish, you can find your compiled jsp files here your-domain-dir/generated/jsp/j2ee-modules\\YourModule/org/apache/jsp. on my system, it is C:\glassfish-4.0\glassfish\domains\domain1\generated\jsp\WebApplication1\org\apache\jsp
score: 0

http://stackoverflow.com/q/23233673
type: UnansweredQuestion
score: 6
has answer: http://stackoverflow.com/a/23989280
upvote count: 6
tagged with: nosql
has answer: http://stackoverflow.com/a/37921956
has comment: http://stackoverflow.com/comment/81755157
tagged with: java
has title: Jedis : Could not get a resource from the pool
tagged with: jedis
type: Question
has comment: http://stackoverflow.com/comment/36012377
has body: Background Our application uses Jedis-2.2.1 and connects to Redis-2.6, here's how I get jedis resource : protected static JedisWrapper getRedisUserWrite(String UDID) { if (redisUserWritePools.get(0) == null) init(); int hash = hash(UDID); Jedis jedis = redisUserWritePools.get(hash).getResource(); jedis.select(dbs.get("redisUserWritePools" + hash)); return new JedisWrapper(jedis, redisUserWritePools.get(hash)); } And this is my JedisWrapper(Unify the management of resources): public class JedisWrapper { private Jedis jedis; private JedisPool pool; public JedisWrapper(Jedis jedis, JedisPool pool) { this.jedis = jedis; this.pool = pool; } public Jedis get(){ return this.jedis; } public void returnResource() { if(null != this.jedis){ this.pool.returnResource(this.jedis); } } public void returnBrokenResource() { if(null != this.jedis) { this.pool.returnBrokenResource(this.jedis); } this.jedis = null; } } JedisWrapper is the container if Jedis instance, here's how I use it : private static void cacheSDKIDs(String UDID, String[] SDKIDs) { JedisWrapper wrapper = getRedisUserWrite(UDID); try { if (SDKIDs != null) { wrapper.get().del(UDID); wrapper.get().sadd(UDID, SDKIDs); } } catch (JedisConnectionException e) { e.printStackTrace(); wrapper.returnBrokenResource(); }catch (Exception e) { e.printStackTrace(); } finally { wrapper.returnResource(); } } Note that, SKDIDs maybe very large(e.g. could reach the maximum of 8KB). Here's the problem Every time I restart our application, all redis connections are normal, but several hours later, the Could not get a resource from the pool Exception comes out. And frequency become higher and higher, then all the connections to Redis are disconnected and can create new connection. Here's my configuration : &lt;bean id = "redisConfig" class="redis.clients.jedis.JedisPoolConfig"&gt; &lt;property name="maxActive" value="400" /&gt; &lt;property name="maxIdle" value="100" /&gt; &lt;property name="minIdle" value="20" /&gt; &lt;property name="ma…
answer count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/81849067
favorite count: 0
tagged with: redis

http://stackoverflow.com/comment/35593648
type: Comment
has text: @JeroenVannevel: I clarified my answer a bit.
comment on: http://stackoverflow.com/a/23259195
score: 0
type: AnswerComment

http://stackoverflow.com/q/23181592
tagged with: arrays
has body: I need to create list of n arrays and fill only first record in every array with records from arr array (first record of first array will be equal to first record from arr array, first record of second array will be equal to second record from arr array etc.). In C# it's simple: List&lt;Point[]&gt; grupy = new List&lt;Point[]&gt;(); //create n array of Point for (int i = 1; i &lt;= n; i++) grupy.Add(new Point[10]); //array length will be 10 int a = 0; foreach (Point[] x in grupy) { grupy[a][0] = new Point(arr[a]); //fill first records in all arrays form list a++; } But I need this code in Java and I noticed that I can't call to records in array from list like that: List&lt;Point[]&gt; grupy = new ArrayList&lt;Point[]&gt;(); //create n arrays of Point for (int i = 1; i &lt;= n; i++) grupy.add(new Point[10]); int a = 0; for(Point[] x : grupy) { grupy[a][0] = new Point(arr[a]); //WRONG WAY a++; } grupy.get(a)[0] dosen't working too. So, my question is: how can I get access to specified record in array from list of arrays? I know that I can create temp array in for(), save arr.get(a) to temp[0] and add temp to grupy but after i need to display or change specified record and this way won't help.
has answer: http://stackoverflow.com/a/23181630
tagged with: arraylist
has comment: http://stackoverflow.com/comment/35455187
has comment: http://stackoverflow.com/comment/35454485
accepted answer: http://stackoverflow.com/a/23181630
possible better answer: http://stackoverflow.com/a/23181841
has title: Getting access to records in list of arrays
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23181841
tagged with: java
type: Question
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/35455330

http://stackoverflow.com/a/23266430
answers question: http://stackoverflow.com/q/23266397
score: 0
has body: How else would you transfer? Finally it will be bytes that will be transferred on the network. How will other end know how to create the original object from these bytes? Serialization is the answer.It can be of many types. You can use Java inbuilt serialization, XML etc.
type: Answer

http://stackoverflow.com/comment/35430619
comment on: http://stackoverflow.com/q/23167985
score: 0
type: Comment
type: QuestionComment
has text: even if it does, that doesnt help me, how do I run `isClosed()` more than once? If I put the code at the end of the loop it will only be called once and thats after the client sends me a message. If the client doesnt send me a message the `isClosed()` will not be called.

http://stackoverflow.com/a/76213025
type: AcceptedAnswer
downvote count: 0
upvote count: 2
has body: We noticed the same problem, particularly with Java EL and JPA. This is likely to affect multiple frameworks that use Introspector to discover properties that follow the JavaBean convention. There is an official Bug opened. I thought I would add this for reference since it is creating problems for multiple frameworks. https://bugs.openjdk.org/browse/JDK-8071693 https://github.com/openjdk/jdk/pull/13544 The official Fix version is 21. I asked if it could possibly be backported to 17. EDIT More Info for EL specific issues: https://github.com/jakartaee/expression-language/issues/43 There may be at least a partial fix in Jakarta EE 10. However, there is a fully working workaround for EE < 10 and JDK < 21. You can simply make a BeanInfo class that describes the properties inherited from the interface. Here, MyClass is inheriting aProperty getter/setters from an interface. To expose these to the JDK Introspector, simply create a BeanInfo class: public class MyClassBeanInfo extends SimpleBeanInfo { @Override public BeanInfo[] getAdditionalBeanInfo() { return new BeanInfo[] { new SimpleBeanInfo() { @Override public PropertyDescriptor[] getPropertyDescriptors() { try { return new PropertyDescriptor[] { new PropertyDescriptor("aProperty", MyClass.class, "getAProperty", "setAProperty") }; } catch (final IntrospectionException e) { throw new RuntimeException(e); } } } }; } } Reference: https://docs.oracle.com/javase/8/docs/api/java/beans/BeanInfo.html
type: Answer
accepted answer of: http://stackoverflow.com/q/23219006
score: 2
answers question: http://stackoverflow.com/q/23219006

http://stackoverflow.com/comment/35618440
score: 0
comment on: http://stackoverflow.com/q/23272683
type: Comment
type: QuestionComment
has text: here's an answer i wrote describing the basics of spring-data jpa http://stackoverflow.com/a/15573461/217324 just to give you an idea.

http://stackoverflow.com/a/23244681
has comment: http://stackoverflow.com/comment/35567396
score: 0
has body: <?xml version="1.0" encoding="utf-8"?> <requestFocus /> <RadioButton android:id="@+id/radioButton1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@+id/editText1" android:layout_toRightOf="@+id/radioButton2" android:checked="true" android:text="kmh" android:textSize="8sp" /> <RadioButton android:id="@+id/radioButton2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@+id/editText1" android:text="miles" android:textSize="8sp"/>
has comment: http://stackoverflow.com/comment/35567693
has comment: http://stackoverflow.com/comment/35571286
has comment: http://stackoverflow.com/comment/35593574
type: Answer
answers question: http://stackoverflow.com/q/23244326

http://stackoverflow.com/comment/35517238
score: 0
type: Comment
type: QuestionComment
has text: aLeaderboard size is not equal to aResult.size(). the for loop counter is looping on aResult.size(). the line aLeaderboard.get((aResult.get(counter)) is trying to access which is not there.
comment on: http://stackoverflow.com/q/23217222

http://stackoverflow.com/comment/35497697
comment on: http://stackoverflow.com/a/23206048
score: 1
type: AnswerComment
has text: You can't reuse a transaction. Just use `getFragmentManager().beginTransaction()` like you did in `onCreate()`.
type: Comment

http://stackoverflow.com/a/23177447
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/23177407
has body: I guess you need to recurse the whole tree, something like start with the root iterate all components enable each of them test if it's an instance of Container if so, do a recursive call For the ScrollPane you'll probably need an additional instanceof test and then getViewPort or something like this.
has comment: http://stackoverflow.com/comment/35447284
has comment: http://stackoverflow.com/comment/35447292
has comment: http://stackoverflow.com/comment/35447220
downvote count: 0
has comment: http://stackoverflow.com/comment/35447406
has comment: http://stackoverflow.com/comment/35479139
has comment: http://stackoverflow.com/comment/35447355
type: Answer
has comment: http://stackoverflow.com/comment/35455062

http://stackoverflow.com/a/23256223
has body: You can make sure that your filenames are padded with zeros like this: public String pad(String fileName, int len) { if (fileName.length() &gt;= len) { return fileName; } String padded = "0000000" + fileName; // Change the number of zeros to your needs return padded.substring(padded.length() - len); } Then you just have to prepend "ABC_" to the padded value: String newName = "ABC_" + pad(oldNmame, 6); // produce 6 characters per String produces results like: 10.pdf gets ABC_10.pdf 1.pdf gets ABC_01.pdf a.pdf gets ABC_0a.pdf 100.pdf gets ABC_100.pdf a.a gets ABC_000a.a
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23255870
answers question: http://stackoverflow.com/q/23255870
type: Answer
has comment: http://stackoverflow.com/comment/35614804
score: 0
has comment: http://stackoverflow.com/comment/35625445

http://stackoverflow.com/q/23197884
upvote count: 1
favorite count: 0
tagged with: download
answer count: 0
downvote count: 0
type: UnansweredQuestion
tagged with: jakarta-ee
has body: The following code is used to prepare a file to be downloaded: File downloadFile = new File(ftpPath + File.separator + company.toLowerCase() + File.separator + "download" + File.separator + paramFileName); FileInputStream fis = new FileInputStream(downloadFile); BufferedInputStream bis = new BufferedInputStream(fis); response.setContentType("binary"); response.setHeader("Content-Disposition", "attachment; filename="+paramFileName); response.setHeader("Content-Length",String.valueOf(downloadFile.length())); response.setHeader("Content-Encoding", "utf-8"); ServletOutputStream sos = response.getOutputStream(); IOUtils.copy(bis, sos); sos.flush(); fis.close(); bis.close(); sos.close(); When a file is clicked and downloaded, while the total file size is correctly visible in the download progress bar, the file never actually finishes downloading. For large files, it gets about 95%+ of the way there and then stops completely. For smaller files, the results are less consistent, but the file never finishes downloading in it's entirety. If I remove the following lines, the file does completely download: /* response.setHeader("Content-Length",String.valueOf(downloadFile.length())); response.setHeader("Content-Encoding", "utf-8"); */ However, the total file size is not given when the file begins downloading. This is very inconvenient for our users, who may be downloading a large file and would like to know an approximate "time to completion" number. Is there a fix which will allow the file to completely download and also give an accurate indication of the file size? Thanks for the help Note: Got rid of DataInputStream as it was never used.
score: 1
tagged with: java
type: Question
has title: Downloading file stops just before finish - caused by Content Length in response header

http://stackoverflow.com/q/23264366
answer count: 1
accepted answer: http://stackoverflow.com/a/23266082
tagged with: buffer
tagged with: sockets
has comment: http://stackoverflow.com/comment/35645869
type: AnsweredQuestion
has body: I am trying to transfer a large file from a server to a client. My code so far works but only if I set the buffer size in the client code to the exact size of the file. I won't always know what the file size is going to be. I keep finding examples that claim it doesn't matter what the size of the file or buffer is because it will just keep reading from the input stream...? However, when I implement the code that supposedly does this, it transfers 0 bytes. Client: public static void main (String [] args ) throws IOException { int bytesRead; int current = 0; FileOutputStream fos = null; BufferedOutputStream bos = null; Socket sock = null; try { sock = new Socket(hostname, 20000); System.out.println("Connecting..."); // receive file InputStream is = sock.getInputStream(); fos = new FileOutputStream(FILE_TO_RECEIVE); bos = new BufferedOutputStream(fos); //////////// replaced this //////////////////////////// byte[] buffer = new byte[BUFFER_SIZE]; bytesRead = is.read(buffer,0,buffer.length); current = bytesRead; do { bytesRead = is.read(buffer, current, (buffer.length-current)); if(bytesRead &gt;= 0){ current += bytesRead;} } while(bytesRead &gt; 0); bos.write(buffer, 0 , current); /////////////////////////////////////// // with this: // int count; // byte[] buffer = new byte[8192]; // while ((count = is.read(buffer)) &gt; 0) // { // bos.write(buffer, 0, count); // } //////////// transfers 0 bytes /////////// bos.flush(); System.out.println("File " + FILE_TO_RECEIVE + " downloaded (" + current + " bytes read)"); } finally { if (fos != null){ fos.close();} if (bos != null){ bos.close();} if (sock != null){ sock.close();} } } Server: public static void main(String[] args) throws IOException{ FileInputStream fis = null; BufferedInputStream bis = null; OutputStream os = null; ServerSocket servsock = null; Socket sock = null; try { servsock = new ServerSocket(20000); while (true) { System.out.println("Waiting..."); try { sock = servsock.accept(); System.out.println("Accepted …
tagged with: java
has title: Java Socket Programming Buffer for Large File
type: Question
has answer: http://stackoverflow.com/a/23266082
score: 0

http://stackoverflow.com/a/23234792
has comment: http://stackoverflow.com/comment/35549810
has comment: http://stackoverflow.com/comment/35560165
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/35555506
answers question: http://stackoverflow.com/q/23234528
has body: you can add a custom list class: public class MyList { private ArrayList&lt;HashMap&lt;String, String&gt;&gt; list = new ArrayList&lt;&gt;(); public boolean add(HashMap&lt;String, String&gt; map) { return list.add(map); } public void setColor(String newId, String color) { for (HashMap&lt;String, String&gt; m : list) if (m.containsKey(newId)) m.put("color", color); } public String getGroupKey(String key, int i) { ArrayList&lt;String&gt; uniqeList = getUniqKeyList(key); Collections.sort(uniqeList); return uniqeList.get(i); } public ArrayList&lt;String&gt; getUniqKeyList(String key){ ArrayList&lt;String&gt; l = new ArrayList&lt;&gt;(); for (HashMap&lt;String, String&gt; m : list) if(!l.contains(m.get(key))) l.add(m.get(key)); return l; } } and in main every thing is clear and simple : public static void main(String[] args) throws Exception { MyList myList = new MyList(); HashMap&lt;String,String&gt; map = new HashMap&lt;String,String&gt;(); map.put("NewId", newId); map.put("Title", title); map.put("Description", description); myList.add(map); String[] colors = new String[]{"#1F1A17", "#62934D","#B694D1"}; int i=0; while (true) { if(i == colors.length) break; String s = myList.getGroupKey("NewId", i); if(s == null) break; else myList.setColor(s, colors[i++]); } }
downvote count: 0
has comment: http://stackoverflow.com/comment/35554750
has comment: http://stackoverflow.com/comment/35558034
type: Answer

http://stackoverflow.com/q/23197303
has body: So i am using Java and Swing and am trying to program a window with a JSplitPane equally split on each side. I have got the JSplitPane, however one side is nearly the full size of the window and the other is tiny. package com.harrykitchener.backup; import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.io.*; public class Main { private JMenuBar menuBar; private JMenu fileMenu, editMenu, helpMenu; private JPanel leftPanel, rightPanel; private JButton openButton; public Main() { JPanel mainCard = new JPanel(new BorderLayout(8, 8)); menuBar = new JMenuBar(); fileMenu = new JMenu("File"); editMenu = new JMenu("Edit"); helpMenu = new JMenu("Help"); menuBar.add(fileMenu); menuBar.add(editMenu); menuBar.add(helpMenu); mainCard.add(menuBar); leftPanel = new JPanel(); rightPanel = new JPanel(); JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, leftPanel, rightPanel); JFrame window = new JFrame("Pseudo code text editor"); window.setJMenuBar(menuBar); window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); window.getContentPane().add(splitPane); window.setSize(1280, 720); window.setLocationRelativeTo(null); window.setVisible(true); } public static void main(String args[]) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { new Main(); } }); } }
has title: How to equally split a JSplitPane?
type: Question
accepted answer: http://stackoverflow.com/a/23197450
has answer: http://stackoverflow.com/a/23198508
score: 0
answer count: 2
possible better answer: http://stackoverflow.com/a/23198508
tagged with: swing
has answer: http://stackoverflow.com/a/23197450
tagged with: jsplitpane
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/35620061
comment on: http://stackoverflow.com/q/23272905
type: Comment
type: QuestionComment
has text: I'm stumped too. With what little you post (which is not enough to see those statements in their proper context) I see multiple red flags. Using instance variables in a RESTful web service which should remain stateless by design? Making it a singleton!?!? I don't think so.
score: 0

http://stackoverflow.com/a/23234055
upvote count: 2
answers question: http://stackoverflow.com/q/23234040
has body: It is absolutely safe. When someString.split("\t") is executed, a reference to the object it returns is put on the stack. It is therefore reachable and cannot be GC'ed. The object can only be GC'ed after someString.split("\t")[0] // ^ array access has been executed.
downvote count: 0
type: Answer
score: 2

http://stackoverflow.com/a/23249371
has comment: http://stackoverflow.com/comment/35575565
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/35575207
accepted answer of: http://stackoverflow.com/q/23249312
type: Answer
has body: Use the length method of the File class: File f = new File(fileName); System.out.println(f.length()) Please note that you can use the f in your BufferReader object too : BufferedReader br = new BufferedReader(new FileReader(f));
answers question: http://stackoverflow.com/q/23249312
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/35575183

http://stackoverflow.com/comment/35581569
comment on: http://stackoverflow.com/a/23252901
type: Comment
score: 0
type: AnswerComment
has text: @BrianRoach, whoa. Learning new stuff everyday!

http://stackoverflow.com/comment/35512450
type: Comment
has text: Doesn't change anything
comment on: http://stackoverflow.com/a/23214143
score: 0
type: AnswerComment

http://stackoverflow.com/comment/35411018
type: Comment
comment on: http://stackoverflow.com/a/23151670
has text: It's not exactly what I needed but it helped me to find the answer. Thanks
score: 0
type: AnswerComment

http://stackoverflow.com/comment/35489386
type: Comment
has text: I have no reputation to do this - schema contains a lot of urls
type: QuestionComment
comment on: http://stackoverflow.com/q/23200757
score: 0

http://stackoverflow.com/a/23165365
has body: You can't access them because they are initialized within a function. You need to declare them as global variables. ArrayList&lt;Vertex&gt; vertexObjects = new ArrayList&lt;Vertex&gt;(); ArrayList&lt;Edge&gt; edgeObjects = new ArrayList&lt;Edge&gt;(); ArrayList&lt;Vertex&gt; visitedObjects = new ArrayList&lt;Vertex&gt;(); ArrayList&lt;Vertex&gt; unvisitedObjects = new ArrayList&lt;Vertex&gt;(); ArrayList&lt;Edge&gt; tempEdge = new ArrayList&lt;Edge&gt;(); int numVertices = 0; String startVertex, smallDistance, endVertex = ""; that might be the problem.
type: Answer
accepted answer of: http://stackoverflow.com/q/23165322
answers question: http://stackoverflow.com/q/23165322
type: AcceptedAnswer
score: 0

http://stackoverflow.com/a/23249410
score: 0
type: Answer
has body: It's difficult to use a non-ugly Regex. The neatest approach, with respect to coding, is to iterate through the letters and trim off the last one. String r = "TopChoice"; while (r.length() &gt; 0) { //Check for match to String r r = r.substring(0, r.length() - 1).trim(); }
answers question: http://stackoverflow.com/q/23249257

http://stackoverflow.com/q/23136506
has answer: http://stackoverflow.com/a/23142253
has title: Accessing properties set at runtime using property ${} notation in Mule flow
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35375550
type: Question
accepted answer: http://stackoverflow.com/a/23142253
has body: In a Mule flow, I have a property set in my flow as follows: &lt;set-property propertyName="certPath" value="/tmp/#[aVariable]/certificate.pem" doc:name="Property"/&gt; I'm now trying to use it inside my sftp outbound-endpoint identityFile attribute, as follows: identityFile="${certPath}" This does not work and takes in the placeholder as a string (as is.) Am I missing something in the way properties should be set and then accessed? I have also tried to add a message property in the session scope, but then when trying ${session.certPath} nothing gets evaled either.
tagged with: properties
answer count: 1
score: 0
tagged with: java
tagged with: mule
has comment: http://stackoverflow.com/comment/35375623
tagged with: mule-el
tagged with: ant

http://stackoverflow.com/a/23151629
type: Answer
has body: It could be solved in a much simpler way: String result = ""; for (int i = 0; i &lt; str.length(); i += 4) { result += str.substring(i, Math.min(str.length(), i + 2)); } return result; More: It's generally a bad idea to change counter variable inside a for loop - use while loop then. substring(int beginIndex, int endIndex) - endIndex is exclusive.
score: 2
has comment: http://stackoverflow.com/comment/35401395
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23151539
answers question: http://stackoverflow.com/q/23151539
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35401243
upvote count: 2

http://stackoverflow.com/q/23194304
has title: Idea can't rename package named like ''integer' or 'Exception'
tagged with: java
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35476598
tagged with: intellij-idea
type: Question
has body: As the topic, our project has a old package named as javaBase.Exception , we want to change the package name Excption to javaexception , when we select the package and do the 'Rename' action, the IDEA suspented in Looking for useage step. How can I solve it?
has answer: http://stackoverflow.com/a/23194489
score: 0
answer count: 1

http://stackoverflow.com/comment/35523150
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23219733
has text: its the parameter got from main class?

http://stackoverflow.com/a/23258607
type: Answer
has body: Aside from using the wrong method to compare strings, there is another serious problem: optionGet() opens a new Scanner on system.in. If the input contains an option that is not A, B, or C, then optionGet() calls itself recursively. The recursive call does another Scanner ad = new Scanner(System.in); while the first one is still open. There is no telling just what that will do, but it is likely to cause problems. Do not do that. Don't use recursion. It's inappropriate here. Instead, put the code that checks for options in a loop, and make sure new Scanner is outside the loop.
upvote count: 3
score: 3
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23258485
answers question: http://stackoverflow.com/q/23258485

http://stackoverflow.com/comment/35608960
type: Comment
comment on: http://stackoverflow.com/a/23267763
score: 0
type: AnswerComment
has text: When an error occurs somewhere else in a servlet or whatever the user is redirected to this page and the exception details are displayed.

http://stackoverflow.com/a/23203775
upvote count: 1
has body: ResultSet rs = stmt.executeQuery(...) should be replaced with int results = stmt.executeUpdate(...) executeQuery is used whenever you are executing a query (select) but executeUpdate is used whenever you are executing something that will change the DB (insert, update, delete).
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/35493500
score: 1
has comment: http://stackoverflow.com/comment/35494131
type: Answer
accepted answer of: http://stackoverflow.com/q/23203652
answers question: http://stackoverflow.com/q/23203652

http://stackoverflow.com/q/23254550
type: AnsweredQuestion
has title: What does -> means in Java
tagged with: intellij-idea
accepted answer: http://stackoverflow.com/a/23254665
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/35584791
favorite count: 0
has comment: http://stackoverflow.com/comment/35584822
has body: I am just looking to get an understanding on what the symbol '->' means. I wrote a simple method and closed that IDE session. When I returned back to continue my work, it looked as follows. When I clicked on the method, it reverted back to how I initially wrote it as follows: My Question is, is this a new syntax for Java 8.0 or did the IDE automatically did some kind of information collapse?
tagged with: android
has comment: http://stackoverflow.com/comment/35584817
score: 2
upvote count: 2
tagged with: java
has answer: http://stackoverflow.com/a/23254665
type: Question

http://stackoverflow.com/comment/35689389
comment on: http://stackoverflow.com/q/23258753
has text: Intellij can generally warn if some return values are disregarded. This could help as you would than have to assign the value locally.
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/a/23202314
has comment: http://stackoverflow.com/comment/35504076
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/35491309
answers question: http://stackoverflow.com/q/23191770
has comment: http://stackoverflow.com/comment/35491407
has comment: http://stackoverflow.com/comment/35492127
has body: Yes, in your getByFilter() method, you could write a straightforward HQL or native SQL query to find all the employees who have an age equal to the filter's age, or use Hibernate's Criteria Queries like for example: return getSession().createCriteria(Employee.class).add(Restrictions.eq("age", filter.getAge())).list(); It might be a good idea to add another parameter to your all-purpose getByFilter() method so you can specify filtering by any field (name, age, and so on), and then act accordingly.

http://stackoverflow.com/a/23223660
accepted answer of: http://stackoverflow.com/q/23220317
answers question: http://stackoverflow.com/q/23220317
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: I would suggest to use the build in JSF resource library mechanism, which supports versioning of resources. Since the clients caches will load a given resource when its' path changes. This way you can change the version number of your resoures and urge the client to reload them, without having to deal with any cache ageing strategies. There are several good write-ups about this topic here on SO What is the JSF resource library for and how should it be used? JSF resource versioning JSF2 Static resource caching
upvote count: 3
score: 3

semaphore
type: Tag
tags question: http://stackoverflow.com/q/23145895
tags question: http://stackoverflow.com/q/23255267
tag name: semaphore

http://stackoverflow.com/comment/42368279
comment on: http://stackoverflow.com/a/26888423
type: Comment
has text: @Jayesh As I said, there is a default truststore. It contains a number of CA certificates that the JRE already trusts, including one that verifies google.com. Your second question (about a refused connection) has nothing to do with keystores: if the server refuses the connection, that's it, the connection is refused... Nothing happens.
score: 5
type: AnswerComment

http://stackoverflow.com/q/23219564
has answer: http://stackoverflow.com/a/23219721
tagged with: datetime
has answer: http://stackoverflow.com/a/23219686
downvote count: 1
duplicate of: http://stackoverflow.com/q/4216745
upvote count: 0
type: UnansweredQuestion
tagged with: java
score: -1
tagged with: date
type: Question
answer count: 2
has body: I need to convert a string ( 20-04-2014) to date in the format DD-MM-YYYY of type date. String date = "20-04-2014"; I need to convert it to a type Date. How to do this??
has title: Converting a string to specific date format and of date type
favorite count: 0
linked to: http://stackoverflow.com/q/4216745

http://stackoverflow.com/a/23254972
has comment: http://stackoverflow.com/comment/72275699
type: Answer
answers question: http://stackoverflow.com/q/23144353
has body: In trustMgrFactory.init(keystore); you're configuring defaultTrustManager with your own personal keystore, not the system default keystore. Based on reading the source code for sun.security.ssl.TrustManagerFactoryImpl, it looks like trustMgrFactory.init((KeyStore) null); would do exactly what you need (load the system default keystore), and based on quick testing, it seems to work for me.
upvote count: 22
score: 19
has comment: http://stackoverflow.com/comment/55652413
has comment: http://stackoverflow.com/comment/59191867
downvote count: 3

http://stackoverflow.com/comment/35532805
score: 0
type: Comment
type: QuestionComment
has text: This sounds like an [XY problem](http://meta.stackexchange.com/questions/66377/what-is-the-xy-problem) to me, but I can't tell for sure. Consider creating and posting a [minimal example program](http://stackoverflow.com/help/mcve). My own code would add the MouseAdapter to the marker itself and not to its container, ... or to the container that holds both donating and receiving container.
comment on: http://stackoverflow.com/q/23225958

http://stackoverflow.com/a/63235882
score: 0
answers question: http://stackoverflow.com/q/23285290
type: Answer
has body: 'javac' is not recognized as an internal or external command, operable program or batch file. .........................................................................................................ERROR OUTPUT Path is an environment variable used to access the java binaries like java or javac that are used to run java programs and compile java source files. Path can be overridden by Java Settings. Path is used by operating system to find any binary or command typed in shell. Command used to set Path:- In window 10 Environment Variables enter the following set PATH=%PATH%;C:\Program Files\Java\JDK1.8.0_121\bin Error: Could not find or load main class HelloWorld ...........................................................................................ERROR OUTPUT Try this to correct the error java -cp . HelloWorld

http://stackoverflow.com/comment/35658177
type: AnswerComment
comment on: http://stackoverflow.com/a/23279685
type: Comment
has text: Correction: The new time library in Java 8 (known as JSR-310) is not in java.util-package, but in java.time-package. And it supports nanosecond precision, not just microsecond precision.
score: 1

http://stackoverflow.com/q/23239712
upvote count: 1
downvote count: 1
type: Question
duplicate of: http://stackoverflow.com/q/513832
has answer: http://stackoverflow.com/a/23239836
score: 0
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/23239836
has comment: http://stackoverflow.com/comment/35558411
has body: What am I doing wrong in here: public void processFinish(String[] result) { System.out.println(result[0]); System.out.println(result[1]); System.out.println(result[2]); if(result[0] == "true") comments.setText("Success"); else if (result[1] == "true" &amp;&amp; result[2] == "false") comments.setText("Username is already used"); else comments.setText("Phone number is already used"); } The output is: true false false Yet, it always executes the else clause !!!
has title: Compare String array elements to literals Strings
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35558242
tagged with: java

http://stackoverflow.com/comment/35575320
type: QuestionComment
comment on: http://stackoverflow.com/q/23249428
score: 0
has text: Yes Gyro, I want to unit test the method to make it return array list b. Of course, that is not possible because of the way randNum is defined any idea how ?
type: Comment

http://stackoverflow.com/q/23229660
tagged with: ftp
type: AnsweredQuestion
tagged with: ftp-client
type: Question
upvote count: 5
tagged with: java
has answer: http://stackoverflow.com/a/23260306
has title: FTP Client keeps getting denied permission to upload by Server
has comment: http://stackoverflow.com/comment/35585365
score: 5
tagged with: ftp-server
tagged with: permission-denied
answer count: 1
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/23260306
has body: I am trying to write an FTP Client and Server that will allow me to send a file from the client to the server via anonymous FTP. However, I keep getting 550 Permission Denied. I am able to do other things like download a file from the server, or get a list of the files in the directory, but whenever I try to do a download it says 550 Permission Denied. The result is the same whether I log in or use anonymous FTP. I don't see any problems with my code, but I have tried running it on different networks and computers with the same result. Is there a problem with the code that I don't see, or do I have to do something with the router/firewall? I am writing both the client and server in Java and running Windows. The libraries I am using are Apache Commons FTP Client and Apache FTP Server. Here is the client. The commented out code is for uploading and getting a list of the files in the directory. import org.apache.commons.net.ftp.*; import java.io.*; import java.net.*; public class Client { public Client() { // Do nothing } public void transferFile(String ipAddress) { // For uploading FileInputStream file = null; // For downloading // FileOutputStream file = null; try { InetAddress address = InetAddress.getByName(ipAddress); FTPClient ftpClient = new FTPClient(); ftpClient.connect(address, 5000); ftpClient.login("anonymous", ""); ftpClient.setFileType(FTP.BINARY_FILE_TYPE); ftpClient.enterLocalPassiveMode(); // For uploading file = new FileInputStream(new File("C:/SoundFiles/Send/Test1.txt")); // For downloading // file = new FileOutputStream(new File("C:/SoundFiles/Receive/Test2.txt")); // For uploading boolean success = ftpClient.storeFile("/Receive/Test2.txt", file); // For downloading // boolean success = ftpClient.retrieveFile("/Send/Test1.txt", file); // For listing the files on the server's directory /* FTPFile[] directoryFiles = ftpClient.listFiles(); System.out.println("There are " + directoryFiles.length + " files"); for(int i = 0; i &lt; directoryFiles.length;…

http://stackoverflow.com/q/23176144
score: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35445422
tagged with: positioning
has title: Smooth transition between positions for ball program java
has comment: http://stackoverflow.com/comment/35445449
has comment: http://stackoverflow.com/comment/35445389
has body: Currently I am working on a very simple java ball program. The program consists of a ball that falls from the top of the screen and bounces on the floor before coming to a rest. The program uses a method that is called 50 times a second (the rate at which the gametimer ticks) and in which refreshes the screen and places the ball at its current x and y positions which are affected by gravity and the s key. When the s key is pressed the ball's height is increased. However, in the current version of my program the ball just jumps 50 pixels when the s key is pressed. How would I make it so there is a smooth transition when the s key is pressed? The high refresh rate is kind of confusing me. Here is my current code (not including the method the refreshes and the method that draws the ball): public void keyPressed(keyEvent event) { if (event.KeyCode() == KeyEvent.VK_S) { firstball.BallLocation(); } } public void BallLocation() { currentPositionY = currentPositionY - 50 - currentGravity; } Thanks for your help!
answer count: 0
tagged with: java
type: Question

http://stackoverflow.com/a/23174005
has comment: http://stackoverflow.com/comment/35442057
has comment: http://stackoverflow.com/comment/35459807
has body: The Mule-ish way to interact with transports is via the MuleClient. Inject the MuleContext in your Java component, get the MuleClient from it and then use send or dispatch with a URI that matches the SFTP endpoint you want to interact with (like sftp://...).
has comment: http://stackoverflow.com/comment/35488107
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23157096
has comment: http://stackoverflow.com/comment/35468043
type: Answer
answers question: http://stackoverflow.com/q/23157096
has comment: http://stackoverflow.com/comment/35489159

http://stackoverflow.com/comment/35403468
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23152800
has text: I interpreted your words `returns null if no value is associated with a` as meaning, the key does not exists in map. No value is associated with a key can only happen when key is not in the HashMap.
score: 1

http://stackoverflow.com/comment/35492822
comment on: http://stackoverflow.com/a/23177551
type: AnswerComment
score: 0
has text: @peeskillet--@kleopatra put this into perspective--it's not how to run a railroad, [dis|en]abling menu items this way. The code in "Answer" "Here's what worked" below got me through the menu items; everything got enabled; **academic pursuit completed; nothing practical accomplished**. I won't bother y'all with this any further. I'll wait until some actual coding problem rears its head and stumps me in the context of developing the nuts and bolts of this program and will then post an MCVE.
type: Comment

http://stackoverflow.com/q/23161781
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/35422926
favorite count: 0
has answer: http://stackoverflow.com/a/23180119
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35419931
tagged with: clojure
score: 2
upvote count: 2
tagged with: java
type: Question
has body: I have an existing Java code base. It is organized into several projects in eclipse. These projects tend to require one another. For example: Project A -&gt; Common Lib 1 -&gt; 2nd level dependency 1 | -&gt; Common Lib 2 To utilize code from other projects I can go to "Build Path" "Projects" tab and click "Add" Is there something similar that can be done for clojure code (in eclipse), so that I can easily start using code from my existing Java projects in clojure?
tagged with: eclipse
tagged with: leiningen
tagged with: counterclockwise
has title: How to use java project in eclipse from clojure project

http://stackoverflow.com/q/23189495
duplicate of: http://stackoverflow.com/q/218384
has comment: http://stackoverflow.com/comment/35468502
has comment: http://stackoverflow.com/comment/35468481
has answer: http://stackoverflow.com/a/23189700
upvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/35468476
type: Question
linked to: http://stackoverflow.com/q/218384
tagged with: null
has body: I am new so bear with me. But I am getting a NullPointerException somewhere in here. Any ideas? Thanks! private void loadInstructors() { // get all account numbers from database try { //myResultSet = myStatement.executeQuery( "SELECT DISTINCT lastname FROM InstEval" ); myResultSet = myStatement.executeQuery( "SELECT DISTINCT TEAMNAME FROM APP.TEAMEVAL" ); // add account numbers to accountNumberJComboBox while ( myResultSet.next() ) { //instructorComboBox.addItem( myResultSet.getString( "lastname" ) ); TeamsComboBox.addItem( myResultSet.getString( "TEAMNAME" ) ); } myResultSet.close(); // close myResultSet } // end try catch ( SQLException exception ) { exception.printStackTrace(); } }
downvote count: 4
tagged with: nullpointerexception
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/35468505
has comment: http://stackoverflow.com/comment/35468515
has title: null pointer exception java
type: UnansweredQuestion
score: -4

http://stackoverflow.com/a/23170735
score: 3
accepted answer of: http://stackoverflow.com/q/23170703
type: AcceptedAnswer
downvote count: 0
has body: You cannot. This number, written out, is: 1557760000000 The max int is: 2147483648 This is clearly much smaller. You can, however, cast to a long. Its max value is 9223372036854775808 which, even at a glance, is much larger than your double. Use the following code: long iLong = (long)iD;
type: Answer
upvote count: 3
answers question: http://stackoverflow.com/q/23170703

http://stackoverflow.com/comment/35567084
type: Comment
has text: K thank u ., I got ur point . cant v do it for keyboard input.?
type: AnswerComment
comment on: http://stackoverflow.com/a/23245002
score: 0

http://stackoverflow.com/comment/35566070
type: QuestionComment
comment on: http://stackoverflow.com/q/23244306
has text: @BartlomiejLewandowski., any language I understand basics of all three
type: Comment
score: 0

http://stackoverflow.com/comment/35620807
type: Comment
type: QuestionComment
has text: If you need c = 5 to be visible to a running thread, you must place it inside the synchronized block. Otherwise there is no guarantee the other thread will ever see this value.
score: 0
comment on: http://stackoverflow.com/q/23274038

http://stackoverflow.com/comment/35435903
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23171147
has text: The video course I'm using (VirtualPairProgrammers) uses the HibernateTemplate. I had seen that it was deprecated and tried to build this project without it. But I ran into so many problems (I'm very new to this), that I decided to follow their format as closely as possible.
type: AnswerComment

http://stackoverflow.com/comment/35402817
comment on: http://stackoverflow.com/q/23152613
has text: do you have some code to show us?
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/35446742
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23177188
has text: There's actually no error, that's what I am so confused by. It just ignores the user input and prompts the user for a function again. here's the link to my full code: https://stackoverflow.com/questions/23175941/exception-in-thread-main-java-lang-nosuchmethoderror-main
score: 0

http://stackoverflow.com/comment/35647562
has text: Did you create a ContextWrapper with an overridden getResources()? Check line 128 of the code mentioned above. You might want to try and override getSystemService in your activity like 150 in my example.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23273860
type: AnswerComment

http://stackoverflow.com/q/23272628
score: 0
has body: List&lt;Lists&gt; listOfLists = db.getAllLists(); db.getAllLists() returns a List object. Am I making use of Polymorphism without knowing here?
answer count: 1
has answer: http://stackoverflow.com/a/23272653
tagged with: android
accepted answer: http://stackoverflow.com/a/23272653
type: AnsweredQuestion
tagged with: list
tagged with: java
linked to: http://stackoverflow.com/q/383947
type: Question
has title: Am I making use of Polymorphism without knowing here?
tagged with: listview

http://stackoverflow.com/q/23228417
type: UnansweredQuestion
score: 1
tagged with: java
tagged with: unityscript
has body: I want to learn android game development. I don't have any programing knowledge. So should I learn JAVA and eclipse to develop games for android. Or should I learn Unity 3d. And is knowledge of java programing is necessary to develop android games in unity? Or knowledge of Javascript/UnityScript will do. Can I develop android games in unity with just JavaScript knowledge?? what are the benefits of unity over Java/eclipse and vice versa when talking of android game dev??
type: Question
has title: do I need knowledge of java programing to develop android games in unity 3d?
tagged with: eclipse
has comment: http://stackoverflow.com/comment/35539652
has answer: http://stackoverflow.com/a/33341928
answer count: 2
upvote count: 1
has comment: http://stackoverflow.com/comment/35537600
favorite count: 0
has answer: http://stackoverflow.com/a/23228768
tagged with: unity-game-engine
tagged with: android
downvote count: 0

http://stackoverflow.com/q/23145959
has answer: http://stackoverflow.com/a/23154309
accepted answer: http://stackoverflow.com/a/23154309
favorite count: 0
tagged with: cdi
upvote count: 5
has comment: http://stackoverflow.com/comment/35444006
type: AnsweredQuestion
downvote count: 0
has comment: http://stackoverflow.com/comment/35438307
has comment: http://stackoverflow.com/comment/35439785
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/21295589
tagged with: jboss-arquillian
score: 5
tagged with: jersey
has title: Java EE CDI interceptor not working inside JAX-RS resource class
tagged with: glassfish
has body: I wanted to use a profiling interceptor inside a jax-rs resource class. The interceptor works otherwise, but it causes problems inside a jax-rs resource class. I have put the demo code on github. Here is a description of the problem. First, here is a list of the main code. Profiled @InterceptorBinding @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.METHOD, ElementType.TYPE}) public @interface Profiled { } Profiler @Interceptor @Profiled public class Profiler { @Inject Logger logger; @AroundInvoke private Object profile( InvocationContext context ) throws Exception { long startTime = System.currentTimeMillis(); try { return context.proceed(); } finally { long time = System.currentTimeMillis() - startTime; logger.info( context.getMethod() + " took " + time + " milliseconds" ); } } } UtilsProducer public class UtilsProducer { @Produces private Logger createLogger( InjectionPoint point ) { return Logger.getLogger( point.getMember().getDeclaringClass().getName() ); } @Produces private Client createClient() { return ClientBuilder.newClient(); } } Foobar public class Foobar { public static final int SLEEP_TIME = 1000; // in milliseconds @Inject Logger logger; public String hello() { return "hello"; } @Profiled public long profiledCall() throws Exception { long startTime = System.currentTimeMillis(); Thread.sleep( SLEEP_TIME ); return System.currentTimeMillis() - startTime; } } RestFoobar @Path("/") public class RestFoobar { public static final int SLEEP_TIME = 1000; @Inject private Logger logger; @Inject private Foobar foobar; @Context private UriInfo context; @Path("hello") @GET public String hello() { logger.info("Request from " + context.getRequestUri() ); return "hello"; } @Path("profile") @GET @Profiled public long profile() throws Exception { logger.info("Request from " + context.getRequestUri() ); long startTime = System.currentTimeMillis(); Thread.sleep( SLEEP_TIME ); return System.currentTimeMillis() - startTime ; } } FoobarTest public class FoobarTest ex…
answer count: 1

http://stackoverflow.com/q/23141252
tagged with: simpleadapter
possible better answer: http://stackoverflow.com/a/23141310
type: Question
tagged with: nullpointerexception
has answer: http://stackoverflow.com/a/23141310
has body: Null Pointer Exception in line: listView.setAdapter(sAdapter); public class MyEmployeFragment extends Fragment { MyTask task; String employer_id; String employer_name; String str=null; // имена атрибутов для Map final String ATTRIBUTE_ID = "p_id"; final String ATTRIBUTE_NAME = "p_name"; ListView listView; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { //myPrefs = this.getActivity().getSharedPreferences("MYsettings", Context.MODE_PRIVATE); task = new MyTask(); task.execute(); // Creating view correspoding to the fragment View v = inflater.inflate(R.layout.my_employe, container, false); // Updating the action bar title getActivity().getActionBar(); String[] userId = {"1","2","3"}; String[] userName = {"Nadezhd","Vasya", "hardcore"}; ArrayList&lt;Map&lt;String, Object&gt;&gt; data = new ArrayList&lt;Map&lt;String, Object&gt;&gt;( userId.length); Map&lt;String, Object&gt; m; for (int i = 0; i &lt; userId.length; i++) { m = new HashMap&lt;String, Object&gt;(); m.put(ATTRIBUTE_ID, userId[i]); m.put(ATTRIBUTE_NAME, userName[i]); data.add(m); } // массив имен атрибутов, из которых будут читаться данные String[] from = {ATTRIBUTE_ID, ATTRIBUTE_NAME}; // массив ID View-компонентов, в которые будут вставлять данные int[] to = {R.id.tw_employe_id, R.id.tw_employe_name}; // создаем адаптер SimpleAdapter sAdapter = new SimpleAdapter(getActivity(), data, R.layout.list_item_employee, from, to); // определяем список и присваиваем ему адаптер listView = (ListView) getActivity().findViewById(R.id.lv_employee_list); // ListView listView = (ListView) getView(); listView.setAdapter(sAdapter); return v; } class MyTask extends AsyncTask&lt;Void, Void, Void&gt; { @Override protected void onPreExecute() { super.onPreExecute(); } @Override protected Void doInBackground(Void... params) { String s = "5ACACEC6-752B-4EFF-AA50-EEBE58A52113"; // String user_guid = myPrefs.getString("guid", ""); HttpActivity _http = new HttpActivity("192…
tagged with: android
accepted answer: http://stackoverflow.com/a/23141351
score: 0
answer count: 2
has title: SimpleAdapter dont work
tagged with: java
has comment: http://stackoverflow.com/comment/35383482
has answer: http://stackoverflow.com/a/23141351
tagged with: listview
has comment: http://stackoverflow.com/comment/35383442
type: AnsweredQuestion

http://stackoverflow.com/a/23263072
score: 0
has comment: http://stackoverflow.com/comment/35693212
has comment: http://stackoverflow.com/comment/35696569
type: Answer
has body: Just save the part of the HTML file between the &lt;svg&gt; tags (including the &lt;svg&gt;). Give it a .svg extension. You should then be able to open it in a browser, or pass it to Batik, ImageMagick or some other converter.
has comment: http://stackoverflow.com/comment/35638772
has comment: http://stackoverflow.com/comment/35630074
answers question: http://stackoverflow.com/q/23251156
has comment: http://stackoverflow.com/comment/35692485

http://stackoverflow.com/comment/35604232
score: 0
comment on: http://stackoverflow.com/a/23263864
type: AnswerComment
type: Comment
has text: In my question I have character like (\r\n*KW\0) I need to take individual separate or full car array

http://stackoverflow.com/a/38095505
score: 5
downvote count: 0
type: Answer
has body: csv2libsvm.py does not work with Python3, and also it does not support label targets (string targets), I have slightly modified it. Now It should work with Python3 as well as wıth the label targets. I am very new to Python, so my code may do not follow the best practices, but I hope it is good enough to help someone. #!/usr/bin/env python """ Convert CSV file to libsvm format. Works only with numeric variables. Put -1 as label index (argv[3]) if there are no labels in your file. Expecting no headers. If present, headers can be skipped with argv[4] == 1. """ import sys import csv import operator from collections import defaultdict def construct_line(label, line, labels_dict): new_line = [] if label.isnumeric(): if float(label) == 0.0: label = "0" else: if label in labels_dict: new_line.append(labels_dict.get(label)) else: label_id = str(len(labels_dict)) labels_dict[label] = label_id new_line.append(label_id) for i, item in enumerate(line): if item == '' or float(item) == 0.0: continue elif item=='NaN': item="0.0" new_item = "%s:%s" % (i + 1, item) new_line.append(new_item) new_line = " ".join(new_line) new_line += "\n" return new_line # --- input_file = sys.argv[1] try: output_file = sys.argv[2] except IndexError: output_file = input_file+".out" try: label_index = int( sys.argv[3] ) except IndexError: label_index = 0 try: skip_headers = sys.argv[4] except IndexError: skip_headers = 0 i = open(input_file, 'rt') o = open(output_file, 'wb') reader = csv.reader(i) if skip_headers: headers = reader.__next__() labels_dict = {} for line in reader: if label_index == -1: label = '1' else: label = line.pop(label_index) new_line = construct_line(label, line, labels_dict) o.write(new_line.encode('utf-8'))
upvote count: 5
answers question: http://stackoverflow.com/q/23170152

http://stackoverflow.com/comment/35646390
type: QuestionComment
score: 0
has text: If you post sample images, you might even get the code for it...
type: Comment
comment on: http://stackoverflow.com/q/23281582

http://stackoverflow.com/comment/35861731
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23141104
type: AnswerComment
has text: Sounds like an unrelated issue, probably something not imported

http://stackoverflow.com/comment/35481609
has text: *"once I removed it they showed up fine"* You are seeing random behavior. It might work on two PCs but fail on a third. There are so many (other) problems with that code it is difficult to know where to begin. But post an MCVE if you would like to fix them. I've gone as far as I am willing with uncompilable code snippets.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23177390
score: 0

http://stackoverflow.com/a/23143372
upvote count: 1
has comment: http://stackoverflow.com/comment/35387360
score: 1
downvote count: 0
has body: For an if statement to compile, the condition between parenthesis, has to be a boolean. So, if you can put the method foo as the condition of an if, it's because it returns a boolean. Therefore, you could write: return foo(); In your particular case, the expression !(row &gt; 0 &amp;&amp; row &lt; 4 &amp;&amp; col &gt; 0 &amp;&amp; col &lt; 4) evaluates to true or false, Therefore you could write: return !(row &gt; 0 &amp;&amp; row &lt; 4 &amp;&amp; col &gt; 0 &amp;&amp; col &lt; 4);
answers question: http://stackoverflow.com/q/23143344
has comment: http://stackoverflow.com/comment/35387381
type: Answer
has comment: http://stackoverflow.com/comment/35387336

http://stackoverflow.com/comment/35479915
score: 0
type: Comment
has text: In which language have you created the webservice??? Is it in your local server???
comment on: http://stackoverflow.com/a/23196121
type: AnswerComment

http://stackoverflow.com/q/23271598
upvote count: 4
type: AnsweredQuestion
downvote count: 0
tagged with: java
type: Question
possible better answer: http://stackoverflow.com/a/23271830
has comment: http://stackoverflow.com/comment/35615633
has answer: http://stackoverflow.com/a/23271684
tagged with: arrays
score: 4
has comment: http://stackoverflow.com/comment/35615624
has answer: http://stackoverflow.com/a/23272510
has comment: http://stackoverflow.com/comment/35615663
has answer: http://stackoverflow.com/a/23271771
has title: Avoiding duplicates without Sets?
favorite count: 0
has answer: http://stackoverflow.com/a/23272165
has body: I am in a beginner Java class and I haven't gotten the chance to learn how to avoid duplicated values when storing values inside arrays. String[] newAlphabet = new String[26]; for(int I = 0; I &lt; newAlphabet.length; I++){ int random = (65 + (int)(Math.random() * ((90 - 65) + 1)); char ascii = (char)random; String letters = ascii + ""; if(letters != newAlphabet[0] &amp;&amp; letters != newAlphabet[1] ... so on and so on until newAlphabet[25]) newAlphabet[I] = letters; }//end So this is my pseudo code for part of my program and the point of it is to avoid having duplicated letters inside the array. The problem that I am having is inside the if statement. Instead of typing letters != newAlphabet[] to 25, is there another way of doing it? I have seen some of the forums in stackedoverflow that I should use HashSet but I have not learned that? I can ask my teacher if I am allowed but is there another way to avoid this problem? I have been thinking of using for-each loop to search through all the elements in the array but I haven't thought out the plan long enough if it's valid.
accepted answer: http://stackoverflow.com/a/23272165
has comment: http://stackoverflow.com/comment/35615723
has answer: http://stackoverflow.com/a/23271830
answer count: 5

http://stackoverflow.com/a/23183555
score: 1
accepted answer of: http://stackoverflow.com/q/23183543
has body: "will Color be able to access its value after the method ends??" Short answer: Yes, otherwise why would you define a variable as global.(No matter it's a reference or primitive) Please run this code to see what happens: public class Test { int[] Color = new int[2]; int i = 20; public static void main(String[] args) { Test t = new Test(); t.ChangeColor(new int[] {1,2,3}); System.out.println(Arrays.toString(t.Color)); System.out.print(t.i); } public void ChangeColor(int[] value) { Color = value; i = 10; } }
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/23183543
upvote count: 1

http://stackoverflow.com/q/23150695
has comment: http://stackoverflow.com/comment/35423268
upvote count: 1
has body: I am using a java NIO based which accept connections from clients(configured non blocking) and only reads data sent by clients. Clients once connected will stick to server for a long time, so i used a single thread for "selector.select" and "Accept", but the clients connected will send messages every 15 sec and number of clients are 5000, each message is of size 150 Bytes. Instead of creating a new thread for each read from clients i decided to have a thread pool of 100 threads, but server is not able to read data from all clients it simply hangs. When a new thread is created each time it is able to read data from all clients. Here is my ReadEvent thread class ReadEvent implements Runnable { private static Logger logger = Logger.getLogger(ReadEvent.class.getName()); private SelectionKey key; /** * Constructor to initialize the thread with the key having read event * pending. * * @param key * SelectionKey having read event. **/ public ReadEvent(SelectionKey key) { this.key = key; } /** * Method to read the data from the key. **/ @Override public void run() { SocketChannel socketChannel = (SocketChannel) key.channel(); synchronized (socketChannel) { if (socketChannel.isOpen()) { try { ByteBuffer readBuffer = ByteBuffer.allocate(150); int numRead = 0; try { /* ".read" is nonblocking */ numRead = socketChannel.read(readBuffer); /* * Some other IO error on reading socketChannel. */ } catch (IOException e) { logger.debug( "[run] Connection abruptly terminated from client", e); key.channel().close(); return; } if (numRead == -1) {// socket closed cleanly key.channel().close(); return; } String data = null; data = new String(readBuffer.array(), Charset.forName("ASCII")); /* Send the read data to the DataDispatcher Actor */ Main.getDataDispatcher().tell(data, ActorRef.noSender()); } catch (IOException e) { logger.debug("[run] ", e); return; } } else {// socketChannel is closed try { key.channel().close();// Sanitary close operation return; } catch (IOException e) { } } } } }…
has comment: http://stackoverflow.com/comment/35425383
has title: NIO thread pool per event
tagged with: java
has comment: http://stackoverflow.com/comment/35446427
type: Question
has comment: http://stackoverflow.com/comment/35435630
tagged with: threadpool
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/35428428
tagged with: nio
has comment: http://stackoverflow.com/comment/35428203
has answer: http://stackoverflow.com/a/65050321
has comment: http://stackoverflow.com/comment/35401076
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/35401007
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/49900393

http://stackoverflow.com/q/23163964
tagged with: spring-el
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23172927
tagged with: spring
type: Question
tagged with: java
has body: I want to concatenate a string dynamically in springs.The string is <entry key="bean:name=HealthChk" value-ref="#{'HealthChk-'.concat(_LOCALHOST_)}"/> I am passing _LOCALHOST_ value from script which should replace this with the IPAddress.Can anyone help me out how the concat can be done?value-ref="#{'HealthChk-'.concat(_LOCALHOST_)} needs to be corrected. Thanks
has title: Regarding dynamic Value Replacement in Spring config
answer count: 1
score: 0

http://stackoverflow.com/comment/35465769
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23188051
has text: Thank you for your answer. Sadly it still does not work. It still crashes and I keep getting null pointer exception. My countdown timer works fine its just getting the Timer value and using it in my main game screen which is seeming to be impossible.
type: AnswerComment

http://stackoverflow.com/comment/35609662
score: 0
type: Comment
type: QuestionComment
has text: are you playing from sdcard or from web link ?
comment on: http://stackoverflow.com/q/23268430

http://stackoverflow.com/q/23192782
tagged with: java
type: Question
upvote count: 2
tagged with: jasper-reports
has body: I have two JRXML File with two different data source. in first jasper report data source is JRXmlDataSource and in second jasper report data source is JRResultSetDataSource try { conn= objConnector.getConnection(); conn.setAutoCommit(false); PreparedStatement ps = conn.prepareCall("{ call Sp_DEMO(?) }"); ps.setString(1,condition); ResultSet rs = ps.executeQuery(); JasperReport jreport1 = JasperCompileManager.compileReport("d:\\JRXML\\ECGImage.jrxml"); JasperPrint jprint1 = JasperFillManager.fillReport(jreport1, new HashMap(), new JRResultSetDataSource(rs)); jprintlist.add(jprint1); JasperReport jasperReport = JasperCompileManager.compileReport("d:\\JRXML\\RadiologyReport.jrxml"); JRXmlDataSource xmlDataSource = new JRXmlDataSource("d:\\abc.xml"+, "/X-RayReport/Type"); JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, new HashMap(),xmlDataSource); jprintlist.add(jasperPrint); File file = new File("d:\\demo.pdf"); if(file.exists()) { file.delete(); } JRExporter exporter = new JRPdfExporter(); exporter.setParameter(JRPdfExporterParameter.JASPER_PRINT_LIST, jprintlist); OutputStream output = new FileOutputStream(new File("d:\\demo.pdf")); exporter.setParameter(JRPdfExporterParameter.OUTPUT_STREAM, output); exporter.exportReport(); } catch(Exception e) { e.printStackTrace(); } i want to create single pdf file as output from both jrxml file.
has answer: http://stackoverflow.com/a/23193344
answer count: 3
linked to: http://stackoverflow.com/q/2310188
favorite count: 0
has answer: http://stackoverflow.com/a/23193071
has answer: http://stackoverflow.com/a/71855176
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/42426311
score: 2
downvote count: 0
has title: How to merge two jrxml jasper reports into a one single pdf output file

http://stackoverflow.com/comment/35513573
score: 0
type: AnswerComment
has text: I am getting errors with the above mentioned code. Here is a [screenshot](http://i.imgur.com/Fx6le8I.png)
type: Comment
comment on: http://stackoverflow.com/a/23212468

http://stackoverflow.com/q/23232774
answer count: 2
upvote count: 1
tagged with: jpa
favorite count: 0
accepted answer: http://stackoverflow.com/a/23234218
has title: JPA - How to call method for web service after commit
has answer: http://stackoverflow.com/a/63371391
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23234218
downvote count: 0
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/63371391
type: Question
has body: Sorry for something that is probably very simple, but I'm new to JPA and I'm not sure where to insert a function call for a method that needs to be called after a new record is committed to a database. I have the following: @POST @Override @Consumes({"application/xml", "application/json"}) @Path("...") @RolesAllowed("...") public void create(LearningActivity entity){ super.create(entity); } I need to call a custom method myMethod() after the above process is completed. I thought I could add it immediately after super.create(entity) but apparently the commit process isn't completed until the whole create() method executes. I've also tried adding @PostPersist to the underlying entity but that's still before the record is committed. Any help would be appreciated.

http://stackoverflow.com/comment/35411163
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/23156828
type: Comment
has text: @user3547063, see edit. Without a Proper `SSCCE`, I can't offer any more help.

inputstream
tags question: http://stackoverflow.com/q/23161934
tags question: http://stackoverflow.com/q/23161119
tag name: inputstream
tags question: http://stackoverflow.com/q/23171680
type: Tag

http://stackoverflow.com/comment/35439718
type: Comment
has text: Thank's ! I had try to use TreeMap, but without sucess.. with your logic it should work now :)
type: AnswerComment
comment on: http://stackoverflow.com/a/23173041
score: 0

http://stackoverflow.com/q/23281801
answer count: 2
downvote count: 4
has answer: http://stackoverflow.com/a/23282146
has title: Java Error java.lang.NullPointerException 2
upvote count: 0
has comment: http://stackoverflow.com/comment/35635842
duplicate of: http://stackoverflow.com/q/218384
favorite count: 0
has comment: http://stackoverflow.com/comment/35636754
has answer: http://stackoverflow.com/a/23282306
type: UnansweredQuestion
score: -4
linked to: http://stackoverflow.com/q/218384
has body: public FileWindow(JMenuItem menuItem,final JTextArea text, JMenuItem save){ //Open menuItem.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent event){ openFile(); if(fileToOpen == JFileChooser.APPROVE_OPTION){ text.setText(""); try{ Scanner scan = new Scanner(new FileReader(Open.getSelectedFile().getPath())); while(scan.hasNext()){ text.append(scan.nextLine() + "\n"); } }catch(Exception e){ System.out.println(e.getMessage()); } } } }); //Save save.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent event){ saveFile(); if(fileToSave == JFileChooser.APPROVE_OPTION){ try{ BufferedWriter out = new BufferedWriter(new FileWriter(Save.getSelectedFile().getPath() + ".txt")); out.write(text.getText()); out.flush(); out.close(); }catch(Exception e){ System.out.println(e.getMessage()); } } } }); } I'm getting an error on this line --> "menuItem.addActionListener(new ActionListener){" I tried initiating the variables but that didn't work. Any help would be very appreciated!
tagged with: java
type: Question

http://stackoverflow.com/a/23269576
upvote count: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23269333
accepted answer of: http://stackoverflow.com/q/23269333
type: Answer
downvote count: 0
score: 1
has body: Are you confused about the unboxing conversion? From type Integer to type int From type Double to type double If r is a reference of type Integer, then unboxing conversion converts r into r.intValue() If r is a reference of type Double, then unboxing conversion converts r into r.doubleValue() And compound assignment operators? A compound assignment expression of the form E1 op= E2 is equivalent to E1 = (T) ((E1) op (E2)), where T is the type of E1, except that E1 is evaluated only once. So this c += a; becomes c = (int) (c + a); in which case we have addition and the operands are promoted. If any operand is of a reference type, it is subjected to unboxing conversion (§5.1.8). If either operand is of type double, the other is converted to double. So a becomes a.doubleValue(); The whole expression becomes c = (int) ((double) c + a.doubleValue() Now, this wouldn't work if c was an Integer because the expression would be c = (Integer) (c + b); in which case c + b is addition and the same promotion rules as before apply. c = (Integer) ((double) c.intValue() + a.doubleValue()); but the double value result of the addition cannot be cast to an Integer, so it fails. Basically, don't use the compound assignment operator with wrapper (boxed) types.

http://stackoverflow.com/q/23268298
tagged with: jena
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/23270901
score: 2
tagged with: http://stackoverflow.com/tag/rdf
downvote count: 0
type: UnansweredQuestion
tagged with: jena-rules
tagged with: java
tagged with: eclipse
has body: I have written a custom builtin to use in my Project but I do not really know how I can use it. I have written two classes. In one of them there is the builtin I have made (using BaseBuiltin) and in the other one I have registered the new builtin (using BuiltinRegistry). I have already tried to use default builtins, writing rules that use them in a text file readable from Eclipse using Java. In this case I do not have any problems. How can I use the builtin I have built? Should I import (or include) something in some files?
type: Question
upvote count: 2
has title: Once I've written a builtin, what do I need to do to make the reasoners aware of it?

exception
tags question: http://stackoverflow.com/q/23177720
tags question: http://stackoverflow.com/q/23184964
tags question: http://stackoverflow.com/q/23177003
tags question: http://stackoverflow.com/q/23249009
tags question: http://stackoverflow.com/q/23169438
tags question: http://stackoverflow.com/q/23178724
tags question: http://stackoverflow.com/q/23149305
tags question: http://stackoverflow.com/q/23151013
tags question: http://stackoverflow.com/q/23162916
tags question: http://stackoverflow.com/q/23200998
tags question: http://stackoverflow.com/q/23184787
tags question: http://stackoverflow.com/q/23238630
tags question: http://stackoverflow.com/q/23208154
tags question: http://stackoverflow.com/q/23170163
tags question: http://stackoverflow.com/q/23203542
tags question: http://stackoverflow.com/q/23130930
tags question: http://stackoverflow.com/q/23271582
tags question: http://stackoverflow.com/q/23151283
tags question: http://stackoverflow.com/q/23273821
tags question: http://stackoverflow.com/q/23215988
tags question: http://stackoverflow.com/q/23285907
type: Tag
tags question: http://stackoverflow.com/q/23175316
tags question: http://stackoverflow.com/q/23150719
tags question: http://stackoverflow.com/q/23234241
tags question: http://stackoverflow.com/q/23277062
tags question: http://stackoverflow.com/q/23236879
tags question: http://stackoverflow.com/q/23280359
tags question: http://stackoverflow.com/q/23160530
tags question: http://stackoverflow.com/q/23178952
tags question: http://stackoverflow.com/q/23250815
tags question: http://stackoverflow.com/q/23214454
tags question: http://stackoverflow.com/q/23195668
tags question: http://stackoverflow.com/q/23198269
tags question: http://stackoverflow.com/q/23230025
tags question: http://stackoverflow.com/q/23222111
tag name: exception
tags question: http://stackoverflow.com/q/23231215
tags question: http://stackoverflow.com/q/23283853
tags question: http://stackoverflow.com/q/23193054
tags question: http://stackoverflow.com/q/23277646
tags question: http://stackoverflow.com/q/23270513
tags question: http://stackoverflow.com/q/23145961
tags question: http://stackoverflow.com/q/23250954
tags question: http://stackoverflow.com/q/23188205
tags question: http://stackoverflow.com/q/23254253

http://stackoverflow.com/q/23222035
type: Question
has body: I'm trying enable query cache in our application. As per the documentation I have given hibernate.cache.use_query_cache as true and givent setCacheable() in my queries. But I'm getting below exception. org.hibernate.cache.NoCacheRegionFactoryAvailableException: Second-level cache is used in the application, but property hibernate.cache.region.factory_class is not given, please either disable second level cache or set correct region factory class name to property hibernate.cache.region.factory_class (and make sure the second level cache provider, hibernate-infinispan, for example, is available in the classpath). Should I specify cache region for query cache, I'm using Hibernate 4. Please help me in this regard
tagged with: caching
score: 0
has answer: http://stackoverflow.com/a/23244498
has comment: http://stackoverflow.com/comment/35525713
answer count: 1
has title: Configure Query Cache in Hibernate4
tagged with: spring
accepted answer: http://stackoverflow.com/a/23244498
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/19303348
tagged with: java
tagged with: hibernate

http://stackoverflow.com/comment/35536969
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23227881
has text: Maybe i could some how generate the sequence table name myself?

http://stackoverflow.com/comment/35485768
type: QuestionComment
has text: Try to return the geostartpoint from the doinbackground method, and get it from the parameters of your onpostexecute method
comment on: http://stackoverflow.com/q/23181149
score: 0
type: Comment

http://stackoverflow.com/comment/35478165
score: 0
type: Comment
has text: when adding l.add(fname); cannot find symbol error
comment on: http://stackoverflow.com/a/23195450
type: AnswerComment

http://stackoverflow.com/a/23147997
has body: Static (methods,variables,classes, etc) belongs to Class not to the particular instance of the class. We define as static when the behaviour or state does not depend on any particular instance of the class. For Example "generate a Random Number " it does not depend on the instance, it always generate a number regardless of instance such behaviour can be defined as static. Regarding the error, posting you code will helpful to give better solution. Refer the below link to know more about Static and non-static http://javarevisited.blogspot.in/2012/02/why-non-static-variable-cannot-be.html
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23147013

http://stackoverflow.com/comment/132707066
type: Comment
score: 1
has text: I agree, it's ambiguous. Should the cursor be at the front or end. Maybe the method name should indicate that.
type: AnswerComment
comment on: http://stackoverflow.com/a/42170003

http://stackoverflow.com/a/23294813
score: 0
type: Answer
has body: I found the solution!! I'm using spring-boot within my application with the aim of executing it with the command java -jar <generated_file_name>. Which means my jar needs to be spring-bootable I missed the following plugin in my pom.xml --> spring-boot-maven-plugin which I added as : org.springframework.boot spring-boot-maven-plugin 1.0.1.RELEASE repackage ${start.class} ${start.class} After adding this, it worked like a charm!!
answers question: http://stackoverflow.com/q/23222663
accepted answer of: http://stackoverflow.com/q/23222663
type: AcceptedAnswer

http://stackoverflow.com/comment/35587119
type: Comment
comment on: http://stackoverflow.com/q/23255783
score: 0
type: QuestionComment
has text: How is y already 3 at that point? It's `-2147483647`

http://stackoverflow.com/q/23222257
has answer: http://stackoverflow.com/a/25303049
tagged with: intellij-idea
upvote count: 10
type: AnsweredQuestion
has title: intellij shortcut - how to fold all javadocs + method implementations
downvote count: 0
accepted answer: http://stackoverflow.com/a/25303049
favorite count: 0
has comment: http://stackoverflow.com/comment/101232748
type: Question
has answer: http://stackoverflow.com/a/46451746
score: 10
tagged with: folding
possible better answer: http://stackoverflow.com/a/46451746
tagged with: java
answer count: 2
has body: I can't find some IntelliJ IDEA shortcuts. When I go to a class, I want to be able to see only the method signature without additional details. Here is what I mean. Before: And after: Is there a shortcut for this?

http://stackoverflow.com/comment/35565810
type: QuestionComment
comment on: http://stackoverflow.com/q/23243941
score: 5
has text: File-->New--->Other--->Java Project From Existing Build File
type: Comment

http://stackoverflow.com/q/23284114
favorite count: 0
upvote count: 2
type: UnansweredQuestion
has body: I'm having a distributed application with different modules running on different tomcats ports. For example login service (CAS) is running on 8080 tomcat port, Reporting service of application is running on another tomcat say 8081 port. Main application is itself running in side different tomcat say port 8083 and I have single domain for the application i.e. www.example.com.com. I am really wondering how will I manage this using nginix and if user is getting logged in to application and tries to access module on other sever how will session be preserved. In short how can I configure nginix for a distributed application i.e. application distributed over several servers. below is the content on nginix file. server { listen 80; server_name mysite.com; charset utf-8; rewrite ^(.*) https://$server_name$1 permanent; } server { listen 443; ssl on; ssl_certificate /etc/nginx/server.crt; ssl_certificate_key /etc/nginx/server.key; server_name mysite.com; error_log /var/log/nginx/mysite-qa-error.log; charset utf-8; location ~ ^/cas/(.*)$ { proxy_pass http://localhost:140; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; } mysite application is running on 9001 tomcat port. how will i redirect nginix to application from cas
has comment: http://stackoverflow.com/comment/35661215
has comment: http://stackoverflow.com/comment/36243202
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/35640107
type: Question
has comment: http://stackoverflow.com/comment/35651102
has comment: http://stackoverflow.com/comment/35639909
tagged with: nginx
downvote count: 0
has comment: http://stackoverflow.com/comment/35728646
tagged with: tomcat
has comment: http://stackoverflow.com/comment/35639825
has comment: http://stackoverflow.com/comment/35639839
score: 2
tagged with: cas
has title: nginix setup for cas and distributed application

http://stackoverflow.com/comment/35589479
type: QuestionComment
has text: Sorry about the number of questions. It's my first post here.
comment on: http://stackoverflow.com/q/23256949
score: 0
type: Comment

http://stackoverflow.com/comment/35634290
has text: Is IoUtils part of some library or is it something android specific?
score: 0
comment on: http://stackoverflow.com/q/23280896
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35581526
score: 2
has text: Create your own class that uses a byte array.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23252933

http://stackoverflow.com/a/23272194
type: Answer
accepted answer of: http://stackoverflow.com/q/23271699
upvote count: 17
score: 17
has body: Your top level node represents an array, not an object. You need to go one level deeper before you can add the property. You could use something like this: JsonNode elem0 = ((ArrayNode) jsonNode).get(0); ((ObjectNode) elem0).put("label", "2007"); Of course you may want to add some error handling if the structure does not look like you expect.
answers question: http://stackoverflow.com/q/23271699
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/23145024
score: 0
tagged with: android
has comment: http://stackoverflow.com/comment/35405577
has body: I need to show AlertDialog#1 with custom layout R.layout.add_new_entry with button mybtn and this button should open another AlertDialog#2 with single choice list and after choosing one of them this dialog (AlertDialog#2) should send index of shoosen into first dialog (AlertDialog#1) and set some values into EditText field in AlerDialog#1. Is it possible to make? My dialog#1 with custom layout: AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); LayoutInflater inflater = getActivity().getLayoutInflater(); builder.setView(inflater.inflate(R.layout.add_new_entry, null)) .setTitle(dialogTitle) .setPositiveButton("Add", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int id) { // My functions... } }) .setNegativeButton("Cancel", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { // My functions... } }); builder.create().show(); I'v spent all night on it and i can't find any good examples or articles how to open dialog inside dialog. Thanks
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35405383
tagged with: android-alertdialog
answer count: 0
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/16071500
has title: Alertdialog inside AlerDialog
has comment: http://stackoverflow.com/comment/35390520

http://stackoverflow.com/q/23171524
tagged with: shortest-path
answer count: 2
tagged with: algorithm
tagged with: path-finding
linked to: http://stackoverflow.com/q/19436859
possible better answer: http://stackoverflow.com/a/23171668
upvote count: 1
favorite count: 0
has body: I have implemented the A star algorithm to find a route between two nodes on a simple grid. I'm currently testing on a grid with no obstacles, and it seems to be finding a shortest path, but it isn't an 'ideal' shortest path, by that I mean one that doesn't keep randomly changing directions. Ideally I'd like it to keep going in one direction, meaning it only changes direction once. How can I enforce this? I'm looking at the part of the code where I consider which node to expand in the open list, and I might be able to hack something in by keeping a note of the previous direction and choosing the same direction if the next tile has the same f value, but it isn't very elegant.
has answer: http://stackoverflow.com/a/23171668
type: AnsweredQuestion
has title: a star algorithm not taking the visually ideal route
duplicate of: http://stackoverflow.com/q/19436859
downvote count: 0
tagged with: a-star
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/23171756
accepted answer: http://stackoverflow.com/a/23171756
type: Question

http://stackoverflow.com/a/23260969
downvote count: 0
type: Answer
score: 1
answers question: http://stackoverflow.com/q/23248963
upvote count: 1
has body: Spring MVC has a lot of features in that regard so it might be easier to look elsewhere as a starting point. The new messaging abstraction that was introduced in Spring 4 has similar features. Look at @MessageMapping which allows you to build a flexible signature against a Message instance. You could for instance inject a header of the message public void foo(@Header("myHeader") int myHeader) Or you could validate that the payload against a Validator public void bar(@Payload @Validated Order order) The core of the infrastructure is located in InvocableHandlerMethod which is going to invoke a java.lang.reflect.Method you have provided on a given bean instance based on an incoming Message and additional parameters you may provide (see public final Object invoke(Message&lt;?&gt; message, Object... providedArgs) To create that instance, you need to provide a set of HandlerMethodArgumentResolver. Each HandlerMethodArgumentResolver is responsible to handle a method parameter. In short, that's basically going to provide you a MethodParameter instance (i.e. a reference to a parameter of the method you want to handle, such as the annotated order in the last example) and you're going to tell if you support it or not and when you do, handle that parameter so that the right value is injected. For the header example, the implementation looks for a header with the name on the annotation. Simple! A set of default resolvers are created for example in SimpAnnotationMethodMessageHandler (look at initArgumentResolvers). That's going to show you the kind of parameters you can inject there by default. By extending that list (or providing custom instances) you can augment what the user can use in the method signature. In Spring 4.1, we rely on this infrastructure to provide JMS listener annotated endpoints and those endpoints may have a flexible signature as well. It's actually already implemented so you may want to have a look to that for yet another example.

http://stackoverflow.com/comment/35677272
type: AnswerComment
has text: You are right! With deciders I was able to solve this issue in a clean way. Thank you!
type: Comment
score: 0
comment on: http://stackoverflow.com/a/23261346

http://stackoverflow.com/comment/35622479
has text: I think I will have to... I supposed there is some standard solution when asking my question
type: Comment
comment on: http://stackoverflow.com/a/23274957
score: 0
type: AnswerComment

http://stackoverflow.com/comment/35386133
has text: It's probably because filter-mapping's *.jsf gets precedence over servlet-mapping's *.jsf. Too bad there is no <absolute-ordering> in servlet 2.5
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23141776
type: QuestionComment

http://stackoverflow.com/a/23264619
upvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/23264480
downvote count: 1
has body: yes it is fine. as it has nothing to do with the final keyword of the Instance variable. what you are doing is passing the enclosing class' object to the constructor of SomeClass
score: -1

http://stackoverflow.com/a/23264977
has body: If the resultSet size is very huge you can do it in batches by setting max limits query.setMaxResults(int maxResults)
type: Answer
answers question: http://stackoverflow.com/q/23264869
downvote count: 2
score: -2
has comment: http://stackoverflow.com/comment/35603507
upvote count: 0

http://stackoverflow.com/comment/35503480
has text: possible duplicate of [Export wizard application in netbeans](http://stackoverflow.com/questions/23122292/export-wizard-application-in-netbeans)
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23208604
score: 0

http://stackoverflow.com/comment/39463808
type: QuestionComment
has text: Please check http://stackoverflow.com/questions/25307297/using-a-trust-association-interceptor-tai-to-obtain-a-ltpa2-token
comment on: http://stackoverflow.com/q/23132125
score: 0
type: Comment

http://stackoverflow.com/q/23160471
has comment: http://stackoverflow.com/comment/35424990
has answer: http://stackoverflow.com/a/23237707
answer count: 1
favorite count: 0
type: UnansweredQuestion
tagged with: io
score: -3
has comment: http://stackoverflow.com/comment/35417042
has comment: http://stackoverflow.com/comment/35417189
tagged with: java
downvote count: 3
has title: How to read a file?
has body: private void getInput() throws IOException { InputStream resourceAsStream = this.getClass().getResourceAsStream( "aaa.txt"); BufferedReader br = new BufferedReader(new FileReader( resourceAsStream.toString())); try { StringBuilder sb = new StringBuilder(); String line = br.readLine(); while (line != null) { sb.append(line); sb.append(System.lineSeparator()); line = br.readLine(); } String everything = sb.toString(); System.out.println(everything); } finally { br.close(); } } The file aaa.txt is in the same project and it cannot be read, I have java.lang.NullPointerException when I execute that.
type: Question
upvote count: 0
linked to: http://stackoverflow.com/q/309424

http://stackoverflow.com/comment/38107038
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24533519
has text: You're right. What I meant was that I made a new list as a copy of the original list each time I iterated through it to be sure the list I iterated through wasn't changed (objects removed) by other threads during iteration. What I meant with objects disappearing was rather that established websocket sessions could be go down since anyone could just quit or the connection be broken. So just as you said, that needs to be handled somehow. So you're 100% right in your comment and answer, I was just sloppy and didn't think enough about the wording in my comment. :)

web
tags question: http://stackoverflow.com/q/23214105
tags question: http://stackoverflow.com/q/23200096
type: Tag
tags question: http://stackoverflow.com/q/23199885
tag name: web
tags question: http://stackoverflow.com/q/23261587
tags question: http://stackoverflow.com/q/23193773
tags question: http://stackoverflow.com/q/23195835
tags question: http://stackoverflow.com/q/23209570
tags question: http://stackoverflow.com/q/23279574
tags question: http://stackoverflow.com/q/23267834

http://stackoverflow.com/comment/56973817
has text: Can you at least write where did you put `@ComponentScan` annotation and why?
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23326034
score: 1

http://stackoverflow.com/q/23178173
has comment: http://stackoverflow.com/comment/35448451
tagged with: sql
answer count: 1
has comment: http://stackoverflow.com/comment/35448400
downvote count: 0
has comment: http://stackoverflow.com/comment/35448335
favorite count: 0
has body: I am not able to search a particular item from the database and put it into the Jtable here is the code i am using: try{ String filename="stock.mdb"; String database="jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ="; database += filename.trim()+ ";DriverID=22;READONLY=FALSE}"; conn=DriverManager.getConnection (database, "", ""); Statement sta= conn.createStatement(); String str=search.getText(); String sql="SELECT '"+str+"' FROM stockDB"; ResultSet rs= sta.executeQuery(sql); Table.setModel(DbUtils.resultSetToTableModel(rs)); System.out.println("SEARCH UPDATED"); }catch(Exception e) { System.out.println(e); } What is wrong with it?
has answer: http://stackoverflow.com/a/23178348
accepted answer: http://stackoverflow.com/a/23178348
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35448355
upvote count: 1
has title: How to display search item in Jtable?
has comment: http://stackoverflow.com/comment/35448377
has comment: http://stackoverflow.com/comment/35448393
type: Question
has comment: http://stackoverflow.com/comment/35448411
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/35448425

http://stackoverflow.com/a/23133165
upvote count: 5
has body: Having an abstract class with no methods is legal, yet entirely pointless. You use abstract classes to share implementation. If a class has no methods, it has no implementation to share. If you need to share some common variables (I assume that your abstract class has at least some fields, otherwise it is entirely empty) you would be better off with composition and an interface, like this: class CommonData { // Some getters and setters for items that you wish to share } interface WithCommonData { CommonData getCommonData(); } Your classes can put the common data as a member, and implement the interface WithCommonData, giving you access to the common data, and letting the classes keep their inheritance structure. If you need to "mark" a user class, doing it with a "marker interface" (i.e. an interface with no methods) is a lot more flexible, because the users retain an ability to build their own chain of inheritance.
has comment: http://stackoverflow.com/comment/35368265
type: Answer
has comment: http://stackoverflow.com/comment/35368371
downvote count: 0
has comment: http://stackoverflow.com/comment/35368297
has comment: http://stackoverflow.com/comment/35368548
score: 5
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23133038
answers question: http://stackoverflow.com/q/23133038
has comment: http://stackoverflow.com/comment/35368149

http://stackoverflow.com/q/23140022
has answer: http://stackoverflow.com/a/23140079
has comment: http://stackoverflow.com/comment/35381089
has comment: http://stackoverflow.com/comment/35381288
has comment: http://stackoverflow.com/comment/35381350
score: 1
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/35381285
answer count: 2
tagged with: arrays
downvote count: 0
has comment: http://stackoverflow.com/comment/35381070
favorite count: 0
has body: I have an array that can store 25 values. Now, if I store just 5 values, the remaining 20 values in the array are automatically filled in as 0. And when I print the array, all 25 of those value come up. Is there any way to get only the populated(in this case 5) values and exclude the automatically filled 0's?
has comment: http://stackoverflow.com/comment/35381093
has comment: http://stackoverflow.com/comment/35385093
has comment: http://stackoverflow.com/comment/35381080
has title: How to print just the populated values in an array in java?
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23140120
has comment: http://stackoverflow.com/comment/35381182
upvote count: 1

http://stackoverflow.com/q/23250310
linked to: http://stackoverflow.com/q/18855323
answer count: 1
downvote count: 0
favorite count: 0
tagged with: jlabel
tagged with: swing
has answer: http://stackoverflow.com/a/23250436
type: AnsweredQuestion
score: 1
tagged with: mouselistener
tagged with: java
upvote count: 1
has body: I use a MouseListner in a DefaultTableCellRenderer. A Label shall get this one ==========================> public class CatCustTabRenderer extends DefaultTableCellRenderer implements TableCellRenderer { Icon iconGetDate = new ImageIcon(GUI_RentABook.class.getResource("/images/edit15.jpg")); JButton button = new JButton(iconGetDate); // setOpaque(true); public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { JTableHeader header = table.getTableHeader(); header.setBackground(OwnConstants.SALTEGREY); header.setForeground(Color.white); table.getColumnModel().getColumn(0).setPreferredWidth(25);// 0 Numbers table.getColumnModel().getColumn(1).setPreferredWidth(60);// 1 Cust-ID table.getColumnModel().getColumn(2).setPreferredWidth(160);// 2 Customer table.getColumnModel().getColumn(3).setPreferredWidth(50);// 3 ZIP table.getColumnModel().getColumn(4).setPreferredWidth(100);// 4 City table.getColumnModel().getColumn(5).setPreferredWidth(100);// 5 Street table.getColumnModel().getColumn(6).setPreferredWidth(40);// 6 Str-# table.getColumnModel().getColumn(7).setPreferredWidth(115);// 7 Phone table.getColumnModel().getColumn(8).setPreferredWidth(170);// 8 Email table.getColumnModel().getColumn(9).setPreferredWidth(110);// 9 Loan-ID table.getColumnModel().getColumn(10).setPreferredWidth(16);// 10 Edit-Icon JLabel label = (JLabel) super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); String returnTTipp = ""; returnTTipp = "Edit customer values"; if (value instanceof ImageIcon) { label.setText(null); label.setIcon((ImageIcon)value); label.setToolTipText(returnTTipp); System.out.println("Im RENDERER"); label.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent me) { System.out.println("CLICKED"); } }); }else { label.setIcon(null); label.setToolTipText(null); } if ((row % 2) == 1 &amp;&amp; !isSelected) { label.setBackground(OwnConstants.NAVAJOWHITE);…
tagged with: listcellrenderer
type: Question
has title: addMouseListener does not work on label
accepted answer: http://stackoverflow.com/a/23250436

http://stackoverflow.com/comment/35476985
comment on: http://stackoverflow.com/a/23188138
score: 0
type: Comment
has text: No, that is the layout within the individual panels. Not OF the panels.
type: AnswerComment

http://stackoverflow.com/comment/35587171
comment on: http://stackoverflow.com/a/23255719
has text: This was the solution i was looking for. Thank you.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/35611773
comment on: http://stackoverflow.com/q/23262313
has text: I'll check it next week (into a public holiday now...) But I do know we're a bit out of date because when I went to investigate in the debugger, I found we're using a version somewhat older than the source I have.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23214103
tagged with: executable-jar
has answer: http://stackoverflow.com/a/23216221
linked to: http://stackoverflow.com/q/13078505
has comment: http://stackoverflow.com/comment/35512598
accepted answer: http://stackoverflow.com/a/23216092
has title: Issue with main when running jar file
type: AnsweredQuestion
tagged with: java
tagged with: eclipse
has body: I am trying to run a jar file, and I have created the manifest file and such within eclipse and specified the main entry point. I have tested all my class files and the one I need to work(TestRead.java) keeps giving me this error am not sure why or how to resolve it: Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/ws/commons/schema/XmlSchemaElement at java.lang.Class.getDeclaredMethods0(Native Method) at java.lang.Class.privateGetDeclaredMethods(Unknown Source) at java.lang.Class.getMethod0(Unknown Source) at java.lang.Class.getMethod(Unknown Source) at sun.launcher.LauncherHelper.validateMainClass(Unknown Source) at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source) Caused by: java.lang.ClassNotFoundException: org.apache.ws.commons.schema.XmlSchemaElement at java.net.URLClassLoader$1.run(Unknown Source) at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) ... 6 more And below is the command line: java -jar JavaWdslApp.jar Edit: I saved it as a runnable Jar file for the mean time and tried running it but another issue appears telling me the array is out of bounds: Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0 This is how I call it: public static void main(String[] args) { String path1 = args[0]; String fileName = args[1]; TagDef tagDef; String[] operations; try { operations = listOperationsUnique("abc"); System.out.println("operation:" + operations.length); for (int i = 0; i &lt; operations.length; i++) { System.out.println("operation:" + operations[i]); } } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (SAXException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOE…
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/35512017
tagged with: jar
has answer: http://stackoverflow.com/a/23216092
has comment: http://stackoverflow.com/comment/35514447
score: 0
has comment: http://stackoverflow.com/comment/35515256
possible better answer: http://stackoverflow.com/a/23216221

http://stackoverflow.com/q/23250407
tagged with: eclipse
tagged with: runnable
tagged with: jar
downvote count: 0
linked to: http://stackoverflow.com/q/2706222
favorite count: 0
has comment: http://stackoverflow.com/comment/35580991
type: UnansweredQuestion
has title: How to export 32bit or 64bit runnable JAR in one Eclipse project with SWT?
has comment: http://stackoverflow.com/comment/35589503
score: 2
answer count: 0
upvote count: 2
tagged with: java
tagged with: swt
has comment: http://stackoverflow.com/comment/35589522
type: Question
has body: I know that SWT has two versions, 32bit and 64bit. That is the source of problem. I have a project using SWT in Eclipse IDE, my OS and Eclipse developing environment are all in 64bit. Certainly, in this project, I refer the SWT 64bit jar package for running or exporting. But, my colleague's computer is running on 32bit windows 7. They can not run my JAR with SWT 64bit, and I have to remove the SWT 64bit package from my project and add the SWT 32bit package to it, and export again this runnable JAR which included SWT 32bit for my colleague. It troubles me. There is a stupid but efficient way to complete this task. I just need to create two projects, one includes the SWT 32bit package and another has the SWT 64bit package, every time I make a little change, I need to copy the java code from 64bit project to 32bit project. That is just the point I hated. Because I only try to keep one copy java codes for two different OS platform's exportation. What should I do? Does Ant or Maven have a good choice? I don't familiar with them, but if it needs, I can learn.

http://stackoverflow.com/comment/35579022
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23251461
has text: can you please explain the `parse` method

http://stackoverflow.com/a/23279840
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23279744
has comment: http://stackoverflow.com/comment/35645324
has body: (returning true: tryLock()) when I'm at 20 threads. Unless you have 20 CPUs, these threads are not running all at the same time, and the threads which are running are likely to be staving out the threads which are not. If you need to avoid this, you have to use a fair lock. A better solution is to not write code where it is significant contention on any lock.

http://stackoverflow.com/q/23193137
tagged with: javascript
has comment: http://stackoverflow.com/comment/35476173
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/23193172
type: UnansweredQuestion
tagged with: response.redirect
downvote count: 1
tagged with: java
has title: Can we display parameters sent by response.sendRedirect on the next page. If yes, how?
score: -1
tagged with: getparameter
type: Question
upvote count: 0
has body: Is this the correct way to display parameter sent by, response.sendRedirect("index.jsp?a="+1); alert(&lt;%=request.getParameter("a")%&gt;);
tagged with: jsp

http://stackoverflow.com/a/23237076
type: Answer
downvote count: 2
has body: You can simply do: System.out.println(s.substring(s.lastIndexOf(".") + 1)); This will print Friend
score: 6
answers question: http://stackoverflow.com/q/23237038
has comment: http://stackoverflow.com/comment/35553402
has comment: http://stackoverflow.com/comment/35553400
accepted answer of: http://stackoverflow.com/q/23237038
has comment: http://stackoverflow.com/comment/35553624
has comment: http://stackoverflow.com/comment/35553514
has comment: http://stackoverflow.com/comment/35553298
type: AcceptedAnswer
upvote count: 8
has comment: http://stackoverflow.com/comment/35553133

specifications
type: Tag
tags question: http://stackoverflow.com/q/23215988
tags question: http://stackoverflow.com/q/23193059
tag name: specifications

http://stackoverflow.com/a/23160883
has body: The problem it's your first return statement for(int i = 0; i &lt; an.length; i++){ ans = an[i]; ansl = Integer.toString(ans); return ansl; // &lt;- This return doesn't allow to continue the loop foor! } return ansl; However, you can do this for give you want: String str = Arrays.toString(array);
type: Answer
upvote count: 2
score: 2
answers question: http://stackoverflow.com/q/23160584
downvote count: 0

http://stackoverflow.com/a/23243057
has body: First I think we should get the terminology right. There are two general groups of "fake" objects in testing (simplified): a mock, which returns predefined answers on predefined input and stubs which are a simplified version of the object the SUT (system under test) communicates with. While a mock basically does nothing than to provide a response, a stub might use a live algorithm, but not store it's results in a database or send them to customers via eMail for example. I am no expert in testing, but those two fake objects are rather to be used in unit and depending on their scope in acceptance tests. So your sut communicates with a remote system during integration test. In my book this is the perfect time to actually test how your software integrates with other systems, so your software should be tested against a test version of the remote system. In case this is not possible (they might not have a test system) you are conceptually in some sort of trouble. You can shape your stub or mock only in a way you expect it to work, very much like the part of the software you have written to communicate with that remote service. This leaves out some important things you want to test with integration tests: Was the client side implemented correctly so that it will work with the live server. Do we have to develop work around as there are implementation errors on the server side? In which scale will the communication with the remote system affect our software's performance? Do our authentication credentials work? Does the authentication mechanism work? What are the technical and conceptual implications of this communication relationship no one has thought of so far? (Believe me, the latter will happen more often than you might expect!) Generally speaking: What will happen if you do integration tests against a mock or a stub is that you test against your own understanding of how to implement the client and the server side of communication, and you do not test how your client wo…
score: 0
upvote count: 1
downvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/23239653

http://stackoverflow.com/comment/35449341
comment on: http://stackoverflow.com/q/23178740
score: 0
has text: @Raghunandan Please see the edit I did on my original post.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/48496523
comment on: http://stackoverflow.com/a/30195688
type: AnswerComment
type: Comment
score: 1
has text: That's actually what solved my problem. I deleted and put back all the drawables in my project :)

http://stackoverflow.com/q/23195317
tagged with: jsp
duplicate of: http://stackoverflow.com/q/3655316
type: Question
tagged with: http://stackoverflow.com/tag/html
has title: Accessing Resources from JSP inside WEB-INF
has answer: http://stackoverflow.com/a/23195494
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/35477885
possible better answer: http://stackoverflow.com/a/23197476
tagged with: java
accepted answer: http://stackoverflow.com/a/23195494
has answer: http://stackoverflow.com/a/23197476
tagged with: eclipse
tagged with: servlets
linked to: http://stackoverflow.com/q/3655316
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35477957
has body: I'm having trouble accessing some images and a css file from my JSP stored in WEB-INF. My servlet calls up the JSP and that all loads fine but the page is unable to find the images and css file. I'm very new to this sort of thing and would appreciate the help. I am aware that there have been some questions on this in the past and I've tried the suggestions posed by those but I can't seem to get my head around it. Here's the contents of the JSP (I tried a bunch of different methods): <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> Title Test And here's my directory structure: http://gyazo.com/0a7aea0a44e51e1789c263767e14a40b

http://stackoverflow.com/comment/35494610
comment on: http://stackoverflow.com/a/23204582
type: AnswerComment
score: 0
has text: OK then i'd say the question is not relevant anymore. But in that matter, i'd like to know how to detect the arguments type (int / bool / double / ...)
type: Comment

http://stackoverflow.com/q/23148121
has title: Java tail log file and display it in jsp
has comment: http://stackoverflow.com/comment/35395580
has answer: http://stackoverflow.com/a/23148346
score: 2
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/11345387
tagged with: jakarta-ee
downvote count: 0
has comment: http://stackoverflow.com/comment/35395595
tagged with: tail
has body: I would like to display log file contents in a jsp page (as part of a web application functionality - cannot use another standalone webapp). I am looking for something similar to the unix tail -f functionality. I looked at Apache Commons Tailer and TailerListenerAdapter. However, the TailerListenerAdapter has a method handle(String line) which is not useful if you would like to see the output in a web browser. There are other solutions such as reading the file and then polling the file for new contents. But it would involve too many IO operations in a loop. Ideally I would want to tail the contents (say 2000 lines) and then display it in a jsp page. I could use an AJAX call, say ever 100 ms and refresh the data in the UI.
tagged with: logfile
answer count: 1
favorite count: 0
upvote count: 2
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/5803776

http://stackoverflow.com/q/23160790
has answer: http://stackoverflow.com/a/23161246
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35417697
downvote count: 0
favorite count: 0
has body: I know it's a bad idea, and it causes bugs. The problem is, I need the "intended" behavior. "Low": // simplified example abstract class Low { String name; public Low(String name) { this.name = name; } public Low(int id) { this.name = getNameForId(id); } public Low() {} // will be loaded later @Override public String toString() { return name; } public void load(InputStream in) { // --- grab ID from stream --- this.name = getNameForId(id); } protected abstract String getNameForId(int id); } And "High": class High extends Low { public High(int id) { super(id); } public High(String name) { super(name); } public High() {} // will be loaded later @Override protected String getNameForId(int id) { return Registry.getName(id); } } Note that in this particular case, it will work just fine. But it will fall apart once the overriding method needs to use some field. How to do this better?
type: Question
upvote count: 2
tagged with: design-patterns
accepted answer: http://stackoverflow.com/a/23161246
possible better answer: http://stackoverflow.com/a/23161194
has comment: http://stackoverflow.com/comment/35417730
tagged with: oop
has answer: http://stackoverflow.com/a/23161194
has comment: http://stackoverflow.com/comment/35417788
has comment: http://stackoverflow.com/comment/35417714
tagged with: java
answer count: 2
has title: Safe alternative to calling of abstract method from constructor
has comment: http://stackoverflow.com/comment/35417975
has comment: http://stackoverflow.com/comment/35417826
has comment: http://stackoverflow.com/comment/35417749

http://stackoverflow.com/a/23278791
has body: You css selector is wrong. .scroll-pane:corner selects Nodes with class "scroll-pane" which have a pseudo-class state "corner" activated. According to the css documentation, scroll pane has no "corner" pseudoclass. .scroll-pane:corner &gt; .viewport would select a node with class "viewport" that had an (immediate) parent node with class "scroll-pane" and with that parent node having the pseudoclass state "corner" activated. So, if anything, you would be selecting the viewport here. The css you need is .scroll-pane &gt; .corner { -fx-background-color: #191A19 ; } Maybe have a look at a general purpose tutorial on css selectors, such as the one at w3schools Update complete example: import javafx.application.Application; import javafx.scene.Scene; import javafx.scene.control.ScrollPane; import javafx.scene.control.ScrollPane.ScrollBarPolicy; import javafx.scene.control.TextArea; import javafx.scene.layout.BorderPane; import javafx.stage.Stage; public class ScrollPaneStyledCorner extends Application { @Override public void start(Stage primaryStage) { BorderPane root = new BorderPane(); ScrollPane scrollPane = new ScrollPane(); scrollPane.setPrefHeight(200); scrollPane.setPrefWidth(200); TextArea textArea = new TextArea(System.getProperty("javafx.version")); scrollPane.setContent(textArea); scrollPane.setVbarPolicy(ScrollBarPolicy.ALWAYS); scrollPane.setHbarPolicy(ScrollBarPolicy.ALWAYS); root.setCenter(scrollPane); Scene scene = new Scene(root); scene.getStylesheets().add(getClass().getResource("scrollPaneCorner.css").toExternalForm()); primaryStage.setScene(scene); primaryStage.show(); } public static void main(String[] args) { launch(args); } } scrollPaneCorner.css: .scroll-pane &gt; .corner { -fx-background-color: #191A19 ; }
has comment: http://stackoverflow.com/comment/80259123
has comment: http://stackoverflow.com/comment/35633264
downvote count: 0
answers question: http://stackoverflow.com/q/23278267
type: Answer
score: 8
upvote count: 8

http://stackoverflow.com/q/23208281
type: Question
tagged with: java
upvote count: 1
answer count: 1
type: UnansweredQuestion
has body: I created my custom JRE using Java 8 Embedded (I think it only support 32 bit JVM) System : Linux X86_64 http://www.oracle.com/technetwork/java/embedded/downloads/java-embedded-java-se-download-359230.html when i access a 64 BIT system JNI library from my code .I get the following exception " Native library (linux-x86/xyz.so) not found in resource path " but I've the corresponding 64 bit xyz.so in the java library path.I didn't get the 32 bit version of xyz.so lib .Is there any way i can access the 64 JNI lib from 32 bit JVM. Any help really appreciated.
downvote count: 0
score: 1
favorite count: 0
has title: How to access 64 bit JNI lib using 32 bit Java 8 Embedded JRE
tagged with: linux
has answer: http://stackoverflow.com/a/23208509

http://stackoverflow.com/comment/35479332
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23195056
has text: just create one custom row item that look like grid row and rest will be the same
type: AnswerComment

m2e
type: Tag
tag name: m2e
tags question: http://stackoverflow.com/q/23153355
tags question: http://stackoverflow.com/q/23275928

http://stackoverflow.com/comment/35511448
comment on: http://stackoverflow.com/q/23212654
type: Comment
score: 0
has text: Click details, copy them and post with your question.
type: QuestionComment

http://stackoverflow.com/comment/35455060
has text: Thanks for the information and for the tip! I'll look and see whether I can use immutable objects as keys instead (or avoid mutating them).
type: AnswerComment
comment on: http://stackoverflow.com/a/23181850
score: 0
type: Comment

http://stackoverflow.com/comment/35443722
score: 1
comment on: http://stackoverflow.com/q/23175539
type: Comment
type: QuestionComment
has text: @Olayinka, why put that as a comment instead of as an answer?

http://stackoverflow.com/comment/35501781
type: Comment
comment on: http://stackoverflow.com/a/23205518
type: AnswerComment
has text: it is psuedo code since i do not want to just give you the answer...its just as good as any other code...its up to you to convert it
score: 0

http://stackoverflow.com/q/23180876
accepted answer: http://stackoverflow.com/a/23181395
answer count: 1
favorite count: 0
type: AnsweredQuestion
has body: In partition problem I have understood the pseudo polynomial time algorithm.But i am not able to print the balanced set . I am not able to figure out what to store instead of boolean values in the table constructed from algo. Please provide algo to print partitioned subset also. Can you provide solution in which I can modify table constructed to achieve the partitioned values.
has answer: http://stackoverflow.com/a/23181395
upvote count: 1
downvote count: 1
type: Question
has title: printing partitioned set in partition prob
tagged with: algorithm
tagged with: java
score: 0

design-patterns
tags question: http://stackoverflow.com/q/23249449
tags question: http://stackoverflow.com/q/23246146
tags question: http://stackoverflow.com/q/23144203
tag name: design-patterns
tags question: http://stackoverflow.com/q/23257842
tags question: http://stackoverflow.com/q/23269932
tags question: http://stackoverflow.com/q/23156128
tags question: http://stackoverflow.com/q/23211468
tags question: http://stackoverflow.com/q/23274331
type: Tag
tags question: http://stackoverflow.com/q/23162562
tags question: http://stackoverflow.com/q/23150227
tags question: http://stackoverflow.com/q/23186564
tags question: http://stackoverflow.com/q/23160790

http://stackoverflow.com/comment/35500302
type: Comment
comment on: http://stackoverflow.com/a/23207381
has text: I copy your solution in my code, but nothing was removed.
score: 0
type: AnswerComment

http://stackoverflow.com/q/23143829
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35389094
tagged with: thread-local
has comment: http://stackoverflow.com/comment/35390114
has comment: http://stackoverflow.com/comment/35390084
score: 2
has answer: http://stackoverflow.com/a/23600516
upvote count: 2
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/35389010
answer count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/35390082
has body: We see an issue due to ThreadLocal's initialValue() being called multiple times. private static class MonMetricsTLS extends ThreadLocal&lt;IMonitor&gt; { public MonMetricsTLS(MetricConfig config) { this.config = config; Timer timer = new Timer(true); } @Override protected IMonitor initialValue() { IMonitor mon = new MonitorImpl(config); timer.schedule(new SenderTimerTask(mon), config.senderPeriodMs(), config.senderPeriodMs()); return mon; } } Between first and second calls timer can go bad and we get illegalstateexception in schedule(). Why is it getting called multiple times per thread?
has title: ThreadLocal initialValue() called multiple times per thread. why?
has answer: http://stackoverflow.com/a/23148147
favorite count: 0
has comment: http://stackoverflow.com/comment/35388628

http://stackoverflow.com/a/28682553
type: Answer
has comment: http://stackoverflow.com/comment/45704373
score: 2
has body: You just found a bug. Please report the bug. Since this is related to the parsing. You can do two things. First of all you can take a memory dump. Just dump the memory (or profile this using visualvm and make a memory profile run). This way you understand what polutes the memory. Second you can correct the issue you found. I do it all the way with third party code. So just before they step into parsing the snippet you do another step evaluating if the xml is correct without checking for shema. Just use a parser run with no shema involved. In order to provide a modified implementation use the sourcecode or if not available, decompile it or rename the class and provide a new implementation class extending from this. If it is a private method or feature you need to access just modify the byte code. In order to inject your version just add your class to your class path (or the classpath of the websphere) and put it in front of it. Usually your code is preceeded for any library code. This way you can override every implementation detail of any library as long as you control the classpath (usually by setting it within the java.exe. So just add an additional test for correctness before this bugged version is issued. And report the bug and also blog about it. If you have questions or need a tool advice just ask. I do this on a regular basis. With open source and non-open source software. Also great for other things like extending features.
upvote count: 2
answers question: http://stackoverflow.com/q/23212857
has comment: http://stackoverflow.com/comment/45674293
downvote count: 0

http://stackoverflow.com/comment/35631561
comment on: http://stackoverflow.com/q/23279253
score: 0
type: Comment
type: QuestionComment
has text: Call super.paintComponent or be prepared for some really cool weirdness

http://stackoverflow.com/a/23274976
has body: In the second case you are using a static method which is internally creating the object or passing a reference to an existing object. This is a common pattern particularly when the APIs wish to hide an internal implementation (as is the case here).
type: Answer
has comment: http://stackoverflow.com/comment/35624878
has comment: http://stackoverflow.com/comment/35622287
score: 12
answers question: http://stackoverflow.com/q/23274911
upvote count: 12
downvote count: 0
has comment: http://stackoverflow.com/comment/35622612

http://stackoverflow.com/q/23193143
possible better answer: http://stackoverflow.com/a/23206801
tagged with: java
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/23206801
has comment: http://stackoverflow.com/comment/35491799
favorite count: 0
tagged with: netbeans-8
has title: Conflict between Netbeans IDE 8.0 and UCanAccess?
upvote count: 3
tagged with: jdbc
tagged with: connection
tagged with: ucanaccess
has answer: http://stackoverflow.com/a/23308939
accepted answer: http://stackoverflow.com/a/23308939
downvote count: 0
has comment: http://stackoverflow.com/comment/35482760
has body: I have to define a new Driver in the Netbeans "Services" Tab Services->Databases->Drivers->new Driver... because I want use the "Entity Classes from Database"-Wizard in context with UCanAccess. 1st step: "new Driver" does work (only declaration ;-) ) Driver File(s): f:\WorkspaceNetbeans\MSAccessDB\lib\UCanAccess-2.0.4-bin\ucanaccess-2.0.4.jar Driver Class: net.ucanaccess.jdbc.UcanaccessDriver Name:msaccess 2nd step: "Connect using..." JDBC URL: jdbc:ucanaccess://F:/WorkspaceNetbeans/MSAccessDB/data/Datenbank2.accdb "User Name" and "Password" leave blank The "Test Connection"-Button results in Error Message: Cannot establish a connection to jdbc:ucanaccess://F:\WorkspaceNetbeans\MSAccessDB\data\Datenbank2.accdb using net.ucanaccess.jdbc.UcanaccessDriver (Could not initialize class net.ucanaccess.jdbc.UcanaccessDriver) I've got the newest ucanaccess from http://ucanaccess.sourceforge.net/site.html ucanaccess-2.0.4.jar, commons-lang-2.6.jar, commons-logging-1.0.4.jar, hsqldb.jar, jackcess-2.0.3.jar in the Netbeans Classpath. The old fashion way to connect via jdbc to ucanaccess works fine. public static void main(String[] args) throws ClassNotFoundException, SQLException { String connectString = "jdbc:ucanaccess://" + "f:/WorkspaceNetbeans/MSAccessDB/data/Datenbank2.accdb"; Class.forName("net.ucanaccess.jdbc.UcanaccessDriver"); Connection conn = DriverManager.getConnection(connectString, "", ""); conn.createStatement().execute("CREATE TABLE example1 (id COUNTER PRIMARY KEY,descr text(400), number numeric(12,3), date0 datetime) "); } The same connection string also works fine make DBeaver able to connect to the MSAccess db. My set up: Windows 7 Professional 64 bit Microsoft Office 2013 NetBeans IDE 8.0 Java 1.8 The problem is similar to: "Conflict between JT400 and UCanAccess?" Conflict between JT400 and UCanAccess? but the answers there don't help with my problem. Any ideas to solve my problem?
type: AnsweredQuestion
score: 3

http://stackoverflow.com/comment/36025532
has text: Here's the CWE that is relevant to validation before canonicalization: http://cwe.mitre.org/data/definitions/180.html
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23344777
type: Comment

http://stackoverflow.com/a/23572247
type: Answer
has comment: http://stackoverflow.com/comment/77266228
answers question: http://stackoverflow.com/q/23185882
score: 3
downvote count: 1
upvote count: 4
has comment: http://stackoverflow.com/comment/46815405
type: AcceptedAnswer
has body: You should split your TableView on multiple Nodes according to height of printable area and height of your rows. Then call job.PrintPage for all nodes, and once job.endJob. Here is my approach for multiple pages printing: public static List&lt;Node&gt; getLineRecordPages(Collection&lt;LineRecord&gt; lineRecords, PageLayout layout) { LinkedList&lt;Node&gt; result = new LinkedList&lt;&gt;(); VBox node = null; double totalHeight = Double.POSITIVE_INFINITY; for (LineRecord record : lineRecords) { PrintLineRecordView view = new PrintLineRecordView(); final PrintLineRecordPresenter presenter = (PrintLineRecordPresenter) view.getPresenter(); presenter.bind(record); final double elementHeight = view.getView().prefHeight(layout.getPrintableWidth()); if (elementHeight + totalHeight &gt; layout.getPrintableHeight()) { node = new VBox(); node.setMaxWidth(layout.getPrintableWidth()); result.add(node); totalHeight = 0; } totalHeight+=elementHeight; if (node != null) { node.getChildren().add(view.getView()); } } return result; } And actualy sending pages to printing job: Printer printer = Printer.getDefaultPrinter(); PageLayout pageLayout = printer.getDefaultPageLayout(); PrinterJob printerJob = PrinterJob.createPrinterJob(printer); final List&lt;Node&gt; pages = Formatter.getLineRecordPages(lineRecords, pageLayout); final boolean print = printerJob.showPrintDialog(null); if (print) { pages.forEach(printerJob::printPage); printerJob.endJob(); }
accepted answer of: http://stackoverflow.com/q/23185882

http://stackoverflow.com/comment/35403940
type: Comment
has text: Tarun Gupta Just correct me if I am wrong. In the spring controller I have to send the JSON which is having List<Strin>. And in my java method where I am calling this controller, I have to get the JSON from the response. Am I right Tarun ?
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/23151398

http://stackoverflow.com/comment/35678067
type: QuestionComment
comment on: http://stackoverflow.com/q/23202516
has text: @VD' : I tried that, removing all JDK's from my machine. Are there other steps I should take?
score: 0
type: Comment

http://stackoverflow.com/q/23222707
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/23222847
answer count: 4
has title: Android NullPointerException. Why?
tagged with: java
has answer: http://stackoverflow.com/a/23239154
type: Question
has comment: http://stackoverflow.com/comment/35526950
has answer: http://stackoverflow.com/a/23222905
has comment: http://stackoverflow.com/comment/35526890
has body: I'am new in android programming, and i have next problem: In my fragment class i need to do some action when user has clicked on button. Here is my code, he is very simple: public class InboxFragment extends Fragment{ private ListView ll; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { return inflater.inflate(R.layout.inbox_fragment, container, false); } public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Button filter_bt; filter_bt = (Button) getView().findViewById(R.id.filter_button); filter_bt.setOnClickListener((OnClickListener) this); } } And here is my code of layout file: &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" &gt; &lt;Button android:id="@+id/filter_button" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@color/red" android:text="Filter by date" android:textColor="@color/white" /&gt; &lt;/LinearLayout&gt; Here is my logs: FATAL EXCEPTION: main java.lang.NullPointerException at com.example.android.navigationdrawerexample.InboxFragment.onCreate(InboxFragment.java:29) at android.app.Fragment.performCreate(Fragment.java:1673) at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:872) at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1075) at android.app.BackStackRecord.run(BackStackRecord.java:682) at android.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1455) at android.app.FragmentManagerImpl$1.run(FragmentManager.java:441) at android.os.Handler.handleCallback(Handler.java:725) at android.os.Handler.dispatchMessage(Handler.java:92) at android.os.Looper.loop(Looper.java:137) at android.app.ActivityThread.main(ActivityThread.java:5306) at java.lang.reflect.Method.invokeNative(Native Method) at…
score: 0
has answer: http://stackoverflow.com/a/23222855

http://stackoverflow.com/comment/35636962
type: AnswerComment
comment on: http://stackoverflow.com/a/23282340
has text: OK that makes sense thank you guys! It just seemed kind of trivial to create a for loop that takes up several lines of code, only to to add one to a list of variables, and other things like that.
score: 0
type: Comment

http://stackoverflow.com/comment/35503540
type: QuestionComment
has text: @HotLicks hmmm, it shows `javac 1.6.0_30`. How to fix?
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23209280

http://stackoverflow.com/comment/35569857
comment on: http://stackoverflow.com/a/23223481
type: AnswerComment
score: 0
has text: Thanks, that explanation really helped to wrap things up
type: Comment

http://stackoverflow.com/q/23233688
has body: I am trying to concatenate two two-dimensional arrays of different sizes. I have no idea why my method doesn't work. Java tells me, when I mouse over the "return xx": "Type mismatch: cannot convert from int[][] to int[]". When I mouse over "concatenateArr2d..." I get: "Illegal modifier for parameter concatenateArr2d: only final is permitted". I don't understand why I am getting this error. public static int[][] concatenateArr2d(int[][] t, int[][] s) { int[][] xx = new int[t.length + s.length][]; for(i = 0; i &lt; xx.length; i++) { xx[i] = new int[t[i].length + s[i].length]; } return xx; } I still have to do the code to fill the entries but that should not be a problem. Any help please? Thank you.
type: AnsweredQuestion
tagged with: java
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/35547066
has answer: http://stackoverflow.com/a/23233744
tagged with: arrays
accepted answer: http://stackoverflow.com/a/23233744
has comment: http://stackoverflow.com/comment/35547094
tagged with: multidimensional-array
has comment: http://stackoverflow.com/comment/35547156
possible better answer: http://stackoverflow.com/a/23234008
score: 0
has answer: http://stackoverflow.com/a/23234008
has title: Concatenating 2-dimensional ragged arrays (Java)

http://stackoverflow.com/comment/35532604
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/23225590
has text: Yes make sure the key implements hashcode and equals properly, also value implements equals correctly

http://stackoverflow.com/a/31919817
answers question: http://stackoverflow.com/q/23145576
type: Answer
has body: Make sure you are added the same versioned scala library. I had the same issue once, when I used an older scala lib than the Kafka's Scala version.
score: 0

http://stackoverflow.com/comment/35611279
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23268779
has text: Did you read this https://developers.google.com/drive/web/quickstart/quickstart-java

http://stackoverflow.com/comment/35629265
type: Comment
type: QuestionComment
has text: It can be any random number of strings such as "1985196519819819819561984984949454687541654" and "984651984191941987490619816202619816206". Then you would take that string and convert them to and int array and add them together.
comment on: http://stackoverflow.com/q/23278367
score: 0

http://stackoverflow.com/q/23253527
has comment: http://stackoverflow.com/comment/35583108
type: Question
tagged with: arraylist
tagged with: log4j
answer count: 0
score: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35582655
has comment: http://stackoverflow.com/comment/35585397
has body: I'm going to extends rollingFileAppender. I have defined the size and the amount of the dile in log4j.properties: log4j.appender.myApp.MaxFileSize=20MB log4j.appender.myApp.MaxBackupIndex=5 my extenstion should save the log event in memory and when there is error, to write them to the log. I use ArrayList&lt;LoggingEvent&gt; loggingEvents = new ArrayList&lt;&gt;(); But, I don't know what size to give the arrayList so it will still work with the sizes defined above as expected. Any suggestion? thanks
tagged with: java
has title: Use arraylist to store the log events in memory - with rolling appender

http://stackoverflow.com/q/23227127
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/23229146
type: UnansweredQuestion
tagged with: web-services
has title: Modify the path to index.jsp
tagged with: java
type: Question
has body: My environment is spring 4.0 and tomcat 7 I have a index.jsp file in my project under webapp, if I run the project on tomcat locathost:8080/contextPath_Of_Project/, by default, the browser will display index.jsp If I want the browser to display index.jsp under localhost:8080/contextPath_of_Project/something/ Is there any solution beside using controller and viewresolver? can I accomplish the goal by modifying the configuration only? thanks

http://stackoverflow.com/comment/35588964
type: Comment
has text: That argument is for the CA certs, not for the signed CSR.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23238473

url
tags question: http://stackoverflow.com/q/23172740
tags question: http://stackoverflow.com/q/23140698
tags question: http://stackoverflow.com/q/23209559
tags question: http://stackoverflow.com/q/23179787
tag name: url
tags question: http://stackoverflow.com/q/23161119
tags question: http://stackoverflow.com/q/23288709
tags question: http://stackoverflow.com/q/23169865
tags question: http://stackoverflow.com/q/23231639
tags question: http://stackoverflow.com/q/23273267
tags question: http://stackoverflow.com/q/23226641
tags question: http://stackoverflow.com/q/23268430
tags question: http://stackoverflow.com/q/23192011
type: Tag
tags question: http://stackoverflow.com/q/23205213

http://stackoverflow.com/a/23268074
has comment: http://stackoverflow.com/comment/35611193
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23266148
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/23266148
upvote count: 2
has body: "16 file = 16 Mappers" that is a wrong assumption. "16 Files = Minimum 16 Mappers" This is correct. If some of the 16 files are bigger than the block size they are split to multiple mappers. Hence your 16 files generating 26 Mappers may not be because of speculative execution. Setting the value in Conf certainly works. You can verify by checking your job.xml

http://stackoverflow.com/q/23226430
has answer: http://stackoverflow.com/a/23226589
answer count: 1
has comment: http://stackoverflow.com/comment/35533851
favorite count: 0
has comment: http://stackoverflow.com/comment/35535006
tagged with: rest
has body: I am new to android.i am using Restful web Services.I have one field like Category in mySql Database.now I need to get value from database and put it into AutoCompleteTextView.but I can get values from database.and also I know how to set that value into AutoCompleteTextView.but I don't know how can I get list from HttpResponse. HttpResponse can return list?
type: UnansweredQuestion
tagged with: android
downvote count: 2
upvote count: 0
has title: HttpResponse can return list in android through RESTFUL web service?
tagged with: java
type: Question
tagged with: android-layout
tagged with: performance
score: -2

http://stackoverflow.com/comment/35631652
comment on: http://stackoverflow.com/q/23279614
type: Comment
type: QuestionComment
score: 0
has text: 1) an object *is* itself, and; 2) an object is *not* cloned/duplicated during an assignment or when used as a method argument. (Those two pieces of information should be enough to answer the question even without digressing into reference values..)

http://stackoverflow.com/comment/35521891
score: 1
has text: This still assumes a hard-coded resource path with `libResourcePath = "/org/jnativehook/lib/"` - is something as dynamic as the class path possible? I.e. Eclipse allows you to specify a folder as Class-Folder which is apparently added to the search-path. Something similar for the Manifest would be interesting.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23203283

http://stackoverflow.com/comment/134337140
type: Comment
comment on: http://stackoverflow.com/a/23326034
has text: Have the same issue, and update the vaule of @ComponentScan on spring application class, such as HelloApp.
type: AnswerComment
score: 0

http://stackoverflow.com/q/23284260
type: Question
upvote count: 0
has comment: http://stackoverflow.com/comment/35810160
answer count: 1
has comment: http://stackoverflow.com/comment/35827416
favorite count: 0
has comment: http://stackoverflow.com/comment/36070137
tagged with: google-glass
type: UnansweredQuestion
tagged with: oauth-2.0
downvote count: 1
has answer: http://stackoverflow.com/a/23387132
has comment: http://stackoverflow.com/comment/35810188
has title: OAuth Callback in the Glass Quick Starter Java App
has body: Got my Glass last week. Working on running the Java version of the Quick Starter Glassware demo. I am having trouble with the OAuth callback. Do I need set this up myself? Or is there source included in the sample somewhere? Please help! Clarification: I have set up my own project with the Java Quick Starter app's code, deployed it in EC2 and have set up the Client-ID and Client-secret in the Google APIs Console. I set the Redirect URI as http://&lt;my server&gt;/&lt;my-app&gt;/oauth2callback. When I visit the app in the browser, I get a 404 error that /oauth2callback is not found. I also tried setting the Redirect URI to just my app's root, i.e. http://&lt;my server&gt;/&lt;my app&gt;. Strangely, I still get the same error that /oauth2callback is not found. Additional questions: Can you please clarify what the callback URL needs to be set to? Is the handler code already included in the quick-start-demo app or do I need to provide that code?
tagged with: java
linked to: http://stackoverflow.com/q/23482202
score: -1
has comment: http://stackoverflow.com/comment/35651095

http://stackoverflow.com/comment/35633719
has text: I'm just trying to get the breakpoint in my IntelliJ to get hit. I think that would happen even without the @Produces
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23278708
type: Comment

http://stackoverflow.com/comment/35424953
score: 0
comment on: http://stackoverflow.com/q/23164762
type: Comment
type: QuestionComment
has text: Ah i asked this sort of question earlier. If you look at my profile, someone recommended me to write it that way

http://stackoverflow.com/q/23206825
has answer: http://stackoverflow.com/a/23211886
tagged with: eclipse-plugin
type: Question
has title: Get input field of a dialog in eclipse
answer count: 1
has body: For my plugin, I try to get the active Eclipse dialog with these lines: String shellTitle = Display.getCurrent().getActiveShell().getTitle(); System.out.println("Opened dialog: " + shellTitle); If e.g. I open the search dialog, these lines print me Opened dialog: Search in my console. But I would also want to print the keyword in the search field, for example Opened dialog: Search (with the search word 'ChatSession') I have read the API reference and there, I just can found the getTitle() and some other methods for getting bounds and so on. Is my idea realizable? And if not, is it realizable with these so-called extension points? I have never used them but heard of them.
tagged with: dialog
score: 0
tagged with: java
tagged with: eclipse
type: UnansweredQuestion
tagged with: title

http://stackoverflow.com/comment/35364516
score: 0
has text: It won't. You are basically doing the same.
type: Comment
comment on: http://stackoverflow.com/a/23131295
type: AnswerComment

http://stackoverflow.com/a/23301652
score: 0
answers question: http://stackoverflow.com/q/23208604
type: Answer
has body: Please loot at this forum for solution. We cannot make NBM project as standalone java application. http://forums.netbeans.org/viewtopic.php?p=157046#157046

http://stackoverflow.com/q/23144898
has answer: http://stackoverflow.com/a/23145008
tagged with: java
type: Question
has body: I'm making a game, where each screen will have somethings that are the same, and some diffrent things. I have a class called cInteractive that has the base operations. I then create one of the following classes that derive from it, cParkPieces1, cParkPieces2 or cParkPieces4. I would like it so when I call update from cInteractive, it will then call the update function from the clss that inherits from it. sample code cInteractive cInteractive Pieces; // my base class switch(id) { case 1: Pieces=new cParkPieces1(context); break; case 1: Pieces=new cParkPieces2(context); break; case 1: Pieces=new cParkPieces3(context); break; } ..... .... Pieces.Update(); // need to call update in cParkPeaces, not cInteractive
has comment: http://stackoverflow.com/comment/35390122
linked to: http://stackoverflow.com/q/4836708
score: 0
has comment: http://stackoverflow.com/comment/35390002
answer count: 1
has title: Can a method in a base class, call a method that derives from it??? (sort of like a callback)
type: UnansweredQuestion

http://stackoverflow.com/q/23281582
linked to: http://stackoverflow.com/q/11541154
tagged with: java
answer count: 2
tagged with: image-processing
has comment: http://stackoverflow.com/comment/35635212
upvote count: 5
has title: Java - Image Recognition
type: UnansweredQuestion
has body: I have about 5000 images with water marks on them and 5000 identical images with no watermarks. The file names of each set of images are not correlated to each other in any way. I'm looking for an API in Java preferably that I can use to pair each water marked image with its non-water marked pair.
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/23281652
type: Question
has comment: http://stackoverflow.com/comment/35646390
score: 5
has answer: http://stackoverflow.com/a/29542316

http://stackoverflow.com/comment/35639143
comment on: http://stackoverflow.com/a/23283645
type: Comment
has text: @user1795294 use this Integer.toHexString(Integer.parseInt(String));
score: 3
type: AnswerComment

http://stackoverflow.com/a/41382166
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23252974
has body: a bit late, but maybe a help/hint for anyone struggling with this issue. we had the same strange problem every now and then (our tomcat service is restarted every day at night (which cleans the open handles), so the error was not happening that often). We use a apache proxy with ajp protocol. The problem was a wrong protocol implementation. Our connector config is now the following: &lt;Connector port="8009" protocol="org.apache.coyote.ajp.AjpNioProtocol" connectionTimeout="1800000" acceptorThreadCount="2" maxThreads="400" maxConnections="8192" asyncTimeout="20000" acceptCount="200" minSpareThreads="40" compression="on" compressableMimeType="text/html,text/xml,text/plain" enableLookups="false" URIEncoding="UTF-8" redirectPort="8443" /&gt; Please mind this: protocol="org.apache.coyote.ajp.AjpNioProtocol" This implementation did the trick for us - no more open file handles. Further information can be found here: https://itellity.wordpress.com/2013/07/12/getting-rid-of-close_waits-in-tomcat-67-with-mod_proxy/ I hope this helps someone. Have a nice day!

http://stackoverflow.com/comment/35425652
has text: Please post full code you're using to insert data.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23165011
score: 0

http://stackoverflow.com/comment/35387191
type: QuestionComment
comment on: http://stackoverflow.com/q/23142767
has text: let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/50921/discussion-between-kiruwka-and-ganapathy)
score: 0
type: Comment

http://stackoverflow.com/a/23283649
has comment: http://stackoverflow.com/comment/35638990
has body: So do something like this JOptionPane.showMessageDialog(null, "&lt;html&gt;line 1&lt;br&gt;line 2&lt;br&gt;line 3");
answers question: http://stackoverflow.com/q/23283618
score: 0
has comment: http://stackoverflow.com/comment/35638975
type: Answer

http://stackoverflow.com/q/23226563
answer count: 2
has body: Problem: I have a requirement to call a dao method at fix rate say every 10 sec, then I need to check if the result is valid if yes exit, else keep on calling that method every 10 sec till I get a valid result or defined time out (say 2 min) is over. Approaches: I want to keep the task and scheduler logic separate, and write a task in such a way that it can be used by different classes having similar requirement. One way I can think is to define a new poller task public abstract class PollerTask&lt;T&gt; implements Runnable { abstract public boolean isValid(T result); abstract public T task(); private T result; private volatile boolean complete; public boolean isComplete() { return complete; } public T getResult() { return result; } @Override final public void run() { result = task(); if (complete = isValid(result)) { //may be stop scheduler ?? } } } User need to simply provide implementation of task and isValid; Then we can define a separate class that takes pooling freq and timeout and creates a scheduled executor and submit this task public class PollerTaskExecutor { private int pollingFreq; private int timeout; private ScheduledExecutorService executor; private ScheduledExecutorService terminator; private ExecutorService condition; private volatile boolean done; private ScheduledFuture future; public PollerTaskExecutor(int pollingFreq, int timeout) { this.pollingFreq = pollingFreq; this.timeout = timeout; executor = Executors.newSingleThreadScheduledExecutor(); terminator = Executors.newSingleThreadScheduledExecutor(); condition = Executors.newSingleThreadExecutor(); } public void submitTaskForPolling(final PollerTask pollerTask) { future = executor.scheduleAtFixedRate(pollerTask, 0, pollingFreq, TimeUnit.SECONDS); terminator.schedule(new Runnable() { @Override public void run() { complete(); } }, timeout, TimeUnit.SECONDS); condition.execute(new Runnable() { @Override public void run() { if (pollerTask.isComplete()) { complete(); } } }); } public boolean isDone…
has title: Scheduled executor: poll for result at fix rate and exit if timeout or result valid
downvote count: 0
has answer: http://stackoverflow.com/a/23231576
favorite count: 0
tagged with: scheduledexecutorservice
accepted answer: http://stackoverflow.com/a/23231576
tagged with: multithreading
score: 5
possible better answer: http://stackoverflow.com/a/23232354
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23232354
upvote count: 5
tagged with: java
type: Question

http://stackoverflow.com/q/23210052
score: -1
favorite count: 0
tagged with: java-2d
tagged with: jframe
type: UnansweredQuestion
tagged with: swing
has answer: http://stackoverflow.com/a/23210079
linked to: http://stackoverflow.com/q/21198074
tagged with: java
linked to: http://stackoverflow.com/q/14593678
linked to: http://stackoverflow.com/q/14574045
downvote count: 1
type: Question
linked to: http://stackoverflow.com/q/13022754
upvote count: 0
has body: Not knowing how to do this is killing me. I currently have a frame with a ball which moves diagonally downwards and right, when it collides with the edge of the frame, it needs to bounce. The bounce part I can work out myself after, what I need help with is the ball knowing when it hits the edge of the frame. Main: class ControlledBall extends JPanel { private int x = 70; private int y = 30; private boolean yes = true; public void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2 = (Graphics2D) g; g2.setColor(Color.BLUE); Ellipse2D.Double ball = new Ellipse2D.Double(x,y,50,50); g2.draw(ball); g2.fill(ball); } public void moveRight(int d) {x = x + d;} public void moveDown(int d) {y = y + d;} public void gogo() {yes = true;} public void nono() {yes = false;} public static void main(String[] args) { JFrame frame = new Viewer(); frame.setSize(500, 500); frame.setTitle("Bouncing Ball"); frame.setDefaultCloseOperation((JFrame.EXIT_ON_CLOSE)); frame.setVisible(true); } } Viewer Class: public class Viewer extends JFrame { JButton go = new JButton("GO"); JButton stop = new JButton("STOP"); JPanel buttons = new JPanel(); Timer timer; ControlledBall cbPanel = new ControlledBall(); JPanel left = new JPanel(); JPanel right = new JPanel(); JPanel top = new JPanel(); class gogoListener implements ActionListener { public void actionPerformed(ActionEvent e) { cbPanel.gogo(); timer.start(); } } class nonoListener implements ActionListener { public void actionPerformed(ActionEvent e) { cbPanel.nono(); timer.stop(); } } class TimerListener implements ActionListener { public void actionPerformed(ActionEvent e) { cbPanel.moveRight(5); cbPanel.moveDown(5); repaint(); } } public Viewer() { buttons.add(go); buttons.add(stop); this.add(buttons, BorderLayout.SOUTH); this.add(cbPanel, BorderLayout.CENTER); this.add(right, BorderLayout.EAST); this.add(top, BorderLayout.NORTH); this.add(left, BorderLayout.WEST); timer = new Timer(50, new TimerListener()); go.addActionListener(n…
tagged with: awt
has comment: http://stackoverflow.com/comment/35505640
has title: Java: Ball Collision with Frame
answer count: 1

http://stackoverflow.com/q/23200276
has title: how to create a view form option in java?
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/23200400
downvote count: 2
score: -2
tagged with: jform
tagged with: java
answer count: 1
type: UnansweredQuestion
upvote count: 0
has body: I have created a form for getting the user details. Now I want that when the user clicks on submit button then his/her details gets displayed in an un-editable form format or a pop-up that shows how his/her forms look like. How can I do this?

http://stackoverflow.com/comment/35536417
comment on: http://stackoverflow.com/q/23227266
has text: There are a lot of words here, but it sounds like you are saying that you are doing an update if metadata and contents, and the metadata is updated but the contents are not, is that correct? How are you verifying that the contents are not updated?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35608048
comment on: http://stackoverflow.com/a/23267431
has text: if you are referring to using a boolean variable before the loop it would look something like `while (continuePlaying)` and then after the user input you would simply do `if (pchoice == 0) { continuePlaying = false; }` and `if (playChoice == "dontPlay".equalsIgnoreCase()) { continuePlaying = false; }`
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/23207130
type: Answer
accepted answer of: http://stackoverflow.com/q/23207106
upvote count: 1
has body: Just add the spaces, and a conditional check if you're at the last number to decide whether to print MEGA public static void printTicket(int [] array) { int i; for(i = 0; i &lt; array.length ; i++) { if (i == array.length - 1) { System.out.print("MEGA: "); } System.out.print(array[i]); System.out.print(" "); }
score: 1
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23207106

http://stackoverflow.com/comment/35508200
type: Comment
score: 1
has text: I not suggesting a redirect, rather that you from the 1st app you produce a file as well and that the second app watches for file changes and processes the file http://docs.oracle.com/javase/tutorial/essential/io/notification.html
comment on: http://stackoverflow.com/a/23211853
type: AnswerComment

http://stackoverflow.com/a/23230499
answers question: http://stackoverflow.com/q/23229827
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35545107
has comment: http://stackoverflow.com/comment/35541812
has comment: http://stackoverflow.com/comment/35545408
has comment: http://stackoverflow.com/comment/35541649
upvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/35544789
has comment: http://stackoverflow.com/comment/35541962
downvote count: 0
has comment: http://stackoverflow.com/comment/35545430
has comment: http://stackoverflow.com/comment/35545213
has comment: http://stackoverflow.com/comment/35545124
has body: Option 1 - Use a JFormattedTextField with a SimpleDateFormat: JFormattedTextField textField = new JFormattedTextField(new SimpleDateFormat("HH:mm:ss:SSS")); textField.setText("00:00:00:000"); You can replace the format string according to your needs by looking at the SimpleDateFormat API. This pattern works as long as the movie is not longer than 24 hours. This way the user can delete the string, but once he leaves the text field the string will return to what it was before. Only strings of the specified format will actually be accepted as the value. Option 2 - Use a JFormattedTextField with a MaskFormatter: MaskFormatter mask = null; try { mask = new MaskFormatter("##:##:##:###"); } catch (ParseException e) { e.printStackTrace(); } mask.setValidCharacters("0123456789"); mask.setPlaceholderCharacter('0'); JFormattedTextField textField2 = new JFormattedTextField(mask); textField2.setText("00:00:00:000"); You can replace the format string according to your needs by looking at the MaskFormatter API. This pattern works as long as the movie is not longer than 99 hours, but minutes and seconds count can exceed 59 (e.g. you can have 01:76:98:123 read: 1 hour 76 minutes 98 seconds 123 milliseconds). This way the user can only type digits (specified by "0123456789") and deleting any of the numbers will replace them with 0 (specified by '0').
has comment: http://stackoverflow.com/comment/35541672
has comment: http://stackoverflow.com/comment/35545396
has comment: http://stackoverflow.com/comment/35545636
score: 1
has comment: http://stackoverflow.com/comment/35545172
accepted answer of: http://stackoverflow.com/q/23229827

http://stackoverflow.com/a/23142562
score: 2
has body: Override the setValueAt(...) method of your TableModel. You invoke super.setValueAt(...) to save the data normally. Then whenever the data in column 2 or 3 changes, you then calculate the value of column 4 and update the model.
has comment: http://stackoverflow.com/comment/35460661
has comment: http://stackoverflow.com/comment/35410864
has comment: http://stackoverflow.com/comment/35386498
upvote count: 2
has comment: http://stackoverflow.com/comment/35407013
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23142142
accepted answer of: http://stackoverflow.com/q/23142142
type: Answer

http://stackoverflow.com/q/23207471
has comment: http://stackoverflow.com/comment/35500780
downvote count: 1
has comment: http://stackoverflow.com/comment/35500686
type: Question
score: 3
accepted answer: http://stackoverflow.com/a/23207578
tagged with: java
upvote count: 4
has comment: http://stackoverflow.com/comment/35500558
has comment: http://stackoverflow.com/comment/35500602
answer count: 2
has comment: http://stackoverflow.com/comment/35500549
has comment: http://stackoverflow.com/comment/35500645
favorite count: 0
has title: In Java, what exactly constitutes as "initializing a local variable"?
possible better answer: http://stackoverflow.com/a/23207633
has answer: http://stackoverflow.com/a/23207633
has answer: http://stackoverflow.com/a/23207578
has body: say I have a piece of code in a local method int a = 5, b; and then some code to indirectly initialize B such as if (true) b = 5; // legal if (someBool) b = 10; else b = 7; // legal if (false) b = 5; // illegal illegal even though B will always be initialized if (a &gt; 10) b = 4; if (a &lt;= 10) b = 4; My question is what are all of the exact circumstances in which a local variable can be legitimately considered "initialized"?
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35500572

http://stackoverflow.com/q/23218097
answer count: 4
possible better answer: http://stackoverflow.com/a/23218194
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23218194
has title: Cannot find JAVA_HOME in Red Hat Server
type: Question
has answer: http://stackoverflow.com/a/23593702
tagged with: java
has answer: http://stackoverflow.com/a/23218161
tagged with: rhel
has body: I'm trying to find the location where JAVA_HOME env variale is set up and I tried to find in ~/.bash_profile , ~/.bashrc and /etc/profile but could not find the env variable. But when I run echo $JAVA_HOME its gives out the value /usr/local/java. Where else would the JAVA_HOME env variable. BTW its a Red Hat Linux Server.
score: 0
has answer: http://stackoverflow.com/a/23226342
accepted answer: http://stackoverflow.com/a/23218161
tagged with: redhat

http://stackoverflow.com/comment/35594625
type: AnswerComment
has text: @PowerofMerlin if you want more help ask another question, or message me.
type: Comment
comment on: http://stackoverflow.com/a/23200025
score: 0

http://stackoverflow.com/comment/35611570
comment on: http://stackoverflow.com/a/23269269
type: AnswerComment
has text: @shkschneider I deleted it but how do i pass a context to Database details=new Database(mContext); to make it work ?
score: 0
type: Comment

http://stackoverflow.com/a/23153481
downvote count: 0
has comment: http://stackoverflow.com/comment/35404277
has comment: http://stackoverflow.com/comment/35404115
score: 3
has body: I don't understand why you are catching the exception in the first place. Can you not throw the JSONException and let the caller deal with the error?
has comment: http://stackoverflow.com/comment/35404241
upvote count: 3
answers question: http://stackoverflow.com/q/23153413
type: Answer
has comment: http://stackoverflow.com/comment/35404329

http://stackoverflow.com/comment/35490117
has text: Are you using ^ to mean to the power of? Assuming your string example intentionally uses only 1 and 0 then your answer is almost certainly going to be 1. Unless you have your first number as 0, then it will be 0
type: Comment
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/23202128

http://stackoverflow.com/comment/35500441
type: Comment
type: QuestionComment
has text: By the way, you don't need the System.exit in the end in this case.
comment on: http://stackoverflow.com/q/23185909
score: 0

http://stackoverflow.com/comment/35635914
type: Comment
comment on: http://stackoverflow.com/a/23281749
score: 0
type: AnswerComment
has text: Using the latest code with the `\/`s, I still get: `java.lang.ClassNotFoundException: https:..github.com.nrubin29.cubesorte.blob.gh-pages.cubesorter.me.nrubin29.cubesorter.Viewer.class?raw=true`. Note that I am using IntelliJ and testing this locally at http://localhost:63342/CubeSorter%20Web/index.html. Is that the issue?

http://stackoverflow.com/q/23216546
type: UnansweredQuestion
has body: I'm using spring security 3.1.4 and I have the following question: I have 2 web apps one is an "admin" and the other for "users". The admin calls the other using controllers. I would like that this communication will use spring security, we thought of the option to create a special "login" controller in the user app for the admin and create a special "admin user" with all the authentication information (login name, password , role..) and every time I want to communicate from the admin app I would use this controller. Is this a valid and common solution?
has comment: http://stackoverflow.com/comment/35517666
has comment: http://stackoverflow.com/comment/35521915
tagged with: spring
tagged with: spring-mvc
answer count: 0
downvote count: 0
has comment: http://stackoverflow.com/comment/35517226
score: 1
has comment: http://stackoverflow.com/comment/35517455
type: Question
tagged with: java
has title: Spring security between web apps- NOT SSO
linked to: http://stackoverflow.com/q/14121810
has comment: http://stackoverflow.com/comment/35517956
upvote count: 1
tagged with: spring-security
favorite count: 0

http://stackoverflow.com/a/23196929
has comment: http://stackoverflow.com/comment/35487101
has comment: http://stackoverflow.com/comment/35480917
has body: When you spy an object, you completely replace the implementation of the method(s) which you've defined a mock behavior for. So, as you noted in the question, this would not work. One trick around this is to extract an additionalBehavior() method, and test it only, without spying or mocking: public class Base { public void say() { System.out.println("Base"); // some work in the base class additionalBehavior(); } protected void additionalBehavior() { // No implementation. Alternatively - make it abstract } } public class Derived extends Base { @Override protected void additionalBehavior() { System.out.println("Derived"); // some additional work in the derived class } } public class DerivedTest { @Test public void testAdditionalBehavior() { Derived obj = new Derived(); obj.additioanlBehavior(); // assert that "Derived" was the output } }
downvote count: 0
type: Answer
score: 3
upvote count: 3
answers question: http://stackoverflow.com/q/23196456

http://stackoverflow.com/a/23157568
type: Answer
has body: I don't think the problem with the or in this Hibernate query, apart from a possible logic issue with the order of precedence between OR and AND. From your query text, we deduce that what you probably wanted is: ... where opt.idQuestion=5 and ( opt.content='Other' or opt.content='Others' ) I believe Hibernate will also allow you to write this as: ... where opt.idQuestion=5 and opt.content in ('Other','Others') Are you saying that if you remove this portion: "or opt.content='Others'" from the query text, then the query works. But when you add that back in to the query, Hibernate is throwing a java.lang.NullPointerException ? Sweeeeet.
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/23156988
answers question: http://stackoverflow.com/q/23156988
upvote count: 1
type: AcceptedAnswer

http://stackoverflow.com/q/23264480
has answer: http://stackoverflow.com/a/23264885
has answer: http://stackoverflow.com/a/23264959
has comment: http://stackoverflow.com/comment/35602744
score: 0
has comment: http://stackoverflow.com/comment/35602855
has body: Is it OK to use the this keyword in a final instance variable declaration/initialization in Java? Like this: private final SomeClass foo = new SomeClass(this); It worked when I tried it out. And since it is not a static variable I guess it should be referring to a particular instance. But I felt unsure if it is advisable or not so therefore I wanted to ask here. Edit: The main class is an Android Activity class, and the SomeClass-instance needs this Activity as Context.
has answer: http://stackoverflow.com/a/23264629
has answer: http://stackoverflow.com/a/23264619
has comment: http://stackoverflow.com/comment/35602395
possible better answer: http://stackoverflow.com/a/23264629
tagged with: android
answer count: 4
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35602470
has title: Is it ok to use 'this' in final instance variable declaration?
tagged with: final
tagged with: java
accepted answer: http://stackoverflow.com/a/23264885
type: Question
has comment: http://stackoverflow.com/comment/35602457

http://stackoverflow.com/comment/35728384
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23185905
has text: Are you sure new 14.04 requires a minimum version of Eclipse? If so, what version are you using that works?
type: AnswerComment

http://stackoverflow.com/comment/35520475
has text: following is my view resolver code public class AppConfig { // Resolve logical view names to .jsp resources in the /WEB-INF/views directory @Bean ViewResolver viewResolver() { InternalResourceViewResolver resolver = new InternalResourceViewResolver(); resolver.setPrefix("WEB-INF/views/"); resolver.setSuffix(".jsp"); return resolver; } }
comment on: http://stackoverflow.com/q/23218842
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23184431
type: AnsweredQuestion
score: 3
has comment: http://stackoverflow.com/comment/35458706
has comment: http://stackoverflow.com/comment/35458708
tagged with: java
type: Question
upvote count: 3
has comment: http://stackoverflow.com/comment/35458705
favorite count: 0
has body: I'm a beginner and I'm doing all the Java exercises on programmingbydoing. I get errors in my code cause I don't know what "symbol" or structure I'm supposed to be using. else if ( age == 18 || 19 || 20 || 21 || 22 || 23 || 24 ) { System.out.println ( "You can vote but not rent a car" + name); }
answer count: 3
accepted answer: http://stackoverflow.com/a/23184432
has comment: http://stackoverflow.com/comment/35458704
has answer: http://stackoverflow.com/a/23233083
has comment: http://stackoverflow.com/comment/35458707
has title: Ages between 18-24, if statement
downvote count: 0
possible better answer: http://stackoverflow.com/a/23184433
has answer: http://stackoverflow.com/a/23184432
has answer: http://stackoverflow.com/a/23184433

http://stackoverflow.com/q/23280931
tagged with: frombodyattribute
linked to: http://stackoverflow.com/q/19167954
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0
has comment: http://stackoverflow.com/comment/35634320
has comment: http://stackoverflow.com/comment/35634865
answer count: 0
has comment: http://stackoverflow.com/comment/35634042
type: UnansweredQuestion
tagged with: url-routing
has comment: http://stackoverflow.com/comment/35674855
has title: How can I pass a bunch of XML to a RESTful method from Android without putting it into the URL?
has comment: http://stackoverflow.com/comment/35634737
downvote count: 0
has comment: http://stackoverflow.com/comment/35634661
score: 1
tagged with: java
has body: I know how to do this in C#, in fact I wrote a tip about it here, but I don't know how to accomplish it in Java/Android. My code is this so far: protected void doInBackground(String... params) { String URLToCall = "http://10.0.2.2:28642/api/DeliveryItems/PostArgsAndXMLFileAsStr"; String result = ""; String stringifiedXML = params[0]; HttpClient httpclient = new DefaultHttpClient(); HttpPost httppost = new HttpPost(URLToCall); List&lt;NameValuePair&gt; nvp = new ArrayList&lt;NameValuePair&gt;(); nvp.add(new BasicNameValuePair("serialNum", "42")); nvp.add(new BasicNameValuePair("siteNum", "Some Site")); try { httppost.setEntity(new UrlEncodedFormEntity(nvp)); HttpResponse response = httpclient.execute(httppost); result = response.toString(); } catch (ClientProtocolException e) { Log.e("ClientProtocolException", e.toString()); } catch (UnsupportedEncodingException uex) { Log.e("UnsupportedEncodingException", uex.toString()); } catch (IOException iox) { Log.e("IOException", iox.toString()); } } The Web API method starts like this: [Route("api/DeliveryItems/PostArgsAndXMLFileAsStr")] public void PostArgsAndXMLFileAsStr([FromBody] string stringifiedXML, string serialNum, string siteNum) { XDocument doc = XDocument.Parse(stringifiedXML); As you can see, I'm passing two (small) vals in the URL (serialNum and siteNum), but how can I pass stringifiedXML (which is fairly large, and would look 17X uglier than a lockerroomful of pimply louts if stuffed into the URL)? The C# client code uses a WebClient, but I don't know if there is an analagous class in Java. UPDATE In response to Affe (hopefully he's not German) and based on what I see here: So are you saying that instead of what I have above, I should set it up like so: String result = ""; String stringifiedXML = params[0]; String serNum = params[1]; String siteNum = params[2]; HttpClient httpclient = new DefaultHttpClient(); HttpPost httppost = new HttpPost(URLToCall); List&lt;NameValuePair&gt; nvp = new ArrayList&lt;NameValu…
type: Question
has comment: http://stackoverflow.com/comment/35635453
has comment: http://stackoverflow.com/comment/35635241
tagged with: rest
upvote count: 1

text-size
tag name: text-size
type: Tag
tags question: http://stackoverflow.com/q/23209656

http://stackoverflow.com/comment/35581747
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/23252982
has text: possible duplicate of [java.lang.ArrayIndexOutOfBoundsException](http://stackoverflow.com/questions/5554734/java-lang-arrayindexoutofboundsexception)
type: Comment

http://stackoverflow.com/comment/62093682
has text: Yes, it is running in Windows .
type: Comment
comment on: http://stackoverflow.com/a/35579151
score: 0
type: AnswerComment

http://stackoverflow.com/comment/35591429
type: QuestionComment
comment on: http://stackoverflow.com/q/23258134
score: 0
has text: words is declared outside of this method. I can edit it for the whole code if necessary its not too long.
type: Comment

http://stackoverflow.com/q/23214623
downvote count: 0
answer count: 1
favorite count: 0
has title: Spring Hateoas - REST clients need have model classes + resource classes
type: UnansweredQuestion
tagged with: spring
has answer: http://stackoverflow.com/a/50535219
has body: We have implemented a RESTful web service using the Spring Hateoas project. This project makes it easy to convert your domain classes to resources that provides "self" links etc. What I find confusing with this approach is that you return resources classes when using GET, but when it comes to do a POST or a PUT you use the domain model. This means that any client using the RESTful API would need to have access to the domain classes + the resource classes (resulting in clients having to add the Hateoas project as a dependency). This approach can be seen in this blog entry. What would be the correct approach here? To only work with resources classes (for POSTs and PUTs as well)? Not each domain class has an matching resource. Take the case where the object graph is more complicated and a resource has a list of child object: public class StoreResource { public String name; public List&lt;Location&gt; children; } The Location object wouldn't have any resource class. For now it looks like we need to provide both the domain classes + existing resource classes to clients.
upvote count: 5
tagged with: java
type: Question
score: 5
tagged with: hateoas

http://stackoverflow.com/comment/46878090
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23137854
has text: refer to my other post here for more details: http://stackoverflow.com/questions/23087782/jboss-not-using-logback-for-logging the answer for that question should give a better explanation
type: AnswerComment

http://stackoverflow.com/a/23156031
upvote count: 2
score: 2
has comment: http://stackoverflow.com/comment/35601748
answers question: http://stackoverflow.com/q/23153750
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23153750
has body: Your method should look like this : public ArrayList&lt;String&gt; getRecords(){ ArrayList&lt;String&gt; data=new ArrayList&lt;String&gt;(); Cursor cursor = db.query(DATABASE_TABLE, new String[]{"column names"},null, null, null, null, null); String fieldToAdd=null; while(cursor.moveToNext()){ fieldToAdd=cursor.getString(0); data.add(fieldToAdd); } cursor.close(); // dont forget to close the cursor after operation done return data; } this method will return all field values from database to arraylist
type: Answer

http://stackoverflow.com/comment/35553106
score: 0
type: AnswerComment
type: Comment
has text: No I don't really care about one mark but this is not the general practice on SO. Whatever answer is correct and posted first is accepted, you are old enough on this forum to realize that. I purposely provided you my regex demo links which has detailed explanations on regex uses on bottom.
comment on: http://stackoverflow.com/a/23236286

http://stackoverflow.com/q/23250334
has title: Cannot make a static reference to a non-static method
tagged with: java
duplicate of: http://stackoverflow.com/q/14744746
tagged with: methods
has comment: http://stackoverflow.com/comment/35576508
has answer: http://stackoverflow.com/a/23250478
type: Question
has comment: http://stackoverflow.com/comment/35576476
has comment: http://stackoverflow.com/comment/35576449
has comment: http://stackoverflow.com/comment/35576534
tagged with: variables
linked to: http://stackoverflow.com/q/14744746
has comment: http://stackoverflow.com/comment/35576780
has comment: http://stackoverflow.com/comment/35577588
answer count: 1
has comment: http://stackoverflow.com/comment/35576468
favorite count: 0
tagged with: var
has body: I have this in my java code, when I try to compile my code I get an error. This happens when I try to get the value of the text in my textview into a var. I cannot understand this error because It works fine in the other method. Why happens this and how can I fix it? public class MainActivity extends Activity { public EditText editText; TextView textView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Toast.makeText(MainActivity.this, "onCreate", Toast.LENGTH_LONG).show(); //setupMessageButton(); editText = (EditText) findViewById(R.id.editText1); textView = (TextView)findViewById(R.id.tvIsConnected); } public void btnDisplayMessage(View view){ //HERE WORKS FINE String missatge = editText.getText().toString(); } public static String POST(String url){ InputStream inputStream = null; String result = ""; //HERE CRASHES String missatge = "red"//editText.getText().toString(); GIVES ERROR String usuario = "foo"; ............ WHY? EDIT: Thanks for downvote my question, Yes, I searched for another similar questions and I've already tried with static method...then don't crash but the content of the var is null and don't work at all.
type: UnansweredQuestion
score: -4
has comment: http://stackoverflow.com/comment/35577883
downvote count: 4
has comment: http://stackoverflow.com/comment/35576579
upvote count: 0

http://stackoverflow.com/comment/35648399
type: QuestionComment
comment on: http://stackoverflow.com/q/23288977
score: 2
has text: At what point in your code are you writing `Command Failed`?!
type: Comment

http://stackoverflow.com/comment/35466971
comment on: http://stackoverflow.com/a/23188565
type: AnswerComment
score: 0
type: Comment
has text: Thanks! So there is no doubt! I must not use JavaFX properties in the model and entity classes! Even in a client application such as mine. There could be several huge problems! I hadn't taken attention that JavaFX properties aren't serializable.

http://stackoverflow.com/comment/35526034
score: 0
type: AnswerComment
has text: Java8: Source says it return an instance of an inner private ArrayList class which extends AbstractList.. private static class ArrayList<E> extends AbstractList<E> implements
type: Comment
comment on: http://stackoverflow.com/a/23222166

http://stackoverflow.com/comment/35529469
type: AnswerComment
score: 0
has text: The `setOnSucceeded(...)` handler is actually executed in the FX Application Thread anyway. You don't need a `Platform.runLater(...)` here.
type: Comment
comment on: http://stackoverflow.com/a/23209401

http://stackoverflow.com/comment/35492881
type: Comment
score: 1
has text: possible duplicate of [Does Java handle exception automatically without using a try and catchblock?](http://stackoverflow.com/questions/12136880/does-java-handle-exception-automatically-without-using-a-try-and-catchblock)
comment on: http://stackoverflow.com/q/23203542
type: QuestionComment

http://stackoverflow.com/a/23262382
answers question: http://stackoverflow.com/q/23262160
type: AcceptedAnswer
score: 52
has comment: http://stackoverflow.com/comment/35599509
upvote count: 52
type: Answer
has body: Clearly you aren't sending the data with ObjectOutputStream: you are just writing the bytes. If you read with readObject() you must write with writeObject(). If you read with readUTF() you must write with writeUTF(). If you read with readXXX() you must write with writeXXX(), for most values of XXX.
has comment: http://stackoverflow.com/comment/93717982
accepted answer of: http://stackoverflow.com/q/23262160
downvote count: 0

http://stackoverflow.com/a/23176026
upvote count: 0
has comment: http://stackoverflow.com/comment/35444575
answers question: http://stackoverflow.com/q/23175941
score: -1
downvote count: 1
type: Answer
has body: You need a main method in your code for it to run, add in something like this public static void main(String [] args){ gerLab(); }

http://stackoverflow.com/q/23143715
has comment: http://stackoverflow.com/comment/35428671
tagged with: listview
score: 0
has comment: http://stackoverflow.com/comment/35414866
has comment: http://stackoverflow.com/comment/35428364
type: UnansweredQuestion
tagged with: android
has body: I have two classes for my translation app. One(Voice.java) in which we speak and RecognizerIntent gets our speech and displays it in form of a list. This is voice.java package com.example.testing; import java.util.ArrayList; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.speech.RecognizerIntent; import android.view.View; import android.view.View.OnClickListener; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.ListView; public class Voice extends Activity implements OnClickListener{ ListView lv; static final int check=1111; @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.voice); lv=(ListView)findViewById(R.id.lvVoiceReturn); Button b=(Button)findViewById(R.id.bVoice); b.setOnClickListener(this); lv.setOnClickListener(this); } @Override public void onClick(View arg0) { // TODO Auto-generated method stub switch(arg0.getId()){ case R.id.bVoice: Intent i=new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH); i.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_FREE_FORM); i.putExtra(RecognizerIntent.EXTRA_PROMPT, "Speak Up"); startActivityForResult(i, check); break; } } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { // TODO Auto-generated method stub if(requestCode == check &amp;&amp; resultCode==RESULT_OK){ ArrayList&lt;String&gt; results=data.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS); lv.setAdapter(new ArrayAdapter&lt;String&gt;(this, android.R.layout.simple_list_item_1,results)); } super.onActivityResult(requestCode, resultCode, data); } } And another class TranslateActivity which has one button and two edit text. Button works as translator of text from 1st edit text to translated text in second edit Text and speaks the translated text also . Code is as follows: package com.example.te…
answer count: 0
tagged with: java
has title: Set OnclickListener For ListView Such that line selected in list is used as edit text in another class
tagged with: eclipse
type: Question
has comment: http://stackoverflow.com/comment/35428491
has comment: http://stackoverflow.com/comment/35471834

http://stackoverflow.com/q/23246912
has comment: http://stackoverflow.com/comment/35571148
has comment: http://stackoverflow.com/comment/35571058
has comment: http://stackoverflow.com/comment/35571494
downvote count: 0
has comment: http://stackoverflow.com/comment/35570675
score: 54
has title: Could not autowire org.springframework.mail.javamail.JavaMailSender
favorite count: 0
has comment: http://stackoverflow.com/comment/35571782
has comment: http://stackoverflow.com/comment/35571254
accepted answer: http://stackoverflow.com/a/23249128
has answer: http://stackoverflow.com/a/64266919
has answer: http://stackoverflow.com/a/62513071
upvote count: 54
has answer: http://stackoverflow.com/a/23247096
has answer: http://stackoverflow.com/a/66536336
answer count: 9
has answer: http://stackoverflow.com/a/42268693
has comment: http://stackoverflow.com/comment/35573208
has answer: http://stackoverflow.com/a/39397065
has body: I got the following problem when trying to run my application. Have debugged everything and still nothing. The IDE is finding the bean without any issue so I'm very confused as to what is happening here. SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mailManager': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire method: public void com.testmail.app.service.implement.CustomMManagerService.setMailSender(org.springframework.mail.javamail.JavaMailSender); nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [org.springframework.mail.javamail.JavaMailSender] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {} My bean generation is located in following file: @Configuration @EnableWebMvc @ComponentScan(basePackages = "com.testmail.app") public class WebConfig extends WebMvcConfigurerAdapter { //CODE CODE CODE @Bean public JavaMailSenderImpl mailSender() { JavaMailSenderImpl javaMailSender = new JavaMailSenderImpl(); javaMailSender.setProtocol("SMTP"); javaMailSender.setHost("127.0.0.1"); javaMailSender.setPort(25); return javaMailSender; } // CODE CODE CODE } Code for CustomMManager: public interface CustomMManager extends Serializable { void sendMail(String mailFrom,String mailTo,String subject,String mailBody); } Finally the code for CustomMManagerService: @Service("mailManager") public class CustomMManagerService implements CustomMManager { private JavaMailSender mailSender; @Autowired public void setMailSender(JavaMailSender mailSender) { this.mailSender = mailSender; } @Override public void sendMail(final String mailFrom, final String mailTo, final String subject, fin…
has answer: http://stackoverflow.com/a/60996645
tagged with: spring
has answer: http://stackoverflow.com/a/54851622
has comment: http://stackoverflow.com/comment/35571936
tagged with: spring-mvc
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23249128
possible better answer: http://stackoverflow.com/a/39397065
tagged with: java
has comment: http://stackoverflow.com/comment/35570471
type: Question

http://stackoverflow.com/q/23262496
tagged with: android
has body: I am triying to implement serializable in java but i obtain an excepcion. This is my serializable class: public class Serialize implements java.io.Serializable { private static final long serialVersionUID = 1L; public double dis1; public double dis2; public double error1; public double error2; public double coorx; public double coory; public double coorz; } And this when i create object of this class and try to convert to bytes. Serialize serial = new Serialize(); serial.dis1 = dis1; serial.dis2 = dis2; serial.error1 = error1; serial.error2 = error2; serial.coorx = coorx; serial.coory = coory; serial.coorz = coorz; byte[] bytes = null; int length = 0; try { ByteArrayOutputStream bs = new ByteArrayOutputStream(); ObjectOutputStream os = new ObjectOutputStream(bs); os.writeObject(serial); ///EXCEPCION os.close(); bytes = bs.toByteArray(); length = bytes.length; } catch (IOException e) { e.printStackTrace(); } What am i doing wrong? Logcat: 04-24 09:15:29.734: W/System.err(4279): java.io.NotSerializableException: org.gradiant.sistole.locservice.Communication 04-24 09:15:29.734: W/System.err(4279): at java.io.ObjectOutputStream.writeNewObject(ObjectOutputStream.java:1364) 04-24 09:15:29.734: W/System.err(4279): at java.io.ObjectOutputStream.writeObjectInternal(ObjectOutputStream.java:1671) 04-24 09:15:29.734: W/System.err(4279): at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1517) 04-24 09:15:29.734: W/System.err(4279): at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1481) 04-24 09:15:29.734: W/System.err(4279): at java.io.ObjectOutputStream.writeFieldValues(ObjectOutputStream.java:979) 04-24 09:15:29.734: W/System.err(4279): at java.io.ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java:368) 04-24 09:15:29.734: W/System.err(4279): at java.io.ObjectOutputStream.writeHierarchy(ObjectOutputStream.java:1074) 04-24 09:15:29.734: W/System.err(4279): at java.io.ObjectOutputStream.writeNewObject(ObjectOutputStream.java:1404) 04-24…
tagged with: java
has comment: http://stackoverflow.com/comment/35599126
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/35598825
has comment: http://stackoverflow.com/comment/35598903
has comment: http://stackoverflow.com/comment/35599780
has title: Problems with serializable java
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/35598958
score: 1
has answer: http://stackoverflow.com/a/23262705
favorite count: 0
tagged with: serialization
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35600029

http://stackoverflow.com/a/23260727
answers question: http://stackoverflow.com/q/23256685
has body: If I were you I would just @Autowire the existing DataSource, downcast as necessary, and then set the extra property. It can be dangerous up do that for some beans (if they initialize themselves from their properties), but I doubt if that will be a problem here.
type: Answer
downvote count: 0
score: 1
upvote count: 1

http://stackoverflow.com/q/23162535
has answer: http://stackoverflow.com/a/23162796
tagged with: java
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35421952
has comment: http://stackoverflow.com/comment/35420953
accepted answer: http://stackoverflow.com/a/23162796
score: 0
has comment: http://stackoverflow.com/comment/35421110
answer count: 1
has comment: http://stackoverflow.com/comment/35421076
tagged with: android
has title: At what frequency do you send user interaction data to the server?
has body: Lets consider Tinder, where users can like/dislike other persons. A user session can consist out of 0 likes/dislikes or 100s of them. I was wondering when and how do you send this like/dislike data to the server? I thought of some ways to do it but i would like to have some experts opinion on this topic. An webservice call for every like/dislike (inefficient, and resource consuming) Grouping the calls per 10-50 like/dislike or when the user exits the app. Sending all when the user exists (No internet?, retry?) I have some experience in java/android but i would like to know more on this topic, thanks in advance!

http://stackoverflow.com/comment/35505855
type: QuestionComment
comment on: http://stackoverflow.com/q/23210603
has text: *"When I am open a file that is added to recent menu in the file, but when I click the added path of recent menu it will opened."* Wait ..what? I don't understand that combination of words. Please try describing in other words: a) What you expected to happen b) What actually happened, and for utility c) Why you expected (a) to happen.
score: 2
type: Comment

http://stackoverflow.com/comment/35450655
type: QuestionComment
has text: You can't get that exception when you write. You can get it when you read, but as you aren't reading the filename from the server anywhere, I don't see how you can be getting the exception from this code at all. Nor how it can possibly be expected to work.
comment on: http://stackoverflow.com/q/23179066
score: 0
type: Comment

http://stackoverflow.com/comment/35507902
type: Comment
has text: i have a lot of email sending in my app. it works in the other modules of my email sending but it doesn't work in this one.. btw. this module is forgotpassword.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/23210366

http://stackoverflow.com/comment/124406659
type: AnswerComment
comment on: http://stackoverflow.com/a/52033799
type: Comment
score: 1
has text: @RDD At the same path where you executed the command

http://stackoverflow.com/q/23164192
has comment: http://stackoverflow.com/comment/35424029
answer count: 1
has answer: http://stackoverflow.com/a/23171036
has body: I found this difference confused me Initially, I wanted to calculate the number of records in the reducer by accumulating 1 in each step, the code is as follows: The input pair is &lt;Text, DoubleWritable&gt; and all the records has the same key "one". There are 160000 records public void reduce(Text key, Iterator&lt;DoubleWritable&gt; values, OutputCollector&lt;Text, DoubleWritable&gt; output, Reporter reporter) throws IOException { double count = 0; while(values.hasNext()){ count = count + 1; } output.collect(new Text("Count"), new DoubleWritable(count)); } The output is 22 After I change the input of reducer to &lt;Text, Text&gt;, The key value is the same for all records "one", and the value is "1" The code becomes: public void reduce(Text key, Iterator&lt;Text&gt; values, OutputCollector&lt;Text, DoubleWritable&gt; output, Reporter reporter) throws IOException { double count = 0; String s = ""; while(values.hasNext()){ s = values.next().toString(); count = count + Integer.parseInt(s); } output.collect(new Text("Count"), new DoubleWritable(count)); } Now the answer is right: 160000 It seems like the number of iterations of while loop should be the same in each case. Why are the results different?
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35424457
accepted answer: http://stackoverflow.com/a/23171036
type: Question
tagged with: java
has title: Hadoop results confusion
has comment: http://stackoverflow.com/comment/35434811
tagged with: mapreduce
tagged with: hadoop
score: 0

http://stackoverflow.com/q/23158435
has comment: http://stackoverflow.com/comment/35413072
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/35413133
has answer: http://stackoverflow.com/a/23160241
has body: I'm having trouble with a condition inside a while loop failing to evaluate. I am trying to perform an operator once every 1/60th of a second. The following code does not print out "Done" every 1/60th of a second, it only prints every few seconds. I've checked that the delta time is fine (about 2E-6 to 5E-6 on my computer). So, I'm not sure why the code within the if statement is not occurring every 1/60th of a second. float p_dt = 1.f/60.f; float u_time = 0.f; while (true) { float t_ft = serverClock.restart().asSeconds(); //Gets the delta time u_time += t_ft; if( u_time &gt; p_dt ) { System.out.println("Done"); u_time = 0; } } Edit: In terms of I/O speed, I don't think this is the issue. "Done" is only being printed out every 3-5 seconds, so it seems like there's a bigger issue here. Additionally, in my actual program there are some other things being evaluated in the condition. Finally, if I add print statements before the condition to keep track of u_time, it prints out 60 "Done"s per second. I don't think that it's an I/O issue because the function called inside the condition is only being called every 3-5 seconds, just like the print statement. Also, serverClock is a JSFML Clock object, an OpenGL wrapper with other system tools.
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35413481
tagged with: conditional-statements
tagged with: java
tagged with: loops
has comment: http://stackoverflow.com/comment/35424601
has answer: http://stackoverflow.com/a/23158953
type: Question
has title: Java condition in while loop fails to evaluate
has comment: http://stackoverflow.com/comment/35415930

jformattedtextfield
tags question: http://stackoverflow.com/q/23134329
tag name: jformattedtextfield
type: Tag

http://stackoverflow.com/a/23145992
downvote count: 0
answers question: http://stackoverflow.com/q/23145947
type: Answer
has body: You did not remove chars, just replace them. Try this: String letter = "l"; data = data.replace(letter, "");
upvote count: 3
score: 3

http://stackoverflow.com/comment/35578105
comment on: http://stackoverflow.com/q/23250887
score: 0
type: Comment
has text: @ams but that's the expected behavior of `@DirtiesContext`, you should put it on those tests that will dirt the context (in this case, Test1). Apart from this, you should use [`CopyOnWriteArrayList`](http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/CopyOnWriteArrayList.html) instead of technically deprecated `Vector` for handling concurrency operations in your List.
type: QuestionComment

http://stackoverflow.com/comment/35523454
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23220753
has text: The error dialog shown on winxp machine does not have this info about the applet, on win 7 it has the correct info. I'm not the developer of this applet. and it is not signed by me. Is there a way I can add **Caller-Allowable-Codebase** in the manifest without having to resign the applet?

http://stackoverflow.com/q/23288991
has answer: http://stackoverflow.com/a/27300208
has comment: http://stackoverflow.com/comment/35648875
has answer: http://stackoverflow.com/a/35811532
tagged with: eclipse
has comment: http://stackoverflow.com/comment/35648818
has comment: http://stackoverflow.com/comment/35648825
has answer: http://stackoverflow.com/a/26206806
has answer: http://stackoverflow.com/a/24870500
downvote count: 0
tagged with: tomcat
favorite count: 0
has answer: http://stackoverflow.com/a/31462362
upvote count: 8
has comment: http://stackoverflow.com/comment/35648687
type: UnansweredQuestion
has body: I was working on my web application in eclipse with Tomcat v7.0, and everything was fine. But today suddenly I can't run my poject on server anymore. I do as usual: Right click on my project->Run As->Run on Server and then choose to run it on my Tomcat server, but I get this error: 'Publishing to Tomcat v7.0 Server at localhost...' has encountered a problem Removing obsolete files from server... Could not clean server of obsolete files: Premature end of file. Premature end of file. Does anyone know what should I do please? web.xml: <?xml version="1.0" encoding="UTF-8"?> LinkedIn login.jsp
has comment: http://stackoverflow.com/comment/35648870
has answer: http://stackoverflow.com/a/32370552
has comment: http://stackoverflow.com/comment/35648512
has comment: http://stackoverflow.com/comment/35648731
has comment: http://stackoverflow.com/comment/35648685
has comment: http://stackoverflow.com/comment/35649065
has comment: http://stackoverflow.com/comment/35648776
tagged with: java
has comment: http://stackoverflow.com/comment/35650261
type: Question
answer count: 8
score: 8
has answer: http://stackoverflow.com/a/53860820
has title: Tomcat v7.0 stopped to run my project at localhost
has answer: http://stackoverflow.com/a/31087689

http://stackoverflow.com/comment/35434965
has text: Why do I get -1 if I downvote an answer? i found an answer that is wrong as most of the people mentioned. I don't understand this behaviour.. :|
comment on: http://stackoverflow.com/q/23170448
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/q/23170118
favorite count: 0
tagged with: netbeans
has title: JavaFX tab is missing from Netbeans 8.0's Java Platform Manager
type: AnsweredQuestion
downvote count: 0
score: 1
has body: When I follow the step in https://netbeans.org/kb/73/java/javafx-setup.html#create-platform-manual, I expect I will be getting a JavaFX tab However, what I'm getting from latest Netbeans 8 is The JavaFX tab is missing! I can see jfxrt.jar at C:\Program Files\Java\jdk1.7.0_51\jre\lib. Is there any workaround I can do?
tagged with: java
tagged with: javafx
type: Question
accepted answer: http://stackoverflow.com/a/23173801
has answer: http://stackoverflow.com/a/23173801
answer count: 2
upvote count: 1
possible better answer: http://stackoverflow.com/a/23170333
has answer: http://stackoverflow.com/a/23170333

http://stackoverflow.com/q/23173304
has title: Java - How to split strings based on certain length ?
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/23173455
has answer: http://stackoverflow.com/a/23173455
score: 0
tagged with: c-strings
tagged with: android
accepted answer: http://stackoverflow.com/a/23173341
has body: I want to split this number based on length : 11101204 . Like Division would be 111. Division2=01,Division3=2,Divison 4=04; i.e., 111, 01 , 12, 04 ...I want it to be split in this way and if the number has only 3 numbers then Division should be 111 and rest should be null How can I achieve this ? Many Thanks !
has comment: http://stackoverflow.com/comment/35439745
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/23173341
tagged with: substring

http://stackoverflow.com/comment/35395400
has text: @user3507894 you haven't understood. You copy pasted the code that i posted on your previous post. That is your problem
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23147977

http://stackoverflow.com/comment/35376508
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23137177
has text: t1 will decrement and 1 will be returned. t2 decrements and 0 will be returned. Only one thread will be `== 0`. There are no race conditions @wmorrison365 unless you call `refCt.get()` again.
type: AnswerComment

http://stackoverflow.com/q/23165748
has title: Java Key Press Event
tagged with: java
has answer: http://stackoverflow.com/a/23165939
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/23165758
has body: I am trying to create a Bengali Keyboard using Java Swing. I am accessing key press event and replacing a particular character with relevant Bengali character. The problem I am getting is the original English character is still appending at the end. How to stop it? Here is the code. public void keyPressed(KeyEvent e) { if(e.getKeyCode() == 54) { textField.setText(textField.getText()+(char)2433); } if(e.getKeyCode() == 65) { textField.setText(textField.getText()+(char)2438); } } The output is coming like "আa", should be only "আ". Thanks in advance. Here is the full Code: import javax.swing.*; import java.awt.*; import java.awt.event.*; public class Phonetic extends JFrame { public Phonetic() { setTitle("AntaryƒÅmƒ´"); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); getContentPane().setLayout(null); textField = new JTextField(); textField.setFont(new Font("Mukti Narrow", Font.PLAIN, 20)); textField.setBounds(12, 33, 614, 383); getContentPane().add(textField); textField.setColumns(10); textField.addKeyListener(new KeyListener() { @Override public void keyPressed(KeyEvent e) { if(e.getKeyCode() == 54) { textField.setText(textField.getText()+(char)2433); } if(e.getKeyCode() == 65) { textField.setText(textField.getText()+(char)2438); } } @Override public void keyTyped(KeyEvent e) { } @Override public void keyReleased(KeyEvent e) { } }); this.setSize(650, 450); this.show(); } /** * */ private static final long serialVersionUID = 1L; private JTextField textField; public static void main(String args[]) { new Phonetic(); } }
type: UnansweredQuestion
tagged with: swing
type: Question

http://stackoverflow.com/a/23194251
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/23193920
score: 1
accepted answer of: http://stackoverflow.com/q/23193920
has comment: http://stackoverflow.com/comment/44165143
has body: There is no support at this time, but there is an experimental branch by Saad Mufti that should work. It depends upon modified version of Metrics and I think this is one of the main reasons why it hasn't been merged yet.

http://stackoverflow.com/a/23263251
has comment: http://stackoverflow.com/comment/35600362
upvote count: 5
has comment: http://stackoverflow.com/comment/35600182
accepted answer of: http://stackoverflow.com/q/23263180
type: Answer
has comment: http://stackoverflow.com/comment/35600229
has body: A couple of issues there. First, you need a space before the WHERE: result = stat.executeUpdate("SELECT username,password FROM DB" + "WHERE (username = '"+loginusr.getText()+"',password = '"+loginpwd.getText()+"')"); // Here ---------------------------------------------------------^ But the more fundamental issue is that you've left that code wide open to SQL injection attacks and failures. Use PreparedStatement, don't concatenate strings to put your parameters in. Here's a nice illustration of why: From: http://xkcd.com/327/ And finally: It's not best practice to store passwords in a database. Instead, typically you store a cryptographic hash of the password, not the password itself (SHA-256 is one hashing technique, for instance). Then when the user is authenticating, you hash what they gave you as their password and compare it with the hash you have stored. That way, the password cannot be retrieved from the database.
answers question: http://stackoverflow.com/q/23263180
downvote count: 0
score: 5
has comment: http://stackoverflow.com/comment/35600176
type: AcceptedAnswer

http://stackoverflow.com/comment/35624818
type: QuestionComment
has text: I am assuming he will use these other variables so he can re-map user controls from a settings file or through the app itself
comment on: http://stackoverflow.com/q/23275840
score: 0
type: Comment

http://stackoverflow.com/comment/35536370
type: Comment
comment on: http://stackoverflow.com/a/23227623
has text: i'm only following what's written in the tutorial link
type: AnswerComment
score: 0

http://stackoverflow.com/a/23192239
answers question: http://stackoverflow.com/q/23192196
score: 1
has body: According to public int delete (String table, String whereClause, String[] whereArgs), where the second argument is a where clause, you should use database.delete(SQLHelper.TABLE_TRANSACTION, String.format("%s=?", SQLHelper.COLUMN_TRANSNAME), {transName});
downvote count: 0
type: Answer
upvote count: 1

http://stackoverflow.com/a/23308138
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23228214
type: Answer
score: 6
upvote count: 6
has body: use that library https://github.com/xgc1986/ParallaxPagerLibrary, it's very easy to use, and it worked for me demo
answers question: http://stackoverflow.com/q/23228214
type: AcceptedAnswer

http://stackoverflow.com/comment/35439081
score: 0
comment on: http://stackoverflow.com/q/23160278
has text: I've added some background information to the question, not sure if I can use Expando for that, but I will try.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35499985
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23207222
has text: @Jesus If he's using an assembler, the value will be added to the constant pool automatically.
score: 0

http://stackoverflow.com/q/23194120
possible better answer: http://stackoverflow.com/a/23194160
type: Question
has answer: http://stackoverflow.com/a/23194160
score: 1
tagged with: java
answer count: 3
has answer: http://stackoverflow.com/a/23194157
downvote count: 0
tagged with: number-formatting
has body: I've been working on this for hours and can't find a solution... When I use this code: NumberFormat currencyFormatter = NumberFormat.getCurrencyInstance(Locale.US); System.out.println(currencyFormatter.format(12385748375889879879894375893475984.03)); It gives me the output: $12,385,748,375,889,900,000,000,000,000,000,000.00 What's the problem?? I'm giving it a double value which should be able to contain a number much much larger than what I'm supplying, but it's giving me all these useless zeros... Does anyone know why and what I can do to fix it?
favorite count: 0
tagged with: currency
tagged with: android
has answer: http://stackoverflow.com/a/23194298
accepted answer: http://stackoverflow.com/a/23194157
type: AnsweredQuestion
has title: NumberFormat.getCurrencyInstance() turning everything to zero?
upvote count: 1

http://stackoverflow.com/comment/35665868
type: Comment
has text: When mouse is over divider, I shall resize left component to show file browser. And when file browser loses focus I hide this left component.
comment on: http://stackoverflow.com/a/23253123
type: AnswerComment
score: 0

http://stackoverflow.com/comment/35385859
has text: Oh, I see. Then I would just need to change System.out.println(i); to print rndNum instead.
type: AnswerComment
comment on: http://stackoverflow.com/a/23142488
score: 0
type: Comment

http://stackoverflow.com/a/23262158
has comment: http://stackoverflow.com/comment/35600231
score: 1
upvote count: 1
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/35603294
accepted answer of: http://stackoverflow.com/q/23261317
type: Answer
answers question: http://stackoverflow.com/q/23261317
has body: We can use the following regex (count only ' not preceded by "). \bAND\b(?=(?:(?:[^']*[^'"]'){2})*[^']*$) Debuggex Demo
has comment: http://stackoverflow.com/comment/35599989

http://stackoverflow.com/comment/35391011
type: QuestionComment
type: Comment
has text: @AnubianNoob, I don't understand how this helps with the size calculation.
comment on: http://stackoverflow.com/q/23145439
score: 0

http://stackoverflow.com/q/23214105
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23214803
score: 1
has title: how to bind field to foreign key in bean vaadin
tagged with: java
tagged with: vaadin
upvote count: 1
type: Question
has body: I have my bean as this public class RegistrationEntity { private Long accountNumber; private String firstName; private String middleName; private String lastName; // occupation entity is another table private OccupationEntity occupationEntity; } components are like this firstName = new TextField("First Name"); firstName.setRequired(true); firstName.setWidth(COMMON_FIELD_WIDTH); lastName = new TextField("Last Name"); lastName.setRequired(true); lastName.setWidth(COMMON_FIELD_WIDTH); occupation = new NativeSelect("Occupation:"); occupation.setRequired(true); occupation.setImmediate(true); occupation.setWidth(COMMON_FIELD_WIDTH); occupation.setNullSelectionItemId("--Select--"); occupation.addItem("Static"); as long as firstName and lastName are considered can be binded like this fieldgroup.bind(firstName,"firstName"); but how can I bind occupation NativeSelect to occupationEntity ?????
tagged with: frameworks
answer count: 1
downvote count: 0
tagged with: web
favorite count: 0

http://stackoverflow.com/comment/35639017
has text: "_my IDE does not like the above_" If you get errors/exceptions, please post them in your question.
score: 1
comment on: http://stackoverflow.com/q/23283655
type: QuestionComment
type: Comment

http://stackoverflow.com/a/23163781
score: 0
has comment: http://stackoverflow.com/comment/35423406
answers question: http://stackoverflow.com/q/23163578
type: Answer
has comment: http://stackoverflow.com/comment/35423230
has body: Why are you using a SOAP service? SOAP services don't work that way, in your particular case is more suitable a Rest service or just a plain servlet

http://stackoverflow.com/a/23223747
answers question: http://stackoverflow.com/q/23223579
type: Answer
score: 2
upvote count: 2
accepted answer of: http://stackoverflow.com/q/23223579
has comment: http://stackoverflow.com/comment/35529120
type: AcceptedAnswer
downvote count: 0
has body: Set the responseField variable to be a JTextArea instead of JTextField: a JTextField contains, by definition, only one line.

http://stackoverflow.com/comment/35640502
type: Comment
type: QuestionComment
score: 0
has text: @meera try to change if (resultCode == 1) to if (resultCode == RESULT_OK)
comment on: http://stackoverflow.com/q/23284367

http://stackoverflow.com/comment/35458434
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23184275
score: 2
has text: Please post the logcat output so we can pinpoint the problem. Without a logcat we can only guess what the problem might be.

http://stackoverflow.com/q/23184503
has title: find average of a matrix in java
linked to: http://stackoverflow.com/q/14345426
type: Question
score: 0
answer count: 2
has body: How to find average of each 8 element in a 2D-matrix(5×5) and replace it in element number(9) ? in java programming (OOP) in frist code should be like this and For example : (source: 0zz0.com)
tagged with: arrays
has comment: http://stackoverflow.com/comment/35458955
favorite count: 0
has comment: http://stackoverflow.com/comment/35458877
has comment: http://stackoverflow.com/comment/35459236
has answer: http://stackoverflow.com/a/23185133
accepted answer: http://stackoverflow.com/a/23185133
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/35458962
has answer: http://stackoverflow.com/a/23184767
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/35459910
possible better answer: http://stackoverflow.com/a/23184767

http://stackoverflow.com/comment/35561752
type: Comment
type: QuestionComment
score: 2
has text: Please give context -- where is this value, is it part of another statement, does it come from an Excel spreadsheet or something translated from Urdu or what? Assume we don't know your situation.
comment on: http://stackoverflow.com/q/23242000

http://stackoverflow.com/q/23267017
has comment: http://stackoverflow.com/comment/35614929
type: UnansweredQuestion
upvote count: 1
has comment: http://stackoverflow.com/comment/35606932
has comment: http://stackoverflow.com/comment/35607167
linked to: http://stackoverflow.com/q/14663346
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/23267811
has body: I want to convert a webpage into an HTML page programatically. I searched many sites but only providing details like converting into pdf format etc. For my program now I'm saving a page as .html and then extracting the necessary data. Is there any way to convert the webpage to an html page? Can anyone help me? Any help would be appreciated. Well I can explain in detail I am extracting the names of users who like a page which i'm admin of . So I found a link https://www.facebook.com/browse/?type=page_fans&amp;page_id=pageid where i can find the list of users. So for getting it first of all i have to save it as a .html page and then extract necessary data. So here I'm converting it into .html and then extract the data. But what I need is that convert that page into an HTML page using my program. I hope my question is clear now
has comment: http://stackoverflow.com/comment/35615342
type: Question
has comment: http://stackoverflow.com/comment/35606985
answer count: 2
has comment: http://stackoverflow.com/comment/35614961
has answer: http://stackoverflow.com/a/23271105
downvote count: 0
has comment: http://stackoverflow.com/comment/35606900
has title: Converting webpage into HTML
favorite count: 0
has comment: http://stackoverflow.com/comment/35607235
tagged with: http://stackoverflow.com/tag/html

http://stackoverflow.com/q/23238859
answer count: 1
has answer: http://stackoverflow.com/a/23245416
type: UnansweredQuestion
tagged with: google-app-engine
has title: GAE Datastore Entity relationship
tagged with: java
type: Question
has body: To make entity relationship we put a parent Key (parent relationship) or put a Key into a Entity property (child relationship). Like this: Key resultingKey = KeyFactory.createKey(parent, kind, key); Entity userEntity = new Entity(resultingKey); // parent Entity oldAddress = new Entity(KeyFactory.createKey(e.getKey, "Address", userEntity.getOldAddress.getId())); userEntity.setProperty("oldAddress", oldAddress.getKey()); // child However the question would be, for a parent Key, does the key should be a product of a Datastore put: Key resultingKey = _ds.put(parentEntity); Or creating a Key with KeyFactory is enough? Furthermore, does this apply also for child Key?
tagged with: google-cloud-datastore
score: 0

http://stackoverflow.com/comment/35458789
score: 3
has text: Add some details to your answer, explaining what was the problem in above code and how did you solved it. It will help others in understanding
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23178044

http://stackoverflow.com/comment/128773874
comment on: http://stackoverflow.com/a/56806107
has text: As of spring boot 2.7.1, the default settings seem to be not throwing exception but returning a `ResponseEntity` wrapping the error inside.
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/35460571
score: 1
comment on: http://stackoverflow.com/a/23185195
type: AnswerComment
type: Comment
has text: @AliumBritt Yes. By putting the type in front you are declaring a new variable. When you declar a variable in a method its scope is limited to that method. Since your local variable is named the same as your instance variable it "hides" the instance variable.

http://stackoverflow.com/comment/35520719
comment on: http://stackoverflow.com/q/23204876
score: 0
has text: @AlexK That issue was useful, but unless I'm missing something, It doesn't explain how to actually access and set those parameters in Java.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/50422745
type: Answer
downvote count: 0
score: 1
has body: 1) Replace context with getApplicationContext() button.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(getApplicationContext(),ActivityB.class); startActivity(intent); } }); 2) Replace context with MainActivity.this button.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(MainActivity.this,ActivityB.class); startActivity(intent); } }); Hope it will help you!
answers question: http://stackoverflow.com/q/23179795
upvote count: 1

http://stackoverflow.com/a/23266303
upvote count: 1
has body: How are you creating your logger in the class? If I try static Logger log = Logger.getLogger(MyMain.class.getName()); Output 15:58:13.861 INFO com.pkg1.MyMain - something I get the package name in the log output. However the following code just prints the class name. static Logger log = Logger.getLogger("pkg1.MyMain"); Output: 15:57:33.814 INFO pkg1.MyMain - something
answers question: http://stackoverflow.com/q/23265657
downvote count: 0
has comment: http://stackoverflow.com/comment/35617235
has comment: http://stackoverflow.com/comment/35612274
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/35605956

http://stackoverflow.com/q/23228822
score: 3
has comment: http://stackoverflow.com/comment/35538449
tagged with: java
has comment: http://stackoverflow.com/comment/35538493
has body: Suppose that a method I own is sometimes called on the Event Dispatch Thread and is sometimes not. Now suppose some of the code in that method I want to have called on a thread other than the Event Dispatch Thread. Is there a way to run some code on a thread other than the EDT at this point? I tried this: if (SwingUtilities.isEventDispatchThread()) { new Runnable() { @Override public void run() { myMethod(); } }.run(); } else { myMethod(); } But myMethod() ended up running on the EDT even when I created a new Runnable. Is there a way to run myMethod() on a thread other than the EDT at this point?
accepted answer: http://stackoverflow.com/a/23228928
downvote count: 0
answer count: 1
favorite count: 0
tagged with: awt-eventqueue
has title: On Event Dispatch Thread---want to get off of it
type: AnsweredQuestion
tagged with: event-dispatch-thread
has answer: http://stackoverflow.com/a/23228928
upvote count: 3
tagged with: multithreading
type: Question

jframe
tags question: http://stackoverflow.com/q/23234594
tags question: http://stackoverflow.com/q/23175408
tags question: http://stackoverflow.com/q/23209125
tags question: http://stackoverflow.com/q/23178563
tags question: http://stackoverflow.com/q/23225885
tags question: http://stackoverflow.com/q/23225389
tag name: jframe
tags question: http://stackoverflow.com/q/23220858
tags question: http://stackoverflow.com/q/23174748
tags question: http://stackoverflow.com/q/23257590
tags question: http://stackoverflow.com/q/23147888
tags question: http://stackoverflow.com/q/23207440
tags question: http://stackoverflow.com/q/23210052
tags question: http://stackoverflow.com/q/23211737
tags question: http://stackoverflow.com/q/23206079
tags question: http://stackoverflow.com/q/23221528
tags question: http://stackoverflow.com/q/23203392
tags question: http://stackoverflow.com/q/23206309
tags question: http://stackoverflow.com/q/23288050
tags question: http://stackoverflow.com/q/23208530
tags question: http://stackoverflow.com/q/23243153
tags question: http://stackoverflow.com/q/23280267
tags question: http://stackoverflow.com/q/23224480
tags question: http://stackoverflow.com/q/23169495
tags question: http://stackoverflow.com/q/23226170
tags question: http://stackoverflow.com/q/23185180
tags question: http://stackoverflow.com/q/23208346
tags question: http://stackoverflow.com/q/23283726
tags question: http://stackoverflow.com/q/23203688
tags question: http://stackoverflow.com/q/23290189
tags question: http://stackoverflow.com/q/23143132
tags question: http://stackoverflow.com/q/23191427
tags question: http://stackoverflow.com/q/23249114
tags question: http://stackoverflow.com/q/23188165
tags question: http://stackoverflow.com/q/23281531
tags question: http://stackoverflow.com/q/23191116
tags question: http://stackoverflow.com/q/23273313
tags question: http://stackoverflow.com/q/23170144
tags question: http://stackoverflow.com/q/23175212
type: Tag
tags question: http://stackoverflow.com/q/23143268
tags question: http://stackoverflow.com/q/23213388
tags question: http://stackoverflow.com/q/23204473
tags question: http://stackoverflow.com/q/23176633
tags question: http://stackoverflow.com/q/23153772

http://stackoverflow.com/comment/35437178
type: AnswerComment
score: 0
has text: I suggest you to read this for more infos about generics (as it's hard to tell all the benefits here): http://docs.oracle.com/javase/tutorial/java/generics/index.html
type: Comment
comment on: http://stackoverflow.com/a/23171547

http://stackoverflow.com/comment/35435439
has text: I'm working from JavaScript Box2D version but as far as I know functions with the exact same name do the same thing in every implementation
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23170816

wifi
tag name: wifi
type: Tag
tags question: http://stackoverflow.com/q/23176129

http://stackoverflow.com/a/23278954
has comment: http://stackoverflow.com/comment/35631138
has body: To make the painting dynamic you need to get the current width/height of the panel. public void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2d = (Graphics2D) g; //g2d.drawOval(0, 0, 50, 50); g2d.drawOval(0, 0, getWidth(), getHeight()); } You also need the super.paintComponent(g) to clear the background of the panel. Edit: Actually, I took a closer look at your code and it does nothing. A JFrame does not have a paintComponent() method so your code will never be executed. Also, you create a panel but then don't do anything with it. Start by reading the section from the Swing tutorial on Custom Painting for more information and working examples. Then you can modify the example from the tutorial to draw your oval, using the suggestion give above.
has comment: http://stackoverflow.com/comment/35631035
score: 2
downvote count: 0
upvote count: 2
answers question: http://stackoverflow.com/q/23278903
type: Answer

http://stackoverflow.com/q/23171226
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: gson
tagged with: error-handling
type: Question
has body: I send some data to my server and get a response. In case there was an error the response is a class instance: { errorCode (int), errorMsg (String) } In a success case the response is an items array. I have tried to run the following code and got an error: code: private void afterServerOfferResponse(final Gson gson, String result) { ServerErrorMessage serverErrorMessage = gson.fromJson( result, ServerErrorMessage.class); if (serverErrorMessage.errorCode == 0) { Type collectionType = new TypeToken&lt;ArrayList&lt;Offer&gt;&gt;() { }.getType(); mOffersList = gson.fromJson(result, collectionType); mAdapter = new ImageAdapter(OffersListActivity.this, mOffersList); mListView.setAdapter(mAdapter); error: com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was BEGIN_ARRAY at line 1 column 2 how would you check for an error case without changing the server response too much?
has title: how gson can identify between a class instance and an array?
score: 0
answer count: 1
tagged with: android
has answer: http://stackoverflow.com/a/23171322
accepted answer: http://stackoverflow.com/a/23171322
type: AnsweredQuestion

http://stackoverflow.com/a/23193607
accepted answer of: http://stackoverflow.com/q/23193502
type: Answer
has body: Use FontMetrics: FontMetrics fm = g.getFontMetrics(); To get width of your text use: fm.stringWidth(text) Then output your text at width / 2 - fm.stringWidth(text) / 2 Where width is a width of your output area.
upvote count: 3
score: 3
answers question: http://stackoverflow.com/q/23193502
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/23240149
tagged with: annotations
has title: Using validation and other annotations on Lombok annotations
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23240463
tagged with: java
type: Question
score: 9
tagged with: lombok
upvote count: 9
downvote count: 0
accepted answer: http://stackoverflow.com/a/23240463
answer count: 1
favorite count: 0
has body: Is it possible to using other annotations on Lombok annotations? Let's say have field Name and want to make sure it's not null when it's set using annotations. Before Lombok public class Person(){ String name; @NotNull public void setName(String newName){ name = newName; } } After Lombok public class Person(){ @NotNull @Setter String name; } I know it's very simple example but is something like this possible?

http://stackoverflow.com/comment/35485389
comment on: http://stackoverflow.com/q/23199609
has text: And what do you call "hex representation" exactly?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23223075
has comment: http://stackoverflow.com/comment/35527648
has comment: http://stackoverflow.com/comment/35527625
type: Question
accepted answer: http://stackoverflow.com/a/23223103
tagged with: vector
has body: I want to have a vector of integer pairs in Java so I can store Cartesian coordinates in each cell. So it would look like : |2,3|4,5|5,6|6,7| Each cell of the vector has 2 ints. I tried doing this: Vector&lt;pair&lt;Integer,Integer&gt;&gt; test = new Vector&lt;pair&lt;Integer,Integer&gt;&gt;(); But java could not resolve the word pair (even when I did ctrl+shift+O in eclipse to import all relevant libraries). Then I tried this: Vector&lt;pair&lt;int,int&gt;&gt; test= new Vector&lt;pair&lt;int,int&gt;&gt;(); But it doesn't like the keyword int for some reason. Any ideas on how to make a vector of int pairs in Java?
has answer: http://stackoverflow.com/a/51047085
has comment: http://stackoverflow.com/comment/35527694
downvote count: 0
score: 1
favorite count: 0
tagged with: integer
has answer: http://stackoverflow.com/a/23223103
has answer: http://stackoverflow.com/a/23223133
has title: Java Vector of Int Pair
upvote count: 1
linked to: http://stackoverflow.com/q/4777622
answer count: 4
has comment: http://stackoverflow.com/comment/35527686
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/23223133
has answer: http://stackoverflow.com/a/50683992
tagged with: java
has comment: http://stackoverflow.com/comment/35527952
tagged with: eclipse

http://stackoverflow.com/q/23283987
tagged with: jsp
tagged with: jquery
tagged with: ajax
has comment: http://stackoverflow.com/comment/35639630
answer count: 1
has title: Jquery Ajax call servlet not successful
has answer: http://stackoverflow.com/a/23285403
score: 0
has comment: http://stackoverflow.com/comment/35639470
type: AnsweredQuestion
tagged with: java
has body: Here is my servlet code @WebServlet("/write") public class write extends HttpServlet { private static final long serialVersionUID = 1L; /** * @see HttpServlet#HttpServlet() */ public write() { super(); // TODO Auto-generated constructor stub } /** * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub } /** * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) */ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String name = request.getParameter("name"); String price = request.getParameter("price"); String description = request.getParameter("description"); System.out.println(name+price+description); } Here is my ajax jquery $( document ).ready(function() { var mydata = $("#update").serialize(); $("#update").submit(fuction(){ $.ajax({ url: 'write', data: mydata, type: 'POST', success: function(data){ $(#success).show(); } }); return false; }); }); Here is my form Name Price Description After I click the submit button, from url I can see admin.jsp?name=sasa&price=sasasa&description=sasasasa But result shown nothing in console, seems my jquery never call my servlet, I don't know why PS: I'm using eclipse with tomcat server
accepted answer: http://stackoverflow.com/a/23285403
has comment: http://stackoverflow.com/comment/35639521
tagged with: servlets
type: Question
has comment: http://stackoverflow.com/comment/35641295

http://stackoverflow.com/a/23138721
has comment: http://stackoverflow.com/comment/64999414
has body: There are two ways to solve this problem. Load all the fragments together. for this use pager.setOffscreenPageLimit(numberOfFragments); immediate after setting the adapter to viepager. Remove the code from onCreate() to onCreateView() As when you swipe through the viewpager, fragment is reloaded and its OncreateView() is called.
downvote count: 0
has comment: http://stackoverflow.com/comment/35379038
has comment: http://stackoverflow.com/comment/35379171
has comment: http://stackoverflow.com/comment/35379410
type: AcceptedAnswer
upvote count: 2
accepted answer of: http://stackoverflow.com/q/23138613
type: Answer
has comment: http://stackoverflow.com/comment/35379460
answers question: http://stackoverflow.com/q/23138613
score: 2

http://stackoverflow.com/comment/35615167
type: AnswerComment
type: Comment
score: 1
comment on: http://stackoverflow.com/a/23262127
has text: @xploreraj - The key thing is that there is no overwriting/polymorphism on static methods. So B.add is simply providing access to A.add. So the only lock would be on A.

http://stackoverflow.com/a/23211081
answers question: http://stackoverflow.com/q/23211034
type: Answer
score: 2
downvote count: 0
has body: initialize id ,quiz1, quiz2, quiz3 with idStudent like this int[] id = new int[idStudent]; double[] quiz1 = new double[idStudent]; double[] quiz2 = new double[idStudent]; double[] quiz3 = new double[idStudent]; the reason for that error is you declaring array with zero size. you can't insert element to an array with zero size
upvote count: 2

http://stackoverflow.com/comment/35433427
type: Comment
type: QuestionComment
has text: What about Expando Classes?
score: 0
comment on: http://stackoverflow.com/q/23160278

http://stackoverflow.com/q/23245257
downvote count: 0
score: 1
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/23247175
has comment: http://stackoverflow.com/comment/35569480
tagged with: class
upvote count: 1
answer count: 1
has body: Considering the code below, it runs without throw any exception. public class Test1 { public static int k = 0; public static Test1 t1 = new Test1("t1"); public static Test1 t2 = new Test1("t2"); public static int i = print("i"); public static int n = 99; public int j = print("j"); { print("constructor block"); } static { print("static block"); } public Test1(String str) { System.out.println((++k) + ":" + str + " i=" + i + " n=" + n); ++i; ++n; } public static int print(String str) { System.out.println((++k) + ":" + str + " i=" + i + " n=" + n); ++n; return ++i; } public static void main(String[] args) { // TODO Auto-generated method stub Test1 t = new Test1("init"); } } output : 1:j i=0 n=0 2:constructor block i=1 n=1 3:t1 i=2 n=2 4:j i=3 n=3 5:constructor block i=4 n=4 6:t2 i=5 n=5 7:i i=6 n=6 8:static block i=7 n=99 9:j i=8 n=100 10:constructor block i=9 n=101 11:init i=10 n=102 I step through it with a debugger. can see the clinit method calls init method. Since the clinit method is still a part of class loading, does this mean we can instantiate Test1 object before the Test1 class is well prepared?
has comment: http://stackoverflow.com/comment/35568061
tagged with: initialization
has comment: http://stackoverflow.com/comment/35568338
has title: why can we use the new operator before the class is loaded
favorite count: 0
accepted answer: http://stackoverflow.com/a/23247175
type: AnsweredQuestion

http://stackoverflow.com/q/23176087
answer count: 1
type: UnansweredQuestion
has body: So what that does is stores random values in the array elements from 31-58 and then total them up and average them and then I simply display them out. My question is: How can I take the days array which is used to give a day to every random number from 31-58 (28days in the month of february) and store it to a second array (weekday[]).So that at the very end of the program I can display the day name if I wanted. and My code looks like.(this is just a snipped) double [] anArray = new double[366];//Keep track of all the days in the year String [] weekday = new String[366];//I hope to store the day names in this array String days[]={"monday","tuesday","wednesday","thursday", "friday","saturday","sunday"}; //---each letter is 0 to start each new month at monday--- int a=0;int b=0;int c=0;int d=0;int e=0;int f=0;int g=0;int h=0;int i=0; int j=0;int k=0;int l=0;//Days counter //--These start at 1 to start each new month on the 1st int jandays=1;int febdays=1;int mardays=1;int aprdays=1;int maydays=1;int jundays=1; int juldays=1;int augdays=1;int septdays=1;int octdays=1;int novdays=1;int decdays=1; //Temperatures for February for(int feb=31;feb &lt;= 58;feb++){ anArray[feb]=(int)(26 + Math.random() * (40-26+1)); //System.out.println(days[b++ %7] + " january "+ (febdays++) +" at "+ anArray[feb]+" degrees"); // This is just testing to see if everything checks out. febtotal += anArray[feb]; } febavg= febtotal/31; System.out.printf("The Average temperature in February: "+"%.2f",febavg); System.out.println(""); Hell what I'm asking for is actually kinda confusing me o.o.
has answer: http://stackoverflow.com/a/23176291
tagged with: java
tagged with: loops
type: Question
tagged with: arrays
score: 0
has title: Store contents from an array into another array

bufferedimage
tags question: http://stackoverflow.com/q/23180059
tags question: http://stackoverflow.com/q/23201348
tag name: bufferedimage
tags question: http://stackoverflow.com/q/23278448
tags question: http://stackoverflow.com/q/23289387
tags question: http://stackoverflow.com/q/23236054
type: Tag
tags question: http://stackoverflow.com/q/23165512

http://stackoverflow.com/comment/35601507
type: Comment
has text: Could you please share the screenshot once?
comment on: http://stackoverflow.com/a/23243184
score: 0
type: AnswerComment

http://stackoverflow.com/a/23270500
has body: Definitely not. Strictly abstract methods are not defined, but need to be in child classes. When you override a method, you can still call it on super, so it exists (being not strictly abstract).
type: Answer
answers question: http://stackoverflow.com/q/23270459
score: 0

http://stackoverflow.com/a/23237452
has body: This link may help .. you have to provide multiprt form data .. http://www.journaldev.com/2122/servlet-3-file-upload-using-multipartconfig-annotation-and-part-interface
answers question: http://stackoverflow.com/q/23237359
score: 0
type: Answer

http://stackoverflow.com/comment/35458488
type: QuestionComment
comment on: http://stackoverflow.com/q/23184274
score: 0
type: Comment
has text: yes....its a spring example

hadoop
tags question: http://stackoverflow.com/q/23266974
tags question: http://stackoverflow.com/q/23178695
tags question: http://stackoverflow.com/q/23219225
tags question: http://stackoverflow.com/q/23277853
tags question: http://stackoverflow.com/q/23245930
tags question: http://stackoverflow.com/q/23256629
tags question: http://stackoverflow.com/q/23152312
tag name: hadoop
tags question: http://stackoverflow.com/q/23255182
tags question: http://stackoverflow.com/q/23135444
tags question: http://stackoverflow.com/q/23197729
tags question: http://stackoverflow.com/q/23270237
tags question: http://stackoverflow.com/q/23129896
tags question: http://stackoverflow.com/q/23208506
type: Tag
tags question: http://stackoverflow.com/q/23275414
tags question: http://stackoverflow.com/q/23200361
tags question: http://stackoverflow.com/q/23263727
tags question: http://stackoverflow.com/q/23186353
tags question: http://stackoverflow.com/q/23246968
tags question: http://stackoverflow.com/q/23185598
tags question: http://stackoverflow.com/q/23163876
tags question: http://stackoverflow.com/q/23156749
tags question: http://stackoverflow.com/q/23131527
tags question: http://stackoverflow.com/q/23171131
tags question: http://stackoverflow.com/q/23150072
tags question: http://stackoverflow.com/q/23152550
tags question: http://stackoverflow.com/q/23188536
tags question: http://stackoverflow.com/q/23139066
tags question: http://stackoverflow.com/q/23219089
tags question: http://stackoverflow.com/q/23195254
tags question: http://stackoverflow.com/q/23143297
tags question: http://stackoverflow.com/q/23284054
tags question: http://stackoverflow.com/q/23231428
tags question: http://stackoverflow.com/q/23188745
tags question: http://stackoverflow.com/q/23191027
tags question: http://stackoverflow.com/q/23192136
tags question: http://stackoverflow.com/q/23190746
tags question: http://stackoverflow.com/q/23266148
tags question: http://stackoverflow.com/q/23164192
tags question: http://stackoverflow.com/q/23155028
tags question: http://stackoverflow.com/q/23168400
tags question: http://stackoverflow.com/q/23279091
tags question: http://stackoverflow.com/q/23209703
tags question: http://stackoverflow.com/q/23256347
tags question: http://stackoverflow.com/q/23172682

http://stackoverflow.com/comment/35643440
type: QuestionComment
comment on: http://stackoverflow.com/q/23285450
has text: What's so complicated? It's just a grid in fact with some gaps
score: 1
type: Comment

http://stackoverflow.com/q/23272077
has answer: http://stackoverflow.com/a/23272372
has comment: http://stackoverflow.com/comment/35617183
score: 0
accepted answer: http://stackoverflow.com/a/23272372
tagged with: sqlite
answer count: 1
has body: I have a list of players that can be added to an event. I would like to select a list of players not already on the events list. The Query I have is: stmt.executeQuery("SELECT PLAYER_NO,FIRST_NAME,SURNAME," + "EMAIL,PHONE_NO FROM PLAYER" + "WHERE NOT EXISTS(SELECT PLAYER_NO FROM EVENT_PLAYER_LIST " + "WHERE EVENT_NO = "+eventKey+" &amp; " + "EVENT_PLAYER_LIST.PLAYER_NO = PLAYER.PLAYER_NO);"); Can anyone spot the problem or tell me how to go about this? Here are the two tables evolved: String sql = " CREATE TABLE IF NOT EXISTS EVENT_PLAYER_LIST" + " (EVENT_NO INT NOT NULL," + " PLAYER_NO INT NOT NULL," + " ACTIVE INT," + " TIME_ENROLLED CHAR(50)," + " WINS INT," + " LOSES INT," + " DRAWS INT," + " PRIMARY KEY (EVENT_NO, PLAYER_NO))"; String sql = " CREATE TABLE IF NOT EXISTS PLAYER" + " (PLAYER_NO INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL," + " FIRST_NAME CHAR(50) NOT NULL," + " SURNAME CHAR(50) NOT NULL," + " DOB CHAR(50)," + " CLUB CHAR(50)," + " EMAIL CHAR(120)," + " PHONE_NO CHAR(50))"; If I have several players added to an event they all still show up on the list of players except the first one.
has title: SQLite Select when value is not on another table
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/35616748
type: Question
has comment: http://stackoverflow.com/comment/35616944
has comment: http://stackoverflow.com/comment/35616667
has comment: http://stackoverflow.com/comment/35616606

http://stackoverflow.com/q/23180051
has comment: http://stackoverflow.com/comment/35451686
score: 0
tagged with: invoke
has comment: http://stackoverflow.com/comment/35452134
answer count: 1
has comment: http://stackoverflow.com/comment/35451991
has comment: http://stackoverflow.com/comment/35452055
has body: I'm trying to run a Python program from within Java using the following statement Process p = Runtime.getRuntime().exec("python " + file); Where file is a string "c:\user\test.py" It throws me an exception Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified I made sure my system variable has an entry pointing to my python home directory. please help
tagged with: python
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35451700
has comment: http://stackoverflow.com/comment/35452181
has answer: http://stackoverflow.com/a/23180622
tagged with: java
has comment: http://stackoverflow.com/comment/35451680
has title: invoking python compiler from within java
type: Question
has comment: http://stackoverflow.com/comment/35451725
accepted answer: http://stackoverflow.com/a/23180622

http://stackoverflow.com/comment/35640570
score: 0
comment on: http://stackoverflow.com/q/23284443
type: Comment
type: QuestionComment
has text: And Take Look at this u can have Solution from this i am sure. http://www.mkyong.com/regular-expressions/how-to-validate-email-address-with-regular-expression/

http://stackoverflow.com/q/23208585
has answer: http://stackoverflow.com/a/23208647
has answer: http://stackoverflow.com/a/23208760
type: Question
possible better answer: http://stackoverflow.com/a/23208808
score: 1
has comment: http://stackoverflow.com/comment/35502376
has answer: http://stackoverflow.com/a/23208618
upvote count: 1
has title: Remove all null array values before sorting
tagged with: java
answer count: 5
accepted answer: http://stackoverflow.com/a/23208618
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23208649
has body: I have been getting some errors. My array looks like this: String words[] = new String[50000]; The user is asked to input values into the array words[i]=c.readLine(); The program will exit the infinite for loop once duplicated values are inputed. Now the program must sort the array in alphabetical order, yet it is trying to sort some of the null values and returns errors. Arrays.sort(words, String.CASE_INSENSITIVE_ORDER); for (int a = 0; a &lt; words.length; a++) { c.println(words[a]); } This program will work only if the user inputs exactly 50000 values. I am unable to guess how many values the user will input, how do I solve this? I am thinking I have to somehow remove all null values before alphabetically sorting. Any ideas?
tagged with: arrays
downvote count: 0
has answer: http://stackoverflow.com/a/23208808
tagged with: sorting
favorite count: 0

http://stackoverflow.com/a/23264392
downvote count: 0
upvote count: 2
has body: It exceeds Integer.MAX_VALUE because it really does exceed Integer.MAX_VALUE. It's Integer.MAX_VALUE + 1, which you can absolutely calculate in int-space and you can write it down as 0x80000000 or as Integer.MIN_VALUE, but it'll be negative. Which is why parseInt complains. You just can't parse it that way - you can absolutely represent a bitvector with the 32nd bit set with an int. The "sign bit" (which is a misleading name, but we seem to be stuck with it) is just a normal bit like any other bit. Its special meaning only comes into play for: converting to/from String converting to a wider or floating point type division and remainder right shift, see &gt;&gt; vs &gt;&gt;&gt; comparisons except equality, for example 1 &gt; 0x80000000. You can compare long x and y as if they were unsigned with (x ^ Long.MIN_VALUE) &lt; (y ^ Long.MIN_VALUE) (for int you can cast to long and mask with 0xffffffffL of course) The "sign bit" is just an other bit without special meaning for: addition and subtraction bitwise operations (including left shift) multiplication equality testing converting to a narrower type If you're interpreting your int as a bitvector, the "sign bit" will just be a normal bit, but you must take care that all the operations you do on it agree on that.
type: Answer
score: 2
answers question: http://stackoverflow.com/q/23259194

http://stackoverflow.com/a/23165750
has body: may help : newWTF = new String[inverseNewWords.size()];
type: Answer
answers question: http://stackoverflow.com/q/23165706
score: 0

http://stackoverflow.com/q/23220957
upvote count: 7
has answer: http://stackoverflow.com/a/23222863
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/43780714
score: 7
tagged with: java
accepted answer: http://stackoverflow.com/a/23222863
has title: Can i programatically detect if there are any Chromecast devices on the current WiFi network?
type: Question
has answer: http://stackoverflow.com/a/23222017
downvote count: 0
possible better answer: http://stackoverflow.com/a/23221509
has answer: http://stackoverflow.com/a/23221509
has body: Is it possible to detect if there are any Chromecast devices on the current WiFi network. I've seen that there's a Cast SDK but I couldn't find anything about searching for devices. Having never worked with this SDK before, it is possible that I may have overlooked it.
tagged with: android
has answer: http://stackoverflow.com/a/23454218
favorite count: 0
answer count: 5
tagged with: chromecast

http://stackoverflow.com/comment/35464438
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23187254
has text: I have no idea how to code it to search for a valid match and was hoping to get some insight.

http://stackoverflow.com/comment/35655663
comment on: http://stackoverflow.com/a/23291236
score: 0
type: Comment
has text: Thank you very much for your answer! It helped, but I would like to ask one more question. Would it be possible to create four lists containing only soft references, only weak references, only phantom references and only strong references? That would be just perfect. Do you know how to modify your code to achieve it?
type: AnswerComment

http://stackoverflow.com/a/23167649
type: Answer
downvote count: 0
score: 1
has body: Try this: Date startDate = (Date) data.get("startDate");//2014-04-01 Date endDate = (Date) data.get("endDate");//2014-04-30 int pagesize=10; String query = "select * from bill_details " + " where status=? " + " AND date(add_date) BETWEEN ? AND ?" + " order by add_date desc limit ?"; ps = con.prepareStatement(query); ps.setString(1, dataStatus); ps.setDate(2, startDate); ps.setDate(3, endDate); ps.setInt(4, pagesize); System.out.println("Before execution"); res = ps.executeQuery();
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23167501
upvote count: 1
answers question: http://stackoverflow.com/q/23167501
has comment: http://stackoverflow.com/comment/35429902

http://stackoverflow.com/comment/35513442
type: QuestionComment
has text: Seems like bubble sort http://en.wikipedia.org/wiki/Bubble_sort
comment on: http://stackoverflow.com/q/23215026
score: 0
type: Comment

http://stackoverflow.com/a/23213682
has body: What's MySQL's role in this project? MySQL is the database: where the data is stored. That's what its role is. You typically don't need to "export" anything to MySQL from your project. Rather, you set up the JPA configuration file with the backend database settings (database type, hostname, account name, logical database name, etc), and the JPA provider (for example Hibernate) takes care of creating the necessary tables and indexes in your backend database.
upvote count: 1
score: 1
accepted answer of: http://stackoverflow.com/q/23213579
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23213579
type: Answer

http://stackoverflow.com/comment/35443968
score: 0
type: AnswerComment
has text: I was looking for the same preg_replace_callback() style implementation, since I know PHP very well, but this seems way too complicated at this time and I also implemented the solution I marked as an answer. Thank you for your effort anyway. I would have preffered the regex style, but it is what it is for now. Good to know for the future.
type: Comment
comment on: http://stackoverflow.com/a/23175113

http://stackoverflow.com/q/23248943
has answer: http://stackoverflow.com/a/23249150
downvote count: 0
has answer: http://stackoverflow.com/a/23249094
linked to: http://stackoverflow.com/q/3819794
favorite count: 0
has title: Instantiation of a class with only private constructor from another class in groovy
has comment: http://stackoverflow.com/comment/35574251
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/4005700
tagged with: java
possible better answer: http://stackoverflow.com/a/23249094
type: Question
linked to: http://stackoverflow.com/q/7852370
upvote count: 5
accepted answer: http://stackoverflow.com/a/23249150
tagged with: access-modifiers
answer count: 2
score: 5
tagged with: groovy
has body: I have scenario like following where there's a World class with only a private constructor and another class App. As shown in code, a new instance of World can be created inside App class despite of only private constructor in World. It is prohibited in Java and I thought it is prohibited in groovy too, but the App run without any error. // World.groovy class World { private World() { } } // App.groovy class App { static void main(String[] args) { def world = new World() println world } I couldn't understand how it is possible in groovy. How can another class instantiate a class with only private constructor in groovy?

http://stackoverflow.com/a/23256469
has body: Possible your source file is using Windows style line feeds. Try using the program dos2unix to fix the line feeds and try recompiling. I'd also have to see the complete source file to help further, I'm assuming you have the imports at the top of the file.
score: 0
has comment: http://stackoverflow.com/comment/35589878
type: Answer
answers question: http://stackoverflow.com/q/23256428

http://stackoverflow.com/comment/35418288
has text: I tried `word.length() - word.replaceAll(" ","").length();` but it didn't work. I got the error `java.lang.ArrayIndexOutOfBoundsException`
type: Comment
comment on: http://stackoverflow.com/a/23157574
score: 0
type: AnswerComment

http://stackoverflow.com/a/23281327
score: 0
answers question: http://stackoverflow.com/q/23281206
has body: You should prepare a string: String sortedNumbersOutput = ""; for (int i = 0; i &lt; sortedNumbers.size(); i++) { sortedNumbersOutput += sortedNumbers.get(i) + (i != sortedNumbers.size() - 1 ? "," : ""); } Output2.setText("Sorted Numbers " + sortedNumbersOutput ); On a separate note, I don't believe you are sorting your list... You are comparing on the indices and not the values at those indices. Maybe you want to try: boolean changes = true; int temp; while (changes) { changes = false; for (int i = 0; i &lt; Numbers.size()-1; i++){ if (Numbers.get(i) &gt; Numbers.get(i+1)) { temp = Numbers.get(i); Numbers.set(i, Numbers.get(i+1)); Numbers.set(i+1, temp); changes = true; } } } which is called a bubble sort
type: Answer

http://stackoverflow.com/comment/35668694
comment on: http://stackoverflow.com/a/23290838
type: AnswerComment
has text: Two synchronized blocks (on the same object monitor) can't be running at the same time. It's not possible.
score: 0
type: Comment

http://stackoverflow.com/a/23207173
accepted answer of: http://stackoverflow.com/q/23206667
answers question: http://stackoverflow.com/q/23206667
upvote count: 2
has body: This should work for getting the encrypted number. Think how to handle the missing zero(s) public static int encrypt(int number){ int temp = number; int digit4 = (temp + 7) % 10; temp = temp / 10; int digit3 = (temp + 7) % 10; temp = temp / 10; int digit2 = (temp + 7) % 10; temp = temp / 10; int digit1 = (temp + 7) % 10; return (digit3 * 1000 + digit4 * 100 + digit1 * 10 + digit2); }
type: AcceptedAnswer
type: Answer
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/35500105

http://stackoverflow.com/comment/118298700
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23255122
has text: Please use `logging.config` instead of `logback.configurationFile`
score: 1

http://stackoverflow.com/comment/35536896
comment on: http://stackoverflow.com/a/23226651
has text: You can do the same and use `select c, person from ...` or just `select person from ...`. Just don't expect a country's persons not to contain all the country's persons.
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/23139364
tagged with: android
has comment: http://stackoverflow.com/comment/35379808
has answer: http://stackoverflow.com/a/23139464
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/35380462
tagged with: eclipse
type: Question
has body: I'm trying to populate a listview with some data from json. Here are the errors I am getting: 04-17 12:54:25.573: E/JSON Parser(1169): Error parsing data org.json.JSONException: of type org.json.JSONArray cannot be converted to JSONObject 04-17 12:54:26.223: E/AndroidRuntime(1169): FATAL EXCEPTION: main 04-17 12:54:26.223: E/AndroidRuntime(1169): Process: com.example.mysqltest, PID: 1169 04-17 12:54:26.223: E/AndroidRuntime(1169): java.lang.NullPointerException 04-17 12:54:26.223: E/AndroidRuntime(1169): at com.example.mysqltest.PropertyView$JSONParseP.onPostExecute(PropertyView.java:95) 04-17 12:54:26.223: E/AndroidRuntime(1169): at com.example.mysqltest.PropertyView$JSONParseP.onPostExecute(PropertyView.java:1) 04-17 12:54:26.223: E/AndroidRuntime(1169): at android.os.AsyncTask.finish(AsyncTask.java:632) 04-17 12:54:26.223: E/AndroidRuntime(1169): at android.os.AsyncTask.access$600(AsyncTask.java:177) 04-17 12:54:26.223: E/AndroidRuntime(1169): at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:645) 04-17 12:54:26.223: E/AndroidRuntime(1169): at android.os.Handler.dispatchMessage(Handler.java:102) 04-17 12:54:26.223: E/AndroidRuntime(1169): at android.os.Looper.loop(Looper.java:136) 04-17 12:54:26.223: E/AndroidRuntime(1169): at android.app.ActivityThread.main(ActivityThread.java:5017) 04-17 12:54:26.223: E/AndroidRuntime(1169): at java.lang.reflect.Method.invokeNative(Native Method) 04-17 12:54:26.223: E/AndroidRuntime(1169): at java.lang.reflect.Method.invoke(Method.java:515) 04-17 12:54:26.223: E/AndroidRuntime(1169): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779) 04-17 12:54:26.223: E/AndroidRuntime(1169): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595) 04-17 12:54:26.223: E/AndroidRuntime(1169): at dalvik.system.NativeStart.main(Native Method) Here is my Java file... JSONArray array = null public void onClick(View view) new JSONParseP().execute() private class JSONParseP extends AsyncTask&l…
tagged with: listview
has comment: http://stackoverflow.com/comment/35380039
score: 0
has title: Android java.lang.NullPointerException not able to populate the listview
answer count: 1
type: UnansweredQuestion

http://stackoverflow.com/q/23142915
type: UnansweredQuestion
tagged with: log4j2
score: 0
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has answer: http://stackoverflow.com/a/23143267
type: Question
has title: Log4j2 JSON layout: handling of "\n" (new line character)
has body: I'm using Log4j2 and its JSONLayout to produce logs in JSON format. Everything works fine but when I use Logger.warn(String message, Throwable t) like: l4j2Logger.warn("log1...\n...log2", new Exception("ex1...\n...ex2")); I get in my logs: "message":"log1...\n...log2", "throwable":"java.lang.Exception: ex1...\\n...ex2\\n\tat test.Test.log(Test.java:73)\\n\tat......" In the message key, the \n character is written \n in the log file, but in the throwable key, the \n character is written \\n in the log file. As I need to parse these logs, the JSON parser doesn't like \\n, which seems normal since the JSON specifications indicates that \n shall be used. Here is an extract of my log4j XML configuration file: &lt;Appenders&gt; &lt;File name="FileAppender" fileName="log4j2.log" append="true"&gt; &lt;JSONLayout complete="true" compact="false"/&gt; &lt;/File&gt; &lt;/Appenders&gt; Do you know why Log4j2 is using \\n in throwable, and if/how I can change that? (I'm using Log4j-2.0-RC1, the latest at this time)
answer count: 1

http://stackoverflow.com/comment/35381070
score: 1
comment on: http://stackoverflow.com/q/23140022
type: Comment
type: QuestionComment
has text: Iterate over them and check.

http://stackoverflow.com/comment/35598208
type: Comment
score: 1
has text: Answering one of my questions, I found this helpful: The warning is not just because the compiler does not know that the cast is safe. For example String s = (String) new Object() ; gets no warning, even though the compiler does not know that the cast is safe. The warning is because the compiler (a) does not know that the cast is safe AND (b) will not generate a complete run-time check at the point of the cast. There will be a check that it is a Hashmap, but there will not be a check that it is a HashMap<String,String>. – Theodore Norvell Feb 28 '13 at 16:46
type: AnswerComment
comment on: http://stackoverflow.com/a/23257096

http://stackoverflow.com/a/23154042
score: 0
has comment: http://stackoverflow.com/comment/137060418
type: Answer
has body: maybe youll find this reference guide being usefull
answers question: http://stackoverflow.com/q/23153778

http://stackoverflow.com/a/23269675
has body: One solution that would work for you is the following: @JsonAutoDetect(getterVisibility = JsonAutoDetect.Visibility.NONE) public class Parent { @JsonProperty int id; public void setId(int id) { this.id = id; } } I have to admit that this solution is not terribly elegant since you need to add the @JsonProperty annotation to every field in the Parent class, but does have the benefit that no modifications are needed to any of it's subclasses All the annotations that are present in the jackson library can be found here. The javadoc for @JsonAutoDetectcan be found here
answers question: http://stackoverflow.com/q/23268681
score: 0
type: Answer

http://stackoverflow.com/a/23310458
has body: In fact, there really seemed to be no ready-to-use component. I'n experimenting with dynamic menues which seems to offer the right functionality. But I'm currently fighting with presenting it as cute as possible ... which of course is the real challenge. In the facelet it's nothing more than &lt;p:menu model="#{nachrichtTeaserController.unreadMenu}"/&gt; and the controller looks soemthing like ... private List&lt;Nachricht&gt; unread; private MenuModel unreadMenu; ... public void initUnread() { unread = nachrichtFacade.findAllUnread( personLoginController.getCurrentUser().getMandant(), personLoginController.getCurrentUser()); unreadMenu = new DefaultMenuModel(); Integer menuItemId = 1; for (Nachricht nachricht : unread) { menuItemId++; DefaultMenuItem menuItem = new DefaultMenuItem(nachricht.getTeaserText()); menuItem.setId(menuItemId.toString()); String nachrichtIdString = nachricht.getId().toString(); menuItem.setCommand("#{nachrichtTeaserController.show('" + nachrichtIdString + "')}"); //menuItem.setCommand(String.format("#{nachrichtTeaserController.show('%d')}",unread.indexOf(n))); unreadMenu.addElement(menuItem); } } ... public String show(String nachrichtIdString) { Long nachrichtId = Long.valueOf(nachrichtIdString); Nachricht nachricht = nachrichtFacade.find(nachrichtId); return show(nachricht); } Two points: It's important to use menuItem.setId(menuItemId.toString()); otherwise you'll get an NullPointerexception somewhere deep in PrimeFaces ... and please consider how to do "row selection" - I mean: It's easy to call show() but it's necessary to get some information in show() about which MenuItem was clicked. Unfortunately one cannot pass a reference to the nachricht so I use the primary key.
type: Answer
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/23237705
answers question: http://stackoverflow.com/q/23237705
upvote count: 1
type: AcceptedAnswer

http://stackoverflow.com/a/23175586
has body: He/she may simply be trying to define a role that other classes can play, especially if more classes are added later on. Say you have a Pet interface. You might have a Dog and RoboDog class that both implement that interface later even though they possibly come from different inheritance trees.
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/23175539
type: Answer
upvote count: 1

onpause
tags question: http://stackoverflow.com/q/23183430
type: Tag
tag name: onpause

http://stackoverflow.com/a/23175541
type: Answer
downvote count: 1
upvote count: 0
has body: One problem is with the break statement in onUpdate method. break statement will break a loop or switch statement. In your code, you need be return from the method. So, change the break as return. Other problem is with onUpdate and onReceive method. If while(true) your returning , this will break the loop and return , so that the next statements will not be reached. You need to remove the return statement here or change your logic to return based on any condition. while (true) { return; if ("com.wifiswitch.bestwifiswitch.toggle".equals(str)) { Toggle(paramContext, "com.roundedlabs.widgets.wifi.toggle"); Update(paramContext, AppWidgetManager.getInstance(paramContext), null); }
score: -1
answers question: http://stackoverflow.com/q/23175275

http://stackoverflow.com/a/40798334
downvote count: 0
answers question: http://stackoverflow.com/q/23209872
type: Answer
score: 1
upvote count: 1
has body: Well!Well! Whenever its downloading task,better put code in asynch task with progress dialog.As it takes a little time.So you can do as follows. ==> Put/call your downloading code in doinBackground() part of Async() task. ==> call progressdialog() in preexecute() and postexecute() as follows. ==> In post execute() after mProgressDialog.dismiss(); call openfile() function and write your file opener code in fileopen() function. class MyAsyncTask extends AsyncTask&lt;String, String, Void&gt; { boolean running; @Override protected Void doInBackground(String...fUrl) { int count; InputStream input = null; OutputStream output = null; HttpURLConnection connection = null; try { URL url = new URL(fUrl[0]); connection = (HttpURLConnection) url.openConnection(); connection.connect(); int lenghtOfFile = connection.getContentLength(); // download the file input = connection.getInputStream(); output = new FileOutputStream( Environment.getExternalStorageDirectory() + "/MDroid/" + fileName); //################################# mydownload(fileUrl, filepath, fileName, visibility); //i am calling download function() here //########################################## byte data[] = new byte[4096]; long total = 0; while ((count = input.read(data)) != -1) { total += count; publishProgress(""+(int)((total*100)/lenghtOfFile)); output.write(data, 0, count); } output.close(); input.close(); } catch (Exception e) { e.printStackTrace(); } return null; } @Override protected void onPreExecute() { super.onPreExecute(); running = true; mProgressDialog.show(); } @Override protected void onPostExecute(Void aVoid) { super.onPostExecute(aVoid); mProgressDialog.dismiss(); openfile(); } @Override protected void onProgressUpdate(String... progress) { // Update the progress dialog mProgressDialog.setProgress(Integer.parseInt(progress[0])); } } ==> openfile() function code is something like this. public void openfile() { try { File file = new File(Environment .getExternalStoragePublicDirectory("/MDroid") + fi…

http://stackoverflow.com/q/23264450
favorite count: 0
possible better answer: http://stackoverflow.com/a/23264613
has comment: http://stackoverflow.com/comment/35602296
has answer: http://stackoverflow.com/a/23265548
answer count: 5
has answer: http://stackoverflow.com/a/23264613
has comment: http://stackoverflow.com/comment/35602294
has comment: http://stackoverflow.com/comment/35602257
has answer: http://stackoverflow.com/a/23264865
tagged with: dictionary
has comment: http://stackoverflow.com/comment/35602642
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23264536
has body: I have a Map&lt;Integer,Integer&gt; 1 10 2 10 3 20 5 20 6 11 7 22 How do I find the maximum repeated value of the map? In this case - that is 10 &amp; 20. Repeated count is 2 on both case.
score: 1
tagged with: java
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/35602286
downvote count: 0
has answer: http://stackoverflow.com/a/40464220
has comment: http://stackoverflow.com/comment/35602243
accepted answer: http://stackoverflow.com/a/23264536
has title: Find map value with highest number of occurrences

http://stackoverflow.com/comment/35532353
comment on: http://stackoverflow.com/q/23225151
score: 0
type: Comment
type: QuestionComment
has text: i cant use another buffer, beacuse what you see in the client is action when starting when i'm click on buttom

http://stackoverflow.com/q/23289865
favorite count: 0
tagged with: android
has title: android.view.InflateException: Binary XML file line #52: Error inflating class <unknown>
has comment: http://stackoverflow.com/comment/35653583
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23290269
score: 1
tagged with: java
tagged with: android-intent
has body: i Have Error when i choose ImageButton to get next Activty here the logcat : E/AndroidRuntime(820): FATAL EXCEPTION: main E/AndroidRuntime(820): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.pengendalipagar/com.ta.pengendalipagar.MnUtama}: android.view.InflateException: Binary XML file line #52: Error inflating class <unknown> E/AndroidRuntime(820): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180) E/AndroidRuntime(820): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230) E/AndroidRuntime(820): at android.app.ActivityThread.access$600(ActivityThread.java:141) E/AndroidRuntime(820): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234) E/AndroidRuntime(820): at android.os.Handler.dispatchMessage(Handler.java:99) E/AndroidRuntime(820): at android.os.Looper.loop(Looper.java:137) E/AndroidRuntime(820): at android.app.ActivityThread.main(ActivityThread.java:5041) E/AndroidRuntime(820): at java.lang.reflect.Method.invokeNative(Native Method) E/AndroidRuntime(820): at java.lang.reflect.Method.invoke(Method.java:511) E/AndroidRuntime(820): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793) E/AndroidRuntime(820): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560) E/AndroidRuntime(820): at dalvik.system.NativeStart.main(Native Method) E/AndroidRuntime(820): Caused by: android.view.InflateException: Binary XML file line #52: Error inflating class <unknown> E/AndroidRuntime(820): at android.view.LayoutInflater.createView(LayoutInflater.java:613) E/AndroidRuntime(820): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56) E/AndroidRuntime(820): at android.view.LayoutInflater.onCreateView(LayoutInflater.java:660) E/AndroidRuntime(820): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:685) This is My Code activity1 activity_login.xml : <?xml version="1.0" encoding="utf-8"…
type: Question
has answer: http://stackoverflow.com/a/23290269
tagged with: eclipse
upvote count: 2
answer count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/35649963
tagged with: android-activity

http://stackoverflow.com/comment/136609924
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23279738
has text: Lol we're commenting on a 9-year-old question!
score: 0

http://stackoverflow.com/comment/35401540
type: Comment
has text: Another one, as a row implementation you can create a Custom Class which has Max and Min Degree Direction which returns a Cardinal Direction for given degree (Make a Method for this).
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23151878

http://stackoverflow.com/comment/35429342
type: Comment
has text: I meant the slashes in the string pathnames. On windows, it's two backslashes into the hierarchy, and on UNIX-like platforms it's one forward slash. The package and class names are also equivalent.
comment on: http://stackoverflow.com/a/23167196
score: 0
type: AnswerComment

http://stackoverflow.com/comment/35527522
type: Comment
has text: Oh i saw the problem, you're pasting it on `onCreateView()`, try to override `onViewCreated()` , which is the function executing after the layout is drawn
type: AnswerComment
comment on: http://stackoverflow.com/a/23222855
score: 0

http://stackoverflow.com/a/23239422
upvote count: 2
has comment: http://stackoverflow.com/comment/35641600
score: 2
answers question: http://stackoverflow.com/q/23239087
has comment: http://stackoverflow.com/comment/35559962
downvote count: 0
has body: If you want to do this then create two hidden fields in you jsp and assign the values of them by your java script. Then you submit the page or ajax call pass as querystring to jsp/servlet so you will have such values in jsp/servlet.
type: Answer

http://stackoverflow.com/comment/35466142
comment on: http://stackoverflow.com/q/23188162
score: 0
has text: Thats when I tried with ArrayLists
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23196798
type: Answer
accepted answer of: http://stackoverflow.com/q/23186817
has body: Q1 Does the EntityManager of the surrounding transaction (here em1) see the returned entity as managed or detached? A1 The returned entity is unknown to em1. See the entity as detached. Q2 If the surrounding transaction commits, will there be a OptimisticLock exception, or is the changed version propagated to em1? A2 There is no Exception. It looks like all changes are known to em1, because of the "call by reference". Q2b Will the behaviour be different if the version filed is exposed to the entity (by annotation a field with @Version)? A2b Don't know. My example had the version field exposed.
answers question: http://stackoverflow.com/q/23186817
score: 0
type: AcceptedAnswer

http://stackoverflow.com/comment/35495625
type: Comment
comment on: http://stackoverflow.com/a/23203677
type: AnswerComment
has text: Hi JLRishe, unfortunately this does not work for me. BTW, I have to use JDK1.6.
score: 0

http://stackoverflow.com/a/23156208
has body: It's not showing the scrollbars either, right? Assuming that contentPane is where you want your components, you need to add the RTextScrollPane instance to the contentPane, not the RSyntaxTextArea instance. The Gutter, which displays line numbers, is a part of the RTextScrollPane - an extended JScrollPane. If you don't add a scroll pane to your GUI, it will not be shown, nor will you be able to scroll around. :P So try the following: contentPane.add(sp, BorderLayout.CENTER);
upvote count: 3
accepted answer of: http://stackoverflow.com/q/23153916
score: 3
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23153916
downvote count: 0
type: Answer

http://stackoverflow.com/q/23146845
tagged with: string
has answer: http://stackoverflow.com/a/23146890
linked to: http://stackoverflow.com/q/5603080
type: AnsweredQuestion
tagged with: java
has title: indexOf method of String class in jdk is implemented by using BF, why not use KMP or BM?
accepted answer: http://stackoverflow.com/a/23146890
type: Question
has comment: http://stackoverflow.com/comment/35393536
tagged with: indexof
has body: indexOf method of String class in jdk is implemented by using BF, why not use KMP or BM? Below is how jdk implement this funcion. It use BF to solve. why not use a more efficientive method, such as KMP, BM ? static int indexOf(char[] source, int sourceOffset, int sourceCount, char[] target, int targetOffset, int targetCount, int fromIndex) { if (fromIndex &gt;= sourceCount) { return (targetCount == 0 ? sourceCount : -1); } if (fromIndex &lt; 0) { fromIndex = 0; } if (targetCount == 0) { return fromIndex; } char first = target[targetOffset]; int max = sourceOffset + (sourceCount - targetCount); for (int i = sourceOffset + fromIndex; i &lt;= max; i++) { /* Look for first character. */ if (source[i] != first) { while (++i &lt;= max &amp;&amp; source[i] != first); } /* Found first character, now look at the rest of v2 */ if (i &lt;= max) { int j = i + 1; int end = j + targetCount - 1; for (int k = targetOffset + 1; j &lt; end &amp;&amp; source[j] == target[k]; j++, k++); if (j == end) { /* Found whole string. */ return i - sourceOffset; } } } return -1; }
has comment: http://stackoverflow.com/comment/35393409
score: 0
has comment: http://stackoverflow.com/comment/35393489
answer count: 1

http://stackoverflow.com/comment/35580594
comment on: http://stackoverflow.com/q/23252506
has text: indent, flush, close. Also, stop creating so many references to the same File. It's confusing. Finally, are you sure your count is ever greater then 1?
type: Comment
type: QuestionComment
score: 2

http://stackoverflow.com/q/23204679
downvote count: 1
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23204796
tagged with: java
has body: I want to add 2 buttons to the following code that will let me "FREEZE" and "START" the ball move as it bounces on the window. I've been trying to do this for the last hour but I cant figure this out. I did some work but it mostly crap, if anyone wants please let me know to post it(avoided it in order not to extend my coding). Anyone can help me with this? Open to any suggestions. Thanks import java.awt.*; import javax.swing.*; public class BallMoves extends JPanel implements Runnable { Color color = Color.red; int dia = 30; long delay = 40; private int x = 1; private int y = 1; private int dx = 3; private int dy = 7; protected void paintComponent(Graphics g){ super.paintComponent(g); Graphics2D g2 = (Graphics2D)g; g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g.setColor(color); g.fillOval(x,y,30,30); // adds color to circle g.setColor(Color.red); g2.drawOval(x,y,30,30); // draws circle } public void run() { while(isVisible()) { try { Thread.sleep(delay); } catch(InterruptedException e) { System.out.println("interrupted"); } move(); repaint(); } } public void move() { if(x + dx &lt; 0 || x + dia + dx &gt; getWidth()) { dx *= -1; color = getColor(); } if(y + dy &lt; 0 || y + dia + dy &gt; getHeight()) { dy *= -1; color = getColor(); } x += dx; y += dy; } private Color getColor() { int rval = (int)Math.floor(255); int gval = (int)Math.floor(0); int bval = (int)Math.floor(0); return new Color(rval, gval, bval); } private void start() { while(!isVisible()) { try { Thread.sleep(25); } catch(InterruptedException e) { System.exit(1); } } Thread thread = new Thread(this); thread.setPriority(Thread.NORM_PRIORITY); thread.start(); } public static void main(String[] args) { BallMoves test = new BallMoves(); JFrame f = new JFrame(); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.getContentPane().add(test); f.setSize(400,400); f.setLocation(200,200); f.setVisible(true); test.start(); } } Update version import java.awt.*; import jav…
tagged with: jpanel
has title: How to add a button to freeze and resume the bouncing ball JAVA
type: Question
answer count: 1
has comment: http://stackoverflow.com/comment/35494808
accepted answer: http://stackoverflow.com/a/23204796
favorite count: 0
score: 0
upvote count: 1

http://stackoverflow.com/q/23266866
has body: I try using the parallelStream() in DAO with Spring @Transactional annotations and get so problem: @Transactional public void processCollection(Collection&lt;Object&gt; objects) { objects.parallelStream() .forEach(this::processOne); //throw exception } @Transactional public void processOne(Object o) { ... } Works correct: @Transactional public void processCollection(Collection&lt;Object&gt; objects) { objects.stream() .forEach(this::processOne); //work correctly } @Transactional public void processOne(Object o) { ... } Exception: org.hibernate.HibernateException: No Session found for current thread org.springframework.orm.hibernate4.SpringSessionContext.currentSession(SpringSessionContext.java:106) org.hibernate.internal.SessionFactoryImpl.getCurrentSession(SessionFactoryImpl.java:978) How can I use @Transactional annotated methods by parallelStream()? Update Why this happen Spring transaction manager and multithreading But I hope spring 4 with java 8 support can provide some solution for this. Any ideas?
score: 20
has title: Java .parallelStream() with spring annotated methods
answer count: 2
upvote count: 20
has comment: http://stackoverflow.com/comment/35608155
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/35606812
has comment: http://stackoverflow.com/comment/35609460
has answer: http://stackoverflow.com/a/51107094
has comment: http://stackoverflow.com/comment/35608835
has answer: http://stackoverflow.com/a/23268602
tagged with: spring
tagged with: java-8
has comment: http://stackoverflow.com/comment/35607386
tagged with: java-stream
type: UnansweredQuestion
tagged with: java
tagged with: multithreading
has comment: http://stackoverflow.com/comment/35606883
linked to: http://stackoverflow.com/q/16835974
type: Question

http://stackoverflow.com/a/31622733
has body: Windows-vm "C:\Program Files\Java\jdk1.6.0_07\jre\bin\javaw.exe"
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/23174265
upvote count: 1

http://stackoverflow.com/comment/35484231
score: 0
has text: Possible duplicate of [How do you clear the validation errors in Eclipse?](https://stackoverflow.com/questions/3420536/how-do-you-clear-the-validation-errors-in-eclipse).
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23198995

http://stackoverflow.com/q/23250210
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/35578042
downvote count: 0
has answer: http://stackoverflow.com/a/23251159
answer count: 1
tagged with: vba
tagged with: jsp
score: 1
favorite count: 0
has title: JSP data to be downloaded to Excel sheet using ActiveQuery results in character problems
type: UnansweredQuestion
tagged with: excel
tagged with: java
has body: downloading data using Active query from JSP page with some parameters is leading to character problems. Special characters in the german language as for example, ö, ä, ß are printed as Ã¶, Ã¤ and ÃŸ. Debugging the JSP page in Java shows that the result that is returned by the JSP page is correct. So the problem seems to be due to conversion within excel after download, most probably due to a unsopported charset. I tried to convert the result string in JSP to different charsets, but the problem still persists. Does anyone know a solution? Thank You very much in advance!

http://stackoverflow.com/q/23248673
tagged with: jcombobox
has answer: http://stackoverflow.com/a/23248854
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/23248910
score: 0
tagged with: java
has title: Attaching ActionListener to JComboBox
tagged with: actionlistener
type: UnansweredQuestion
has body: I am working on a program that has several functions that need to happen based on a user selection from a JComboBox. Ideally, the user selection would be pulled out and used in a series of if/else statements to change the necessary values. This is the error I am getting: method addActionListener in class JComboBox&lt;E&gt; cannot be applied to given types; classJComboBox.addActionListener(this); required: ActionListener found: DWTools reason: actual argument DWTools cannot be converted to ActionListener by method invocation conversion where E is a type-variable: E extends Object declared in class JComboBox And here is my code (At the moment, all I have it set to do is put the chosen class in the name JTextField for testing purposes): import java.awt.*; import javax.swing.*; import java.awt.event.*; import java.text.*; import java.util.*; public class DWTools extends JFrame { private String[] classes = { "Bard", "Cleric", "Druid", "Fighter", "Paladin", "Thief", "Ranger", "Wizard" }; public JTabbedPane mainPane; public JPanel basic; public JPanel moves; public JPanel spells; private JLabel nameJLabel; private JLabel classJLabel; private JTextField nameJTextField; private JComboBox classJComboBox; public DWTools() { createUserInterface(); } public void createUserInterface() { Container contentPane = getContentPane(); JPanel topPanel = new JPanel(); topPanel.setLayout(new BorderLayout()); contentPane.add(topPanel); createBasic(); createMoves(); createSpells(); mainPane = new JTabbedPane(); mainPane.addTab("Basic Information", basic); mainPane.addTab("Character Moves", moves); mainPane.addTab("Character Spells", spells); topPanel.add(mainPane, BorderLayout.CENTER); setTitle("Dungeon World Tools"); setSize(500, 500); setVisible(true); } public void createBasic() { basic = new JPanel(); basic.setLayout( null ); JLabel nameJLabel = new JLabel("Name:"); nameJLabel.setBounds(10, 10, 50, 25); basic.add(nameJLabel); JTextField nameJTextField = new JTextField(); nameJTextField.s…

http://stackoverflow.com/comment/35611374
comment on: http://stackoverflow.com/q/23269333
type: Comment
score: 2
has text: What makes you think that it should throw an error?
type: QuestionComment

http://stackoverflow.com/q/23215221
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23216343
tagged with: java
tagged with: http
type: Question
tagged with: mule-el
answer count: 1
tagged with: mule
has body: I am new to Mule and trying to post a GET request using the HTTP endpoint, but I am receiving the following error "Template Endpoint "http://api.mymemory.translated.net:80/get?q=#[message.inboundProperties.get('http.relative.path')]&amp;langpair=EN|IT" resolved into a Malformed endpoint "http://api.mymemory.translated.net:80/get?q=hello&amp;langpair=EN|IT". Failed to route event via endpoint: org.mule.endpoint.DynamicOutboundEndpoint" I have tried the following configurations: get?q=hello&amp;langpair=EN%7CIT [WORKS] get?q=#[message.inboundProperties.get('http.relative.path')]&amp;langpair=EN%7CIT [DOESN'T WORK] get?q=#[message.inboundProperties.get('http.relative.path')]&amp;langpair=EN|IT [DOESN'T WORK] The stack trace seems to indicate that there is a problem with the "|" character. My flow is as follows: &lt;flow name="my_first_projectFlow1" doc:name="my_first_projectFlow1"&gt; &lt;http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8081" doc:name="HTTP"/&gt; &lt;http:outbound-endpoint exchange-pattern="request-response" host="api.mymemory.translated.net" port="80" path="get?q=#[message.inboundProperties.get('http.relative.path')]&amp;amp;langpair=EN%7CIT" method="GET" doc:name="HTTP"/&gt; &lt;echo-component doc:name="Echo"/&gt; &lt;/flow&gt;
score: 0
tagged with: rest
has answer: http://stackoverflow.com/a/23216343
has title: Mule malformed endpoint error

akka
type: Tag
tag name: akka
tags question: http://stackoverflow.com/q/23157784

http://stackoverflow.com/q/23251346
type: Question
answer count: 1
has title: When trying to zip up and compress multiple files, how do you zip using InputStream and return as InputStream?
has comment: http://stackoverflow.com/comment/35578905
score: 0
tagged with: io
has body: I have an excel file that I want to send as an attachment in email as well as a couple other text files, but I want to zip those files for size reasons. How would I go about this using InputStream and returning as InputStream? Any help is much appreciated.
tagged with: http://stackoverflow.com/tag/zip
has answer: http://stackoverflow.com/a/23251955
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35578573
tagged with: java

http://stackoverflow.com/comment/35560047
type: Comment
comment on: http://stackoverflow.com/a/23236199
has text: Oh, ok. But for extra credit maybe you can point out that using a regular expression to parse non-regular languages is a bad idea. :) http://twoproblems.com/1
type: AnswerComment
score: 0

http://stackoverflow.com/a/23273187
has body: As I understand it, your browser on the client brings you a result, the agent running on the server gets a 302, and the agent running on the client gets you a NullPointerException. Since you don't seem to want to show your code, all I can really do is guess. (Maybe that's all I could do if I saw your code, too, but I'd still feel better about your question if you'd show me all the information that you can see yourself.) In any case, the 302 suggests to me that there might be a proxy involved, somehow. Perhaps some of the information here will be of help to you.
has comment: http://stackoverflow.com/comment/35628194
has comment: http://stackoverflow.com/comment/35628305
answers question: http://stackoverflow.com/q/23241078
score: 0
type: Answer

http://stackoverflow.com/comment/35504854
score: 0
type: AnswerComment
has text: @zeroRooter updated my answer.. what I meant is to only put the user interface update not the class instances
type: Comment
comment on: http://stackoverflow.com/a/23209401

http://stackoverflow.com/a/37022678
type: Answer
has body: Problem occurs because of the entry mapping class="annotations.Users" in hibernate.cfg.xml remove that line then it will be work. I had the same issue. When I removed the above line then it was working fine for me.
downvote count: 1
score: -1
answers question: http://stackoverflow.com/q/23214454
upvote count: 0

http://stackoverflow.com/q/23207000
favorite count: 0
possible better answer: http://stackoverflow.com/a/23207101
has comment: http://stackoverflow.com/comment/35499504
tagged with: interface
tagged with: classname
accepted answer: http://stackoverflow.com/a/23207097
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/35501192
has body: Say I have a Java interface Blender.java with various implementations Cuisinart.java, Oster.java, Blendtec.java, etc. Now I want to write a program like so: public class Blendifier { // ... public static void main(String... args) { Blender blender = new Cuisinart(); blender.blend(); } } But now if I want to use the Blendtec instead of the Cuisinart, I have to open up the source, change the code, and recompile. Instead, I'd like to be able to specify which Blender to use on the fly when I run the program, by writing the class name I want as a command line argument. But how can I go from a String containing the name of a class, to constructing an actual instance of that class?
upvote count: 1
type: Question
type: AnsweredQuestion
tagged with: command-line-arguments
has comment: http://stackoverflow.com/comment/35500678
answer count: 2
has answer: http://stackoverflow.com/a/23207097
has answer: http://stackoverflow.com/a/23207101
has title: Specify which implementation of Java interface to use in command line argument
downvote count: 0

http://stackoverflow.com/a/23244484
type: Answer
upvote count: 2
score: 2
downvote count: 0
has body: You haven't specified any capturing groups. If you change your pattern like this: Pattern pattern = Pattern.compile("(@)"); then you'll have a capturing group - but it will still only return 1, as each match only has a single group. find() will return true 5 times though.
answers question: http://stackoverflow.com/q/23244390

http://stackoverflow.com/a/23249888
accepted answer of: http://stackoverflow.com/q/23239218
type: Answer
has comment: http://stackoverflow.com/comment/43641142
upvote count: 17
has body: If you're using Dropwizard 0.6.2 you should be able to do something like this in your run method: ServletBuilder builder = environment.addServlet(myServlet, "/bar"); If you're using Dropwizard 0.7.0 try this: environment.getApplicationContext().addServlet("org.example.MyServlet", "/bar");
downvote count: 0
has comment: http://stackoverflow.com/comment/35592903
score: 17
has comment: http://stackoverflow.com/comment/48002549
answers question: http://stackoverflow.com/q/23239218
type: AcceptedAnswer

http://stackoverflow.com/comment/35458104
type: AnswerComment
comment on: http://stackoverflow.com/a/23183293
score: 0
type: Comment
has text: Ok I understand, I will edit a solution in my question.

servlets
tags question: http://stackoverflow.com/q/23138591
tags question: http://stackoverflow.com/q/23147310
tags question: http://stackoverflow.com/q/23147683
tags question: http://stackoverflow.com/q/23204166
tags question: http://stackoverflow.com/q/23279127
tags question: http://stackoverflow.com/q/23194949
tags question: http://stackoverflow.com/q/23290506
tags question: http://stackoverflow.com/q/23205071
tags question: http://stackoverflow.com/q/23147836
tags question: http://stackoverflow.com/q/23153416
tags question: http://stackoverflow.com/q/23239922
tags question: http://stackoverflow.com/q/23224052
tags question: http://stackoverflow.com/q/23185026
tags question: http://stackoverflow.com/q/23138319
tags question: http://stackoverflow.com/q/23195317
tags question: http://stackoverflow.com/q/23139707
tags question: http://stackoverflow.com/q/23281862
tags question: http://stackoverflow.com/q/23141776
tags question: http://stackoverflow.com/q/23191385
tags question: http://stackoverflow.com/q/23167846
tags question: http://stackoverflow.com/q/23201031
tags question: http://stackoverflow.com/q/23141409
tags question: http://stackoverflow.com/q/23167654
tags question: http://stackoverflow.com/q/23286749
tags question: http://stackoverflow.com/q/23239218
tags question: http://stackoverflow.com/q/23176290
tags question: http://stackoverflow.com/q/23134163
tags question: http://stackoverflow.com/q/23240702
tags question: http://stackoverflow.com/q/23267506
tags question: http://stackoverflow.com/q/23185348
tags question: http://stackoverflow.com/q/23242262
tags question: http://stackoverflow.com/q/23215834
tags question: http://stackoverflow.com/q/23148055
tags question: http://stackoverflow.com/q/23186813
tags question: http://stackoverflow.com/q/23159589
tags question: http://stackoverflow.com/q/23146323
tags question: http://stackoverflow.com/q/23268501
tags question: http://stackoverflow.com/q/23152178
tags question: http://stackoverflow.com/q/23282257
tags question: http://stackoverflow.com/q/23149203
tags question: http://stackoverflow.com/q/23212065
tags question: http://stackoverflow.com/q/23272897
tags question: http://stackoverflow.com/q/23190944
tags question: http://stackoverflow.com/q/23143809
tags question: http://stackoverflow.com/q/23138803
tags question: http://stackoverflow.com/q/23260775
tags question: http://stackoverflow.com/q/23244397
tags question: http://stackoverflow.com/q/23284403
tags question: http://stackoverflow.com/q/23203175
tags question: http://stackoverflow.com/q/23194250
tags question: http://stackoverflow.com/q/23236879
tags question: http://stackoverflow.com/q/23132293
tags question: http://stackoverflow.com/q/23267525
tag name: servlets
tags question: http://stackoverflow.com/q/23167600
tags question: http://stackoverflow.com/q/23284484
tags question: http://stackoverflow.com/q/23273510
tags question: http://stackoverflow.com/q/23152530
tags question: http://stackoverflow.com/q/23283987
tags question: http://stackoverflow.com/q/23189048
tags question: http://stackoverflow.com/q/23184063
tags question: http://stackoverflow.com/q/23256999
tags question: http://stackoverflow.com/q/23264224
type: Tag
tags question: http://stackoverflow.com/q/23270954
tags question: http://stackoverflow.com/q/23228443
tags question: http://stackoverflow.com/q/23273733
tags question: http://stackoverflow.com/q/23147238
tags question: http://stackoverflow.com/q/23237359
tags question: http://stackoverflow.com/q/23211329
tags question: http://stackoverflow.com/q/23276806
tags question: http://stackoverflow.com/q/23232001
tags question: http://stackoverflow.com/q/23225553

bukkit
tag name: bukkit
tags question: http://stackoverflow.com/q/23250815
tags question: http://stackoverflow.com/q/23180305
tags question: http://stackoverflow.com/q/23251953
type: Tag
tags question: http://stackoverflow.com/q/23230908
tags question: http://stackoverflow.com/q/23286019
tags question: http://stackoverflow.com/q/23130395

http://stackoverflow.com/comment/35495384
has text: Next time, please improve the original question rather than create a new one.
comment on: http://stackoverflow.com/q/23201818
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23277927
has comment: http://stackoverflow.com/comment/35718186
score: 5
upvote count: 5
answers question: http://stackoverflow.com/q/23277777
has body: Assuming you actually are getting an array of String[], you should be able to use something like - public static List&lt;String[]&gt; getList(ResultSet rs) throws IOException, SQLException { List&lt;String[]&gt; al = new ArrayList&lt;String[]&gt;(); java.sql.Array z = rs.getArray("my_array_column"); for (Object obj : (Object[])z.getArray()) { try { String [] arr = (String[]) obj; al.add(arr); } catch (ClassCastException e) { System.out.println("Object is not a String[]"); e.printStackTrace(); } } return al; }
downvote count: 0
has comment: http://stackoverflow.com/comment/35708897
type: Answer

http://stackoverflow.com/a/24303115
type: Answer
has body: Also getting this response error when sending two POST requests in quick succession. The solution is to add header "Connection: close" for both of these requests.
upvote count: 14
has comment: http://stackoverflow.com/comment/102563595
score: 14
downvote count: 0
has comment: http://stackoverflow.com/comment/102787507
answers question: http://stackoverflow.com/q/23238397

http://stackoverflow.com/q/23245908
favorite count: 0
accepted answer: http://stackoverflow.com/a/23539795
type: Question
tagged with: google-app-engine
has body: I own a Java application on Google App Engine Java with a custom domain and multiple subdomains. I'd like to allow one part of my application to be served over https (for example, all the urls of a subdomain or all the urls with /secure/ in path). The other urls should still be served over http. Our website receive more than 100 req/s and the vast majority of these requests should still work over http. I fear that by trying to activate https I might block all the http requests which would create a big downtime for our servers. Is it possible to do what I'd like with App Engine? What is the best way to do it and avoid any downtime? Thanks!
upvote count: 2
tagged with: java
answer count: 1
tagged with: https
has answer: http://stackoverflow.com/a/23539795
tagged with: ssl
type: AnsweredQuestion
score: 2
downvote count: 0
has title: Add HTTPS to a custom domain on Google App Engine (and keep HTTP working)

http://stackoverflow.com/a/67297758
has body: Happened to me: if your project depends on docker machine or/ and database to build successfully then please check first that your db instance is up and your docker is also up because maybe there are some unit tests running in the background ... check that especially after starting your laptop.. hope that could help someone
answers question: http://stackoverflow.com/q/23260057
score: 0
type: Answer

binary-tree
tag name: binary-tree
tags question: http://stackoverflow.com/q/23226365
type: Tag
tags question: http://stackoverflow.com/q/23281399
tags question: http://stackoverflow.com/q/23173932
tags question: http://stackoverflow.com/q/23198081

http://stackoverflow.com/q/23248657
tagged with: jtable
score: 0
has comment: http://stackoverflow.com/comment/35574242
answer count: 1
has comment: http://stackoverflow.com/comment/35619105
type: UnansweredQuestion
has body: I am using this method to update the table using JTextFiled, but nothing is happening. The code is inside constructor table.getSelectionModel().addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent e) { int row = table.getSelectedRow(); Object value3 = table.getValueAt(row, 3); Object value1 = table.getValueAt(row, 1); Object value2 = table.getValueAt(row, 2); enterText.setText(value3 == null ? null : value3.toString()); startTime.setText(value1 == null ? null : value1.toString()); endTime.setText(value2 == null ? null : value2.toString()); Object getValue3 = enterText.getText(); if(value3 != getValue3){ table.setValueAt(getValue3, row, 3); } } }); The data is showing when I select the row inside the text field but when I change it and send it back to the JTable it is not happening. I think I need a listener.
tagged with: java
tagged with: swing
tagged with: jtextfield
has comment: http://stackoverflow.com/comment/35573989
type: Question
has title: Why is this not updating the table?
has answer: http://stackoverflow.com/a/23249768

http://stackoverflow.com/a/23251125
upvote count: 2
score: 2
has body: See the dynamic-ftp sample application. It adds ftp outbound adapters using a child application context for each. In effect, a dynamic router routes to the input channel for each adapter.
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23248987
type: Answer
answers question: http://stackoverflow.com/q/23248987

http://stackoverflow.com/a/23166336
type: Answer
has comment: http://stackoverflow.com/comment/35428703
score: 2
answers question: http://stackoverflow.com/q/23162164
accepted answer of: http://stackoverflow.com/q/23162164
type: AcceptedAnswer
downvote count: 0
has body: As far as I can see your configuration is correct and all is set up as described in the log4j2 manual page for web apps. One thing you could try is putting the log4j2.xml config file in the classpath (under WEB-INF/classes) and removing the log4jConfiguration context-param setting. But since you are seeing an info.log file being created, it is likely that the log4j2.xml file is already discovered correctly, so putting it in the classpath may not help. (Worth a try though.) Two other reasons I can think of why nothing appears in the log file: log output is buffered and the buffer is not flushed on every event. However, the default for FileAppender is immediateFlush=true, so that would mean a new bug was introduced in rc1. This is possible, but not likely (current trunk source looks correct). Finally, would it be possible that your method that does the logging (myMethod in your example above) is not called? Is there a way to verify that this method was called?
upvote count: 2
has comment: http://stackoverflow.com/comment/35433835

http://stackoverflow.com/a/23203978
type: Answer
has comment: http://stackoverflow.com/comment/35493657
has body: You have code lines that assume that there are at least 3 arguments before you check how many arguments there are. Move these lines: // setting up the variable firstNumber and secondNumber int firstNumber = Integer.parseInt(args[0]); int secondNumber = Integer.parseInt(args[1]); String arithmetic = args[2]; below your "!= 3" check. Otherwise if you enter less than 3 command line arguments, you'll get an ArrayIndexOutOfBoundsException on one of those lines before you check how many arguments you have.
upvote count: 4
type: AcceptedAnswer
downvote count: 0
score: 4
accepted answer of: http://stackoverflow.com/q/23203926
answers question: http://stackoverflow.com/q/23203926

http://stackoverflow.com/comment/35607619
has text: Yes i'm onli quering..So the commit is only to persist an not to quering or deleting??
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23267207

http://stackoverflow.com/q/23151522
type: Question
tagged with: camera
tagged with: java
has body: I take a photo using the native camera and then when i display it in my android app if it the photo is portrait then it automatically displays the photo in landscape. I do want the photo in landscape but is there a way to force the image to stay in whatever orientation it is. For instance if it is taken in portrait then when the photo is displayed i just want it to stay how it is instead of android automatically rotating the image and stretching it. I have tried forcing the camera into landscape using MediaStore.EXTRA_SCREEN_ORIENTATION and setting this to landscape but it still tries to rotate the image when i load it up. I know you can get the orientation of the file and rotate in real time but I don't see the need to do this I just want the photo to display however it is regardless of orientation. Thanks Edit: Imagine you take a photo portrait, now if you rotate the phone (not the image) then you still have a portrait image but it is display in landscape (this is what I want) but android rotates the image to landscape which stretches it etc...
answer count: 1
has answer: http://stackoverflow.com/a/23151554
score: 0
tagged with: android
type: UnansweredQuestion
has title: Android camera background rotating
tagged with: photo

http://stackoverflow.com/q/23199974
type: AnsweredQuestion
tagged with: java
score: -1
type: Question
has body: I am writing an Assertion Generator Plugin in Java to fetch a user details from Session Store and modify the values in Assertion(SAML 2.0) accordingly. I am able to identify the method(Link) using which I can pull the user values from Session Store (agentAPIObject.getSessionVariables()) based on SessionID, but, I am having trouble writing a code to fetch specific parameters from the session store. (speficially around setting values for Attribute method and making it as an array) Can someone post a sample code if you have ever seen/written around it, so that I can fetch user attributes from Session Store. I am having trouble understanding Java docs around it. Thanks in advance,
upvote count: 0
accepted answer: http://stackoverflow.com/a/23200303
answer count: 1
has comment: http://stackoverflow.com/comment/35486888
favorite count: 0
tagged with: siteminder
has title: Java Code to fetch Session Store attribute values
has answer: http://stackoverflow.com/a/23200303
downvote count: 1

http://stackoverflow.com/a/23230301
has body: you could build a new array, counting by twos: for(int index=1; index&lt;=result.size; index = index+2) or you could use a regex instead, specifying the second half http://docs.oracle.com/javase/tutorial/essential/regex/groups.html http://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html I'd do the regex route personally!
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23230210

http://stackoverflow.com/comment/35553906
type: Comment
has text: Which means what more precisely ?
type: QuestionComment
comment on: http://stackoverflow.com/q/23226082
score: 0

http://stackoverflow.com/comment/35631363
type: AnswerComment
comment on: http://stackoverflow.com/a/23277520
type: Comment
has text: That looks like the framework of the other layouts I've seen. I thought it would be simpler to extend it for its methods, so I can manipulate a separate class that is shared among all Activites. But it looks like as long as its instantiated as a MediaPlayer Object, it holds all the methods. Sorry, I'm completely new with no mentor.
score: 0

http://stackoverflow.com/comment/35573633
comment on: http://stackoverflow.com/a/23230781
has text: So, with my rudimentary knowledge of exception handling, I've just managed to get the program to crash at the same point with the error message that I defined.
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/23177009
tagged with: hashmap
tagged with: java
score: 0
has answer: http://stackoverflow.com/a/23177034
answer count: 3
accepted answer: http://stackoverflow.com/a/23177029
has body: Sorry if this is a noob question, but I am scratching my head how to add values to the following map inside a for loop: private void filterSnakes() { Map&lt;Integer, Map&lt;Integer, Integer&gt;&gt; mapSnakes = new HashMap&lt;Integer, Map&lt;Integer, Integer&gt;&gt;(); int coutner = 0; for(int i = 0; i &lt; mGameAssets.length; i++) { if(mGameAssets[i].getAssetType().isSnake()){ //check if the asset is snake mapSnakes.put(++coutner, i,mGameAssets[i].getDamage() ); } } } I mean how can I put a new entry in the mapSnakes, the key part is ok but how about the Value part which itself is a Map?
possible better answer: http://stackoverflow.com/a/23177034
has comment: http://stackoverflow.com/comment/35446285
has comment: http://stackoverflow.com/comment/35446296
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23177037
has answer: http://stackoverflow.com/a/23177029
has title: Adding to a HashMap which its Value part is another HashMap
type: Question

http://stackoverflow.com/comment/43631170
type: AnswerComment
comment on: http://stackoverflow.com/a/23249825
has text: I had this problem when using the Stanford Parser jars. Thanks @Leonard
type: Comment
score: 0

http://stackoverflow.com/a/23195509
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/23195423
score: 1
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23195423
has body: Citing Johannes Weiß: "When calling String.split(String), it calls String.split(String, 0) and that discards trailing empty strings (as the docs say it), when calling String.split(String, n) with n &lt; 0 it won't discard anything."

http://stackoverflow.com/a/23218474
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/23218102
upvote count: 24
has comment: http://stackoverflow.com/comment/35519692
score: 24
accepted answer of: http://stackoverflow.com/q/23218102
has body: I think you just need to use IN :stringId instead of IN (:stringId) For JPA namedQuery.setParameter("stringId", strIds); is correct, but for Hibernate you should use namedQuery.setParameterList("stringId", strIds);

http://stackoverflow.com/q/23287527
favorite count: 0
type: Question
tagged with: soap
score: 1
upvote count: 1
has title: Strange behaviour SOAP-HTTPS webservice on JBoss 7.4 HA cluster
has body: We have EAP 6.3 (AS 7.4-final) running in HA mode on two Ubuntu 12.04 LTS Microsoft Azure Cloud servers.The two nodes are load-balanced through Azure load-balanced set for HTTPS. Calling the SOAP service through HTTP is no problem, But for HTTPS we get some strange results. Calling through HTTPS the first one or two times, after a JBoss (re)start, succeeds. After this next tries result in this exception: 13:07:43,555 WARNING [org.apache.cxf.phase.PhaseInterceptorChain] (http-/0.0.0.0:8443-57) Interceptor for {http://www.enexis.nl/SCiP/admin/2013/10/}ScipAdminService has thrown exception, unwinding now: java.lang.RuntimeException: Couldn't parse stream. at org.apache.cxf.staxutils.StaxUtils.createXMLStreamReader(StaxUtils.java:1445) at org.apache.cxf.interceptor.StaxInInterceptor.handleMessage(StaxInInterceptor.java:112) at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:272) at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121) at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:239) at org.jboss.wsf.stack.cxf.RequestHandlerImpl.handleHttpRequest(RequestHandlerImpl.java:97) at org.jboss.wsf.stack.cxf.transport.ServletHelper.callRequestHandler(ServletHelper.java:131) at org.jboss.wsf.stack.cxf.CXFServletExt.invoke(CXFServletExt.java:88) at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:286) at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:206) at javax.servlet.http.HttpServlet.service(HttpServlet.java:754) [jboss-servlet-api_3.0_spec-1.0.2.Final-redhat-1.jar:1.0.2.Final-redhat-1] at org.jboss.wsf.stack.cxf.CXFServletExt.service(CXFServletExt.java:136) at org.jboss.wsf.spi.deployment.WSFServlet.service(WSFServlet.java:140) [jbossws-spi-2.3.0.CR1.jar:2.3.0.CR1] at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [jboss-servlet-api_3.0_spec-1.0.2.Final-redhat-1…
tagged with: cxf
tagged with: java
type: UnansweredQuestion
tagged with: jboss
tagged with: https
has comment: http://stackoverflow.com/comment/45442178
answer count: 0
has comment: http://stackoverflow.com/comment/45483571
downvote count: 0

http://stackoverflow.com/comment/35452819
type: AnswerComment
has text: I have no idea about Ehcache. And yes you have use static map..and if you want to update the cache then put this this static map inside doPost or doGet method too like this `if("updatecache".equals(request.getParameter("cacheupadte"){ map= getTag();}` and remaining logic in else block. In this case you have to fire a seperate url to update cache without application restart. But if you are worry about Thread safety then things will little complicated.
type: Comment
comment on: http://stackoverflow.com/a/23179742
score: 0

http://stackoverflow.com/comment/35513637
comment on: http://stackoverflow.com/a/23215097
type: AnswerComment
has text: I have misunderstanding. I can use wait only on synchronized(this) ?
score: 0
type: Comment

http://stackoverflow.com/a/23264901
type: Answer
has comment: http://stackoverflow.com/comment/35606204
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/35608750
has comment: http://stackoverflow.com/comment/35607706
has comment: http://stackoverflow.com/comment/35603440
downvote count: 0
has comment: http://stackoverflow.com/comment/35603702
has comment: http://stackoverflow.com/comment/35605432
answers question: http://stackoverflow.com/q/23264342
has body: You can use this regex: ^.*fox[A-Z0-9\s]*(.*)dog.*$ You can pass fox and dog by parameter in your function to use in other cases.
has comment: http://stackoverflow.com/comment/35608252
has comment: http://stackoverflow.com/comment/35604867
has comment: http://stackoverflow.com/comment/35603488
has comment: http://stackoverflow.com/comment/35604270

http://stackoverflow.com/comment/35489580
comment on: http://stackoverflow.com/q/23201676
type: Comment
type: QuestionComment
score: 1
has text: You are on the right track. A custom RecordSeparatorPolicy is exactly what you need to do for this scenario. You can read more about them here: http://docs.spring.io/spring-batch/trunk/apidocs/org/springframework/batch/item/file/separator/RecordSeparatorPolicy.html

http://stackoverflow.com/comment/35721135
comment on: http://stackoverflow.com/a/23305026
has text: @Rehan : we are all human with no special skills to see what you have new changes. So next time please. Show with a `Edit` or `Update` in your Question that you have changed something. You need two con.prepareStatement(sql); Look at my updated answer.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/35607462
comment on: http://stackoverflow.com/q/23224234
type: Comment
type: QuestionComment
has text: Is your base service locator something that I should also keep track of dynamically? I ask because I can easily create a utility that copies the current set of services from one locator to another (via an Alias, not actually do a copy) or I can create a JIT resolver which would work better if your base locator can change services over time, but which would then only work for Injections, and not for raw lookups.
score: 0

http://stackoverflow.com/q/23214674
tagged with: sorting
has answer: http://stackoverflow.com/a/23214832
answer count: 3
upvote count: 1
favorite count: 0
downvote count: 0
type: UnansweredQuestion
has body: Okay i got some issue with the Collection.sort(myintarray); line... it says cannot find symbol trying to make it sort the list so the lowest number in array come first. package uppgift.pkg1; import java.util.ArrayList; import java.util.Collection; import java.util.List; import java.util.Arrays; /** * @author Fredrik * */ public class Uppgift1 { public static void main(String[] args) { //Anrop av metod skapaArray(); } public static void skapaArray() { List&lt;Integer&gt; myintarray = new ArrayList&lt;Integer&gt;(); int ints = 0; int size = 1; while (ints &lt; size) { myintarray.add(ints); ints++; } Collection.sort(myintarray); System.out.println(myintarray.size()); } }
has answer: http://stackoverflow.com/a/23214810
has answer: http://stackoverflow.com/a/23215619
score: 1
tagged with: java
has title: Sort() "cannot find symbol"
has comment: http://stackoverflow.com/comment/35512915
type: Question

http://stackoverflow.com/q/23135167
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/35372469
has title: Unexpected line by zebra printer
has answer: http://stackoverflow.com/a/23135865
tagged with: android
favorite count: 0
score: 2
upvote count: 2
tagged with: zebra-printers
accepted answer: http://stackoverflow.com/a/23135865
type: AnsweredQuestion
tagged with: java
has body: I'm using Zebra printer and Android. This line printer = ZebraPrinterFactory.getInstance(connection); make a printer to print unexpected line U1 getvar "appl.name" After that printer going well. How to get rid of printing that line?
tagged with: adt
type: Question

http://stackoverflow.com/comment/35376933
score: 0
comment on: http://stackoverflow.com/q/23137719
type: Comment
type: QuestionComment
has text: To expand on the [above comment](http://stackoverflow.com/questions/23137719/calculation-is-sometimes-wrong#comment35376899_23137719): money is often best stored in integer values (i.e. total cents/pence/whatever). That avoids any of this nasty floating point error stuff.

http://stackoverflow.com/comment/35609047
type: Comment
has text: I would suggest that `Dollar` should have a constructor taking the amount, and then that should be set as a `final` variable. I would use `BigDecimal` rather than `double` though...
score: 2
comment on: http://stackoverflow.com/q/23268056
type: QuestionComment

http://stackoverflow.com/q/23133272
has comment: http://stackoverflow.com/comment/35368454
has title: GUI result output to user
has answer: http://stackoverflow.com/a/23133772
has comment: http://stackoverflow.com/comment/35368932
has body: The display message is not displaying as a GUI. Currently I have the output message set up as a system out print ln but I need a string output to display a message that states if the lists are identical or not. How can I make this change? I am using the following List 1=5 2 5 6 1 6 and list 2=5 2 5 6 1 6 Here is the updated code: // Enter values for list1 String input = JOptionPane.showInputDialog ("Enter list1: "); int size1 = Integer.parseInt(input); int[] list1 = new int[size1]; for (int i = 0; i &lt; list1.length; i++) list1[i] = Integer.parseInt(input); // Enter values for list2 String input2 = JOptionPane.showInputDialog ("Enter list2: "); int size2 = Integer.parseInt(input2); int[] list2 = new int[size2]; for (int i = 0; i &lt; list2.length; i++) list2[i] = Integer.parseInt(input2); if (equals(list1, list2)) { System.out.println("Two lists are strictly identical"); } else { System.out.println("Two lists are not strictly identical"); } } public static boolean equals(int[] list1, int[] list2) { if (list1.length != list2.length) return false; for (int i = 0; i &lt; list1.length; i++) if (list1[i] != list2[i]) return false; return true; } }
type: UnansweredQuestion
score: -3
tagged with: output
tagged with: java
type: Question
downvote count: 4
upvote count: 1
tagged with: user-interface
tagged with: arrays
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/35368194

http://stackoverflow.com/q/23139438
type: Question
score: 9
answer count: 2
upvote count: 9
downvote count: 0
possible better answer: http://stackoverflow.com/a/23145868
has answer: http://stackoverflow.com/a/23145868
tagged with: android
has answer: http://stackoverflow.com/a/23154415
favorite count: 0
has comment: http://stackoverflow.com/comment/35380217
accepted answer: http://stackoverflow.com/a/23154415
has title: Behavior of HttpURLConnection for URL with Revoked SSL Certificate?
type: AnsweredQuestion
has body: We're going to have a bumper crop of revoked SSL certificates, courtesy of heartbleed. When I saw that Chrome on Android apparently ignores revoked SSL certificates, I wondered what the behavior would be when requesting in Java a Web resource from a server, where we get a revoked SSL certificate. What I hoped for was a crash with some sort of SSLHandshakeException. What I am seeing is a successful connection, but downloading no data -- reading from getInputStream() returns a length of -1. This is tested using https://revoked.grc.com/ as my test site, which will return an explanatory page if you download it ignoring certificate errors (e.g., via wget -no-check-certificate). I have tried 4.4, 4.3, and 2.3 emulators, with the same results. Is there a specified behavior for the Java VM? I doubt that there is an Android-specific specification, but if Android's actual behavior differs from a Java specification, I can work to get the differences clarified as either being bugs or missing documentation.
tagged with: java
has comment: http://stackoverflow.com/comment/35380587
tagged with: ssl
has comment: http://stackoverflow.com/comment/35392337
tagged with: https

http://stackoverflow.com/comment/35547156
score: 0
has text: While that may have solved the issue at hand, you are going to run into some more problems when you actually attempt to run this. `xx[i] = new int[t[i].length + s[i].length];` is going to always result in an `IndexOutOfBoundsException`.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23233688

http://stackoverflow.com/a/23188756
has comment: http://stackoverflow.com/comment/35467457
has comment: http://stackoverflow.com/comment/35621663
has body: You need to specify which location in the array you want to compare. Try this: public static int calculatePrizesWon(int[] winnersCount, int roundWinner) { int prizesWon = 0; if (winnersCount[roundWinner] == 0) { JOptionPane.showMessageDialog(null, "Prize won: $106 consolidation prize!"); } else if (winnersCount[roundWinner] == 1) { JOptionPane.showMessageDialog(null, "Prize won: $15,125!"); } else if (winnersCount[roundWinner] == 2) { JOptionPane.showMessageDialog(null, "Prize won: $30,110!"); } else if (winnersCount[roundWinner] == 3) { JOptionPane.showMessageDialog(null, "Prize won: $15,120,000!"); } return prizesWon; // Replace this with the real prize won number. } You'll probably do better using a switch statement instead. If you want to see or receive comments on other things you can do better post a comment.
has comment: http://stackoverflow.com/comment/35467407
has comment: http://stackoverflow.com/comment/35625683
has comment: http://stackoverflow.com/comment/35467147
has comment: http://stackoverflow.com/comment/35469858
type: AcceptedAnswer
score: 0
accepted answer of: http://stackoverflow.com/q/23188575
type: Answer
answers question: http://stackoverflow.com/q/23188575
has comment: http://stackoverflow.com/comment/35467240
has comment: http://stackoverflow.com/comment/35467174
has comment: http://stackoverflow.com/comment/35467361
has comment: http://stackoverflow.com/comment/35467197

http://stackoverflow.com/q/23190624
has comment: http://stackoverflow.com/comment/35470424
linked to: http://stackoverflow.com/q/17394221
has answer: http://stackoverflow.com/a/23190719
upvote count: 3
has answer: http://stackoverflow.com/a/23191295
has comment: http://stackoverflow.com/comment/35470484
tagged with: java
downvote count: 3
tagged with: output
has body: I need to calculate running time of a factorial program with different sizes up to 130!. However, the program is currently using the long data type and that is not large enough to hold the outputs. After 20 factorial it turns negative and glitches out. How can I store even bigger numbers so I can calculate up to 130 factorial? Here are the methods doing the work: public class FactorialCalculation { long startTime = System.nanoTime(); //recursive Factorial method public long factorial(long number) { if (number &lt;= 1) return 1; else return number * factorial(number - 1); } //Now output the factorials of 0 through 15 public void displayFactorials() { // Calculate the factorial of o through 15 for (int counter = 0; counter &lt;= 130; counter++) System.out.print("Factorial of:" + counter + " " + factorial(counter) + " \n"); long estimatedTime = System.nanoTime() - startTime; System.out.println(estimatedTime); } // end of the method displayFactorials } // end of class FactorialCalculation Here is the output showing it turning negative and then to 0. Factorial of:0 1 Factorial of:1 1 Factorial of:2 2 Factorial of:3 6 Factorial of:4 24 Factorial of:5 120 Factorial of:6 720 Factorial of:7 5040 Factorial of:8 40320 Factorial of:9 362880 Factorial of:10 3628800 Factorial of:11 39916800 Factorial of:12 479001600 Factorial of:13 6227020800 Factorial of:14 87178291200 Factorial of:15 1307674368000 Factorial of:16 20922789888000 Factorial of:17 355687428096000 Factorial of:18 6402373705728000 Factorial of:19 121645100408832000 Factorial of:20 2432902008176640000 Factorial of:21 -4249290049419214848 Factorial of:22 -1250660718674968576 Factorial of:23 8128291617894825984 Factorial of:24 -7835185981329244160 Factorial of:25 7034535277573963776 Factorial of:26 -1569523520172457984 Factorial of:27 -5483646897237262336 Factorial of:28 -5968160532966932480 Factorial of:29 -7055958792655077376 Factorial of:30 -8764578968847253504 Factorial of:31 4999213071378415616 Factorial of:32 -604…
tagged with: memory
has title: Java Data Type For Large Numbers
has comment: http://stackoverflow.com/comment/35470347
duplicate of: http://stackoverflow.com/q/1938855
type: Question
has comment: http://stackoverflow.com/comment/35470393
has comment: http://stackoverflow.com/comment/35470355
linked to: http://stackoverflow.com/q/1938855
has comment: http://stackoverflow.com/comment/35470267
tagged with: variables
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/23190761
has comment: http://stackoverflow.com/comment/35470388
has comment: http://stackoverflow.com/comment/35470438
has comment: http://stackoverflow.com/comment/35470259
has comment: http://stackoverflow.com/comment/35470363
has comment: http://stackoverflow.com/comment/35470417
favorite count: 0
has comment: http://stackoverflow.com/comment/35470580
linked to: http://stackoverflow.com/q/12693273
has comment: http://stackoverflow.com/comment/35470326
type: UnansweredQuestion

http://stackoverflow.com/comment/35552439
type: QuestionComment
has text: FYI added detailed explanation to the original answer.
comment on: http://stackoverflow.com/q/23236561
score: 0
type: Comment

http://stackoverflow.com/a/23249825
downvote count: 0
answers question: http://stackoverflow.com/q/23249331
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23249331
score: 109
type: Answer
has comment: http://stackoverflow.com/comment/47985924
has comment: http://stackoverflow.com/comment/43631170
has comment: http://stackoverflow.com/comment/54736291
upvote count: 109
has body: Your code was compiled with Java Version 1.8 while it is being executed with Java Version 1.7 or below. In your case it seems that two different Java installations are used, the newer to compile and the older to execute your code. Try recompiling your code with Java 1.7 or upgrade your Java Plugin.
has comment: http://stackoverflow.com/comment/35576626

http://stackoverflow.com/comment/35459820
type: Comment
score: 0
comment on: http://stackoverflow.com/a/23173182
type: AnswerComment
has text: [http://pastebin.com/NCPSEc0Q] Please do look at it, I've noticed that if I keep only one doctor, the patients do everything once. But, if I keep it for 2 doctors then the methods are done twice. Your help is greatly appreciated.

http://stackoverflow.com/comment/35461071
type: Comment
type: QuestionComment
has text: @LeosLiterak I edited my post.Could you please CHECK ?
comment on: http://stackoverflow.com/q/23185086
score: 0

http://stackoverflow.com/comment/35611358
comment on: http://stackoverflow.com/a/23253401
has text: @user3565634: what? don't change the adapter! when did i ever mentioned anything about changing the adapter?
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/23269702
answers question: http://stackoverflow.com/q/23269668
upvote count: 5
accepted answer of: http://stackoverflow.com/q/23269668
has body: You can get all finished instances of a process using the following code: package org.camunda.bpm; import org.camunda.bpm.engine.HistoryService; import org.camunda.bpm.engine.ProcessEngine; import org.camunda.bpm.engine.RepositoryService; import org.camunda.bpm.engine.history.HistoricProcessInstance; import org.camunda.bpm.engine.repository.ProcessDefinition; import java.util.List; public class AllFinishedProcessInstances { public List&lt;HistoricProcessInstance&gt; getAllFinishedProcessInstances(String processDefinitionName) { ProcessEngine processEngine = BpmPlatform.getDefaultProcessEngine(); HistoryService historyService = processEngine.getHistoryService();; RepositoryService repositoryService = processEngine.getRepositoryService(); ProcessDefinition myProcessDefinition = repositoryService.createProcessDefinitionQuery() .processDefinitionName(processDefinitionName) .latestVersion() // we are only interested in the latest version .singleResult(); List&lt;HistoricProcessInstance&gt; processInstances = historyService.createHistoricProcessInstanceQuery() .processDefinitionId(myProcessDefinition.getId()) .finished() // we only want the finished process instances .list(); return processInstances; } }
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 5

http://stackoverflow.com/q/23212683
has comment: http://stackoverflow.com/comment/37517020
has comment: http://stackoverflow.com/comment/37518012
favorite count: 0
has answer: http://stackoverflow.com/a/24508211
score: 12
type: Question
has comment: http://stackoverflow.com/comment/37885374
answer count: 2
has comment: http://stackoverflow.com/comment/35729227
has answer: http://stackoverflow.com/a/24505367
has comment: http://stackoverflow.com/comment/37629479
has comment: http://stackoverflow.com/comment/37887146
has comment: http://stackoverflow.com/comment/36960981
has title: Cant understand the working of File object.delete()
tagged with: java
has comment: http://stackoverflow.com/comment/35509328
has comment: http://stackoverflow.com/comment/35730240
has comment: http://stackoverflow.com/comment/36288553
upvote count: 12
has comment: http://stackoverflow.com/comment/35509376
has comment: http://stackoverflow.com/comment/37628810
tagged with: java-5
tagged with: jar
downvote count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36882727
has comment: http://stackoverflow.com/comment/37865814
has body: I am trying to delete a jar file using java 5 (So the Paths API introduced in Java 7 is not an option). My code: String sep = File.separator; File test = new File("."+ sep + "server" + sep + "lib" + sep + "testJar.jar"); if(test.delete()) { logger.log(Level.INFO,test.getName() + " deleted."); } else { logger.log(Level.INFO,"Delete operation is failed for "+test.getName()); } When my code gets executed the jar file is deleted but Delete operation is failed for testJar.jar is printed in the logs.Cant understand why..any help is appreciated. UPDATE: I tried the same code again and and this time it says testJar.jar deleted Now i am confused what is happening

http://stackoverflow.com/q/23236392
linked to: http://stackoverflow.com/q/6448856
tagged with: android
accepted answer: http://stackoverflow.com/a/23252936
has comment: http://stackoverflow.com/comment/35551696
possible better answer: http://stackoverflow.com/a/23240391
has body: &lt;!-- language: none --&gt; 04-23 11:47:01.904: E/AndroidRuntime(12396): java.lang.RuntimeException: Unable to resume activity {com.t4t.sp/com.t4t.sp.SignUpActivity}: java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=111, result=-1, data=Intent { act=content://media/external/images/media/3809 (has extras) }} to activity {com.t4t.sp/com.t4t.sp.SignUpActivity}: java.lang.NullPointerException I am not able to find out why the activity is not able to produce the result,what I want is I am launching an edit intent and after the editing I want to supply the uri to my onactivity result. Edited : Here is my code of on create method `protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGESS); setContentView(R.layout.activity_sign_up); mUsername=(EditText)findViewById(R.id.usernameField); mPassword=(EditText)findViewById(R.id.passwordField); mImage=(ImageView) findViewById(R.id.imageView1); medit=(Button)findViewById(R.id.edit); medit.setVisibility(View.GONE); mImage.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Intent choosePhotoIntent=new Intent(Intent.ACTION_GET_CONTENT); choosePhotoIntent.setType("image/*"); choosePhotoIntent.putExtra("crop", "true"); choosePhotoIntent.putExtra("outputX", 128); choosePhotoIntent.putExtra("outputY", 128); choosePhotoIntent.putExtra("aspectX", 1); choosePhotoIntent.putExtra("aspectY", 1); choosePhotoIntent.putExtra("scale", true); startActivityForResult(choosePhotoIntent, PICK_PHOTO_REQUEST); } }); ` here is my onactivity for result code where i am getting a null value for data as when i am trying to fetch the url its saying null pointer over there : @SuppressLint("NewApi") @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); Log.e("resultcode",Integer.toString(resultCode)); Log.e("requestcod…
upvote count: 1
tagged with: android-intent
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23252936
score: 1
tagged with: java
has title: failure delivering Resultinfo
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/23240391
downvote count: 0
linked to: http://stackoverflow.com/q/5568874
favorite count: 0

http://stackoverflow.com/comment/35378817
has text: @AJ_91 `Car` would be `vehicles` in your case. Btw, class names should start with a capital letter (e.g. `Vehicles`) and since the class seems to represent a _single_ vehicle, it might better be named `Vehicle`.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23138734

http://stackoverflow.com/a/23256971
score: 1
has comment: http://stackoverflow.com/comment/35606859
downvote count: 0
has body: feuerball, you asked for a regex... This one captures the five groups you want. I formatted the regex in free-spacing mode to make it easier to read. I did not explain in detail but each line is commented and I am certain you are able to understand it. :) regexp = /(?x) # free-spacing mode ^ # assert head of string (\#\d+) # captures the digits into Group 1 \s*=\s* # gets us past the equal and spaces ([A-Z_]+) # captures the name into Group 2 \s*\(\s*' # gets us inside the opening quote ([^']*?)' # captures the string in Group 3 (?: # start optional non-capturing group, let's call it A \s*,\s* # get over the comma and spaces (\([^)]*?\)) # capture parens to Group 4 (?:\s*,\s* # start optional non-capturing group, let's call it B ([^\s)]+) # capture last string to Group 5 )? # end optional non-capturing group B )? # end optional non-capturing group A \s*\)\s*; # close string / subject.scan(regexp) {|result| # If the regex has capturing groups, subject is an array with the text matched by each group (but without the overall match) # If the regex has no capturing groups, subject is a string with the overall regex match }
answers question: http://stackoverflow.com/q/23246867
type: Answer
has comment: http://stackoverflow.com/comment/35632173
upvote count: 1

http://stackoverflow.com/comment/35544659
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23232254
score: 0
has text: look at the first row, how do you know if the 2nd entry is for second column or third column?

http://stackoverflow.com/comment/35485724
type: QuestionComment
comment on: http://stackoverflow.com/q/23199662
score: 0
has text: FYI: If `tableName` comes from the user, this code is subject to SQL Injection.
type: Comment

http://stackoverflow.com/comment/35569071
comment on: http://stackoverflow.com/q/23245826
type: Comment
type: QuestionComment
has text: Great, worked! I was struggling with this a bit: http://shortrecipes.blogspot.de/2013/07/ubuntu-install-java-7-source-openjdk-7.html
score: 1

http://stackoverflow.com/q/23224282
upvote count: 5
tagged with: java
tagged with: javafx
has comment: http://stackoverflow.com/comment/35530476
score: 5
has comment: http://stackoverflow.com/comment/35529872
answer count: 1
accepted answer: http://stackoverflow.com/a/23224762
downvote count: 0
favorite count: 0
tagged with: fxml
has title: how to split JavaFX GUI into fxml files with good performance?
has answer: http://stackoverflow.com/a/23224762
type: Question
has body: I am working on an enterprise-scale project on which JavaFX 8 was choosen as the frontend technology. Target platform is a windows-based tablet, so performance is even more likely to be an issue on this. The application is made up of dozens of screens (essentially forms) and it was decided to split-up the GUI description into a myriad of FXML files, in a kind of component-based approach (some sub-panes inside a screen will be defined in their own fxml for instance). Also Spring is used to plug the controllers and services inside said components. The main problem is that now, 200+ fxml are loaded at startup (for a client application) and it takes around 20 seconds to do so... which is a bit too noticeable :( I've already ruled out Spring overhead as the culprit (we have a Spring-aware FXMLLoader implementation but most of the time is spent inside the load method). I wonder if this is the right approach... Is there an "scalability" issue in loading too many FXML files? A recommended limit on the number of fxml to attempt to load / granularity of fxml in a JavaFX app? Any tips or similar-situation feedback for this performance problem are welcome! Thank you.
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/44381065

http://stackoverflow.com/comment/35556497
score: 2
comment on: http://stackoverflow.com/q/23237460
type: Comment
type: QuestionComment
has text: You can try Jackson Streaming API (https://www.google.com/search?q=Jackson+streaming+API). When you split one JSON object it will be broken, won't it? Is it acceptable? If yes, you can see this question: http://stackoverflow.com/questions/19177994/java-read-file-and-split-into-multiple-files

http://stackoverflow.com/q/23274735
answer count: 1
has title: Java mySQL login issue
has comment: http://stackoverflow.com/comment/35621993
has comment: http://stackoverflow.com/comment/35622444
has comment: http://stackoverflow.com/comment/35621872
has comment: http://stackoverflow.com/comment/35622896
has comment: http://stackoverflow.com/comment/35622304
has comment: http://stackoverflow.com/comment/35622032
has comment: http://stackoverflow.com/comment/35622122
has comment: http://stackoverflow.com/comment/35622516
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/17213761
tagged with: java
has comment: http://stackoverflow.com/comment/35621916
tagged with: easyphp
tagged with: mysql
has comment: http://stackoverflow.com/comment/35622648
has comment: http://stackoverflow.com/comment/35622849
type: Question
has body: Hey guys I have a weird problem , if I enter my correct credentials from my database I GET AN ERROR, if I enter the wrong credentials everything is okay. Exception in thread "main" java.sql.SQLException: Column 'username' not found. This error occurs when I enter the correct credentials Also I have another problem, my passwords are encrypted with MD5 and I have no idea how to write that into my SELECT , tried this but without any success. resultSet = statement.executeQuery("SELECT password FROM cards.username WHERE username = '" + username + "' &amp;&amp; password = 'MD5(" + password + ")'"); So this is my class public void readDataBase() throws Exception { //Scanners Scanner in = new Scanner(System.in); System.out.print("Username: "); String username = in.nextLine(); System.out.print("Password: "); String password = in.nextLine(); System.out.println(" "); //--------------------- String databaseUsername = ""; String databasePassword = ""; 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("jdbc:mysql://localhost/cards?" + "user=root&amp;password=password"); // statements allow to issue SQL queries to the database statement = connect.createStatement(); resultSet = statement.executeQuery("SELECT password FROM cards.username WHERE username = '" + username + "' &amp;&amp; password = '" + password + "'"); //writeResultSet(resultSet); while (resultSet.next()) { databaseUsername = resultSet.getString("username"); databasePassword = resultSet.getString("password"); } if (username.equals(databaseUsername) &amp;&amp; password.equals(databasePassword)) System.out.println("Success !! "); else System.out.println(" Failure "); //--- //-------------------------------------------------------------------------------------------------- // resultSet gets the result of the SQL query // resultSet = statement.executeQuery("select * from FEEDBACK.COMMENTS")…
has answer: http://stackoverflow.com/a/23275254
score: 0
has comment: http://stackoverflow.com/comment/35621953
accepted answer: http://stackoverflow.com/a/23275254

http://stackoverflow.com/q/23280652
downvote count: 3
duplicate of: http://stackoverflow.com/q/1200621
type: Question
has body: I need to create a list of available television channels (identified by integers). I am thinking that I would begin by creating int [] list = 5,9,12,19,64. Here is the code: public NotVeryGoodTV(int[] channels) { int [] list =5,9,12,19,64; but I am getting a syntax error stating that a { is needed after "=". I would like to have a list of tv channels that would be available to the user once they turned on their television.
score: 0
has answer: http://stackoverflow.com/a/23280677
has title: How to initialize a list of integers
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23280687
has answer: http://stackoverflow.com/a/23280672
answer count: 4
has comment: http://stackoverflow.com/comment/35633362
has answer: http://stackoverflow.com/a/23280669
linked to: http://stackoverflow.com/q/1200621
upvote count: 3
tagged with: java

http://stackoverflow.com/q/23173851
has title: Getting error for the product of items in an array
has body: I want to take inputs from console and use the numbers in performing calculations. I want to stop receiving items into array when i receive some ref value like"10"(in this case) from console. As soon as i enter 10 in console the array has to be ended and the values in array have to be multiplied. I have tried this as a program but am getting 0 as answer for the product being performed. public class Scrap { private static int i; private static double[] as; public static void main(String[] args) { as=new double[100]; for(i=0;i&lt;as.length;i++) { as[i]=dscan(); if(as[i]==10) break; } double d=1; for(i=0;i&lt;as.length;i++) { d=d*as[i]; } System.out.println("Product is :"+(d/10)); } public static double dscan() { System.out.print(" : "); return new Scanner(System.in).nextDouble(); } }
type: AnsweredQuestion
tagged with: java
type: Question
answer count: 2
accepted answer: http://stackoverflow.com/a/23174008
tagged with: arrays
has answer: http://stackoverflow.com/a/23174001
score: 0
has answer: http://stackoverflow.com/a/23174008
possible better answer: http://stackoverflow.com/a/23174001

http://stackoverflow.com/a/23177037
type: Answer
score: 2
downvote count: 0
has body: You have declared the map as mapping from an integer to a Map. Therefore mapSnakes.put(++counter, i,mGameAssets[i].getDamage() ); needs to be something like this: Map&lt;Integer, Integer&gt; submap = ... mapSnakes.put(++counter, submap); ... or possibly something like @dimoniy's answer. (It is not clear, because you don't actually specify how you want the data structure to be initialized. I could guess, but I'm not playing that game this morning.) The other points to be made are: This looks like a poor OO design. Maps of maps of basic types etcetera in Java has "code smell". Usually it means that you should have defined some application classes. Maps are rather expensive data structures, both in memory usage and in time. And whenever you have to use Integer rather int, you incur overheads due to boxing and unboxing.
upvote count: 2
answers question: http://stackoverflow.com/q/23177009

http://stackoverflow.com/q/23184946
has answer: http://stackoverflow.com/a/23185281
type: Question
answer count: 1
has comment: http://stackoverflow.com/comment/35459890
score: 0
has title: Project Euler #3 double division
has body: I'm currently working on Project's Euler Problem 3 and due to lacking programming skills, I keep failing. The mean thing about that Problem is, that the number is too huge for int. Therefore I used double. Sadly my whole code is based on whole division. ` public static ArrayList PrimeDeco(double Insert, int Position, ArrayList PrimeFactor){ ArrayList&lt;Integer&gt; Prime= new ArrayList&lt;Integer&gt;(); Prime=Primenumbers(1000); int i = Position; while(Insert%(Integer)Prime.get(i)==0){ Insert=Insert/Prime.get(i); } PrimeFactor.add((Integer)Prime.get(Position)); System.out.println(PrimeFactor); if(Insert!=1){ System.out.println(Insert + " " + Position); PrimeDeco(Insert,Position+1, PrimeFactor); } return PrimeFactor; } Where as Insert is of type double and Prime.get(i) a Primenumber. While working for example with Integer 70, my programm prints [2,5,7] woth the Division 70, 35, 7, 1. But obviously that doesnt work with double type numbers and I don't know how to get a whole number without comma out of double.
type: UnansweredQuestion
tagged with: java

http://stackoverflow.com/a/23281749
has body: You need to move viewer.class into the cubesorter/tree/gh-pages directory. Simple fix. Not much more to it. Java not supported In the code above, I hotlinked viewer.class for you
answers question: http://stackoverflow.com/q/23281598
type: Answer
has comment: http://stackoverflow.com/comment/35636078
has comment: http://stackoverflow.com/comment/35635914
has comment: http://stackoverflow.com/comment/35636447
has comment: http://stackoverflow.com/comment/35636378
has comment: http://stackoverflow.com/comment/35636861
has comment: http://stackoverflow.com/comment/35636245
has comment: http://stackoverflow.com/comment/35635679
has comment: http://stackoverflow.com/comment/35635560
has comment: http://stackoverflow.com/comment/35636510
has comment: http://stackoverflow.com/comment/35636484
has comment: http://stackoverflow.com/comment/35635493
has comment: http://stackoverflow.com/comment/35636035
has comment: http://stackoverflow.com/comment/35636431
has comment: http://stackoverflow.com/comment/35636011
has comment: http://stackoverflow.com/comment/35636134
has comment: http://stackoverflow.com/comment/35636463
has comment: http://stackoverflow.com/comment/35636171
score: 0
has comment: http://stackoverflow.com/comment/35635945
has comment: http://stackoverflow.com/comment/35636492
has comment: http://stackoverflow.com/comment/35636535
has comment: http://stackoverflow.com/comment/35636395
has comment: http://stackoverflow.com/comment/35636832
has comment: http://stackoverflow.com/comment/35636347
has comment: http://stackoverflow.com/comment/35635775
has comment: http://stackoverflow.com/comment/35636599

http://stackoverflow.com/comment/35682839
score: 0
type: QuestionComment
type: Comment
has text: In a real life scenario, you should not use a single round of MD5 for password hashing. Use bcrypt, scrypt, or PBKDF2.
comment on: http://stackoverflow.com/q/23285389

http://stackoverflow.com/q/23164562
has answer: http://stackoverflow.com/a/23165515
answer count: 1
downvote count: 0
tagged with: callback
favorite count: 0
has body: What is the best and easiest way to implement callback mechanism in java 8? Is it to easily replace inner class decleration with lambda experission? Like replacing doSomethingAndRunThisCode(new Call() { @Override public void callback() { System.out.println("here I am called back"); } }); with doSomethingAndRunThisCode(() -&gt; { System.out.println("here I am called back"); }); But I think this is not all. Because pre java 8 way is even easier due to code complition of eclipse. Eclipse does nothing on java 8 way of implementing it (yet) .
has comment: http://stackoverflow.com/comment/35427040
type: UnansweredQuestion
tagged with: java-8
has comment: http://stackoverflow.com/comment/35426096
type: Question
has title: Callback mechanism of Java 8
tagged with: java
has comment: http://stackoverflow.com/comment/35755298
tagged with: closures
score: 4
upvote count: 4

http://stackoverflow.com/a/23221092
answers question: http://stackoverflow.com/q/23221021
has comment: http://stackoverflow.com/comment/35524477
has body: I don't know what ebean is but can you try something like this? List&lt;StockItem&gt; result = StockItem.find() .where() .eq("warehouse.id", warehouse.getId()) .findList();
downvote count: 1
has comment: http://stackoverflow.com/comment/35524654
score: 0
type: Answer
upvote count: 1

http://stackoverflow.com/a/23194676
downvote count: 0
type: Answer
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/23159330
answers question: http://stackoverflow.com/q/23159330
has body: criteria.add(Restrictions.eq("personType.idPersonType", 1)); criteria.addOrder(Order.asc("surname")) .setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY);
type: AcceptedAnswer

http://stackoverflow.com/a/23256850
has comment: http://stackoverflow.com/comment/35589194
accepted answer of: http://stackoverflow.com/q/23256787
score: 2
has body: Well, simply define a regex: Pattern p = Pattern.compile("R[0-9]{10} ((0|1|)[0-9]{1,2}|2([0-4][0-9]|5[0-5]))(\\.((0|1|)[0-9]{1,2}|2([0-4][0-9]|5[0-5]))){3}"); Matcher m = p.matcher(theStringToMatch); if(!m.matches()) { //do something, the test didn't pass thus ok } Or a jdoodle. EDIT: Since you actually wanted two possible patterns to filter out, chance the pattern to: Pattern p = Pattern.compile("(R[0-9]{10})|(((0|1|)[0-9]{1,2}|2([0-4][0-9]|5[0-5]))(\\.((0|1|)[0-9]{1,2}|2([0-4][0-9]|5[0-5]))){3})"); If you want to match the entire string (so that the string should start and end with the pattern, place ^ in from and $ at the end of the pattern.
upvote count: 2
has comment: http://stackoverflow.com/comment/35589272
has comment: http://stackoverflow.com/comment/35589300
has comment: http://stackoverflow.com/comment/35589170
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/35589037
has comment: http://stackoverflow.com/comment/35589191
has comment: http://stackoverflow.com/comment/35589045
answers question: http://stackoverflow.com/q/23256787
type: Answer

http://stackoverflow.com/comment/35583206
type: Comment
type: QuestionComment
has text: What query would you use? Why is that no efficient enough for you?
comment on: http://stackoverflow.com/q/23247900
score: 0

http://stackoverflow.com/comment/35556418
type: Comment
has text: Wait you asked to get the photo uri hence my answer is still ok - the cursor queries for photos in case there are no photos there is no photo uri...
comment on: http://stackoverflow.com/a/23238794
type: AnswerComment
score: 0

database-security
type: Tag
tag name: database-security
tags question: http://stackoverflow.com/q/23231441

http://stackoverflow.com/q/23159351
has comment: http://stackoverflow.com/comment/35414980
has comment: http://stackoverflow.com/comment/35415748
tagged with: android-studio
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35414885
tagged with: refactoring
accepted answer: http://stackoverflow.com/a/23159466
downvote count: 1
has comment: http://stackoverflow.com/comment/35415566
has comment: http://stackoverflow.com/comment/35414999
type: Question
has comment: http://stackoverflow.com/comment/35414983
has title: Android Studio says 'Local variable is redundant'
score: 7
tagged with: java
has comment: http://stackoverflow.com/comment/35414876
has comment: http://stackoverflow.com/comment/35414851
has comment: http://stackoverflow.com/comment/35414919
answer count: 1
has answer: http://stackoverflow.com/a/23159466
favorite count: 0
has comment: http://stackoverflow.com/comment/35414939
upvote count: 8
tagged with: android
has body: I am getting a warning on many methods that local variable is redundant. Here is a sample method: public MyObject getMSListItem(int pos) { MyObject li = getItem(pos); return li; } Now it SEEMS, I suppose, I can do this to fix it: public MyObject getMSListItem(int pos) { return getItem(pos); } Another example: public String getTeacher(int pos) { ffTeacherListItem t = getItem(pos); String teacher = t.teacher; return teacher; } Seems this could be: public String getTeacher(int pos) { ffTeacherListItem t = getItem(pos); return t.teacher; } OR as recommended below, even better! public String getTeacher(int pos) { return getItem(pos).teacher; } Is there really a "best practice" for this? Is one way better than the other? Or is it just about code readability and nothing more?

http://stackoverflow.com/comment/35585425
comment on: http://stackoverflow.com/q/23254659
type: QuestionComment
type: Comment
has text: Looks like you need to import `Fooballer` class.
score: 0

http://stackoverflow.com/q/23190683
tagged with: wizard
favorite count: 0
has answer: http://stackoverflow.com/a/23192485
accepted answer: http://stackoverflow.com/a/23192485
tagged with: swt
type: AnsweredQuestion
has title: WizardPage vs WizardDialog
has body: In SWT, what is the difference between WizardPage and WizardDialog Can some explain please. I couldn't understand fully yet. Thanks.
score: 1
tagged with: java
type: Question
upvote count: 1
downvote count: 0
answer count: 1
tagged with: jface

http://stackoverflow.com/a/23185133
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/23184503
upvote count: 1
accepted answer of: http://stackoverflow.com/q/23184503
type: AcceptedAnswer
has body: So I just did it for fun, here's my code. It would work for any size matrix. public class Matrixer { final double[][] matrix, computedMatrix; final int rows, cols; public Matrixer(int N, int M, final 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) { final double[][] matrix = { {1, 2, 3, 4, 5}, {5, 4, 3, 5, 1}, {3, 2, 2, 3, 4}, {2, 3, 4, 5, 3}, {3, 2, 4, 5, 6}, }; Matrixer mx = new Matrixer(5, 5, matrix); mx.computeAverages(); mx.printComputedMatrix(); } } Test Output: 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 2.63, 3.13, 3.13, 0.00, 0.00, 3.25, 3.63, 3.38, 0.00, 0.00, 2.75, 3.25, 3.88, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00
type: Answer

http://stackoverflow.com/q/23246983
has answer: http://stackoverflow.com/a/23247147
answer count: 4
upvote count: 11
has answer: http://stackoverflow.com/a/23247102
duplicate of: http://stackoverflow.com/q/17944
score: 11
duplicate of: http://stackoverflow.com/q/7446710
linked to: http://stackoverflow.com/q/17944
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23249954
tagged with: numbers
tagged with: math
tagged with: java
linked to: http://stackoverflow.com/q/7446710
has body: I know I can use Math.java functions to get the floor, ceil or round value for a double or float, but my question is -- Is it possible to always get the higher integer value if a decimal point comes in my value For example int chunkSize = 91 / 8 ; which will be equal to 11.375 If I apply floor, ceil or round to this number it will return 11 I want 12. Simply If I have 11.xxx I need to get 12 , if I have 50.xxx I want 51 Sorry The chunkSize should be int How can I achieve this?
has title: Get the next higher integer value in java
type: Question
accepted answer: http://stackoverflow.com/a/23247102
possible better answer: http://stackoverflow.com/a/23247012
has comment: http://stackoverflow.com/comment/35570378
downvote count: 0
has answer: http://stackoverflow.com/a/23247012
favorite count: 0
has comment: http://stackoverflow.com/comment/35570465

http://stackoverflow.com/comment/35449240
comment on: http://stackoverflow.com/q/23177807
type: Comment
has text: `frame.setFocusable(true);` is redundant, `JFrame` is focusable by default.
score: 0
type: QuestionComment

http://stackoverflow.com/comment/35459405
has text: Note, that if the user does not make a selection, the selected index is -1, and so if you wish to check if a selection has not yet been made, then perhaps this is what you really want to test: `if (comboBox.getSelectedIndex() == -1)` then show error message.
score: 0
comment on: http://stackoverflow.com/q/23184024
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/86450853
score: 2
has text: @StephenHarrison That is incorrect. We both have conceptually the same answers. I only show the `Map<String, Integer> map = new HashMap<>();` to indicate the source of the original map.
comment on: http://stackoverflow.com/a/23214322
type: AnswerComment
type: Comment

http://stackoverflow.com/a/23183802
has comment: http://stackoverflow.com/comment/35457546
has comment: http://stackoverflow.com/comment/35457729
score: 7
has comment: http://stackoverflow.com/comment/35457566
downvote count: 1
accepted answer of: http://stackoverflow.com/q/23183744
has comment: http://stackoverflow.com/comment/35457582
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23183744
has body: You can do it using regex as follows: String d = Str.split("\\W+"); Updated answer for your question: String d = Str.split("\\b");
upvote count: 8
has comment: http://stackoverflow.com/comment/35457642
has comment: http://stackoverflow.com/comment/58742436
type: Answer

http://stackoverflow.com/comment/35634226
score: 0
type: Comment
has text: Thanks didn't notice the typo. Sorry about that.
type: AnswerComment
comment on: http://stackoverflow.com/a/23257336

http://stackoverflow.com/comment/35400970
score: 0
type: Comment
has text: thanks for the response So it means if i set the time in web.xml and check the condition if(session == null){ response.sendRedirect(request.getContextPath() + "/login.html"); } will redirect to login page after the session timeout?
type: AnswerComment
comment on: http://stackoverflow.com/a/23149388

http://stackoverflow.com/a/23245190
has body: If you use keyword do{ you have to include while keyword to define until when the code specified between do{ and while should do stuff Solution is include while condition like this do{ //do your stuff here... switch etc. }while(condition) //condition must return boolean value or be boolean expression I see your while there so the error is maybe wrong { or } placement EDIT: I copy pasted your code in Netbeans and yes your problem is that your do{} is missing while statement Heres your working code with added while public static void main(String[] args) { int choice; int index; String name = " "; int goals; int points; int noofthings; int location; Footballer tempObject; String search = ""; int step; noofthings = 0; do{ choice = menu(); switch(choice) { case 1 : { step = 0; System.out.print("Enter a name "); name = EasyIn.getString(); while((step &lt; noofthings) &amp;&amp; !(names[step].getName().equals(name))) { step++; } if(step &lt; noofthings) { System.out.println("Name already exists, choose another "); } else { System.out.println("Enter amount of goals "); goals = EasyIn.getInt(); System.out.println("Enter amount of points "); points = EasyIn.getInt(); tempObject = new Footballer(name, goals, points); location = findPlace(names, tempObject, noofthings); noofthings = addOne(names, location, tempObject, noofthings); } } } }while(variable!=anotherVariable); //added this line }
type: Answer
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/23245019
downvote count: 0

http://stackoverflow.com/q/23176815
answer count: 1
tagged with: jar
has comment: http://stackoverflow.com/comment/35453036
has comment: http://stackoverflow.com/comment/35454242
favorite count: 0
has comment: http://stackoverflow.com/comment/76107721
has comment: http://stackoverflow.com/comment/35445934
has body: I have a simple java application that i've got running in Netbeans, show below. i've added the sqlite-jdbc.jar in Netbeans to access the database but i'd like to know if i can use the .jar from the Command Prompt and if so how? Thanks. import java.io.*; import java.sql.Connection; import java.sql.DriverManager; import javax.swing.JOptionPane; import java.sql.*; import javax.swing.*; /** * * @author James */ public class TestProj{ /** * @param args the command line arguments */ public static void main(String[] args) { // TODO code application logic here ConnectDb(); } public static Connection ConnectDb(){ try { Class.forName("org.sqlite.JDBC"); Connection conn = DriverManager.getConnection("jdbc:sqlite: C:\\Users\\James\\Documents \\NetBeansProjects\\TestProj\\TestProj.sqlite"); System.out.println("Connection opened successfully!"); Statement stat = conn.createStatement(); String sql = "SELECT kE100 FROM customers" + " WHERE phoneNo = 873333333"; ResultSet rs = stat.executeQuery(sql); System.out.println("name = " + rs.getString("kE100")); conn.close(); return conn; }catch(Exception e){ System.out.println("No Connection!"); return null; } } } C:\Users\James\Documents\NetBeansProjects\TestKamarad\src\testkamarad>javac -cp "C:/Users/James/Desktop/Installers Etc/sqlite-jdbc-3.7.2.jar;" TestKamarad.java C:\Users\James\Documents\NetBeansProjects\TestKamarad\src\testkamarad>java -cp " C:/Users/James/Desktop/Installers Etc/sqlite-jdbc-3.7.2.jar;" TestKamarad Exception in thread "main" java.lang.NoClassDefFoundError: TestKamarad (wrong na me: testkamarad/TestKamarad) at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(Unknown Source) at java.security.SecureClassLoader.defineClass(Unknown Source) at java.net.URLClassLoader.defineClass(Unknown Source) at java.net.URLClassLoader.access$100(Unknown Source) at java.net.URLClassLoader$1.run(Unknown Source) at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPriv…
has answer: http://stackoverflow.com/a/23177072
tagged with: sqlitejdbc
has comment: http://stackoverflow.com/comment/35454244
type: UnansweredQuestion
downvote count: 1
has title: Is it possible to run an application from the Command Line and reference a .jar file too?
tagged with: command-prompt
has comment: http://stackoverflow.com/comment/35454037
tagged with: java
score: -1
type: Question
linked to: http://stackoverflow.com/q/9822256
has comment: http://stackoverflow.com/comment/35455110
has comment: http://stackoverflow.com/comment/35454344
upvote count: 0

http://stackoverflow.com/comment/35387356
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/23143004
type: Comment
has text: that kind of depends on what `doSomething` actually does. Does it modify the list? does it create new elements? where do the returned elements come from? are they created, or are they part of `list`?

http://stackoverflow.com/q/23213891
has answer: http://stackoverflow.com/a/23214299
upvote count: 115
favorite count: 0
duplicate of: http://stackoverflow.com/q/22840170
has title: How to map values in a map in Java 8?
linked to: http://stackoverflow.com/q/22840170
tagged with: lambda
tagged with: java-8
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23214322
tagged with: java
accepted answer: http://stackoverflow.com/a/23214299
type: Question
possible better answer: http://stackoverflow.com/a/23214322
answer count: 2
downvote count: 0
has body: Say I have a Map&lt;String, Integer&gt;. Is there an easy way to get a Map&lt;String, String&gt; from it? By easy, I mean not like this: Map&lt;String, String&gt; mapped = new HashMap&lt;&gt;(); for(String key : originalMap.keySet()) { mapped.put(key, originalMap.get(key).toString()); } But rather some one liner like: Map&lt;String, String&gt; mapped = originalMap.mapValues(v -&gt; v.toString()); But obviously there is no method mapValues.
has comment: http://stackoverflow.com/comment/35512601
score: 115
tagged with: dictionary

http://stackoverflow.com/q/23148109
has comment: http://stackoverflow.com/comment/35395526
has body: I need to get the number of tweets,followers count and friends count of a person say virat kohli.I use Twitter4j jar and my code looks like this import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.util.Properties; import twitter4j.Twitter; import twitter4j.TwitterException; import twitter4j.TwitterFactory; import twitter4j.User; import twitter4j.auth.OAuthAuthorization; import twitter4j.conf.ConfigurationBuilder; public class HomePage { public static void main(String[] args) throws IOException, TwitterException { Properties props=new Properties(); InputStream input=new FileInputStream(args[0]); props.load(input); ConfigurationBuilder conf=new ConfigurationBuilder(); conf.setDebugEnabled(true).setOAuthConsumerKey(props.getProperty("ConsumerKey")).setOAuthConsumerSecret(props.getProperty("ConsumerSecret")).setOAuthAccessToken(props.getProperty("AccessToken")).setOAuthAccessTokenSecret(props.getProperty("AccessTokenSecret")); OAuthAuthorization auth = new OAuthAuthorization(conf.build()); Twitter twitter = new TwitterFactory().getInstance(auth); // User user = twitter.verifyCredentials(); User user=twitter.showUser("@imVkohli"); System.out.println(user.getStatusesCount()); System.out.println(user.getFriendsCount()); System.out.println(user.getFollowersCount()); } } All the keys are placed in the property file and iam passing the path of property file as runtime argument. Iam getting following exception 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. message - Could not authenticate you code - 32 If i try to get my timeline then iam not getting this error. Is there an error in the code?
has title: Twitter4j Authentication error
upvote count: 1
type: Question
type: AnsweredQuestion
tagged with: twitter4j
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/23153450
downvote count: 0
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/35395583
accepted answer: http://stackoverflow.com/a/23153450

http://stackoverflow.com/a/23193095
type: AcceptedAnswer
downvote count: 0
has body: "extracted to a different file in like the home directory of my game (where i save the settings and stuff) the basic maps are inside the jar file, so i want them to be extracted on the first startup of the program" You can get the URL by using getClass().getResource() URL url = getClass().getResource("/res/myfile.txt"); Then create a File object from the URI of the URL File file = new File(url.toURI()); Then just perform your normal file operations. if (file.renameTo(new File(System.getProperty("user.home") + "\\" + file.getName()))) { System.out.println("File is moved successful!"); } else { System.out.println("File is failed to move!"); } Assuming your file structure is like below, it should work fine ProjectRoot src res myfile.txt Note: the above is moving the entire file. If you want to extract just the data inside the file, then you can simple use InputStream is = getClass().getResourceAsStream("/res/myfile.txt"); BufferedReader reader = new BufferedReader(new InputStreamReader(is)); The just do normal IO operation with the reader. See here for help with writing the file.
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/23192199
accepted answer of: http://stackoverflow.com/q/23192199

http://stackoverflow.com/comment/35647238
has text: I do not understand the question. What kind of adapter is it?
comment on: http://stackoverflow.com/a/23286787
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/124401793
type: Comment
has text: You are a lifesaver, Tomas. Thanks a lot. I used java config and it worked like a charm jobBuilderFactory.get("jobName").listener(new BatchJobExecutionListener()).start...
type: AnswerComment
comment on: http://stackoverflow.com/a/23194323
score: 0

http://stackoverflow.com/comment/36043865
comment on: http://stackoverflow.com/q/23203778
type: Comment
type: QuestionComment
has text: The standard for 3-channel JPEG uses Y Cb Cr, often decimating the chrominance channels to reduce data volume. The luminance isn't strongly coupled to the chrominance, so you get better compression when you optimize the two separated.
score: 0

http://stackoverflow.com/comment/35478922
comment on: http://stackoverflow.com/a/23195927
type: Comment
score: 0
type: AnswerComment
has text: @SunnyGarg How is it irrelevant? It is exactly what he asked for and not just that, it is the solution from the official docs. That's how you differentiate between which tab has been clicked.

http://stackoverflow.com/a/23136835
has comment: http://stackoverflow.com/comment/35396655
has comment: http://stackoverflow.com/comment/35393364
upvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/35396953
has body: You can overlay an ImageView over the camera preview. put both the SurfaceView and the ImageView within a FrameLayout both match_parent and the image must be on top. Set to an black image with transparent circle in the middle.
answers question: http://stackoverflow.com/q/23136695
downvote count: 0
has comment: http://stackoverflow.com/comment/35395794
score: 1

http://stackoverflow.com/comment/35562940
type: Comment
comment on: http://stackoverflow.com/a/23242709
score: 0
type: AnswerComment
has text: The order for any `HashSet` is undefined. Especially, it is not consistent. The order in which objects are put/removed, the capacity of the `HashSet`, and the distribution of hash values across the items will probably all affect the order. So there's no way to rely on any particular ordering.

http://stackoverflow.com/comment/35422980
type: Comment
has text: How would I initialize and use the getters?
comment on: http://stackoverflow.com/a/23163365
score: 0
type: AnswerComment

http://stackoverflow.com/a/23343851
upvote count: 2
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/56341942
type: Answer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23274539
answers question: http://stackoverflow.com/q/23274539
has body: The solution to this was to use the classpath option as described here: http://mojo.codehaus.org/license-maven-plugin/examples/example-add-license.html Using a license resolver from classpath Since version 1.3, it is possible to use a license resolver from classpath (means included into a jar or any dependency of the plugin dependencies). Just use the classpath:// protocol in the plugin configuration. Imagine you have a license resolver in an artifact com.my:extraLicenseResolvers:1.0 in package foo.bar Next example show how to use this license resolver from classpath: org.codehaus.mojo license-maven-plugin 1.6 my_license classpath://foo/bar update-file-header process-sources com.my extraLicenseResolvers 1.0 What wasn't obvious about this is that you really do need to have a separate package with the license files. There doesn't seem to be a way to keep this information in the parent pom project. In the end, this solution worked and we were able to have a single location for our license info that all of the children pom files use.
score: 2

http://stackoverflow.com/comment/35490537
comment on: http://stackoverflow.com/a/23202313
type: AnswerComment
type: Comment
score: 1
has text: @ᴋᴇʏsᴇʀ I have added a more detailed example.

http://stackoverflow.com/a/23234082
accepted answer of: http://stackoverflow.com/q/23232454
type: Answer
answers question: http://stackoverflow.com/q/23232454
has body: Use the Timer class to schedule work to be done in the future. Use the Scheduler for deferring some logic into the immediate future Scheduler says: If you are using a timer to schedule a UI animation, use AnimationScheduler instead. The browser can optimize your animation for maximum performance. For detailed description please have a look at DevGuideCodingBasicsDelayed. GWT provides three classes that you can use to defer running code until a later point in time: Timer DeferredCommand IncrementalCommand Please have a look on below posts: Using the GWT Scheduler GWT: Timer and Scheduler Classes
score: 3
upvote count: 3
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/35365976
type: QuestionComment
comment on: http://stackoverflow.com/q/23131681
has text: I think this task is impossible to solve :(
score: 0
type: Comment

http://stackoverflow.com/comment/59279321
type: Comment
has text: I found this solution to work without modifying the pom.xml once I replicated the package requirements for the .java classes.
comment on: http://stackoverflow.com/a/31631812
score: 0
type: AnswerComment

http://stackoverflow.com/q/23219209
upvote count: 5
tagged with: java
score: 5
has body: As I know, and I used very little java regex, there is a method (or tool) to convert a control xsd:pattern in java regex? My xsd: pattern is as follows: &lt;xsd:simpleType name="myCodex"&gt; &lt;xsd:restriction base="xsd:string"&gt; &lt;xsd:pattern value="[A-Za-z]{6}[0-9]{2}[A-Za-z]{1}[0-9]{2}[A-Za-z]{1}[0-9A-Za-z]{3}[A-Za-z]{1}" /&gt; &lt;xsd:pattern value="[A-Za-z]{6}[0-9LMNPQRSTUV]{2}[A-Za-z]{1}[0-9LMNPQRSTUV]{2}[A-Za-z]{1}[0-9LMNPQRSTUV]{3}[A-Za-z]{1}" /&gt; &lt;xsd:pattern value="[0-9]{11,11}" /&gt; &lt;/xsd:restriction&gt; &lt;/xsd:simpleType&gt;
downvote count: 0
answer count: 1
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35523020
tagged with: regex
tagged with: xsd
type: Question
has title: how can I convert xsd: pattern in java regex
has answer: http://stackoverflow.com/a/23221968

http://stackoverflow.com/q/23254425
has answer: http://stackoverflow.com/a/23290613
has title: Quickbooks Online Rest API Reporting Java ERROR
downvote count: 0
score: 1
tagged with: java
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/30628762
upvote count: 1
tagged with: quickbooks-online
has body: I have used a tutorial and the Java SDK to pull reports from the new REST reporting API. https://developer.intuit.com/docs/0025_quickbooksapi/0055_devkits/0201_ipp_java_devkit_3.0/reports I have used the following code as specified by the tutorial: String consumerKey = "XXXXXXXXXXXTDF2GEP0tlzdGxxpQRfSb4"; String consumerSecret = "XXXXXXXXXXYuy9CLaWiyAVHTowK0NuGMKN1X"; String accessToken = "XXXXXXXXXXXGPU4SUGAaeyhRJFp05NUg4s8QnbY4eI4U"; String accessTokenSecret = "XXXXXXXXXXXgkz50A8Ho3Z3pgMO8QFh2ZBv3XjI"; OAuthAuthorizer oauth = new OAuthAuthorizer(consumerKey, consumerSecret, accessToken, accessTokenSecret); String appToken = "011e510ebf68ab4683b8a06b21f6228dfa03"; String companyID = "1067363490"; try { Context context = new Context(oauth, appToken, ServiceType.QBO, companyID); ReportService service = new ReportService(context); service.setStart_date("2014-02-01"); service.setEnd_date("2014-04-20"); service.setAccounting_method("Accrual"); Object report = service.executeReport(ReportName.PROFITANDLOSS.toString()); String name = "ryan"; //System.out.println(report.toString()); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } Inside service.executeReport it keeps throwing a java.lang.ClassCastException: com.intuit.ipp.data.Report cannot be cast to com.intuit.ipp.core.Response Has anyone got these reports to work with the Java SDK? Am I doing something wrong?
favorite count: 0
tagged with: rest
type: UnansweredQuestion

http://stackoverflow.com/a/23176331
type: Answer
has body: Thank you @omer681, you pointed me in the right direction. My fix involved changing the Hole values from enums to ints in an array. Then, the in recursion, an 'itter' int was passed where the for loop would start. In recursion, this number was inherited from the for loop. This way, each step in a for loop would limit the number of steps in the loops below. This works for any number of balls and score holes. private static void scoreCalc(int targetScore, int score, int ballNumber, int itter) { for(int i = itter; i &lt; HOLEVALUES.length; i++) { ... if (ballNumber &gt; 0) { scoreCalc(targetScore, score, ballNumber, i); ... } } private static void scoreCalc(int targetScore) { scoreCalc(targetScore, 0, BALLCOUNT, 0); }
accepted answer of: http://stackoverflow.com/q/23174838
score: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23174838

http://stackoverflow.com/q/23133200
score: 3
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/23133383
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35368275
tagged with: regex
has body: I am trying to create a regex that will look for the number of forward slashes (/) in the beginning of a String and if their are odd number of backslahes they will be replaced by empty String String regex = "^/(//)*"; System.err.println("Case1: " + "/".replaceAll(regex,"")); System.err.println("Case2: " + "//".replaceAll(regex,"")); System.err.println("Case3: " + "///".replaceAll(regex,"")); System.err.println("Case4: " + "/b".replaceAll(regex,"")); System.err.println("Case5: " + "//b".replaceAll(regex,"")); System.err.println("Case6: " + "///b".replaceAll(regex,"")); My regex is working with case 1,3,4 and 6 but in case 2 and 5 it is printing / and /b as output respectively. Please help.
upvote count: 3
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/23133417
has title: Replacing if a character comes odd number of times in the begining of a String || Regex
answer count: 2

http://stackoverflow.com/comment/35395966
score: 5
comment on: http://stackoverflow.com/q/23148382
type: Comment
type: QuestionComment
has text: solved and deleted. stop in org.a.b.MainClass.method1 was needed

http://stackoverflow.com/comment/35663712
comment on: http://stackoverflow.com/a/23237786
type: AnswerComment
score: 0
type: Comment
has text: This happens even when using a simple Workflow action, with no coordinator. So the problem is something more basic than this. I'm familiar with the "start time in the future" issue, but in this case, the task hangs without even *getting* a startTime, as far as I can tell.

http://stackoverflow.com/comment/35446541
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23176548
type: QuestionComment
has text: can you paste a bit more code from both of your classes?

http://stackoverflow.com/comment/35471187
score: 0
has text: what are your inputs?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23191155

http://stackoverflow.com/q/23158311
has answer: http://stackoverflow.com/a/23158511
has comment: http://stackoverflow.com/comment/35427526
has title: How to double buffer awt objects
linked to: http://stackoverflow.com/q/6255106
type: AnsweredQuestion
has body: I am trying to make a java program where you can draw (like paint) so far, I have pen size, and different colors. The only problem is the rectangles (theyre just there so you can see where to click) flicker whenever you're drawing. Here is my code: import java.awt.*; import java.awt.event.*; import java.applet.*; @SuppressWarnings({ "serial" }) public class DrawGame extends Applet implements MouseListener, MouseMotionListener, ActionListener { int x, y, width, height, colorx, colory, pen; boolean isRed = false, isYellow = false, isBlue = false, isGreen = false, isGrey = false, isBlack = false; String color = "Black"; Image backbuffer; Graphics background; Button clear; CheckboxGroup radioGroup; Checkbox ps4, ps8, ps16, ps32, ps64; public void init() { clear = new Button("Clear"); radioGroup = new CheckboxGroup(); ps4 = new Checkbox("4", radioGroup, false); ps8 = new Checkbox("8", radioGroup, true); ps16 = new Checkbox("16", radioGroup, false); ps32 = new Checkbox("32", radioGroup, false); ps64 = new Checkbox("64", radioGroup, false); setLayout(new FlowLayout()); setSize(900, 700); width = getSize().width; height = getSize().height; add(clear); add(ps4); add(ps8); add(ps16); add(ps32); add(ps64); setBackground(Color.WHITE); backbuffer = createImage(width, height); background = backbuffer.getGraphics(); addMouseListener(this); addMouseMotionListener(this); } public void mousePressed(MouseEvent v) { if(x &lt; 80) { //so you can't draw where the squares are colorx = v.getX(); colory = v.getY(); } if(colorx &gt;= 25 &amp;&amp; colory &lt;= 50 &amp;&amp; colory &gt;= 25 &amp;&amp; colorx &lt;= 75) { isRed = true; isBlue = false; isBlack = false; isGreen = false; isGrey = false; isGreen = false; isYellow = false; color = "Red"; } else if(colorx &gt;= 25 &amp;&amp; colory &lt;= 100 &amp;&amp; colory &gt;= 75 &amp;&amp; colorx &lt;= 75) { isBlack = true; isRed = false; isBlue = false; isGreen = false; isGrey = false; isGreen = false; isYellow = false; color = "Black"; } else…
tagged with: java
linked to: http://stackoverflow.com/q/2845346
accepted answer: http://stackoverflow.com/a/23158511
type: Question
tagged with: double-buffering
tagged with: awt
score: 0
answer count: 1

http://stackoverflow.com/comment/35617254
type: Comment
comment on: http://stackoverflow.com/a/23266305
has text: "@Raghunandan" unfortunately i saw your comment one hour later.I am sorry i don't want to be rude.
score: 0
type: AnswerComment

http://stackoverflow.com/a/23282239
has body: Superclass methods aren't automatically called. When you override toString() in Player and you call toString() on an instance of Player the only code that gets run is Player's toString(). If you want to include the toString() of Character in your toString() of Player you need to make that explicit by calling super.toString() in Player's toString(). Your Player implementation of toString() could be amended to include my recommendation as follows: /** * @return a string with player information */ @Override public String toString() { String string = "Name: " + name + " Type: " + type + "\n"; if(isAlive()) { string += "Is alive with health: " + health; } else { string += "Is dead."; } string += "\n"+ name + "'s backpack contains the following items: \n"; for(Item item : backpack.values()) { string += item; } return super.toString() + string; } The salient part of this is changing: return string; To: return super.toString() + string;
type: Answer
score: 0
answers question: http://stackoverflow.com/q/23281880

hql
tag name: hql
type: Tag
tags question: http://stackoverflow.com/q/23158880
tags question: http://stackoverflow.com/q/23156988
tags question: http://stackoverflow.com/q/23247457

http://stackoverflow.com/comment/35692405
has text: Thank you, good article and I appreciate the references.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23284095

http://stackoverflow.com/a/23145585
answers question: http://stackoverflow.com/q/23136079
has comment: http://stackoverflow.com/comment/35423264
accepted answer of: http://stackoverflow.com/q/23136079
has comment: http://stackoverflow.com/comment/71331393
score: 5
has body: Allocate a ByteBuffer per accepted channel, and save it as the key attachment, or in a session object that is used as the key attachment, that might contain other things as well. When OP_READ fires, you should then read. Don't futz around queuing things. NB OP_WRITE is almost always ready, except when the socket send buffer is full. It is therefore not correct to register it as an interestOp except when the socket buffer is full, which you can detect by write() returning zero. At all other times you should just write when you have something to write. If write() returns zero, then register OP_WRITE (and not OP_READ), and when you get it, retry the write: if it completes, deregister OP_WRITE and register OP_READ. If you have OP_WRITE registered all the time, the selector will never wait, it will just spin.
upvote count: 5
has comment: http://stackoverflow.com/comment/35452036
has comment: http://stackoverflow.com/comment/35406355
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/comment/35582733
has text: It's funny to read that your answer starts with a question while the OP's question actually doesn't state a question :)
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23253183

http://stackoverflow.com/comment/35538199
type: Comment
comment on: http://stackoverflow.com/a/23172356
has text: thanks for your comment. I have edited the post to make code bit more legible using code constructs. I realize when adding comment, code can't be formatted since the HTML editor appears only for Answers and while Editing original post. Getting used to posting comments now.
type: AnswerComment
score: 0

http://stackoverflow.com/a/23138590
answers question: http://stackoverflow.com/q/23138523
has comment: http://stackoverflow.com/comment/35378951
downvote count: 0
score: 6
has comment: http://stackoverflow.com/comment/35379107
type: Answer
upvote count: 6
has body: Short answer: no, your analysis is not correct. If you remove something from a collection while you're iterating over it (without using the iterator), the iterator doesn't have a good way to keep track of where it is. Use a simpler example: List. Say the iterator is at index 10, and you remove index 5. That removal shifts all of the indices. Now you call next() on the iterator, and you.. what? Go to index 11? Stay at index 10? The iterator has no way to know. Similarly, if you add something to a collection while you're iterating over it (without using the iterator), the iterator doesn't know if that was added before or after the current index, so the next() function is broken. This doesn't even get into data structures where the iterator order depends on what's in the collection, but the issues are similar to the ones I listed above.

http://stackoverflow.com/comment/35542475
has text: You are checking first in your code if ArrayList2.size() > ArrayList1.size() and after that you are operating your for-loop from 0 to ArrayList2.size() length. Because ArrayList2 is bigger, you will not find the last elements in ArrayList1 in point i ! I think your for-loop should go from 0 until ArrayList1.size() since that one is shorter
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23230972
score: 0

http://stackoverflow.com/q/23183592
favorite count: 0
accepted answer: http://stackoverflow.com/a/23183671
has answer: http://stackoverflow.com/a/23183671
type: AnsweredQuestion
upvote count: 0
tagged with: reflection
tagged with: java
score: -1
has body: I am having a bit of a hassle with classes. I must admit I didn't search very well, but the most simple Google search didn't lead me to a proper answer. Since I don't understand why this problem is happening, I thought I would ask for some explanation on it. I have the following code (or at least the code that's relevant): public class someClass { private final Class&lt;? extends TileGeneric&gt; tileClass; public someClass(Class&lt;? extends TileGeneric&gt; clazz) { // Some more checks go here, but it's about the class, not this code tileClass = clazz; } public TileGeneric getInstance(World world) { if( tileClass != null ) { TileGeneric tile = ReflectionUtil.getInstance(tileClass, null, new Object[] {} ); // This method is not relevant, but what you should know is that no compile errors occur here if(tile == null) tile = ReflectionUtil.getInstance(tileClass, World.class, world); // Here does a compile occur: (see further details below this code) } return null; } } Okay, that is more or less the most important code of my class where the problem lies. The compile error I'm getting is at the second ReflectionUtil.getInstance call: "The method getInstance(Class&lt;? extends T&gt;, Class&lt;?&gt;[], Object...) in the type ReflectionUtil is not applicable for the arguments (Class&amp;lt;capture#9-of ? extends TileGeneric&amp;gt;, Class&amp;lt;World&amp;gt;, World)." So the error lies somewhere in what I'm assuming is due to those blocks, but I'm quite unaware if that even is the issue. The very odd thing is that the first call does not error, and that is what really breaks my mind. If there is already an explanation out there that I couldn't find, please link me to it. I'm very grateful for all help, and really want to know why this is occurring so I can void it in the future.
type: Question
has title: Reflection and Generics
answer count: 1
downvote count: 1

http://stackoverflow.com/comment/35412626
has text: I solved the problem stated above but now i have an error that states: IOException: Connection reset. (on client side) It has something to do with sending to the server. Is there a limit on the size of the byte array you can send over sockets?
comment on: http://stackoverflow.com/q/23155333
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35533790
has text: insert looks wrong. It inserts twice if key < this.key and not at all if >.
type: Comment
comment on: http://stackoverflow.com/q/23226365
type: QuestionComment
score: 2

http://stackoverflow.com/q/23170959
score: 1
has title: How can I avoid this Ant Build error?
tagged with: ant
tagged with: java
tagged with: eclipse
has body: What is this ant build error in eclipse? When I click the Ant Build I have the error message shown below. Build failed Reason: Unable to find an Ant file to run. Could you please help me solve it?
downvote count: 0
answer count: 1
favorite count: 0
type: UnansweredQuestion
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/23170995

http://stackoverflow.com/q/23198394
has comment: http://stackoverflow.com/comment/35483148
score: 1
has answer: http://stackoverflow.com/a/23198513
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/35483319
type: Question
has answer: http://stackoverflow.com/a/23198601
downvote count: 0
tagged with: rest
has answer: http://stackoverflow.com/a/23214487
tagged with: jax-rs
has body: Is there any method or annotation in JAX-RS that allows me to call a method before or after the matching request method is executed. Lets assume I have the following service class: public class MyService { ... @POST @Path("{id : \\d+}") @Consumes(MediaType.APPLICATION_JSON) public Response updateServiceObject(@PathParam("id") long id, InputStream is) { try { // Fetch the service object ... ServiceObject updatedServiceObj = readServiceObject(is); // ... and try to update it. updated = getServiceObjectDao().update(updatedServiceObj); if (updated == 0) { throw new WebApplicationException(Response.Status.NOT_FOUND); } return Response.ok().build(); } catch (Exception e) { throw new WebApplicationException(Response.Status.BAD_REQUEST); } } @DELETE @Path("{id : \\d+}") public Response deleteServiceObject(@PathParam("id") long id) { try { getServiceObjectDao().deleteById(id); } catch (Exception e) { throw new WebApplicationException(Response.Status.BAD_REQUEST); } return Response.ok().build(); } } I would like to add a method logEvent(), which logs which method has been called and which parameters (just @PathParam values) had been provided. So it has to bee invoked before or after each call.
favorite count: 0
has answer: http://stackoverflow.com/a/23211646
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35488791
tagged with: web-services
answer count: 4
has title: Calling a method before or after each @POST or @DELETE request in JAX-RS

http://stackoverflow.com/a/32467075
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/23201663
upvote count: 1
has body: Try adding internet permissions in your manifest file? &lt;uses-permission android:name="android.permission.INTERNET" /&gt;
type: Answer

http://stackoverflow.com/a/23267655
has body: Can we call non-static function inside the static function, in PHP? Yes but not adviced. As $this keyword won't be available under static context. However, you can do that using the static / self keyword but that will result in a Strict standards notice Strict standards: Non-static method A::foo() should not be called statically Demonstration on Code Viper So better not do it !
has comment: http://stackoverflow.com/comment/35608525
has comment: http://stackoverflow.com/comment/35608601
has comment: http://stackoverflow.com/comment/35608212
has comment: http://stackoverflow.com/comment/35608430
has comment: http://stackoverflow.com/comment/35608468
answers question: http://stackoverflow.com/q/23267527
downvote count: 0
has comment: http://stackoverflow.com/comment/35608656
type: Answer
score: 2
upvote count: 2

http://stackoverflow.com/comment/35395257
type: Comment
has text: It doesn't matter how and where I'm binding those values, I'm still getting the old bean, instead it should be the bean with the values set in the init method right? Its obviously session scoped but it doesn't die even after session timeout, it only dies after restarting server. I hope I'm clear.
score: 0
comment on: http://stackoverflow.com/a/23137171
type: AnswerComment

http://stackoverflow.com/a/23172201
type: Answer
accepted answer of: http://stackoverflow.com/q/23171753
has comment: http://stackoverflow.com/comment/35438873
has comment: http://stackoverflow.com/comment/35440134
has comment: http://stackoverflow.com/comment/35440506
answers question: http://stackoverflow.com/q/23171753
type: AcceptedAnswer
has body: You use 2 different instances of the Movements class (Movements Movements = new Movements(); in OpenPilot and FXMLDocumentController). Since you don't use static fields / methods, you won't get any data from one instance to the other. You have to get the Movements object from the controller: Controller: public class FXMLDocumentController implements Initializable { Movements movements = new Movements(); public Movements getMovements() { return movements; } @FXML public Slider SpeedSlider; @FXML public Slider TurnsSlider; @Override public void initialize(URL url, ResourceBundle rb) { //Send GUI Information movements.GetSliders(SpeedSlider, TurnsSlider); } } Use a instance of the FXMLLoader instead of the static method to get the Movements field from the controller: Main class: public class OpenPilot extends Application { Movements movements; @Override public void start(Stage stage) throws Exception { FXMLLoader fxmlLoader = new FXMLLoader(); // use non-static load method here Parent root = fxmlLoader.load(getClass().getResource("FXMLDocument.fxml").openStream()); // get movements from via controller FXMLDocumentController controller = fxmlLoader.&lt;FXMLDocumentController&gt;getController(); movements = controller.getMovements(); Scene scene = new Scene(root); scene.setOnKeyPressed(new EventHandler&lt;KeyEvent&gt;() { @Override public void handle(KeyEvent Key) { movements.GetKeys(Key); } }); stage.setScene(scene); stage.show(); } /** * @param args the command line arguments */ public static void main(String[] args) { launch(args); } }
has comment: http://stackoverflow.com/comment/35440093
has comment: http://stackoverflow.com/comment/35439420
score: 0
has comment: http://stackoverflow.com/comment/35439633

http://stackoverflow.com/comment/35378274
type: QuestionComment
score: 6
has text: The first thing you should do is read our [`servlets`](http://stackoverflow.com/tags/servlets/info) info page. Don't put HTML in Java code. Don't put Java code in HTML.
comment on: http://stackoverflow.com/q/23138591
type: Comment

http://stackoverflow.com/q/23211545
tagged with: rxtx
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/35511083
has title: Handling ANSI codes in JTextArea
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35515339
has answer: http://stackoverflow.com/a/23234737
tagged with: java
has comment: http://stackoverflow.com/comment/35509205
has body: I am implementing new tool which supports serial communication using RxTx library. My environment here is: Provided user interface to execute commands and display input from serail connection. My Problem here is: when i am reading data from serial port it was printing some specail characters like: 0[m, &lt;-m... which i dont want to print in terminal. so how to restrict those values from my serial reader. this is my code to read data from inputstream which is there in serialEvent(SerialPortEvent evt) function. int length = input.available(); byte[] array = new byte[length]; int numBytes = input.read(array); for (int i = 0; i &lt; numBytes; i++) { if (array[i] != Constants.NEW_LINE_ASCII) { logText = new String(new byte[] {array[i]}); textArea.append(logText); } else { textArea.append("\n"); } } Thanks in advance
type: Question
tagged with: jtextarea

http://stackoverflow.com/comment/35600735
type: Comment
has text: What do you mean, you can't use properties in versions? I've been using them since Maven 2. They just have to be locally resolvable.
type: AnswerComment
comment on: http://stackoverflow.com/a/23263262
score: 0

multimap
tags question: http://stackoverflow.com/q/23285609
type: Tag
tag name: multimap

http://stackoverflow.com/comment/35551020
has text: That said, just using newCachedThreadPool() instead of newFixedThreadPool() will allow having an arbitrary number of threads.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23235826

http://stackoverflow.com/a/23155551
has comment: http://stackoverflow.com/comment/35408096
has comment: http://stackoverflow.com/comment/35408838
score: 0
has comment: http://stackoverflow.com/comment/35409922
has comment: http://stackoverflow.com/comment/35427029
has comment: http://stackoverflow.com/comment/35408269
type: Answer
has body: checkout this for video: Intent intent = new Intent(Intent.ACTION_PICK); intent.setType("video/*"); intent.setAction(Intent.ACTION_GET_CONTENT); startActivityForResult(Intent.createChooser(intent,"Select Video"), SELECT_VIDEO); and this for images: Intent intent = new Intent(Intent.ACTION_PICK); intent.setType("image/*"); intent.setAction(Intent.ACTION_GET_CONTENT); startActivityForResult(Intent.createChooser(intent,"Select Images"), SELECT_PHOTO); and in onActivityResult try this : if (requestCode==SELECT_VIDEO) { //take whatever video action }else if(requestCode==SELECT_PHOTO){ //take whatever image action }
answers question: http://stackoverflow.com/q/23154790
has comment: http://stackoverflow.com/comment/35410835
has comment: http://stackoverflow.com/comment/35409805

http://stackoverflow.com/q/23208977
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23209029
tagged with: java
tagged with: hibernate
possible better answer: http://stackoverflow.com/a/23209029
type: Question
answer count: 2
accepted answer: http://stackoverflow.com/a/23208996
score: 0
has body: In a very simplified way, I'm trying to create the following structure: Table Post id (PK) name content Table Tag post_id (FK to post id) name So that a post might have many tags, but the tags don't have a primary id. (the primary key so far would be the composite post_id + name) Now what I wanted to know is if it is a bad practice (to omit the id column in the tag table) and what would be the possible values to use as a primary key for the tag table when using hibernate.
tagged with: sql
has answer: http://stackoverflow.com/a/23208996
has title: Hibernate - What primary key should I use in a one to many relationship without an ID on the child table

http://stackoverflow.com/q/23229725
has answer: http://stackoverflow.com/a/23230037
tagged with: java
tagged with: http://stackoverflow.com/tag/json
accepted answer: http://stackoverflow.com/a/23230037
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/35540433
has title: JSON Parsing creating error
has comment: http://stackoverflow.com/comment/35540329
has answer: http://stackoverflow.com/a/23229893
has body: I am trying to parse Rotten Tomatoes JSON API to my App. This is the layout: &lt;!-- ListRow Left side Thumbnail image --&gt; &lt;LinearLayout android:id="@+id/thumbnail" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_marginRight="5dip" android:padding="3dip" &gt; &lt;ImageView android:id="@+id/list_image" android:layout_width="60dip" android:layout_height="60dip" android:contentDescription="@string/app_name" android:src="@drawable/poster" /&gt; &lt;/LinearLayout&gt; &lt;!-- Rightend Arrow --&gt; &lt;ImageView android:id="@+id/imageView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentRight="true" android:layout_centerVertical="true" android:contentDescription="@string/app_name" android:src="@drawable/arrow" /&gt; &lt;!-- City --&gt; &lt;TextView android:id="@+id/namelisttext" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_toRightOf="@id/list_image" android:layout_marginLeft="75dip" android:gravity="top" android:paddingBottom="10dip" android:text="Movie Name" android:textColor="#040404" android:textSize="25sp" android:textStyle="bold" android:typeface="sans" /&gt; &lt;!-- Weather Information --&gt; &lt;ImageView android:id="@+id/rtscore" android:layout_width="18dip" android:layout_height="18dip" android:layout_alignLeft="@id/namelisttext" android:layout_below="@id/namelisttext" android:contentDescription="@string/app_name" android:src="@drawable/rtscore" /&gt; &lt;TextView android:id="@+id/rtscoretext" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="2dp" android:layout_toRightOf="@+id/rtscore" android:layout_alignTop="@id/rtscore" android:text="Score" android:textColor="#343434" android:textSize="15sp" /&gt; &lt;ImageView android:id="@+id/audscore" android:layout_width="18dip" android:layout_height="18dip" android:layout_below="@id/namelisttext" …
score: 0
tagged with: android
possible better answer: http://stackoverflow.com/a/23229893
has comment: http://stackoverflow.com/comment/35540120
has comment: http://stackoverflow.com/comment/35540158
type: AnsweredQuestion

http://stackoverflow.com/q/23210357
upvote count: 1
has title: Connect SYS DBA with no password using JAVA
type: Question
has answer: http://stackoverflow.com/a/23213746
answer count: 2
tagged with: sql
downvote count: 0
favorite count: 0
tagged with: oracle-database
tagged with: thin
has body: I want to connect oracle DB with JAVA, I have code like this : Class.forName("oracle.jdbc.driver.OracleDriver"); dbURL = "jdbc:oracle:thin:@localhost:1521:DB"; con = DriverManager.getConnection(dbURL, "sys as sysdba" , ""); return con; it's not working, but I tried with command promt like this conn /as sysdba, it can be Connected. I have beed googling about this article but all of code not work. Anyone can help. Thanks
type: UnansweredQuestion
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/23210872

http://stackoverflow.com/a/26291595
has comment: http://stackoverflow.com/comment/43412554
has body: I'm using JASPIC for my authentication, but JASPIC has one limitation you need to contend with (if you want things standard). You're limited to having no dependencies outside of the Java EE 7 API. This means access to JDBC resources which require a driver is not a capability that is explicitly stated in the standards. In my OpenID Connect implementation I used Google as my secure store, which also presents me with the Google login form. That is a larger example of using JASPIC though. For yourself, you can expose an EJB to the global namespace and use InitialContext to get the EJB. There'd be some code duplication in that you have to copy the EJB remote interface code in two places and ensure the serialVersionIDs are the same on both. The EJB can be used to connect to the JPA resources to get your authorization data. Use EJBs, because the other two options you may think of are REST and SOAP which would be exposing something on your web ports and would require some extra configuration to prevent unauthorized access or require they be placed on a different system. A simple JASPIC implementation I created in case you want to learn is the HTTP Header JASPIC module which is intended for integration with more complex systems like SiteMinder.
type: Answer
score: 3
upvote count: 3
answers question: http://stackoverflow.com/q/23265594
downvote count: 0

http://stackoverflow.com/q/23218406
type: Question
tagged with: android-viewpager
upvote count: 2
has body: I have two fragment. Fragment 1 has a radio button Fragment 2 Has a textview So, What should I do to display "radio button from fragment 1 was chosen" on text view of fragment 2?? I tried a lot of ways but it does not work :( My code: Fragment 1: public class fragment1 extends Fragment { @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // TODO Auto-generated method stub return inflater.inflate(R.layout.fragment_1, container,false); } } Fragment 2: public class fragment2 extends Fragment { @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // TODO Auto-generated method stub return inflater.inflate(R.layout.fragment_2, container,false); } } Main_Activity: public class MainActivity extends FragmentActivity { ViewPager pager; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); pager=(ViewPager)findViewById(R.id.pager); FragmentManager fm = getSupportFragmentManager(); pager.setAdapter(new MyAdapter(fm)); } class MyAdapter extends FragmentPagerAdapter { @Override public CharSequence getPageTitle(int position){ CharSequence title = null; switch(position) { case 0: title ="Tab 1"; break; case 1: title ="Tab 2"; break; return title; } public MyAdapter(FragmentManager fm) { super(fm); // TODO Auto-generated constructor stub } @Override public Fragment getItem(int position) { // TODO Auto-generated method stub Fragment fragment = null; switch(position) { case 0: fragment = new fragment1(); break; case 1: fragment = new fragment2(); break; return fragment; } @Override public int getCount() { // TODO Auto-generated method stub return 2; } } @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; } } THanks for your Help!!!!!!
tagged with: pager
favorite count: 0
answer count: 0
type: UnansweredQuestion
tagged with: android
score: 2
has title: How to transfer data from fragment to fragment in ViewPager
tagged with: android-fragments
downvote count: 0
tagged with: java

http://stackoverflow.com/comment/35578386
type: Comment
type: QuestionComment
score: 1
has text: The outcome here looks dependent on how paintFrame is called and how often, and isMouseClicked()'s implementation, so you will probably need to show that code and explain what you think it does.
comment on: http://stackoverflow.com/q/23251319

http://stackoverflow.com/comment/35493576
comment on: http://stackoverflow.com/a/23203914
type: Comment
score: 0
has text: I'm feeling a little silly for making the comparison mistake. Can you explain a little further as to why the same string wouldn't have the same byte representation? Thanks for your help!
type: AnswerComment

http://stackoverflow.com/q/23239922
has comment: http://stackoverflow.com/comment/35558002
type: Question
tagged with: httpresponse
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/23240589
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has body: In my application I have used JSON auto suggest functionality to suggest name of user id when stored in cache. So when ever I try to hit the URL the response is getting back the fully qualified email address, PFB - Request - https://wwwsampleweb.com/tc/servlet/AjaxServiceServlet?qtc=james* it is returning the response - {identifier:'name', items: [ {name:'james.goodlife@abc.com', label:'james.goodlife@abc.com'}]} How to stop the response when directly accessing the URL? I have tried to verify the session but this servlet is used for auto sugggesting the username while logging in which means session is not created status. Also we can block the IP but we cannot block all IPs. Could you please assist me how we can stop this? Thanks!
tagged with: servlets
accepted answer: http://stackoverflow.com/a/23240589
type: AnsweredQuestion
has title: How to protect servlet response data when directly accessed using URL
tagged with: jquery
has comment: http://stackoverflow.com/comment/35558470
has comment: http://stackoverflow.com/comment/35557917

regex
tags question: http://stackoverflow.com/q/23143054
tags question: http://stackoverflow.com/q/23274061
tags question: http://stackoverflow.com/q/23203545
tags question: http://stackoverflow.com/q/23265444
tags question: http://stackoverflow.com/q/23183744
tags question: http://stackoverflow.com/q/23236561
tags question: http://stackoverflow.com/q/23223708
tags question: http://stackoverflow.com/q/23273362
tags question: http://stackoverflow.com/q/23218347
tags question: http://stackoverflow.com/q/23230678
tags question: http://stackoverflow.com/q/23180012
tags question: http://stackoverflow.com/q/23288039
tags question: http://stackoverflow.com/q/23264342
tag name: regex
tags question: http://stackoverflow.com/q/23160221
tags question: http://stackoverflow.com/q/23280562
tags question: http://stackoverflow.com/q/23161992
tags question: http://stackoverflow.com/q/23246947
tags question: http://stackoverflow.com/q/23236162
tags question: http://stackoverflow.com/q/23237038
tags question: http://stackoverflow.com/q/23181710
tags question: http://stackoverflow.com/q/23208233
tags question: http://stackoverflow.com/q/23223898
tags question: http://stackoverflow.com/q/23159941
tags question: http://stackoverflow.com/q/23262327
tags question: http://stackoverflow.com/q/23211539
tags question: http://stackoverflow.com/q/23275343
tags question: http://stackoverflow.com/q/23274869
tags question: http://stackoverflow.com/q/23226175
tags question: http://stackoverflow.com/q/23230627
tags question: http://stackoverflow.com/q/23150307
tags question: http://stackoverflow.com/q/23130000
tags question: http://stackoverflow.com/q/23261317
tags question: http://stackoverflow.com/q/23227706
tags question: http://stackoverflow.com/q/23253464
tags question: http://stackoverflow.com/q/23262300
tags question: http://stackoverflow.com/q/23289902
tags question: http://stackoverflow.com/q/23171557
tags question: http://stackoverflow.com/q/23204373
tags question: http://stackoverflow.com/q/23151710
tags question: http://stackoverflow.com/q/23239224
tags question: http://stackoverflow.com/q/23174984
tags question: http://stackoverflow.com/q/23206915
tags question: http://stackoverflow.com/q/23196896
tags question: http://stackoverflow.com/q/23229449
tags question: http://stackoverflow.com/q/23175938
tags question: http://stackoverflow.com/q/23251768
tags question: http://stackoverflow.com/q/23192323
tags question: http://stackoverflow.com/q/23212001
tags question: http://stackoverflow.com/q/23207667
tags question: http://stackoverflow.com/q/23149036
tags question: http://stackoverflow.com/q/23219209
tags question: http://stackoverflow.com/q/23133200
tags question: http://stackoverflow.com/q/23244390
tags question: http://stackoverflow.com/q/23163925
tags question: http://stackoverflow.com/q/23254253
tags question: http://stackoverflow.com/q/23218838
tags question: http://stackoverflow.com/q/23240336
tags question: http://stackoverflow.com/q/23249257
tags question: http://stackoverflow.com/q/23197016
tags question: http://stackoverflow.com/q/23256787
type: Tag
tags question: http://stackoverflow.com/q/23251861
tags question: http://stackoverflow.com/q/23207983
tags question: http://stackoverflow.com/q/23164402
tags question: http://stackoverflow.com/q/23246867
tags question: http://stackoverflow.com/q/23275541
tags question: http://stackoverflow.com/q/23208927

http://stackoverflow.com/q/23268212
answer count: 1
tagged with: attributes
has title: Java Manifest File Codebase attribute
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23269787
accepted answer: http://stackoverflow.com/a/23269787
tagged with: java
tagged with: file
type: Question
tagged with: codebase
has body: I am currently writing a few Ant build scripts for some JAR files, for use with the updated Java security settings as of Java 1.7.0_51. I have run into a problem with the codebase attribute; this attribute apparently requires the exact URL that the code will be stored and accessed via, however this not known at the time of JAR packaging. We build and create our JAR files and then sign them. Is there any way to specify the codebase attribute at a later time without having to unpack the JAR, modify the manifest, repackage the JAR and then re-sign? I understand this is a long shot, I'm just looking for a little clarity on this. Thanks
tagged with: manifest
score: 0

http://stackoverflow.com/a/23259580
score: 2
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 2
accepted answer of: http://stackoverflow.com/q/23259503
has body: So, based on you example, removing the references to GetFilePath, as I don't have access to that source, when I compile your code I get... error: cannot find symbol win1.getContentPane().add(emptyLabel, BorderLayout.CENTER); ^ symbol: variable emptyLabel location: class Starter Which basically means that emptyLabel is not defined. It's possible that your IDE is looking for a matching value that could be passed to the method parameter, again, based on you code, that leaves win1, which obviously isn't going to work (you can't add something to itself or a Window based component to a Container) What you need to to is define and create an instance of some component, such as a JLabel, for example... JLabel emptyLabel = new JLabel(); win1.getContentPane().add(emptyLabel, BorderLayout.CENTER); I'd also suggest you have a read through Initial Thread and make sure you are initialising your UI's within the context of the Event Dispatching Thread
answers question: http://stackoverflow.com/q/23259503
has comment: http://stackoverflow.com/comment/35593839

http://stackoverflow.com/comment/35472048
score: 0
type: Comment
type: QuestionComment
has text: Are you using tabs instead of spaces?
comment on: http://stackoverflow.com/q/23191572

http://stackoverflow.com/comment/35433421
has text: maybe this helps http://stackoverflow.com/questions/13839780/monitor-text-that-is-highlighted
comment on: http://stackoverflow.com/q/23169701
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/79502881
answers question: http://stackoverflow.com/q/23187145
type: Answer
has body: java.time Use only the modern java.time classes for your date-time work. For a date-only value, use LocalDate class. You said: contains the date in string format and looks like (e.g. 21-3-2013 Parse with a formatting pattern that matches your input. DateTimeFormatter f = DateTimeFormatter.ofPattern ( "d-M-uuuu" ) ; LocalDate ld = LocalDate.parse ( "21-3-2013" , f ) ; Tip: Educate the publisher of your data about using only the standard ISO 8601 formats for exchanging date-time values textually. For a date, that is YYYY-MM-DD. Then you can parse directly with no need to bother defining a formatting pattern. Define a map with LocalDate as the type of the key. For a SequencedMap/NavigableMap/SortedMap such as TreeMap, the LocalDate objects know how to sort themselves. LocalDate implements Comparable. So no need for you to provide a Comparator. NavigableMap < LocalDate , String > navMap = new TreeMap<>() ; navMap.put ( ld , s ) ; Tip: Practice first with some dummy data. Use Map.of to populate a map in a literals style. Map < < LocalDate , String > dummyMap = Map.of ( // Non-modifiable map. LocalDate.of ( 2025 , Month.JANUARY , 23 ) , "Alice" , LocalDate.of ( 2026 , Month.JANUARY , 23 ) , "Bob" , LocalDate.of ( 2024 , Month.JANUARY , 23 ) , "Carol" ); NavigableMap < LocalDate , String > navMap = new TreeMap<>() ; navMap.putAll ( dummyMap ) ; // Elements of passed set are automatically sorted by key in our TreeMap. navMap.entrySet().forEach( System.out :: println ) ; // Dump to console.
score: 0

http://stackoverflow.com/q/23222607
tagged with: java
tagged with: compiler-warnings
tagged with: eclipse
has comment: http://stackoverflow.com/comment/35526925
has comment: http://stackoverflow.com/comment/35527245
type: Question
has comment: http://stackoverflow.com/comment/35533848
upvote count: 16
has answer: http://stackoverflow.com/a/23232378
possible better answer: http://stackoverflow.com/a/23232506
has comment: http://stackoverflow.com/comment/35541179
answer count: 3
favorite count: 0
accepted answer: http://stackoverflow.com/a/23232592
linked to: http://stackoverflow.com/q/1752607
downvote count: 0
score: 16
has answer: http://stackoverflow.com/a/23232506
has body: Is that possible to give custom warning message in my own API like below? Is Resource leak:'ois' is never closed message related with Java API or JVM?
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23232592
has title: How to give warning message in own API?

http://stackoverflow.com/comment/35538445
score: 0
has text: @user3445748 I have updated my answer with a link to a Java Tutorial that you might find helpful.
type: Comment
comment on: http://stackoverflow.com/a/23228317
type: AnswerComment

http://stackoverflow.com/a/23255034
type: AcceptedAnswer
has body: Sorry, rookie mistake on my part. No wonder it wasn't working, the second request in my question (the GET, after logging in) wasn't actually passing in the httpContext object that contains the cookies.
has comment: http://stackoverflow.com/comment/117254472
type: Answer
has comment: http://stackoverflow.com/comment/117337040
answers question: http://stackoverflow.com/q/23251941
accepted answer of: http://stackoverflow.com/q/23251941
score: 0

http://stackoverflow.com/comment/35685665
comment on: http://stackoverflow.com/a/23270540
type: AnswerComment
has text: The original has EditText inputSearch; Where and how did you declare Search?
score: 0
type: Comment

http://stackoverflow.com/comment/139125792
score: 0
type: Comment
comment on: http://stackoverflow.com/a/78894532
has text: Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer).
type: AnswerComment

http://stackoverflow.com/comment/35424730
score: 2
has text: It's not possible that the implementation may change, as the behaviour of its close() method is specified in the Javadoc.
comment on: http://stackoverflow.com/a/23164649
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/35461657
type: QuestionComment
has text: maybe look at this? http://stackoverflow.com/questions/1532819/algorithm-efficient-way-to-remove-duplicate-integers-from-an-array. Though I'm not sure how efficient it will be with such a big string.
type: Comment
comment on: http://stackoverflow.com/q/23185933
score: 0

http://stackoverflow.com/comment/35423232
type: AnswerComment
comment on: http://stackoverflow.com/a/23163751
type: Comment
has text: Is there away to solve it with out using ArrayUtils ?
score: 1

finalize
type: Tag
tags question: http://stackoverflow.com/q/23258636
tags question: http://stackoverflow.com/q/23287223
tag name: finalize

http://stackoverflow.com/comment/35387867
type: Comment
comment on: http://stackoverflow.com/q/23143714
score: 0
has text: You're trying to match the guess to the length of the ship through by modding with `parity`?
type: QuestionComment

http://stackoverflow.com/comment/35636932
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23281836
has text: Additionally: when you're dropping exceptions, you probably need to rethink your program's logic.
score: 0

http://stackoverflow.com/comment/35522572
comment on: http://stackoverflow.com/a/23220113
type: Comment
has text: So for example if the element i was adding to the DelayQueue was cities visited E.G. "Paris" and the delay for every city inside the EU has to be 12 minutes and every city outside the EU has to be 6 minutes. i cannot set the delay with queue.offer(*The City*, *The Delay*) ?
score: 0
type: AnswerComment

http://stackoverflow.com/comment/35638158
type: QuestionComment
has text: what version of java?
comment on: http://stackoverflow.com/q/23283118
score: 0
type: Comment

http://stackoverflow.com/q/23285597
tagged with: encryption
tagged with: php
answer count: 1
downvote count: 1
tagged with: java
has title: PHP code to encrypt XMLwhich will be decrypted over Java
has answer: http://stackoverflow.com/a/23285846
upvote count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35642438
type: Question
linked to: http://stackoverflow.com/q/22654565
has body: I am trying to encrypt XML using PHP which will be decrypted over java. While I am doing R&amp;D and i found a code over this link PHP code to decrypt XML encrypted through Java which is doing exactly opposite thing that I am looking for. How can I encrypt XML which comfortably decrypted over java?
tagged with: cryptography
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0
score: -1

http://stackoverflow.com/q/23150719
answer count: 0
has body: I have been needing a list of common Java Exceptions. I need it for an Exception Helper I'm making. This could help a lot more people than me because it can be used as a reference. How you could help: Giving me an Exception commonly found in your code. A link to a list if common exceptions If this isn't a valid question please feel free to remove. Thanks in advance, Curlip
favorite count: 0
score: 13
type: Question
tagged with: exception
has comment: http://stackoverflow.com/comment/96322992
has comment: http://stackoverflow.com/comment/56217021
downvote count: 3
upvote count: 16
tagged with: java
type: UnansweredQuestion
has title: List of common Java Exceptions

http://stackoverflow.com/comment/35383902
score: 0
has text: @azurefrog also how to delete any record from this file ?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23141105

http://stackoverflow.com/q/23154263
tagged with: http://stackoverflow.com/tag/html
downvote count: 0
has comment: http://stackoverflow.com/comment/35408877
favorite count: 0
answer count: 0
type: UnansweredQuestion
tagged with: web-applications
upvote count: 1
tagged with: video
score: 1
tagged with: java
tagged with: resources
type: Question
has comment: http://stackoverflow.com/comment/35405489
has comment: http://stackoverflow.com/comment/36064940
has title: Access video resource from file system in Java Spring web application
has body: From my Java Spring web application I need access video resource which is on file system (outside of the application). I would like to access it via URL on HTML (preferably using HTML 5 tag ). I found some simple servlets. But is it a safe way? Will video player work adequately (e.g. stop video, jump etc.)? What is the best (and easy) way how to access video resource in this case? Thanks

http://stackoverflow.com/q/23254547
score: 4
type: Question
upvote count: 4
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/23254610
favorite count: 0
has comment: http://stackoverflow.com/comment/35584798
tagged with: clojure
accepted answer: http://stackoverflow.com/a/23254610
possible better answer: http://stackoverflow.com/a/23254893
has answer: http://stackoverflow.com/a/23254893
type: AnsweredQuestion
has body: I am trying to figure out how to call a static method with no arguments in Clojure. Two (bad) examples are (sun.misc.Unsafe/getUnsafe) and (Object/getClass), both of which throw a CompilerException caused by a NoSuchFieldException. Yes I know there is a simpler way to call getClass and I should not be using sun.misc.Unsafe at all - just wondering how to call a no-arg static method in Clojure in general.
tagged with: java
has title: How do I call a Java static method with no arguments in Clojure?

http://stackoverflow.com/a/23223887
score: 0
answers question: http://stackoverflow.com/q/23221459
type: Answer
has body: I believe the proper way to do this is with two locks. For example, one for the right leg and for the left leg. The left thread notifies the right and the right thread notifies the left. (After 10 loop iterations, the code just waits forever. You might want to fix that on your own.) Your loop condition can simply be switching the legs with an enum. public class Example { public static void main(String[] args) throws Exception { Object left = new Object(); Object right = new Object(); LegHolder legHolder = new LegHolder(); legHolder.leg = Leg.LEFT; new LeftLegThread(left, right, legHolder).start(); new RightLegThread(left, right, legHolder).start(); } } enum Leg { LEFT, RIGHT } class LegHolder { protected volatile Leg leg; } class LeftLegThread extends Thread { private final Object left; private final Object right; private final LegHolder holder; public LeftLegThread(Object left, Object right, LegHolder holder) { this.left = left; this.right = right; this.holder = holder; } @Override public void run() { try { int i = 0; while (i++ &lt; 10) { synchronized (left) { System.out.println("Left "); synchronized (right) { holder.leg = Leg.RIGHT; right.notify(); } while (holder.leg != Leg.LEFT) left.wait(); } } } catch (InterruptedException e) { e.printStackTrace(); } } } class RightLegThread extends Thread { final Object left; final Object right; private final LegHolder holder; public RightLegThread(Object left, Object right, LegHolder holder) { this.left = left; this.right = right; this.holder = holder; } @Override public void run() { try { synchronized (right) { while (true) { System.out.println("Right "); synchronized (left) { holder.leg = Leg.LEFT; left.notify(); } while (holder.leg != Leg.RIGHT) right.wait(); } } } catch (InterruptedException e) { e.printStackTrace(); } } }

http://stackoverflow.com/a/23207688
has body: The difference is that HTTPS adds a step, which can be seen in the HostnameVerifier interface. It is trying to match the hostname being connected to with the hostname in the SubjectDN or alternative names.
score: 1
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/23206713
downvote count: 0

http://stackoverflow.com/a/23167817
answers question: http://stackoverflow.com/q/23167232
type: Answer
has body: As per your comments your server side classes are not considering the changes. Please try it again after removing all the generated stub and re-compiling the project again. I have highlighted all the stubs that needs to be deleted as shown in below snapshot. -- EDIT -- Try to inspect the RPC calls using Firefox Firebug plugin as shown below :
has comment: http://stackoverflow.com/comment/35430522
has comment: http://stackoverflow.com/comment/35430353
has comment: http://stackoverflow.com/comment/35430376
has comment: http://stackoverflow.com/comment/35430538
has comment: http://stackoverflow.com/comment/35431650
score: 0

http://stackoverflow.com/a/29377765
type: Answer
has body: Seems like you are missing a dependency Add "org.infinispan services" in your MANIFEST.MF file
answers question: http://stackoverflow.com/q/23244296
score: 0

http://stackoverflow.com/q/23276863
tagged with: client
has body: I am attempting to send one character at a time to a server using a Java client. But packets are being grouped even though I disabling Nagle's algorithm. s.setTcpNoDelay(true); Any solutions?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35626498
tagged with: telnet
has comment: http://stackoverflow.com/comment/35625961
tagged with: tcp
has title: Use Java TCP to send character by character to server
tagged with: java
has answer: http://stackoverflow.com/a/23277039
has answer: http://stackoverflow.com/a/23277042
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/35625971
score: 0

http://stackoverflow.com/comment/35606638
type: Comment
has text: I'm trying to understand why you would have duplicate items in the cache at all. I'd approach the problem by maintaining a counter for each item, which indicates how many times it's been accessed.
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23261128

http://stackoverflow.com/comment/35396827
has text: Can't you make `doExecuteMySpecialAlgorithm` actually return the value?
type: QuestionComment
type: Comment
score: 1
comment on: http://stackoverflow.com/q/23148962

integer
tags question: http://stackoverflow.com/q/23219494
tags question: http://stackoverflow.com/q/23254351
tags question: http://stackoverflow.com/q/23208773
tags question: http://stackoverflow.com/q/23271119
tags question: http://stackoverflow.com/q/23249747
tags question: http://stackoverflow.com/q/23164788
tags question: http://stackoverflow.com/q/23223075
tags question: http://stackoverflow.com/q/23278685
tags question: http://stackoverflow.com/q/23275480
tag name: integer
tags question: http://stackoverflow.com/q/23170703
type: Tag
tags question: http://stackoverflow.com/q/23282077

http://stackoverflow.com/comment/35395090
comment on: http://stackoverflow.com/q/23147308
has text: no, there is only the manifest file for third jar.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23257107
has title: Program not polygons
has comment: http://stackoverflow.com/comment/35589461
answer count: 0
score: 0
tagged with: mouselistener
type: UnansweredQuestion
tagged with: swing
type: Question
tagged with: graphics
has comment: http://stackoverflow.com/comment/35589655
tagged with: java
has comment: http://stackoverflow.com/comment/35589500
has body: I got a program running and I call this class and well, after coding it it should do stuff when the mouse drags, but it just does nothing, where is the error? I mean it should work based on the code, but it just stares at me with apparent ambivalent contempt, mocking me. import java.awt.*; import java.awt.event.*; import javax.swing.*; public class simpleWhiteBoard extends JFrame { protected int lastX, lastY; public simpleWhiteBoard() { super("Smile white board"); lastX = 0; lastY = 0; Container c = getContentPane(); c.setBackground(Color.white); addMouseListener(new positionRecorder()); addMouseMotionListener(new LineDrawer()); setBounds(10, 20, 450, 400); setVisible(true); } protected void record(int x, int y) { lastX = x; lastY = y; } private class positionRecorder extends MouseAdapter { public void mouseEntered(MouseEvent e) { record(e.getX(), e.getY()); } public void mousePressed(MouseEvent e) { record(e.getX(), e.getY()); } } private class LineDrawer extends MouseMotionAdapter { public void mouseDragged(MouseEvent e) { Graphics g = getGraphics(); Polygon p = new Polygon(Constants.X, Constants.Y, Constants.X.length); g.setColor(Color.yellow); g.fillPolygon(p); g.setColor(Color.red); p = new Polygon(Constants.X, Constants.Y, Constants.X.length); } } }//finale
tagged with: polygon

http://stackoverflow.com/comment/35397644
type: Comment
comment on: http://stackoverflow.com/a/23148576
score: 0
type: AnswerComment
has text: yes, but what I want is to create new dl on new onClick and keep adding to the exiting ArrayList then the entire ArrayList is converted to String Array using method toStringList, as I have to pass the arguments through bundle to the Monday_list_fragment's ListView

http://stackoverflow.com/a/23231584
answers question: http://stackoverflow.com/q/23229604
has body: if you're free to choose a buildsystem there're rpm and deb packaging plugins for gradle, maven and even ant tasks for deb and rpm. The resulted packages are somewhat limited, but if you don't something special like precise file permissions control, or rpm install triggers etc, they may help you.
downvote count: 0
has comment: http://stackoverflow.com/comment/35548220
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/35550773
upvote count: 1

http://stackoverflow.com/comment/35439172
type: Comment
comment on: http://stackoverflow.com/a/23172806
score: 1
has text: I don't know about your code, but from my experience, it mostly is about your own code. There probably would be a way to speed up the rendering for one platform, but speeding it up on all platforms is going to be tough. In the end, using TexturePaint, you're doing a little more than using Color. There's some information about this on the web. See [1](https://www.java.net/node/646433) and [2](https://community.oracle.com/thread/1267686?start=0&tstart=0). I wouldn't develop a game/graphics intensive app with Java2D. You really should try [JLWGL](http://lwjgl.org/)!
type: AnswerComment

http://stackoverflow.com/comment/35499661
type: QuestionComment
comment on: http://stackoverflow.com/q/23207021
has text: If it expects a short then pushing a long will not work.
score: 0
type: Comment

http://stackoverflow.com/a/23196297
accepted answer of: http://stackoverflow.com/q/23172484
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23172484
type: Answer
has body: Damn it! I missed to add Internet permission to manifest! :( I add that and problem solved. The browser of phone(android emulator) has this permission and it could connect to network, but my application haven't that permission. So I should add only this line to manifest.xml: . . . .
upvote count: 1
score: 1

http://stackoverflow.com/q/23140450
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35384382
has body: I developed an app that uses JavaFX for the GUI. The main issue I am having is that the people that will be using the app don't have the latest version of java and some can't upgrade their JRE because they have other applications that have a dependency on a specific java version. So my question is, what type of workaround can be done on the code to make sure the application will run regardless of the jre version? Is it possible to extract the JavaFX library and add it to the buildpath? Perhaps a solution to my problem is not possible but want to get someone's input on how to come up with a possible workaround. The application works fine for me under java version 1.8.0_05 Thanks in advance
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/35382218
tagged with: javafx
has comment: http://stackoverflow.com/comment/35384869
type: Question
score: 0
has comment: http://stackoverflow.com/comment/35382285
has title: Workaround for JavaFX Application on older versions of java
has comment: http://stackoverflow.com/comment/35411224

http://stackoverflow.com/comment/35558448
type: Comment
has text: I probably did not say it clear enough. The iteration is over more configurations. Let's say I have 3 servers that can provide the service and I need to store URL+username+password for each one. So I will have 3 instances of configuration class and the "working" class need to iterate over these configurations if the connection fails.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23240148

http://stackoverflow.com/q/23212016
has comment: http://stackoverflow.com/comment/35508160
tagged with: abstract-syntax-tree
has body: I am trying to search for specific nodes in AST (Abstract Syntax Tree). The basic idea is: There is an AST parsed from source code which contains about 10000 nodes. There is a list of 50 items that I would like to search in the AST. Question: What is the best way to search for those 50 items in AST? Right now, I am thinking about using Arraylist containing those 50 items. Then, traversing AST and compare each node with Arraylist using a loop. Is this good idea in term of performance? I want the operation to be done fast. Are there any other ways to solve this problem?
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/35508253
score: 1
favorite count: 0
type: UnansweredQuestion
has title: Search for specific node in Abstract Syntax Tree
has comment: http://stackoverflow.com/comment/35701172
tagged with: java
has answer: http://stackoverflow.com/a/23222771
upvote count: 1
type: Question

http://stackoverflow.com/comment/35534761
score: 1
comment on: http://stackoverflow.com/q/23226095
type: Comment
type: QuestionComment
has text: @user3561431 I've not done it for the volume you're working with. I can't say what the performance impacts would be. It logically seemed like the cleanest solution long term (which is why it's a comment not an answer) My fear was you may run into the need to use dynamic SQL; but using a function to get the next sequence may reduce that concern some) I can say I work with a system having over 300 sequences with 1,744,464,335 new IDs over 10 years and I don't see a performance problem with our enterprise DB.

http://stackoverflow.com/comment/35443208
comment on: http://stackoverflow.com/q/23175244
has text: @SotiriosDelimanolis isn't it possible using generics?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35390614
type: Comment
type: QuestionComment
has text: Please, remove uninteresting parts of your codes.
score: 2
comment on: http://stackoverflow.com/q/23145276

http://stackoverflow.com/comment/35422521
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23163342
score: 0
has text: I don't know if what you asked is possible but I'll leave a suggestion (probably not a good one). Create an extra thread in a infinite loop cheking for the "signal". Then you send to that extra thread the "signal" and when it gets the signal, it creates a new thread to send the user input. When it ends sending, keep doing the other thing you were doing, while the loop is running forever.

http://stackoverflow.com/a/23200517
type: Answer
has comment: http://stackoverflow.com/comment/35487536
answers question: http://stackoverflow.com/q/23200439
score: 2
has comment: http://stackoverflow.com/comment/35487599
has comment: http://stackoverflow.com/comment/35487720
accepted answer of: http://stackoverflow.com/q/23200439
has body: You need to use generics in the method signature rather than a raw type so that the type can be determined from the collection public void otherClassMethod(ListMultimap&lt;String, int[]&gt; terrainMap)
downvote count: 0
has comment: http://stackoverflow.com/comment/35487994
type: AcceptedAnswer
upvote count: 2

http://stackoverflow.com/q/23268647
has comment: http://stackoverflow.com/comment/35610316
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/23271790
type: Question
tagged with: jsoup
linked to: http://stackoverflow.com/q/17643512
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/35613741
tagged with: android
has comment: http://stackoverflow.com/comment/35610174
has body: I use jsoup to scrape HTML. I am having problems with extracting information from html tags of the following kind: &lt;span class="some"&gt;&amp;#8237;&amp;#8237;78&amp;#8236;&amp;#8236;&lt;/span&gt; it should only be like &lt;span class="some"&gt;78‬‬&lt;/span&gt; How can I remove the HTML Entities from the string?
has comment: http://stackoverflow.com/comment/35610369
favorite count: 0
has title: Remove html entities with jsoup in android
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35610699
upvote count: 1

http://stackoverflow.com/comment/35650547
has text: I didn't try using OpenCV, but that's ok,any libraries are welcome, as long as its fast... I tried to identify rectangle-like shapes in the image..but that didn't worked very well. No, I don't have the rectangle positions.
comment on: http://stackoverflow.com/q/23289387
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/23231511
downvote count: 0
tagged with: jersey-2.0
has comment: http://stackoverflow.com/comment/35888826
possible better answer: http://stackoverflow.com/a/23383460
has title: jersey 2: How to create custom HTTP param binding
has answer: http://stackoverflow.com/a/23397113
has comment: http://stackoverflow.com/comment/35767377
upvote count: 17
answer count: 4
favorite count: 0
has comment: http://stackoverflow.com/comment/35821087
has comment: http://stackoverflow.com/comment/35544091
has answer: http://stackoverflow.com/a/34664763
has answer: http://stackoverflow.com/a/23423794
has answer: http://stackoverflow.com/a/23383460
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35543533
tagged with: grizzly
tagged with: java
linked to: http://stackoverflow.com/q/18463311
score: 17
has body: I am trying to create a custom http param binding for my restful service. Please see the example below. @POST @Path("/user/{userId}/orders") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) public MyResult foo(@PathParam("userId") String someString, @UserAuthHeaderParam String authString){ } You can see that there is a UserAuthHeaderParam annotation in the function signature. What I want to do is have a custom http param binding other than the standard javax.ws.rs.*Param . I have try to implement org.glassfish.hk2.api.InjectionResolver which basically extract the value from http header: public class ProtoInjectionResolver implements InjectionResolver&lt;UserAuthHeaderParam&gt;{ ... @Override public Object resolve(Injectee injectee, ServiceHandle&lt; ? &gt; root) { return "Hello World"; } ... } When I call the restful service, the server get below exceptions. It indicates that the framework fails to resolve the param in the function signature: org.glassfish.hk2.api.UnsatisfiedDependencyException: There was no object available for injection at Injectee(requiredType=String,parent=MyResource,qualifiers={}),position=0,optional=false,self=false,unqualified=null,2136594195), java.lang.IllegalArgumentException: While attempting to resolve the dependencies of rs.server.MyResource errors were found Please help. Any advise is appreciated. I do make a lot of search on google but fails to make it work. Jersey 2.*. How to replace InjectableProvider and AbstractHttpContextInjectable of Jersey 1.* might be the similar question. -- UPDATES: I use AbstractBinder to bind my resolver to UserAuthHeaderParam: public class MyApplication extends ResourceConfig { public MyApplication() { register(new AbstractBinder() { @Override protected void configure() { // bindFactory(UrlStringFactory.class).to(String.class); bind(UrlStringInjectResolver.class).to(new TypeLiteral&lt;InjectionResolver&lt;UrlInject&gt;&gt;() { }).in(Singleton.class); } }); packages("rs"); } } Th…
type: Question
accepted answer: http://stackoverflow.com/a/23397113
has comment: http://stackoverflow.com/comment/35654840

http://stackoverflow.com/q/23152786
type: Question
has answer: http://stackoverflow.com/a/29275676
has answer: http://stackoverflow.com/a/23155070
has answer: http://stackoverflow.com/a/23152925
score: 0
linked to: http://stackoverflow.com/q/9554636
answer count: 4
has comment: http://stackoverflow.com/comment/35403178
has title: How to open one frame on the same monitor as another in swing?
has comment: http://stackoverflow.com/comment/46750158
type: UnansweredQuestion
has body: I have one frame, which can cause another frame to open, say, by button press. I want to make second frame to appear on the same screen (in dual monitor config) as the first one. How to do that? UPDDATE Passing getGraphicsConfiguration() from the parent JFrame does not help, although it contains correct screen field inside.
tagged with: swing
has answer: http://stackoverflow.com/a/67340209
tagged with: java
has comment: http://stackoverflow.com/comment/35407667
linked to: http://stackoverflow.com/q/11712180
tagged with: multiple-monitors

http://stackoverflow.com/a/23243698
accepted answer of: http://stackoverflow.com/q/23232274
answers question: http://stackoverflow.com/q/23232274
score: 0
has body: An IndexColorModel is typically created from a GIF or a PNG with a PLTE (palette) chunk. BMP files with palette might also work. Try reading a GIF file, using ImageIO.read(yourGIF), it should come out with an IndexColorModel. Another option would be to create a blank image like this, if you can live with the fixed color map: input = new BufferedImage(1, 1, BufferedImage.TYPE_BYTE_INDEXED); But I think for your use case, it's simpler to just create a new IndexColorModel using predefined look-up tables. You don't need to get it from an input image.
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/comment/35648040
comment on: http://stackoverflow.com/q/23288709
has text: @EgorN OR INSTEAD of using BackgroundResource i have to use ImageResource
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23180542
type: Question
tagged with: htmlunit
has body: I want to connect to bitcoind using java. My plan is to use htmlunit and gson. Right now I can complete a single request successfully. However, I can not do more than exactly four subsequent requests due to a SocketTimeoutException being thrown at the fifth request. I tried: Waiting between requests. (No effect visible) Forcing a failing http status code e.g. by requesting getinfoo instead of getinfo. (I do not get the timeout after four failing requests) Any help or comment is appreciated! package test; import com.gargoylesoftware.htmlunit.BrowserVersion; import com.gargoylesoftware.htmlunit.FailingHttpStatusCodeException; import com.gargoylesoftware.htmlunit.HttpMethod; import com.gargoylesoftware.htmlunit.WebClient; import com.gargoylesoftware.htmlunit.WebRequest; import com.google.gson.Gson; import java.io.IOException; import java.net.SocketTimeoutException; import java.net.URL; public class Test { public static void main(String[] args) { WebClient client = new WebClient(BrowserVersion.FIREFOX_24); // http://[bitcoind-user]:[password]@localhost:[bitcoind-port] String baseUrl = "http://admin:admin@localhost:8332/"; client.getOptions().setTimeout(2000); while (true) { try { WebRequest req = new WebRequest(new URL(baseUrl)); req.setAdditionalHeader("Content-type", "application/json"); req.setHttpMethod(HttpMethod.POST); JSONRequestBody body = new JSONRequestBody(); body.setMethod("getinfo"); req.setRequestBody(new Gson().toJson(body, JSONRequestBody.class)); client.getPage(req); client.closeAllWindows(); System.out.println("ok. (No Exception)"); } catch (SocketTimeoutException tex) { System.out.println("not ok: SocketTimeoutException"); } catch (IOException ex) { System.out.println("not ok: IOException"); } catch (FailingHttpStatusCodeException hex) { System.out.println("not ok: FailingHttpStatusCodeException"); } } } } (EDIT:) Removing the .setTimeout(2000) did not help as well. Measuring the time for each request shows that they are quite quick: ok. (No Exception…
downvote count: 0
has title: SocketTimeoutException after four requests to local bitcoind
has comment: http://stackoverflow.com/comment/35466857
answer count: 1
has answer: http://stackoverflow.com/a/23183462
favorite count: 0
upvote count: 2
type: UnansweredQuestion
tagged with: bitcoind
score: 2
tagged with: java

http://stackoverflow.com/a/23275497
has body: The problem is with the inner loop where you are initializing j always with 1. It must be started one greater than current value of i. It should be j = i + 1 in inner loop. Complete code: for(int i = 0; i &lt; stuTable.getRowCount(); i++){ Object seatNum = stuTable.getValueAt(i,0); int seatInt = Integer.parseInt(String.valueOf(seatNum)); for(int j = i + 1; j &lt; stuTable.getRowCount(); j++){ Object seatNum2 = stuTable.getValueAt(j,0); int seatInt2 = Integer.parseInt(String.valueOf(seatNum2)); if(seatInt == seatInt2){System.out.println(seatInt+":"+seatInt2);} } } For detailed information read below comments.
accepted answer of: http://stackoverflow.com/q/23275451
has comment: http://stackoverflow.com/comment/35623289
has comment: http://stackoverflow.com/comment/35623399
has comment: http://stackoverflow.com/comment/35624037
answers question: http://stackoverflow.com/q/23275451
type: Answer
has comment: http://stackoverflow.com/comment/35623738
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/35623916
has comment: http://stackoverflow.com/comment/35623989
has comment: http://stackoverflow.com/comment/35623644
has comment: http://stackoverflow.com/comment/35623362
type: AcceptedAnswer
upvote count: 1
has comment: http://stackoverflow.com/comment/35623427

http://stackoverflow.com/q/23284367
has comment: http://stackoverflow.com/comment/114544198
has title: QR code scanner android, onActivityResult method not calling and Toast doesn't display
answer count: 4
has comment: http://stackoverflow.com/comment/35640417
has comment: http://stackoverflow.com/comment/35640120
downvote count: 0
has comment: http://stackoverflow.com/comment/35640431
has body: I am developing an application that involves QR scanning. I am able to execute the scanner application library which is called from my application.After scanning i need to store the captured value,but onActivityResult method which is written inside my application is not getting called.Please help on this I am posting code here: @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Intent intent = new Intent(MainActivity.this, CaptureActivity.class); // Intent intent = new // Intent("com.google.zxing.client.android.SCAN"); intent.putExtra("SCAN_MODE", "QR_CODE_MODE"); startActivityForResult(intent, 0); } @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 onActivityResult(int requestCode, int resultCode, Intent intent) { if (requestCode == 0) { if (resultCode == 1) { // Handle successful scan String capturedQrValue = intent.getStringExtra("RESULT"); // String format = intent.getStringExtra("SCAN_RESULT_FORMAT"); Toast.makeText(MainActivity.this,"Scan Result:" + capturedQrValue, Toast.LENGTH_SHORT).show(); finish(); Intent it = new Intent(MainActivity.this, ThirdActivity.class); it.putExtra("Code", capturedQrValue); startActivity(it); } else if (resultCode == RESULT_CANCELED) { // Handle cancel }
has answer: http://stackoverflow.com/a/23284609
type: Question
has comment: http://stackoverflow.com/comment/35640136
has comment: http://stackoverflow.com/comment/35640206
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/35640224
tagged with: qr-code
has answer: http://stackoverflow.com/a/23284500
has comment: http://stackoverflow.com/comment/35640176
has comment: http://stackoverflow.com/comment/35640502
upvote count: 1
has comment: http://stackoverflow.com/comment/35640511
has answer: http://stackoverflow.com/a/23289203
has comment: http://stackoverflow.com/comment/35641137
has comment: http://stackoverflow.com/comment/35640149
has answer: http://stackoverflow.com/a/23284904
favorite count: 0
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/35640380
has comment: http://stackoverflow.com/comment/35640412

http://stackoverflow.com/comment/35551651
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23234571
has text: Why do you want to do `wchar_t` to byte? Sounds like you're trying to solve the wrong problem.

http://stackoverflow.com/comment/35630855
score: 0
type: QuestionComment
type: Comment
has text: @LuiggiMendoza Actually I tried that too .. and It worked... What I did was.. In AppProperty class itself I read the property file using InputStream/ Java IO etc... and I was able to read the property... The requirement for my application is to change the behavior of loading this class AT RUNTIME ..
comment on: http://stackoverflow.com/q/23278427

http://stackoverflow.com/q/23221563
type: Question
score: 0
answer count: 2
tagged with: radio-button
has answer: http://stackoverflow.com/a/23222004
possible better answer: http://stackoverflow.com/a/23222461
has answer: http://stackoverflow.com/a/23222461
tagged with: android
has title: Swap positions of Radios - Android java
accepted answer: http://stackoverflow.com/a/23222004
has body: I got one RadioGroup with four Radios. RadioGroup rg = (RadioGroup) findViewById(R.id.radioGroup); RadioButton r0 = (RadioButton) findViewById(R.id.radio0); RadioButton r1 = (RadioButton) findViewById(R.id.radio1); RadioButton r2 = (RadioButton) findViewById(R.id.radio2); RadioButton r3 = (RadioButton) findViewById(R.id.radio3); I set the text to all of them. r0.setText("1"); r1.setText("2"); r2.setText("3"); r3.setText("4"); So i got that radios like this 1, 2, 3, 4. How can I randomly swap positions of radios. I want to get something like this 3,2,1,4 or 2,3,1,4....etc... But IMPORTANT I don't want to change text of radios, as I said I want positions to be swapped.
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/35640588
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23283997
has text: I will try to implement your suggestion tomorrow @Jeeter, I've tried to create an instance of Savings using the classname objectname = new classname. (i.e. Savings mySavings = newSavings();) which should have activated the default constructor from my Account class, but for some reason it didn't. But I am tired so not sure if it's doing what I want it to. Thanks for your help and I'll update this thread tomorrow
score: 0

http://stackoverflow.com/comment/35559899
has text: @DavidWallace, you are right. Detecting cycles is one of the constraints. But i already know how to do this.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23240079

http://stackoverflow.com/q/23254196
has answer: http://stackoverflow.com/a/23254537
linked to: http://stackoverflow.com/q/23110475
answer count: 1
tagged with: smartgwt
accepted answer: http://stackoverflow.com/a/23254537
score: 0
has body: I have an already generated PDF on my server-side,I would like some help on showing the pdf when clicking a button on the client side. How should I create the conextion with the server and client using the shared? Thank you for your help.
tagged with: gwt
type: AnsweredQuestion
tagged with: java
type: Question
has title: SmartGWT/GWT: Show a PDF on client side

http://stackoverflow.com/comment/35578702
type: Comment
type: QuestionComment
score: 1
has text: It runs with no problems here. Using java 8
comment on: http://stackoverflow.com/q/23251241

http://stackoverflow.com/comment/35530051
comment on: http://stackoverflow.com/q/23222970
has text: I try the first solution but does not works and throw an exception my other bean services. About the second solution I try the controller declaration in the applicationContext, and in the xml where I configure the entityManagerFactory and TransactionManager and nothing. No transaction works on controller
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/23270886
answer count: 1
has answer: http://stackoverflow.com/a/23271356
type: AnsweredQuestion
has title: Why the new version of EGIT(3.3.x) has errors on my system and eclipse?
tagged with: git
type: Question
tagged with: java
tagged with: egit
tagged with: eclipse
has body: 1. I'm still using windows xp SP3(x86),because My computer can't install Vista&amp;win7&amp;win8 etc. So do not ask me to update win7 or greater . :) 2. It's going well when I'm using :(1)Eclipse jee Juno SR2 + EGIT3.2 (2) Eclipse jee kepler SR2 + EGIT3.2. 3. When I updated Egit to the latest version:now is 3.3.2, an error occurred during some operat about git and github.It shows: An internal error occurred during: "Computing Git status for repository xxx".Symbolic links not supported on this operating system. Why it's happening ?And what should I do? Thanks very much!
score: 0
accepted answer: http://stackoverflow.com/a/23271356

http://stackoverflow.com/comment/54345698
comment on: http://stackoverflow.com/q/23210778
has text: Related question: [How to use hbase with Spring Boot using Java instead of XML?](http://stackoverflow.com/questions/24795097/how-to-use-hbase-with-spring-boot-using-java-instead-of-xml)
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/35510154
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23212476
has text: how about the meaning of return_vcal_in_english

http://stackoverflow.com/comment/35460609
comment on: http://stackoverflow.com/q/23185354
has text: ok tell me what u r expection from output and what u r giving to url? u want get or post method?
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/35443619
score: 0
type: Comment
type: QuestionComment
has text: Are you using Eclipse to do JNI work?
comment on: http://stackoverflow.com/q/23175522

http://stackoverflow.com/q/23243153
upvote count: 1
tagged with: swing
answer count: 1
tagged with: graphics
has body: I want to determine the position of a JFrame on its screen. When i use getLocationOnScreen() or getLocation() i just get w1 + p but i want to determine just p. ______________ __________ | | | p ____| | | |&lt;-&gt; |__|| |____________| |________| &lt;--- w1 ---&gt; &lt;-- w2 --&gt; Using getGraphicsConfiguration().getDevice().getDisplayMode().getWidth() returns w2 whats fine, but i'm not able to determine the JFrames position on the active screen. My overall target is to ensure that the JFrame never has an area out of the visible screen area. E.g. if the JFrame is moved 100px up out of the visible area of screen #2 its corrected with moving it down for 100px. How can i get the position of a JFrame on its active screen or make sure in any other way that the complete JFrame is visible (asuming `JFrame.size &lt;= Screen.size)?
tagged with: java
tagged with: multiscreen
has answer: http://stackoverflow.com/a/23253254
has title: Position of JFrame on multiple screens
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23253254
downvote count: 0
favorite count: 0
type: Question
score: 1
tagged with: jframe

concurrency
tag name: concurrency
tags question: http://stackoverflow.com/q/23256026
tags question: http://stackoverflow.com/q/23165042
tags question: http://stackoverflow.com/q/23170201
tags question: http://stackoverflow.com/q/23135412
tags question: http://stackoverflow.com/q/23255267
tags question: http://stackoverflow.com/q/23199206
tags question: http://stackoverflow.com/q/23227141
tags question: http://stackoverflow.com/q/23221459
tags question: http://stackoverflow.com/q/23220875
tags question: http://stackoverflow.com/q/23137112
tags question: http://stackoverflow.com/q/23257338
tags question: http://stackoverflow.com/q/23209245
type: Tag
tags question: http://stackoverflow.com/q/23287054
tags question: http://stackoverflow.com/q/23230323
tags question: http://stackoverflow.com/q/23180112
tags question: http://stackoverflow.com/q/23214891
tags question: http://stackoverflow.com/q/23252554
tags question: http://stackoverflow.com/q/23227529
tags question: http://stackoverflow.com/q/23185609
tags question: http://stackoverflow.com/q/23273579

http://stackoverflow.com/a/23498561
answers question: http://stackoverflow.com/q/23289387
has body: One possible solution is to perform connected component analysis after binarization using adaptive method. After that, calculate the median width of the connected component, if the connected component width is 5 times larger than the median width, then this connected component is the square we are looking for. The following codes are used to illustrate this idea Mat im = imread(inputFileName,CV_LOAD_IMAGE_GRAYSCALE); Mat outputIm(im.rows,im.cols,CV_8U, Scalar(0)); Mat bi; // step 1: adaptive thresholding adaptiveThreshold(im,bi,255,ADAPTIVE_THRESH_GAUSSIAN_C,THRESH_BINARY,7,50); threshold(bi, bi, 128.0, 255.0, CV_THRESH_BINARY_INV); // step 2: connected component analysis std::vector&lt;std::vector&lt;cv::Point&gt; &gt; contours; findContours(bi, contours, CV_RETR_EXTERNAL , CV_CHAIN_APPROX_NONE); // step 3: analyze these blobs double area; std::vector&lt;double&gt; areaArray; for(int i=0; i&lt;contours.size(); i++) { cv::Rect rect = boundingRect(contours[i]); area = rect.width; areaArray.push_back(area); } std::vector&lt;double&gt; sortedAreaArray; sortedAreaArray = areaArray; size_t n = sortedAreaArray.size() / 2; nth_element(sortedAreaArray.begin(), sortedAreaArray.begin()+n, sortedAreaArray.end()); double medianArea = sortedAreaArray[n]; for(int i=0; i&lt;contours.size(); i++) { if(areaArray[i]&gt;5*medianArea) { for(int j=0; j&lt;contours[i].size(); j++) { int x = contours[i][j].x; int y = contours[i][j].y; int pos = x+y*bi.cols; outputIm.data[pos]=255; } } } imwrite(outputFileName,outputIm); The output rectangles can be shown:
has comment: http://stackoverflow.com/comment/36381779
downvote count: 0
has comment: http://stackoverflow.com/comment/36377217
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/36334098
upvote count: 1

http://stackoverflow.com/comment/35621713
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23272807
has text: I would just create a POJO class for Question, and my model attribute would be a simple List of those Question Objects, simple and easy to handle ---- myList<Question> (or well, if you just need the question text and the answer, you can just use a list of arrays or maps)
score: 0

http://stackoverflow.com/comment/35454610
type: QuestionComment
has text: See [this](http://www.javaworld.com/article/2076614/core-java/object-initialization-in-java.html)
type: Comment
comment on: http://stackoverflow.com/q/23180770
score: 0

http://stackoverflow.com/comment/35694577
has text: @Sudh: see update about width and height parameters.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23305334
type: AnswerComment

http://stackoverflow.com/a/23287076
has body: I managed to do this by adding the following functions in the Smack BOSHConnection library class: public class BOSHConnection extends Connection { ... public String getSid() { return client.getSid(); } public Long getRid() { return client.getRid(); } ... } you then need to remember that the Rid is the last id used by the Smack library and for your pre-bind you need to increment this for next request. Jid is already available via BOSHConnection.getUser(); I should also flag that to get converse pre-bind working with Smack I also had to change the BOSHConnection.login functon. // Changed: preserve current api - call new pre-bind aware function public void login(String username, String password, String resource) throws XMPPException { login(username, password, resource, false); } // Added: Using original login function with prebind awareness public void login(String username, String password, String resource, boolean preBind) throws XMPPException { if (!isConnected()) { throw new IllegalStateException("Not connected to server."); } ... unchanged // Indicate that we're now authenticated. authenticated = true; anonymous = false; // Added: Prebind only requires connect and authenticate if (preBind) { return; } then in Web app // login with pre-bind only connection.login(userName, password, "", true); This is required as the first thing converse does is perform all the roster and presence stuff that the later half of the login function does. My reasoning here is that the XMPP server will actually see two connections (one from SMACK and one from converse) and it's the one that sends the presence which will end up being target for XMPP messages - and we want that to be converse. Edit: Longer code sample for this is in this other StackOverflow answer
has comment: http://stackoverflow.com/comment/39710751
score: 4
has comment: http://stackoverflow.com/comment/37103665
answers question: http://stackoverflow.com/q/23264662
type: Answer
upvote count: 4
has comment: http://stackoverflow.com/comment/37095446
downvote count: 0
has comment: http://stackoverflow.com/comment/39585889

session
tags question: http://stackoverflow.com/q/23267834
tags question: http://stackoverflow.com/q/23248566
tags question: http://stackoverflow.com/q/23194588
tags question: http://stackoverflow.com/q/23161731
type: Tag
tags question: http://stackoverflow.com/q/23273889
tags question: http://stackoverflow.com/q/23251941
tags question: http://stackoverflow.com/q/23214080
tags question: http://stackoverflow.com/q/23146323
tags question: http://stackoverflow.com/q/23209167
tags question: http://stackoverflow.com/q/23149203
tags question: http://stackoverflow.com/q/23143656
tags question: http://stackoverflow.com/q/23232614
tag name: session
tags question: http://stackoverflow.com/q/23266655
tags question: http://stackoverflow.com/q/23269178
tags question: http://stackoverflow.com/q/23284403

android-mediaplayer
tags question: http://stackoverflow.com/q/23147977
tag name: android-mediaplayer
type: Tag
tags question: http://stackoverflow.com/q/23276786
tags question: http://stackoverflow.com/q/23154790
tags question: http://stackoverflow.com/q/23259942
tags question: http://stackoverflow.com/q/23232827

http://stackoverflow.com/comment/35481653
score: 0
comment on: http://stackoverflow.com/q/23196896
has text: BTW if you want to write comment to someone you should add `@` before nick of this person. This way such person will get notification of your massage. So if you want to write massage for me try to write it in form `@Pshemo your massage ...`.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23267949
linked to: http://stackoverflow.com/q/6118737
linked to: http://stackoverflow.com/q/10488112
has body: I have 8 jpanels with background color and I am trying to draw a rectangle on top of it but it shows under it and I cant get it on top Here is the code for initializing a JPanel tempPanel = new JPanel(); tempPanel.setBackground(Color.black); tempPanel.setOpaque(true); tempPanel.setLayout(null); panel.add(tempPanel); tempPanel.setBounds(195 + insets.left, 155 + insets.top, main.getLanes().get(5).getDistance()*5, 20); if (!added) lanes.add(tempPanel); and the code for drawing rectangle; it is inside a class that extends Jpanel and inisde paintComponents: super.paintComponent(g); Graphics2D g2d = (Graphics2D) g; drawLanes(); int i, j; ArrayList&lt;Lane&gt; lanes2= new ArrayList&lt;Lane&gt;(); ArrayList&lt;Car&gt; cars= new ArrayList&lt;Car&gt;(); for(int counter = 0; counter &lt; 10; counter ++) { lanes2 = main.getLanes(); for( i = 0; i&lt; lanes.size(); i++) { lanes.get(i).removeAll(); cars = lanes2.get(i).getCars(); for ( j = 0; j &lt; cars.size(); j++) { Insets insets = lanes.get(i).getInsets(); g2d.setColor(Color.red); g2d.draw(new Rectangle(lanes.get(i).getLocation().x + 5*(lanes2.get(i).getDistance() - cars.get(j).getCurrent_pos()), lanes.get(i).getLocation().y, cars.get(j).getCar_size()*5, lanes.get(i).getHeight())); JLabel temp = new JLabel("Car"); temp.setForeground(Color.red); temp.setBounds(insets.left + 5*(lanes2.get(i).getDistance() - cars.get(j).getCurrent_pos()) , insets.top, cars.get(j).getCar_size()*5, lanes.get(i).getHeight()); lanes.get(i).add(temp); } } } Thanks in adavnce
score: 0
tagged with: user-interface
has comment: http://stackoverflow.com/comment/35620096
tagged with: java-2d
answer count: 0
type: UnansweredQuestion
has title: draw a 2dGraphics shape on top of jpanel with background color
has comment: http://stackoverflow.com/comment/35639404
tagged with: swing
tagged with: java
type: Question
tagged with: graphics

http://stackoverflow.com/comment/35421467
score: 0
type: AnswerComment
type: Comment
has text: No, still getting the same output.
comment on: http://stackoverflow.com/a/23162828

http://stackoverflow.com/q/23235129
type: Question
has comment: http://stackoverflow.com/comment/35549686
has title: Extending ArrayList with an abstract class in Java?
answer count: 2
has answer: http://stackoverflow.com/a/23235175
has body: This is a problem I've been working on for a little while now and I've barely made any progress. I've been running into a lot of problems trying to use an abstract class when extending ArrayList. My first step was to define three classes, Circle, Rectangle, and Triangle that are all concrete subclasses of an abstract class GeometricObject. The base class has abstract methods getArea() and getPerimeter() that are overridden in the subclasses by the specific getPerimeter() and getArea() formula for that particular object. This part is completed and is working as intended. The next part is where I'm having trouble. I'm supposed to define a new class GeoemetricObjectList that extends ArrayList&lt;GeometricObject&gt;. This class should override the add(), remove(), and clear() methods. This class keeps a totalArea and totalPerimeter variable of the objects on the list. Right now I've created a, quite frankly, messy if statement list in my GeometricObjectList add() method that I'd like to clean up. Here is my code for that class so far: import java.util.ArrayList; @SuppressWarnings("hiding") public class GeometricObjectList&lt;GeometricObject&gt; extends ArrayList&lt;GeometricObject&gt;{ final static long serialVersionUID = 1L; public double totalArea = 0; public double totalPerimeter = 0; public boolean add(GeometricObject element){ if(element instanceof Rectangle) { totalArea += ((Rectangle)element).getArea(); totalPerimeter += ((Rectangle)element).getPerimeter(); } if(element instanceof Circle) { totalArea += ((Circle)element).getArea(); totalPerimeter += ((Circle)element).getArea(); } if(element instanceof Triangle) { totalArea += ((Triangle)element).getArea(); totalPerimeter +=((Triangle)element).getArea(); } return super.add(element); } public boolean remove(GoemetricObject element) { return super.remove(element); } public void clear() { } } When I simply write totalArea += element.getArea() I get the error "The method getArea() is undefined for the type GeometricOb…
has comment: http://stackoverflow.com/comment/35550011
has answer: http://stackoverflow.com/a/23235402
upvote count: 2
tagged with: java
has comment: http://stackoverflow.com/comment/35549678
has comment: http://stackoverflow.com/comment/35550242
type: UnansweredQuestion
tagged with: arraylist
has comment: http://stackoverflow.com/comment/35549663
tagged with: abstract-class
has comment: http://stackoverflow.com/comment/35549864
score: 2
downvote count: 0
favorite count: 0

http://stackoverflow.com/comment/35460243
type: QuestionComment
has text: If you are not using the GUI parts of this code look at [this question](https://stackoverflow.com/questions/6045384/playing-mp3-and-wav-in-java)
comment on: http://stackoverflow.com/q/23184559
type: Comment
score: 0

http://stackoverflow.com/q/23167879
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23168002
has title: java - how to simulate an ECG (electro-cardiogram)
score: 4
upvote count: 4
has comment: http://stackoverflow.com/comment/35430282
tagged with: random
tagged with: sensors
answer count: 1
downvote count: 0
favorite count: 0
tagged with: graphing
accepted answer: http://stackoverflow.com/a/23168002
has body: I am working on some kind of project which involves simulating an ECG (electrocardiogram). I do it by generating some random numbers between an interval and sending that data to another program analyzing and graphing it. But, the problem is the random number generated between an interval say [a,b] by java code have a lot of variance, meaning the next generated random value differs greatly from the previous number. What I want is a flow of random numbers varying slightly so that graph looks smooth. At this point, the graph generated is very spiky, but I want it to be smooth and varying like a real ECG graph. Please help me do that. Here is the code //setup ECG graph StdDraw.setXscale(0.0, 100.0); StdDraw.setYscale(0.0,200.0); StdDraw.setPenColor(StdDraw.BLUE); StdDraw.setPenRadius(0.0009); //generate random points between interval of range int t = 0; int prevVal = 0; int nextVal; while(true){ nextVal = range.getRandomValue(); System.out.println(nextVal); StdDraw.point(prevVal, nextVal); StdDraw.line(t-1, prevVal, t, nextVal); StdDraw.show(100); prevVal = nextVal; t = (t+1) % 100; if(t == 0){ StdDraw.clear(); } } Thank You
has comment: http://stackoverflow.com/comment/35430395
tagged with: java
tagged with: plot
type: Question

http://stackoverflow.com/q/23155112
score: 1
upvote count: 1
type: Question
possible better answer: http://stackoverflow.com/a/23155148
tagged with: processing
tagged with: oop
has answer: http://stackoverflow.com/a/23155148
has comment: http://stackoverflow.com/comment/35406977
tagged with: java
accepted answer: http://stackoverflow.com/a/23155146
answer count: 3
downvote count: 0
has title: NPE when trying to access variable from a method. Processing/Java
favorite count: 0
has body: I'm trying to make a Grid Class to use in a Sketch I want to make (I'm using Processing) but I get a NullPointerException when trying to access the grid variable from a method printGrid() of the Grid Class. Code: Grid_Proj: Grid gridObj; void setup() { size(480, 360); background(0); gridObj = new Grid(10, 10); gridObj.printGrid(); } Grid: class Grid { int[][] grid; // Declare the Grid Grid(int size_x, int size_y) { int grid[][] = new int[size_x][size_y]; // Initialize the Grid for (int x=0;x&lt;size_x;x++) { for (int y=0;y&lt;size_y;y++) { grid[x][y] = 0; } } println("Created Grid Object with: ", size_x, size_y); } void printGrid() { for (int x=0;x&lt;10;x++) { for (int y=0;y&lt;10;y++) { print(grid[x][y]); // NPE Error here } print('\n'); } } } I'm obviously doing something wrong here, but I can't figure out what. I also tried using this.grid[x][y] to no avail.
has answer: http://stackoverflow.com/a/23155161
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23155146

http://stackoverflow.com/comment/35400119
score: 0
type: QuestionComment
type: Comment
has text: `==` does not suitable to compare strings
comment on: http://stackoverflow.com/q/23151028

http://stackoverflow.com/a/23214216
has comment: http://stackoverflow.com/comment/35570852
upvote count: 13
answers question: http://stackoverflow.com/q/23214080
type: Answer
has comment: http://stackoverflow.com/comment/35513722
has comment: http://stackoverflow.com/comment/35654970
has comment: http://stackoverflow.com/comment/35660323
score: 13
downvote count: 0
has comment: http://stackoverflow.com/comment/35514748
has body: If you modify entities and explicitly want them not to be flushed, you can detach them before modifying. The detached entities will no longer be managed by the persistence context. Hibernate API: session.evict(myEntity) JPA: entityManager.detach(myEntity) EDIT: In case you want to detach all entities and manage only some of them, you can clear your persistence context first and then merge the entites you do need to be managed: Hibernate API: session.clear(); managedEntity = session.merge(detachedEntity); JPA: entityManager.clear(); managedEntity = entityManager.merge(detachedEntity); EDIT 2 All changes to managed entities are flushed on transaction commit. I am not aware of any feature of JPA or Hibernate that can turn this behavior off. So in addition to detaching some or all entities, you have some other choices, but none is exactly what you are looking for: fetching the entities outside a transaction, so they are detached immediately. This seems to come closest to what you want - no hassle with managed changes, only explicit merging would save an entity and you would have to deal less with the persistence API. However you would still need to open a session to merge the entities you do want to be saved with changes. mapping query results to DTOs/POJOs (which are always detached) using the NEW operator in your queries. This approach has the advantage of separating the persistence mapping from the application. However introducing a bunch of new classes may not be worth it, and not doing it consistently across the application adds conceptual complexity. working inside a transaction, but rolling back instead of committing. You would not be able to save anything, and it is kind of a crude way to prevent changes from being synced with the DB. Unfortunately, you have to either commit or rollback a transaction eventually. creating deep copies of the entities to change them. Frankly, this doesn't make much sense to me neither, just adding it for the sake of completeness. E…
accepted answer of: http://stackoverflow.com/q/23214080
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35642499

http://stackoverflow.com/a/23180801
has comment: http://stackoverflow.com/comment/35453635
has comment: http://stackoverflow.com/comment/35453510
type: Answer
answers question: http://stackoverflow.com/q/23180770
has body: I would say it was (as always) practical reason. You can initialize object at one point and use it some time later - then you have to have some mechanism that ensure that everything was initialized into some default value in case we cannot set them immediately. Local object on the other hand are used immediately after they were declared - so we can safely assume programmer is able to initiate them with their target value, and it should be encouraged. Bottom line - just practical reasons, encouraging the good practices which would prevent some errors, nothing like technical limitations.
score: 2
downvote count: 0
upvote count: 2

http://stackoverflow.com/q/23246666
has answer: http://stackoverflow.com/a/23462114
type: Question
has comment: http://stackoverflow.com/comment/35579908
has title: Invoking the parser with new File in the parse(new File(args[0]), handler);
tagged with: saxparser
accepted answer: http://stackoverflow.com/a/23462114
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/35572203
has body: I just learned to write parser.I need a quick help.I have tried searchign for the same but was not of much help. I have written all the callback methods.Now i am writing the private static main method to call the parser. SAXParserFactory parserFactor = SAXParserFactory.newInstance(); SAXParser parser = parserFactor.newSAXParser(); SAXParserExample handler = new SAXParserExample();` parser.parse(new File(args[0]), handler); Now my xml name is Employees.xml and i have a class also Employee.java When i am runing this i am getting this error.I guess i need to send the xml file as argument. Exception in thread "main" java.lang.RuntimeException: The name of the XML file is required! at main.java.SAXParserExample.main(SAXParserExample.java:82)
tagged with: parsing
favorite count: 0
has comment: http://stackoverflow.com/comment/35570053
upvote count: 2
has comment: http://stackoverflow.com/comment/35602580
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35570201
tagged with: java

http://stackoverflow.com/comment/35391444
type: Comment
score: 0
type: AnswerComment
has text: can you send me your code by email ? my email is there in my profile.
comment on: http://stackoverflow.com/a/23132820

http://stackoverflow.com/q/23187600
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/23188081
score: 0
answer count: 1
has body: I was trying to make a small simulation game with individual "Person" class. I used a JFrame to make a window and have real time simulations with Runnable. However, when I created more instances of Person, the Runnable becomes really slow. The more instances I have, the slower it becomes. Is there a better way of doing this? Or should I try to use SQL database rather than a text file to store data? It is just part of the code, I will add more if needed. Thank you very much. public class Main extends JFrame implements ActionListener{ private static final long serialVersionUID = 1L; private JTextField textField; private JTextArea textArea; // create a list of people, each include person.java class private List&lt;Person&gt; people = new ArrayList&lt;Person&gt;(); // set the number of miliseconds in a day // 86400 = 24 hr x 60 min x 60 s private int lengthOfDay = 100; private int timeCounter = 0; private int timeCounterPause = lengthOfDay / 24; private int timeOfDay = 0; private int hourOfDay = 0; private int lengthOfYear = lengthOfDay * 365; private int dayOfWeek = 1; // day starts monday private String dayOfWeekS = ""; // boolean for stop Runnable private volatile boolean stopRequested = false; // runnable "run" class Runnable simulation = new Runnable() { public void run() { try { while (!stopRequested) { for (int i = 0; i &lt; people.size(); i++) { // determine time of day timeOfDay = timeOfDay + timeCounterPause; if (timeOfDay &gt; lengthOfDay) { timeOfDay = timeOfDay % lengthOfDay; // assign int to string dayOfWeekS assignDay(); } // display day of week if set visible (focused) if (people.get(i).getVisible() &amp;&amp; hourOfDay &lt; 1) { textArea.append(dayOfWeekS + "\n"); } hourOfDay = timeOfDay / (lengthOfDay / 24); people.get(i).setAge((float) (people.get(i).getAgeInMs() / (float)lengthOfYear)); // show time if focused if (people.get(i).getVisible()) { // textArea.append(hourOfDay +"o'clock\n"); } // go to school if (people.get(i).getFinishedSchool() == false…
tagged with: multithreading
has title: Runnable become very slow after loading multiple arraylist instances
tagged with: swing
accepted answer: http://stackoverflow.com/a/23188081
type: AnsweredQuestion

http://stackoverflow.com/q/23189272
answer count: 1
has title: Java - Why do only some error-throwing methods require error handling?
linked to: http://stackoverflow.com/q/6115896
type: UnansweredQuestion
duplicate of: http://stackoverflow.com/q/6115896
tagged with: error-handling
has comment: http://stackoverflow.com/comment/35468372
tagged with: java
has body: For example, why is it that ObjectOutputStream.close();, which can throw an IOException, requires error handling (either a try-catch block or a throws declaration) while Integer.parseInt(String s);, which can throw a NumberFormatException, does not?
type: Question
has answer: http://stackoverflow.com/a/23189294
has comment: http://stackoverflow.com/comment/35468059
score: 0

http://stackoverflow.com/a/23277386
answers question: http://stackoverflow.com/q/23277367
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/35627706
type: Answer
has comment: http://stackoverflow.com/comment/35627795
has body: You can't put code like that directly in the body of a class. first.item = "to"; second.item = "be"; third.item = "or"; fourth.item = "not"; fifth.item = "to"; sixth.item = "be"; first.next = second; second.next = third; third.next = fourth; fourth.next = fifth; fifth.next = sixth; sixth.next = null; Move it to an instance initializer, constructor, or method and invoke it. Also, you've declared a type parameter for your class, Item. It is unbounded, so you can't just assign String values to elements declared with that generic type. Also, this if(x == k-1) doesn't make sense since x is an Item and k-1 resolves to an int value. You can't compare the two. You probably meant to count how many nodes you've iterated over.
has comment: http://stackoverflow.com/comment/35627450
has comment: http://stackoverflow.com/comment/35627398
upvote count: 1
accepted answer of: http://stackoverflow.com/q/23277367
score: 1

http://stackoverflow.com/a/23154016
has body: Remove this line alert_confirm.setCancelable(false); [setCancelable:][1] Sets whether the dialog is cancelable or not. Default is true.
answers question: http://stackoverflow.com/q/23153622
has comment: http://stackoverflow.com/comment/35405059
score: 0
type: Answer

http://stackoverflow.com/a/23371999
has body: The jsp stayed like this: &lt;form:form modelAttribute="searchForm"&gt; &lt;form:select path="nombreEstado" id="nombreEstado"&gt; &lt;form:option value=""&gt;Estado: &lt;/form:option&gt; &lt;c:forEach items="${estados}" var="estado"&gt; &lt;form:option value="${estado}"&gt;${estado}&lt;/form:option&gt; &lt;/c:forEach&gt; &lt;/form:select&gt; I removed from items the getEstado property and from the controller I did the following changes: @ModelAttribute("estados") public List&lt;String&gt; obtenerEstados(){ logger.debug("buscando todos los estados"); int cantidadEstados = this.estadoBo.obtenerEstados().size(); ArrayList&lt;String&gt; estadoLista = new ArrayList&lt;String&gt;(); for (int i = 0; i &lt; cantidadEstados; i++) { estadoLista.add(this.estadoBo.obtenerEstados().get(i).getNombreEstado()); } return estadoLista; } and this is where I had the problem: @ModelAttribute("estados") public List&lt;String&gt; obtenerEstados(){ logger.debug("buscando todos los estados"); int cantidadEstados = this.estadoBo.obtenerEstados().size(); ArrayList&lt;String&gt; estadoLista = new ArrayList&lt;String&gt;(); for (int i = 0; i &lt; cantidadEstados; i++) { estadoLista.add(this.estadoBo.obtenerEstados().get(i).getNombreEstado()); } return estadoLista; } I added the attribute searchForm to the model with the new bean object and now it works fine
answers question: http://stackoverflow.com/q/23230342
accepted answer of: http://stackoverflow.com/q/23230342
score: 0
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/q/23188398
has comment: http://stackoverflow.com/comment/35466519
tagged with: database
has comment: http://stackoverflow.com/comment/35567411
has comment: http://stackoverflow.com/comment/35466428
tagged with: derby
score: 0
has title: Connect to a Java Derby Database through the internet
answer count: 1
has comment: http://stackoverflow.com/comment/35484235
has body: i am making an application for a maintenance office ... the user(owner) want to manage his work remotely like from another country ... i would like your help to lead me or clarify how could it be done what was in my mind when i accepted the project was a connection string like this : "jdbc:derby:MOfficeDB;create=false;user=app;password=any;remotehost=xxx.xxx.xxx.xxx" where xxx is the global IP ... and iam not sure of remotehost
has comment: http://stackoverflow.com/comment/35466497
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35466697
has answer: http://stackoverflow.com/a/23198941
tagged with: java
tagged with: connection-string
has comment: http://stackoverflow.com/comment/35466475
type: Question
has comment: http://stackoverflow.com/comment/35574896

http://stackoverflow.com/comment/90108637
type: Comment
has text: You're mistaking `observeOn` with `subscribeOn` and the other way around. [Look at the documentation](http://reactivex.io/documentation/operators/subscribeon.html). `"SubscribeOn specify the Scheduler on which an Observable will operate"`. I'd need a lot more than simple comments to explain you that without mistaking those operators, you can easily use `subscribeOn` to schedule any part of the chain, especially using it on an observable inside a `flatMap`, for example, with an example an outputs as a proof.
type: AnswerComment
comment on: http://stackoverflow.com/a/35758176
score: 0

http://stackoverflow.com/comment/35591570
comment on: http://stackoverflow.com/a/23258268
has text: Point you are missing, is the explanation that `this` is the object `string1` from the question
type: Comment
score: 1
type: AnswerComment

http://stackoverflow.com/comment/35627988
has text: Yes this is just the loop that i'm using to generate the number. I print out the number in my table, I didn;t think it was relevant
comment on: http://stackoverflow.com/q/23277774
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/35514811
comment on: http://stackoverflow.com/a/23212476
score: 0
type: Comment
has text: sir can you post ur code here, mine really doesnt work
type: AnswerComment

http://stackoverflow.com/comment/35445240
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23175577
score: 0
has text: What do you think about this idea? datosOEM = [0]*900000. to replace public static byte[] datosOEM = new byte[900000];

http://stackoverflow.com/comment/35641015
type: AnswerComment
comment on: http://stackoverflow.com/a/23284823
type: Comment
has text: Thanx Gaurav!! can we remove _NNS _NN _JJ from output word mean wants only cards worth hundreds report.
score: 0

http://stackoverflow.com/comment/35431182
has text: Hello @Anton, to install i start the file install.exe, file is in folder was.
comment on: http://stackoverflow.com/a/23136926
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/23141409
has title: retrieve data from database table and display it in atable with html
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/35383726
tagged with: scriptlet
has answer: http://stackoverflow.com/a/23141781
tagged with: servlets
answer count: 2
tagged with: jsp
has body: i am a beginer and am currently working on my final school project which require retrieving data from a database table and displaying the datas in an html page. i have searched alot but still no progress. i was linked to this site through google, i saw a format and i try to do the same thing but after running the code i get this error Exception report message An exception occurred processing JSP page /crimeinfo.jsp at line 32 description The server encountered an internal error that prevented it from fulfilling this request. exception org.apache.jasper.JasperException: An exception occurred processing JSP page /crimeinfo.jsp at line 32 29: 30: 31: <%List <String> data =(List)request.getAttribute("data"); 32: Iterator <String> itr = data.iterator() ; 33: for (itr = data.iterator(); 34: itr.hasNext();) 35: {%> please i need help. i dont known what else to do. thnks... viewcrime.xml <?xml version="1.0" encoding="UTF-8"?> viewcrimereport viewcrimereport viewcrimereport viewcrimereport viewcrimereport.java public class viewcrimereport extends javax.servlet.http.HttpServlet implements javax.servlet.Servlet { private ServletConfig config; String page = "crimeinfo.jsp"; public void init(ServletConfig config) throws ServletException{ this.config = config; } protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { PrintWriter out=response.getWriter(); response.setContentType("text/html"); Connection conn = null; String url = "jdbc:mysql://localhost/citycrime"; String userName = "root"; String passw = "jids"; PreparedStatement pst = null; ResultSet rs; ArrayList<String> datalist = new ArrayList<String>(); try{ int i=0; Class.forName("com.mysql.jdbc.Driver").newInstance(); conn = DriverManager.getConnection(url, userName, passw); pst = conn.prepareStatement(""); String sql ="select suspectname,suspectaliases,suspectht,suspectgender,features,crimeaddress,crimetype,caseno,casestatus from crimereport"; pst.executeQuery(s…
has comment: http://stackoverflow.com/comment/35384236
has answer: http://stackoverflow.com/a/26159594
has comment: http://stackoverflow.com/comment/35385094
score: 0
tagged with: jdbc
linked to: http://stackoverflow.com/q/2188706
type: UnansweredQuestion

http://stackoverflow.com/a/61059298
score: 5
answers question: http://stackoverflow.com/q/23265790
downvote count: 0
upvote count: 5
type: Answer
has body: Since JPA 2.2 you can also use the Java 8 stream API: entityManager.createQuery("SELECT customer FROM Customer customer", Customer.class) .getResultStream() .collect(Collectors.toSet());

http://stackoverflow.com/q/23169881
score: 2
tagged with: android-gradle-plugin
tagged with: java
tagged with: gradle
type: Question
has body: I`m new to build management and related dev ops stuff so please be gentle :) . My team is working on an Android project and it depends on libraries such as Volley and the Facebook SDK. Now Currently each developer has to import the libraries(from the official site) and manually add them to the build path and take care of library versions and the likes after checking out the android project. I am looking for a solution where the developer can checkout the project, and the related libraries are also checked out automatically. I would also like to specify the order of building the libs. Another related issue: One of the libraries almost always is not able to locate the JRE on every restart.(Manually adding the JRE fixes the issue...something tells me that a good build management flow will fix this)Suggestions on fixing this? If you are suggesting a dependency management tool based solution id prefer Gradle based solutions. Please suggest at least the high level flow I need to follow. Thank you!
has answer: http://stackoverflow.com/a/23169972
downvote count: 0
has title: What is the best way to deal with library dependencies in android if you are working as a team?
answer count: 3
tagged with: android
has answer: http://stackoverflow.com/a/23170512
favorite count: 0
upvote count: 2
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23169920
tagged with: dependency-management

http://stackoverflow.com/comment/35508630
type: QuestionComment
has text: As you say _there are several alternatives_. If you have an unknown number of matrices then a `List<MyThing[][]>` would work. If you know how many there are you could use a `MyThing[][][]` and initialise it like any other array - you don't gain much by doing so however.
comment on: http://stackoverflow.com/q/23212291
score: 0
type: Comment

http://stackoverflow.com/q/23258124
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23258166
type: Question
has comment: http://stackoverflow.com/comment/35591728
has body: ok, so I am trying to run this and it tells me there is no main (i have tried putting one in and i get a termination and syntax error) what is wrong and/or where do I put the main function? here is the code import javax.swing.*; import java.awt.*; import java.awt.event.*; public class StyleListener extends JPanel { private static final long serialVersionUID = 1L; private JCheckBox bold, italic; private JLabel saying; private JSplitPane splitPane; public StyleListener() { splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT); splitPane.setOneTouchExpandable(true); splitPane.setPreferredSize(new Dimension(300,200)); splitPane.setBackground(Color.green); splitPane.setDividerLocation(100); JPanel subPanel1 = new JPanel(); subPanel1.setPreferredSize(new Dimension(300, 100)); subPanel1.setBackground(Color.cyan); saying = new JLabel ("Say it with style!"); saying.setFont (new Font ("Helvetica", Font.PLAIN, 36)); subPanel1.add (saying); splitPane.setTopComponent(subPanel1); JPanel subPanel2 = new JPanel(); subPanel2.setPreferredSize(new Dimension(300, 100)); subPanel2.setBackground(Color.green); bold = new JCheckBox ("Bold"); bold.setToolTipText("Check this box to make text fatter."); bold.setBackground (Color.green); italic = new JCheckBox ("Italic"); italic.setToolTipText("Check this box to make text slantier looking."); italic.setBackground (Color.green); subPanel2.add (bold); subPanel2.add (italic); splitPane.setBottomComponent(subPanel2); add(splitPane); StyleListener listener = new StyleListener(); bold.addItemListener (listener); italic.addItemListener (listener); public void itemStateChanged (ItemEvent event) { int style = Font.PLAIN; if (bold.isSelected()) style = Font.BOLD; if (italic.isSelected()) style += Font.ITALIC; saying.setFont (new Font ("Helvetica", style, 36)); }
tagged with: java
has comment: http://stackoverflow.com/comment/35591274
score: 0
has comment: http://stackoverflow.com/comment/35591290
tagged with: program-entry-point
answer count: 1
has comment: http://stackoverflow.com/comment/35591293
has title: No Main Function

http://stackoverflow.com/a/23248654
type: Answer
has body: There are two things you can do. 1) If the file needs to be supplied by the user, take the location as an argument. Also use this approach if you want the application to fail without the user input. public static void main(String... args) { String location = args[0]; ... // Do Stuff } 2) If the file is static, package it in your jar and read it as a resource. public static void main(String... args) { InputStream input = FileClass.getClass().getClassLoader().getResourceAsStream("test.txt") ... // Do Stuff } When it's a properties file, my preference is a combination of the two. Define your default properties and package them. Then, allow the user to overwrite the values by supplying their own properties. Load the properties from the classpath (example two), and then replace any values from the file the user supplies (example one).
accepted answer of: http://stackoverflow.com/q/23248474
answers question: http://stackoverflow.com/q/23248474
type: AcceptedAnswer
score: 0

http://stackoverflow.com/comment/35573038
type: QuestionComment
type: Comment
has text: I think you want to loop as long as choice is not y AND not Y AND not n AND not N. As soon as either of them is entered (OR), you want to end the loop. So you should use `&&` instead of each of the `||`
comment on: http://stackoverflow.com/q/23248326
score: 0

http://stackoverflow.com/a/23155366
upvote count: 1
has body: If you don't want to expose the user IDs directly in the UI, you can access the user Profile using some other field like "user-name" for example, but you must ensure this particular field is UNIQUE on your database, so your links might end up like this: EXAMPLE --> "localhost:8080/myApp/userProfile?userName=joe123"
score: 1
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/23154811

http://stackoverflow.com/q/23205912
tagged with: movie
has title: Processing 2.0 Movie cannot open movie file when running from jar
type: UnansweredQuestion
upvote count: 1
tagged with: getresource
has answer: http://stackoverflow.com/a/23695878
tagged with: processing
score: 1
tagged with: java
type: Question
downvote count: 0
tagged with: executable-jar
favorite count: 0
has body: I'm trying to run a movie using the Processing 2.0 Movie class. If I run my program from my code editor (Eclipse in my case) everything works fine and the code runs flawlessly: it locates and starts the movie. However, when I export my program to a jar and start it from my terminal, it does locate the file but it crashes on trying to open it. I am currently using this code to find my movie path string. public String locateMovie(String moviePath) { String movie = MoviePlayer.class.getClassLoader().getResource(moviePath).getPath(); if (movie == null) { System.out.println("FATAL ERROR --- Movie file not found: '" + moviePath + "'"); } return movie; } As you can see I am using the classLoader to locate the file for me since the paths are different after I export it to a .jar file and do not wish to change the paths all the time myself. The .getPath() deletes the 'File:' in File:/Path/To/My/File as this is an unneeded side effect from using the above way. A bit further in my code I've already added an extra check to see if nothing is wrong with the path that the classLoader is returning, I do this with the following lines. File temp = new File(moviePath); System.out.println("If I have something after this, the file exists: '" + temp + "'"); It always returns the right path, whether it's running from within my Eclipse (/Users/Path/To/My/Folder/2/java/Game/movies/introMovie.mp4) or from the executable .jar file (introMovie.mp4). At first I thought it was strange that in the .jar file it was giving me a file straight away without the path leading to it because it does have some structure in my project but after using the jar tf myProject.jar command in my commandLine it returns the same file/pathname for the file so the path should be correct and all is still well here. But now, when I try to load the movie via Processing' Movie class with the following code: currentMovie = new Movie(parent, moviePath); It throws an java.lang.StringIndexOutOfBoundsException exception and cr…
answer count: 1

http://stackoverflow.com/a/23234041
downvote count: 0
answers question: http://stackoverflow.com/q/23234033
type: Answer
score: 2
has body: You are declaring your variables in the constructor making them visible only in the constructor. Don't do this. Declare the ones that need class visibility in the class. i.e. class Loan { private double base; private double exponent; private double totalPay; public Loan(double anualInterestRate, int numberOfYears, double loanAmount){ base = (double) ( loanAmount * (1+anualInterestRate/12)); xponent = (double) (numberOfYears * 12); totalPay = (double) Math.pow(base, exponent); // consider setting other fields with your parameters if they'll be // needed elsewhere }
upvote count: 2

http://stackoverflow.com/q/23240777
score: 2
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23240881
has answer: http://stackoverflow.com/a/23241000
downvote count: 0
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/23240881
has answer: http://stackoverflow.com/a/23240921
has answer: http://stackoverflow.com/a/23240855
has comment: http://stackoverflow.com/comment/35559494
upvote count: 2
tagged with: abstract
has comment: http://stackoverflow.com/comment/35560773
has title: Extends class with two parameters of super class in Java
has comment: http://stackoverflow.com/comment/35559405
favorite count: 0
has body: I am trying to write an abstract class that extends another abstract class. The super class is Expression: public abstract class Expression { String expression; /*Empty Constructor for Expression object */ public Expression(){ } /*Constructor for Expression object with String expression*/ public Expression(String expression){ this.expression = new String(expression); } and the extends class is CompoundExpression that has two variables from type Expression in it: public abstract class CompoundExpression extends Expression { Expression firstOperand, secondOperand; public CompoundExpression(Expression first, Expression second){ String strFirst = first.expression; String strSecond = second.expression; this.firstOperand = super(strFirst); this.secondOperand = super(strSecond); } } I figure I am doing it the wrong way cause it isn't working... Can someone help me understand why? And how I can do it the right way? I thought maybe to write it this way: public abstract class CompoundExpression extends Expression { Expression firstOperand, secondOperand; public CompoundExpression(Expression first, Expression second){ this.firstOperand.expression = first.expression; this.secondOperand.expression = second.expression; } } What do you think?
tagged with: extends
possible better answer: http://stackoverflow.com/a/23240855
has comment: http://stackoverflow.com/comment/35559722
answer count: 4

http://stackoverflow.com/q/23196200
has comment: http://stackoverflow.com/comment/35479442
tagged with: netbeans
accepted answer: http://stackoverflow.com/a/23196286
has comment: http://stackoverflow.com/comment/35479230
type: AnsweredQuestion
has body: I want to create independent jar files in netbeans like we can do in eclipse. Normally people suggest to clean and built the project and there is a jar file created. But to run these jar file the .java files, the codes are also required. Isn't there any way to create jar files which runs independently without requiring java codes? Thanks
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/23196286
answer count: 1
tagged with: jar
has title: how to create jar file in netbeans
score: 0

http://stackoverflow.com/a/79513466
score: 0
has body: tl;dr java.time.LocalDate.parse ( input.replace ( " " , "-" ) ).getMonthValue() … and: java.time.LocalDate.parse ( input.replace ( " " , "-" ) ).getDayOfWeek() java.time Both Joda-Time and the terribly-flawed legacy date-time classes in Java have been entirely supplanted by the modern java.time classes defined in JSR 310, built into Java 8+. You could use java.time.format.DateTimeFormatter to define a matching format. DateTimeFormatter f = DateTimeFormatter.ofPattern ( "uuuu MM dd" ) ; LocalDate ld = LocalDate.parse ( input , f ) ; ISO 8601 Or you could use simple string manipulation. Your input string is nearly in standard ISO 8601 format. To fully comply, replace your SPACE characters with - characters. String input = "2025 01 23".replace ( " " , "-" ) ; The java.time classes use those standard formats by default. So parse directly. LocalDate ld = LocalDate.parse ( input ) ; Tip: Educate the publisher of your data about using ISO 8601 formats rather than inventing a custom format. Sane numbering Unlike the legacy date-time classes, java.time uses sane numbering. For months, 1-12 is January-December. LocalDate x = LocalDate.parse ( "2013 01 01".replace ( " " , "-" ) ) ; LocalDate y = LocalDate.parse ( "2013 02 01".replace ( " " , "-" ) ) ; int month_x = x.getMonthValue() ; int month_y = y.getMonthValue() ; See this code run at Ideone.com. month_x: 1 month_y: 2 By the way, you may want a Month enum object rather than a number. Month m = myLocalDate.getMonth() ; Day of week You said your real goal is to get the day of week. The java.time classes offer a DayOfWeek enum, with one object for each day of the week. DayOfWeek dow = myLocalDate.getDayOfWeek() ;
type: Answer
answers question: http://stackoverflow.com/q/23169761

http://stackoverflow.com/a/23255889
has comment: http://stackoverflow.com/comment/48172910
downvote count: 0
answers question: http://stackoverflow.com/q/23255523
score: 48
has comment: http://stackoverflow.com/comment/64398702
type: Answer
upvote count: 48
has comment: http://stackoverflow.com/comment/85471295
has comment: http://stackoverflow.com/comment/35587361
has body: Retrofit uses an Executor for queueing requests. The default uses Executors.newCachedThreadPool which allows for unlimited threads. This fits most use cases since normally you would only ever have one or two requests happening at once. You can change this behavior, however, by supplying your own when building the RestAdapter. Call setExecutors and pass in an executor that uses a confined thread pool (limited to whatever number you would like). For the second argument, simply pass a new instance of MainThreadExecutor so that callbacks happen on the main thread.
has comment: http://stackoverflow.com/comment/48890690
has comment: http://stackoverflow.com/comment/35590878
has comment: http://stackoverflow.com/comment/50474185
accepted answer of: http://stackoverflow.com/q/23255523
type: AcceptedAnswer

http://stackoverflow.com/comment/35547273
comment on: http://stackoverflow.com/q/23233839
score: 0
has text: Please indicate the language (java) by adding a tag for it, rather than putting it in the title. I've fixed it this time.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35605878
comment on: http://stackoverflow.com/q/23266321
has text: did you debug the code? what is this value when cursor on it **sp1.getSelectedItem().toString()** and **(sp2).getSelectedItem().toString()** and **plHand** and **dlHand**
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35460704
type: QuestionComment
comment on: http://stackoverflow.com/q/23185418
has text: public void addUser(User user){ try{ makeConnection(); Statement s = con.createStatement(); s.execute("INSERT INTO Person VALUES('"+user.getUserName()+"','"+user.getPassword()+"','"+user.getEmail()+"','"+user.getSlang()+"')"); } catch(SQLException ex){ xc=false; JOptionPane.showMessageDialog(null,"The LoginID & or email already exists, \n please type a different loginID and password", "Error",JOptionPane.ERROR_MESSAGE); //System.out.println("Error......."); ex.printStackTrace(); } }
score: 0
type: Comment

http://stackoverflow.com/comment/64185155
comment on: http://stackoverflow.com/q/23289159
has text: Does your bash profile have proxy settings configured. That would explain wget working and sonar not. If so, have you added proxy configuration to your sonar configuration.
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/35469680
comment on: http://stackoverflow.com/a/23190183
type: AnswerComment
type: Comment
has text: @ZohraKhan my problem is not only a faster way for make my code more simple, , when I input into two EditText and another EditText is null, the page move from current page into new page, when it should not be moved
score: 0

while-loop
tags question: http://stackoverflow.com/q/23144001
type: Tag
tags question: http://stackoverflow.com/q/23170052
tags question: http://stackoverflow.com/q/23231653
tags question: http://stackoverflow.com/q/23267247
tags question: http://stackoverflow.com/q/23165488
tags question: http://stackoverflow.com/q/23228108
tags question: http://stackoverflow.com/q/23195554
tags question: http://stackoverflow.com/q/23203149
tags question: http://stackoverflow.com/q/23208455
tags question: http://stackoverflow.com/q/23178724
tags question: http://stackoverflow.com/q/23164788
tag name: while-loop
tags question: http://stackoverflow.com/q/23181570

http://stackoverflow.com/comment/35586199
score: 0
has text: probably because you did not call Base.close()
comment on: http://stackoverflow.com/a/23253223
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/43799338
comment on: http://stackoverflow.com/a/26462422
has text: True but registering your java class with Kryo causes the java serializer to be used. I did this with Guava's BiMap. Without registering BiMap the task failed to serialize.
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/23204580
has comment: http://stackoverflow.com/comment/35495008
duplicate of: http://stackoverflow.com/q/12020048
has title: Does switch case order affect speed?
has comment: http://stackoverflow.com/comment/35683879
has comment: http://stackoverflow.com/comment/35494640
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/35517945
has comment: http://stackoverflow.com/comment/35494936
downvote count: 1
tagged with: switch-statement
accepted answer: http://stackoverflow.com/a/23204827
has comment: http://stackoverflow.com/comment/35494631
type: Question
score: 83
has body: I've tried to google this, but had no luck. I have a very big switch, and some cases are obviously more common than others. So I would like to know if the order is really held as it is and the "upper" cases get tested before the "lower", therefore being evaluated faster. I'd like to keep my order, but if it hurts speed, then reordering the branches would be a good idea. For illustration: switch (mark) { case Ion.NULL: return null; case Ion.BOOLEAN: return readBoolean(); case Ion.BYTE: return readByte(); case Ion.CHAR: return readChar(); case Ion.SHORT: return readShort(); case Ion.INT: return readInt(); case Ion.LONG: return readLong(); case Ion.FLOAT: return readFloat(); case Ion.DOUBLE: return readDouble(); case Ion.STRING: return readString(); case Ion.BOOLEAN_ARRAY: return readBooleans(); case Ion.BYTE_ARRAY: return readBytes(); case Ion.CHAR_ARRAY: return readChars(); case Ion.SHORT_ARRAY: return readShorts(); case Ion.INT_ARRAY: return readInts(); case Ion.LONG_ARRAY: return readLongs(); case Ion.FLOAT_ARRAY: return readFloats(); case Ion.DOUBLE_ARRAY: return readDoubles(); case Ion.STRING_ARRAY: return readStrings(); default: throw new CorruptedDataException("Invalid mark: " + mark); }
has comment: http://stackoverflow.com/comment/35494687
has comment: http://stackoverflow.com/comment/35536484
linked to: http://stackoverflow.com/q/22110707
has comment: http://stackoverflow.com/comment/35494605
answer count: 1
upvote count: 84
linked to: http://stackoverflow.com/q/12020048
favorite count: 0
has comment: http://stackoverflow.com/comment/35494567
linked to: http://stackoverflow.com/q/15621083
has answer: http://stackoverflow.com/a/23204827

http://stackoverflow.com/comment/35535983
type: AnswerComment
type: Comment
has text: I disagree. WindowBuilder tends to have a lot of glitches and it uses older methods to create the layouts and everything. It is not reliable. When I used it I had to go back through and make manual changes to everything WindowBuilder did for me, so it did not save me any time at all.
comment on: http://stackoverflow.com/a/23227612
score: 0

http://stackoverflow.com/q/23147654
score: 0
has comment: http://stackoverflow.com/comment/35400335
answer count: 1
has comment: http://stackoverflow.com/comment/35394884
has answer: http://stackoverflow.com/a/23175983
has comment: http://stackoverflow.com/comment/35399663
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35400905
tagged with: multithreading
has comment: http://stackoverflow.com/comment/35402772
type: Question
accepted answer: http://stackoverflow.com/a/23175983
has body: I need a blocking queue that has a size of 1, and every time put is applied it removes the last value and adds the next one. The consumers would be a thread pool in which each thread needs to read the message as it gets put on the queue and decide what to do with it, but they shouldn't be able to take from the queue since all of them need to read from it. I was considering just taking and putting every time the producer sends out a new message, but having only peek in the run method of the consumers will result in them constantly peeking, won't it? Ideally the message will disappear as soon as the peeking stops, but I don't want to use a timed poll as it's not guaranteed that every consumer will peek the message in time. My other option at the moment is to iterate over the collection of consumers and call a public method on them with the message, but I really don't want to do that since the system relies on real time updates, and a large collection will take a while to iterate through completely if I'm going through each method call on the stack.
tagged with: blockingqueue
tagged with: java
has title: is there a blocking queue in Java that only allows peek?

http://stackoverflow.com/comment/35449514
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23178887
has text: this is what i did to run the code inside the loop infinitely. Is there any other way around to run a piece of code infinitely...

http://stackoverflow.com/q/23285259
has comment: http://stackoverflow.com/comment/35642227
score: 0
has comment: http://stackoverflow.com/comment/35642090
tagged with: console
has body: Hi I am using java spring MVC framework in my application. I am facing problem to handle the java console from web application .In below I am providing sample code: @RequestMapping(value="/consoleInput",method=RequestMethod.GET) public String takingInput(Model model ){ logger.info("/ConsoleInput mapping is begin"); System.out.println("Enter any things:"); Scanner sc = new Scanner(System.in); String s=sc.next(); System.out.println("Yours input is :"+s); model.addAttribute("input", s); logger.info("/ConsoleInput mapping is end"); return"console"; } So my problem is how can I give control to end user to provide the needed input when he is on web page and don’t have any idea about what is happening on back end. The above code is something is an example .so In web application console needed a input from user then how we can provide this input from webpage or how we can know on web page , this application needed input by user to continue rest of part. If I am not able to explain this problem properly or something still I am missing please let me know. I am using tomcat 7, java 7 and spring MVC framework Your help would be appreciated. Thank you in Advance.
type: UnansweredQuestion
tagged with: spring
answer count: 0
tagged with: web-applications
has title: How to provide console Input from Java Web application
has comment: http://stackoverflow.com/comment/35641836
type: Question
has comment: http://stackoverflow.com/comment/35641814
tagged with: java

http://stackoverflow.com/q/23266794
has body: I need to define some properties in map Lookup in log4j; so is there any way I can modify and add some properties in the Map Lookup ?? Any guide or suggestion would be appreciable Thank you!
favorite count: 0
type: UnansweredQuestion
tagged with: properties
tagged with: logging
tagged with: http://stackoverflow.com/tag/xml
has title: How to modify map lookup in log4j
score: 3
upvote count: 3
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/34767753
downvote count: 0
answer count: 1
tagged with: log4j

http://stackoverflow.com/comment/35455169
type: Comment
has text: InnerClass definitely does know about Child, if it's created from a Child. As you saw it printed "foo from child".
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/23181847

selectonemenu
tags question: http://stackoverflow.com/q/23202735
tag name: selectonemenu
type: Tag

http://stackoverflow.com/q/23136695
downvote count: 0
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/15744119
has body: I find myself in need of assistance. I'm trying to develop this simple app that takes pictures (Wow, now that's original!). Everything is fine. The only thing I need is to have a CIRCULAR CAMERA PREVIEW. I have my camerapreview class (which extends surfaceview) placed inside a frame layout, which is my camera preview basically. As you all know, this comes in a rectangular shape. Since I have bigger plans for the app, I'd need the camera preview to be circular (so, for example, someone can take a picture of someone's face and I can have some drawings around...). Now, I don't know how to proceed. I tried different things, creating a shape with xml and set it as background for my frame layout, but that just didn't work. After hours spent on google for solutions I decided that I had to give up and come here. So please, if someone knows anything, let us know :) I hope I was clear enough, do not hesitate to ask for clarification if needed.
has answer: http://stackoverflow.com/a/23136835
tagged with: camera
tagged with: java
type: Question
score: 5
has answer: http://stackoverflow.com/a/63878645
has title: Android: I need a circular camera preview. How to achieve it?
favorite count: 0
upvote count: 5
answer count: 3
tagged with: android
has answer: http://stackoverflow.com/a/38173770
tagged with: http://stackoverflow.com/tag/xml

http://stackoverflow.com/a/23183840
has comment: http://stackoverflow.com/comment/35459948
type: Answer
answers question: http://stackoverflow.com/q/23183815
has comment: http://stackoverflow.com/comment/35457775
has comment: http://stackoverflow.com/comment/35460157
has comment: http://stackoverflow.com/comment/35457658
score: 5
has body: This is not possible, and most of the time not desirable. You can, however, provide methods as a way to access these abstract properties: public interface Foo{ Integer x(); // get void x(Integer x); // set Double y(); void y(Double y); } Instead of System.out.println(foo.x); foo.x = 42; you'd now use System.out.println(foo.x()); foo.x(42); Or the more traditional, but also more verbose, naming: public interface Foo{ Integer getX(); void setX(Integer x); Double getY(); void setY(Double y); }
upvote count: 5
has comment: http://stackoverflow.com/comment/35457737
downvote count: 0

http://stackoverflow.com/q/23160481
has answer: http://stackoverflow.com/a/23160723
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/23163064
tagged with: java
type: Question
tagged with: object
has body: I've been trying to save an object, a level in my case, into a file, so that i can later load it again. Basically just a save/load function. I can't get it to work.. I keep getting a file of 5 byte, which seems way to small for what should be in it. I know that it might have something to do with Serializable, but i dont know what. Here is my current code: (btw, i hard coded the level into the program, because i dont know how to save it properly to a file yet. although that is the goal...) public class BufferSaveGames { public void saveGameOutputStream(Level level) throws FileNotFoundException { ObjectOutputStream output; try { output = new ObjectOutputStream((new FileOutputStream("SaveGame.dat"))); output.writeObject(level); output.close(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } and the second class Level, which it is loading: (removed code not needed for example) public class Level implements MouseListener, Serializable { private Level currentLevel; private int aantalPoppetjesOpLevel; private String oplossing; private int timer; JPanel[][] levelGrid; Poppetje[] lijstPoppetjes; public Level() throws IOException{ levelGrid = new JPanel[5][5]; lijstPoppetjes = new Poppetje[5]; for (int a=0;a&lt;5;a++) { for (int b=0;b&lt;5;b++) { levelGrid[a][b] = new JPanel(); levelGrid[a][b].setSize(100,100); levelGrid[a][b].setVisible(true); levelGrid[a][b].setLayout(null); levelGrid[a][b].setOpaque(false); levelGrid[a][b].addMouseListener(this); } } //bovenste rij levelGrid[0][0].setLocation(10,10); levelGrid[0][1].setLocation(112,10); levelGrid[0][2].setLocation(214,10); levelGrid[0][3].setLocation(316,10); levelGrid[0][4].setLocation(418,10); Poppetje roodPoppetje = new Poppetje("Rood", 4, 4); Poppetje oranjePoppetje = new Poppetje("Oranje", 0, 4); Poppetje groenPoppetje = new Poppetje("Groen", 1, 2); Poppetje paarsPoppetje = new Poppetje("Paars", 2, 1); Poppetje geelPoppetje = new Poppetje("Geel", 3, 3); //Poppetje blauwPoppetje = …
accepted answer: http://stackoverflow.com/a/23160723
score: 0
answer count: 2
tagged with: file-io
tagged with: serialization
has title: How to save an object into a file, so that i can load it later?
has answer: http://stackoverflow.com/a/23163064

http://stackoverflow.com/q/23206667
possible better answer: http://stackoverflow.com/a/23207003
has comment: http://stackoverflow.com/comment/35498925
has comment: http://stackoverflow.com/comment/35498903
has comment: http://stackoverflow.com/comment/35498919
has comment: http://stackoverflow.com/comment/35499177
score: 0
has body: I'm currently working on a project, and I don't understand why my second method doesn't work. I'm attempting to change the numbers entered by the user to another number. Each number should be added +7, then divided by 10. The first and third digit are supposed to be swapped, as are the second and fourth. It is supposed to accept four digits, and work with each one individually. I'm not sure how to get the results my professor is asking for. He said the result of 1234 should be 0189, but instead I keep getting 13 no matter how I swap them... I have attempted to modify the method to separate the digits, then perform the math required afterwards, but now the result is 14... I also don't understand how to have the compiler return a zero at the beginning of the number, or to keep it from dropping the zero at the beginning of the number when it is returned. Any help would be appreciated, but please don't hate on me for not understanding this assignment. import java.util.*; public class SeayJ_program2 { static Scanner input = new Scanner (System.in); public static void main (String [] args) { int num = getnum(); System.out.println(encrypt(num)); } // methods are here public static int getnum() { int num; System.out.println("Please enter a four digit number"); num = input.nextInt(); return num; } public static int encrypt(int num) { int digit1, digit2, digit3, digit4; digit4 = num % 10; num = num / 10; digit4 = (num + 7) / 10; digit3 = num % 10; num = num / 10; digit3 = (num + 7) / 10; digit2 = num % 10; num = num / 10; digit2 = (num + 7) / 10; digit1 = num % 10; num = num / 10; digit1 = (num + 7) / 10; return digit3 + digit4 + digit1 + digit2; } }
has title: encrypting numbers in java using a method
tagged with: encryption
tagged with: methods
has comment: http://stackoverflow.com/comment/35498964
has answer: http://stackoverflow.com/a/23207173
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35499051
has comment: http://stackoverflow.com/comment/35499251
tagged with: java
has comment: http://stackoverflow.com/comment/35499092
has answer: http://stackoverflow.com/a/23207003
accepted answer: http://stackoverflow.com/a/23207173
type: Question
answer count: 2

http://stackoverflow.com/comment/35650449
type: QuestionComment
comment on: http://stackoverflow.com/q/23289760
has text: @AlejandroLucena I'm pretty sure there's no max implementation in official java API's. To get max you just pass Collections.reverseOrder() to the PriorityQueue(int, Comparator<E>) constructor.
score: 0
type: Comment

http://stackoverflow.com/q/23136998
answer count: 4
has answer: http://stackoverflow.com/a/23137030
type: AnsweredQuestion
upvote count: 3
has comment: http://stackoverflow.com/comment/35376302
type: Question
score: 3
has body: package vehicles_order; import java.util.ArrayList; import java.util.Collections; import java.util.Iterator; public class vehicles implements Comparable { String Vehicle; String Make; String Type; double Cost; public static void main(String[] args){ ArrayList cars = new ArrayList(); cars.add(new vehicles ("CAR","Peugot","3008",12500.00)); cars.add(new vehicles ("CAR","BMW","316",4995.00)); cars.add(new vehicles ("CAR","Ford","Fiesta",2995.00)); Collections.sort(cars); Iterator itr = cars.iterator(); while(itr.hasNext()){ Object element = itr.next(); System.out.println(element + "\n"); } } public vehicles(String vehicle, String make, String type, double cost){ Vehicle = vehicle; Make = make; Type = type; Cost = cost; } public String toString() { return "Vehicle: " + Vehicle + "\n" + "Make: " + Make + "\n" + "Type: " + Type + "\n" + "Cost: " + Cost; } public int compareTo(Object o1) { if (this.Cost == ((vehicles) o1).Cost) return 0; else if ((this.Cost) &gt; ((vehicles) o1).Cost) return 1; else return -1; } } My comparator is at the bottom and I just wondering how it actually works. Im guessing its like a stack, where when it returns 1 it moves up the stack if its -1 moves down. Also, can anyone tell me how id go about ordering the cars via a different method. For example, store the cost in a temp highest value and check if the new value is higher than the current one
tagged with: java
possible better answer: http://stackoverflow.com/a/35582787
has answer: http://stackoverflow.com/a/23137346
tagged with: comparison
has title: How does this comparator work?
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/23137366
accepted answer: http://stackoverflow.com/a/23137366
tagged with: compare
has answer: http://stackoverflow.com/a/35582787

http://stackoverflow.com/comment/35611933
comment on: http://stackoverflow.com/a/23268648
has text: Thanks for the help. I have implemented it but it seems to only be called when backspace/delete is hit. I.e. if 2 digits are entered, nothing happens, but if I enter 3 then delete one the colon is entered. I will copy and paste my new code into my original post
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/35560693
has text: i have it in the libraries
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23240899

http://stackoverflow.com/a/23209692
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35504226
answers question: http://stackoverflow.com/q/23209559
type: Answer
has comment: http://stackoverflow.com/comment/35504282
has comment: http://stackoverflow.com/comment/35504237
score: 2
downvote count: 0
has body: In dispatcher-servlet.xml, you have mapping to controller as: <bean name="/beanurlhandlermapping.html" class="com.fanjavaid.controller.BeanNameUrlHandlerMappingController" /> Make change in index.jsp as: Click to test BeanURLHandlerMapping
upvote count: 2
accepted answer of: http://stackoverflow.com/q/23209559

http://stackoverflow.com/q/23261495
upvote count: 1
has title: how to handle dynamically changing iframe id using selenium webdriver
has answer: http://stackoverflow.com/a/73871232
type: UnansweredQuestion
answer count: 4
has body: iframe id=pngNewCase1143241142570_IFrame., this id changes dynamically every time how can i handle this in selenium webdriver java I tried using driver.switchTo().frame(driver.findElement(By.xpath("Xpath of Iframe which changes dynamically"))); driver.switchTo().defaultContent(); but didn't work for me also tried driver.switchTo().frame(driver.findElement(By.Id("pngNewCase1143241142570_IFrame"))); driver.switchTo().defaultContent(); can anyone help me please
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/35599276
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/24367095
linked to: http://stackoverflow.com/q/20069737
tagged with: selenium-webdriver
tagged with: java
has answer: http://stackoverflow.com/a/23264403
has answer: http://stackoverflow.com/a/76663265

http://stackoverflow.com/q/23188031
tagged with: swing
type: Question
has body: I have a Start and a Pause button on my gui. When I click start, it executes method run() from another class and I want to be able to pause the execution however I can't click the pause button while the program is running and the pause button is only clickable when run() finishes. How do I make pause button clickable while run() is being executed?
tagged with: java
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/23188100
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23188100
has title: How to use start and pause buttons
has comment: http://stackoverflow.com/comment/35465821

http://stackoverflow.com/q/23138066
has title: Java runnable problems
has body: Currently this is my code package com.raggaer.frame; import java.awt.Dimension; import java.awt.Graphics; import javax.swing.JFrame; public class Frame { private JFrame frame; public Frame() { this.frame = new JFrame("Java Snake"); this.frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.frame.add(new Panel()); Paint game = new Paint(); this.frame.setResizable(false); this.frame.pack(); this.frame.setVisible(true); } } And this is my paint class package com.raggaer.frame; public class Paint implements Runnable { private Thread thread; public Paint() { thread = new Thread(this); thread.start(); } public void run() { System.out.println("aaa"); } } But the System.out.println("aaa"); is just executing one time instead of forever.. what Im doing wrong?
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/23138099
type: Question
has answer: http://stackoverflow.com/a/23138177
possible better answer: http://stackoverflow.com/a/23138177
score: 0
answer count: 3
tagged with: runnable
has answer: http://stackoverflow.com/a/23138099
has answer: http://stackoverflow.com/a/23139752
tagged with: multithreading

osmdroid
type: Tag
tag name: osmdroid
tags question: http://stackoverflow.com/q/23211909
tags question: http://stackoverflow.com/q/23181149

http://stackoverflow.com/comment/35525851
type: AnswerComment
has text: Thank you very much ;). This was the fault. Gonna add it as answer till I can.
comment on: http://stackoverflow.com/a/23222109
score: 0
type: Comment

http://stackoverflow.com/a/23287316
downvote count: 0
answers question: http://stackoverflow.com/q/23287185
type: Answer
has comment: http://stackoverflow.com/comment/35816580
upvote count: 1
score: 1
has body: It look as if you were trying to parse an invalid xml structure. The error itself points to a missing '>', like so: &lt;position&gt; &lt;stuff &lt;/position&gt; The parser expects to find the '>' of the stuff tag, but finds the closing tag of position. Try to extract the xml structure as a string and look for the error. You might also just paste it into an xml validator.

http://stackoverflow.com/a/23262127
has comment: http://stackoverflow.com/comment/35602181
has comment: http://stackoverflow.com/comment/35605311
downvote count: 0
has comment: http://stackoverflow.com/comment/35605178
has comment: http://stackoverflow.com/comment/35598701
has body: The only difference is that a static synchronized locks on the class instance and a non-static synchronized method locks on the instance. People tell about two types of multi-threaded locking There is object instance locks and Lock style locks. A Lock, confusingly, has both. object and class Not true as you have worked out already. Just because people say stuff doesn't make it true. Often people say a lot of nonsense. In fact there is whole web sites devoted to non-sense about Java. :P
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23261120
score: 4
answers question: http://stackoverflow.com/q/23261120
has comment: http://stackoverflow.com/comment/35615167
type: Answer
upvote count: 4
has comment: http://stackoverflow.com/comment/35599399
has comment: http://stackoverflow.com/comment/81218311

http://stackoverflow.com/a/23264212
answers question: http://stackoverflow.com/q/23264150
has body: PROBLEM ANALYSIS: You use a PrintWriter for sending from the client, but you use an ObjectInputStream on the receiving side of the server. These two are not compatible. You have to use a pair of Writer and Reader together or a pair of ObjectOutputStream and ObjectInputStream, but you can't mix them. SOLUTION: We're going to use pairs of Writer and Reader. The client side already uses a Writer and a Reader, so we only need to change the server side. On the server side, instead of the ObjectInputStream, use a BufferedReader: BufferedReader reader = new BufferedReader(new InputStreamReader(socket.getInputStream())); reader.readLine(); Moreover, use a PrintWriter instead of the ObjectOutputStream on the server side for sending back to the client: PrintWriter writer = new PrintWriter(new BufferedWriter( new OutputStreamWriter(socket.getOutputStream())), true); writer.println(str); Alltogether, then the server side looks like this: import java.io.IOException; import java.io.BufferedWriter; import java.io.BufferedReader; import java.io.OutputStreamWriter; import java.io.InputStreamReader; import java.io.PrintWriter; import java.lang.ClassNotFoundException; import java.net.ServerSocket; import java.net.Socket; public class SocketServerExample { //static ServerSocket variable private static ServerSocket server; //socket server port on which it will listen private static int port = 5000; public static void main(String args[]) throws IOException, ClassNotFoundException{ //create the socket server object server = new ServerSocket(port); //keep listens indefinitely until receives 'exit' call or program terminates while(true){ System.out.println("Waiting for client request"); //creating socket and waiting for client connection Socket socket = server.accept(); // //read from socket to ObjectInputStream object // ObjectInputStream ois = new ObjectInputStream(socket.getInputStream()); // //convert ObjectInputStream object to String // String message = (String) ois.readObject(); // S…
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/35602812
has comment: http://stackoverflow.com/comment/35602336
has comment: http://stackoverflow.com/comment/35602026
type: Answer
has comment: http://stackoverflow.com/comment/35601934
score: 2
upvote count: 2
accepted answer of: http://stackoverflow.com/q/23264150

http://stackoverflow.com/a/23172491
type: AcceptedAnswer
downvote count: 0
score: 1
has body: JFrame and JDialog are top-level containers typically used as view components. In general, they don't communicate except to position a dialog relative to its parent frame. Instead, arrange for your views to communicate using a PropertyChangeEvent, as shown in this example. Having a separate model that contains a notional List&lt;Product&gt; will let you employ the pattern discussed here.
answers question: http://stackoverflow.com/q/23170144
type: Answer
accepted answer of: http://stackoverflow.com/q/23170144
upvote count: 1

http://stackoverflow.com/q/23278867
has body: I'm currently programming a game in java and am using an interface to handle input/output for the game. I currently have a text interface working properly. I'm using code similar to the following: while (moveExists()) { String in = interface.getInput(); processInput(in); interface.displayOutput(this.getState); } The text only interface works because it pauses to wait for input, but I am not sure how to accomplish a similar behaviour in a GUI implementation. How may I 'wait' for input from an actionListener? If not, I'll probably use code less like a game loop and more like a finite state machine so that I don't need to deal with two different threads trying to co-ordinate their actions.
tagged with: user-interface
answer count: 1
has comment: http://stackoverflow.com/comment/35629868
has comment: http://stackoverflow.com/comment/35633043
has answer: http://stackoverflow.com/a/23278932
type: UnansweredQuestion
tagged with: interface
has title: Syncing interaction between a GUI and a while loop
tagged with: java
type: Question
score: 0

http://stackoverflow.com/comment/35409207
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23156405
has text: You can do it with breakpoints and Debug Mode with NetBeans, I'm not sure about eclipse though.
score: 0

http://stackoverflow.com/a/23166226
type: AcceptedAnswer
upvote count: 1
has body: You don't need a nested loop to check the elements. In fact, your code is wrong in a sense that it's checking all the elements from one array to another. You might want to // Check to make sure arrays have same length if (data.length != s.length) return false; for (int i=0;i&lt;data.length;i++) { if (data[i]!=s[i]) { return false; } } return true;
type: Answer
accepted answer of: http://stackoverflow.com/q/23166193
answers question: http://stackoverflow.com/q/23166193
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/35427585

http://stackoverflow.com/comment/35512533
has text: try Sysout on the returnz and see whether your return is correct... if it is, you can either display it on the screen or use it where ever you see fit. Hope this helped.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23213540

http://stackoverflow.com/a/23162069
has comment: http://stackoverflow.com/comment/35423216
score: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23161790
accepted answer of: http://stackoverflow.com/q/23161790
type: Answer
has body: A few issues with this code. The reason you're only getting the last result is because of this line: fWriter = new FileWriter("Exports/Transfers/" + /* frmNm.replace(":", "_") */"EBW_" + GtDates.fdate + ".csv", false); This line is inside your loop. The false as the last parameter tells FileWriter not to append. In other words, a false means overwrite the file if it exists. Since this is in your loop, each result overwrites the file that the last result created. You should create the FileWriter outside of your loop, probably in a try with resources. That will allow you to remove your writer.close() call, which should have been in a finally block anyway. Not related to your original question but something you should be aware of: You're creating a new Statement with each loop iteration. This can be an expensive operation. You should use a PreparedStatement instead. Create it outside your loop and then just set the parameter and execute it inside the loop. It also implements AutoCloseable, so you can create it in a try with resources too, probably the same one you create your FileWriter in.
has comment: http://stackoverflow.com/comment/35423191

http://stackoverflow.com/comment/35450046
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23168135
score: 1
has text: As I said I wanted to ask this question in the comments but I can't due to low reputation since I'm new... sorry. And as for your question devnull, you'd be surprised how some institutions teach...

http://stackoverflow.com/q/23183543
favorite count: 0
accepted answer: http://stackoverflow.com/a/23183555
type: AnsweredQuestion
has body: public void changeColor(int[] value) { color = value; } In the above code Color is a is a int Array in a class. and value is a array in the scope of method ChangeColor. By Color = value; I am assigning the memory space allocated to value to Color. As per my understanding once a method ended the variable specific to the method will be deleted, in that case will Color be able to access its value after the method ends??
tagged with: java
downvote count: 2
has answer: http://stackoverflow.com/a/23183591
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/23183555
possible better answer: http://stackoverflow.com/a/23183591
has title: memory allocation change
score: -1
answer count: 2
has comment: http://stackoverflow.com/comment/35457191

http://stackoverflow.com/q/23201663
has answer: http://stackoverflow.com/a/31648535
downvote count: 0
has answer: http://stackoverflow.com/a/23201861
has comment: http://stackoverflow.com/comment/35807925
favorite count: 0
has answer: http://stackoverflow.com/a/24550565
has title: OkHttp in android for making network requests
tagged with: android
tagged with: okhttp
has comment: http://stackoverflow.com/comment/35490717
upvote count: 16
type: AnsweredQuestion
has body: What I am trying to do:: I am trying to learn the usage of Okhttp for making networking calls in android What I have done:: I have read their documentation here I have downloaded and added the JAR in the project I am using their sample code from here MyCode:: MainActivity.java import android.app.Activity; import android.os.Bundle; import android.util.Log; import com.squareup.okhttp.OkHttpClient; import com.squareup.okhttp.internal.http.Request; import com.squareup.okhttp.internal.http.Response; public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Request request = new Request.Builder() .url("https://raw.github.com/square/okhttp/master/README.md") .build(); Response response = client.execute(request); Log.d("ANSWER", response.body().string()); } } Error i am facing:: In the line Response response = client.execute(request); I am getting error as : client cannot resolved to a variable How to resolve this ! {Update} public class MainActivity extends Activity { OkHttpClient client = new OkHttpClient(); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Request request = new Request.Builder() .url("https://raw.github.com/square/okhttp/master/README.md") .build(); Response response = client.execute(request); Log.d("ANSWER", response.body().string()); } } Now I am facing error as : in the line Response response = client.execute(request); as The method execute(Request) is undefined for the type OkHttpClient
has answer: http://stackoverflow.com/a/24550458
has comment: http://stackoverflow.com/comment/77411032
tagged with: java
has answer: http://stackoverflow.com/a/32467075
score: 16
has answer: http://stackoverflow.com/a/31730390
type: Question
answer count: 8
accepted answer: http://stackoverflow.com/a/24550565
has answer: http://stackoverflow.com/a/23201768
has comment: http://stackoverflow.com/comment/35490831
possible better answer: http://stackoverflow.com/a/24300809
has answer: http://stackoverflow.com/a/24300809

http://stackoverflow.com/a/23232029
downvote count: 1
answers question: http://stackoverflow.com/q/23231996
has comment: http://stackoverflow.com/comment/35544202
upvote count: 2
type: Answer
score: 1
has body: Remove coins = new ArrayList&lt;MyCoins&gt;(); from your showCoins() method. It replaces the list of coins currently in your purse by an empty list.
has comment: http://stackoverflow.com/comment/35544218

http://stackoverflow.com/comment/35365957
has text: yes i do it but it is not working for me. I also checking increasing and decrease.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23132124

http://stackoverflow.com/comment/35431422
has text: Related: https://stackoverflow.com/questions/5963399/how-can-i-make-a-copy-of-an-iterator-in-java and https://stackoverflow.com/questions/3831912/java-why-are-iterators-not-copyable
score: 1
comment on: http://stackoverflow.com/q/23168493
type: Comment
type: QuestionComment

http://stackoverflow.com/a/78711361
has comment: http://stackoverflow.com/comment/138775375
type: Answer
score: 0
has body: The simple (and real) reason is that locks need additional storage space and the primitive types don't have 'room' for these lock bits, as they are just what they are, unboxed types. The boxed versions of these like java.lang.Integer etc. do have room for the locks, and so they have them. Note that you can put a primitive type directly on the (JVM) stack, but you can only put a reference there to a boxed type. One might also recall here that most primitive accesses (meaning reads and writes) are guaranteed atomic in Java up to '32-bit', so except for longs and doubles, access to which may be implemented as two operations, so are not guaranteed atomic. Except (also) that due the somewhat complicated Java Memory Model even though 32-bit writes are atomic (so you can't see inconsistent half words on these), updates may not immediately propagate to other threads! OTOH, as soon as you make some primitive type volatile it is guaranteed that other threads will see the change "as soon as possible" and it will also be (inter-thread) atomic even for the 64-bit quantities. So, as far as just reads and writes are concerned (set and get) java.util.concurrent.AtomicLong merely declares a volatile long (and uses no synchronized around its set and get). One answer (already) mentioned java.util.concurrent, but that is not merely to give atomic reads and writes e.g. of Booleans, but to also give more complex atomic ops (on those) like compareAndSet. But for 64-bit types java.util.concurrent also provides atomic reads and writes, albeit in a simple volatile fashion.
answers question: http://stackoverflow.com/q/23131810
has comment: http://stackoverflow.com/comment/138775085

http://stackoverflow.com/a/23284180
has body: ExceptionInInitializerError occurs if an error or exception occurs when the class is getting loaded in its ClassLoader. This might occur if anything wrong happens while initializing any of the static variables that are present within a class or if there are any static blocks something like: In your class you could check if any exception occurs at the line: private static PropLoader loader = new PropLoader("/WEB-INF/lib/info.cfg"); In addition to catching the IOException, you could also catch the Exception to check if your PropLoader constructor is completed successfully without any errors. If there is an error or exception there, then it could lead to whether the file "/WEB-INF/lib/info.cfg" is present inside the war in the said location or not.
accepted answer of: http://stackoverflow.com/q/23283704
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23283704
type: AcceptedAnswer

http://stackoverflow.com/a/23224586
downvote count: 0
has comment: http://stackoverflow.com/comment/35531470
has comment: http://stackoverflow.com/comment/35530575
answers question: http://stackoverflow.com/q/23224480
has comment: http://stackoverflow.com/comment/35530549
has comment: http://stackoverflow.com/comment/35530841
type: Answer
upvote count: 2
has body: GridLayout I've never actually used but I'm not sure if it can do this. BorderLayout can do this and is simpler to use than GridBagLayout. GridBagLayout can do this. In general GridBagLayout is one of the most flexible LayoutManagers and is well worth learning so I'd recommend using it here to get used to it on a simple case before you need it anyway for something more complex. If you are familiar with HTML then think of GridBagLayout as working like HTML tables. Very quickly - create the three panels and set the sizes/borders/whatever you need in them. Add one in cell 0,0 with a colspan of 2. Add one in cell 1,0 Add one in cell 1,1 After that you are done although you will probably want to specify resize/anchor/etc behaviour.
has comment: http://stackoverflow.com/comment/35530949
score: 2

http://stackoverflow.com/comment/35429263
comment on: http://stackoverflow.com/q/23166986
has text: Showing the code that executes and processes the `select` would help. Unless you're just doing that directly in your client, like SQL Developer; how would you expect the binary data to be displayed? You could query the size of the BLOB field maybe, to compare with the original file?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35452352
type: QuestionComment
type: Comment
has text: you may check out `DetachedCriteria` in Hibernate, then you can pass it to `getUser()`. But I think it's not as good as your original design.
comment on: http://stackoverflow.com/q/23178601
score: 0

http://stackoverflow.com/comment/35467487
comment on: http://stackoverflow.com/q/23188863
score: 0
type: Comment
has text: Best not to deal with double for this, you will get errors. The simplest way is to use an it and record it as cents instead of dollars (eg. 123 is $1 and 23 cents). Take alook here for more details: http://stackoverflow.com/questions/3730019/why-not-use-double-or-float-to-represent-currency
type: QuestionComment

http://stackoverflow.com/comment/35619450
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23272703
has text: yes I'm using eclipse, but my teacher hates eclipse and tried to get me to use jgrasp. not nearly as useful.
score: 0

http://stackoverflow.com/comment/35537219
comment on: http://stackoverflow.com/a/23227875
score: 0
type: AnswerComment
type: Comment
has text: I'll check) Thank you!)

http://stackoverflow.com/comment/35577479
type: Comment
has text: @PaulRitcher I actually did make everything static is this a problem?
comment on: http://stackoverflow.com/a/23250089
score: 0
type: AnswerComment

annotate
tag name: annotate
type: Tag
tags question: http://stackoverflow.com/q/23198442

http://stackoverflow.com/a/23188730
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/23188608
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/23188608
has body: When you send the name to the server with : out.print(name); use out.println(name); to send it if you want to read it with in.nextLine() on the server. This should solve your problem.
downvote count: 0

http://stackoverflow.com/comment/74628970
comment on: http://stackoverflow.com/a/23261076
has text: I missed it at first when trying this technique: it's important to set the Java `srcDirs` to empty array if you're including `src/main/java` in the Scala `srcDirs`.
type: Comment
score: 1
type: AnswerComment

http://stackoverflow.com/comment/35448454
comment on: http://stackoverflow.com/q/23178214
score: 0
type: Comment
type: QuestionComment
has text: It is pound delimited however, if there is nothing listed for author the length returns 2 instead of 3. I need it to return the null if the author is nonexistent.

http://stackoverflow.com/comment/35631714
type: AnswerComment
type: Comment
has text: Modified. I didn't even notice the `substring` method because it's so odd to do it that way.
comment on: http://stackoverflow.com/a/23279770
score: 0

http://stackoverflow.com/comment/35427813
type: Comment
has text: Nice! +1 Actually my comment to the question, which was sitting on the screen for s long time before I submitted it, almost seems redundant now - except for the idea of resizing it when painting.. BTW - `g.drawImage(image, scaleTransform, null);` should better be `g.drawImage(image, scaleTransform, null); g.dispose();`..
score: 1
comment on: http://stackoverflow.com/a/23165743
type: AnswerComment

http://stackoverflow.com/q/23132980
tagged with: classnotfoundexception
answer count: 1
has title: loadClass throws NoClassDefFoundError caused by ClassNotFoundException
has body: Using the following code I get a NoClassDefFoundError caused by ClassNotFoundException: File file = new File( "C:\\prototype.core.bl.xmodelval.xmodel-1.0.0.jar" ); URL url = file.toURI().toURL(); URL[] urls = new URL[] { url }; ClassLoader cl = new URLClassLoader( urls ); Class cls = cl.loadClass("de.zeb.control.prototype.core.bl.xmodelval.xmodel.entity.EntityNameLengthXModelValidationRule" ); The jar and the class in the jar are definitely available. The following exception is thrown by cl.loadClass. The full exception stack trace follows: Exception in thread "main" java.lang.NoClassDefFoundError: de/zeb/control/prototype/core/bl/xmodelval/XModelValidationRule at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631) at java.lang.ClassLoader.defineClass(ClassLoader.java:615) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141) at java.net.URLClassLoader.defineClass(URLClassLoader.java:283) at java.net.URLClassLoader.access$000(URLClassLoader.java:58) at java.net.URLClassLoader$1.run(URLClassLoader.java:197) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:190) at java.lang.ClassLoader.loadClass(ClassLoader.java:306) at java.lang.ClassLoader.loadClass(ClassLoader.java:247) at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631) at java.lang.ClassLoader.defineClass(ClassLoader.java:615) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141) at java.net.URLClassLoader.defineClass(URLClassLoader.java:283) at java.net.URLClassLoader.access$000(URLClassLoader.java:58) at java.net.URLClassLoader$1.run(URLClassLoader.java:197) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:190) at java.lang.ClassLoader.loadClass(ClassLoader.java:306) at java.lang.ClassLoader.loadClass(ClassLoa…
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35369283
tagged with: java
tagged with: noclassdeffounderror
type: Question
has comment: http://stackoverflow.com/comment/35369471
has answer: http://stackoverflow.com/a/23133504
has comment: http://stackoverflow.com/comment/35370975
score: 0

http://stackoverflow.com/comment/35456047
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23182968
has text: Try `System.out.println(new File("").getAbsolutePath());` to see the default directory.

http://stackoverflow.com/comment/35428139
comment on: http://stackoverflow.com/q/23166644
type: Comment
has text: your layout is not same, seek bar is not exists on `activity_crazy_tip_calc`
score: 0
type: QuestionComment

http://stackoverflow.com/a/23195568
type: AcceptedAnswer
downvote count: 0
score: 1
has body: As the error suggests can't serialize class com.xxx.pojo.Bookmark , which means that the List containing Bookmark.class can't be directly inserted in BasicDBObject document. You need to use : BasicDBList as follows: BasicDBList bookmark_list = new BasicDBList(); List&lt;Bookmark&gt; bmk_list = userList.get(i).getBookmarksList(); for(int i=0;i&lt;bmk_list.size();i++) { String name = bmk_list.get(i).getName(); String category = bmk_list.get(i).getCategory(); String stats = bmk_list.get(i).getStats(); boolean tried = bmk_list.get(i).getTried(); DBObject db_obj = new BasicDBObject(); db_obj.put("name",name); db_obj.put("category",category); db_obj.put("stats",stats); db_obj.put("tried",tried); bookmark_list.add(db_obj); } Now add this bookmark_list in your document as follows: BasicDBObject document = new BasicDBObject(); document.append("email", userList.get(i).getEmail()); document.append("bookmarks", bookmark_list ) ; WriteResult result = collection.insert(document);
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/23192279
accepted answer of: http://stackoverflow.com/q/23192279

http://stackoverflow.com/q/23159540
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23160542
has answer: http://stackoverflow.com/a/23159636
tagged with: tree
upvote count: 0
tagged with: linked-list
has body: Everytime I want to insert a new node into the list it will make a new head, which it should do the first time, but the second time it should attach the new node to the previous one. Whenever I insert with this code it keeps creating a new head. Why does the previous head which was first inserted not being saved? static class TreeNode{ int frequency; boolean isLeftChild; TreeNode parent; TreeNode next; /** * TreeNode class constructor to initialize the variables and also * takes a frequency as the parameter. * @param f Frequency of a certain character. */ TreeNode(int f){ frequency = f; isLeftChild = true; parent = null; next = null; } } // Class used to store information for the linked list. static class List{ TreeNode head; int numItems; // number of nodes in the list List(){ head = null; numItems = 0; // initialize head and numItems } /** * Inserts a node into the TreeNode linked list according to its frequencies * position as it will be in a SORTED list. * @param freq Frequency of a specific character. * @return Returns the new TreeNode object that has been inserted. */ TreeNode insert(int freq){ TreeNode previous, current, newNode; int newFreq = freq; numItems++; previous = null; current = head; while((current != null) &amp;&amp; (Integer.valueOf(newFreq).compareTo(Integer.valueOf(current.frequency)) &gt; 0 )){ previous = current; current = current.next; } if(previous == null){ head = new TreeNode(newFreq); return head; } else{ newNode = new TreeNode(newFreq); previous.next = newNode; return newNode; } }
has comment: http://stackoverflow.com/comment/35417010
tagged with: java
has comment: http://stackoverflow.com/comment/35423468
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/35415985
has comment: http://stackoverflow.com/comment/35417335
has comment: http://stackoverflow.com/comment/35416990
score: -1
answer count: 2
has title: Sorted List insertion keeps creating new head?
favorite count: 0
has comment: http://stackoverflow.com/comment/35415396
tagged with: sortedlist
has comment: http://stackoverflow.com/comment/35415510

http://stackoverflow.com/a/23264943
answers question: http://stackoverflow.com/q/23264857
type: Answer
has body: An Object[] is not a String[].
score: 0

http://stackoverflow.com/q/23191311
score: 0
has title: Verifying unexpected empty lines in a file
has body: Aside: I am using the penn.txt file for the problem. The link here is to my Dropbox but it is also available in other places such as here. However, I've not checked whether they are exactly the same. Problem statement: I would like to do some word processing on each line of the penn.txt file which contains some words and syntactic categories. The details are not relevant. Actual "problem" faced: I suspect that the file has some consecutive blank lines (which should ideally not be present), which I think the code verifies but I have not verified it by eye, because the number of lines is somewhat large (~1,300,000). So I would like my Java code and conclusions checked for correctness. I've used slightly modified version of the code for converting file to String and counting number of lines in a string. I'm not sure about efficiency of splitting but it works well enough for this case. File file = new File("final_project/penn.txt"); //location System.out.println(file.exists()); //converting file to String byte[] encoded = null; try { encoded = Files.readAllBytes(Paths.get("final_project/penn.txt")); } catch (IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } String mystr = new String(encoded, StandardCharsets.UTF_8); //splitting and checking "consecutiveness" of \n for(int j=1; ; j++){ String split = new String(); for(int i=0; i&lt;j; i++){ split = split + "\n"; } if(mystr.split(split).length==1) break; System.out.print("("+mystr.split(split).length + "," + j + ") "); } //counting using Scanner int count=0; try { Scanner reader = new Scanner(new FileInputStream(file)); while(reader.hasNext()){ count++; String entry = reader.next(); //some word processing here } reader.close(); } catch (FileNotFoundException e) { e.printStackTrace(); } System.out.println(count); The number of lines in Gedit--if I understand correctly--matched the number of \n characters found at 1,283,169. I have verified (separately) that the number of \r and \r\n (combined) ch…
linked to: http://stackoverflow.com/q/326390
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23209814
linked to: http://stackoverflow.com/q/2850203
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/23209814
tagged with: newline
answer count: 1

http://stackoverflow.com/q/23204473
tagged with: gridbaglayout
has answer: http://stackoverflow.com/a/23204549
has body: I am trying to create a GUI where I add two JPanels to one JFrame, but the second JPanel I add override the first. In my first JPanel I have a sudoku box, and in the second I want a button. But, since the first one I add always overrides the second, this doesn't work. My sudoku JPanel uses GridLayout, and this alone works perfectly. The problem is when I try to add the second JPanel (which has a JButton). Since the button needs to be another size than the squares in the sudoku box, I can't add this button to the first JPanel. Is it possible to solve this using two JPanels, or do I need a different layout? I have read some about GridBagLayout and think this might be a solution, but it's a bit boring to change the whole code for my JPanel which has the sudoku in it.
tagged with: jpanel
answer count: 1
downvote count: 0
favorite count: 0
has title: Two JPanels in one JFrame - the second overrides the first
accepted answer: http://stackoverflow.com/a/23204549
tagged with: jframe
tagged with: swing
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
type: Question

http://stackoverflow.com/comment/35585877
comment on: http://stackoverflow.com/q/23255162
has text: You want to play it again? Please confirm.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35497682
has text: if jboss doesn't provide exact jar you want in classpath then just change scope to `<compile>` or `<runtime>`
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23206074

http://stackoverflow.com/comment/35529860
has text: Okay so I have the code and I am maneuvering things around to try and get it to work. The problem I have now it I cant access the variables addition, minus, division etc. in the performOperation method. I am sorry if this is juvenile or easy java but I am having a problem with this.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23221331
type: Comment

http://stackoverflow.com/q/23188366
tagged with: dns
tagged with: java
has comment: http://stackoverflow.com/comment/35466376
type: Question
has title: Tracing a bug in a "reverse domain" program in Java
score: 0
tagged with: reverse
has comment: http://stackoverflow.com/comment/35466303
has body: My code is supposed to reverse a domain. For example, if the input is www.google.com.uk, it should print uk.com.google.www My problem is that my code prints uk.com..google.www I can't figure where the extra . comes from or how to remove it. I did some tracing and found that www.stack.com.edu.uk would return uk.edu..com..stack.www import java.util.*; public class Domainreverse { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String domain = sc.nextLine(); int x; int start = 0; String reversed_domain = ""; boolean flag = false; do{ x = domain.indexOf(".",start+1); if(x==-1){ flag = true; break; } reversed_domain = domain.substring(start,x+1) +reversed_domain; start = x; } while(flag==false); int length = domain.length(); int z = domain.lastIndexOf("."); String enddomain = domain.substring(z+1,length); reversed_domain = enddomain+reversed_domain; int p = reversed_domain.lastIndexOf("."); reversed_domain = reversed_domain.substring(0,p); System.out.print(reversed_domain); } }
has comment: http://stackoverflow.com/comment/35466308
answer count: 0
type: UnansweredQuestion

http://stackoverflow.com/a/23186844
has body: I think what you'd want to do in this situation is store the difference between the players guess and the exact price in a temp variable in the loop body and then check if that value is less than the current minimum, in which case you would replace the minimum with the temp value. I would use a sentinel as the initial value of minimum, something like Integer.Max_VALUE so that the player's guesses would always be less than the initial value of minimum. // set minValue to largest possible value of double double minValue = Double.MAX_VALUE; for(int x = 0; x &lt; 4; x++ ){ // set temp to difference between user's guess and exact price double temp = Math.abs(exactValue - userGuess); // set minValue to minimum of previous minValue or userGuess minValue = Math.min(minValue, temp); }
type: Answer
score: 0
answers question: http://stackoverflow.com/q/23186801
has comment: http://stackoverflow.com/comment/35463599

http://stackoverflow.com/a/23583888
type: AcceptedAnswer
score: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/23188959
has body: Ok, I find the problem now. Happens I had the wrong path in the annotation @ComponentScan. I fix and now the tables were created normally. thank you by your suggestions, anyway.
answers question: http://stackoverflow.com/q/23188959

http://stackoverflow.com/q/23222868
has comment: http://stackoverflow.com/comment/35527316
has comment: http://stackoverflow.com/comment/35527485
tagged with: excel
type: AnsweredQuestion
tagged with: apache-poi
tagged with: java
linked to: http://stackoverflow.com/q/1072561
has comment: http://stackoverflow.com/comment/35555353
has answer: http://stackoverflow.com/a/23243979
has comment: http://stackoverflow.com/comment/35527636
type: Question
has title: Getting wrong numeric values from Excels first column
has comment: http://stackoverflow.com/comment/35537443
has comment: http://stackoverflow.com/comment/35528422
has comment: http://stackoverflow.com/comment/35527293
has comment: http://stackoverflow.com/comment/35555411
score: 0
has comment: http://stackoverflow.com/comment/35527576
has comment: http://stackoverflow.com/comment/35535398
accepted answer: http://stackoverflow.com/a/23243979
answer count: 1
has body: I read Excel spreadsheet (.xlsx) with Apache-poi 3.8. When I try to get numeric value from cell at 0 column index, I get wrong numberic value. For example my table looks like this +-----------+---------+---------+ | Header1 | Header2 | Header3 | +-----------+---------+---------+ | 123456789 | AA | BB | | 99999 | CC | DD | +-----------+---------+---------+ I begin to read on Row index 1 and Cell Index 0. It should returns 123456789 but it returns wrong value 13. Next columns are correct even if it's numeric value. If the first cell contains string it returns correct value as well. Row 2 Cell 0 reads like 14 and next columns are correct. The number I get from first column is somehow related to amount of rows in sheet, If I have 6 rows, it starts to return 16,17,18,19,20. It should not have to be related with other frameworks but I use myfaces tomahawk and jsf 1.2 for upload my Excel file. public String getCellStr(final int x, final int y) { String cellValue = ""; try { Row row = sheet.getRow(x); Cell cell = row.getCell(y); if (row == null || (row != null &amp;&amp; cell == null)) { cellValue = ""; } else { switch (cell.getCellType()) { case Cell.CELL_TYPE_STRING: cellValue = cell.toString(); break; case Cell.CELL_TYPE_NUMERIC: if (DateUtil.isCellDateFormatted(cell)) { cellValue = DateUtils.date2String(cell.getDateCellValue()); } else { Double value = cell.getNumericCellValue(); Long longValue = value.longValue(); cellValue = longValue.toString(); } break; case Cell.CELL_TYPE_BOOLEAN: cellValue = new String(new Boolean( cell.getBooleanCellValue()).toString()); break; case Cell.CELL_TYPE_BLANK: cellValue = ""; break; } } } catch (NullPointerException e) { return cellValue; } return cellValue; }
has comment: http://stackoverflow.com/comment/35528002

http://stackoverflow.com/q/23231356
has comment: http://stackoverflow.com/comment/35546166
has comment: http://stackoverflow.com/comment/35546155
linked to: http://stackoverflow.com/q/23030181
score: 0
has title: Best way to traverse an almost complete undirected weighted graph
tagged with: graph-algorithm
has body: need help with an optimized solution for the following problem http://acm.ro/prob/probleme/B.pdf. Depending on the cost i either traverse the graph using only new edges, or using only old edges, both of them work, but i need to pass test in a limited number of milliseconds, and the algorithm for the old edges is dragging me down. I need a way to optimize this, any suggestions are welcome EDIT: for safety reasons i am taking the algorithm down, i'm sorry, i'm new so I don't know what i need to do to delete the post now that it has answers
has comment: http://stackoverflow.com/comment/35543066
has comment: http://stackoverflow.com/comment/35545005
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23231734
tagged with: algorithm
tagged with: java
has answer: http://stackoverflow.com/a/23231453
type: Question
tagged with: graph
answer count: 2

http://stackoverflow.com/comment/35571605
type: AnswerComment
type: Comment
has text: It is nessesary to attach the android sdk to unity to build to android, but you only use it as an external tool, the coding for unity is always done in C#, whether your coding for android or iphone or PC/Mac. You don't need to touch java to get the final APK from unity.
score: 2
comment on: http://stackoverflow.com/a/23228768

http://stackoverflow.com/a/23154104
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/23154061
answers question: http://stackoverflow.com/q/23154061
has comment: http://stackoverflow.com/comment/35405386
score: 5
upvote count: 5
has body: Such an implementation exists in the java.util package. It is, unsurprisingly, called LinkedList. It has methods such as add(int index, E element), as well as an add(E e) to add to the end. There are also multiple remove( methods that include removing a given object, the head of the list, or an arbitrary index.
has comment: http://stackoverflow.com/comment/35405367

http://stackoverflow.com/a/23227954
score: 3
has comment: http://stackoverflow.com/comment/35536949
accepted answer of: http://stackoverflow.com/q/23227806
has comment: http://stackoverflow.com/comment/35537513
has comment: http://stackoverflow.com/comment/35716949
answers question: http://stackoverflow.com/q/23227806
has comment: http://stackoverflow.com/comment/35537175
has comment: http://stackoverflow.com/comment/35537543
type: AcceptedAnswer
downvote count: 0
upvote count: 3
has body: I just need the window to not close when the X is clicked. But the window DOES close. Try this simple code EventQueue.invokeLater(new Runnable() { @Override public void run() { JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); frame.addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent we) { System.out.println("closing..."); } @Override public void windowClosed(WindowEvent we) { System.out.println("closed.."); } }); frame.setVisible(true); } } output (when the X is clicked) closing...
type: Answer
has comment: http://stackoverflow.com/comment/35536607
has comment: http://stackoverflow.com/comment/35537741
has comment: http://stackoverflow.com/comment/35537259
has comment: http://stackoverflow.com/comment/35589023
has comment: http://stackoverflow.com/comment/35537464
has comment: http://stackoverflow.com/comment/35536663
has comment: http://stackoverflow.com/comment/35537642

http://stackoverflow.com/a/23273460
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23273223
has body: scanArray.length will give zero if someMethodThatCenReturnZero() returns zero. So your condition could be : if(scanArray.length == 0){ PApplet.println("null"); }
answers question: http://stackoverflow.com/q/23273223
type: Answer
upvote count: 2
score: 2

code-duplication
tag name: code-duplication
tags question: http://stackoverflow.com/q/23139661
type: Tag

http://stackoverflow.com/comment/35474676
score: 0
type: AnswerComment
type: Comment
has text: You can switch the console output with the "Display selected console" button: http://help.eclipse.org/indigo/index.jsp?topic=%2Forg.eclipse.jdt.doc.user%2Freference%2Fviews%2Fconsole%2Fref-console_view.htm -- but nexttime start an new question if you want to ask something.
comment on: http://stackoverflow.com/a/23187547

http://stackoverflow.com/comment/35395384
type: QuestionComment
comment on: http://stackoverflow.com/q/23147860
has text: I have to upload a file to a server and zip the file on the fly. But for that, i need to get the exact file size before uploading it. The way i am trying, i am getting few bytes difference of zipped file and actual file.
score: 0
type: Comment

http://stackoverflow.com/q/23157184
has answer: http://stackoverflow.com/a/23157388
has answer: http://stackoverflow.com/a/41614092
type: AnsweredQuestion
has body: I'm trying SQLite with Java, this is the first time using both together, here is the code: package db; import java.sql.Connection; import java.sql.DriverManager; import java.sql.Statement; /** * * @author Alessio */ public class DB { public static void main(String[] args){ Connection c = null; Statement stmt = null; try{ Class.forName("org.sqlite.JDBC"); c = DriverManager.getConnection("jdbc:sqlite:test.db"); stmt = c.createStatement(); String sql = "CREATE TABLE COMPANY " + "(ID INT PRIMARY KEY NOT NULL," + " NAME TEXT NOT NULL, " + " AGE INT NOT NULL, " + " ADDRESS CHAR(50), " + " SALARY REAL)"; stmt.executeUpdate(sql); stmt.close(); c.close(); } catch(Exception e){ System.err.println(e.getClass().getName() + ": " + e.getMessage()); System.exit(0); } System.out.println("Database opened succesfully!!!"); } } When I run the code for the first time I have any error, my result in console is: run: Database opened succesfully!!! BUILD SUCCESSFUL (total time: 1 second) while the second time I get run: java.sql.SQLException: [SQLITE_ERROR] SQL error or missing database () BUILD SUCCESSFUL (total time: 1 second) What am I doing wrong?
upvote count: 3
has answer: http://stackoverflow.com/a/55701505
type: Question
has answer: http://stackoverflow.com/a/48611575
accepted answer: http://stackoverflow.com/a/23157388
tagged with: java
tagged with: sql
tagged with: sqlite
downvote count: 0
has title: Java and SQLite [SQLITE_ERROR] SQL error or missing database ()
favorite count: 0
possible better answer: http://stackoverflow.com/a/23157289
answer count: 5
score: 3
has answer: http://stackoverflow.com/a/23157289

http://stackoverflow.com/comment/35404654
has text: thank you' i just notice now that i put the wrong permission. its working perfectly now.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23153123
type: Comment

http://stackoverflow.com/comment/35496659
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23204874
has text: @NESPowerGlove, yes the paintComponent calls super.paintComponent(g).
score: 0

http://stackoverflow.com/comment/35413884
comment on: http://stackoverflow.com/q/23146787
score: 0
has text: The [File Format Specification for PaletteRecord](http://msdn.microsoft.com/en-us/library/dd909801%28v=office.12%29.aspx) suggests there's a hard limit of 56 colours in a `.xls` file. Can you switch to XSSF / .xlsx? That has a different way of doing colours, without that restriction
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35505847
has text: Where ever you want, but yes, might be better to add it sooner rather then later
type: Comment
comment on: http://stackoverflow.com/a/23210581
score: 0
type: AnswerComment

listview
tags question: http://stackoverflow.com/q/23232113
tags question: http://stackoverflow.com/q/23214042
tags question: http://stackoverflow.com/q/23140095
tags question: http://stackoverflow.com/q/23167685
tags question: http://stackoverflow.com/q/23221958
tag name: listview
tags question: http://stackoverflow.com/q/23210945
tags question: http://stackoverflow.com/q/23189024
tags question: http://stackoverflow.com/q/23246079
tags question: http://stackoverflow.com/q/23209979
tags question: http://stackoverflow.com/q/23139364
tags question: http://stackoverflow.com/q/23170736
tags question: http://stackoverflow.com/q/23252627
tags question: http://stackoverflow.com/q/23132571
tags question: http://stackoverflow.com/q/23166972
tags question: http://stackoverflow.com/q/23191009
tags question: http://stackoverflow.com/q/23282669
tags question: http://stackoverflow.com/q/23197525
tags question: http://stackoverflow.com/q/23148307
tags question: http://stackoverflow.com/q/23272628
tags question: http://stackoverflow.com/q/23141252
tags question: http://stackoverflow.com/q/23167362
tags question: http://stackoverflow.com/q/23143715
tags question: http://stackoverflow.com/q/23236717
type: Tag
tags question: http://stackoverflow.com/q/23271855
tags question: http://stackoverflow.com/q/23193138
tags question: http://stackoverflow.com/q/23165917

http://stackoverflow.com/a/23238376
upvote count: 2
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/35555808
has body: You need to import the signed certificate using the same alias as the private key and the CSR. Otherwise there is no connection between them, and the new certificate is just another certificate. You should not use -trustcacerts for this step, and if you are asked whether to trust the certificate you've got the alias wrong.
accepted answer of: http://stackoverflow.com/q/23238337
answers question: http://stackoverflow.com/q/23238337
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35559335
downvote count: 0
has comment: http://stackoverflow.com/comment/35555145

http://stackoverflow.com/comment/35419721
score: 0
has text: possible duplicate of [SQL Engine for the Datastore](http://stackoverflow.com/questions/23075780/sql-engine-for-the-datastore)
comment on: http://stackoverflow.com/q/23159339
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23170212
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/109434599
upvote count: 13
has comment: http://stackoverflow.com/comment/66152157
answers question: http://stackoverflow.com/q/23157424
type: Answer
has comment: http://stackoverflow.com/comment/64047719
has body: You can call a Python method from Java by implementing a Java interface on the python side. The steps are: Create an interface in Java, e.g., py4j.examples.Operator In Python, create a class and inside the class, create a Java class with an "implements" field. In Python, instantiate a gateway with start_callback_server=True, e.g., gateway = JavaGateway(start_callback_server=True) In Python, instantiate the class implementing a Java interface and send it to the Java side. In Java, call the interface. Example adapted from the Py4J documentation: Java code: // File 1 package py4j.examples; public interface Operator { public int doOperation(int i, int j); public int doOperation(int i, int j, int k); } // File 2 package py4j.examples; import java.util.ArrayList; import java.util.List; import java.util.Random; import py4j.GatewayServer; public class OperatorExample { // To prevent integer overflow private final static int MAX = 1000; public List&lt;Integer&gt; randomBinaryOperator(Operator op) { Random random = new Random(); List&lt;Integer&gt; numbers = new ArrayList&lt;Integer&gt;(); numbers.add(random.nextInt(MAX)); numbers.add(random.nextInt(MAX)); numbers.add(op.doOperation(numbers.get(0), numbers.get(1))); return numbers; } } Python code: from py4j.java_gateway import JavaGateway class Addition(object): def doOperation(self, i, j, k = None): if k == None: return i + j else: return i + j + k class Java: implements = ['py4j.examples.Operator'] if __name__ == '__main__': gateway = JavaGateway(start_callback_server=True) operator = Addition() operator_example = gateway.jvm.py4j.examples.OperatorExample() # "Sends" python object to the Java side. numbers = operator_example.randomBinaryOperator(operator)
has comment: http://stackoverflow.com/comment/103587990
score: 13
downvote count: 0
has comment: http://stackoverflow.com/comment/66142936
accepted answer of: http://stackoverflow.com/q/23157424

http://stackoverflow.com/a/23186882
score: 0
answers question: http://stackoverflow.com/q/23186801
has comment: http://stackoverflow.com/comment/35463702
type: Answer
has body: As you suggested, i am using a linear search, and setting the initial minimum value to the maximum value of a double, making sure that it will be replaced by the first guess price. I am also returning a winner index of -1 if the array of guess prices is empty, letting you handle that error (instead of throwing or catching exceptions) int winnerIndex = -1; double minDifference = Double.MAX_VALUE; for(int i = 1; i &lt; guessPrices.length; i++) { double temp = guessPrices[i] - exactPrice; if(temp &lt; minDifference) { minDifference = temp; winnerIndex = i; } } return winnerIndex;
has comment: http://stackoverflow.com/comment/35463668

http://stackoverflow.com/a/23181876
has body: "Is one of the solutions more efficient in any way?" Define "efficient". If, by "efficient", you're referring to CPU time and memory requirements, then the "instance" approach can never be more efficient than the "static" approach; at best, it can be as efficient as the static approach, and the difference depends on the frequency of object instantiation, read: how many times are you going to instantiate the "instance" approach. "Are any of the solutions considered best practice?" No. The "best practice" here is to match your design to your requirements. If the mapping operation requires maintaining state, such as dependencies on other services/mappers/whatnot, then going with the "instance" approach makes more sense. One thing you don't want to get into is a world where your application's design consists of singletons that depend on each other. Use the "instance" approach, preferably using an auto-wiring facility such as the Spring Framework or CDI. If the mapping operation requires no state, and you have an extremely high confidence in that it will never require state in the future, then use the "static" approach - unless you already have an auto-wiring facility at hand, in which case, you might as well choose the "instance" approach with auto-wiring and guarantee that, if the mapping operation requires state in the future, you won't have to alter your design much.
type: Answer
upvote count: 19
score: 19
answers question: http://stackoverflow.com/q/23181735
has comment: http://stackoverflow.com/comment/35455349
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23181735

http://stackoverflow.com/comment/35633369
type: QuestionComment
has text: @PeterLawrey So i've created my ant file and ran the ant command successfully but i dont knwo how to run the actual program
comment on: http://stackoverflow.com/q/23280314
score: 0
type: Comment

http://stackoverflow.com/a/23232445
upvote count: 1
answers question: http://stackoverflow.com/q/23232416
has body: Assuming tokens[i] is a string, treat the string as an array of characters: var firstCharacter = tokens[i][0]; Assuming par is also a string, the string.IsNullOrEmpty() method can help you test whether or not a particular string is empty: if (string.IsNullOrEmpty(par)) { } If par is a Stack&lt;String&gt; as you've indicated, then you could test whether it was empty (has no elements) with a simple bit of LINQ: if (!par.Any()) { // par has no elements } Alternatively, you could use the Count property in the Stack class: if (par.Count == 0) { // par has no elements }
has comment: http://stackoverflow.com/comment/35545020
downvote count: 0
type: Answer
score: 1

http://stackoverflow.com/comment/35450060
has text: Thank you too :) you explained it in an even simpler way
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/23168787
score: 0

http://stackoverflow.com/comment/35550273
has text: @BrianRoach I didn't say I wanted to bind EVERY port. Only every port that I CAN bind. Hence `slightly less than`. Which I did accomplish in about 10 minutes. It would be nice if I could do this in maybe about 5 minutes.
type: QuestionComment
comment on: http://stackoverflow.com/q/23235443
score: 0
type: Comment

http://stackoverflow.com/comment/35448847
has text: Could you show the UI code that is not working?
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23178414

http://stackoverflow.com/q/23236338
has answer: http://stackoverflow.com/a/23236451
has answer: http://stackoverflow.com/a/57402450
tagged with: functional-testing
has comment: http://stackoverflow.com/comment/35551732
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/35553796
has title: Using Mockito to mock a local variable of a method
tagged with: mocking
linked to: http://stackoverflow.com/q/6520242
tagged with: mockito
downvote count: 0
has answer: http://stackoverflow.com/a/23236507
answer count: 3
linked to: http://stackoverflow.com/q/11620103
favorite count: 0
has body: I have a class A that needs to the tested. The following is the definition of A: public class A { public void methodOne(int argument) { //some operations methodTwo(int argument); //some operations } private void methodTwo(int argument) { DateTime dateTime = new DateTime(); //use dateTime to perform some operations } } And based on the dateTime value some data is to be manipulated, retrieved from the database. For this database, the values are persisted via a JSON file. This complicates things. What I need is to set the dateTime to some specific date while it is being tested. Is there a way I can mock a local variable's value using mockito?
type: UnansweredQuestion
score: 54
upvote count: 54

http://stackoverflow.com/comment/35378679
type: Comment
has text: how would i implement this into my code? Im a noob so i dont understand this fully. Im getting a mistake. The 'Car'is underlined in red
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23138734

embedded-tomcat-8
tag name: embedded-tomcat-8
tags question: http://stackoverflow.com/q/23167654
type: Tag

http://stackoverflow.com/comment/35437830
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23164016
has text: It seems that I don't have enough reputation to do this maybe I have missed something, sorry :(

http://stackoverflow.com/a/23165228
has comment: http://stackoverflow.com/comment/35429994
type: Answer
has comment: http://stackoverflow.com/comment/35427162
answers question: http://stackoverflow.com/q/23164382
has body: OK well, I have found a solution but it is really hackish... The solution is to add a method to write the generated class' byte code into a file in ParserTransformer#defineExtendedParserClass()... But I'd have really appreciated a less hackish solution :/
score: 0

http://stackoverflow.com/comment/35362738
has text: Are you sure you're not using SHA512 if you're getting 64 bytes? Either way, no current hash gives a result as short as 128 bits, so you'll just have to truncate the output.
comment on: http://stackoverflow.com/q/23130255
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23276968
type: Answer
has body: Only if you run your query again. Specifically, if you run something like this: ResultSet resultSet = myStatement.executeQuery("select * from some_table"); and then you update the database (either from the command line / database client), then no. you will need to run your query again to see the changes you made.
answers question: http://stackoverflow.com/q/23276891
upvote count: 1
accepted answer of: http://stackoverflow.com/q/23276891
score: 1
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/23173326
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35441328
accepted answer of: http://stackoverflow.com/q/23173285
type: Answer
answers question: http://stackoverflow.com/q/23173285
score: 2
has comment: http://stackoverflow.com/comment/35441197
downvote count: 0
has body: You have to import it: import java.util.Arrays; At the top of your file. Alternatively, you can refer to it by its fully qualified name without importing it, e.g. java.util.Arrays.asList(cardRanks). Only java.lang.* is imported automatically (well, and the package your class itself is in as well); everything else you have to import explicitly. Note also that Arrays.binarySearch requires your input array to be pre-sorted in ascending order to work correctly.
upvote count: 2
has comment: http://stackoverflow.com/comment/35440606

http://stackoverflow.com/a/23148017
downvote count: 0
type: Answer
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/23139060
has body: After trying Peter's suggestion the problem persisted but now in another context : "/System/Library/Frameworks/JavaVM.framework" does not contain the JNI_CreateJavaVM symbol" After struggling for many hours, and reading about people with the same issue opting to re-install the entire OS , decided to examine the issue from another perspective, the thing I first mentioned here that I believe went unnoticed was that I restored my permissions before this happening, so what I did was the following. After reading a bunch of articles about Apple no longer providing Java support themselves but Oracle providing it, reasoned through it and realized that perhaps paths (Often called directories) from Apple's final Java release may have not been strictly the same as the new Oracle releases, so decided to wipe out all recent Oracle Java Runtime Environment that I found on /Library/Java/JavaVirtualMachines and delete the Java Applet Plugin from /Applications (Just search for it on your /Applications path) . Installed Apple's last stable release from the following link. Located where Apple located their Java releases : /System/Library/Frameworks/ My particular interest was the Java Runtime Environment , so I explored the JavaVM directory on /System/Library/Frameworks/ Found out that all Apple's JRE previous releases reside on a directory called Versions that is within /System/Library/Frameworks/JavaVM.framework directory, here's where I noticed something rare, for some reason at the moment I restored file permissions from my Disk Utility Application , this directory was made inaccessible (By not giving the root user permissions to access anything in itself). Went to my terminal console and inside the JavaVM.framework directory modified the permissions to that directory to be accessible for all users by running the following command chmod -R 777 Versions. After executing these actions I went straight to my JRE-Required software and attempted to open it , success! Things to learn fro…
accepted answer of: http://stackoverflow.com/q/23139060
type: AcceptedAnswer

http://stackoverflow.com/q/23205213
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/69493358
has answer: http://stackoverflow.com/a/49517384
tagged with: java
accepted answer: http://stackoverflow.com/a/23205349
has answer: http://stackoverflow.com/a/56806107
type: Question
has answer: http://stackoverflow.com/a/55726405
has answer: http://stackoverflow.com/a/46975339
has answer: http://stackoverflow.com/a/23205349
upvote count: 69
downvote count: 0
tagged with: url
has answer: http://stackoverflow.com/a/54998229
has body: I am using RestTemplate to make an HTTP call to our service which returns a simple JSON response. I don't need to parse that JSON at all. I just need to return whatever I am getting back from that service. So I am mapping that to String.class and returning the actual JSON response as a string. RestTemplate restTemplate = new RestTemplate(); String response = restTemplate.getForObject(url, String.class); return response; Now the question is - I am trying to extract HTTP Status codes after hitting the URL. How can I extract HTTP Status code from the above code? Do I need to make any change into that in the way I doing it currently? Update:- This is what I have tried and I am able to get the response back and status code as well. But do I always need to set HttpHeaders and Entity object like below I am doing it? RestTemplate restTemplate = new RestTemplate(); //and do I need this JSON media type for my use case? HttpHeaders headers = new HttpHeaders(); headers.setContentType(MediaType.APPLICATION_JSON); //set my entity HttpEntity&lt;Object&gt; entity = new HttpEntity&lt;Object&gt;(headers); ResponseEntity&lt;String&gt; out = restTemplate.exchange(url, HttpMethod.GET, entity, String.class); System.out.println(out.getBody()); System.out.println(out.getStatusCode()); Couple of question - Do I need to have MediaType.APPLICATION_JSON as I am just making a call to url which returns a response back, it can return either JSON or XML or simple string.
has answer: http://stackoverflow.com/a/44935103
score: 69
tagged with: http-status-codes
favorite count: 0
answer count: 9
has title: How to extract HTTP status code from the RestTemplate call to a URL?
possible better answer: http://stackoverflow.com/a/46975339
has answer: http://stackoverflow.com/a/61369668
tagged with: resttemplate
linked to: http://stackoverflow.com/q/19253174

http://stackoverflow.com/a/23289955
type: Answer
has comment: http://stackoverflow.com/comment/35650649
has comment: http://stackoverflow.com/comment/35650525
score: 1
downvote count: 1
answers question: http://stackoverflow.com/q/23289902
has comment: http://stackoverflow.com/comment/35650307
has body: Use the following, You have to escape the * character, since replaceAll() method accepts regular expression as one argument replaceAll("\\*",letter+"")
upvote count: 2
has comment: http://stackoverflow.com/comment/35650446

http://stackoverflow.com/a/23151958
has body: you must be add tools.jar to your classpath you can look this link for more information how you can add JAR in to Classpath in Java
type: Answer
score: 0
answers question: http://stackoverflow.com/q/23151157

http://stackoverflow.com/q/23243211
tagged with: jersey
has comment: http://stackoverflow.com/comment/35572144
has body: I want to have be able to run a URL that looks like host/to/source/search?query=something&amp;terms=term1,term2,etc What I am interested in the most is the terms parameter. I want to run a SPARQL query that will use the values of terms as names of graphs to search into. public String search(@QueryParam("query") String search_string, @QueryParam("match") @DefaultValue("") String match_string, @QueryParam("terms") @DefaultValue("") String terms_string) throws ServletException, IOException { List&lt;String&gt; splitted =Arrays.asList(terms_string.split(",")); VirtGraph set = new VirtGraph (hostURL, userName, password); //String replaceString = "//s"+"AND"+"//s"; String srch = search_string.replaceAll(java.util.regex.Pattern.quote(" "), " AND ") ; VirtuosoQueryExecution vqe = VirtuosoQueryExecutionFactory.create ("select ?s1 as ?uri, ?o1 as ?label where { { { select ?s1, ( ?sc * 3e-1 ) as ?sc, ?o1, ( sql:rnk_scale ( &lt;LONG::IRI_RANK&gt; ( ?s1 ) ) ) as ?rank, ?g where { quad map virtrdf:DefaultQuadMap { graph ?g { ?s1 ?s1textp ?o1 . ?o1 bif:contains '(" + srch + ")' option ( score ?sc ) . }}} order by desc ( ?sc * 3e-1 + sql:rnk_scale ( &lt;LONG::IRI_RANK&gt; ( ?s1 ) ) ) limit 20 offset 0 } }}", set);; if (match_string.equals("exact")){ vqe = VirtuosoQueryExecutionFactory.create( "select ?uri, ?label where {quad map virtrdf:DefaultQuadMap { graph ?g { ?uri ?p ?label. FILTER (?label = '"+search_string+"'@en) .}}}",set ); } ResultSet results = vqe.execSelect(); ByteArrayOutputStream out = new ByteArrayOutputStream(); ResultSetFormatter.outputAsJSON(out, results); return out.toString(); } At the moment I am taking the input of the user as a string and then I split it, but it would be nicer to know how I can use it directly as a List using some Jersey propriety. But the main issue is how to treat the List items as graphs for SPARQL to use in the queries above.
downvote count: 0
has comment: http://stackoverflow.com/comment/35566780
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35568686
tagged with: sparql
answer count: 0
score: 1
tagged with: java
has title: Multiple Query on Jersey to select from multiple graphs
upvote count: 1
type: Question

http://stackoverflow.com/q/23204721
has comment: http://stackoverflow.com/comment/35495538
has comment: http://stackoverflow.com/comment/35495147
tagged with: multipartform-data
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/35497144
favorite count: 0
tagged with: spring-webflow
has answer: http://stackoverflow.com/a/23205685
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35495871
has comment: http://stackoverflow.com/comment/35495178
has comment: http://stackoverflow.com/comment/35496287
tagged with: spring
has body: So, i have an upload file input in my web. This way: &lt;form:form method="post" modelAttribute="proyecto" enctype="multipart/form-data"&gt; &lt;input type="file" accept="image" name="foto"&gt; &lt;input type="submit" value="Next" name="_eventId_gotoPageTwo"&gt; &lt;/form:form&gt; In the modelAttribute, I have a property called "foto": public MultipartFile foto; (...) public MultipartFile getFoto() { return foto; } public void setFoto(MultipartFile foto) { System.out.println("Receiving image: "+foto.getOriginalFilename()); this.foto = foto; } The CommonsMultipartResolver: &lt;beans:bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver"/&gt; I have put a sysoyut there to check. The method is called, the name of the file is correct... but after this, a receive an Exception: org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.webflow.execution.repository.FlowExecutionRestorationFailureException: A problem occurred restoring the flow execution with key 'e1s2' org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:894) org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:778) javax.servlet.http.HttpServlet.service(HttpServlet.java:621) javax.servlet.http.HttpServlet.service(HttpServlet.java:728) org.springframework.webflow.execution.repository.FlowExecutionRestorationFailureException: A problem occurred restoring the flow execution with key 'e1s2' org.springframework.webflow.execution.repository.snapshot.SerializedFlowExecutionSnapshotFactory.restoreExecution(SerializedFlowExecutionSnapshotFactory.java:82) org.springframework.webflow.execution.repository.snapshot.AbstractSnapshottingFlowExecutionRepository.restoreFlowExecution(AbstractSnapshottingFlowExecutionRepository.java:89) org.springframework.webflow.execution.repository.impl.DefaultFlowExecutionRepository.getFlowExecution(DefaultFlowExecutionRepo…
score: 1
tagged with: java
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/35495804
has title: Weird error uploading file with Spring Web Flow

http://stackoverflow.com/q/23143593
type: UnansweredQuestion
tagged with: android
score: 1
tagged with: java
has title: create an onClick event on an inflated layout
upvote count: 1
type: Question
answer count: 1
downvote count: 0
favorite count: 0
has body: I have a GeoPoint whenever its clicked an inflated layout appears with details on that GeoPoint. Initally I had a button within the inflated layout but now I have discovered that: The view is rendered as an image (using View.draw(Canvas)) at the time it is returned. so is it possible to create an onclick event for the entire inflated layout. Below shows the xml file for the inflated layout: &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical" android:minWidth="150dp" android:id="@+id/placeInfo" &gt; &lt;TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/txtName" android:textColor="#ff555555" android:textSize="14dip" android:textStyle="bold" android:layout_marginTop="5dip" /&gt; &lt;TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/txtHours" android:textColor="#ff555555" android:textSize="14dip" android:layout_marginTop="5dip" /&gt; &lt;TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/txtCountry" android:textColor="#ff555555" android:textSize="14dip" android:layout_marginTop="5dip" /&gt; &lt;TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/txtAddress" android:textColor="#ff555555" android:textSize="14dip" android:layout_marginTop="5dip" /&gt; &lt;TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/txtPostCode" android:textColor="#ff555555" android:textSize="14dip" android:layout_marginTop="5dip" /&gt;
has answer: http://stackoverflow.com/a/23144268

http://stackoverflow.com/q/23258045
has answer: http://stackoverflow.com/a/23258069
favorite count: 0
has answer: http://stackoverflow.com/a/23258246
has title: How do I pass an array to a method in java?
downvote count: 2
has comment: http://stackoverflow.com/comment/35591645
accepted answer: http://stackoverflow.com/a/23258120
answer count: 4
type: AnsweredQuestion
tagged with: java
tagged with: methods
has comment: http://stackoverflow.com/comment/35592003
type: Question
has comment: http://stackoverflow.com/comment/35591117
upvote count: 0
score: -2
tagged with: arrays
has body: Here is the program that I am trying to run: /** * Write a description of class mainGame here. * * @author Anthony Parsch * @version 0.1.1 */ //Import what I need to. import java.io.*; public class mainGame { /** * Constructor for objects of class mainGame */ public static void main(String[] args) { // initialise instance variables int xCoord = 10; //The map's max x coordinate +1 int yCoord = 10; //The map's max y coordinate +1 int playerX = 0; //The player's current x coordinate int playerY = 0; //The player's current y coordinate //Declare the arrays String[][] map; //[x][y]The map String[][] direc; //[x][y]Which directions that you can go String[][] items; //[x][y]Where items are at String[] inv; // Holds your inventory. int[][] helpInt; //[x][y] All the other stuff in the //Initalize the arrays //---The player arrays inv = new String[10]; //The player's inventory inv[0] = "0"; inv = addItem(inv, "Blarg");//GET RID OF THIS LATER //---The map arrays map = new String[xCoord][yCoord]; //Descriptions direc = new String[xCoord][yCoord]; //north y++,west x--,south y--,east x++ items = new String[xCoord][yCoord]; //The items within the world //Declare the values of map map[0][0] = "You wake up with the feel of cold metal on your back. The only other thing in this room is the door."; map[0][1] = "You are now in a hallway with a door behind you and one either side. Forward is a continuation of the hallway.com"; //Declare the values of direc direc[0][0] = "north"; direc[0][1] = "north, south, east, west"; print(inv[0]); //Check that the functions work print(findDirec(direc, 0, 0)); } /** * Finds and displays the avaliable exits for a coordinate. * * @param map[][] The map array from which this method pulls the directions from. * @param x The x value of the map * @param y The y value of the map * @return The string value of which way you can go */ static String findDirec(String[][] map, int x, int y){ //Pulls the directions String match = map[x][y]; //Checks Directions bool…
has answer: http://stackoverflow.com/a/23258120
possible better answer: http://stackoverflow.com/a/23258206
has comment: http://stackoverflow.com/comment/35591223
has answer: http://stackoverflow.com/a/23258206

http://stackoverflow.com/comment/35621345
type: QuestionComment
has text: http://stackoverflow.com/questions/18385362/high-resolution-image-outofmemoryerror/18385448#18385448
score: 1
type: Comment
comment on: http://stackoverflow.com/q/23274495

http://stackoverflow.com/q/23200361
score: 0
has body: As per theory following properties are to define number of map/red task slots at data node. mapred.tasktracker.map.tasks.maximum | mapred.map.tasks. Also, number of mapper objects is decided by the number of input splits in the MapReduce job. We implement map/red function and framework creates objects and sends them closest to data blocks. So what is the difference between map task slots and mapper objects created by framework. Lets say i am storing 2TB file across 5 data nodes, each node having 400Mb. If i define dfs.block.size =100Mb then each node will hold 400/100 = 4 data blocks. Here, out of 4 data blocks we can ideally have 4 input splits and in turn 4 mapper objects per node. And at the same time if i define mapred.tasktracker.map.tasks.maximum = 2 &amp; mapred.map.tasks=2, then what conclusion can i make out of it. Can i say 4 mapper objects are to be shared among 2 map task slots. I might be going in a wrong direction, any clarification would be helpful.
answer count: 1
tagged with: hadoop-partitioning
tagged with: hadoop-streaming
has answer: http://stackoverflow.com/a/23201181
type: UnansweredQuestion
type: Question
tagged with: java
tagged with: mapreduce
has title: Hadoop Map task/Map object
tagged with: hadoop

http://stackoverflow.com/comment/71192624
type: Comment
comment on: http://stackoverflow.com/a/23226858
has text: Suppose I could. Then how would I do it?
score: 0
type: AnswerComment

http://stackoverflow.com/a/23223200
has comment: http://stackoverflow.com/comment/35553622
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23222767
type: Answer
accepted answer of: http://stackoverflow.com/q/23222767
has comment: http://stackoverflow.com/comment/35551429
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/35528821
has body: As the other answers point out, to the database it doesn't matter. However, your application is another matter entirely. By default Hibernate does not deal nicely with data changes outside of its control. More specifically, it tends to ignore such changes completely. As a result, the data your application has loaded will quite likely get out of synch with what the database itself knows it to be, leading to all kind of problems. That's because Hibernate caches data, a lot of data, and tends to operate on that cache rather than the actual data for increased performance, synchronising with the database only when a transaction is committed. If something else changed the data Hibernate will blissfully ignore those changes and overwrite whatever that other process did, probaly without even giving you a warning.

http://stackoverflow.com/comment/35488372
score: 0
type: AnswerComment
has text: maybe something about my workspace just needs to be cleaned? like from the command line perhaps
type: Comment
comment on: http://stackoverflow.com/a/23201111

http://stackoverflow.com/a/23211381
answers question: http://stackoverflow.com/q/23204924
accepted answer of: http://stackoverflow.com/q/23204924
has body: Use the same TreeMap with the parameter as TreeMap&lt;Integer, LinkedList&lt;Integer&gt;&gt; tMap=new TreeMap&lt;Integer, LinkedList&lt;Integer&gt;&gt;(); Here consider the distance as key and mobileNo as value. As per your statement, for the same distance there are several mobileNo value (Since distance is not unique). So for the value field we can have LinkedList or ArrayList. TreeMap will store the keys in a sorted manner. So you can print the TreeMap based on the key and all values for the key. Complete code is given below, import java.util.Collections; import java.util.LinkedList; import java.util.TreeMap; public class MultiValueCollection { public static void main(String[] args) { // TODO Auto-generated method stub MultiValueCollection mCollection=new MultiValueCollection(); TreeMap&lt;Integer, LinkedList&lt;Integer&gt;&gt; tMap=new TreeMap&lt;Integer, LinkedList&lt;Integer&gt;&gt;(); mCollection.addMobileNumberByDistance(tMap, 40, 65655423); mCollection.addMobileNumberByDistance(tMap, 40, 76785647); mCollection.addMobileNumberByDistance(tMap, 40, 85785852); mCollection.addMobileNumberByDistance(tMap, 40, 96786344); mCollection.addMobileNumberByDistance(tMap, 40, 57657354); mCollection.addMobileNumberByDistance(tMap, 20, 13543353); mCollection.addMobileNumberByDistance(tMap, 20, 23453456); mCollection.addMobileNumberByDistance(tMap, 30, 33353544); mCollection.addMobileNumberByDistance(tMap, 30, 43534554); mCollection.addMobileNumberByDistance(tMap, 30, 59789785); mCollection.printMobileNumbersByDistance(tMap); } public void addMobileNumberByDistance(TreeMap&lt;Integer, LinkedList&lt;Integer&gt;&gt; tMap, int distance, int mobileNo) { LinkedList&lt;Integer&gt; list=null; if(tMap.get(distance)==null) { list=new LinkedList&lt;Integer&gt;(); }else { list=tMap.get(distance); } list.push(mobileNo); tMap.put(distance, list); } public void printMobileNumbersByDistance(TreeMap&lt;Integer,LinkedList&lt;Integer&gt;&gt; distNumberMap) { LinkedList&lt;Integer&gt; list; for…
type: Answer
downvote count: 0
score: 1
upvote count: 1
type: AcceptedAnswer

http://stackoverflow.com/comment/35593121
type: AnswerComment
score: 0
type: Comment
has text: Hi TBM, thanks for your response. I tried to check each options to create project with sample code, but it just gave me as usual without modules.
comment on: http://stackoverflow.com/a/23259159

http://stackoverflow.com/a/23251885
type: Answer
upvote count: 1
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/23251823
has body: Make new files for your classes, you cannot have multiple public class definitions in the same file. The files will be named after your class definition, so public class Manager would be named Manager.java

http://stackoverflow.com/comment/35408365
comment on: http://stackoverflow.com/q/23155628
score: 0
type: Comment
type: QuestionComment
has text: yes I have it working now, the naming convention got a bit messed up I started using the names from my tables as variable names, I'll be more careful on my next project.

http://stackoverflow.com/a/23231244
accepted answer of: http://stackoverflow.com/q/23230972
type: Answer
answers question: http://stackoverflow.com/q/23230972
score: 0
has body: As Sara Seppola already mentioned, you need to use the smallest of the two sizes to compare the elements in the two lists. Currently, you're using the biggest of the two, which guarantees that you'll go out of bounds on the smaller list. Also, you should be using ArrayList1.size() and not ArrayList1.size()-1 in your loop limits, as the strictly less than check in your loop condition currently causes i to iterate from 0 to ArrayList1.size()-2 - which is one too short. Again, the index-out-of-bounds is not caused by the -1, but rather because of the incorrect size used in the condition. Finally, you're not accounting for the case where the lists have equal sizes. Currently, your code gives "The files are the same" since there's not if-test which passes when ArrayList1.size() == ArrayList2.size(). if(ArrayList1.size() &gt;= ArrayList2.size()) { // Here, ArrayList1.size() &gt;= ArrayList2.size() // Use the smallest size as limit so we stay in bounds for both // In this case, that's ArrayList2.size() // When the lists have equal length, both sizes could be used // as limit so it doesn't really matter whether you use // &gt; or &gt;= in the test of the above if-statement for(int i=0; i&lt;ArrayList2.size(); i++) { if(ArrayList1.get(i).equals(ArrayList2.get(i))) { temp++; } } } else { // Here, ArrayList1.size() &lt; ArrayList2.size() // so use ArrayList1.size() as the limit for(int i=0; i&lt;ArrayList2.size(); i++) { if(ArrayList2.get(i).equals(ArrayList1.get(i))) { temp++; } } } There's still an error in your code though: you're only comparing corresponding elements. What about the extra elements from the larger list? Those should be counted as differences as well. A quick fix would be to simply subtract the two sizes to get the number of extra elements in the bigger list, and use that as initial value for the number of difference: if(ArrayList1.size() &gt;= ArrayList2.size()) { temp = ArrayList1.size() - ArrayList2.size(); // [for loop] } else { temp = ArrayList2.size() …
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35546028

http://stackoverflow.com/comment/35602863
type: Comment
type: AnswerComment
has text: I suggest you look up the Javadoc for DataOutputStream. It's clear enough. I would expect any professional programmer to be able to proceed from what's stated in this answer.
score: 0
comment on: http://stackoverflow.com/a/23263864

http://stackoverflow.com/q/23273985
favorite count: 0
has answer: http://stackoverflow.com/a/23274051
upvote count: 0
accepted answer: http://stackoverflow.com/a/23274054
has comment: http://stackoverflow.com/comment/35620821
has body: My problem is simple : listeBalles is an ArrayList&lt;Balle&gt; and here is my code : for (Balle b : listeBalles) { b.changeList(listeBalles); } The matter is that the method b.changeList adds a Balle to the ArrayList listeBalles. I think that this is the matter. Here are the exceptions : Exception in thread "main" java.util.ConcurrentModificationException at java.util.AbstractList$Itr.checkForComodification(AbstractList.java:372) at java.util.AbstractList$Itr.next(AbstractList.java:343) at Main.main(Main.java:31) The line pointed is the for (Balle b : listeBalles) { line. Thank you for your help.
possible better answer: http://stackoverflow.com/a/23274041
has comment: http://stackoverflow.com/comment/35620459
has answer: http://stackoverflow.com/a/23274041
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23274054
has answer: http://stackoverflow.com/a/23274046
tagged with: java
score: -1
type: Question
has title: ArrayList / for-loop
tagged with: for-loop
has comment: http://stackoverflow.com/comment/35620739
linked to: http://stackoverflow.com/q/13847695
tagged with: arraylist
downvote count: 1
linked to: http://stackoverflow.com/q/993025
answer count: 4

http://stackoverflow.com/a/23172629
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/23172524
downvote count: 0
has body: Each Java class should be in a file of its own, with a name that's the same as the class name: customer on customer.java, PBill on PBill.java. Adhere to conventions: class names should start with upper case letters ("Customer"). Using inheritance to link rather unrelated concepts is not best practice. A bill is one entity, and a customer is another one. There may, of course, various categories of customers where inheritance is applicable.

http://stackoverflow.com/q/23164113
score: 0
tagged with: java
has title: How to redirect to another Tiles layout in Struts2?
type: Question
answer count: 1
has answer: http://stackoverflow.com/a/23164359
tagged with: struts2
tagged with: tiles
has body: I'm using Tiles in my Struts2 web app. I have page where I display all records. I use a tiles layout for displaying all the records. Now, if I click a delete on one of the records, it should display me the same page again without the one I deleted. I am able to delete the record, but I'm not sure to how to forward to same tile layout back again to display all the records again. How to do this in my struts.xml ? Any pointers are appreciated.
type: UnansweredQuestion

http://stackoverflow.com/comment/35484771
comment on: http://stackoverflow.com/a/23199280
type: AnswerComment
has text: @Ziker Good catch there
score: 0
type: Comment

http://stackoverflow.com/comment/35386441
score: 0
type: Comment
type: QuestionComment
has text: @ganapathy please try the code I posted and post what errors you have with this.
comment on: http://stackoverflow.com/q/23142767

http://stackoverflow.com/a/42175007
score: 1
answers question: http://stackoverflow.com/q/23187539
has body: This code works for all cases include other chars not only parentheses ex: Please enter input {ibrahim[k]} true ()[]{}[][] true saddsd] false public class Solution { private static Map<Character, Character> parenthesesMapLeft = new HashMap<>(); private static Map<Character, Character> parenthesesMapRight = new HashMap<>(); static { parenthesesMapLeft.put('(', '('); parenthesesMapRight.put(')', '('); parenthesesMapLeft.put('[', '['); parenthesesMapRight.put(']', '['); parenthesesMapLeft.put('{', '{'); parenthesesMapRight.put('}', '{'); } public static void main(String[] args) { System.out.println("Please enter input"); Scanner scanner = new Scanner(System.in); String str = scanner.nextLine(); System.out.println(isBalanced(str)); } public static boolean isBalanced(String str) { boolean result = false; if (str.length() < 2) return false; Stack<Character> stack = new Stack<>(); for (int i = 0; i < str.length(); i++) { char ch = str.charAt(i); if (!parenthesesMapRight.containsKey(ch) && !parenthesesMapLeft.containsKey(ch)) { continue; } if (parenthesesMapLeft.containsKey(ch)) { stack.push(ch); } else { if (!stack.isEmpty() && stack.pop() == parenthesesMapRight.get(ch).charValue()) { result = true; } else { return false; } } } if (!stack.isEmpty()) return result = false; return result; } }
upvote count: 1
type: Answer
downvote count: 0

http://stackoverflow.com/a/51535737
upvote count: 1
answers question: http://stackoverflow.com/q/23254234
type: Answer
downvote count: 0
score: 1
has body: We should know the reason for this Our OS comes with a predefined (built-in)set of tools and utilities. When we try to execute the command e.g. cls in the Windows command line then it is already present in system path variable and os will refer the corresponding binary of cls to execute the command. However, when we install any third party tool/software then path variable is not updated accordingly. When we install different versions of java on your system then installations go to different directories. E.g. JDK installation directory for Windows will be C:\Program Files\Java\jdk1.8.0_161 Similarly, JRE installation directory for Windows will be JDK installation directory for Windows will be C:\Program Files\Java\jre1.8.0_161 We need to update the path variable of OS to point to the appropriate directory. If we set the path of JDK then it will execute a binary from JDK bin directory. Solution we need to update JDK or JRE version specific directory location into PATH Environment variable.

http://stackoverflow.com/comment/37056366
score: 0
type: QuestionComment
type: Comment
has text: Do you have the latest version of Google Play Services? It seems to be a problem with that.
comment on: http://stackoverflow.com/q/23242307

http://stackoverflow.com/comment/35684150
type: Comment
has text: Hey thanks a lot for your response, I was able to plot it to the jfreechart after this, few questions though, in the code the values of x and y are also influenced by width and height (variables w & h) wouldn't these things affect the audio information? if yes then how to elliminate them? because the main loop that calculates y values actually depends upon the width
comment on: http://stackoverflow.com/a/23305334
score: 0
type: AnswerComment

http://stackoverflow.com/q/23239393
upvote count: 3
has answer: http://stackoverflow.com/a/23239476
favorite count: 0
has answer: http://stackoverflow.com/a/23239733
has answer: http://stackoverflow.com/a/23239498
tagged with: extends
answer count: 5
tagged with: android
type: AnsweredQuestion
score: 3
has title: Use method from T class extending ArrayList<T>
downvote count: 0
tagged with: java
possible better answer: http://stackoverflow.com/a/23239497
has answer: http://stackoverflow.com/a/23239497
type: Question
has body: Not sure if the title makes sense, I will try to explain. I have a CustomList extending ArrayList, T being let's say Class A1 and Class A2, both extending Class A which is a custom Class. I need to do this : public class CustomList&lt;T&gt; extends ArrayList&lt;T&gt; { public CustomList() { super(); } public boolean add(T obj) { /*The method getCustomBoolean() is not defined for the type T*/ if(obj.getCustomBoolean()) { super.add(obj); } return true; } } The method getCustomBoolean() is a Class A method, and using this CustomList only for A1 and A2, I'm sure obj.getCustomBoolean() won't cause an exception. I need a way to specify that T is a child class of A.
has answer: http://stackoverflow.com/a/23239466
accepted answer: http://stackoverflow.com/a/23239466
tagged with: arraylist

http://stackoverflow.com/q/23156778
answer count: 3
tagged with: android
tagged with: generics
type: UnansweredQuestion
has title: Java/Android: generic method - apply same functionality to different objects
has answer: http://stackoverflow.com/a/23157246
has body: I am trying to make some helper method in my Android project - method to set background with outline. I would like to method accepts different types of object (minimum is different Layouts) and call setBackground() on them. My code: @SuppressLint("NewApi") @SuppressWarnings("deprecation") private static &lt;I&gt; void setBackgroundOutlined(Context context, I item, String backgroundColor, String outlineColor, int outlineThickness, Boolean setStatesPressed) { GradientDrawable shapeDrawable = new GradientDrawable(); shapeDrawable.setStroke(CF.floatToPixels(context, outlineThickness), Color.parseColor(outlineColor)); shapeDrawable.setColor(Color.parseColor(backgroundColor)); StateListDrawable states = new StateListDrawable(); states.addState(new int[] {android.R.attr.state_pressed, android.R.attr.state_enabled}, context.getResources().getDrawable(R.drawable.textview_pressed_color)); states.addState(StateSet.WILD_CARD, shapeDrawable); if (item instanceof RelativeLayoutWithContextMenuInfo) { RelativeLayoutWithContextMenuInfo item2= (RelativeLayoutWithContextMenuInfo)item; if (android.os.Build.VERSION.SDK_INT &lt; 16) { item2.setBackgroundDrawable(states); } else { item2.setBackground(states); } } else if (item instanceof LinearLayout) { LinearLayout item2= (LinearLayout)item; if (android.os.Build.VERSION.SDK_INT &lt; 16) { item2.setBackgroundDrawable(states); } else { item2.setBackground(states); } } } I really dislike repeating code in condiditons. Any suggestion to make it more clearly? Thanks, J.
tagged with: java
has answer: http://stackoverflow.com/a/23156916
type: Question
score: 0
has answer: http://stackoverflow.com/a/23156900

http://stackoverflow.com/a/23278839
has comment: http://stackoverflow.com/comment/35630218
downvote count: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35630768
has body: For a more complete answer: If you look at the source code for LocationManager, specifically line 303, you'll see it actually does have a public constructor ... but there's a special annotation: /** * @hide - hide this constructor because it has a parameter * of type ILocationManager, which is a system private class. The * right way to create an instance of this class is using the * factory Context.getSystemService. */ public LocationManager(Context context, ILocationManager service) { mService = service; mContext = context; } The @hide annotation keeps the constructor out of the Javadoc and the IDE won't show it. You can read more about the @hide annotation in this SO Q and A Basically, the class is designed so that you get it from the Context rather than instantiating it yourself. This is a fairly common design for things that require complex (or platform specific) configuration that you want to avoid having the user deal with. Note that the @hide annotation and its handling are specific to Android. This is similar to how the Builder or Factory pattern works, where only a builder/factory class can instantiate the object, although usually that's done with a private or package-private constructor in Java: public class MyWidget { private final Foo someObject; // ... more stuff private MyWidget(Builder builder) { this.someObject = builder.someObject; // ... more stuff } public static class Builder { Foo someObject; public Builder() {} public Builder withFoo(Foo someObject) { this.someObject = someObject; return this; } public MyWidget build() { return new MyWidget(this); } } } Which gets invoked as: MyWidget widget = new MyWidget.Builder().withFoo(someFoo).build();
accepted answer of: http://stackoverflow.com/q/23278604
upvote count: 2
type: Answer
answers question: http://stackoverflow.com/q/23278604
has comment: http://stackoverflow.com/comment/35630976
score: 2

http://stackoverflow.com/a/23216143
answers question: http://stackoverflow.com/q/23215933
has body: if you want it into a map order by counter you can use this: Map(Integer, Bus) busPosition = new HashMap&lt;>(); busPosition.put(buscount, new Bus(splitted[0],splitted[1],splitted[2],splitted[3],splitted[4],splitted[5]));
score: 0
type: Answer

http://stackoverflow.com/a/23149646
answers question: http://stackoverflow.com/q/23148003
score: 0
type: Answer
has body: Eveything looks good. I recommend you to 'sniff' your HTTP traffic and take a look what's going on with your body. On Windows I use TCP Trace. Here you should be sure that you really send a Map as payload. From other side test your Controller separately, e.g. using some RestClient. My preference - Firefox plugin. Build here the form manually, which should be converted to the MultiValueMap in the DispatcherServlet and don't forget to present header Content-Type: application/x-www-form-urlencoded

http://stackoverflow.com/comment/35594529
comment on: http://stackoverflow.com/a/23247504
has text: In detail this is a mini project of attendance taking system in which a lecturer press a take_attendance_button and the list of all the students from the database will get display in a listview along with the checkbox as we did it so far... now when any lecturer will take attendance then he/she will check the checkbox if student is present otherwise blank.... after taking attendance lecturer is going to press on the save button...here i want to save the data of all the selected and unselected checkboxes into the database inside table name studentrecord which contains fieldname id and status...
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/35423944
comment on: http://stackoverflow.com/a/23164067
type: AnswerComment
score: 0
type: Comment
has text: Thank you very much for the help! for some reason my decimal button has now stopped working but I am sure that will be a quick fix!

http://stackoverflow.com/q/23250400
type: Question
accepted answer: http://stackoverflow.com/a/23250701
has body: I am new to android, currently in my second year in I.t.. I'm working on a grocery list app project, where I display a list of groceries for the user to select and to display them on the next screen (Screen 2). The problem I am having, is, when I click the Show List button, it displays the indexes of the selected checkboxes instead of the text displayed... I have tried using a ListActivity to display an array in a CheckedTextView but that didn't work out either (checkboxes were not checking when selected). I would really appreciate some help on how to display the selected text instead of the checkboxes selected indexes and would like to know where I am going wrong. Below is my Java and XML code for the 2 screens.. Java Coding - Screen 1 package com.allmycode.lists; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.CheckBox; import android.widget.LinearLayout; public class MainActivity extends Activity { static CheckBox[] checkBoxes = new CheckBox[18]; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); LinearLayout layout = (LinearLayout) findViewById(R.id.linearLayout); for (int i = 0; i &lt; 18; i++) { checkBoxes[i] = new CheckBox(this); layout.addView(checkBoxes[i]); } checkBoxes[0].setText("Baking Ingredients"); checkBoxes[1].setText("Beverages"); checkBoxes[2].setText("Canned Foods"); checkBoxes[3].setText("Cereal"); checkBoxes[4].setText("Dairy"); checkBoxes[5].setText("Detergents"); checkBoxes[6].setText("Frozen Vegetables"); checkBoxes[7].setText("Fruit"); checkBoxes[8].setText("Broad Beans"); checkBoxes[9].setText("Herbs"); checkBoxes[10].setText("Legumes"); checkBoxes[11].setText("Meat"); checkBoxes[12].setText("Pasta"); checkBoxes[13].setText("Pet Food"); checkBoxes[14].setText("Rice"); checkBoxes[15].setText("Snacks"); checkBoxes[16].setText("Toiletries"); checkBoxes[17].setText("Vegetable…
has title: Checkboxes displaying indexes instead of text
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/23250999
favorite count: 0
tagged with: android
possible better answer: http://stackoverflow.com/a/23250999
tagged with: checkbox
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23250701
score: 1
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/35576818

http://stackoverflow.com/q/23238229
accepted answer: http://stackoverflow.com/a/23487775
possible better answer: http://stackoverflow.com/a/23248842
type: AnsweredQuestion
tagged with: neo4j
type: Question
answer count: 2
has body: I have successfully incorporated a Play! Framework 2.2.2 application with spring-data-neo4j 3. I now have to incorporate a simple Java component with neo4j. I'm using neo4j-rest-graphdb-2.0.1 in my new project. Question as follows: With spring-data-neo4j I had a User model class with @NodeEntity and @TypeAlias("_User") annotations. So I could execute a Cypher query like this: @Query("MATCH (User:_User) WHERE User.network = {0} RETURN User") Iterable&lt;User&gt; executeFilterTest(String filterValue); And that would return a list of my User model class objects that I can iterate through. But now in my Java project I am doing this: RestAPI restAPI = new RestAPIFacade("http://localhost:7474/db/data","",""); CypherResult theResult = restAPI.query("MATCH (User:User) WHERE User.userid = '" + id + "' RETURN User", new HashMap&lt;String, Object&gt;()); I have no idea how to use the CypherResult? Is there a way I can return the same User model objects as a list like I did in my spring-data-neo4j instance?
tagged with: cypher
has answer: http://stackoverflow.com/a/23487775
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/23248842
has title: How to use Neo4j RestAPI with CypherResult‏ in Java

http://stackoverflow.com/comment/35437554
type: QuestionComment
comment on: http://stackoverflow.com/q/23172123
has text: Please add the imports you are using at the top of you class.
score: 0
type: Comment

http://stackoverflow.com/a/23217565
has comment: http://stackoverflow.com/comment/35565213
has comment: http://stackoverflow.com/comment/35562397
accepted answer of: http://stackoverflow.com/q/23217163
type: Answer
answers question: http://stackoverflow.com/q/23217163
has comment: http://stackoverflow.com/comment/35582210
score: 3
upvote count: 3
has body: Your compiler accepts this without errors (but not without warnings) since the f2() method is returning a raw TwoTuple, and you are performing an unchecked conversion to TwoTuple&lt;Boolean, Integer&gt;. If you change the f2() method to a type-safe signature as below, you will get an error: static TwoTuple&lt;ByteArrayOutputStream, Integer&gt; f2() { return tuple(new ByteArrayOutputStream(), 47); }
has comment: http://stackoverflow.com/comment/35573326
has comment: http://stackoverflow.com/comment/35536898
downvote count: 0
has comment: http://stackoverflow.com/comment/35527958
has comment: http://stackoverflow.com/comment/35573089
type: AcceptedAnswer

http://stackoverflow.com/q/23226227
has body: Having a ToolItem with a 32x32 image and a text caption, the image is displayed far too small. Is it possible to set the height of a SWT ToolItem programatically? I am not asking for a solution using CoolItem. Increasing the size of the parent ToolBar and (parent of parent) Composite did not help. The ToolBar becomes heigher, but the ToolItem height seems fixed.
has comment: http://stackoverflow.com/comment/35627997
tagged with: height
has answer: http://stackoverflow.com/a/23311392
has title: How to set height of a SWT ToolItem?
accepted answer: http://stackoverflow.com/a/23311392
favorite count: 0
downvote count: 0
tagged with: swt
has comment: http://stackoverflow.com/comment/35683775
has comment: http://stackoverflow.com/comment/35689039
score: 2
has comment: http://stackoverflow.com/comment/35554095
type: AnsweredQuestion
tagged with: java
type: Question
upvote count: 2
answer count: 1
tagged with: toolbar

http://stackoverflow.com/q/23265835
type: Question
answer count: 2
score: 0
has answer: http://stackoverflow.com/a/23268049
tagged with: ddd-repositories
has title: Domain model that needs to store another domain model
has body: Suppose I have the following simple Domain Model setup: class Event { ... } class PlannedEvent { Event event; DateTime date; .. } And I would like to plan events as descriptive as possible I would write it as class Event { public void plan(DateTime date) { // Can I create and Store a PlannedEvent here ? // in other words access a Repository } I add the plan method because from within the Ubiquitous language you Plan an Event which results in a Planned Event somewhere in the Future. So it feels natural to put the plan method in the Event class. I've always read that you must not use repostories in domain objects I can understand why , but how would I solve the above then ? Is this where Domain Events come into play ? class Event { public void plan(DateTime date) { DomainEventPublisher .instance() .publish(new PlannedEventCreated(this, date))); } Where the Domain Event will make sure a PlannedEvent will be created and stored (by a repository) ?
type: UnansweredQuestion
tagged with: domain-driven-design
has comment: http://stackoverflow.com/comment/35605824
has answer: http://stackoverflow.com/a/23269420
has comment: http://stackoverflow.com/comment/35605711
tagged with: java

http://stackoverflow.com/comment/35452723
type: AnswerComment
comment on: http://stackoverflow.com/a/23180713
has text: I know it is printing the Array but I don't quite understand how, I mean the variable i is not even part of the array, it basically counts the arrays.
type: Comment
score: 0

http://stackoverflow.com/q/23211172
has answer: http://stackoverflow.com/a/23232494
answer count: 1
has body: First of all, this is a odd problem that im trying to fix since I got netbeans and started programming. Basically: I made a simple program with a music that should be playing while the program is running, but when the music just starts playing, it will last only some seconds because it suddenly stops playing with no apparent reason. I just open the program and click the button that makes the music to iniciate, and then it suddenly stops with 3 or 4 seconds(this is random, sometimes it ll last longer). THE CURIOUS THING IS: On my notebook, if I try to test the program while in netbeans yet, the problem always occurs, BUT if I build the program, the problem goes away. In other hand, if I test or build the same program on my pc(high-end), that problem will occur while testing on netbeans and after building it too, so no way to get ridding off it on pc, only on my notebook after building it(if I just test it while on netbeans without building, the problem will occur).That happens with every sound file or music that I try, also all of them are on wav format. Im not sure but I have installed K-lite mega codec pack on both systems, but dunno if its causing that. Here is part of my program where the sound file is started(and my importations): //importations below import java.applet.*; import java.net.*; import java.io.File; import javax.swing.JOptionPane; //my program sound stuff below File file = new File("C:\\Users\\MY-PC\\Desktop\\Projetos\\src\\javaapplication9\\cave of the past.wav"); AudioClip clip=null; try{ clip = Applet.newAudioClip(file.toURI().toURL()); } catch(MalformedURLException lol){ System.err.println("LOOOOOOOOOOOOOOL"); } clip.loop();
score: 0
tagged with: java
tagged with: playing
type: UnansweredQuestion
type: Question
has title: On NetBeans(JAVA), Sound file suddenly stops playing when I start/test my program
tagged with: netbeans

http://stackoverflow.com/comment/35627836
has text: Hi, you appear to be new to StackOverflow. When you post a question and say you have an error, please make sure you include the error message, the name of the exception, and indicate which line it occurred at. This will assist people that are trying to come up with an answer.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23277528

http://stackoverflow.com/q/23229969
tagged with: jdbctemplate
has body: I'm trying to use prepared statements with JDBC Template and SQL Server 2012. I used this to execute the statement: jdbcTemplate.query(PreparedStatementCreator psc, PreparedStatementSetter pss, ResultSetExtractor rse); From the JAVA part, everything is OK. Query is executed, and I get what I need, but the issue is database performance. When I fire up tracing, I can see that statement is being prepared, than executed, but than UNPREPARED! I'm not sure why. Than, the whole point of prepared statements is lost, since the query execution plan is being erased from the cache, and it has to be prepared again for the next usage. Please, does anybody have an idea why SQL Server is unprepareing the statements, and how to prevent it from happening? Thanks in advance!
tagged with: java
type: Question
score: 2
downvote count: 0
favorite count: 0
tagged with: sql-server
tagged with: sql
has title: Spring JdbcTemplate Prepared Statements with SQL Server 2012
answer count: 0
upvote count: 2
type: UnansweredQuestion
tagged with: spring

http://stackoverflow.com/a/23173484
has comment: http://stackoverflow.com/comment/35440874
has comment: http://stackoverflow.com/comment/35440758
has body: One way to do this is to use scan.nextLine() to read the entire line; this essentially uses the "newline" to indicate the end of the sentence. Now you'll have a String containing the whole sentence. Then you can split the string into words with e.g. String.split(): String sentence = scan.nextLine(); String[] words = sentence.split("\\s+"); // &lt;= sequence of one or more whitespace for (String word : words) vec.add(word); You could also use a second Scanner to read the words from the sentence string, if you'd like to stay away from the regular expressions of String.split(), e.g.: String sentence = scan.nextLine(); Scanner sentenceScan = new Scanner(sentence); while (sentenceScan.hasNext()) vec.add(sentenceScan.next()); The key there is hasNext(). You may be tempted to use scan.hasNext() on your original scanner but, unfortunately, this will not get the job done, as hasNext() will continue to return true until the end-of-file on the input is reached (and a newline input is not an end-of-file). By the way, note that in your original code: for(int i=0;i&lt;=vec.size();i++) Here, vec.size() is initially 0, so this loop would never execute anyways. One advantage of using dynamically sized containers (such as Vector) over arrays is that you can add elements to them as needed. So instead of looping to vec.size(), which couldn't be known ahead of time anyways (you don't know how many words will be entered), loop over all the input words and just add() them to the vector. Attempting to break down the while loop in the second example as requested in comments. This while loop: while (sentenceScan.hasNext()) vec.add(sentenceScan.next()); Essentially this is a direct translation of the English sentence: "While there are more words, get the next word and add it to vec." It's always good when your code clearly reflects your intentions, but we can break it down a little to see how it works: We know the following: while (condition) loops while condition is true. sentenceScan.hasNex…
type: Answer
has comment: http://stackoverflow.com/comment/35440644
score: 2
accepted answer of: http://stackoverflow.com/q/23173367
downvote count: 0
answers question: http://stackoverflow.com/q/23173367
upvote count: 2
type: AcceptedAnswer

http://stackoverflow.com/comment/35379296
type: Comment
type: QuestionComment
has text: Haha I know! This was an assigned project from my programming teacher.
comment on: http://stackoverflow.com/q/23138889
score: 0

http://stackoverflow.com/comment/35608891
type: AnswerComment
comment on: http://stackoverflow.com/a/23262682
score: 0
type: Comment
has text: YES..it works, Tankyou...i wish like to understand the reason.. It woks with both auto.commit sets to true or false;

http://stackoverflow.com/q/23133952
has comment: http://stackoverflow.com/comment/35374531
has title: How to sort data sets Java
has comment: http://stackoverflow.com/comment/35374037
type: Question
has comment: http://stackoverflow.com/comment/35374832
tagged with: arrays
downvote count: 0
tagged with: sorting
possible better answer: http://stackoverflow.com/a/23134078
has comment: http://stackoverflow.com/comment/35376603
tagged with: class
has answer: http://stackoverflow.com/a/23134078
score: 2
has comment: http://stackoverflow.com/comment/35373206
has answer: http://stackoverflow.com/a/23134352
favorite count: 0
has body: I have some data here VAN,Ford,Transit,7995 VAN,Ford,Transit,8900 VAN,Ford,Transit,6200 I have already split the data but I need to order them from cheapest van first and I have no idea where to start. Here is my code so far: import java.io.BufferedReader; import java.io.FileReader; public class Vehicle { public static void main(String[]args) throws Exception { FileReader file = new FileReader("C:/Users/Aaron/Documents/java/car_file.txt"); BufferedReader reader = new BufferedReader(file); String text = ""; String line = reader.readLine(); while (line!= null) { text += line+"\r\n"; line = reader.readLine(); } System.out.println(text); } } I am guessing you make classes and sort the data some how but I don't know where to start.
upvote count: 2
answer count: 5
has comment: http://stackoverflow.com/comment/35369761
has answer: http://stackoverflow.com/a/23134524
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35374696
has answer: http://stackoverflow.com/a/23134368
has answer: http://stackoverflow.com/a/23134285
tagged with: java
accepted answer: http://stackoverflow.com/a/23134352
has comment: http://stackoverflow.com/comment/35369590

http://stackoverflow.com/comment/35604163
has text: I deleted the second linear layout and it no longer runs. I have edited my answer to show the updated XML.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23265022

http://stackoverflow.com/comment/35448511
type: QuestionComment
comment on: http://stackoverflow.com/q/23178196
has text: Can you mark it for me? I don't see where you're talking about.
score: 0
type: Comment

http://stackoverflow.com/a/23255923
score: 3
upvote count: 3
type: AcceptedAnswer
has body: This is probably your problem exportStr += formatStringExport(currentPx, x, y, color); Use a StringBuilder instead: StringBuilder sb = new StringBuilder(imgW * imgH * &lt;String size per pixel&gt;); .... sb.append(formatStringExport(currentPx, x, y, color)); Check the StringBuilder documentation for details. Additionally, you could try to reduce the number of objects being created. So for instance replace: c = new Color(image.getRGB(x, y)); String color = matrix[x][y]==1 ? "W" : "B"; by ... if(image.getRGB(x, y).equals(...)) sb.append(formatStringExport(currentPx, x, y, (matrix[x][y]==1 ? "W" : "B"))); Good luck! :)
accepted answer of: http://stackoverflow.com/q/23255734
type: Answer
answers question: http://stackoverflow.com/q/23255734
has comment: http://stackoverflow.com/comment/35591165
downvote count: 0

http://stackoverflow.com/a/23217293
answers question: http://stackoverflow.com/q/23194997
downvote count: 0
type: Answer
has body: Using validate() to validate your action code is a good practice. This type of validation is known as programmatic validation and is described in he Struts documentation under the validation interceptor. You can configure this interceptor to perform all kinds of validations which is the default setting. So, to use a programmatic validation by overriding a validate method vs declarative validation is a way you can do legally in your action. Of course you can do both types of validations via the same interceptor. The framework has support for many basic validators used by the core package, all of them are described under the section of bundled validators. You can also extend the framework by providing your custom validators. The classic example of the custom validator for validation of two fields. Regardless of whichever type of validation you choose, you shouldn't do it in the action method (unless you have a reason to do it, and you know what are you doing) because you can use the framework features and the validation framework to separate the validation logic from the controller logic (assumed that business logic is performed on the service layer). The code you should fix: protected static SimpleDateFormat getDateFormat(){ return new SimpleDateFormat("dd-MMM-yyyy hh:mm"); } @Override public void validate(){ try { SimpleDateFormat df = getDateFormat(); df.parse(dateAndTimeOfOccurance); } catch (java.text.ParseException e) { e.printStackTrace(); addFieldError(dateAndTimeOfOccurance, "Please enter a valid date"); } } @Override public void execute() throws Exception { SimpleDateFormat df = getDateFormat(); Date d = df.parse(dateAndTimeOfOccurance); Timestamp t = new java.sql.Timestamp(d.getTime()); ps.setTimestamp(13, t); ... return SUCCESS; } This code a bit clumsy because it needs to parse a string field twice (and as many times as needed if you want to get a Date value from the string field). Also, It used a fixed format pattern regardless of the context's locale.
score: 1
upvote count: 1

http://stackoverflow.com/q/23169691
has title: UML Class diagram, how to show a Class extends thread?
tagged with: relationship
downvote count: 0
has body: I have a class called ServerSide in which another class resides called Cserver. The following code fragment should explain what I am talking about: public static void main (String [] args) throws Exception { System.out.println("The server is running."); int clientnumber = 1; ServerSocket server = new ServerSocket(9090); try { while (true) { new cserver(server.accept(), clientnumber++).start(); } }finally { server.close(); } } private static class cserver extends Thread { private Socket socket; private int clientnumber; private ConnectionHandler c_handler; private Protocol protocol; public cserver(Socket socket, int clientnumber) { this.socket = socket; this.clientnumber = clientnumber; log("New connection with Client: " + clientnumber + " at " + socket); } I want to make a class diagram in UML which shows the relationship between the two classes, as I am unsure as how this can be drawn in UML. Will it be an association? Thanks
has answer: http://stackoverflow.com/a/23169877
favorite count: 0
tagged with: class-diagram
type: Question
has answer: http://stackoverflow.com/a/23169830
score: 15
answer count: 3
has answer: http://stackoverflow.com/a/23246158
tagged with: java
tagged with: uml
type: UnansweredQuestion
upvote count: 15

http://stackoverflow.com/comment/35646559
comment on: http://stackoverflow.com/q/23286442
type: Comment
score: 0
has text: Try to move the maven installation directory to some other directory where there is no space. For example c:\apps\maven. I remember somewhere reading spaces should not be there
type: QuestionComment

http://stackoverflow.com/q/23138356
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/23138764
has answer: http://stackoverflow.com/a/23139666
has comment: http://stackoverflow.com/comment/35379147
has comment: http://stackoverflow.com/comment/35377934
tagged with: android
has body: I have a single instance thread class. public class LogThread extends Thread{ private static LogThread instance = null; private volatile boolean isRunning = false; private final static Object instanceLock = new Object(); public static synchronized LogThread getInstance(){ synchronized(instanceLock){ if(instance == null) instance = new LogThread(); } return instance; } @Override public run(){ //Doing some run stuff //Once run is finished synchronized(instanceLock){ isRunning = false; instance = null; } } @Override public synchronized void start() { synchronized (instanceLock){ if(!isRunning){ isRunning = true; super.start(); } } } } I am calling start from another thread each time i get the instance, and every once in a while i get a IllegalThreadStateException in com.......LogThread.start, line x Thread already started. How can the thread already be started if I set isRunning before starting the thread AND synchronize it based on instanceLock. EDIT:: I have edited my getInstance() to below: public static synchronized LogThread getInstance(){ synchronized(instanceLock){ if(instance == null){ instance = new LogThread(); instance.start(); } } } it should stop any attempts to start a thread that is already started.
tagged with: java
tagged with: multithreading
possible better answer: http://stackoverflow.com/a/23138764
type: Question
type: AnsweredQuestion
tagged with: thread-safety
has title: How can thread already be started?
accepted answer: http://stackoverflow.com/a/23139666

http://stackoverflow.com/comment/35431467
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23162642
has text: In other words every dependency marked with test will work in unit but not in the integration tests?
score: 0

http://stackoverflow.com/q/23192849
has comment: http://stackoverflow.com/comment/35474207
tagged with: java
has body: I found problem with ojdbc drivrr while connecting to my project.even i put the ojdbc14.jar on classpath but still it doesnt work for me. i must be thankful in advance for letting me to get rid off this . this is myspringcfg.xml &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"&gt; &lt;bean id="fetchBean" class="com.prime.datasource.FetchBean"&gt; &lt;property name="DataSource" ref ="ds" /&gt; &lt;/bean&gt; &lt;bean id="ds" class="org.springframework.jdbc.datasource.DriverManagerDataSource"&gt; &lt;property name="driverClassName" value="oracle.jdbc.driver.OracleDriver" /&gt; &lt;property name="url" value="jdbc:oracle:thin:@192.168.3.44:1521:xe" /&gt; &lt;property name="username" value="harish" /&gt; &lt;property name="password" value="password" /&gt; &lt;/bean&gt; &lt;/beans&gt; this is fetchbean.java package com.prime.datasource; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import javax.sql.DataSource; /** * @author agubbala */ public class FetchBean implements Fetch { //Constants for Queries String NAMESQL = "SELECT NAME FROM EMP WHERE EMPID = ?"; String SALSQL = "SELECT SAL FROM EMP WHERE EMPID = ?"; String DEPTSQL = "SELECT DEPTNO FROM ENO WHERE EMPID = ?"; private DataSource dataSource; public void setDataSource (org.springframework.jdbc.datasource.DriverManagerDataSource dataSource) { this.dataSource = dataSource; } /* (non-Javadoc) * @see com.prime.datasource.Fetch#fetchEmpName(int) */ @Override public String fetchEmpName(int empId) { return getData(NAMESQL, empId); } /* (non-Javadoc) * @see com.prime.datasource.Fetch#fetchEmpSal(int) */ @Override public String fetchEmpSal(int empId) { return getData(SALSQL, empId); } /* (non-Javadoc) * @see com.prime.d…
type: Question
has comment: http://stackoverflow.com/comment/35474562
has answer: http://stackoverflow.com/a/23194093
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/35475165
has title: no suitable driver found for jdbc:oracle:thin:@localhost:xe
type: UnansweredQuestion
tagged with: jdbc
tagged with: spring

http://stackoverflow.com/a/23218992
accepted answer of: http://stackoverflow.com/q/23218961
score: 2
upvote count: 2
has body: I would use System.out.printf(...) and use a template String to help be sure that all columns line up. Then you could print things out easily in a for loop. For example: import java.text.NumberFormat; import java.util.ArrayList; import java.util.List; public class Foo4 { public static void main(String[] args) { List&lt;Bar4&gt; bar4List = new ArrayList&lt;&gt;(); bar4List.add(new Bar4("Donald", 3, "A", 22.42)); bar4List.add(new Bar4("Duck", 100, "B", Math.PI)); bar4List.add(new Bar4("Herman", 20, "C", Math.sqrt(20))); String titleTemplate = "%-10s %6s %6s %9s%n"; String template = "%-10s %6d %6s %9s%n"; System.out.printf(titleTemplate, "Name", "Value", "Grade", "Cost"); for (Bar4 bar4 : bar4List) { System.out.printf(template, bar4.getName(), bar4.getValue(), bar4.getGrade(), bar4.getCostString()); } } } class Bar4 { private String name; private int value; private String grade; private double cost; private NumberFormat currencyFormat = NumberFormat.getCurrencyInstance(); public Bar4(String name, int value, String grade, double cost) { this.name = name; this.value = value; this.grade = grade; this.cost = cost; } public String getName() { return name; } public int getValue() { return value; } public String getGrade() { return grade; } public double getCost() { return cost; } public String getCostString() { return currencyFormat.format(cost); } } Which would return: Name Value Grade Cost Donald 3 A $22.42 Duck 100 B $3.14 Herman 20 C $4.47 For more details on the user of the String format specifiers (i.e., the %6d and %6s above), please look at the Formatter API.
answers question: http://stackoverflow.com/q/23218961
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/comment/35577552
comment on: http://stackoverflow.com/q/23250887
has text: Does `@DirtiesContext` not do that for you?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35478500
type: Comment
score: 0
type: AnswerComment
has text: Yes but what confuse me is which view? The view the list view is in or the parent of the XML row to be inflated?
comment on: http://stackoverflow.com/a/23195743

jogl
tag name: jogl
tags question: http://stackoverflow.com/q/23163838
tags question: http://stackoverflow.com/q/23223818
type: Tag

http://stackoverflow.com/q/23138989
has answer: http://stackoverflow.com/a/23139305
has comment: http://stackoverflow.com/comment/35379488
has comment: http://stackoverflow.com/comment/35379408
type: Question
tagged with: libgdx
has title: Accessing Array.items[] in a for-loop error
tagged with: java
has comment: http://stackoverflow.com/comment/35379198
tagged with: class
score: 0
answer count: 2
tagged with: for-loop
has answer: http://stackoverflow.com/a/23139854
has comment: http://stackoverflow.com/comment/35379165
has comment: http://stackoverflow.com/comment/35379448
type: UnansweredQuestion
tagged with: android
has body: With the aim of getting a better performance I'm fine tuning the code, looking through the DDMS tracer. One aspect is Array.get(x) which is more expensive than Array.items[x] We can directly access the items proving the array type is Object, or, we specify the array type in the constructor, like so: Array&lt;MyClass&gt; foo = new Array&lt;MyClass&gt;(MyClass.class) This works fine, however, how do I specify the last MyClass.class in a for loop? I have this at the moment: for (Array&lt;MyClass&gt; listOfObjects : allObjects) { for (int i=0; i&lt;listOfObjects.size; i++) { MyClass myObj = listOfObjects.get(i); //MyClass myObj = listOfObjects.items[i]; The commented line works fine, but trying to get rid of the overhead, I want to supply the `(MyClass.class)' like mentioned above. Where can I do this in that for-loop constructor? Many thanks J

http://stackoverflow.com/comment/35489634
type: Comment
comment on: http://stackoverflow.com/a/23200971
score: 0
type: AnswerComment
has text: In eclipse there is a built-in debugger available, see: https://developer.android.com/tools/debugging/debugging-projects.html#toptips The logcat should be always running, you don't have to do anything special about it. However you can write some logs yourself into the logcat by using Log statements in your code.

http://stackoverflow.com/comment/35421528
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23162863
has text: I wish I could upvote but I am not allowed yet. So I'll just say thank you for your help!
score: 0

http://stackoverflow.com/q/23234617
score: 0
answer count: 2
tagged with: deep-copy
has body: I have two classes, one class is called Client and the other one is call Department. The class Department stores an array of Clients. I was making some tests to prove Deep Copy in Java, but it does not seem to work. In the Department class I have a get method that returns the list of Clients that stores. For example: public Client[] getClientList() { return clientList; } a method that returns the number of clients that I store: public int getNumberClients() { return n; } and one method that returns an specific Client from the clientList: public Client getClient(int pos){ return clientList[pos]; } In my main program I have created a certain number of Clients and store them into the Department class, specifically in the clientList attribute; something like this: Client objCli1=new Cliente(... ... Department objDep=new Department(100) objDep.addClient(objCli1) ... so now I want to return the array of Clients from the Department class into my main program, and copy their elements into another client Array. Something like this: Client[] clientList; int n=objDep.getNumberClients(); clientList=new Client[n]; for (int i=0;i&lt;n;i++){ clientList[i]=objDep.getClient(i); } So when I print the elements of clientList they are the same as the ones that I have in my Department class. The problem is that if I do something like this: clientList[2].setName("Michaels") it changes the name of the second client that I got stored in my Department class; I wonder why is that? because I have made a deep copy of the elements that I have in my Department class to the new clientList in my main program. So why is not working? Any hint how to do that it would be great. Thanks
has answer: http://stackoverflow.com/a/23234698
accepted answer: http://stackoverflow.com/a/23234675
possible better answer: http://stackoverflow.com/a/23234698
has comment: http://stackoverflow.com/comment/35548702
has comment: http://stackoverflow.com/comment/35548668
has answer: http://stackoverflow.com/a/23234675
type: AnsweredQuestion
has title: deep copy seems not to work
tagged with: oop
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/35548673

http://stackoverflow.com/a/23239836
has body: use this for comparing if(result[0].equals("true")) comments.setText("Success"); else if (result[1].equals("true") &amp;&amp; result[2].equals("false")) comments.setText("Username is already used"); else comments.setText("Phone number is already used");
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/23239712
answers question: http://stackoverflow.com/q/23239712
score: 3
upvote count: 3

http://stackoverflow.com/comment/35497850
comment on: http://stackoverflow.com/a/23206117
score: 1
type: AnswerComment
type: Comment
has text: your answer will fix the issue, but OP seems to know this already, question is more around why jboss isn't picking up jar in classpath which is placed somewhere in jboss directory from where OP is expecting it to pick up, I assume, +1 btw

http://stackoverflow.com/comment/73082515
has text: Did you solve this? I have the same requirement.
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/23219937

http://stackoverflow.com/comment/35566084
type: Comment
comment on: http://stackoverflow.com/a/23232761
has text: What do you mean the problem is that the `Bundle` is null? The `TabPagerAdapter` is ok, but you should use the `newInstance()` method of the `arrivi` `Fragment` there too. You can pass values to the `TabPagerAdapter` through the constructor. Or if you nest the `TabPagerAdapter` in the `MainActivity` without the static keyword than you can access member variables of the `MainActivity` in the `TabPagerAdapter`.
type: AnswerComment
score: 0

http://stackoverflow.com/a/54817272
answers question: http://stackoverflow.com/q/23246696
score: 0
type: Answer
has body: Two ways, Use JobExecution, here you can get access to StepExecution and thereby can get step read, write or errors Spring Batch stores all its job and step data in batch tables. You can refer the docs here : Spring Batch Meta-Data If you are using Meta-data tables, then you can configure jobExplorer that provides you to get the meta-data data. Using xml you can configure it as,

http://stackoverflow.com/comment/35375644
type: AnswerComment
type: Comment
score: 0
has text: Yes sure, I was just testing. I've tried using an algorithm similar as described in this paper [Two-stage Image Denoising by Principal Component Analysis with Local Pixel Grouping](http://www4.comp.polyu.edu.hk/~cslzhang/paper/PR_10_x_3.pdf) where i'm searching not only for corresponding blocks between frames but pixels surrounding them as well [result](http://imgur.com/rlI7XDz,AzLejws) .Unfortunately it takes around 1 minute per frame, which is slow and the results are similar to my actual implementation which instead can be run in quasi real time with 4x4 blocks( example was with 4x4 blocks)
comment on: http://stackoverflow.com/a/23131052

http://stackoverflow.com/q/23232809
answer count: 1
score: 0
tagged with: command-line
has answer: http://stackoverflow.com/a/23232890
type: UnansweredQuestion
has body: I am trying to convert a proprietary, third party IDL into java. I downloaded the IDL, opened up cmd.exe, navigated to the directory containing the IDL files, and then typed in the following command which was given explicitly by the provider of the third party IDL: java com.sun.tools.corba.se.idl.toJavaPortable.Compile -fallTIE -pkgPrefix types org.hl7 -pkgPrefix CTSMAPI org.hl7 -pkgPrefix CTSVAPI org.hl7 CTSVAPI.idl Unfortunately, this is throwing the following error in the command line: Error: could not find or load main class com.sun.tools.corba.se.idl.toJavaPortable.Compile I googled and found the definition of the class at this link. I typed in java in the command prompt and got a list of methods, indicating that I can call java from the command prompt in that directory. Other web sites indicate that com.sun.tools.corba.se.idl.toJavaPortable.Compile has been a part of the jdk since at least version 1.3. So why am I getting this error?
type: Question
has title: transforming an idl to java
tagged with: java

http://stackoverflow.com/comment/35559155
has text: @fe11e I didn't know that. I will try that option also. Thank you.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23213544

http://stackoverflow.com/comment/35613264
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/23268161
type: Comment
has text: @Jon Skeet, thanks for your hints. It looks like the example in the book won't work because I would need to abandon the BankAccount class at the end if I only change the Dollar class. I re-posted the new code. I think it doesn't matter now, I thought by re-posting the code, it would be clearer for everyone. Also to other contributors, thanks.

http://stackoverflow.com/a/23203441
type: Answer
score: 2
downvote count: 0
has body: You won't be able to do that unless you want to reprogram what would essentially be the other layouts like BorderLayout, GridLayout, and so on. So the solution for this is to not use a null layout and use a combination of other layouts nested together. Here's a link to get started on what the other specific layouts can do for you.
answers question: http://stackoverflow.com/q/23203392
upvote count: 2

http://stackoverflow.com/q/23248719
upvote count: 1
linked to: http://stackoverflow.com/q/2427883
tagged with: android
favorite count: 0
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35573761
has title: Cannot instanciate correctly new object clone with copy constructor
downvote count: 0
score: 1
tagged with: java
has body: I'm trying to get a clone of an object using copy-contructor, unfortunately seems that all the modification to the clone are reflected to the original object. I have this interface public interface Car{ public Car newInstance(Car c); } and various Object hat implements the interface in this way public FerrariSpyder implements Car{ String name; String description ArrayList&lt;Feature&gt; featureList; public FerrariSpyder(String name, String description, ArrayList&lt;Feature&gt; featureList){ this.name=name; this.descripion=descripion; this.featureList=featureList; } @Override public Car newInstance(Car c) { return FerrariSpyder.newInstance((FerrariSpyder) c); } public static FerrariSpyder newInstance(FerrariSpyder fs) { return new FerrariSpyder(fs.getName(), fs.getDescription(), fs.getFeatureList()); } } Now assuming that I have a Car object named originalCar I try to clone this with Car clone=originalCar.newIstance(originalCar); If I add elements in featureList of the clone also the featureList in originalCar will be modified.
type: Question
has comment: http://stackoverflow.com/comment/35573772
answer count: 1
has answer: http://stackoverflow.com/a/23248881
accepted answer: http://stackoverflow.com/a/23248881

http://stackoverflow.com/a/23165232
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23165042
type: Answer
has comment: http://stackoverflow.com/comment/35425781
answers question: http://stackoverflow.com/q/23165042
downvote count: 0
score: 1
has body: It doesn't seem like you're doing anything to coordinate with your Reader and Writer threads, which are the ones you want to wait for. If you pass your synchronization barrier through to those threads so that they can register and signal when they are done, it works just fine. Here's a version rewritten to do so, using a Phaser instead of a CyclicBarrier. Note that each Reader and Writer registers itself upon construction, and notifies the synchronization barrier when it is done executing: public class ThreadTesterRunner { public static void main(String[] args) throws InterruptedException { final Phaser cb = new Phaser(); ThreadRunner tr = new ThreadRunner(cb); Thread t = new Thread(tr, "Thread Runner"); t.start(); boolean process = true; // wait until all threads process, then print reports while (process){ if(tr.getIsFinished()){ System.out.println("Print metrics"); process = false; } //else { // System.out.println("Waiting: registered=" + cb.getRegisteredParties() + ", arrived=" + cb.getArrivedParties() + ", unarrived=" + cb.getUnarrivedParties()); //} Thread.sleep(1000); } } } class ThreadRunner implements Runnable { static int timeOutTime = 2; private ExecutorService executorService = Executors.newFixedThreadPool(10); private final Phaser barrier; private boolean isFinished=false; public ThreadRunner(Phaser phaser) { this.barrier = phaser; } public void run(){ try { boolean stillLoop = true; int i = 0; while (stillLoop){ int size; Future&lt;Integer&gt; future = null; try { future = executorService.submit(new Reader(this.barrier)); // sleeps size = future.get(); } catch (InterruptedException | ExecutionException ex) { // handle Errs } if(i == 3){ stillLoop = false; this.barrier.awaitAdvance(0); this.isFinished=true; } //System.out.println("i = "+i+" Size is: "+size+"\r"); i++; } } catch (Exception e1) { e1.printStackTrace(); } } public boolean getIsFinished(){ return this.isFinished; } } class Reader implements Callable { private Phaser barrier; private Executor…

http://stackoverflow.com/comment/35367828
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23131872
score: 0
has text: @reubenjohn No problem, don't be surprised when people answer what they think the question was. sometimes they answer without reading carefully, so if you are doing something different you have to make it really obvious.

jsf
tags question: http://stackoverflow.com/q/23266858
tags question: http://stackoverflow.com/q/23134929
type: Tag
tags question: http://stackoverflow.com/q/23274833
tags question: http://stackoverflow.com/q/23223689
tags question: http://stackoverflow.com/q/23188115
tags question: http://stackoverflow.com/q/23213516
tags question: http://stackoverflow.com/q/23139004
tags question: http://stackoverflow.com/q/23249217
tags question: http://stackoverflow.com/q/23212322
tags question: http://stackoverflow.com/q/23210962
tags question: http://stackoverflow.com/q/23219951
tags question: http://stackoverflow.com/q/23232034
tags question: http://stackoverflow.com/q/23160271
tags question: http://stackoverflow.com/q/23217429
tags question: http://stackoverflow.com/q/23285809
tags question: http://stackoverflow.com/q/23140944
tags question: http://stackoverflow.com/q/23237705
tags question: http://stackoverflow.com/q/23220317
tags question: http://stackoverflow.com/q/23172961
tags question: http://stackoverflow.com/q/23219596
tag name: jsf
tags question: http://stackoverflow.com/q/23235854
tags question: http://stackoverflow.com/q/23219563
tags question: http://stackoverflow.com/q/23141975
tags question: http://stackoverflow.com/q/23218148
tags question: http://stackoverflow.com/q/23170641
tags question: http://stackoverflow.com/q/23270616
tags question: http://stackoverflow.com/q/23131235
tags question: http://stackoverflow.com/q/23266655
tags question: http://stackoverflow.com/q/23217879
tags question: http://stackoverflow.com/q/23265354
tags question: http://stackoverflow.com/q/23246405
tags question: http://stackoverflow.com/q/23131736

access-control
tag name: access-control
type: Tag
tags question: http://stackoverflow.com/q/23278604

http://stackoverflow.com/q/23157352
has answer: http://stackoverflow.com/a/25464761
upvote count: 6
has body: This issue is supposed to be fixed by the latest ADT release(22.6.2), but I'm still receiving the same error when I'm trying to create an empty Android Application Project. Here is the exact error: Errors occurred during the build. Errors running builder 'Android Resource Manager' on project 'MyFirstApp'. java.lang.NullPointerException Am I missing something here? btw I'm using OSX-Maverics 10.9.2
has answer: http://stackoverflow.com/a/24249498
has comment: http://stackoverflow.com/comment/35452077
downvote count: 1
type: Question
tagged with: osx-mavericks
tagged with: java
has answer: http://stackoverflow.com/a/25049448
answer count: 6
has comment: http://stackoverflow.com/comment/35411168
score: 5
has comment: http://stackoverflow.com/comment/35474730
tagged with: java-7
has comment: http://stackoverflow.com/comment/35410917
has comment: http://stackoverflow.com/comment/35410788
has title: Eclipse ADT 22.6.2 still gives the error "java.lang.NullPointerException"
favorite count: 0
has comment: http://stackoverflow.com/comment/35411076
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23199262
has answer: http://stackoverflow.com/a/24390734
has answer: http://stackoverflow.com/a/30697621
tagged with: android
tagged with: eclipse-adt

http://stackoverflow.com/q/23229613
answer count: 1
favorite count: 0
has title: Generic Binary Search-java
has comment: http://stackoverflow.com/comment/35539963
has comment: http://stackoverflow.com/comment/35539983
has comment: http://stackoverflow.com/comment/35539886
score: -1
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35539847
tagged with: java
has comment: http://stackoverflow.com/comment/35540090
has comment: http://stackoverflow.com/comment/35540249
downvote count: 1
has answer: http://stackoverflow.com/a/23229751
has comment: http://stackoverflow.com/comment/35539881
type: Question
has body: I am a beginner at Java so I don't really understand this stuff that well and I am currently working on a Java program and found something simliar to the program I am working on. The only difference from the program the teacher wants is that he wants us to read in a file using Scanner. So If you could just show me how to do this one I would greatly appreciate it. Thanks:) Implement the following method using Binary search. public static &lt;E extends Comparable&lt;E&gt;&gt; int binarySearch(E[]list, E key)
has comment: http://stackoverflow.com/comment/35539925
has comment: http://stackoverflow.com/comment/35541049
accepted answer: http://stackoverflow.com/a/23229751
has comment: http://stackoverflow.com/comment/35539952
has comment: http://stackoverflow.com/comment/35540125
has comment: http://stackoverflow.com/comment/35540012
upvote count: 0

http://stackoverflow.com/q/23147899
has comment: http://stackoverflow.com/comment/35395324
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/4112686
tagged with: jsp
has answer: http://stackoverflow.com/a/23147939
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/23148068
has title: calling java program from Jsp on click
has body: I have a JSP page with two buttons. One is On and other one is OFF. If I click on ON button in JSP, On click some predefined string will have to send to IP address. How can we call Java program from JSP on click button?
type: UnansweredQuestion

http://stackoverflow.com/q/23245019
has comment: http://stackoverflow.com/comment/35567176
has comment: http://stackoverflow.com/comment/35566941
tagged with: java
has comment: http://stackoverflow.com/comment/35567677
has body: I have a project on object orientation due in a couple of weeks and Im completely aware that this is 'homework' per-say. Im just really stuck with these errors and I cant understand them at all! The errors im getting are saying that I dont have a while loop, illegal start of expression and reached end of file while parsing. I would really appreciate if you guys could help me out a little! Thanks!! Here's my code so far: { public static void main(String[] args) { int choice; int index; String name = " "; int goals; int points; int noofthings; int location; Footballer tempObject; String search = ""; int step; noofthings = 0; do{ choice = menu(); switch(choice) { case 1 : { step = 0; System.out.print("Enter a name "); name = EasyIn.getString(); while((step &lt; noofthings) &amp;&amp; !(names[step].getName().equals(name))) { step++; } if(step &lt; noofthings) { System.out.println("Name already exists, choose another "); } else { System.out.println("Enter amount of goals "); goals = EasyIn.getInt(); System.out.println("Enter amount of points "); points = EasyIn.getInt(); tempObject = new Footballer(name, goals, points); location = findPlace(names, tempObject, noofthings); noofthings = addOne(names, location, tempObject, noofthings); } } } } } } This is the Footballer class: class Footballer { private String name; private int goals; private int points; public Footballer () // constructor { } public Footballer (String theName, int theGoals, int thePoints) // constructor { name = theName; goals = theGoals; points = thePoints; } // Mutators (Setter Methods) public void setName (String theName) { name = theName; } public void setGoals (int theGoals) { goals = theGoals; } public void setPoints (int thePoints) { points = thePoints; } // Selectors (Getter Methods) no parameters public String getName () { return name; } public int getGoals() { return goals; } public int getPoints () { return points; } public String toString () { String myString; myString = ""; myString += "\n Nam…
score: -1
has comment: http://stackoverflow.com/comment/35567256
has title: Object Orientation
upvote count: 0
answer count: 1
tagged with: arrays
has comment: http://stackoverflow.com/comment/35567144
has comment: http://stackoverflow.com/comment/35568253
favorite count: 0
has comment: http://stackoverflow.com/comment/35566882
has answer: http://stackoverflow.com/a/23245190
has comment: http://stackoverflow.com/comment/35566888
has comment: http://stackoverflow.com/comment/35567921
has comment: http://stackoverflow.com/comment/35568296
has comment: http://stackoverflow.com/comment/35566976
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35567100
downvote count: 1
has comment: http://stackoverflow.com/comment/35568412
type: Question
tagged with: object

http://stackoverflow.com/a/23137847
upvote count: 2
has comment: http://stackoverflow.com/comment/35377651
has body: You're probably getting an error because getSort() isn't static, so it can't be called from main(). Beyond this, you shouldn't use raw types, parametrize your lists and sets: ArrayList&lt;Integer&gt; list = ... TreeSet&lt;Integer&gt; set = ... You should be getting warnings about this. In fact, I would make this method totally generic: public static &lt;V extends Comparable&lt;V&gt;&gt; TreeSet&lt;V&gt; getSort(List&lt;V&gt; list) { return new TreeSet&lt;&gt;(list); } Lastly, remember to follow naming conventions: local variable names should start with a lowercase letter (i.e. list and not List).
downvote count: 0
has comment: http://stackoverflow.com/comment/35378038
type: Answer
answers question: http://stackoverflow.com/q/23137758
score: 2

http://stackoverflow.com/comment/35413115
type: Comment
type: QuestionComment
has text: But why do you have insertable and updatable set to false? In this way that field will not be included in insert/update queryes
comment on: http://stackoverflow.com/q/23157585
score: 0

http://stackoverflow.com/q/23161119
tagged with: inputstream
has comment: http://stackoverflow.com/comment/35418705
has body: I am trying to fetch input stream pdf from URL Connection but I am getting an empty input stream. Can anyone please tell me what is I am doing wrong? Following is the code: &lt;!-- language: java --&gt; URL fileUrl = new URL("https://www.dropbox.com/s/ao3up7xudju4qm0/Amalgabond%20Adhesive%20Agent.pdf"); HttpURLConnection connection = (HttpURLConnection)fileUrl.openConnection(); connection.connect(); InputStream is = connection.getInputStream(); Log.i("TAG", "is.available(): " + is.available()); is.available() is returning 0 empty stream.
answer count: 3
has title: URLConnection returning empty inputStream
linked to: http://stackoverflow.com/q/3695372
linked to: http://stackoverflow.com/q/13557630
tagged with: url
tagged with: urlconnection
has comment: http://stackoverflow.com/comment/35418840
favorite count: 0
upvote count: 3
has answer: http://stackoverflow.com/a/23161755
has answer: http://stackoverflow.com/a/23164792
has comment: http://stackoverflow.com/comment/35418851
tagged with: httpurlconnection
has comment: http://stackoverflow.com/comment/35418885
has comment: http://stackoverflow.com/comment/35418967
downvote count: 0
linked to: http://stackoverflow.com/q/309424
has comment: http://stackoverflow.com/comment/35419154
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23163767
type: Question
has comment: http://stackoverflow.com/comment/35419004
score: 3
has comment: http://stackoverflow.com/comment/35419133
tagged with: java
has comment: http://stackoverflow.com/comment/95375020

http://stackoverflow.com/q/23278469
has comment: http://stackoverflow.com/comment/35630047
answer count: 1
has comment: http://stackoverflow.com/comment/35629232
tagged with: mergesort
favorite count: 0
has body: I'm working through Programming Peals, and the first essay deals with sorting numbers within a known range. As a smart solution, they offer implementing a bitmap, setting all numbers in the input file to one in the bitmap, and then simply iterating over it to print the result. The assumption is that this should be a lot faster than a more traditional sorting algorithm like quicksort or mergesort. To test this out, I wrote the bitmap sort myself, in Java. I was not too surprised when I found out that the Unix sort command, which uses merge sort, is still a lot faster. I attributed this to the fact that it is written in C, and probably highly optimized by some very smart folks. So, then I wrote my own merge sort, also in Java. To my surprise, my BitmapSort was faster, but only marginally. With a very large input file (+-800000 integers), bitmapsort is only about 30% faster. Here is my bitmap sort and bitmap implementation: import java.util.Scanner; import java.io.FileReader; import java.io.File; class BitmapSort { Scanner sc; BitmapSort() throws Exception { sc = new Scanner(new File("numbers.txt")); } void start() { BitMap map = new BitMap(3000000); while (sc.hasNextInt()) { map.set(sc.nextInt()); } for (int i = 0; i &lt; 3000000; i++) { if (map.isSet(i)) { System.out.println(i); } } } public static void main(String[] args) throws Exception { new BitmapSort().start(); } } class BitMap { byte[] bits; int size; BitMap(int n) { size = n; bits = new byte[(int) Math.ceil((double) n / (double) Byte.SIZE)]; for (Byte b : bits) { b = 0; } } private String toBinary(byte b) { return String.format(Integer.toBinaryString(b &amp; 0xFF)).replace(' ', '0'); } void set(int i) { int index = i / Byte.SIZE; bits[index] = (byte) ((bits[index] | (byte) (1 &lt;&lt; (Byte.SIZE - 1 - (i % Byte.SIZE))))); } void unset(int i) { int index = i / Byte.SIZE; bits[index] = (byte) ((bits[index] ^ (byte) (1 &lt;&lt; (Byte.SIZE - 1 - (i % Byte.SIZE))))); } boolean isSet(int i) { int index = i / Byte.S…
tagged with: bitmap
has comment: http://stackoverflow.com/comment/35629555
upvote count: 4
has comment: http://stackoverflow.com/comment/35629120
tagged with: big-o
type: AnsweredQuestion
downvote count: 0
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/23278726
tagged with: algorithm
has comment: http://stackoverflow.com/comment/35630049
score: 4
has comment: http://stackoverflow.com/comment/35629190
has answer: http://stackoverflow.com/a/23278726
has title: Why is my bitmap sort not infintely faster than my mergesort?

http://stackoverflow.com/q/23151445
has comment: http://stackoverflow.com/comment/35401450
possible better answer: http://stackoverflow.com/a/23151564
has comment: http://stackoverflow.com/comment/35400889
has comment: http://stackoverflow.com/comment/35401366
tagged with: android
has title: REST webservice doesn't receive Android HttpPost parameters
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23153310
accepted answer: http://stackoverflow.com/a/23153310
tagged with: java
has body: I have a webservice which receives 2 (optional) parameters: &lt;resource path="getLogbookEvents"&gt; &lt;method name="POST"&gt; &lt;request&gt; &lt;param name="startDate" style="query" type="xs:string"/&gt; &lt;param name="endDate" style="query" type="xs:string"/&gt; &lt;/request&gt; &lt;response&gt; &lt;representation mediaType="application/json"/&gt; &lt;/response&gt; &lt;/method&gt; &lt;/resource&gt; I'm able to connect and receive an answer from Android using HttpPost, but the web service never receives either of the two parameters. HttpClient httpclient = new DefaultHttpClient(); HttpPost post = new HttpPost("http://... method URL ..."); //post.setHeader("media-type", "application/json; charset=UTF-8"); ArrayList&lt;NameValuePair&gt; nameValuePairs = new ArrayList&lt;NameValuePair&gt;(); nameValuePairs.add(new BasicNameValuePair("startDate", "2014-04-18T05:00:00")); nameValuePairs.add(new BasicNameValuePair("endDate", "2014-04-18T06:00:00")); UrlEncodedFormEntity entity = new UrlEncodedFormEntity(nameValuePairs); // entity.setContentEncoding(HTTP.UTF_8); post.setEntity(entity); // make POST request to the given URL HttpResponse httpResponse = httpclient.execute(post); // receive response as inputStream inputStream = httpResponse.getEntity().getContent(); I have tried HttpParams, JSONObject and nameValuePairs and nothing works. I just keep receiving the response as if I didn't specify any parameters. Any ideas on why this could be happening or other things I could try to get the winning combination?
tagged with: web-services
has answer: http://stackoverflow.com/a/23151564
type: Question
has comment: http://stackoverflow.com/comment/35401720
score: 0
answer count: 2
tagged with: http-post
has comment: http://stackoverflow.com/comment/35401537

http://stackoverflow.com/a/23167196
score: 1
has body: exception thrown here on non-windows OS That's a big clue, suggesting that there's a capitalization difference somewhere. The major file systems used with Windows are case-insensitive, whereas the major file systems used elsewhere (*nix) are case-sensitive. So look very carefully at the capitalization of the resources you're trying to load and ensure what you're loading has exactly the same capitalization in your code as it does in the jar or in the file system.
has comment: http://stackoverflow.com/comment/35429291
has comment: http://stackoverflow.com/comment/35429132
has comment: http://stackoverflow.com/comment/35429476
upvote count: 1
answers question: http://stackoverflow.com/q/23167148
has comment: http://stackoverflow.com/comment/35429407
type: Answer
has comment: http://stackoverflow.com/comment/35429342
downvote count: 0

http://stackoverflow.com/a/23165026
type: Answer
answers question: http://stackoverflow.com/q/23164988
score: 0
has body: If I understand what you are asking, you don't want hundreds of alert messages asking the user for input, correct? Just ask once? If that is the case, you can ask the user to separate the input with some symbol. For example a semi-colon. Then the user can input something like this: 1;2;3;4;5 Then what you do is split the input to get the array, and you print it out using a for loop and a printing method of your choice (e.g. system.out or show in an alert message) Hope that solves your problem

http://stackoverflow.com/comment/35393569
has text: Make your view variables `final` so they are visible within the `OnClickListener` and do your calculations.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23146201
type: AnswerComment

http://stackoverflow.com/q/23235225
tagged with: gradle
score: 9
type: Question
has answer: http://stackoverflow.com/a/23706161
upvote count: 9
has comment: http://stackoverflow.com/comment/36109028
has answer: http://stackoverflow.com/a/23255236
answer count: 3
downvote count: 0
favorite count: 0
possible better answer: http://stackoverflow.com/a/23524442
accepted answer: http://stackoverflow.com/a/23255236
has comment: http://stackoverflow.com/comment/36084614
has title: New Relic Android agent error with gradle
has answer: http://stackoverflow.com/a/23524442
tagged with: android
tagged with: newrelic
has comment: http://stackoverflow.com/comment/36084570
type: AnsweredQuestion
has body: I have a project that uses the gradle build system and I'm willing to add New Relic monitoring to it. The project (including New Relic) is working fine on Linux (Fedora 20), but won't build on my Mac development system, and gives out an error stating Agent JAR loaded but agent failed to initialize. Here is the full log of the error: Dev-1:test 0x4d$ ./gradlew clean &gt; Configuring &gt; 1/2 projects &gt; :appobjc[4437]: Class JavaLaunchHelper is implemented in both /Library/Java/JavaVirtualMachines/jdk1.7.0_55.jdk/Contents/Home/bin/java and /Library/Java/JavaVirtualMachines/jdk1.7.0_55.jdk/Contents/Home/jre/lib/libinstrument.dylib. One of the two will be used. Which one is undefined. [newrelic.error] Agent startup error java.lang.IllegalAccessException: Can not set static final java.lang.Object field java.util.logging.Logger.treeLock to com.newrelic.agent.compile.RewriterAgent$InvocationDispatcher at sun.reflect.UnsafeFieldAccessorImpl.throwFinalFieldIllegalAccessException(UnsafeFieldAccessorImpl.java:73) at sun.reflect.UnsafeFieldAccessorImpl.throwFinalFieldIllegalAccessException(UnsafeFieldAccessorImpl.java:77) at sun.reflect.UnsafeQualifiedStaticObjectFieldAccessorImpl.set(UnsafeQualifiedStaticObjectFieldAccessorImpl.java:77) at java.lang.reflect.Field.set(Field.java:741) at com.newrelic.agent.compile.RewriterAgent.createInvocationDispatcher(RewriterAgent.java:772) at com.newrelic.agent.compile.RewriterAgent.premain(RewriterAgent.java:137) at com.newrelic.agent.compile.RewriterAgent.agentmain(RewriterAgent.java:102) 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 sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:382) at sun.instrument.InstrumentationImpl.loadClassAndCallAgentmain(Instrumentation…
tagged with: java

http://stackoverflow.com/comment/35578299
type: Comment
score: 0
comment on: http://stackoverflow.com/a/23250825
type: AnswerComment
has text: @LuiggiMendoza In Java, a local uninitialized int defaults to 0, isn't it? In C and C++, yes, it is true that local uninitialized int has junk value. A bit messed up for me :)

http://stackoverflow.com/a/23304413
score: 1
has body: It's better to use a properties file than either a class or an interface, for holding strings used for messages. You could even keep the properties file outside of the jar that has your java code. There are a few advantages. If you want to change the text of the messages, or have different versions for different languages, you can just put a new properties file in place, and you don't need to rebuild the jar files. If you use the PropertyResourceBundle class properly, the internationalisation happens automatically - you can have different sets of properties co-existing, and the system's locale will be used to select the right one. The Logger class integrates seamlessly with ResourceBundle, so you don't have to write any code for looking up the message key. The Logger class lets you use include message parameters (like {0}, {1}) and have them expand using parameters that you provide. There are even some formatting options. So in the example of your question, you might have a property whose value is Entering method {0} of class {1} and just write logger.log(Level.FINE, "entering", "methodname", "classname"); where "entering" is the key in the properties file. There is then no need to mess around with StringBuilder objects, or String.format, or any other message concatenating mechanism. There are logging frameworks that give you even more goodies than this, but this is too large a topic to go into here. My point is that using a properties file and a resource bundle will give you a lot, for nothing; and therefore there's no need to even consider having a class or an interface for your constants.
upvote count: 1
accepted answer of: http://stackoverflow.com/q/23272227
answers question: http://stackoverflow.com/q/23272227
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/comment/35630597
comment on: http://stackoverflow.com/q/23279183
score: 3
has text: And why aren't you using an XML API anyway? That's usually a *much* better idea than trying to handle it yourself.
type: QuestionComment
type: Comment

http://stackoverflow.com/q/23180027
score: 1
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/35451721
type: Question
has body: I'm trying to add a record to my sqlite table. I had a problem saving the record and i saw that in the logcat. however i would like to prompt the user with a Toast saying there was a problem and what's the error (as written in the logcat) how can i catch sqlite throwable and show a Toast? sql catches the error itself and doesn't throw it to its caller? public void addItem(Offer offer) { Log.d(MyLogger.TAG, "add saved-offer"); // 1. get reference to writable DB SQLiteDatabase db = this.getWritableDatabase(); // 2. create ContentValues to add key "column"/value ContentValues values = new ContentValues(); values.put(KEY_UID, offer.getId().toString()); values.put(KEY_ADDRESS, offer.getAddress()); // 3. insert db.insert(TABLE_NAME, // table null, // nullColumnHack values); // key/value -&gt; keys = column names/ values = column // values String text = String.format("item was added to table: {0}", TABLE_NAME); Log.d(MyLogger.TAG, text); Toast.makeText(mContext, text, Toast.LENGTH_LONG); // 4. close db.close(); }
has title: catching sqlite throwables in my code
tagged with: sql
tagged with: sqlite
has answer: http://stackoverflow.com/a/23180055
accepted answer: http://stackoverflow.com/a/23180055
answer count: 1
downvote count: 0
favorite count: 0
tagged with: android
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/8283844

http://stackoverflow.com/a/23279372
accepted answer of: http://stackoverflow.com/q/23275626
score: 1
upvote count: 1
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/23275626
downvote count: 0
has body: i managed to resolve the issue,The issue was that i had conflicting package names in my web app and the external jar. And the context component scan was giving the problem.

http://stackoverflow.com/a/45701139
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/23139331
type: Answer
has body: It can be done in a FAT jar. Your own answer stating it's not possible has a link to a page that shows it's possible! It's not that insane of a solution. Here's a slightly modified version: private List&lt;String&gt; getResourceFiles(String path) throws IOException { List&lt;String&gt; files = new ArrayList&lt;&gt;(); ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); URL dirURL = classLoader.getResource(path); if (dirURL.getProtocol().equals("jar")) { String jarPath = dirURL.getPath().substring(5, dirURL.getPath().indexOf("!")); try (final JarFile jar = new JarFile(URLDecoder.decode(jarPath, "UTF-8"))) { Enumeration&lt;JarEntry&gt; entries = jar.entries(); while (entries.hasMoreElements()) { String name = entries.nextElement().getName(); if (name.startsWith(path + "/") &amp;&amp; !name.endsWith("/")) { files.add(name); } } } return files; } // return some other way when not a JAR } This version will return the full resource path of any file under the given resource path, recursively. For example, an input of config/rest would return files under that resource folder as: config/rest/options.properties config/rest/samples/data.json With those values, one can get the resource with ClassLoader::getResource, or get the contents of the resource with ClassLoader::getResourceAsStream.
downvote count: 0

http://stackoverflow.com/a/23252548
downvote count: 0
score: 1
has body: To not use Box or GridBag, I think a combination such as this may work out: Have main panel (let's call it A) have a BorderLayout Create another panel (let's call it B), with a FlowLayout, with constructor aligning components to the center Create another panel (let's call it C), with a GridLayout, 1 column 3 rows Add each button to a new JPanel with a FlowLayout (1 JPanel per button, so buttons are wrapped by a FlowLayout), and then add each of those JPanels to C Add C to B Add B to A (center position) I think this should cause buttons to be on top of each other with small amount of padding while not being stretched widthwise and while appearing in the center of the screen.
answers question: http://stackoverflow.com/q/23252229
upvote count: 1
type: Answer

http://stackoverflow.com/a/23230968
answers question: http://stackoverflow.com/q/23230600
type: Answer
has body: Probably the TextView planetNameValue is null because R.id.dataview1 does not exist in the layout fragment_main.
score: 0

http://stackoverflow.com/comment/35548286
has text: I "think" the problem is because the `JFrame` has "stuff" already on it which is preventing the whatever is been painted to the `BufferStrategy` from been made visible. Can you explain why you need to use `BufferStrategy` to do this...Also, the `pixels` array is not a "live" copy of the pixel data, meaning that modifying won't change the underlying image...some more information about what you are actually trying to achieve might allow us to provide other solutions for you
comment on: http://stackoverflow.com/q/23234306
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23183787
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35462840
answers question: http://stackoverflow.com/q/23183344
has body: Assuming you are using two sets of Points gained from the mousePressed and the mouseDragged MouseEvent, Here something to consider. Break it down into smaller pieces. Look at it in terms of quadrants (The O in the center being the initial Point gathered from the mousePressed Quadrants +--------------+---------------+ | | | | | | | I | II | | | | | | | +--------------O---------------+ | | | | | | | IV | III | | | | | | | +--------------+---------------+ When you drag the mouse, the second Point obtained from the mouseDragged will be either in quadrant I, II, III, or IV. So again I'll say.. Break it down into smaller pieces. How would you draw the rectangle if the the second point is in quadrant I? Point 2 would then become the initial point to draw from. So you would have to switch the drawing points using // original setRect(p1.x, p1.y, p2.x - p1.x, p2.y - p1.y); // change to setRect(p2.x, p2.y, p1.x - p2.x, p1.y - p2.y); You can use logic to check which quadrant point is in, such as public boolean isPointTwoInQuadOne(Point p1, Point p2) { return p1.x &gt;= p2.x &amp;&amp; p1.y &gt;= p2.y; } Hope that helps you out, or at least helps you see the problem from a different perspective :) Here's a running example. I figured out the quadrant I for you, and you seem to already know the quadrant III, so I'll leave it to you, to figure II and IV ;-) import java.awt.Dimension; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Point; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.awt.event.MouseMotionAdapter; import java.awt.geom.Rectangle2D; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.SwingUtilities; public class RectangleDrawWithDrag extends JPanel{ private static final int D_W = 500; private static final int D_H = 500; private Point p1; private Point p2; private Rectangle2D rectangle; public RectangleDrawWithDrag() { addMouseListener(new MouseAdapter(){ public void mousePressed(MouseEvent e…
type: Answer
score: 5
upvote count: 5
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23183344

http://stackoverflow.com/comment/35703817
type: Comment
comment on: http://stackoverflow.com/a/23316723
type: AnswerComment
score: 0
has text: everything looks great, thank you so much! but in the main menu, section 2 stops working? Was working before?

http://stackoverflow.com/q/23278604
type: Question
upvote count: 4
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/35629351
has comment: http://stackoverflow.com/comment/35629736
tagged with: android
tagged with: access-control
has answer: http://stackoverflow.com/a/23278839
accepted answer: http://stackoverflow.com/a/23278839
has comment: http://stackoverflow.com/comment/35629382
has title: Why can I not instantiate LocationManager class?
has body: I am trying to do some work with LocationManager class and saw that I cannot instantiate it. It is not an abstract class and I was under the impression that only classes marked as abstract could not be instantiated.
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/17035271
tagged with: java
downvote count: 5
score: -1
has comment: http://stackoverflow.com/comment/35629424
has comment: http://stackoverflow.com/comment/35629305

http://stackoverflow.com/comment/35767486
has text: I tried moving the class to the folder but Eclipse will not let me do that
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23354000

http://stackoverflow.com/comment/35611060
has text: by providing any file path statically and store programetically using google api and java
comment on: http://stackoverflow.com/q/23268779
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35539699
comment on: http://stackoverflow.com/q/23229204
has text: I changed the .toString in the mapper to line.toString which is what I had before. I ran with both and ended up with the same output.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35553232
type: QuestionComment
comment on: http://stackoverflow.com/q/23236592
has text: its already being put on classpath
score: 0
type: Comment

http://stackoverflow.com/comment/35544202
type: AnswerComment
comment on: http://stackoverflow.com/a/23232029
score: 0
type: Comment
has text: Downvoted for spoonfeeding without explaining the issue at hand

http://stackoverflow.com/q/23238397
favorite count: 0
has title: Retrofit "java.net.ProtocolException: Unexpected status line", Anyone?
tagged with: retrofit
tagged with: android
has answer: http://stackoverflow.com/a/36767593
has comment: http://stackoverflow.com/comment/35555993
tagged with: okhttp
answer count: 4
has answer: http://stackoverflow.com/a/24303115
has comment: http://stackoverflow.com/comment/35555673
has comment: http://stackoverflow.com/comment/35555831
score: 13
has answer: http://stackoverflow.com/a/36493143
type: Question
has answer: http://stackoverflow.com/a/23244575
accepted answer: http://stackoverflow.com/a/23244575
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/35556057
has comment: http://stackoverflow.com/comment/35555270
downvote count: 0
has body: My Android app crashed with the following stack trace, but when I try it from a desktop rest client it works well. Does anyone know what the problem might be? 04-23 16:00:50.449 27917-27983/com.iproperty.android.apps.irealtor D/Ireal_IrealtorClient﹕ ---&gt; HTTP GET http://beta2.irealtor.api.iproperty.com.my/Listing?pageSize=10000&amp;orderby=1&amp;order=-1 04-23 16:00:50.449 27917-27983/com.iproperty.android.apps.irealtor D/Ireal_IrealtorClient﹕ If-Modified-Since: 1398235278243 04-23 16:00:50.449 27917-27983/com.iproperty.android.apps.irealtor D/Ireal_IrealtorClient﹕ User-Agent: Android/0.0.20 04-23 16:00:50.449 27917-27983/com.iproperty.android.apps.irealtor D/Ireal_IrealtorClient﹕ Accept: application/json 04-23 16:00:50.449 27917-27983/com.iproperty.android.apps.irealtor D/Ireal_IrealtorClient﹕ Authorization: WFdSeW8vOTJ1Z3BoQlBJMk53VGpaekZRY2pCd1pYSlVXUT090 04-23 16:00:50.449 27917-27983/com.iproperty.android.apps.irealtor D/Ireal_IrealtorClient﹕ ---&gt; END HTTP (0-byte body) 04-23 16:00:50.549 27917-27983/com.iproperty.android.apps.irealtor D/Ireal_IrealtorClient﹕ ---- ERROR http://beta2.irealtor.api.iproperty.com.my/Listing?pageSize=10000&amp;orderby=1&amp;order=-1 04-23 16:00:50.549 27917-27983/com.iproperty.android.apps.irealtor D/Ireal_IrealtorClient﹕ java.net.ProtocolException: Unexpected status line: {"Data":[],"CustomStatusCode":200,"Status":"success"}HTTP/1.1 200 OK at com.squareup.okhttp.internal.http.StatusLine.&lt;init&gt;(StatusLine.java:38) at com.squareup.okhttp.internal.http.HttpConnection.readResponse(HttpConnection.java:150) at com.squareup.okhttp.internal.http.HttpTransport.readResponseHeaders(HttpTransport.java:99) at com.squareup.okhttp.internal.http.HttpEngine.readResponse(HttpEngine.java:595) at com.squareup.okhttp.internal.http.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:381) at com.squareup.okhttp.internal.http.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:328) at com.squareup.okhttp.internal.http.HttpURLConn…
upvote count: 13
possible better answer: http://stackoverflow.com/a/36493143

http://stackoverflow.com/comment/35385531
has text: Your button will not detect any click. The entire layout is rendered as a single image. You can only give listener for the entire info window!
type: Comment
comment on: http://stackoverflow.com/a/23140412
score: 0
type: AnswerComment

http://stackoverflow.com/q/23175689
has comment: http://stackoverflow.com/comment/35444087
type: UnansweredQuestion
type: Question
has comment: http://stackoverflow.com/comment/35444246
tagged with: java
has answer: http://stackoverflow.com/a/23444548
tagged with: aop
tagged with: aspectj
has title: aspectj - stackoverflowerror when accessing thisJoinPoint.getTarget()
answer count: 1
has comment: http://stackoverflow.com/comment/35443976
score: 0
has body: I am trying to advise a large 3rd party application with the following pointcut/advice to intercept all field accesses: before(Object target): get(* *) &amp;&amp; target(target) &amp;&amp; !within(aspect) { logger.debug("Pointcut: " + thisJoinPoint); logger.debug("Target: " + target); } For most field accesses this works fine, however for a particular access the second debug line causes a StackOverflowError and the method that contains the field appears to be repeatedly executed up to the line of the field access. If I remove the second debug line the problem goes away - so it seems that using thisJoinPoint.getTarget() is causing the problem. The same issue occurs for getThis(), however not for thisJoinPoint.getSourceLocation() or thisJoinPoint.getSignature()

http://stackoverflow.com/comment/35471034
comment on: http://stackoverflow.com/a/23186802
type: Comment
score: 0
has text: read edit in my original question for more info, im updating as i go along
type: AnswerComment

variables
tag name: variables
tags question: http://stackoverflow.com/q/23264006
tags question: http://stackoverflow.com/q/23281145
tags question: http://stackoverflow.com/q/23246803
tags question: http://stackoverflow.com/q/23134472
type: Tag
tags question: http://stackoverflow.com/q/23250334
tags question: http://stackoverflow.com/q/23147941
tags question: http://stackoverflow.com/q/23193121
tags question: http://stackoverflow.com/q/23232767
tags question: http://stackoverflow.com/q/23183062
tags question: http://stackoverflow.com/q/23190624
tags question: http://stackoverflow.com/q/23265005
tags question: http://stackoverflow.com/q/23233875
tags question: http://stackoverflow.com/q/23221447
tags question: http://stackoverflow.com/q/23160622
tags question: http://stackoverflow.com/q/23194084
tags question: http://stackoverflow.com/q/23178238

http://stackoverflow.com/a/34912908
type: Answer
has body: Instead of getHeight() and getWidth() you may resort to getDxaGoal(), resp. getDyaGoal(). These represent the original size of the image prior to scaling / cropping in twips. You can then multiply this with getVerticalScalingFactor() / 1000.0 resp. getHorizontalScalingFactor() / 1000.0 to get the final (rendered) size. Division by 1000.0 is necessary because those scaling factors are given per mille.
answers question: http://stackoverflow.com/q/23218590
score: 0

http://stackoverflow.com/q/23226485
has body: I have 1 to M association with Country and Person. Meaning a Country can have multiple persons. The country.hbm.xml fils is shown below: <?xml version="1.0"?> <one-to-many class="com.test.hibernate.Person"/> The Person.hbm.xml is shown below <?xml version="1.0"?> Now, I am trying to query all the persons who are males belonging to India Country Criteria countryCriteria = session.createCriteria(Country.class); Criterion country = Restrictions.eq("countryName", "India"); Criterion male = Restrictions.eq("persons.gender", "M"); countryCriteria.add(country); countryCriteria.add(male); List<Country> countryList = countryCriteria.list(); I am getting a Exception in thread "main" org.hibernate.QueryException: could not resolve property: persons.gender of: com.test.hibernate.Country at org.hibernate.persister.entity.AbstractPropertyMapping.propertyException(AbstractPropertyMapping.java:83) at org.hibernate.persister.entity.AbstractPropertyMapping.toColumns(AbstractPropertyMapping.java:98) at org.hibernate.persister.entity.BasicEntityPropertyMapping.toColumns(BasicEntityPropertyMapping.java:61) at org.hibernate.persister.entity.AbstractEntityPersister.toColumns(AbstractEntityPersister.java:1960) at org.hibernate.loader.criteria.CriteriaQueryTranslator.getColumns(CriteriaQueryTranslator.java:523) at org.hibernate.loader.criteria.CriteriaQueryTranslator.findColumns(CriteriaQueryTranslator.java:538) at org.hibernate.criterion.SimpleExpression.toSqlString(SimpleExpression.java:66) at org.hibernate.loader.criteria.CriteriaQueryTranslator.getWhereCondition(CriteriaQueryTranslator.java:419) at org.hibernate.loader.criteria.CriteriaJoinWalker.(CriteriaJoinWalker.java:123) at org.hibernate.loader.criteria.CriteriaJoinWalker.(CriteriaJoinWalker.java:92) at org.hibernate.loader.criteria.CriteriaLoader.(CriteriaLoader.java:95) at org.hibernate.internal.SessionImpl.list(SessionImpl.java:1643) at org.hibernate.internal.CriteriaImpl.list(CriteriaImpl.java:374) at com.test.hibernate.Main.ma…
answer count: 2
tagged with: sql
has answer: http://stackoverflow.com/a/23255711
possible better answer: http://stackoverflow.com/a/23226651
has answer: http://stackoverflow.com/a/23226651
has title: Hibernate 1 to M restriction on children
type: AnsweredQuestion
score: 0
accepted answer: http://stackoverflow.com/a/23255711
type: Question
tagged with: java
tagged with: hibernate

http://stackoverflow.com/q/23270093
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question
has body: Does anyone have experience developing and maintaining APIs that support both XML and JSON? I'm looking for some clues on how to implement request validation for both XML and JSON. Background: We have a java based application exposing RESTful API. It accepts xml requests which get validated against xml schema and then unmarshaled to DTO objects using JAXB. All works nicely but recently we've got a requirement to support JSON as well. Now, we could continue validating xml against xml schema and use json-schema for json. The json-schema spec (https://datatracker.ietf.org/doc/html/draft-zyp-json-schema-04) is still a draft (and already expired one!) but has already some pretty mature looking implementation in java: https://github.com/fge/json-schema-validator. The obvious drawback is that we'd forced to maintain two schemas (xsd and json-schema) which is a bit of a pain. The other option would be to first unmarshall/deserialise request to dto and use something like hibernate validator on annotated dto classes. The advantage would be that we'd have same validation rules for both xml and json in one place. However the validation would be less robust/reliable because we'd create objects before checking the request. At the moment I'm inclined to choose the option 1 and sacrifice maintainability for robustness. Are there any other possible solutions? Many thanks.
has title: RESTful API in both XML and JSON - best approach to request validation?
has comment: http://stackoverflow.com/comment/35613788
tagged with: api
has comment: http://stackoverflow.com/comment/35613457
downvote count: 0
has comment: http://stackoverflow.com/comment/35614135
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/35614789
has comment: http://stackoverflow.com/comment/35613213
tagged with: rest
type: UnansweredQuestion
score: 2
answer count: 0
upvote count: 2

http://stackoverflow.com/comment/35552481
type: AnswerComment
score: 0
type: Comment
has text: 1: You misspelled my name. ;-) 2: OP is already using a `"Content-Disposition"` header.
comment on: http://stackoverflow.com/a/23236852

http://stackoverflow.com/q/23165813
tagged with: java
has comment: http://stackoverflow.com/comment/35426957
has title: Getting value from one activity to another class
has answer: http://stackoverflow.com/a/23166282
type: Question
has body: can anyone guide me to the right direction, as the situation is have two classes calssA with Activity while classB is simple java class 1.classA has a editbox where the user inputs some value. 2.classB has a method that computes the user input. need to get the user input value from classA to classB. a).cannot get it through passing intent as the other class does not have activity. b).have tried getter setter method by creating a class thus,calling setter where the user inputs the detail. and calling the getter in another class. Still the value is null, so what apparently is missing here.Any guidance to a example or brief explanation would be great.Thanks
downvote count: 0
possible better answer: http://stackoverflow.com/a/23166282
has comment: http://stackoverflow.com/comment/35426844
favorite count: 0
has answer: http://stackoverflow.com/a/23166016
tagged with: android
answer count: 4
has answer: http://stackoverflow.com/a/23166237
has comment: http://stackoverflow.com/comment/35426825
has answer: http://stackoverflow.com/a/23166611
linked to: http://stackoverflow.com/q/3624280
score: 1
has comment: http://stackoverflow.com/comment/35426782
upvote count: 1
tagged with: android-intent
accepted answer: http://stackoverflow.com/a/23166016
has comment: http://stackoverflow.com/comment/35426826
type: AnsweredQuestion

http://stackoverflow.com/comment/35565200
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23242519
has text: remove ? from the url & try

http://stackoverflow.com/q/23280562
type: Question
has title: Regex doesnt work, how should it be formulated?
score: 0
has answer: http://stackoverflow.com/a/23280597
answer count: 3
tagged with: string
has body: I Want to know if a String consists only of the same character except at the last index, it can be any other possible character except the character that's leading. For Example: "FFFFFFFl" matches the pattern, but "FlFFFF" not. If the String is only one Character, it should output false. I have this code, but actually it's not working: String dance = "FFFFFl"; Pattern p = Pattern.compile(dance.charAt(0) + "{" + (dance.length()-1) + "}\\w^" + dance.charAt(0)); Matcher m = p.matcher(dance); System.out.println(m.matches()); This outputs "false" even though it should be true. I would really appreciate your help!
has comment: http://stackoverflow.com/comment/35633395
tagged with: regex
accepted answer: http://stackoverflow.com/a/23280597
has comment: http://stackoverflow.com/comment/35633640
has answer: http://stackoverflow.com/a/23280649
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23280611
tagged with: java
possible better answer: http://stackoverflow.com/a/23280611

http://stackoverflow.com/a/23228579
has comment: http://stackoverflow.com/comment/35569101
has body: I'm not familiar with com4j, but Point.GetCoordinates is a restricted method: . The solution to this problem in VB is you need to create a new variant and set it equal to p3. Then, call GetCoordinates from the variant's context. Intellisense will not work well on the variant, but the call to GetCoordinates will work. In VB the code would look something like this: ... Dim p3 As Variant Dim arrayOfCoord(2) As Variant Set p3 = hybridShapePointCoord1 'set variant = strongly typed point object p3.GetCoordinates arrayOfCoord ... In your case, non-VB, your code might look like this ... Object p3Obj; //used in vb:Variant p3Var; p3Obj = p3; p3Obj.GetCoordinates(tab);//Intellisense will not work, but the call to this method should ... Let me know if this works.
has comment: http://stackoverflow.com/comment/35570877
score: 0
has comment: http://stackoverflow.com/comment/35571810
has comment: http://stackoverflow.com/comment/35571464
type: Answer
has comment: http://stackoverflow.com/comment/35557085
has comment: http://stackoverflow.com/comment/35570654
answers question: http://stackoverflow.com/q/23222526
has comment: http://stackoverflow.com/comment/35987212
has comment: http://stackoverflow.com/comment/35570253
has comment: http://stackoverflow.com/comment/35570631

http://stackoverflow.com/q/23248539
has comment: http://stackoverflow.com/comment/35573470
has comment: http://stackoverflow.com/comment/35573471
has body: i have the following code: public List&lt;String&gt; processMap(Map&lt;String, String&gt; aMap) { Cloner cloner = new Cloner(); Map&lt;String, String&gt; tempMap = cloner.deepClone(aMap); while(!tempMap.isEmpty()) { Iterator&lt;Entry&lt;String, String&gt;&gt; iterator = tempMap.entrySet().iterator(); while(iterator.hasNext()) { Entry&lt;String, String&gt; entry = iterator.next(); // !!! } } return null; } To deep copy the map i use this library: Cloner I marked the line where i unfortunately get a ava.util.ConcurrentModificationException with '!!!' Can you please tell me why i get this exception? The complete code: Cloner cloner = new Cloner(); Map&lt;String, FreebaseType&gt; tempFreebaseTypes = new HashMap&lt;String, FreebaseType&gt;(); Map&lt;String, FreebaseType&gt; freebaseTypesCopy = cloner.deepClone(freebaseTypes); while(!freebaseTypesCopy.isEmpty()) { Iterator&lt;Entry&lt;String, FreebaseType&gt;&gt; iterator = freebaseTypesCopy.entrySet().iterator(); while(iterator.hasNext()) { Entry&lt;String, FreebaseType&gt; entry = iterator.next(); if(tempFreebaseTypes.containsKey(entry.getValue().getSuperType()) || entry.getValue().getSuperType() == null) { tempFreebaseTypes.put(entry.getValue().getType(), entry.getValue()); freebaseTypesCopy.remove(entry.getKey()); } } } List&lt;FreebaseType&gt; sortedFreebaseTypes = new ArrayList&lt;FreebaseType&gt;(); Iterator&lt;Entry&lt;String, FreebaseType&gt;&gt; iterator = tempFreebaseTypes.entrySet().iterator(); while(iterator.hasNext()) { Entry&lt;String, FreebaseType&gt; entry = iterator.next(); sortedFreebaseTypes.add(entry.getValue()); } return sortedFreebaseTypes;
has title: HashMap java.util.ConcurrentModificationException
answer count: 1
accepted answer: http://stackoverflow.com/a/23248840
downvote count: 0
has comment: http://stackoverflow.com/comment/35573533
favorite count: 0
has comment: http://stackoverflow.com/comment/35573615
has comment: http://stackoverflow.com/comment/35573583
has comment: http://stackoverflow.com/comment/35573601
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35573683
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/35573905
upvote count: 1
has comment: http://stackoverflow.com/comment/35573707
has answer: http://stackoverflow.com/a/23248840
has comment: http://stackoverflow.com/comment/35573304
type: Question
has comment: http://stackoverflow.com/comment/35573664
has comment: http://stackoverflow.com/comment/35573538
has comment: http://stackoverflow.com/comment/35573495
has comment: http://stackoverflow.com/comment/35573404
has comment: http://stackoverflow.com/comment/35573643

http://stackoverflow.com/a/23185157
score: 0
answers question: http://stackoverflow.com/q/23185116
type: Answer
has body: or if you wanna keep the value of num1 just get rid of the num1 in for. like this: for(;num2==0;num2--)

http://stackoverflow.com/q/23252434
tagged with: java
has comment: http://stackoverflow.com/comment/35581099
has answer: http://stackoverflow.com/a/23253933
type: Question
has body: I have a question about printing a long value with the toString method. My code is: public class LinkedLargeInteger { private class Node { private int data; private long dat; private Node next; private Node(int data, Node next) { this.data = data; this.next = next; } private Node(int data) { this(data, null); } private Node() { data = 0; next = null; } private Node(long dat, Node next) { this.dat = dat; this.next = next; } private Node(long dat) { this(dat, null); } } private Node head; private Node tail; private int size; private String largeString; private int largeInt; private long largeLong; public LinkedLargeInteger(long largeLong) { String s = Long.toString(largeLong); head = new Node(); tail = head; size = 0; for (int i = 0; i &lt; s.length(); i++) { tail.next = new Node(Long.parseLong(s), null); tail = tail.next; size++; } } @Override public String toString() { StringBuilder builder = new StringBuilder(); Node current = head.next; for (int i = 0; i &lt; this.size; i++) { builder.append(i + 1); current = current.next; } return builder.toString(); } public static void main(String[] args) { LinkedLargeInteger numLong = new LinkedLargeInteger(100000000000L); System.out.println(numLong); } } I have implemented a linked list with my Node class and want to print out a long value with my constructor. When I print a long value out in main, it gives my an entirely different number than what I entered as an argument. Does someone have any idea what my problem could be?
tagged with: long-integer
has title: Printing Long values with toString in Java
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/23253933
has comment: http://stackoverflow.com/comment/35580498
has comment: http://stackoverflow.com/comment/35580930
has comment: http://stackoverflow.com/comment/35580501
has comment: http://stackoverflow.com/comment/35580538
tagged with: tostring
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35581052

http://stackoverflow.com/q/23275494
has body: I'm trying to write an applet that switches between cards using CardLayout, but the app is not showing anything at all and I can't figure out what's wrong. A little help would be much appreciated :) import javax.swing.*; import java.awt.*; public class TEST extends JApplet{ @Override public void init(){ } @Override public void start(){ JPanel cards = new JPanel(new CardLayout()); JPanel main = new JPanel(); main.setLayout(new GridLayout(3, 1, 2, 2)); JTextField jtfEmail = new JTextField("E-mail", 10); main.add(jtfEmail); JTextField jtfPassword = new JPasswordField("Password", 10); main.add(jtfPassword); JPanel buttons = new JPanel(); JButton jbtLogin = new JButton("Login"); buttons.add(jbtLogin); JButton jbtRegister = new JButton("Register"); buttons.add(jbtRegister); main.add(buttons); cards.add(main, "Main"); CardLayout cardLayout = (CardLayout) cards.getLayout(); cardLayout.show(cards, "Main"); } }
score: 0
has title: CardLayout in Applet not showing
type: UnansweredQuestion
tagged with: swing
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/35639301
has answer: http://stackoverflow.com/a/23275536
tagged with: cardlayout
has comment: http://stackoverflow.com/comment/35639318
answer count: 1
tagged with: layout-manager
tagged with: applet

http://stackoverflow.com/comment/35604798
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23265444
has text: can you give the specific strings it is failing against?
score: 0

http://stackoverflow.com/comment/56096223
has text: Delete tmp0 folder inside workspace at : workspace\.metadata\.plugins\org.eclipse.wst.server.core\ work well. Thank you !
comment on: http://stackoverflow.com/a/27300208
score: 1
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/35497390
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23205348
type: Comment
has text: I thought if I try all permutations, the time complexity is n!. Correct me if I am wrong

http://stackoverflow.com/comment/35520419
score: 0
type: Comment
type: QuestionComment
has text: Check this other stackoverflow [answer](http://stackoverflow.com/questions/9850594/why-handler-timer-only-run-once).
comment on: http://stackoverflow.com/q/23219045

http://stackoverflow.com/a/33058018
answers question: http://stackoverflow.com/q/23146052
type: Answer
has body: Try this: public class MainActivity extends Activity { TextView PA; TextView Interest_Rate; TextView Years; EditText PA_bar; EditText IR_bar; EditText year_bar; Button calculate; TextView t1; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); PA = (TextView) findViewById(R.id.PA); Interest_Rate = (TextView) findViewById(R.id.Interest_Rate); Years = (TextView) findViewById(R.id.Years); PA_bar = (EditText) findViewById(R.id.PA_bar); IR_bar = (EditText) findViewById(R.id.IR_bar); year_bar = (EditText) findViewById(R.id.year_bar); calculate = (Button) findViewById(R.id.calculate); t1 = (TextView) findViewById(R.id.t1); calculate.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { int num1 = Integer.parseInt(PA_bar.getText().toString()); int num2 = Integer.parseInt(IR_bar.getText().toString()); int num = Integer.parseInt(year_bar.getText().toString()); int si = (num1 * num2 * num) / 100; t1.setText(Integer.toString(si)); } }); }};
score: 2
downvote count: 0
upvote count: 2

http://stackoverflow.com/comment/35431269
has text: at com.classes.ConcatenateStub.concatenateString(ConcatenateStub.java:185) at com.classes.ClientCall.main(ClientCall.java:20)
comment on: http://stackoverflow.com/q/23168402
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23172249
type: Answer
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/23172196
has body: It's not in javadoc because it's not a method you call - it's part of the syntax of the language. It's a class literal, which is described in the Java Language Specification section 15.8.2: A class literal is an expression consisting of the name of a class, interface, array, or primitive type, or the pseudo-type void, followed by a '.' and the token class. The type of C.class, where C is the name of a class, interface, or array type (§4.3), is Class&lt;C&gt;. The type of p.class, where p is the name of a primitive type (§4.2), is Class&lt;B&gt;, where B is the type of an expression of type p after boxing conversion (§5.1.7). The type of void.class (§8.4.5) is Class&lt;Void&gt;.
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23172196

http://stackoverflow.com/comment/35468747
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23189677
has text: Edit the question and show what `sql` looks like after the variable substitution.
score: 2

http://stackoverflow.com/a/31921498
downvote count: 0
has body: I had the same issue, the compilation result was depending on order files were compiled. And I could not deploy the application. I can't explain why, but I solve it removing the use of finder in views. There is an example of what to do, try to replace in view : index.scala.html @for(dealer &lt;- Dealership.find.all()) { ... } with @(dealerships: List[Dealership]) ... @for(dealer &lt;- dealerships) { ... } and add in your controller : public class Dealerships extends Controller { public Result index() { return ok (index.render (Dealership.find.all())); } }
type: Answer
answers question: http://stackoverflow.com/q/23190566
upvote count: 1
score: 1

http://stackoverflow.com/comment/35476150
comment on: http://stackoverflow.com/q/23194207
has text: Have you tried to clean the project?
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/comment/35595495
type: QuestionComment
type: Comment
score: 1
has text: `gameObjects` may be `null` because `update` has't been called yet...
comment on: http://stackoverflow.com/q/23253544

http://stackoverflow.com/comment/35405367
type: AnswerComment
score: 0
type: Comment
has text: Yes that is double linked list implementation. I am looking for singly linked list.
comment on: http://stackoverflow.com/a/23154104

http://stackoverflow.com/a/36493817
downvote count: 0
score: 33
answers question: http://stackoverflow.com/q/23218102
has body: This is a very misleading error, and may root from different causes, for me I was setting a parameter that it was supposedly a number but at runtime it was setting null, hence it was binary. On a separate occasion got this error due to bean creation error in spring and was not setting the parameter correctly as well.
type: Answer
upvote count: 33

http://stackoverflow.com/comment/43298046
has text: For integration testing, if you want to having application.yml file in test/resources and if you want to override only few attributes other than /java/resources how can you do that
comment on: http://stackoverflow.com/a/23135183
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/23236717
has answer: http://stackoverflow.com/a/23236945
tagged with: java
has comment: http://stackoverflow.com/comment/35559772
has comment: http://stackoverflow.com/comment/35552303
has comment: http://stackoverflow.com/comment/35552446
tagged with: listviewitem
tagged with: listview
answer count: 2
has comment: http://stackoverflow.com/comment/35579771
has comment: http://stackoverflow.com/comment/35552571
has comment: http://stackoverflow.com/comment/35554406
has comment: http://stackoverflow.com/comment/35552358
has body: This seems to be a problem that is encountered often, but couldn't find a solution for my situation among those that are offered. So I have an Activity that extends a ListActivity and the following code within it: super.onCreate(savedInstanceState); db = SQLiteDatabase.openDatabase(playersDatabaseName, null, SQLiteDatabase.CREATE_IF_NECESSARY | SQLiteDatabase.OPEN_READWRITE); SQLStatement = "create table if not exists Players_And_Scores(_id integer primary key autoincrement, Player String, Score String);"; db.execSQL(SQLStatement); cv.put("Player", WelcomeActivity.playersName); cv.put("Score", GameActivity.currentScore); try { db.insertOrThrow("Players_And_Scores", null, cv); } catch (Exception e) { Log.i("SQLiteException", cv.toString() + " is there already"); } c = db.query("Players_And_Scores", null, null, null, null, null, null, null); SimpleCursorAdapter adapter = new SimpleCursorAdapter(getApplicationContext(), android.R.layout.simple_list_item_1, c, new String[] {"Player", "Score"}, new int[] {android.R.id.text1}, 0); this.setListAdapter(adapter); This does set up a listview and every time the entry is added a new row is added into a database a new line is added to a listwiev. However all of the lines are empty. So it recognizes the number of lines, but not the contents. I was thinking if I should add something to xml so I've been playing with it without result. Here is what I have currently for xml: <?xml version="1.0" encoding="utf-8"?> <ListView android:id="@android:id/list" android:layout_width="fill_parent" android:layout_height="fill_parent"/> Any ideas would be greatly appreciated. EDIT here is the logcat: 04-23 03:05:16.083 3332-3332/statesgame.app D/dalvikvm﹕ Not late-enabling CheckJNI (already on) 04-23 03:05:16.193 3332-3332/statesgame.app I/can read﹕ true 04-23 03:05:16.193 3332-3332/statesgame.app I/this﹕ State Capital 04-23 03:05:16.193 3332-3332/statesgame.app I/this﹕ ---------------- --------------- 04-23 03:05:16.193 3332-3332/statesgame.app …
has answer: http://stackoverflow.com/a/23257943
has title: ListActivity Does Not Show Any Entries In The ListView
tagged with: android
has comment: http://stackoverflow.com/comment/35554001
has comment: http://stackoverflow.com/comment/35552614
score: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35554303
has comment: http://stackoverflow.com/comment/35552393
has comment: http://stackoverflow.com/comment/35554172
type: Question

http://stackoverflow.com/a/23188681
upvote count: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23188665
type: Answer
has comment: http://stackoverflow.com/comment/35467044
downvote count: 0
score: 1
has body: You're missing a getText() call in your method chaining. It needs to be input.getText().toString(). The clue is the logcat output: Invalid int: "android.widget.EditText{... That is definitely not your input. For number parsing, I'd recommend actually catching the Exception. That way any input that you might have forgotten to filter does not crash the program.
accepted answer of: http://stackoverflow.com/q/23188665

http://stackoverflow.com/a/23232398
type: Answer
has comment: http://stackoverflow.com/comment/35544823
has body: He meant that if you have two synchronized methods, they will be synchronized amongst each other and not just individually. This is because an object lock is held on the instance the method is called on. In other words, if you have two synchronized methods foo() and bar(), no thread can call bar() while another thread is calling foo(). This is easy to see if you write out the definition. The synchronized method public synchronized void foo() { stuff; } is equivalent to: public void foo() { synchronized(this) { stuff; } } For methods with no associated instance (i.e., static methods), a lock is held on the Class instance instead.
score: 7
answers question: http://stackoverflow.com/q/23232372
upvote count: 7
downvote count: 0

http://stackoverflow.com/q/23225797
has comment: http://stackoverflow.com/comment/35532578
tagged with: java
has body: 1 0 0 0 1 1 1 Have a text file that has to be read line by line to code below in the array, however it only stop at the first line. As in it gets the first ineger "1" and doesn't get to the rest of the integers, line by line String fileName = "input.txt"; File file = new File(fileName); Scanner scanner = new Scanner(file); // String s = ""; while(scanner.hasNextLine()){ data1 = scanner.nextLine(); } for ( int i = 0; i &lt; data1.length(); i++) { covertDataArray[i] = Byte.parseByte(data1.substring( i, i+1)); }
has comment: http://stackoverflow.com/comment/35532547
score: 0
has comment: http://stackoverflow.com/comment/35532577
possible better answer: http://stackoverflow.com/a/23225888
has answer: http://stackoverflow.com/a/23225881
accepted answer: http://stackoverflow.com/a/23225881
has comment: http://stackoverflow.com/comment/35532867
has answer: http://stackoverflow.com/a/23225877
has answer: http://stackoverflow.com/a/23225919
answer count: 4
has title: read Line by Line, in java feed in to an array
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23225888
type: Question

http://stackoverflow.com/a/23286677
upvote count: 3
has body: You will need to make sure the cur variable is initialized to something and change the following line to use != instead of == ! while (cur.link != null) { This will help with compiling @rpax did the heavy lifting.
type: Answer
score: 3
downvote count: 0
answers question: http://stackoverflow.com/q/23286539

http://stackoverflow.com/comment/35509806
has text: covert it from String to long value coming from textview via getText().toString() method.
comment on: http://stackoverflow.com/a/23212476
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/23183854
has comment: http://stackoverflow.com/comment/35518976
answers question: http://stackoverflow.com/q/23183429
score: 0
has comment: http://stackoverflow.com/comment/35521088
has comment: http://stackoverflow.com/comment/36779488
has comment: http://stackoverflow.com/comment/35462230
has comment: http://stackoverflow.com/comment/35782732
has comment: http://stackoverflow.com/comment/35460980
has comment: http://stackoverflow.com/comment/35457744
has comment: http://stackoverflow.com/comment/35686550
type: Answer
has comment: http://stackoverflow.com/comment/35476124
has body: Make sure you add your listener class correctly. The only other possible cause would be if the NOTIFY is unsolicited, which should not be the case but it happens. Try to enable this flag gov.nist.javax.sip.DELIVER_UNSOLICITED_NOTIFY. See more about it here https://jsip.ci.cloudbees.com/job/jsip/javadoc/gov/nist/javax/sip/SipStackImpl.html Otherwise you will need to attach DEBUG logs to figure it out, could be malformed request or something of the sort.
has comment: http://stackoverflow.com/comment/35515947
has comment: http://stackoverflow.com/comment/35688193
has comment: http://stackoverflow.com/comment/35540777
has comment: http://stackoverflow.com/comment/35733637
has comment: http://stackoverflow.com/comment/35834940

http://stackoverflow.com/q/23209872
has body: I have a problem. I have code for download and open file PDF. I want after download completed, PDF will open automatically. This is my code for download pdf file : private EditText ids; private TextView no; private TextView per; private EditText surat_fi; private EditText disp; private Button kepada, baca; Context context=this; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.suratmasuk); ids = (EditText) findViewById(R.id.edid); no = (TextView) findViewById(R.id.ednomor); per = (TextView) findViewById(R.id.edperihal); surat_fi = (EditText) findViewById(R.id.surat); disp = (EditText) findViewById(R.id.eddisposisi); ArrayList&lt;HashMap&lt;String, String&gt;&gt; mylist = new ArrayList&lt;HashMap&lt;String, String&gt;&gt;(); JSONObject json = JSONSuratMasuk.getJSONfromURL("http://link..."); try{ JSONArray data = json.getJSONArray("data"); for(int i=0;i&lt;data.length();i++){ HashMap&lt;String, String&gt; map = new HashMap&lt;String, String&gt;(); JSONObject jsonobj = data.getJSONObject(i); map.put("id1", jsonobj.getString("id")); map.put("nomor", jsonobj.getString("nosurat")); map.put("perihal", jsonobj.getString("perihal")); map.put("surat", jsonobj.getString("surat")); mylist.add(map); } }catch(JSONException e) { Log.e("log_tag", "Error parsing data "+e.toString()); } ListAdapter adapter = new SimpleAdapter(this, mylist , R.layout.row, new String[] { "nomor", "perihal" }, new int[] { R.id.lvnomor, R.id.lvperihal }); setListAdapter(adapter); final ListView lv = getListView(); lv.setTextFilterEnabled(true); lv.setOnItemClickListener(new OnItemClickListener() { public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) { @SuppressWarnings("unchecked") HashMap&lt;String, String&gt; o = (HashMap&lt;String, String&gt;) lv.getItemAtPosition(position); no.setText(String.valueOf(o.get("nomor"))); per.setText(String.valueOf(o.get("perihal"))); surat_fi.setText(String.valueOf(o.g…
tagged with: eclipse
has answer: http://stackoverflow.com/a/23210411
answer count: 3
score: 2
tagged with: http://stackoverflow.com/tag/pdf
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/40798334
type: UnansweredQuestion
tagged with: android
tagged with: android-download-manager
upvote count: 2
tagged with: java
has title: Open File PDF automatically After Download Completed
type: Question
has answer: http://stackoverflow.com/a/23213755

http://stackoverflow.com/a/23283131
has comment: http://stackoverflow.com/comment/43490130
has comment: http://stackoverflow.com/comment/42669155
has comment: http://stackoverflow.com/comment/38115061
accepted answer of: http://stackoverflow.com/q/23265112
has comment: http://stackoverflow.com/comment/35658481
has comment: http://stackoverflow.com/comment/38101544
type: Answer
answers question: http://stackoverflow.com/q/23265112
score: 23
has comment: http://stackoverflow.com/comment/38093532
has body: Android Studio is based on Intellij Idea 13. The solution here also applies. Just modifying Info.plist from 1.6* to 1.7* did it for me. Btw, I've observed that at least Android Studio 0.5.5 uses massive amounts of memory. With Java 8 it gets over 2GB for very simple projects. With Java 7 it is still bad, but takes around 1.5GB.
has comment: http://stackoverflow.com/comment/43270128
has comment: http://stackoverflow.com/comment/53692656
has comment: http://stackoverflow.com/comment/43501116
type: AcceptedAnswer
downvote count: 0
upvote count: 23

image
tags question: http://stackoverflow.com/q/23173186
tags question: http://stackoverflow.com/q/23210359
tags question: http://stackoverflow.com/q/23176030
tags question: http://stackoverflow.com/q/23169910
tags question: http://stackoverflow.com/q/23255734
tags question: http://stackoverflow.com/q/23241473
tags question: http://stackoverflow.com/q/23140554
tags question: http://stackoverflow.com/q/23274262
tags question: http://stackoverflow.com/q/23157987
tags question: http://stackoverflow.com/q/23280548
tags question: http://stackoverflow.com/q/23175188
tags question: http://stackoverflow.com/q/23225389
tags question: http://stackoverflow.com/q/23213390
tags question: http://stackoverflow.com/q/23154790
tags question: http://stackoverflow.com/q/23229602
tags question: http://stackoverflow.com/q/23225243
tags question: http://stackoverflow.com/q/23258988
tags question: http://stackoverflow.com/q/23162686
tags question: http://stackoverflow.com/q/23165512
tags question: http://stackoverflow.com/q/23149451
tags question: http://stackoverflow.com/q/23245977
tags question: http://stackoverflow.com/q/23180059
tags question: http://stackoverflow.com/q/23201348
tags question: http://stackoverflow.com/q/23190614
tag name: image
tags question: http://stackoverflow.com/q/23147224
tags question: http://stackoverflow.com/q/23265652
tags question: http://stackoverflow.com/q/23257844
tags question: http://stackoverflow.com/q/23177720
tags question: http://stackoverflow.com/q/23134293
tags question: http://stackoverflow.com/q/23147171
type: Tag
tags question: http://stackoverflow.com/q/23212703
tags question: http://stackoverflow.com/q/23183679
tags question: http://stackoverflow.com/q/23249114

http://stackoverflow.com/a/34767753
downvote count: 0
answers question: http://stackoverflow.com/q/23266794
type: Answer
has body: MainMapLookup.setMainArguments("key","value"); and get value from xml : ${main:key}
upvote count: 1
score: 1

http://stackoverflow.com/comment/35379722
comment on: http://stackoverflow.com/q/23139331
has text: `PathMatchingResourcePatternResolver` does have an overloaded constructor that accepts a `ClassLoader` if you can get `OneJar`'s.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23146492
answer count: 2
tagged with: arrays
has answer: http://stackoverflow.com/a/23146780
tagged with: arraylist
has title: An ArrayList of two dimensional arrays
has comment: http://stackoverflow.com/comment/35392852
has comment: http://stackoverflow.com/comment/35392841
type: UnansweredQuestion
has body: I am able to declare variables dataList and data as follows: ArrayList&lt;Double[][]&gt; dataList = new ArrayList&lt;Double[][]&gt;(); double [][] data = new double[2][]; but when I do something like dataList.add(data); I get an error saying The method add(Double[][]) in the type ArrayList&lt;Double[][]&gt; is not applicable for the arguments (double[][]) How can I add data to dataList?
has comment: http://stackoverflow.com/comment/35392788
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/23146519
has comment: http://stackoverflow.com/comment/35392885
score: 0

http://stackoverflow.com/a/23251033
has comment: http://stackoverflow.com/comment/35578396
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/35578785
has body: The following is a non-deprecated option: public class PopupPane extends PopupControl { public PopupPane() { HBox PopBase = new HBox(); PopBase.getChildren().addAll(Button1, Button2, Button3); this.getScene().setRoot(PopBase); } }
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23246722
type: Answer
answers question: http://stackoverflow.com/q/23246722

http://stackoverflow.com/q/23286568
downvote count: 0
tagged with: java
has title: Serializing Java DOM Document to XML: Add CData Elements
has answer: http://stackoverflow.com/a/23287281
tagged with: sax
has answer: http://stackoverflow.com/a/23289430
type: Question
tagged with: dom
upvote count: 2
has body: I am constructing an XML DOM Document with a SAX parser. I have written methods to handle the startCDATA and endCDATA methods and in the endCDATA method I construct a new CDATA section like this: public void onEndCData() { xmlStructure.cData = false; Document document = xmlStructure.xmlResult.document; Element element = (Element) xmlStructure.xmlResult.stack.peek(); CDATASection section = document.createCDATASection(xmlStructure.stack.peek().characters); element.appendChild(section); } When I serialize this to an XML file I use the following line to configure the transformer: transformer.setOutputProperty(OutputKeys.CDATA_SECTION_ELEMENTS, "con:setting"); Never the less no &lt;![CDATA[ tags appear in my XML file and instead all backets are escaped to &amp;gt; and &amp;lt;, this is no problem for other tools but it is a problem for humans who need to read the file as well. I am positive that the "con:setting" tag is the right one. So is there maybe a problem with the namespace prefix? Also this question indicates that it is not possible to omit the CDATA_SECTION_ELEMENTS property and generally serialize all CDATA nodes without escaping the data. Is that information correct, or are there maybe other methods that the author of the answer was not aware of? Update: It seems I had a mistake in my code. When using the document.createCDATASection() function, and then serializing the code with the Transformer it DOES output CDATA tags, even without the use of the CDATA_SECTION_ELEMENTS property in the transformer.
has answer: http://stackoverflow.com/a/23290369
answer count: 3
has comment: http://stackoverflow.com/comment/35651515
linked to: http://stackoverflow.com/q/13727161
has comment: http://stackoverflow.com/comment/35651221
favorite count: 0
possible better answer: http://stackoverflow.com/a/23289430
has comment: http://stackoverflow.com/comment/35651320
accepted answer: http://stackoverflow.com/a/23287281
tagged with: http://stackoverflow.com/tag/xml
score: 2
type: AnsweredQuestion

http://stackoverflow.com/q/23177004
tagged with: google-cloud-print
answer count: 3
tagged with: google-app-engine
has answer: http://stackoverflow.com/a/23183482
has body: I'm trying to submit a new print job to Google Cloud Print from an App Engine app (Java). In the Google Cloud Print settings for the printer, I set "can print" permissions to {{MY_APP_ID}}@appspot.gserviceaccount.com Then, from the App Engine app I run the following code- AppIdentityCredential credential = new AppIdentityCredential( Arrays.asList("https://www.googleapis.com/auth/cloudprint")); HttpRequestFactory requestFactory = new UrlFetchTransport().createRequestFactory(credential); Map<String, String> params = new LinkedHashMap<String, String>(); params.put("printerid", "{{PRINTER_ID}}"); params.put("title", "Title"); params.put("ticket", "{\"version\":\"1.0\", \"print\":{}}"); params.put("content", " \n \n \nHello world!\n \n "); params.put("contentType", "text/html"); HttpRequest httpRequest = requestFactory.buildPostRequest( new GenericUrl("https://www.google.com/cloudprint/submit"), new UrlEncodedContent(params)); HttpResponse httpResponse = httpRequest.execute(); try { System.out.println(httpResponse.parseAsString()); } finally { httpResponse.ignore(); } Google Cloud Print's API returns a response with success=false and message="User is not authorized." However, it seems that it does recognize the correct user as the response's users field is indeed ["{{MY_APP_ID}}@appspot.gserviceaccount.com"]. What am I doing wrong? Is there any way to have an App Engine app print to Google Cloud Print with the app's own permissions?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35454437
linked to: http://stackoverflow.com/q/19767752
has answer: http://stackoverflow.com/a/40987870
downvote count: 0
has answer: http://stackoverflow.com/a/55395252
score: 1
tagged with: java
favorite count: 0
type: Question
upvote count: 1
has title: Submitting a print job to Google Cloud Print from App Engine app

http://stackoverflow.com/q/23132935
score: 0
answer count: 1
has body: How to set Width for a Widget Spinner in GWT Spinner pageNumberSpinner = new Spinner(1, 99999, 1, 1); Please help me to set width to pageNumberSpinner.
tagged with: http://stackoverflow.com/tag/html
has comment: http://stackoverflow.com/comment/35367859
has comment: http://stackoverflow.com/comment/35368473
type: UnansweredQuestion
has title: How to set Width for a Widget Spinner in GWT
type: Question
tagged with: gwt
tagged with: java
has answer: http://stackoverflow.com/a/23133427

http://stackoverflow.com/a/24215320
answers question: http://stackoverflow.com/q/23145174
has body: Theres a few possiblities for implementing this. The simplest might be to just do it in javascript. You can intercept the form being submitted, check if the fields are empty and if they are, append the asterisk. If not, let the form be submitted. e.g add onsubmit to form &lt;form id="myform" onsubmit="return validateForm()"&gt; &lt;input type="text" id="myinput"&gt; ... Then using javascript and jquery : function validateForm() { if ($('input:text').is(":empty")) { $('input:text').after("&lt;span&gt;*&lt;/span&gt;"); return false; } return true; } The more robust way would be to implement server side validation aswell. If you're using spring mvc, theres loads of resources of how to do that.
downvote count: 0
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/comment/35579171
type: AnswerComment
has text: Thanks @Raffaele, it's sample code for practice. In the code not shown, I called shutdown() right after the for loop. Once I remove that, the code runs with no problem. So seems like the Exception was handled after the ExecutorService was shut down --isn't shutdown() expected to be effective after all tasks are done?
type: Comment
comment on: http://stackoverflow.com/a/23251587
score: 0

http://stackoverflow.com/comment/65622979
score: 0
type: Comment
type: QuestionComment
has text: This doesn't change the fact that it shouldn't redirect unless required.
comment on: http://stackoverflow.com/q/23258397

http://stackoverflow.com/a/26905326
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/23265698
has body: Thank you very much for the above code snippet. Its working for me with bouncycastle version 1.51 <bcprov-jdk15on-version>1.51</bcprov-jdk15on-version> org.bouncycastle bcprov-jdk15on ${bcprov-jdk15on-version} Many Thanks for your code snippet.
type: Answer
upvote count: 1

http://stackoverflow.com/comment/35618945
score: 0
has text: Could you post the stack trace of the exception you are getting?
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23273278

http://stackoverflow.com/a/23141946
upvote count: 4
has comment: http://stackoverflow.com/comment/35385276
downvote count: 0
has body: You may try something like WEKA OpenNLP Standford NLP I guess they are free for educational projects, better make sure license is not an issue for you. Edit: Adding few more (Credit goes to Arun A K) 4) LIBSVM (for SVM) 5) Apache Mahout 6) Java ML Library
score: 4
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23141910
accepted answer of: http://stackoverflow.com/q/23141910
type: Answer

http://stackoverflow.com/comment/35545616
type: Comment
has text: Not neccesarily, you want to use the push and pop mechanic. I could have {{{{ and it would pass if I just check dividing by two
comment on: http://stackoverflow.com/a/23232764
score: 0
type: AnswerComment

http://stackoverflow.com/comment/35604118
score: 1
comment on: http://stackoverflow.com/q/23265301
has text: Try to use wrappers for Arabic and English text-blocks. This wrappers can be something like tags (HTML) with align="left" and align="right" attributes. Don't use tabs.
type: QuestionComment
type: Comment

http://stackoverflow.com/a/23220484
score: 4
type: Answer
has comment: http://stackoverflow.com/comment/35525691
has body: To set parameters from Java, you have to put them in your params object. Map&lt;String, Object&gt; params = new HashMap&lt;String, Object&gt;(); params.put("paramName",value); JasperReport report = JasperCompileManager.compileReport("path\\to\\jrxml"); JasperPrint print = JasperFillManager.fillReport(report, params, new ItemData(keys)); and then use it in the report like $P{paramName}. Make sure, when you declare the parameter in the report to have the same name ('paramName') and that its class is the class of your value object. If you want to use IN clause, you will have to use built-in SQL Clause Functions provided by Jasper. The format is $X{IN, &lt;column_name&gt;, &lt;parameter_name&gt;} (make sure to use, in this case, just the name of the parameter, without $P). So, in your case, the query would be: SELECT * FROM StockInventory WHERE $X{IN,pk,paramName} 'paramName' parameter can be either a java.util.Collection instance or a java.util.List instance.
upvote count: 4
accepted answer of: http://stackoverflow.com/q/23204876
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23204876
downvote count: 0

http://stackoverflow.com/q/23285809
has body: This is not regarding any object or value being null.This is regarding some configuration issue which I am facing with the application. So it cannot be a possible duplicate of the question specified as duplicate. The issue I am facing is that while I am trying to make a simple example using JSF,Spring and hibernate. I am getting a null pointer exception when I make the hibernateDAO function call from the ExpenseForm class where I read all the variables from the jsf form. Below are my related code files.I am using Spring 3.0 and JSF 2.0 configurations. ExpenseBean: @Entity @Table(name = "Expenses") public class ExpenseBean implements Serializable { /** * */ private static final long serialVersionUID = 1L; private int food; private int travel; private int living; @Id @Column(name = "Food", nullable = false) public int getFood() { return food; } public void setFood(int food) { this.food = food; } @Column(name = "Travel", nullable = false) public int getTravel() { return travel; } public void setTravel(int travel) { this.travel = travel; } @Column(name = "Living", nullable = false) public int getLiving() { return living; } public void setLiving(int living) { this.living = living; } } ExpenseForm: public class ExpenseForm { private int food; private int travel; private int living; private ConfigureExpenseDAO configureExpenseDAO; public ConfigureExpenseDAO getConfigureExpenseDAO() { return configureExpenseDAO; } public void setConfigureExpenseDAO(ConfigureExpenseDAO configureExpenseDAO) { this.configureExpenseDAO = configureExpenseDAO; } public String addExpense() { ExpenseBean expense = new ExpenseBean(); System.out.println(food); expense.setFood(food); expense.setLiving(living); expense.setTravel(travel); System.out.println(expense.getFood() + expense.getLiving()); /*line 33*/ configureExpenseDAO.saveExpenseDetails(food, living, travel); return "index"; } public int getFood() { return food; } public void setFood(int food) { this.food = food; } public int getTravel() { r…
tagged with: jsf-2
accepted answer: http://stackoverflow.com/a/23286643
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35643573
possible better answer: http://stackoverflow.com/a/23286428
has answer: http://stackoverflow.com/a/23286428
favorite count: 0
type: Question
answer count: 2
tagged with: spring
score: -1
has comment: http://stackoverflow.com/comment/35643354
has comment: http://stackoverflow.com/comment/35644432
has title: Null pointer Exception on DAO call
tagged with: jsf
tagged with: java
tagged with: hibernate
downvote count: 2
upvote count: 1
linked to: http://stackoverflow.com/q/218384
has comment: http://stackoverflow.com/comment/35643110
has answer: http://stackoverflow.com/a/23286643
duplicate of: http://stackoverflow.com/q/218384
has comment: http://stackoverflow.com/comment/35643304

http://stackoverflow.com/q/23195979
answer count: 0
type: UnansweredQuestion
tagged with: encryption
has comment: http://stackoverflow.com/comment/35482380
upvote count: 1
has comment: http://stackoverflow.com/comment/35481079
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/35479882
type: Question
has comment: http://stackoverflow.com/comment/35479716
downvote count: 0
has body: I'm trying to write a function which encrypts\decrypts files using only cipher object, that is CipherInputStream are disallowed (homework problem). However after quite some time debugging I can't wrap my head around what's wrong. Encryption works as far as I can tell (encrypting using open-ssl and comparing sha1sums of my code and open-ssl output, but decryption works only for the first 16 bytes then gives wrong data leading to BadPaddingException at the ending. Code is divided into two function and one caller from main: private static void symetricKeyCriptographyHandler(final int opmode, final Path source, final Path destination) { try (InputStream in = new BufferedInputStream(Files.newInputStream(source), BUFFER_BLOCK_SIZE); OutputStream out = new BufferedOutputStream(Files.newOutputStream(destination), BUFFER_BLOCK_SIZE); BufferedReader scr = new BufferedReader(new InputStreamReader(System.in, StandardCharsets.UTF_8))) { Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding"); System.out .format("Please provide password as hex-encoded text (16 bytes, i.e. 32 hex-digits):%n&gt; "); byte[] key = hexToByte(scr.readLine().trim()); SecretKeySpec keySpec = new SecretKeySpec(key, "AES"); System.out .format("Please provide initialization vector as hex-encoded text (32 hex-digits):%n&gt; "); byte[] iv = hexToByte(scr.readLine().trim()); IvParameterSpec paramSpec = new IvParameterSpec(iv); // Writing out key and iv as debugging tools. Checks out as far as I can tell. for (byte b : key) { System.out.format("%02x", b); } System.out.println(); for (byte b : iv) { System.out.format("%02x", b); } System.out.println(); cipher.init(opmode, keySpec, paramSpec); processCryptedData(cipher, in, out); System.out.format("%s completed. Generated file %s based on file %s", opmode == Cipher.ENCRYPT_MODE ? "Encryption" : "Decription", destination.getFileName(), source.getFileName()); } catch (NoSuchAlgorithmException | NoSuchPaddingException e) { // Should never happen!!! e.printStackTr…
has comment: http://stackoverflow.com/comment/35481138
favorite count: 0
has comment: http://stackoverflow.com/comment/35481000
has comment: http://stackoverflow.com/comment/35480295
has title: Java Decryption problems using chiper update\update\doFinal
has comment: http://stackoverflow.com/comment/35484062
has comment: http://stackoverflow.com/comment/35481761
has comment: http://stackoverflow.com/comment/35479467

http://stackoverflow.com/comment/35463478
comment on: http://stackoverflow.com/q/23185250
score: 0
has text: If echoSocket is null then wich exception did you catch?
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35519888
comment on: http://stackoverflow.com/q/23218454
has text: Husman the example I have given is for understanding purpose, in reality there are various complicated operations I have to support. like to complicate the example If i want to search for user whose names starting with 'A' and ending with 'R' and belongs to either "US", "UK" , "CHINA", "JAPAN" and except date of birth in the range "01/05/1990" to "01/05/2008". I have to build the query from the form after user entering the criteria.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35619812
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23273715
has text: Then how about C++? It seems C++ can allocate a list on stack by doing "list<int> a;". And then it can perform any operation desired.

http://stackoverflow.com/comment/35650516
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23290118
type: Comment
has text: What do you mean by file concept ?

junit
tags question: http://stackoverflow.com/q/23139321
tags question: http://stackoverflow.com/q/23191032
type: Tag
tags question: http://stackoverflow.com/q/23208927
tags question: http://stackoverflow.com/q/23166915
tags question: http://stackoverflow.com/q/23264111
tags question: http://stackoverflow.com/q/23229538
tags question: http://stackoverflow.com/q/23206356
tags question: http://stackoverflow.com/q/23172548
tags question: http://stackoverflow.com/q/23260378
tags question: http://stackoverflow.com/q/23279894
tags question: http://stackoverflow.com/q/23237137
tags question: http://stackoverflow.com/q/23253558
tags question: http://stackoverflow.com/q/23169918
tags question: http://stackoverflow.com/q/23198138
tags question: http://stackoverflow.com/q/23194249
tags question: http://stackoverflow.com/q/23165881
tags question: http://stackoverflow.com/q/23240300
tag name: junit
tags question: http://stackoverflow.com/q/23136569
tags question: http://stackoverflow.com/q/23206112
tags question: http://stackoverflow.com/q/23214254
tags question: http://stackoverflow.com/q/23274682
tags question: http://stackoverflow.com/q/23281886
tags question: http://stackoverflow.com/q/23219937
tags question: http://stackoverflow.com/q/23156294
tags question: http://stackoverflow.com/q/23154615
tags question: http://stackoverflow.com/q/23195015
tags question: http://stackoverflow.com/q/23252095
tags question: http://stackoverflow.com/q/23166297
tags question: http://stackoverflow.com/q/23160938
tags question: http://stackoverflow.com/q/23249428
tags question: http://stackoverflow.com/q/23134972
tags question: http://stackoverflow.com/q/23198687
tags question: http://stackoverflow.com/q/23181064
tags question: http://stackoverflow.com/q/23157279
tags question: http://stackoverflow.com/q/23277963
tags question: http://stackoverflow.com/q/23154166
tags question: http://stackoverflow.com/q/23263296
tags question: http://stackoverflow.com/q/23171915
tags question: http://stackoverflow.com/q/23175564
tags question: http://stackoverflow.com/q/23287702
tags question: http://stackoverflow.com/q/23226162
tags question: http://stackoverflow.com/q/23274989
tags question: http://stackoverflow.com/q/23273230
tags question: http://stackoverflow.com/q/23142886
tags question: http://stackoverflow.com/q/23173588
tags question: http://stackoverflow.com/q/23278814
tags question: http://stackoverflow.com/q/23163642

http://stackoverflow.com/comment/35391702
type: Comment
comment on: http://stackoverflow.com/q/23145290
score: 0
has text: That comparison is extremely fast if you use a Dictionary to hold the "second file" rows, in memory. If you keep looping through a file, it will be extremely slow.
type: QuestionComment

http://stackoverflow.com/q/23165381
has comment: http://stackoverflow.com/comment/35426063
has answer: http://stackoverflow.com/a/23165472
has comment: http://stackoverflow.com/comment/35426010
type: Question
has comment: http://stackoverflow.com/comment/35426077
downvote count: 0
has comment: http://stackoverflow.com/comment/35483048
possible better answer: http://stackoverflow.com/a/23165472
favorite count: 0
answer count: 3
tagged with: physics
has answer: http://stackoverflow.com/a/23166693
tagged with: collision
has comment: http://stackoverflow.com/comment/35426057
has comment: http://stackoverflow.com/comment/35426019
has answer: http://stackoverflow.com/a/23165428
has comment: http://stackoverflow.com/comment/35426105
linked to: http://stackoverflow.com/q/15514906
upvote count: 1
has title: Collisions between rectangles
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23165428
score: 1
has body: I have been trying to solve this for a few hours, and the internet is pretty unfruitful on the subject. I need help detecting and solving collisions between rectangles, and not just detecting, but note I mentioned solving as well. These are two boxes, with x/y width/heights. I simply need to detect when they are overlapping, and push one of the boxes out of the other one smoothly. Also, note that one box is stationary - and the other is moving. Does anyone have anything on this (or can give me an example?) I'd really appreciate it. I need the boxes to be able to rest on top of each other as well. Thank you!
tagged with: java

http://stackoverflow.com/q/23242211
tagged with: timezone
has title: Java SimpleDateFormat parse Timezone like America/Los_Angeles
type: AnsweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/23242779
score: 4
upvote count: 4
answer count: 2
possible better answer: http://stackoverflow.com/a/23249401
downvote count: 0
has answer: http://stackoverflow.com/a/23249401
tagged with: parsing
favorite count: 0
accepted answer: http://stackoverflow.com/a/23242779
has body: I want to parse the following string in Java and convert it to a date: DTSTART;TZID=America/Los_Angeles:20140423T120000 I tried this: SimpleDateFormat sdf = new SimpleDateFormat("'DTSTART;TZID='Z':'yyyyMMdd'T'hhmmss"); Date start = sdf.parse("DTSTART;TZID=America/Los_Angeles:20140423T120000"); And this: SimpleDateFormat sdf = new SimpleDateFormat("'DTSTART;TZID='z':'yyyyMMdd'T'hhmmss"); Date start = sdf.parse("DTSTART;TZID=America/Los_Angeles:20140423T120000"); But it still doesn't work. I think the problem is in America/Los_Angeles. Can you help me please? Thank you

http://stackoverflow.com/a/23160929
has comment: http://stackoverflow.com/comment/35418282
has comment: http://stackoverflow.com/comment/35418380
answers question: http://stackoverflow.com/q/23160896
has comment: http://stackoverflow.com/comment/35418465
has comment: http://stackoverflow.com/comment/35418350
has comment: http://stackoverflow.com/comment/35418234
type: Answer
has comment: http://stackoverflow.com/comment/35418175
has body: No. You don't get inheritance, methods, abstract methods, polymorphism, and many more object oriented concepts with Structs. You can try to make C conform to object oriented behavior using structs, but that's different from using an object oriented language.
upvote count: 7
score: 7
has comment: http://stackoverflow.com/comment/35419129
has comment: http://stackoverflow.com/comment/35418525
has comment: http://stackoverflow.com/comment/35418223
has comment: http://stackoverflow.com/comment/35418127
has comment: http://stackoverflow.com/comment/35418029
has comment: http://stackoverflow.com/comment/35418091
downvote count: 0

http://stackoverflow.com/comment/35547814
type: Comment
type: QuestionComment
has text: 1) I fear that you've got a bug in code not shown. 2) I also worry when I see static being used where it shouldn't be used. Consider creating and posting your [minimal code example program](http://stackoverflow.com/help/mcve) for us to review, test, and possibly fix.
score: 1
comment on: http://stackoverflow.com/q/23234134

http://stackoverflow.com/q/23188412
tagged with: android
has comment: http://stackoverflow.com/comment/35469005
has body: I am communicating with my Renderer class on a different thread to pass in touch actions using the queueEvent( new Runnable() ) function. It works well with ACTION_DOWN and prints out ACTION_DOWN on the log once. But if I try it with ACTION_UP I get it multiple times SurfaceView.java: public boolean onTouchEvent( final MotionEvent event ){ if( event != null ){ queueEvent( new Runnable(){ public void run(){ renderer.reportEvent( event ); } }); return true; } return super.onTouchEvent( event ); } Renderer.java public void reportEvent( MotionEvent event ){ if( event.getAction() == MotionEvent.ACTION_DOWN ){ Log.d( "DEBUG","ACTION_DOWN" ); } if( event.getAction() == MotionEvent.ACTION_UP ){ Log.d( "DEBUG", "ACTION_UP" ); } } Testing this out on a Galaxy S4 I simply press and release for 1 second the screen and get the following in Log: ACTION_DOWN ACTION_UP ACTION_UP And sometimes I get it three times: ACTION_DOWN ACTION_UP ACTION_UP ACTION_UP My rendering thread goes to sleep to keep a steady 30 fps. Could this be the issue? What is going on? Also what are the boolean return statements for? [edit] I just tried removing the Thread.sleep in the Renderer thread and it still doesn't work.
has title: Android onTouchEvent calls multiple times when communicating with different thread
answer count: 0
type: UnansweredQuestion
tagged with: multithreading
upvote count: 1
score: 1
tagged with: java
type: Question
downvote count: 0
favorite count: 0
tagged with: touch

http://stackoverflow.com/comment/35435513
type: AnswerComment
has text: Thanks! I figured it was something silly that I was code-blind to.
type: Comment
comment on: http://stackoverflow.com/a/23165557
score: 0

http://stackoverflow.com/q/23148460
has answer: http://stackoverflow.com/a/23148742
has comment: http://stackoverflow.com/comment/35396586
has answer: http://stackoverflow.com/a/59051850
has title: Generation of all subsets of strings for a given string
has answer: http://stackoverflow.com/a/23148584
tagged with: algorithm
answer count: 5
has comment: http://stackoverflow.com/comment/35396177
possible better answer: http://stackoverflow.com/a/23148584
has comment: http://stackoverflow.com/comment/35396838
has answer: http://stackoverflow.com/a/23148775
has comment: http://stackoverflow.com/comment/35396139
type: AnsweredQuestion
tagged with: time-complexity
has answer: http://stackoverflow.com/a/23149057
has comment: http://stackoverflow.com/comment/35396131
tagged with: string
has comment: http://stackoverflow.com/comment/35396180
has body: I want a code to generate all the subsets of strings of the given string. I tried this on my own and came up with this : public static void main(String[] args){ long startTime = System.nanoTime(); String text = "1234"; int n = text.length(); String k = ""; for(int i=0;i &lt; Math.pow(2, n);i++){ k = Integer.toBinaryString(i); while(k.length() != n){ k = "0"+k; } StringBuilder sb = new StringBuilder(); for(int j=0;j&lt;k.length();j++){ if(k.charAt(j) == '1'){ sb.append(text.charAt(j)); } } // System.out.println(String.format("%04d", // Integer.parseInt(k))); System.out.println(sb.toString()); } long endTime = System.nanoTime(); long duration = endTime - startTime; System.out.println("Duration:" + duration); } But this is a horrible O(n^2) algorithm so I was looking for a better solution and found this: public static void comb2(String s) { comb2("", s); } private static void comb2(String prefix, String s) { System.out.println(prefix); for (int i = 0; i &lt; s.length(); i++){ comb2(prefix + s.charAt(i), s.substring(i + 1)); } } // read in N from command line, and print all subsets among N elements public static void main(String[] args) { String alphabet = "1234"; comb2(alphabet); System.out.println(); } The output generated is : 1 12 123 1234 124 13 134 14 2 23 234 24 3 34 4 Although the code is working fine. I was debugging it to understand the logic. I get how 1, 12, 123, 1234 are being generated but after that is not so clear. Can tell me whats going on here?
has comment: http://stackoverflow.com/comment/35396005
accepted answer: http://stackoverflow.com/a/23149057
type: Question
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/35396048

http://stackoverflow.com/q/23270817
answer count: 1
favorite count: 0
has title: Cannot resolve import for OAuth2 class on Java
score: 2
tagged with: oauth
downvote count: 0
type: Question
tagged with: spring-mvc
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/23271334
accepted answer: http://stackoverflow.com/a/23271334
tagged with: eclipse
upvote count: 2
has body: I'm following this step by step tutorial by google: https://developers.google.com/+/web/signin/server-side-flow I have downloaded Google APIs client library for Java that it mentions and I have added Jars from Properties > Build Path > Add External Jars on Eclipse. I added all the jar files cointained into "libs" folder. But when I write this line, at backend code side, Oauth2 oauth2 = new Oauth2.Builder( I cannot resolve the import properly, and it says: Oauth2 cannot be resolved to a type The list of jar files contained in "libs" is: google-api-client-1.18.0-rc.jar google-api-client-android-1.18.0-rc.jar google-api-client-appengine-1.18.0-rc.jar google-api-client-gson-1.18.0-rc.jar google-api-client-jackson2-1.18.0-rc.jar google-api-client-java6-1.18.0-rc.jar google-api-client-protobuf-1.18.0-rc.jar google-api-client-servlet-1.18.0-rc.jar google-api-client-xml-1.18.0-rc.jar google-oauth-client-1.18.0-rc.jar google-oauth-client-appengine-1.18.0-rc.jar google-oauth-client-java6-1.18.0-rc.jar google-oauth-client-java7-1.18.0-rc.jar google-oauth-client-jetty-1.18.0-rc.jar google-oauth-client-servlet-1.18.0-rc.jar google-http-client-1.18.0-rc.jar google-http-client-android-1.18.0-rc.jar google-http-client-appengine-1.18.0-rc.jar google-http-client-protobuf-1.18.0-rc.jar google-http-client-gson-1.18.0-rc.jar google-http-client-jackson-1.18.0-rc.jar google-http-client-jackson2-1.18.0-rc.jar google-http-client-jdo-1.18.0-rc.jar google-http-client-xml-1.18.0-rc.jar commons-logging-1.1.1.jar gson-2.1.jar httpclient-4.0.1.jar httpcore-4.0.1.jar jackson-core-asl-1.9.11.jar jackson-core-2.1.3.jar jdo2-api-2.3-eb.jar jsr305-1.3.9.jar protobuf-java-2.4.1.jar transaction-api-1.1.jar xpp3-1.1.4c.jar Any ideas? thanks!
has comment: http://stackoverflow.com/comment/35614350

http://stackoverflow.com/comment/35637007
type: AnswerComment
comment on: http://stackoverflow.com/a/23282162
has text: @AnubianNoob I **do** voted to close, and I **didn't** downvote
type: Comment
score: 0

http://stackoverflow.com/comment/35485098
has text: Perhaps the `CLASSPATH` environmental variable was set on that other machine
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23198925

http://stackoverflow.com/q/23206915
has comment: http://stackoverflow.com/comment/35499642
has comment: http://stackoverflow.com/comment/35499734
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/35499438
type: Question
score: 3
answer count: 2
has answer: http://stackoverflow.com/a/23207428
has title: Remove stopwords from a string in Java
downvote count: 0
has comment: http://stackoverflow.com/comment/35499747
favorite count: 0
has answer: http://stackoverflow.com/a/23207381
has body: I have a string with a lot of words that I need to count. But I want to avoid some words without significancy to the context. So, I have a file with all the words I will ignore. I open this file and create a list I call ArrayList&lt;String&gt; stopWordsList; Now I have the string and need to clean it, eliminating the stopWords from the list. I've tried like this: String example = "Job in a software factory. Work with Agile, Spring, Hibernate, GWT, etc."; for(String stopWord : stopWordsList){ example = example.replaceAll(" "+ stopWord + " ", " "); } After this, string example should be: "Job software factory. Work Agile, Spring, Hibernate, GWT, ." The problem is that "etc." was not remove it, because of the dot after the word. Then I tried: for(String stopWord : stopWordsList){ example = example.replaceAll(" "+ stopWord + " ", " "); example = example.replaceAll(" "+ stopWord + ",", ","); example = example.replaceAll(" "+ stopWord + ".", "."); } But, this is not right, it does not do what I need. Can anybody help me finding a way to clean this string, including words that comes before punctuations or blankspaces. PS: I can not just do example = example.replaceAll(stopWord, " "); because this can break some words like "initial". It will remove "in" and leave me "itial".
type: UnansweredQuestion
tagged with: regex
tagged with: stop-words

http://stackoverflow.com/q/23153565
tagged with: c++-cli
has comment: http://stackoverflow.com/comment/35404484
tagged with: visual-c++
score: 0
has comment: http://stackoverflow.com/comment/35406341
favorite count: 0
tagged with: c++
has title: Does DLL keep state between JNI calls?
type: UnansweredQuestion
upvote count: 1
has comment: http://stackoverflow.com/comment/35405203
downvote count: 1
has body: I have a C++/CLI code that I need to link with Java via JNI. That code was not designed to be a dll library and so I met problem: I need to load parameters from file first (C++ code does it) Then initialize connect to hardware using parameters loaded at step 1 Then connect to hardware and perform actions The question is: 1) if I make 3 native calls to my .dll will DLL keep state(loaded parameters)?
answer count: 0
tagged with: java-native-interface
tagged with: java
type: Question

http://stackoverflow.com/a/23288285
accepted answer of: http://stackoverflow.com/q/23287622
score: 2
has body: See this chapter in the manual for information about loading external config files: http://grails.org/doc/2.3.7/guide/single.html#configExternalized After having specified a property file with grails.config.locations, the properties are loaded automatically when your application is started so they should already be accessible by in the grailsApplication.config object like this: def grailsApplication // Injects the grailsApplication object to your service/controller ... grailsApplication.config.myproperty Read more here about how to access config properties: http://grails.org/doc/2.3.7/guide/conf.html What you are trying to do with your code is to load a file from the current working directory and probably this file does not exists there. Hence the error code. EDIT If you want to load a file that exist in the classpath you should load it as a resource instead. Like this: InputStream is = MyClass.class.getResourceAsStream("urls.properties"); ...where MyClass is a class which is located in the same package as urls.properties. Don't forget to check if the stream is is null, since it will be if it fails to load the resource.
upvote count: 2
answers question: http://stackoverflow.com/q/23287622
has comment: http://stackoverflow.com/comment/35648717
has comment: http://stackoverflow.com/comment/35647146
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/35648437
type: Answer

http://stackoverflow.com/a/23151329
has comment: http://stackoverflow.com/comment/35400536
upvote count: 4
downvote count: 0
score: 4
has comment: http://stackoverflow.com/comment/35400537
answers question: http://stackoverflow.com/q/23151292
type: Answer
has body: String s = "Cap mbsonsl null"; s = s.replaceAll("null", ""); System.out.println(s);

http://stackoverflow.com/a/23273812
type: AcceptedAnswer
downvote count: 0
has body: You could probably do something around those lines. Note: this code is pseudo-code. abstract class Common{ ... } class Foo{ private Common currentReference; public Foo(...){ currentReference = new Foo1(); } public Foo changeReferenceToClass(Class clazz){ ... currentReference = clazz.newInstance(); ... return this; } public &lt;T extends Common&gt; T getReference() { return (T) currentReference; } } class Foo1 extends Common{ ... } class Foo2 extends Common{ ... } Foo f=new Foo( ... ); Foo g=f; g=g.changeReferenceToClass(Foo2.class); What this does is: make an class that contains a reference to an object that has a common interface (in the example, the Common abstract class. instantiate the reference to a default value when it is constructed (Foo1 in the example). offer methods to change and get the reference. when you change the reference to be Foo2 in one place, you can access it in all places In the example, when you change g to hold a reference to Foo2, f will hold a reference to Foo2 too.
type: Answer
answers question: http://stackoverflow.com/q/23273235
accepted answer of: http://stackoverflow.com/q/23273235
upvote count: 1
score: 1

http://stackoverflow.com/a/23220257
downvote count: 0
upvote count: 2
answers question: http://stackoverflow.com/q/23218946
has body: Update: I tested your code on both JavaFX 2.2 and JDK 8 and it seemed to work fine for my simple test case. The logic seems right; the one thing you have to be really careful of in these types of style-class based cell and row implementations is making sure you don't add multiple copies of a given string to the list of style classes - in your implementation this looks right. Double check and make sure you have the strings exactly the same in the add(...) and remove(...) methods. I like to completely bullet-proof these at a slight cost to performance: private final String headPersonStyleClass = "headPerson" ; private class TableRowRightFormat extends TableRow&lt;Person&gt; { @Override protected void updateItem(Person p, boolean b) { super.updateItem(p, b); ObservableList&lt;String&gt; styleClass = getStyleClass(); if (p != null &amp;&amp; p.getId()==2 &amp;&amp; (! styleClass.contains(headPersonStyleClass))) { styleClass.add(headPersonStyleClass); } else { // remove all occurrences: styleClass.removeAll(Collections.singleton(headPersonStyleClass)); } } } If you are using JavaFX 8, a better approach is to use a PseudoClass for this.
type: Answer
score: 2

http://stackoverflow.com/comment/35545273
has text: @DavidWallace Thanks, if I remember his exact words, he said, "When you have a boolean attribute in an object accessed by several threads, do you have to put it in an synchronized block?" Still not sure what he meant by a "synchronized block" in this context.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23232579
score: 0

http://stackoverflow.com/comment/35534714
score: 0
comment on: http://stackoverflow.com/q/23226175
type: QuestionComment
type: Comment
has text: I'm not sure what you want with this but I'm sure the answer is way before you arrive to this.

http://stackoverflow.com/comment/35556964
score: 0
type: Comment
type: QuestionComment
has text: @andrewww `the import com.viewpagerindicator cannot be resolved in the Problems.` this is the error message from the Problems console.
comment on: http://stackoverflow.com/q/23239036

http://stackoverflow.com/q/23154299
has comment: http://stackoverflow.com/comment/36255608
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/35486148
type: Question
answer count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/35498661
tagged with: dropbox-api
has answer: http://stackoverflow.com/a/42297374
has comment: http://stackoverflow.com/comment/36255580
has answer: http://stackoverflow.com/a/49928172
has title: Custom file properties in Dropbox Core API?
favorite count: 0
tagged with: google-drive-api
type: UnansweredQuestion
has body: In the Google Drive API there is something called custom file properties - https://developers.google.com/drive/web/properties - and they can be used to add your own as key/value pairs: { 'key': 'additionalID', 'value': '8e8aceg2af2ge72e78', 'visibility': 'PRIVATE' } I would like to do the same in a desktop Java application with the Dropbox Core API, but I cannot find anything. Am I missing something or is this simply not available in Dropbox Core API? If there is something, please provide an example of how it would be used in Java. Thanks!
upvote count: 1
has comment: http://stackoverflow.com/comment/35491537

http://stackoverflow.com/a/25277703
upvote count: 13
score: 13
accepted answer of: http://stackoverflow.com/q/23176324
has body: Change the version to 3.9.0-rc.2 for android-maven-plugin solved the issue.
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23176324
type: Answer

http://stackoverflow.com/comment/35550358
type: AnswerComment
has text: I get a IllegalStateException if I don't create a new instance of timer. What would I put if I catch the exception?
type: Comment
comment on: http://stackoverflow.com/a/23235172
score: 0

http://stackoverflow.com/comment/35441666
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23174357
type: QuestionComment
has text: Doesn't `executeScript` expect Javascript code as the parameter?

http://stackoverflow.com/q/23273972
tagged with: java
has title: Calling only the super method on Override class
has body: I see this code snippet in a Jenkins plugin and I think that it is no-op @Override public DescriptorImpl getDescriptor() { return (DescriptorImpl)super.getDescriptor(); } Any reason that this might be essential and cannot be nuked from the code?
type: Question
upvote count: 4
score: 4
has answer: http://stackoverflow.com/a/23274067
accepted answer: http://stackoverflow.com/a/23274067
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/35622866
favorite count: 0
has comment: http://stackoverflow.com/comment/35620341
type: AnsweredQuestion

http://stackoverflow.com/a/23251587
has comment: http://stackoverflow.com/comment/35579171
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23251241
type: Answer
has comment: http://stackoverflow.com/comment/35579947
has body: That exception is thrown when a task is submitted and either: the executor has been shut down you exceeded the maximum queue size We can't tell without seeing the code, but likely you do one of these two things in hidden code (maybe even in main), and you have to fix it (btw, this behavior can be customized with setRejectedExecutionHandler) I don't know if this question is your actual problem or a sample one, but anyway I don't think it's common practice for a task to spawn another task. You'd better restructure your code to make the caller itself submitting a new task when necessary. Not that it will fix your problem, but will certainly improve the design of your program. If you describe your domain, maybe we can help with that, too.
upvote count: 1
accepted answer of: http://stackoverflow.com/q/23251241
score: 1

http://stackoverflow.com/a/50012107
has body: "Caused by: java.util.concurrent.ExecutionException: java.lang.RuntimeException: The forked VM terminated without properly saying goodbye. VM crash or System.exit called?" This issue can be occur if you use non compatible version of java. Like uses new version of java while code support some other version.
upvote count: 0
downvote count: 3
score: -3
type: Answer
answers question: http://stackoverflow.com/q/23260057

http://stackoverflow.com/q/23171245
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/23173182
type: Question
tagged with: arraydeque
upvote count: 2
has comment: http://stackoverflow.com/comment/35441304
has body: This is my Question A health center has employed two doctors that examine and treat at most 25 patients in a day. A patient is examined and treated by any one of the two doctors. Each patient has to register his name so that the doctors can examine and treat the patient on first-come-first-serve bases. Exercise 2 Part a: For the scenario2 mentioned above, develop a program that creates patients and doctors (both are threads). Patients register in a queue and the doctors pick patient from the same queue on first-come-first-serve bases and examine and treat them. Use the queue that is not thread safe (For example ArrayDeque). Make sure your program has no synchronization issues. Part b: Use the queue that is thread safe (For example, ArrayBlockedQueue) and check if your solution has synchronization issues. (Make sure that you solution does not provide synchronized methods or synchronized blocks) This is my CODE package lab8; import java.util.ArrayDeque; public class LAB8 { class Doctor implements Runnable { private String name; private Patient patient; Doctor (String n){ name = n; } public void examine (){ System.out.println("Doctor is now examining the patient"); } public void treat(){ System.out.println("Doctor is now treating the patient"); } @Override public void run (){ } } static class Patient implements Runnable { private String name; Patient (String n){ name = n; } public void register(String name){ System.out.println(name + " is registering in Queue"); } @Override public void run(){ ArrayDeque&lt;Patient&gt; Patients = new ArrayDeque(25); for(int i = 0;i&lt;25;i++){ Patients.add(new Patient("Patient No " + i)); Patients.removeFirst().register("Patient No " + i); } } } public static void main(String[] args) { ArrayDeque&lt;Patient&gt; Patients = new ArrayDeque(25); for(int i = 0;i&lt;25;i++){ (new Thread (Patients.removeFirst())).start(); } } } This is the error I am getting when I run it. Exception in thread "main" java.util.NoSuchElementException at java.uti…
answer count: 1
downvote count: 1
favorite count: 0
has title: Stuck on a Homework using ArrayDeque and Threads in Java?
tagged with: multithreading
accepted answer: http://stackoverflow.com/a/23173182
type: AnsweredQuestion

http://stackoverflow.com/q/23257136
answer count: 3
has answer: http://stackoverflow.com/a/23257163
has comment: http://stackoverflow.com/comment/35589818
has title: Java static keyword usage
linked to: http://stackoverflow.com/q/7379915
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23257163
tagged with: java
has body: Why this code does not work? HelloWorld.java:5: error: non-static method add(int,int) cannot be referenced from a static context System.out.println(add(1,2)); I know if I add static to the add method, it works, but why we have to use static? If this code was in C, it works, right? if you do not add static to add method, what are other ways that I can "test" my add method in main? public class HelloWorld { public static void main (String []args) { System.out.println(add(1,2)); } public int add (int x, int y) { return x+y; } }
type: Question
has answer: http://stackoverflow.com/a/23257340
possible better answer: http://stackoverflow.com/a/23257170
has answer: http://stackoverflow.com/a/23257170
score: 0

http://stackoverflow.com/a/23131521
has comment: http://stackoverflow.com/comment/35365742
accepted answer of: http://stackoverflow.com/q/23131002
has comment: http://stackoverflow.com/comment/35365194
has comment: http://stackoverflow.com/comment/35365537
has body: I believe the question is not really about Java threads in general, but about the Android "main thread" (also called the "UI thread"). To quote from the JavaDoc for the Android Handler: When a process is created for your application, its main thread is dedicated to running a message queue that takes care of managing the top-level application objects (activities, broadcast receivers, etc) and any windows they create. You can create your own threads, and communicate back with the main application thread through a Handler. This is done by calling the same post or sendMessage methods as before, but from your new thread. The given Runnable or Message will then be scheduled in the Handler's message queue and processed when appropriate. In other words: The main thread is responsible for dequeuing messages/runnables from a queue and processing them. That main thread is blocked while the queue is empty (since there is nothing for it to do). If you use a Handler that was created in the main thread, that Handler's messages and runnables will actually be added to the same queue used by the main thread. Normally, the main thread will run as long as the process does. Note: An Android app can actually have multiple processes, and each one will have its own main thread. However, most Android apps will only have one process (and therefore one main thread).
type: AcceptedAnswer
score: 4
type: Answer
upvote count: 4
has comment: http://stackoverflow.com/comment/35365535
downvote count: 0
answers question: http://stackoverflow.com/q/23131002

http://stackoverflow.com/comment/35573269
score: 0
type: Comment
has text: @sp00m In the SSCCE yes, in reality a negative value instance can never exist. In fact a zero value instance will never exist except in the NullObject case
type: AnswerComment
comment on: http://stackoverflow.com/a/23248462

http://stackoverflow.com/a/23166572
type: Answer
has body: It does not work that way, try this for (Iterator&lt;Entry&lt;String, Integer&gt;&gt; i = m.entrySet().iterator(); i.hasNext();) { Entry&lt;String, Integer&gt; e = i.next(); i.remove(); System.out.println(e.getKey() + ": " + e.getValue()); } Map.remove with no args does not exist, you can try m.remove(e.getKey()) but then you will be getting ConcurrentModificationException.
accepted answer of: http://stackoverflow.com/q/23166551
answers question: http://stackoverflow.com/q/23166551
has comment: http://stackoverflow.com/comment/35428041
has comment: http://stackoverflow.com/comment/35428092
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35428060
has comment: http://stackoverflow.com/comment/35428032

http://stackoverflow.com/q/23142083
tagged with: media-player
has answer: http://stackoverflow.com/a/23149246
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/23142490
has body: I added to the raw folder'm developing an application that plays music. By clicking the song is playing music to a ListView. but the music does not pass to the next song when finished. What should I do? and I'm using translate sorry public class LoadedActivity extends Activity { MediaPlayer mp; View View; ListView listView; Drawable Drawble; ImageButton OynatButonu; ImageButton DurdurButonu; ImageButton IleriButonu; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.loaded_layout); Field[] fields = R.raw.class.getFields(); String[] mediaList = new String[fields.length]; for (int count = 0; count &lt; fields.length; count++) mediaList[count] = fields[count].getName(); listView = (ListView) findViewById(R.id.music_list); ArrayAdapter&lt;String&gt; adapter = new ArrayAdapter&lt;String&gt;( LoadedActivity.this, android.R.layout.simple_list_item_1, mediaList); listView.setAdapter(adapter); listView.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView&lt;?&gt; arg0, View v, int position, long id) { if (View != null) ((TextView) View).setBackgroundDrawable(Drawble); Drawble = ((TextView) v).getBackground(); String uri = "android.resource://" + getPackageName() + "/raw/" + ((TextView) v).getText(); if (mp != null &amp;&amp; mp.isPlaying()) mp.stop(); mp = MediaPlayer.create(getApplicationContext(), Uri.parse(uri)); mp.start(); ((TextView) v).setBackgroundColor(Color.WHITE); ((TextView) v).setTextColor(Color.RED); View = v; } }); } @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.menu, menu); return true; } }
type: UnansweredQuestion
tagged with: android
tagged with: java
type: Question
has title: List view music list, of song

http://stackoverflow.com/q/23202556
score: 0
has comment: http://stackoverflow.com/comment/35491151
tagged with: panel
has comment: http://stackoverflow.com/comment/35491136
type: UnansweredQuestion
tagged with: swing
tagged with: graphics
has answer: http://stackoverflow.com/a/23226509
tagged with: java
has comment: http://stackoverflow.com/comment/35491221
has comment: http://stackoverflow.com/comment/35491146
type: Question
has answer: http://stackoverflow.com/a/23202958
has comment: http://stackoverflow.com/comment/35491008
answer count: 2
has comment: http://stackoverflow.com/comment/35491712
has body: Assume I already have created a Frame and Panel. I am doing some calculations and I want to add something to the existing graphics that are already displayed in that Frame / Panel. How can I add to that existing Graphics object? For example, starting with the code below, this creates a simple window with some graphics. Now that it is up on the screen, and the "paintComponent" method has been executed, I want to add additional graphics to this object (lines, boxes, ...) I see only two options: Create a brand new object and start from "scratch" adding all the old objects to the Graphics object "g" Put logic into the "paintComponent" method to listen for additional objects to be added and then wait for the frame to be repainted (e.g. frame.repaint() ) Neither seems particularly elegant. What is the "standard" solution? What is the right OO way to think about this situation? import javax.swing.JFrame; import java.awt.Graphics; import javax.swing.JPanel; import java.awt.Color; import javax.swing.JLabel; import javax.swing.ImageIcon; import java.awt.BorderLayout; public class testSimpleOverlay extends JPanel { public testSimpleOverlay() // set up graphics window { super(); setBackground(Color.WHITE); } public void paintComponent(Graphics g) // draw graphics in the panel { int width = getWidth(); // width of window in pixels int height = getHeight(); // height of window in pixels super.paintComponent(g); // call superclass to make panel display correctly g.drawString("Hello, World", 100, 150); g.drawLine(0, 0, 20, 40); g.drawRect(10, 10, 200, 100); } public static void main(String[] args) { testSimpleOverlay panel = new testSimpleOverlay(); // window for drawing JFrame application = new JFrame(); // the program itself application.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // set frame to exit // when it is closed application.add(panel); application.setSize(500, 400); // window is 500 pixels wide, 400 high application.setVisible(true); } } For those interested in more …
has title: Add objects to panel, without starting over?
has comment: http://stackoverflow.com/comment/35490932

http://stackoverflow.com/comment/35497403
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23205894
has text: @EricEvans I'm not sure if you really have both `${Budget}` and `$F{Budget}`, review your code.

http://stackoverflow.com/a/23251049
score: 1
answers question: http://stackoverflow.com/q/23247947
downvote count: 0
has body: If the big object is GC-ed by the FullGC, you could use the class histogram to inspect the heap. Use -XX:+PrintClassHistogramBeforeFullGC and -XX:+PrintClassHistogramAfterFullGC. This will at least show you all the different classes of objects allocated in the heap, sorted by footprint and number of instances. This is a lightweight approach but you can at least check your hypothesis of a "one large object". After that, you can dig in with profilers, e.g. Mission Control for JDK7u40 and higher or jProfiler, both work great.
type: Answer
upvote count: 1

http://stackoverflow.com/comment/35365300
type: Comment
score: 0
has text: it#next() goes to pic next values. you need Drank darnk= it.next(); then access your object drank.getName(); drank.getgetDescription()
type: QuestionComment
comment on: http://stackoverflow.com/q/23131733

http://stackoverflow.com/comment/35540158
comment on: http://stackoverflow.com/q/23229725
has text: if it hits the catch block, it means an Exception is being thrown. Why not try logging those exceptions to work out what the problem is, rather than just moving on and forgetting about them
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/23198829
tagged with: eclipse
type: Question
has body: I want to include some files as embedded resources in an Eclipse Java project, so that at runtime I can read them using getClass().getResourceAsStream("somefile") For most files this works just by adding them to a directory inside the project, but some of the files to have the extension ".java". Eclipse naturally tries to compile them as part of the project. How do I tell it not compile them, but include them as embedded resources?
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/35484199
has title: How to include .java files as embedded resources in Eclipse project
has comment: http://stackoverflow.com/comment/35484134
has comment: http://stackoverflow.com/comment/35484113
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23200201
tagged with: java

http://stackoverflow.com/comment/35600299
type: QuestionComment
comment on: http://stackoverflow.com/q/23263115
has text: The PriorityBlockingQueue has a capacity. Additional threads should be created once the capacity is reached.
type: Comment
score: 1

http://stackoverflow.com/q/23209804
has answer: http://stackoverflow.com/a/50335052
possible better answer: http://stackoverflow.com/a/50335052
answer count: 2
downvote count: 0
favorite count: 0
tagged with: android-asynctask
tagged with: android-handler
has answer: http://stackoverflow.com/a/23217770
upvote count: 2
tagged with: android
has body: I have wrote a service to log accelerometer values in background. The idea is to register for sensor listener and write the values to storage. I have enabled the StrictMode.enableDefaults() in the MainActivity of the app (not in the service) to check if the service runs on its own thread. But it does not! I don't know what is the problem...I have this AsyncTask class that I hoped to take care of the problem but it apparently did not (this is inside the service and its execute method is called from the onCreate method of the service. private class LogTask extends AsyncTask&lt;Void, Void, Void&gt; { @Override protected Void doInBackground(Void... voids) { mListener = new SensorEventListener() { @Override public void onSensorChanged(SensorEvent sensorEvent) { String formatted = String.valueOf(System.currentTimeMillis()) + "\t" + String.valueOf(sensorEvent.timestamp) + "\t" + String.valueOf(sensorEvent.values[0]) + "\t" + String.valueOf(sensorEvent.values[1]) + "\t" + String.valueOf(sensorEvent.values[2]) + "\r\n"; //if (mIsServiceStarted &amp;&amp; mFileStream != null &amp;&amp; mLogFile.exists()) { if (mFileStream != null &amp;&amp; mLogFile.exists()) { try { mFileStream.write(formatted.getBytes()); } catch (IOException e) { e.printStackTrace(); } } } @Override public void onAccuracyChanged(Sensor sensor, int accuracy) { } }; mSensorManager.registerListener( mListener, mSensor, SensorManager.SENSOR_DELAY_FASTEST ); return null; } } StrictMode in log cat specially points that the following line is voiding the policy: mFileStream.write(formatted.getBytes()); StrictMode policy violation; ~duration=0 ms: android.os.StrictMode$StrictModeDiskWriteViolation: policy=31 violation=1 at android.os.StrictMode$AndroidBlockGuardPolicy.onWriteToDisk(StrictMode.java:1092) Can someone tell me what is going wrong? Here is the full code of my service if requried: http://pastebin.com/NRm376BL
score: 2
type: AnsweredQuestion
tagged with: java
has title: Android sensor registerListener in a separate thread
accepted answer: http://stackoverflow.com/a/23217770
type: Question
tagged with: android-service

http://stackoverflow.com/q/23174982
linked to: http://stackoverflow.com/q/3695230
score: 0
favorite count: 0
has body: So I am trying to make a GUI in Java. I am pretty new to Java GUIs. So here is my code: private class thehandler implements ActionListener { public void actionPerformed(ActionEvent event){//this is what is going to handle an event String string = ""; if(event.getSource() == item1)//if they click enter on item1 string=String.format("field 1: %s", event.getActionCommand()); else if(event.getSource() == item2)//if they click enter on item2 string = String.format("field 2: %s", event.getActionCommand()); else if(event.getSource() == item3)//if they click enter on item3 string = String.format("field 3: %s", event.getActionCommand()); else if(event.getSource() == passField)//if they click enter on passField string = String.format("Password field is: %s", event.getActionCommand()); } } I get an error on string=String.format("field 1: %s", event.getActionCommand()); and all the other String.format lines. It says "The method format(String, Object[]) in the type String is not applicable for the arguments (String, String)" I have no clue how to fix this. I just downloaded the JRE and JDK 8 if that helps at all. Thank you!
upvote count: 2
type: UnansweredQuestion
downvote count: 2
has title: I'm trying to make a GUI in Java
has comment: http://stackoverflow.com/comment/35446204
tagged with: java
has answer: http://stackoverflow.com/a/23175023
type: Question
answer count: 2
tagged with: user-interface
has answer: http://stackoverflow.com/a/23175028

http://stackoverflow.com/q/23262168
has body: I am trying to combine Java-config and xml-config for spring security authentication. But i received an error: Error creating bean with name 'securityConfig': Injection of autowired dependencies failed What seems to be the problem with my code? Been googling for answers but have not found any. Thanks in advance. hope you can help me. Stack-trace: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'securityConfig': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire method: public void org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter.setAuthenticationConfiguration(org.springframework.security.config.annotation.authentication.configuration.AuthenticationConfiguration); nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No matching bean of type [org.springframework.security.config.annotation.authentication.configuration.AuthenticationConfiguration] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {} Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire method: public void org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter.setAuthenticationConfiguration(org.springframework.security.config.annotation.authentication.configuration.AuthenticationConfiguration); nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No matching bean of type [org.springframework.security.config.annotation.authentication.configuration.AuthenticationConfiguration] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {} Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No matching bean of type [org.springframewo…
favorite count: 0
tagged with: spring
has answer: http://stackoverflow.com/a/29365448
tagged with: http://stackoverflow.com/tag/xml
tagged with: spring-mvc
has answer: http://stackoverflow.com/a/23263109
upvote count: 3
type: UnansweredQuestion
score: 3
has title: Error creating bean with name 'securityConfig': Injection of autowired dependencies failed
tagged with: java
tagged with: spring-java-config
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/73353212
downvote count: 0

http://stackoverflow.com/tag/csv
type: Tag
tags question: http://stackoverflow.com/q/23151816
tags question: http://stackoverflow.com/q/23175512
tags question: http://stackoverflow.com/q/23262569
tags question: http://stackoverflow.com/q/23178543
tag name: csv
tags question: http://stackoverflow.com/q/23210316
tags question: http://stackoverflow.com/q/23151410
tags question: http://stackoverflow.com/q/23170152
tags question: http://stackoverflow.com/q/23201427
tags question: http://stackoverflow.com/q/23140217
tags question: http://stackoverflow.com/q/23180111
tags question: http://stackoverflow.com/q/23192158
tags question: http://stackoverflow.com/q/23257369
tags question: http://stackoverflow.com/q/23161790
tags question: http://stackoverflow.com/q/23236601
tags question: http://stackoverflow.com/q/23224287
tags question: http://stackoverflow.com/q/23187405

atomicinteger
tag name: atomicinteger
tags question: http://stackoverflow.com/q/23201468
tags question: http://stackoverflow.com/q/23137112
type: Tag

http://stackoverflow.com/comment/35395593
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23148154
has text: its while(nums[position] != s){

http://stackoverflow.com/comment/35431136
comment on: http://stackoverflow.com/q/23168185
type: Comment
has text: Okay, it just sounded like you wanted it to say "1 MB" and then download 200 MB (or whatever amount of data).
type: QuestionComment
score: 0

http://stackoverflow.com/comment/35602357
score: 0
type: Comment
has text: Does it also make sense to avoid the query parameter "param" in the form action attribute and rather make it a hidden form input?
comment on: http://stackoverflow.com/a/23264355
type: AnswerComment

http://stackoverflow.com/comment/35541208
type: Comment
has text: `.+` should be non-greedy (`.+?`). Same with `.*`.
comment on: http://stackoverflow.com/a/23230352
score: 0
type: AnswerComment

http://stackoverflow.com/q/23287914
has title: Static list MINUS select statement
tagged with: oracle-database
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23288003
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/23288225
accepted answer: http://stackoverflow.com/a/23288003
has body: I have a java program that returns a list of Long values (hundreds). I would like to subtract to this list the values obtained from a select on an oracle database, something like this: SELECT 23 as num FROM DUAL UNION ALL SELECT 17 as num FROM DUAL UNION ALL SELECT 19 as num FROM DUAL UNION ALL SELECT 67 as num FROM DUAL UNION ALL... ... ... SELECT 68 as num FROM DUAL MINUS SELECT NUM FROM MYTABLE I presume that this operation has some performance issues... Are there other better approaches? Thank you
score: 0
answer count: 2
tagged with: sql
possible better answer: http://stackoverflow.com/a/23288225

http://stackoverflow.com/q/23151467
tagged with: java
has comment: http://stackoverflow.com/comment/35400953
score: 0
has comment: http://stackoverflow.com/comment/35401274
answer count: 1
has comment: http://stackoverflow.com/comment/35400789
has title: How can I avoid many request to my server (PHP-Java)?
tagged with: security
has comment: http://stackoverflow.com/comment/35401163
tagged with: android
has answer: http://stackoverflow.com/a/23151664
tagged with: php
accepted answer: http://stackoverflow.com/a/23151664
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35400802
has comment: http://stackoverflow.com/comment/35401134
has body: I am developing an app for Android which allow users making comments. The problem is: if someone discovered the PHP file of my server which receive a comment and save it in a database this person would have a total control to save unlimited comments. So... How could I avoid this? I don't know so much of security but... Could it be possible solve it with hash, keys or anything? How?
has comment: http://stackoverflow.com/comment/35400919
type: Question
has comment: http://stackoverflow.com/comment/35400866
has comment: http://stackoverflow.com/comment/35401000

http://stackoverflow.com/q/23175143
tagged with: greendao
type: UnansweredQuestion
answer count: 0
downvote count: 0
score: 1
favorite count: 0
type: Question
tagged with: android
has title: greenDao find all changed entities
tagged with: java
upvote count: 1
has body: Is there a way to fetch all entities that have been changed locally that have not been updated in the database yet? I'm trying to create an undo function, so I'd like to fetch all entities with a change and then call refresh on each object. Thanks!

http://stackoverflow.com/q/23204407
has comment: http://stackoverflow.com/comment/35494253
upvote count: 0
has comment: http://stackoverflow.com/comment/35494572
has comment: http://stackoverflow.com/comment/35494450
answer count: 1
favorite count: 0
has body: EDIT: How do I use the eclipse parser to workout the type of an parameter at compile time? I'm trying to check if a function was called by value. So i activate the following function on the user's code: public boolean visit(MethodInvocation node){} My question is how to actually check whether the call was by value or by reference. I tried member functions of node like the following: typeArguments() arguments() getExpression() and couldn't go further. For instance i tried: List r_type= node.typeArguments(); if(r_type.toString() == "int") { .... } but r_type seems to be always empty.
has comment: http://stackoverflow.com/comment/35494240
has comment: http://stackoverflow.com/comment/35494430
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35494356
has comment: http://stackoverflow.com/comment/35705939
has comment: http://stackoverflow.com/comment/35495003
tagged with: parsing
has title: How to check if function was called by value?
has answer: http://stackoverflow.com/a/23204582
has comment: http://stackoverflow.com/comment/35494439
has comment: http://stackoverflow.com/comment/35494894
has comment: http://stackoverflow.com/comment/35494415
has comment: http://stackoverflow.com/comment/35495030
tagged with: java
has comment: http://stackoverflow.com/comment/35494370
tagged with: eclipse-jdt
linked to: http://stackoverflow.com/q/40480
has comment: http://stackoverflow.com/comment/35701522
downvote count: 1
has comment: http://stackoverflow.com/comment/35494363
type: Question
has comment: http://stackoverflow.com/comment/35494988
has comment: http://stackoverflow.com/comment/35494260
has comment: http://stackoverflow.com/comment/35495256
score: -1
tagged with: eclipse
has comment: http://stackoverflow.com/comment/35494442
tagged with: abstract-syntax-tree
has comment: http://stackoverflow.com/comment/35494833

http://stackoverflow.com/a/35166284
downvote count: 0
has comment: http://stackoverflow.com/comment/58069900
has body: According to your discussion on: https://chat.stackoverflow.com/rooms/102325/discussion-between-ankitagrawal-and-oneworld , you need a monotonic counter to uniquely identify a dataset. For that you can easily set a SharedPreference and increment this value every time you need a new identifier. When you require to know which is the newest file, just compare the identifiers. If it is an issue that this counter gets reset once the app is uninstalled, please refer to: In android is there any way to preserve SharedPreferences after an uninstall A different approach that could be used, is to request a timestamp from an outside server. Hope it helps ;-)
answers question: http://stackoverflow.com/q/23282540
has comment: http://stackoverflow.com/comment/58066096
type: Answer
has comment: http://stackoverflow.com/comment/58085387
score: 1
upvote count: 1

http://stackoverflow.com/a/23202742
answers question: http://stackoverflow.com/q/23202609
score: 0
has body: You have a simple error in your code ("where vouch_no..." is not inside the string sql), it should be: String sql = "select item_type as 'Item Type', md_by as 'Made By', model as 'Model', selling_price as 'Selling Price', purchase_price as 'Purchase Price', purchase_date as 'Purchase Date', vouch_no as 'Voucher No.', vouch_date as 'Voucher Date', record_no as 'Record No.' from purchase where vouch_no = ?"; You can set the parameter like this: ps = con.prepareStatement(sql); ps.setString(1 , Integer.parseInt(txt_vouchno_p.getText()));
type: Answer

http://stackoverflow.com/comment/35493785
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23202475
has text: Can anyone suggest me the fix for the above problem?
type: AnswerComment

http://stackoverflow.com/comment/35460995
type: QuestionComment
comment on: http://stackoverflow.com/q/23185348
has text: Surely it uses an internal Thread pool in 3.1 to handle the case but it exempts you to manage it or even guessing its existence. Using 3.0, you would have to manage it yourself ..
score: 0
type: Comment

http://stackoverflow.com/comment/35399921
type: Comment
has text: If you don't know what you are writing, I suggest taking a look at http://stackoverflow.com/questions/21406878/uploading-files-with-primefaces-4-0-and-jsf-2-2-on-google-app-engine because Google App Engine doesn't support Servlet 3.0. So I really appreciate if you will answer with a more specific way, because I've been testing this code for 3 weeks and I'm fairly documented. Since the code you've posted (which i've already seen many days ago) is useless in my case. Could you post a working code for Google App Engine please? Thank you so much man.
score: 1
comment on: http://stackoverflow.com/a/23144368
type: AnswerComment

http://stackoverflow.com/a/23182721
upvote count: 2
type: Answer
accepted answer of: http://stackoverflow.com/q/23182610
has comment: http://stackoverflow.com/comment/35455648
has comment: http://stackoverflow.com/comment/35455839
has comment: http://stackoverflow.com/comment/35455684
has body: try this way ResultSet rs =sta.executeQuery("SELECT Quantity FROM stockDB WHERE Name='"+name+"' AND Size="+size+""); while(rs.next()) { String str = rs.getString("Quantity"); int quan = Integer.parseInt(str); ..... } The cursor remains at the top of the 1st row.rs.next() is used to check if any rows are present or not,if present then it return true and cursor comes to 1st row and rs.getString() is used to retrieve the particual column.Now when the cursor reaches the last row then rs.next() returns false and the control comes out of the loop. I would suggest you to use preparedstatement instead of statement
score: 2
has comment: http://stackoverflow.com/comment/35455594
answers question: http://stackoverflow.com/q/23182610
downvote count: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35455597
has comment: http://stackoverflow.com/comment/35455540

http://stackoverflow.com/comment/35635797
score: 1
has text: You are trying to get the result from a column named `DISPLAYNAME` which does not exist. Use `rs.getString(1)` to get the result by index number rather than by name. If you want to use a name, reference the alias you use: `rs.getString("result_str")`.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23281460

http://stackoverflow.com/comment/35404428
comment on: http://stackoverflow.com/a/23151017
type: Comment
score: 0
type: AnswerComment
has text: thanks, you solved some of the problems, now i know what is my question. :P

http://stackoverflow.com/comment/35638097
has text: Hi, Thanks for your response. Actually I am using Identity in my ms sql server for my parent and child table. So my parent table doesnt have any issue in storing PK field value. but at the same time, while persisting the child table, parent key id is not available. any guess what is missing or wrong in my code?
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/23267184
type: Comment

http://stackoverflow.com/comment/35529799
score: 0
type: Comment
has text: `StringBuilder builder2 = new StringBuilder(stringBuilder.toString().trim());`
comment on: http://stackoverflow.com/a/23223412
type: AnswerComment

http://stackoverflow.com/comment/35592298
type: QuestionComment
type: Comment
has text: Kon, Exception in thread "main" java.lang.IllegalArgumentException: illegal component position at java.awt.Container.addImpl(Unknown Source) at java.awt.Container.add(Unknown Source) at net.MMMGames.JAVIS.Starter.main(Starter.java:16)
score: 0
comment on: http://stackoverflow.com/q/23258668

http://stackoverflow.com/comment/35373206
type: QuestionComment
has text: @Joffrey - I could but the asker asked for general direction so :)
comment on: http://stackoverflow.com/q/23133952
score: 0
type: Comment

http://stackoverflow.com/q/23186553
has comment: http://stackoverflow.com/comment/35463371
has comment: http://stackoverflow.com/comment/35463160
tagged with: java
tagged with: eclipse
type: Question
has comment: http://stackoverflow.com/comment/35463169
has title: How can I get HD image on imageview and set to wallpaper?
tagged with: android
has comment: http://stackoverflow.com/comment/35463229
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/35463255
answer count: 0
type: UnansweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/35462968
has body: I want to make an app which will get images from image.google.com and download it in HD and then set wallpaper. I can do wallpaper like stuff but I am unable to get image in high definition. ImageLoader.java package com.FUG.besthdwallpaperportrait; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.InputStream; import java.io.OutputStream; import java.net.HttpURLConnection; import java.net.URL; import java.util.Collections; import java.util.Map; import java.util.WeakHashMap; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import android.app.Activity; import android.content.Context; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.widget.ImageView; public class ImageLoader { MemoryCache memoryCache=new MemoryCache(); FileCache fileCache; private Map&lt;ImageView, String&gt; imageViews=Collections.synchronizedMap(new WeakHashMap&lt;ImageView, String&gt;()); ExecutorService executorService; public ImageLoader(Context context){ fileCache=new FileCache(context); executorService=Executors.newFixedThreadPool(5); } int stub_id = R.drawable.ic_launcher; public void DisplayImage(String url, int loader, ImageView imageView) { stub_id = loader; imageViews.put(imageView, url); Bitmap bitmap=memoryCache.get(url); if(bitmap!=null) imageView.setImageBitmap(bitmap); else { queuePhoto(url, imageView); imageView.setImageResource(loader); } } private void queuePhoto(String url, ImageView imageView) { PhotoToLoad p=new PhotoToLoad(url, imageView); executorService.submit(new PhotosLoader(p)); } private Bitmap getBitmap(String url) { File f=fileCache.getFile(url); //from SD cache Bitmap b = decodeFile(f); if(b!=null) return b; //from web try { Bitmap bitmap=null; URL imageUrl = new URL(url); HttpURLConnection conn = (HttpURLConnection)imageUrl.openConnection(); conn.setConnectTimeout(30000); conn.setReadTimeout(30000); conn.setIns…

http://stackoverflow.com/comment/45469578
score: 0
type: Comment
comment on: http://stackoverflow.com/a/28559070
type: AnswerComment
has text: sorry but you are wrong see my updated answer. interceptors are called AFTER webshere stuff about saaj

http://stackoverflow.com/a/23166237
has body: In your activity class create public static String valueEntered; valueEntered=mEdtTxt.getText().toString(); and in your java class where you want String enteredValue=ClassA.valueEntered;
answers question: http://stackoverflow.com/q/23165813
score: 0
type: Answer

http://stackoverflow.com/a/23269472
has body: Instance members are automatically initialized by its default values. For object default value is null. The local variable are not initialized by default. If you create a final variable then you have to set the value. In first option you can't make it final because you can't assign it again. In second option you have to initialize it before returning because its a final variable. You can use either one.
score: 1
answers question: http://stackoverflow.com/q/23269357
upvote count: 1
downvote count: 0
type: Answer

http://stackoverflow.com/comment/35515438
type: AnswerComment
type: Comment
has text: you just write you response back with some variable value and then you will able to determine
comment on: http://stackoverflow.com/a/23216239
score: 0

http://stackoverflow.com/comment/35413247
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23158493
has text: You'll need to use `pigArray[i].setName(pigArray[k].getName();` And your following lone call to pigArray[k].getName() is going to do nothing, btw. That getter will just return its value to nobody and be sad.

http://stackoverflow.com/comment/35467631
comment on: http://stackoverflow.com/q/23189053
type: Comment
has text: Post your logcat output.
type: QuestionComment
score: 2

http://stackoverflow.com/comment/35455973
comment on: http://stackoverflow.com/a/23182870
score: 0
type: AnswerComment
type: Comment
has text: Thank for response, But can you tell me how I can access soap body of this code, please provide some method, Actually I have implemented soap demo but not get data through tag.

http://stackoverflow.com/comment/35576679
score: 0
has text: If you want to implement this you will have to include a library which supports exponent/powers for BigDecimal. If you are lucky you may find an implementation for Gamma already written in Java.
comment on: http://stackoverflow.com/q/23249619
type: Comment
type: QuestionComment

lombok
type: Tag
tag name: lombok
tags question: http://stackoverflow.com/q/23240149

http://stackoverflow.com/comment/35406159
comment on: http://stackoverflow.com/q/23154181
has text: OK. `Best match`. Investigating...
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/23263585
has body: I have a messaging "service"(not Android Service) and I want to initialize it once in Applicaion's onCreate and then provide this "service" to all app componens. The problem is that MessageBus should be initialized on separate thread, since it performes some network operations. How do I eliminate race condition if client tries to access MessageBus instance? Say, Activity tries to get MessageBus, but it's still not initialized? public interface ServiceProvider { public MessageBus getMessageBus(); } public class MyApplication extends Application implements ServiceProvider { private MessageBus messageBus; @Override public void onCreate(){ super.onCreate(); new Thread(new Runnable() { @Override public void run() { try { messageBus = new MessageBusImpl(); } catch (Exception e) { Log.d(TAG, "Failed to init MessageBus"); e.printStackTrace(); } } }).start(); } Override public MessageBus getMessageBus() { return messageBus; } }
has title: How do I init my object in Application instance asynchronously?
score: 0
tagged with: android
has answer: http://stackoverflow.com/a/23263650
type: Question
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23263650
tagged with: java
answer count: 1

http://stackoverflow.com/a/76663265
has body: Fetch the dynamic iframe id into a string and then use the same id to locate the dynamic iframe. Below is for reference: String iframeId = driver.findElement(By.xpath("*//div[contains(@class,'classname")).getAttribute("id"); WebElement dynamicIframeId = driver.findElement(By.id(iframeId)); driver.switchTo().frame(dynamicIframeId);
answers question: http://stackoverflow.com/q/23261495
score: 0
type: Answer

http://stackoverflow.com/q/23240300
tagged with: unit-testing
type: Question
answer count: 1
downvote count: 0
tagged with: junit
has title: Why is my DataPoints method being called multiple times?
has body: This test class: @RunWith(Theories.class) public class TheoriesConfusion { @DataPoints public static int[] ints() { System.out.println("Generator called"); return new int[]{1, 2, 3, 4, 5}; } @Theory public void twoArgTest(int x, int y) { assertTrue(x &lt; y || x &gt;= y); } } Prints the following output: Generator called Generator called Generator called Generator called Generator called Generator called Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.137 sec This is quite counterintuitive, as I expect the data-generating function to be called only once. This has implications when creating random data, or any case where the data-generating method returns different results on each call, so I'd like to understand it.
has answer: http://stackoverflow.com/a/23296745
favorite count: 0
upvote count: 2
score: 2
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/23296745

http://stackoverflow.com/comment/35590744
has text: Can you construct an [sscce](http://sscce.org) that shows the actual problem, without the confusing tiny numbers?
comment on: http://stackoverflow.com/q/23228440
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35480387
type: AnswerComment
score: 0
type: Comment
has text: Sorry for not posting a clear question. Feel free to look at the above answer and post your comments on it
comment on: http://stackoverflow.com/a/23195686

http://stackoverflow.com/a/23164726
has body: Because it's reading the rest of the (empty) line after the 5. Add another call before the loop to consume the newline.
answers question: http://stackoverflow.com/q/23164680
score: 0
has comment: http://stackoverflow.com/comment/35424821
type: Answer

http://stackoverflow.com/q/23131340
downvote count: 0
favorite count: 0
type: Question
has body: I have an sql table: User, with one field: NAME. I created a popup dialog window, where I should type in the Users's name, after that, it should be passed to the column NAME in mysql. So, it is pretty simple but me as beginner got stuck with some error. Is there a way to fix my code to work smoothly? import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.sql.*; import java.sql.Connection; import java.sql.DriverManager; import javax.swing.*; public class Userdialog { static final String JDBC_DRIVER="com.mysql.jdbc.Driver"; static final String DB_URL = "jdbc:mysql://localhost/mydb"; static final String USER="root"; static final String PASS=""; Connection conn = null; Statement st = null; JTextField name; JButton proceed; Userdialog(){ JFrame useradd = new JFrame("Add user to database"); useradd.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); name = new JTextField(10); useradd.setLayout(new GridLayout(0,1)); JPanel pane = new JPanel(new GridLayout(0,1)); useradd.add(pane); pane.add(new JLabel("First name: ")); pane.add(name); proceed = new JButton("Add that user"); pane.add(proceed); proceed.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { //HOW TO MAKE IT TO THE SQL TABLE??? try { Class.forName("com.mysql.jdbc.Driver"); conn=DriverManager.getConnection(DB_URL,USER,PASS); st = (Statement) conn.createStatement(); st.execute("insert into user (name) values('Philip')"); JOptionPane.showMessageDialog(null,"Inserted Successfully!"); } catch(Exception ex) { ex.printStackTrace(); } }}); useradd.pack(); useradd.setSize(300,200); useradd.setVisible(true); }} MAIN CLASS public class Main { public static void main(String[] args) { Userdialog mc = new Userdialog(); }}
has answer: http://stackoverflow.com/a/23131485
has title: How to add text from swing text field to mysql table in Java?
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/35364623
tagged with: mysql
accepted answer: http://stackoverflow.com/a/23131485
tagged with: swing
answer count: 1
has comment: http://stackoverflow.com/comment/35365390
type: AnsweredQuestion
score: 3

http://stackoverflow.com/a/23204766
score: 2
answers question: http://stackoverflow.com/q/23181978
has body: If you use any new language features in Java 8, it requires also using Java 8 bytecode. $ javac -source 1.8 -target 1.7 javac: source release 1.8 requires target release 1.8 That means your options are quite limited. You cannot use lambdas, method references, default methods, Streams, etc. and maintain backwards compatibility. There are still two things you can do that users of Java 8 will benefit from. The first is using Functional Interfaces in your public API. If your methods take Runnables, Callables, Comparators, etc. as parameters, then users of Java 8 will be able to pass in lambdas. You may want to create your own Single-Abstract-Method interfaces as well. If you find you need Functions and Predicates, I'd suggest reusing the ones that ship with GS Collections or Guava instead of writing your own. The second thing you can do is use a rich collections API that benefits from using Functional Interfaces. Again, that means using GS Collections or Guava. For example, if you have a method that would return List, return MutableList or ImmutableList instead. That way, callers of the method will be able to chain usages of the rich API exposed by these interfaces.
downvote count: 0
upvote count: 2
type: Answer

http://stackoverflow.com/q/23129880
has body: I have an object which need to be updated "opereation", the following form is used to update it. I have a Double attribute called Montant that created the problem, I can't update it because the form return a String and not a double value, but when i want to update my object "operation", i found this error : Avertissement: Error setting value ognl.MethodFailedException: **Method "setMontant"** failed for object dao.Operation@1ed5095 [java.lang.NoSuchMethodException: **setMontant([Ljava.lang.String;)]** at ognl.OgnlRuntime.callAppropriateMethod(OgnlRuntime.java:823) at ognl.OgnlRuntime.setMethodValue(OgnlRuntime.java:964) at ognl.ObjectPropertyAccessor.setPossibleProperty(ObjectPropertyAccessor.java:75) at ognl.ObjectPropertyAccessor.setProperty(ObjectPropertyAccessor.java:131) at com.opensymphony.xwork2.ognl.accessor.ObjectAccessor.setProperty(ObjectAccessor.java:28) at ognl.OgnlRuntime.setProperty(OgnlRuntime.java:1656) ............................... Form.jsp &lt;s:form validate="true" namespace="/" name="form" id="form"&gt; &lt;s:select id="immatriculs" list="immatriculs" label="immatriculation" name="immatricul"&gt; &lt;/s:select&gt; &lt;&lt;s:textfield id="datepicker" name="dt_debut" label="Date début :" &gt; &lt;s:textfield id="montant" name="montant" label="Montant :"&gt; &lt;s:submit action="ajouterassurance" name="Enregistrer" value="Inserer"&gt; &lt;/s:submit&gt; &lt;/s:form&gt; pojo : public class Operation { private Integer idOperation; private Date dt_debut; private Double montant; private String immatricul; // setters and getters public Double getMontant() { return montant; } public void setMontant(Double montant) { this.montant = montant; } } Actionclass : public class GestionOperations extends ActionSupport implements ModelDriven&lt;Operation&gt;{ private Operation operation = new Operation(); private OperationService operationservice; public GestionOperations() { //contructor } public String add() { operationservice = new OperationServiceImpl(); oper…
has comment: http://stackoverflow.com/comment/35366424
type: Question
has comment: http://stackoverflow.com/comment/35371564
has comment: http://stackoverflow.com/comment/35363285
tagged with: struts2
has comment: http://stackoverflow.com/comment/35363017
has title: Struts2 : ognl.MethodFailedException: Method "setMontant" failed for object dao.Operation@1ed5095
downvote count: 0
favorite count: 0
type: UnansweredQuestion
tagged with: double
has comment: http://stackoverflow.com/comment/35363790
has comment: http://stackoverflow.com/comment/35362310
answer count: 0
score: 1
tagged with: java
upvote count: 1

http://stackoverflow.com/q/23161855
has comment: http://stackoverflow.com/comment/35419685
has title: Delete from Binary Search Tree in Java
score: 0
possible better answer: http://stackoverflow.com/a/23162034
answer count: 2
has comment: http://stackoverflow.com/comment/35419740
has answer: http://stackoverflow.com/a/23162051
has body: I can't find what is wrong with my deletion algorithm. When I run my delete method on the root of the BST, it will replace the root with the value of the minimum of the right subtree, but it is not deleting the node thereafter. public void delete(BinaryTreeNode node, int x){ if (node==null) return; else if (x&lt;node.getKey()) delete(node.getLeftChild(),x); else if (x&gt;node.getKey()) delete(node.getRightChild(),x); else{ if (node.getLeftChild()==null) node = node.getRightChild(); else if (node.getRightChild()==null) node = node.getLeftChild(); else{ BinaryTreeNode temp = findMin(node.getRightChild()); System.out.println(temp.getKey() + " " + node.getKey()); node.setKey(temp.getKey()); System.out.println(temp.getKey() + " " + node.getKey()); delete(node.getRightChild(), node.getKey()); } } } and my findMin() method: public BinaryTreeNode findMin(BinaryTreeNode node){ if (node.getLeftChild()==null) return node; else return findMin(node.getLeftChild()); } For a BST containing all integers 1-9 with a root of 4, my output for inorderPrint() yields 1,2,3,5,5,6,7,8,9 instead of 1,2,3,5,6,7,8,9
type: AnsweredQuestion
tagged with: binary-search-tree
has answer: http://stackoverflow.com/a/23162034
tagged with: java
has comment: http://stackoverflow.com/comment/35419755
type: Question
accepted answer: http://stackoverflow.com/a/23162051

http://stackoverflow.com/a/23181100
answers question: http://stackoverflow.com/q/23181064
type: AcceptedAnswer
type: Answer
upvote count: 1
score: 1
accepted answer of: http://stackoverflow.com/q/23181064
downvote count: 0
has body: At runtime, that file doesn't live in test/resources. Your build system/IDE will have put it inside a Jar, or somewhere in your classes/ directory. Either way, it will only be accessible via the classpath; getResourceAsStream() abstracts that away, so that's what you should be using. If you really need a filename (i.e. if that's an unavoidable aspect of how your class works*), then you should consider using JUnit's @TemporaryFolder rule; have your test setup copy the contents of the resource file into a temporary file, and then pass the name of that to your constructor. * And that sounds like a design flaw, you should consider rewriting your class to work with abstractions.

content-length
type: Tag
tag name: content-length
tags question: http://stackoverflow.com/q/23230025

http://stackoverflow.com/q/23180211
has answer: http://stackoverflow.com/a/23194857
score: 0
accepted answer: http://stackoverflow.com/a/23194857
answer count: 1
tagged with: smartgwt
type: AnsweredQuestion
tagged with: tabs
has title: smartGwt close clickHandler
type: Question
tagged with: gwt
has body: i am facing a problem with using the smartGWT CloseClickHandler , i added it to a tab , it is working good but my problem is, that it delete tha tab before i can do any thing with the event , what i want is to be able to show a confirmation window so the user can be sure he want to close the tab , so is there any handler that can do my code before deleting or hiding the tab Or is there any way to handle this situation using the tab CloseClickHandler ? my code is : tabSet = new TabSet(); tabSet .setWidth100(); tabSet .setOverflow(Overflow.HIDDEN); tabSet .setTabBarThickness(23); tabSet .setHeight(23); tabSet .setBackgroundColor("#e1dfdf"); tabSet .setCanCloseTabs(true); tabSet .setCloseTabIcon("icons/close_icon.png"); tabSet .setCloseTabIconSize(12); tabSet .addCloseClickHandler(new CloseClickHandler() { public void onCloseClick(TabCloseClickEvent event) { final int tabIndex = ((MyTab)event.getTab()).getId(); final MyTab = (MyTab)tabSet.getTab(tabIndex); int tabId = tab.getTabId(); int tabType = getType(); presenter.removeBasket(tabId, tabType); } });
tagged with: java

http://stackoverflow.com/q/23281105
score: 0
has comment: http://stackoverflow.com/comment/35634539
answer count: 1
has comment: http://stackoverflow.com/comment/35634283
has comment: http://stackoverflow.com/comment/35634248
has comment: http://stackoverflow.com/comment/35634528
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23282049
has comment: http://stackoverflow.com/comment/35634302
tagged with: java
has comment: http://stackoverflow.com/comment/35634453
has comment: http://stackoverflow.com/comment/35634301
has comment: http://stackoverflow.com/comment/35634378
has title: Project will not display search results
type: Question
has body: I have this project ive been working on all week and cannot get the search in Main.java in the switch case 3 to work. Any idea why this will not display?? Here it all is :( Main.Java package hartman; import java.util.ArrayList; import java.util.Scanner; public class Main { public static void main(String[] args) { Printer.printWelcome(); Scanner keyboard = new Scanner(System.in); ArrayList&lt;Person&gt; personList = new ArrayList&lt;&gt;(); boolean keepRunning = true; while (keepRunning) { Printer.printMenu(); Printer.printPrompt("Please enter your operation: "); String userSelection = keyboard.nextLine(); switch (userSelection) { case "1": Database.addPerson(personList); break; case "2": Database.printDatabase(personList); break; case "3": Printer.printSearchPersonTitle(); String searchFor = keyboard.nextLine(); Database.findPerson(searchFor); Printer.printPersonList(personList); break; case "4": keepRunning = false; break; default: break; } } Printer.printGoodBye(); keyboard.close(); } } Database.Java package hartman; import java.util.ArrayList; import java.util.Scanner; public class Database { static Scanner keyboard = new Scanner(System.in); private static ArrayList&lt;Person&gt; personList = new ArrayList&lt;Person&gt;(); public Database() { } public static void addPerson(ArrayList&lt;Person&gt; personList) { Printer.printAddPersonTitle(); Printer.printPrompt(" Enter first name: "); String addFirstName = keyboard.nextLine(); Printer.printPrompt(" Enter last Name: "); String addLastName = keyboard.nextLine(); Printer.printPrompt(" Enter social Security Number: "); String addSocial = keyboard.nextLine(); Printer.printPrompt(" Enter year of birth: "); int addYearBorn = Integer.parseInt(keyboard.nextLine()); System.out.printf("\n%s, %s saved!\n", addFirstName, addLastName); Person person = new Person(); person.setFirstName(addFirstName); person.setLastName(addLastName); person.setSocialSecurityNumber(addSocial); person.setYearBorn(addYearBorn); personList.add(person…

http://stackoverflow.com/q/23171680
answer count: 1
has comment: http://stackoverflow.com/comment/35436909
has comment: http://stackoverflow.com/comment/35437115
has comment: http://stackoverflow.com/comment/35436863
score: 0
has answer: http://stackoverflow.com/a/23171944
tagged with: outputstream
tagged with: string
has comment: http://stackoverflow.com/comment/35436896
has comment: http://stackoverflow.com/comment/35436773
has body: i have a question! I have a txt file (in a specific path that don't move) that contains a string which content is variable. i must use this string for input of my algorithm. A example of solution of txt file is 50 [40,-13,-6,-7,-4] [28,-40,45,-29,37] [-43,19,-24,-9,-45] [26,-41,-28,-16,44] or 4 [-3,-1,2] [-2,-4,1] [-3,2,1] [-2,3,-4] [4,2,1] [4,-1,2] [3,-4,1] [-3,-2,-4] I must use the number 50 or 4 or another number out of brackets as a int. but all the rest of the content must be extracted in a particular string that after will pass to a method. anyone have a solution? IMPORTANT: the contents of the file is variable
accepted answer: http://stackoverflow.com/a/23171944
has comment: http://stackoverflow.com/comment/35436946
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35436835
has title: read specific line from txt file java
tagged with: java
tagged with: inputstream
type: Question

http://stackoverflow.com/q/23208088
has comment: http://stackoverflow.com/comment/35501610
tagged with: java
tagged with: alphabetical
type: Question
has answer: http://stackoverflow.com/a/23208424
has comment: http://stackoverflow.com/comment/35501775
tagged with: arrays
tagged with: sorting
accepted answer: http://stackoverflow.com/a/23208313
score: 0
answer count: 3
has title: Unable to sort array in alphabetical order
possible better answer: http://stackoverflow.com/a/23208262
has answer: http://stackoverflow.com/a/23208262
linked to: http://stackoverflow.com/q/23208585
has comment: http://stackoverflow.com/comment/35501590
has comment: http://stackoverflow.com/comment/35501706
has comment: http://stackoverflow.com/comment/35501654
has body: I am currently trying to sort an array alphabetically I am having troubles with step 3. Here is my current code : import java.util.Arrays; import hsa.Console; public class HowToSortAnArray { static Console c; public static void main(String[] args) { c = new Console (); String[] myStrArray = new String[500]; for(int i=0;i&lt;5;i++) { c.print("Input word: "); myStrArray[i]=c.readLine(); } Arrays.sort(myStrArray, String.CASE_INSENSITIVE_ORDER); for (int a = 0; a &lt; myStrArray.length; a++) { c.println(myStrArray[a]); } } } Can anyone explain to me why this code isn't working an this one is: String[] words = new String[] {"b", "b", "a", "D"}; Arrays.sort(words, String.CASE_INSENSITIVE_ORDER); for (int a = 0; a &lt; words.length; a++) { c.println(words[a]); } Does it have something to do with declaring array values? I am pretty lost.
has answer: http://stackoverflow.com/a/23208313
type: AnsweredQuestion

http://stackoverflow.com/q/23220103
score: 0
has answer: http://stackoverflow.com/a/23220415
has title: How to replace the value of '0' in a given pattern?
answer count: 1
accepted answer: http://stackoverflow.com/a/23220415
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35522137
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/35523147
has comment: http://stackoverflow.com/comment/35522154
has body: I am new in java, and i am trying to replace the value of "0's" with "x" at index "0,1,7,13,20,21,22, and 23" in below given sequence of 0 and 1's. And the code so far is given. Their is some problem due to which i can not obtain desired result. 001111 101110 100010 110000 public class Task { public static void main (String args[]) { File file = new File("C:\\NetBeansProjects\\Task\\src\\File.txt"); BufferedReader reader = null; try { reader = new BufferedReader(new FileReader(file)); String text = null; //Array lis declaration ArrayList&lt;String&gt; list = new ArrayList&lt;&gt;(); while( (text = reader.readLine()) != null){ list.add(text); } //printing Array list. System.out.println("Print Array list\n"); for(String d:list){ // System.out.println(d); } //Convert ArrayList into 2DArray int noOfLines = 0; String[][] array = new String[list.size()][]; for(int i=0; i &lt; list.size(); i++){ String row = list.get(i); noOfLines++; array[i] = row.split("\0"); } System.out.println("Befor"); print(array); int row=0,column=0; for(int count=0; count&lt;array.length; count++){ if(row&lt;noOfLines-1 &amp;&amp; array[row+1][column]=="0"){ row++; } else if(column&lt;array[row].length-1 &amp;&amp; array[row][column+1]=="0"){ column++; } array[row][column] = "x"; } // array[0][0] = "x"; System.out.println("After"); print(array); //end try Block } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } //end Catch Block } //end main public static void print(String[][] array){ for(int i=0; i&lt;array.length; i++){ for(int j=0; j&lt;array[i].length; j++){ System.out.print(array[i][j]); } System.out.println(""); } } //end function print. } //end Class

image-processing
tags question: http://stackoverflow.com/q/23197793
tags question: http://stackoverflow.com/q/23223716
tags question: http://stackoverflow.com/q/23197490
tags question: http://stackoverflow.com/q/23233060
type: Tag
tags question: http://stackoverflow.com/q/23231252
tags question: http://stackoverflow.com/q/23269645
tags question: http://stackoverflow.com/q/23130736
tags question: http://stackoverflow.com/q/23203778
tags question: http://stackoverflow.com/q/23281582
tags question: http://stackoverflow.com/q/23184463
tag name: image-processing
tags question: http://stackoverflow.com/q/23255734
tags question: http://stackoverflow.com/q/23289387
tags question: http://stackoverflow.com/q/23157987
tags question: http://stackoverflow.com/q/23280548

http://stackoverflow.com/comment/35450190
type: Comment
has text: If inside list is int type value you can get the sum of list as `int sum=0; for(int i=0;i<ls.size();i++) { //ls is your list sum+=ls.get(i); } bean.setAvg(sum);//provided if avg is int type property ` and get it inside jsp like this `<jsp:getProperty name="{Bean id}" property="avg"/>` as described in link.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23172993

http://stackoverflow.com/a/23285453
score: 0
type: AcceptedAnswer
has body: I think you should be able to achieve this with a ThresholdFilter. Make your root logger level TRACE so that it sends all events to all appenders, then put different threshold filters on each appender. The log4j2 manual contains an example. (EDIT) After understanding the requirements better, I think the SMTP Appender already does what you need: it internally keeps a buffer of the events (512 by default) that preceded the ERROR event that triggered the email. These preceding events will be included in the email.
type: Answer
has comment: http://stackoverflow.com/comment/35711924
has comment: http://stackoverflow.com/comment/35643740
has comment: http://stackoverflow.com/comment/35766004
has comment: http://stackoverflow.com/comment/35776246
answers question: http://stackoverflow.com/q/23278467
has comment: http://stackoverflow.com/comment/35811069
accepted answer of: http://stackoverflow.com/q/23278467

http://stackoverflow.com/q/23142511
score: 0
tagged with: swing
has answer: http://stackoverflow.com/a/23143048
tagged with: actionlistener
tagged with: java
type: UnansweredQuestion
answer count: 1
has comment: http://stackoverflow.com/comment/35386024
has title: Java Swing Menu Beginners Advice
has body: I just started studying some java GUI techniques and I have created a small program which has a menu bar a menu as well as an item within that menu. Now what I want to do is to implement a file chooser so when the item in the menu is selected then the file chooser is executed. The problem is that the file chooser that I created is in another class. Is there any possible way to start my file chooser's class when the item in the menu is clicked? Here is my code public class menu { public static void main(String[] args){ //to menu JFrame frame = new JFrame("Menu"); frame.setVisible(true); frame.setSize(600,400); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JMenuBar bar = new JMenuBar(); frame.setJMenuBar(bar); JMenu search = new JMenu("Browse"); bar.add(search); final JMenuItem songstoplay = new JMenuItem("Browse Songs To Play"); search.add(songstoplay); //to outline final Container content = frame.getContentPane(); content.setLayout(new GridLayout(3, 1)); JLabel text = new JLabel("My first iteration", JLabel.CENTER); text.setVerticalAlignment(JLabel.TOP); text.setFont(new Font("Serif", Font.PLAIN, 30)); content.add(text); JLabel text2 = new JLabel(); text2.setText("List of drives connected: C:/"); text2.setFont(new Font("Serif", Font.PLAIN, 20)); text2.setVerticalAlignment(JLabel.TOP); content.add(text2); } }
has comment: http://stackoverflow.com/comment/35385721
type: Question
tagged with: menu
has comment: http://stackoverflow.com/comment/35385825

http://stackoverflow.com/comment/35626502
type: AnswerComment
has text: @NESPowerGlove I think i++ contain both read and write, I will update my answer.
type: Comment
comment on: http://stackoverflow.com/a/23273588
score: 0

http://stackoverflow.com/a/23149696
downvote count: 0
answers question: http://stackoverflow.com/q/23148611
has comment: http://stackoverflow.com/comment/35408575
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/35410533
has comment: http://stackoverflow.com/comment/35410039
upvote count: 2
has body: RSA works on numbers. This is different than e.g. AES that works on bits and bytes. So, during the calculation, 041 is identical to 41. However, you explicitly split your plaintext up into 3 digit values. So the only thing you have to do is to add 0 characters to the left until you have 3 digits. The only thing left is the final number. You could pad with zeros and add a final (encrypted?) value that specifies how many zero's were added at the end. Now there is another problem; you don't have delimiters. This can be solved by using the octal encoding of the characters instead. Check this ASCII table and look under Octal. Additional advantage in this case is that you get one character per decrypted value. Obviously you could also left pad each decimal representation with zero's until you get 3 decimal characters per character in "Save The Queen".

http://stackoverflow.com/comment/35510153
type: QuestionComment
has text: @a_horse_with_no_name... your right but i want to change it using mouse and it should be like the way we are changing the Jtable/Jxtable column resizing
comment on: http://stackoverflow.com/q/23211378
score: 0
type: Comment

http://stackoverflow.com/a/23246240
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/23246146
has body: your code is not thread safe. let say that you do 2 calls from 2 thread to MySimgleton().getInstance() If the context switch happens after the if - then you will create 2 instances
upvote count: 2
score: 2

http://stackoverflow.com/q/23132061
upvote count: 0
favorite count: 0
has body: am making a class where the user gives input in few text boxes ,want to get that values and display it on another class having a text view.Can anyone show the correct way of doing it based on the laid oops principle .Please do provide examples for the reason...Thanks P.s Just to be clear the Don’t want to start another activity by using intent want to store the data until a call is made
tagged with: android
score: -1
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23132376
downvote count: 1
has title: How to get the values of variables in a different class
tagged with: java
has answer: http://stackoverflow.com/a/23132179
type: Question
answer count: 2

http://stackoverflow.com/comment/35439428
type: Comment
has text: Also this would be smaller when written to a file because you don't need to store the location of the tiles, you can just store all the tiles, without having to worry about position. If you use RLE this would be _even_ shorter because you don't have to do duplicates.
comment on: http://stackoverflow.com/a/23162927
type: AnswerComment
score: 0

http://stackoverflow.com/q/23166104
tagged with: adt
has title: Android Eclipse ADT Widget Palette
tagged with: eclipse
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/23166190
has body: I'm learning how to build android apps and I have a simple question about the Eclipse ADT software. I tried to figure out the reason on google but I was unlucky. Does anyone could explain me why I have an old widget palette on my Eclipse ADT? The guy at Lynda works with different widgets and the Google Developer site shows a different palette too. Thanks in advance! My Palette / Tutorial Palette / Google Site Palette's Differences pic
type: UnansweredQuestion
tagged with: android
tagged with: java
type: Question

http://stackoverflow.com/comment/35477892
has text: check edit, I have made you a method to find the number of occurences and another to find all positions
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23194722
type: Comment

http://stackoverflow.com/a/24505596
answers question: http://stackoverflow.com/q/23270641
type: Answer
downvote count: 0
score: 1
has body: I guess that is a part of the doc you have been looking for... If you want to do complex queries linearly, you can even use Reverse Polish Notation (of all things). There is a Where.or(int) and Where.and(int) methods which do the operation on the previous number of specified clauses. where.eq(Account.NAME_FIELD_NAME, "foo"); where.eq(Account.PASSWORD_FIELD_NAME, "_secret"); // this does an AND between the previous 2 clauses // it also puts a clause back on the stack where.and(2); where.eq(Account.NAME_FIELD_NAME, "bar"), where.eq(Account.PASSWORD_FIELD_NAME, "qwerty"))); // this does an AND between the previous 2 clauses // it also puts a clause back on the stack where.and(2); // this does an OR between the previous 2 AND clauses where.or(2);
upvote count: 1

http://stackoverflow.com/comment/36370387
comment on: http://stackoverflow.com/a/23133898
type: Comment
has text: So, Before the assertTrue, I should have a piece of code to determine the Parnent-Element? Someting like parent = (driver.findelement(By.Id("text")?
type: AnswerComment
score: 0

http://stackoverflow.com/comment/53407878
type: AnswerComment
type: Comment
has text: Do the same with `Field annotations` to avoid line breaks for fields. This is helpful when using View Injectors, like `ButterKnife` or `Dagger`
comment on: http://stackoverflow.com/a/23258356
score: 12

http://stackoverflow.com/q/23133651
has answer: http://stackoverflow.com/a/23147978
type: Question
tagged with: native
tagged with: java-native-interface
has title: Call base method from native part of inherite (Android)
answer count: 1
downvote count: 0
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/35370278
type: UnansweredQuestion
tagged with: android
tagged with: java
upvote count: 1
has body: My classes hierarchy looks that // Form is my own class // Dialog is android class "android/app/Dialog" class Form extends Dialog { @override onBackPressed() { /*IMPLEMENTATION HERE*/ } } I've got the native part of Form class where I should call the super.onBackPressed(); if I try GetMethodID("android/app/Dialog", "onGetPressed", "()V"); it calls the From.onBackPressed() methon not the Dialog.onBackPressed(); if Someone could tell me how to call super.onBackPressed() without making stub function in java like void superOnBackPressed() { super.onBackPressed() } I would be sooooooo happy =)

http://stackoverflow.com/comment/35485565
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23199488
has text: @BheshGurung I have read that, however I seem to not be able to apply that information on my usecase here.

http://stackoverflow.com/a/23211168
has body: Try adding these attributes to your class in C# and check if the input is ok in Java. [ProtoContract] class Person { [ProtoMember(1)] public string id = "1"; }
type: Answer
has comment: http://stackoverflow.com/comment/35508941
answers question: http://stackoverflow.com/q/23207981
score: 0

http://stackoverflow.com/a/23170256
has body: I'm missing a lot of context here, what is it that is not working for you? I assume you are seeing an error on the jframe.newEmployee(); command saying that the method is undefined, if so then that is reasonable because the JFrame class does not have that method, if your class is class ProdJFrame and it extends JFrame and has that method, then you need to do ((ProdJFrame)jframe).newEmployee();
score: 0
has comment: http://stackoverflow.com/comment/35434391
answers question: http://stackoverflow.com/q/23170144
type: Answer

http://stackoverflow.com/comment/35506662
has text: @TugrulASLAN check out the edit..you need to format your date not parse it
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23184996

http://stackoverflow.com/comment/35506077
score: 2
comment on: http://stackoverflow.com/q/23210857
has text: What line is throwing the exception? What is the value of `bytelength`?
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35518990
score: 0
type: Comment
has text: Thanks Sean F, your solution does work. I think two XML nodes with the same name on the same level but with different namespace is not good design, right?
comment on: http://stackoverflow.com/a/23211222
type: AnswerComment

http://stackoverflow.com/a/23258211
score: 0
answers question: http://stackoverflow.com/q/23257785
type: Answer
accepted answer of: http://stackoverflow.com/q/23257785
has body: You cannot directly remove an element from an array in Java. You two choices: A. If you must preserve the order of the elements in the array: Begin at the index you want to remove, and shift each element "down" one index (toward index 0), as in: public String removeEntry(String name) { String result = null; int index = find(name); if (index &gt;= 0) { result = thePhonebook[index].telno; for (int i = index + 1; i &lt; thePhonebook.length; ++i) { thePhonebook[i - 1] = thePhonebook[i]; if (thePhonebook[i] == null) { break; } } thePhonebook[thePhonebook.length - 1] = null; } return result; } In the above implementation, the value null in the array signifies the end of the list. B. If the order of the elements in the array doesn't matter: Swap the element you want to remove with the last element of the list. Note that to do this you need to maintain a length value for the list, which is the value thePhonebookLength in the code below. public String removeEntry(String name) { String result = null; int index = find(name); if (index &gt;= 0) { result = thePhonebook[index].telno; thePhonebook[index] = thePhonebook[thePhonebookLength - 1]; thePhonebook[--thePhonebookLength] = null; } return result; } A benefit of both of these solutions is that the array is modified in place, without using allocation. Having offered these possibilities, I suggest that using a collection is better suited for your purposes -- such as one of the List subclasses, or perhaps even a Map if lookups by name are common.
type: AcceptedAnswer

http://stackoverflow.com/q/23222603
upvote count: 1
type: AnsweredQuestion
tagged with: fxml
has answer: http://stackoverflow.com/a/23223723
score: 1
tagged with: java
tagged with: javafx
has answer: http://stackoverflow.com/a/23223165
type: Question
possible better answer: http://stackoverflow.com/a/23223165
accepted answer: http://stackoverflow.com/a/23223723
answer count: 2
tagged with: window
downvote count: 0
favorite count: 0
has body: I'm creating an application that will have a window over top of another, similar to the general idea seen here. I'm still new to JavaFX and am looking for a simple way of accomplishing this but with more complicated forms, each with their own .fxml files. This is what I have so far: public void btnNewProjectClicked(){ //! this should open the other form, but it doesn't Parent root; try { root = FXMLLoader.load(getClass().getClassLoader().getResource("../fxml/NewProject.fxml")); Scene scene = new Scene(root, 300, 250); Stage stage = new Stage(); stage.setTitle("It works!"); stage.setScene(scene); stage.show(); } catch (IOException e) { e.printStackTrace(); } } Everything works fine with the parent window until btnNewProjectClicked is called. Once it is, I get a slew of errors: Exception in thread "JavaFX Application Thread" java.lang.RuntimeException: java.lang.reflect.InvocationTargetException at javafx.fxml.FXMLLoader$MethodHandler.invoke(Unknown Source) at javafx.fxml.FXMLLoader$ControllerMethodEventHandler.handle(Unknown Source) at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(Unknown Source) at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(Unknown Source) at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(Unknown Source) at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(Unknown Source) at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source) at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source) at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source) at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source) at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source) at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source) at com.sun.javafx.event.EventUtil.fireEventImpl(Unknown Source) at com.sun.javafx.event.EventUtil.fireEvent(Unknown Source) at javafx.event.Event.fireEvent(Unkno…
has title: Open Two Windows Simultaneously - JavaFX

http://stackoverflow.com/q/23249533
tagged with: java
has comment: http://stackoverflow.com/comment/35582583
tagged with: logcat
has comment: http://stackoverflow.com/comment/35575632
has comment: http://stackoverflow.com/comment/35575072
has comment: http://stackoverflow.com/comment/35575910
answer count: 0
has comment: http://stackoverflow.com/comment/35580428
tagged with: adt
has title: Why are my objects not keeping the data they are constructed with?
type: UnansweredQuestion
has body: I am building an Android application in Java to navigate three buildings on a campus. The user enters the room number of the room they are in, and the room number of the room they wish to travel to, and are given directions to get from one to the other. As part of this, I made a WorldMap class to hold the map, and defined in it a bunch of nodes to use for pathfinding. The nodes declare perfectly fine as far as I've been able to tell, yet when I tried to access them from within the WorldMap class's methods, the program threw a NullPointerException. I investigated this, and Eclipse tells me that every single one of the nodes' fields are set to null values. While I'm not entirely new to Java, I am still relatively new, having used pretty much entirely C++ in the past, and I have absolutely no idea what I am looking at here and no idea where to start looking. On to the code, then. This is an example of how the nodes are declared: Node g2 = new Node( new ConnectionTo[] { new ConnectionTo(new Node(new Coordinates()), new Room[]{}, Direction.north), new ConnectionTo(new Node(new Coordinates(0,3,8)), new Room[]{}, Direction.east), new ConnectionTo(new Node(new Coordinates(0,4,7)), new Room[]{}, Direction.south), new ConnectionTo(new Node(new Coordinates(0,3,6)), new Room[]{new Room("104",new String[]{"left","right"}),new Room("120",new String[]{"right","left"})}, Direction.west), new ConnectionTo(new Node(new Coordinates()), new Room[]{}, Direction.up), new ConnectionTo(new Node(new Coordinates()), new Room[]{}, Direction.down) }, new Coordinates(0,3,7) ); This is how the nodes are stored: Node[][][] map = { { //first floor //00 01 02 03 04 05 06 07 08 09 {dne, dne, dne, dne, dne, cls, dne, dne, dne, dne}, //00 {dne, dne, dne, dne, oc, cl, cf, dne, dne, dne}, //01 {dne, dne, dne, dne, dne, dne, dne, dne, dne, dne}, //02 {dne, dne, dne, dne, og2, g4, gc, g2, gs1, dne}, //03 {dne, dne, dne, dne, dne, dne, gs2, g1, g3, dne}, //04 {dne, ot3, dne, ot1, op, dne, og1, gal, dne, dn…
has comment: http://stackoverflow.com/comment/35576194
tagged with: nullpointerexception
has comment: http://stackoverflow.com/comment/35580832
has comment: http://stackoverflow.com/comment/35587771
has comment: http://stackoverflow.com/comment/35575297
has comment: http://stackoverflow.com/comment/35576338
has comment: http://stackoverflow.com/comment/35575504
downvote count: 0
has comment: http://stackoverflow.com/comment/35575576
score: 1
has comment: http://stackoverflow.com/comment/35575364
has comment: http://stackoverflow.com/comment/35575639
has comment: http://stackoverflow.com/comment/35576010
favorite count: 0
has comment: http://stackoverflow.com/comment/35575774
has comment: http://stackoverflow.com/comment/35575197
type: Question
has comment: http://stackoverflow.com/comment/35575630
tagged with: android
has comment: http://stackoverflow.com/comment/35575844
upvote count: 1
has comment: http://stackoverflow.com/comment/35575982
has comment: http://stackoverflow.com/comment/35575710
has comment: http://stackoverflow.com/comment/35576019
has comment: http://stackoverflow.com/comment/35575904
has comment: http://stackoverflow.com/comment/35576009
has comment: http://stackoverflow.com/comment/35575354

http://stackoverflow.com/q/23222123
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/35527340
has title: Language independent storage class?
answer count: 1
has comment: http://stackoverflow.com/comment/35611462
has body: so I feel like this is a thing that I've seen before, but I can't think what it's called. I have a java program which loads up an object from a file (I'm going to call this object the catalogue). Defining the file format, and writing the parser for it has taken a fair amount of time. Recently I've had developers that are want to load the file so they can use the catalogue for their own tools, but are working in a different language (current just C#, but potentially others in future). Most of our tools run out on a server, so to prevent other people having to write their own parser for the file format, I plan on having a web service running which uses my program to load the catalogue, then returns it's contents as a json string. (Encoding the original file as json is not an option). In future I may just return bits of the json string, since the whole contents of the file can be pretty massive. What I'm wondering is, do I have to write my catalogue object in each language, and write a json parser for it in that language, or is there a tool that will allow me to do something similar? I'm hoping for something that just has a simple format for declaring storage classes, generate corresponding code for various languages, and have a default serialize/deserialize for something like json. Currently I'd need it to support java and C#. Does such a thing exist?
score: 0
tagged with: storage
has answer: http://stackoverflow.com/a/23222846
type: UnansweredQuestion
type: Question
tagged with: c#

http://stackoverflow.com/a/30828743
answers question: http://stackoverflow.com/q/23211625
score: 0
has body: It looks like javax.management.* is not available in the current set of APIs offered by the Android platform. That means it's safe to suppress the warning... for now. But if Android ever decides to add this class, there will be trouble. In my case, however, javaee-api was being required but did not seem to be actually used, so I could just suppress this dependency as follows (syntax taken from here): compile("io.grpc:grpc-all:0.7.1") { exclude group: "javax" } If you do actually need something from the javaee-api package, you should use JarJar to rename it, as suggested by the error message. The jarjar-gradle plugin would come in useful here.
type: Answer

http://stackoverflow.com/comment/45178124
has text: the second part of the answer helped me out here. my Java version was 8 and now i'm going for a jdk-7u75 . i think that will work for me.
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/23204986

http://stackoverflow.com/comment/35439676
type: Comment
has text: @roxdragon check this http://stackoverflow.com/questions/12739909/send-data-from-activity-to-fragment-in-android. Pls make it clear in your question. You haven't mentioned fragment at all
type: AnswerComment
comment on: http://stackoverflow.com/a/23173054
score: 0

http://stackoverflow.com/q/23164582
tagged with: java
has answer: http://stackoverflow.com/a/23206506
has comment: http://stackoverflow.com/comment/35425002
has title: Run perl script through Java using ProcessBuilder
type: Question
has comment: http://stackoverflow.com/comment/35424956
answer count: 1
has body: I have a perl script that i'm trying to execute through shell. The normal UNIX shell invocation is do is: /home/projects/bumble/script.pl --input /home/input/input.txt > /home/output/output.txt. To do this in Java I wrote a function: public void runCommand(String command, File directory) { final ProcessBuilder pb = new ProcessBuilder(command); pb.directory(directory); final Process process = pb.start(); if(process.waitFor() != 0) { throw new RuntimeException("ERROR"); } } I call this: String command = "/home/projects/bumble/script.pl --input /home/input/input.txt &gt; /home/output/output.txt"; File directory = new File("/home/projects/bumble"); runCommand(command,directory); The exception I get is: java.io.IOException: ... Cannot run program error=2, No such file or directory I notice here: java.io.IOException: Cannot run program error=2, No such file or directory, implies that running programs given a full input with > into a completely different directory would fail. If I just run the command /home/projects/bumble/script.pl --input /home/input/input.txt, also fails with the same error. I run it directly through shell, it does work. Is there something I am missing or doing incorrectly?
upvote count: 1
has comment: http://stackoverflow.com/comment/35424618
linked to: http://stackoverflow.com/q/11787479
favorite count: 0
has comment: http://stackoverflow.com/comment/35424583
downvote count: 0
accepted answer: http://stackoverflow.com/a/23206506
type: AnsweredQuestion
score: 1

http://stackoverflow.com/a/27150933
has body: you can change your configuration file like this. # Root logger option log4j.rootLogger= ALL,file, stdout And log4j.appender.stdout.Threshold=INFO change level like ALL its print all level logs TRACE to FATAL
downvote count: 0
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/23133479
answers question: http://stackoverflow.com/q/23133479
score: 1
upvote count: 1

http://stackoverflow.com/comment/35559838
type: QuestionComment
comment on: http://stackoverflow.com/q/23137134
has text: Hi Angelo, Thanks for checking this. Please find the Stacktrace appended with the main content. Let me know if you need anymore details.
score: 0
type: Comment

http://stackoverflow.com/q/23158133
has answer: http://stackoverflow.com/a/23158185
has title: Adding rows from JTable to another JTable
tagged with: swing
type: AnsweredQuestion
tagged with: java
type: Question
has body: I'm onto the last part of my project, this is one of the last problems I'm having with it. This part is for editing a booking, i.e changing the rooms booked for a particular booking. I have 2 JTables, one with available rooms and another with rooms already booked for that booking. Both have separate DefaultTable models and 2D Object arrays. I have an add and a remove button between the two tables, which swaps over the row you have selected. The problem is that it works fine for the first add/remove, but I think I'm not refreshing the 2D array. On the second attempt to add another row the model is still referring to the original 2D array, as I don't remove the row from the 2D array so it gives me the wrong row data. Is there an easier way of addressing this issue using a JTable/model method, rather than creating a temporary 2D object array to exclude the selected row? Example code below to show the ActionPerformed code. if(e.getSource().equals(addRow)){ System.out.println(tableLeft.getSelectedRow()); if(tableLeft.getSelectedRow() == -1){ //if no row selected } else{ model.insertRow(tableRight.getRowCount(),array2dLeft[tableLeft.getSelectedRow()]); modelLeft.removeRow(tableLeft.getSelectedRow()); modelLeft.fireTableRowsDeleted(tableLeft.getSelectedRow(),tableLeft.getSelectedRow()); txtTotalCost.setText("€" + getTotalCost()); } } if(e.getSource().equals(removeRow)){ if(tableRight.getSelectedRow() == -1){ //if no row selected } else{ modelLeft.insertRow(tableLeft.getRowCount(),array2dLeft[tableRight.getSelectedRow()]); model.removeRow(tableRight.getSelectedRow()); txtTotalCost.setText("€" + getTotalCost()); } } }
tagged with: arrays
tagged with: jtable
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/23158185

couchbase
tags question: http://stackoverflow.com/q/23262620
tag name: couchbase
type: Tag

http://stackoverflow.com/q/23273562
type: UnansweredQuestion
tagged with: filewriter
tagged with: maven
has comment: http://stackoverflow.com/comment/35619759
type: Question
has comment: http://stackoverflow.com/comment/35619916
tagged with: java
has comment: http://stackoverflow.com/comment/35619471
has comment: http://stackoverflow.com/comment/35619608
has comment: http://stackoverflow.com/comment/35619628
score: 0
linked to: http://stackoverflow.com/q/17554085
has comment: http://stackoverflow.com/comment/35619502
has title: Can you write to a file in src/main/resources?
has body: Question is in the Title, Here's my code which dosen't seem to work: File counterValues = new File(getClass().getResource(COUNTER_VALUES_FILE).getFile()); FileWriter out = new FileWriter(counterValues); out.write("TEST"); out.close(); where COUNTER_VALUES_FILE is private static final String COUNTER_VALUES_FILE = "/data/counter_values.csv"; I have also tried: File counterValues = new File(getClass().getResource(COUNTER_VALUES_FILE).toURI()); It has made me believe it might not be possible, but i don't see why not if i can read from the file!
tagged with: file-io
has comment: http://stackoverflow.com/comment/35619524
answer count: 0

http://stackoverflow.com/comment/35524869
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23220988
score: 0
has text: Moreover, I must use plugins and automatic agents to generate Entities (it's a project restriction) and the proposed approach would require my intervention every time I edit the table structure

http://stackoverflow.com/a/23188646
upvote count: 1
has body: All of the Scanner methods you use will throw an IllegalStateException if the scanner is closed when you attempt to use them. Somewhere in your code, you likely have keyboard.close(). Delete this line, or move it to the end of your program, and you're golden. From the Java documentation: Attempting to perform search operations after a scanner has been closed will result in an IllegalStateException.
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/23188433
type: Answer

http://stackoverflow.com/a/23288886
has comment: http://stackoverflow.com/comment/35738432
has comment: http://stackoverflow.com/comment/35683915
has comment: http://stackoverflow.com/comment/35650168
score: -1
has body: Your aim is very unclear from the code. I presume you want some functionality like tail command in linux..if so, Below code is helpful..please run it and check it out.. import java.io.*; public class FileCheck { static long sleepTime = 1000 * 1; static String file_path = "/dev/ttyO1"; public static void main(String[] args) throws IOException { BufferedReader input = new BufferedReader(new FileReader(file_path)); String currentLine = null; while (true) { if ((currentLine = input.readLine()) != null) { System.out.println(currentLine); continue; } try { Thread.sleep(sleepTime); } catch (InterruptedException e) { Thread.currentThread().interrupt(); break; } } input.close(); } }
upvote count: 0
has comment: http://stackoverflow.com/comment/35679012
has comment: http://stackoverflow.com/comment/74814203
type: Answer
answers question: http://stackoverflow.com/q/23288595
downvote count: 1

http://stackoverflow.com/comment/35379096
comment on: http://stackoverflow.com/q/23138974
score: 0
type: Comment
type: QuestionComment
has text: Refer to BackSlash's comment. He is correct.

http://stackoverflow.com/a/23245616
answers question: http://stackoverflow.com/q/23235385
has comment: http://stackoverflow.com/comment/35612011
has comment: http://stackoverflow.com/comment/35590821
has comment: http://stackoverflow.com/comment/35612653
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/35611464
has comment: http://stackoverflow.com/comment/35612536
has body: What version of Processing are you using? If you're using the latest, you can simply export your sketch as an application and then use SvgExe to create a self-extracting runnable jar from Processing's output. Or you can convert the code into a Java application, but that's not going to be as simple as importing the .pde files. Tutorial here: http://processing.org/tutorials/eclipse/

http://stackoverflow.com/q/23154061
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23154104
tagged with: java
has title: Basic linked list implementation in java
type: Question
has body: I am looking for the basic implementation of linked list in Java which has insert() and remove() method. Thanks.
has comment: http://stackoverflow.com/comment/35405170
tagged with: data-structures
accepted answer: http://stackoverflow.com/a/23154104
upvote count: 0
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/35405132
downvote count: 8
score: -8

http://stackoverflow.com/a/27153560
answers question: http://stackoverflow.com/q/23248824
has body: The processing of output is so annoying, that I wrote little library called jproc that deals with the problem of consuming stdout and stderr. It can simply filter strings through external programs likes this: ProcBuilder.filter("x y z","sed" ,"s/y/a/") It also lets you specify a timeout for the completion and will convert non-zero exit codes into exception.
score: 0
type: Answer

http://stackoverflow.com/comment/35603235
type: Comment
comment on: http://stackoverflow.com/a/23264536
has text: Yeap. Sorry. I think the two instances of Integer will be give a different hashcode.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/35609430
score: 0
type: Comment
type: QuestionComment
has text: What is the error message ?
comment on: http://stackoverflow.com/q/23268339

http://stackoverflow.com/a/23171147
has comment: http://stackoverflow.com/comment/35435903
has comment: http://stackoverflow.com/comment/35444257
answers question: http://stackoverflow.com/q/23164152
has comment: http://stackoverflow.com/comment/35519267
has comment: http://stackoverflow.com/comment/35455089
has comment: http://stackoverflow.com/comment/35455002
type: Answer
score: 0
has body: You should use EntityManager instead of HibernateTemplate wich is deprecated from Spring 2.5 @Repository public class GenericService&lt;T&gt; implements IGenericService&lt;T&gt; { protected EntityManager em; public EntityManager getEm() { return em; } @PersistenceContext public void setEm(EntityManager em) { this.em = em; } @Transactional @Override public T create(final T t) throws DefaultException{ return this.em.persist(t); } ... }

http://stackoverflow.com/comment/35539053
type: QuestionComment
type: Comment
has text: @NikolayShmyrev I just posted the error I am getting. Also, if there was a typo wouldn't it throw the same exception in eclipse? As for the table it was too long to put on here but edu/cmu/sphinx is apart of it. I did also extract the jar to double check.
comment on: http://stackoverflow.com/q/23227142
score: 0

http://stackoverflow.com/a/23191079
has comment: http://stackoverflow.com/comment/35471044
answers question: http://stackoverflow.com/q/23191009
type: Answer
has body: The problem i think is with initialization(or rather not doing that), static int count; public static ArrayList&lt;String&gt; values = new ArrayList&lt;String&gt;(); private static ArrayList&lt;String&gt; sharedList; Now for eg, not initialized count to a value before: count++; if(count==1){ Same needs to be done for sharedList, like new ArrayList... And yes, the reason being onCreate() is not called before onResume() every time, for more on the refer Android Activity Life Cycle Check Figure 1. The activity lifecycle. on that link. It will give you a better idea for your implementation/requirement and how to initialize or work with sharedPref and other components for your activity.
score: 0
has comment: http://stackoverflow.com/comment/35471016

http://stackoverflow.com/comment/35632476
type: Comment
comment on: http://stackoverflow.com/a/23280089
has text: What about just an array? you could add the number to the end, then sort it.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/35428512
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/23166687
has text: What's the error? Shouldn't you `connectSocket` before `sendData`? Also you are passing a single byte to `sendData(byte[] byteData)`.
type: Comment

http://stackoverflow.com/q/23143344
favorite count: 0
possible better answer: http://stackoverflow.com/a/23143372
has comment: http://stackoverflow.com/comment/35387211
has comment: http://stackoverflow.com/comment/35387288
answer count: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23143372
score: 1
has answer: http://stackoverflow.com/a/30273747
tagged with: java
has answer: http://stackoverflow.com/a/23143417
accepted answer: http://stackoverflow.com/a/23143417
type: Question
has answer: http://stackoverflow.com/a/23143392
has title: Simplifying statements
has body: I am working on a project and I am using Intellij IDEA. While I was writing I got a notification that my if-statement could be simplified. (Note that I am still new to coding) It says: Reports if statements which can be simplified to single assignment or return statements. For example: if (foo()) { return true; } else { return false; } can be simplified to return foo(); How does this work? Say foo() is the number 4, wouldn't this just return 4 instead of true? What am I misunderstanding? Edit Here is the code I am writing: if (row &gt; 0 &amp;&amp; row &lt; 4 &amp;&amp; col &gt; 0 &amp;&amp; col &lt; 4) { return false; } else { return true; } and it can be simplified to: return !(row &gt; 0 &amp;&amp; row &lt; 4 &amp;&amp; col &gt; 0 &amp;&amp; col &lt; 4); I just don't understand how this is simplified.
tagged with: intellij-idea
has comment: http://stackoverflow.com/comment/35387293
upvote count: 2
has comment: http://stackoverflow.com/comment/35387214
downvote count: 1
tagged with: simplify
has comment: http://stackoverflow.com/comment/35387294

http://stackoverflow.com/q/23144864
has comment: http://stackoverflow.com/comment/35389956
type: Question
has comment: http://stackoverflow.com/comment/35390676
downvote count: 0
has comment: http://stackoverflow.com/comment/35389925
has comment: http://stackoverflow.com/comment/35390158
has comment: http://stackoverflow.com/comment/35389953
has body: That is a phone interview question. Assume you have a C++ code, you want to implement the code by using Java rather than rewriting the code. How would you solve that? I cannot figure out this question. Can anyone told me the solution?(is it possible by import some package or java library?) Thanks
answer count: 1
has answer: http://stackoverflow.com/a/23144993
has comment: http://stackoverflow.com/comment/35389977
favorite count: 0
has comment: http://stackoverflow.com/comment/35389873
has comment: http://stackoverflow.com/comment/35389958
accepted answer: http://stackoverflow.com/a/23144993
upvote count: 1
tagged with: c++
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35389919
has comment: http://stackoverflow.com/comment/35389909
has comment: http://stackoverflow.com/comment/35389899
score: 1
tagged with: java
has title: how to use java to implement C++ code

http://stackoverflow.com/comment/35910523
has text: After read=all, write=all in manager.conf and restart *, not only manager reload in CLI, I can see all events Thanks for help!
type: Comment
comment on: http://stackoverflow.com/a/23281639
score: 0
type: AnswerComment

http://stackoverflow.com/q/23148927
has comment: http://stackoverflow.com/comment/35398877
type: Question
tagged with: jakarta-mail
score: 0
tagged with: email
has comment: http://stackoverflow.com/comment/35397917
type: UnansweredQuestion
has title: How to configure Spring JavaMailSenderImpl for XMPP protocol
tagged with: spring
has body: How can I configure spring javaMailSender to use XMPP protocol and send mail for host "jabber.abc.com"? How can I configure this javaMailSender bean in context.xml?
answer count: 0
tagged with: java

http://stackoverflow.com/comment/35512686
comment on: http://stackoverflow.com/q/23214511
score: 0
has text: And that is still causing a problem? What is the error?
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35552112
has text: @Andrew Thompson , i was mistaken about layout compatibily, thanks i have edited my answer.
comment on: http://stackoverflow.com/a/23226786
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/35412441
has text: Will you be able to read it if the docx is password protected? Sorry, if my understanding of reading a stream is limited.
score: 0
comment on: http://stackoverflow.com/q/23157368
type: QuestionComment
type: Comment

http://stackoverflow.com/q/23289916
has comment: http://stackoverflow.com/comment/35826948
has comment: http://stackoverflow.com/comment/35823999
type: Question
has comment: http://stackoverflow.com/comment/35710312
score: 0
has comment: http://stackoverflow.com/comment/35829515
tagged with: jasper-reports
tagged with: spring-mvc
has comment: http://stackoverflow.com/comment/35778748
tagged with: java
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35728019
has comment: http://stackoverflow.com/comment/35829850
has comment: http://stackoverflow.com/comment/35729784
has title: Display data in the JasperReports's table view using Spring mvc
has comment: http://stackoverflow.com/comment/35730167
has comment: http://stackoverflow.com/comment/35829547
answer count: 0
has body: I'm not able to display data in JasperReports's table, view getting empty. But in iReport for same jrxml file I am able to display The code in Spring Controller: @RequestMapping(value = "displayTradeList") public ModelAndView displayTradeListHtml(ModelAndView modelAndView) { tradeList = service.getTradeList(); JRDataSource JRdataSource = new JRBeanCollectionDataSource(tradeList); Map&lt;String, Object&gt; parameterMap = new HashMap&lt;String, Object&gt;(); parameterMap.put("datasource", JRdataSource); //xlsReport bean has ben declared in the jasper-views.xml file modelAndView = new ModelAndView("htmlReport", parameterMap); return modelAndView; } please find below jrxml file:http://community.jaspersoft.com/questions/826043/display-data-jasperreportss-table-view

http://stackoverflow.com/q/23181350
has title: How to fetch whether a USB device is connected to USB3.0 or USB2.0 port
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23181459
upvote count: 1
has body: I just want to know how to find a usb device is connected to USB3.0 or USB2.0 port in windows as well as linux. FYI, I am using libusbK in WINDOWS and in libusb in LINUX is used to access usb device. Is there any api's or any techniques available to fetch the said information? Eg: If a usb device is connected to USB3.0, i should be able to tell the user that usb device is connected to USB3.0 port. Is it not possible to fetch the USB details as mentioned above? Thanks in Advance.
tagged with: java
tagged with: usb
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/35454086
score: 0
tagged with: linux
tagged with: windows
answer count: 1
favorite count: 0

http://stackoverflow.com/comment/35400586
has text: from where do you send your request? And where do you want the response?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23151306
score: 0

http://stackoverflow.com/comment/35420038
comment on: http://stackoverflow.com/q/23158933
type: QuestionComment
type: Comment
has text: Not an option as this is an existing project.
score: 0

http://stackoverflow.com/q/23137252
type: Question
answer count: 1
has comment: http://stackoverflow.com/comment/35376038
score: 0
has title: enum name isnt allowed by compiler
has body: So I had troubles with declaring enums in my program so I copied the code from the sun website example, at first the compiler was older then 1.5 so I updated it and the error changed to this: Exception in thread "main" java.lang.NoSuchMethodError: examples.Day.values()[Lexamples/Day; at examples.EnumTest.$SWITCH_TABLE$examples$Day(EnumTest.java:7) at examples.EnumTest.tellItLikeItIs(EnumTest.java:15) at examples.EnumTest.main(EnumTest.java:37) my code: import java.lang.Enum; public enum Day { SUNDAY, MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY ; } public class EnumTest { Day day; public EnumTest(Day day) { this.day = day; } public void tellItLikeItIs() { switch (day) { case MONDAY: System.out.println("Mondays are bad."); break; case FRIDAY: System.out.println("Fridays are better."); break; case SATURDAY: case SUNDAY: System.out.println("Weekends are best."); break; default: System.out.println("Midweek days are so-so."); break; } } public static void main(String[] args) { EnumTest firstDay = new EnumTest(Day.MONDAY); firstDay.tellItLikeItIs(); EnumTest thirdDay = new EnumTest(Day.WEDNESDAY); thirdDay.tellItLikeItIs(); EnumTest fifthDay = new EnumTest(Day.FRIDAY); fifthDay.tellItLikeItIs(); EnumTest sixthDay = new EnumTest(Day.SATURDAY); sixthDay.tellItLikeItIs(); EnumTest seventhDay = new EnumTest(Day.SUNDAY); seventhDay.tellItLikeItIs(); } }
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35376064
has comment: http://stackoverflow.com/comment/35376000
has comment: http://stackoverflow.com/comment/35376963
has answer: http://stackoverflow.com/a/23137369
tagged with: java

http://stackoverflow.com/comment/35624360
score: 0
type: Comment
type: QuestionComment
has text: Did you read the question? Specifically "start the code following a brace **on the same line** as the brace"
comment on: http://stackoverflow.com/q/23272331

http://stackoverflow.com/comment/35425398
has text: Okay, that make sense to me. Let me ask you an additional question: how would I go about stopping the program until I received input from the user? The actual program I'm working on is something where I want the user to enter their name, and then that name is printed in a JLabel elsewehre in the window. But I can't figure out how I could make the program stop and wait for input. Would I need to split it into multiple threads and use the wait() function? That seems weirdly complicated for what seems like a simple action, but using a while loop seems to bring the program to a halt.
type: Comment
comment on: http://stackoverflow.com/a/23165005
score: 0
type: AnswerComment

http://stackoverflow.com/comment/35604041
type: Comment
has text: And if for example: one english user (admin) can add a category "Drinks" but his coworker is spanish, and he want to read "Bebidas". In the Add Category form can ask the new category name in three or four languages, but are saved in .properties file?
comment on: http://stackoverflow.com/a/23264826
type: AnswerComment
score: 0

http://stackoverflow.com/a/23192603
upvote count: 1
has body: Traditionally, the expectation is that mail with a content-type of text/plain should be rendered with a fixed-width font. There are clients which do not obey this convention, though, and there is nothing you can do about that (except in your own account, if the client allows you to configure this). The workaround is to use a content-type with a stricter definition, or send email with a hyperlink to a web page which renders the way you like (or, if you are in a position where you can do this, miff your users by forcing them to use a client you choose). All of these options have drawbacks from a usability point of view, but for content which does not make sense without proper formatting, you can probably find a reasonable compromise.
type: Answer
answers question: http://stackoverflow.com/q/23191572
downvote count: 0
score: 1

http://stackoverflow.com/a/23242888
has body: You have executed the line int resultSet = st.executeUpdate(SQLquery); before define the value of variable SQLquery.
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/23242808
downvote count: 0

http://stackoverflow.com/comment/35461437
score: 0
type: QuestionComment
type: Comment
has text: The ouput is that it is supposed to output the numbers in ascending order. It is ok as Ted solved my problem. But thank you very much for the respones and thank you Ted for helping me.
comment on: http://stackoverflow.com/q/23185811

http://stackoverflow.com/comment/35621248
score: 2
type: Comment
has text: @ArnaudDenoyelle There's a big difference between a `default` method and a `static` method. `Default` methods are instance methods, but they don't have to be implemented in an implementing class since the default is provided.
comment on: http://stackoverflow.com/a/23274407
type: AnswerComment

http://stackoverflow.com/comment/35447555
comment on: http://stackoverflow.com/a/23171910
type: AnswerComment
has text: MySQL encrypts the password when you create the user and decrypts it when you try to login. So if you know the original password given while the user is created, you just need to issue that while logging in. If you want to test it, open your local mysql workbench and connect to your local host. Issue this command in the SQL"create user 'test123'@'localhost' identified by '123456';". Then check the user table "select * from mysql.user". You can see the password is encrypted. Now log in with the new user and the password.
score: 0
type: Comment

http://stackoverflow.com/comment/35460118
type: AnswerComment
comment on: http://stackoverflow.com/a/23184433
score: 0
type: Comment
has text: Its worse case performance is to trawl the entire list. Yes, I realize that it will exit early if the value is found before the end of the list, but if you're checking the extreme end of the list, then you're going to check every element. To that end - I don't see why this would be preferable; creating a new object only for the sake of throwing it away later, when the bounds check is more efficient and doesn't create any unnecessary objects.

http://stackoverflow.com/comment/35532366
score: 0
comment on: http://stackoverflow.com/q/23225247
type: QuestionComment
type: Comment
has text: Thank you. Bitbucket is the best solution. It works fine.

http://stackoverflow.com/a/23197164
type: Answer
answers question: http://stackoverflow.com/q/23197016
has body: If you are interested in regex you can try with Pattern.compile("text/(?:plain|html);\\s*charset\\s*=\\s*\"([^\"]+)\""); It should store encoding part in group 1 so you can use this pattern like Matcher m = pattern.matcher(yourData); if (m.find()) System.out.println(m.group(1)); else System.out.println("no encoding informations");
score: 0

http://stackoverflow.com/q/23206305
favorite count: 0
has title: for loop running time analysis java
has body: For all of these I have to find out the running time. 1. for ( int i = 0; i &lt; n; i+=2 ) sum++; 2. for ( int i = 1; i &lt; n; i*=2 ) sum++ 3. for ( int i = 0; i &lt; n; i++ ) for ( int j = 0; j &lt; n; j++ ) sum++; 4. for ( int i = 0; i &lt; n; i++ ) sum++ for ( int j = 0; j &lt; n; j++ ) sum++ // The above are two loops one after the other, NOT nested 5. for ( int i = 0; i &lt; 2*n; i++ ) sum++ 6. for ( int i = 0; i &lt; n*n; i++ ) sum++; 7. for ( int i = 0; i &lt; n; i++ ) for ( int j = 0; j &lt; n*n; j++ ) sum++; 8. for ( int i = 0; i &lt; n; i++ ) for ( int j = 0; j &lt; 10000; j++ ) sum++; For the first one I got O(n) and the fourth one I got O(n^2). Are these correct? And how do I do the others? I am really confused with the second one. Answer can be expressed in big O or big theta.
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23222546
tagged with: big-o
tagged with: java
downvote count: 2
has answer: http://stackoverflow.com/a/23206480
upvote count: 1
type: Question
score: -1
answer count: 2

http://stackoverflow.com/q/23181524
type: Question
has body: Here is the code to demonstrate my point (java): public static int getSize(List&lt;String&gt; list) { System.out.println("begin"); try { System.out.println("get list size"); return list.size(); } catch (Exception e) { System.err.println("exception"); } finally { System.out.println("finally"); return -1; } } public static void main(String[] args) { List&lt;String&gt; list = null; int size = getSize(list); System.out.println("list size: " + size); } I expected the output of: begin get list size exception finally list size: -1 instead I get other stuff and the one above as well... like the exception can show before get list size and after exception... e.g. begin exception get list size finally list size: -1 and begin get list size finally exception list size: -1 Why is it doing this? What is the correct output?
tagged with: java
has answer: http://stackoverflow.com/a/23181555
tagged with: try-catch-finally
score: 0
answer count: 1
tagged with: execution
accepted answer: http://stackoverflow.com/a/23181555
has title: Try-Catch-Finally execution order
type: AnsweredQuestion

http://stackoverflow.com/comment/35430800
comment on: http://stackoverflow.com/q/23166687
score: 0
has text: The error is "The method sendData(byte[]) in type MainActivity is not applicable for the argument(byte)".
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23157654
tagged with: java
tagged with: switch-statement
answer count: 2
downvote count: 4
has body: I am writing a small program. I am a beginner at programming java. Here is the code: package dnd; public class Monster { static String name; static int level; static String rang; static String Class; static double[] Strength = {1, 1, 0}; static double[] Endurance = {1, 1, 0}; static double[] Agility = {1, 1, 0}; static double[] Precision = {1, 1, 0}; static double[] Wisdom = {0, 1, 1}; static double[] Intelegence = {0, 1, 1}; public static void Monster(String nameC, int levelC, String classesC, int rangC){ name = nameC; level = levelC; switch(rangC){ case 1: rang = "Civillian"; case 2: rang = "Soldier"; case 3: rang = "Veteran"; case 4: rang = "Commander"; case 5: rang = "Boss"; case 6: rang = "Elite"; default: rang = "Civillian"; } Class = classesC; switch(Class){ case "Warrior": Strength[1] = 2; Endurance[1] = 2; Intelegence[1] = 0.5; case "Archer": Agility[1] = 2; Precision[1] = 2; Endurance[1] = 0.5; case "Rouge": Agility[1] = 2; Intelegence[1] = 2; Endurance[1] = 0.5; case "Mage": Wisdom[1] = 2; Intelegence[1] = 2; Strength[1] = 0.5; case "Priest": Wisdom[1] = 2; Strength[1] = 0.5; case "Druid": Intelegence[1] = 2; Agility[1] = 0.5; } } public static void defaultStaringPoints(){ int StP; int EnP; int InP; int AgP; int PrP; int WiP; switch(Class){ case "Warrior": //Strength //Endurance //-Intelegence StP = (int) (Math.random() * 2); EnP = (int) (Math.random() * (3-StP)); InP = (int) (Math.random() * (3-(StP+EnP))); Strength[0] = Strength[0] + StP; Endurance[0] = Endurance[0] + EnP; Intelegence[0] = Intelegence[0] + InP; case "Archer": //Agility //Precision //-Endurance AgP = (int) (Math.random() * 2); PrP = (int) (Math.random() * (3-AgP)); EnP = (int) (Math.random() * (3-(AgP+PrP))); Agility[0] = Agility[0] + AgP; Precision[0] = Precision[0] + PrP; Endurance[0] = Endurance[0] + EnP; case "Rouge": //Agility //Intelegence //-Endurance AgP = (int) (Math.random() * 2); InP = (int) (Math.random() * (3-AgP)); EnP = (int) (Math.random() * (3-(AgP+InP))); Agility[0] = A…
possible better answer: http://stackoverflow.com/a/23157698
favorite count: 0
has comment: http://stackoverflow.com/comment/35411470
accepted answer: http://stackoverflow.com/a/23157699
has title: Can someone please help me with the code I am writing? (Java)
type: AnsweredQuestion
tagged with: constructor
score: -3
has answer: http://stackoverflow.com/a/23157698
has answer: http://stackoverflow.com/a/23157699
upvote count: 1
type: Question

http://stackoverflow.com/a/30114782
type: Answer
has body: Since HashMap is already Serializable, there is no need to replace it. It is much more convenient to just do a private class that implements the Serializable bitmap. private static class SerializableBitmap implements Serializable { private static final long serialVersionUID = 0L; private byte[] _compressedBitmap; // constructor compresses bitmap into Serializable form public SerializableBitmap(Bitmap bitmap) { ByteArrayOutputStream stream = new ByteArrayOutputStream(); bitmap.compress(Bitmap.CompressFormat.PNG, 100, stream); _compressedBitmap = stream.toByteArray(); } // reconstructs Bitmap for actual use public Bitmap getBitmap() { Bitmap bitmap = BitmapFactory.decodeByteArray(_compressedBitmap, 0, _compressedBitmap.length); return bitmap; } } Then you can just use HashMap&lt;String,SerializableBitmap&gt; instead of HashMap&lt;String,Bitmap&gt;.
answers question: http://stackoverflow.com/q/23168132
score: 0

http://stackoverflow.com/q/23287329
type: Question
upvote count: 2
answer count: 2
accepted answer: http://stackoverflow.com/a/23289398
favorite count: 0
has answer: http://stackoverflow.com/a/23289398
has body: I created a simple frame program that includes a image. But the image don't have the same size as the frame. If i enlarge the frame the image size stays the same? How can i make the image the same size as the frame? Here is my current code: JPanel panel1 = new JPanel(); ImageIcon image1 = new ImageIcon("C:\\Users\\Dark Mangetsu\\Downloads\\Ceng102_Lab10.1\\image\\flower.jpg"); JLabel label1 = new JLabel(image1); panel1.add(label1); Color color1 = new Color (200, 0 ,100); panel1.setBorder(BorderFactory.createLineBorder(color1, 3)); JFrame f = new JFrame("Frame"); f.setLayout(new BorderLayout(5,5)); f.add((panel1),BorderLayout.WEST); f.setSize(320,200); f.setVisible(true); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
tagged with: swing
has title: How can I make an image the same size as the panel?
score: 2
type: AnsweredQuestion
downvote count: 0
possible better answer: http://stackoverflow.com/a/23289918
tagged with: java
tagged with: jpanel
has answer: http://stackoverflow.com/a/23289918
has comment: http://stackoverflow.com/comment/35648643

http://stackoverflow.com/q/23233875
tagged with: scope
has title: Java beginner help, cannot resolve a variable
answer count: 3
has body: I'm trying to make sure that the variable num is only 5 digits long, but my while and return statements say that num cannot be resolved to a variable. What can be done? import java.util.*; public class program1 { public static void main(String[] args) { int num; num = getnum(); System.out.print(num); } public static int getnum() { Scanner console = new Scanner(System.in); do { System.out.println("Enter a number that has only five digits "); int num = console.nextInt(); } while (num &lt; 10000 || num &gt; 99999); return num; } }
has comment: http://stackoverflow.com/comment/35547359
has answer: http://stackoverflow.com/a/23233902
has answer: http://stackoverflow.com/a/23233930
accepted answer: http://stackoverflow.com/a/23233902
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/23233924
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/23233924
type: Question
tagged with: variables
has comment: http://stackoverflow.com/comment/35547550

http://stackoverflow.com/a/23203109
has comment: http://stackoverflow.com/comment/35496215
has comment: http://stackoverflow.com/comment/35506125
has comment: http://stackoverflow.com/comment/35495170
has comment: http://stackoverflow.com/comment/35506104
has comment: http://stackoverflow.com/comment/35496440
has comment: http://stackoverflow.com/comment/35495951
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/35492234
has comment: http://stackoverflow.com/comment/35495160
has comment: http://stackoverflow.com/comment/35539096
has comment: http://stackoverflow.com/comment/35507353
type: Answer
has comment: http://stackoverflow.com/comment/35494519
answers question: http://stackoverflow.com/q/23202988
upvote count: 1
has comment: http://stackoverflow.com/comment/35506166
has comment: http://stackoverflow.com/comment/35508873
has comment: http://stackoverflow.com/comment/35585276
has comment: http://stackoverflow.com/comment/35497416
accepted answer of: http://stackoverflow.com/q/23202988
has comment: http://stackoverflow.com/comment/35590645
has comment: http://stackoverflow.com/comment/35494269
has comment: http://stackoverflow.com/comment/35497121
has body: Specify the same charset while reading file. try (final BufferedReader br = Files.newBufferedReader(new File(filePath).toPath(), StandardCharsets.UTF_8)) UPDATE Now i got your problem. Thanks for the file. Again : Your file still readable to any text reader like Notepad++ ( Since your characters includes extended and control characters you are seeing those non readable characters . but it is still in ASCII.) Now back to your problem, You have two problem with your code. While reading file you should specify the Correct Charset. Readers are character readers - Bytes would be convert into characters while reading. If you specify the Charset it would use that else it would use the default system charset. So you should create BufferedReader as follows try (final BufferedReader br = Files.newBufferedReader(new File(filePath).toPath(), StandardCharsets.UTF_8)) Second issue, you have characters which includes Control characters. while reading file line by line , by default bufferedReader uses System's default EOL characters and skip those characters. thats why you are getting 17 instead of 19 ( since you have 2 characters are CR). To avoid this issue you should read characters. int ch; while ((ch = br.read()) > -1) { buffer.append((char)ch); } Overall the below method would return proper text. static String readCyberText() { StringBuilder buffer = new StringBuilder(); try (final BufferedReader br = Files.newBufferedReader(new File("C:\\projects\\test2201404221017.txt").toPath(), StandardCharsets.UTF_8)){ int ch; while ((ch = br.read()) &gt; -1) { buffer.append((char)ch); } return buffer.toString(); } catch (IOException e) { e.printStackTrace(); return null; } } And you can test by String s = readCyberText(); System.out.println(s.length()); System.out.println(s); and output as 19 ia@ m©Ù6ë&lt;«9K()il Note: the length of String is 19, however when it display it just displayed 17 characters. because the console considered as eof and displayed in different line. but the String…
score: 1

http://stackoverflow.com/q/23215419
linked to: http://stackoverflow.com/q/23219219
linked to: http://stackoverflow.com/q/23238199
has answer: http://stackoverflow.com/a/23215656
score: 0
answer count: 2
possible better answer: http://stackoverflow.com/a/23215784
has body: I have a web app developped with Maven. I have some class that execute function via Runtime.getRuntime().exec. I was wondering, where to put them in the project to compile them and then to call them via something like String[] command={"java MainExternal.class ","test"}; What should be the path ? I'm quite lost... UPDATED :
has answer: http://stackoverflow.com/a/23215784
tagged with: maven-3
accepted answer: http://stackoverflow.com/a/23215656
has title: How to manage class you want use via Runtime.getRuntime().exec in a web app project with Maven?
type: AnsweredQuestion
tagged with: runtime.exec
tagged with: java
type: Question

http://stackoverflow.com/q/23178486
has answer: http://stackoverflow.com/a/23178514
type: Question
answer count: 2
has title: multiple objects with same name
has comment: http://stackoverflow.com/comment/35448904
score: -1
accepted answer: http://stackoverflow.com/a/23178508
downvote count: 1
favorite count: 0
upvote count: 0
has answer: http://stackoverflow.com/a/23178508
has body: With the code below, three objects with the same name are created. How can I call upon one of them to print out its values? import java.util.Scanner; class ProcessPurchases { public static void main(String args[]) { Scanner myScanner = new Scanner(System.in); Purchase aPurchase; for (int count = 0; count &lt; 3; count++){ aPurchase = new Purchase(); aPurchase.amount = myScanner.nextDouble(); aPurchase.quantity = myScanner.nextInt(); } } }
type: AnsweredQuestion
tagged with: oop
tagged with: java
possible better answer: http://stackoverflow.com/a/23178514

http://stackoverflow.com/a/23283433
upvote count: 1
has comment: http://stackoverflow.com/comment/35638783
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23283365
has comment: http://stackoverflow.com/comment/35638883
type: Answer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/35639549
has comment: http://stackoverflow.com/comment/35638730
has body: You have made mistake in initializing the LayoutInflatrot you have done this inflater = (LayoutInflater)convertView.getContext() .getSystemService(Context.LAYOUT_INFLATER_SERVICE); which is wrong, because convertView will be null at the beginning. instead you need to do something like inflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); and If you want to use context you need to initializing it correctly in your Adapter's constructor, it is currently pointing to itself.
has comment: http://stackoverflow.com/comment/35638901
accepted answer of: http://stackoverflow.com/q/23283365

android-fragments
tags question: http://stackoverflow.com/q/23218406
tags question: http://stackoverflow.com/q/23174403
tags question: http://stackoverflow.com/q/23265752
tags question: http://stackoverflow.com/q/23283365
tags question: http://stackoverflow.com/q/23138613
tags question: http://stackoverflow.com/q/23241287
tags question: http://stackoverflow.com/q/23183864
tags question: http://stackoverflow.com/q/23254034
tags question: http://stackoverflow.com/q/23169995
type: Tag
tags question: http://stackoverflow.com/q/23164580
tags question: http://stackoverflow.com/q/23280685
tags question: http://stackoverflow.com/q/23193138
tags question: http://stackoverflow.com/q/23197283
tags question: http://stackoverflow.com/q/23154037
tags question: http://stackoverflow.com/q/23167006
tags question: http://stackoverflow.com/q/23211252
tags question: http://stackoverflow.com/q/23194397
tags question: http://stackoverflow.com/q/23282482
tags question: http://stackoverflow.com/q/23210766
tags question: http://stackoverflow.com/q/23177375
tags question: http://stackoverflow.com/q/23176268
tags question: http://stackoverflow.com/q/23132560
tags question: http://stackoverflow.com/q/23180028
tags question: http://stackoverflow.com/q/23184275
tags question: http://stackoverflow.com/q/23284232
tags question: http://stackoverflow.com/q/23197892
tags question: http://stackoverflow.com/q/23232543
tags question: http://stackoverflow.com/q/23284113
tags question: http://stackoverflow.com/q/23186164
tags question: http://stackoverflow.com/q/23258788
tags question: http://stackoverflow.com/q/23203969
tags question: http://stackoverflow.com/q/23250715
tags question: http://stackoverflow.com/q/23205772
tags question: http://stackoverflow.com/q/23265544
tags question: http://stackoverflow.com/q/23281346
tag name: android-fragments
tags question: http://stackoverflow.com/q/23241104
tags question: http://stackoverflow.com/q/23179190
tags question: http://stackoverflow.com/q/23218322

http://stackoverflow.com/comment/103909541
score: 12
type: AnswerComment
comment on: http://stackoverflow.com/a/33757854
type: Comment
has text: Could someone explain what it actually does and what effects does it have?

http://stackoverflow.com/q/23131681
has comment: http://stackoverflow.com/comment/35365345
has comment: http://stackoverflow.com/comment/35367802
has body: When I'm trying to send PUT request to the handler of my controller all works fine @RequestMapping(method = RequestMethod.PUT, consumes = "application/json", headers = "content-type=application/json") public String updateCompany(@RequestBody Company company) { companyRepository.updateCompany(company); return "redirect:/api/company/" + company.getId(); } But when it redirect to another handler @RequestMapping(value = "/{id}", method = GET, produces = "application/json") public @ResponseBody Company getCompany(@PathVariable("id") Integer id) { Company c = companyRepository.getCompany(id); return new CompanyToJsonWrapper(c); } I'm getting HTTP Status 405 - Request method 'PUT' not supported error. Any ideas how to fix it?
answer count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/35365976
favorite count: 0
tagged with: spring
has comment: http://stackoverflow.com/comment/35365410
tagged with: spring-mvc
has comment: http://stackoverflow.com/comment/40882342
type: AnsweredQuestion
upvote count: 0
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/35366239
has answer: http://stackoverflow.com/a/23133102
accepted answer: http://stackoverflow.com/a/23133102
has title: How to redirect properly in RESTful Spring MVC controller
score: -1

http://stackoverflow.com/comment/35447843
type: QuestionComment
has text: Here's my favorite [question/answer about interfaces](http://stackoverflow.com/questions/383947/what-does-it-mean-to-program-to-an-interface). If you read the first answer, you'll be sure to have a better understanding.
comment on: http://stackoverflow.com/q/23177860
type: Comment
score: 0

http://stackoverflow.com/comment/102890126
score: 0
has text: Simple. How come I didn't thought of that? :D
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/23236034

http://stackoverflow.com/q/23163545
type: Question
tagged with: system-calls
answer count: 1
has answer: http://stackoverflow.com/a/23163797
upvote count: 1
tagged with: cmd
favorite count: 0
downvote count: 0
linked to: http://stackoverflow.com/q/5711084
type: UnansweredQuestion
tagged with: process
has body: I've got an external executable program which I want to run from within my java program. While it is running, I need a way to get what the .exe is outputting, and also a way to then send input back to the .exe. This is what I've conjured up so far: public int run(){ String cmdRun = "cmd C:\\Meister\\Student\\bin\\Student.exe"; int returnCode = 1; try { Process p = Runtime.getRuntime().exec(cmdRun); // makes appropriate system call BufferedReader stdError = new BufferedReader(new InputStreamReader(p.getErrorStream())); BufferedReader stdInput = new BufferedReader(new InputStreamReader(p.getInputStream())); String s = null; // read any info from the attempted command while ((s = stdError.readLine()) != null){ returnCode = -1; break; } while ((s = stdInput.readLine()) != null){ System.out.println(s); } System.out.println("Finished with exit code " + p.waitFor()); } catch (Exception e) { e.printStackTrace(); } return returnCode; } How should I properly RUN (1) the program, GET (2) the program output, and then SEND (3) input to the program when necessary? EDIT: btw, when I run the method seen above, I do not see any output even though the file is being executed.
has title: Running Executables From Java
score: 1
tagged with: java

http://stackoverflow.com/q/23227449
has answer: http://stackoverflow.com/a/23229535
tagged with: android
has comment: http://stackoverflow.com/comment/35535552
tagged with: parameters
tagged with: view
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/35536235
has comment: http://stackoverflow.com/comment/35535974
has title: How to properly set settings for RelativeLayout programatically?
type: Question
has comment: http://stackoverflow.com/comment/35536436
score: 0
tagged with: layout
answer count: 1
has body: I'm creating a RelativeLayout programatically and I want to place three objects into it: a ListView and two Buttons. I need to set some settings to properly locate them in the window. For now I'm doing it this way: RekativeLayout rl = new RelativeLayout(context); rl.setBackgroundColor(Color.WHITE); rl.setPadding(10, 10, 10, 10); ListView listView = new ListView(context); ListViewAdapter adapter = new ListViewAdapter(jParser.getArrayList(), context); listView.setLayoutParams(new LayoutParams(wWidth, wHeight)); listView.setAdapter(adapter); RelativeLayout.LayoutParams listParams = new RelativeLayout.LayoutParams(wWidth, wHeight); listParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT); listParams.addRule(RelativeLayout.ALIGN_PARENT_TOP); listView.setId(98515); listView.setLayoutParams(listParams); Button moreButton = new Button(context); moreButton.setLayoutParams(lp); moreButton.setBackgroundColor(Color.GRAY); moreButton.setText("More"); RelativeLayout.LayoutParams mButtonParams = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); mButtonParams.addRule(RelativeLayout.ALIGN_LEFT, listView.getId()); mButtonParams.addRule(RelativeLayout.BELOW, listView.getId()); mButtonParams.setMargins(0, 10, 0, 0); moreButton.setLayoutParams(mButtonParams); closeButton.setLayoutParams(lp); closeButton.setBackgroundColor(Color.GRAY); closeButton.setText("Close"); Button closeButton = new Button(context); RelativeLayout.LayoutParams cButtonParams = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); cButtonParams.addRule(RelativeLayout.ALIGN_RIGHT, listView.getId()); cButtonParams.addRule(RelativeLayout.BELOW, listView.getId()); cButtonParams.setMargins(0, 10, 0, 0); closeButton.setLayoutParams(cButtonParams); rl.addView(listView); rl.addView(moreButton); rl.addView(closeButton); but I guess this method requires much system resources and isn't acceptable. How should I set the settings properly?
has comment: http://stackoverflow.com/comment/35536689

http://stackoverflow.com/a/23238616
downvote count: 0
score: 1
has body: String split[] = string.split(" ") is will generate an array of string then you can parse the array to int.
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/23238571

http://stackoverflow.com/comment/35370902
type: AnswerComment
type: Comment
score: 2
has text: So this is correct, but consider adding that the concrete answer to OP's question is NO, not every method is overrideable. Also, I don't think java has the distinction that C# makes with "virtual methods"
comment on: http://stackoverflow.com/a/23134631

http://stackoverflow.com/comment/35372244
type: QuestionComment
type: Comment
has text: why dont you just always use 1 port for broadcasting and 1 port for the "real" data
comment on: http://stackoverflow.com/q/23135063
score: 0

http://stackoverflow.com/comment/118206591
score: 0
type: AnswerComment
has text: The biggest problem with yourkit is their licensing. YourKit could run in standalone agent mode with provided capture configuration, but as the environment is an production of another customer who don't own YourKit license, do you are allowed to use there yourkit agent to generate profiling snapshot (i.e. does the agent is license free and the YourKit GUI under license)? If agent is under license, then yourkit is useless for profiling remote customer application, where headless mode is required.
type: Comment
comment on: http://stackoverflow.com/a/23266768

http://stackoverflow.com/comment/35410974
comment on: http://stackoverflow.com/q/23157368
has text: Does the directory exist that you are saving it to?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35460027
type: Comment
type: QuestionComment
has text: What are you trying to achieve?
comment on: http://stackoverflow.com/q/23185116
score: 0

http://stackoverflow.com/a/23445122
has comment: http://stackoverflow.com/comment/35943160
has comment: http://stackoverflow.com/comment/35955605
answers question: http://stackoverflow.com/q/23289387
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23289387
type: Answer
upvote count: 7
has body: I did the following program in c++ using opencv (I'm not familiar with java+opencv). I've included the output for the two sample images that you have provided. You may have to adjust the thresholds in the contour filtering section for some other images. #include "stdafx.h" #include &lt;opencv2/core/core.hpp&gt; #include &lt;opencv2/highgui/highgui.hpp&gt; #include &lt;opencv2/imgproc/imgproc.hpp&gt; #include &lt;iostream&gt; using namespace cv; using namespace std; int _tmain(int argc, _TCHAR* argv[]) { // load image as grayscale Mat im = imread(INPUT_FILE, CV_LOAD_IMAGE_GRAYSCALE); Mat morph; // morphological closing with a column filter : retain only large vertical edges Mat morphKernelV = getStructuringElement(MORPH_RECT, Size(1, 7)); morphologyEx(im, morph, MORPH_CLOSE, morphKernelV); Mat bwV; // binarize: will contain only large vertical edges threshold(morph, bwV, 0, 255.0, CV_THRESH_BINARY | CV_THRESH_OTSU); // morphological closing with a row filter : retain only large horizontal edges Mat morphKernelH = getStructuringElement(MORPH_RECT, Size(7, 1)); morphologyEx(im, morph, MORPH_CLOSE, morphKernelH); Mat bwH; // binarize: will contain only large horizontal edges threshold(morph, bwH, 0, 255.0, CV_THRESH_BINARY | CV_THRESH_OTSU); // combine the virtical and horizontal edges Mat bw = bwV &amp; bwH; threshold(bw, bw, 128.0, 255.0, CV_THRESH_BINARY_INV); // just for illustration Mat rgb; cvtColor(im, rgb, CV_GRAY2BGR); // find contours vector&lt;vector&lt;Point&gt;&gt; contours; vector&lt;Vec4i&gt; hierarchy; findContours(bw, contours, hierarchy, CV_RETR_CCOMP, CV_CHAIN_APPROX_SIMPLE, Point(0, 0)); // filter contours by area to obtain boxes double areaThL = bw.rows * .04 * bw.cols * .06; double areaThH = bw.rows * .7 * bw.cols * .7; double area = 0; for(int idx = 0; idx &gt;= 0; idx = hierarchy[idx][0]) { area = contourArea(contours[idx]); if (area &gt; areaThL &amp;&amp; area &lt; areaThH) { drawContours(rgb, contours, idx, Scalar(0, 0, 255), 2, 8, hierarchy);…
has comment: http://stackoverflow.com/comment/35960090
score: 7

scripting
tags question: http://stackoverflow.com/q/23194353
tag name: scripting
tags question: http://stackoverflow.com/q/23147663
type: Tag
tags question: http://stackoverflow.com/q/23206782

http://stackoverflow.com/comment/35495465
has text: It eases the code readability and maintainability, that's all.
comment on: http://stackoverflow.com/q/23205061
type: Comment
type: QuestionComment
score: 2

http://stackoverflow.com/a/23187087
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23164857
type: Answer
has comment: http://stackoverflow.com/comment/43720248
answers question: http://stackoverflow.com/q/23164857
has comment: http://stackoverflow.com/comment/43708993
downvote count: 1
score: 3
has body: The Bndtools tutorial was mentioned and dismissed in the original question; however we were able to resolve the issue. So I post this as an answer for others who might be looking for an introductory OSGi tutorial: check out the Bndtools Tutorial!
upvote count: 4

http://stackoverflow.com/comment/35482651
type: Comment
type: QuestionComment
has text: I'm not sure what the problem is... Does the error occur when the user writes `removeplayer` only in the console? If so, you have to check whether `str1.length` is 1. If it is, then assign `param=null`. If it isn't, then assign `param = str1[1]`.
comment on: http://stackoverflow.com/q/23198021
score: 0

http://stackoverflow.com/a/23176670
score: 0
has comment: http://stackoverflow.com/comment/35457599
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35447883
answers question: http://stackoverflow.com/q/23176562
has comment: http://stackoverflow.com/comment/35463905
has body: Replace import android.R; with import R; android.R contains the system resources, not your project's resources
has comment: http://stackoverflow.com/comment/35457593
type: Answer
accepted answer of: http://stackoverflow.com/q/23176562
has comment: http://stackoverflow.com/comment/35481701
has comment: http://stackoverflow.com/comment/35463998
has comment: http://stackoverflow.com/comment/35447851

http://stackoverflow.com/a/25303049
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/96850680
type: Answer
has body: Code Folding of a whole file is Ctrl+Shift+Minus and Ctrl+Shift+Numpad_Plus or in the menu choose Code | Folding | Collapse All or Code | Folding | Expand All. For more shortcuts for code folding: Docs for Code Folding Shortcuts
accepted answer of: http://stackoverflow.com/q/23222257
downvote count: 1
upvote count: 13
answers question: http://stackoverflow.com/q/23222257
score: 12

http://stackoverflow.com/a/23353418
has body: I have solved using a temporary DB. I have created a index with the key in which I want to make a merge and in this way I can make a query over the DB and the response is very fast.
answers question: http://stackoverflow.com/q/23145290
score: 0
type: Answer

http://stackoverflow.com/comment/35585662
comment on: http://stackoverflow.com/q/23254949
type: Comment
has text: In the decryptor method, you create a local cryptor variable and never actually set the password to OLLEH for that instance. Not sure how the Cryptography class works, but could that be your issue?
type: QuestionComment
score: 0

amazon-web-services
tags question: http://stackoverflow.com/q/23267525
tags question: http://stackoverflow.com/q/23227657
tags question: http://stackoverflow.com/q/23208224
tags question: http://stackoverflow.com/q/23273298
tags question: http://stackoverflow.com/q/23269591
tags question: http://stackoverflow.com/q/23146581
type: Tag
tags question: http://stackoverflow.com/q/23217951
tag name: amazon-web-services
tags question: http://stackoverflow.com/q/23200602
tags question: http://stackoverflow.com/q/23239304
tags question: http://stackoverflow.com/q/23203224
tags question: http://stackoverflow.com/q/23220877
tags question: http://stackoverflow.com/q/23184813

http://stackoverflow.com/a/23277225
upvote count: 1
type: Answer
has body: Try to use phantomjs webDriver implementation, we don't need to initiate jetty proxy server and we can get all requests even those without responses.
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/23270929

http://stackoverflow.com/comment/35620459
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/23273985
type: Comment
has text: See http://stackoverflow.com/questions/13847695/java-delete-arraylist-iterator for the remove case and how this problem is addressed

http://stackoverflow.com/q/23225610
type: Question
has comment: http://stackoverflow.com/comment/35545478
has comment: http://stackoverflow.com/comment/35545004
tagged with: java
has body: I've got to reverse engineer a file containing X/Y values that represent a curve. Although I know that finally will have to write the converter by myself, i'd be happy to know a windows tool that helps me to find out wether - the file consists of Integers, Double or Float values - the values are big- or little endian - at which offset the relevant data starts - and so on... Does anyone know a tool that can help me to find this out? Finally, I'll implement the algorithm in Java, so code recommendations also will be welcome! Thanks in advance Christoph
answer count: 1
has title: Reverse Engineering: Tool to read XY-Values out of files
score: 0
tagged with: reverse-engineering
has comment: http://stackoverflow.com/comment/35533610
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23297969

http://stackoverflow.com/a/23220175
downvote count: 0
type: Answer
score: 1
answers question: http://stackoverflow.com/q/23218294
upvote count: 1
accepted answer of: http://stackoverflow.com/q/23218294
has body: The easiest and most straightforward way is to use the JPopupMenu class. You can add any JComponent to a JPopupMenu, not just JMenuItems. Here's a button which when clicked, shows a JList in a popup without any close buttons, just with a scroll bar. Wherever the popup (the JList) loses focus, the popup will be automatically closed. final JButton b = new JButton("Press me"); b.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { final DefaultListModel&lt;String&gt; model = new DefaultListModel&lt;&gt;(); for (int i = 0; i &lt; 100; i++) model.addElement(i + "."); final JList&lt;String&gt; l = new JList&lt;&gt;(model); final JPopupMenu pm = new JPopupMenu(); final JScrollPane sp = new JScrollPane(l); // pm.setPreferredSize(new Dimension(100, 300)); pm.add(sp); pm.show(b, 0, 0); } });
type: AcceptedAnswer

http://stackoverflow.com/q/23175236
has answer: http://stackoverflow.com/a/44552824
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23175332
has body: So, I have a large file containing 3 million lines of words. And I need to see if there is any duplicates. I put the lines in a TreeMap so that they are sorted, put "lines" into key and give "1" to their value. When there is a duplicate, the value of the line stacks up. Then I will have to see if there is any value that is not 1. Here is my code: BufferedReader list = new BufferedReader( new FileReader( args[0] ) ); String line; TreeMap&lt;String,Integer&gt; map = new TreeMap&lt;String,Integer&gt;(); while ( (line = list.readLine()) != null ) { if (!map.containsKey(line)) { map.put(line, 0); } map.put(line, map.get(line) + 1); } if ( !map.containsKey(1) ) { System.out.print("NOT UNIQUE"); } else { System.out.print("UNIQUE"); } list.close(); } Question: Will the use of TreeMap speed up the process? Or using HashMap will have the same/faster speed? The output: Exception in thread "main" java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Integer at java.lang.Integer.compareTo(Integer.java:52) at java.util.TreeMap.getEntry(TreeMap.java:346) at java.util.TreeMap.containsKey(TreeMap.java:227) at Lab10.main(Lab10.java:22) which is if ( !map.containsKey(1) ) , but I don't know what went wrong.
upvote count: 2
has title: Find the duplicated line in a large file Java
accepted answer: http://stackoverflow.com/a/23175505
has answer: http://stackoverflow.com/a/59082754
type: Question
tagged with: performance
has answer: http://stackoverflow.com/a/23175467
tagged with: java
tagged with: duplicates
answer count: 6
tagged with: treemap
possible better answer: http://stackoverflow.com/a/35438277
downvote count: 0
has answer: http://stackoverflow.com/a/35438277
favorite count: 0
has answer: http://stackoverflow.com/a/23175505
has comment: http://stackoverflow.com/comment/35443117

maven
tags question: http://stackoverflow.com/q/23239407
tags question: http://stackoverflow.com/q/23229810
tags question: http://stackoverflow.com/q/23289098
tags question: http://stackoverflow.com/q/23272350
tags question: http://stackoverflow.com/q/23196541
tags question: http://stackoverflow.com/q/23236315
type: Tag
tags question: http://stackoverflow.com/q/23138307
tags question: http://stackoverflow.com/q/23227132
tags question: http://stackoverflow.com/q/23162438
tags question: http://stackoverflow.com/q/23285831
tags question: http://stackoverflow.com/q/23236877
tags question: http://stackoverflow.com/q/23147308
tags question: http://stackoverflow.com/q/23149484
tags question: http://stackoverflow.com/q/23198231
tags question: http://stackoverflow.com/q/23185200
tags question: http://stackoverflow.com/q/23193224
tags question: http://stackoverflow.com/q/23143952
tags question: http://stackoverflow.com/q/23212091
tags question: http://stackoverflow.com/q/23145192
tags question: http://stackoverflow.com/q/23268217
tags question: http://stackoverflow.com/q/23235002
tags question: http://stackoverflow.com/q/23270606
tags question: http://stackoverflow.com/q/23197802
tags question: http://stackoverflow.com/q/23170684
tags question: http://stackoverflow.com/q/23289159
tags question: http://stackoverflow.com/q/23204768
tags question: http://stackoverflow.com/q/23148055
tags question: http://stackoverflow.com/q/23279213
tags question: http://stackoverflow.com/q/23172586
tags question: http://stackoverflow.com/q/23221495
tags question: http://stackoverflow.com/q/23286442
tags question: http://stackoverflow.com/q/23225309
tags question: http://stackoverflow.com/q/23272650
tags question: http://stackoverflow.com/q/23243941
tags question: http://stackoverflow.com/q/23204629
tags question: http://stackoverflow.com/q/23153355
tags question: http://stackoverflow.com/q/23217151
tags question: http://stackoverflow.com/q/23188959
tags question: http://stackoverflow.com/q/23152523
tags question: http://stackoverflow.com/q/23235430
tags question: http://stackoverflow.com/q/23273443
tags question: http://stackoverflow.com/q/23206074
tags question: http://stackoverflow.com/q/23154615
tags question: http://stackoverflow.com/q/23198128
tags question: http://stackoverflow.com/q/23252378
tags question: http://stackoverflow.com/q/23204893
tags question: http://stackoverflow.com/q/23130658
tags question: http://stackoverflow.com/q/23136569
tags question: http://stackoverflow.com/q/23274539
tags question: http://stackoverflow.com/q/23220630
tags question: http://stackoverflow.com/q/23241600
tags question: http://stackoverflow.com/q/23195228
tags question: http://stackoverflow.com/q/23249135
tags question: http://stackoverflow.com/q/23276836
tags question: http://stackoverflow.com/q/23227881
tags question: http://stackoverflow.com/q/23143905
tags question: http://stackoverflow.com/q/23272185
tags question: http://stackoverflow.com/q/23180984
tags question: http://stackoverflow.com/q/23157231
tags question: http://stackoverflow.com/q/23182576
tags question: http://stackoverflow.com/q/23288816
tags question: http://stackoverflow.com/q/23176324
tags question: http://stackoverflow.com/q/23173816
tags question: http://stackoverflow.com/q/23261215
tags question: http://stackoverflow.com/q/23207088
tags question: http://stackoverflow.com/q/23275549
tags question: http://stackoverflow.com/q/23208612
tags question: http://stackoverflow.com/q/23249923
tags question: http://stackoverflow.com/q/23224052
tags question: http://stackoverflow.com/q/23183931
tags question: http://stackoverflow.com/q/23252126
tags question: http://stackoverflow.com/q/23243609
tags question: http://stackoverflow.com/q/23241275
tags question: http://stackoverflow.com/q/23226372
tags question: http://stackoverflow.com/q/23154060
tags question: http://stackoverflow.com/q/23176548
tags question: http://stackoverflow.com/q/23246289
tags question: http://stackoverflow.com/q/23222663
tags question: http://stackoverflow.com/q/23244887

http://stackoverflow.com/comment/35726223
has text: Sorry for the late reply, I'll get back to this ASAP and see if this works. Much appreciated.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23292784
type: AnswerComment

http://stackoverflow.com/comment/35456533
has text: Ahh, I didn't realize it was compact. Take a look at this link from the same site: https://github.com/phishman3579/java-algorithms-implementation/blob/master/src/com/jwetherell/algorithms/data_structures/RadixTrie.java
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23182614
score: 0

http://stackoverflow.com/a/23204257
type: AcceptedAnswer
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/23202749
type: Answer
answers question: http://stackoverflow.com/q/23202749
upvote count: 1
has body: Finally solved. I added Filters in web.xml. SessionFilter com.java.util.SessionFilter avoid-urls /firstPage.htm SessionFilter *.htm Then created a Filter class import java.io.IOException; import java.util.ArrayList; import java.util.StringTokenizer; import javax.servlet.Filter; import javax.servlet.FilterChain; import javax.servlet.FilterConfig; import javax.servlet.ServletException; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; public class SessionFilter implements Filter { private ArrayList<String> urlList; public void destroy() { } public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException { HttpServletRequest request = (HttpServletRequest) req; HttpServletResponse response = (HttpServletResponse) res; String url = request.getServletPath(); boolean allowedRequest = false; if (urlList.contains(url)) { allowedRequest = true; } if (!allowedRequest) { HttpSession session = request.getSession(false); if (null == session) { response.sendRedirect("startup.jsp"); } else { chain.doFilter(request, response); } } else { chain.doFilter(request, response); } } public void init(FilterConfig config) throws ServletException { String urls = config.getInitParameter("avoid-urls"); StringTokenizer token = new StringTokenizer(urls, ","); urlList = new ArrayList<String>(); while (token.hasMoreTokens()) { urlList.add(token.nextToken()); } } } Notice I executed this line " chain.doFilter(request, response);" only when session is active. Otherwise it would give the exception "java.lang.IllegalStateException: Cannot forward after response has been committed"

http://stackoverflow.com/q/23176354
has comment: http://stackoverflow.com/comment/35445465
has comment: http://stackoverflow.com/comment/35445732
type: Question
tagged with: jsoup
score: 0
tagged with: dreamweaver
answer count: 1
has answer: http://stackoverflow.com/a/23183112
has body: I'm developing a simple app where it displays pictures just like tumblr and 9gag. I couldn't exactly get it done, i hope someone can help me figure this out, i'm trying to display the pictures from eversorandom.com in a single line without a title or description.
type: UnansweredQuestion
has title: how to get jsoup to display pictures from a website using Dreamweaver?
tagged with: dreamweaver-templates
tagged with: java

http://stackoverflow.com/a/23186842
has comment: http://stackoverflow.com/comment/35463722
type: Answer
has body: In order to increase the rectangles length you need to replace the 300 and 20 with variables. shapeRenderer.filledRect(0, 0, 300, 20); should be shapeRenderer.filledRect(0, 0, rWidth, rHeight); Then declare those variables in your class int rWidth,rHeight; and put this in your default constructor rWidth=300; rHeight=20; Then in your render class you will have a seperate method in the beginning of it that will increase the rWidth and rHeight. To make it grow very quickly you can just put this in the top of your render method. rWidth++; rHeight++; try this for now so you get the idea then you can use Gdx.graphics.getDeltaTime() to adjust it based on time rather than rendering frames.
answers question: http://stackoverflow.com/q/23186771
has comment: http://stackoverflow.com/comment/35463697
score: 0

http://stackoverflow.com/a/23271289
upvote count: 1
downvote count: 0
has body: Array variables are just references. If you pass values as data, data points to the same array as values. Consider the following example: int[] a = new int[] {1, 2, 3}; int[] b = a; b[0] = 4; // a is now {4, 2, 3} If you don't want this, you need to make a copy: Make copy of array Java
type: Answer
score: 1
answers question: http://stackoverflow.com/q/23271227

http://stackoverflow.com/a/23151667
has body: First , I don't konw why you create the constructor like this public Student (String f, String l, String h, String s, int e, int n) Meanwhile , you override each parameter in it Second , one way to convert a String parameter into array is char arr1[]=new char[len1]; arr1=s1.toCharArray() String[] is an array of String , and char[] is a array of char ,which means a String.
score: 0
answers question: http://stackoverflow.com/q/23150846
type: Answer

http://stackoverflow.com/comment/35420229
score: 0
comment on: http://stackoverflow.com/a/23161943
type: Comment
has text: Should I implement it like this? 'MyRunnable t1=new MyRunnable(1000);MyRunnable t2=new MyRunnable(2000);t1.start();t2.start()'
type: AnswerComment

http://stackoverflow.com/comment/35447292
score: 1
type: AnswerComment
has text: @DSlomer64: And in case you wouldn't like recursion, you could use a stack (`List`) or `Queue` to simulate it. This would give you control over the processing order.
comment on: http://stackoverflow.com/a/23177447
type: Comment

http://stackoverflow.com/comment/35501481
type: Comment
comment on: http://stackoverflow.com/a/23208005
score: 0
type: AnswerComment
has text: I appreciate your comments, Hovercraft. Initial question: using JLabel instead of JButton yields a window that appears to be a large empty field with a bunch of floating labels. How do I make it appear as a grid with lines demarcating the individual spaces?

http://stackoverflow.com/a/23209129
type: Answer
accepted answer of: http://stackoverflow.com/q/23208964
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/23208964
type: AcceptedAnswer
has body: You need to download Apache Commons Logging and add it to your runtime classpath.
upvote count: 1

http://stackoverflow.com/comment/35570253
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23228579
has text: In VBA in catia it is working : ` Dim coordonnees(2) Set P1 = HSF.AddNewPointDatum(hbody.HybridShapes.Item(i)) 'fonction coordonnes P1.GetCoordinates coordonnees 'get name + coordinate coordonnees2(Y, 0) = hbody.HybridShapes.Item(i).name coordonnees2(Y, 1) = Round(coordonnees(0), 3) coordonnees2(Y, 2) = Round(coordonnees(1), 3) coordonnees2(Y, 3) = Round(coordonnees(2), 3)`

http://stackoverflow.com/comment/35488370
has text: @donfuxx Addressed below
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23200712

currency
tag name: currency
tags question: http://stackoverflow.com/q/23194120
type: Tag

http://stackoverflow.com/comment/35409097
comment on: http://stackoverflow.com/q/23155966
score: 0
type: Comment
has text: Currently, your code simply creates a new `Score` array which has the same size as `standings` and sets every entry to `points`. If you called this method with a `standings` array of size `5` for example and `points` equal to `3`, you'll end up with `[3, 3, 3, 3, 3]` as your `Score` array. After that, you don't do anything with that array, so nothing really happens...
type: QuestionComment

http://stackoverflow.com/q/23255397
has body: Today I wanted to integrate a persistent cache into apache's httpclient library. A quick look into the documentation for Http-Caching tells you: The current release includes support for storing cache entries using EhCache and memcached implementations, which allow for spilling cache entries to disk or storing them in an external process. Fair enough, a quick google-search later I had exactly no idea what to do and how to do that ;) But there was one more hint: If none of those options are suitable for your application, it is possible to provide your own storage backend by implementing the HttpCacheStorage interface and then supplying that to caching HttpClient at construction time. So at least we know that the HttpCacheStorage needs to be initialized using some class that implements HttpCacheStorage. The question in a one liner: How do you integrate caching into any http-request? How do you initialiase an EhCache? How do your integrate an EhCache into the http-caching thingy.
downvote count: 0
answer count: 1
favorite count: 0
tagged with: ehcache
tagged with: apache-httpclient-4.x
has title: Integrating persistent caching into Apache Httpclient with EhCache
has answer: http://stackoverflow.com/a/23255398
type: AnsweredQuestion
upvote count: 3
accepted answer: http://stackoverflow.com/a/23255398
tagged with: http-caching
type: Question
score: 3
tagged with: java
tagged with: caching

http://stackoverflow.com/comment/35504363
comment on: http://stackoverflow.com/q/23209570
score: 0
type: Comment
type: QuestionComment
has text: Sry, the cases for request.getParameter() is a careless mistake. I am doing school assignment, which requires me to use jsp to complete the tasks. Anyway, I think I have alr solved the problem, thank your for your concerns!

http://stackoverflow.com/q/23175577
upvote count: 1
downvote count: 1
has title: How I solve this TypeError in python?
has comment: http://stackoverflow.com/comment/35444869
accepted answer: http://stackoverflow.com/a/23176541
has comment: http://stackoverflow.com/comment/35443977
tagged with: python-2.7
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35444694
has comment: http://stackoverflow.com/comment/35444807
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/35444355
has comment: http://stackoverflow.com/comment/35443831
tagged with: python
answer count: 1
has comment: http://stackoverflow.com/comment/35444643
has answer: http://stackoverflow.com/a/23176541
has comment: http://stackoverflow.com/comment/35445240
score: 0
tagged with: java
has body: I am working in python based on a Java code. I have this in Java: public static byte[] datosOEM = new byte[900000]; I wrote this in Python following some documents that I found: datosOEM=bytes([0x90, 0x00, 0x00]) When I run my program it shows me this: Traceback (most recent call last): File "test.py", line 63, in &lt;module&gt; # The line 63 is the location of x1=datosOEM[k]; x1=datosOEM[k]; IndexError:string index out of range Craig correct this part and recommended me to change to this: datosOEM = bytearray(900000) Now, when I run my program it shows me this: Traceback (most recent call last): File "test.py", line 10, in &lt;module&gt; # The line 10 is the location of datosOEM = bytearray(900000) datosOEM = bytearray(900000) TypeError: 'type' object has no attribute '__getitem_' How I can fix this problem? Part of my code is this: ... response=port.read(8) print(response) k=0 C=0 conexion=True if(conexion): while(response&gt;200): while(C==0): x1=datosOEM[k]; if(x1=1): x2=datosOEM[k+1]; ...

http://stackoverflow.com/comment/35637778
has text: Hmm I'm going to be using your enum in my code, it's pretty legit :)
type: AnswerComment
comment on: http://stackoverflow.com/a/23282684
score: 0
type: Comment

http://stackoverflow.com/comment/35635221
score: 0
type: Comment
has text: Not quite. Inside this loop you are reading `String` `int` `String` `int` `String` `int` which handles first 3 lines. But since loop will be executer two times (because of condition `i<2` while `i=0` and then is incremented to `1`) forth line will throw mentioned exception. You can remove this loop and execute code inside it just once. Another problem you will be facing is `f` in `format` method while you are passing integer. In that case you should either explicitly cast value to `float` or `double` or instead of `f` use `d`.
comment on: http://stackoverflow.com/a/23281329
type: AnswerComment

http://stackoverflow.com/a/23206480
downvote count: 0
has comment: http://stackoverflow.com/comment/35501463
score: 5
has body: Basically, you count the number of operations in terms of n. E.g.: for ( int i = 0; i &lt; n; i+=2 ) sum++; sum++ is 1 operation, and you loop n/2 times. Thus, this code does n/2 operations. Thus, big O is O(n/2) = O(n) (you can throw out the constant factor of 1/2). For the other problems, simply do the same thing (count the number of times sum++ is executed, then simplify by throwing out constants).
answers question: http://stackoverflow.com/q/23206305
type: Answer
has comment: http://stackoverflow.com/comment/35499804
upvote count: 5

http://stackoverflow.com/comment/35379084
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23138734
has text: ive added some code to my question if you have a chance to view it :)
score: 0

http://stackoverflow.com/comment/35550242
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23235129
has text: @nablex Unfortunately this is how I'm being asked to do it. I would never do it this way if it were up to me.

http://stackoverflow.com/comment/35858070
has text: @DhanaKrishnasamy well you cannot have annotation on the same method argument obviously, but you can have a method like `@Path("{id}") public String getResult(@UserAuthHeaderParam String user, @PathParam("id") Integer id)`, if that's what you're asking for?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23397113
type: AnswerComment

http://stackoverflow.com/comment/35427555
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23159295
has text: Oh, and note that I meant the **[W3C HTML validation service](http://validator.w3.org/)** there. Oops! ;)
score: 0

http://stackoverflow.com/q/23131475
has body: i am using user role relationship using hibernate that is available on so many websites. But In my case user table already having users and roles table also having all the predefined roles. Now what i want is to fetch all the available roles from roles table and check box as "checked" if it is available to the given user_id in third table(user_role).
score: 1
tagged with: java
tagged with: hibernate
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/23133393
has title: Edit/Update User Role Relationship using hibernate
answer count: 1
downvote count: 0
accepted answer: http://stackoverflow.com/a/23133393
favorite count: 0
has comment: http://stackoverflow.com/comment/35365076
tagged with: spring
tagged with: model-view-controller
type: AnsweredQuestion

http://stackoverflow.com/comment/35468465
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23188801
score: 0
has text: For better help sooner, post an [MCVE](http://stackoverflow.com/help/mcve) (Minimal Complete and Verifiable Example).

http://stackoverflow.com/comment/35491222
comment on: http://stackoverflow.com/q/23202632
score: 0
type: Comment
type: QuestionComment
has text: What is xlst? You can lock on that. You can use a "lock on keys" cache approach. Alternatively use a `ConcurrentHashMap`.

http://stackoverflow.com/comment/35448924
type: Comment
has text: It reads the data and I'm able to print it line by line. If you link a smaller file (5 lines or so) and post what you get and why it is not what you want it would be easier to pinpoint the problem.
comment on: http://stackoverflow.com/a/23178447
score: 0
type: AnswerComment

http://stackoverflow.com/comment/35379400
type: Comment
has text: @user3546087> Well, I don't know what's the logic of your program, so I don't know what do you mean by `hardware(...)` and `item(...)`, I just said that you should call `super` with a String, an int, a double,a String as parameters.
comment on: http://stackoverflow.com/a/23138625
type: AnswerComment
score: 0

http://stackoverflow.com/a/24550458
has body: protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); new AsyncTask&lt;String, Integer, String&gt; (){ @Override protected String doInBackground(String... params) { // TODO Auto-generated method stub try { client = new OkHttpClient(); s = post("https://raw.github.com/square/okhttp/master/README.md",""); } catch (Exception e) { // TODO: handle exception e.printStackTrace(); } return null; } @Override protected void onPostExecute(String result) { super.onPostExecute(result); Log.e("ANSWER", "" + s); } }.execute(); }
type: Answer
upvote count: 3
score: 3
downvote count: 0
answers question: http://stackoverflow.com/q/23201663

http://stackoverflow.com/q/23277344
tagged with: gwt
has title: GWT RequestFactory + Validation Groups
score: 0
tagged with: bean-validation
tagged with: validation
answer count: 1
type: UnansweredQuestion
has body: Is there a way to use validation groups with request factory. If I execute a request all annotations are checked. But sometimes I want to validate only a part of the constraints. Is this possible with GWT request factory version 2.6?
has answer: http://stackoverflow.com/a/23285706
tagged with: java
tagged with: requestfactory
type: Question

http://stackoverflow.com/comment/35522467
type: Comment
comment on: http://stackoverflow.com/a/23219775
has text: I improved upon the anser. But have you looked into just combining the arrays themselves? Is the ByteBuffer essential to use?
score: 0
type: AnswerComment

http://stackoverflow.com/comment/35597390
type: QuestionComment
score: 0
has text: @JBNizet the checklogin beans use `response.sendRedirect("admin.jsp");` So after that the url is localhost:8080/Filters/admin.jsp.BTW the init and destroy methods are calling.
type: Comment
comment on: http://stackoverflow.com/q/23261281

http://stackoverflow.com/q/23256629
type: UnansweredQuestion
has title: HBase bulk delete using MapReduce job
score: 3
has answer: http://stackoverflow.com/a/23304669
upvote count: 3
tagged with: java
has body: Using a mapreduce job I am trying to delete rows from a Hbase table. I am getting the following error. java.lang.ClassCastException: org.apache.hadoop.hbase.client.Delete cannot be cast to org.apache.hadoop.hbase.KeyValue at org.apache.hadoop.hbase.mapreduce.HFileOutputFormat$1.write(HFileOutputFormat.java:124) at org.apache.hadoop.mapred.ReduceTask$NewTrackingRecordWriter.write(ReduceTask.java:551) at org.apache.hadoop.mapreduce.task.TaskInputOutputContextImpl.write(TaskInputOutputContextImpl.java:85) at org.apache.hadoop.mapreduce.lib.reduce.WrappedReducer$Context.write(WrappedReducer.java:99) at org.apache.hadoop.mapreduce.Reducer.reduce(Reducer.java:144) at org.apache.hadoop.mapreduce.Reducer.run(Reducer.java:164) at org.apache.hadoop.mapred.ReduceTask.runNewReducer(ReduceTask.java:610) at org.apache.hadoop.mapred.ReduceTask.run(ReduceTask.java:444) at org.apache.hadoop.mapred.Child$4.run(Child.java:268) at java.security.AccessController.doPrivileged(Native Method) at javax.security.auth.Subject.doAs(Subject.java:396) at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation. It looks like this is caused by the output set to KeyValue by configureIncrementalLoad. It only has PutSortReducer and KeyValueSortReducer but not a DeleteSortReducer. My Code: import java.io.IOException; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.conf.Configured; import org.apache.hadoop.fs.Path; import org.apache.hadoop.hbase.HBaseConfiguration; import org.apache.hadoop.hbase.client.Delete; 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.io.LongWritable; import org.apache.hadoop.io.Text; import org.apache.hadoop.mapreduce.Job; import org.apache.hadoop.mapreduce.Mapper; import org.apache.hadoop.mapreduce.lib.input.FileInputFormat; import org.apache.hadoop.mapreduce.lib.input.TextInputFormat; import org.apa…
tagged with: mapreduce
type: Question
tagged with: hadoop
tagged with: scalability
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/23284844
favorite count: 0
tagged with: hbase

opencv
type: Tag
tags question: http://stackoverflow.com/q/23140249
tags question: http://stackoverflow.com/q/23222380
tags question: http://stackoverflow.com/q/23287979
tags question: http://stackoverflow.com/q/23226853
tags question: http://stackoverflow.com/q/23289387
tag name: opencv
tags question: http://stackoverflow.com/q/23196967
tags question: http://stackoverflow.com/q/23272183
tags question: http://stackoverflow.com/q/23290000
tags question: http://stackoverflow.com/q/23203911
tags question: http://stackoverflow.com/q/23134304
tags question: http://stackoverflow.com/q/23199886
tags question: http://stackoverflow.com/q/23162147
tags question: http://stackoverflow.com/q/23259249

http://stackoverflow.com/a/23189387
answers question: http://stackoverflow.com/q/23189366
type: Answer
score: 2
upvote count: 2
has body: Use ResultSetMetaData.getColumnCount() - Returns the number of columns in this ResultSet object. ResultSet rs = pstat.executeQuery(); ResultSetMetaData rsmd = rs.getMetaData(); int columnCount = rsmd.getColumnCount(); See ResultSetMetaData
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23189366

http://stackoverflow.com/a/23275529
type: Answer
score: 0
answers question: http://stackoverflow.com/q/23274591
has body: Discovered that if I create a byte array first and then "wrap" it in a ByteBuffer, I just have to make sure the JVM has enough memory. The Cassandra driver accepts it fine.
has comment: http://stackoverflow.com/comment/72161741

http://stackoverflow.com/comment/35369948
type: Comment
has text: @user3543997: Well if you are asking server side code, I afraid I have less knowledge on that.
type: AnswerComment
comment on: http://stackoverflow.com/a/23133827
score: 0

http://stackoverflow.com/comment/35382079
comment on: http://stackoverflow.com/q/23139060
type: QuestionComment
type: Comment
has text: @JoelHernandez I've just tried in my mac, and I do not have such a path : ..MacOS/jre/bin/java. And it starts just fine. weird..
score: 0

http://stackoverflow.com/comment/35365383
comment on: http://stackoverflow.com/a/23131284
score: 0
type: AnswerComment
has text: Thanks for downvote. It has made me realize that not everything I should answer. I should answer what I completely know.
type: Comment

colors
tags question: http://stackoverflow.com/q/23211603
tags question: http://stackoverflow.com/q/23247130
tags question: http://stackoverflow.com/q/23222578
tags question: http://stackoverflow.com/q/23227524
tags question: http://stackoverflow.com/q/23144451
tags question: http://stackoverflow.com/q/23287271
tag name: colors
tags question: http://stackoverflow.com/q/23234709
tags question: http://stackoverflow.com/q/23275939
tags question: http://stackoverflow.com/q/23145276
type: Tag

http://stackoverflow.com/comment/35450439
type: QuestionComment
has text: I think I have answered by own question. I simply updated the GGTS.ini file to point to the 1.7 JDK. For my installation, GGTS.ini was located in: ~/springsource/ggts-3.5.0.RELEASE/GGTS.app/Contents/MacOS
comment on: http://stackoverflow.com/q/23179256
score: 0
type: Comment

http://stackoverflow.com/a/23261294
has comment: http://stackoverflow.com/comment/35597199
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/23261020
has body: about log4j, this type of configuration that XML configuration which embed the property file is not supported in current version. for details, you can view the log4j's source code . the XML parse details is in class DOMConfigurator.configure
upvote count: 1

http://stackoverflow.com/comment/35468277
type: Comment
comment on: http://stackoverflow.com/a/23147223
score: 0
type: AnswerComment
has text: I was able to get unread emails true this code. This code didn't work on my GoogleApps account but I was able to get trough Gmail Feed API working on [OAuth 2.0 Playground](https://developers.google.com/oauthplayground/). Is there any possibility to get including the read emails? Thanks.

http://stackoverflow.com/a/23145215
upvote count: 1
accepted answer of: http://stackoverflow.com/q/23144850
answers question: http://stackoverflow.com/q/23144850
has body: To solve your problem, you need only ONE ArrayList of Person (and not of array of Person), and you don't need the value ArrayList. What you need instead is some method that create an array of arrays representing a table containing your data, in fact an array of arrays of Strings. The problem is the 'columns' of the table are actually the fields of the Person class. I'm not sure if my solution (below) is the best, probably you can solve this problem also dealing with the reflection. Anyway, this works (I tried to modify least as possible your code or to simplify it): public void buildTable(JPanel panel) throws IOException { File file = new File("C:\\Users\\user\\Desktop\\test.txt"); try { BufferedReader br = new BufferedReader(new FileReader(file)); String line; lineArray = new ArrayList&lt;Person&gt;(); while ((line = br.readLine()) != null) { String[] temp = line.split(","); Person p = new Person(temp[0], temp[1], temp[2], temp[3], temp[4], temp[5], temp[6], temp[7], temp[8]); lineArray.add(p); } br.close(); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } List&lt;String&gt; columns = new ArrayList&lt;String&gt;(); columns.add("First Name"); columns.add("Last Name"); columns.add("Address"); columns.add("Address 2"); columns.add("City"); columns.add("State"); columns.add("Zip Code"); columns.add("Phone"); columns.add("Email"); TableModel tableModel = new DefaultTableModel(Person.toStringsMatrix(lineArray), columns.toArray()); final JTable table = new JTable(tableModel); JScrollPane tableContainer = new JScrollPane(table); tableContainer.setBounds(10, 36, 833, 219); panel.add(tableContainer); } And the Person class: class Person { public String firstName; public String lastName; public String address; public String address2; public String city; public String state; public String zip; public String phone; public String email; public Person(String firstName, String lastName, String address, String address2, Strin…
type: AcceptedAnswer
downvote count: 0
score: 1
type: Answer

http://stackoverflow.com/comment/35437177
has text: @camickr> Thanks for your valuable comment.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23165758
type: Comment

http://stackoverflow.com/comment/35486600
comment on: http://stackoverflow.com/q/23200124
score: 0
type: QuestionComment
has text: I'm just writing a script to create a file of insert statements to run directly in a Oracle Query window via the Database Software (SQL Developer).
type: Comment

http://stackoverflow.com/q/23190608
tagged with: bufferedreader
has answer: http://stackoverflow.com/a/23190710
tagged with: filechooser
answer count: 1
downvote count: 0
favorite count: 0
has body: I've tried several things to open a text file that my program uses to display a map in a map creator. Everything works except that if I choose a text file, I get "null" as string. I don't know how it gets null, because the file exists (and I checked it before loading it) Here my 2 code blocks for both tries: public String OpenText(){ String str = null; JFileChooser fc = new JFileChooser(); int returnVal = fc.showOpenDialog(null); if (returnVal == JFileChooser.APPROVE_OPTION) { File file = fc.getSelectedFile(); System.out.println("Opening: " + file.getName() + ". " + "Path: "+file.getPath()); if(new File(file.getPath()).exists()){ try { System.out.println("File Exists."); /*FileReader fr = new FileReader(file); BufferedReader br = new BufferedReader(fr); StringBuilder sb = new StringBuilder(); while((str = br.readLine())!= null){ sb.append(str); } */ StringBuilder sb = new StringBuilder(); Scanner input = new Scanner(file); while(input.hasNext()){ sb.append(input.nextLine()); sb.append("\n"); } } catch (IOException e) { e.printStackTrace(); } } } else { System.out.println("Open command cancelled by user."); } System.out.println(str); return str; } The code gave at both the first attempt and the second attempt "null" as return. I know the first code works since I use it to save my settings. But I also tried it with a Scanner. Extra info: The file I try to open HAS text in it. I tried different text files.
accepted answer: http://stackoverflow.com/a/23190710
has title: OpenFile Dialog in Java gives null as response
type: AnsweredQuestion
tagged with: java.util.scanner
score: 1
tagged with: java
upvote count: 1
type: Question
tagged with: null

http://stackoverflow.com/comment/35490245
type: Comment
comment on: http://stackoverflow.com/a/23199737
score: 0
type: AnswerComment
has text: @Ram: and what command did you execute to get this? did you try the absolute-path version i added here?

http://stackoverflow.com/comment/70016973
type: QuestionComment
comment on: http://stackoverflow.com/q/23280509
score: 0
has text: Please check comments of http://stackoverflow.com/questions/26647675/how-create-sha224sum-in-java
type: Comment

http://stackoverflow.com/comment/35550043
type: QuestionComment
has text: Looks like you messed with paths, now you have dictionaryPath in config which is wrong. Most likely there is a typo somewhere too, so provide tf output as well as provide your config file. If you don't want to mess with config, you can use latest API version which doesn't require XML configuration from here: http://cmusphinx.sourceforge.net/wiki/tutorialsphinx4. Btw, this latest code allows you to use en-us generic acoustic model which is more accurate than HUB4.
comment on: http://stackoverflow.com/q/23227142
score: 0
type: Comment

http://stackoverflow.com/q/23165581
type: Question
has comment: http://stackoverflow.com/comment/35446659
has comment: http://stackoverflow.com/comment/59280886
tagged with: swingworker
tagged with: java
has comment: http://stackoverflow.com/comment/35444031
has comment: http://stackoverflow.com/comment/35444161
has body: I am creating a java program that will open up a splash image, then every 15 minutes, display an (new or old) image loaded from the function CallMinutesInternational... (in the doInBackground) This image, for the sake of simplicity, changes every few intervals. Now I have a very strange bug.... The code below will only deadlock on a VISTA machine, but will not deadlock on my machine, nor on Microsoft Server 2008 SP1 machine. This leads me to believe that there is something that I am not getting. I have excluded all swing calls and creation in the process(). However, after 20-50 intervals, my computer at work will deadlock (Vista) I would be grateful if anyone can explain why this would occur. I have spent many days trying to fix this simple... nuisance of an error, but cannot get my head around it. Any suggestions? public class GUIThreadremaster extends JComponent { static JFrame f = new JFrame(); static JLabel label = new JLabel(); static final String version = "v.72"; static final String splashUrl = "http://s3.postimg.org/48nx9vkur/image.jpg"; public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { public void run() { new GUIThreadremaster(); n.execute(); }}); // A.GUIThread(); } public static SwingWorker&lt;Void, BufferedImage&gt; n = new SwingWorker&lt;Void,BufferedImage&gt;() { //Semaphore block = new Semaphore(0); boolean b = false; @Override protected Void doInBackground() throws Exception { // TODO Auto-generated method stub URL url = null; BufferedImage image = null; String s; int i = 1; Thread.sleep(15000); while(!b) { System.out.println(Thread.currentThread() + " " + i); i++; s = CallMinInternational.updateGraph(CallMinInternational.queryResultsLive(false)); //System.out.println("test"); // s = splashUrl; url = new URL(s); try { image = ImageIO.read(url); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } //System.out.println("UPDATED : " ); publish(image); Thread.sleep(15000); } return null; }…
has comment: http://stackoverflow.com/comment/35447348
has comment: http://stackoverflow.com/comment/35433155
has title: (Simple code) SwingWorker deadlock
tagged with: deadlock
has comment: http://stackoverflow.com/comment/35442988
has comment: http://stackoverflow.com/comment/35445388
score: 0
has comment: http://stackoverflow.com/comment/35442386
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35441741
tagged with: multithreading
tagged with: swing

http://stackoverflow.com/q/23253916
type: UnansweredQuestion
score: 48
tagged with: logging
answer count: 4
linked to: http://stackoverflow.com/q/30571319
has answer: http://stackoverflow.com/a/32603032
tagged with: java
has body: Log4J allows you to pass the level you'd like particular loggers in your application to log at from the command line, e.g. "-Dlog4j.logger.com.whatever.MyClass=DEBUG". I can't find any similar facility in Logback. According to the FAQ, all it seems to allow you to do is set the level for the root logger by using variable substitution. Is there something I'm missing or does Logback just not support this? Thanks.
type: Question
has title: Is it possible to configure logback logger levels on the command line?
has answer: http://stackoverflow.com/a/71403805
tagged with: logback
has answer: http://stackoverflow.com/a/31335490
downvote count: 0
upvote count: 48
tagged with: log4j
favorite count: 0
has answer: http://stackoverflow.com/a/23255122

http://stackoverflow.com/comment/35585995
type: AnswerComment
has text: Could you please explain why each dependency is calling wait() and notify()? Thank you.
type: Comment
comment on: http://stackoverflow.com/a/23232703
score: 0

http://stackoverflow.com/comment/66865666
has text: hi, did you get answer to this ? were you able to add tiff tag ?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23280548
score: 0

http://stackoverflow.com/q/23285544
type: Question
score: 0
has comment: http://stackoverflow.com/comment/35642442
tagged with: jms
has body: I want to implement a Spring web service to handle a long running process. In requests to this service client specify the job parameters and I need to response back with a job id to track the status of the job. Client will request again with the job id and service should respond with the status (pending, inprogress, completed) of the job. According to the requirement given, I need to use a JMS queue to queue up jobs and once the job is completed a result object (Which has the job id) will be added to another queue. So client will be able to get the result by requesting with the job id. Currently I am able to create Job objects from given parameters, added them to a queue using JMS, a consumer process the job and put the result object to a another queue. Also I tried to generate unique string id as the job id using UUID. But I'm not sure how to handle this status checking and taking result back from the result queue. Also i think if there is a way to generate an integer id it will be more elegant, Any ideas will be highly appreciated.
tagged with: spring
has comment: http://stackoverflow.com/comment/35642331
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35642597
tagged with: java
has title: Spring Web Service, JMS, Long Running Job

http://stackoverflow.com/a/23266521
has comment: http://stackoverflow.com/comment/35606297
has comment: http://stackoverflow.com/comment/35606085
type: AcceptedAnswer
score: 15
has comment: http://stackoverflow.com/comment/35610224
type: Answer
has body: It is a reasonably common practice to use an @NotNull annotation which is supported by some IDEs and maven plugins. In Java 8 you can write @NotNull String text; @NotNull List&lt;@NotNull String&gt; strings = ...; This is not a language feature, but if you need this, it is available. Note: there isn't a standard @NotNull annotation :( So the tools which support this allow you to configure which one(s) you want. I use the one which comes with IntelliJ. It gives you warnings in the editor with auto-fixes and add runtime checks for null arguments, return values and variables. Note: IntelliJ is able to work out if a field is not nullable by usage as well.
upvote count: 15
downvote count: 0
answers question: http://stackoverflow.com/q/23266441
accepted answer of: http://stackoverflow.com/q/23266441

http://stackoverflow.com/comment/35600460
score: 0
has text: As mentioned above you could just log or use System.out.println() in those methods to log the parameters. But if you looking to read a .java file (I am not sure if this is needed) ? It is same like any other text file. Check http://www.mkyong.com/java/how-to-read-file-from-java-bufferedreader-example/
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23263096

http://stackoverflow.com/q/23150397
has answer: http://stackoverflow.com/a/23150574
tagged with: arraylist
score: 0
has body: I created a java application where login credentials are required to have access. I recorded the information about username in ArrayList. private void jBLoginActionPerformed(java.awt.event.ActionEvent evt) { String sql="select * from logins where username=? and password=? and idTypeLogin=?"; try{ pst=(PreparedStatement) conexao.prepareStatement(sql); pst.setString(1, jTUser.getText()); pst.setString(2, jPass.getText()); pst.setString(3, jComboBoxTipoLogin.getSelectedItem().toString()); rs=pst.executeQuery(); if(rs.next()){ String idTypeLogin= rs.getString("idTypeLogin"); if (idTypeLogin.equals("Administrator")) { jTTaskAdmin ah = new jTTaskAdmin(); ah.setVisible(true); } else { jTTaskTecnic eh = new jTTaskTecnic(); eh.setVisible(true); } this.setVisible(false); } else{ JOptionPane.showMessageDialog(null, "User Invalid"); } //close(); }catch(Exception e){ JOptionPane.showMessageDialog(null, e); } List&lt;String&gt; loggedInUsers = new ArrayList&lt;String&gt;(); loggedInUsers.add(jTUser.getText()) List&lt;String&gt; t = loggedInUsers; jTTasktecnic.recordVar=loggedInUsers.get(0); } And I add this code in second form static String recordVar; How can I do to get the information that was recorded in the array, but in another form. That is, I recorded the information in ArrayList in the Login form, now I want to get this information in another form. How can I do this? Thank you
answer count: 3
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23150574
type: Question
tagged with: java
has title: How to get the information that was recorded in the ArrayList?
has comment: http://stackoverflow.com/comment/35399202
linked to: http://stackoverflow.com/q/4646577
possible better answer: http://stackoverflow.com/a/23150460
has answer: http://stackoverflow.com/a/23150575
has answer: http://stackoverflow.com/a/23150460

http://stackoverflow.com/comment/35508206
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23211927
has text: Process p; p = Runtime.getRuntime().exec("/home/path/flume/bin/flume-ng agent --conf-file /home/path/flume/filename.conf --name TwitterAgent -Dflume.root.logger=INFO,console"); p.waitFor(); BufferedReader reader = new BufferedReader(new InputStreamReader(p.getInputStream())); String line = ""; while ((line = reader.readLine())!= null) { System.out.println(line); } I am not getting any error. But it not works.

http://stackoverflow.com/comment/35665310
has text: That should be something like: 4. and allows readQueue to continue' **after** it cleared the messages and releases the lock. 5a readQueue takes the messages-lock 5b. At this moment only readQueue operates on messages (which is probably still empty)
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23297080

http://stackoverflow.com/a/23213661
type: Answer
has body: MySQL is database management system, meaning it let's you store and query the data in handy manner. Eclipse is devepolment enviroment that helps programmers to create software. JPA is a standard for ORM that let's you map data from the database on the objects (f.e. in Java). There is little connection between these 3.
answers question: http://stackoverflow.com/q/23213579
score: 0

http://stackoverflow.com/a/23201919
accepted answer of: http://stackoverflow.com/q/23201884
answers question: http://stackoverflow.com/q/23201884
has body: You initialized your boxArray properly, but you initialized a local variable boxArray, and your instance variable boxArray was unreferenced, so Java initialized it to null, causing the exception. Change Box[] boxArray = new Box[monetaryAmounts.length]; to boxArray = new Box[monetaryAmounts.length];
upvote count: 5
type: AcceptedAnswer
downvote count: 0
score: 5
type: Answer
has comment: http://stackoverflow.com/comment/35489657

http://stackoverflow.com/comment/35467646
score: 0
type: Comment
has text: Thanks @SJuan76, you mean it depends on JMS provider that is compatible enough for both JAVA and .NET for sending and receiving messages from the JMS server? is there any JMS server that is capable currently?
type: AnswerComment
comment on: http://stackoverflow.com/a/23188999

http://stackoverflow.com/q/23278701
downvote count: 2
has title: Disable button in onClickListener inside ArrayAdapter
type: AnsweredQuestion
has body: I have a custom ArrayAdapter, which inflates rows of a list into some text labels, and a button. However, I want to disable the button when the button is clicked. So, here's what I have for example: public class MyListAdapter extends ArrayAdapter&lt;Meetup&gt; { public MyListAdapter(Context context, int layoutResId, ArrayList&lt;Meetup&gt; elements) { ... } public View getView(final int position, View convertView, ViewGroup parent) { //need final int for mElements.get(position) LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); View rowView = inflater.inflate(mLayoutResId, parent, false); Button statusButton = (Button) rowView.findViewById(R.id.statusButton); statusButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { //what I want to do is this: statusButton.setEnabled(false); } }); }} The problem is that I can't reach statusButton from inside the onClickListener. The usual solution would be to make the statusButton global to the class, and that would fix my problem. However I'm not sure if doing that would link ALL the buttons inside that listView, and clicking one would disable all of them... Is that the case, or is there another solution?
tagged with: java
type: Question
upvote count: 0
score: -2
possible better answer: http://stackoverflow.com/a/23278829
has answer: http://stackoverflow.com/a/23278795
has answer: http://stackoverflow.com/a/23278829
answer count: 3
has answer: http://stackoverflow.com/a/23278852
tagged with: android
favorite count: 0
accepted answer: http://stackoverflow.com/a/23278852

http://stackoverflow.com/q/23176111
tagged with: inheritance
accepted answer: http://stackoverflow.com/a/23178323
possible better answer: http://stackoverflow.com/a/23176137
answer count: 3
downvote count: 0
favorite count: 0
tagged with: package
has body: So I got a compile error, who doesn't find the class Person (it works fine if I remove to use the packages) How can I make javac find Person.class? package mypackage; public class Person { private String name; public Person(){ this("Papadopoulos"); } public Person(String name){ setName(name); } public void setName(String name){ this.name = name; } public String getName(){ return( name ); } } public class Student extends Person { private String am; private String department; public Student(){ this("0", "0", "0"); } public Student(String am, String department, String name){ super(name); setAm(am); setDepartment( department ); } public void setAm(String am){ this.am = am; } public String getAm(){ return( am ); } public void setDepartment(String department){ this.department = department; } public String getDepartment(){ return( department ); } }
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23321948
score: 1
tagged with: java
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/23178323
has answer: http://stackoverflow.com/a/23176137
has title: Inheritance in packages

http://stackoverflow.com/comment/35471515
type: Comment
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/23191385
has text: where and what is the error?

http://stackoverflow.com/q/23216596
type: Question
has body: I would like to set delay time in milliseconds for the class which extends AsyncTask. But this class is using also another java Thread. There are classes to stream Mjpeg on Android with some few changes from this question: Android ICS and MJPEG using AsyncTask This is my class which Extends AsyncTask: public class GetCameraMjpeg extends AsyncTask&lt;String, Void, MjpegInputStream&gt; { @Override protected MjpegInputStream doInBackground(String... params) { try { URL url = new URL(params[0]); HttpURLConnection connection = (HttpURLConnection) url.openConnection(); connection.setRequestMethod("GET"); if (username != null &amp;&amp; password != null) { String authEncoded = Base64.encodeToString((username + ":" + password).getBytes(), Base64.DEFAULT); connection.setRequestProperty("Authorization", "Basic " + authEncoded); } connection.connect(); return new MjpegInputStream(connection.getInputStream()); } catch (MalformedURLException e) { e.printStackTrace(); } catch (ProtocolException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return null; } @Override protected void onPostExecute(MjpegInputStream result) { mjpegView.setSource(result); mjpegView.setDisplayMode(MjpegView.SIZE_FULLSCREEN); } } MjpegInputStream class is the same as in the Stackoverflow question pasted above. And the MjpegView is the class extending SurfaceView. It contains inner class MjpegViewThread which is the class extending java Thread class. And this is the run method of this thread. @Override public void run() { Bitmap bitmap; Rect destRect; Canvas canvas = null; while (mjpegRun) { if (surfaceDone) { try { canvas = surfaceHolder.lockCanvas(); if (canvas != null) { synchronized (surfaceHolder) { try { bitmap = mjpegInputStream.readMjpegFrame(); if (displayMode != SIZE_FULLSCREEN) { displayWidth = bitmap.getWidth(); displayHeight = bitmap.getHeight(); } destRect = destRect(bitmap.getWidth(), bitmap.getHeight()); canvas.drawColor(Color.TRANSPARENT); canvas.drawBitmap(bitm…
linked to: http://stackoverflow.com/q/6531950
downvote count: 0
answer count: 1
linked to: http://stackoverflow.com/q/10550139
favorite count: 0
tagged with: android-asynctask
has answer: http://stackoverflow.com/a/23221959
type: UnansweredQuestion
tagged with: multithreading
tagged with: android
score: 3
upvote count: 3
tagged with: java
has title: How to set delay time for the AsyncTask execution when it uses also another Thread?

http://stackoverflow.com/comment/35621834
type: QuestionComment
comment on: http://stackoverflow.com/q/23274698
type: Comment
has text: As others have mentioned, if you have an error, post the error message you received. Also, since you know the line causing the error is line 11, indicate to us which line that is. In this case we may have been able to guess it, but in other cases it is not so easy.
score: 0

http://stackoverflow.com/comment/35573230
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23248318
has text: Ok I understand what you are saying and it makes sense. My JSP is just complaining about the <c:set var="buttonTitel"> tag saying it unknown tag which casuses the same issue I had with the sing quotes above. Did you just use that <c: as an example or can that actually be used?
type: AnswerComment

http://stackoverflow.com/a/23249444
has comment: http://stackoverflow.com/comment/35575254
type: Answer
upvote count: 4
accepted answer of: http://stackoverflow.com/q/23249372
has comment: http://stackoverflow.com/comment/35577106
has comment: http://stackoverflow.com/comment/35577343
downvote count: 0
has comment: http://stackoverflow.com/comment/35575239
has body: For this to happen then either: info is not actually an ArrayList and has had a different list assigned to it at some point (for example Collections.emptyList, Collections.singletonList, Arrays.asList, wrapping it in an immutable list of some sort, etc). or e.getType() is throwing the exception. The exception stack trace will help you confirm which of these is the case.
score: 4
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35575202
answers question: http://stackoverflow.com/q/23249372

http://stackoverflow.com/comment/35560302
comment on: http://stackoverflow.com/q/23241106
score: 0
type: Comment
type: QuestionComment
has text: `since i need to give only a single file i can't make a jar library`, Nope, You can create a jar file with that interface only

http://stackoverflow.com/a/23133805
score: 1
answers question: http://stackoverflow.com/q/23133732
upvote count: 1
has body: You can pack your component into javax.swing.Box add shift it: jtp.add("Component shifted vertically", shiftVertical(your_component, 5)); // 5 px or more public static Box shiftVertical(JComponent component, int size){ Box vBox = Box.createVerticalBox(); vBox.add(Box.createVerticalStrut(size)); vBox.add(component); return vBox; }
has comment: http://stackoverflow.com/comment/35369699
type: Answer
has comment: http://stackoverflow.com/comment/35371489
has comment: http://stackoverflow.com/comment/35370870
downvote count: 0

http://stackoverflow.com/comment/35491074
type: Comment
has text: If I could mark this as an answer also I would, it also does what I need in a different way - thank you very much.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23202455

http://stackoverflow.com/q/23239933
has comment: http://stackoverflow.com/comment/35611460
has comment: http://stackoverflow.com/comment/35586930
type: AnsweredQuestion
score: 3
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/23271183
type: Question
has comment: http://stackoverflow.com/comment/35611250
tagged with: infinispan
answer count: 1
has title: Persisting data in infinispan cache to file
accepted answer: http://stackoverflow.com/a/23271183
has body: I'm trying to persist cached data from infinispan 6.0.2 to a file, I'm using the embedded mode and this is the cache configuration: ConfigurationBuilder builder = new ConfigurationBuilder(); builder.eviction().strategy(EvictionStrategy.LRU).maxEntries(1) .persistence() .passivation(false) // save evicted entries to cache store .addSingleFileStore() .preload(true) .shared(false) .fetchPersistentState(true) .ignoreModifications(false) .purgeOnStartup(false) .location(System.getProperty("java.io.tmpdir")+"infinispan") //.async().enabled(true).threadPoolSize(5) .singleton() .enabled(true) .pushStateWhenCoordinator(true) .pushStateTimeout(20000); Configuration configuration = builder.build(); It does not work for me (and I don't have errors), the file store is created in the file system but contains only "FCS1" and if it's already created nothing happen (i.e. no update). Here is the code (nothing fancy) for adding key/value pairs to the cache: // Avoid JMX problems related to org.infinispan already registered domain GlobalConfiguration globalConf = new GlobalConfigurationBuilder() //.clusteredDefault() .globalJmxStatistics() .mBeanServerLookup(DummyMBeanServer.lookup) .build(); EmbeddedCacheManager manager1 = new DefaultCacheManager(globalConf, configuration); manager1.start(); Cache&lt;String, String&gt; cache1 = manager1.getCache(); // default cache cache1.put("key11", "val11"); cache1.put("key12", "val12"); cache1.put("key13", "val13"); cache1.evict("key11"); // a desperate attempt to move this key to the store cache1.stop(); // when I restart the cache all data is lost cache1.start();
upvote count: 3
tagged with: java
tagged with: file
has comment: http://stackoverflow.com/comment/35608771
tagged with: caching
has comment: http://stackoverflow.com/comment/35598857
tagged with: persistence

http://stackoverflow.com/q/23230854
score: 7
has answer: http://stackoverflow.com/a/23230913
has comment: http://stackoverflow.com/comment/35545734
has comment: http://stackoverflow.com/comment/35542587
has answer: http://stackoverflow.com/a/23231098
downvote count: 1
tagged with: arrays
has answer: http://stackoverflow.com/a/23231357
has answer: http://stackoverflow.com/a/23231160
has body: Is it possible in Java to find the number of dimensions of an array with an 'a priori' unknown number of dimensions? That is, if one doesn't know the number of dimensions of a multidimensional matrix, how could it be retrieved, if possible?
tagged with: multidimensional-array
answer count: 5
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35542279
tagged with: java
has title: Getting unknown number of dimensions from a multidimensional array in Java
favorite count: 0
has comment: http://stackoverflow.com/comment/35545851
upvote count: 8
type: Question
has answer: http://stackoverflow.com/a/23231113
tagged with: dimensions

http://stackoverflow.com/q/23258875
type: Question
has answer: http://stackoverflow.com/a/23258913
downvote count: 0
accepted answer: http://stackoverflow.com/a/23258913
answer count: 1
has body: I want to Load an Image and use it as the Back Ground for my JPanel, This Code doesn't give me any errors or results. I also Tried using BufferedImage and setting the File location to the path of the image, but i got an error "Can't read input file!", After some research i found this method and an easier alternative. import javax.swing.ImageIcon; import javax.swing.*; import java.awt.*; import java.awt.image.*; import java.io.File; import java.io.IOException; public class drawArea extends JPanel { public drawArea(){ init(); } private void init(){ setPreferredSize( new Dimension( 570, 570 ) ); setVisible(true); } private void initializeGrid(Graphics g) { Graphics2D g2d = (Graphics2D) g; Image img = new ImageIcon("/LinearEquations/src/exit.png").getImage(); g2d.drawImage(img, 0, 0, this); } public void paintComponent(Graphics g) { super.paintComponent(g); initializeGrid(g); } } Thanks in Advance
favorite count: 0
upvote count: 2
has title: Can't Load Image in Java
tagged with: swing
score: 2
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/72259433
has text: Did you find solution for this issue?
type: Comment
comment on: http://stackoverflow.com/q/23240378
type: QuestionComment
score: 0

http://stackoverflow.com/q/23217190
answer count: 5
has comment: http://stackoverflow.com/comment/35558505
has answer: http://stackoverflow.com/a/73036665
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35517158
has answer: http://stackoverflow.com/a/23217376
accepted answer: http://stackoverflow.com/a/23217376
linked to: http://stackoverflow.com/q/29280857
upvote count: 3
tagged with: java
tagged with: multithreading
tagged with: thread-synchronization
has body: public void method(Type1 inst1, Type2 inst2) { synchronized(inst1) { synchronized(inst2) { //do something now } } } I can understand from this piece of code that once a thread enters the method, it acquires the lock on inst1, and then it acquires lock on inst2, without releasing inst1 lock. I assume that both of these objects are not locked by other thread. If a thread can acquire lock on only one object at once and can only own another lock when lock on current object has been released, how can this piece of code be valid, or rather, is it a valid code that I think I have seen somewhere? And what if Type1 and Type2 are same? What happens if we make the method synchronized, considering it resides in a class other than the parameter types of the method?
type: Question
has answer: http://stackoverflow.com/a/23217505
possible better answer: http://stackoverflow.com/a/23239746
score: 3
has answer: http://stackoverflow.com/a/55213410
has comment: http://stackoverflow.com/comment/35520235
has answer: http://stackoverflow.com/a/23239746
has comment: http://stackoverflow.com/comment/35523475
downvote count: 0
tagged with: synchronization
favorite count: 0
has title: How can a thread acquire lock on two objects simultaneously as in this case?

http://stackoverflow.com/q/23142991
answer count: 3
favorite count: 0
has answer: http://stackoverflow.com/a/23143106
type: UnansweredQuestion
has body: I have to create a Battleship program with the player as the object and then the Array Boards being part of the fields. I have a minor error somewhere in the code which I can't seem to figure what it is exactly. I have a main method and a class where my methods are defined. I get an error saying it can't find the symbol at "a.setBoard()" and "b.setBoard()" public class Player_p2 implements Player{ //fields char [][] Board1 = new char [11][10]; char [][] Board2 = new char[11][10]; //methods public void setBoard () { this.Board1 = Board1; this.Board2 = Board2; int row = Board1.length; int col = Board1[0].length; char a = '~'; for (int k = 1; k &lt; row; k++) { for (int l = 0; l &lt; col; l++) { Board1[k][l] = a; } } int row1 = Board1.length; int col1 = Board1[0].length; char b = '~'; for (int m = 1; m &lt; row1; m++) { for (int n = 0; n &lt; col1; n++) { Board1[m][n] = b; } } Board1[0][0] = '0'; Board1[0][1] = '1'; Board1[0][2] = '2'; Board1[0][3] = '3'; Board1[0][4] = '4'; Board1[0][5] = '5'; Board1[0][6] = '6'; Board1[0][7] = '7'; Board1[0][8] = '8'; Board1[0][9] = '9'; Board2[0][0] = '0'; Board2[0][1] = '1'; Board2[0][2] = '2'; Board2[0][3] = '3'; Board2[0][4] = '4'; Board2[0][5] = '5'; Board2[0][6] = '6'; Board2[0][7] = '7'; Board2[0][8] = '8'; Board2[0][9] = '9'; } public void printBoard() { this.Board2 = Board2; int row = Board2.length; int col = Board2[0].length; for (int k = 0; k &lt; row; k++) { System.out.print(k + " "); for (int l = 0; l &lt; col; l++) { System.out.print(Board2[k][l] + " "); } System.out.println(); } } } public class Battleship { public static void main(String[] args) { Player a = new Player_p2(); Player b = new Player_p2(); //initializes the empty boards a.setBoard(); b.setBoard(); a.printBoard(); b.printBoard(); } } public interface Player{ public void printBoard(); }
has answer: http://stackoverflow.com/a/23143107
has comment: http://stackoverflow.com/comment/35386772
tagged with: java
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/35386591
upvote count: 0
score: -1
has comment: http://stackoverflow.com/comment/35386857
has title: Trouble programming using objects for Battleship
has answer: http://stackoverflow.com/a/23143066

http://stackoverflow.com/comment/95031856
has text: Did you run the above code? Note the `matches()` call, which ensures the entire input string matches the pattern. This makes the use of `^`, `$`, or `\b` unnecessary in this case.
comment on: http://stackoverflow.com/a/23155867
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/35589441
comment on: http://stackoverflow.com/q/23257048
has text: Basically the same as http://stackoverflow.com/questions/23212676/why-is-upcasting-a-class-considered-an-unsafe-operation , although this referred to `Class` instead of `X` ...
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35434612
type: QuestionComment
has text: Can you check if you have the Presence feature enabled on your key. Check admin.pubnub.com
comment on: http://stackoverflow.com/q/23157794
score: 3
type: Comment

http://stackoverflow.com/comment/35445998
has text: That's almost exactly the code I have used except some variable names and format changes. Swapping is not used at any place whatsoever. TInTArrayList is an array backed list of int primitives. So besides an int array, it will have few meta data stored(still this is not much of a memory headache i suppose). Creating a TIntArrayList object creation takes time but with that many lines in the file, I have not checked it's impact yet. TIntArrayList creation overhead would be the last thing I would want to hear. :D
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23156016
type: AnswerComment

http://stackoverflow.com/q/23180984
score: 2
tagged with: java
tagged with: maven-assembly-plugin
type: Question
upvote count: 2
answer count: 2
has body: I have a maven SWT project that has multiple dependencies: dependency 1, dependency 2, dependency 3,...., dependency n. I want to make an executable jar that contains only the project and dependency 1 and dependency 2 but the other dependencies will be copied on the /lib directory. Here is my assembly config : org.apache.maven.plugins maven-assembly-plugin 2.2-beta-5 com.company dependency1 1.0-SNAPSHOT com.company dependency2 1.0 mvnDescript.xml true ${project.build.mainClass} make-my-jar-with-dependencies package single and the mvnDescript.xml : dir false / false ${artifact} /lib false ${artifact}
has answer: http://stackoverflow.com/a/23184271
favorite count: 0
has comment: http://stackoverflow.com/comment/35457438
downvote count: 0
type: UnansweredQuestion
tagged with: maven
has answer: http://stackoverflow.com/a/23183420
has title: How to produce a executable jar with maven that contains a subset of dependencies?

http://stackoverflow.com/comment/35607172
comment on: http://stackoverflow.com/q/23267099
score: 0
type: Comment
type: QuestionComment
has text: I hope there is duplicate id exist in your xml file and do that what subash said.

http://stackoverflow.com/comment/35648083
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23288709
has text: Is it working now or not. If not what is the problem

http://stackoverflow.com/comment/35477734
comment on: http://stackoverflow.com/q/23195028
has text: Show the code you're using to create the `jpg` file.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35598857
type: Comment
type: QuestionComment
has text: Indeed, we need to see the code you call and the assertions you have in place, as suggested by cruftex. Btw, remove the singleton part since it's not relevant for a local cache like this.
score: 0
comment on: http://stackoverflow.com/q/23239933

http://stackoverflow.com/q/23255783
has body: I have the following program. I was just kind of messing around with other stuff when I noticed something unusual. The line "y = 3;" seems to have an effect on how fast the previous block of code can be run. When the line is commented out, the first half of the code runs around ten times slower than the second half. However, when the line is uncommented, both halves run at the same speed. Interestingly, the line in question should not be doing anything, as at that point the value of y is already 3. EDIT: I added line "System.out.println(y)" right above "y=3" and it prints 3. That's why I think it's 3. And I'm measuring based on the output of the program. The two lines that it prints are the two runtimes, and the Timer code at the bottom shows clearly how I am measuring time. /** * @author lpreams */ public class Misc { public static void main(String[] args) { new Misc().run(); } public void run() { Timer t = new Timer(); t.start(); int y = Integer.MIN_VALUE; for (int j = 0; j &lt; Integer.MAX_VALUE; ++j) { for (int i = 0; i &lt; Integer.MAX_VALUE; ++i) { ++y; } } t.stop(); System.out.println(t.getElapsedTime()); t.reset(); //y = 3; t.start(); for (int j = 0; j &lt; Integer.MAX_VALUE; ++j) { for (int i = 0; i &lt; Integer.MAX_VALUE; ++i) { ++y; } } t.stop(); System.out.println(t.getElapsedTime()); } private static class Timer { private long startTime = 0; private long stopTime = 0; private long elapsed = 0; public void start() { this.startTime = System.nanoTime()/1000000; } public void stop() { this.stopTime = System.nanoTime()/1000000; elapsed += stopTime - startTime; } public long getElapsedTime() { return elapsed; } public void reset() { elapsed = 0; } } } I am running this code in Eclipse on OS X 10.9.2. I am running the latest version of java. My machine is a MacBook Pro with a 2.4ghz Core 2 Duo with 8gb of RAM.
downvote count: 1
linked to: http://stackoverflow.com/q/5242405
favorite count: 0
has comment: http://stackoverflow.com/comment/35587180
has comment: http://stackoverflow.com/comment/35587354
has answer: http://stackoverflow.com/a/23256074
has title: Resetting a variable later in the code makes an earlier block of code run slower. Why?
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/23256074
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/23256700
accepted answer: http://stackoverflow.com/a/23256700
type: Question
has comment: http://stackoverflow.com/comment/35587119
upvote count: 2
has comment: http://stackoverflow.com/comment/35587201
has comment: http://stackoverflow.com/comment/35587101
answer count: 2

spring-data-jpa
tags question: http://stackoverflow.com/q/23246286
tags question: http://stackoverflow.com/q/23193724
tags question: http://stackoverflow.com/q/23262360
tags question: http://stackoverflow.com/q/23235693
tags question: http://stackoverflow.com/q/23178601
tags question: http://stackoverflow.com/q/23275626
type: Tag
tag name: spring-data-jpa

http://stackoverflow.com/comment/35559689
type: AnswerComment
comment on: http://stackoverflow.com/a/23235944
type: Comment
has text: Nice answer! This way should work fine, but i think that versioning by JSF resource library is a better practice. Thank you anyway :)
score: 0

http://stackoverflow.com/comment/35538249
has text: Honestly, I'll take it any way I can get it. I'm not married to Maven. I tried this with a non-Maven (Ant) web project and get the error that my classes need to be enhanced. Any way I can get over this enhancement hurdle is fine by me.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23227132

http://stackoverflow.com/a/23276002
score: 0
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/23273420
has body: you can get string array from jsp to action class by following lines In jsp &lt;s:hidden name="cdSettore" value="%{cdSettore}"&gt;&lt;/s:hidden&gt; If you want you can use &lt;s:if test="#myObj.selected == 0"&gt; &lt;s:hidden name="cdSettore" value="%{cdSettore}"&gt;&lt;/s:hidden&gt; &lt;/s:if&gt; to get not selected once in action class private String[] cdSettore; public void setCdSettore(String[] cdSettore) { this.cdSettore = cdSettore; } public String[] getCdSettore() { return cdSettore; } for(int i=0;i&lt;getCdSettore().length;i++){ System.out.println("not selected :"+getCdSettore()[i]); } Or you can do this In jsp &lt;s:hidden name="cdSettore" value="%{cdSettore}"&gt;&lt;/s:hidden&gt; &lt;s:if test="#myObj.selected == 1"&gt; &lt;s:checkbox name="selected" fieldValue="%{cdSettore}" checked="checked"/&gt; &lt;s:property value="cdSettore" /&gt; &lt;/s:if&gt; &lt;s:if test="#myObj.selected == 0"&gt; &lt;s:checkbox name="selected" fieldValue="%{cdSettore}" /&gt; &lt;s:property value="cdSettore" /&gt; &lt;/s:if&gt; In action class for(int i=0;i&lt;getCdSettore().length;i++){ int flag=0; for(int j=0;j&lt;getSelected().length;j++){ if(getCdSettore()[i].equalsIgnoreCase(getSelected()[j])) { flag++; } } if(flag==0) { System.out.println("not selected :"+getCdSettore()[i]); } }
answers question: http://stackoverflow.com/q/23273420

http://stackoverflow.com/a/23359299
has comment: http://stackoverflow.com/comment/35790534
upvote count: 1
has comment: http://stackoverflow.com/comment/38161252
downvote count: 0
score: 1
type: Answer
answers question: http://stackoverflow.com/q/23241706
has body: In Ehcache 2.6.2 all cache data will always be on disk, as the storage model changed, so you could benefit from a speed-up by using memory storage in addition to the disk storage. What do you mean when you say: After every data update we have in the program, we flush the data to the disk. Regarding the performance of the disk store, there is one option that you can try: &lt;cache diskAccessStripes="4" ...&gt; ... &lt;/cache&gt; where the diskAccessStripes attribute takes a power of two value. Try it first with small values and see if you gain anything. The exact effect of this attribute will depend on a lot of factors: hardware, operation system as well as usage patterns of your application.

http://stackoverflow.com/comment/35598033
has text: what is the error you are getting in the glassfish console?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23257782

google-app-engine
tags question: http://stackoverflow.com/q/23262978
tag name: google-app-engine
tags question: http://stackoverflow.com/q/23171698
tags question: http://stackoverflow.com/q/23196541
type: Tag
tags question: http://stackoverflow.com/q/23172275
tags question: http://stackoverflow.com/q/23283483
tags question: http://stackoverflow.com/q/23266207
tags question: http://stackoverflow.com/q/23208417
tags question: http://stackoverflow.com/q/23254183
tags question: http://stackoverflow.com/q/23189048
tags question: http://stackoverflow.com/q/23171073
tags question: http://stackoverflow.com/q/23206468
tags question: http://stackoverflow.com/q/23141302
tags question: http://stackoverflow.com/q/23238859
tags question: http://stackoverflow.com/q/23152335
tags question: http://stackoverflow.com/q/23157341
tags question: http://stackoverflow.com/q/23190776
tags question: http://stackoverflow.com/q/23248587
tags question: http://stackoverflow.com/q/23183846
tags question: http://stackoverflow.com/q/23211174
tags question: http://stackoverflow.com/q/23144082
tags question: http://stackoverflow.com/q/23170177
tags question: http://stackoverflow.com/q/23275432
tags question: http://stackoverflow.com/q/23225147
tags question: http://stackoverflow.com/q/23190796
tags question: http://stackoverflow.com/q/23245908
tags question: http://stackoverflow.com/q/23159339
tags question: http://stackoverflow.com/q/23177004
tags question: http://stackoverflow.com/q/23218228
tags question: http://stackoverflow.com/q/23238323
tags question: http://stackoverflow.com/q/23188807
tags question: http://stackoverflow.com/q/23245977
tags question: http://stackoverflow.com/q/23259113
tags question: http://stackoverflow.com/q/23254265
tags question: http://stackoverflow.com/q/23149036
tags question: http://stackoverflow.com/q/23155599
tags question: http://stackoverflow.com/q/23246850
tags question: http://stackoverflow.com/q/23162642
tags question: http://stackoverflow.com/q/23233344
tags question: http://stackoverflow.com/q/23152776
tags question: http://stackoverflow.com/q/23195381
tags question: http://stackoverflow.com/q/23251693
tags question: http://stackoverflow.com/q/23224623
tags question: http://stackoverflow.com/q/23149390
tags question: http://stackoverflow.com/q/23154699

http://stackoverflow.com/comment/35602169
score: 0
type: AnswerComment
type: Comment
has text: This work, but I need to use show and display ( those are textviews to display the value in application ) I will update the all code to see.
comment on: http://stackoverflow.com/a/23264069

http://stackoverflow.com/a/23271089
type: Answer
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/23225283
has comment: http://stackoverflow.com/comment/134981992
answers question: http://stackoverflow.com/q/23225283
upvote count: 1
type: AcceptedAnswer
has body: The problem was actually my antivirus (avast). After fixing that, it launched in &lt;1min.

http://stackoverflow.com/a/55118294
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/23260057
score: 4
upvote count: 4
has body: The forked JVM used in the test is running out of memory. The solution would be to either disable forking a JVM and running the tests on the main JVM ensuring you have sufficient memory or to pass args to increase the memory of the forked JVM Check out the solution in this answer

http://stackoverflow.com/q/23227571
answer count: 1
downvote count: 0
tagged with: inheritance
favorite count: 0
has comment: http://stackoverflow.com/comment/35536563
has answer: http://stackoverflow.com/a/23951634
has comment: http://stackoverflow.com/comment/35536095
has title: calling super method from unrelated method
has comment: http://stackoverflow.com/comment/35536945
has body: Today I realized that calling super.foo() is possible not only inside an overriding foo method, but also inside completely unrelated methods: class Base { void foo() { } } class Derived extends Base { void foo() { } void bar() { super.foo(); } } Is there any real-world scenario, Design Pattern or whatever where this is actually useful?
has comment: http://stackoverflow.com/comment/35536063
type: AnsweredQuestion
tagged with: super
upvote count: 3
accepted answer: http://stackoverflow.com/a/23951634
has comment: http://stackoverflow.com/comment/35538233
type: Question
score: 3
tagged with: oop
tagged with: java

http://stackoverflow.com/a/23249094
answers question: http://stackoverflow.com/q/23248943
has body: Creating private constructor typically has goal to prevent creating instance of the class from outside. Typically this is done if class provides other methods to create its instance, for example static factory method. Examples: java.util.Pattern can be created using Pattern.compile() singleton design pattern If you however indeed want to work around the compiler's restrictions you can use reflection. I am not familiar enough with Groovy, but here is how you can do this in java. Constructor c = World.class.getConstructor(); c.setAccessible(true); // This line grants you permission to access even private elements World w = (World)c.newInstance();
score: 2
downvote count: 0
type: Answer
upvote count: 2

http://stackoverflow.com/comment/35439737
comment on: http://stackoverflow.com/q/23171019
has text: You have to connect to the public IP. If it belongs to a router then the router has to be configured to forward inbound connections to the server's private LAN IP. There is nothing you can do about that on the client end.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35590678
type: Comment
comment on: http://stackoverflow.com/a/23257620
has text: If you could help me improve my bad code (with an explanation of why it is bad), i would be very grateful as this is very confusing for me currently.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/35574330
type: QuestionComment
has text: you have a typo, you are initializing rTimer twice. Copy paste :P
comment on: http://stackoverflow.com/q/23249098
score: 0
type: Comment

http://stackoverflow.com/comment/35573989
score: 0
has text: " I think I need a listener." okay did you try it?
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23248657

cassandra-2.0
tags question: http://stackoverflow.com/q/23245378
type: Tag
tag name: cassandra-2.0

http://stackoverflow.com/comment/68262288
score: 0
comment on: http://stackoverflow.com/a/23232887
has text: You are wrong. Volatile reads are significantly cheaper than writes. This is a tested optimization for volatile field writes.
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/35565960
score: 0
has text: So which language are you talking about? Java, C++,and C are very different languages.
comment on: http://stackoverflow.com/q/23244306
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23267885
tagged with: swingworker
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/23268268
score: 0
has comment: http://stackoverflow.com/comment/35608607
tagged with: runnable
answer count: 1
has title: TextArea which Dynamically shows appended text
has answer: http://stackoverflow.com/a/23268268
tagged with: multithreading
tagged with: swing
has body: I want to execute this task such that on each task execution some text lines in the already present JTextArea logText gets appended. Error is the line : task = new Task(); what needs to be done such that we get a JTextArea which Dynamically shows appended text. public class ScanAccount extends JFrame { private JPanel contentPane; private JTextField textField; private JPasswordField passwordField; private JTable table; private JTextArea logText = new JTextArea(); private static Task task; private static String statusText; class Task extends SwingWorker&lt;Void, Void&gt; { /* * Main task. Executed in background thread. */ @Override public Void doInBackground() { logText.append(statusText + "\n"); logText.setCaretPosition(logText.getDocument().getLength()-1); return null; } /* * Executed in event dispatching thread */ @Override public void done() { } } /** * Launch the application. */ public static void main(String[] args) { javax.swing.SwingUtilities.invokeLater(new Runnable() { public void run() { try { ScanAccount frame = new ScanAccount(); frame.setVisible(true); while(true) { Random random = new Random(); statusText = "new text is " + random.nextInt(10000); task = new Task(); task.execute(); } } catch (Exception e) { e.printStackTrace(); } } }); } /** * Create the frame. */ public ScanAccount() { setTitle("Scanning Mode : Email Accounts"); setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); setBounds(100, 100, 450, 440); contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); setContentPane(contentPane); contentPane.setLayout(null); JLabel lblAccountInformation = new JLabel("Account Information :"); lblAccountInformation.setBounds(12, 12, 168, 15); contentPane.add(lblAccountInformation); JLabel lblUsername = new JLabel("Username :"); lblUsername.setFont(new Font("Dialog", Font.PLAIN, 12)); lblUsername.setBounds(34, 37, 88, 15); contentPane.add(lblUsername); textField = new JTextField(); textField.setBounds(113, 35, 285, 19); contentPane.add(…
type: AnsweredQuestion

http://stackoverflow.com/a/23181760
accepted answer of: http://stackoverflow.com/q/23181670
score: 2
has comment: http://stackoverflow.com/comment/35455416
type: AcceptedAnswer
upvote count: 2
type: Answer
has body: Consider redesigning the schema so that tags have a table of their own and there's a many-to-many relationship between the things and tags tables. For example CREATE TABLE tags(id INTEGER PRIMARY KEY, name TEXT); CREATE TABLE thingtags(thingid INTEGER REFERENCES things(id), tagid INTEGER REFERENCES tags(id), PRIMARY KEY(thingid,tagid)); Then to get the tags that are used at least once SELECT name FROM tags WHERE id IN (SELECT tagid FROM thingtags);
answers question: http://stackoverflow.com/q/23181670
downvote count: 0

http://stackoverflow.com/q/23151306
answer count: 4
downvote count: 0
has title: How to retrieve List <String> from HttpResponse object in Java
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35400586
has comment: http://stackoverflow.com/comment/35402050
has answer: http://stackoverflow.com/a/23151398
has answer: http://stackoverflow.com/a/23154370
score: 2
linked to: http://stackoverflow.com/q/9048812
tagged with: httpresponse
favorite count: 0
has answer: http://stackoverflow.com/a/48663630
type: Question
upvote count: 2
tagged with: spring
has body: I am new to this kind of coding where in I have to send a collection of String i.e., List from a Spring controller of different web app. So my questions are How should I return the Response which consists of List from a controller? Does the below code works fine? Below is my controller code where I will be returning List&lt;String&gt;. @RequestMapping(value = "getMyBookingsXmlList", method = RequestMethod.GET) public @ResponseBody List&lt;String&gt; getMyBookingsXmlList() { return mbXmlImpl.getMyBookingsDetailsXmlList(); } In the client side how should I have to retrieve the List&lt;String&gt; which was sent from the above controller method ? Below is the code which I am trying to do but I have no clue as of how to do. HttpClient httpclient = new DefaultHttpClient(); HttpGet httpGet = new HttpGet("URL"); HttpResponse httpResponse = httpclient.execute(httpGet); InputStream is = httpResponse.getEntity().getContent(); StringBuffer buffer = new StringBuffer(); byte [] b = new byte [1024]; for (int n ; (n = is.read(b)) != -1 ;) buffer.append(new String(b, 0, n)); After this I don't have a clue what to do....
tagged with: spring-mvc
has answer: http://stackoverflow.com/a/23152698
tagged with: java
linked to: http://stackoverflow.com/q/6442791
has comment: http://stackoverflow.com/comment/35400519

http://stackoverflow.com/comment/35442974
type: QuestionComment
has text: The actual class cast exception stack trace would be helpful.
score: 0
comment on: http://stackoverflow.com/q/23174582
type: Comment

http://stackoverflow.com/comment/35464539
comment on: http://stackoverflow.com/a/23187338
type: Comment
score: 0
type: AnswerComment
has text: I was trying to avoid doing that, I figured that much out, but I figured I could use a functional programming hack with Java 8 to do it.

http://stackoverflow.com/comment/35488772
type: AnswerComment
has text: @ Sriram thank you, your snippet certainly helped a lot.
type: Comment
comment on: http://stackoverflow.com/a/23192948
score: 0

http://stackoverflow.com/comment/35749319
type: Comment
comment on: http://stackoverflow.com/q/23271644
score: 0
has text: oh, thank you, i'll do that!
type: QuestionComment

http://stackoverflow.com/a/24294682
upvote count: 2
answers question: http://stackoverflow.com/q/23276678
has body: Turns out I had some proprietary code from AppDynamics causing this issue. I opened a ticket with them and they fixed the issue in their next release. Thank you for all the help though!
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23276678
downvote count: 0
has comment: http://stackoverflow.com/comment/38917858
type: Answer
score: 2

http://stackoverflow.com/a/23234309
downvote count: 0
score: 4
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23234062
has body: You're not instantiating any of the fragments you wish to become tabs in the FragmentPagerAdapter, getItem method. Instead you're returning null and therefore there are no views to fill the viewpager. I can see you've checked out his sample project, maybe take a closer look at the fragments you're trying to add to the viewpager. The above answer looks like a sound implementation.
answers question: http://stackoverflow.com/q/23234062
type: Answer
upvote count: 4

http://stackoverflow.com/q/23154116
accepted answer: http://stackoverflow.com/a/23155004
has comment: http://stackoverflow.com/comment/35405638
has answer: http://stackoverflow.com/a/23154433
has comment: http://stackoverflow.com/comment/35405708
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/23154433
tagged with: java
tagged with: mysql
tagged with: eclipse
has comment: http://stackoverflow.com/comment/35405782
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/23155004
has comment: http://stackoverflow.com/comment/35405518
has comment: http://stackoverflow.com/comment/35406931
has comment: http://stackoverflow.com/comment/35406057
score: 0
has title: Android JDBC : Some issues with using MySql JDBC in Eclipse
has comment: http://stackoverflow.com/comment/35405915
tagged with: jdbc
has comment: http://stackoverflow.com/comment/35405978
has body: I am using Eclipse in Windows and i want to connect to a MySql DB. I know i should use JDBC. But i don't know how to use it! I have downloaded both msi and zip file from JDBC download page. In the zip file, a file with this name exsits : mysql-connector-java-5.1.30-bin.jar What should i do with this? I mean where i copy/import (in a folder or in eclipse) this file? Note that i have this code: import android.os.Bundle; import android.app.Activity; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.ResultSetMetaData; import java.sql.Statement; import android.os.AsyncTask; import android.view.View; import android.widget.Button; import android.widget.TextView; public class LearningActivity extends Activity { private static final String url = "jdbc:mysql://cool/app"; private static final String user = "user"; private static final String pass = "password"; private Button button; private TextView tv; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); button = (Button)this.findViewById(R.id.button1); tv = (TextView)this.findViewById(R.id.textView1); button.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { // Perform action on click Connect(); } }); } public void Connect() { Connect task = new Connect(); task.execute(); } private class Connect extends AsyncTask&lt;String, Void, String&gt; { @Override protected String doInBackground(String... urls) { String response = ""; try { Class.forName("com.mysql.jdbc.Driver"); Connection con = DriverManager.getConnection(url, user, pass); String result = "Database connection success\n"; Statement st = con.createStatement(); ResultSet rs = st.executeQuery("select * from users"); ResultSetMetaData rsmd = rs.getMetaData(); while(rs.next()) { result += rsmd.getColumnName(1) + ": " + rs.getInt(1) + "\n"; result += rsmd.getColumnName(2) + ": " + rs.getString(2) + "\n"; result += rsmd.ge…

http://stackoverflow.com/comment/35543273
has text: Test if y is -1 before the `substring` call? I'm not entirely sure what your input is, so I can't be sure.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23231423
type: AnswerComment

http://stackoverflow.com/a/55770814
score: 1
has body: Late Post. package com.prac.stack; public class BalanceBrackets { public static void main(String[] args) { String str = "{()}[]"; char a[] = str.toCharArray(); System.out.println(check(a)); } static boolean check(char[] t) { Stackk st = new Stackk(); for (int i = 0; i &lt; t.length; i++) { if (t[i] == '{' || t[i] == '(' || t[i] == '[') { st.push(t[i]); } if (t[i] == '}' || t[i] == ')' || t[i] == ']') { if (st.isEmpty()) { return false; } else if (!isMatching(st.pop(), t[i])) { return false; } } } if (st.isEmpty()) { return true; } else { return false; } } static boolean isMatching(char a, char b) { if (a == '(' &amp;&amp; b == ')') { return true; } else if (a == '{' &amp;&amp; b == '}') { return true; } else if (a == '[' &amp;&amp; b == ']') { return true; } else { return false; } } }
downvote count: 0
answers question: http://stackoverflow.com/q/23187539
type: Answer
upvote count: 1

http://stackoverflow.com/comment/35567034
type: Comment
has text: Yes it's working but I get NullPointer Exception now on: layout.addView(rowview); any ideea ? thanks
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23242735

http://stackoverflow.com/comment/35576923
score: 2
has text: @user2336315 Clearly it didn't matter. It was a comment. Not an answer.
comment on: http://stackoverflow.com/q/23250358
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35436103
has text: I have just posted my new answer.Just have a look of it.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23169927

http://stackoverflow.com/q/23176401
answer count: 0
has comment: http://stackoverflow.com/comment/35445452
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/35445427
has title: How to graph data using java?
score: 0
has comment: http://stackoverflow.com/comment/35445486
tagged with: readfile
has body: I have to Implement the readFile method to open the input file, read in the input variables (except for the title) in the order shown in the File Format section of this document, and close the file. program should read the number of data elements from the input file, then dynamically allocate all label and data arrays for all the charts. These sizes must also be used for the loops that read labels or data elements from the file.No other variables (except strings) should be initialized, and the arrays must be declared but not allocated It says there is an error for pieLabels[i] = input.next(); and I am not sure what the problem is. Am I doing the FOR loop wrong? or is it not supposed to be a FOR loop? this is the file i have to read from 5 8 6 Nokia 12.2 Apple 15.6 Google 23.7 Samsung 16.4 Motorola 32.1 74.0 35.0 63.0 43.6 47.7 27.0 13.3 41.0 55.0 44.7 34.0 48.1 62.0 32.4 34.5 45.0 35.0 5.0 17.0 25.0 32.7 12.4 32.3 41.0 20.6 1.0 13.9 17.5 26.5 11.2 3.9 14.9 33.0 41.4 The first entry in the data file is the number of data items in the pie chart, followed by the same number of labels and doubles (so 5). Next is the number of data items in the bar chart, followed by two series of data that each have the same number of doubles (so 8). Next is the number of data items in the line graph, followed by three series of data that each have the same number of doubles (so 6). static String pieTitle = "Pie Chart"; static int pieCount; static String[] pieLabels; static double[] pieData; // Bar chart data static String barTitle = "Bar Chart"; static int barCount; static double[] barData0; static double[] barData1; // Line graph data static String lineTitle = "Line Graph"; static int lineCount; static double[] lineData0; static double[] lineData1; static double[] lineData2; public static void main(String[] args) { // TODO Auto-generated method stub readFile(args[0]); displayCharts(); } private static void readFile(String inputFile) { try { // Open input stream Scanner input = new Sca…
tagged with: graphing
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35445336
has comment: http://stackoverflow.com/comment/35445343

http://stackoverflow.com/q/23210143
has title: How can Spring boot/Application.java pick up Mongo AbstractMongoConfiguration in another package?
accepted answer: http://stackoverflow.com/a/23215209
tagged with: spring
type: AnsweredQuestion
score: 2
upvote count: 2
tagged with: java
type: Question
tagged with: mongodb
tagged with: spring-boot
has answer: http://stackoverflow.com/a/23215209
has body: I want to keep my classes organized into packages. Using the following example: https://spring.io/guides/gs/accessing-data-mongodb/ I have Application.java in "my.main.package" I define my own implementation of AbstractMongoConfiguration below: import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.data.mongodb.config.AbstractMongoConfiguration; import com.mongodb.Mongo; import com.mongodb.MongoClient; @Configuration public class MyMongoConfig extends AbstractMongoConfiguration{ @Override @Bean public Mongo mongo() throws Exception { return new MongoClient("remotehost:27018"); } @Override protected String getDatabaseName() { return "mydb"; } } If I put the class within the same package as my Application.java, then it works. If I put MyMongoConfig in its own package i.e "my.config.package.settings", then running Application.java appears to use the default MongoDB connection settings without using "MyMongoConfig". Why is my application not automatically finding the "MyMongoConfig" when its in a different package? Is there a proper way or possibility to do this without shoving them both in the same package?
answer count: 1
downvote count: 0
favorite count: 0

http://stackoverflow.com/comment/35493681
has text: Using `double` will not really get you the right answer. The correct answer is an integer that takes 64 bits (which means `long` isn't good enough because of the sign bit). A `double` only gives you 52 bits of precision, which means that if you use a `double` to do the computation, then no matter how you convert the result to an integer or `BigInteger`, the low-order 12 bits of the answer will not necessarily be accurate.
score: 0
comment on: http://stackoverflow.com/q/23203309
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23210318
accepted answer of: http://stackoverflow.com/q/23205445
answers question: http://stackoverflow.com/q/23205445
type: AcceptedAnswer
downvote count: 0
has body: Append ;ifexists=true to the database URL. See also the documentation at Database URL Overview
upvote count: 8
type: Answer
score: 8
has comment: http://stackoverflow.com/comment/35523131

http://stackoverflow.com/q/23231733
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/23231922
favorite count: 0
has comment: http://stackoverflow.com/comment/35543690
has title: Adding an external .java file to eclipse build path
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35543677
score: 1
has body: I am taking a class in data structures, and they want us to use eclipse. Unfortunately, the intro programming class I took used jgrasp, so that's what I am used to. While I REALLY like the way that eclipse works, I can't seem to figure out how to download the support files for my assignments into my project so that they are usable. I have downloaded the support files, and put them into the same file as the class I am writing, but the downloaded files don't show up on eclipse, and when I try to implement the interfaces, they say that they don't exist. When I go through my computer, and look at the file with windows explorer, I can see all the files (both the ones that I downloaded and the ones that I wrote), but they don't show up in java, and when I try to use them, I get an error. I'm sure this is a really easy fix, but if ANYBODY could help me, I would be extremely grateful. I have tried changing the build path, but I don't really understnad how to do that. The files I am trying to add are simple. One is an interface and the other is a special exception class that my professor developed.
upvote count: 1
has comment: http://stackoverflow.com/comment/35543737
has comment: http://stackoverflow.com/comment/35543817
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/35543981
linked to: http://stackoverflow.com/q/3280353
tagged with: eclipse
has comment: http://stackoverflow.com/comment/35543803

http://stackoverflow.com/q/23182866
upvote count: 2
type: UnansweredQuestion
score: 1
tagged with: java
downvote count: 1
tagged with: face-recognition
type: Question
tagged with: image-recognition
answer count: 1
has body: Can someone please explain to me what training set in context of face recognition means? I have been reading journals and I often see pages like In the experiments, five samples of each person chose randomly are used to form the training set, and the remaining samples are used for testing. Thanks
tagged with: training-data
favorite count: 0
has title: Training Set for Face Recognition
has comment: http://stackoverflow.com/comment/35455996
has answer: http://stackoverflow.com/a/23182962
has comment: http://stackoverflow.com/comment/35455874

http://stackoverflow.com/comment/35551314
type: Comment
comment on: http://stackoverflow.com/a/23235755
type: AnswerComment
has text: @CodeCamper Yes but the other 25k ports you were not able to bind to are still available for use (or are already in use), and this also does not relate to non-UDP traffic. Your goal of having "[no] network traffic but through [your] application" is simply not possible. And no there is no way to speed up what you are doing. Why do you want to do this, anyways?
score: 0

http://stackoverflow.com/comment/35387261
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23137481
type: Comment
has text: hey, would it be possible to find the average of the listed definitives? i think i would have needed to use ArrayList to get this program running better.

http://stackoverflow.com/q/23278448
has body: I am creating a BufferedImage from a JPanel without rendering it to a JFrame with the following function: public BufferedImage getScreenShot(JComponent c){ BufferedImage i = new BufferedImage(c.getWidth(), c.getHeight(), BufferedImage.TYPE_INT_RGB); c.paint(i.getGraphics()); return i; } Then I place the BufferedImage into a PowerPoint presentation using Apache POI. I have used this code without problems for years, but I recently upgraded to Windows 7 and Java 1.7. (These are the most recent versions I'm allowed to use due to outdated contract requirements.) Since the upgrade, many of my users randomly get a NullPointerException at javax.swing.RepaintManager.getVolatileOffscreenBuffer(Unknown Source) that traces back to line 2 of the function above (c.paint(...). This only happens in about 1 run out of 50, so it is impossible to debug. I've looked everywhere I can think of for help but have come up empty handed. Can anyone help? Thanks
has comment: http://stackoverflow.com/comment/35629499
answer count: 0
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/35629128
favorite count: 0
linked to: http://stackoverflow.com/q/10138741
type: Question
has title: What is causing the getVolitaleOffscreenBuffer NullPointerException?
has comment: http://stackoverflow.com/comment/35630132
has comment: http://stackoverflow.com/comment/35661882
tagged with: java
upvote count: 1
tagged with: swing
tagged with: bufferedimage
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35629039

http://stackoverflow.com/q/23180453
type: Question
has body: I'm trying to write a java mobile application (J2ME) and I got stuck with a problem: in my project there are moving circles called shots, and non moving circles called orbs. When a shot hits an orb, it should bounce off by classical physical laws. However I couldn't find any algorithm of this sort. The movement of a shot is described by velocity on axis x and y (pixels/update). all the information about the circles is known: their location, radius and the speed (on axis x and y) of the shot. Note: the orb does not start moving after the collision, it stays at its place. The collision is an elastic collision between the two while the orb remains static here is the collision solution method in class Shot: public void collision(Orb o) { //the orb's center point Point oc=new Point(o.getTopLeft().x+o.getWidth()/2,o.getTopLeft().y+o.getWidth()/2); //the shot's center point Point sc=new Point(topLeft.x+width/2,topLeft.y+width/2); //variables vx and vy are the shot's velocity on axis x and y if(oc.x==sc.x) { vy=-vy; return ; } if(oc.y==sc.y) { vx=-vx; return ; } // o.getWidth() returns the orb's width, width is the shot's width double angle=0; //here should be some sort of calculation of the shot's angle setAngle(angle); } public void setAngle(double angle) { double v=Math.sqrt(vx*vx+vy*vy); vx=Math.cos(Math.toRadians(angle))*v; vy=-Math.sin(Math.toRadians(angle))*v; } thanks in advance for all helpers
has title: JAVA elastic collision of moving and non moving circles
answer count: 2
linked to: http://stackoverflow.com/q/22919567
has comment: http://stackoverflow.com/comment/35453754
tagged with: math
has comment: http://stackoverflow.com/comment/35473124
has comment: http://stackoverflow.com/comment/35452381
has comment: http://stackoverflow.com/comment/35453665
has comment: http://stackoverflow.com/comment/35453159
downvote count: 0
has comment: http://stackoverflow.com/comment/35484093
has answer: http://stackoverflow.com/a/23193044
has comment: http://stackoverflow.com/comment/35454815
favorite count: 0
tagged with: geometry
has comment: http://stackoverflow.com/comment/35453895
tagged with: physics
has answer: http://stackoverflow.com/a/35862798
tagged with: collision
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/35862798
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/23193044
upvote count: 1

http://stackoverflow.com/q/23272587
possible better answer: http://stackoverflow.com/a/23272870
upvote count: 1
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35617813
score: 1
has answer: http://stackoverflow.com/a/23272703
tagged with: java
accepted answer: http://stackoverflow.com/a/23272703
has answer: http://stackoverflow.com/a/23272870
type: Question
has comment: http://stackoverflow.com/comment/35617495
has title: issue with setting a private variable assigned in another class
has comment: http://stackoverflow.com/comment/35617501
answer count: 2
has body: heres the code block for my armors and weapons setting, but eclipse tells me that when I add to the variables for strength and hitpoints that it there is no variable assigned for it. I assume this is because its a private variable in my player class, so do I make those variables public instead of private? public void setArm(){ switch (threeSidedDie.getValue()){ case 1: Armors = "helmet"; hitP += 1; break; case 2: Armors = "gloves"; hitP += 2; break; case 3: Armors = "chest armor"; hitP += 3; break; } }
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/35617549

http://stackoverflow.com/comment/35630001
type: Comment
comment on: http://stackoverflow.com/a/23278768
score: 1
has text: @user2250333 I hope you got it now.
type: AnswerComment

http://stackoverflow.com/comment/35604532
comment on: http://stackoverflow.com/q/23265157
has text: Take a look at this tutorial to analyze memory leaks using visualvm http://rejeev.blogspot.in/2009/04/analyzing-memory-leak-in-java.html
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35384772
type: AnswerComment
score: 0
has text: Thank you so much! I didn't even notice I had used integer for that. All of the problems with the program have been solved. Again, thank you!
type: Comment
comment on: http://stackoverflow.com/a/23141947

http://stackoverflow.com/a/23193592
accepted answer of: http://stackoverflow.com/q/23192454
type: Answer
score: 0
has comment: http://stackoverflow.com/comment/35475432
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23192454
has body: Use this method pass string as parameter it will return MD5 as return string. Store that string in database. public static String getMD5(String data) throws NoSuchAlgorithmException { MessageDigest messageDigest=MessageDigest.getInstance("MD5"); messageDigest.update(data.getBytes()); byte[] digest=messageDigest.digest(); StringBuffer sb = new StringBuffer(); for (byte b : digest) { sb.append(Integer.toHexString((int) (b &amp; 0xff))); } return sb.toString(); }
has comment: http://stackoverflow.com/comment/35475418

http://stackoverflow.com/a/23196745
has body: You should be able to use the URLDecoder.decode() function, like this: String s = URLDecoder.decode(myString, "UTF-8"); more info string encoding easily
answers question: http://stackoverflow.com/q/23196220
type: Answer
has comment: http://stackoverflow.com/comment/35482922
score: 0

http://stackoverflow.com/comment/35585604
type: QuestionComment
score: 1
has text: in your code snippet you don't actually seem to be using httpContext on anything...? how do you take it into use?
comment on: http://stackoverflow.com/q/23251941
type: Comment

http://stackoverflow.com/a/23250478
has body: You can not access a variable non static from a static method... Solutions: Make editText static Its not Logical that one static method access a variable non static, so you should change the logic there! Greetings :)...
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23250334

http://stackoverflow.com/q/23199840
has answer: http://stackoverflow.com/a/23200106
type: UnansweredQuestion
tagged with: swing
tagged with: jfilechooser
tagged with: java
type: Question
score: 0
answer count: 1
has body: I'm working with a program that opens a jDialog from jMenu, I need to evaluate the option that the users choose (Open, Cancel or Exit) in order to proceed in different ways. int result;// result = jFileChooser1.showOpenDialog(this); if (result == JFileChooser.APPROVE_OPTION) { System.out.println(jFileChooser1.getSelectedFile().getName()); System.out.println(jFileChooser1.getSelectedFile().getAbsolutePath()); ... } else if (result == JFileChooser.CANCEL_OPTION) { ... } The problem is that everytime I need to evaluate result, showOpenDialog() opens again the dialog. Is there any other way to get options without oppening dialog?
has title: Evaluating jFileChooser options

http://stackoverflow.com/comment/35490053
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/23201861
has text: I tried with thread and async task still same error ase shown in update persists .... Am i missing something else here ?
score: 0

http://stackoverflow.com/q/23207700
score: 0
upvote count: 1
has body: I have been trying to do a question as follows: The program should keep prompting the user to enter a letter until the user types ‘!’, which ends the program. Each time the use enters a letter, the program should add the letter to the previous letters entered and print the result. The program should also return: the last entered letter when ‘@’ is entered. the total number of letters entered when ‘#’ is entered. I am stuck on how to return the last entered letter and returning number of letters entered. I thought about if statements but they don't seem to be working. Here is my code so far: import java.util.Scanner; import java.util.ArrayList; public class check { static Scanner input = new Scanner (System.in); static ArrayList<String> array= new ArrayList<>(); public static void main(String[] args) { System.out.print("Please enter a letter: "); String a=input.nextLine(); while ( !a.equals("!")) { array.add(a); for(String b : array) { System.out.print(b); } System.out.print("\n"+"Please enter a letter: "); a=input.nextLine(); } // array.add(a); if((a.equals("#"))) { ArrayList.get(ArrayList.size()-1); for(String b : array) { System.out.print(b); } } I know the if statement I have done is incorrect because it's giving red line under. But don't know how and what to do next.
has title: How to return last letter in ArrayList and return total number of letters entered?
answer count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/35500884
tagged with: if-statement
tagged with: java
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35500896
favorite count: 0
has comment: http://stackoverflow.com/comment/35500881
tagged with: arraylist
type: Question
has comment: http://stackoverflow.com/comment/35500939
has answer: http://stackoverflow.com/a/23207937

http://stackoverflow.com/q/23162219
has comment: http://stackoverflow.com/comment/35420958
type: Question
has title: Dijksta's Algorithm Java - How to find vertex with shortest distance value from ArrayList of Objects
linked to: http://stackoverflow.com/q/6267172
tagged with: arraylist
score: 0
has comment: http://stackoverflow.com/comment/35422205
linked to: http://stackoverflow.com/q/1871253
has comment: http://stackoverflow.com/comment/35420536
has comment: http://stackoverflow.com/comment/35420513
answer count: 0
type: UnansweredQuestion
has body: I am attempting to implement Dijkstra's Algorithm with Java. I am doing so using an ArrayList, and I know that there are other data structures that might be better suited to this task. However, I want to get comfortable with ArrayLists, so that's what I'll be using. I have an ArrayList of Objects. These objects contain several values, one of which is the distance from the source node. How can I select the node that has the smallest distance value? I want to then set the name of the vertex that had the smallest distance value to the String "smallest". Here is what I have so far. import java.io.File; import java.io.FileNotFoundException; import java.util.Scanner; import java.util.ArrayList; public class Graph { ArrayList&lt;Vertex&gt; vertexObjects = new ArrayList&lt;Vertex&gt;(); ArrayList&lt;Edge&gt; edgeObjects = new ArrayList&lt;Edge&gt;(); ArrayList&lt;Vertex&gt; visitedObjects = new ArrayList&lt;Vertex&gt;(); ArrayList&lt;Vertex&gt; unvisitedObjects = new ArrayList&lt;Vertex&gt;(); int numVertices = 0; public void readFile() { try { Scanner s = new Scanner(new File("graph.txt")); String sameVertex = ""; while (s.hasNext()) { String preVertex = s.next(); String postVertex = s.next(); String distance = s.next(); Edge temp = new Edge(preVertex, postVertex, distance); edgeObjects.add(temp); if (!(preVertex.equals(sameVertex))) { Vertex herp = new Vertex(preVertex, Double.POSITIVE_INFINITY, false, null); vertexObjects.add(herp); sameVertex = preVertex; numVertices++; } } } catch (FileNotFoundException e) { System.out.println("I can't find that file!"); } } public void Dijkstra(String startVertex, String endVertex) { // Change the distance of the startVertex to 0 and all others to infinity. for (int i = (numVertices-1); i &gt;= 0; i--) { if (vertexObjects.get(i).vertexName.equals(startVertex)) { vertexObjects.get(i).distance = 0; } else { vertexObjects.get(i).distance = Double.POSITIVE_INFINITY; } unvisitedObjects.add(vertexObjects.get(i)); } String currentVertex = st…
has comment: http://stackoverflow.com/comment/35420574
tagged with: dijkstra
tagged with: java

http://stackoverflow.com/q/23223411
has title: Receiving data at regular intervals (MODBUS TCP JAVA)
has answer: http://stackoverflow.com/a/23246689
accepted answer: http://stackoverflow.com/a/23246689
upvote count: 2
downvote count: 0
answer count: 1
favorite count: 0
tagged with: modbus
score: 2
type: AnsweredQuestion
has body: I'm currently working on a Modbus TCP JAVA project using the jamod library. So far, I'm able to read &amp; write to the Modbus network (gateway &amp; some sensors from 4-noks) without any issues. My next step is to receive the data of the sensors automatically. The devices I'm using are sending their registers to the Modbus-Gateway at regular intervals (about 20-60seconds). Unfortunately, I'm having some problems in receiving these data. The Gateway has a register in which it's counting the received messages and it does receive data of the sensors, but how can I display these data onto my PC using java (jamod, or maybe another library)? I have been searching and trying for the last week and I'm out of ideas. Would be very nice to get some information on how this goal can be achieved!
tagged with: tcp
tagged with: java
type: Question

http://stackoverflow.com/a/23238815
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/35556325
has comment: http://stackoverflow.com/comment/35878239
has comment: http://stackoverflow.com/comment/36034959
upvote count: 2
has comment: http://stackoverflow.com/comment/35834528
has body: I've opened a bug to Java for this (Review ID: JI-9011898). The issue is that in the org.omg.CORBA.ORB.init() method the system class loader is forced to use, while in the past the current thread's class loader was used. UPDATE: a valid workaround is copying the JacORB jars inside the /jre/lib/endorsed folder, so these classes can be loaded outside the webstart class loader. See Java WebStart and endorsed directories and Java 7u55 Eclipse System Fragment Classloader for details.
has comment: http://stackoverflow.com/comment/36244056
answers question: http://stackoverflow.com/q/23217131
type: Answer

http://stackoverflow.com/comment/35652389
score: 1
comment on: http://stackoverflow.com/a/23291089
type: AnswerComment
type: Comment
has text: The question is: "where I store this configuration? In a .properties file? In the database?"

http://stackoverflow.com/a/23155134
type: Answer
accepted answer of: http://stackoverflow.com/q/23154615
upvote count: 3
answers question: http://stackoverflow.com/q/23154615
score: 3
has body: If you follow the Maven conventions (having both the src and test folders) you will have an easier time. Your tests will not be deployed along with your compiled source so I wouldn't worry about bloat. Maven will compile both a jar and a test jar file (assuming you're using jars). If you really want separate src/test modules then yes, the multi-module approach with a common parent is the way to go. The test module would have a dependency on the source module but not the other way around. Really this just amounts to reinventing what Maven is already doing for you though. In the long run, I think you'd be happier using the conventional approach though as things will go a lot smoother.
has comment: http://stackoverflow.com/comment/35419797
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/35612274
score: 0
type: AnswerComment
has text: I'm using "Logger.getLogger()" to get the logger. I'd rather not use Strings. As @JensSchauder mentions - you're likely to get clashes. Automatic refactoring of packages etc. would also not rename these strings for me.
type: Comment
comment on: http://stackoverflow.com/a/23266303

http://stackoverflow.com/a/23217849
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35518243
type: Answer
has comment: http://stackoverflow.com/comment/35518618
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/23217670
answers question: http://stackoverflow.com/q/23217670
has body: With the information provided, this is going to be a custom job. For example if I was just given the 7 blocks that you mention I could end up with (2,3,2) like you did or (2,2,3) or (3,2,2) or (4,2,1), etc. To put together a mathematically well formed solution you are going to have to constrain it more. e.g. no more than x rows, rows are added in the following order, new rows can / cannot be inserted between existing rows etc. writing that kind of algorithm from scratch is doable, but you need to constrain the possibilities more to have it work as you described.
upvote count: 1

http://stackoverflow.com/comment/35490204
comment on: http://stackoverflow.com/a/23200056
has text: busy loop doesen't fit:( But thanx for reply.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/35524970
has text: It's there all the time.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23209656
score: 0

http://stackoverflow.com/q/23272650
has comment: http://stackoverflow.com/comment/35618799
favorite count: 0
answer count: 0
upvote count: 2
tagged with: documentum6.5
type: UnansweredQuestion
tagged with: maven
score: 2
tagged with: java
has title: Error compiling JSP using jspc-maven-plugin:2.0-alpha-3; class cannot be resolved to a type
has comment: http://stackoverflow.com/comment/35618013
type: Question
downvote count: 0
tagged with: jsp
has body: I am encountering an issue with the jspc-maven-plugin version 2-0 alpha 3 during JSP compilation. Most my JSPs compile just fine, but there are some which depend upon classes contained within a JAR dependency (dam_classes) which I have listed in my POM: &lt;plugin&gt; &lt;groupId&gt;org.codehaus.mojo.jspc&lt;/groupId&gt; &lt;artifactId&gt;jspc-maven-plugin&lt;/artifactId&gt; &lt;version&gt;2.0-alpha-3&lt;/version&gt; &lt;executions&gt; &lt;execution&gt; &lt;goals&gt; &lt;goal&gt;compile&lt;/goal&gt; &lt;/goals&gt; &lt;phase&gt;prepare-package&lt;/phase&gt; &lt;configuration&gt; &lt;sources&gt; &lt;directory&gt;${basedir}/target/${project.build.finalName}&lt;/directory&gt; &lt;includes&gt; &lt;include&gt;**/*.jsp&lt;/include&gt; &lt;/includes&gt; &lt;/sources&gt; &lt;verbose&gt;1&lt;/verbose&gt; &lt;inputWebXml&gt;${basedir}/target/${project.build.finalName}/WEB-INF/web.xml&lt;/inputWebXml&gt; &lt;/configuration&gt; &lt;/execution&gt; &lt;/executions&gt; &lt;dependencies&gt; &lt;dependency&gt; &lt;groupId&gt;com.fmr.AP100141.com.documentum&lt;/groupId&gt; &lt;artifactId&gt;dam_classes&lt;/artifactId&gt; &lt;version&gt;6.7.2000.0038&lt;/version&gt; &lt;/dependency&gt; &lt;dependency&gt; &lt;groupId&gt;org.codehaus.mojo.jspc&lt;/groupId&gt; &lt;artifactId&gt;jspc-compiler-tomcat6&lt;/artifactId&gt; &lt;version&gt;2.0-alpha-3&lt;/version&gt; &lt;/dependency&gt; &lt;dependency&gt; &lt;groupId&gt;javax.servlet&lt;/groupId&gt; &lt;artifactId&gt;servlet-api&lt;/artifactId&gt; &lt;version&gt;2.5&lt;/version&gt; &lt;/dependency&gt; &lt;/dependencies&gt; &lt;/plugin&gt; When I run mvn -X package and examine the debug output, I see the following message: [ERROR] An error occurred at line: 31 in the jsp file: /custom/dam/environment/preferences/general/app_general_preferences.jsp [ERROR] com.documentum.web.form.control cannot be resolved to a type [ERROR] 28: &lt;dmf:label nlsid="MSG_START_SECTION_HEADER"/&gt;&lt;/td&gt; [ERROR] 29: &lt;td class="defaultcolumnspacer leftAlignmen…

http://stackoverflow.com/q/23287054
type: Question
score: 3
tagged with: ejb
possible better answer: http://stackoverflow.com/a/23287359
has body: The EJB 3.2 spec says the following: By default, clients are allowed to make concurrent calls to a stateful session object and the container is required to serialize such concurrent requests. Note that the container never permits multi-threaded access to the actual stateful session bean instance. To me concurrent access and multi-threaded access seem equivalent. So how is it possible to make concurrent calls to a stateful EJB while multiple threads are prohibited?
has answer: http://stackoverflow.com/a/23287359
tagged with: concurrency
upvote count: 3
answer count: 2
tagged with: stateful-session-bean
favorite count: 0
has title: Stateful session bean multi-threaded access
has answer: http://stackoverflow.com/a/23287332
accepted answer: http://stackoverflow.com/a/23287332
type: AnsweredQuestion
downvote count: 0
tagged with: java
tagged with: multithreading

http://stackoverflow.com/q/23205265
upvote count: 1
has title: How to lock an instance when a method is being executed
downvote count: 1
has comment: http://stackoverflow.com/comment/35496381
has answer: http://stackoverflow.com/a/23475524
tagged with: java
tagged with: thread-safety
has body: I don't know if this question is redundant or not but I could find the answer after looking for 2 hours... I'm trying to make a program that uses multiple threads and a shared instance of a class. When a certain method on this instance is being called, let's call it "reconnect", other method calls should wait until "reconnect" is finished executing. How do I achieve this? Is it just: synchronized (this) { //////// } or: public ReentrantLock lock = new ReentrantLock(); public void reconnect() { lock.lock(); //// lock.unlock(); } Sorry if this was already asked. Thanks for reading. Addition 1: This was mentioned in the comments, when a method, other than "reconnect" is being executed, and "reconnect" is called, "reconnect" should wait until every other method is done executing.
type: Question
has comment: http://stackoverflow.com/comment/35496446
answer count: 2
tagged with: locking
has comment: http://stackoverflow.com/comment/35496509
has comment: http://stackoverflow.com/comment/35495963
favorite count: 0
score: 0
has comment: http://stackoverflow.com/comment/35496264
has comment: http://stackoverflow.com/comment/35496271
has answer: http://stackoverflow.com/a/23205423
has comment: http://stackoverflow.com/comment/35496211
type: UnansweredQuestion
tagged with: multithreading

http://stackoverflow.com/comment/60376858
has text: You should use AudioClip class only for playing short audio files. It stores y the raw, uncompressed audio data for the entire sound, which can be quite large for long audio clips. For more info: https://docs.oracle.com/javafx/2/api/javafx/scene/media/AudioClip.html
comment on: http://stackoverflow.com/a/36139922
type: Comment
score: 1
type: AnswerComment

http://stackoverflow.com/q/23192653
score: 1
tagged with: java
type: Question
tagged with: spring-amqp
downvote count: 0
answer count: 1
tagged with: spring-batch
has body: I am using spring batch and spring amqp. I am producing messages in my spring batch ItemWriter using public class ImportItemWriter&lt;T&gt; implements ItemWriter&lt;T&gt; { private AmqpTemplate template; public AmqpTemplate getTemplate() { return template; } public void setTemplate(AmqpTemplate template) { this.template = template; } public void write(List&lt;? extends T&gt; items) throws Exception { for (T item : items) { template.convertSendAndReceive(item.toString()); } } } and at consumer side, I am using POJO to handle messages using MessageListenerAdapter. public class ImportMessageListener{ @Override public String handle(String exchange) throws Exception { throw new Exception("Command Failed."); } } I want template.convertSendAndReceive(item.toString()); to throw the same exception thrown by message handler so that spring batch can stop the batch , mark it as failed and log the exception? I had look at this but couldn't get how to achieve above use case ? http://docs.spring.io/spring-amqp/docs/1.3.1.RELEASE/reference/html/amqp.html How do I do this ?
linked to: http://stackoverflow.com/q/23240863
has answer: http://stackoverflow.com/a/23198111
has title: Throw Exception if template.convertSendAndReceive consumer message handler throws exception?
favorite count: 0
upvote count: 1
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23198111

http://stackoverflow.com/q/23135412
has comment: http://stackoverflow.com/comment/35372964
downvote count: 0
has comment: http://stackoverflow.com/comment/35372383
has comment: http://stackoverflow.com/comment/35372212
has answer: http://stackoverflow.com/a/23135899
accepted answer: http://stackoverflow.com/a/23135916
score: 3
has comment: http://stackoverflow.com/comment/35372826
has comment: http://stackoverflow.com/comment/35372994
answer count: 4
favorite count: 0
has comment: http://stackoverflow.com/comment/35373761
possible better answer: http://stackoverflow.com/a/23135899
upvote count: 3
has answer: http://stackoverflow.com/a/23136228
tagged with: multithreading
has body: I am new to multi threading and while practising I wrote the following code. I want to call the createThred method to create a new thread evrytime I call it. However, With the below given code, everytime the createThread method is called, i get the same thread running again and again. Is it possible to create a new thread using the same object? Appararently not but just wanted to confirm if there is a way I dont know of. public class ThreadStartRunnable implements Runnable { private Thread t; /* ThreadStartRunnable(String name) { t = new Thread(this, name); t.start(); } */ private Thread createThread(String name){ t = new Thread(this,name); t.start(); return t; } /** * @Override run * */ public void run() { for(int i=0;i&lt;=5;i++) { try { Thread.sleep(500); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } System.out.println("The current Thread is " + t.getName() + " and thread ID is " + t.getId()); } } /** * @param args * @throws InterruptedException */ public static void main(String[] args) { // TODO Auto-generated method stub Thread t = Thread.currentThread(); //new ThreadStartRunnable("User 1"); //new ThreadStartRunnable("User 2"); //ThreadStartRunnable c = new ThreadStartRunnable(); ThreadStartRunnable t1 = new ThreadStartRunnable(); t1.createThread("Child 1"); t1.createThread("Child 2"); for(int i=0;i&lt;=5;i++) { try { Thread.sleep(1000); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } System.out.println("The cirrent Thread is " + t.getName()+ " and thread ID is " + t.getId()); } } } OUTPUT: The current Thread is Child 2 and thread ID is 9 The current Thread is Child 2 and thread ID is 9 The cirrent Thread is main and thread ID is 1 The current Thread is Child 2 and thread ID is 9 The current Thread is Child 2 and thread ID is 9 The current Thread is Child 2 and thread ID is 9 The current Thread is Child 2 and thread ID is 9 The current Thread is Child 2 and thread ID is …
has title: Can one object create multiple threads in Java
linked to: http://stackoverflow.com/q/9562505
has answer: http://stackoverflow.com/a/23135793
type: Question
has comment: http://stackoverflow.com/comment/35372440
has comment: http://stackoverflow.com/comment/35372550
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/23135916
has comment: http://stackoverflow.com/comment/35375450
tagged with: concurrency
has comment: http://stackoverflow.com/comment/35372308
has comment: http://stackoverflow.com/comment/35372680

http://stackoverflow.com/comment/35446049
score: 0
has text: :( I really don't understand. What am I doing wrong?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23176863

http://stackoverflow.com/comment/35416130
has text: thank you so much I was on this simple idea but somehow was stuck with simple flaws that take up much time for no reason I really appreciate it.
type: AnswerComment
comment on: http://stackoverflow.com/a/23159989
score: 0
type: Comment

http://stackoverflow.com/q/23142291
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23142330
has comment: http://stackoverflow.com/comment/35385271
tagged with: java
has body: Any shortcut to create a Java array of the first n integers without doing an explicit loop? In R, it would be intArray = c(1:n) (and the resulting vector would be 1,2,...,n).
type: Question
upvote count: 4
has comment: http://stackoverflow.com/comment/35385279
tagged with: arrays
downvote count: 0
answer count: 1
score: 4
linked to: http://stackoverflow.com/q/3790142
favorite count: 0
has comment: http://stackoverflow.com/comment/35385235
has title: Java: Array of first n integers

http://stackoverflow.com/comment/35500099
type: Comment
comment on: http://stackoverflow.com/a/23207302
type: AnswerComment
has text: I see some 1:n instead of 1:1 relations here (e.g. Country has multiple States)
score: 0

http://stackoverflow.com/a/30314756
score: 4
has body: One can simply navigate a browser to the following URL to get the indexes available on an ElasticSearch cluster. http://elasticsearch.company.com/_aliases This will return an array of indexes and their aliases in JSON. Here's an example: { "compute-devzone1": { }, "compute-den2": { }, "compute-den1": { }, ... } To get the list of indexes with Jest, use this code... HttpClientConfig config; JestClientFactory factory; JestClient client; GetAliases aliases; JestResult result; String json; config = new HttpClientConfig. Builder("http://elasticsearch.company.com"). build(); aliases = new GetAliases. Builder(). build(); factory = new JestClientFactory(); factory.setHttpClientConfig(config); client = factory.getObject(); result = client.execute(aliases); json = result.getJsonString(); Use your favorite JSON processor to extract the indexes from json.
type: Answer
upvote count: 4
downvote count: 0
answers question: http://stackoverflow.com/q/23223714

http://stackoverflow.com/comment/35644318
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23286591
type: Comment
has text: Hey, if my question solved your probably con side clicking the checkmark under the arrows. It's gives us both some rep. And if it helped you or solved your problem, consider up voting it.

http://stackoverflow.com/a/23270047
score: 1
downvote count: 0
has body: Store that number in class variable and show that variable value in TextView private int count = 0; //when needed update count count++; //show value in TextView private void showValue() { textView.setText(String.valueOf(count)); }
type: Answer
answers question: http://stackoverflow.com/q/23269821
upvote count: 1

http://stackoverflow.com/a/23235137
accepted answer of: http://stackoverflow.com/q/23223003
type: Answer
score: 6
has body: Here are a few of your answers: First, let me give you a quick overview of how the interaction between a CAS client and a CAS server normally works: (I am not familiar with the Shibboleth portion, so I am omitting that.) User hits the application webpage. application redirects user to CAS. CAS, using standard cookies and sessions, determines if user is already logged in. if User is not logged in, CAS displays a login form for the user to provide login credentials. IF the user is already logged in, CAS skips to step #7. CAS then interacts with the AD to verify that the provided credentials are valid. if they are, then CAS logs in the user. then CAS will redirect back to the application, providing a ticket. The application makes a direct call to CAS to validate the provided ticket. If the ticket is valid, then CAS returns user information as a response to the request. The application then creates an authenticated session for the user, potentially looking up user information based on the info provided by CAS, and redirects them wherever is appropriate. Now for your questions: CAS and AD : CAS will actually login to AD and use the user provided credentials to find and authenticate the user. If you are using a forest, make sure you use the correct port to log into the Global Catalog, as that is easy to miss. The contents of the token are not significant, as the standard CAS protocol will send the token back to CAS and retrieve user details in the response. As a developer, this is actually very little you can do with the token, as it is tied to the application and can only be used once, and, for security reasons, has to be used within a very short amount of time (ie, sent back to CAS to be validated) or it will expire. If you are doing primarily CAS and you have the ability to do your own CAS clients in your applications, CAS can be a very nice solution. Unfortunately, CAS does not have full SAML2 support, using it's own protocol instead, though CAS's protocol is very sim…
downvote count: 0
upvote count: 6
answers question: http://stackoverflow.com/q/23223003
type: AcceptedAnswer

http://stackoverflow.com/comment/35466899
has text: Don't delete posts after they are answered, this is against the idea of Stack Overflow - maybe somebody having same problem as you can come here and find a solution.
comment on: http://stackoverflow.com/q/23165449
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35541644
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/23230604
has text: Are you using your random numbers for security purposes?

http://stackoverflow.com/a/23164356
accepted answer of: http://stackoverflow.com/q/23152312
score: 0
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/23152312
has body: KEYIN,VALUEIN for the mapper and KEYOUT,VALUEOUT for the reducer depend on your input/output formats respectively. The map output k/v pair must match the input for the reducer. For a text file you probably want the TextInputFormat. The key is the byte offset of the file and the value is the line. From there you can parse out any data you want like a normal string. LongWritable vs IntWritable is just like choosing an int vs a long. It all depends on your data. Whether the bulk of the work should be done in the mapper or reducer is up for debate. You generally use more mappers than reducers so you can leverage more parallelism. You also reduce the amount of data that needs to be shuffled &amp; sorted before reducing. However reducers have all values collocated based on key so the processing may make sense there too. Personally I try to minimize the data as much as I can as early as I can. Mapreduce is most efficient when everything can fit in memory.

http://stackoverflow.com/q/23141323
possible better answer: http://stackoverflow.com/a/23141430
has body: When I execute the below code it works without any problem. List&lt;String&gt; singletonList = Collections.singletonList("Hello"); List&lt;String&gt; s = Collections.emptyList(); singletonList.addAll(s); However, when I try to do following it gives me compile error. Why? List&lt;String&gt; singletonList = Collections.singletonList("Hello"); singletonList.addAll(List&lt;String&gt; Collections.emptyList()); Collections.emptyList is a type-safe way of creating an empty list. But why doesn't my program compile then? I know I cannot add to immutable list (UnsupportedOperationException) but adding an empty list is allowed. Actually I was testing this and I noticed above thing.
has answer: http://stackoverflow.com/a/23141375
accepted answer: http://stackoverflow.com/a/23141375
answer count: 2
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/23141430
has comment: http://stackoverflow.com/comment/35383645
has comment: http://stackoverflow.com/comment/35384424
type: AnsweredQuestion
score: 2
has title: adding to an empty list
upvote count: 2
tagged with: java
tagged with: collections
type: Question

http://stackoverflow.com/comment/35388994
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23143931
has text: It seems to me that a broadcast receiver would need to filter out irrelevant declarations (correct me if I'm wrong); a `Printer` class doesn't need to know that you have a wireless connection, or that you just got a phone call. An observer pattern solves this problem by being 'opt-in'; a class only subscribes to information it needs to know. EDIT: As @EricWoodruff says, Broadcast receivers appear to have the advantage of being ways to transmit data between running applications.
score: 0

http://stackoverflow.com/q/23166916
has comment: http://stackoverflow.com/comment/35475562
answer count: 0
upvote count: 2
score: 1
tagged with: wordnet
downvote count: 1
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/36694828
favorite count: 0
has title: Rita word net does not consider space in a word
type: UnansweredQuestion
has body: I downloaded Rita word net jar file and i use it in java. but i have a problem. for example when the string is "absolute coding" and part of speech is "noun", it ignores the second word which is "coding" and returns antonyms or synonyms of "absolute". why Rita word net ignores the second word(after space)? thanks in advance
has comment: http://stackoverflow.com/comment/35450394

http://stackoverflow.com/q/23285290
has comment: http://stackoverflow.com/comment/35641835
has answer: http://stackoverflow.com/a/54591335
has comment: http://stackoverflow.com/comment/35641882
has answer: http://stackoverflow.com/a/63869851
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/56619235
has comment: http://stackoverflow.com/comment/35641919
has answer: http://stackoverflow.com/a/23285309
downvote count: 1
has comment: http://stackoverflow.com/comment/35641870
type: Question
has answer: http://stackoverflow.com/a/36346663
has answer: http://stackoverflow.com/a/53548850
has answer: http://stackoverflow.com/a/43011952
possible better answer: http://stackoverflow.com/a/23285309
has comment: http://stackoverflow.com/comment/35641830
tagged with: java
has answer: http://stackoverflow.com/a/23285308
upvote count: 10
answer count: 11
has comment: http://stackoverflow.com/comment/35641848
has title: "Hello, world!" - Could not find or load main class
score: 9
accepted answer: http://stackoverflow.com/a/23285312
has answer: http://stackoverflow.com/a/49621940
has answer: http://stackoverflow.com/a/63235882
favorite count: 0
has body: Computer OS: Windows 7 Language: Java After long time back I am using java, I am getting problem while running the hello world program: public class Hello { public static void main (String args[]) { System.out.println ("Hello World!"); } } I saved this code in Hello.java File, and then compiled using cmd: C:\Users\XYZ\Desktop&gt;javac -version javac 1.6.0 C:\Users\XYZ\Desktop&gt;javac Hello.java C:\Users\XYZ\Desktop&gt;java Hello Error: Could not find or load main class Hello C:\Users\XYZ\Desktop&gt; Can you explain why the error message above was thrown?
has comment: http://stackoverflow.com/comment/35641832
has answer: http://stackoverflow.com/a/23285312
has comment: http://stackoverflow.com/comment/35641878

http://stackoverflow.com/q/23236176
has answer: http://stackoverflow.com/a/23236277
tagged with: log4j
has title: How to know in log4j , that ERROR level is triggered?
type: UnansweredQuestion
upvote count: 1
downvote count: 1
type: Question
tagged with: java
has body: How to know in log4j , that ERROR level is triggered. In my code I have written like If an exception occurs i.e if an ERROR level is triggered then I will show log file path in console and wont show any message for other levels.
answer count: 2
has comment: http://stackoverflow.com/comment/35551413
favorite count: 0
score: 0
has answer: http://stackoverflow.com/a/23236267

http://stackoverflow.com/comment/35645896
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23262698
type: Comment
has text: if you do System.out.println(favourites). whats in the list? 2 elements or 4?

http://stackoverflow.com/a/23217486
answers question: http://stackoverflow.com/q/23217359
score: 0
type: Answer
has body: For a login you can use a service all form most facing web portal, and once authentication is successfully done than you can transfer on a spring login authenticated page and its pass access for user as well

http://stackoverflow.com/comment/35571591
has text: So to clarify, if I am open an application to physically writing code for an iPhone, I am using a tool or product. I will code in a framework (not sure what that is for iPhone) and the platform would be iOS (same for iPad and iPhone), correct?
comment on: http://stackoverflow.com/a/23247185
score: 0
type: AnswerComment
type: Comment

dialog
tag name: dialog
tags question: http://stackoverflow.com/q/23219563
tags question: http://stackoverflow.com/q/23284221
type: Tag
tags question: http://stackoverflow.com/q/23206825
tags question: http://stackoverflow.com/q/23287819

http://stackoverflow.com/a/23133220
type: Answer
upvote count: 2
has body: If I correctly understood your question, I am afraid it does not have a complete solution. Since a float is stored with a finite number of bits, not all fractions can be represented, especially the ones that are not decimal numbers like 2/3. Even for decimal numbers, not all of them can be represented. In other words, your method will never be called by the float representation of 2/3 as an input, since this representation does not exist. You might be called with 0.66666666 (with whatever the limit of digits would be in Java), but that is not 2/3... See this link for more details about floating point representation in Java: http://introcs.cs.princeton.edu/java/91float/
score: 2
accepted answer of: http://stackoverflow.com/q/23132982
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23132982

http://stackoverflow.com/q/23208710
downvote count: 1
has answer: http://stackoverflow.com/a/23209074
type: Question
upvote count: 0
score: -1
has comment: http://stackoverflow.com/comment/35502986
has body: IT doesn't seem to work properly ' public class junk { public static void main(String[] args){ int[] Arr = {1,0,1,1,0,1,0}; int[] newArr = null; for(int i = 0; i &lt; Arr.length; i++){ if(isPowerOfTwo(i)) { newArr[i] = 9; } else{ newArr[i] = Arr[i]; } } for (int i = 0; i &lt; newArr.length; i++) { System.out.print(newArr[i] + ", "); } } private static boolean isPowerOfTwo(int i) { if (i &lt;= 0) { throw new IllegalArgumentException("number: " + i); } if ((i &amp; -i) == i) { return true; } return false; } } ' an Array 10011010 of this, and now I want this 9 9 1 9 0 0 1 9 1 0 1 0 So the power of 2 indices should be filled with 9's am i getting this right? How would I load that data of bits in to any array or Arraylist with a loop and also with certain indices to be 9... want the 1st,2nd, 4th and 8th indices... _ _ 1 _ 0 0 1 _ 1 0 1 0
answer count: 2
has comment: http://stackoverflow.com/comment/35502702
possible better answer: http://stackoverflow.com/a/23208915
accepted answer: http://stackoverflow.com/a/23209074
favorite count: 0
has answer: http://stackoverflow.com/a/23208915
has title: Loading an Array from another Array
has comment: http://stackoverflow.com/comment/35502611
has comment: http://stackoverflow.com/comment/35502494
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/35499051
comment on: http://stackoverflow.com/q/23206667
has text: I think you are misunderstanding the problem or something because how are you going from `1234` and getting `0819`? I cannot see the math here.
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/comment/35637428
score: 0
has text: I want to use the string stored in variable_name as a new variable of type Animal
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23282626

http://stackoverflow.com/a/40346210
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/23259205
upvote count: 2
has body: Stream is pull based. Personally I feel it is Oracle's answer to C# IEnumerable&lt;>, LINQ and their related extension methods. RxJava is push based, which I am not sure whether it is .NET's reactive extensions released first or Rx project goes live first. Conceptually they are totally different and their applications are also different. If you are implementing a text searching program on a text file that's so large that you can't load everything and fit into memory, you would probably want to use Stream since you can easily determine if you have next lines available by keeping track of your iterator, and scan line by line. Another application of Stream would be parallel calculations on a collection of data. Nowadays every machine has multiple cores but you won't know easily exactly how many cores your client machine are available. It would be hard to pre-configure the number of threads to operate. So we use parallel stream and let the JVM to determine that for us (supposed to be more optimal). On the other hand, if you are implementing a program that takes an user input string and searches for available videos on the web, you would use RX since you won't even know when the program will start getting any results (or receive an error of network timeout). To make your program responsive you have to let the program "subscribe" for network updates and complete signals. Another common application of Rx is on GUI to "detect user finished input" without requiring the user to click a button to confirm. For example you want to have a text field whenever the user stops typing you start searching without waiting a "Search button" click. In this case you use Rx to create an observable on "KeyEvent" and "throttle" (e.g. at 500ms), so that whenever he stopped typing for 500ms you receive an onNext() to "start searching".

http://stackoverflow.com/comment/35533942
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23160113
has text: I've implemented your code however now I am getting an error calling the paint train method inside run. It is saying that the variables need to be final. But if they are final they cannot be changed. Any suggestions? Thanks

http://stackoverflow.com/a/23342902
has body: The problem was that the JRE version on the server was 1.6.0_25. Changing the JRE to a later version solved this issue.
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23248270
answers question: http://stackoverflow.com/q/23248270
type: Answer

http://stackoverflow.com/comment/35498046
score: 0
type: AnswerComment
type: Comment
has text: @user3439407 The `while` loop won't affect the behavior of the problem, just providing the code as an example. If you want to find them by their name, you should use a `Map<String, List<String>>` instead, so you're using the wrong approach...
comment on: http://stackoverflow.com/a/23206050

http://stackoverflow.com/comment/35627398
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23277386
has text: I updated code... when i moved the code to a constructor I am unable to get reference for first. How can I solve this ?
type: AnswerComment

http://stackoverflow.com/comment/35384829
type: Comment
type: QuestionComment
has text: Hi Elliott, I didn't have 64-bit Access, only Access 2010 32-bit...
score: 0
comment on: http://stackoverflow.com/q/23141655

http://stackoverflow.com/comment/35553800
comment on: http://stackoverflow.com/a/23134129
type: Comment
has text: Is there any way to write custom tags using components and renderers in JSF2.0 using JSP?
score: 0
type: AnswerComment

http://stackoverflow.com/q/23242445
tagged with: formatter
type: Question
has answer: http://stackoverflow.com/a/25591774
type: AnsweredQuestion
upvote count: 5
tagged with: eclipse
answer count: 2
score: 5
downvote count: 0
accepted answer: http://stackoverflow.com/a/25591774
favorite count: 0
has body: Each time I click Save the entire file's formatting alternates between these two formats: this.getObject() .method() .method(); this.method(arg1, arg2, arg3, arg4); and this.getObject() .method() .method(); this.method(arg1, arg2, arg3, arg4); I want it to stick to the first format.
has answer: http://stackoverflow.com/a/23242803
has title: Eclipse - Wrapped lines' indentation appears & disappears each time I save
tagged with: coding-style
possible better answer: http://stackoverflow.com/a/23242803
tagged with: java
tagged with: eclipse-jdt

http://stackoverflow.com/a/23183482
score: 0
has body: TL;DR- https://stackoverflow.com/a/19951913/929444 Long version- When you grant someone permissions to a Google Cloud Print printer, Google emails them for approval. Of course, Google's UI does not indicate it in any way. Since the AppEngine app user cannot press the email link, there really isn't a straight-forward way to do what I wanted. A workaround, as suggested in the link above, is to create a Google Group that contains the AppEngine app and another regular user. Whenever someone adds the group, the regular user approves and the app will be granted permissions implicitly as part of the group.
type: Answer
answers question: http://stackoverflow.com/q/23177004

http://stackoverflow.com/a/23295889
upvote count: 0
has body: I think this may help you https://www.eclipse.org/mat/ I am not sure it can open just the heap memory from a heap dump but it is worth to try EDIT You may use JConsole It shows what you are looking for
type: Answer
answers question: http://stackoverflow.com/q/23266786
has comment: http://stackoverflow.com/comment/35668771
downvote count: 3
score: -3

http://stackoverflow.com/comment/35423937
type: QuestionComment
has text: @Gagravarr so I "fixed" it, changed it to xlsx and it seems to be working.. better now. But with one slight problem.... No matter what I do, all the colors end up being purple :| Except for black, black stays black. I will update question with current code
comment on: http://stackoverflow.com/q/23146787
score: 0
type: Comment

http://stackoverflow.com/comment/35777010
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23153805
score: 1
has text: The best way to format them is to avoid them.

http://stackoverflow.com/comment/35407514
type: QuestionComment
comment on: http://stackoverflow.com/q/23155157
has text: There is no easy way of doing this with a single query atm, there is a $setOnInsert but that only works for the root document. You can do this with query magic though, you could query for where the subdocument does not exist and add $inc to that command and if it returns false (meaing the subdocument was there) the run another command without $inc, still not a single command though
score: 0
type: Comment

http://stackoverflow.com/a/23150389
has body: You could wrap your code in: boolean finished = false; while (!finished) { try { // your repeating code here } finally { finished = true; } } however you would probably want to have a "catch" block that can separate out exceptions that should also cause the loop to terminate. On a general note, you would do well to break your code down in to several methods, each of which would have one fairly small funcion. This would make your code much easier to understand and debug. A good book on structuring code is "The Pragmatic Programmer" by Andrew Hunt and David Thomas.
has comment: http://stackoverflow.com/comment/35399182
has comment: http://stackoverflow.com/comment/35399573
score: 0
answers question: http://stackoverflow.com/q/23150231
has comment: http://stackoverflow.com/comment/35399953
type: Answer

http://stackoverflow.com/a/23262542
upvote count: 2
has body: You can't... You can only check that the domain exists or not making a DNS MX request on the domain name, and even then this will depend on your OS name resolution system (and you can't do that using pure Java unless you use a DNS library); for instance you may be in a very tightly controlled network which will not give you access to DNS but will force you to use a SMTP relay (in the similar vein that in a large number of enterprise networks you have to use a proxy for HTTP: you just can't "access the web" directly since you can't resolve hostnames. And even if you knew your name resolution system was reliable, you can't know whether the user actually exists before you send RCPT TO to the SMTP server. Now, if this is the syntax of the mail address you want to check, use javax.mail's InternetAddress.
answers question: http://stackoverflow.com/q/23262440
downvote count: 0
type: Answer
score: 2

http://stackoverflow.com/comment/35396228
score: 0
comment on: http://stackoverflow.com/a/23148535
type: Comment
has text: Still checking the Delete method, there seems to be alot wrong with it.
type: AnswerComment

http://stackoverflow.com/comment/35502871
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23208935
has text: So I don't need to worry about `MessageFactory`?

http://stackoverflow.com/q/23191046
answer count: 1
has comment: http://stackoverflow.com/comment/35471053
has body: I'm using: tableName.getColumnModel().getColumn(0).setHeaderValue("new header blahhh"); to change header values. After the code executes, the header value only changes once i mouse over the column header i have NO mouseover events anywhere. Has anyone else heard of this? Is there another way i can change header values without this?
tagged with: jtable
score: 0
tagged with: columnheader
has comment: http://stackoverflow.com/comment/35471184
type: UnansweredQuestion
tagged with: swing
has title: changing column header values in JTable
has answer: http://stackoverflow.com/a/23200036
tagged with: java
has comment: http://stackoverflow.com/comment/35471161
has comment: http://stackoverflow.com/comment/35471240
type: Question

http://stackoverflow.com/a/23204151
score: 0
type: Answer
has body: You can write your own compareTo function for classes so you can order your objects anyway you want.
answers question: http://stackoverflow.com/q/23204088

http://stackoverflow.com/a/23246198
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23244651
answers question: http://stackoverflow.com/q/23244651
has body: Well, I found the problem. As I mentioned in a comment on the question, when you call sort the MongoDB driver starts using a meta-query operators rather than just a simple object query, as you would usually do. For example, the simple query, without sorting, would look like this: find({ "hello" : { "$exists" : true}}, null) The above will find any document that contains a field called "hello". However, when you use sort, the query looks like this: find({ "query" : { "hello" : { "$exists" : true}} , "orderby" : { "hello" : 1}}, null) This is WRONG because it will match a document containing a field called "query" with the above value, as well as a field called "orderby"... The correct query should be: find({ "$orderby" : { "hello" : 1} , "$query" : { "hello" : { "$exists" : true}}}, null) The only difference is the $ that makes the keys meta-operators. To confirm this hypothesis, I modified my code to use addSpecial (which allows me to add meta-operators to the query) as well as tried to "cancel" the automatically-generated (and wrong) query, as follows: final DBCursor sorted = collection .find( ) .addSpecial( "$orderby", new BasicDBObject( "hello", 1 ) ) .addSpecial( "$query", new BasicDBObject( "hello", new BasicDBObject( "$exists", true ) ) ) .limit( 10 ); Because this will still keep the wrong "query" operator in the query, I had to add a query field to my documents to make it finally work: collection.insert( new BasicDBObject( "hello", 4 ).append( "query", 1 ) ); ... Now all the tests above pass! Clearly, this is a horrible hack and hopefully the MongoDB team will fix the Java client ASAP. In the mean time, I can get this to work at least. I have tried to issue a bug in the Java Driver JIRA but I couldn't find out how to sign up. EDIT 2 Actually, just found out I could sign up and created a ticket: JAVA-1176 ** EDIT 3 ** Just found out with the MongoDB team that this problem does not exist anymore with the most recent version of Fongo (1.4.5 at the time of writi…
upvote count: 1
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/a/23224269
has comment: http://stackoverflow.com/comment/35554592
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/35530034
has comment: http://stackoverflow.com/comment/35530139
accepted answer of: http://stackoverflow.com/q/23224094
has comment: http://stackoverflow.com/comment/35530099
has comment: http://stackoverflow.com/comment/35542602
answers question: http://stackoverflow.com/q/23224094
has comment: http://stackoverflow.com/comment/35531864
upvote count: 1
type: AcceptedAnswer
has body: You're reading all the lines and only keeping the last in your data1 variable. That's probably your problem. You should, instead, handle each value right away while reading the file, and build an ArrayList instead of an array (because you won't know its size beforehand): String fileName = "input.txt"; File file = new File(fileName); Scanner scanner = new Scanner(file); ArrayList&lt;Byte&gt; covertDataList= new ArrayList&lt;&gt;(); while(scanner.hasNextLine()){ String line = scanner.nextLine(); // the line should be just a number covertDataList.add(Byte.parseByte(line)); // no substring needed } If you want to fail nicely when the file format is wrong, you may surround parseByte with a try/catch block. About the ArrayList If you want to use your list as an array, you can just: use covertDataList.get(i) instead of covertDataArray[i] use covertDataList.set(i, value); instead of covertDataArray[i] = value; If you really need an array (I don't see the point here), you can do this: Byte[] covertDataArray = covertDataList.toArray(new Byte[list.size()]);
type: Answer
has comment: http://stackoverflow.com/comment/35530092

http://stackoverflow.com/comment/35438768
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23172622
type: Comment
has text: But it is not the solution. Even without the `@Repository` annotation the test fails.

http://stackoverflow.com/comment/140209799
type: AnswerComment
type: Comment
has text: i'm using 3.8.8 and still having issue.
comment on: http://stackoverflow.com/a/73441577
score: 0

http://stackoverflow.com/comment/35401134
comment on: http://stackoverflow.com/q/23151467
has text: I like your solution @Tyranicangel, thanks. Do you know some websites to learn how could I implement tokens?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35642300
score: 0
type: AnswerComment
type: Comment
has text: where are you looking for the file? It will be creates in the projects root directory. So if your project is HelloWorld it will be created in HelloWorld directory and not HelloWorl/src dir. Anyway you can give absolute path and retry.
comment on: http://stackoverflow.com/a/23285335

http://stackoverflow.com/comment/35395972
has text: I'm thinking less of exceptions that one writes code to throw, and more about exceptions that get automatically thrown in cases of errors, like NullPointerException and IndexOutOfBoundsException. Of course, I'm not sure what kind of trivial seeming issues you are spending ages searching for information on; can you give an example?
comment on: http://stackoverflow.com/a/23147816
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/23179088
tagged with: java
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/23179517
score: 0
has comment: http://stackoverflow.com/comment/35449893
has title: Error in Recursion Program
type: UnansweredQuestion
has body: I have the following program that is supposed to be running but it is not. The professor gave it to us to work with. It is designed to calculate factorials. It won't even let me compile. The error I am getting states Multiple markers at this line - Syntax error on token "Invalid Character", invalid Expression - Syntax error on tokens, delete these tokens This is in reference to the following line: System.out.print ( “%d! = %d\n”, counter, factorial (counter )); How can I fix this? I've written quite a few programs before but I've never seen that modulus operator inside quotations before. I'm a little confused! The entire program is posted below! Thank you! public class FactorialTest { // calculate the factorial of 0 – 15 public static void main ( String args[] ) { FactorialCalculation factorialCalculation = new FactorialCalculation(); factorialCalculation.displayFactorials(); } // end of main } // end of the class FactorialTest public class FactorialCalculation { //recursive Factorial method public long factorial(long number) { if (number &lt;= 1) return 1; else return number * factorial (number - 1); } //Now output the factorials of 0 through 15 public void displayFactorials() { // Calculate the factorial of o through 15 for ( int counter = 0; counter &lt;= 10; counter++ ) System.out.print ( “%d! = %d\n”, counter, factorial (counter )); } // end of the method displayFactorials } // end of class FactorialCalculation
tagged with: recursion
has answer: http://stackoverflow.com/a/23179098

http://stackoverflow.com/q/23180634
has body: I have some problems in implementing the hill cipher algorithm in Java Android. It runs well on certain condition but it comes lack on other condition. Here is the running app. 1. It runs OK for below condition 2. It comes with unexpected result for below condition I'm just figuring that the problem comes from the negative results. I used the determinant and multiplicative invers to find the matrix invers. here is the code of my project. MainActivity.java package com.andri.hilltest; import java.util.Arrays; import android.os.Bundle; import android.app.Activity; import android.view.Menu; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.EditText; import android.widget.Toast; public class MainActivity extends Activity implements OnClickListener { EditText txtPlain, txtKey, txtCipher, txtDecrypt; Button btnEncrypt, btnCheck, btnDecrypt; String char_db = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 ?!.,"; //String char_db = "ABCDEFGHIJKLMNOPQRSTUVWXYZabc"; int[] array_angka, array_angka2; int[] array_angka_cipher, array_angka_decrypted; int[][] M_key = new int[2][2]; int[][] M_inverse = new int [2][2]; int i; String key_input, ciphertext, plaintext; int db_length = char_db.length(); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); txtPlain = (EditText) findViewById(R.id.txtPlain); txtKey = (EditText) findViewById(R.id.txtKey); txtCipher = (EditText) findViewById(R.id.txtCipher); txtDecrypt = (EditText) findViewById(R.id.txtDecrypt); btnEncrypt = (Button) findViewById(R.id.btnEncrypt); btnDecrypt = (Button) findViewById(R.id.btnDecrypt); btnCheck = (Button) findViewById(R.id.btnCheck); btnEncrypt.setOnClickListener(this); btnCheck.setOnClickListener(this); btnDecrypt.setOnClickListener(this); } @Override public void onClick(View v) { if(v == btnEncrypt){ String plainTextInput = txtPlain.getText(…
type: UnansweredQuestion
tagged with: android
tagged with: cryptography
has answer: http://stackoverflow.com/a/23180815
score: 1
tagged with: java
upvote count: 1
type: Question
has title: What's wrong with my hill cipher code? (Java Android)
answer count: 1
downvote count: 0
favorite count: 0

http://stackoverflow.com/q/23224596
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23224641
upvote count: 1
tagged with: java
type: Question
tagged with: numberformatexception
answer count: 2
has title: Exception in thread "main" java.lang.NumberFormatException: For input string: "8/3/2012"
has comment: http://stackoverflow.com/comment/35530397
score: -11
downvote count: 12
has comment: http://stackoverflow.com/comment/35530334
has body: Why I'm getting these error message. Exception in thread "main" java.lang.NumberFormatException: For input string: "8/3/2012" at sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:1222) at java.lang.Double.parseDouble(Double.java:510) at com.exel.raf.seeit.ExecuteImport.excelDtToString(ExecuteImport.java:713) at com.exel.raf.seeit.ExecuteImport.generateItemHistorySql(ExecuteImport.java:649) at com.exel.raf.seeit.ExecuteImport.execute(ExecuteImport.java:56) at com.exel.raf.seeit.ExecuteImport.main(ExecuteImport.java:38) Process exited with exit code 1.
favorite count: 0
has answer: http://stackoverflow.com/a/44399629
has comment: http://stackoverflow.com/comment/35530373

http://stackoverflow.com/comment/35956426
comment on: http://stackoverflow.com/a/23404591
has text: @Peter, I appreciate your support :) . If I am not disturbing you, would you simply give me your idea about similar scenario problem. Just forget my question's scenario. And just assume, 3 jee applications running and all have same kind of objects in their application context.Therefore,I remove all those objects from applications, and all functions(validations,data processings)are put into another 4th application.This 4th app only does storing common objects and some other functions relevant to those objects.When ever those objects are needed,those 3 applications call the 4th app and get....
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/35381906
comment on: http://stackoverflow.com/a/23140174
type: AnswerComment
has text: Thank you! Is the reason for 2*i because of the previous charArray initialized as string.length * 2?
type: Comment
score: 0

http://stackoverflow.com/a/23200588
has body: See the OpenDMK, which supports cascading (federating). There's a mavenized build as well.
score: 0
has comment: http://stackoverflow.com/comment/35689733
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23167132
type: Answer
answers question: http://stackoverflow.com/q/23167132

http://stackoverflow.com/q/23167965
has comment: http://stackoverflow.com/comment/35430798
tagged with: java
has comment: http://stackoverflow.com/comment/35430543
has answer: http://stackoverflow.com/a/23168496
type: Question
has comment: http://stackoverflow.com/comment/35430491
has body: I have a random set S of integers and the cardinality (n) of this set may vary from 10 to 1000. I need to store all sums of the nCr combinations of size r generated from this set. Usually r range from 3 to 10. E.g. if S={102,233,344,442,544,613,71289,836,97657,12} and r=4, Then The sums generated will be {0,1,2,3}=102+233+344+442, {0,1,2,4}=102+233+344+544,....so on. I implemented a findCombi function (below) in Java which gave me all nCr combinations in terms of r sized sets of indices and then I sifted through these sets in another function to generate the sum of corresponding elements. But the program is giving heapspace error, probably because of exponential nature and I have 100-5000 of such sets, S. Or may be there is a memory leak? Is there a faster and lesser-memory consuming way to do it? Note: dsize=n, combiSize=r List &lt;List&lt;Integer&gt;&gt; findCombi(int dsize,int combiSize) { if( (combiSize==0) || (dsize==0) ){ return null; } long n=dsize; int r=combiSize; for(int i=1;i&lt;combiSize;i++) { n=n*(dsize-i); r=r*i; } int totalcombi=(int) n/r; List &lt;List&lt;Integer&gt;&gt; combiData=new ArrayList&lt;&gt;(totalcombi); int pos; List &lt;Integer&gt; combi=new ArrayList&lt;&gt;(combiSize); for(int i=0;i&lt;combiSize;i++) { combi.add(i,i); } combiData.add(new ArrayList&lt;&gt;(combi)); pos=combiSize-1; while(true) { if(combi.get(pos)&lt;(dsize-combiSize+pos)) { combi.set(pos,combi.get(pos)+1); if(pos==(combiSize-1)) { combiData.add(new ArrayList&lt;&gt;(combi)); } else { combi.set(pos+1,combi.get(pos)); pos++; } } else { pos--; } if(pos==-1) { break; } } return combiData; }
has comment: http://stackoverflow.com/comment/35430806
score: 0
has comment: http://stackoverflow.com/comment/35430854
answer count: 1
has comment: http://stackoverflow.com/comment/35430470
has comment: http://stackoverflow.com/comment/35430836
tagged with: heap-memory
type: UnansweredQuestion
has title: How to generate sums of combinations of elements of a set efficiently in terms of time and memory?
has comment: http://stackoverflow.com/comment/35431117
has comment: http://stackoverflow.com/comment/35431024
tagged with: combinations

http://stackoverflow.com/q/23240251
has answer: http://stackoverflow.com/a/23240675
type: AnsweredQuestion
tagged with: joptionpane
tagged with: java
tagged with: swing
has comment: http://stackoverflow.com/comment/35559081
type: Question
has body: I'm making a GUI for a car register and I'm trying to make a form for adding a vehicle. The main panel have all the basic choices. If I'm pushing the add vehicle button I'm running the showInputDialog command and a window shows up. This contains one drop down box and the user needs to choose one of the alternatives, once that is done I want to update the same window to show what the user can choose after the first choice. e.g I want to choose between a car and a truck, and those two have different parameters, if I choose the car I get the parameters for the car in a new box/field beneath the first one in the same window and so on. I'm new to GUI/Swing but have used Java for a while.
has title: How do I add fields to a showInputDialog window?
accepted answer: http://stackoverflow.com/a/23240675
score: 0
linked to: http://stackoverflow.com/q/5665156
answer count: 1

http://stackoverflow.com/a/23253389
score: -1
has body: You might do it with either scaleType(http://developer.android.com/reference/android/widget/ImageView.ScaleType.html) You use ImageView instead of background placing it as the first layout's element and specify android:scaleType attribute for it: &lt;RelativeLayout android:layout_width="fill_parent" android:layout_height="fill_parent" &gt; &lt;ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/backgrnd" android:scaleType="matrix" /&gt; ... rest layout components here ... &lt;/RelativeLayout&gt; or drawable xml
downvote count: 1
type: Answer
upvote count: 0
answers question: http://stackoverflow.com/q/23253164

http://stackoverflow.com/a/56830730
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/23226119
score: 1
upvote count: 1
has body: You can use the list to store the EntrySet values and then sort by using list.sort() method with the help of Comparator. ConcurrentHashMap<String,Integer> pl = new ConcurrentHashMap<>(); pl.put("joker25", 255); pl.put("minas", 55); pl.put("agoriraso", 122); pl.put("pigasakias", 1024); pl.put("geo5", 5092); //Add your map elements into a list which accepts EntrySet<String, Integer> as Input List<Entry<String, Integer>> list = new ArrayList<>(pl.entrySet()); /* * Sort the list by using comparator object or comparator lambda expression (as * listed in any one of the below ways) */ // WAY - 1 : Passing Comparator as lambda Expression list.sort((e1, e2) -> e1.getValue().compareTo(e2.getValue())); /* * WAY - 2 : By using method reference for Comparator - Uncomment below line if * you want to use Method reference */ //list.sort(Comparator.comparing(Entry::getValue)); /* * Create a new HashMap and add the values to it, but here if you add the sorted * values to Concurrent hashMap you will not see the values in sorted order * because the entries will be stored according to hash value of string */ //Suggest you to use the linked hashmap if you want to see the sorted order of entries according to the valueset ConcurrentHashMap<String,Integer> ol = new ConcurrentHashMap<>(); //LinkedHashMap<String,Integer> ol = new LinkedHashMap<>(); for(Entry<String, Integer> e : list) { System.out.println(e.getKey() +" ::" +e.getValue()); ol.put(e.getKey(), e.getValue()); }

http://stackoverflow.com/comment/35584791
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23254550
has text: why not add code as `code`?

http://stackoverflow.com/q/23277619
possible better answer: http://stackoverflow.com/a/23277735
has answer: http://stackoverflow.com/a/23277798
type: AnsweredQuestion
has title: Java Input Validation for Number Range and Numeric values only with counter
tagged with: java
tagged with: counter
has comment: http://stackoverflow.com/comment/35628043
type: Question
has answer: http://stackoverflow.com/a/23279261
tagged with: validation
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/52140855
accepted answer: http://stackoverflow.com/a/23279261
answer count: 4
has answer: http://stackoverflow.com/a/23277735
has body: I am trying to complete a task and I am unsure what route to take. I have tried while, if, and a combination of statements and cannot get the input validation I need. I am trying to validate user input and ensure their input is a number between 0 and 10 (excluding 0 and 10). Also I need to make sure that what they do enter is a number and not some symbol or letter. Finally I need a counter that will allow them 3 chances to input the correct information. The code below is my method I am trying to setup to accomplish this. private static int getNumericInput(String quantity) { int count = 0; String input; input = JOptionPane.showInputDialog(quantity); int range = Integer.parseInt(input); while ((range &gt; 9 || range &lt; 1) &amp;&amp; (count &lt; 2)) { JOptionPane.showMessageDialog(null, "Sorry that input is not valid, please choose a quantity from 1-9"); input = JOptionPane.showInputDialog(quantity); count++; } if (count == 2) { JOptionPane.showMessageDialog(null, "Sorry you failed to input a valid response, terminating."); System.exit(0); } return range; }
score: 2
upvote count: 2

http://stackoverflow.com/q/23289934
upvote count: 1
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/27077992
downvote count: 0
has title: Java Code error while Streaming Data into BigQuery
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23290048
has body: I'm beginner in Java. Can you tell me please why the following code detected an error though I take exactly the same code given as an example in the following URL of google: https://developers.google.com/bigquery/streaming-data-into-bigquery#streaminginsertexamples the word bigquery is underlying in red and the error is: bigquery cannot be resolved. I remember that I want to stream my data into BigQuery one record at a time by using the tabledata().insertAll() method. This is my code: import java.io.IOException; import java.util.*; import com.google.api.services.bigquery.*; import com.google.api.services.bigquery.model.*; public class sdz1 { public static void main(String[] args) { TableRow row = new TableRow(); row.set("Average", 7.7); TableDataInsertAllRequest.Rows rows = new TableDataInsertAllRequest.Rows(); rows.setInsertId(""+System.currentTimeMillis()); rows.setJson(row); List rowList = new ArrayList(); rowList.add(rows); TableDataInsertAllRequest content = new TableDataInsertAllRequest().setRows(rowList); try { TableDataInsertAllResponse response = bigquery .tabledata() .insertAll("Vigicolis", "wi_vigicolis", "TestTable", content) .execute(); // TableDataInsertAllResponse response = new TableDataInsertAllResponse(); // response.bigquery.tabledata().insertAll("Vigicolis", "wi_vigicolis", "TestTable", content).execute(); System.out.println("Response: " + response); } catch (IOException e) { // handle } } }
score: 1
tagged with: java

http://stackoverflow.com/comment/35585743
score: 0
type: Comment
type: QuestionComment
has text: Uuuh, why synchronize since you use a lock to begin with?? Also, you should lock in front of a `try` block and unlock in a `finally` block
comment on: http://stackoverflow.com/q/23255083

http://stackoverflow.com/comment/35603193
score: 1
type: AnswerComment
has text: Plz see again the question. Problem in autocommit on lost connection to db server. By default, Oracle commit transaction on lost connection.
type: Comment
comment on: http://stackoverflow.com/a/23263230

http://stackoverflow.com/a/41823317
has comment: http://stackoverflow.com/comment/84168236
downvote count: 1
answers question: http://stackoverflow.com/q/23218874
upvote count: 62
has comment: http://stackoverflow.com/comment/120711304
has body: This answer concerns itself with the performance of the various implementations of the loops. Its only marginally relevant for loops that are called VERY OFTEN (like millions of calls). In most cases the content of the loop will be by far the most expensive element. For situations where you loop really often, this might still be of interest. You should repeat this tests under the target system as this is implementation specific, (full source code). I run openjdk version 1.8.0_111 on a fast Linux machine. I wrote a test that loops 10^6 times over a List using this code with varying sizes for integers (10^0 -&gt; 10^5 entries). The results are below, the fastest method varies depending on the amount of entries in the list. But still under worst situations, looping over 10^5 entries 10^6 times took 100 seconds for the worst performer, so other considerations are more important in virtually all situations. public int outside = 0; private void iteratorForEach(List&lt;Integer&gt; integers) { integers.forEach((ii) -&gt; { outside = ii*ii; }); } private void forEach(List&lt;Integer&gt; integers) { for(Integer next : integers) { outside = next * next; } } private void forCounter(List&lt;Integer&gt; integers) { for(int ii = 0; ii &lt; integers.size(); ii++) { Integer next = integers.get(ii); outside = next*next; } } private void iteratorStream(List&lt;Integer&gt; integers) { integers.stream().forEach((ii) -&gt; { outside = ii*ii; }); } Here are my timings: milliseconds / function / number of entries in list. Each run is 10^6 loops. 1 10 100 1000 10000 iterator.forEach 27 116 959 8832 88958 for:each 53 171 1262 11164 111005 for with index 39 112 920 8577 89212 iterable.stream.forEach 255 324 1030 8519 88419 If you repeat the experiment, I posted the full source code. Please do edit this answer and add you results with a notation of the tested system. Using a MacBook Pro, 2.5 GHz Intel Core i7, 16 GB, macOS 10.12.6: 1 10 100 1000 10000 iterator.forEach 27 106 1047 8516 88044 fo…
has comment: http://stackoverflow.com/comment/101039668
score: 61
type: Answer
has comment: http://stackoverflow.com/comment/98797346

http://stackoverflow.com/q/23139075
type: AnsweredQuestion
upvote count: 0
has comment: http://stackoverflow.com/comment/35379241
has answer: http://stackoverflow.com/a/23139168
accepted answer: http://stackoverflow.com/a/23139334
type: Question
tagged with: recursion
possible better answer: http://stackoverflow.com/a/23139168
tagged with: algorithm
tagged with: java
score: -1
has answer: http://stackoverflow.com/a/23139334
has comment: http://stackoverflow.com/comment/35379217
has answer: http://stackoverflow.com/a/23139236
answer count: 3
has comment: http://stackoverflow.com/comment/35379292
downvote count: 1
has body: I'm supposed to create a method that takes an ArrayList of Bounded Generic type and sorts it based on the volumes of the objects using the following algorithm (I HAVE to follow it exactly). The bound should only allow any Shape object and subclasses: if the list size is &lt;= 1 return the list select a middle element from the list and remove it create two lists leftList and rightList for each element in the list if element is less than the middle element then add element to the rightList else add element to leftList return the combination of recursiveSort(leftList), middle element, and recursiveSort(rightList) My Shape class is simply just an interface with a getVolume() method where my other classes (Spheres, Ellipsoid, etc.) override this method And here is my recursive code (in another class that does other methods such as find min and max): public class ShapeUtilities { public static &lt;T extends Shape&gt; Collection&lt;? extends T&gt; recursiveSort(ArrayList&lt;T&gt; list) { if (list.size() &lt;= 1) { return list; } int middleIndex = list.size() / 2; T middleElement = list.get(middleIndex); list.remove(middleIndex); ArrayList&lt;T&gt; leftList = new ArrayList&lt;T&gt;(); ArrayList&lt;T&gt; rightList = new ArrayList&lt;T&gt;(); for (T item : list) { if (item.getVolume() &lt; middleIndex) { rightList.add(item); } else { leftList.add(item); } } ArrayList&lt;? extends Shape&gt; combination = new ArrayList&lt;T&gt;(); combination.addAll(recursiveSort(leftList)); combination.add(middleElement); combination.addAll(recursiveSort(rightList)); return combination; How can I return the "combination of recursiveSort(leftList), middle element, and recursiveSort(rightList)"? It's not adding into the ArrayList I created and simply just returns the middle element instead of all three.
has comment: http://stackoverflow.com/comment/35387208
tagged with: generics
favorite count: 0
has comment: http://stackoverflow.com/comment/35379303
has comment: http://stackoverflow.com/comment/35381558
has title: my recursiveSort() method not working? (generics)
has comment: http://stackoverflow.com/comment/35379407
has comment: http://stackoverflow.com/comment/35379447

http://stackoverflow.com/comment/35641829
has text: @dcastro - Any book where I can laern more about synchronization? :)
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23274258
type: AnswerComment

http://stackoverflow.com/comment/35395688
has text: I would prefer to launch the gallery - which will display the image full screen by default (launching the video imagebutton causes the gallery to open - I would like the same for images)
type: Comment
comment on: http://stackoverflow.com/a/23148157
type: AnswerComment
score: 0

http://stackoverflow.com/q/23152902
tagged with: android
tagged with: http://stackoverflow.com/tag/xml
tagged with: webview
type: AnsweredQuestion
tagged with: java
has title: Element at the top of a Webview
has answer: http://stackoverflow.com/a/23153014
type: Question
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/23153014
has body: I should put an element (AdMob) at the top of a WebView, so when the WebView scrolls, the adv (AdMob) doesn't stay at the top of the page but scrolls with the page. Is it possible? If not, how can I do this? Thanks! PS: I'm Italian, sorry for any error :|

http://stackoverflow.com/comment/35816044
type: QuestionComment
has text: @Parasu I ended up doing this prior to you suggesting it and it did work. This fixed all of my issues. Also what I done, is I changed where the Loader object gets instantiated and instead made it to where the object is created and destroyed each time the method that requires it is called, for the sake of the web service. Thanks for the response though!
score: 0
comment on: http://stackoverflow.com/q/23283704
type: Comment

http://stackoverflow.com/a/23226166
accepted answer of: http://stackoverflow.com/q/23226096
answers question: http://stackoverflow.com/q/23226096
has comment: http://stackoverflow.com/comment/35533646
has comment: http://stackoverflow.com/comment/35533382
has body: When a thread has "finish processing", i.e., exits from the run method, the thread will terminate itself and there's no need to interrupt.
has comment: http://stackoverflow.com/comment/35533168
score: 2
has comment: http://stackoverflow.com/comment/35533350
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/35533582
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/35533424
has comment: http://stackoverflow.com/comment/35533704

http://stackoverflow.com/comment/35645224
score: 0
has text: Thanks for the Java code. Could please reverify your results using `Stopwatch`?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23286148

http://stackoverflow.com/comment/92151737
has text: @Holger you are right, I should have read my own question clearly. Recently I was trying to find out resident memory breakup (heap + non heap etc), for that I was using XX:NativeMemoryTracking and my previous comment was related to that.
comment on: http://stackoverflow.com/q/23266786
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23235150
tagged with: io
has answer: http://stackoverflow.com/a/23235684
tagged with: swing
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/35549746
type: Question
has title: how to send screenshot to server without storing in local machine
has comment: http://stackoverflow.com/comment/35549697
possible better answer: http://stackoverflow.com/a/23235684
tagged with: httpclient
tagged with: awt
score: 0
answer count: 2
has body: i am beginner in java and developing one desktop application. as per requirement i have to capture screen shot at time interval and send on to the server. for that i have wrote following code Rectangle screenRect = new Rectangle(Toolkit .getDefaultToolkit().getScreenSize()); //To Store the scrreen shot in buffer. BufferedImage capture = new Robot() .createScreenCapture(screenRect); //To Save the image on specific location. ImageIO.write(capture, "png", new File( "resources/img/screenshot.png")); //To decrees the size of the image Thumbnails.of("resources/img/screenshot.png").scale(0.50) .toFile("resources/img/screenshot.png"); File file = new File("resources/img/screenshot.png"); MultipartEntity mpEntity = new MultipartEntity(); ContentBody cfBody = new FileBody(file); mpEntity.addPart("screenshot", cfBody); this code run successfully but problem is that when any machine has not permission to write the file in "Program File folder" that time this is not work. then is there any way to send the image via httpClient without storing in local machine?
has answer: http://stackoverflow.com/a/23236638
accepted answer: http://stackoverflow.com/a/23236638

http://stackoverflow.com/comment/35407997
comment on: http://stackoverflow.com/q/23155024
score: 1
has text: You are aware that if you're operating a CA, you'll want to do more than just sign a request? (In particular, you'll want to keep track of what certificates you think you've signed, and what of those you think are valid and what are invalid.)
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23221332
has answer: http://stackoverflow.com/a/23221494
has comment: http://stackoverflow.com/comment/35524650
has comment: http://stackoverflow.com/comment/35524486
score: 0
has answer: http://stackoverflow.com/a/23221469
has body: How do I parse a date string like 2014-04-25T01:50:00.000-06:00? I am using Joda DateTime and have tried something like: public static String formatDate(Date d){ SimpleDateFormat mdyFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.00'0Z'"); String mdy = mdyFormat.format(d); return mdy; } However, the result is an error: java.text.ParseException: Unparseable date: "2014-04-25T01:50:00.000-06:00"
type: Question
tagged with: java
tagged with: date
has answer: http://stackoverflow.com/a/23221530
has title: DateTime ParseException for date with offset
has comment: http://stackoverflow.com/comment/35524752
answer count: 3
type: UnansweredQuestion
tagged with: datetime

http://stackoverflow.com/a/23277687
accepted answer of: http://stackoverflow.com/q/23277360
score: 0
has body: You're trying to access content inside an iFrame. My understanding is jsoup does not support this. Target the iframe src directly, See: https://stackoverflow.com/a/16236780/24998 to ensure you're actually accessing the content inside the iframe. '>' in a CSS selection is for an immediate child, which doesn't seem to be the case here. You'll probably want to drop the '>' and just have a space.
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23277360
type: Answer
has comment: http://stackoverflow.com/comment/35640104

http://stackoverflow.com/comment/35456041
has text: is your java project a maven project
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23182968
score: 0

http://stackoverflow.com/a/23184418
has comment: http://stackoverflow.com/comment/47296050
score: 46
upvote count: 46
has body: Go to project Build Path and change the Java Library version to 1.7 Go to Eclipse Preferences -> Java -> Compiler -> Change compliance level to 1.7 Right click on project -> Properties -> Project Facets Uncheck Dynamic Web Module and click Apply (also uncheck JavaServer Faces if you had that) Change the Java facet version to 1.7 and click Apply Add the Dyanmic Web Module v3.0, apply. Eclipse's facets configuration is buggy. Make sure you keep hitting Apply between checking and unchecking of facets. Links: Cannot change version of project facet Dynamic Web Module to 3.0? Change version of project facet Dynamic Web Module to 2.5
accepted answer of: http://stackoverflow.com/q/23183931
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23183931
has comment: http://stackoverflow.com/comment/83313357
type: Answer

http://stackoverflow.com/a/23137369
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/23137252
has comment: http://stackoverflow.com/comment/35376431
upvote count: 2
has body: Your enum declaration is wrong. Either put the whole declaration inside the EnumTest class as an inner class, remove the public specifier, or put it in a separate file.

http://stackoverflow.com/comment/35409065
comment on: http://stackoverflow.com/q/23156294
score: 0
type: Comment
type: QuestionComment
has text: Is ur build set to build automatically and you have to click clean all the time when that happens u don't need to restart eclipse.

http://stackoverflow.com/q/23138631
tagged with: struts2
tagged with: ajax
score: 0
has body: I am trying to call struts2 action when I click 'OK' in confirm box. I have an id from jsp and I want to pass it into the action. I've tried several ways with no success. One thing is using href: &lt;s:url action="disable" var="urlTag"&gt; &lt;s:param name="id"&gt;&lt;s:property value="id"/&gt;&lt;/s:param&gt; &lt;/s:url&gt; window.location.href="{urlTag}"; I also tried using ajax $.ajax( { type: "POST", url: "%{urlTag}", //will this declaration of action work? dataType: "json", contentType: "application/json; charset=utf-8", data: "", success: function() { alert("success"); } }); I am new to this and really want to get though it. Thank you for any help!
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23147248
tagged with: java
has title: struts2 confirm box with action
has answer: http://stackoverflow.com/a/23139051
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/35378672
tagged with: jsp
tagged with: javascript

http://stackoverflow.com/comment/42318295
comment on: http://stackoverflow.com/q/23202046
has text: nobody answered.. strange....I also encountered the same question today...
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35368793
type: AnswerComment
type: Comment
has text: [this](http://stackoverflow.com/questions/7697650/check-if-file-exists-on-sd-card-on-android) question explains how you can check if a file exists in external storage. [this](http://stackoverflow.com/questions/8330276/write-a-file-in-external-storage-in-android) question explains how you can create a new file in external storage
comment on: http://stackoverflow.com/a/23133307
score: 0

http://stackoverflow.com/comment/35512179
type: AnswerComment
score: 0
type: Comment
has text: i havent added the permission internet one now i will check it @Raghunandan
comment on: http://stackoverflow.com/a/23211475

http://stackoverflow.com/a/23138278
type: Answer
score: 0
has body: You should always free/close the resources you use like ResultSet, Statement, Connection. That should be done in finally block. The snippet you pasted here looks OK (as far as s and c are closed in QuietDb).
answers question: http://stackoverflow.com/q/23138189

http://stackoverflow.com/a/23236904
answers question: http://stackoverflow.com/q/23211133
has body: you can do that without writing file in your local machine by using the following code ByteArrayOutputStream bos=new ByteArrayOutputStream(); byte[] imageByte = null; try { //To Get the the size of the screen. Rectangle screenRect = new Rectangle(Toolkit .getDefaultToolkit().getScreenSize()); //To Store the scrreen shot in buffer. BufferedImage capture = new Robot() .createScreenCapture(screenRect); //To Save the image on specific location. ImageIO.write(capture, "png",bos); bos.flush(); imageByte=bos.toByteArray(); bos.close(); // File file = new File("resources/img/screenshot.png"); MultipartEntity mpEntity = new MultipartEntity(); // ContentBody cfBody = new FileBody(file); ContentBody cfBody = new ByteArrayBody(imageByte,"screenshot.png"); mpEntity.addPart("screenshot", cfBody); } send direct the byte array in plase of the image
score: 0
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/23211133

http://stackoverflow.com/q/23185049
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: multithreading
has comment: http://stackoverflow.com/comment/35460136
upvote count: 1
has body: I have a thread that does some task in the background after certain interval of time, at regular intervals. However I want control over when the thread should get killed off, here is how I have implemented it. class Task extends Thread { private boolean kill= false,repeat = false; public void kill() { kill = true; } public void repeat() { repeat = true; } public void run() { do { //wait until the required time has elapsed while(!isTimeElapsed() &amp;&amp; !kill) { Thread.sleep(1000); } if(!kill) { //time to work, do stuff } } while(repeat &amp; !kill); } } The code works as I required, but Netbeans notifies me saying, "Invoking Thread.sleep() in loop can cause performance problems". But it does not suggest a better way to do what I want to do. But, is there a better way to do what I want, i.e to make a thread wait for a fixed amount of time, but have the flexibility of killing the thread whenever I want to as well ?
has comment: http://stackoverflow.com/comment/35460247
has comment: http://stackoverflow.com/comment/35460151
has answer: http://stackoverflow.com/a/23185213
type: Question
possible better answer: http://stackoverflow.com/a/23185213
has answer: http://stackoverflow.com/a/23185230
answer count: 2
has comment: http://stackoverflow.com/comment/35460034
has comment: http://stackoverflow.com/comment/35460121
downvote count: 0
accepted answer: http://stackoverflow.com/a/23185230
favorite count: 0
has title: Is there a better way to do this than using Thread.sleep()?

http://stackoverflow.com/comment/35623150
type: Comment
has text: OK, I understand that OP may have needed `\\S+`. But it should be noted that the greediness or reluctance of regex constructs should _never_ affect whether a match is found, because of backtracking, unless there are non-backtracking constructs somewhere in the regex (`.*+`, `(?>...)`). It would only affect how much text is matched and what goes into the groups.
comment on: http://stackoverflow.com/a/23274921
type: AnswerComment
score: 0

http://stackoverflow.com/comment/35449767
type: AnswerComment
comment on: http://stackoverflow.com/a/23178935
type: Comment
has text: @JasonC oh sorry, I was misinterpreting the context of your response.
score: 0

http://stackoverflow.com/comment/35583397
score: 0
comment on: http://stackoverflow.com/q/23253156
type: Comment
type: QuestionComment
has text: there should be a problem with the way you deploy it. I followed all your steps and deployed on a vanilla Tomcat 7 and it works fine.

http://stackoverflow.com/comment/35643488
score: 1
has text: I see. I must admit I never delved into GC as far as to be able to explain it even further. I found later comments by JB Nizet, kjkrum and aquaraga very informative and complete. I'm not even sure thare is a *one level deeper* explanation. GC is a simple concept, otherwise it would be too costly to implement.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23285237

applet
tags question: http://stackoverflow.com/q/23246806
tags question: http://stackoverflow.com/q/23220659
tags question: http://stackoverflow.com/q/23273152
tags question: http://stackoverflow.com/q/23212654
tags question: http://stackoverflow.com/q/23263925
tags question: http://stackoverflow.com/q/23241617
type: Tag
tags question: http://stackoverflow.com/q/23220858
tag name: applet
tags question: http://stackoverflow.com/q/23225715
tags question: http://stackoverflow.com/q/23213498
tags question: http://stackoverflow.com/q/23220334
tags question: http://stackoverflow.com/q/23224875
tags question: http://stackoverflow.com/q/23173727
tags question: http://stackoverflow.com/q/23204544
tags question: http://stackoverflow.com/q/23281598
tags question: http://stackoverflow.com/q/23202279
tags question: http://stackoverflow.com/q/23239079
tags question: http://stackoverflow.com/q/23174281
tags question: http://stackoverflow.com/q/23275494
tags question: http://stackoverflow.com/q/23140908
tags question: http://stackoverflow.com/q/23241600
tags question: http://stackoverflow.com/q/23245068
tags question: http://stackoverflow.com/q/23287655
tags question: http://stackoverflow.com/q/23270818
tags question: http://stackoverflow.com/q/23279367
tags question: http://stackoverflow.com/q/23185749
tags question: http://stackoverflow.com/q/23225192
tags question: http://stackoverflow.com/q/23249331
tags question: http://stackoverflow.com/q/23138328
tags question: http://stackoverflow.com/q/23254012
tags question: http://stackoverflow.com/q/23284095

http://stackoverflow.com/a/24269202
answers question: http://stackoverflow.com/q/23189984
type: Answer
accepted answer of: http://stackoverflow.com/q/23189984
upvote count: 1
score: 1
has body: Please follow the below steps: Add the spring.jar into your project In the web.xml file, add the following piece of code contextConfigLocation /WEB-INF/acegi-security-config.xml Acegi Filter Chain Proxy org.acegisecurity.util.FilterToBeanProxy targetClass org.acegisecurity.util.FilterChainProxy Acegi Filter Chain Proxy /* AuthenticatedFilter com.security.AuthenticatedFilter AuthenticatedFilter action org.springframework.web.context.ContextLoaderListener acegi-security-config.xml, is the spring security configuration file
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/35656106
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23215847
has text: As Dave said, feel free to register JIRA issue for that
score: 0

http://stackoverflow.com/comment/35602432
comment on: http://stackoverflow.com/a/23263503
type: AnswerComment
has text: @EJP please provide me the some document I will try.
score: 0
type: Comment

http://stackoverflow.com/a/23196155
answers question: http://stackoverflow.com/q/23195835
type: Answer
has body: You may try like codes : public static final String URLPREFIX = "http://url/api"; HttpGet httpget = new HttpGet(URLPREFIX + "/method_name/token/" + mAuthKey); Log.e(TAG, "" + URLPREFIX + "/method_name/token/" + mAuthKey); try { // Execute HTTP Post Request HttpResponse response = httpclient.execute(httpget); HttpEntity entity = response.getEntity(); String jsonResponse = EntityUtils.toString(entity); Log.e(TAG, "entity: " + jsonResponse); JSONObject jsonObject = new JSONObject(jsonResponse); JSONArray jsonArray = jsonObject.getJSONArray("collection"); for (int i = 0; i &lt; jsonArray.length(); i++) { JSONObject mFirstChild = jsonArray.getJSONObject(i); int mId = Integer.parseInt(mFirstChild.getString("id")); String mTitle = mFirstChild.getString("title"); arrayList.add(new CustomClass(mId, mTitle)); } } catch (Exception e) { e.printStackTrace(); }
score: 0

http://stackoverflow.com/a/23252741
has body: Code is calling: BankAccount account = new BankAccount(init); which goes to this constructor: public BankAccount(double initialBalance){ balance = initialBalance; } if you also want to get the other constructor being called (the one that assign the id), you need to change it as follow: public BankAccount(double initialBalance){ this(); balance = initialBalance; } Java doesn't call the default constructor if you don't tell it.
answers question: http://stackoverflow.com/q/23252646
type: Answer
downvote count: 0
score: 1
upvote count: 1

http://stackoverflow.com/a/23170737
answers question: http://stackoverflow.com/q/23170675
has comment: http://stackoverflow.com/comment/35436593
has comment: http://stackoverflow.com/comment/35435733
has body: The textfield's getText method is designed to get a String not an array Yes Java has String as it's first Love. Let me give you an Idea how can you do it. As you have mentioned you need to use JTextField Enter Numbers Using Separator (Ex. 1,2,5,60) Retrive it and Store it as String Use split() function to get all numbers in String array. Use Integer.parseInt("1") method to convert String to int. For Example: String str=jt.getText();//JtextField Has text as 1,3,4,55,10 String strA[]=new String[5]; strA=str.split(",") int intA[]=new int[5]; for(int i=0;i&lt;array.length;i++) { intA[i]=Integer.parseInt(strA[i]); } NOTE: It will only work for specific numbers say here I am passing 5 but if you pass 6 than it will give you IndexOutOfBound Exception.So in that case it would be better to use ArrayList
has comment: http://stackoverflow.com/comment/35826216
accepted answer of: http://stackoverflow.com/q/23170675
has comment: http://stackoverflow.com/comment/35435146
score: 2
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/35436320
type: Answer
has comment: http://stackoverflow.com/comment/35437565
upvote count: 2
has comment: http://stackoverflow.com/comment/35436376
has comment: http://stackoverflow.com/comment/35435222
has comment: http://stackoverflow.com/comment/35446936
has comment: http://stackoverflow.com/comment/35436699

http://stackoverflow.com/comment/35616880
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23272098
has text: At the end of the day every method throws RuntimeExceptions already so there is no point in adding a throws declaration for every potential RuntimeException. Partly because there is no way to know just what runtime issues may arise. Maybe you'll run out of memory. Maybe the thread will get terminated. Do you really want to see those added as declared exceptions on every java method? It is the fault of the API developer for not documenting unchecked exceptions properly.
type: AnswerComment

http://stackoverflow.com/comment/51336260
comment on: http://stackoverflow.com/q/23252378
score: 0
has text: did you find a solution? I'm facing the same problem
type: QuestionComment
type: Comment

http://stackoverflow.com/a/23286123
has comment: http://stackoverflow.com/comment/35644259
has body: 1. In your create table String, String newTableQueryString = "create table " + TABLE_NAME + " (" + TABLE_ROW_ID + " integer primary key autoincrement not null, " + TABLE_ROW_ONE + " text, " + TABLE_ROW_TWO + " text, " + TABLE_ROW_THREE + " text, " + TABLE_ROW_FOUR + " text" + ");"; The ROW_ID is an integer, so in your function updateRow(), the data type for parameter of rowID should be integer, which is passed in the "where" clause. So should change -> public void updateRow(long rowID, String rowStringOne,... 2. To identify the row you have added, you need to have a primary key which you will be able to identify on the basis of the entry. Auto increment integer is good for ensuring that the database will have a new row each time, but the primary key you need should be something you will know to differentiate entries. Can try a derived key which would be another column in your db, to insert the same with adding rows would be like: String customPrimaryKey="UserName.getText().toString()+FirstName.getText().toString()+txtPassword.getText().toString()"; db.updateRow ( UserName.getText().toString(), FirstName.getText().toString(), LastName.getText().toString(), txtPassword.getText().toString(), // add one more value for a particular entry-a primary key for You to identify that row customPrimaryKey ); So you have a way to identify which row to update then, and pass the same in the updateRow() parameters for the where clause
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23285447
has comment: http://stackoverflow.com/comment/35643816
answers question: http://stackoverflow.com/q/23285447
type: Answer
has comment: http://stackoverflow.com/comment/35644065
score: 0

http://stackoverflow.com/comment/35619938
comment on: http://stackoverflow.com/q/23272833
score: 0
type: Comment
type: QuestionComment
has text: Which version of the JDBC driver are you using? See also http://connect.microsoft.com/SQLServer/feedback/details/683176/jdbc-driver-3-0-casts-all-datetime-parameters-as-datetime2

http://stackoverflow.com/a/23202981
type: Answer
has body: The problem was that I was closing the http client too early i.e. client.close() before I tried to retrieve the response InputStream with a call to response.getEntity().getContent().
score: 0
answers question: http://stackoverflow.com/q/23197096

http://stackoverflow.com/q/23260421
tagged with: gridview
answer count: 0
score: 0
type: Question
tagged with: java
has title: create dynamic textview and grid view or list view dynamically
tagged with: textview
has body: @Override protected void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); setContentView(R.layout.table1); lv =getListView(); category_main = ""; new Getitems().execute(category_main); sub = (Button) findViewById(R.id.submit); sub.setOnClickListener(this); b =(Button) findViewById(R.id.start); b.setOnClickListener(this); itemList = new ArrayList&lt;HashMap&lt;String, String&gt;&gt;(); } @Override public void onClick(View arg0) { switch(arg0.getId()){ case R.id.start: try { Log.d("start","click"); onbuttonclick(); } catch (JSONException e) { e.printStackTrace(); } break; case R.id.submit: Log.d("submi","click"); onsubmitclick(); break; } } private void onsubmitclick() { Log.d("submi inside","click"); EditText et = (EditText) findViewById(R.id.EditText05); EditText et1 = (EditText) findViewById(R.id.EditText06); TextView tx= (TextView) findViewById(R.id.name); String json = "{'Order':["; if(!et.equals(str)){ Log.d("json", "json"); String stra = "{'Table_id':"+Second.a+",'item_name':'"+tx.getText()+"','Item_quantity':'"+et.getText()+"','Item_additionaldetails':'"+et1.getText()+"'}"; json = json+stra; } json = json + "]}"; Log.d("json", json); } private void onbuttonclick() throws JSONException { TableRow[] tr = new TableRow[arry1.length]; final TextView[] tx = new TextView[arry1.length]; GridLayout tl = (GridLayout) findViewById(R.id.tablelayout1); tl.setRowCount(arry1.length*2); tl.setColumnCount(1); final Button but = new Button(S1.this); b.setText("hi"); gl = new GridLayout[arry1.length]; for (i = 0; i &lt; arry1.length; i++) { final String cat = arry1[i].toString(); tx[i] = new TextView(S1.this); tx[i].setLayoutParams(new TableRow.LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT)); tx[i].setAllCaps(true); tx[i].setTextSize(15); tx[i].setText(cat); tr[i] = new TableRow(S1.this); tr[i].setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT)); tr[i].addView(tx[i],new TableRow.LayoutParams(LayoutPara…
has comment: http://stackoverflow.com/comment/35596985
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/35596537

http://stackoverflow.com/q/23176527
tagged with: java
score: 0
has title: array out of bounds exce.. creating multidimensional array from mysql table
tagged with: arrays
answer count: 1
tagged with: multidimensional-array
has comment: http://stackoverflow.com/comment/35445489
type: UnansweredQuestion
tagged with: mysql
has body: So I've been trying to create a String[][] extracting its items from a database using JDBC but haven't been able to get the results into String[][] what am I doing wrong I get this error: java.lang.ArrayIndexOutOfBoundsException: 4 at modelo.ConectorBaseDatos.getRows_From_DB(ConectorBaseDatos.java:194) at modelo.ConectorBaseDatos.main(ConectorBaseDatos.java:237) line 194 is: rows_list[rows][cols] = result.getString(2); Here is the code: public String[][] getRows_From_DB(String tableName, String db, String querY){ try{ int columnCount = this.getTableInfo(tableName, db, true, false) - 1; int rowCount = this.getTableInfo(tableName, db, false, true) - 1; rows_list = new String[rowCount][columnCount]; Connection con = getConnect_to_DB("fifa"); PreparedStatement statement = con.prepareStatement(querY); ResultSet result = statement.executeQuery(); while(result.next()){ for(int rows = 1; rows &lt;= rowCount; rows++){ for(int cols = 1; cols &lt;= columnCount; cols ++){ rows_list[rows][cols] = result.getString(2); rows_list[rows][cols] = result.getString(3); rows_list[rows][cols] = result.getString(4); rows_list[rows][cols] = result.getString(5); } } } }catch(Exception e){ e.printStackTrace(); JOptionPane.showMessageDialog(null, "Error en getRows_From_DB()" + e, "ERROR!", JOptionPane.ERROR_MESSAGE, null); } return rows_list; }
type: Question
has answer: http://stackoverflow.com/a/23176724

http://stackoverflow.com/comment/35429478
type: AnswerComment
has text: The mistake was on my part! I gave the wrong collection name. The name of my collection is "idx" and i specified it as e.text()
type: Comment
comment on: http://stackoverflow.com/a/23167311
score: 0

http://stackoverflow.com/comment/35598293
type: Comment
type: QuestionComment
score: 1
has text: You need to explain in much more detail what "SSHing through a program" really means.
comment on: http://stackoverflow.com/q/23261954

http://stackoverflow.com/comment/35397228
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23149169
score: 0
has text: What is the use of the `Exception` in the method?

http://stackoverflow.com/a/23224886
has comment: http://stackoverflow.com/comment/35837903
type: Answer
upvote count: 1
has body: There are a lot of problems with your code. Here are some fixes for them: Do your input stream declarations using a "try-with-resources" statement. Every single input/output element should be wrapped this way; it makes it far easier to reuse code later. You need to add javadoc comments to your code. Encapsulate the palindrome checking in its own function. By refactoring out the decision logic from the input/output logic, you can make the code much clearer and more concise. Write a method to fill this signature: public static boolean isPalindrome(String word) Simplify the palindrome checking algorithm. All you need to do is check that the word is itself reversed. Nothing fancy. For instance, you can do this: public static boolean isPalindrome(String word){ return String.valueOf(Arrays.reverse(word.toCharArray())).equals(word); } This is not only easier to read, it is actually faster too. Change the prompt structure. Do they really need to tell you every time that they want to input another word? I would recommend using the 'leave blank to quit' exit type. The prompt could then be: System.out.print("Enter a word (leave blank to quit):"); Use a loop-and-a-half to accomplish the prompt cycle, instead of inventing your own inferior loop pattern: public static void main(String [] args) { try(Scanner in = new Scanner(System.in), PrintWriter out = System.out){ while(true){ out.print("Enter a word (leave blank to quit):"); String word = in.nextLine() if(in.isEmpty()) break; out.printf("%s is%s a palindrome.%n", word, isPalindrome(word)?" not":""); } } } All this code accomplishes the exact same thing as what you wrote, but is more concise, clearer, and faster.
has comment: http://stackoverflow.com/comment/35837948
downvote count: 1
has comment: http://stackoverflow.com/comment/35834190
score: 0
answers question: http://stackoverflow.com/q/23224188

http://stackoverflow.com/comment/35588150
score: 0
type: AnswerComment
type: Comment
has text: of person who needs lots of examples and thorough explanations if I'm going to actually learn something and not just mimic examples I find online.
comment on: http://stackoverflow.com/a/23254218

control-flow
tags question: http://stackoverflow.com/q/23153413
type: Tag
tag name: control-flow

http://stackoverflow.com/comment/35619351
has text: also the method getProperty(String, bool) only accesses data, doesn't modify it, so that is fairly thread safe on its own.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23273378

http://stackoverflow.com/comment/35581430
comment on: http://stackoverflow.com/a/23252901
type: Comment
has text: Looking at the contents of DBInfo, it's not meant to be an interface either.
score: 0
type: AnswerComment

http://stackoverflow.com/q/23272069
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/35617103
has comment: http://stackoverflow.com/comment/35616492
has comment: http://stackoverflow.com/comment/35617234
has comment: http://stackoverflow.com/comment/35617186
upvote count: 2
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/35617390
has body: I have been looking through major Android SDK's (Facebook, Google+, and even Android). What I have noticed is that exceptions never seem to be included in method signatures. Instead what I see is that Exceptions are thrown, but usually only listed in the docs (if you are lucky). What is up with this practice? Is there some manifesto declaring exceptions in method signatures evil? Examples: From android.database.AbstractCursor void checkPosition() This function throws CursorIndexOutOfBoundsException if the cursor position is out of bounds. Why this and not void checkPosition() throws CursorIndexOutOfBoundsException I prefer the latter since you can set up your IDE/compiler to actually warn you instead of just praying to the bytecode that the docs mention what is acutally being thrown.
answer count: 2
has answer: http://stackoverflow.com/a/23272107
has answer: http://stackoverflow.com/a/23272098
score: 2
downvote count: 0
linked to: http://stackoverflow.com/q/6115896
favorite count: 0
has title: Why are exceptions not being added to signatures?

http://stackoverflow.com/comment/35594920
score: 0
type: QuestionComment
type: Comment
has text: thank you so much for the help, I forget to import because I think it is imported automatically by netbeans
comment on: http://stackoverflow.com/q/23260202

http://stackoverflow.com/a/23138739
answers question: http://stackoverflow.com/q/23138528
score: 0
type: AcceptedAnswer
type: Answer
has body: If you annotate the totalMinutes property on the DateMinutesHours class with @XmlValue then you will get the behaviour you are lookiing for.
accepted answer of: http://stackoverflow.com/q/23138528

http://stackoverflow.com/a/23176765
has body: "Embedded" means that you program ships with the server within it as opposed to a web application being deployed to external server. With embedded server your application is packaged with the server of choice and responsible for server start-up and management. From the user standpoint the difference is: Application with embedded server looks like a regular java program. You just launch it and that's it. Regular web application is usually a war archive which needs to be deployed to some server Embedding a server is very useful for testing purposes where you can start or stop server at will during the test.
type: Answer
upvote count: 27
has comment: http://stackoverflow.com/comment/73430379
accepted answer of: http://stackoverflow.com/q/23176717
downvote count: 0
answers question: http://stackoverflow.com/q/23176717
score: 27
type: AcceptedAnswer

http://stackoverflow.com/q/23245211
tagged with: java
score: 0
answer count: 2
has title: Interfaces and Abstract Classes in Java
has answer: http://stackoverflow.com/a/23246126
tagged with: abstract-class
has body: Does interfaces and abstract classes in Java extend base Object class? Logical answer which I can think of is no, but if interface does not extend Object class, then can please someone explain me the below code: interface A { @Override public int hashCode(); @Override public String toString(); } In above case, A interface is the new interface declared. Yet, no class is implementing it. Then how come the methods from Object class visible in the interface? If it doesn't extend Object class, then why I can't declare following method in the interface: public Class getClass(); When I tried to declare this method in the interface, it says that it can't override this method, inherited from Object class, as it is declared as final method in Object class.
type: UnansweredQuestion
tagged with: interface
has answer: http://stackoverflow.com/a/23245277
linked to: http://stackoverflow.com/q/13776018
type: Question
has comment: http://stackoverflow.com/comment/35567223

http://stackoverflow.com/a/23257476
has comment: http://stackoverflow.com/comment/35727033
has comment: http://stackoverflow.com/comment/35639438
answers question: http://stackoverflow.com/q/23242934
has comment: http://stackoverflow.com/comment/35710623
has body: What version of JavaMail are you using? What does the protocol trace show? This usually only happens when the message is incorrectly formatted or encoded.
has comment: http://stackoverflow.com/comment/35600284
score: 0
type: Answer

http://stackoverflow.com/comment/35400635
type: QuestionComment
score: 1
has text: None if you just want simple screen based applications, if you want to be able to reuse your stuff, use fragments.
comment on: http://stackoverflow.com/q/23151348
type: Comment

http://stackoverflow.com/comment/35644598
comment on: http://stackoverflow.com/q/23266229
type: QuestionComment
type: Comment
has text: @Shombol-shagol read this before deciding to delete. i suggest its a bad idea. http://stackoverflow.com/help/question-bans
score: 0

http://stackoverflow.com/comment/35623775
type: Comment
score: 1
type: AnswerComment
has text: I guess most people simply run K-Means a number of times (say 100), and then choose the clustering with the smallest K-Means output. If your data set is too large for you to run K-Means so many times, I'd suggest Intelligent K-Means.
comment on: http://stackoverflow.com/a/23249961

http://stackoverflow.com/q/23143656
downvote count: 0
favorite count: 0
tagged with: binding
type: UnansweredQuestion
has body: How can I check the input a user made via a WOTextField? These are my bindings: fristName : WOTextField { value = session.customerOrder.customer.firstName; } and here's the Javacode: public WOComponent confirmationpage() { //Some code try { if (!session.customerOrder().customer().firstName().isEmpty()) { dataValid = true; } } catch (Exception e) { e.printStackTrace(); whatsMissing += "Firstname "; dataValid = false; } //More code } How can I check the user's input without to store it into a var?
score: 2
tagged with: project-wonder
answer count: 0
upvote count: 2
tagged with: java
type: Question
tagged with: session
has title: Validate user's input via WOTextField
tagged with: validation

http://stackoverflow.com/a/23243313
has comment: http://stackoverflow.com/comment/35564648
has body: If you are using JRE 6 then you can use the Endpoint.publish() method to create an in-app server and expose a service. Refer the simple tutorial in the link to see an example of the same. How the Endpoint.publish() works is it internally creates a light weight server and makes the SOAP service available on that location.
answers question: http://stackoverflow.com/q/23219707
score: 0
type: Answer

http://stackoverflow.com/a/25007559
answers question: http://stackoverflow.com/q/23209125
score: 12
has body: Right-click on the project Select properties Java build path Library > Add Library > Add JRE SYSTEM Library Execution Environment Select JavaSE-1.7 Finish
type: Answer
downvote count: 1
has comment: http://stackoverflow.com/comment/54314713
upvote count: 13

http://stackoverflow.com/comment/35539585
has text: @JoachimIsaksson you should post that as an answer.
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/23228960

http://stackoverflow.com/a/23227094
has comment: http://stackoverflow.com/comment/35537992
type: Answer
has body: Try this--> convert('string' using utf8) or convert('string',char) or convert('string' using latin1) or use whatever the character encoding is that you have set in the table. The code I have provided are mysql functions.
answers question: http://stackoverflow.com/q/23224512
score: 0

http://stackoverflow.com/q/23161407
has comment: http://stackoverflow.com/comment/35419017
has answer: http://stackoverflow.com/a/23319588
has comment: http://stackoverflow.com/comment/35431624
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35418906
linked to: http://stackoverflow.com/q/15587177
has comment: http://stackoverflow.com/comment/35418868
has answer: http://stackoverflow.com/a/26818872
tagged with: non-recursive
linked to: http://stackoverflow.com/q/1294701
has body: Forgive me if its asked before but i couldn't find appropriate answer. I have an major issue in converting binary search tree traversal written with recursive method into non recursive method. kindly help me out. Here is a code using recursive method in java. //BinarySt class public interface BinaryST { public void insert(Integer nData); public Integer remove(Integer nData); public boolean isExist(Integer nData); public String preOrder(); public String inOrder(); public String postOrder(); } //BinaryTreeNode class public class BinaryTreeNode { Integer element; BinaryTreeNode LChild; BinaryTreeNode RChild; BinaryTreeNode() {} } //BinarySearchTree implements BinaryST class public class BinarySearchTree implements BinaryST{ protected StringBuffer s; protected BinaryTreeNode root; public BinarySearchTree() {} public BinarySearchTree(Integer nData) { root = new BinaryTreeNode(); root.element = nData; } public void insert(Integer nData) { if( root==null ) { root = new BinaryTreeNode(); root.element = nData; return; } boolean flag=true; BinaryTreeNode c=root; while(flag) { if( nData&gt;=c.element ) { if( c.RChild==null ) { c.RChild = new BinaryTreeNode(); c.RChild.element = nData; flag = false; } c = c.RChild; } else { if( c.LChild==null ) { c.LChild = new BinaryTreeNode(); c.LChild.element = nData; flag = false; } c = c.LChild; } } } public Integer remove(Integer nData) { return new Integer(5); } public boolean isExist(Integer nData) { return true; } public String preOrder() { if( root==null ) { return new String( "null" ); } s = new StringBuffer(""); prOrder( root ); return new String(s); } public String inOrder() { if( root==null ) { return new String( "null" ); } s = new StringBuffer(""); iOrder( root ); return new String(s); } public String postOrder() { if( root==null ) { return new String( "null" ); } s = new StringBuffer(""); poOrder( root ); return new String(s); } private void prOrder(BinaryTreeNode t) { if( t!=null ) { s.append( t.element.toString() + " " ); prO…
tagged with: java
has title: how to convert binary search tree traversal recursion into non-recursive method in java
type: Question
tagged with: recursive-datastructures
tagged with: traversal
score: 0
answer count: 2

http://stackoverflow.com/comment/35728646
score: 0
type: Comment
type: QuestionComment
has text: Hi @alihaider i have updated the nginix file content above. nhinix redirect the user to cas login page .but after providing log -in information the web page gives error regarding infinite loop.How will the user be redirected to main application.Do need to make entries in cas application or this is to be handled by nginix.Please guide me.
comment on: http://stackoverflow.com/q/23284114

http://stackoverflow.com/q/23249657
has title: How to Upload Files with WebView in Android Studio?
favorite count: 0
has body: I'm looking for help with this code. I need to add that you can upload files from this application. But I can not make it work as well .... So this works great. What I could do is download, but not upload files. As I can do? I leave the code below. please be explicit and specific.Consider that only supports Android 3.0>. I mean this is a WebView which one when you are on the website Facebook touches the button to upload an image and a box that lets you choose if you take a picture or look in the device is opened. I want that. As I can do? public class MainActivity extends ActionBarActivity { private WebView mWebView; private ProgressBar progressBar; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mWebView = (WebView) findViewById(R.id.activity_main_webview); // Enable Javascript WebSettings webSettings = mWebView.getSettings(); webSettings.setJavaScriptEnabled(true); mWebView.loadUrl("file:///android_asset/www/index.html"); // Force links and redirects to open in the WebView instead of in a browser mWebView.setWebViewClient(new WebViewClient()); // enable local storage // enable local storage mWebView.setDownloadListener(new DownloadListener() { public void onDownloadStart(String url, String userAgent, String contentDisposition, String mimetype, long contentLength) { Intent i = new Intent(Intent.ACTION_VIEW); i.setData(Uri.parse(url)); startActivity(i); } }); webSettings.setBuiltInZoomControls(true); webSettings.setSupportZoom(true); progressBar = (ProgressBar) findViewById(R.id.progressbar); mWebView.setWebChromeClient(new WebChromeClient() { @Override public void onProgressChanged(WebView view, int progress) { progressBar.setProgress(0); progressBar.setVisibility(View.VISIBLE); MainActivity.this.setProgress(progress * 1000); progressBar.incrementProgressBy(progress); if (progress == 100) { progressBar.setVisibility(View.GONE); } } }); } @Override public void onBackPressed() …
linked to: http://stackoverflow.com/q/15442843
tagged with: android
tagged with: download
downvote count: 0
type: UnansweredQuestion
tagged with: webview
has answer: http://stackoverflow.com/a/23250307
type: Question
score: 1
tagged with: java
upvote count: 1
answer count: 1

http://stackoverflow.com/comment/35544446
type: AnswerComment
has text: Good point. For my current application, I only have one invalid character which is the replacement character for illegal UTF-8 characters.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23227584

http://stackoverflow.com/a/23175969
has comment: http://stackoverflow.com/comment/35446643
downvote count: 0
has comment: http://stackoverflow.com/comment/35446661
has comment: http://stackoverflow.com/comment/35444716
has body: Thread.stop has been deprecated since it is unsafe (see the Javadoc). Instead have each thread monitor a boolean flag of some sort (see Java: How to stop thread? and likely countless other threads on SO). In situations like this I typically implement some sort of thread pool manager that is responsible for cleanly shutting down running threads. Then when something really bad happens you only need to notify the manager to shut things down.
upvote count: 2
answers question: http://stackoverflow.com/q/23175316
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23175316
type: Answer
score: 2

http://stackoverflow.com/q/23251525
tagged with: java
tagged with: mysql
has answer: http://stackoverflow.com/a/23252172
type: Question
has comment: http://stackoverflow.com/comment/35579149
has comment: http://stackoverflow.com/comment/35578885
score: 0
answer count: 1
type: UnansweredQuestion
has title: Saving parsed html to mysql database
has body: I print the results below with system.out.println however I want to pass the list of results into an insertdata.java class that will insert the data into a mysql database table. The results below are a small section but there are 8 columns in my table then I want it to move on to the next row if that makes sense. 13.0kts ENE 0 x 0 x 0 unspecified 212230000 212230000 Cy [CY] Unknown unknown 5.6kts rough thought so far, any idea how I can do this without php? Class.forName("com.mysql.jdbc.Driver"); Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/fishtrax", "username", "passw0rd"); PreparedStatement ps=con.prepareStatement("insert into ships values(?,?,?,?,?,?,?,?)"); } catch(Exception e) { e.printStackTrace(); } UPDATED SO FAR: InsertData.java Class.forName("com.mysql.jdbc.Driver"); Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/fishtrax", "username", "passw0rd"); PreparedStatement ps=con.prepareStatement("insert into ships values(?,?,?,?,?,?,?,?)"); ps.setString(1,shipSpeed); ps.setString(2,shipDirect); ps.setString(3,shipSize); ps.setString(4,shipSpeed); ps.setString(5,mmsi); ps.setString(6,shipName); ps.setString(7,shipDest); ps.setString(8,shipEta); ps.executeUpdate(); fileParser.java File input = new File("shipMove.txt"); Document doc = Jsoup.parse(input, null); Elements tables = doc.select("table.shipInfo"); for( Element element : tables ){ Elements tdTags = element.select("td"); // Iterate over all 'td' tags found for( Element td : tdTags ){ // Print its text if not empty final String text = td.text(); if( text.isEmpty() == false) { if (td.getElementsByTag("a").first() != null) { // Get the attribute value String url = td.getElementsByTag("a").first().attr("href"); // Check for nulls here and take the substring from '=' onwards String id = url.substring(url.indexOf('=') + 1); System.out.println(id); System.out.println(td.text()); } else { System.out.println(td.text()); } } }

http://stackoverflow.com/comment/35597661
has text: What do you mean by "clean"?
comment on: http://stackoverflow.com/q/23260775
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35532392
has text: Why do you need the sleep part exactly?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23225359

http://stackoverflow.com/q/23227706
tagged with: regex
has title: Check for underscore wrapped any valid Windows filename characters except underscore and csv extension
has body: I'm still very new to regex, so I think I can determine whether a string ends with a case-insensitive .csv: (\\.(?i)(csv)) However, I do not know how to check that everything before that is at least one valid Windows filename character except an underscore, one underscore, and at least one valid Windows filename character except an underscore. How can this be done?
tagged with: filenames
tagged with: file-extension
tagged with: java
upvote count: 1
answer count: 1
has answer: http://stackoverflow.com/a/23227773
type: AnsweredQuestion
downvote count: 0
score: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/23227773
type: Question
tagged with: windows

http://stackoverflow.com/comment/35539746
has text: `catch(Exception ex) {}` you should probably log the exception instead of ignore it, especially if, say, something is going wrong, and you don't know what
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/23229488
type: Comment

http://stackoverflow.com/q/23255870
has answer: http://stackoverflow.com/a/23256029
has title: How do I use different prefixes when renaming multiple files in Java?
upvote count: 1
accepted answer: http://stackoverflow.com/a/23256223
type: Question
tagged with: file-rename
tagged with: http://stackoverflow.com/tag/pdf
downvote count: 0
tagged with: directory
has body: I am trying to create a Java app (with swing) which renames pdf files with a set naming convention. Currently the files are named: 1.pdf, 2.pdf...... 10.pdf, 11.pdf...... 20.pdf, 21.pdf etc. So I decide to add a prefix (ABC_0) to the file name. The new file names should be: ABC_01.pdf, ABC_02.pdf.... ABC_10.pdf, ABC_11.pdf...... ABC_20.pdf, ABC_21.pdf etc. So far everything is working well. The only problem I am facing is that when the prefix gets added to a pdf file name with a number 10 and above, it's renamed as: ABC_010.pdf, ABC_011.pdf...... ABC_020.pdf, ABC_021.pdf etc. This is wrong. The 0 should only be added to the pdf file names with a number 1–9 in it. Could you please help me? This is the code that I need help with. { String dir= txt_src.getText(); String addPrefix= "ABC_0"; File dirFile,dirFile1; File oldfile, newfile; String newname; String filenames[]; int i, count; dirFile = new File(dir); if (!dirFile.exists() || !dirFile.isDirectory()) { message("File not exist or not a directory"); } filenames = dirFile.list(); for(i = count = 0; i &lt; filenames.length; i++) { if (filenames[i].equals(".")) continue; if (filenames[i].equals("..")) continue; dirFile1 = new File(dir+"\\"+filenames[i]); if (!dirFile1.isDirectory()) {oldfile = new File(dirFile, filenames[i]); newname = addPrefix + filenames[i]; newfile = new File(dirFile, newname); message("Files Renamed Successfully"); if (oldfile.renameTo(newfile)) count++; else { message("Unable to rename " + oldfile); } } } }
has answer: http://stackoverflow.com/a/23256164
favorite count: 0
has answer: http://stackoverflow.com/a/23256223
tagged with: prefix
answer count: 4
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/23256008
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/23256008

http://stackoverflow.com/q/23219225
tagged with: hadoop
has body: I am running a MapReduce program and encountered with the below error. 14/04/22 07:44:02 INFO mapred.JobClient: Cleaning up the staging area cfs://XX.XXX.XXX.XXX/tmp/hadoop-cassandra/mapred/staging/psadmin/.staging/job_201404180932_0063 14/04/22 07:44:02 ERROR security.UserGroupInformation: PriviledgedActionException as:psadmin cause:java.io.IOException: Could not get input splits Exception in thread "main" java.io.IOException: Could not get input splits at org.apache.cassandra.hadoop.AbstractColumnFamilyInputFormat.getSplits(AbstractColumnFamilyInputFormat.java:193) at org.apache.hadoop.mapred.JobClient.writeNewSplits(JobClient.java:962) at org.apache.hadoop.mapred.JobClient.writeSplits(JobClient.java:979) at org.apache.hadoop.mapred.JobClient.access$600(JobClient.java:174) at org.apache.hadoop.mapred.JobClient$2.run(JobClient.java:897) at org.apache.hadoop.mapred.JobClient$2.run(JobClient.java:850) at java.security.AccessController.doPrivileged(Native Method) at javax.security.auth.Subject.doAs(Unknown Source) at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1121) at org.apache.hadoop.mapred.JobClient.submitJobInternal(JobClient.java:850) at org.apache.hadoop.mapreduce.Job.submit(Job.java:500) at org.apache.hadoop.mapreduce.Job.waitForCompletion(Job.java:530) at MultiOutMR.run(MultiOutMR.java:95) at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:65) at MultiOutMR.main(MultiOutMR.java:36) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.apache.hadoop.util.RunJar.main(RunJar.java:156) Caused by: java.util.concurrent.ExecutionException: java.lang.RuntimeException: org.apache.thrift.transport.TTransportException at java.util.concurrent.FutureTask.report(Unknown Source) at java.util.concurrent.FutureTask.get(Unknown Source) at org.…
has comment: http://stackoverflow.com/comment/35521305
upvote count: 0
has comment: http://stackoverflow.com/comment/35531936
has comment: http://stackoverflow.com/comment/35526235
answer count: 1
favorite count: 0
tagged with: cassandra
type: UnansweredQuestion
tagged with: datastax-enterprise
has title: java.io.IOException: Could not get input splits when run the MapReduce program
tagged with: java
has answer: http://stackoverflow.com/a/23225532
downvote count: 1
type: Question
score: -1

http://stackoverflow.com/comment/35449183
type: AnswerComment
type: Comment
score: 2
comment on: http://stackoverflow.com/a/23148941
has text: If an approach like the 1st "fixed" it for you, you're doing JSON-RPC wrong. You shouldn't try to just "print" the `result` field of the JSON-RPC envelope. It's a JSON "value", which could be a `String`, `Number`, `Object`, `Array` or the value `null`. Instead, you should determine what data-structure has been transmitted (or agree on a convention beforehand) such that you know what you've received and how it can be "printed".

http://stackoverflow.com/q/23160622
tagged with: netbeans
accepted answer: http://stackoverflow.com/a/23160722
has body: I'm working on an ASCII checkers program right now, and I'm trying to figure out how I should be storing my board state. Obviously I'll need a 2d int/short array(for states 'black', 'white', 'empty'), but I don't know how I should declare this so it is accessible from everywhere in the program, like I'll probably need. In procedural languages I've used in the past, global variables have been easy, but apparently globals in Java is a really bad practice. Also, I'm working under the constraint of one java file, so I don't know if that limits my options. I'm working in NetBeans, and for this assignment, it's supposed to be one .java file. Right now I'm just using public static int[][] checkersBoard; right before my main method inside my class. I'm pretty sure that's bad practice though Thanks! P.s. This is a bonus question, thats why I havn't been taught how to do this :P
type: AnsweredQuestion
has title: Global Variables in Object Oriented languages
has answer: http://stackoverflow.com/a/23160727
tagged with: java
tagged with: global-variables
type: Question
possible better answer: http://stackoverflow.com/a/23160727
has answer: http://stackoverflow.com/a/23160722
tagged with: variables
score: 0
answer count: 2

http://stackoverflow.com/a/23237247
score: 0
answers question: http://stackoverflow.com/q/23236561
type: Answer
has body: Yet another solution. Maybe you want to catch the minus sign regardless of white spaces and rather depending on its meaning, i. e. a binary-minus operator and not the minus sign before the numbers. You could have the case where you could have a binary-minus without any space at all, like in 3-5 or you could have a minus sign before the number with a space between them (which it is allowed in many programming languages, Java included). So, in order to catch your tokens properly (positive-negative-numbers and binary-operators) you can try this: public static void main(String[] args) { String numberPattern = "(?:-? *\\d+(?:\\.\\d+)?(?:E[+-]?\\d+)?)"; String opPattern = "[+*/-]"; Pattern tokenPattern = Pattern.compile(numberPattern + "|" + opPattern); String stringA = "-3.5 + -2 * 3 / 2"; Matcher matcher = tokenPattern.matcher(stringA); while(matcher.find()) { System.out.println(matcher.group().trim()); } } Here you are catching operators AND ALSO operands, regardless of white spaces. If you only need the binary operators, just filter them. Try with the string "-3.5+-2*3/2" (without spaces at all) and you'll have your tokens anyway.

http://stackoverflow.com/a/23141430
has body: In Java 8, the type inference is improved. You can do List&lt;String&gt; singletonList = Collections.singletonList("Hello"); singletonList.addAll(Collections.emptyList()); The type argument for the invocation of emptyList() will be inferred from the context it is used in, ie. it expects a Collection&lt;? extends String&gt;.
downvote count: 0
answers question: http://stackoverflow.com/q/23141323
type: Answer
score: 2
upvote count: 2

http://stackoverflow.com/comment/35590978
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23257924
has text: Yes you're right.. I'm not realy used to java.. More C# so I don't know all the keywords.. I will edit, thanks.
score: 0

http://stackoverflow.com/comment/35420462
has text: you mean how to do the PUT from java? see the spring framework and the RestTemplate client side utility, in this step by step guide https://spring.io/blog/2009/03/27/rest-in-spring-3-resttemplate
comment on: http://stackoverflow.com/a/23162220
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/23163592
has comment: http://stackoverflow.com/comment/35423044
has comment: http://stackoverflow.com/comment/35422942
has body: You'd just name the parameters on the request AddService?num1=12312&amp;num2=123123
score: 0
has comment: http://stackoverflow.com/comment/35422927
has comment: http://stackoverflow.com/comment/35423119
type: Answer
answers question: http://stackoverflow.com/q/23163578
has comment: http://stackoverflow.com/comment/35423063

http://stackoverflow.com/comment/35651630
score: 1
has text: Do other simple X applications work e.g. gedit?
comment on: http://stackoverflow.com/q/23288442
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35491317
has text: @AdamGent Yes, that was the problem, thanks.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23197096
score: 0

http://stackoverflow.com/comment/35627383
has text: valueSet needs to be volatile.
comment on: http://stackoverflow.com/q/23277565
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/a/31631812
has body: If you're using spring-boot-starter-parent in your pom, you simply add the following to your pom: org.springframework.boot spring-boot-maven-plugin Then do your mvn package. See this Spring docs page. A very important aspect here is to mention that the directory structure has to be src/main/java/nameofyourpackage
type: Answer
score: 16
answers question: http://stackoverflow.com/q/23217002
has comment: http://stackoverflow.com/comment/59279321
downvote count: 1
upvote count: 17

fractions
type: Tag
tags question: http://stackoverflow.com/q/23132982
tag name: fractions

http://stackoverflow.com/comment/35448615
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23178253
has text: Solved by Anubian. Thanks for trying :)
score: 0

http://stackoverflow.com/q/23267099
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35611284
tagged with: android
has answer: http://stackoverflow.com/a/23267287
has comment: http://stackoverflow.com/comment/35607123
has comment: http://stackoverflow.com/comment/35607112
answer count: 4
has comment: http://stackoverflow.com/comment/35607071
has comment: http://stackoverflow.com/comment/35607172
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/23267300
type: Question
has title: Syntax Error in R.java file
tagged with: eclipse
tagged with: r.java-file
has body: I had placed a text view on my page and i didn't realize I had misspelled the id it was meant to be txtTick but instead I had hit the / and it was txt/tick. I corrected this error however it had saved to my R.java file and i keep getting the error. Syntax error on token "/" ,, expected. However I cant modify this file and I don't want to touch it encase something else happens. I have checked my strings.xml and that string doesn't exist anymore. I am unable to clean my project because of this error and have tried restarting it as well but have no idea how I can fix this. Any ideas? R.Java public static final int txt/tick=0x7f050089; xml android:id="@+id/txtTick"
has answer: http://stackoverflow.com/a/23267225
has comment: http://stackoverflow.com/comment/35607099
has answer: http://stackoverflow.com/a/23267453

http://stackoverflow.com/comment/35542384
has text: It's an odd task but HTTP connections do start with a socket connection. It's what you send (via `out.print(...)`) and how you process the respons (received via `in.read()`) that makes the protocol (like HTTP). Sending an HTTP get-request (and receiving a response) can be done this way, but it's usually not how it is done.
comment on: http://stackoverflow.com/a/23213051
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/23277034
tagged with: android
tagged with: android-studio
tagged with: java
tagged with: gradle
type: Question
has answer: http://stackoverflow.com/a/23506159
has title: Gradle aapt not a file
score: 0
answer count: 1
linked to: http://stackoverflow.com/q/18928164
tagged with: build-error
has body: I try to build a android app with android studio. Gradle throws this error when i try to build: Gradle invocation completed successfully with 1 error(s) in 10 sec and the message gradle build window shows: Error:Execution failed for task ':SlidingUpPanelLayout:processReleaseResources'. java.io.IOException: Cannot run program "/home/[...]/android-studio/sdk/build-tools/19.0.2/aapt": error=2, No such file or directory but ls -l shows me this files: ~/development/android-studio/sdk/build-tools/19.0.2$ ls -l total 49348 -rwxr-xr-x 1 david david 1109734 Apr 12 12:29 aapt -rwxr-xr-x 1 david david 271551 Apr 12 12:29 aidl -rwxr-xr-x 1 david david 3570836 Apr 12 12:29 arm-linux-androideabi-ld -rwxr-xr-x 1 david david 36534 Apr 12 12:29 bcc_compat -rwxr-xr-x 1 david david 445402 Apr 12 12:29 dexdump -rwxr-xr-x 1 david david 2577 Apr 12 12:29 dx -rwxr-xr-x 1 david david 3570836 Apr 12 12:29 i686-linux-android-ld drwxr-xr-x 2 david david 4096 Apr 12 12:29 lib -rwxr-xr-x 1 david david 332357 Apr 12 12:29 libbcc.so -rwxr-xr-x 1 david david 932160 Apr 12 12:29 libbcinfo.so -rwxr-xr-x 1 david david 15372369 Apr 12 12:29 libclang.so -rwxr-xr-x 1 david david 21101517 Apr 12 12:29 libLLVM.so -rwxr-xr-x 1 david david 1667769 Apr 12 12:29 llvm-rs-cc -rwxr-xr-x 1 david david 1919720 Apr 12 12:29 mipsel-linux-android-ld -rw-r--r-- 1 david david 10800 Apr 12 12:29 NOTICE.txt drwxr-xr-x 5 david david 4096 Apr 12 12:29 renderscript -rw-r--r-- 1 david david 16649 Apr 12 12:29 source.properties why say gradle the the aapt is not a file? whats wrong with it?
type: UnansweredQuestion

http://stackoverflow.com/a/51065616
downvote count: 0
score: 4
answers question: http://stackoverflow.com/q/23260057
type: Answer
has body: I recently stuck in with this error while building my containerized jar applications with Bamboo: org.apache.maven.surefire.booter.SurefireBooterForkException: The forked VM terminated without properly saying goodbye After many hours of researching I fixed it. And I thought it would be useful to share my solution here. So the error happen every time when bamboo run mvn clean package command for java applications in the docker containers. I am no Maven expert but the trouble was in Surefire and Junit4 plugins included in spring-boot as maven dependency. To fix it you need to replace Junit4 for Junit5 and override Surefire plugin in you pom.xml. 1.Inside spring boot dependency insert exclusion: org.springframework.boot spring-boot-starter-test test <!-- FIX BAMBOO DEPLOY> junit junit 2. Add new Junit5 dependencies: org.junit.jupiter junit-jupiter-api test org.junit.jupiter junit-jupiter-engine 5.1.0 test org.junit.vintage junit-vintage-engine 5.1.0 test org.junit.platform junit-platform-launcher 1.1.0 test org.junit.platform junit-platform-runner 1.1.0 test org.junit.platform junit-platform-surefire-provider 1.1.0 test 3. Insert new plugin inside plugins section org.apache.maven.plugins maven-failsafe-plugin org.apache.maven.plugins maven-surefire-plugin 2.19.1 org.junit.platform junit-platform-surefire-provider 1.1.0 org.junit.jupiter junit-jupiter-engine 5.1.0 That's should be enough to repair bamboo builds. Don't forget also transform all Junit4 tests to support Junit5.
upvote count: 4

http://stackoverflow.com/comment/35589967
type: QuestionComment
comment on: http://stackoverflow.com/q/23257181
score: 0
has text: You've already got the method inside of a class that extends JPanel, but you never seem to use instances of that JPanel anywhere. You need to add an instance of that class somewhere to your GUI for its paintComponent to show anything. Also, you still haven't fixed the paintComponent error that I mentioned in my first comment. Proof-reading your code has little to do with GUI coding and everything to do with taking care to avoid sloppy mistakes.
type: Comment

http://stackoverflow.com/comment/35589086
type: Comment
has text: @Sakthivel That's a new question. Without more details looks like you're calling a method with the wrong parameter types.
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/23246356

http://stackoverflow.com/comment/35590949
comment on: http://stackoverflow.com/q/23257930
type: Comment
type: QuestionComment
has text: `BufferedInputStream#read` reads only one byte.
score: 0

http://stackoverflow.com/comment/35649047
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23230781
has text: So, my research has brought up this link - http://lists.w3.org/Archives/Public/www-validator-css/2013Apr/0004.html - which suggests that that the problem is to do with same-domain URL redirection. "This is related to redirection but not in relation to a new domain. This occurs when a HTTP location header specifies a relative URL instead of an absolute URL."

http://stackoverflow.com/a/23229223
type: Answer
answers question: http://stackoverflow.com/q/23229124
has body: When you are doing alal.add(al);, you are not copying anything from al into alal, you are actually making the first element of alal be al (you are storing a list into a list, which is allowed). When you clear al, you remove every element from it, but do not create a new list (that would no longer be in alal. When you go to print alal, you are printing every element in it. The first element is the list al, which prints as [String 2] (and then the String 3).
score: 0

acceleratorkey
type: Tag
tags question: http://stackoverflow.com/q/23179496
tag name: acceleratorkey

http://stackoverflow.com/comment/35478729
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23195909
has text: This is not a good solution. Especially hardcoding the `Strings` like that is a bad idea.
type: AnswerComment

http://stackoverflow.com/a/23300222
has comment: http://stackoverflow.com/comment/35669346
has comment: http://stackoverflow.com/comment/35669510
upvote count: 1
has comment: http://stackoverflow.com/comment/35717571
has comment: http://stackoverflow.com/comment/35669602
has body: Well, for me it sounds like Oracle decided to strengthen the applets security requirements. Here is what I found on CodeRanch: Make SecurityManager accept socket-related permission checks: System.getSecurityManager().checkPermission(new SocketPermission("50.31.1.13:2255", "accept, connect, listen")); //I used IP address from your exception Now, thread-related checks: System.getSecurityManager().checkPermission(new RuntimePermission("readerThread")); These lines should be put in the beginning of main() method. The second thing needs to be done is signing your jar/war/ear file. First, create a keystore: keytool -genkey -alias philip -keystore keystore Now, put the signed by CA in your truststore certificate to it or create self-signed certificate: keytool -selfcert -alias philip -keystore keystore And finally, sign the file: jarsigner -keystore keystore -signedjar WhatYouWantTheSignedJarToBeNamed.jar ThePreviousJARYouCreated.jar philip Actually for signed JAR file the SecurityManager-related magic might be an overhead, but in my opinion it is safer to do both. Also be advised that sometimes you may need to sign external jars, not only the jar where your applet resides.
has comment: http://stackoverflow.com/comment/35669394
has comment: http://stackoverflow.com/comment/35669750
type: Answer
answers question: http://stackoverflow.com/q/23189650
has comment: http://stackoverflow.com/comment/35669194
has comment: http://stackoverflow.com/comment/35716314
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/35715103

http://stackoverflow.com/comment/35489261
score: 1
has text: @Mac the performance impact is due to the use of volatile in AtomicInteger but will be minimal (a volatile read is typically equivalent to a non-volatile read - volatile writes can be several orders of magnitude slower than non volatile writes but we are talking about nanoseconds). If you really want to use a mutable structure an `int[2]` would perform better.
comment on: http://stackoverflow.com/q/23201468
type: Comment
type: QuestionComment

ksoap2
type: Tag
tags question: http://stackoverflow.com/q/23182818
tags question: http://stackoverflow.com/q/23214264
tags question: http://stackoverflow.com/q/23220502
tag name: ksoap2

http://stackoverflow.com/comment/35476850
comment on: http://stackoverflow.com/a/23194619
has text: Alternatively they could get rid of the `frame.setLayout` line since [the content pane uses a BorderLayout by default.](http://docs.oracle.com/javase/7/docs/api/javax/swing/JFrame.html)
type: AnswerComment
score: 2
type: Comment

http://stackoverflow.com/a/23231510
has comment: http://stackoverflow.com/comment/35570911
has body: I have a couple of suggestions. First, consider using a Java Virtual Machine implementation other than gcj. This could easily be a gcj bug that we can't really chase down without matching your environment exactly. Are you also using gcj on the command line or using some other Java implementation? That could be the key difference. If that's not really an option for you, I have no evidence to support my belief, but I'd try setting the Rhino optimization level to -1, if you haven't already. When run with 0 or 1, Rhino tries some aggressive optimization techniques at the class level, and these may be confusing gcj.
has comment: http://stackoverflow.com/comment/35584532
has comment: http://stackoverflow.com/comment/35547135
has comment: http://stackoverflow.com/comment/35582614
has comment: http://stackoverflow.com/comment/35584397
has comment: http://stackoverflow.com/comment/35570512
has comment: http://stackoverflow.com/comment/35562032
has comment: http://stackoverflow.com/comment/35584174
has comment: http://stackoverflow.com/comment/35562286
answers question: http://stackoverflow.com/q/23223973
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/35584250

http://stackoverflow.com/a/23255340
type: Answer
answers question: http://stackoverflow.com/q/23255230
score: 0
has body: you can pass command line arguments from eclipse, run your program from eclipse as run on configuration it will open dialog box and click arguments tab and pass your arguments from there

http://stackoverflow.com/q/23165011
tagged with: java
score: -1
type: Question
has body: I am trying to insert data in to a table with an auto increment primary key. My table structure is like this: int:PK varchar:Item_ID varchar:Item_name int:FK_type When I try the prepared statement: prep = conn.prepareStatement("insert into Inventory values (?, ?, ?);"); I get this Error: Exception in thread "main" java.sql.SQLException: [SQLITE_ERROR] SQL error or missing database (table Inventory has 4 columns but 3 values were supplied) at org.sqlite.DB.newSQLException(DB.java:383) at org.sqlite.DB.newSQLException(DB.java:387) at org.sqlite.DB.throwex(DB.java:374) at org.sqlite.NativeDB.prepare(Native Method) at org.sqlite.DB.prepare(DB.java:123) at org.sqlite.PrepStmt.&lt;init&gt;(PrepStmt.java:42) at org.sqlite.Conn.prepareStatement(Conn.java:404) at org.sqlite.Conn.prepareStatement(Conn.java:399) at org.sqlite.Conn.prepareStatement(Conn.java:383) at org.checkout.CheckInventory.&lt;init&gt;(CheckInventory.java:58) at org.checkout.main.main(main.java:18) When I try executing the statement: stat.executeUpdate("insert into Inventory (Item_ID, Item_name, FK_type ) values ('TP1', 'NX Tripod 1', 2)"); I get this error: java.sql.SQLException: [SQLITE_MISUSE] Library used incorrectly (out of memory) at org.sqlite.DB.newSQLException(DB.java:383) at org.sqlite.DB.newSQLException(DB.java:387) at org.sqlite.DB.throwex(DB.java:374) at org.sqlite.NativeDB._exec(Native Method) at org.sqlite.Stmt.executeUpdate(Stmt.java:152) at org.checkout.CheckInventory.insertItem(CheckInventory.java:73) at org.checkout.CheckInventory$1.actionPerformed(CheckInventory.java:25) at javax.swing.AbstractButton.fireActionPerformed(Unknown Source) at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source) at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source) at javax.swing.DefaultButtonModel.setPressed(Unknown Source) at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source) at java.awt.Component.processMouseEvent(Unknown Source) at javax.swing.JComponent…
upvote count: 0
tagged with: sql
tagged with: sqlite
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/35425525
has comment: http://stackoverflow.com/comment/35425652
tagged with: jdbc
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23165181
downvote count: 1
has title: How to perform an SQL insert in Java

http://stackoverflow.com/q/23144062
upvote count: 2
tagged with: runtimeexception
has comment: http://stackoverflow.com/comment/35391118
favorite count: 0
has comment: http://stackoverflow.com/comment/35388843
answer count: 0
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/35391500
has comment: http://stackoverflow.com/comment/35388604
has title: Java Runtime Exception : takePicture failed to execute
score: 2
has comment: http://stackoverflow.com/comment/35388587
downvote count: 0
tagged with: java
type: Question
tagged with: android-camera
has body: When I click the Button on HomeActivity to invoke the camera my app crashes java Runtime Exception: take picture failed 04-17 17:59:18.229: E/AndroidRuntime(23037): FATAL EXCEPTION: main 04-17 17:59:18.229: E/AndroidRuntime(23037): java.lang.RuntimeException: takePicture failed 04-17 17:59:18.229: E/AndroidRuntime(23037): at android.hardware.Camera.native_takePicture(Native Method) 04-17 17:59:18.229: E/AndroidRuntime(23037): at android.hardware.Camera.takePicture(Camera.java:1202) 04-17 17:59:18.229: E/AndroidRuntime(23037): at android.hardware.Camera.takePicture(Camera.java:1147) 04-17 17:59:18.229: E/AndroidRuntime(23037): at com.cs9033.katalogkiller.HomeActivity.scanMail(HomeActivity.java:108) 04-17 17:59:18.229: E/AndroidRuntime(23037): at com.cs9033.katalogkiller.HomeActivity$1.onClick(HomeActivity.java:67) 04-17 17:59:18.229: E/AndroidRuntime(23037): at android.view.View.performClick(View.java:4354) 04-17 17:59:18.229: E/AndroidRuntime(23037): at android.view.View$PerformClick.run(View.java:17948) 04-17 17:59:18.229: E/AndroidRuntime(23037): at android.os.Handler.handleCallback(Handler.java:725) 04-17 17:59:18.229: E/AndroidRuntime(23037): at android.os.Handler.dispatchMessage(Handler.java:92) 04-17 17:59:18.229: E/AndroidRuntime(23037): at android.os.Looper.loop(Looper.java:137) 04-17 17:59:18.229: E/AndroidRuntime(23037): at android.app.ActivityThread.main(ActivityThread.java:5293) 04-17 17:59:18.229: E/AndroidRuntime(23037): at java.lang.reflect.Method.invokeNative(Native Method) 04-17 17:59:18.229: E/AndroidRuntime(23037): at java.lang.reflect.Method.invoke(Method.java:511) 04-17 17:59:18.229: E/AndroidRuntime(23037): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1102) 04-17 17:59:18.229: E/AndroidRuntime(23037): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869) 04-17 17:59:18.229: E/AndroidRuntime(23037): at dalvik.system.NativeStart.main(Native Method) HomeActivity.java import android.app.Activity; import an…
linked to: http://stackoverflow.com/q/21723557
has comment: http://stackoverflow.com/comment/80127571

http://stackoverflow.com/a/23223498
score: 1
has comment: http://stackoverflow.com/comment/35528635
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/23220346
has body: Are you sure that you have "btn.ok" message in your message properties? Does anyone know where the problem is and how can i add other properties with a different name than messages_en, like labels_en.properties and so on...? You should change your basename property. E.g.: &lt;beans:property name="basename" value="classpath:labels" /&gt;
upvote count: 1

http://stackoverflow.com/comment/35638320
has text: No. Variable names are only known at compile-time.
comment on: http://stackoverflow.com/q/23283222
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23249602
answers question: http://stackoverflow.com/q/23249428
downvote count: 0
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/35575552
type: Answer
has body: You should perhaps call the method under test say 1000 or 10000 times and check that you get a about 50% of the time.

http://stackoverflow.com/comment/35530981
has text: Yep, the problem is in code you're not showing us. Please fix this by creating and posting your [minimal code example program](http://stackoverflow.com/help/mcve) for us to review, test, and possibly fix.
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23224948

http://stackoverflow.com/q/23132982
accepted answer: http://stackoverflow.com/a/23133220
downvote count: 0
favorite count: 0
type: Question
score: 3
has body: I am trying to make a method that returns the fractional value of a decimal number. //these are included in a class called 'equazioni' private static long getMCD(long a, long b) { if (b == 0) { return a; } else { getMCD(b, a % b); } } public String getFraction(double a) { String s = String.valueOf(a); int decimali = s.length() - 1 - s.indexOf('.'); int den = 1; for(int i = 0; i &lt; decimali; i++){ a *= 10; den *= 10; } int num = (int) Math.round(a); long mcd = getMCD(num,den); return String.valueOf(num/mcd) + "/" + String.valueOf(den/mcd); } These 2 methods works perfectly with most of values. For example with a 8.65 it returns a 173/20, or 78.24 it returns a 1956/25. It's called in this way: equazioni eq = new equazioni(a,b,c); jTextField4.setText("8.65= " + eq.getFraction(8.65)); I am having troubles with fractions like 2/3, 5/18, 6/45... because the denominator is divisible by 3 and so the fraction is a periodic number. How could I represent it? My problem is also "How could I recognize that it's a periodic number?". I thought that I could something like this int test = den % 3; If the denominator is divisible by 3, then I have to generate a fraction in a particular way. Any suggestion?
tagged with: fractions
upvote count: 3
has answer: http://stackoverflow.com/a/23133220
answer count: 1
has comment: http://stackoverflow.com/comment/35367891
tagged with: java
has comment: http://stackoverflow.com/comment/35367825
has title: Java get fraction method
type: AnsweredQuestion

http://stackoverflow.com/q/23290595
answer count: 2
upvote count: 1
has comment: http://stackoverflow.com/comment/35651748
tagged with: tapestry
favorite count: 0
has answer: http://stackoverflow.com/a/23290976
has body: I am developing a web application with Java + Spring + Hibernate + Tapestry and I want to allow admin user to change the color configuration of all users registered. where I store this configuration? In a .properties file? In the database? This application will be local, I could force to restart application. Any solution? Thanks
has title: Change color configuration in web application at runtime
downvote count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35816762
tagged with: spring
tagged with: properties
has answer: http://stackoverflow.com/a/23291089
has comment: http://stackoverflow.com/comment/35736574
tagged with: configuration
score: 1
tagged with: java
type: Question

http://stackoverflow.com/comment/35621148
has text: I would like f and g to become a Foo2, which can not be achieved by g.setSomething("...")
comment on: http://stackoverflow.com/q/23273235
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35422087
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23162828
has text: Looking in to it a bit more, PNGs do not appear to load into the TYPE_INT_ARGB or RGB color spaces. You will need to look into the exact format PNGs are loading into.
type: AnswerComment

http://stackoverflow.com/q/23193996
tagged with: java
has answer: http://stackoverflow.com/a/23194119
type: Question
has comment: http://stackoverflow.com/comment/35475681
possible better answer: http://stackoverflow.com/a/23194131
tagged with: sorting
answer count: 6
tagged with: arraylist
score: 0
linked to: http://stackoverflow.com/q/2784514
has answer: http://stackoverflow.com/a/23194095
has title: Sorting in arraylist
has comment: http://stackoverflow.com/comment/35475680
has answer: http://stackoverflow.com/a/23194106
accepted answer: http://stackoverflow.com/a/23194119
has comment: http://stackoverflow.com/comment/35475678
has body: I am trying to sort the elements present in my arraylist in decreasing order. However, there seems to be some issue in the implementation. I am just a beginner in java, and am trying to use the most easiest method possible to sort. student temp = new student(user_name,given_name,family_name,tot_marks); for(int j=0;j&lt;list1.size()-1;j++) { for(int k=0;k&lt;list1.size();k++) { student sort1 = list1.get(j); student sort2 = list1.get(k); if(sort1.tot_marks &lt; sort2.tot_marks) { temp.user_name=sort1.user_name; temp.family_name=sort1.family_name; temp.given_name=sort1.given_name; temp.tot_marks=sort1.tot_marks; sort2.user_name=temp.user_name; sort2.family_name=temp.family_name; sort2.given_name=temp.given_name; sort2.tot_marks=temp.tot_marks; sort1.family_name=sort2.family_name; sort1.given_name=sort2.given_name; sort1.tot_marks=sort2.tot_marks; list1.add(sort1); //Adding sorted elements to the arraylist. } //If marks are same, sort on the basis of username. else if(sort1.tot_marks == sort2.tot_marks) { //Compare usernames whichever is greater. { temp.user_name=sort1.user_name; temp.family_name=sort1.family_name; temp.given_name=sort1.given_name; temp.tot_marks=sort1.tot_marks; sort2.user_name=temp.user_name; sort2.family_name=temp.family_name; sort2.given_name=temp.given_name; sort2.tot_marks=temp.tot_marks; sort1.family_name=sort2.family_name; sort1.given_name=sort2.given_name; sort1.given_name=sort2.given_name; sort1.tot_marks=sort2.tot_marks; list1.add(sort1); } } } } //Print the sorted list. for (int i=0;i&lt;list1.size();i++) { student display = list1.get(i); System.out.println(display.tot_marks+","+display.given_name+" "+display.family_name); }
has answer: http://stackoverflow.com/a/23194114
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23194071
has answer: http://stackoverflow.com/a/23194131

http://stackoverflow.com/a/34664763
has body: here is my actual implementatipn of UserAuthHeaderParamValueFactoryProvider class import javax.inject.Inject; import javax.inject.Singleton; import org.glassfish.hk2.api.Factory; import org.glassfish.hk2.api.ServiceLocator; import org.glassfish.jersey.server.internal.inject.AbstractContainerRequestValueFactory; import org.glassfish.jersey.server.internal.inject.AbstractValueFactoryProvider; import org.glassfish.jersey.server.internal.inject.MultivaluedParameterExtractorProvider; import org.glassfish.jersey.server.model.Parameter; @Singleton public class UserAuthHeaderParamValueFactoryProvider extends AbstractValueFactoryProvider { @Inject protected UserAuthHeaderParamValueFactoryProvider(MultivaluedParameterExtractorProvider mpep, ServiceLocator locator) { super(mpep, locator, Parameter.Source.UNKNOWN); } @Override protected Factory&lt;?&gt; createValueFactory(Parameter parameter) { Class&lt;?&gt; classType = parameter.getRawType(); if (classType == null || (!classType.equals(String.class))) { return null; } return new AbstractContainerRequestValueFactory&lt;String&gt;() { @Override public String provide() { //you can use get any header value. return getContainerRequest().getHeaderString("Authorization"); } }; }
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23231511

http://stackoverflow.com/q/23283599
accepted answer: http://stackoverflow.com/a/23283645
has body: I'm trying to compare the hex color value string to the color of textview which changes color every few seconds. At the moment getCurrentTextColor for the textview returns a large minus number, rather than the hex value of the color. How would I turn this number into it's hex value? is this possible? thanks
tagged with: android
linked to: http://stackoverflow.com/q/6539879
has comment: http://stackoverflow.com/comment/35639137
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/44726641
has answer: http://stackoverflow.com/a/23283645
has answer: http://stackoverflow.com/a/44726641
type: Question
has comment: http://stackoverflow.com/comment/35639253
has title: getCurrentTextColor returns int, I want hex color value
tagged with: java
score: 0
answer count: 2

http://stackoverflow.com/a/23276504
score: 0
type: Answer
has body: Like in the comments, go through a tutorial and check your error message, it usually tells you what is wrong public String[] gettobill(String bill) { // TODO Auto-generated method stub String col[]= new String[] { KEY_EBID, KEY_EMONTH, KEY_EBREAD, KEY_EBAMOUNT }; Cursor l=ourDatabase.query(DATABASE_TABLE1, col, KEY_EBID + "='" + bill + "'", null, null, null, null); String[] eresult = new String[5];//initialize your array before you can populate it otherwise eresult will be null and throw an exception int peid=l.getColumnIndex(KEY_EBID); int pemonth=l.getColumnIndex(KEY_EMONTH); int peread=l.getColumnIndex(KEY_EBREAD); int pamount=l.getColumnIndex(KEY_EBAMOUNT); for (l.moveToFirst(); !l.isAfterLast(); l.moveToNext()){ eresult[0]= l.getString(peid); eresult[1]=l.getString(pemonth); eresult[2]=l.getString(peread); eresult[3]=l.getString(pamount); } return eresult; }
answers question: http://stackoverflow.com/q/23276364

authentication
tags question: http://stackoverflow.com/q/23157100
tags question: http://stackoverflow.com/q/23238337
tag name: authentication
tags question: http://stackoverflow.com/q/23217359
type: Tag
tags question: http://stackoverflow.com/q/23199975
tags question: http://stackoverflow.com/q/23265594
tags question: http://stackoverflow.com/q/23240528
tags question: http://stackoverflow.com/q/23176290
tags question: http://stackoverflow.com/q/23158218
tags question: http://stackoverflow.com/q/23140518
tags question: http://stackoverflow.com/q/23162770
tags question: http://stackoverflow.com/q/23227543
tags question: http://stackoverflow.com/q/23264029
tags question: http://stackoverflow.com/q/23196045
tags question: http://stackoverflow.com/q/23214919
tags question: http://stackoverflow.com/q/23204630

http://stackoverflow.com/q/23143318
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/23148805
tagged with: eclipse-plugin
type: UnansweredQuestion
has body: In Eclipse, is it possible to highlight a file in the Package Explorer? What I want is to highlight the operational classes (putting green for example, which means that I do not have to return above) to identify those that should be reviewed. Or there is another way to identify visually some files?
tagged with: android
tagged with: java
has title: Highlight files in Eclipse
tagged with: eclipse
type: Question

http://stackoverflow.com/comment/35417160
comment on: http://stackoverflow.com/a/23159851
type: AnswerComment
has text: Yes, that's kind of a pain, though obviously you can make it work with a `TreeView<Object>`. I've often been in the situation where I thought `TreeView` should have a `TreeItem<S,T> root`, where `TreeItem<S,T>` has `S getValue()` and ` ObservableList<TreeItem<T,U>> getChildren()`. But I guess they figured it made the API too complex.
type: Comment
score: 1

grouping
tags question: http://stackoverflow.com/q/23136533
type: Tag
tags question: http://stackoverflow.com/q/23234528
tag name: grouping

http://stackoverflow.com/q/23143004
has answer: http://stackoverflow.com/a/23143061
has title: Method cannot be applied to ArrayList<ObjectImplementsInterface> if definited for ArrayList<Interface>
answer count: 2
upvote count: 1
has comment: http://stackoverflow.com/comment/35387356
has comment: http://stackoverflow.com/comment/35387920
favorite count: 0
tagged with: android
has comment: http://stackoverflow.com/comment/35387749
possible better answer: http://stackoverflow.com/a/23143423
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23143061
has answer: http://stackoverflow.com/a/23143423
downvote count: 0
score: 1
tagged with: java
has body: I have various Objects named Gold,Iron etc. all these objects implement the interface Metal. Since I have to do same kind of operations on all these Objects i have definited my method to accept ArrayList&lt;Metal&gt;to avoid redundant code. for example public ArrayList&lt;Metal&gt; doSomething(ArrayList&lt;Metal&gt; list){ ... } but if try to do something like ArrayList&lt;Iron&gt; inputList; ArrayList&lt;Iron&gt; result=doSomething(inputList); I get the error: doSomething cannot be applied to ArrayList&lt;Iron&gt; How could I fix this without write redundant methods that do the same thing for each Object type? EDIT A sample of method edited according user suggestions is this public static &lt;T extends Metal&gt; List&lt;T&gt; addMoleculaInMetalList(ArrayList&lt;? extends Metal&gt; list, Molecula t) { Metal ma; ArrayList&lt;Molecula&gt; moleculist; for (int i = 0; i &lt; list.size(); i++) { ma = list.get(i); if (ma.getName().equals(t.getDestinationName())) { moleculist = ma.getMoleculas(); moleculist.add(t); ma.setMoleculas(moleculist); list.set(i, ma); return list; } } return list; } but doesn't work, get -error cannot be applied in list.set(i, ma); and -error incompatible types on return
type: Question

http://stackoverflow.com/q/23153570
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/23335218
has comment: http://stackoverflow.com/comment/35409306
has comment: http://stackoverflow.com/comment/35407422
tagged with: spring-data-rest
has comment: http://stackoverflow.com/comment/35417175
answer count: 1
downvote count: 0
favorite count: 0
has title: Spring Data Rest Unit Tests Selectively Pass
type: UnansweredQuestion
tagged with: spring-test-dbunit
tagged with: spring
has body: I am investigating the use of Spring Data Rest (2.0.1.RELEASE and Spring 4.0.2.RELEASE), and have written a simple service. I have also written a simple test class (see below) using DbUnit. Unfortunately when I run the tests only the findAll method passes. If I comment out the findAll method then the findInvestigationalProductById passes and directLink fails. If I then comment out findInvestigationalProductById then directLink passes. None of these methods changes data state, so I would like to know if there is some configuration I have overlooked that can cause this behaviour. @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations = {"classpath:/com/perceptive/ctms/core/tests-context.xml"}) @WebAppConfiguration @TestExecutionListeners({ DependencyInjectionTestExecutionListener.class, DbUnitTestExecutionListener.class }) @DatabaseSetup("investigational-products-data.xml") public class InvestigationalProductTests { private MockMvc mockMvc; @Autowired private WebApplicationContext wac; @Before public void setup() { this.mockMvc = MockMvcBuilders.webAppContextSetup(this.wac).build(); MockitoAnnotations.initMocks(this); } @Test public void findAll() throws Exception { ResultActions resultActions = mockMvc.perform(get("/investProduct")) .andExpect(status().isOk()) .andExpect(content().contentType("application/hal+json")); resultActions.andExpect(jsonPath("$_embedded.investigationalProduct", hasSize(3))); resultActions.andExpect(jsonPath("$_embedded.investigationalProduct[0].investigationalProductCode", is("ACTIVE1"))); resultActions.andExpect(jsonPath("$_embedded.investigationalProduct[1].investigationalProductCode", is("ACTIVE2"))); resultActions.andExpect(jsonPath("$_embedded.investigationalProduct[2].investigationalProductCode", is("ACTIVE3"))); } @Test public void directLink() throws Exception { ResultActions resultActions = mockMvc.perform(get("/investProduct/3")) .andExpect(status().isOk()) .andExpect(content().contentType("application/hal+json"));…
has comment: http://stackoverflow.com/comment/35405281
tagged with: dbunit
score: 1
tagged with: java

http://stackoverflow.com/comment/96327935
has text: the hack I used was to add hook into the doPostSetup() method the test harness provides to call the method used to setup the registry in the CamelContextListener class for the prod context. a bit of boilerplate plumbing to be sure but it's not much and it ensures both prod and test have the same registry.
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/23153215
score: 0

http://stackoverflow.com/comment/35578161
type: Comment
comment on: http://stackoverflow.com/a/23251132
score: 0
type: AnswerComment
has text: I'm only using keyboard. I don't know what closing is, but I don't think so. If it helps, I'm using http://www.compileonline.com/compile_java_online.php

http://stackoverflow.com/a/23283243
answers question: http://stackoverflow.com/q/23283222
downvote count: 0
has body: No. Variable names are only known at compile-time. In order to do something like this, you will need to write your own basic parser.
has comment: http://stackoverflow.com/comment/35639614
upvote count: 2
type: Answer
score: 2

http://stackoverflow.com/a/23290286
has comment: http://stackoverflow.com/comment/35654108
has comment: http://stackoverflow.com/comment/35661911
score: 4
upvote count: 4
answers question: http://stackoverflow.com/q/23290039
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/35662074
has comment: http://stackoverflow.com/comment/35661247
has comment: http://stackoverflow.com/comment/35656958
has comment: http://stackoverflow.com/comment/35662452
type: Answer
has comment: http://stackoverflow.com/comment/35658430
has comment: http://stackoverflow.com/comment/35661040
accepted answer of: http://stackoverflow.com/q/23290039
has body: Your db class stores connection already so just create means to retrieve it: package database; class Database { private String dbUri = "jdbc:mysql://"; private String dbDriver = "com.mysql.jdbc.Driver"; private Connection connection; public boolean connect(String host, String base, String user, String pass) { try { Class.forName(dbDriver); String uri = dbUri + host + '/' + base; connection = DriverManager.getConnection(uri, user, pass); return true; } catch (ClassNotFoundException e) { e.printStackTrace(); return false; // Could not find the database driver } catch (SQLException e) { e.printStackTrace(); return false; // Could not connect to the database } } public Connection getConnection() { return connection; } } In your main: class Main { public static void main(String[] args) { Database db = new Database(); if (db.connect(/* parameters for database connection here */)) { final Connection conn = db.getConnection(); // you can use conn for your queries. If they are in other classes, pass connection as parameter. } } } I've tried to make it simple, but you should actually use factory and singleton patterns to create and store a connection, once created, and then statically retrieve it within application. Once you feel comfortable with the concept you should also look into connection pooling as suggested in comments, for example with use of BoneCP.

http://stackoverflow.com/q/23239218
answer count: 2
has comment: http://stackoverflow.com/comment/35557574
downvote count: 0
has answer: http://stackoverflow.com/a/27078119
has comment: http://stackoverflow.com/comment/35557720
tagged with: dropwizard
possible better answer: http://stackoverflow.com/a/27078119
has comment: http://stackoverflow.com/comment/35559454
accepted answer: http://stackoverflow.com/a/23249888
favorite count: 0
has title: Add jetty servlet into dropwizard
has comment: http://stackoverflow.com/comment/35557217
tagged with: jetty
score: 13
upvote count: 13
type: AnsweredQuestion
has body: I need to add jetty servlet into my already existing server implemented using dropwizard framework. To be more specific: I have a restful resource Foo mapped to url "localhost:8080/foo" with CRUD operations. Now I need a jetty servlet mapped to url "localhost:8080/bar" and handles all requests to this url (mainly GET and POST). I could not get a clue how to do this after some googlings. Could someone please give me a direction or a snippet? Thanks!
tagged with: java
tagged with: servlets
type: Question
has answer: http://stackoverflow.com/a/23249888

http://stackoverflow.com/comment/35477537
comment on: http://stackoverflow.com/a/23195138
score: 0
type: AnswerComment
has text: Failed to see your answer. My thoughts were exactly the same.
type: Comment

http://stackoverflow.com/q/23194397
type: Question
tagged with: android
has comment: http://stackoverflow.com/comment/35477188
score: 0
has comment: http://stackoverflow.com/comment/35476786
has title: Navigation drawer and Action bar tabs contents overlapping in android
tagged with: navigation-drawer
tagged with: android-fragments
has body: I have done navigation drawer and action bar tabs using fragments but contents of NavigationDrawer is overlapping on ActionBarTabs content.How to overcome this problem and work like Google play store app. protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ActionBar actionbar = getActionBar(); actionbar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); // create new tabs and and set up the titles of the tabs ActionBar.Tab mFindTab = actionbar.newTab().setText(getString(R.string.ui_tabname_find)); ActionBar.Tab mChatTab = actionbar.newTab().setText(getString(R.string.ui_tabname_chat)); ActionBar.Tab mMeetTab = actionbar.newTab().setText(getString(R.string.ui_tabname_meet)); ActionBar.Tab mPartyTab = actionbar.newTab().setText(getString(R.string.ui_tabname_party)); // create the fragments Fragment mFindFragment = new FindFragment(); Fragment mChatFragment = new ChatFragment(); Fragment mMeetFragment = new MeetFragment(); Fragment mPartyFragment = new PartyFragment(); // bind the fragments to the tabs - set up tabListeners for each tab mFindTab.setTabListener(new MyTabsListener(mFindFragment,getApplicationContext())); mChatTab.setTabListener(new MyTabsListener(mChatFragment,getApplicationContext())); mMeetTab.setTabListener(new MyTabsListener(mMeetFragment,getApplicationContext())); mPartyTab.setTabListener(new MyTabsListener(mPartyFragment,getApplicationContext())); // add the tabs to the action bar actionbar.addTab(mFindTab); actionbar.addTab(mChatTab); actionbar.addTab(mMeetTab); actionbar.addTab(mPartyTab); if (savedInstanceState != null) { Toast.makeText(getApplicationContext(), "tab is " + savedInstanceState.getInt(TAB_KEY_INDEX, 0), Toast.LENGTH_SHORT).show(); actionbar.setSelectedNavigationItem(savedInstanceState.getInt( TAB_KEY_INDEX, 0)); } dataList = new ArrayList&lt;DrawerItem&gt;(); mTitle = mDrawerTitle = getTitle(); mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout…
tagged with: java
has comment: http://stackoverflow.com/comment/35476972
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35478718

http://stackoverflow.com/q/23218281
has answer: http://stackoverflow.com/a/23237431
tagged with: java
type: Question
has title: pass EJB ApplicationException to web
score: 0
answer count: 1
has body: I have EJB class, custom exception and web back end bean classes, i want to catch the custom exception in the web if the EJB pass the exception, but the RuntimeException catch the exception?? Exception Class: @ApplicationException public class CustomException extends Exception { } EJB Class: public class EmployeeDao { private UserTransaction transaction; @PersistenceUnit(unitName="xxx") protected EntityManagerFactory entityManagerFactory; . . . . . public void addNewEmployee(Employee employee) throws CustomException { . . . . throw new CustomException (...); } } Backend Class: public class EmployeeBackend { . . . . public void doAddEmployee() { try { .... employeeDao.addNewEmployee(); } catch(CustomException e) { System.err.println("------------------------ CustomException"); e.printStackTrace(); } catch(RuntimeException e) { System.err.println("------------------------ RuntimeException "); e.printStackTrace(); } } }
type: UnansweredQuestion
tagged with: ejb-3.0

http://stackoverflow.com/a/23279247
accepted answer of: http://stackoverflow.com/q/23278575
has comment: http://stackoverflow.com/comment/35631028
has body: The problem came up from my password varchar, it was 10 and the encryption didn't had enough space. Raised it to 50/100 and now I can login. Thanks
answers question: http://stackoverflow.com/q/23278575
has comment: http://stackoverflow.com/comment/35630724
score: 0
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/comment/35422575
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23162916
has text: I noticed that the try/catch structure influence's the scope of the array. How can it work without beeing blocked by the try/catch ?

http://stackoverflow.com/q/23286319
tagged with: android
tagged with: sqlite
accepted answer: http://stackoverflow.com/a/23286603
possible better answer: http://stackoverflow.com/a/23286843
score: 0
has answer: http://stackoverflow.com/a/23286843
type: AnsweredQuestion
tagged with: java
type: Question
has title: Get multiple value to next activity
answer count: 2
has answer: http://stackoverflow.com/a/23286603
has body: The app activity would random get 10 question from sqlite database. I want get the questions and answers to next activity to show answer. I think it should return the value on the "NextQ" button. How to set it? public class QuizGram extends Activity { private SQLiteDatabase database; private static final String DB_NAME = "eng.db"; private static final String TABLE_NAME = "quiz"; private static final String QUIZ_ID = "_id"; private static final String QUIZ_TYPE = "quiz_type"; private static final String QUESTION = "question"; private static final String A = "a"; private static final String B = "b"; private static final String C = "c"; private static final String ANS = "ans"; List&lt;Question&gt; quesList; int score=0; int qid=0; Question currentQ; TextView Questions; RadioButton Radio0, Radio1, Radio2; Button NextQ; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.quizdetail); DBhelper dbHelper = new DBhelper(this, DB_NAME); database = dbHelper.openDataBase(); quesList = this.getQuestions(); currentQ = quesList.get(qid); Questions = (TextView)findViewById(R.id.questions); Radio0 = (RadioButton)findViewById(R.id.radio0); Radio1 = (RadioButton)findViewById(R.id.radio1); Radio2 = (RadioButton)findViewById(R.id.radio2); NextQ = (Button)findViewById(R.id.nextQ); setQuestionView(); NextQ.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { RadioGroup grp=(RadioGroup)findViewById(R.id.radioGroup1); RadioButton answer=(RadioButton)findViewById(grp.getCheckedRadioButtonId()); Log.d("yourans", currentQ.getANSWER()+" "+answer.getText()); if(currentQ.getANSWER().equals(answer.getText())) { score++; Log.d("score", "Your score"+score); } if(qid&lt;10){ currentQ=quesList.get(qid); setQuestionView(); }else{ Intent intent = new Intent(QuizGram.this, QuizResult.class); Bundle bundle = new Bundle(); bundle.putInt("score", score); //Your score intent.putExtras(bundle); //Put your score to you…

http://stackoverflow.com/a/23196418
has comment: http://stackoverflow.com/comment/35483521
upvote count: 8
has body: forEach() doesn't guarantee to process elements in specific order: The behavior of this operation is explicitly nondeterministic. For parallel stream pipelines, this operation does not guarantee to respect the encounter order of the stream, as doing so would sacrifice the benefit of parallelism. For any given element, the action may be performed at whatever time and in whatever thread the library chooses. If the action accesses shared state, it is responsible for providing the required synchronization. You should use forEachOrdered() instead: list.stream().parallel().sorted(Comparator.comparing(e -&gt; e.getFirstName())) .forEachOrdered(System.out::println);
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23196257
accepted answer of: http://stackoverflow.com/q/23196257
type: Answer
score: 8

http://stackoverflow.com/comment/35553657
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23236945
type: Comment
has text: Sorry, took a little while to get rid of redundant logs i put in there.

http://stackoverflow.com/comment/35410797
score: 0
comment on: http://stackoverflow.com/q/23157100
has text: I've edited to the original post :)
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35619437
has text: http://www.androidhive.info/2012/09/android-adding-search-functionality-to-listview/
type: AnswerComment
comment on: http://stackoverflow.com/a/23270540
score: 0
type: Comment

http://stackoverflow.com/q/23165637
has title: Failure to launch Tomcat from IntelliJ IDEA
has answer: http://stackoverflow.com/a/23166743
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/35426524
upvote count: 2
has comment: http://stackoverflow.com/comment/35426569
tagged with: maven
tagged with: spring
score: 2
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23166743
tagged with: java
has body: I am a complete beginner at writing Java web apps, but I'm getting into Spring MVC. I have created a default spring app and am attempting to launch it using TomCat 8.0 I am met with the following error: SEVERE: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[]] .... Caused by: 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/ServletContext" I know this might sound simple but I have no idea where to start. I assume from the message that either my Maven, project or build settings are incorrect as the wrong Type of servlet is being instantiated? Any help to get setup would be greatly appreciated. Full build log: Apr 19, 2014 1:54:22 PM org.apache.catalina.core.AprLifecycleListener init INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jdk1.7.0_51\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files (x86)\Git\cmd;c:\Program Files (x86)\Microsoft SQL Server\110\Tools\Binn\;c:\Program Files\Microsoft SQL Server\110\DTS\Binn\;c:\Program Files (x86)\Microsoft SQL Server\110\Tools\Binn\ManagementStudio\;c:\Program Files (x86)\Microsoft SQL Server\110\DTS\Binn\;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files (x86)\Windows Live\Shared;C:\JavaApps\play-2.2.1;C:\program files\Java\jdk1.6.0_27\bin;C:\GitStack\python;C:\GitStack\python\Scripts;C:\GitStack\php;C:\Program Files\Microsoft\Web Platform Installer\;C:\…
has comment: http://stackoverflow.com/comment/35427530
linked to: http://stackoverflow.com/q/6841769
type: Question
has comment: http://stackoverflow.com/comment/35426606
possible better answer: http://stackoverflow.com/a/54175512
answer count: 2
has answer: http://stackoverflow.com/a/54175512
tagged with: intellij-idea
tagged with: tomcat

http://stackoverflow.com/a/23234250
upvote count: 3
has comment: http://stackoverflow.com/comment/35548087
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/23234169
has body: That seems like a terrible idea, I strongly urge you not to use a reversible transform with the password. If your passwords are stored in a reversible manner, then an attacker (with access to the file) can reverse your users' passwords. Instead, current best practices are to use a cryptographically secure hash and a SALT to prevent attacks with rainbow tables. See also the now ancient Shadow Suite. Are you aware of the pigeonhole principle? Inconceivable? That's your cue Mr. Patinkin. Edit Since you added code, Don't use == to test String equality. With Object types that is for reference equality testing. You need to use .equals(). if ("a" != new String("a")) { System.out.println("It is known."); // &lt;-- There a GoT reference too. }
score: 3

http://stackoverflow.com/comment/35553624
has text: @Harmlezz Now should be better. I suspect that all here got downvoted because initially we didn't try to find full package name of class but we assumed that it was passed as input.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23237076

http://stackoverflow.com/comment/35565812
score: 0
has text: What do you mean by "DB Connection Crashed"? Do you have any log statements for that?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23244314

http://stackoverflow.com/comment/35579900
type: QuestionComment
has text: Show your layout.xml with TextView
comment on: http://stackoverflow.com/q/23252096
score: 0
type: Comment

http://stackoverflow.com/comment/35408774
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23155193
type: Comment
has text: I believe that is what I need, but how can I add it to the JList? Do I need a DefaultListModel?

http://stackoverflow.com/comment/35458706
score: 0
comment on: http://stackoverflow.com/q/23184431
type: Comment
type: QuestionComment
has text: In the future, it's better to ask these kinds of questions in StackOverflow.com

http://stackoverflow.com/a/23194093
upvote count: 1
has body: With oracle 10g and jdk 1.7, you need to have ojdbc7 driver which you can find here. You need to have it in your classpath. One more thing, replace &lt;property name="driverClassName" value="oracle.jdbc.driver.OracleDriver" /&gt; by &lt;property name="driverClassName" value="oracle.jdbc.OracleDriver" /&gt; this is the correct class that have to be loaded for JDBC operations on Oracle 10g using thin client.
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/23192849
type: Answer

onclicklistener
tag name: onclicklistener
tags question: http://stackoverflow.com/q/23174722
tags question: http://stackoverflow.com/q/23250715
tags question: http://stackoverflow.com/q/23179795
tags question: http://stackoverflow.com/q/23168955
type: Tag

http://stackoverflow.com/comment/35630596
has text: I edited my post, actually the issue is more conflicts of JARs, with some legacy servlets having some needs.
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23279196

http://stackoverflow.com/a/23271620
type: AcceptedAnswer
downvote count: 0
has body: Change Toast.makeText(this,message, Toast.LENGTH_LONG).show(); to Toast.makeText(ActivityName.this ,message, Toast.LENGTH_LONG).show(); makeText takes as first parameter a Context object, but this, in your case, refers to the object of the inner anonymous class new View.OnClickListener
type: Answer
accepted answer of: http://stackoverflow.com/q/23271590
answers question: http://stackoverflow.com/q/23271590
score: 5
upvote count: 5

http://stackoverflow.com/q/23289538
favorite count: 0
type: UnansweredQuestion
tagged with: oracle-adf
has title: NullPointerException in my active code
downvote count: 1
tagged with: jdeveloper
has comment: http://stackoverflow.com/comment/35649492
has comment: http://stackoverflow.com/comment/35650123
tagged with: java
has comment: http://stackoverflow.com/comment/35649309
type: Question
linked to: http://stackoverflow.com/q/218384
answer count: 2
has answer: http://stackoverflow.com/a/23290212
upvote count: 0
score: -1
has answer: http://stackoverflow.com/a/23290175
has comment: http://stackoverflow.com/comment/35649343
has comment: http://stackoverflow.com/comment/35649507
tagged with: nullpointerexception
has body: I have a problem with my code. I am using Oracle JDeveloper 12c and I can't deal with my code. I have a method called deactivate: public void deactivate() { DeesconfViewImpl deak = getDeesconfView(); RowSetIterator rowSetIterator = deak.createRowSetIterator("New"); if (rowSetIterator != null) { rowSetIterator.reset(); while (rowSetIterator.hasNext()) { Row currentRow = rowSetIterator.next(); currentRow.setAttribute("Active", 0); } rowSetIterator.closeRowSetIterator(); } } which has a problem in line: DeesconfViewImpl deak = getDeesconfView(); He doesn't see that getDeesconfView, JDeveloper gives me a hint to insert a method private DeesconfViewImpl getDeesconfView() { return null; } And code compiles succesfully, but I have nullPointerException in my method, which is supposed to set all rows to inactive, and this one I selected to active: public void activeYear() { deactivate(); this.getCurrentRow().setAttribute("Active", 1); } I am sure that the problem is DeesconfViewImpl deak = getDeesconfView(); but I have no idea what could go in this code. If I remove this line, I have an error with: public class DeesconfViewImpl extends ViewObjectImpl implements DeesconfView { private static DeesconfView getDeesconfView; } That he doesn't see getDeesconfView. Seems like he just doesn't use it. Yes I debugged it and I found out already which line causes this error.
tagged with: oracle-database

http://stackoverflow.com/q/23169865
type: UnansweredQuestion
tagged with: tomcat
tagged with: contextpath
type: Question
tagged with: url
score: 1
has title: How to remove application context from URL in apache tomcat
has answer: http://stackoverflow.com/a/23169989
favorite count: 0
has body: I have a war test.war. I deployed it in webapps folder. Now I can access the web application by URL www.domain.com/test/login In order to remove the war name, I renamed the war to ROOT.war So Now I am able to access the web application by URL www.domain.com/login Can someone please guide me How to access the web application by URL www.domain.com P.S I cannot modify the contents of my WAR file.
answer count: 3
upvote count: 1
tagged with: java
has answer: http://stackoverflow.com/a/23170413
has answer: http://stackoverflow.com/a/23169886
tagged with: apache
downvote count: 0

http://stackoverflow.com/comment/45466874
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/28559070
has text: what you want to describe ? I have validation similar that you posted
score: 0

http://stackoverflow.com/comment/35644012
comment on: http://stackoverflow.com/q/23286480
score: 0
type: Comment
type: QuestionComment
has text: The second format `##` can't be parsed, because there is no visible separator. Example `12,34` and `1234`. The second example could result in: `1,234` or `12,34` or `123,4`.

http://stackoverflow.com/comment/35410706
type: Comment
has text: thx, i update the code, but the problem persists. "matriz" have the new data but the jpanel no change absolutely
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23156828

http://stackoverflow.com/q/23205071
has comment: http://stackoverflow.com/comment/35495514
has comment: http://stackoverflow.com/comment/35495563
downvote count: 0
tagged with: jsp
has comment: http://stackoverflow.com/comment/35495544
answer count: 1
score: 1
favorite count: 0
has answer: http://stackoverflow.com/a/23205275
has body: I'm new in java web development. When I use redirect from servlet to JSP the pictures and CSS files doesn't load. Without the servlet it's working well but when I want use servlet it's not working. The CSS file is in the same folder with the JSP one. Please can you help me how should I set the href attribute of the link tag ? &lt;link rel="stylesheet" type="text/css" href="/style.css"&gt; the servlet has only 1 command: request.getRequestDispatcher("index.jsp").forward(request, response);
type: AnsweredQuestion
tagged with: java
has title: JSP path error on servlet redirect
upvote count: 1
accepted answer: http://stackoverflow.com/a/23205275
tagged with: servlets
type: Question

http://stackoverflow.com/q/23252301
has comment: http://stackoverflow.com/comment/35580229
type: Question
has body: I'm an Italian student with the passion of programming and I'm creating an application that asks the user to insert a password when opening a precedently specified file or folder. My problem is how to detect when the user opens the file/folder using an event, if possible. Can you help me please?
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/23252361
tagged with: java
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35580282
has title: how do i detect when a folder or file is accessed in java?

floating-point
tags question: http://stackoverflow.com/q/23205867
type: Tag
tags question: http://stackoverflow.com/q/23236052
tags question: http://stackoverflow.com/q/23284782
tag name: floating-point

http://stackoverflow.com/a/23179281
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/23179256
has body: It does not matter if there exists another jdk on the system, you can use others in GGTS. Just add another JDK using Window>Preferences>Java>Installed JREs . Then at that page click on add and find your JDK location. Finally select the default one for GGTS to use. Thats all.
upvote count: 2

http://stackoverflow.com/comment/35604253
has text: I have taken the like this ByteArrayOutputStream bytearrypacket = new ByteArrayOutputStream(); DataOutputStream dateoutputpacket = new DataOutputStream(bytearrypacket);
type: Comment
comment on: http://stackoverflow.com/a/23263864
score: 0
type: AnswerComment

http://stackoverflow.com/a/23203568
has comment: http://stackoverflow.com/comment/35493513
upvote count: 2
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23203309
type: Answer
accepted answer of: http://stackoverflow.com/q/23203309
score: 2
downvote count: 0
has body: I would use the BigInteger type, public static void main(String[] args) { BigInteger n = BigInteger.ONE; BigInteger p = BigInteger.ONE; for(int i = 1;i &lt;= 64;i++){ n = n.add(n); p = p.add(n); } System.out.println(p); } Output is 36893488147419103231 Edit Based on your comment, you really wanted something more like The Legend of the Chessboard - BigInteger n = BigInteger.ONE; BigInteger p = BigInteger.ZERO; BigInteger TWO = new BigInteger("2"); for (int i = 1; i &lt;= 64; i++) { StringBuilder sb = new StringBuilder(); sb.append("For square #: " + i); sb.append(", Grains on square: " + n); p = p.add(n); n = n.multiply(TWO); sb.append(", Running Total: " + p); System.out.println(sb.toString()); }

http://stackoverflow.com/a/23186659
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/23186624
has body: You're executing two independent commands: su starting a root shell (which you subsequently ignore) mv ran as you, which is deemed to fail What you need is a single command like sudo mv src dst Be careful when working as root.
has comment: http://stackoverflow.com/comment/35463206
score: 1
has comment: http://stackoverflow.com/comment/35463250
downvote count: 0
has comment: http://stackoverflow.com/comment/35464053

http://stackoverflow.com/comment/35522149
score: 0
has text: Is there a reason why you're doing this yourself, rather than following the [Example XLS to CSV converter that Apache POI provides](http://svn.apache.org/repos/asf/poi/trunk/src/examples/src/org/apache/poi/hssf/eventusermodel/examples/XLS2CSVmra.java)?
type: Comment
comment on: http://stackoverflow.com/q/23201427
type: QuestionComment

http://stackoverflow.com/q/23259942
tagged with: android
downvote count: 0
type: UnansweredQuestion
has title: Issue Preparing MediaPlayer to play custom file
has answer: http://stackoverflow.com/a/23260595
tagged with: android-mediaplayer
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/23259993
type: Question
tagged with: illegalstateexception
answer count: 2
upvote count: 1
tagged with: media
favorite count: 0
has body: So basically everything works fine when I'm playing audio from the file included with the application in the res/raw folder, but when I want a user to pick their own file, I'm having troubles. The object is to have the datasource for the media player set to the URI of the user's chosen file. Then to initialize the player with the new datasource and play it. My error comes when the the play method is invoked. It ends up saying I called play in an illegal state (i.e. I didn't prepare the player beforehand) but it's definitely prepared. What is happening and how can I fix it? Invoked method to choose file: public void chooseFile(){ Intent intent; intent = new Intent(); intent.setAction(Intent.ACTION_GET_CONTENT); intent.setType("audio/mpeg"); startActivityForResult(Intent.createChooser(intent, chosenAudioFilePath), 1); } Activity result method: @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if(resultCode != RESULT_CANCELED){ if (requestCode == 1 &amp;&amp; resultCode == Activity.RESULT_OK){ if ((data != null) &amp;&amp; (data.getData() != null)){ userChosenFilePath = data.getData(); setSongToUserPick(); } } }} setSongToUserPick method: public void setSongToUserPick(){ stop(); currentAudioPath = userChosenFilePath; initializePlayer(); stopped = false; play(); } Stop method: public void stop() { isPlaying = false; stopped = true; playPauseButton.setText("Play"); player.stop(); player.release(); } Initialize Player method: public void initializePlayer() { nowPlayingView.setText(FilenameUtils.getBaseName(currentAudioPath.toString())); try { player.setDataSource(thisContext, currentAudioPath); } catch (IllegalArgumentException | SecurityException | IllegalStateException | IOException e) { e.printStackTrace(); } try { player.prepare(); } catch (IllegalStateException | IOException e) { e.printStackTrace(); } } and finally, Play method: public void play() { if(isPrepared){ isPlaying …

http://stackoverflow.com/q/23153750
type: Question
answer count: 2
tagged with: android
has title: Android - How to add all the values in a database to arraylist
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/23156031
has body: I have the following database class, I have a simple question... getrecords() method returns just the first name in the database i.e., 10 , All i need is that I want to store all the names in the database to the arraylist i.e., 10 and 100, how do i do that?. I am a beginner , so don't have much knowledge about this stuff. Thankyou for your help ! public class Database { public static final String KEY_ROWID = "ID"; public static final String KEY_NAME = "NAME"; public static final String KEY_HOTNESS = "PLACE"; private static final String DATABASE_NAME = "Database.db"; private static final String DATABASE_TABLE = "peopleTable"; private static final int DATABASE_VERSION = 6; private static DbHelper ourHelper; private final Context ourContext; private static SQLiteDatabase ourDatabase; private static class DbHelper extends SQLiteOpenHelper{ public DbHelper(Context context) { super(context, DATABASE_NAME, null, DATABASE_VERSION); // TODO Auto-generated constructor stub } @Override //I create it here, right? public void onCreate(SQLiteDatabase db) { db.execSQL("CREATE TABLE " + DATABASE_TABLE + " (" + KEY_ROWID + " INTEGER PRIMARY KEY AUTOINCREMENT, " + KEY_NAME + " TEXT NOT NULL UNIQUE, " + KEY_HOTNESS + " TEXT NOT NULL);" ); db.execSQL("INSERT INTO " + getDatabaseTable() + "(NAME, PLACE) VALUES('10',' Plantation')"); db.execSQL("INSERT INTO " + getDatabaseTable() + "(NAME, PLACE) VALUES('100','NR Plantation')"); } @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { db.execSQL("DROP TABLE IF EXISTS " + getDatabaseTable()); onCreate(db); } public void close(Database database) { // TODO Auto-generated method stub } } public Database(Context c){ ourContext = c; } public Database open() throws SQLException{ ourHelper = new DbHelper(ourContext); ourDatabase = ourHelper.getWritableDatabase(); return this; } public void close() { ourHelper.close(); } public static String getDatabaseTable() { return DATABASE_TABLE; } public List&lt;String&gt; getr…
possible better answer: http://stackoverflow.com/a/23153851
has answer: http://stackoverflow.com/a/23153851
tagged with: arrays
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23156031

http://stackoverflow.com/q/23276891
type: AnsweredQuestion
has title: JDBC and MySQL: Do changes in the underlying database are known to the java program?
tagged with: java
tagged with: mysql
possible better answer: http://stackoverflow.com/a/23276957
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/23276968
accepted answer: http://stackoverflow.com/a/23276968
has answer: http://stackoverflow.com/a/23276957
score: 0
tagged with: sql
tagged with: jdbc
has body: Suppose that, after I establish a connection of my java application with my underlying MySQL database, and then open MySQL workbench and update some rows in a table, and then retrieve the fields of that table in the java client, will those changes synchronize with the java program. In other words, will those changes appear in the results of queries I carry out in the java program? In general, after establishing a connection between a java application and a MySQL database, are the updates, deletions, alterations etc. carried out in the database by using the MySQL DBMS (and not the java program) visible to the program?

http://stackoverflow.com/a/25812910
score: 0
type: Answer
has body: Boolean isSrvConnected(){ return ssh.connect(); }
answers question: http://stackoverflow.com/q/23130265

http://stackoverflow.com/a/23169326
answers question: http://stackoverflow.com/q/23169001
score: 0
type: Answer
has body: You can set an onClickListener on your button which will start the Intent: Button button = (Button) findViewById(R.id.button); button.setOnClickListener(new OnClickListener() { public void onClick(View v) { Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse("http://google.com/")); startActivity(i); } });

http://stackoverflow.com/comment/35559286
type: Comment
type: QuestionComment
has text: Posted while you were posting too. So, obviously, you had a point!
score: 0
comment on: http://stackoverflow.com/q/23240464

http://stackoverflow.com/comment/35401440
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23151742
type: AnswerComment
has text: @VarunKarhadkar Yep, there is none. But it doesn't solve the task!

http://stackoverflow.com/comment/35603517
has text: We are using Apache Tika library to generate metadata. Here is a list for a PDF file which fails to upload with metadata - `Creation-Date, dcterms:modified, meta:save-date, Last-Modified, date, created, xmpTPg, dcterms:created, Last-Save-Date, modified, Content-Type, meta:creation-date, xmp:CreatorTool, producer.`
comment on: http://stackoverflow.com/q/23239304
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23132619
answers question: http://stackoverflow.com/q/23132560
upvote count: 1
has comment: http://stackoverflow.com/comment/35367125
score: 1
has body: You go wrong over here if(bundle1 != null){ string1 = getArguments().getString(string1); string2 = getArguments().getString(string2); } Correct with below: if(bundle1!= null){ String string1=getArguments().getString("String1"); // Provide Double Quotes String string2=getArguments().getString("String2"); // Provide Double Quotes }
downvote count: 0
type: Answer

http://stackoverflow.com/q/23204924
score: 0
answer count: 3
accepted answer: http://stackoverflow.com/a/23211381
has comment: http://stackoverflow.com/comment/35495622
has answer: http://stackoverflow.com/a/23211381
possible better answer: http://stackoverflow.com/a/23205009
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35495325
tagged with: java
has answer: http://stackoverflow.com/a/23205171
tagged with: collections
has body: I want to ask about collection that i can use in my project. The following are my requirements. It have key-value pair. One is mobile field and other is distance. mobile field is unique but distance is not unique. It should store them as ascending order of distance field. I do not want dupicates distance(key-pair) to be removed. I have already tried to use TreeMap taking distance as key and mobile as value. But it is removing the duplicates. And I can not also make mobile as key because, otherwise it will sort the pair according to the value of mobile. so please tell what to do. TreeMap tree = new TreeMap(); while(rs.next()){ // obtaining dist and mob values here tree.put(dist, mob); } Set set=tree.entrySet(); Iterator itr=set.iterator(); out.println("distance " + "mobile"); while(itr.hasNext()){ Map.Entry m=(Map.Entry)itr.next(); out.println(m.getKey()+" "+m.getValue()+"\n"); } I want to get all mobile numbers in the order of their corresponding increasing distances. This is what i have tried so far , but the problem with this is it is eliminating duplicate distances.
type: Question
has comment: http://stackoverflow.com/comment/35495190
has comment: http://stackoverflow.com/comment/35495642
has title: Ask about a particular java collections having following properties
has answer: http://stackoverflow.com/a/23205009
has comment: http://stackoverflow.com/comment/35495330

http://stackoverflow.com/comment/35412308
has text: Correct, but I'd like to know the specific type that is returned when using the Convertor (for whatever possible implementation of `Content`), instead of simply working with the interface. I hope that makes sense :)
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23157636
score: 0

http://stackoverflow.com/q/23175183
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/29267253
upvote count: 6
possible better answer: http://stackoverflow.com/a/29267253
score: 6
has answer: http://stackoverflow.com/a/23175235
has title: Ant - difference between task and target
has body: I am new to Ant, and having difficulty in understanding some of its basic things like task and target. Online documentation and books say that target is a stage of the entire build process, while task is the smallest unti of work. However, I find it very difficult to understand what exactly is meant by this, Can someone explain in depth with examples what are targets and tasks in Ant?
tagged with: build
type: AnsweredQuestion
tagged with: ant
tagged with: java
type: Question
answer count: 2
accepted answer: http://stackoverflow.com/a/23175235

http://stackoverflow.com/q/23229538
has body: So I edited the name of a JUnit test and now it wont work. Instead I get Unrooted Tests: initializationError. This is a simple test. Infact it is a test for JUnit tests as I am just starting to use it. @Test public void testRun() String s = null; assertNull(s); } and all i did was change it to testRun2(). Also when I run the file not the individual test, it still runs the old testRun(), not testRun2(). My project has Maven not sure if that is a factor. And I have updated the project
has title: JUnit test, Unrooted Tests: initializationError
answer count: 3
score: 2
tagged with: junit
downvote count: 0
has answer: http://stackoverflow.com/a/23249580
favorite count: 0
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35540480
tagged with: maven
tagged with: java
has comment: http://stackoverflow.com/comment/35539799
has answer: http://stackoverflow.com/a/26641846
tagged with: unit-testing
type: Question
has answer: http://stackoverflow.com/a/43669547

http://stackoverflow.com/a/23264260
has body: You can do something like Scanner scanner = new Scanner(System.in); String[] command = scanner.nextLine().trim().split(" "); assuming you are reading command from standard input.
accepted answer of: http://stackoverflow.com/q/23264129
score: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23264129
type: Answer

http://stackoverflow.com/a/36207966
score: 0
type: Answer
has body: You may want to consider storing the strings as 0-prefix to a fixed maximum length, eg: 001, 023, 234 etc. Ordering will then work correctly using the normal string alpha comparison. See Ordering results by computed value in Hibernate for a JPA specific implementation way of achiveing close to the same thing. Another option is to store your collection in a TreeSet with a custom comparator.
answers question: http://stackoverflow.com/q/23263480

http://stackoverflow.com/a/23288233
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/35655133
accepted answer of: http://stackoverflow.com/q/23283944
answers question: http://stackoverflow.com/q/23283944
upvote count: 1
type: AcceptedAnswer
has body: I tried to add this panel to a frame, but it did not even show up, unless I commented out the stuff from the "initComponents" method. I guess there's something wrong, but this auto-generated code is unreadable. I assume that the jPanel1 (that the mouse listener is added to) is not placed properly. You could add the mouse listener to the animation panel directly. However, here is it as a SSCCE: import java.awt.Graphics; import java.awt.GridLayout; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.util.Random; import javax.swing.JFrame; import javax.swing.SwingUtilities; /** * * @author matthewtingle */ public class AnimatedSelectionSortPanel extends javax.swing.JPanel { private static final int NUMBER_INDEXES = 50; private static int[] number = new int[NUMBER_INDEXES]; public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { JFrame f = new JFrame(); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.getContentPane().setLayout(new GridLayout(1,1)); f.getContentPane().add(new AnimatedSelectionSortPanel()); f.setSize(600,300); f.setLocationRelativeTo(null); f.setVisible(true); } }); } /** * Creates new form AnimatedSelectionSortPanel */ public AnimatedSelectionSortPanel() { addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { selectionSort(); repaint(); } }); loadArray(); for(int i = 0; i &lt; NUMBER_INDEXES; i++){ if(i%10==0){ System.out.println(""); System.out.print("" + number[i]+", "); }else{ System.out.print("" + number[i]+", "); } } } @Override public void paintComponent(Graphics g) { super.paintComponent(g); drawPass(g); for (int i = 0; i &lt; NUMBER_INDEXES; i++){ if(i%10==0){ System.out.println(""); System.out.print(""+ number[i]+ ", "); }else{ System.out.print(""+ number[i]+ ", "); } } } private void loadArray() { Random rnd = new Random(); for (int i = 0; i &lt; NUMBER_INDEXES; i++) { number[i] = rnd.nextInt((100 - 20) + 1) + 20; } } …
type: Answer

http://stackoverflow.com/q/23153373
tagged with: inheritance
tagged with: protected
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/23154171
favorite count: 0
possible better answer: http://stackoverflow.com/a/23154919
has answer: http://stackoverflow.com/a/23154919
type: AnsweredQuestion
upvote count: 3
tagged with: java
has title: What does the Java compiler do when it sees the keyword extends?
accepted answer: http://stackoverflow.com/a/23154171
type: Question
score: 3
has body: Consider the following code. A.java, main package: package pkgs.main; public class A { protected int x; } B.java, test package: package pkgs.test; import pkgs.main.A; public class B extends A { } When the javac compiler is run, does it do something roughly like this: A.java, main package: package pkgs.main; public class A { protected int x; } B.java, test package: package pkgs.test; import pkgs.main.A; public class B extends A { // Some "flag/code" that says: // Must be aware that the following new and seperate copy of x // has originated from class A, which is inside a package called main. protected int x; } The reason why I ask is that I'm trying to understand if it's essential that a subclass must be aware of all of the "properties/attributes" of its inherited members, in order to operate. If that is true, then would this kind of programming inheritance differ slightly from inheritance found in the "real world"? For example, I inherit various properties from my parents, but I can be completely ignorant of all of this information. (Say if my parents were to pass away, I could continue to operate.) Whereas, I wonder if Java's inheritance isn't independent in this sense, if a child subclass must always be aware of where it got its inherited members from, in order to correctly operate. The thing is, I get confused when reading about inheritance in programming books. They provide examples involving real world objects such animals and cats and dogs etc, but based on the paragraph above, I'm wondering if there is a subtle "mechanism difference" between Java inheritance, and inheritance examples given in Java books that involve these types of real world objects. The problem that I'm having with Java is that I don't understand why I'm allowed to do the following. The code below is some simple "calling code" in a "Main class" involving the two classes (A and B) already defined above. Main.java, main package: package pkgs.main; import pkgs.test.B; // Just some method inside…

http://stackoverflow.com/comment/66288142
has text: tried everything nothing worked until I found this gem hidden here.
type: AnswerComment
type: Comment
score: 1
comment on: http://stackoverflow.com/a/38366380

http://stackoverflow.com/comment/35539224
comment on: http://stackoverflow.com/a/23227217
has text: Thank you for editing. Now I know how to show the code in concrete lang. And it has improved my english, too.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/35637748
type: Comment
type: QuestionComment
has text: @user3189142 I think he need the equation
comment on: http://stackoverflow.com/q/23282908
score: 0

http://stackoverflow.com/comment/35600176
type: Comment
has text: +1. Perhaps you should also add a remark about better not storing plain text passwords in the database.
comment on: http://stackoverflow.com/a/23263251
score: 1
type: AnswerComment

http://stackoverflow.com/comment/35542975
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/23231314
has text: Which line in the constructor?
type: Comment

http://stackoverflow.com/q/23204523
tagged with: gson
has title: Convert Java object to JSON string using gson
type: Question
has body: In Java I have object that contains an List of object and each object in List Contains EncryptedInteger object Vote.java public class Vote implements Serializable { private static final long serialVersionUID = 2L; private int voteId; private int surveyId; private int voterId; private List&lt;Choice&gt; choices; private boolean counted; public Vote(){ } public Vote(int surveyId,int voterId){ this.surveyId=surveyId; this.voterId=voterId; this.choices = new ArrayList&lt;Choice&gt;(); this.counted=false; } public Vote(int voteId,int surveyId,int voterId, boolean counted){ this.voteId=voteId; this.surveyId=surveyId; this.voterId=voterId; this.choices = new ArrayList&lt;Choice&gt;(); this.counted=counted; } public void addChoice(Choice choice) { choices.add(choice); } public String ChoicesToJson() { Gson gson = new Gson(); String json = gson.toJson(this.choices); return json; } public void JsonToChoices(String json) { Gson gson = new Gson(); TypeToken&lt;List&lt;Choice&gt;&gt; token = new TypeToken&lt;List&lt;Choice&gt;&gt;() { }; this.choices = gson.fromJson(json, token.getType()); } public int getVoteId() { return voteId; } public void setVoteId(int voteId) { this.voteId = voteId; } public int getSurveyId() { return surveyId; } public void setSurveyId(int surveyId) { this.surveyId = surveyId; } public int getVoterId() { return voterId; } public void setVoterId(int voterId) { this.voterId = voterId; } public List&lt;Choice&gt; getChoices() { return choices; } public void setChoices(List&lt;Choice&gt; choices) { this.choices = choices; } public boolean isCounted() { return counted; } public void setCounted(boolean counted) { this.counted = counted; }} Choice.java public class Choice implements Serializable { private static final long serialVersionUID = 3L; private EncryptedInteger encryptedInteger; private int questionNumber; private int optionNumber; private double S; public Choice(EncryptedInteger encryptedInteger, int questionNumber, int optionNumber, double s) { this.…
upvote count: 2
score: 0
has comment: http://stackoverflow.com/comment/35497079
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/35494901
has answer: http://stackoverflow.com/a/23206002
accepted answer: http://stackoverflow.com/a/23206002
has comment: http://stackoverflow.com/comment/35494790
has comment: http://stackoverflow.com/comment/35495607
has comment: http://stackoverflow.com/comment/35497347
type: AnsweredQuestion
tagged with: biginteger
tagged with: java
tagged with: http://stackoverflow.com/tag/json
downvote count: 2

http://stackoverflow.com/q/23137773
has comment: http://stackoverflow.com/comment/35377085
type: Question
has comment: http://stackoverflow.com/comment/35377252
tagged with: java
has comment: http://stackoverflow.com/comment/35376969
has comment: http://stackoverflow.com/comment/35377158
has comment: http://stackoverflow.com/comment/35377228
tagged with: for-loop
answer count: 1
tagged with: sorting
favorite count: 0
has comment: http://stackoverflow.com/comment/35377095
has body: Ok so this is my code. I'm supposed to gather 10 numbers of input and then sort them in descending order by the number of which they appear. Ex. {0,0,1,2,2,2] My output would be "Mode=2 and then have 2 appears 3 times, 0 appears two times, 1 appears once." My code can gather the 10 integers and find the mode but I'm having issues trying to sort the numbers in that way. This is what I have so far and I'm stuck. import java.util.*; class question2 { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int[] arrTwo = new int[10]; int x=0; for (int i = 0; i &lt; 10; i++) { System.out.println("Enter number: " + (i + 1)); arrTwo[i] = scan.nextInt(); } mode(arrTwo); int temp; int bs[] = new int[10]; for ( x=0 ; x&lt;=8 ; ++x ) { if (bs[x]&gt;bs[x+1]) { temp=bs[x]; bs[x]=bs[x+1]; bs[x+1]=temp; x=-1; } } for(int i = 0; i &lt;= bs.length-1; i++) { for(int index=0; index &lt;= 99 ; index++) { if (i == i) { bs[i] +=1; } } System.out.println("The number " + i + " is generated " +arrTwo[i] + " times"); } } public static void mode(int[] array) { int modeTrack[] = new int[10]; int max =0; int number =0; for (int i = 0; i &lt; array.length; i++) { modeTrack[array[i]] += 1; } int maxIndex = 0; for (int i = 1; i &lt; modeTrack.length; i++) { int newNum = modeTrack[i]; if (newNum &gt; modeTrack[maxIndex]) { maxIndex = i; } }System.out.println("The mode is: "+maxIndex); } My output isn't listing my numbers, just 0-9 and the generated times is just going from 1-9 with no basis or order.
downvote count: 3
has comment: http://stackoverflow.com/comment/35377045
has title: How do I sort the numbers inputted from an array to tell how many times the number was entered
upvote count: 0
has answer: http://stackoverflow.com/a/23138333
tagged with: temp
has comment: http://stackoverflow.com/comment/35376924
type: UnansweredQuestion
score: -3
has comment: http://stackoverflow.com/comment/35377120
tagged with: loops
has comment: http://stackoverflow.com/comment/35377129

http://stackoverflow.com/comment/35449304
comment on: http://stackoverflow.com/a/23178701
type: AnswerComment
type: Comment
has text: 04-20 01:18:29.526: E/AndroidRuntime(1130): java.lang.NullPointerException
score: 0

http://stackoverflow.com/comment/35535759
type: Comment
type: QuestionComment
has text: @Kamil is probably correct. When you started the project did you select an API that explicitly stated Google in it? If you just select an Android api for the build, maps will not work. You should be able to change this the target api in the properties section.
comment on: http://stackoverflow.com/q/23227204
score: 0

http://stackoverflow.com/a/75408195
type: Answer
has body: If you want to validate with selenium the color by Name, you can add this class in your utils files and use it in your tests for color validation. import java.awt.*; import java.lang.reflect.Field; import java.util.ArrayList; public class ColorUtils { private static ArrayList<ColorName> initColorList() { ArrayList<ColorName> colorList = new ArrayList<>(); colorList.add(new ColorName("AliceBlue", 0xF0, 0xF8, 0xFF)); colorList.add(new ColorName("AntiqueWhite", 0xFA, 0xEB, 0xD7)); colorList.add(new ColorName("Aqua", 0x00, 0xFF, 0xFF)); colorList.add(new ColorName("Aquamarine", 0x7F, 0xFF, 0xD4)); colorList.add(new ColorName("Azure", 0xF0, 0xFF, 0xFF)); colorList.add(new ColorName("Beige", 0xF5, 0xF5, 0xDC)); colorList.add(new ColorName("Bisque", 0xFF, 0xE4, 0xC4)); colorList.add(new ColorName("Black", 0x00, 0x00, 0x00)); colorList.add(new ColorName("BlanchedAlmond", 0xFF, 0xEB, 0xCD)); colorList.add(new ColorName("Blue", 0x00, 0x00, 0xFF)); colorList.add(new ColorName("BlueViolet", 0x8A, 0x2B, 0xE2)); colorList.add(new ColorName("Brown", 0xA5, 0x2A, 0x2A)); colorList.add(new ColorName("BurlyWood", 0xDE, 0xB8, 0x87)); colorList.add(new ColorName("CadetBlue", 0x5F, 0x9E, 0xA0)); colorList.add(new ColorName("Chartreuse", 0x7F, 0xFF, 0x00)); colorList.add(new ColorName("Chocolate", 0xD2, 0x69, 0x1E)); colorList.add(new ColorName("Coral", 0xFF, 0x7F, 0x50)); colorList.add(new ColorName("CornflowerBlue", 0x64, 0x95, 0xED)); colorList.add(new ColorName("Cornsilk", 0xFF, 0xF8, 0xDC)); colorList.add(new ColorName("Crimson", 0xDC, 0x14, 0x3C)); colorList.add(new ColorName("Cyan", 0x00, 0xFF, 0xFF)); colorList.add(new ColorName("DarkBlue", 0x00, 0x00, 0x8B)); colorList.add(new ColorName("DarkCyan", 0x00, 0x8B, 0x8B)); colorList.add(new ColorName("DarkGoldenRod", 0xB8, 0x86, 0x0B)); colorList.add(new ColorName("DarkGray", 0xA9, 0xA9, 0xA9)); colorList.add(new ColorName("DarkGreen", 0x00, 0x64, 0x00)); colorList.add(new ColorName("DarkKhaki", 0xBD, 0xB7, 0x6B)); colorList.add(new C…
answers question: http://stackoverflow.com/q/23220575
score: 0

http://stackoverflow.com/comment/35514798
type: QuestionComment
comment on: http://stackoverflow.com/q/23215834
type: Comment
has text: You probably need to write your main method contents in either doGet or doPost method. Or you may invoke the main method from those do* methods directly. If you are not sure what these do* methods are, then you will have to read about servlets a bit first
score: 0

http://stackoverflow.com/comment/35440978
type: QuestionComment
score: 1
has text: where is hundred button code i could not see in above code , there is only one button i can see
comment on: http://stackoverflow.com/q/23173979
type: Comment

http://stackoverflow.com/q/23222767
has body: I use Hibernate to manage a DB table and everything works just well. Now, another system should access the same DB table and I cannot tell it to use Hibernate (because is a monolithic piece of software). My doubt concerns the correct usage of the DB from an external software and the consistency problems this approach brings to my attention. In particular, can it be a problem? Maybe Hibernate works in RAM (an ORM can implement caching and lazy transaction to speed up the write/read process) so a possible external transaction onto the DB may bring inconsistency in the Hibernate work. Is this the Hibernate case? Thank you
answer count: 3
has title: Is it possibile to access a Hibernate managed DB without Hibernate too?
has answer: http://stackoverflow.com/a/23223200
possible better answer: http://stackoverflow.com/a/23222919
has answer: http://stackoverflow.com/a/23222911
type: AnsweredQuestion
tagged with: java
tagged with: hibernate
type: Question
has answer: http://stackoverflow.com/a/23222919
has comment: http://stackoverflow.com/comment/35527174
accepted answer: http://stackoverflow.com/a/23223200
score: 0

http://stackoverflow.com/comment/35394407
type: QuestionComment
comment on: http://stackoverflow.com/q/23147128
has text: Well... define _implement_. _Where_ do you want to use it? _How_ do you want to implement it?
score: 0
type: Comment

http://stackoverflow.com/comment/35576791
has text: The program is incomplete. Provide the full description to link the code properly.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23250438

http://stackoverflow.com/comment/35646608
has text: Ah, you did not simply mean a directory called src, you meant the source code directory of the project/running class.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23288022

http://stackoverflow.com/comment/35379662
type: Comment
has text: Your code explicitly says you want the IDE to tell you to declare a generic type of Long, assuming you want a List of Long. It has no idea what kind of list you want, so the question should be framed around the desire to be warned about a missing generic type in general, not a recommendation for a specific one. It's a small distinction.
comment on: http://stackoverflow.com/q/23138501
score: 0
type: QuestionComment

http://stackoverflow.com/q/23135099
favorite count: 0
tagged with: keylogger
has answer: http://stackoverflow.com/a/23138550
tagged with: swing
has title: Event handling in keylogger
type: AnsweredQuestion
has body: While thinking of making a keylogger here I learnt how to register listener class with JFrame problem with this approach is that it works when JFrame is in focus otherwise it does not. My question is there any other object with which I can register my listener class and can get the key pressed whether JFrame was in focus or not. package javaapplication2; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import javax.swing.JFrame; public class KeyListenerTest extends JFrame implements KeyListener { KeyListenerTest() { this.addKeyListener(this); } @Override public void keyTyped(KeyEvent ke) { //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. System.out.println( ke.getKeyChar() ); } @Override public void keyPressed(KeyEvent ke) { //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } @Override public void keyReleased(KeyEvent ke) { //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } public static void main(String[] args) { KeyListenerTest app = new KeyListenerTest(); app.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE ); app.setSize(500, 500); //app.setVisible(true); } }
tagged with: java
downvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/23138550
upvote count: 0
tagged with: event-handling
score: -1
linked to: http://stackoverflow.com/q/6172556
has comment: http://stackoverflow.com/comment/35375032
answer count: 1
tagged with: events

http://stackoverflow.com/comment/35626730
type: Comment
score: 1
has text: This might be helpful: http://stackoverflow.com/a/5362572/2865997
type: QuestionComment
comment on: http://stackoverflow.com/q/23277062

http://stackoverflow.com/comment/35536726
type: QuestionComment
has text: what type of array is `list`? You're attempting to push a `Character` object into what I might assume is a `char` array?
score: 0
comment on: http://stackoverflow.com/q/23228029
type: Comment

http://stackoverflow.com/a/23149301
has comment: http://stackoverflow.com/comment/35397443
type: Answer
upvote count: 1
score: 1
downvote count: 0
has body: Try this in your web.xml if you are using Apache Tomcat 30
answers question: http://stackoverflow.com/q/23149203

http://stackoverflow.com/comment/35509193
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/23207313
type: Comment
has text: But the css files that use the resources are on the client side.

http://stackoverflow.com/a/23154754
type: Answer
answers question: http://stackoverflow.com/q/23154665
has body: You can use request.getContextPath() in your action class, and you can pass that to JSP as a string using request, or you can use bean to get that in JSP. Application scoped objects are stored as attributes of the ServletContext. If the "function call" has access to the ServletContext, then it can just grab them as follows: Bean bean = (Bean) servletContext.getAttribute("beanname"); I of course expect that the "function" is running in the servlet context. I.e. it is (in)directly executed by a servlet the usual way. You can also try this link. It have example with full explanation.
score: 0

http://stackoverflow.com/q/23175805
type: Question
has body: In the contract of Comparable, there's nothing forcing an object to be comparable to itself. It's just strongly recommended, but not strictly required that (x.compareTo(y)==0) == (x.equals(y)) which implies that it's recommended for x.compareTo(x) not to throw. But it's possible to write a class X implements Comparable&lt;Y&gt; { ... } where X and Y are two unrelated classes. I can't see what it could be good for, but in the Java 8 version of HashMap there's even a corresponding check. Is it allowed to implement X implements Comparable&lt;Y&gt; with two unrelated classes? Does it make any sense? I guess the answers are yes and no, but it's just a guess
has answer: http://stackoverflow.com/a/66449817
has comment: http://stackoverflow.com/comment/35444878
has comment: http://stackoverflow.com/comment/117475113
has comment: http://stackoverflow.com/comment/35444857
favorite count: 0
has comment: http://stackoverflow.com/comment/35454966
accepted answer: http://stackoverflow.com/a/23176679
answer count: 4
has comment: http://stackoverflow.com/comment/35444918
has title: Is there any Comparable not comparable to itself?
upvote count: 2
has comment: http://stackoverflow.com/comment/35445021
downvote count: 1
tagged with: java-8
has answer: http://stackoverflow.com/a/23176170
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/23176297
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/23176297
has comment: http://stackoverflow.com/comment/35444955
tagged with: comparable
has answer: http://stackoverflow.com/a/23176679
has comment: http://stackoverflow.com/comment/35444727

apache
tag name: apache
tags question: http://stackoverflow.com/q/23280533
tags question: http://stackoverflow.com/q/23166076
tags question: http://stackoverflow.com/q/23200742
tags question: http://stackoverflow.com/q/23282786
tags question: http://stackoverflow.com/q/23256999
tags question: http://stackoverflow.com/q/23139066
tags question: http://stackoverflow.com/q/23139660
tags question: http://stackoverflow.com/q/23225309
tags question: http://stackoverflow.com/q/23143297
tags question: http://stackoverflow.com/q/23151374
tags question: http://stackoverflow.com/q/23200602
tags question: http://stackoverflow.com/q/23271984
tags question: http://stackoverflow.com/q/23169865
tags question: http://stackoverflow.com/q/23243256
tags question: http://stackoverflow.com/q/23189678
tags question: http://stackoverflow.com/q/23192011
tags question: http://stackoverflow.com/q/23289399
tags question: http://stackoverflow.com/q/23248210
type: Tag
tags question: http://stackoverflow.com/q/23171901
tags question: http://stackoverflow.com/q/23281462
tags question: http://stackoverflow.com/q/23286442
tags question: http://stackoverflow.com/q/23260821
tags question: http://stackoverflow.com/q/23223973
tags question: http://stackoverflow.com/q/23248548

http://stackoverflow.com/q/23234143
score: 0
has answer: http://stackoverflow.com/a/23234303
answer count: 1
has title: Where is my logical mistake with my timer that animates a shot moving to the top of the frame?
type: UnansweredQuestion
tagged with: paintcomponent
has body: I'm making a simple space invaders-type game and I have made a mistake when trying to use a timer to animate a shot being fired upwards. Should I rework my code so that I add shots to a separate panel and then add that panel to the main panel in my frame? Or can I keep it the way I have it, just clean up the code and rework the logic a bit? Here's my completed code: public static void main(String[] args) throws IOException { GameTest t = new GameTest(); } public static class GameTest extends JFrame { private static final int WINDOW_WIDTH = 800; private static final int WINDOW_HEIGHT = 500; public static GamePanel gamePanel; public GameTest() throws IOException { super("Deep Fried Freedom"); setResizable(false); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setSize(WINDOW_WIDTH, WINDOW_HEIGHT); setLayout(new BorderLayout()); gamePanel = new GamePanel(); add(gamePanel); center(this); setVisible(true); this.addKeyListener(new aKeyListener()); this.setFocusable(true); } public void center(JFrame frame) { GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); Point center = ge.getCenterPoint(); int w = frame.getWidth(); int h = frame.getHeight(); int x = center.x - w / 2, y = center.y - h / 2; frame.setBounds(x, y, w, h); frame.validate(); }//end of center method public class aKeyListener implements KeyListener { @Override public void keyTyped(KeyEvent e) { }//end empty keyTyped method @Override public void keyPressed(KeyEvent e) { if (Launcher.lxCoord == 0 || Launcher.lxCoord == 735) { //ensure the launcher can't leave the frame Launcher.lRun *= -1; } else { switch (e.getKeyCode()) { case KeyEvent.VK_A : Launcher.lRun = -5; break; case KeyEvent.VK_D : Launcher.lRun = 5; break; case KeyEvent.VK_ENTER : gamePanel.numShots++; gamePanel.createShots(); break; default: Launcher.lRun = 0; } } gamePanel.move(gamePanel); }//end keyPressed method @Override public void keyReleased(KeyEvent e) { }//end empty keyReleased method }//end aKeyListener class }//end…
tagged with: swing
type: Question
tagged with: java
tagged with: jpanel
tagged with: keylistener
has comment: http://stackoverflow.com/comment/35547969

http://stackoverflow.com/comment/35499002
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23205585
has text: if i un-commented the synchronized block at the end of my code which has the notifyall() , would that eliminate any potential issues?

http://stackoverflow.com/comment/35601033
type: Comment
score: 1
comment on: http://stackoverflow.com/a/23249391
has text: Perhaps you could do a dynamic parameter list `@Component(id="grid", publishParameters="prop:myCalculatedParameterList")`
type: AnswerComment

http://stackoverflow.com/comment/35419648
comment on: http://stackoverflow.com/q/23161634
has text: Several solutions in the linked question are for Windows, OS X, and Linux.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23208126
answers question: http://stackoverflow.com/q/23191281
has body: Don't put functions or subclasses in JSPs expecting to use them in others. (That is what they are after all, subclasses under that particular JSP.) It is very bad design. Create classes in actual .java files, compile them, and then call them from the JSPs. Even that is not particularly recommended (see How to avoid Java code in JSP files), but its better, a lot better. If you have access to the filesystem, you don't need to put classes in a EAR/WAR. Just put them on the filesystem under webapps/{theApp}/WEB-INF/classes/... You can even dispense with an IDE altogether, and just save all your .java files under webapps/{theApp}/WEB-INF/classes/... open a console, cd to that directory, and javac them. There is certainly no need to put class files in jars. You do, of course, have to restart the application afterwards.
type: Answer
score: 0

http://stackoverflow.com/comment/35362644
type: QuestionComment
has text: My others variables are inside scriplets. i would like to check this index variable with the other java variables inside the scriplets. say <% if(index == pageno) {%> <s:property value="userName" /> <% } %>
comment on: http://stackoverflow.com/q/23129994
score: 0
type: Comment

http://stackoverflow.com/a/23273588
downvote count: 1
accepted answer of: http://stackoverflow.com/q/23272987
has comment: http://stackoverflow.com/comment/35626502
has body: Ideally, it will read it simultaneously, but it is not safe in some cases. For example, if you declare: int i = 1; Thread threadOne = new Thread() { public void run() { i++; System.out.println("ThreadOne is " + i); } }; Thread threadTwo = new Thread() { public void run() { i++; System.out.println("ThreadTwo is "+ i); } }; Thread threadThree = new Thread() { public void run() { i++; System.out.println("ThreadThree is " + i); } }; threadOne.start(); threadTwo.start(); threadThree.start(); You can try several times and you will see the result varies. Without synchronization, all of thread will read and write the memory "randomly" OR "simultaneously" in the other word, depend on who finish first. The result I get after run the program several times: ThreadOne is 1 ThreadThree is 3 ThreadTwo is 2 ThreadOne is 3 ThreadThree is 3 ThreadTwo is 3 ThreadTwo is 2 ThreadThree is 3 ThreadOne is 2 As we can see, all three thread read the memory which contain int i randomly and update the int a by adding one. If one thread has added one, then another thread will read 2. The system.out.println() is also a process. In the second attempt, it prints all 3s. It means after three thread has read int i and add 1, the final result of int i became 3. Then the system.out.println will all print 3. Here is another way to prove, among all these threads, all the process are running simultaneously or the thread are running simultaneously.
answers question: http://stackoverflow.com/q/23272987
score: 2
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35619944
type: Answer
upvote count: 3
has comment: http://stackoverflow.com/comment/35627173
has comment: http://stackoverflow.com/comment/35625047

http://stackoverflow.com/comment/35641662
score: 2
has text: When `Root->instance` is cleared, the instance that contains the final field is no longer reachable, and therefore whatever the final field refers to is also no longer reachable, provided nothing else refers to it. Being unreachable is not the same as being a weak reference.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23284509

http://stackoverflow.com/a/23152813
answers question: http://stackoverflow.com/q/23152758
downvote count: 0
type: Answer
has body: In your for-loop you can test beforehand, if the element is in the map and if not, you put it with frequency 0 into it. for (String a : argss) { if(m.get(a) == null) { m.put(a,0); } Integer freq = m.get(a); m.put(a, freq + 1); }
has comment: http://stackoverflow.com/comment/35403334
upvote count: 1
score: 1

http://stackoverflow.com/comment/35529580
type: AnswerComment
has text: Or even better, use `String.matches()`, which is much more concise.
type: Comment
comment on: http://stackoverflow.com/a/23224154
score: 0

http://stackoverflow.com/a/23131688
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/23131607
downvote count: 0
type: Answer
has body: Use this code for printing the array in reverse order. int j = integers.length; //integers is the array in which the values are stored. for(int k=j-1; k&gt;=0; k--) System.out.print(integers[k]+"-");

http://stackoverflow.com/a/23196309
score: 0
has body: Looks like -libjars option is missing. Specify the jar, which contains the custom format and custom partitioner along with -libjars option also set the newly created jar in the environment variable HADOOP_CLASSPATH as follows before executing hadoop command export HADOOP_CLASSPATH=${HADOOP_CLASSPATH}:Path-Custom-Format.jar
answers question: http://stackoverflow.com/q/23190746
type: Answer

http://stackoverflow.com/comment/35425604
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23153763
has text: Note also there is another close reason that comes down to 'requesting links to offsite resources'. So, right there we have a *2nd reason* for closing this question. (I have already voted to close as 'too broad', so cannot vote again.)
type: Comment

http://stackoverflow.com/comment/35495147
has text: Did you declare CommonsMultipartResolver in servlet context xml?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23204721

http://stackoverflow.com/a/41380934
type: Answer
has body: this implementation of Delayed is good because: implementation of compareTo() does not do any class casting, eliminatig the possibility of throwing a ClassCastException implementation of compareTo() uses Math.min and Math.max functions before casting to int in order to properly prevent overflow errors implementation of getDelay() properly converts the units and actually returns the time remaining TestDelay class implements Delayed: import org.jetbrains.annotations.NotNull; import java.util.concurrent.Delayed; import java.util.concurrent.TimeUnit; public class TestDelay implements Delayed { public final Long delayMillis; public final Long expireTimeMillis; public TestDelay(Long delayMillis) { this.delayMillis = delayMillis; this.expireTimeMillis = System.currentTimeMillis()+delayMillis; } @Override public final int compareTo(@NotNull Delayed o) { long diffMillis = getDelay(TimeUnit.MILLISECONDS)-o.getDelay(TimeUnit.MILLISECONDS); diffMillis = Math.min(diffMillis,1); diffMillis = Math.max(diffMillis,-1); return (int) diffMillis; } @Override public final long getDelay(@NotNull TimeUnit unit) { long delayMillis = expireTimeMillis-System.currentTimeMillis(); return unit.convert(delayMillis,TimeUnit.MILLISECONDS); } } JUnit unit test showing an example of using the TestDelay class: import org.junit.Test; import java.util.concurrent.DelayQueue; public class DelayQueueTest { @Test public final void generalTest() throws InterruptedException { DelayQueue&lt;TestDelay&gt; q = new DelayQueue&lt;&gt;(); q.put(new TestDelay(500L)); q.put(new TestDelay(2000L)); q.put(new TestDelay(1000L)); q.put(new TestDelay(10L)); q.put(new TestDelay(3000L)); while (!q.isEmpty()) { System.out.println(q.take().delayMillis); } } } output of DelayQueueTest:
answers question: http://stackoverflow.com/q/23219801
downvote count: 0
score: 8
upvote count: 8

http://stackoverflow.com/comment/35410374
has text: If you started with a File (e.g., c:/classpath/test.jar or the base c:/classpath/directory/ containing com/example/classes/Foo.class), then use File.toURI().toURL(), then use it to create a CodeSource, then use it to create a ProtectionDomain, and use that when calling ClassLoader.defineClass.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/23156478
type: Comment

http://stackoverflow.com/a/23155885
answers question: http://stackoverflow.com/q/23155767
has body: package com.javacodegeeks.java.core; import java.util.regex.Matcher; import java.util.regex.Pattern; public class HexColorValidator { private Pattern pattern; private Matcher matcher; private static final String HEX_PATTERN = "^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$"; public HexColorValidator() { pattern = Pattern.compile(HEX_PATTERN); } public boolean validate(final String hexColorCode) { matcher = pattern.matcher(hexColorCode); return matcher.matches(); } } Code from http://examples.javacodegeeks.com/core-java/util/regex/matcher/how-to-validate-hex-color-code-with-regular-expression/
score: 4
upvote count: 4
downvote count: 0
type: Answer

http://stackoverflow.com/a/26881520
score: 16
downvote count: 2
has comment: http://stackoverflow.com/comment/42331052
type: Answer
has body: Simply speaking, to establish a connection to an SSL-endpoint, you have to trust its public certificate. To trust a certificate, either itself or the certificate of its issuer has to be in the keystore. Think of the keystore as a set of folders or a database/repository which contains certificates. Physically, it is a file in the JRE (/lib/security/cacerts). This repository can be modified with the keytool command that ships with the JRE. See this link for some common commands. Another way is to use the Certificate Dialog of the Java Control Panel (this is also installed with the JRE):
answers question: http://stackoverflow.com/q/23202046
upvote count: 18

http://stackoverflow.com/comment/35551031
type: QuestionComment
has text: Just call `reader.readLine()` before the loop.
score: 15
type: Comment
comment on: http://stackoverflow.com/q/23236000

http://stackoverflow.com/comment/35416912
score: 0
has text: For my own learning, what does the IN(f.sess) syntax do? and shouldn't there be a join between s and f in the query?
comment on: http://stackoverflow.com/q/23159715
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23180718
answers question: http://stackoverflow.com/q/23180528
upvote count: 1
type: AcceptedAnswer
type: Answer
downvote count: 0
has body: This line setJPanel(ciphertextArray, panel3, "1"); also adds a DocumentListener to every element of the ciphertextArray TextField. So every time the value of one of your cipher text TextFields changes, the method setCipherText() is invoked. This leads to the following sequence: You enter a new value in one of the TextFields of arrayIV or plainTextArray setCipherText() is invoked setCipherText() changes the value of a cipher text TextField setCipherText() is again invoked (explanation above). Go back to 2. Thats why you get the IllegalStateException. So the solution is to do NOT add a DocumentListener to the TextFields in your ciphertextArray. Solution could be implemented as follows: public void setJPanel(JTextField array[], JPanel container, String s, boolean docListener) { for (int i = 0; i &lt; 8; i++) { array[i] = new JTextField(s, 4); if (docListener) { array[i].getDocument().addDocumentListener(new DocumentListener() { @Override public void insertUpdate(DocumentEvent de) { setCiphertext(); } @Override public void removeUpdate(DocumentEvent de) { setCiphertext(); } @Override public void changedUpdate(DocumentEvent de) { setCiphertext(); } }); } container.add(array[i]); } } [...] setJPanel(arrayIV, panel1, "1a", true); setJPanel(plaintextArray, panel2, "1b", true); setJPanel(ciphertextArray, panel3, "1", false);
score: 1
accepted answer of: http://stackoverflow.com/q/23180528

http://stackoverflow.com/comment/35627158
score: 0
comment on: http://stackoverflow.com/q/23276678
type: QuestionComment
type: Comment
has text: On a more thorough google search, com.singularity.ee.agent appears to be linked to AppDynamics (though I cant find the exact class i am using here), which I am using to monitor memory. Perhaps AppDynamics is causing the problem itself.

http://stackoverflow.com/comment/35449294
type: Comment
type: QuestionComment
has text: @DanielLerps - Why is it discouraged ?
score: 0
comment on: http://stackoverflow.com/q/23178543

http://stackoverflow.com/comment/35615342
comment on: http://stackoverflow.com/q/23267017
score: 0
has text: @TechAgent your assumption is somewhat right. Now I have edited my question.Plz take a look. I hope it will be clear for u know and I need your suggestions for this
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35504610
type: Comment
has text: wouldn't that convert uppercase to lowercase
comment on: http://stackoverflow.com/a/23209695
score: 0
type: AnswerComment

http://stackoverflow.com/comment/35641066
has text: thanx for your valuable comment but i already tryied this its not working according to my requirment
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23284736

http://stackoverflow.com/comment/35513034
comment on: http://stackoverflow.com/q/23214677
has text: @user2758757 Can you provide an example please?
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/35508131
type: QuestionComment
has text: @VarunAchar Good point, I'm trying to figure out how to call java method from sqlite
comment on: http://stackoverflow.com/q/23211610
score: 0
type: Comment

http://stackoverflow.com/comment/35426847
type: QuestionComment
comment on: http://stackoverflow.com/q/23165790
score: 1
has text: Please create a MCVE - a **MINIMAL**, Complete and Verifiable example. I suggest learning about the `for` loop so that you can create your labels in icons in 3 lines of code instead of 72 lines.
type: Comment

http://stackoverflow.com/comment/35647748
comment on: http://stackoverflow.com/q/23281862
type: Comment
type: QuestionComment
has text: See Graeme's answer, it's what I was describing in my comment.
score: 0

http://stackoverflow.com/a/23150435
has comment: http://stackoverflow.com/comment/35399556
has comment: http://stackoverflow.com/comment/35399660
type: Answer
has comment: http://stackoverflow.com/comment/35399957
has comment: http://stackoverflow.com/comment/35399698
answers question: http://stackoverflow.com/q/23150104
has body: Try with OnTimeSetListener ontime = new OnTimeSetListener() { public void onTimeSet(TimePicker view, int hourOfDay, int minute) { // TODO Auto-generated method stub txt_time.setText(String.valueOf(hourOfDay) + ":" + String.valueOf(minute)); Intent intent = new Intent(getActivity(), AlarmReceiver.class); intent.putExtra("time_value",String.valueOf(hourOfDay) + " : " + String.valueOf(minute)); PendingIntent pendingIntent = PendingIntent.getBroadcast(getActivity(), RQS_1, intent, 0); AlarmManager alarmManager = (AlarmManager)ctx.getSystemService(Context.ALARM_SERVICE); alarmManager.set(AlarmManager.RTC_WAKEUP, txt_time.getTimeInMillis(), pendingIntent); } };
score: 0

http://stackoverflow.com/q/23142156
has comment: http://stackoverflow.com/comment/35385062
has body: I'm trying to click on element using below code and its working fine if variable does not have special characters. Values that passed in variable are: Product Passed Test Message -&gt; Failed Double Units 13/2" -&gt; failed I cannot go with partial text, because sometimes only difference between two element is special character. String Answertoselect = ElementName.replaceAll("'", "\\\\'"); String selectanswer = Answertoselect.replaceAll(" ", "${nbsp}");
has title: How to handle special characters like single/double quotes/space inside XPATH JAVA
tagged with: xpath
answer count: 0
downvote count: 0
type: UnansweredQuestion
tagged with: selenium-webdriver
score: 1
tagged with: java
type: Question
upvote count: 1
linked to: http://stackoverflow.com/q/1341847
favorite count: 0

http://stackoverflow.com/q/23239521
answer count: 2
favorite count: 0
has answer: http://stackoverflow.com/a/23289734
has title: Modifying an inlined constant at runtime in Java
tagged with: windows
has answer: http://stackoverflow.com/a/23244885
type: AnsweredQuestion
score: 3
tagged with: reflection
downvote count: 0
tagged with: java
tagged with: swt
type: Question
tagged with: runtime
has body: I'm trying to get SWT's DirectoryDialog to open without the "Make new folder" button showing on Windows. Windows' API supports this but unfortunately SWT doesn't. You can see SWT's Windows implementation here: http://kickjava.com/src/org/eclipse/swt/widgets/DirectoryDialog.java.htm Line 193 is where the magic happens. lpbi.ulFlags = OS.BIF_NEWDIALOGSTYLE | OS.BIF_RETURNONLYFSDIRS | OS.BIF_EDITBOX | OS.BIF_VALIDATE; I would like to add BIF_NONEWFOLDERBUTTON to the flags (see http://msdn.microsoft.com/en-us/library/windows/desktop/bb773205(v=vs.85).aspx). I've tried achieving this through an ugly reflection hack where I added BIF_NONEWFOLDERBUTTON to OS.BIF_NEWDIALOGSTYLE by doing a bitwise OR to the static field. Unfortunately that had no effect. I'm assuming it's because Java inlines it (since it's compile time constant). My question is therefore: how do I modify line 193 at runtime so that it includes this constant?
possible better answer: http://stackoverflow.com/a/23244885
accepted answer: http://stackoverflow.com/a/23289734
upvote count: 3

http://stackoverflow.com/a/29951548
downvote count: 0
score: 1
upvote count: 1
type: Answer
has body: Actually c3p0 is a JAR file which we uses in Hibernate. When we run our Hibernate application, we can see in the console that there is a line "Connection Pool Size 20". That is the number of connection objects available. If we uses only 5 connections, then 15 connection objects will be a waste, and in industry "Connection Objects" are very costly resources. That's why, to define the number of connection objects that may be needed in our application, we use the c3p0 JAR file.
answers question: http://stackoverflow.com/q/23140539

http://stackoverflow.com/q/23260821
has comment: http://stackoverflow.com/comment/35596252
downvote count: 2
type: AnsweredQuestion
has body: Can someone please explain, what is Apache Velocity ? what is its purpose ? It would be nice to provide an example along with it. Thanks in advance.
tagged with: java
has comment: http://stackoverflow.com/comment/97799720
upvote count: 10
accepted answer: http://stackoverflow.com/a/23261610
type: Question
has comment: http://stackoverflow.com/comment/35596366
has title: What is Apache Velocity?
tagged with: apache
answer count: 1
has comment: http://stackoverflow.com/comment/35596135
favorite count: 0
has answer: http://stackoverflow.com/a/23261610
tagged with: velocity
score: 8

http://stackoverflow.com/comment/35554902
has text: Sorry forgot to mention. It is using struts 2 framework
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23212866

http://stackoverflow.com/q/23229466
has comment: http://stackoverflow.com/comment/35542484
has comment: http://stackoverflow.com/comment/35542869
has title: How to rotate and draw an image in a specific way?
answer count: 0
type: UnansweredQuestion
tagged with: java
has body: I have a line. I know the endpoint of that line and an angle which tells by how many degrees it's tilted. I want to draw an image in such a way so that the bottom center point of the image would touch the endpoint of the line like so: Sadly, I get the wanted result only if line isn't rotated, like above. If it's rotated by, for example, 90 degrees I get this: This is the code that draws the image (line is already drawn by that point). public void drawCreature(Graphics2D g) { int centered = creature.getX() - creature.getImage().getWidth()/2; BufferedImage image = creature.getImage(); BufferedImage rotatedImage = new BufferedImage(image.getWidth(), image.getHeight(), BufferedImage.TYPE_INT_ARGB); Graphics2D g2d = (Graphics2D)rotatedImage.getGraphics(); g2d.rotate(Math.toRadians(creature.getAngle()), rotatedImage.getWidth()/2, rotatedImage.getHeight()/2); g2d.drawImage(creature.getImage(), 0, 0, null); g.drawImage(rotatedImage, centered, creature.getY(), null); } Any help would be appreciated.
linked to: http://stackoverflow.com/q/19209650
tagged with: swing
type: Question
tagged with: graphics
tagged with: rotation
has comment: http://stackoverflow.com/comment/35543638
has comment: http://stackoverflow.com/comment/35545216
score: 0

http://stackoverflow.com/a/23232631
upvote count: 3
has comment: http://stackoverflow.com/comment/35545563
has comment: http://stackoverflow.com/comment/35545190
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35545720
downvote count: 0
answers question: http://stackoverflow.com/q/23232570
accepted answer of: http://stackoverflow.com/q/23232570
score: 3
type: Answer
has body: Short answer is no - Java is single inheritance, so a class can not extend multiple classes. This is generally an indication that you should rethink your design. Without knowing specifics, it's hard to tell, but if Subclass1 and Subclass2 are similar, is there an abstract class you could create that extends JPanel, and then Subclass1 and Subclass2 could each extend that abstract class?
has comment: http://stackoverflow.com/comment/35545716

http://stackoverflow.com/comment/35810226
has text: You are definitely right, it crashes every time it pops up the suggestions for the signature of the method I'm calling... don't know how to disable that though
type: Comment
score: 1
comment on: http://stackoverflow.com/a/23346499
type: AnswerComment

http://stackoverflow.com/a/23143587
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/23143199
has body: First of all, a PreparedStatement is used to cache a single SQL statement. This has the advantage that the driver/database might optimize the statement since it is expecting many of them and since it is a parameterized statement. If you want to use it for two different SQL statements you need two PreparedStatements. In order to add rows to the statement you need to set your parameters using set*(1,...), set*(2,...), set*(3,...), etc. and then call addBatch() (no arguments!). Finally you submit the batch of statements using executeBatch().
upvote count: 1

http://stackoverflow.com/comment/35571152
comment on: http://stackoverflow.com/q/23246821
score: 0
has text: Instance variables are not polymorphic.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35641848
type: QuestionComment
comment on: http://stackoverflow.com/q/23285290
score: 0
has text: Yes Hello.java class is created after javac
type: Comment

http://stackoverflow.com/comment/35415847
type: AnswerComment
comment on: http://stackoverflow.com/a/23159636
score: 0
type: Comment
has text: @user3001301 Why should it be null first? I'd think that complicates things unnecessarily. I've added some code to show how the head can initially be its own next and previous element.

http://stackoverflow.com/a/23280677
type: Answer
has body: Yep, you need to encase the list in curly braces like this: int [] list = {5, 9, 12, 19, 64}; Just proper Java syntax issues.
answers question: http://stackoverflow.com/q/23280652
score: 0

http://stackoverflow.com/a/23203150
type: Answer
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/23195798
has comment: http://stackoverflow.com/comment/35588609
type: AcceptedAnswer
has body: You CANNOT cache the JNIEnv and should be using AttachCurrentThread() on the cached JVM*. If the native thread is already attached I believe this function is equivalent to a NOOP. if ((*jvm)-&gt;AttachCurrentThread(jvm, (void **)(&amp;env), NULL) == JNI_OK) { .... }
answers question: http://stackoverflow.com/q/23195798
has comment: http://stackoverflow.com/comment/35534995
upvote count: 1

http://stackoverflow.com/a/23272510
type: Answer
answers question: http://stackoverflow.com/q/23271598
has body: Based on this line it looks like all you're trying to do is produce the letters A to Z in some other order: int random = (65 + (int)(Math.random() * ((90 - 65) + 1)); If I'm understanding that right, then really all you're trying to do is shuffle the alphabet: // Initialize new alphabet array String originalAlphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; char[] newAlphabet = originalAlphabet.toCharArray(); // Shuffle the new alphabet by swapping each character to a random position for (int i=0; i&lt;26; i++) { int j = (int)(Math.random() * 26); char temp = newAlphabet[i]; newAlphabet[i] = newAlphabet[j]; newAlphabet[j] = temp; } // Print the new alphabet for (int i=0; i&lt;26; i++) { System.out.print(newAlphabet[i]); } System.out.println(); Here's a sample output: VYMTBIPWHKZNGUCDLRAQFSOEJX
score: 2
downvote count: 0
upvote count: 2

http://stackoverflow.com/a/23195072
has body: String queryCheck = "SELECT * from ..."; Statement st = conn.createStatement(); ResultSet rs = st.executeQuery(queryCheck); // execute the query, and get a java resultset if(rs.absolute(1)) { //record already exist }
answers question: http://stackoverflow.com/q/23194949
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/23194949
upvote count: 1
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/comment/35640448
type: QuestionComment
type: Comment
has text: Consider this first two set of data is in One XML file and other line in another XML... So I want compare this two file and print the uncommon things which is present in one file and not in other... I'm able to read the two file now I want to filter out? Using regular expression can I do??? HOw?? Coz Mozilla/4.0 ---- AND/OR are common things.. So I thought of using regular expression... So that I don't need to write all things in one of the XML... I'm thinking of useing like this... for EX: Mozilla/[0-9].0 (compatible; MSIE 6.0; Windows NT 5.0;) [A-Z] 1=1 -- Help me in solving this..
comment on: http://stackoverflow.com/q/23262300
score: 0

http://stackoverflow.com/a/29363683
has body: Also as Kefas I am specify java version to 1.7 and it works! maven-compiler-plugin 3.1 1.7 1.7
upvote count: 5
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/23183931
score: 5

http://stackoverflow.com/q/23273235
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23273812
has comment: http://stackoverflow.com/comment/35618816
tagged with: java
type: Question
has body: Say I have a class Foo, and two classes Foo1 and Foo2 extending Foo. Say I have a Foo f, which turns out to be a Foo1 , and I want to change it without using a constructor. If it was just a matter of changing the fields of f, I could do it manually: f.field1= .. f.field2= .. But what can I do if I want to change it into a Foo2 ? N.B : The point is that I would like to do something like that : Foo f=new Foo1( ...); Foo g=f; g=new Foo2(...); and have f change when g changes, but obviously this does not work.
accepted answer: http://stackoverflow.com/a/23273812
has comment: http://stackoverflow.com/comment/35620094
score: 0
has comment: http://stackoverflow.com/comment/35621148
has title: How to change the class of an object without creating a new one?
has answer: http://stackoverflow.com/a/23273288
has answer: http://stackoverflow.com/a/23273311
possible better answer: http://stackoverflow.com/a/23273288
has answer: http://stackoverflow.com/a/23273709
answer count: 4

http://stackoverflow.com/comment/35608680
comment on: http://stackoverflow.com/q/23257439
score: 0
has text: What should I do? Since the code is right, requests are being received... I don't know why it doesn't show any earning
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23201866
has body: Previously, if we were using FileCredentialStore, we are able to specific the stored filename for Credential information. However, FileCredentialStore is depreciated Alternative to setCredentialStore method for google analytics Now, we are using FileDataStoreFactory. However, there is no way for us to specific saved filename anymore. We can only specific directory name. The filename will be fixed to StoredCredential Is there any way I can specific filename? As I have different credential information, and I would like to group them within single directory.
answer count: 1
downvote count: 0
linked to: http://stackoverflow.com/q/20144375
has answer: http://stackoverflow.com/a/27854386
favorite count: 0
has title: Specific filename for FileDataStoreFactory (Google API)
type: UnansweredQuestion
tagged with: google-api
score: 2
upvote count: 2
tagged with: java
type: Question

http://stackoverflow.com/q/23215064
has body: Can't change Welcome TextView. I need help. See the code below: I am developing new app android with facebook login. I edit again to show all the code... package app.android.listasvip; 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.app.Activity; import android.content.Intent; import android.widget.TextView; import com.facebook.*; import com.facebook.model.*; public class MainActivity extends ActionBarActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); if (savedInstanceState == null) { getSupportFragmentManager().beginTransaction().add(R.id.container, new PlaceholderFragment()).commit(); } // start Facebook Login Session.openActiveSession(this, true, new Session.StatusCallback() { // callback when session changes state @Override public void call(Session session, SessionState state, Exception exception) { if (session.isOpened()) { // make request to the /me API Request.newMeRequest(session, new Request.GraphUserCallback() { // callback after Graph API response with user object @Override public void onCompleted(GraphUser user, Response response) { if (user != null) { TextView welcome = (TextView) findViewById(R.id.welcome); welcome.setText("Hello " + user.getName() + "!"); } } }).executeAsync(); } } }); } @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { if (Session.getActiveSession() != null) { Session.getActiveSession().onActivityResult(this, requestCode, resultCode, data); } super.onActivityResult(requestCode, resultCode, data); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMen…
tagged with: java
type: Question
score: 0
answer count: 1
has title: Can't change text of TextView Android
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35514461
tagged with: android
has comment: http://stackoverflow.com/comment/35522904
has comment: http://stackoverflow.com/comment/35513439
has comment: http://stackoverflow.com/comment/35522815
has answer: http://stackoverflow.com/a/23215161

http://stackoverflow.com/q/23238630
score: 0
accepted answer: http://stackoverflow.com/a/23238693
answer count: 1
tagged with: string
has comment: http://stackoverflow.com/comment/35555701
tagged with: exception
type: AnsweredQuestion
has body: While parsing internet content of HTML pages there is common thing that due to mistakes in HTML code some chars are absent - for example closing " or > or something else. And when a parser meet this situation sometimes it occurs "out of bounds exception". I am thinking about the best way to work around this issue - try\catch is good but slow enough. A series of if/else perhaps would be better but may be you know some mechanism that allow to skip this abnormal situations?
has comment: http://stackoverflow.com/comment/35555760
has title: best way to react on substring out of bounds exception
has answer: http://stackoverflow.com/a/23238693
has comment: http://stackoverflow.com/comment/35556868
type: Question
has comment: http://stackoverflow.com/comment/35555761
tagged with: java
has comment: http://stackoverflow.com/comment/35555735

http://stackoverflow.com/comment/35448885
has text: @user3551620 you should ask another question and as you type the question see if the answer pops up, if it doesn't then ask it in case future people have the same question.
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/23178348

http://stackoverflow.com/q/23288319
has body: I need to send request through HTTPS. I have read a lot about SSL and there is lots about SSL on Google but no starting place where to start. I need to connect to a web service through HTTPS and send and receive data. I am using HttpsUrlConnection to send the requests of. The web service provider does not have a self signed certificate as this would be displayed on the Internet Explorer page. The certificate is issed by COMODA High-Assurance Secure Server CA but is not self signed. How can I connect, send and receieve data with SSL connections? Please see below code: public class Sender { public void send(String endpoint) { URL url = new URL(endpoint); HttpsURLConnection httpsUrlConnection = (HttpsURLConnection) url.openConnection(); httpsUrlConnection.setRequestMethod(new String("POST")); httpsUrlConnection.setDoOutput(true); httpsUrlConnection.setRequestProperty("Content-Type", "application/xml"); SSLContext sc = SSLContext.getInstance("SSL"); sc.init(null, getTrustManager(), new SecureRandom()); httpsUrlConnection.setSSLSocketFactory(sc.getSocketFactory()); httpsUrlConnection.connect(); OutputStreamWriter outputStreamWriter = new OutputStreamWriter(httpsUrlConnection.getOutputStream()); outputStreamWriter.write(""); // writes XML data outputStreamWriter.flush(); outputStreamWriter.close(); InputStreamReader inputStreamReader = new InputStreamReader(httpsUrlConnection.getInputStream()); char i = (char) inputStreamReader.read(); System.out.println(i); } public TrustManager[] getTrustManager() { TrustManager[] trustAllCerts = new TrustManager[] { new X509TrustManager() { public void checkClientTrusted(X509Certificate[] xcs, String string) throws CertificateException { } public void checkServerTrusted(X509Certificate[] xcs, String string) throws CertificateException { System.out.println("AuthType : " + " " + string); for(int i = 0; i &lt; xcs.length; i++) { System.out.println("\t" + xcs[i].getIssuerX500Principal().getName()); System.out.println("\t" + xcs[i].getIssue…
has comment: http://stackoverflow.com/comment/35648120
tagged with: java
has comment: http://stackoverflow.com/comment/35649545
tagged with: https
type: Question
tagged with: ejb
has title: Java SSL Client No Self Signed Certificate
tagged with: ssl
has comment: http://stackoverflow.com/comment/35649197
score: 0
has answer: http://stackoverflow.com/a/23290153
answer count: 1
has comment: http://stackoverflow.com/comment/35649455
type: UnansweredQuestion

http://stackoverflow.com/q/23152529
tagged with: android
has title: Automatic spacing in gridview columns?
type: AnsweredQuestion
tagged with: java
has body: I have a simple GridView. The following is the XML I create a TextView and insert it as an item in the gridview. Basically the idea is to create a customized calendar. In the adaptor I have @Override public View getView(int position, View convertView, ViewGroup parent) { TextView textView = new TextView(mContext); textView.setText(days.get(position).toString()); textView.setRotationY(180); textView.setGravity(Gravity.CENTER); textView.setBackground(mContext.getResources().getDrawable(R.drawable.grey_box)); int x = mContext.getResources().getDimensionPixelSize(R.dimen.calendar_slot); textView.setLayoutParams(new GridView.LayoutParams(x, x)); return textView; } R.dimen.calendar_slot equals to 30dp. What I fail to understand is , given the above why does my gridview appear like below ? . I need the columns to be merged together. But they have spaces between them. Can anyone aid ?
accepted answer: http://stackoverflow.com/a/27312526
tagged with: android-gridview
type: Question
answer count: 1
has answer: http://stackoverflow.com/a/27312526
score: 0

http://stackoverflow.com/q/23283233
has answer: http://stackoverflow.com/a/23283334
type: UnansweredQuestion
has title: Static or dynamic binding in the code?
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/23283353
answer count: 2
has body: class A { public void display() { System.out.println("in A"); } public static void invoke(A x) { x.display(); } } What kind of binding (static or dynamic) would this code represent? I would also appreciate reasons why.
score: 0
tagged with: binding

http://stackoverflow.com/q/23289826
linked to: http://stackoverflow.com/q/23280953
has body: ImageIo.read() doesn't work.the error tells that ImageIo class doesn't contains read method.like ByteArrayInputStream bais=new ByteArrayInputStream(logo); BufferedImage bimage=ImageIO.read(bais); any one help me?
favorite count: 0
accepted answer: http://stackoverflow.com/a/23289956
has comment: http://stackoverflow.com/comment/35650078
tagged with: android
tagged with: web-services
possible better answer: http://stackoverflow.com/a/23290118
has comment: http://stackoverflow.com/comment/35649982
has comment: http://stackoverflow.com/comment/35650044
type: AnsweredQuestion
tagged with: performance
has answer: http://stackoverflow.com/a/23289956
downvote count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/35650209
type: Question
has comment: http://stackoverflow.com/comment/35650278
has comment: http://stackoverflow.com/comment/35650490
tagged with: iostream
has title: ImageIo.read method doesn't work in android
has answer: http://stackoverflow.com/a/23290118
answer count: 2
has comment: http://stackoverflow.com/comment/35650153
upvote count: 1

http://stackoverflow.com/comment/35382786
score: 0
comment on: http://stackoverflow.com/q/23140697
type: Comment
has text: @Nambari After a bit more investigation, I've found that as long as the plugin owning the class is still running, the class itself is ineligible for garbage collection.
type: QuestionComment

http://stackoverflow.com/comment/35620943
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23274061
has text: .matches any character. you need to escape it (using \\ or use Pattern.quote() ). Also \\D means NOT a DIGIT . are you sure that's what you want?
score: 0

http://stackoverflow.com/a/23320582
has comment: http://stackoverflow.com/comment/35795667
has body: By migrating of projects from ant to maven without changing project structure set your sourceDirectory testSourceDirectory in the build and use the maven-resource-plugin as folowing take care in wich phase you execute the goals. maven-resources-plugin 2.6 copy-resources01 process-classes copy-resources ${basedir}/target/classes UTF-8 ${basedir}/src **/*.properties copy-resources02 verify copy-resources ${basedir}/build/lib UTF-8 ${basedir}/target/ *.jar
has comment: http://stackoverflow.com/comment/35762813
score: 20
upvote count: 20
downvote count: 0
answers question: http://stackoverflow.com/q/23289098
type: Answer

http://stackoverflow.com/q/23213034
type: UnansweredQuestion
tagged with: localization
tagged with: internationalization
has answer: http://stackoverflow.com/a/23216050
tagged with: java
tagged with: struts-1
type: Question
has body: I have a requirement in my project to support Localization in web application. The project is a web application which provides services to its users. It is based on Struts 1.2. Requirement: The labels in the jsp page can be controlled according to the user's preference i.e. the labels can differ according to the user logged in. The user can change the text of the label what he/she wants to see. How can I achieve this in Struts 1.2? I know about Struts i18n, but it is based on the locale. What I'm thinking is to create a separate property file for each user. How can I use the same property file for displaying the labels in JSP in Struts 1.2? Please help.
has title: Localization in struts1
answer count: 1
tagged with: struts
score: 0

http://stackoverflow.com/q/23147726
score: 2
downvote count: 0
has title: way to debug java frameworks on console
favorite count: 0
tagged with: console
has body: I am a C++ dev, working in java technology for about a year. Forgive my ignorance, but I have tried to search for following two questions. What is the best way to debug in console for a java application (ala gdb in good ol' C++). It seems jdb is below par. Eclipse is the way to go for its IDE. But Eclipse is a GUI and I do develop in console on unix servers. What is the best way to tame huge jave open-source frameworks. eg, camel, hibernate, spring, logback, blah, blah
type: Question
has comment: http://stackoverflow.com/comment/35395009
has answer: http://stackoverflow.com/a/23148094
has answer: http://stackoverflow.com/a/30944673
linked to: http://stackoverflow.com/q/975271
upvote count: 2
tagged with: java
answer count: 3
tagged with: debugging
tagged with: jdb
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23147816

http://stackoverflow.com/comment/35636124
type: Comment
comment on: http://stackoverflow.com/a/23278986
type: AnswerComment
has text: UPDATE - I am using `Eclipse` to do a `hibernate` example. I DON'T get the WARN messages when I keep `log4j.properties` inside the `src` folder. But, when I keep it under `src/resources` folder, then I get the warning. Why does this happen and how do I make eclipse refer to the correct folder ?
score: 0

api
tags question: http://stackoverflow.com/q/23151294
tags question: http://stackoverflow.com/q/23155571
tags question: http://stackoverflow.com/q/23214505
tags question: http://stackoverflow.com/q/23244571
type: Tag
tags question: http://stackoverflow.com/q/23180305
tags question: http://stackoverflow.com/q/23173130
tags question: http://stackoverflow.com/q/23148962
tag name: api
tags question: http://stackoverflow.com/q/23172790
tags question: http://stackoverflow.com/q/23250118
tags question: http://stackoverflow.com/q/23145933
tags question: http://stackoverflow.com/q/23270093
tags question: http://stackoverflow.com/q/23220827

http://stackoverflow.com/comment/35410935
has text: How big is the excel file in mb? And if you bump the heap size up above 2gb, is there a point when it starts working?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23139660

http://stackoverflow.com/q/23233130
has comment: http://stackoverflow.com/comment/35547165
has title: Android initializatoin of class fields not done
type: Question
has answer: http://stackoverflow.com/a/23233848
score: -1
tagged with: ondestroy
answer count: 1
tagged with: initialization
favorite count: 0
accepted answer: http://stackoverflow.com/a/23233848
has comment: http://stackoverflow.com/comment/35546415
tagged with: android
downvote count: 2
upvote count: 1
has body: Struggled with an appropriate title on this one. I've encountered and odd/baffling situation which only came to light as I sometimes initialize fields. In this case, I had a boolean which I initialized to false (I know, redundant... but...) the app runs fine and prior to exit my boolean is set to true. I watch the log cat to see that onDestroy() has been called. I then restart the app. My boolean, whose value I now log in onCreate(), is true. WTF? I noted that the activity started with a new PID. And yet, it is bypassing field initializations. Mind you, I have some which are not redundant. So what is going on here? I then force stopped the app from the settings menu on the device. Restarting the app now shows all as expected, boolean = false. So is onDestroy() not a reliable/real termination? I don't recall ever reading anything like that. This is not my app but is an example of the situation: public class MyActivity extends Activity { /** * Called when the activity is first created. */ private static boolean b = false; private static int i = 1; private static final String TAG = "junk app"; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); Log.i(TAG, "=================================================================="); if(b) Log.i(TAG,"boolean is true"); if(!b) Log.i(TAG,"boolean is false"); Log.i(TAG,"The value of i is"+i); i++; b=!b; foo(); } public void foo() { finish(); } @Override public void onResume() { Log.i(TAG,"onResume"); super.onResume(); } @Override public void onStop() { Log.i(TAG,"onStop"); super.onStop(); } @Override public void onDestroy() { Log.i(TAG,"onDestroy"); super.onDestroy(); } } Run this app on a device and watch your logcat. onDestroy() is called. Now start the app again from its icon. i is incremented and b becomes !b. IDK but my (naive) expectation is that if an app is destroyed, if it is restarted it starts fresh and all initializations, etc are done again.
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35546792
has comment: http://stackoverflow.com/comment/35546073
tagged with: java

http://stackoverflow.com/comment/35566165
score: 0
comment on: http://stackoverflow.com/q/23244306
type: Comment
type: QuestionComment
has text: if language is c you can use sizeof(var) and depending on value return by this function u can find datatype for eg. integer if sizeof(var) return 4

http://stackoverflow.com/comment/35432746
score: 0
comment on: http://stackoverflow.com/a/23169362
type: AnswerComment
type: Comment
has text: why unicode characters can be used any where but not octal characters

http://stackoverflow.com/comment/35605317
type: QuestionComment
has text: Nothing is impossible
comment on: http://stackoverflow.com/q/23266124
type: Comment
score: 0

http://stackoverflow.com/a/23249560
answers question: http://stackoverflow.com/q/23192158
has body: I figured it out. The above MATLAB code works, I added one line to Java to flush the buffer after every write and it worked! So my Java code is below. I am not sure why flushing the buffer helped. It seemed to be something about MATLAB parsing multiple lines from Java at once? public static void main(String[] args) throws UnknownHostException, IOException { log("Hello World!"); Socket s = new Socket("192.168.1.8", 3000); BufferedReader r = new BufferedReader(new FileReader("./channel1.csv")); PrintWriter out = new PrintWriter(s.getOutputStream(), true); String line = null; int bytes = 0; int i = 0; while (true) { line = ++i + "," + Math.sin(Math.toRadians((double) i)); System.out.println("Sending:" + line); out.write(line + "\n"); out.flush(); bytes += line.length( } } Thanks to Andrew Janke for the help!
score: 0
accepted answer of: http://stackoverflow.com/q/23192158
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36135550
type: Answer
has comment: http://stackoverflow.com/comment/36135609

http://stackoverflow.com/q/23244020
has body: I'm sorry if this question was already asked, but i don't fine an answer to my question. I'm working on HashMap i put two values (7,"value test 1") (7,"value test 2) According to the specification java API HashMap put the first values is replaced by the second . My question is when comes the resolution of collision ? why my second value is not store in linkedList or store in another place in the hashMap ? Is it due to the equals or hascode method ?? Best Regards
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/35565294
type: Question
tagged with: hashmap
accepted answer: http://stackoverflow.com/a/23244150
possible better answer: http://stackoverflow.com/a/23244142
answer count: 2
tagged with: hash-collision
linked to: http://stackoverflow.com/q/3093863
has answer: http://stackoverflow.com/a/23244142
has title: java hashMap<Integer,String> collision
has answer: http://stackoverflow.com/a/23244150
has comment: http://stackoverflow.com/comment/35565230
type: AnsweredQuestion

http://stackoverflow.com/q/23247887
score: 1
tagged with: java
tagged with: jtextfield
has comment: http://stackoverflow.com/comment/35573109
type: Question
has comment: http://stackoverflow.com/comment/35573885
has answer: http://stackoverflow.com/a/23248133
tagged with: if-statement
has body: My goal here is to make two checkboxes become enabled when someone types the word "Physique" into a certain JTextField. SO: Press button Button reads text in JTextField if text in field is equal to Physique then enable Checkboxes Three and Four. However, I cannot make it respond when text is entered in the JTextField String greatOne = skillGreat1JTextField.getText(); if ( greatOne.equals( "Physique" ) ) { physStress3CheckBox.setEnabled( true ); physStress4CheckBox.setEnabled( true ); } This triggers when I press an Apply button, but for some reason. This if statement doesn't seem to perform because the Checkboxes never become enabled when Physique is entered into the JTextField Anyone have a clue why this won't perform? I'm at a loss. [EDIT] Here's some more of the code. When I press a button named Apply, this should perform. public void applyJButtonActionPerformed( ActionEvent event ) { String greatOne = skillGreat1JTextField.getText(); if ( greatOne.equals( "Physique" ) ) { physStress3CheckBox.setEnabled( true ); physStress4CheckBox.setEnabled( true ); } } That's the IF statement, here's the code for the button: applyJButton.addActionListener( new ActionListener() { public void actionPerformed( ActionEvent event ) { applyJButtonActionPerformed( event ); } } ); Also, in reply to Rudi, Should I be using an OnClickListener? I've been using an ActionListener. [LAST EDIT] I've figured it out. It turns out my issue was a conflict with something that happens later in the event, I just took out the line of code that was Turning them back off after it had just turned them on. Thanks everyone for all of your help. System.out.println("Some text"); This one line of text solved my entire problem. Thanks again everyone! You've saved my FATE games.
possible better answer: http://stackoverflow.com/a/23248133
has comment: http://stackoverflow.com/comment/35572109
answer count: 3
has comment: http://stackoverflow.com/comment/35573625
upvote count: 1
has comment: http://stackoverflow.com/comment/35573903
has comment: http://stackoverflow.com/comment/35573528
has comment: http://stackoverflow.com/comment/35572114
has comment: http://stackoverflow.com/comment/35574082
favorite count: 0
has comment: http://stackoverflow.com/comment/35573224
has answer: http://stackoverflow.com/a/23248176
has comment: http://stackoverflow.com/comment/35573466
has comment: http://stackoverflow.com/comment/35572797
has comment: http://stackoverflow.com/comment/35573367
tagged with: checkbox
has answer: http://stackoverflow.com/a/23313352
accepted answer: http://stackoverflow.com/a/23313352
type: AnsweredQuestion
downvote count: 0
has title: Make button recognize text in JTextField

http://stackoverflow.com/comment/35403178
comment on: http://stackoverflow.com/q/23152786
has text: Have you had a look at what the GraphicsContext can tell you?
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/q/23288709
score: 0
answer count: 2
tagged with: android
has body: i have coded for media player and it is playing song .In the front end only image button is used and hardcoded as play button when i click again it has to change image to pause state but the button which i have used is playing the song two times simultaneously whenever i click on it which is wrong but i need the song to be paused so whereever i used mp.start(); function which will be start to play the music from the url i added the code as if(!mp.isPlaying()){ mp.start(); buttonPlayPause.setBackgroundResource(R.drawable.pause); }else { mp.pause(); buttonPlayPause.setBackgroundResource(R.drawable.play);} but when i click the play button it starts playing and again if i click the button again it starts playing two times simultaneously please help me how should i start and pause the mp3 file which i have displayed it in url it is not going to else block itself should i use different function the full code of the project is public class MainActivity5 extends Activity implements OnClickListener, OnPreparedListener, OnErrorListener, OnCompletionListener { MediaPlayer mp; ProgressDialog pd; Button bt; ImageButton iv; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main5); iv = (ImageButton)findViewById(R.id.play); iv.setOnClickListener(this);} @Override public void onPrepared(MediaPlayer mp) { Log.i("StreamAudioDemo", "prepare finished"); //pd.setMessage("Playing....."); //mp.start(); /*if(mp.isPlaying()== true) { mp.start(); iv.setImageResource(R.drawable.pause); } else { mp.pause(); mp.release(); iv.setImageResource(R.drawable.play); }*/ } @Override public void onClick(View v) { try { pd = new ProgressDialog(this); pd.setMessage("Buffering....."); //pd.show(); mp = new MediaPlayer(); mp.setAudioStreamType(AudioManager.STREAM_MUSIC); mp.setOnPreparedListener(this); mp.setOnErrorListener(this); mp.setDataSource("http://192.168.1.138/Android/music/vande.mp3"); mp.prepareAsync(); mp.setOnCompletionListener(this); …
tagged with: url
has comment: http://stackoverflow.com/comment/35648591
has title: Android: button is not changing to pause state when i click
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35649497
has comment: http://stackoverflow.com/comment/35649317
has answer: http://stackoverflow.com/a/23289611
has comment: http://stackoverflow.com/comment/35648895
has comment: http://stackoverflow.com/comment/35648080
has comment: http://stackoverflow.com/comment/35649192
has comment: http://stackoverflow.com/comment/35647886
has comment: http://stackoverflow.com/comment/35648083
has comment: http://stackoverflow.com/comment/35648040
tagged with: java
has comment: http://stackoverflow.com/comment/35647856
has comment: http://stackoverflow.com/comment/35647949
has comment: http://stackoverflow.com/comment/35648118
has comment: http://stackoverflow.com/comment/35649104
tagged with: android-emulator
type: Question
has answer: http://stackoverflow.com/a/23289082
has comment: http://stackoverflow.com/comment/35648468
has comment: http://stackoverflow.com/comment/35647935
has comment: http://stackoverflow.com/comment/35649449
tagged with: media-player
has comment: http://stackoverflow.com/comment/35649414

http://stackoverflow.com/a/24164356
upvote count: 1
score: 1
type: AcceptedAnswer
downvote count: 0
has body: The original problem was caused by filters taking precedence over the Faces servlet. Despite filter2 being a filter, it was also associated with a Faces Servlet and as a result executed after all other filters. To counteract that, I associated Faces Servlet with the last filter of my chain, filter3. With the following mapping both .jsp and .jsf now execute in desired sequence: filter1->filter2->filter3 filter1 *.jsf *.jsp REQUEST filter2 *.jsp *.jsf filter3 *.jsp REQUEST Faces Servlet *.jsf filter3 Faces Servlet FORWARD INCLUDE REQUEST ERROR
type: Answer
accepted answer of: http://stackoverflow.com/q/23141776
answers question: http://stackoverflow.com/q/23141776

http://stackoverflow.com/q/23176129
tagged with: java
has body: Is there a way to change the Internet connection type ? For example when the device is connected with WLAN/Wifi my App still wants to use the 3G/4G connection. Can I handle that?
type: Question
accepted answer: http://stackoverflow.com/a/23176294
tagged with: network-programming
answer count: 2
downvote count: 0
tagged with: wifi
tagged with: 4g
has title: Change type of Internet connection
favorite count: 0
has answer: http://stackoverflow.com/a/23176294
tagged with: android
possible better answer: http://stackoverflow.com/a/23176180
type: AnsweredQuestion
score: 2
upvote count: 2
has answer: http://stackoverflow.com/a/23176180

http://stackoverflow.com/a/23255020
type: Answer
answers question: http://stackoverflow.com/q/23254651
has comment: http://stackoverflow.com/comment/35586731
score: 0
has body: Why do you have if (rowNum % 2 == 0) ... else if (rowNum % 2 == 0) in the draw method in Block.java? Maybe you mean the second one to be else if (rowNum % 2 == 1) That might fix your problems.

http://stackoverflow.com/a/23243875
score: 0
has body: Hardcoded. But must work. int[] mToday = new int[]{}; java.util.Calendar calendar = java.util.Calendar.getInstance(); mToday[0] = calendar.get(java.util.Calendar.DAY_OF_MONTH); mToday[1] = calendar.get(java.util.Calendar.MONTH); mToday[2] = calendar.get(java.util.Calendar.YEAR);
answers question: http://stackoverflow.com/q/23243701
type: Answer

http://stackoverflow.com/a/23142400
score: 4
upvote count: 4
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/35385603
type: Answer
accepted answer of: http://stackoverflow.com/q/23141851
has comment: http://stackoverflow.com/comment/35385796
has body: If you want to write binary data, use DataInputStream/DataOutputStream. Scanner is for text data and you can't mix it. WriteInts: import java.io.*; public class WriteInts { public static void main(String[] args) throws IOException { DataOutputStream output = new DataOutputStream(new FileOutputStream( "data.dat")); for (int i = 0; i &lt; 100; i++) { output.writeInt(i); System.out.println(i); } output.close(); } } ReadInts: import java.io.DataInputStream; import java.io.FileInputStream; import java.io.IOException; public class ReadInts { public static void main(String[] args) throws IOException { DataInputStream input = new DataInputStream(new FileInputStream( "data.dat")); while (input.available() &gt; 0) { int x = input.readInt(); System.out.println(x); } input.close(); } }
answers question: http://stackoverflow.com/q/23141851

http://stackoverflow.com/comment/35438685
has text: I could not understand your purpose. How can this matrix convert into such two lists? What are your constraints?
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23172602

http://stackoverflow.com/comment/35399466
comment on: http://stackoverflow.com/q/23150307
has text: using replace or replaceall shows me error ' "Semantic Error: No applicable overload for a method with signature "replace(java.lang.String, java.lang.String)" was found in type "java.lang.String". Perhaps you wanted the overloaded version "java.lang.String replace(char $1, char $2);" instead?"'
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/35378980
has text: Your android client could also try to connect with all the ip addresses in the subnet. If all is dhcp the server ip will not differ too much from the client`s own ip.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23135063
score: 0

http://stackoverflow.com/q/23236162
score: 0
has comment: http://stackoverflow.com/comment/35551339
has comment: http://stackoverflow.com/comment/35551658
possible better answer: http://stackoverflow.com/a/23236286
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35551425
has answer: http://stackoverflow.com/a/23236343
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/23236294
has body: I have a string line String user_name = "id=123 user=aron name=aron app=application"; and I have a list that contains: {user,cuser,suser} And i have to get the user part from string. So i have code like this List&lt;String&gt; userName = Config.getConfig().getList(Configuration.ATT_CEF_USER_NAME); String result = null; for (String param: user_name .split("\\s", 0)){ for(String user: userName ){ String userParam = user.concat("=.*"); if (param.matches(userParam )) { result = param.split("=")[1]; } } } But the problem is that if the String contains spaces in the user_name, It do not work. For ex: String user_name = "id=123 user=aron nicols name=aron app=application"; Here user has a value aron nicols which contain spaces. How can I write a code that can get me exact user value i.e. aron nicols
has comment: http://stackoverflow.com/comment/35551795
has comment: http://stackoverflow.com/comment/35551555
has title: Java String tokens
has comment: http://stackoverflow.com/comment/35551439
tagged with: string
answer count: 3
has comment: http://stackoverflow.com/comment/35552004
tagged with: regex
accepted answer: http://stackoverflow.com/a/23236294
has comment: http://stackoverflow.com/comment/35551329
has answer: http://stackoverflow.com/a/23236286

http://stackoverflow.com/a/23295598
type: Answer
has body: Successful! The soluction was to use INNER JOIN, lets se: id NOT IN (SELECT DISTINCT(i.id) FROM Item i INNER JOIN i.itemsRelated ii) the result is: Select * from Item where id NOT IN (SELECT DISTINCT(i.id) FROM Item i INNER JOIN i.itemsRelated ii) Thanks for everyone!
answers question: http://stackoverflow.com/q/23278793
score: 0

http://stackoverflow.com/comment/35687642
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23270540
has text: i don't know a the moment what is wrong exactly - i'll take a look at first and post later. thanks

http://stackoverflow.com/q/23240643
accepted answer: http://stackoverflow.com/a/23240829
type: AnsweredQuestion
upvote count: 3
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/35559447
linked to: http://stackoverflow.com/q/22146899
possible better answer: http://stackoverflow.com/a/26585562
has answer: http://stackoverflow.com/a/26585562
has answer: http://stackoverflow.com/a/23240829
score: 3
downvote count: 0
has title: how to stop main thread while another thread still running
favorite count: 0
has answer: http://stackoverflow.com/a/36601287
has comment: http://stackoverflow.com/comment/35559175
has answer: http://stackoverflow.com/a/23240766
has body: I started t1 thread in my main method and want to stop main thread but my t1 thread still running. It is possible? how? public static void main(String[] args) { Thread t1=new Thread() { public void run() { while(true) { try { Thread.sleep(2000); System.out.println("thread 1"); } catch(Exception e) {} } } }; t1.start(); }
linked to: http://stackoverflow.com/q/2213340
tagged with: multithreading
answer count: 4

http://stackoverflow.com/comment/35646270
type: AnswerComment
score: 0
type: Comment
has text: i get the same result.
comment on: http://stackoverflow.com/a/23286655

http://stackoverflow.com/comment/35447489
type: QuestionComment
has text: I'm not sure, I'm getting the code using the api in https://developer.flightstats.com/
comment on: http://stackoverflow.com/q/23177699
score: 0
type: Comment

http://stackoverflow.com/a/23181908
has comment: http://stackoverflow.com/comment/35455322
score: 0
has body: Edited based on the comments: The libGDX Rectangle class has a contains method, and it seems like this is what you are checking there manually. You could also print some information that tells you more about whether an object was hit or not. It seems like the intended process is the following: When the first item is clicked, its color should be stored as colorArrayFirst When the second item is clicked, its color should be stored as colorArraySecond, and the colorSelected flag should be set to true The followign code shows how this could be done. But the question still when this information will be "reset". That is, when will both arrays be reset to null, and when will the colorSelected flag be reset to false? private boolean colorSelected = false; private int colorArrayFirst[] = null; private int colorArraySecond[] = null; void someGameLoopMethod() { if(Gdx.input.isButtonPressed(Input.Buttons.LEFT)) { Iterator&lt;ColorObject&gt; iterator = gameManager.getColorsList().iterator(); while(iterator.hasNext()) { ColorObject item = (ColorObject) iterator.next(); float x = Gdx.input.getX(); float y = Gdx.input.getY(); Rectangle r = item.colorRectangle; System.out.println("Check if "+x+" "+y+" is in "+r+": "+r.contains(x,y)); if (r.contains(x,y)) { clickedItem(item); } } } } private void clickedItem(ColorObject item) { if (colorArrayFirst == null) { colorArrayFirst = item.colorArray; } else if (colorArraySecond == null) { colorArraySecond = item.colorArray; colorSelected = true; } } // TODO Think about when this method should be called private void resetClickingInformation() { colorSelected = false; colorArrayFirst = null; colorArraySecond = null; }
has comment: http://stackoverflow.com/comment/35455544
type: Answer
has comment: http://stackoverflow.com/comment/35456890
has comment: http://stackoverflow.com/comment/35455365
has comment: http://stackoverflow.com/comment/35455304
answers question: http://stackoverflow.com/q/23181358
has comment: http://stackoverflow.com/comment/35455567
has comment: http://stackoverflow.com/comment/35455297
has comment: http://stackoverflow.com/comment/35455431

http://stackoverflow.com/comment/35386319
type: Comment
comment on: http://stackoverflow.com/a/23142549
has text: https://www.inkling.com/read/programming-android-mednieks-1st/chapter-11/visualizing-the-fragment-life
type: AnswerComment
score: 0

http://stackoverflow.com/q/23144848
favorite count: 0
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23144858
downvote count: 0
type: Question
has answer: http://stackoverflow.com/a/23144858
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has title: Unexpected character (i) at position 0. - JSON Parsing with Java
upvote count: 1
answer count: 1
has body: { "0" : { "upc" : "00000000005", "name" : "Weighable Soup Cups", "location" : "5310ed21d5dc7aaa0343a932" }, "1" : { "upc" : "00000000011", "name" : "OF Reuseable Bags", "location" : "5310ed21d5dc7aaa0343a932" } } Thats a snippet of the JSON I am trying to parse. Here is the code I am using: public class Main { public static void main(String[] args) { JSONParser parser = new JSONParser(); JSONObject jsonObject = null; try { jsonObject = (JSONObject) parser.parse("items.json"); } catch (ParseException e) { e.printStackTrace(); } JSONObject structure = (JSONObject) jsonObject.get("0"); System.out.println(structure.get("upc")); } } For some reason throws an unexpected character (i) at position 0 error. As far as I know of the JSON file is formatted correctly for parsing and the code is solid, so I don't understand why this will not work. Thanks.

http://stackoverflow.com/comment/108242888
score: 0
comment on: http://stackoverflow.com/q/23224616
type: Comment
type: QuestionComment
has text: or implement your own https://github.com/wjtxyz/VarSizedByteBuffer

http://stackoverflow.com/comment/35405824
comment on: http://stackoverflow.com/a/23134963
type: AnswerComment
score: 0
type: Comment
has text: A test needs to be able to change everything necessary to simulate the kind of situations that you want to see your code survive. So if you have global variables or functions(`public final static`) and you need to change their behavior during a test, then you should really replace them with something that can be easily exchanged.

http://stackoverflow.com/q/23280536
downvote count: 0
has title: OFX4J with American Express
has answer: http://stackoverflow.com/a/23303092
tagged with: gnucash
favorite count: 0
tagged with: ofx
has body: So I'm trying to connect to American Express using OFX4J. I'm using the data provided in the OFX home page and I am getting a 503 error whenever I attempt to access the service. I'm not sure exactly what I'm doing wrong. I'm getting the Institution Data like so: BaseFinancialInstitutionData amex = new BaseFinancialInstitutionData(); amex.setId( "424" ); amex.setFinancialInstitutionId( "3010" ); amex.setName( "American Express Card" ); amex.setBrokerId( null ); amex.setOrganization( "AMEX" ); amex.setOFXURL( new URL( "https://online.americanexpress.com/myca/ofxdl/desktop/desktopDownload.do?request_type=nl_ofxdownload" ) ); Then I'm opening the connection like they do in the example: CreditCardAccountDetails ccDetails = new CreditCardAccountDetails(); ccDetails.setAccountNumber( "&lt;my_card_number&gt;" ); CreditCardAccount ccAccount = fi.loadCreditCardAccount( ccDetails, "&lt;my_username&gt;", "&lt;my_password&gt;" ); AccountStatement statement = ccAccount.readStatement( startDate, endDate ); TransactionList transactions = statement.getTransactionList(); List&lt;Transaction&gt; ledger = transactions.getTransactions(); But as soon as I attempt to access any data, I get the 503 error. Cursiously, Schwab works like a charm, so I'm assuming there is something wrong in the Institution Data? Has anyone been able to get Amex going with OFX4J? Thanks!
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/23303092
type: Question
score: 3
has answer: http://stackoverflow.com/a/28622303
accepted answer: http://stackoverflow.com/a/28622303
tagged with: financial
upvote count: 3
answer count: 2

http://stackoverflow.com/q/23158489
has body: Hello I have a problem with my scrolled game. When scroll player is too fast for scrolling. I think the issue is not calculating coordinates displayed player. Here is the code: Main.class import java.applet.Applet; import java.awt.Graphics; import java.awt.Image; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; public class Main extends Applet implements Runnable, KeyListener { Applet app; public static final int gameX = 660; public static final int gameY = 660; Thread thread; int map[][] = new int[29][52]; boolean moveU = false; boolean moveD = false; boolean moveR = false; boolean moveL = false; loadImage loadImg = new loadImage(); Player player; Graphics bgGrap; Image bgimage; public void init(){ app = this; setSize(gameX, gameY); requestFocus(); addKeyListener(this); loadMap(); player = new Player(200,200); bgimage = createImage(gameX, gameY); bgGrap = bgimage.getGraphics(); } public void update(Graphics g) { bgGrap.clearRect(0, 0, gameX, gameY); paint(bgGrap); g.drawImage(bgimage, 0, 0, app); } public void paint(Graphics g){ drawHugeWorld(g); g.drawImage(loadImg.getImg("tree.PNG"), player.getX(), player.getY(), null); //here I draw the player. } public void start() { if(thread == null) { thread = new Thread(this); thread.start(); } } public void stop() { if(thread != null) { thread = null; } } public void destroy(){ thread = null; } public void drawHugeWorld(Graphics g){ int cameraX = player.getX() - (gameX/2); int cameraY = player.getY() - (gameY/2); int tileX = cameraX/32; int tileY = cameraY/32; if(tileX % 32 != 0) { tileX--; } if(tileY % 32 != 0) { tileY--; } for (int y = tileY; y &lt; cameraY + gameY; y+=32) { for (int x = tileX; x &lt; cameraX + gameX; x+=32) { switch(map[y/32][x/32]) { case 0: g.drawImage(loadImg.getImg("grass.png"), x - cameraX, y - cameraY, null); break; case 1: g.drawImage(loadImg.getImg("tree.png"), x - cameraX, y - cameraY, null); break; } } } } public void loadMap(){ int map1[][] = { {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1…
score: 1
tagged with: java
tagged with: scroll
type: Question
has title: Java scrolled game issue
has comment: http://stackoverflow.com/comment/35413840
has answer: http://stackoverflow.com/a/23159399
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/35413932
favorite count: 0
has comment: http://stackoverflow.com/comment/35413489
upvote count: 1
accepted answer: http://stackoverflow.com/a/23159399
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35413325

http://stackoverflow.com/comment/35516004
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23214838
has text: this can be a comment

http://stackoverflow.com/q/23269546
has body: I have ~50 automated test cases that works like a charm in both Chrome and Firefox, but IE just won't do it (too bad IE is required). IE fails at assertions (not all assertions, but a vast majority of them) because (I think) it tries to assert too quickly, e.g. the page is not rendered fast enough. Here is a piece of code that works in Chrome and FF, but not IE: driver.manage().timeouts().implicityWait(30, TimeUnit.SECONDS); driver.navigate().to(targetAdminServer()); Assert.assertTrue("The startpage is displayed", driver.getTitle().startsWith("Admin Portal -")); driver.findElement(By.id("loginForm:j_id4:username")).sendKeys(loginSAUsername()); driver.findElement(By.id("loginForm:j_id6:password")).sendKeys(loginSAPassword()); driver.findElement(By.id("loginForm:login")).click(); Assert.assertTrue("Login successful", driver.getTitle().contains("Welcome,")); Where I get the following error: java.lang.AssertionError: Login successful at org.junit.Assert.fail(Assert.java:88) at org.junit.Assert.assertTrue(Assert.java:41) at first.example.project.webdriver.AddUser.I_am_logged_in_as_a_administrator(AddUser.java:36) at ✽.Given I am logged in as a "administrator"(C:\path\cucumberfeature1.feature:5) What I can see during execution is that webdriver fills the fields with username and password and then dies right after clicking the login button. UPDATE: I may add that if I add a Thread.sleep(1000) before the Assertion that fails it works just fine. UPDATE2: A friend asked me if it might be because that IE usually runs at 32-bit while the rest of the browsers runs at 64-bit (since I have a 64-bit OS), could this have anything to do with it? UPDATE3: Tried with both 64-bit and 32-bit IEDriverServer, but none of them asserted in time.
tagged with: selenium-webdriver
type: AnsweredQuestion
score: 0
tagged with: java
possible better answer: http://stackoverflow.com/a/38365624
has answer: http://stackoverflow.com/a/23541037
has answer: http://stackoverflow.com/a/38365624
type: Question
answer count: 2
has title: Webdriver Assertions fails in IE
tagged with: internet-explorer-8
tagged with: internet-explorer-9
accepted answer: http://stackoverflow.com/a/23541037

http://stackoverflow.com/comment/35423119
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23163592
has text: AddService is the class name not the method name. add is the method inside that class. That is why I used /AddService/add?x=1&y=2 this URL. Still it didn't work

http://stackoverflow.com/q/23253002
type: Question
has body: I need to execute N calculations (with graphics updates) in X seconds using javax.swing.Timer. What's the best way for do this? If I set a fixed delay for the timer I exceed the X seconds, because the time required for each execution is delay + calculations. To work around this I've tried to set the delay of the timer dynamically, but still the time is not accurate. As a last chance I've tried to set the dalay to 1ms and use Thread.sleep(sleepTime) for control the duration and this work perfectly, without affect the animations. My question is: Is this a good solution? Can I use Thread.sleep(sleepTime) inside the javax.swing.Timer? Edit, here's some code to better understand. I want to say that the graphics is needed only to see if the movements are correct, in the final version i only need to update the game and generate a report of the match result. Main frame with "game loop": package engine.test; import engine.entity.Skill; import engine.math.Point; import engine.math.Vector; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.File; import java.io.FileNotFoundException; import java.util.ArrayList; import java.util.HashMap; import java.util.Map; import java.util.Scanner; import java.util.logging.Level; import java.util.logging.Logger; import javax.swing.JFrame; import javax.swing.JMenu; import javax.swing.JMenuBar; import javax.swing.JMenuItem; import javax.swing.Timer; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; public final class EngineFrame extends JFrame implements ActionListener { public static final int SCALE = 6; public static final int WIDTH = 100 * SCALE; public static final int HEIGHT = 60 * SCALE; public static final int DURATION = 2; // animation duration in seconds public static final int FPS = 60; public static final int SKIP_TICKS = 1000 / FPS; private final JSONObject data; private final ArrayList&lt;Player&gt; players; private PlayersPanel playersPanel; public EngineFram…
has comment: http://stackoverflow.com/comment/35586139
has comment: http://stackoverflow.com/comment/35582669
has comment: http://stackoverflow.com/comment/35581609
has title: Java javax.swing.Timer duration
score: 0
has answer: http://stackoverflow.com/a/23257909
answer count: 1
linked to: http://stackoverflow.com/q/21868170
has comment: http://stackoverflow.com/comment/35583988
tagged with: timer
has comment: http://stackoverflow.com/comment/35582624
type: UnansweredQuestion
tagged with: animation
tagged with: swing
has comment: http://stackoverflow.com/comment/35585280
tagged with: java

http://stackoverflow.com/q/23191116
has title: Not able to see the graphics stuff inside paint() method
has answer: http://stackoverflow.com/a/23191222
tagged with: jframe
type: UnansweredQuestion
tagged with: java
tagged with: swing
type: Question
tagged with: awt
has comment: http://stackoverflow.com/comment/35471384
has comment: http://stackoverflow.com/comment/35471523
score: 0
has body: I'm doing all Graphics stuffs such as g.drawLine() etc. inside class MyCanvas.java public class MyCanvas extends JComponent{ public void paint(Graphics g){...} } And my Main.java class is class Main{ public static void main(String[] args){ JFrame window = new JFrame(); window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); window.setBounds(30, 30, 1000, 350); window.getContentPane().setLayout(new FlowLayout()); MyCanvas mc = new MyCanvas(); JScrollPane jsp = new JScrollPane(mc); jsp.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); window.getContentPane().add(jsp); window.getContentPane().setBackground(Color.WHITE); window.setVisible(true); } } However, JFrame is only showing white plain background, It isn't showing any Graphics stuff from paint(Graphics g). Note that, If I remove JScrollPane from above Main.java, then it shows everything perfectly. class Main{ public static void main(String[] args){ JFrame window = new JFrame(); window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); window.setBounds(30, 30, 1000, 350); window.getContentPane().add(new MyCanvas()); window.getContentPane().setBackground(Color.WHITE); window.setVisible(true); } } Where my logic is going wrong? Is there any problem while adding JScrollPane ? Please help. Thanks.
has comment: http://stackoverflow.com/comment/35471290
answer count: 1
has comment: http://stackoverflow.com/comment/35471231
has comment: http://stackoverflow.com/comment/35471297

http://stackoverflow.com/a/23283606
has body: I think I found the solution I follow the Export from Eclipse on this thread Migrating from Eclipse
type: Answer
score: 0
answers question: http://stackoverflow.com/q/23283583

http://stackoverflow.com/comment/35565048
comment on: http://stackoverflow.com/a/23243842
score: 0
type: AnswerComment
has text: Thanks for your answer, but it will no longer be included in the root element, I would only remove it from the `associated` field, not others...
type: Comment

http://stackoverflow.com/a/60607317
answers question: http://stackoverflow.com/q/23210316
score: 0
type: AcceptedAnswer
has body: Upgrade to version 1.8 or later.
type: Answer
accepted answer of: http://stackoverflow.com/q/23210316

http://stackoverflow.com/comment/35607112
comment on: http://stackoverflow.com/q/23267099
score: 0
type: Comment
type: QuestionComment
has text: i tried that i just keeps coming back the same way

http://stackoverflow.com/comment/113919147
score: 1
comment on: http://stackoverflow.com/a/63205759
has text: Do you have a source for this issue?
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/35389511
comment on: http://stackoverflow.com/q/23144597
score: 0
type: Comment
has text: what is the page you are trying to access? and where is it placed ? in WEB-INF? and can you share web.xml
type: QuestionComment

size
type: Tag
tags question: http://stackoverflow.com/q/23176974
tags question: http://stackoverflow.com/q/23235852
tag name: size
tags question: http://stackoverflow.com/q/23245517
tags question: http://stackoverflow.com/q/23249312

http://stackoverflow.com/q/23193616
answer count: 1
score: 0
tagged with: foreign-keys
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35477129
type: Question
has comment: http://stackoverflow.com/comment/35475292
tagged with: java
tagged with: hibernate
tagged with: mysql
tagged with: innodb
has title: MySQL - Hibernate does not create foreign key constraint
has answer: http://stackoverflow.com/a/23193999
has body: I am, moving my application from Derby to MySQL, and facing the problem that hibernate doesn't create the foreign key constraints while initially creating the tables. All me mappings seems to be correct as they were working fine with Derby. I am using MySQL Server 5.6, and also MySQL5InnoDBDialect. Also i verified in the MySQL workbench using show create table command that the table are being created using innoDB engine. MySQL connector used - mysql-connector-java - 5.1.6 Logs: 2014-04-21 12:38:29,820 ERROR org.hibernate.tool.hbm2ddl.SchemaExport - Unsuccessful: alter table DEPENDENCY_TRACK add constraint FK25E3373737E62D9A foreign key (TOOL_ID) references TOOL_MASTER 2014-04-21 12:38:29,820 ERROR org.hibernate.tool.hbm2ddl.SchemaExport - Cannot add foreign key constraint 2014-04-21 12:38:30,127 ERROR org.hibernate.tool.hbm2ddl.SchemaExport - Unsuccessful: alter table DEPT_ROLE add constraint FK7E895E3080D96D8 foreign key (DEPARTMENT_ID) references DEPARTMENT 2014-04-21 12:38:30,128 ERROR org.hibernate.tool.hbm2ddl.SchemaExport - Cannot add foreign key constraint Persistance.xml <?xml version="1.0" encoding="UTF-8"?> import.sql META-INF/orm.xml database.properties # database properties app.jdbc.driverClassName = com.mysql.jdbc.Driver app.jdbc.url = jdbc:mysql://localhost:3306/alt app.jdbc.username = root app.jdbc.password = root

http://stackoverflow.com/comment/35589605
comment on: http://stackoverflow.com/a/23256779
type: AnswerComment
score: 0
type: Comment
has text: Will do, and I'm actually thinking of adding a little more to the code, because this is actually a project for my german class based on aesthetics, and I really want it to interact more with the music. Do you have any ideas on what could be added?

http://stackoverflow.com/q/23248687
has comment: http://stackoverflow.com/comment/35574265
has comment: http://stackoverflow.com/comment/35573560
has answer: http://stackoverflow.com/a/23248977
possible better answer: http://stackoverflow.com/a/23248797
has body: For some reason, I can't get my method to display a previously mentioned array. The only issue is in my first line. The error code is: "illegal start of expression". What am I doing wrong? public static void display(int matrix[][]) { for (int row = 0; row &lt; matrix.length; row++) { for (int col = 0; col &lt; matrix[row].length; col++) { System.out.print(matrix[row][col] + " "); } System.out.println(); } }
has answer: http://stackoverflow.com/a/23248797
type: AnsweredQuestion
has title: How do I display a matrix in a method?
tagged with: java
tagged with: formatting
tagged with: methods
type: Question
accepted answer: http://stackoverflow.com/a/23248977
answer count: 2
has comment: http://stackoverflow.com/comment/35573659
has comment: http://stackoverflow.com/comment/35573598
tagged with: arrays
score: 0
tagged with: matrix

http://stackoverflow.com/comment/35428564
has text: @user1509593 no idea about that.
type: AnswerComment
comment on: http://stackoverflow.com/a/23166667
score: 0
type: Comment

http://stackoverflow.com/a/23178252
has comment: http://stackoverflow.com/comment/35448513
upvote count: 3
has body: Use the overloaded method yourString.split("#", -1) The javadoc states The array returned by this method contains each substring of this string that is terminated by another substring that matches the given expression or is terminated by the end of the string. [...] The limit parameter controls the number of times the pattern is applied and therefore affects the length of the resulting array. If the limit n is greater than zero then the pattern will be applied at most n - 1 times, the array's length will be no greater than n, and the array's last entry will contain all input beyond the last matched delimiter. If n is non-positive then the pattern will be applied as many times as possible and the array can have any length. If n is zero then the pattern will be applied as many times as possible, the array can have any length, and trailing empty strings will be discarded. Invoking String#split(String) is equivalent to invoking yourString.split(yourRegex, 0); which does what that last line of javadoc states, discarding trailing empty strings. This, however, will not return null in the last position of the array returned. It will simply be an empty string.
accepted answer of: http://stackoverflow.com/q/23178214
type: AcceptedAnswer
downvote count: 0
score: 3
type: Answer
answers question: http://stackoverflow.com/q/23178214

http://stackoverflow.com/comment/35634041
has text: @Christoph With possessive quantifier (the one with additional `+` like `*+`) backtracking is impossible so regex `b*+b` will never match `bbbbb` because all `b`s will be consumed (possessed) by `b*` so last `b` in regex will never find its match (as mentioned backtracking is impossible) making regex unable to find its match. This idea was used here, where instead of `b*` we used first letter in String. `\\1*+` will consume all same characters as first character in string letting `.` match only something which is different that first character (otherwise it would be consumed by `\\1*+`
type: AnswerComment
comment on: http://stackoverflow.com/a/23280597
type: Comment
score: 1

http://stackoverflow.com/comment/35560296
type: Comment
comment on: http://stackoverflow.com/a/23240881
score: 1
has text: @YuvalLevy I've added a section on how you might achieve that, but make sure its really what you want
type: AnswerComment

http://stackoverflow.com/comment/35486694
score: 0
type: Comment
type: QuestionComment
has text: @MikeB I was initially thinking about JavaFX, but I am a noob and I have heard that it is very difficult. I want some transitions and animations in the GUI. Do you think doing that will be appropriate for a beginner?
comment on: http://stackoverflow.com/q/23200096

http://stackoverflow.com/comment/35938400
type: Comment
type: QuestionComment
has text: @androidDev it is android or java no issue you need to include the required jar to fix above error...and take care...
score: 0
comment on: http://stackoverflow.com/q/23290698

http://stackoverflow.com/comment/35617758
has text: Okay, I understand what you're saying but don't really know how to proceed. If I remove the game over check I don't get the "jerkiness" but everything keeps being rendered (which is what I'd expect as there's no restriction). What I'd like to happen, is on a collision, stop rendering with no jerkiness and proceed to game over. Do I need to add in game over again after rendering or call unlockandpost? I'm unsure.
comment on: http://stackoverflow.com/a/23272240
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/23229810
has title: JAVA_HOME is not defined correctly -- mvn
tagged with: java
has comment: http://stackoverflow.com/comment/35540282
type: Question
answer count: 1
has comment: http://stackoverflow.com/comment/35540343
has comment: http://stackoverflow.com/comment/35540548
score: 0
has comment: http://stackoverflow.com/comment/35540462
has comment: http://stackoverflow.com/comment/35540346
has answer: http://stackoverflow.com/a/23232651
has body: Ran a mvn clean install and got: konnor@konnor-laptop:~/workspace/automation$ mvn clean install Error: JAVA_HOME is not defined correctly. We cannot execute /opt/jdk/bin/java I've done a little research on this and haven't found out how to resolve, anyone have any thoughts? Some additional info: konnor@konnor-laptop0:~/workspace/automation$ which java /usr/bin/java konnor@konnor-laptop:/opt/jdk$ ls -la total 20 drwxr-xr-x 5 root root 4096 Apr 18 08:52 . drwxr-xr-x 5 root root 4096 Apr 18 08:51 .. drwxr-xr-x 2 root root 4096 Apr 18 08:52 bin drwxr-xr-x 5 root root 4096 Apr 18 08:51 jre drwxr-xr-x 3 root root 4096 Apr 18 08:52 man konnor@konnor-laptop:~$ /opt/jdk/bin/java -version bash: /opt/jdk/bin/java: No such file or directory konnor@konnor-laptop:~/workspace/automation$ $JAVA_HOME bash: /opt/jdk: Is a directory
accepted answer: http://stackoverflow.com/a/23232651
tagged with: maven
type: AnsweredQuestion

http://stackoverflow.com/a/65007929
answers question: http://stackoverflow.com/q/23155678
type: Answer
has body: The real fix would be a fix of your samba. There is very likely some locking due to some network timeout in it. Most likely it is some WINS/DNS configuration problem. Only you can debug it (tcpdump/strace the samba process). However, the best approach is not the fix of your samba, but using a different version for deployment. Your question makes likely that you have your development environment on your Windows host machine, and you deploy your code to your CentOS. Use a native filesystem on your host, typically bound it into a versioning system (most likely, git), and make the deployment a part of your build scripts. For example, you could install a cygwin, and then upload your compiled code (or even the source) to your VM by an rsync. This rsync can already be called from your build script (like maven-exec-plugin in a pom.xml, if you use maven).
score: 0

http://stackoverflow.com/a/23215288
downvote count: 0
answers question: http://stackoverflow.com/q/23213368
score: 1
has body: UPDATE queries bypass the EntityManager, which means that the EntityManager may not have an up to date view of the real objects in the database. As explained in the UPDATE queries page in the ObjectDB Manual: "Updating entity objects in the database using an UPDATE query may be slightly more efficient than retrieving entity objects and then updating them, but it should be used cautiously because bypassing the EntityManager may break its synchronization with the database. For example, the EntityManager may not be aware that a cached entity object in its persistence context has been modified by an UPDATE query. Therefore, it is a good practice to use a separate EntityManager for UPDATE queries." Using a separate EntityManager is exactly what you did by closing and opening a new EntityManager in your revised code. Alternatively, if you want to use the same EntityManager, you may clear its persistence context (i.e. its cache), after running the UPDATE query and before running the SELECT query.
upvote count: 1
type: Answer

http://stackoverflow.com/q/23170893
type: Question
has answer: http://stackoverflow.com/a/46582603
answer count: 2
tagged with: abstract-syntax-tree
has comment: http://stackoverflow.com/comment/35436029
downvote count: 0
has comment: http://stackoverflow.com/comment/35435585
tagged with: eclipse-plugin
favorite count: 0
has body: I am trying to use Eclipse's AST parser as a standalone to parse Java source files. This is a small snippet of a code to get the compilation unit: public CompilationUnit getCompilationUnit(ASTParser parser) { parser.setResolveBindings(true); CompilationUnit cu = (CompilationUnit) parser.createAST(null); return cu; } If I try to execute this code standalone ie without Eclipse IDE, I am getting below error: java.lang.NoSuchFieldError: resources at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:2545) [org.eclipse.jdt.core_3.8.2.v20120814-155456.jar:] at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:2423) [org.eclipse.jdt.core_3.8.2.v20120814-155456.jar:] at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:534) [org.eclipse.jdt.core_3.8.2.v20120814-155456.jar:] I am not understanding from where does it's calling method resources. If I try to run from Eclipse IDE it works without any issues. I have included following JAR files in the classpath: org.eclipse.core.contenttype_3.4.200.v20120523-2004.jar org.eclipse.core.jobs_3.5.300.v20120912-155018.jar org.eclipse.core.resources_3.8.1.v20121114-124432.jar org.eclipse.core.runtime_3.8.0.v20120912-155025.jar org.eclipse.equinox.common_3.6.100.v20120522-1841.jar org.eclipse.equinox.preferences_3.5.1.v20121031-182809.jar org.eclipse.jdt.core_3.8.3.v20130121-145325.jar org.eclipse.osgi_3.8.2.v20130124-134944.jar I have included all of the necessary jar files to run successfully. But when I run this error occurs. Can anyone please guide me?
type: UnansweredQuestion
upvote count: 1
has comment: http://stackoverflow.com/comment/35435535
has title: java.lang.NoSuchFieldError: resources - Eclipse AST parser error
has answer: http://stackoverflow.com/a/23318017
score: 1
tagged with: java
tagged with: eclipse-jdt
tagged with: eclipse

http://stackoverflow.com/comment/35767166
has text: Can you please post the entire stack trace here in addition to the web.xml, servlet class. Please make sure that the classes folder is lowercase like myservlet/WEB-INF/classes
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23260775

http://stackoverflow.com/comment/35652629
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23290699
has text: Which version of Spring are you using??

http://stackoverflow.com/comment/35632286
type: Comment
type: QuestionComment
score: 0
has text: You've yet to identify the source of your errors, and that's the first step that needs to be done before you can fix it. Use a debugger to help you do this.
comment on: http://stackoverflow.com/q/23280106

http://stackoverflow.com/q/23237883
tagged with: java
downvote count: 3
accepted answer: http://stackoverflow.com/a/23238107
linked to: http://stackoverflow.com/q/4216745
tagged with: mysql
type: Question
duplicate of: http://stackoverflow.com/q/4216745
upvote count: 0
has answer: http://stackoverflow.com/a/23237976
has answer: http://stackoverflow.com/a/23237978
has title: How to convert a string to date in java
tagged with: string
has answer: http://stackoverflow.com/a/23238107
favorite count: 0
has comment: http://stackoverflow.com/comment/35554293
score: -3
has answer: http://stackoverflow.com/a/23238064
answer count: 4
has comment: http://stackoverflow.com/comment/35554269
type: AnsweredQuestion
has body: I have a datetime picker.the user selects the date and time from datetime picker,and in servlet I get it using request.getParameter(""); Now how to parse the string to date in java as while inserting in database the datatype is datetime.
possible better answer: http://stackoverflow.com/a/23238064

http://stackoverflow.com/a/23211902
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/23205274
downvote count: 0
has body: It will be necessary to add the jar containing the Persistence class on the run-time class-path of the applet. To do that, put it in the same code base as the applet Jar, and reference it in a comma separated list in the archive attribute of the applet element.

http://stackoverflow.com/q/23287039
tagged with: apache-camel
has body: I have a route that contains a wiretap element that redirects to a route that tries to make a bean invocation after a certain delay (approximately 20 seconds). However when the application shuts down, I get errors because the bean doesn't exist anymore and during shutdown it cannot be created. I want to make my application shutdown gracefully by checking the state of the application after the delay. How can I do that? ... 20000 <bean ref="myBean" method="updateAfterDelay"/>
accepted answer: http://stackoverflow.com/a/23290233
answer count: 2
downvote count: 0
score: 1
favorite count: 0
possible better answer: http://stackoverflow.com/a/23287917
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23287917
tagged with: dsl
has title: How can I check in Spring-DSL if Camel is shutting down?
tagged with: java
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/23290233

http://stackoverflow.com/q/23173979
accepted answer: http://stackoverflow.com/a/23174141
has comment: http://stackoverflow.com/comment/35441075
possible better answer: http://stackoverflow.com/a/23174073
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35440978
has answer: http://stackoverflow.com/a/23174073
tagged with: button
has answer: http://stackoverflow.com/a/23174470
tagged with: textview
has comment: http://stackoverflow.com/comment/35441015
has body: I have a 100 buttons in a 10X10 grid. They all call the same method "go". The problem is, when I press any button its text changes as it is supposed to, but when I press some other button after this, the text of the initial button is reset. Here is my button code from activity_main.xml: &lt;Button android:onClick="go" android:id="@+id/r1b1" android:layout_width="0dp" android:layout_height="30dp" android:layout_weight="1" android:text="@string/button" android:textSize="12dp"/&gt; Here is my main_activity.java : package com.example.battleships; import android.app.Activity; import android.os.Bundle; import android.view.Menu; import android.view.View; import android.widget.Button; import android.widget.TextView; public class MainActivity extends Activity { public char[][] a=new char[3][3]; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } public void go(View view) { setContentView(R.layout.activity_main); Button r1b1 = (Button)findViewById(view.getId()); TextView op1 = (TextView)findViewById(view.getId()); op1.setText("X"); } @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; } }
favorite count: 0
has comment: http://stackoverflow.com/comment/35441142
type: Question
has comment: http://stackoverflow.com/comment/35440986
has answer: http://stackoverflow.com/a/23174141
has title: Button Text Keeps Resetting
tagged with: android
upvote count: 1
has comment: http://stackoverflow.com/comment/35441115
score: 0
tagged with: java
answer count: 3
downvote count: 1

http://stackoverflow.com/comment/35554284
type: Comment
type: AnswerComment
has text: Where exactly is your change at? Oh I see the code block now. Sorry
comment on: http://stackoverflow.com/a/23237804
score: 0

http://stackoverflow.com/comment/35544011
comment on: http://stackoverflow.com/q/23231653
score: 0
type: Comment
type: QuestionComment
has text: Each element of the *array*, but aren't you supposed to be using an *ArrayList* instead?

http://stackoverflow.com/comment/35770348
comment on: http://stackoverflow.com/q/23260344
type: QuestionComment
has text: @BobDalgleish wat do you mean by entity where should I keep it while user is browsing the website ? in cookie ?
score: 0
type: Comment

jpa
tags question: http://stackoverflow.com/q/23193077
tags question: http://stackoverflow.com/q/23176551
tags question: http://stackoverflow.com/q/23213579
tags question: http://stackoverflow.com/q/23267041
tags question: http://stackoverflow.com/q/23242176
tags question: http://stackoverflow.com/q/23269193
tags question: http://stackoverflow.com/q/23264419
tags question: http://stackoverflow.com/q/23217972
tags question: http://stackoverflow.com/q/23131403
tags question: http://stackoverflow.com/q/23290722
tags question: http://stackoverflow.com/q/23214330
tags question: http://stackoverflow.com/q/23263480
tags question: http://stackoverflow.com/q/23186939
tags question: http://stackoverflow.com/q/23196166
tags question: http://stackoverflow.com/q/23186817
tags question: http://stackoverflow.com/q/23229160
tags question: http://stackoverflow.com/q/23269885
tags question: http://stackoverflow.com/q/23136352
tags question: http://stackoverflow.com/q/23191387
tags question: http://stackoverflow.com/q/23251353
tags question: http://stackoverflow.com/q/23222970
tags question: http://stackoverflow.com/q/23247886
tags question: http://stackoverflow.com/q/23215988
tags question: http://stackoverflow.com/q/23246286
type: Tag
tags question: http://stackoverflow.com/q/23236877
tags question: http://stackoverflow.com/q/23153949
tags question: http://stackoverflow.com/q/23265790
tags question: http://stackoverflow.com/q/23220430
tags question: http://stackoverflow.com/q/23250248
tags question: http://stackoverflow.com/q/23271644
tags question: http://stackoverflow.com/q/23275299
tags question: http://stackoverflow.com/q/23268048
tags question: http://stackoverflow.com/q/23278793
tags question: http://stackoverflow.com/q/23257203
tags question: http://stackoverflow.com/q/23141014
tags question: http://stackoverflow.com/q/23263622
tags question: http://stackoverflow.com/q/23189106
tags question: http://stackoverflow.com/q/23257782
tags question: http://stackoverflow.com/q/23136469
tags question: http://stackoverflow.com/q/23172548
tags question: http://stackoverflow.com/q/23232774
tags question: http://stackoverflow.com/q/23282201
tags question: http://stackoverflow.com/q/23288254
tags question: http://stackoverflow.com/q/23158880
tags question: http://stackoverflow.com/q/23259555
tags question: http://stackoverflow.com/q/23167738
tags question: http://stackoverflow.com/q/23213969
tags question: http://stackoverflow.com/q/23218378
tags question: http://stackoverflow.com/q/23281335
tags question: http://stackoverflow.com/q/23177655
tags question: http://stackoverflow.com/q/23261844
tags question: http://stackoverflow.com/q/23247539
tags question: http://stackoverflow.com/q/23220851
tag name: jpa
tags question: http://stackoverflow.com/q/23251214
tags question: http://stackoverflow.com/q/23264935
tags question: http://stackoverflow.com/q/23197246
tags question: http://stackoverflow.com/q/23171041
tags question: http://stackoverflow.com/q/23185241
tags question: http://stackoverflow.com/q/23147220
tags question: http://stackoverflow.com/q/23139541
tags question: http://stackoverflow.com/q/23170177
tags question: http://stackoverflow.com/q/23192204
tags question: http://stackoverflow.com/q/23194777
tags question: http://stackoverflow.com/q/23141917
tags question: http://stackoverflow.com/q/23191490
tags question: http://stackoverflow.com/q/23285757
tags question: http://stackoverflow.com/q/23213368
tags question: http://stackoverflow.com/q/23162483
tags question: http://stackoverflow.com/q/23280381
tags question: http://stackoverflow.com/q/23179894
tags question: http://stackoverflow.com/q/23277726
tags question: http://stackoverflow.com/q/23250092
tags question: http://stackoverflow.com/q/23143156
tags question: http://stackoverflow.com/q/23263909
tags question: http://stackoverflow.com/q/23153046

task
type: Tag
tag name: task
tags question: http://stackoverflow.com/q/23209245

http://stackoverflow.com/comment/35589450
type: AnswerComment
type: Comment
has text: You are right, it is valid. Sorry I oversight code.
score: 0
comment on: http://stackoverflow.com/a/23256954

http://stackoverflow.com/q/23225715
tagged with: rotation
downvote count: 0
tagged with: applet
favorite count: 0
has body: Our applet draws rotated text using AffineTransform, a method that we adopted to overcome previous problems with rotated text on OSX (discussed here: Java rotated text has reversed characters sequence) It worked until last thursday when I finally broke down and installed the latest OSX update. This brought me to "Java v7 update 55", and now the rotated text doesn't work anymore, but in the applet only. It works in the standalone. I'm using code like AffineTransform rot = AffineTransform.getRotateInstance(rotAngle*Math.PI/180); Font fRot = g.getFont().deriveFont(rot); g.setFont(fRot); g.drawString(p.displayName,stringX,stringY); It's rotating the characters correctly, but it doesn't position them correctly for strings longer than 1 character.
tagged with: macos
answer count: 0
upvote count: 3
type: UnansweredQuestion
has title: Latest OSX Java update (7u55) appears to break rotated text for applets
linked to: http://stackoverflow.com/q/14569475
type: Question
score: 3
tagged with: java

http://stackoverflow.com/q/23160221
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35416637
tagged with: java
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/23160252
has answer: http://stackoverflow.com/a/23160256
score: -1
has body: Please have a look at the below code public class PuctuationRemover { public PuctuationRemover() { String str = ":The red; third.fox is hungry!!! but, is he angry? doesn't! (yeah!). Call 911! system. can't access it! what the , hell . is this. people of my country, really? 123465 can^be,found.... OK . you got it? "; String str2 = str.replaceAll("[^a-zA-Z'\\s]+", str); System.out.println(str2); } public static void main(String[]args) { new PuctuationRemover(); } } The expected output is The red thirdfox is hungry but is he angry doesn't yeah Call system can't access it what the hell is this people of my country really canbefound OK you got it The output I get is :The red; third.fox is hungry!!! but, is he angry? doesn't! (yeah!). Call 911! system. can't access it! what the , hell . is this. people of my country, .............. The original working regex is here. What has gone wrong here?
has title: Regex do not change anything
answer count: 3
possible better answer: http://stackoverflow.com/a/23160256
upvote count: 0
tagged with: string
favorite count: 0
accepted answer: http://stackoverflow.com/a/23160252
has answer: http://stackoverflow.com/a/23160289
tagged with: regex
has comment: http://stackoverflow.com/comment/35416580

http://stackoverflow.com/a/23266889
has comment: http://stackoverflow.com/comment/35609893
has comment: http://stackoverflow.com/comment/35610101
upvote count: 3
has comment: http://stackoverflow.com/comment/35630845
has comment: http://stackoverflow.com/comment/35606744
type: AcceptedAnswer
has body: Don't use a MouseListener for buttons, you should be using an ActionListener See How to Use Buttons, Check Boxes, and Radio Buttons and How to Write an Action Listener for more details
answers question: http://stackoverflow.com/q/23266605
type: Answer
accepted answer of: http://stackoverflow.com/q/23266605
has comment: http://stackoverflow.com/comment/35609915
downvote count: 0
has comment: http://stackoverflow.com/comment/35606648
score: 3

http://stackoverflow.com/comment/35368931
score: 0
type: Comment
has text: Thanks for the wonderful answer. Can this be achieved through any dynamic solution using Java? I just want to check whether the calls to these functions/properties is made. This is just to get the statistics of those function calls.
type: AnswerComment
comment on: http://stackoverflow.com/a/23132720

http://stackoverflow.com/comment/35442506
has text: problem is it is required to use a while loop to Intialize the intArray. and print also with a while loop
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/23174867

http://stackoverflow.com/a/23233323
downvote count: 0
has body: You'll want to change location to locations which expects an array. Then wrap the value elements in a element. You should have constants.properties constants2.properties
has comment: http://stackoverflow.com/comment/35546752
type: Answer
has comment: http://stackoverflow.com/comment/35546864
score: 1
answers question: http://stackoverflow.com/q/23233293
upvote count: 1
has comment: http://stackoverflow.com/comment/35546850
accepted answer of: http://stackoverflow.com/q/23233293
has comment: http://stackoverflow.com/comment/35546778
has comment: http://stackoverflow.com/comment/35546959
has comment: http://stackoverflow.com/comment/35547008
type: AcceptedAnswer

http://stackoverflow.com/q/23205540
favorite count: 0
has answer: http://stackoverflow.com/a/23267065
has title: Passing SWI-Prolog Query from Java Program
type: UnansweredQuestion
tagged with: swi-prolog
downvote count: 0
score: 1
tagged with: java
linked to: http://stackoverflow.com/q/4303931
has body: I have a Query generated by my Java Program in Query Variable. I want to send this to SWI-Prolog to get the solution of this. The following shows the subcode I wrote in Java to communicate with SWI-Prolog. Process P= new ProcessBuilder("C:\\Program Files\\swipl\\bin\\swipl-win.exe").start(); BufferedReader processOutput = new BufferedReader(new InputStreamReader(P.getInputStream())); BufferedWriter processInput = new BufferedWriter(new OutputStreamWriter(P.getOutputStream())); String commandToSend = Query; processInput.write(commandToSend); But the SWI-Prolog Window opens up but the comand I am writing to ProcessInput is not being sent to SWI-Prolog. Can someoe suggest me the best way to do this? I need the output of the Query Execution from SWI-Prolog in a File as well.
type: Question
has comment: http://stackoverflow.com/comment/35496655
has comment: http://stackoverflow.com/comment/35496770
upvote count: 1
answer count: 1

http://stackoverflow.com/comment/46871879
comment on: http://stackoverflow.com/a/23162370
type: Comment
has text: The source can be found here: http://grepcode.com/file/repo1.maven.org/maven2/org.infinispan/infinispan-core/5.1.5.FINAL/org/infinispan/util/concurrent/jdk8backported/ConcurrentHashMapV8.java
score: 0
type: AnswerComment

http://stackoverflow.com/comment/35416758
comment on: http://stackoverflow.com/q/23158785
score: 0
type: Comment
type: QuestionComment
has text: just got my mistake, actually in Position class i have written different order of getter setter methods from the one that i was recieving from json.

http://stackoverflow.com/a/23166919
answers question: http://stackoverflow.com/q/23166576
score: 0
type: Answer
has body: Not quite sure what you are trying to achieve, but this prints the current time in CEST and IST: SimpleDateFormat localDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss z"); System.out.println("Current Date/Time in local timezone: " + localDateFormat.format( new Date())); localDateFormat.setTimeZone(TimeZone.getTimeZone("IST")); System.out.println("Current Date/Time in IST timezone: " + localDateFormat.format( new Date())); You can also take a date and time in string form and parse it: // create a string showing date and time in IST time zone String istDateString = localDateFormat.format( new Date()); Date istDate = localDateFormat.parse( istDateString, new ParsePosition(0) ); System.out.println( istDateString + " parsed to " + istDate ); The default used in Date.toString is, of course, the local setting.

http://stackoverflow.com/a/23262757
type: Answer
answers question: http://stackoverflow.com/q/23262223
score: 0
has body: Use iterators to iterate: for (Object o : tempFavList){ Log.v("MyApp",Integer.toString(tempFavList.size())); favourites.add(o.toString()); } It will most likely throw an exception, if collection is modified while iterating over.

http://stackoverflow.com/q/23243629
has answer: http://stackoverflow.com/a/23244229
has answer: http://stackoverflow.com/a/23243767
answer count: 3
has body: in my android application, i'm making an AsyncTask in a different way and i'd like to access the integer that gets returned so I can use it after. How do I get the returned value, because when i try to call myBPM as a variable, it is asking for a AsyncTask instead of an int. How would i get the returned value and store it as an int? Thanks AsyncTask myBPM = new AsyncTask&lt;Void, Void, Integer&gt;(){ ... return BPM; //integer value } }.execute();
upvote count: 0
has title: Getting the return as an int from this AsyncTask
favorite count: 0
tagged with: android-asynctask
tagged with: return
has answer: http://stackoverflow.com/a/23243805
type: UnansweredQuestion
tagged with: android
score: -3
tagged with: java
downvote count: 3
type: Question

http://stackoverflow.com/a/23246642
type: Answer
score: 0
has body: What is the advantage of using reflection? First, quoting the documentation: This class was added in Android 4.0 (Ice Cream Sandwich). By "was added", they mean "was added to the Android SDK", and by "Ice Cream Sandwich", they really mean Android 3.2 (API Level 13) based on the rest of the JavaDocs. However, the HttpResponseCache class itself has existed in the framework for longer, hopefully since Android 1.0 given their recommendations. However, that class was marked with the @hide annotation, so it could not be used directly by apps until API Level 13. Your Java version guard block using Build will avoid referencing this class directly on older devices. However, it does not actually configure the cache on older devices, either. Their approach will work on all versions of Android and will allow you to configure the cache, as the class has existed since the beginning. It is fairly rare that Google explicitly authorizes the use of reflection to get at hidden classes or methods this way, which is why you don't see it often in official documentation.
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23246386
answers question: http://stackoverflow.com/q/23246386

http://stackoverflow.com/a/23308651
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/23155599
answers question: http://stackoverflow.com/q/23155599
has body: I found out (by accident, it was not documented anywhere) that when you activate the remote_api for the app, you can use the route /_ah/login properly, which then allows you to use OAuth on the devserver. It worked on Python and Java when the Remote API is activated as described here. Just remove this when going to production, I guess. I don't know if it's an security issue.
upvote count: 1
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/comment/35592730
score: 1
comment on: http://stackoverflow.com/q/23258936
type: QuestionComment
has text: The error tells you pretty literally what the problem is.
type: Comment

http://stackoverflow.com/comment/35395004
type: Comment
type: QuestionComment
has text: @CodeCamper They run in the background and detect when the user holds down the home button, then starts running. They are both virtual assistants like what I'm trying to make.
comment on: http://stackoverflow.com/q/23147200
score: 0

http://stackoverflow.com/comment/35372916
score: 0
has text: Is a better solution use StringBuilder. Also u are adding empty strings in case there are in the array.
type: Comment
comment on: http://stackoverflow.com/a/23135136
type: AnswerComment

http://stackoverflow.com/comment/35544722
score: 0
type: Comment
type: QuestionComment
has text: @0x90 I'm working on a web project. and I checked every build trigger a 'publish'. but some times, it just doesn't work. I have to manually click the 'publish' to redeploy the web app to tomcat
comment on: http://stackoverflow.com/q/23232244

http://stackoverflow.com/comment/35546960
comment on: http://stackoverflow.com/q/23228960
score: 0
has text: @RohitJain Check this [link](http://stackoverflow.com/questions/23219752/find-minimal-substring-from-an-input-string-containing-all-chars-from-2nd-string). Hope you will get a working code too. Also, suggest for better solutions.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23166576
answer count: 2
has body: I need to convert the timestamp from one timezone to another time zone and retrieve the time in milliseconds for that timezone. I tried doing that below, but its not working out. SimpleDateFormat localDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); localDateFormat.setTimeZone(TimeZone.getTimeZone("anothertimezone)); //Current Date Time in Local Timezone System.out.println("Current Date and Time in local timezone: " + localDateFormat.format( new Date())); Calendar calendar = localDateFormat.getCalendar(); System.out.println(calendar.getTime()); The calendar.gettime is printing the current machine's time and not the time based on the timezone.
has comment: http://stackoverflow.com/comment/35428667
score: 0
tagged with: datetime
has comment: http://stackoverflow.com/comment/35428563
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35428725
has answer: http://stackoverflow.com/a/23166919
has title: Timestamp conversion from one timezone
type: Question
has answer: http://stackoverflow.com/a/23166936
tagged with: java
has comment: http://stackoverflow.com/comment/35428460

http://stackoverflow.com/a/23283013
type: Answer
upvote count: 2
has comment: http://stackoverflow.com/comment/35638684
has body: Alright, I've never actually used java, so forgive me if I make any coding errors... if (gender.equalsIgnoreCase("M")) { System.out.print("Your BMR value is: "); //Prints without a newline I assume System.out.print((66 + (13.8 * (weight * 0.454)) + (5 * (height * 2.54)) - (6.8 * age)); } else if (gender.equalsIgnoreCase("W")) { System.out.print("Your BMR value is: "); //Prints without a newline I assume System.out.print((655 + (9.6 * (weight * 0.454)) + (1.8 * (height * 2.54)) - (4.7 * age)); } else { System.out.println(); } Alright, the problem is that keyboard.nextLine() is adding a \n to the end. Two ways to fix: if (gender.equalsIgnoreCase("M\n")) { } else if (gender.equalsIgnoreCase("W\n")) { } OR if (gender.contains("m") || gender.contains("M")) { } else if (gender.contains("w") || gender.contains("W")) { }
score: 2
answers question: http://stackoverflow.com/q/23282908
downvote count: 0

http://stackoverflow.com/q/23282478
tagged with: char
has comment: http://stackoverflow.com/comment/35636983
answer count: 5
has answer: http://stackoverflow.com/a/23283782
has body: I want my program to replace every vowel in the inputted string. public static void main(String[] args) { // TODO code application logic here char vowel; vowel = 'a'+'e'+'i'+'o'+'u'; Scanner keyboard = new Scanner (System.in); System.out.print("Enter your name: "); String name = keyboard.nextLine(); name = name.replace( vowel,'*'); System.out.print(name); It just returns the string as normal but i want the vowels to be *'s.
possible better answer: http://stackoverflow.com/a/23282494
has title: How would you replace multiple characters in a string?
has answer: http://stackoverflow.com/a/23282494
has answer: http://stackoverflow.com/a/23282505
tagged with: java
has comment: http://stackoverflow.com/comment/123047120
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23282493
accepted answer: http://stackoverflow.com/a/23282493
has answer: http://stackoverflow.com/a/23282511
score: 0

http://stackoverflow.com/comment/35483465
type: AnswerComment
has text: Thanks for the input and examples. However, the "template" I am working from is now above in the code section. Now I get an error at throwExceptionA();. I know there are more simple ways of doing this, but I most follow the template.
comment on: http://stackoverflow.com/a/23198298
type: Comment
score: 0

http://stackoverflow.com/a/43669547
type: Answer
answers question: http://stackoverflow.com/q/23229538
has body: Another way this error would occur is forgetting the Test annotation. Encountered when right click method name in Eclipse and Run As -> Junit Test.
score: 0

http://stackoverflow.com/comment/35386558
has text: is correct @user1743703. I just made the change and ran the code. If you for some reason didn't want to change that to be the constructor then you would need to modify your code in `main()` to be something more like this: `RandomPanel p = new RandomPanel();`, `p.NamePanel()`, `frame.getContentPane().add(p);`
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23141104
type: AnswerComment

http://stackoverflow.com/comment/35444643
has text: Then, what is your opinion about the first line?
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23175577
type: QuestionComment

http://stackoverflow.com/comment/35435980
score: 0
type: Comment
has text: yea its pretty stupid but this one is just a random one to learn the sum method for my main app
comment on: http://stackoverflow.com/a/23171111
type: AnswerComment

http://stackoverflow.com/a/23187387
accepted answer of: http://stackoverflow.com/q/23187355
type: AcceptedAnswer
downvote count: 0
has body: Do the following instead Calendar today = Calendar.getInstance(); int month = today.get(Calendar.MONTH); // january == 0 btw int year = today.get(Calendar.YEAR); // do your printing here The reason you are getting 114 is because the getTime() method returns a java.util.Date class, and by default, the java.util.Date class has its year value offset by 1900 (don't ask me why). This means that the current year would be 2014 - 1900 = 114, which is what you are seeing.
upvote count: 5
type: Answer
has comment: http://stackoverflow.com/comment/35464690
answers question: http://stackoverflow.com/q/23187355
score: 5

http://stackoverflow.com/a/23191093
has comment: http://stackoverflow.com/comment/35471814
has body: You instantiate sharedList only in onClick() method of a button. This method is not called when your activity is resumed and sharedList is null. You need to check if it's not null: @Override protected void onResume() { // TODO Auto-generated method stub super.onResume(); if(sharedList != null &amp;&amp; sharedList.size()&gt;0){ adapter=new ArrayAdapter(ListViewDemo1.this,android.R.layout.simple_list_item_1,sharedList); list.setAdapter(adapter); } }
score: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/35471583
has comment: http://stackoverflow.com/comment/35471419
type: Answer
has comment: http://stackoverflow.com/comment/35471093
has comment: http://stackoverflow.com/comment/35471079
answers question: http://stackoverflow.com/q/23191009
has comment: http://stackoverflow.com/comment/35471316
has comment: http://stackoverflow.com/comment/35471155
has comment: http://stackoverflow.com/comment/35471566
upvote count: 1
has comment: http://stackoverflow.com/comment/35471217

http://stackoverflow.com/comment/35514593
has text: Paste your mapper code too, you need to make a couple of changes there too I think
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23212468

swagger-ui
tag name: swagger-ui
tags question: http://stackoverflow.com/q/23136748
type: Tag

http://stackoverflow.com/comment/35576009
comment on: http://stackoverflow.com/q/23249533
type: QuestionComment
type: Comment
has text: @NicolasDefranoux that's not exactly true. If you look at the "litmus test", in C++ I would be able to set the reference passed by reference to a new Object or null. You cannot do that in Java.
score: 0

http://stackoverflow.com/comment/35408718
score: 1
has text: @log1000: open the source file link. Note the class is not marked "public". It's in luni (look at the file path in the URL), but not directly accessible to an app.
comment on: http://stackoverflow.com/q/23150310
type: QuestionComment
type: Comment

http://stackoverflow.com/a/23257830
type: Answer
score: 2
has body: You can solve this problem by adding both the fxml files into a single group, and then you have to add the group to the scene. It is a little more work if you want to make everything look polished, but this the most simple way to do this. Just be sure your controllers are defined in the fxml files. GridPane root = new GridPane(); root.add((Node)(FXMLLoader.load(getClass().getResource("sample1.fxml"))) , 1 , 1); root.add((Node)(FXMLLoader.load(getClass().getResource("sample2.fxml"))) , 1 , 2); primaryStage.setTitle("Two For One Special"); primaryStage.setScene(new Scene(root, 800, 600)); primaryStage.show();
answers question: http://stackoverflow.com/q/23254085
downvote count: 0
upvote count: 2

http://stackoverflow.com/q/23185047
type: Question
tagged with: jakarta-ee
tagged with: javabeans
score: 0
answer count: 1
type: UnansweredQuestion
tagged with: spring
has body: I have multiple config files in my web.xml: MoJV_SpringMVCDispatcherServlet org.springframework.web.servlet.DispatcherServlet contextConfigLocation /mo/MoJV/config/MoJVConfig.xml /mo/App/config/AppConfig.xml 1 In MoJVConfig.xml i have <property name="defaultEncoding" value="utf-8" /> <property name="fallbackToSystemLocale" value="true" /> <property name="cacheSeconds" value="3" /> <property name="files" value="/mo/MoJV/i18n/" /> In AppConfig.xml I would like to only call setWorkingDirectory on the same messagesource. I have tried with <property name="files" value="/mo/App/i18n/" /> but that didnt work. I have tried a bunch of other things as well which hasnt worked. I dont want a new bean, I want the first declaration to actually run, initialize the bean and then my second declaration to call a method on that bean. Is this not possible?
tagged with: spring-mvc
has answer: http://stackoverflow.com/a/23185294
tagged with: java
has title: JavaEE/Spring: Just call method on initialized bean using xml?

http://stackoverflow.com/q/23252836
tagged with: android
has comment: http://stackoverflow.com/comment/35583600
has comment: http://stackoverflow.com/comment/35581413
has comment: http://stackoverflow.com/comment/35581309
has comment: http://stackoverflow.com/comment/35581633
answer count: 0
score: 0
tagged with: java
has title: CPU at 35% when app is running
type: Question
tagged with: performance
has body: So when I exit the android app with the home button and I check the CPU usage in the task manager it is using up around 35% I am using: http://www.androidhive.info/2012/07/android-gps-location-manager-tutorial/ to gather the location of the user. I cannot imagine this is taking up 35% of the CPU though. The app is made up of Custom Listviews and swipea-able Fragment tabs so I cannot understand why it uses all of this cpu power when the app is not running in the foreground.
has comment: http://stackoverflow.com/comment/35581755
type: UnansweredQuestion

http://stackoverflow.com/q/23249662
tagged with: vlc
tagged with: libvlc
tagged with: java
has answer: http://stackoverflow.com/a/23252851
type: Question
has body: I don't find how enable hardware acceleration in vlcj. Is it possible? I found parameter --ffmpeg-hw, but i don't know how use it.
tagged with: vlcj
score: 0
answer count: 1
has title: How enable hardware acceleration in vlcj?
type: UnansweredQuestion

http://stackoverflow.com/a/73441577
type: Answer
answers question: http://stackoverflow.com/q/23260057
has body: I tried many of the solutions described here. None solved the problem. Eventually, the only thing that helped was an upgrade of maven itself from v3.6.1 to v3.8.6. (I used corretto jdk11.0.12_7 for the build)
score: 0
has comment: http://stackoverflow.com/comment/140209799

http://stackoverflow.com/comment/35837948
has text: @ObedMarsh Although I really can't understand how this could possibly be scarier than what he wrote...
type: AnswerComment
comment on: http://stackoverflow.com/a/23224886
score: 0
type: Comment

http://stackoverflow.com/comment/35439235
has text: @User49234123412341 As a test, you can add a `destroy-method` and see if it is called. Don't wait 30 minutes though, set it to like 1 minute or less.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/23137171
type: Comment

http://stackoverflow.com/q/23169701
tagged with: jtextarea
has comment: http://stackoverflow.com/comment/35467693
has comment: http://stackoverflow.com/comment/35433379
has comment: http://stackoverflow.com/comment/35436631
score: 0
has title: Copying text in Java without copy and paste or clipboard transfer
has comment: http://stackoverflow.com/comment/35436611
type: UnansweredQuestion
has body: I am developing a 'text to speech' in Java. It is working well if the text to be converted into speach is copied into the JTextArea by Drag and drop or by Clipboard transfer via cut/copy/paste. But I am seeking a method by which a text just selected from any Browser, Text Editor or Excel Sheet etc. is copied to be set into my JTextArea. What should I do?
answer count: 0
has comment: http://stackoverflow.com/comment/35434429
has comment: http://stackoverflow.com/comment/35434358
tagged with: java
has comment: http://stackoverflow.com/comment/35433421
type: Question
linked to: http://stackoverflow.com/q/13839780

http://stackoverflow.com/q/23210502
has comment: http://stackoverflow.com/comment/35508823
has title: How to listen to text modify event of group widget (Java SWT)?
tagged with: events
tagged with: listener
has answer: http://stackoverflow.com/a/23212871
tagged with: swt
has comment: http://stackoverflow.com/comment/35511190
type: AnsweredQuestion
has body: What I want to do is: When I change the title of Group widget (by calling setText() method), I need to check the title, if contains certain characters, I'll do something. Now the problem is, how to listen to the text modify event of Group widget? I tried addListener(SWT.Modify, listener); method, (see the example below), it's not working. import org.eclipse.swt.SWT; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Event; import org.eclipse.swt.widgets.Group; import org.eclipse.swt.widgets.Listener; import org.eclipse.swt.widgets.Shell; public class Test { public static void main(String[] args) { final Display display = new Display(); Shell shell = new Shell(display); shell.setLayout(new GridLayout(1, false)); shell.setText("Stackoverflow"); final Group group = new Group(shell, SWT.NONE); group.setText("title0"); group.addListener(SWT.Modify, new Listener() { @Override public void handleEvent(Event event) { // TODO Auto-generated method stub System.out.println("Group title changed"); } }); Button btn = new Button(shell, SWT.NONE); btn.setText("Press to set title of Group."); btn.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { // TODO Auto-generated method stub group.setText("title1"); } }); shell.pack(); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); } }
tagged with: java
accepted answer: http://stackoverflow.com/a/23212871
type: Question
score: 0
answer count: 1

http://stackoverflow.com/a/23278708
score: 2
has comment: http://stackoverflow.com/comment/35634656
has comment: http://stackoverflow.com/comment/35634893
has comment: http://stackoverflow.com/comment/35634605
has comment: http://stackoverflow.com/comment/35633719
has comment: http://stackoverflow.com/comment/35634575
has body: You do not seem to have the @Produces annotation on your method @Produces(MediaType.APPLICATION_JSON) Without @Produces, the default mimetype returned is "text/html"
downvote count: 0
answers question: http://stackoverflow.com/q/23278449
upvote count: 2
type: Answer

http://stackoverflow.com/comment/91346039
comment on: http://stackoverflow.com/a/52189356
type: AnswerComment
score: 0
type: Comment
has text: surely is better practice to work with interfaces, but we don't know if the OP needs the specific methods of ArrayList

stack
tags question: http://stackoverflow.com/q/23174651
tags question: http://stackoverflow.com/q/23274518
tags question: http://stackoverflow.com/q/23187539
tags question: http://stackoverflow.com/q/23237650
tags question: http://stackoverflow.com/q/23164175
tags question: http://stackoverflow.com/q/23222795
type: Tag
tag name: stack
tags question: http://stackoverflow.com/q/23164169
tags question: http://stackoverflow.com/q/23254658

http://stackoverflow.com/q/23236592
has comment: http://stackoverflow.com/comment/35557621
type: Question
has body: i am trying to integrating spring to jsf without using maven.i put springbeans.xml in web-inf and i have created managed beans in facesconfig.xml. i am trying to draw connection from the springbeans.xml. i have inserted my project hirarchy image. ojdbc7.jar is being put in classpath for connecting oracle10g and jdk1.7. my facesconfig.xml <?xml version="1.0" encoding="UTF-8"?> <faces-config xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation= "http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web- facesconfig_2_0.xsd" version="2.0"> loginController myCode.LoginController request UI/login.xhtml /UI/login.xhtml registered /UI/Home.xhtml unregistered /UI/login.xhtml UI/login.xhtml /UI/login.xhtml register /UI/Registration.xhtml UI/Registration.xhtml /UI/Registration.xhtml Registration /UI/Registration.xhtml my springbeans.xml <?xml version="1.0" encoding="UTF-8"?> logincontroller.java package myCode; import java.io.Serializable; import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import javax.faces.bean.ManagedBean; import org.springframework.beans.factory.BeanFactory; import org.springframework.beans.factory.xml.XmlBeanFactory; import org.springframework.core.io.ClassPathResource; import org.springframework.jdbc.datasource.DriverManagerDataSource; @ManagedBean(name = "login", eager = true) public class LoginController implements Serializable { private static final long serialVersionUID = 1L; private String userName; private String passWord; //private boolean chkbox; DriverManagerDataSource dms; private BeanFactory factory; public ResultSet rst; public Statement stmt; public Connection conn; String qry = "select username from regdusers where username='" + getUserName() + "' AND password = '" + getPassWord() + "'"; /*public LoginController() throws SQLException{ loginAction(); //rst=stmt.executeQuery(qry); }*/ public String getUserN…
has title: no suitable driver found for oracle10g while integrating spring3.0 to jsf 2.0?
tagged with: jsf-2
has comment: http://stackoverflow.com/comment/35553156
score: 0
has comment: http://stackoverflow.com/comment/35552914
has comment: http://stackoverflow.com/comment/35553509
has comment: http://stackoverflow.com/comment/35553471
type: UnansweredQuestion
tagged with: jdbc
has comment: http://stackoverflow.com/comment/35553185
tagged with: spring
has comment: http://stackoverflow.com/comment/35553232
answer count: 0
tagged with: java

http://stackoverflow.com/comment/35651734
type: AnswerComment
has text: What would be the most efficient way is what I'm asking?
type: Comment
comment on: http://stackoverflow.com/a/23288451
score: 0

http://stackoverflow.com/comment/35550205
type: AnswerComment
has text: same problem inside RestartTimer you are creating new instance of Timer
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23235172

dependency-injection
tags question: http://stackoverflow.com/q/23163709
type: Tag
tags question: http://stackoverflow.com/q/23135525
tags question: http://stackoverflow.com/q/23265904
tags question: http://stackoverflow.com/q/23278427
tags question: http://stackoverflow.com/q/23232384
tag name: dependency-injection

http://stackoverflow.com/q/23268755
has body: It seems like this should be so easy, but I have been banging my head on it for days. I have a simple Java web app that uses Jetty embedded in an executable jar, and I am using system properties to define configuration info that I'm keeping separated from the app. I like that I can set system properties on the command line with -D. For example, java -Dbackend=backend_url -jar ... Is there a way to set a default value for such a system property?
answer count: 1
tagged with: embedded-jetty
has title: How can I specify a default value for a system property in a Java web app?
score: 0
has answer: http://stackoverflow.com/a/23268999
type: UnansweredQuestion
tagged with: jetty
tagged with: properties
tagged with: java
type: Question

http://stackoverflow.com/q/23279329
type: UnansweredQuestion
has title: Java E-Shop project
tagged with: object
has comment: http://stackoverflow.com/comment/35630984
tagged with: java
has body: So I have an exercise about creating a functional e-shop with a minimal CMD UI. I have certain instructions and rules to follow while creating this and that's what makes it so difficult for me. So firstly I have to create a class ierarchy, at the top of which stands the general Product.class and then below that the sub-classes Motherboard, CPU, GPU etc. Each of these sub classes contain their respective constructors. However, in the description of my exercise it isn't stated which items are going to be avalaible for immediate sale or should be ordered. Thus, I think that I'm supposed to choose these randomly meaning that I will have to create each and every one of these 'objects' by calling their constructors, like Motherboard mb1 = new Motherboard(motherboard info). Is there another way of implementing this? Because it seems like it's not the best way. Now for my problem, say I have the required objects created and through the UI and consecutive questions the user will choose what product to buy, how am I going to 'transfer' this chosen object to my Sale.class so I initiate the sale and go on with the program?( The sale class has to print the item's info which is stored in its object and then reduce the items quantity from the shop's reserve) Thanks in advance!
downvote count: 1
type: Question
upvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/23279501
score: -1
favorite count: 0
has comment: http://stackoverflow.com/comment/35630917

http://stackoverflow.com/comment/35407013
comment on: http://stackoverflow.com/a/23142562
type: Comment
has text: Ok I figured it out, I override setValueAt like this: [link](http://wklej.org/id/1336299/)
score: 0
type: AnswerComment

http://stackoverflow.com/a/23227413
score: 0
has comment: http://stackoverflow.com/comment/35568064
has comment: http://stackoverflow.com/comment/35568165
has comment: http://stackoverflow.com/comment/35564112
has comment: http://stackoverflow.com/comment/35568861
has comment: http://stackoverflow.com/comment/35556544
type: Answer
answers question: http://stackoverflow.com/q/23227143
has comment: http://stackoverflow.com/comment/35537118
has comment: http://stackoverflow.com/comment/35537024
has comment: http://stackoverflow.com/comment/35566512
has body: I don't think you can use variable defined inside one case block in another case block. Because there is no particular sequence of execution for case blocks. Better approach would be, declare PopupWindow as member variable of the class. public class MainClass extends Activity implements OnClickListener { public float goldCount; Button minionClick; Button storeClick; Button storeDismiss; TextView textGoldCount; String textTotal; private SharedPreferences prefs; PopupWindow pw; @Override public void onCreate (Bundle savedInstanceState) { super.onCreate(savedInstanceState); //Set full-screen requestWindowFeature(Window.FEATURE_NO_TITLE); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); setContentView(R.layout.mainlayout); prefs = getSharedPreferences("LeagueClicker", Context.MODE_PRIVATE); goldCount = prefs.getFloat("goldCount", 0.0f); //Linking the variables minionClick = (Button) findViewById(R.id.minioncentreid); storeClick = (Button) findViewById(R.id.storeimageid); storeDismiss = (Button) findViewById(R.id.menudismissid); textGoldCount = (TextView) findViewById(R.id.textviewtop); //String which will display at the top of the app textTotal = goldCount + " Gold"; //Setting TextView to the String textGoldCount.setText(textTotal); textGoldCount.setGravity(Gravity.CENTER); Typeface tf = Typeface.createFromAsset(getAssets(), "mechanical.ttf"); textGoldCount.setTypeface(tf); textGoldCount.setTextSize(35); //Setting onClickListener minionClick.setOnClickListener(this); storeClick.setOnClickListener(this); storeDismiss.setOnClickListener(this); } @Override public void onClick(View v) { // TODO Auto-generated method stub switch (v.getId()){ case R.id.minioncentreid: goldCount += 1.0; prefs.edit().putFloat("goldCount", goldCount).commit(); textTotal = goldCount + " Gold"; textGoldCount.setText(textTotal); textGoldCount.setGravity(Gravity.CENTER); break; case R.id.storeimageid: LayoutInflater inflater = (LayoutInfla…
has comment: http://stackoverflow.com/comment/35567272
has comment: http://stackoverflow.com/comment/35569295
has comment: http://stackoverflow.com/comment/35567777
has comment: http://stackoverflow.com/comment/35568627
has comment: http://stackoverflow.com/comment/35566097

http://stackoverflow.com/comment/35409177
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23156390
has text: You won't need `teamIndex` for this, as you already have the index given as value. Only in the implementation of `recordGameResult` will you need both `teamIndex` and `adjust`.
type: Comment

http://stackoverflow.com/comment/35539516
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23229265
has text: There are several different Eclipse downloads available on eclipse.org some of which include WindowBuilder. So if you want a GUI builder download one of those (Eclipse IDE for Java Developers for example).
score: 0

http://stackoverflow.com/comment/35383658
type: AnswerComment
comment on: http://stackoverflow.com/a/23141375
type: Comment
has text: There has to be a type relationship (parent-child, child-parent) for the casting to work. e.g. `String` is an `Object`.
score: 1

http://stackoverflow.com/q/23283487
has answer: http://stackoverflow.com/a/23283681
has comment: http://stackoverflow.com/comment/35638813
type: Question
has title: reading from a file until EOF
answer count: 1
has comment: http://stackoverflow.com/comment/35638713
has comment: http://stackoverflow.com/comment/35638847
score: 0
has body: I have a txt file that a bit per line now i want to modify it so i can have it rrun through entire collection '10101010' per line instead of just '1' per line... I have a string that will be added in to an array list and perform with the string ' 1 0 0 1 1 0 0 1 ' Scanner getInput = new Scanner(System.in); String fileName = getInput.nextLine(); File file = new File(fileName + ".txt"); Scanner scanner = new Scanner(file); while (scanner.hasNextLine()) { stringData += scanner.nextLine(); } for (int i = 0; i &lt; stringData.length(); i++) { list.add((Integer.valueOf(stringData.substring(i, i + 1)))); System.out.println(list.get(i)); }
has comment: http://stackoverflow.com/comment/35638719
has comment: http://stackoverflow.com/comment/35638750
type: UnansweredQuestion
tagged with: java

geotools
type: Tag
tags question: http://stackoverflow.com/q/23138662
tag name: geotools

http://stackoverflow.com/comment/35503719
type: QuestionComment
has text: I think that the invocations of `SwingUtilities.invokeLater` are queued. That means that if you call `SwingUtilities.invokeLater` to add the object to the jpanel before calling it to add `new InvadersGameFrame();` the first invocation should be executed before the second one.
type: Comment
comment on: http://stackoverflow.com/q/23209388
score: 0

http://stackoverflow.com/comment/75791761
type: AnswerComment
type: Comment
has text: @jameslarge , yes i understood that if a static synchronized method is called using object reference and class instance at the same time...it **will execute at the same time** . but imagine passing a same objects to two different thread ... its only until any one of the thread meets the synchronized block the object is synchronized and unable to be modified right? untill then the object is shared among threads right?
comment on: http://stackoverflow.com/a/23270294
score: 1

http://stackoverflow.com/comment/69702755
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23144367
has text: If you don't use scaling, see my answer at http://stackoverflow.com/questions/26908317/libgdx-tiledmap-bug-in-render/41251081#41251081
score: 0

http://stackoverflow.com/comment/35615359
comment on: http://stackoverflow.com/a/23210581
type: Comment
score: 0
type: AnswerComment
has text: i think for setValueAt i have to use this.addTableModelListener(new sampleTabelModelListener()); and also fireTableCellUpdated to update the cell

http://stackoverflow.com/a/23279688
answers question: http://stackoverflow.com/q/23279647
upvote count: 4
type: AcceptedAnswer
downvote count: 0
score: 4
has body: In java changing the argument of a method to refer to some other object does not have any effect on the original argument. Therefor a does not point to tmp after the execution of mystery. To accomplish the swapping your mystery method needs to work on arr directly
type: Answer
accepted answer of: http://stackoverflow.com/q/23279647
has comment: http://stackoverflow.com/comment/35631801

http://stackoverflow.com/a/23242159
upvote count: 2
type: Answer
has body: You have to use the code below int maxValue = getIntent().getExtras().getInt("max"); inside onCreate(). Hope it will solve your problem..
answers question: http://stackoverflow.com/q/23241979
score: 2
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23241979
downvote count: 0

http://stackoverflow.com/q/23201039
tagged with: websocket
possible better answer: http://stackoverflow.com/a/36181957
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23222079
accepted answer: http://stackoverflow.com/a/23222079
tagged with: java
type: Question
answer count: 2
has body: I have written a client program that connects to my websocket on the server. I set up tomcat8 with the examples working and hit the EchoAnnotation endpoint with my client program. I wrote this endpoint program as follows: @ServerEndpoint(value = "/websocket") public class PortServer implements AirMessageListener { public PortServer() { } @OnOpen public void start(Session session) { //do stuff } @OnClose public void end() { //do stuff } } @OnMessage public void incoming(String message) { //do stuff } @OnError public void onError(Throwable tw) throws Throwable { //do stuff } I compile this and create a war file called portserver and drop it into my tomcat webapps directory. I then switched my client program from connecting to: ws://localhost:8080/examples/websocket/echoAnnotation to ws://localhost:8080/portserver/websocket and run it. I get: Connecting to:ws://localhost:8080/portserver/websocket Exception in thread "main" com.corrisoft.air.exception.AirException: Error connecting to server at com.corrisoft.air.socket.AirSocketClient.&lt;init&gt;(AirSocketClient.java:60) at test.corrisoft.air.portserver.SocketConversation.&lt;init&gt;(SocketConversation.java:46) at test.corrisoft.air.portserver.RunPortServerTester.initConfigProperties(RunPortServerTester.java:76) at test.corrisoft.air.portserver.RunPortServerTester.&lt;init&gt;(RunPortServerTester.java:34) at test.corrisoft.air.portserver.RunPortServerTester.main(RunPortServerTester.java:109) Caused by: javax.websocket.DeploymentException: Handshake error. at org.glassfish.tyrus.client.ClientManager$1$1.run(ClientManager.java:466) at org.glassfish.tyrus.client.ClientManager$1.run(ClientManager.java:502) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at org.glassfish.tyrus.client.ClientManager$SameThreadExecutorService.execute(ClientManager.java:654) at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:…
has answer: http://stackoverflow.com/a/36181957
tagged with: tomcat
has title: Can't connect to my tomcat 8 websocket
score: 0

http://stackoverflow.com/comment/35639959
type: QuestionComment
type: Comment
has text: @HovercraftFullOfEels Not that you're wrong in this particular example, but is that a universal truth? Is something wrong with static utility method(s)?
comment on: http://stackoverflow.com/q/23284220
score: 1

http://stackoverflow.com/comment/35406096
score: 0
comment on: http://stackoverflow.com/q/23154600
has text: I have dome so many things but going out of mind. can u give me sample code link.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23200056
answers question: http://stackoverflow.com/q/23199820
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/35486685
has body: Have you thought about record the timing in the same thread that you are using to call the request with? You can throw exceptions from the underlying thread and when Future.get() is called, those exceptions will be thrown there. I'm not sure if you're familiar with non-blocking-io, but with this you wouldn't need to block on a read from your stream and continue computation (i.e. recording the time the operation is taking.) EDIT: java.nio.* package is a non-blocking io package made available with jse1.7 and later. Here is a link to a basic example using it: http://www.studytrails.com/java-io/non-blocking-io-multiplexing.jsp
has comment: http://stackoverflow.com/comment/35487178
has comment: http://stackoverflow.com/comment/35490204

http://stackoverflow.com/q/23159624
has answer: http://stackoverflow.com/a/23159666
tagged with: arrays
tagged with: binary-search
answer count: 3
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/23207412
has title: Finding elements in array with binary search
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23159682
score: 1
tagged with: java
has body: Trying to use Arrays.binarySearch() to search for a string in an array and return the index. However each time I call Arrays.binarySearch() I get the following exception - Exception in thread "main" java.lang.NullPointerException at java.util.Arrays.binarySearch0(Unknown Source) at java.util.Arrays.binarySearch(Unknown Source) at project.ArrayDirectory.lookupNumber(ArrayDirectory.java:97) at project.test.main(test.java:12) Here is my ArrayDirectory class - public class ArrayDirectory implements Directory { static Entry[] directory = new Entry[50]; @Override public void addEntry(String surname, String initials, int extension) { int n = 0; for (int i = 0; i &lt; directory.length; i++) { // counting number of // entries in array if (directory[i] != null) { n++; } } if (n == directory.length) { Entry[] temp = new Entry[directory.length * 2]; // if array is full // double the // length. for (int i = 0; i &lt; directory.length; i++) temp[i] = directory[i]; directory = temp; } int position = -1; for (int i = 0; i &lt; directory.length; i++) { position = i; if (directory[i] != null) { // sorting the array into alphabetical // order by surname. int y = directory[i].getSurname().compareTo(surname); if (y &gt; 0) { break; } } else if (directory[i] == null) { break; } } System.arraycopy(directory, position, directory, position + 1, directory.length - position - 1); directory[position] = new Entry(initials, surname, extension); // placing // new // entry // in // correct // position. } @Override public int lookupNumber(String surname, String initials) { // TODO Auto-generated method stub Entry lookup = new Entry(surname, initials); int index = Arrays.binarySearch(directory, lookup); return index; } } Any ideas how I use binary search to find the correct index? Thank you for you help. edit - I have also overridden comapreToin my Entry class - public int compareTo(Entry other) { return this.surname.compareTo(other.getSurname()); }
upvote count: 1
type: Question

http://stackoverflow.com/q/23143326
type: Question
has body: Here's my data set: &lt;zoo&gt; &lt;animal type="dog" breed="beagle" name="charlie" /&gt; &lt;animal type="dog" breed="beagle" name="chester" /&gt; &lt;animal type="dog" breed="retriever" name="goldie" /&gt; &lt;animal type="duck" breed="mallard" name="lord quackerton" /&gt; &lt;/zoo&gt; I want to transform this data into a big Java object, a hashmap of hashmaps of arrays. Toward that end, I've written the following code: Map&lt;String, Map&lt;String, ArrayList&lt;String&gt;&gt;&gt; expectedTypes = new HashMap(); Map&lt;String, ArrayList&lt;String&gt;&gt; expectedBreeds = new HashMap(); ArrayList&lt;String&gt; expectedNames = new ArrayList(); // Each &lt;animal&gt; element has already been stored in an array called 'zoo' for( int i = 0; i &lt; zoo.length; i++) { // Grab string values from XML file, using XMLbeans: String thisExpectedType = tests[i].getType(); String thisExpectedBreed = tests[i].getBreed(); String thisExpectedName = tests[i].getName(); // Store grabbed strings into the proposed object: expectedNames.add(thisExpectedName); expectedBreeds.put(thisExpectedBreed, expectedNames); expectedTypes.put(thisExpectedType, expectedBreeds); } This is almost doing what I want. The HashMaps get set up fine, but at the bottom level they're all storing the same expectedNames array. It looks like this: - dog - beagle - 0 charlie - 1 chester - 2 goldie - 3 lord quackerton - retriever - 0 charlie - 1 chester - 2 goldie - 3 lord quackerton - duck - mallard - 0 charlie - 1 chester - 2 goldie - 3 lord quackerton But here's what I need: - dog - beagle - 0 charlie - 1 chester - retriever - 0 goldie - duck - mallard - 0 lord quackerton I think I need to see if thisExpectedBreed at i already exists and if it doesn't, make a new array and put that in the HashMap. But how can I do that? How can I make sure each expectedBreeds Map has its own unique array and add the values to each array correctly? If it helps, the data set is sorted by type, then breed, then name, so the logic wo…
has title: How can I add a value to an array by referencing the HashMap containing it in Java?
has answer: http://stackoverflow.com/a/23143382
score: 0
tagged with: java
answer count: 3
possible better answer: http://stackoverflow.com/a/23143478
has answer: http://stackoverflow.com/a/23143478
tagged with: hashmap
type: AnsweredQuestion
tagged with: arrays
has answer: http://stackoverflow.com/a/23143916
tagged with: iteration
accepted answer: http://stackoverflow.com/a/23143382

http://stackoverflow.com/comment/35485553
type: Comment
type: QuestionComment
has text: You might want to read this - [Java Generics: What is PECS?](http://stackoverflow.com/q/2723397/738746).
comment on: http://stackoverflow.com/q/23199488
score: 0

http://stackoverflow.com/comment/35520875
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/23219494
has text: The compiler is complaining that your if blocks may not cover all possibilities. You need to add a final `else` block or have a default return at the end of the method.
type: Comment

http://stackoverflow.com/a/23227236
accepted answer of: http://stackoverflow.com/q/23227076
downvote count: 0
has body: I think the part your confused by is the meaning of static. the age variable in class Person will be shared across all instances of Person, and can be accessed with no instance at all via: Person.age = 100; Changing it for any instance: Person p = new Person(); p.age = 100; changes it for everyone, and is the same as calling Person.age = 100; Changing it in a non static way, meaning via some instance only makes the code misleading by making people think they are changing an instance variable at first glance. You will get a compiler warning about this.
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23227076
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/q/23145508
type: Question
tagged with: tree
tagged with: linked-list
has comment: http://stackoverflow.com/comment/35391020
score: 0
tagged with: java
has body: I want to remove the head of a linked list and return the object that was removed but I'm not sure if it is removing the head correctly. Here is my code I have, I am using this to build a sorted tree so that is why I need to remove the head of the linked list. // TreeNode class to hold the information of each node. static class TreeNode{ int frequency; boolean isLeftChild; TreeNode parent; TreeNode next; /** * TreeNode class constructor to initialize the variables and also * takes a frequency as the parameter. * @param f Frequency of a certain character. */ TreeNode(int f){ frequency = f; isLeftChild = true; parent = null; next = null; } } // Class used to store information for the linked list. static class List{ TreeNode head; int numItems; // number of nodes in the list List(){ head = null; numItems = 0; // initialize head and numItems } /** * Removes the front of the linked list if the head is not null. * @return Returns the TreeNode object that was removed. */ TreeNode removeFront(){ if(head == null){ return null; } else{ numItems--; head = head.next; return head; } }
answer count: 1
has title: Linked List remove head and return object?
has comment: http://stackoverflow.com/comment/35391069
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23145559

http://stackoverflow.com/comment/35401720
comment on: http://stackoverflow.com/q/23151445
has text: I'm not actually able to edit the webservice, sadly. I could try to get the people responsible to change it if need be, but seeing as it expects a string and a string is sent as a parameter, my issue of not receiving the values should not be related to the values not being specified as dates.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35435841
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/23171123
type: Comment
has text: I can't find any `invalidateData()` in the `Android` framework. Where have you seen it? For the second one, check this: http://stackoverflow.com/questions/10676720/is-there-any-difference-between-listview-invalidateviews-and-adapter-notify

http://stackoverflow.com/a/77833320
has body: Found a new solution for 2024. My Project is Spring-Boot 3.x, Java 17: Problem Error Log: ... [ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:3.2.5:test (default-test) on project rest-clients: [ERROR] [ERROR] Please refer to /rest-clients/target/surefire-reports for the individual test results. [ERROR] Please refer to dump files (if any exist) [date].dump, [date]-jvmRun[N].dump and [date].dumpstream. [ERROR] ExecutionException Error occurred in starting fork, check output in log [ERROR] org.apache.maven.surefire.booter.SurefireBooterForkException: ExecutionException Error occurred in starting fork, check output in log [ERROR] at org.apache.maven.plugin.surefire.booterclient.ForkStarter.awaitResultsDone(ForkStarter.java:456) [ERROR] at org.apache.maven.plugin.surefire.booterclient.ForkStarter.runSuitesForkOnceMultiple(ForkStarter.java:358) [ERROR] at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:296) [ERROR] at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:250) [ERROR] at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeProvider(AbstractSurefireMojo.java:1241) [ERROR] at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeAfterPreconditionsChecked(AbstractSurefireMojo.java:1090) [ERROR] at org.apache.maven.plugin.surefire.AbstractSurefireMojo.execute(AbstractSurefireMojo.java:910) [ERROR] at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137) [ERROR] at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2(MojoExecutor.java:370) [ERROR] at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute(MojoExecutor.java:351) [ERROR] at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:215) [ERROR] at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:171) [ERROR] at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:163) [ERROR] at or…
answers question: http://stackoverflow.com/q/23260057
has comment: http://stackoverflow.com/comment/137698020
type: Answer
score: 0

http://stackoverflow.com/comment/35615062
type: QuestionComment
comment on: http://stackoverflow.com/q/23271000
has text: Shouldn't it be `{ !p.isEmpty() }`?
score: 0
type: Comment

http://stackoverflow.com/comment/35517793
comment on: http://stackoverflow.com/q/23216188
has text: @Rembo Though i solved the problem for redirecting.The problem Now is that i need to send an arraylist as an reuqest parameter.Please see my edited post
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35536661
type: AnswerComment
has text: That's completely expected. If you want only some persons, you have to query persons, not countries. A country's persons contains the country's persons, all of them.
score: 0
comment on: http://stackoverflow.com/a/23226651
type: Comment

http://stackoverflow.com/comment/35461862
type: QuestionComment
has text: Post the complete stack trace.
comment on: http://stackoverflow.com/q/23185200
score: 0
type: Comment

http://stackoverflow.com/comment/35649553
comment on: http://stackoverflow.com/a/23289011
type: AnswerComment
has text: is it bo.somestuff() is calling DB ? because DB and transactions may lead this error
score: 0
type: Comment

http://stackoverflow.com/comment/35578663
type: Comment
comment on: http://stackoverflow.com/a/23251132
has text: @eis I can reproduce the OP exception with their code and nothing for "STDIN", so I suspect that's what's going on.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/35612386
has text: @BrettHale: Yes, some cryptographic packages still use MR, because it is sufficient for their needs, and because MR is built-in if you're using GMP or BigInteger for the arithmetic. But some sort of BPSW is now standard among mathematicians. Note that BPSW shares with MR the quick return on composites, since it starts with a strong pseudoprime test. Note also that a single strong-pseudoprime test followed by some kind of Lucas test is faster than 15 strong-pseudoprime tests, so BPSW is faster than MR for primes. And I've never heard anyone say that calculating a Jacobi symbol is complex. ;)
comment on: http://stackoverflow.com/a/23144365
type: Comment
score: 1
type: AnswerComment

http://stackoverflow.com/comment/35514800
type: AnswerComment
score: 0
type: Comment
has text: so if you said, "4.0 and later not prior". THat means I cant use my "2.3" for this wifi peer2peer right?
comment on: http://stackoverflow.com/a/23214587

http://stackoverflow.com/comment/35555157
type: QuestionComment
has text: It is not I think, or did I miss anything?
comment on: http://stackoverflow.com/q/23238384
score: 0
type: Comment

http://stackoverflow.com/comment/35519655
has text: Tried `grep -r JAVA_HOME ~` no results found. Its the same with ANT_HOME, when I give echo $ANT_HOME I get `/usr/local/apache/ant` but cannot find where it is set.
comment on: http://stackoverflow.com/a/23218161
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/23249011
has answer: http://stackoverflow.com/a/23266832
has answer: http://stackoverflow.com/a/23249228
tagged with: jquery
has body: I am trying to run a test in Eclipse that was previously recorded in Selenium. I was able to get it to run in Selenium by using an XPath. However, in Eclipse I get an NoSuchElement error. I am trying to click on a tab on the page, the problem is that the tabs are not listed as buttons, but they are actually in a table. Here is the line that I have in place now. driver.findElement(By.xpath("(//div[@onclick=\"parent.frames.contentFrame.location='/messaging/maintfList.jsp?clearUIPath=true&amp;uiPathLabel=Forms'\"])")).click(); Here is what I am shown when I inspect the element. All of the tabs are listed as menu-normal, the only difference is in the pathlabel. div class="menu-normal" onclick="parent.frames.contentFrame.location='/messaging/maintfList.jsp?clearUIPath=true&amp;uiPathLabel=Forms'"
tagged with: xpath
type: UnansweredQuestion
tagged with: selenium
tagged with: java
tagged with: eclipse
type: Question
score: 0
has title: xpath works in selenium recording, but does not run in Eclipse
answer count: 2

http://stackoverflow.com/comment/35579774
score: 0
type: Comment
has text: Looking at Double to iee754 bias 127 binary.
type: QuestionComment
comment on: http://stackoverflow.com/q/23252025

http://stackoverflow.com/comment/35445055
type: QuestionComment
comment on: http://stackoverflow.com/q/23176120
has text: OK I will put it as answer. Thanks to @maxx777 also.
score: 0
type: Comment

http://stackoverflow.com/a/23225835
accepted answer of: http://stackoverflow.com/q/23225687
type: Answer
score: 3
has body: Follow these steps: Convert the 2 Strings to Date objects using the SimpleDateFormat. For more details on the conversion, you can refer this post. Example: Date date = new SimpleDateFormat(yourFormat).parse(dateString); Now compare the 2 Date objects using the Date#after() method.
upvote count: 3
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23225687

http://stackoverflow.com/q/23178926
tagged with: java
has comment: http://stackoverflow.com/comment/35456714
type: Question
tagged with: iterator
has comment: http://stackoverflow.com/comment/35449936
has comment: http://stackoverflow.com/comment/35476166
downvote count: 0
has title: Post-order iterator in trees
answer count: 3
has answer: http://stackoverflow.com/a/63304648
favorite count: 0
has comment: http://stackoverflow.com/comment/35456173
tagged with: binary-search-tree
has body: I am trying to create an Iterator implementation for post-order and I am in a slump. I was able to get in-order and pre-order implementations but I can't seem to get a post-order. If you guys can point me in the right direction and give me some tips, that would be amazing. Here's my in-order class: public class InOrderIterator&lt;T&gt; implements Iterator&lt;T&gt; { private final Deque&lt;BinaryTreeNode&lt;T&gt;&gt; stack; private BinaryTreeNode&lt;T&gt; current; public InOrderIterator(BinaryTreeNode&lt;T&gt; root){ stack = new LinkedList&lt;BinaryTreeNode&lt;T&gt;&gt;(); this.current = root; } @Override public boolean hasNext() { return (!stack.isEmpty() || current != null); } @Override public T next() { while (current != null) { stack.push(current); if (current.hasLeftChild()) current = current.getLeftChild(); else current = null; } current = stack.pop(); BinaryTreeNode&lt;T&gt; node = current; if (current.hasRightChild()) current = current.getRightChild(); else current = null; return node.getData(); } @Override public void remove() { throw new UnsupportedOperationException(); } } Here's a description of pre-, in-, and post-order: Pre-order Visit the root. Traverse the left subtree. Traverse the right subtree. In-order Traverse the left subtree. Visit root. Traverse the right subtree. Post-order Traverse the left subtree. Traverse the right subtree. Visit the root. http://en.wikipedia.org/wiki/Tree_traversal#Types
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35458627
has answer: http://stackoverflow.com/a/34911340
score: 2
has answer: http://stackoverflow.com/a/53039065

http://stackoverflow.com/comment/35467548
has text: Could you give some examples?
comment on: http://stackoverflow.com/q/23188981
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/23152523
has answer: http://stackoverflow.com/a/23152789
answer count: 1
tagged with: maven-plugin
tagged with: maven-3
favorite count: 0
tagged with: maven
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/23152789
has title: Maven-dependency-plugin copy package to a few places
has body: I use maven-dependency-plugin to copy built package to remote server. I do this so: org.apache.maven.plugins maven-dependency-plugin 2.8 copy package copy ${project.groupId} ${project.artifactId} ${project.version} ${project.packaging} /home/xxx/ Now I need to copy it to one more place (shared package for client and server - interfaces). How can I do it? I tried to add second outputDirectory,new block artifactItems and new block artifactItem but no result.
upvote count: 1

http://stackoverflow.com/comment/35429902
has text: this `right one`, try this code, your not `set` the value from the `database`,..this problem of your code
comment on: http://stackoverflow.com/a/23167649
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/23270818
has answer: http://stackoverflow.com/a/23626103
has comment: http://stackoverflow.com/comment/42520123
upvote count: 12
has comment: http://stackoverflow.com/comment/42596967
has comment: http://stackoverflow.com/comment/42594888
score: 12
answer count: 3
has body: We are facing this issue on our clients machine. Our project uses a third party java applet to open the files in respective softwares. On windows7 we don have any issue but we have issue on windows8 OS our project is working fine in IE10 and FF browsers. of windows8 this error is thrown only in chrome. but when we execute same third party demo site which uses this same java applet to open the files in respective softwares, that is working fine in all browsers without making any changes in settings. I have read many replies from different ppl that we need to changes the client java secutiry settings. But how can we ask all our clients to make this setting so this is not a proper solution for our problem. Please see the image below ![Error message][1] is "Your security system have blocked an application with expired or not yet valid certificate from running" please help me solve this ..
has comment: http://stackoverflow.com/comment/35614308
downvote count: 0
tagged with: applet
has answer: http://stackoverflow.com/a/25404834
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/31452043
has title: Application blocked by security settings error on client' Windows8 OS
tagged with: java
has comment: http://stackoverflow.com/comment/35682188
type: Question

http://stackoverflow.com/comment/35376397
score: 6
comment on: http://stackoverflow.com/q/23137464
type: Comment
type: QuestionComment
has text: Surely "WOOD"'s longest substring would be two characters long? "WO" or "OD"

http://stackoverflow.com/q/23189140
has comment: http://stackoverflow.com/comment/35493619
type: Question
has body: I've created an Enum class to manage various systems in my code, however, I need to access another class in order to complete some code. I've tried referencing the code like so: public NewSkillsMain plugin = NewSkillsMain.this; however this always returns the error: No enclosing instance of the type NewSkillsMain is accessible in scope Does anyone know how to reference other classes from an Enum class? Thanks!
tagged with: enums
has comment: http://stackoverflow.com/comment/35468562
tagged with: java
has comment: http://stackoverflow.com/comment/35468567
score: 0
has comment: http://stackoverflow.com/comment/35468553
has comment: http://stackoverflow.com/comment/35467803
has comment: http://stackoverflow.com/comment/35468559
type: UnansweredQuestion
has title: Referencing another class in an Enum class
has comment: http://stackoverflow.com/comment/35468575
answer count: 0

http://stackoverflow.com/q/23224234
has answer: http://stackoverflow.com/a/29804042
has comment: http://stackoverflow.com/comment/44808084
favorite count: 0
tagged with: rest
answer count: 3
has comment: http://stackoverflow.com/comment/35607462
has comment: http://stackoverflow.com/comment/35543957
score: 4
has comment: http://stackoverflow.com/comment/35621936
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/31293388
has title: How can I cleanly override the default ServiceLocator used by Jersey?
has answer: http://stackoverflow.com/a/28418025
has comment: http://stackoverflow.com/comment/35548212
has comment: http://stackoverflow.com/comment/35589552
has answer: http://stackoverflow.com/a/29420926
tagged with: java
has comment: http://stackoverflow.com/comment/44789593
has comment: http://stackoverflow.com/comment/44807763
has body: I am developing an application that uses Jersey (2.5) as its REST front-end, and Jetty as embedded HTTP(S) server, both in a so-called "embedded" way, eg. without resorting to making .war and deploying it but through programmatic configuration of handlers, resources, injections... I would like to somehow override the HK2 ServiceLocator that is used on the server side by Jersey, or possibly provide this service locator with a parent for resolving dependencies that are defined outside of the REST part of the application. From what I see of the code, this does not seem possible: The ServiceLocator is instantiated inside the ApplicationHandler through a call to Injections: if (customBinder == null) { this.locator = Injections.createLocator(new ServerBinder(application.getProperties()), new ApplicationBinder()); } else { this.locator = Injections.createLocator(new ServerBinder(application.getProperties()), new ApplicationBinder(), customBinder); } And the code in Injections tells me the following: public static ServiceLocator createLocator(Binder... binders) { return _createLocator(null, null, binders); } which means the newly created service locator has some arbitrarily generated name and has no parent. Is there a (clean) way to change this behaviour so that I inject my own ServiceLocator as a parent of the application's?
type: Question
upvote count: 4
tagged with: jersey
downvote count: 0
has comment: http://stackoverflow.com/comment/35594879
tagged with: jersey-2.0

http://stackoverflow.com/comment/35553400
has text: I got 2 downvoted also, i don't know why, but Its Just ok.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23237076
type: AnswerComment

http://stackoverflow.com/comment/35475268
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23193539
has text: it does indeed involve sockets, I will add the out stream above

http://stackoverflow.com/comment/35543206
has text: Also - the "e" in the declaration is an error. Delete it. And it should say "public" and not "Public".
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23231384
type: Comment

http://stackoverflow.com/comment/95585966
has text: any help on this https://stackoverflow.com/questions/54386406/no-referrer-when-downgrade-error-integrating-java-service
type: AnswerComment
comment on: http://stackoverflow.com/a/31677499
type: Comment
score: 0

http://stackoverflow.com/comment/35426904
score: 0
type: Comment
has text: Then you should vote for my answer. This is the whole concept of this website.
comment on: http://stackoverflow.com/a/23165717
type: AnswerComment

http://stackoverflow.com/a/23261952
score: 99
downvote count: 1
has body: (This answer shows one of many options. Just because is has had acceptance mark, doesn't mean it is the best one. I suggest reading other answers and picking one depending on situation you are in. IMO: for Java 8 Holger's answer is nicest, because aside from being simple it doesn't require additional iteration which happens in my solution. for Java 9 I would pick solution describe in Tagir Valeev answer) You can copy elements from your Enumeration to ArrayList with Collections.list and then use it like Collections.list(yourEnumeration).forEach(yourAction);
has comment: http://stackoverflow.com/comment/69198714
type: Answer
upvote count: 100
has comment: http://stackoverflow.com/comment/39537462
has comment: http://stackoverflow.com/comment/69201232
answers question: http://stackoverflow.com/q/23261803

http://stackoverflow.com/comment/35662452
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/23290286
score: 0
has text: I remember that words. And i will try to follow them. Thankyou, for your support, kindness and of course, for your knowledges, which you gave to me.

http://stackoverflow.com/comment/35647398
score: 1
comment on: http://stackoverflow.com/a/23275169
type: AnswerComment
type: Comment
has text: The code you have edited can still cause errors as your column size is 2 and you are placing values for indices 0 and 2(column1=0, column2=2). You are missing index 1, and index 2 makes column size 3.

http://stackoverflow.com/comment/35545563
type: Comment
has text: @JeffStory I was just curious to know if anyone, e.g. Oracle or some clever software genius has created code that can allow for horizontal inheritance. If this existed, I would be so happy because it would allow all the classes(dealer, and players) in my blackjack game to communicate allowing me code to work 100%
type: AnswerComment
comment on: http://stackoverflow.com/a/23232631
score: 0

http://stackoverflow.com/a/23283031
has body: in the url you have to specify either "aleg_url" or "bleg_url" and the "call_uuid" as such params.put("call_uuid", "6653422-91b6-4716-9fad-9463daaeeec2"); params.put("bleg_url", "http://myxmlserver.com/xmldial"); Please check out this link for the rest of clarifications.
has comment: http://stackoverflow.com/comment/35745326
score: 0
answers question: http://stackoverflow.com/q/23241409
type: Answer

http://stackoverflow.com/q/23155868
tagged with: libgdx
downvote count: 0
favorite count: 0
type: UnansweredQuestion
tagged with: android
has title: Check a prefect collision between rotating texture and a curve (libgdx)
has comment: http://stackoverflow.com/comment/35411121
has comment: http://stackoverflow.com/comment/35411458
answer count: 0
score: 1
has comment: http://stackoverflow.com/comment/35646743
tagged with: java
upvote count: 1
type: Question
has body: I'm developing a game where there is a texture that the player need to move around the screen without touching the borders which are black lines and curves. The figure rotates while the player moves it and the borders are fixed the entire game. I need a good method to check a prefect collision between the border and the texture. I tried to make a rectangle around the texture and check for black and green (texture color) pixels that are near each other inside the rectangle but it's too slow.

http://stackoverflow.com/comment/35491785
score: 0
type: Comment
has text: @MiserableVariable As long as `get` and `put` are threadsafe, this algorithm is threadsafe. It does not need any locking across accesses to `map`.
comment on: http://stackoverflow.com/a/23202783
type: AnswerComment

http://stackoverflow.com/q/23139060
downvote count: 0
has answer: http://stackoverflow.com/a/35900579
tagged with: aptana
favorite count: 0
accepted answer: http://stackoverflow.com/a/23148017
has comment: http://stackoverflow.com/comment/35395428
answer count: 4
has comment: http://stackoverflow.com/comment/35395402
has answer: http://stackoverflow.com/a/37464796
has comment: http://stackoverflow.com/comment/35383415
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35379280
upvote count: 3
linked to: http://stackoverflow.com/q/347286
type: Question
score: 3
has comment: http://stackoverflow.com/comment/35379581
has comment: http://stackoverflow.com/comment/35382079
has comment: http://stackoverflow.com/comment/35379550
has body: I've been working on Aptana Studio and some JRE required software for a bit of time now , but since yesterday something quite odd happened, as suddenly the software that requires it threw me an error No Java virtual machine was found . Last thing I did before that was restoring my system files permissions thought safe mode as I had some trouble with that , could this have anything to do with it ? I've tried installing JRE once again , no results. However when I run /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java -version I do get the following 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) Aptana gives me the following error No Java virtual machine was found after searching the following locations: /Applications/Aptana Studio 3/AptanaStudio3.app/Contents/MacOS/jre/bin/java java in your current PATH And other software such as Spine won't simply start. My .bash_profile is the following : PATH="/Library/Frameworks/Python.framework/Versions/3.4/bin:${PATH}" PATH="/Library/Java/JavaVirtualMachines/jdk1.7.0_55.jdk/Contents/Home/bin:${PAT$ export PATH export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_55.jdk/Contents/Home The output of echo $PATHis the following /Library/Java/JavaVirtualMachines/jdk1.7.0_55.jdk/Contents/Home/bin:/Library/Frameworks/Python.framework/Versions/3.4/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin The output of echo $JAVA_HOME is the following /Library/Java/JavaVirtualMachines/jdk1.7.0_55.jdk/Contents/Home And Java invocations on the terminal work. Guidance will be highly appreciated.
tagged with: java
linked to: http://stackoverflow.com/q/12089697
has comment: http://stackoverflow.com/comment/35379768
possible better answer: http://stackoverflow.com/a/23140505
linked to: http://stackoverflow.com/q/9602704
has answer: http://stackoverflow.com/a/23148017
has title: Java Runtime Environment not found error
has answer: http://stackoverflow.com/a/23140505

http://stackoverflow.com/q/23249428
upvote count: 1
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/35575306
tagged with: java
has comment: http://stackoverflow.com/comment/35574906
linked to: http://stackoverflow.com/q/738629
score: 0
has answer: http://stackoverflow.com/a/23249875
tagged with: junit
has comment: http://stackoverflow.com/comment/35575090
has answer: http://stackoverflow.com/a/23274920
favorite count: 0
has comment: http://stackoverflow.com/comment/35575320
has answer: http://stackoverflow.com/a/23249602
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23249702
has body: I have a simple faulty method that I would like to write a JUnit statement to test Here is the code: public static ArrayList union(ArrayList a, ArrayList b) { ArrayList d; int randNum = (int) Math.random(); // if random is dividable by 2 then a is return else b will. if (randNum % 2 == 0) { return a; } else { return b; } } Here is the problem casting Math.random() is not going to produce an integer random number. So, when the method is called it is going to return the array list a. I would like to write a test case that covers this statement and make it fail to show that It is not reaching b. Currently I have this test case: @Test public void testUnion_2() throws Exception { ArrayList a = new ArrayList(); ArrayList b = new ArrayList(); ArrayList result = SectionOne.union(a, b); // add additional test code here assertNotNull(result); assertEquals(0, result.size()); } Thanks I really appreciate the help.
answer count: 4
has comment: http://stackoverflow.com/comment/35575085
has title: How can I write a JUnit test for code that uses Random

http://stackoverflow.com/q/23270690
score: 0
tagged with: java
accepted answer: http://stackoverflow.com/a/23270711
has comment: http://stackoverflow.com/comment/35613929
type: Question
linked to: http://stackoverflow.com/q/5374311
linked to: http://stackoverflow.com/q/5061640
type: AnsweredQuestion
has body: I have this code: java.util.List&lt;String&gt; result = new java.util.LinkedList&lt;&gt;(); And have added some strings to it. But I want to return a String[]. Ideally I'd like to write return (String[])result.toArray(); But I get a casting error at runtime. (Cannot convert Object[] to String[]). Is there a way round this that doesn't involve manual element by element copy?
duplicate of: http://stackoverflow.com/q/5061640
has answer: http://stackoverflow.com/a/23270711
has answer: http://stackoverflow.com/a/23270721
answer count: 2
has title: Type specific java.util.List.toArray()
possible better answer: http://stackoverflow.com/a/23270721
duplicate of: http://stackoverflow.com/q/5374311

http://stackoverflow.com/q/23169557
duplicate of: http://stackoverflow.com/q/18736681
has comment: http://stackoverflow.com/comment/58876375
upvote count: 8
tagged with: thread-sleep
has answer: http://stackoverflow.com/a/23169929
has comment: http://stackoverflow.com/comment/35433187
has comment: http://stackoverflow.com/comment/35434146
linked to: http://stackoverflow.com/q/1453295
has comment: http://stackoverflow.com/comment/35434413
has comment: http://stackoverflow.com/comment/35433054
possible better answer: http://stackoverflow.com/a/23169929
tagged with: multithreading
has comment: http://stackoverflow.com/comment/35434079
downvote count: 1
has answer: http://stackoverflow.com/a/23181571
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35434528
score: 7
tagged with: java
tagged with: sleep
type: Question
answer count: 2
has title: Thread sleep and precise timing
linked to: http://stackoverflow.com/q/18736681
has comment: http://stackoverflow.com/comment/35433405
accepted answer: http://stackoverflow.com/a/23181571
has body: I am making a code where I want definite precision in my timing. I use a robot to make some actions, then I use Thread.sleep(some_time) for some_time to be elapsed between the actions. But I don't get best results because as I search it, sleep is not accurate. What would be the best way to accomplish this? I mean simulate Thread.sleep with other methods.
has comment: http://stackoverflow.com/comment/35434473
favorite count: 0

http://stackoverflow.com/comment/35544846
comment on: http://stackoverflow.com/q/23232416
has text: see: http://stackoverflow.com/questions/3581741/c-sharp-equivalent-to-javas-charat
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/comment/35397486
comment on: http://stackoverflow.com/q/23149149
type: Comment
type: QuestionComment
has text: public static boolean checkStringInput(char Input) { return Input == 89 || Input == 121; }
score: 0

http://stackoverflow.com/a/23177704
has comment: http://stackoverflow.com/comment/35447495
type: Answer
score: 2
upvote count: 2
accepted answer of: http://stackoverflow.com/q/23177375
answers question: http://stackoverflow.com/q/23177375
type: AcceptedAnswer
downvote count: 0
has body: If you're using import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; you must use getSupportFragmentManager(); instead of getFragmentManager();. Source: http://developer.android.com/reference/android/support/v4/app/FragmentActivity.html

libgdx
tags question: http://stackoverflow.com/q/23169600
tags question: http://stackoverflow.com/q/23188009
tags question: http://stackoverflow.com/q/23181623
tags question: http://stackoverflow.com/q/23137767
tags question: http://stackoverflow.com/q/23246248
tags question: http://stackoverflow.com/q/23228594
tags question: http://stackoverflow.com/q/23186065
tags question: http://stackoverflow.com/q/23157849
tag name: libgdx
tags question: http://stackoverflow.com/q/23197894
tags question: http://stackoverflow.com/q/23231029
tags question: http://stackoverflow.com/q/23258833
tags question: http://stackoverflow.com/q/23174520
tags question: http://stackoverflow.com/q/23130898
tags question: http://stackoverflow.com/q/23183983
tags question: http://stackoverflow.com/q/23172929
tags question: http://stackoverflow.com/q/23138989
tags question: http://stackoverflow.com/q/23280736
type: Tag
tags question: http://stackoverflow.com/q/23159031
tags question: http://stackoverflow.com/q/23247499
tags question: http://stackoverflow.com/q/23238681
tags question: http://stackoverflow.com/q/23186771
tags question: http://stackoverflow.com/q/23230607
tags question: http://stackoverflow.com/q/23257757
tags question: http://stackoverflow.com/q/23165049
tags question: http://stackoverflow.com/q/23201545
tags question: http://stackoverflow.com/q/23144367
tags question: http://stackoverflow.com/q/23201235
tags question: http://stackoverflow.com/q/23226588
tags question: http://stackoverflow.com/q/23289182
tags question: http://stackoverflow.com/q/23236435
tags question: http://stackoverflow.com/q/23222053
tags question: http://stackoverflow.com/q/23155868
tags question: http://stackoverflow.com/q/23144655
tags question: http://stackoverflow.com/q/23162438
tags question: http://stackoverflow.com/q/23151252
tags question: http://stackoverflow.com/q/23163728
tags question: http://stackoverflow.com/q/23174722
tags question: http://stackoverflow.com/q/23180992
tags question: http://stackoverflow.com/q/23162845
tags question: http://stackoverflow.com/q/23172790
tags question: http://stackoverflow.com/q/23277795
tags question: http://stackoverflow.com/q/23249449

http://stackoverflow.com/comment/43857428
comment on: http://stackoverflow.com/q/23265851
score: 0
has text: According to the Q&A I linked to, the answer is that you can't disable the message.
type: QuestionComment
type: Comment

http://stackoverflow.com/q/23132293
tagged with: cordova
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/23132414
has title: Phonegap with servlets and database connection java files
has answer: http://stackoverflow.com/a/23132414
tagged with: java
has body: I'm testing a phonegap application.. and i need to connect it with my sql database. I use java for my web app backend hence used jdbc controller to connect with my database. My Problem: I am developing the phonegap for iOS and android simultaneously. Obviously the front end of the app doesn't change, because phonegap. But i cant figure out where to put my src folder, which contains my database connectivity files, servlets and other java classes. Question: Will the src folder have to be in the root directory of the project? or does it reside individually inside platforms&gt;iOS and platforms&gt;Android (Completely detached from the question above) Why are there individual www folders platforms&gt;iOS and platforms&gt;Android, when there is one www in the root folder already?
has comment: http://stackoverflow.com/comment/35366398
accepted answer: http://stackoverflow.com/a/23132759
tagged with: servlets
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/35367122
has comment: http://stackoverflow.com/comment/35366961
tagged with: javascript
score: 0
has answer: http://stackoverflow.com/a/23132759

http://stackoverflow.com/q/23197923
tagged with: resultset
tagged with: jdbc
has body: I think I've become code-blind. I'm currently doing a small project with a friend and we're using JDBC to select from a mySQL database. What I want is that after running the select statement, I get some sort of '2D' list of all the data back. I think I want something returned like this - array[columnName][all of the data inside the selected column] Pseudo Code // Count all rows from a column // Count the columns selected // Adds the column names to 'array' for(int i = 1; i &lt;= columnCount; i++) columns.add(resultSetMeta.getColumnName(i)); // Adds the results of the first column to the 'array' // How can I add the results from n columns? for(int i = 1; i &lt;= rowCount; i++ ) { while (resultSet.next()) rows.add(resultSet.getString(i)); } columnsAndRows.put(columns, rows); What is the most appropriate data type to use to 'replicate' a table - ArrayLists, Arrays, or HashMaps? What's the best way of making a ResultSet into a 2D datatype? When iterating through a ResultSet, how can I move to the next column?
accepted answer: http://stackoverflow.com/a/23197976
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: mysql
upvote count: 1
type: Question
has title: Turning a ResultSet into 2DArray/HashMap/Lists of Lists
tagged with: arraylist
has answer: http://stackoverflow.com/a/23197976
has comment: http://stackoverflow.com/comment/35482427
downvote count: 0
answer count: 1
favorite count: 0

http://stackoverflow.com/q/23130898
tagged with: java
has answer: http://stackoverflow.com/a/23135302
score: 4
tagged with: eclipse
tagged with: google-play-services
has comment: http://stackoverflow.com/comment/36688189
has title: Google Play Game Services LibGDX Project Setup with latest BaseGameUtils
answer count: 1
favorite count: 0
tagged with: android
upvote count: 4
has comment: http://stackoverflow.com/comment/41778477
type: AnsweredQuestion
downvote count: 0
has body: It's my first post but I couldn't solve this one on my own or with Google searches. Any insight will be seriously considered and so very appreciated. I am working with the LibGDX framework and My goal is to have working Achievements &amp; Leaderboards via Google Play Game Services and Ads via AdMob. I was able to set up functioning Achievements / Leaderboards using Theinvader360's Google Play Game Services Tutorial. AdMob's early steps calling for a manifest entry gave an error of @integer not being available. The most current version of "google-play-services_lib" fixed this, but revealed that three Classes in BaseGameUtils were depreciated. I then grabbed the latest version of BaseGameUtils Library from the main source. (I'd include more links but I don't have high enough reputation) What's funny with the current version was the structure was different than the last. I improvised and changed the "main" folder's title to "BaseGameUtils" before importing into Eclipse. I then moved the three classes from their "java" folder into "src". This brought up a FragmentActivity error so I created a "libs" folder and dropped in android-support-v4.jar to alleviate this. Currently: -BaseGameUtils has "Is Library" checked and "google-play-services_lib" Added as Reference. -google-play-services_lib has "Is Library" checked. -The android game project is Referencing these two Libraries. I turned to MainActivity to convert things to up-to-date way using this source: https://developers.google.com/games/services/android/init and scrolling down to "Using GameHelper without BaseGameActivity" As is, the application skips it's splash screen and shows a glimpse of the start screen before crashing. Here's the log: 04-17 02:43:28.994: D/dalvikvm(21249): Trying to load lib /data/app-lib/com.crtgames.cavebat-2/libgdx.so 0x424b0c00 04-17 02:43:29.004: D/dalvikvm(21249): Added shared lib /data/app-lib/com.crtgames.cavebat-2/libgdx.so 0x424b0c00 04-17 02:43:29.004: D/dalvikvm(21249): No JNI_OnLoad…
accepted answer: http://stackoverflow.com/a/23135302
type: Question
tagged with: libgdx

http://stackoverflow.com/comment/35400019
comment on: http://stackoverflow.com/q/23150072
type: Comment
type: QuestionComment
has text: The type of key in the data file is Longwritable. But in the index file it is Text. At At run time I cannot change the MapOutputKeyClass.
score: 0

http://stackoverflow.com/a/23291932
score: 0
type: Answer
has body: There are several solutions to this problem in use. I am working on the assumption that these are independent interfaces, that the intention is multiple interface (implementation of two unrelated interfaces on the same object) and that overloading has nothing to do with it. The solutions I am aware of are: 1. Scoping. A reference to foo() can be qualified as A.foo() or B.foo() to determine which is required. 1. Namespaces. The interfaces are inherited inside a namespace constructed for the purpose, and all references to foo() must be preceded by a namespace, eg A::foo(), B::foo(). 1. Aliasing. One or both of the foo() methods are explicitly renamed when inherited. Calls become something like A_foo() and B_foo(). Ada certainly had a mechanism like this, and I think some variants of Pascal did too. I can find more examples if it's important.
answers question: http://stackoverflow.com/q/23256406

http://stackoverflow.com/a/42667690
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/23183931
upvote count: 2
has body: The above suggests is helpful for me! Right click on project -> Properties -> Project Facets, then change the Java facets version to 1.7. If it doesn't work, add the following code to pom.xml: finalName org.apache.maven.plugins maven-compiler-plugin 3.1 1.7 1.7 Save pom.xml. And then, right click on project-->Maven-->Update Project.
type: Answer

runnable
tags question: http://stackoverflow.com/q/23258643
type: Tag
tags question: http://stackoverflow.com/q/23185160
tags question: http://stackoverflow.com/q/23250407
tags question: http://stackoverflow.com/q/23175867
tags question: http://stackoverflow.com/q/23185350
tags question: http://stackoverflow.com/q/23239724
tags question: http://stackoverflow.com/q/23138066
tags question: http://stackoverflow.com/q/23254633
tag name: runnable
tags question: http://stackoverflow.com/q/23267885

http://stackoverflow.com/q/23178915
answer count: 1
downvote count: 0
has title: Java Thread context classloader - how does it work?
linked to: http://stackoverflow.com/q/23174582
has comment: http://stackoverflow.com/comment/35451072
has body: I found the following loaders structure for OSGi in internet. bootstrap classloader (Java standard libraries from jre/lib/rt.jar etc) ^ extension classloader ^ system classloader (ie stuff on $CLASSPATH, OSGi core code) ^ (** limited access to types from parent classloader common OSGi classloader: --|-- OSGi classloader for bundle1 -> (map of imported-package->classloader) --|-- OSGi classloader for bundle2 -> (map of imported-package->classloader) --|-- OSGi classloader for bundle3 -> (map of imported-package->classloader) Here it says that A context classloader set on the executing thread. By default it is always set to System classloader or from the thread from where the new thread instance was created. From structure above we see system loader(=context loader) has higher position and as I know parent classloader never asks its children. So my question please explain how current thread works with classes that are in current bundle?
favorite count: 0
tagged with: osgi
has comment: http://stackoverflow.com/comment/35455380
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23186987
has comment: http://stackoverflow.com/comment/35463594
tagged with: multithreading
upvote count: 1
type: Question
tagged with: jakarta-ee
has comment: http://stackoverflow.com/comment/35451994
has comment: http://stackoverflow.com/comment/35452686
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/23186987

http://stackoverflow.com/a/23181630
score: 2
upvote count: 2
accepted answer of: http://stackoverflow.com/q/23181592
answers question: http://stackoverflow.com/q/23181592
has body: int a = 0; for(Point[] x : grupy) { x[0] = arr[a]; a++; }
has comment: http://stackoverflow.com/comment/35455227
has comment: http://stackoverflow.com/comment/35454945
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/q/23237705
has comment: http://stackoverflow.com/comment/35577923
upvote count: 2
answer count: 2
has answer: http://stackoverflow.com/a/23310458
accepted answer: http://stackoverflow.com/a/23310458
favorite count: 0
has answer: http://stackoverflow.com/a/23239097
has body: I'm looking for a PrimeFaces 4.0 Component to provide little messages like Facebook does in the upper right corner by clicking on the earth symbol. Any idea?
score: 2
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/23239097
tagged with: jsf
downvote count: 0
has comment: http://stackoverflow.com/comment/42205516
tagged with: java
has title: PrimeFaces Component for Facebook-like "Notifications" (little messages in the upper right corner)
type: Question
tagged with: jakarta-ee
tagged with: primefaces

http://stackoverflow.com/q/23177770
has answer: http://stackoverflow.com/a/23177784
accepted answer: http://stackoverflow.com/a/23177784
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23177789
has title: int [] cannot be converted to int
has comment: http://stackoverflow.com/comment/35447584
tagged with: java
has body: I want to use a 2D array for a gradebook method, where it has the student names, then the exam scores. In the class I have as follows. private int numberOfStudents; private String [] studentName; private int examNumber; private int [] examScores; private int [][] gradebook; public ExamAverage () { numberOfStudents = 0; studentName = new String[numberOfStudents]; examNumber = 0; examScores = new int [numberOfStudents]; gradebook = new int [numberOfStudents][examScores]; Yet I get an error int[] cannot be converted to int.
has answer: http://stackoverflow.com/a/23177790
type: Question
tagged with: arrays
score: -1
tagged with: class
possible better answer: http://stackoverflow.com/a/23177789
answer count: 3
downvote count: 1
favorite count: 0
upvote count: 0
has comment: http://stackoverflow.com/comment/35447670

http://stackoverflow.com/q/23214464
type: Question
score: 9
tagged with: mongodb
upvote count: 9
has answer: http://stackoverflow.com/a/23325254
downvote count: 0
has title: Spring mongo adding criteria to and operator dynamicaly
answer count: 1
favorite count: 0
tagged with: spring-mongo
has comment: http://stackoverflow.com/comment/35513510
accepted answer: http://stackoverflow.com/a/23325254
tagged with: spring
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/35512852
has body: I am trying to create dynamic query with user input with and operation My code is I created List of criteria like: List&lt;Criteria&gt; criterias = new ArrayList&lt;Criteria&gt;(); and added criteria to this list.And its getting added successfully. now I want to make and operator between each criteria. Criteria criteria = new Criteria().andOperator(criterias.get(0), criterias.get(1)); It works fine But my input is not fixed so I want it should added dynamically, I tried like for(int i=0;i&lt;criterias.size();i++) Criteria criteria = new Criteria().andOperator(criterias.get(i)); where I am missing?

http://stackoverflow.com/q/23249140
downvote count: 0
has answer: http://stackoverflow.com/a/23250695
has title: How to create XML in Java, by using XSD and JSON or HashMap of elements/values as input
favorite count: 0
answer count: 3
tagged with: xsd
tagged with: http://stackoverflow.com/tag/xml
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/39623818
upvote count: 1
type: Question
has body: I have a requirement for dynamically creating a XML, with given input parameters like XSD file and JSON string (if required JSON message can be converted HashMap object). Java program should associate element name present in JSON string/HashMap object with the element name present in XSD and generate XML accordingly. Also please note that, I will have multiple XSDs out of which one will be passed in as input to the program based on some condition. Input Data: 1) JSON String: --------------- { "employeeInput":{ "name":"someone", "age":"25", "street":"high street", "city":"Amsterdam" } } (or I can convert JSON string to HashMap object and send this object as input) HashMap Object: --------------- {employeeInput={name=someone, age=25, street=high street, city=Amsterdam}} 2) XSD File: ------------ &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://www.XYZOrganization.com/schemas/Request_Handler/Schema.xsd" targetNamespace="http://www.XYZOrganization.com/schemas/Request_Handler/Schema.xsd" elementFormDefault="qualified" attributeFormDefault="unqualified"&gt; &lt;xs:element name="employeeInput"&gt; &lt;xs:complexType&gt; &lt;xs:sequence&gt; &lt;xs:element ref="name"/&gt; &lt;xs:element ref="age"/&gt; &lt;xs:element ref="street"/&gt; &lt;xs:element ref="city"/&gt; &lt;/xs:sequence&gt; &lt;/xs:complexType&gt; &lt;/xs:element&gt; &lt;xs:element name="name" type="xs:string"/&gt; &lt;xs:element name="age" type="xs:string"/&gt; &lt;xs:element name="street" type="xs:string"/&gt; &lt;xs:element name="city" type="xs:string"/&gt; &lt;/xs:schema&gt; Expected Output XML (with namespace and prefix according to XSD): &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;ns0:employeeInput xmlns:ns0="http://www.XYZOrganization.com/schemas/Request_Handler/Schema.xsd"&gt; &lt;ns0:name&gt;someone&lt;/ns0:name&gt; &lt;ns0:age&gt;25&lt;/ns0:age&gt; &lt;ns0:street&gt;high street&lt;/ns0:street&gt; &lt;ns0:city&gt;Amsterdam&lt;/ns0:ci…
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has answer: http://stackoverflow.com/a/60362692
tagged with: jaxb

http://stackoverflow.com/q/23188228
has body: How can I take the information stored in a HashMap&lt;Integer, ArrayList&lt;Integer&gt;&gt; and create unique arrays of values. I do not need them in reverse order or any other ordering. For example, assuming I have: Key Value --- --------- 1 {1, 2, 3} 2 {10, 11} 3 {29} How can I turn this into the following: {1, 10, 29} {1, 11, 29} {2, 10, 29} {2, 11, 29} {3, 10, 29} {3, 11, 29} Ive tried a variety of loops. I also pondered tail end recursion however it still has me stumped. I would appreciate your guidance so I may solve this. What my goal is: The key value is the primary key for an attribute. Each attribute has options which are contained in the value. I would like to restructure the information so it fits the format shown.
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/35466017
favorite count: 0
has comment: http://stackoverflow.com/comment/35466068
duplicate of: http://stackoverflow.com/q/714108
type: UnansweredQuestion
has title: Convert HashMap of integers into unique integer array?
answer count: 0
has comment: http://stackoverflow.com/comment/35486823
tagged with: java
linked to: http://stackoverflow.com/q/714108
type: Question
has comment: http://stackoverflow.com/comment/35466102
tagged with: hashmap
score: 0
has comment: http://stackoverflow.com/comment/35466035

http://stackoverflow.com/q/23230600
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35541794
has answer: http://stackoverflow.com/a/23230968
has title: Trying to create an android app from a book and getting NullPointerException error at function setStartUpScreenText() on line 2
tagged with: java
tagged with: eclipse
type: Question
has body: Here is my MainActivity.java code. package chapter.two.hello_world; 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.widget.TextView; import android.os.Build; public class MainActivity extends ActionBarActivity { WorldGen earth = new WorldGen("Earth", 5973, 9.78); @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(); } setContentView(R.layout.fragment_main); setStartUpWorldValues(); setStartUpScreenText(); } protected void setStartUpWorldValues(){ earth.setPlanetColonies(1); earth.setPlanetMilitary(1); earth.setColonyImmigration(1000); earth.setBaseProtection(100); earth.turnForceFieldOn(); } private void setStartUpScreenText(){ TextView planetNameValue = (TextView)findViewById(R.id.dataView1); planetNameValue.setText(earth.planetName); /* TextView planetMassValue = (TextView)findViewById(R.id.dataView2); planetMassValue.setText(String.valueOf(earth.planetMass)); TextView planetGravityValue = (TextView)findViewById(R.id.dataView3); planetGravityValue.setText(String.valueOf(earth.planetGravity)); TextView planetColoniesValue = (TextView)findViewById(R.id.dataView4); planetColoniesValue.setText(String.valueOf(earth.planetColonies)); TextView planetPopulationValue = (TextView)findViewById(R.id.dataView5); planetPopulationValue.setText(String.valueOf(earth.planetPopulation)); TextView planetMilitaryValue = (TextView)findViewById(R.id.dataView6); planetMilitaryValue.setText(String.valueOf(earth.planetMilitary)); TextView planetBasesValue = (TextView)findViewById(R.id.dataView7); plane…
answer count: 1
has comment: http://stackoverflow.com/comment/35541775
score: 0
tagged with: android
has comment: http://stackoverflow.com/comment/35541917
has comment: http://stackoverflow.com/comment/35541754
has comment: http://stackoverflow.com/comment/35541815

http://stackoverflow.com/q/23231962
has body: I’m experiencing troubles making the GoogleMaps API work in my app. When I open my app either on the emulator or on my Galaxy S4, the maps appears blank with only the grey grid showing. When I run the app in the emulator I get an error in the eclipse console: “Server returned: 3” thanks //activity_map.xml &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;com.google.android.maps.MapView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/mapView" android:layout_gravity="bottom" android:layout_width="fill_parent" android:layout_height="fill_parent" android:apiKey="APIKEY" android:clickable="true" /&gt; // GoogleActivtiy.java package com.example.thetest; import android.os.Bundle; import com.google.android.maps.MapActivity; public class GoogleMapActivity extends MapActivity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_map); } @Override protected boolean isRouteDisplayed() { return true; } } //logcat 04-22 18:33:48.410: W/System.err(872): java.io.IOException: Server returned: 3 04-22 18:33:48.420: W/System.err(872): at android_maps_conflict_avoidance.com.google.googlenav.map.BaseTileRequest.readResponseData(BaseTileRequest.java:115) 04-22 18:33:48.420: W/System.err(872): at android_maps_conflict_avoidance.com.google.googlenav.map.MapService$MapTileRequest.readResponseData(MapService.java:1473) 04-22 18:33:48.420: W/System.err(872): at android_maps_conflict_avoidance.com.google.googlenav.datarequest.DataRequestDispatcher.processDataRequest(DataRequestDispatcher.java:1117) 04-22 18:33:48.420: W/System.err(872): at android_maps_conflict_avoidance.com.google.googlenav.datarequest.DataRequestDispatcher.serviceRequests(DataRequestDispatcher.java:994) 04-22 18:33:48.420: W/System.err(872): at android_maps_conflict_avoidance.com.google.googlenav.datarequest.DataRequestDispatcher$DispatcherServer.run(DataRequestDispatcher.java:1702) 04-22 18:33:48.420: W/System.err(872): a…
has title: GoogleMaps API error
tagged with: android-mapview
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/35544149
linked to: http://stackoverflow.com/q/19094787
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23241511
linked to: http://stackoverflow.com/q/21007987
tagged with: android
has answer: http://stackoverflow.com/a/23241103
tagged with: java
tagged with: eclipse
has comment: http://stackoverflow.com/comment/35560613
type: Question
tagged with: google-maps

http://stackoverflow.com/comment/35400897
has text: If you use Java 7 you could use `Path` instead; it has more facilities to do what you want.
type: Comment
comment on: http://stackoverflow.com/q/23150864
score: 0
type: QuestionComment

http://stackoverflow.com/comment/35416750
comment on: http://stackoverflow.com/a/23148576
type: Comment
has text: bro, all this stuff's working except this new thing. If you can help me please. http://stackoverflow.com/questions/23153583/on-add-previous-element-getting-replaced-in-arraylist
score: 0
type: AnswerComment

http://stackoverflow.com/comment/35621882
type: Comment
type: QuestionComment
has text: How about wrapping your file finding code in a `try/catch` block?
comment on: http://stackoverflow.com/q/23274717
score: 0

http://stackoverflow.com/comment/35521997
has text: In Spring MVC it's `@PathVariable`, not `@PathParam`.
type: AnswerComment
comment on: http://stackoverflow.com/a/23219506
type: Comment
score: 2

http://stackoverflow.com/a/23172981
type: Answer
has body: It seems you built your views inside fragment_main.xml and not activity_main.xml. When you first create a new android project, you have these files which are automatically created and opened: Then, when you begin, you add views (e.g: a TextView) inside fragment_main.xml file. Whereas you tried to do a basically event with this view inside your Activity, something like this: public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // Using layout activity_main.xml // You try to set a simple text on the view (TextView) previously added TextView text = (TextView) findViewById(R.id.textView1); text.setText("Simple Text"); // And you get an error here! /* * You do an fragment transaction to add PlaceholderFragment Fragment * on screen - this below snippnet is automatically created. */ if(savedInstanceState == null) { getSupportFragmentManager().beginTransaction() .add(R.id.container, new PlaceholderFragment()).commit(); } } You cannot run your app or sometimes you have only a white screen, because the views that you tried to call/display are into the wrong layout.. Solution: Move all your stuff inside onCreateView method into the Fragment class. Call views and do something in the related fragment and not the parent activity. For example, for your case: public static class PlaceholderFragment extends Fragment { int counter; Button add, sub; TextView display; public PlaceholderFragment() { } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_main, container, false); counter = 0; // Don't forget to attach your view to the inflated view as "rootView.findViewById()" add = (Button) rootView.findViewById(R.id.bAdd); sub = (Button) rootView.findViewById(R.id.bSub); display = (TextView) rootView.findViewById(R.id.textDisp); add.setOnClickListener(…
upvote count: 3
score: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/35439272
answers question: http://stackoverflow.com/q/23172934

http://stackoverflow.com/comment/35397041
type: Comment
has text: Why? Will the WEB-INF folder do?
type: AnswerComment
comment on: http://stackoverflow.com/a/23148088
score: 0

http://stackoverflow.com/a/42170003
answers question: http://stackoverflow.com/q/23219644
downvote count: 0
has comment: http://stackoverflow.com/comment/132707066
has body: We'll be copying all data. Remember that this is why string concatenation is expensive! public static ByteBuffer concat(final ByteBuffer... buffers) { final ByteBuffer combined = ByteBuffer.allocate(Arrays.stream(buffers).mapToInt(Buffer::remaining).sum()); Arrays.stream(buffers).forEach(b -&gt; combined.put(b.duplicate())); return combined; }
type: Answer
score: 4
has comment: http://stackoverflow.com/comment/132677401
upvote count: 4

http://stackoverflow.com/comment/35553156
type: Comment
type: QuestionComment
has text: where is ojdbc.jar and which version ojdbc jar you are using?
comment on: http://stackoverflow.com/q/23236592
score: 0

http://stackoverflow.com/comment/35459135
has text: Have you checked the input into the function? (Print out i)
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23184496
score: 0

http://stackoverflow.com/comment/35371654
has text: This is a platform specific implementation, and if you search the bug database, you'll see a number of complaints about it that are still open. Example: http://bugs.java.com/bugdatabase/view_bug.do?bug_id=4834514 It also doesn't seem to be too high on their priority list either.
comment on: http://stackoverflow.com/q/23134267
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23135715
has comment: http://stackoverflow.com/comment/35373788
score: 0
has comment: http://stackoverflow.com/comment/35373040
has comment: http://stackoverflow.com/comment/35373361
answers question: http://stackoverflow.com/q/23135525
has body: Did you remember to add a beans.xml to src/main/resources/META-INF in the other module? --UPDATE-- It doesn't actually have to contain any beans. Should pick up an empty one: <?xml version="1.0" encoding="UTF-8"?>
has comment: http://stackoverflow.com/comment/35373005
has comment: http://stackoverflow.com/comment/35373079
has comment: http://stackoverflow.com/comment/35373896
type: Answer
has comment: http://stackoverflow.com/comment/35374340
has comment: http://stackoverflow.com/comment/35372791
has comment: http://stackoverflow.com/comment/35372969

http://stackoverflow.com/comment/35444878
comment on: http://stackoverflow.com/q/23175805
score: 0
has text: I don't suppose you want to write a short test program to find out.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23459318
downvote count: 0
score: 1
upvote count: 1
has body: A pro will be that Jade is a multi-agent system, and follows the FIPA rules, which are a protocol that allow to comunicate different agents
answers question: http://stackoverflow.com/q/23188377
type: Answer

http://stackoverflow.com/a/23141688
has comment: http://stackoverflow.com/comment/35385749
has comment: http://stackoverflow.com/comment/35393900
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/35384966
type: Answer
upvote count: 1
has body: There is some thing simple and can solve your problem. You can use an interceptor, it doesn't require any external module. Code: public class LoginInterceptor extends HandlerInterceptorAdapter { public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { String requestUri = request.getRequestURI(); //Only check on several pages not all //Check if user is requesting the two JSP pages if (requestUri.startsWith(...)) { //Yes, user is requesting the two JSP if(/*Check if ip address is on the list*/) { //Yes, it is. if (/*check sth else maybe?*/) { //test passes return true; } else { //test fails. response.sendRedirect(request.getContextPath() + "error_1"; return false; } } else { //oops, not on the list, redirect to error url response.sendRedirect(request.getContextPath() + "error_2"; return false; } } else { //no need to check, just grant access return true; } } } Config is also simple: &lt;mvc:interceptors&gt; &lt;bean id="loginInterceptor" class="....LoginInterceptor" /&gt; &lt;/mvc:interceptors&gt; Now, assume the user's ip address is not on the list, he or she is redirected to error page url (say abc.com/error_denied). Here, I assume you don't have a controller mapped to that url, then &lt;mvc:view-controller path="/error_denied" view-name="error.jsp"/&gt; will do the job :)
has comment: http://stackoverflow.com/comment/35393807
has comment: http://stackoverflow.com/comment/35384706
has comment: http://stackoverflow.com/comment/35384440
has comment: http://stackoverflow.com/comment/35386477
score: 1
has comment: http://stackoverflow.com/comment/35389004
has comment: http://stackoverflow.com/comment/35393850
answers question: http://stackoverflow.com/q/23141205
has comment: http://stackoverflow.com/comment/35393787
has comment: http://stackoverflow.com/comment/35384409
has comment: http://stackoverflow.com/comment/35384885
has comment: http://stackoverflow.com/comment/35384822
accepted answer of: http://stackoverflow.com/q/23141205

http://stackoverflow.com/q/23159715
has comment: http://stackoverflow.com/comment/35416912
has comment: http://stackoverflow.com/comment/35416424
type: UnansweredQuestion
answer count: 0
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/35416830
has comment: http://stackoverflow.com/comment/35415809
has comment: http://stackoverflow.com/comment/35416695
has title: Hibernate query get data in range of dates
type: Question
has comment: http://stackoverflow.com/comment/35415786
has comment: http://stackoverflow.com/comment/35419176
has body: I have the following query to get data within a range of dates and then order by the date: Calendar cal = new GregorianCalendar(); cal.set(2014, 0, 1, 0, 0, 0); Date b = cal.getTime(); cal.set(2014, 0, 7, 0, 0, 0); Date e = cal.getTime(); String theQuery = "SELECT DISTINCT f FROM stuff f, IN(f.sess) as s WHERE s.time &lt; :end AND s.time &gt; :begin ORDER BY s.time"; Query query = em.createQuery(theQuery).query.setParameter("begin", b).setParameter("end", e); I expect data like: a | 2014-1-0 0:0:0:0 b | 2014-1-1 0:0:0:0 c | 2014-1-2 0:0:0:0 d | 2014-1-3 0:0:0:0 and so on, but i get data in a seemingly random order and not inside the date range specified. Does anyone have an idea of what I could be doing incorrectly?
score: 0
has comment: http://stackoverflow.com/comment/35417351
tagged with: sql

http://stackoverflow.com/q/23178289
accepted answer: http://stackoverflow.com/a/23506336
upvote count: 1
downvote count: 1
type: AnsweredQuestion
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/36050372
answer count: 2
has comment: http://stackoverflow.com/comment/35448573
has comment: http://stackoverflow.com/comment/35448556
has title: Java Read in Line by Line from Big File \n ONLY
has answer: http://stackoverflow.com/a/23506336
has comment: http://stackoverflow.com/comment/35448540
score: 0
has answer: http://stackoverflow.com/a/23178447
has comment: http://stackoverflow.com/comment/35448581
favorite count: 0
linked to: http://stackoverflow.com/q/5868369
possible better answer: http://stackoverflow.com/a/23178447
has body: I have a file that records terminated by "\n" and columns terminated by X"01", the first non printing character. And it is big... 7GB which will totally screw my laptop memory. I have done some google around how to read big file line by line by using BufferReader.. etc. But the definition of LINE is a bit different, the readline function will return the line that either ends with "\n", "^M" ..etc. I am wondering is there a solution in Java 6/7 to read big files line by line, whose definition is the line end with \n ONLY. Thanks! I have a sample data set here and wondering if some one who could run against the sample data and extract the first column timestamp of every line. here is what I have done but it only reads in the first line, import java.io.File; import java.io.IOException; import java.util.Scanner; public class ParseAdafruit { public static void main(String[] args) throws IOException { // Predefine the delimiter ^A String delimiter = String.valueOf((char) 1); Scanner scanner = new Scanner(new File("/Users/.../data")).useDelimiter("\\n"); while (scanner.hasNext()) { String line = scanner.next(); // This is your line String[] parts = line.split(delimiter); System.out.println(parts[0]); } } } Output 2014-01-28 18:00:41.960205 btw, I had such a good time in Python by using something like this: for line in sys.stdin: print line.split(chr(1))[0]

http://stackoverflow.com/a/23288225
answers question: http://stackoverflow.com/q/23287914
has body: Assuming MyTable is much bigger than literal values, I think the best option is using a temporary table to store your values. This way your query is a lot cleaner. If you are working in a concurrent environment (e.g. typical web app), use an id field, and delete when finished. Summarizing: preliminary: create a table for temporary values TEMPTABLE(id, value) for each transaction get new unique/atomic id (new oracle sequence value, for example) for each literal value: insert into temptable(new_id, value) select * from temptable where id = new_id minus... process result delete from temp_table where id = new_id Temporary tables are a good solution in oracle. This one can be used with an ORM persistence layer
score: 0
type: Answer

http://stackoverflow.com/q/23161367
type: AnsweredQuestion
score: 1
tagged with: java
has title: Java - private inner class public member
tagged with: class
answer count: 2
downvote count: 0
tagged with: nested
has answer: http://stackoverflow.com/a/23161510
has body: how does the access level modifier change the behavior of a member inside an inner private class? I have this code class Main { private static class Inner { private static int a = 1; } public static void main(String[] args) { System.out.print(Inner.a); } } I can access the attribute "a" from the outer class either it's access level is public or private (and this is already weird for me). The question is: if the attribute were "public static int", what were the difference (considering that the Inner class is private so inaccessible from the extern of the "Main" class)? To recap The attribute is private: I can access it from Main but not from outside Main (because Inner is private) The attribute is public: I can still access it from Main but not from outside Main (because Inner is private) I can see no difference
favorite count: 0
tagged with: private
has comment: http://stackoverflow.com/comment/35419433
possible better answer: http://stackoverflow.com/a/23161813
tagged with: member
has answer: http://stackoverflow.com/a/23161813
accepted answer: http://stackoverflow.com/a/23161510
upvote count: 1
type: Question

http://stackoverflow.com/a/23245388
has body: As you mentioned, you can ignore all 404s or you can ignore the entire transaction but you can't ignore errors on the fly with the Java agent API. Probably the best compromise would be to ignore the error in question through configuration, but then in your application's logic use the API call NewRelic.NoticeError to capture the errors that you want to contribute to your error rate. In other words, use NoticeError for the errors you don't want to ignore.
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 1
accepted answer of: http://stackoverflow.com/q/23237945
upvote count: 1
answers question: http://stackoverflow.com/q/23237945

http://stackoverflow.com/comment/35580819
score: 0
type: AnswerComment
has text: I have already found it, but if I am right it is not free. Further I don't have access to the EXPRESS files.
type: Comment
comment on: http://stackoverflow.com/a/23248554

http://stackoverflow.com/q/23246821
type: Question
has comment: http://stackoverflow.com/comment/35571152
score: 0
answer count: 3
has title: Why does the following inherited method is using super class member
has body: Excuse me for my ignorance. The following code outputs A1 has name A1 B1 has name A1 But I am expecting A1 has name A1 B1 has name B1 as String name is redefined in the sub-class. Can anyone explain? Code Snippet: public class Client { public static void main(String[] args) { A1 a = new A1(); A1 b = new B1(); System.out.println(a.greeting() + " has name " + a.getName()); System.out.println(b.greeting() + " has name " + b.getName()); } } class A1 { String name = "A1"; String getName() { return name; } String greeting() { return "class A1"; } } class B1 extends A1 { String name = "B1"; String greeting() { return "class B1"; } }
has answer: http://stackoverflow.com/a/23246975
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35571703
tagged with: java
has comment: http://stackoverflow.com/comment/35570590
has answer: http://stackoverflow.com/a/23246963
linked to: http://stackoverflow.com/q/685300
has answer: http://stackoverflow.com/a/23246950

http://stackoverflow.com/comment/35588459
comment on: http://stackoverflow.com/q/23256423
type: Comment
type: QuestionComment
has text: The question as it formulated now accepts opinion-based answers, which is not preferred way to go at SO. Try to restate it somehow like "what is the best way to detect changes on webpage? [definition of changes] [restrictions about webpage] - whether ETag is available for example, can we rely on 302 Not Modified, etc.
score: 1

http://stackoverflow.com/q/23198492
type: Question
downvote count: 2
has comment: http://stackoverflow.com/comment/35483717
score: -2
answer count: 1
tagged with: string
favorite count: 0
has comment: http://stackoverflow.com/comment/35483464
accepted answer: http://stackoverflow.com/a/23200094
has comment: http://stackoverflow.com/comment/35483601
has comment: http://stackoverflow.com/comment/35486130
has answer: http://stackoverflow.com/a/23200094
upvote count: 0
has comment: http://stackoverflow.com/comment/35483333
has comment: http://stackoverflow.com/comment/35485328
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35489302
tagged with: java
has title: incompatible types error when providing a String to a method which requires a String
has body: i am trying to pass a String value into a method which accepts Strings, however i am getting the error "incompatible types". i have tried hard coding a int value to see what error it gives which i expected it to: found int; required: java.lang.String. changed the method to accept File instead which errors: found String; required: java.io.File. ergo, i am feeding a string where a string should be. but i don't understand where i am going wrong. (and i have changed it back to feed String and accept String) any feedback is welcome. thanks in advance :) import java.io.*; import java.util.*; public class Test { private ArgsReader inputFile; private String filename; private List&lt;Pallet&gt; entryBayQueue; /** * Constructor for objects of class Test */ public Test() { inputFile = new ArgsReader(); entryBayQueue = new LinkedList(); } /** * methods */ public void run(String[] args) { if(args.length &gt; 0) //launched if you gave an argument { String line; filename = args[0]; System.out.println(filename.getClass().getSimpleName()); //outputs string line = inputFile.stringFileReader(filename); //call method containing reading capability to read and store contents in line // ******* here is where the error occurs //System.out.println(line); //line = null here StringTokenizer st = new StringTokenizer(line);//tokenize line's contents while(st.hasMoreTokens()) { System.out.println(st.nextToken()); int serialNum = 0; switch(st.nextToken()) { case "A": { serialNum++; Pallet almondPallet = new Pallet(1,serialNum); //create new almond pellet and assign serial number entryBayQueue.add(almondPallet); //adds pallet to the end of the list break; } } } } else //launched when you didn't provide an argument { filename = null; Console console = System.console(); filename = console.readLine("file to read from: "); inputFile.stringFileReader(filename); //call method containing reading capability } } } // ******this is the implementation of stringFileReader public void stringFileReader(String f…

http://stackoverflow.com/a/23263503
has comment: http://stackoverflow.com/comment/35604812
has comment: http://stackoverflow.com/comment/35602632
has comment: http://stackoverflow.com/comment/35601869
has comment: http://stackoverflow.com/comment/35603072
has comment: http://stackoverflow.com/comment/35601835
has comment: http://stackoverflow.com/comment/35601801
has comment: http://stackoverflow.com/comment/35601173
has comment: http://stackoverflow.com/comment/35603041
has comment: http://stackoverflow.com/comment/35604237
has comment: http://stackoverflow.com/comment/35602306
has comment: http://stackoverflow.com/comment/35601192
has comment: http://stackoverflow.com/comment/35604548
has comment: http://stackoverflow.com/comment/35601262
score: 0
has comment: http://stackoverflow.com/comment/35602432
type: Answer
has comment: http://stackoverflow.com/comment/35601545
has comment: http://stackoverflow.com/comment/35602489
has comment: http://stackoverflow.com/comment/35602910
has comment: http://stackoverflow.com/comment/35601851
has comment: http://stackoverflow.com/comment/35603211
has comment: http://stackoverflow.com/comment/35604008
has comment: http://stackoverflow.com/comment/35601153
has comment: http://stackoverflow.com/comment/35603136
has comment: http://stackoverflow.com/comment/35602013
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/35602643
has comment: http://stackoverflow.com/comment/35602240
has comment: http://stackoverflow.com/comment/35601456
has comment: http://stackoverflow.com/comment/35605792
has body: Ive quickly put this together. Using this function you can create a byte array which has all packet information in the correct place. I used some of the sample info from the question. That should be enough to send the info across the connection. you can pass the byte array directly into your datagram public class Sample { public static void main(String[] args){ byte[] packet = createMsg("\r\n*KW\0", (short)15, (short)82, '1', "\r\n"); for(byte b : packet){ System.out.println(b); } } public static byte[] createMsg(String sMark, short packetle, short cmd, char cErrorCode, String sEnd){ byte[] buffer = new byte[13]; char[] sMarkArr = sMark.toCharArray(); char[] sEndArr = sEnd.toCharArray(); // sMark buffer[0] = (byte) sMarkArr[0]; buffer[1] = (byte) sMarkArr[1]; buffer[2] = (byte) sMarkArr[2]; buffer[3] = (byte) sMarkArr[3]; buffer[4] = (byte) sMarkArr[4]; buffer[5] = (byte) sMarkArr[5]; // packetle buffer[6] = (byte)(packetle &amp; 0xFF); buffer[7] = (byte)((packetle &gt;&gt; 8) &amp; 0xFF); // cmd buffer[8] = (byte)(cmd &amp; 0xFF); buffer[9] = (byte)((cmd &gt;&gt; 8) &amp; 0xFF); // cErrorCode buffer[10] = (byte)(cErrorCode); // sEnd buffer[11] = (byte)sEndArr[0]; buffer[12] = (byte)sEndArr[1]; return buffer; } } Remember when doing comms in java, the datatypes sizes and format aren't always the same as some other languages. Check out http://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html to get each of the sizes Hope this helps EDIT: Packet is 13 * 8 = 104 bits = 000000000000000000000000000000000000... calling buffer[0] = (byte)sMark adds the char (e.g. A) Packet is 13 * 8 = 104 bits = 001000001000000000000000000000000000... calling buffer[6] = (byte)packetle adds the char (e.g. 2) Packet is 13 * 8 = 104 bits = [ Char 6 bytes ][Short 1 byte] [010000010000000000000000000000000000000000000000][00000010]... NOTE: as you are using bytes for chars you will need to add an extra byte, as java chars are 16-bit, otherwise you may get loss of data
has comment: http://stackoverflow.com/comment/35602856
answers question: http://stackoverflow.com/q/23262925

http://stackoverflow.com/a/27190297
upvote count: 2
has body: I had a similar problem, solved by removing this line: @OneToMany(cascade = CascadeType.ALL, orphanRemoval = true) before the @ElementCollection that was not copied.
answers question: http://stackoverflow.com/q/23175199
downvote count: 0
type: Answer
score: 2

http://stackoverflow.com/comment/35639276
comment on: http://stackoverflow.com/a/23241160
type: AnswerComment
score: 0
type: Comment
has text: create another boolean value to check that the input is correct. and put have the user enter it inside a nested while loop. the only way to get out of that nested loop is to use valid input otherwise it'll notify the user that the input is invalid and will list all possible valid inputs.

http://stackoverflow.com/q/23242176
type: Question
score: 0
tagged with: jpa
has body: I am using JPA framework in my application. In particular time, I am getting IllegalMonitorStateException exception frequently when I click on any link which make call to the JPA operations. Error logs are : java.lang.IllegalMonitorStateException at java.util.Vector.isEmpty(Vector.java:500) at org.eclipse.persistence.internal.jpa.querydef.FromImpl.findJoins(FromImpl.java:567) at org.eclipse.persistence.internal.jpa.querydef.AbstractQueryImpl.findJoins(AbstractQueryImpl.java:318) at org.eclipse.persistence.internal.jpa.querydef.CriteriaQueryImpl.translate(CriteriaQueryImpl.java:710) at org.eclipse.persistence.internal.jpa.EntityManagerImpl.createQuery(EntityManagerImpl.java:1412) at com.abco.revenuecycle.persistence.ResultListProcess.getTypedQuery(ResultListProcess.java:62) I caught this Exception in a catch block and called entityManager.close(). When I again click on the link, create the new workunit object. sample code is here : To handle exceptions: catch(IllegalMonitorStateException ime){ FactoryHolder factoryHolder = factoryMap.get(schema); WorkUnit workUnit = factoryHolder.workUnitLocal.get(); if (null != workUnit) { workUnit.close(); workUnit = null; } factoryHolder.workUnitLocal.set(null); } To create new object : synchronized (lock) { FactoryHolder factoryHolder = factoryMap.get(schema); workUnit = factoryHolder.workUnitLocal.get(); //check if entity manager is open if (null == workUnit || !workUnit.isOpen()) { return createWorkUnit(schema); } } Please provide a solution to avoid this Exception. Thanks in advance.
has comment: http://stackoverflow.com/comment/35565019
type: UnansweredQuestion
has title: Getting java.lang.IllegalMonitorStateException exception during JPA operation
has comment: http://stackoverflow.com/comment/35565589
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/35562503

http://stackoverflow.com/q/23158871
has comment: http://stackoverflow.com/comment/35413970
has comment: http://stackoverflow.com/comment/35413993
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/35414201
favorite count: 0
has answer: http://stackoverflow.com/a/23158966
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35414066
has answer: http://stackoverflow.com/a/23159014
has comment: http://stackoverflow.com/comment/35414057
has comment: http://stackoverflow.com/comment/35414023
has body: I am trying to do a program, and this is what i have so far: import java.util.Scanner; import java.io.*; public class WebberProject1 { public static void main(String[] args) throws IOException { Scanner scanner = new Scanner(new File("portlandvip.txt")); (scanner.hasNext()) { String firstName = scanner.next(); String lastName = scanner.next(); System.out.println(" " + firstName + " " + lastName); } } } The output of this program looks like this: Loras Tyrell 5 Club Margaery Tyrell 8 Box Roslin Frey 2 Box Sansa Stark 2 Club Jon Snow and the file looks like this: Loras Tyrell 5 Club Margaery Tyrell 8 Box Roslin Frey 2 Box Sansa Stark 2 Club Jon Snow 5 Club Edmure Tully 3 Box Joffrey Baratheon 20 Court Stannis Baratheon 4 Club Jaime Lannister 2 Box Cersei Lannister 1 Court Beric Dondarrion 8 Court Balon Greyjoy 16 Box Olenna Tyrell 4 Court Mace Tyrell 5 Box Tyrion Lannister 2 Club Sandor Clegane 2 Court Gregor Clegane 6 Club Samwell Tarly 3 Club Petyr Baelish 6 Court My question is, how do you remove the "5 club", "8 box", etc parts from the program's output?
has title: How to manipulate the print statements from files?
tagged with: file
upvote count: 1
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/35413952
tagged with: java

http://stackoverflow.com/q/23256711
score: 1
tagged with: java
tagged with: derby
has body: Currently I have a DerbyDB and a UI with a JTable on it. Now I also I have a bunch of classes but the ones I need help with is SensorDBConnection and myUI. myUI is where have my JTable, and what I want to do is update my JTable from my query which is located on my SensorDBConnection The following is a snippet from my SensorDBConnection which works because it is doing System.outs DefaultTableModel model;//Confused model = new DefaultTableModel(); //Confused jTable1 = new JTable(model);//Confused model.addColumn("TIME"); model.addColumn("SENSORID"); model.addColumn("TEMP"); model.addColumn("HUM"); model.addColumn("LIGHT"); model.addColumn("VOLTAGE"); while(results.next()) { time = results.getInt(1); id = results.getInt(2); temp = results.getInt(3); hum = results.getInt(4); light = results.getInt(5); voltage = results.getInt(6); model.addRow(new Object[]{time,id,temp,hum,light,voltage}); Sensor sens = new Sensor(id, temp, hum, light, voltage); sensors.add(sens); //System.out.println(sens); } results.close(); stmt.close(); So essentially what I am doing right now is querying my data, and then trying to Push it to my JTabel located on my other class, and I don't know how to create the link between them..
tagged with: jtable
answer count: 3
upvote count: 1
possible better answer: http://stackoverflow.com/a/23257249
tagged with: user-interface
downvote count: 0
has answer: http://stackoverflow.com/a/23257932
favorite count: 0
has answer: http://stackoverflow.com/a/23257845
accepted answer: http://stackoverflow.com/a/23257845
has title: Updating a JTable from query
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23257249
tagged with: swing
type: Question

http://stackoverflow.com/comment/35378672
type: QuestionComment
has text: No, it won't work, because OGNL expressions are evaluated only in struts tags' attributes. But you might try JSP EL.
comment on: http://stackoverflow.com/q/23138631
score: 0
type: Comment

http://stackoverflow.com/comment/35517905
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23217684
has text: The issue is to store `EmployeeHistory` with collection of `Record` inside. I need to assemble complex object which consist result of joins.
score: 0

http://stackoverflow.com/comment/35458389
type: Comment
comment on: http://stackoverflow.com/a/23183912
score: 0
type: AnswerComment
has text: But if you have an additional detail view you would create an additional `Activity`. The rule is if you go deeper inside the hierarchy you use need another `Activity` if you stay on the same level you need another `Fragment`.

jakarta-mail
tags question: http://stackoverflow.com/q/23252140
tags question: http://stackoverflow.com/q/23287769
tags question: http://stackoverflow.com/q/23192070
tags question: http://stackoverflow.com/q/23207430
tags question: http://stackoverflow.com/q/23145970
tags question: http://stackoverflow.com/q/23191572
tags question: http://stackoverflow.com/q/23206844
tags question: http://stackoverflow.com/q/23197016
tags question: http://stackoverflow.com/q/23195562
tag name: jakarta-mail
tags question: http://stackoverflow.com/q/23165990
type: Tag
tags question: http://stackoverflow.com/q/23263963
tags question: http://stackoverflow.com/q/23132692
tags question: http://stackoverflow.com/q/23273510
tags question: http://stackoverflow.com/q/23148927
tags question: http://stackoverflow.com/q/23213975
tags question: http://stackoverflow.com/q/23286244
tags question: http://stackoverflow.com/q/23260313
tags question: http://stackoverflow.com/q/23242934

http://stackoverflow.com/q/23141968
has comment: http://stackoverflow.com/comment/35384703
has comment: http://stackoverflow.com/comment/35384750
has comment: http://stackoverflow.com/comment/35384775
possible better answer: http://stackoverflow.com/a/23142175
answer count: 2
has answer: http://stackoverflow.com/a/23142175
upvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/23142044
has title: How to move using angles
has comment: http://stackoverflow.com/comment/35384730
score: -3
type: AnsweredQuestion
tagged with: java
downvote count: 3
has body: I was wondering of how you would move something on a JFrame using angles such as player.move(23); would move the player at an angle of 23. Any help is appreciated, Thanks!!!
type: Question
has comment: http://stackoverflow.com/comment/35384743
has answer: http://stackoverflow.com/a/23142044

http://stackoverflow.com/comment/35633583
type: QuestionComment
comment on: http://stackoverflow.com/q/23280409
has text: @MattJohnson I used to think EST was unique for a long time. In general you only hear about the ones used locally and *everyone* knows what you mean when you are in a particular country. However, computers are more pedantic.
score: 0
type: Comment

http://stackoverflow.com/q/23137604
has title: Java list items
tagged with: list
upvote count: 5
tagged with: java
accepted answer: http://stackoverflow.com/a/23137644
has body: Im using the following code List&lt;String&gt; text = new ArrayList&lt;String&gt;(); text.add("Hello"); So that list will only accept Strings to be added, how can I add into one list more types of variables like ints and strings together like Adding into the text list some rectangle values like rectangle name, rectangle width, rectangle height So later I can access them in a loop
answer count: 4
downvote count: 0
has answer: http://stackoverflow.com/a/23137935
has answer: http://stackoverflow.com/a/23138103
has comment: http://stackoverflow.com/comment/35376632
type: Question
type: AnsweredQuestion
favorite count: 0
has answer: http://stackoverflow.com/a/23137644
possible better answer: http://stackoverflow.com/a/23137845
score: 5
has answer: http://stackoverflow.com/a/23137845

http://stackoverflow.com/comment/35650013
comment on: http://stackoverflow.com/a/23289011
score: 0
type: AnswerComment
type: Comment
has text: How are you getting session Hibernate 4, hibernate 4 works in this way Session session = sf.withOptions() .interceptor(new AuditInterceptor()) .openSession();

http://stackoverflow.com/q/23192199
has body: I would like to ask if its possible to put text files into my jar, I use them to make my map in my game, but users can get Highscores. now I want to save the Highscores with the map, so I have to save the map on the user their PC. Is there any way how I could do this? I've searched the internet for some ideas but I could not find anything that even came close to what I've wanted. I only had 3/4th of a year java so I don't know much about these things, everything that happens outside the debug of eclipse are problems for me(files are mainly one of those things, null exceptions, etc). The main question now. Is it possible to do? If yes, do you have any terms I could search on, or some sites/guides/tutorials? If no, is there any other way how I could save the highscores? EDIT: to make clear Can I get the text file (the text inside the file) to be extracted to a different file in like the home directory of my game (where I save the settings and stuff) the basic maps are inside the jar file, so I want them to be extracted on the first start-up of the program Greetings Carolien
upvote count: 1
answer count: 1
tagged with: jar
favorite count: 0
has answer: http://stackoverflow.com/a/23193095
accepted answer: http://stackoverflow.com/a/23193095
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35473750
downvote count: 0
has title: Extracting files from res folder in Executable JAR (txt files to be specific)
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/35473549
type: Question
tagged with: eclipse

http://stackoverflow.com/comment/35529722
score: 0
has text: I'm not sure anything's wrong with your code, but the DISTINCT keyword is still experimental as mentioned in the documentation, so maybe there is an issue with this kind of query. Maybe you can try not projecting on specific columns but retrieving all columns to see if it makes any difference.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23211174

http://stackoverflow.com/q/23135039
score: 1
tagged with: java
type: Question
tagged with: salesforce-service-cloud
tagged with: salesforce
tagged with: webservices-client
has answer: http://stackoverflow.com/a/23156540
has body: I am working on java application for getting attachments from salesforce. I have to show the salesforce attachments in my java application for particular object like Leads,Contacts etc. For that i am using Rest Api and got response body. But in response body there is url but i want binary data of attachment body. I get response in body in following format: { Body = "/services/data/v23.0/sobjects/Attachment/00P90000004SRFlEAO/Body"; ContentType = "application/video"; Name = "Video.MOV"; attributes = { type = Attachment; url = "/services/data/v23.0/sobjects/Attachment/00P90000004SRFlEAO"; }; }
has title: how to access Salesforce Attachment Body (base64 binary data) using java?
upvote count: 1
answer count: 1
favorite count: 0
type: UnansweredQuestion
tagged with: web-services
downvote count: 0

http://stackoverflow.com/q/23272360
has comment: http://stackoverflow.com/comment/35617178
has title: Tomcat / Maven plugin - Unauthorized error
answer count: 1
downvote count: 0
has body: I have the following config in my /users//settings.xml. Under PluginsGroup: org.apache.tomcat.maven Under servers: localhost tom cat Under profiles: localhost http://localhost:8080/manager/text / I ran the maven command with -X options, and I see the following: [DEBUG] Reading global settings from C:\Tools\apache-maven-3.1.1\bin\..\conf\settings.xml [DEBUG] Reading user settings from C:\Users\<user>\.m2\settings.xml I have the manager-script role in tomcat users xml file. When I manually verify the access through browser, it works fine. But when I run mvn tomcat7:deploy I get the following: Receiving response: HTTP/1.1 401 Unauthorized User name and password are correct. I verified it manually. What else could be wrong? Googling did not help much. Edit: More details from Log. HTTP/1.1 401 Unauthorized Server: Apache-Coyote/1.1 Cache-Control: private Expires: Wed, 31 Dec 1969 18:00:00 CST WWW-Authenticate: Basic realm="Tomcat Manager Application" Set-Cookie: JSESSIONID=7320C7326C51E8F7FF9F4D23A39E6971; Path=/manager/; HttpOnly Content-Type: text/html;charset=ISO-8859-1 Transfer-Encoding: chunked Date: Thu, 24 Apr 2014 02:56:27 GMT Cookie accepted: "[version: 0][name: JSESSIONID][value: 7320C7326C51E8F7FF9F4D23A39E6971] [domain: localhost][path: /manager/][expiry: null]". Connection can be kept alive indefinitely Authentication required localhost:8080 requested authentication Authorization challenge processed Authentication failed Clearing cached auth scheme for http://localhost:8080 Edit: Well, this is what I found out. When I pass username and password from mvn command, its working fine. But its not picking up from settings.xml. Does it ring any bell? I tried moving the config stuff to MAVEN_HOME/config/settings.xml as well. (Deleted the user settings.xml). But still the same. Any settings cache? Edit: I turned on the debugger with -X. Even though I deleted /user/.m2/settings.xml, it says its reading that file. [DEBUG] Reading global settings from C:\Tools\apache-ma…
tagged with: tomcat
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35617701
tagged with: deployment
has comment: http://stackoverflow.com/comment/35617147
has comment: http://stackoverflow.com/comment/35617312
tagged with: maven
upvote count: 1
has comment: http://stackoverflow.com/comment/35617356
has comment: http://stackoverflow.com/comment/35619115
type: Question
has comment: http://stackoverflow.com/comment/35617290
tagged with: unauthorized
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/35618978
has answer: http://stackoverflow.com/a/23273620

http://stackoverflow.com/a/23170440
score: 0
has comment: http://stackoverflow.com/comment/35441947
type: Answer
answers question: http://stackoverflow.com/q/23170177
has body: The messages says user 1 has already been persisted without having any parent, but now we try to persist user 2 as a parent of user 1, but user 1 is known not to have a parent. try to persist everything in one go using cascading instead. You can declare a cascading relation like this: @ManyToMany(cascade=CascadeType.ALL) private List&lt;User&gt; userFriends; And then persist everything in one go using cascading: User user1 = new User(); User user2 = new User(); user1.getUserFriends().add(user2); // this persists the whole tree in one go entityManager.persist(user1);

http://stackoverflow.com/comment/35482469
score: 0
type: Comment
type: QuestionComment
has text: its upto you to decide and code
comment on: http://stackoverflow.com/q/23197807

http://stackoverflow.com/comment/35491657
type: Comment
comment on: http://stackoverflow.com/a/23202806
has text: I tried this one but for some reason it skips the first number and fails to print it out and include it in the counting.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/35521019
has text: This will work, but it assumes he cares about making his services RESTful.
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/23219506
type: Comment

http://stackoverflow.com/q/23214312
downvote count: 0
tagged with: generics
has answer: http://stackoverflow.com/a/23214484
favorite count: 0
has title: Java generics - map of formatters
type: AnsweredQuestion
score: 1
tagged with: java
duplicate of: http://stackoverflow.com/q/13845468
upvote count: 1
has answer: http://stackoverflow.com/a/23214642
possible better answer: http://stackoverflow.com/a/23214484
type: Question
has body: A Formatter&lt;T&gt; knows how to format T to string: public interface Formatter&lt;T&gt; { String format(final T t); } I would like to have a Map of formatters, one for Integer, one for Date etc: Map&lt;Class, Formatter&gt; formatters; The intended use would be: formatters.put(Integer.class, new Formatter&lt;Integer&gt;() { public String format(Integer i) { return i.toString; } }); Is there some way to enforce that the key-values will agree on the Class type? That if I say put(Integer.class, new Formatter&lt;Integer&gt;(){...}) it will work but put(Integer.class, new Formatter&lt;Date&gt;(){...}) will not? What I am trying now is to use ? as the type: Map&lt;Class&lt;?&gt;, Formatter&lt;?&gt;&gt; formatters; But then I cannot use formatters inside this map: Object obj = Integer.valueOf(15); formatters.get(obj.getClass()).format(obj); Error: The method format(capture#3-of ?) in the type Formatter&lt;capture#3-of ?&gt; is not applicable for the arguments (Object) Any clarification would be welcome.
accepted answer: http://stackoverflow.com/a/23214592
linked to: http://stackoverflow.com/q/3437897
linked to: http://stackoverflow.com/q/13845468
has answer: http://stackoverflow.com/a/23214592
answer count: 3

http://stackoverflow.com/comment/35596965
has text: So dont do this.... LinearLayout layout = (LinearLayout)findViewById(R.id.inflationn); Put ... LinearLayout layout = (LinearLayout)findViewById(R.id.container); and....showvalue = (TextView) rowview.findViewById(R.id.ShowMe);
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23242735
score: 1

http://stackoverflow.com/comment/35643754
type: Comment
has text: are u sure that both are not possible with the same intent?
comment on: http://stackoverflow.com/a/23286314
type: AnswerComment
score: 0

http://stackoverflow.com/comment/35477684
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23195232
has text: "Any advices?" - Yes. Benchmark it yourself.
score: 0

http://stackoverflow.com/comment/136032785
type: Comment
has text: Very interesting. For those who didn't understood well, this description tells way to build shapes in a very low-level, getting entire control on how the shape is built.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23165399

http://stackoverflow.com/a/25978122
accepted answer of: http://stackoverflow.com/q/23240508
answers question: http://stackoverflow.com/q/23240508
has comment: http://stackoverflow.com/comment/92977903
upvote count: 5
has body: The bimserver team provides a REST API and a java client library. You can communicate with either of those methods. You cannot access the database directly without building a BerkelyDB connector but the api's interfaces should suffice (specifically the ServiceInterface and the LowLevelInterface) Some helpful links: BimServer -- Client Library and Server BimServerGUI -- Useful GUI Plugin
has comment: http://stackoverflow.com/comment/54289184
has comment: http://stackoverflow.com/comment/93007791
score: 5
has comment: http://stackoverflow.com/comment/93694344
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/a/23180922
answers question: http://stackoverflow.com/q/23159909
accepted answer of: http://stackoverflow.com/q/23159909
type: Answer
has body: Since I couldn't get it to include the WSDL into the classpath, I did it another way. I've created a directory for my application under /etc/ in CRXDE (I'm using Adobe CQ5) and put the WSDL file in there. Then I've just pointed my web service client to the http address of the directory (which would've been http://localhost:4503/etc/projectname/webservice.wsdl). I'm still open for a cleaner approach (this will only work on Publish instances, since on a author instance it'll require login credentials), but so far it does what I need and allows me to deploy everything at once.
score: 0
type: AcceptedAnswer

http://stackoverflow.com/comment/35467394
type: Comment
comment on: http://stackoverflow.com/a/23180133
type: AnswerComment
has text: You send with the write() method.
score: 0

http://stackoverflow.com/comment/35434071
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23167297
has text: The Xpath which one i taken that one is correct,no i am unable to click the element,when i am running the script that time it open the specified browser only,exception will occures while mouseover action is calling

http://stackoverflow.com/comment/35500658
has text: Can you find a reference for this in JLS? I searched but I could not find it.
score: 0
comment on: http://stackoverflow.com/a/23207578
type: AnswerComment
type: Comment

communication
tag name: communication
tags question: http://stackoverflow.com/q/23268956
type: Tag

http://stackoverflow.com/comment/35389628
has text: But I also read on that page that TEXT and MEMO fields with compression enabled are compressed on save, and uncompressed when read, so that is not your issue, apparently. Still could be the API you are using though.
type: AnswerComment
comment on: http://stackoverflow.com/a/23135596
score: 0
type: Comment

http://stackoverflow.com/a/23266474
has body: You cannot do that. It is a language feature. At most what you can do is put null checks.
type: Answer
answers question: http://stackoverflow.com/q/23266441
score: 0

http://stackoverflow.com/q/23146896
favorite count: 0
type: UnansweredQuestion
tagged with: nlp
score: 2
tagged with: uima
upvote count: 2
tagged with: machine-learning
tagged with: opennlp
type: Question
tagged with: java
has title: Using more than one model for entity extraction- OpenNLP
answer count: 2
has answer: http://stackoverflow.com/a/23274603
downvote count: 0
has body: I have two model files as: 1)en-politicians-ner.bin 2)en-engineers-ner.bin Now, is there a way to add these two models in a single NameFinderME object. Work around for using these two models may be to create two NameFinderME objects and Iterate over it to extract entities, But I don't want to do that.
has answer: http://stackoverflow.com/a/23170386

http://stackoverflow.com/a/23258063
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/23257788
answers question: http://stackoverflow.com/q/23257788
type: Answer
upvote count: 1
has body: Try running java with -Djava.library.path: java -Djava.library.path=directory_where_your_library_is main_class
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35607890

http://stackoverflow.com/comment/35422326
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23142490
type: Comment
has text: has failed. the picture below

http://stackoverflow.com/a/23155663
answers question: http://stackoverflow.com/q/23155028
score: 0
type: Answer
has body: Try running /usr/bin/hbase classpath and see if hbase.jar is on your classpath. If it is not or the paths are wrong check your hbase configuration /etc/hbase/conf/hbase-env.sh and make sure you do not have an environment $HBASE_HOME set to the incorrect location.

http://stackoverflow.com/comment/35545030
type: AnswerComment
has text: What version of Java are you using? I've never seen it grow the length.
type: Comment
comment on: http://stackoverflow.com/a/23231306
score: 0

http://stackoverflow.com/a/23132795
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/23132201
has body: This appears to be a bug in the Schematron task. The way the Ant task loads the Saxon XSLT processor would require Saxon to be on the system classpath even if the task itself is on a subsidiary classloader. At first glance this code in ValidatorFactory looks sensible enough: private TransformerFactory _factory = TransformerFactoryImpl.newInstance(); (where TransformerFactoryImpl is Saxon's implementation of TransformerFactory), but in fact TransformerFactoryImpl doesn't define a newInstance() method of its own so this is the inherited newInstance from TransformerFactory, which will look up an appropriate factory based on the value of the javax.xml.transform.TransformerFactory system property. The Ant task does set this system property: System.setProperty("javax.xml.transform.TransformerFactory", "net.sf.saxon.TransformerFactoryImpl"); but TransformerFactory.newInstance() will look for this class on the system classloader, not necessarily on the classloader that loaded the schematron task. The fix would be to change ValidatorFactory line 120 to simply private TransformerFactory _factory = new TransformerFactoryImpl(); which would bypass all the dynamic lookup and instantiate the correct class directly. With this fix in place &lt;taskdef name="schematron" classname="com.schematron.ant.SchematronTask" classpath="lib/ant-schematron.jar:lib/saxon9he.jar"/&gt; would work correctly. I'd suggest you report the bug to the developers, but the project doesn't look particularly active so you may just have to build your own local fork instead...
answers question: http://stackoverflow.com/q/23132201
type: AcceptedAnswer
downvote count: 0
upvote count: 2

http://stackoverflow.com/comment/35530016
has text: How to add value to this merged area ?
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23223993
score: 0

http://stackoverflow.com/a/23152546
has comment: http://stackoverflow.com/comment/52167238
upvote count: 39
type: AcceptedAnswer
downvote count: 0
score: 39
type: Answer
has body: There is a section about this in the Tomcat 8 migration guide which will direct you to use a resources configuration In particular, you will be creating a WebResourceRoot object which contains the following text in its description. VirtualWebappLoader - Replaced by Pre- and Post-Resources mapped to WEB-INF/lib and WEB-INF/classes Your new context.xml will look something like the following: &lt;Context&gt; &lt;Resources className="org.apache.catalina.webresources.StandardRoot"&gt; &lt;PreResources className="org.apache.catalina.webresources.DirResourceSet" base="C:\\PROJECT_NAME\\conf" internalPath="/" webAppMount="/WEB-INF/classes" /&gt; &lt;/Resources&gt; &lt;/Context&gt;
accepted answer of: http://stackoverflow.com/q/23143697
has comment: http://stackoverflow.com/comment/82600963
answers question: http://stackoverflow.com/q/23143697

http://stackoverflow.com/comment/35415772
type: AnswerComment
comment on: http://stackoverflow.com/a/23158895
type: Comment
has text: Wow! Duh! 6 more to go
score: 0

http://stackoverflow.com/comment/35548215
score: 0
type: Comment
has text: If I remove the local declaration, I can't use the button1 in test() method. I am sure there must be something else that is wrong.
comment on: http://stackoverflow.com/a/23234352
type: AnswerComment

http://stackoverflow.com/q/23237460
has body: My JSON file size 126MB. it contains only one line [no spaces , so the whole file is considered as single line]. I want to split it into files each 10MB[some random amount]. WHAT I HAVE TRIED? I tried to use filereader , streamreader etc . When i use reader.readLine() it throws me a memory error I tried Jackson library. File reader = new File("D:\\registry.txt"); ObjectMapper map = new ObjectMapper(); JsonParser jp = new JsonFactory().createJsonParser(reader); JsonNode masterJSON = map.readTree(jp); System.out.println(masterJSON); It also showing the same memory error . How can i do it? MY ALTERNATIVE WORST SOLUTION I FOUND SO FAR? Convert the file extension to .txt . And started reading char by char until i reach maximum splitting size.Again i have to change the file extension to .json. Any easiest way to read one line file which is large[more than 100MB] in size??
has comment: http://stackoverflow.com/comment/35553739
has comment: http://stackoverflow.com/comment/35553808
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35553753
has comment: http://stackoverflow.com/comment/35556497
has comment: http://stackoverflow.com/comment/35553580
has comment: http://stackoverflow.com/comment/35554803
linked to: http://stackoverflow.com/q/19177994
answer count: 0
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question
has comment: http://stackoverflow.com/comment/35598495
has comment: http://stackoverflow.com/comment/35555377
has comment: http://stackoverflow.com/comment/35589386
tagged with: jackson
has comment: http://stackoverflow.com/comment/35555282
score: 0
has title: Reading a large json file char by char

http://stackoverflow.com/comment/35537614
score: 1
comment on: http://stackoverflow.com/q/23222408
type: Comment
type: QuestionComment
has text: This is not a duplicate!

http://stackoverflow.com/comment/35441234
type: QuestionComment
score: 1
has text: @mostruash No, that has absolutely nothing to do with it. This is all about references.
type: Comment
comment on: http://stackoverflow.com/q/23174079

http://stackoverflow.com/a/23202455
type: Answer
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/23201896
downvote count: 0
has body: Here's an alternative that uses a String[] to collect the ngrams instead of a string. I changed the number of iterations on the outer for loop to ensure it captures the last n-gram. public static List&lt;String[]&gt; ngrams(String[] gold, int n_length) { List&lt;String[]&gt; list = new ArrayList&lt;String[]&gt;(); for (int i = 0; i &lt; gold.length - (n_length-1); i++) { String[] ngram = new String[n_length]; for(int j = 0; j &lt; n_length; j++) { ngram[j] = gold[i+j]; } list.add(ngram); } return list; }
has comment: http://stackoverflow.com/comment/35491074

http://stackoverflow.com/comment/35609672
comment on: http://stackoverflow.com/q/23268123
score: 0
type: Comment
type: QuestionComment
has text: and if you try two call printLinesWhichContain("some word") and then printLinesWhichContain("someOtherword") what happens? The second call works or not? Maybe the problem is not about the empty string but about your reader, do you have implemented your own reader? Maybe the reader is not 'reset', and for these reason it works only once the first time.

http://stackoverflow.com/comment/35412889
type: Comment
has text: Ah, works beautifully now. I'll give you some credit in my references, thanks!
comment on: http://stackoverflow.com/a/23158185
type: AnswerComment
score: 0

http://stackoverflow.com/a/23202645
score: 3
type: Answer
answers question: http://stackoverflow.com/q/23202609
has body: Convert the value of txt_vouchno_p.getText() into an int using Integer#parseInt and pass it to your PreparedStatement accordingly: ps.setInt(1, Integer.parseInt(txt_vouchno_p.getText())); Looks like a typo in your current code, but for large literal Strings, do not be afraid o split it in several lines, the compiler is smart enough to convert it into a single large String for you. So, this line: String sql = "select item_type as 'Item Type', md_by as 'Made By', model as 'Model', selling_price as 'Selling Price', purchase_price as 'Purchase Price', purchase_date as 'Purchase Date', vouch_no as 'Voucher No.', vouch_date as 'Voucher Date', record_no as 'Record No.' from purchase" where vouch_no = ?; Should be rewritten to: String sql = "select item_type as 'Item Type'" + ", md_by as 'Made By'" + ", model as 'Model'" + ", selling_price as 'Selling Price'" + ", purchase_price as 'Purchase Price'" + ", purchase_date as 'Purchase Date'" + ", vouch_no as 'Voucher No.'" + ", vouch_date as 'Voucher Date'" + ", record_no as 'Record No.'" + " from purchase" + " where vouch_no = ?";
has comment: http://stackoverflow.com/comment/35491360
upvote count: 3
has comment: http://stackoverflow.com/comment/35491418
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23202609

http://stackoverflow.com/comment/35449675
comment on: http://stackoverflow.com/a/23178967
has text: The compiler knows enough to know that generics are available at source level 1.5 or greater; so it seems like it is an appropriate version but with a bad `-source` argument on the command line.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/23164012
answer count: 1
tagged with: masking
favorite count: 0
accepted answer: http://stackoverflow.com/a/23164054
tagged with: byte
has body: There's something I'm struggling to understand, I have this piece of code : public class HelloWorld{ public static int readByte(byte b) { return b &amp; 0xFF; } public static short readShort(byte[] b) { return (short)(readByte(b[0]) | readByte(b[1]) &lt;&lt; 8); } public static void main(String []args){ byte[] b = {(byte)0x94, 0x00}; System.out.println(readShort(b)); } } Now the result returned is 148, but I don't understand why if I remove the masking "&amp; 0xFF", the result will change, if you're reading 1 byte at a time the masking of 0xFF doesn't suppose to affect the byte (that's what I know atleast), a friend of mine tried to explain me this and he said it's related to the byte "0x94" being unsigned and the casting going on in the readByte method but I couldn't understand it and I'm really having hard time to understand why you need the masking to read the byte properly, thanks in advance for anyone trying to help me !
has comment: http://stackoverflow.com/comment/47998179
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23164054
downvote count: 0
score: 1
tagged with: java
has title: Byte masking in java
type: Question
upvote count: 1

http://stackoverflow.com/q/23267782
has title: Slick2D: getTileProperty returns true when it shouldn't
score: 2
downvote count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35791214
type: Question
has answer: http://stackoverflow.com/a/23366929
tagged with: java
tagged with: slick2d
tagged with: collision-detection
upvote count: 2
answer count: 1
has comment: http://stackoverflow.com/comment/35948728
favorite count: 0
has comment: http://stackoverflow.com/comment/35910459
has body: I'm trying to implement some collision detection to a test game i've been making. I've used TiledMap to create the map and set a property on one of the tiles to blocked=true This tile is then drawn on layer 0. I then check to see if the tile exists in the direction the player is moving, using the following code if (input.isKeyDown(Input.KEY_DOWN)) { sprite = down; sprite.update(delta); int tileID = map.map.getTileId((int) x / map.map.getTileWidth(), (int) y / map.map.getTileHeight() + 1, 0); String value = map.map.getTileProperty(tileID, "blocked", "false"); if (value.equals("true")) { y += delta * 0.1f; System.out.println("Tile ID: " + (int) (x / map.map.getTileWidth()) + ", " + (int) (y / map.map.getTileHeight() + 1) + " Try to walk down. Tile value below the player is:" + value); } } This is repeated for each direction. The problem I'm running into is it's picking up the blocked property for incorrect tiles You can understand better with this video. The yellow tiles are the collision/blocked tiles.
has comment: http://stackoverflow.com/comment/35790934

http://stackoverflow.com/comment/35437538
has text: @AKIWEB Something similar to this solution except it would need to contain an object you can cast to `Throwable`.
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23171870

http://stackoverflow.com/comment/35390114
has text: The question is about initialValue() behaviour of ThreadLocal. This is pretty much the usage. Threads call get() and timer starts running - one per thread.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23143829
score: 0

tcp
type: Tag
tags question: http://stackoverflow.com/q/23151309
tags question: http://stackoverflow.com/q/23266272
tags question: http://stackoverflow.com/q/23283664
tags question: http://stackoverflow.com/q/23163472
tags question: http://stackoverflow.com/q/23223411
tags question: http://stackoverflow.com/q/23204829
tags question: http://stackoverflow.com/q/23276863
tag name: tcp

http://stackoverflow.com/comment/35521088
score: 0
type: AnswerComment
has text: Looking now, I am finding a lot of "retransmissionTicks" though.I believe that the requests are fine because if it was working before, they should, shouldn't they?
type: Comment
comment on: http://stackoverflow.com/a/23183854

http://stackoverflow.com/a/23218498
score: 0
answers question: http://stackoverflow.com/q/23218362
type: Answer
has body: Simply use a multiline literal like this: String s = "first line\n" + "second line"; As the strings are known at compile time the string will be concatenated then. No need to use a StringBuffer at runtime with constant strings.

http://stackoverflow.com/q/23193982
has comment: http://stackoverflow.com/comment/35476298
type: Question
has comment: http://stackoverflow.com/comment/35476389
has body: I wants to implement spring security log in and log out so I have tried following things , Spring-context.xml: <intercept-url pattern="/**" access="isAuthenticated"/> <form-login/> <logout logout-url="/logout" logout-success-url=""/> <authentication-manager> <authentication-provider> <user name="sachin" password="sachin123" authorities="Admin"/> </authentication-provider> spring-servlet.xml: <context:component-scan base-package="com.hrportal.controller" /> </context:annotation-config> <mvc:resources mapping="/images/**" location="/images/"/> <mvc:resources location="/css/**" mapping="/css/"/> <mvc:resources location="/css/**" mapping="/css/"/> <mvc:default-servlet-handler/> I am doing database connection and access manually that is why I am not able to implement the log in and log out using spring security. I am using the following class to connect with database manually : private static Connection con = null; public static Connection getConnection() { try { if (con == null) { Class.forName("com.mysql.jdbc.Driver"); con = DriverManager.getConnection("jdbc:mysql://localhost:3306/portal", "root", "root"); } } catch (Exception e) { e.printStackTrace(); } return con; } } can anyone explain me to solve this..
tagged with: spring-security
has answer: http://stackoverflow.com/a/23204301
score: 0
has title: how to authenticate user using spring security?
answer count: 1
linked to: http://stackoverflow.com/q/18220556
type: UnansweredQuestion
tagged with: spring
has comment: http://stackoverflow.com/comment/35476213
tagged with: spring-mvc
has comment: http://stackoverflow.com/comment/35476479
tagged with: java

http://stackoverflow.com/a/23146774
downvote count: 2
has comment: http://stackoverflow.com/comment/35393436
type: Answer
has comment: http://stackoverflow.com/comment/35393348
answers question: http://stackoverflow.com/q/23146581
upvote count: 0
has comment: http://stackoverflow.com/comment/35393394
has body: You can upload file to AWS S3 using REST web service. You can visit this link for more. File upload directly to S3
score: -2

http://stackoverflow.com/a/23158034
answers question: http://stackoverflow.com/q/23157838
has body: This is an unconventional answer, but Android Annotations makes this easy. You can simply use the @AfterViews annotation before a function to make the code within it execute after the views are ready.
type: Answer
score: 0

http://stackoverflow.com/q/23187162
has answer: http://stackoverflow.com/a/23188257
score: 0
has comment: http://stackoverflow.com/comment/35465763
downvote count: 1
has comment: http://stackoverflow.com/comment/35465610
favorite count: 0
has comment: http://stackoverflow.com/comment/35465164
has comment: http://stackoverflow.com/comment/35464240
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35465150
has answer: http://stackoverflow.com/a/23187644
type: Question
has comment: http://stackoverflow.com/comment/35464788
tagged with: recursion
has comment: http://stackoverflow.com/comment/35464508
has comment: http://stackoverflow.com/comment/35464910
tagged with: java
has comment: http://stackoverflow.com/comment/35465397
has title: Stack Overflow error: How would I write this method Iteratively?
has body: I'm getting a Stack overflow error for the following method at the recursive call. I think I need to make it iterative in order for it to work. How would I write the following method iteratively? Node myMethod(String foo, Node p) { if(p == null) { p = new Node(foo); p.link = spot; spot = p; p.calc[bar] = 1; return p; } else if(foo.equals(p.origin)) { p.calc[bar] = p.calc[bar] + 1; return p; } else { while (p.next == null &amp; foo.equals(p.origin)){ p = p.next; } p.next = myMethod(foo, p.next); return p; } } p is a Node class that has String foo, String origin, Node link, Node next, and int Array calc[]. bar is an int. spot is a random node. This is what I have tried so far Node myMethod(String foo, Node p) { if(p == null) { p = new Node(foo); p.link = spot; spot = p; p.calc[bar] = 1; return p; } else if(foo.equals(p.origin)) { p.calc[bar] = p.calc[bar] + 1; return p; } else { while (p.next == null &amp; foo.equals(p.origin)){ p = p.next; } //instead of doing recursion on: p.next = myMethod(foo, p.next);. I tried the following: if (p.next == null){ p.next = new Node(foo); p.next.link = spot; spot = p.next; p.next.calc[bar] = 1; } else if (foo.equals(p.next.origin)){ p.next.calc[bar] = p.next.calc[bar] + 1; } else { while (p.next.next == null &amp; foo.equals(p.next.origin)){ p.next = p.next.next; } } } return p; }
answer count: 2
upvote count: 1
has comment: http://stackoverflow.com/comment/35465528
tagged with: stack-overflow
tagged with: iteration

http://stackoverflow.com/comment/35532846
has text: @user3561383 can you post the full code and skip the import statements for now
comment on: http://stackoverflow.com/q/23225731
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23285082
favorite count: 0
tagged with: text-analysis
upvote count: 1
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23295289
score: 1
tagged with: java
tagged with: gate
type: Question
has title: GATE API and JAPE code, return empty result
has body: I used GATE API with java code and tried to run one of the known JAPE rules on text of document but unfortunatly I could not get the appropriate results. My code as following: public void initAnnie() throws GateException, IOException { Out.prln("Initialising ANNIE..."); // load the ANNIE application from the saved state in plugins/ANNIE File pluginsHome = Gate.getPluginsHome(); File anniePlugin = new File(pluginsHome, "ANNIE"); File annieGapp = new File(anniePlugin, "ANNIE_with_defaults.gapp"); annieController = (CorpusController) PersistenceManager .loadObjectFromFile(annieGapp); Out.prln("...ANNIE loaded"); } // initAnnie() /** Tell ANNIE's controller about the corpus you want to run on */ public void setCorpus(Corpus corpus) { annieController.setCorpus(corpus); } // setCorpus /** Run ANNIE */ public void execute() throws GateException { Out.prln("Running ANNIE..."); annieController.execute(); Out.prln("...ANNIE complete"); } // execute() /** * Run from the command-line, with a list of URLs as argument. * * NOTE: * This code will run with all the documents in memory - if you want to * unload each from memory after use, add code to store the corpus in a * DataStore. */ public static void main(String args[]) throws GateException, IOException { // initialise the GATE library Out.prln("Initialising GATE..."); Gate.init(); Out.prln("...GATE initialised"); // load ANNIE plugin - you must do this before you can create tokeniser // or JAPE transducer resources. Gate.getCreoleRegister().registerDirectories( new File(Gate.getPluginsHome(), "ANNIE").toURI().toURL()); // Build the pipeline SerialAnalyserController pipeline = (SerialAnalyserController)Factory.createResource( "gate.creole.SerialAnalyserController"); LanguageAnalyser tokeniser = (LanguageAnalyser)Factory.createResource( "gate.creole.tokeniser.DefaultTokeniser"); LanguageAnalyser jape = (LanguageAnalyser)Factory.createResource( "gate.creole.Transducer", gate.Utils.featureMap( "grammarURL", new File("C:path/to/uni…
tagged with: text-mining
has answer: http://stackoverflow.com/a/23295289
downvote count: 0
answer count: 1

http://stackoverflow.com/comment/35506979
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23171198
score: 0
has text: For both tasks I see std out. If it doesn't work You can set the stream with `standardOutput System.out`. Not checked but should work fine. Docs: http://www.gradle.org/docs/current/dsl/org.gradle.api.tasks.JavaExec.html

http://stackoverflow.com/a/23138616
upvote count: 6
answers question: http://stackoverflow.com/q/23138501
has comment: http://stackoverflow.com/comment/35378697
has comment: http://stackoverflow.com/comment/35379405
downvote count: 1
has comment: http://stackoverflow.com/comment/118360077
has comment: http://stackoverflow.com/comment/35378510
has comment: http://stackoverflow.com/comment/35378639
score: 5
has body: In the Project Structure menu, under Project, check the language level setting. Setting it to 6.0 will cause the IDE to give you an error when you are missing the identifier in the diamond block. Setting it to 7.0 or higher will suppress it. Addition based on further exchange: Under File -&gt; Settings -&gt; Inspections -&gt; General if the box that says Unchecked warning is checked, when you run Analyze -&gt; Inspect code, it will report the condition noted under General -&gt; Unchecked warnings as "Unchecked call to add(E) as a member of raw type 'java.util.List'", in this example. If you declare the generic type of List explicitly, this warning will not show up in the report.
type: Answer

http://stackoverflow.com/q/23137039
score: -1
has body: import javax.swing.JPanel; I have to create the player class for a basic "adventuring" game we are making as a group project in java class. Eclipse is telling me that my get and set methods (getStr, getAgi, etc) all need a semicolon to finish the block. but I know that cannot be right. any help or advice in general? public class playerChars extends JPanel{ private int str, agi, intell, hitP; private String wep, arm; die sixSidedDie = new die(6); { public int getStr(str) { str = sixSidedDie.getValue(); } public int getAgi(agi) { agi = sixSidedDie.getValue(); } public int roll(intell) { intell = sixSidedDie.getValue(); } public int getHitP(hitP) { hitP = sixSidedDie.getValue(); } } public static int setQuant(int quantity) { int quant; quant = quantity; } public String getWep() { return wep; } public String setWep(String weapon) { this.wep = weapon; } public String getArm() { String armor; return armor; } public String setArm(String armor) { this.arm = armor; } public int setPot(int potion) { int pot; pot = potion; } public int getPot() { int potion; return potion; } }
has answer: http://stackoverflow.com/a/23137087
downvote count: 1
has comment: http://stackoverflow.com/comment/35375564
favorite count: 0
has title: issues with my java project
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35376298
upvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/35375878
has comment: http://stackoverflow.com/comment/35378374
tagged with: methods
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/35375815
has answer: http://stackoverflow.com/a/23137061

http://stackoverflow.com/comment/35417086
type: Comment
has text: quizarray[j][i] = number; here is the line 115
comment on: http://stackoverflow.com/q/23160318
score: 0
type: QuestionComment

http://stackoverflow.com/q/23186141
tagged with: spring
has title: Websockets and load balancing
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23187449
tagged with: java
upvote count: 10
type: Question
has body: Spring and Java EE have nice support for websockets. For example in Spring you can have: @Configuration @EnableWebSocket public class WebSocketConfig implements WebSocketConfigurer { @Override public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) { registry.addHandler(new MyHandler(), "/myHandler") .addInterceptors(new HttpSessionHandshakeInterceptor()); } } And with MyHandler class you can send and listen for messages to HTML5 websocket. var webSocket = new WebSocket('ws://localhost:8080/myHandler'); webSocket.onmessage = function(event) { onMessage(event) }; The problem is if you run multiple servers behind a load balancer. The clients of server A will not be notified for events on server B. This problem is solved in Spring by using message broker with Stomp protocol (http://assets.spring.io/wp/WebSocketBlogPost.html) Since using the handler and "native" html5 websockets looks easier to me then the Stomp way, my questions are: Is it posible to use the message broker without the Stomp protocol? Are there any other options to overcome the load balancing issue?
score: 10
tagged with: javascript
tagged with: http://stackoverflow.com/tag/html
downvote count: 0
answer count: 1
tagged with: websocket
favorite count: 0
has answer: http://stackoverflow.com/a/23187449

http://stackoverflow.com/q/23193724
has body: I am currently implementing the data-layer for an EE application. I am using latest version of JPA, EclipseLink and Spring. The servlet container is VMware vFabric tc (Tomcat). As the title mentioned, how should I do the connection pooling part ? Most tutorials are using Hibernate with an external library like DBCP or C3PO, but EclipseLink tutorials use Springs DriverManagerDataSource that has no connection pooling. Does EclipseLink have a production level connection pooling feature integrated ? Do I need to set my datasource with JNDI to use Tomcat's connection pooling ? Can someone provide guidelines or an example configuration for a similar scenario, please ? Thank you.
favorite count: 0
upvote count: 2
type: UnansweredQuestion
score: 2
tagged with: connection-pooling
answer count: 0
tagged with: java
type: Question
has title: EclipseLink connection pooling configuration
tagged with: spring-data-jpa
tagged with: eclipselink
downvote count: 0

http://stackoverflow.com/q/23207401
tagged with: java
has answer: http://stackoverflow.com/a/23263403
type: Question
answer count: 1
tagged with: spring-security
tagged with: spring-security-oauth2
score: 0
has title: NPE AuthorizationServerEndpointsConfiguration$TokenRegistrar postProcessBeanFactory
tagged with: spring
accepted answer: http://stackoverflow.com/a/23263403
type: AnsweredQuestion
has body: I have an application built with spring-security-oauth-2.0.0-M2, now I'm trying to upgrade this to 2.0.0.RC1. The samples configuration has changed significantly and now using java config. I have converted the configuration to java config but I got stuck at this error. Apr 21, 2014 5:32:43 PM org.apache.catalina.core.ApplicationContext log INFO: Initializing Spring root WebApplicationContext 17:32:44.703 [localhost-startStop-1] ERROR o.s.web.context.ContextLoader - Context initialization failed java.lang.NullPointerException: null at org.springframework.security.oauth2.config.annotat ion.web.configuration.AuthorizationServerEndpoints Configuration$TokenStoreRegistrar.postProcessBeanF actory(AuthorizationServerEndpointsConfiguration.j ava:179) ~[spring-security-oauth2-2.0.0.RC1.jar:na] at org.springframework.context.support.AbstractApplic ationContext.invokeBeanFactoryPostProcessors(Abstr actApplicationContext.java:694) ~[spring-context-3.2.8.RELEASE.jar:3.2.8.RELEASE] at org.springframework.context.support.AbstractApplic ationContext.invokeBeanFactoryPostProcessors(Abstr actApplicationContext.java:684) ~[spring-context-3.2.8.RELEASE.jar:3.2.8.RELEASE] at org.springframework.context.support.AbstractApplic ationContext.refresh(AbstractApplicationContext.ja va:461) ~[spring-context-3.2.8.RELEASE.jar:3.2.8.RELEASE] at org.springframework.web.context.ContextLoader.conf igureAndRefreshWebApplicationContext(ContextLoader .java:410) ~[spring-web-3.2.8.RELEASE.jar:3.2.8.RELEASE] at org.springframework.web.context.ContextLoader.init WebApplicationContext(ContextLoader.java:306) ~[spring-web-3.2.8.RELEASE.jar:3.2.8.RELEASE] at org.springframework.web.context.ContextLoaderListe ner.contextInitialized(ContextLoaderListener.java: 112) [spring-web-3.2.8.RELEASE.jar:3.2.8.RELEASE] at org.apache.catalina.core.StandardContext.listenerS tart(StandardContext.java:4937) [tomcat-embed-core-7.0.47.jar:7.0.47] at org.apache.catalina.core.StandardContext.startInte rnal(StandardContext.java:…

http://stackoverflow.com/comment/35598339
has text: I mean that the program uses a third party library for the secure login, then opens a terminal for command line interaction. And then process the inputs from the input byte array.
comment on: http://stackoverflow.com/q/23261954
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35449082
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23178543
has text: @Marichyasana Use of `StringTokenizer` is discouraged but it is not deprecatred.

http://stackoverflow.com/a/23252153
type: Answer
has comment: http://stackoverflow.com/comment/35600235
has body: Your progress bar would be shown - if only Swing were thread safe. Remove pbi.dispose(), and you should see your progress bar. You are setting it visible, but immediately afterwards you create an instance of ViewRec - and ViewRec is going to block the thread for it's actions. After ViewRec is constructed, setVisible() is going to be called, and again immediately, you dispose your progress bar. You can find information about how to use progress bars in the official Tutorials offered by Oracle.
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/35580685
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23244448
answers question: http://stackoverflow.com/q/23244448
upvote count: 1

http://stackoverflow.com/comment/35449267
type: Comment
has text: I think you should do all this processing in query if possible and return result. Can you please specify table structure and data. I think your where criteria is such that it returns 1 row but as you said you already tried so please specify value of where criteria also
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/23178678

http://stackoverflow.com/a/23160689
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/23160644
score: 3
upvote count: 3
has body: You can call: object.&lt;Row&gt;mapRow(results, Row.class); but you still need the second parameter anyway, you cannot remove it for what you are trying to do. This is because there is no way to know the type of T at runtime when mapRow is called, due to generics erasure.
answers question: http://stackoverflow.com/q/23160644

http://stackoverflow.com/a/23197962
type: Answer
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/23196461
downvote count: 0
has body: Ironically, the answer is almost stated in the question: as the "left" and "right" task take turns at being forked vs. processed inline, half of the time the right task, represented by this, e.g. the complete rest of the stream, is being forked off. That means that the forking off of chunks is just slowed down a bit (happening every other time), but clearly it happens.

http://stackoverflow.com/comment/35386854
type: AnswerComment
comment on: http://stackoverflow.com/a/23143061
type: Comment
has text: thanks but in this way I get error cannot be applied on all lines `list.set(i, myInterfaceObject);`that i use to replace object in list, and still same error on doSomething
score: 0

http://stackoverflow.com/a/23267604
has body: The current problem is that when doing uniqueID = lUniqueID.toCharArray(); you are assigning a new char array to uniqueID and not the content of it into the previous array defined. What you want to achieve can be done using Arrays.copyOf. char[] uniqueID = Arrays.copyOf(lUniqueID.toCharArray(), 10);
accepted answer of: http://stackoverflow.com/q/23267509
type: Answer
answers question: http://stackoverflow.com/q/23267509
upvote count: 3
score: 3
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/23194874
has body: Case 1: String with Capital First Letter. &gt; String s1 = new String("Ajay") String s2 = s1.toUpperCase() String s3 = s1.toLowerCase() System.out.println s1 == s2 System.out.println s1 == s3 false false Case 2: String with Small First Letter. &gt; String s1 = new String("ajay") String s2 = s1.toUpperCase() String s3 = s1.toLowerCase() System.out.println s1 == s2 System.out.println s1 == s3 false true in Case 1, since the string has capital letter, converting to lowercase will yield a new object hence a new reference for it while in Case 2 small first letter after converting to lowercase will still point to the same object because the original object was same hence creating two references for the same object. You can see the output from the Groovy Shell pretty clear.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23194316

http://stackoverflow.com/comment/35550308
comment on: http://stackoverflow.com/q/23235443
score: 0
type: Comment
has text: @BrianRoach Ahh gotcha. I am by no means qualified to be answering this question, but I thought I'd try.
type: QuestionComment

http://stackoverflow.com/a/23134494
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23134400
answers question: http://stackoverflow.com/q/23134400
type: Answer
has comment: http://stackoverflow.com/comment/35373785
has comment: http://stackoverflow.com/comment/35370958
has comment: http://stackoverflow.com/comment/35372247
score: 3
upvote count: 3
has body: Well, you need to convert your list of employees to JSON and pass the JSON string to the JavaScript function. In order to do that have a look at the various JSON libraries out there, e.g. Gson, Jackson, json-simple etc.
has comment: http://stackoverflow.com/comment/35373193

http://stackoverflow.com/a/23428892
type: AcceptedAnswer
has body: &lt;beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:context="http://www.springframework.org/schema/context" xmlns:jee="http://www.springframework.org/schema/jee" xmlns:lang="http://www.springframework.org/schema/lang" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:p="http://www.springframework.org/schema/p" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:util="http://www.springframework.org/schema/util" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee.xsd http://www.springframework.org/schema/lang http://www.springframework.org/schema/lang/spring-lang.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd"&gt; I have changed my xsd to this xsd definitions and it is working now.. As like Pathfinder2104 is saying, spring automatically takes the most recent available xsd. so better not to mention the version of the xsd.
downvote count: 0
answers question: http://stackoverflow.com/q/23290699
type: Answer
score: 4
accepted answer of: http://stackoverflow.com/q/23290699
upvote count: 4

http://stackoverflow.com/comment/35637140
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23251772
has text: I suggest you debug it. These designs where there are two sockets per client can't ever really work reliably. What happens when two different clients connect more or less simultaneously?
score: 0

http://stackoverflow.com/comment/35449482
has text: @user2707760 thats easy, just do `p.getErrorStream()` and listen for output. If there is no output, then the compilation was usually successful.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23178839
type: AnswerComment

http://stackoverflow.com/comment/35621433
comment on: http://stackoverflow.com/q/23274518
type: Comment
has text: Please say a little bit more about your problem.
type: QuestionComment
score: 1

http://stackoverflow.com/q/23240064
tagged with: java
has comment: http://stackoverflow.com/comment/35565241
type: Question
answer count: 1
has comment: http://stackoverflow.com/comment/35589389
has comment: http://stackoverflow.com/comment/35563723
has comment: http://stackoverflow.com/comment/35564971
has comment: http://stackoverflow.com/comment/35560961
score: 0
has title: Sending a PriorityQueue over Socket in Java sends an empty queue
has comment: http://stackoverflow.com/comment/35561145
has answer: http://stackoverflow.com/a/23265703
has comment: http://stackoverflow.com/comment/35605034
has comment: http://stackoverflow.com/comment/35560888
has comment: http://stackoverflow.com/comment/35604737
has comment: http://stackoverflow.com/comment/35604316
type: UnansweredQuestion
tagged with: sockets
has comment: http://stackoverflow.com/comment/35560788
has comment: http://stackoverflow.com/comment/35559122
has comment: http://stackoverflow.com/comment/35559220
has body: I have two programs - Server and a Client. Basically the job of the server is to maintain an ArrayList of objects of some class 'Item'. Items can be added to the ArrayList or existing items can be altered on the Client app's request. Occasionally the Client App has to receive some of the Items that are contained in the list and that is where the problem comes from. The Item Class has a PriorityQueue of other objects (that are serializable) as an instance variable. The problem is that when the server sends some items the client receives everything but the priority queue for each item is empty (all the other instance variables of the Item objects are received correctly). Now the code: This is the part of the Item Class that is connected to the problem: public class Item implements Serializable { ...Some instance variables... PriorityQueue&lt;Bid&gt; pq; public Item(...) { pq = new ProrityQueue&lt;Bid&gt;(); } public void addStuff(Stuff bid) { this.pq.add(bid); } ...other methods... } To send the ArrayList that the client requested I just to this on the server side ObjectOutputStream oos = new ObjectOutputStream(serverSocket.getOutputStream); oos.writeObject(someArrayList&lt;Item&gt;); and on the client side ObjectInputStream ois = new ObjectInputStream(serverSocket.getInputStream); ArrayList&lt;Item&gt; tempList = (ArrayList&lt;Item&gt;) ois.readObject(); I find it really strange that the client receives every single object it has to receive and all of its instance variables including the PriorityQueue but the PriorityQueue is empty. Why are the Objects in the PriorityQueue the only thing that is not received by the Client? Is there something extra I should know about sending a List of objects that have some collection of other objects within them over a socket? EDIT: I am posting part of the code for further details. In fact for the communication between the server and the client I use ClientCommunications Class and ServerCommunication Class that handle everything so…

http://stackoverflow.com/comment/35655239
has text: Here's the deal, I'm not getting an exception, everything works fine, I'm just not getting the result from that particular cell of the spreadsheet. The indexes are fine, starting from zero. The content of this cell is '303249833' but I'm getting null every time I try to read this cell. It's a very weird problem.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23280533

http://stackoverflow.com/q/23172460
has body: I am writing a program where it takes a file and tries to use data from the file in order to create an output. this is the program: import java.util.Scanner; import java.io.*; public class WebberProjectTest { public static void main(String[] args) throws IOException { Scanner scanner = new Scanner(new File("portlandvip.txt")); while (scanner.hasNext()) { String firstName = scanner.next(); String lastName = scanner.next(); Integer number = scanner.nextInt(); String ticketType = scanner.next(); if(ticketType == "Court") { Integer a = 75 * number; System.out.println(" " + firstName + " " + lastName + " " + a); scanner.nextLine(); } if(ticketType == "Box") { Integer a = 50 * number; System.out.println(" " + firstName + " " + lastName + " " + a); scanner.nextLine(); } if(ticketType == "Club") { Integer a = 40 * number; System.out.println(" " + firstName + " " + lastName + " " + a); scanner.nextLine(); } } } } This is the data file: Loras Tyrell 5 Club Margaery Tyrell 8 Box Roslin Frey 2 Box Sansa Stark 2 Club Jon Snow 5 Club Edmure Tully 3 Box Joffrey Baratheon 20 Court Stannis Baratheon 4 Club Jaime Lannister 2 Box Cersei Lannister 1 Court Beric Dondarrion 8 Court Balon Greyjoy 16 Box Olenna Tyrell 4 Court Mace Tyrell 5 Box Tyrion Lannister 2 Club Sandor Clegane 2 Court Gregor Clegane 6 Club Samwell Tarly 3 Club Petyr Baelish 6 Court The purpose of this program is to that the input File and output for example. Input: Loras Tyrell 5 Court Output: Loras Tyrell $375.00 However, when i run the program, nothing happens. I have a few ideas on why this is happening, but i dont know how to fix it, any help would be appreciated. I also have another question about printf statements. I altered the program so that it prints correctly, but now i have to change the println statements to printf statements. this is what i changed the program to look like now: import java.util.Scanner; import java.io.*; public class WebberProjectTest { public static void main(String[] args) throws IOExc…
tagged with: input
has answer: http://stackoverflow.com/a/23172736
type: Question
has comment: http://stackoverflow.com/comment/35438234
has answer: http://stackoverflow.com/a/23173111
tagged with: java
has title: Having trouble with program output an printf
duplicate of: http://stackoverflow.com/q/513832
has answer: http://stackoverflow.com/a/23172697
score: 0
has comment: http://stackoverflow.com/comment/35438120
has comment: http://stackoverflow.com/comment/35438290
answer count: 3
linked to: http://stackoverflow.com/q/513832
type: UnansweredQuestion

algorithm
tags question: http://stackoverflow.com/q/23226365
tags question: http://stackoverflow.com/q/23231356
tags question: http://stackoverflow.com/q/23257844
tags question: http://stackoverflow.com/q/23186461
tag name: algorithm
tags question: http://stackoverflow.com/q/23222712
tags question: http://stackoverflow.com/q/23217261
tags question: http://stackoverflow.com/q/23239835
tags question: http://stackoverflow.com/q/23176334
tags question: http://stackoverflow.com/q/23223989
tags question: http://stackoverflow.com/q/23218659
tags question: http://stackoverflow.com/q/23234761
tags question: http://stackoverflow.com/q/23276597
tags question: http://stackoverflow.com/q/23228960
tags question: http://stackoverflow.com/q/23169231
tags question: http://stackoverflow.com/q/23137464
tags question: http://stackoverflow.com/q/23171524
tags question: http://stackoverflow.com/q/23280792
tags question: http://stackoverflow.com/q/23250764
tags question: http://stackoverflow.com/q/23261182
tags question: http://stackoverflow.com/q/23203778
tags question: http://stackoverflow.com/q/23180876
tags question: http://stackoverflow.com/q/23136817
tags question: http://stackoverflow.com/q/23202128
tags question: http://stackoverflow.com/q/23261128
tags question: http://stackoverflow.com/q/23278469
tags question: http://stackoverflow.com/q/23263000
type: Tag
tags question: http://stackoverflow.com/q/23173932
tags question: http://stackoverflow.com/q/23174416
tags question: http://stackoverflow.com/q/23282908
tags question: http://stackoverflow.com/q/23178714
tags question: http://stackoverflow.com/q/23168135
tags question: http://stackoverflow.com/q/23144252
tags question: http://stackoverflow.com/q/23188417
tags question: http://stackoverflow.com/q/23172793
tags question: http://stackoverflow.com/q/23205277
tags question: http://stackoverflow.com/q/23139075
tags question: http://stackoverflow.com/q/23147171
tags question: http://stackoverflow.com/q/23148460
tags question: http://stackoverflow.com/q/23209769
tags question: http://stackoverflow.com/q/23208758

http://stackoverflow.com/comment/35492039
type: AnswerComment
has text: This will break if the map is not a `ConcurrentMap` (or something that uses memory barriers in a similar way).
type: Comment
comment on: http://stackoverflow.com/a/23202783
score: 1

http://stackoverflow.com/a/23215561
accepted answer of: http://stackoverflow.com/q/23215400
answers question: http://stackoverflow.com/q/23215400
upvote count: 1
type: AcceptedAnswer
has body: As stated in your logcat output java.lang.ClassCastException: com.example.android.navigationdrawerexample.InboxActivity cannot be cast to android.app.Activity You're trying to start your fragment as an activity Intent activity = new Intent(getApplicationContext(), InboxActivity.class); startActivity(activity); You should remove those two lines as your fragment has already been added using a FragmentTransaction.
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/q/23248210
tagged with: smtp
favorite count: 0
has title: Send Email with Camel an Java. ISSUE STARTTLS error
has body: I know this question has been asked before, but I tried several sollutions and the problem still persists, so and help would be much appreciated. I am trying to configure to send email throu gmail and smtp. Below is our camel configuration: &lt;camel:camelContext xmlns="http://camel.apache.org/schema/spring"&gt; &lt;camel:route id="gmailRoute"&gt; &lt;camel:from uri="direct://gmail" /&gt; &lt;camel:to uri="smtp://p****is@gmail.com?host=smtp.gmail.com&amp;amp;port=587&amp;amp;from=p****is@gmail.comi&amp;amp;password=gl******" /&gt; &lt;/camel:route&gt; On the init method of our service implementation we have the following: log.info("Initializing Email Service"); Properties props = new Properties(); props.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory"); props.put("mail.smtp.auth", "true"); props.put("mail.smtp.starttls.enable", "true"); props.put("mail.smtp.host", "smtp.googlemail.com"); props.put("mail.smtp.port", "587"); Authenticator auth = null; props.put("mail.smtp.auth", "true"); auth = new Authenticator() { protected PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication("******akis@gmail.com", "gl*****s"); } }; Session t = Session.getInstance(props, auth); template = camelContext.createProducerTemplate(); and on the sendmail method we have: @Override public void sendEmail(String from, String[] to, String[] cc, String[] bcc, String subject, String body) { String endpoint = "direct://gmail"; String toString = null; String ccString = null; String bccString = null; Map&lt;String, Object&gt; headers = null; toString = convertStringArrayToCSV(to); ccString = convertStringArrayToCSV(cc); bccString = convertStringArrayToCSV(bcc); headers = new HashMap&lt;String, Object&gt;(); headers.put("Subject", subject); if (toString != null) { headers.put("To", toString); } if (ccString != null) { headers.put("CC", ccString); } if (bccString != null) { headers.put("BCC", bccString); } template.sendBodyAndHeaders(endpoint, bod…
type: UnansweredQuestion
score: 3
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/23253654
has answer: http://stackoverflow.com/a/43773575
type: Question
has answer: http://stackoverflow.com/a/31702883
tagged with: apache
tagged with: apache-camel
answer count: 3
downvote count: 0

http://stackoverflow.com/a/23287161
type: Answer
has comment: http://stackoverflow.com/comment/35645389
has comment: http://stackoverflow.com/comment/35647217
has comment: http://stackoverflow.com/comment/35647299
has comment: http://stackoverflow.com/comment/35645259
answers question: http://stackoverflow.com/q/23286749
has body: If the SampleMethod just uses a small subset, only read operations for example then it might be a viable to implement a HttpServletRequest wrapper that bridge the sevlet api to the play request. Note that there are many ways they differ so it is not certain that you would be able to bridge everything you need. If it depends on large parts of the servlet API then I think you are out of luck.
has comment: http://stackoverflow.com/comment/35645534
score: 0
has comment: http://stackoverflow.com/comment/35647107

http://stackoverflow.com/q/23246867
has answer: http://stackoverflow.com/a/23256971
score: 0
answer count: 3
favorite count: 0
type: UnansweredQuestion
upvote count: 1
tagged with: regex
tagged with: step
has title: Regex for instances in STEP-files?
has answer: http://stackoverflow.com/a/23274129
tagged with: java
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/23248554
has body: I have to parse some STEP-files (ISO-10303-21) from different CAD-Systems and they are always structured differently. This are the forms that might appear: #95=STYLED_ITEM('',(#94),#92); #12 = CARTESIAN_POINT ( 'NONE', ( 1.213489432997839200, 5.617300827691964000, -7.500000000000001800 ) ) ; #263 = TEST ( 'Spaces must not be ignored here' ) ; I thought that a regular expression would help me, so I created this one (http://rubular.com/r/EtJ25Hfg77): (\#\d+)\s*=\s*([A-Z_]+)\s*\(\s*(.*)*\s*\)\s*; This gives me: Match 1: 1: #95 2: STYLED_ITEM 3: Match 2: 1: #12 2: CARTESIAN_POINT 3: Match 3: 1: #263 2: TEST 3: So the first two groups are working as supposed. But I also need the attributes inside the parantheses like this: Match 1: 1: #95 2: STYLED_ITEM 3: '' 4: (#94) 5: #92 Match 2: 1: #12 2: CARTESIAN_POINT 3: 'NONE' 4: ( 1.213489432997839200, 5.617300827691964000, -7.500000000000001800 ) Match 3: 1: #263 2: TEST 3: 'Spaces must not be ignored here' Please help me finding the correct expression for the last group ((.*) at the moment).

http://stackoverflow.com/comment/35610133
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23267506
score: 0
has text: @Infested Updated the JSP code, errorMessage and errorCause still come out as "null"

http://stackoverflow.com/q/23131173
score: 0
has answer: http://stackoverflow.com/a/23131284
has title: Spring MVC HelloWorld
tagged with: jakarta-ee
tagged with: spring-mvc
has comment: http://stackoverflow.com/comment/35364439
has answer: http://stackoverflow.com/a/23131295
tagged with: java
answer count: 5
has comment: http://stackoverflow.com/comment/35365636
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23132215
possible better answer: http://stackoverflow.com/a/23132772
has answer: http://stackoverflow.com/a/23132772
type: Question
tagged with: spring
has answer: http://stackoverflow.com/a/23132902
has body: I'm trying to run my helloWorld program using Spring web mvc but there is a problem in my JSP file .. it can't read the value of "message" attribute added to ModelMap .. the jsp page opens normally but it displays the jsp EL as it is ${message} .. not the value of message !! handler-servlet.xml <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" 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-4.0.xsd"> <context:component-scan base-package="com.shura" /> <property name="viewClass" value="org.springframework.web.servlet.view.JstlView"/> <property name="prefix" value="/WEB-INF/jsp/" /> <property name="suffix" value=".jsp" /> </beans> HelloWorld.java package com.shura; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; @Controller @RequestMapping("/hello") public class HelloWorld { @RequestMapping(method=RequestMethod.GET) public String printHello(ModelMap model){ model.addAttribute("message", "Hello World"); return("hello"); } } hello.jsp <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> Spring MVC Hello World Example ${message} web.xml Archetype Created Web Application handler org.springframework.web.servlet.DispatcherServlet 1 handler /
accepted answer: http://stackoverflow.com/a/23132215

http://stackoverflow.com/comment/35545445
has text: What exactly is the problem? You answered your own question: if you want to return the index you return i.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23232758

http://stackoverflow.com/comment/35460556
comment on: http://stackoverflow.com/q/23185209
has text: i have edited the question. please see it again..
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/122193029
has text: Note: `ViewPager2` **is** final, so it **cannot** be inherited from. `ViewPager` **is not** final, so it **can** be inherited from.
type: Comment
comment on: http://stackoverflow.com/a/23343470
score: 0
type: AnswerComment

http://stackoverflow.com/a/23281162
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/35634970
answers question: http://stackoverflow.com/q/23281130
score: 3
type: Answer
has comment: http://stackoverflow.com/comment/35634804
has body: When creating an array of objects, the elements of the array are assigned default values i.e null. (dont get confused with arrays of array of primitives. for eg: in case of primitve int the default values would be 0). Case 1: Array of Objects SoccerPlayers[] newPlayer = new SoccerPlayers[5]; // now all elements of newPlayer are null System.out.println(newPlayer[0]); // prints null Case 2 : Array of primitives int[] intArr = new int[5]; // now all elements are initialized to 0 (default value for primitive int) System.out.println(intArr[0]); // prints 0 So you have to create new objects and store them in the array as per your need. Change this : for (int i = 0; i &lt; newPlayer.length; i++){ // create objects of SoccerPlayers and store them in array newPlayer[i] = new SoccerPlayers(); newPlayer[i].PlayerCountry(); ......... .........
upvote count: 3
accepted answer of: http://stackoverflow.com/q/23281130

http://stackoverflow.com/a/23247722
type: Answer
score: 1
has body: If your goal is escape text for Java strings, then instead of regular expressions, consider using String escaped = org.apache.commons.lang.StringEscapeUtils. escapeJava("$('a:contains(\"CRUCERO\")')"); System.out.println(escaped); Output: $('a:contains(\"CRUCERO\")') JavaDoc: http://commons.apache.org/proper/commons-lang/javadocs/api-2.6/org/apache/commons/lang/StringEscapeUtils.html#escapeJava(java.lang.String)
upvote count: 1
answers question: http://stackoverflow.com/q/23246947
downvote count: 0

http://stackoverflow.com/comment/35490472
score: 1
comment on: http://stackoverflow.com/q/23202128
type: Comment
type: QuestionComment
has text: @user3550935 why does it start at 3 and not 0, 1, or 2? This seems like such a random problem to solve

http://stackoverflow.com/comment/129396354
type: QuestionComment
has text: Hi @haventchecked, I know it's too late but even I have the similar requirement, if possible can you please guide me on how to achieve with the custom itemReader?
score: 0
comment on: http://stackoverflow.com/q/23201676
type: Comment

http://stackoverflow.com/comment/35458544
comment on: http://stackoverflow.com/a/23184300
has text: @Andro-Begg You cannot do that. You have to do that in MediaDisplayFragment only.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/23163826
has answer: http://stackoverflow.com/a/23164130
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/23164130
type: Question
answer count: 1
has title: JAVA - sudoku weird bug
score: 0
has body: my sudoku solver works pretty well and right now all I am trying to do is "check" when the user clicks the "solve" button. This is a user-input taking custom sudoku, so based on user's inputs on the boxes, the solver will solve. I am trying to check whether the user is putting invalid values, such as " 1 1 2 3 4 5 6 7 8 ", which would be wrong because of " 1 1 ". Because I have my own checkRow, checkBox, checkCol methods, which are used to solve the puzzle, I was gonna check for any invalid values using those methods before running it - because if the user inputs invalid values the program will freeze. The very weird thing is that my sysout inserted to try and debug, I get the following: I, J, NUM 0 0 1 METHOD ROW : true MAIN R: false MAIN C: false MAIN B:false METHOD ROW : true Check: 0, 0, false METHOD ROW : true which METHOD shows the return value of checkRow method, and Main R showing the return value when called from the solve actionListener, which is positioned in main(). Threading issues?? I'm not too familiar with JAVA so I did put majority of my code in main(I know it's not good, but I am still learning). Thanks for any help in advance. solve.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent event) { solve.setEnabled(false); for (int i=0; i&lt;9; i++) { for (int j=0; j&lt;9; j++) { try { problem[i][j]=Integer.parseInt(board[i][j].getText()); System.out.println("I, J, NUM " +i+" "+j+" "+problem[i][j]); System.out.println("TOP R: " + checkRow(i, problem[i][j])); System.out.println("TOP C: " + checkCol(j, problem[i][j])); System.out.println(("TOP B:" + checkBox(i, j, problem[i][j]))); if(problem[i][j] != 0){ System.out.println ("Check: " + i +", "+j +", " +check(i, j, problem[i][j])); if( !check(i, j, problem[i][j])) { solve.setEnabled(true); JOptionPane.showMessageDialog(null, "Bad Input!"); clear_board(); return; } } }catch(NumberFormatException e) { problem[i][j] = 0; } } } try { solve_s(0,0); } catch (Exception e) {…
tagged with: sudoku

http://stackoverflow.com/q/23272174
has title: Error using Object Streams with SSL Sockets
tagged with: objectoutputstream
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23277881
tagged with: java
has comment: http://stackoverflow.com/comment/35623123
tagged with: objectinputstream
type: Question
has comment: http://stackoverflow.com/comment/35644096
tagged with: ssl
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/35618129
accepted answer: http://stackoverflow.com/a/23277881
has body: I have a pair of client-server java programs that are using secure communication for object transfer (using Object input and output streams). This program is a multi-client program and for each client a separate thread is used. Here is a snippet of the code below: final static private ServerSocketFactory serverFactory = SSLServerSocketFactory.getDefault(); final static private SocketFactory clientFactory = SSLSocketFactory.getDefault(); serverSocket = serverFactory.createServerSocket (port, 0, InetAddress.getByName("192.168.1.2")); while(running) { clientSocket = serverSocket.accept(); System.out.println("Client connected :: " + clientSocket); System.out.println("Creating client thread..."); Client c = new Client(count++, clientSocket); c.T.start(); } The thread which will handle the clients request: Client(int id, Socket cs){ T = new Thread(this, "Client Thread" + id); this.socket = cs; this.id = null; try{ input = new ObjectInputStream(cs.getInputStream()); output = new ObjectOutputStream(cs.getOutputStream()); successful = true; }catch(IOException ex){ successful = false; } } The code for client program is very similar. When I run both the programs and send the request from the client to the server, the server will accept the request but when execution reaches the lines where the Object Streams are retrieved from the socket, I get an error: javax.net.ssl.SSLHandshakeException: no cipher suites in common Can anyone help me with this? And are there better ways of using secure communication between client and server in java GUIs?
tagged with: sockets

dom
tags question: http://stackoverflow.com/q/23286568
type: Tag
tags question: http://stackoverflow.com/q/23260417
tags question: http://stackoverflow.com/q/23248788
tags question: http://stackoverflow.com/q/23147676
tag name: dom
tags question: http://stackoverflow.com/q/23267382

http://stackoverflow.com/comment/35445618
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23156281
has text: @Gene Well I have just added the source code too. Thank you.
type: AnswerComment

http://stackoverflow.com/comment/35460976
score: 0
comment on: http://stackoverflow.com/q/23184923
has text: @MTahir How to use AsyncTask??
type: Comment
type: QuestionComment

collision
tags question: http://stackoverflow.com/q/23256590
tags question: http://stackoverflow.com/q/23180453
tags question: http://stackoverflow.com/q/23169600
type: Tag
tags question: http://stackoverflow.com/q/23165381
tag name: collision

http://stackoverflow.com/q/23282247
has body: According to the CAS Java Client config guide you need to add an AuthenticationFilter to web.xml which will attempt to send all HTTP requests on to the CAS server. But what if I only want certain URLs authenticated? What if http://myapp.com/aboutUs doesn't require any authentication at all? Of course, if the user goes to https://myapp.com/login, then yes I want the AuthenticationFilter to kick in. But there are definitely some requests that I don't want auth for. Is this possible? If so, how?
type: UnansweredQuestion
tagged with: servlet-filters
tagged with: java
type: Question
tagged with: configuration
has answer: http://stackoverflow.com/a/23451589
score: 0
has title: How to configure CAS AuthenticationFilter
answer count: 1
tagged with: cas

http://stackoverflow.com/a/23177551
has comment: http://stackoverflow.com/comment/35492822
has body: "In which pane do I find the JMenuBar and how would I enable the JMenus? (And even the JMenuItems." The Root Pane of the JFrame holds the JMenuBar. JFrame.getRootPane().getJMenuBar(); Of course you can always just call JFrame.getJMenuBar(), without having to access the root pane. To get the menus of the menu bar, you can can JMenuBar.getSubElements which return the MenuElement[]. JMenu Also has getSubElements. Keep in mind though that a MenuELement can be JMenu or a JMenuItem, and a JMenu can have more layers of JMenus. So you will have to do some recursive calling if you wanted to try to access them this way. As for trying to access specific component types, check if (obj instanceof SomeComponentType) will help you in what you are trying to achieve.
downvote count: 0
answers question: http://stackoverflow.com/q/23177407
type: Answer
has comment: http://stackoverflow.com/comment/35482140
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/35482203
has comment: http://stackoverflow.com/comment/35492928
has comment: http://stackoverflow.com/comment/35447681

http://stackoverflow.com/comment/35403211
type: Comment
comment on: http://stackoverflow.com/q/23152758
has text: @Joffrey I didn't get how output came I didn't get 2 lines where we are getting and putting values.
score: 0
type: QuestionComment

http://stackoverflow.com/a/23225132
has comment: http://stackoverflow.com/comment/35532656
type: Answer
has body: According to JetBrains, idea64.exe uses this JDK search sequence: IDEA_JDK_64 environment variable ..\jre64 directory system Registry JDK_HOME environment variable JAVA_HOME environment variable If IDEA fails to auto-detect your JDK, try to set IDEA_JDK_64.
upvote count: 14
score: 14
has comment: http://stackoverflow.com/comment/35533018
accepted answer of: http://stackoverflow.com/q/23221957
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23221957
has comment: http://stackoverflow.com/comment/35534412

http://stackoverflow.com/q/23224412
type: UnansweredQuestion
upvote count: 0
tagged with: java
tagged with: http://stackoverflow.com/tag/json
favorite count: 0
tagged with: eclipse
type: Question
has body: private ArrayList&lt;Double&gt; celciusList = new ArrayList&lt;Double&gt;(); private ArrayList&lt;Double&gt; farenList = new ArrayList&lt;Double&gt;(); private ArrayList&lt;Double&gt; LDRlist = new ArrayList&lt;Double&gt;(); private ArrayList&lt;Double&gt; inchList = new ArrayList&lt;Double&gt;(); private ArrayList&lt;Double&gt; cmList = new ArrayList&lt;Double&gt;(); How do i possibly use this data information as my headings to print out in a .json file format?
score: -2
has comment: http://stackoverflow.com/comment/35530132
downvote count: 2
has answer: http://stackoverflow.com/a/23224566
answer count: 1
has title: How to read this data into a .json file format?

http://stackoverflow.com/q/23199870
has answer: http://stackoverflow.com/a/23199978
accepted answer: http://stackoverflow.com/a/23199978
tagged with: arrays
score: -1
has body: The 1st array's elements are arrays, so the 1st array contains four element-arrays. The 2nd array is a one dimensional array. My task is to test if each string of an element-array is present in the 2nd array. If present, the value should be printed. String[][] arr1 = { {"a", "b", "c", "d"}, {"a", "d", "f"}, {"d", "a", "b"}, {"a", "b", "c", "d"} }; String[] arr2 = {"a","b", "d","f"}; The output should be: a d f d a b How can I process these arrays for the needed output?
answer count: 1
downvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/35486017
has comment: http://stackoverflow.com/comment/35486258
has title: Comparing 2 dimensional Array to 1 dimensional Array in java
has comment: http://stackoverflow.com/comment/35486087
type: AnsweredQuestion
upvote count: 0
tagged with: java
type: Question

http://stackoverflow.com/q/23205345
has body: I have a string of length 15: "10101000000010". i want to take the exclusive like below of every alternative index in the array like show below ' int s = a[3] ^ a[ 5] ^ a[ 7] ^ a[ 9] ^ a[11] ^ a[13] ^ a[15];' //here ^ skips 1 index all the way up until the end of length of the string ' int t = a[3] ^ a[ 6] ^ a[ 7] ^ a[10] ^ a[11] ^ a[14] ^ a[15];' //here ^ skips 2 index and lets 2 go, skips 2 lets 2 go... and so on I dont know how to come about approaching this. Make a method with parameter the length of the array and have the method return an integer (0 or 1) which is primarily what its going to be since it's Exclusive or So to clear it up again... I want this to be done to any size array. like 17 now int z = a[3] ^ a[ 5] ^ a[ 7] ^ a[ 9] ^ a[11] ^ a[13] ^ a[15] ^ a[17] THIS IS FOR HAMMING CODE A byte of data: 10011010 Create the data word, leaving spaces for the parity bits: _ _ 1 _ 0 0 1 _ 1 0 1 0 Calculate the parity for each parity bit (a ? represents the bit position being set): Position 1 checks bits 1,3,5,7,9,11: ? _ 1 _ 0 0 1 _ 1 0 1 0. Even parity so set position 1 to a 0: 0 _ 1 _ 0 0 1 _ 1 0 1 0 Position 2 checks bits 2,3,6,7,10,11: 0 ? 1 _ 0 0 1 _ 1 0 1 0. Odd parity so set position 2 to a 1: 0 1 1 _ 0 0 1 _ 1 0 1 0 Position 4 checks bits 4,5,6,7,12: 0 1 1 ? 0 0 1 _ 1 0 1 0. Odd parity so set position 4 to a 1: 0 1 1 1 0 0 1 _ 1 0 1 0 Position 8 checks bits 8,9,10,11,12: 0 1 1 1 0 0 1 ? 1 0 1 0. Even parity so set position 8 to a 0: 0 1 1 1 0 0 1 0 1 0 1 0 Code word: 011100101010. ' int d[]=new int[7]; for(int i=0;i&lt;7;i++) { d[i]=sc.nextInt(); } int p[]=new int[4]; p[0]=d[0]^d[1]^d[3]^d[4]^d[6]; p[1]=d[0]^d[2]^d[3]^d[5]^d[6]; p[2]=d[1]^d[2]^d[3]; p[3]=d[4]^d[5]^d[6]; '
has comment: http://stackoverflow.com/comment/35496159
has comment: http://stackoverflow.com/comment/35496379
type: UnansweredQuestion
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/35496126
tagged with: java
has comment: http://stackoverflow.com/comment/35496185
has comment: http://stackoverflow.com/comment/35496131
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/23207894
has comment: http://stackoverflow.com/comment/35496114
has comment: http://stackoverflow.com/comment/35496239
has title: Find the exclusive OR in an Array by the index, Java
has comment: http://stackoverflow.com/comment/35496202
favorite count: 0
has answer: http://stackoverflow.com/a/23205533
has comment: http://stackoverflow.com/comment/35496165
score: 0
has comment: http://stackoverflow.com/comment/35496251

http://stackoverflow.com/a/24019118
answers question: http://stackoverflow.com/q/23249331
has body: I noticed that in netbeans Apache configuration in the servers tab. you can state the platform for your web application. I changed to 1.8 and it worked fine. (I am targeting java 8 platform in my application). Hope that might t help.
upvote count: 2
type: Answer
score: 2
downvote count: 0

http://stackoverflow.com/comment/35416450
type: Comment
type: QuestionComment
score: 2
has text: I'd suggest something like `Map<String,CellStyle>` to look up from the colours to the cell styles, where the `String` is the hex code of the colour you want
comment on: http://stackoverflow.com/q/23146787

http://stackoverflow.com/comment/35529692
type: Comment
has text: Hello - I do have a pom file, i updated my question to include mine
comment on: http://stackoverflow.com/a/23224069
score: 0
type: AnswerComment

http://stackoverflow.com/comment/35418719
type: QuestionComment
comment on: http://stackoverflow.com/q/23161362
has text: possible duplicate of [Make private methods final?](http://stackoverflow.com/questions/1984464/make-private-methods-final)
score: 4
type: Comment

http://stackoverflow.com/comment/35546627
has text: This wreaks of 'programming by magic'. And this time, the spell not only fails, but shoves a broken GUI in the user's face. -1
type: Comment
comment on: http://stackoverflow.com/a/23230503
type: AnswerComment
score: 0

http://stackoverflow.com/q/23280878
type: Question
has body: For the last few months I have been programming a 2d java racing game and have recently finished a very bare bones multiplayer implementation. This simply uses a server-client system where all world physics calculations are done on the server and then relayed to the client. The client does no calculations of its own but simply renders data from the server and sends the server user input data. I only update the client held positions when the object on the server side actually moves. The system works perfectly fine when sprites are moving at low speeds - however, at higher speeds, they look jittery. The standard Valve article on the subject prescribes interpolation as a way to make movement look more smooth, but I want to be careful before misdiagnosing a problem and making the system even more complicated before I've solved the underlying problem. What's making me wary about this solution is that I'm sending the client update messages sixty times a second, which should be enough to make the quality much higher. Are there any other bugs that have similar symptoms? Thanks for your time. Edit: If this seems vague, it's because it's supposed to be. I'm not asking for help in a specific situation, of for you to debug my code and figure out why it's not working. Unless I've made some awful error, I think my code does exactly what it's supposed to do, given the system described. I'm asking for a theoretical experience-based response as to the cause of the symptoms and what I should implement to solve this.
tagged with: network-programming
tagged with: java
tagged with: multiplayer
has title: Fixing jittery movement in a multiplayer game?
score: 2
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/23326059
has comment: http://stackoverflow.com/comment/35688555
type: AnsweredQuestion
upvote count: 2
has comment: http://stackoverflow.com/comment/35688494
accepted answer: http://stackoverflow.com/a/23326059

http://stackoverflow.com/q/23253494
has comment: http://stackoverflow.com/comment/35583222
has answer: http://stackoverflow.com/a/23254142
score: 0
tagged with: sql
answer count: 1
accepted answer: http://stackoverflow.com/a/23254142
has title: Create column with update statement
type: AnsweredQuestion
tagged with: java
tagged with: mysql
has comment: http://stackoverflow.com/comment/35582675
type: Question
has body: Is it possible to create a row with an update statement if it not exists? I am using java with mysql and i want to save some user data. If the user does not already have a row it should be created.

http://stackoverflow.com/comment/35626366
type: Comment
type: QuestionComment
has text: Ah sorry, forgot to edit that when I was simplyfing the code. Those values were array (int[]) lookups.
score: 0
comment on: http://stackoverflow.com/q/23276471

http://stackoverflow.com/comment/35393793
has text: It's very difficult assume code and problem by just reading the theory.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23147013

http://stackoverflow.com/a/23233651
score: 4
answers question: http://stackoverflow.com/q/23233600
accepted answer of: http://stackoverflow.com/q/23233600
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 4
has body: The problem is in this piece of code: } else { counter = 0; shots.remove(i); repaint(); } You remove an item from shots without adjusting numShots, causing an index out of bounds exception in one of subsequent iterations. To fix this, either add numShots-- in the else branch, or use the built-in size() method that returns the count of elements in a list instead: unlike numShots which you need to maintain, shots.size() never gets "out of sync" with the actual count.

http://stackoverflow.com/comment/35507353
score: 0
type: Comment
type: AnswerComment
has text: @Brian Roach - Take a look at the file I am getting after writing in binary mode. **dropbox.com/s/uuppgtobn9c66cl/test2201404221017.encmsg**
comment on: http://stackoverflow.com/a/23203109

http://stackoverflow.com/a/23270002
has body: Unfortunatly, I connot spot the problem, but I can give you some suggestions: Try to access that URL with another existing player. Does it work? Download the AAC file and store it locally. Do you get the same error if you load the file from local disk. If you think it's a bug, please file the issue here: https://javafx-jira.kenai.com
has comment: http://stackoverflow.com/comment/35613428
type: Answer
has comment: http://stackoverflow.com/comment/35617464
score: 0
answers question: http://stackoverflow.com/q/23208432

http://stackoverflow.com/q/23158782
favorite count: 0
has answer: http://stackoverflow.com/a/23159260
has answer: http://stackoverflow.com/a/23161398
type: AnsweredQuestion
has title: How to create a consecutive number by month
possible better answer: http://stackoverflow.com/a/23161398
tagged with: java
upvote count: 1
downvote count: 7
type: Question
has body: I'm create a java webapp and I have to create a consecutive number that should starts every month. The idea is to have something like this: 01-0414 / 02-0414 /03-0414 / 04-0414 where the first two digits should be the consecutive number, and the last four digits are the month and year. I'm using spring 3.2.2 and hibernate 4.2.6. I really appreciate any help about this. thanks
score: -6
accepted answer: http://stackoverflow.com/a/23159260
has comment: http://stackoverflow.com/comment/35586546
answer count: 2
has comment: http://stackoverflow.com/comment/35413777
has comment: http://stackoverflow.com/comment/35413903
has comment: http://stackoverflow.com/comment/35413799

http://stackoverflow.com/a/23169986
answers question: http://stackoverflow.com/q/23169505
upvote count: 11
has comment: http://stackoverflow.com/comment/35434530
type: AcceptedAnswer
downvote count: 0
has body: Small Note : Yes the properties might be a repeat but they have advantages Details below : If you look at the details here. Pizza pizza = new Pizza(12); pizza.setCheese(true); pizza.setPepperoni(true); pizza.setBacon(true); The problem here is that because the object is created over several calls it may be in an inconsistent state partway through its construction. This also requires a lot of extra effort to ensure thread safety. The better alternative is to use the Builder Pattern. Notice below method in Builder and respective constructor or parent Pizza class - full code in link here public static class Builder { public Pizza build() { // Notice this method return new Pizza(this); } } private Pizza(Builder builder) { // Notice this Constructor size = builder.size; cheese = builder.cheese; pepperoni = builder.pepperoni; bacon = builder.bacon; }
accepted answer of: http://stackoverflow.com/q/23169505
type: Answer
score: 11

http://stackoverflow.com/comment/35477390
comment on: http://stackoverflow.com/q/23192306
type: QuestionComment
type: Comment
has text: I wanted to count the no of zeros in an array containing only 1s and 0s sorted in descending.. I corrected the 3rd condition to 'if(input[mid]==1 && (mid==input.length-1 || input[mid+1]==0))' and it works fine now...
score: 0

http://stackoverflow.com/comment/35438346
has text: `Server charset: UTF-8 Unicode (utf8)` (I guess this is the one you are talking about).
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23172303
score: 0

http://stackoverflow.com/q/23266655
score: 0
has answer: http://stackoverflow.com/a/23287961
accepted answer: http://stackoverflow.com/a/23287961
answer count: 1
has title: Spring transaction + hibernate class cast exception
tagged with: spring
has comment: http://stackoverflow.com/comment/35619869
type: AnsweredQuestion
tagged with: jsf
tagged with: java
tagged with: hibernate
has body: I started to use openSessionInViewFilter for managing my session. I annotated my service method as @Transactional for clossing session, but following exception started to appear. This exception is raised when my annotated service method ends, which could be seen in stacktrace also. I'am using Spring 3, Hibernate 3, jsf 1.2. Stacktrace SEVERE: Servlet.service() for servlet Faces Servlet threw exception java.lang.ClassCastException: java.util.Date cannot be cast to java.lang.Long at org.hibernate.type.descriptor.java.LongTypeDescriptor.unwrap(LongTypeDescriptor.java:36) at org.hibernate.type.descriptor.sql.BigIntTypeDescriptor$1.doBind(BigIntTypeDescriptor.java:52) at org.hibernate.type.descriptor.sql.BasicBinder.bind(BasicBinder.java:91) at org.hibernate.type.AbstractStandardBasicType.nullSafeSet(AbstractStandardBasicType.java:283) at org.hibernate.type.AbstractStandardBasicType.nullSafeSet(AbstractStandardBasicType.java:278) at org.hibernate.type.AbstractSingleColumnStandardBasicType.nullSafeSet(AbstractSingleColumnStandardBasicType.java:89) at org.hibernate.persister.entity.AbstractEntityPersister.dehydrate(AbstractEntityPersister.java:2184) at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2558) at org.hibernate.persister.entity.AbstractEntityPersister.updateOrInsert(AbstractEntityPersister.java:2494) at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2821) at org.hibernate.action.EntityUpdateAction.execute(EntityUpdateAction.java:113) at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:273) at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:265) at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:185) at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:321) at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:51) at org.hibernate.impl.Sessio…
type: Question
has comment: http://stackoverflow.com/comment/35606364
has comment: http://stackoverflow.com/comment/35607129
tagged with: session

http://stackoverflow.com/comment/35717478
type: AnswerComment
has text: I understand why you say what you are saying. Ultimately, the question is, will you have a singleton PathMatcher (for a specific given pattern) in a production system.
type: Comment
comment on: http://stackoverflow.com/a/23290656
score: 0

http://stackoverflow.com/a/23251108
has comment: http://stackoverflow.com/comment/35578265
answers question: http://stackoverflow.com/q/23250947
type: AcceptedAnswer
downvote count: 0
has body: Change your main block as follow: int counter = 1; System.out.println("Printing prime numbers"); for (int numer = 2; counter &lt;= 100; numer++){ if (checkforprime(numer)) { System.out.println(numer); counter++; } } Here Counter will help to execute your loop until 100 prime numbers are displayed...............!
accepted answer of: http://stackoverflow.com/q/23250947
type: Answer
score: 2
upvote count: 2

http://stackoverflow.com/q/23212949
tagged with: batch-updates
has title: How can I fix java.sql.BatchUpdateException?
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/35511166
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35510063
score: 1
tagged with: java
tagged with: mysql
tagged with: prepared-statement
has answer: http://stackoverflow.com/a/23214029
type: Question
accepted answer: http://stackoverflow.com/a/23214029
has comment: http://stackoverflow.com/comment/35510039
has body: I write a java program that connect to mysql db with jdbc.It inserts records to mysql. The sql is this: INSERT INTO my_schema.my_table VALUES ('AMERICAN', '97', '1995-08-28 00:00:00', '10', '1995-08-28 00:00:00', '10', 'United States Dollar', 'USD', '$', '2', 'Y', 'Y', '1995-08-28 00:00:00', '_6064530F8DBAB938E040007F010015E3' ); But it gives this error: e = (java.sql.BatchUpdateException) java.sql.BatchUpdateException: 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 '('AMERICAN', '40', '1995-08-28 00:00:00', '10', '1995-08-28 00:00:00', '10', 'Ja' at line 1 But the weird thing is : I insert it manually without error. thanks in advance,
has comment: http://stackoverflow.com/comment/35510161
upvote count: 1
tagged with: sql

http://stackoverflow.com/a/23288101
score: 0
type: Answer
has body: You need to actually make the JFrame object public static void main(String[] args) { System.out.println("This Is It"); JFrame frame = new getData(); }
answers question: http://stackoverflow.com/q/23288050

http://stackoverflow.com/q/23154464
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/23154487
downvote count: 1
duplicate of: http://stackoverflow.com/q/19648240
type: Question
score: 0
answer count: 2
has title: How to print two dimetional array from method in java?
tagged with: arrays
accepted answer: http://stackoverflow.com/a/23154487
linked to: http://stackoverflow.com/q/19648240
favorite count: 0
tagged with: multidimensional-array
possible better answer: http://stackoverflow.com/a/23154485
has comment: http://stackoverflow.com/comment/35405873
has answer: http://stackoverflow.com/a/23154485
has body: How can I print the values in main method? How ca convert multidimensional array to string. How can I iterate the multidimensional array ? public class Javaclass { public Object[][] method4(){ String [][]type={{"prasad","manju","kishor","vinod"}, {"aaa","bbb","ccc","ddd"}}; return type; } public static void main(String[] args) { // TODO Auto-generated method stub Javaclass jc = new Javaclass(); System.out.println(Arrays.toString(jc.method4())); } }
type: AnsweredQuestion

http://stackoverflow.com/comment/35619354
type: QuestionComment
has text: You could do it with string reading, recursive is probably best: read element's start , find the element's end , and recursively do the same for children tags.
score: 0
comment on: http://stackoverflow.com/q/23273484
type: Comment

http://stackoverflow.com/comment/35426524
score: 2
has text: possible duplicate of [java.lang.LinkageError Error in Class Loading](http://stackoverflow.com/questions/6841769/java-lang-linkageerror-error-in-class-loading) -- summary: it's a duplicate library somewhere.
comment on: http://stackoverflow.com/q/23165637
type: Comment
type: QuestionComment

gradle
tags question: http://stackoverflow.com/q/23244528
tags question: http://stackoverflow.com/q/23242927
tags question: http://stackoverflow.com/q/23269346
tags question: http://stackoverflow.com/q/23288470
tags question: http://stackoverflow.com/q/23261075
tags question: http://stackoverflow.com/q/23274989
tags question: http://stackoverflow.com/q/23246248
tags question: http://stackoverflow.com/q/23220479
tags question: http://stackoverflow.com/q/23197894
tags question: http://stackoverflow.com/q/23206806
type: Tag
tags question: http://stackoverflow.com/q/23148214
tags question: http://stackoverflow.com/q/23139720
tags question: http://stackoverflow.com/q/23198138
tags question: http://stackoverflow.com/q/23286000
tag name: gradle
tags question: http://stackoverflow.com/q/23197739
tags question: http://stackoverflow.com/q/23251747
tags question: http://stackoverflow.com/q/23277034
tags question: http://stackoverflow.com/q/23211284
tags question: http://stackoverflow.com/q/23201235
tags question: http://stackoverflow.com/q/23169881
tags question: http://stackoverflow.com/q/23235225
tags question: http://stackoverflow.com/q/23162845
tags question: http://stackoverflow.com/q/23258582
tags question: http://stackoverflow.com/q/23283583

http://stackoverflow.com/a/23232618
has comment: http://stackoverflow.com/comment/35552235
score: 4
answers question: http://stackoverflow.com/q/23215415
upvote count: 4
has comment: http://stackoverflow.com/comment/35551549
accepted answer of: http://stackoverflow.com/q/23215415
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/35594882
has comment: http://stackoverflow.com/comment/35552132
has body: I'm trying to make heads and tails of your code... You fail to call super.paintComponent...this could lead you into a same serious issues if you're not careful. General rule of thumb, just call it ;) Be careful when modifiying the state of a Graphics context, for example... g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); Will affect ALL components painted after this one and could cause some interesting graphical glitches you weren't expecting... jf.getGlassPane().setVisible(false); glassPanel = new GlassPanel(); jf.getGlassPane().setVisible(true); Seems pointless, as the component set using jf.setGlassPane(glassPanel); will still be the component that is made visible when you call jf.getGlassPane().setVisible(true);. This also means that the GlassPane component is never used... Checking isVisible in paintComponent is pointless, as Swing is clever enough to know not to paint invisible components... Now, having said all that... If you wanted to paint on top of the BlurPanel you would either...paint content after the blurBuffer is drawn, so you are drawing ontop of it OR add another component onto the BlurPanel pane which contains the drawing logic you want to apply... This is a basic example of that concept. This adds another panel onto the glass pane which paints the custom frame of the panel as I want. This example uses personal library code and is intended as an example of the concept alone, not a completely runnable example. import core.ui.GlowEffectFactory; import core.ui.GraphicsUtilities; import core.util.ByteFormatter; import java.awt.BasicStroke; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Container; import java.awt.Dimension; import java.awt.EventQueue; import java.awt.Font; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Insets; import java.awt.Window; import java.awt.event.ActionEvent; import java.awt.e…
type: Answer
has comment: http://stackoverflow.com/comment/35551685
has comment: http://stackoverflow.com/comment/35551712

http://stackoverflow.com/a/54573055
has body: Simple way to convert xls/xlsx into csv by using apache POI. public class XLSXToCSVConverter { public InputStream convertxlstoCSV(InputStream inputStream) throws IOException, InvalidFormatException { Workbook wb = WorkbookFactory.create(inputStream); return csvConverter(wb.getSheetAt(0)); } private InputStream csvConverter(Sheet sheet) { Row row = null; String str = new String(); for (int i = 0; i &lt; sheet.getLastRowNum()+1; i++) { row = sheet.getRow(i); String rowString = new String(); for (int j = 0; j &lt; 3; j++) { if(row.getCell(j)==null) { rowString = rowString + Utility.BLANK_SPACE + Utility.COMMA; } else { rowString = rowString + row.getCell(j)+ Utility.COMMA; } } str = str + rowString.substring(0,rowString.length()-1)+ Utility.NEXT_LINE_OPERATOR; } System.out.println(str); return new ByteArrayInputStream(str.getBytes(StandardCharsets.UTF_8)); } }
type: Answer
answers question: http://stackoverflow.com/q/23201427
has comment: http://stackoverflow.com/comment/116860369
score: 0

http://stackoverflow.com/comment/35460586
type: QuestionComment
comment on: http://stackoverflow.com/q/23185354
score: 0
has text: In this code Request has been successfully sent. But without parameters.
type: Comment

http://stackoverflow.com/a/24550565
type: AcceptedAnswer
upvote count: 13
type: Answer
downvote count: 0
score: 13
accepted answer of: http://stackoverflow.com/q/23201663
answers question: http://stackoverflow.com/q/23201663
has body: The method execute(Request) is undefined for the type OkHttpClient You are getting this exception because there is no such method ie.execute(Request) for OkHttpClient. Rather it is invoked on Call object which is obtained using OkHttpClient object as follows: Call call = client.newCall(request); Response response = call.execute(); I think you should be using Response response = client.newCall(request).execute(); instead of Response response = client.execute(request); OkHttp docs OkHttp Blog

http://stackoverflow.com/a/48218052
type: Answer
answers question: http://stackoverflow.com/q/23153916
has body: Alternatively, you can use the following class: import javax.swing.*; import javax.swing.border.Border; import javax.swing.border.CompoundBorder; import javax.swing.border.EmptyBorder; import javax.swing.border.MatteBorder; import javax.swing.event.CaretEvent; import javax.swing.event.CaretListener; import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentListener; import javax.swing.text.*; import java.awt.*; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import java.util.HashMap; /** * This class will display line numbers for a related text component. The text * component must use the same line height for each line. TextLineNumber * supports wrapped lines and will highlight the line number of the current * line in the text component. * &lt;p&gt; * This class was designed to be used as a component added to the row header * of a JScrollPane. */ public class TextLineNumber extends JPanel implements CaretListener, DocumentListener, PropertyChangeListener { public final static float LEFT = 0.0f; public final static float CENTER = 0.5f; public final static float RIGHT = 1.0f; private final static Border OUTER = new MatteBorder(0, 0, 0, 2, Color.GRAY); private final static int HEIGHT = Integer.MAX_VALUE - 1000000; // Text component this TextTextLineNumber component is in sync with private JTextComponent component; // Properties that can be changed private boolean updateFont; private int borderGap; private Color currentLineForeground; private float digitAlignment; private int minimumDisplayDigits; // Keep history information to reduce the number of times the component // needs to be repainted private int lastDigits; private int lastHeight; private int lastLine; private HashMap&lt;String, FontMetrics&gt; fonts; /** * Create a line number component for a text component. This minimum * display width will be based on 3 digits. * * @param component the related text component */ public TextLineNumber(JTextComponent component) { …
score: 0

http://stackoverflow.com/a/23287955
answers question: http://stackoverflow.com/q/23287851
downvote count: 0
type: Answer
has body: Perhaps refactoring the method this way would make the code less complex and more readable: public boolean isSorted(int[] sequence) { for (int idx = 1; idx &lt; sequence.length; idx++) { if (sequence[idx] &lt; sequence[idx-1]) return false; } return true; }
upvote count: 2
score: 2

http://stackoverflow.com/comment/35502438
has text: I see, I have almost figured out a way of doing this. How can I count how many non-null values are in an array?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23208647
type: Comment

http://stackoverflow.com/comment/35537027
type: QuestionComment
has text: ok. sorry.. PERSONNEW has 5 colums personid,firsnatname,lastname street and city inthat order the order2 table has 3 colums orderid,orderno and personid
score: 0
comment on: http://stackoverflow.com/q/23228108
type: Comment

http://stackoverflow.com/a/23227438
type: Answer
accepted answer of: http://stackoverflow.com/q/23227138
answers question: http://stackoverflow.com/q/23227138
downvote count: 0
score: 1
has body: The answer to this question depends on what you understand as invalid characters. ASCII truncation A simple check would be to check if the code point lies within a certain range. The lowest printable character is a space. It's decimal value is 32. The highest ASCII character is ~ with a decimal value of 126. This would truncate it to the range of printable ASCII characters, which is bad for anyone using accents or similar. Printability Another approach is to check whether a character is printable for a certain font. You can use the java.awt.Font class for that. It provides a method canDisplay, which returns if the font has a glyph to display that very character. This could work, but feels really awful. But this could be what you want, we can't know. Valid letter or number Another criteria might be if the letter is a valid letter or number. The java.lang.Character class provides the method isLetter and isDigit to determine this. Charsets We all know TANSTAPT, so you might well have used the wrong charset. Find out if you're using the same charset as Excel. If these criterias don't fit your intent, you'll have to further specify your needs.
type: AcceptedAnswer
upvote count: 1

http://stackoverflow.com/a/23232335
upvote count: 1
score: 0
has body: In your statusbar in the bottom right corner of the eclipse window all running tasks are shown. If you don't have any pending tasks, this corner is empty. While the compiler work, you see the current task there.
downvote count: 1
has comment: http://stackoverflow.com/comment/35549497
answers question: http://stackoverflow.com/q/23232244
type: Answer

http://stackoverflow.com/comment/35449057
has text: Well, sir... do a search for ^M in this page: http://en.wikipedia.org/wiki/Newline, and I tried your solution with some non-real-world example, and it works... I guess I will keep googling... Thanks again.
type: Comment
comment on: http://stackoverflow.com/a/23178447
score: 0
type: AnswerComment

http://stackoverflow.com/comment/112191237
type: AnswerComment
comment on: http://stackoverflow.com/a/29967201
type: Comment
score: 1
has text: Better late than never, I've created https://github.com/skjolber/json-log-filter

http://stackoverflow.com/comment/35448444
has text: What are you trying to do? You want to output a string that replaces the # with a space? Or put them in separate variables?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23178214

http://stackoverflow.com/q/23161992
favorite count: 0
has answer: http://stackoverflow.com/a/23162314
tagged with: regex
has body: I'm trying code a program to recognize what hand you have while playing poker. The pattern object i'm creating is in the format to check for five cards, with each card defined by the value and then the suit. So for example, ace of spades would be denoted as As. I have the following code to recognize a straight, but it only works if it's in order. How would I make it recognize a string like 5d4sAc3s2h as a straight? Thanks for any help! Pattern[] floppedStraightCheck; floppedStraightCheck = new Pattern[10]; floppedStraightCheck[0] = Pattern.compile("(([aA][scdhSCDH])([2][scdhSCDH])([3][scdhSCDH])([4][scdhSCDH])([5][scdhSCDH])");
has comment: http://stackoverflow.com/comment/35420196
has answer: http://stackoverflow.com/a/23162240
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35420729
has comment: http://stackoverflow.com/comment/35420090
has comment: http://stackoverflow.com/comment/35419897
has title: Regular expression match in any order
upvote count: 5
tagged with: java
type: Question
answer count: 2
score: 5
downvote count: 0

http://stackoverflow.com/comment/35459482
comment on: http://stackoverflow.com/a/23184840
type: AnswerComment
score: 0
type: Comment
has text: I've closed and reopened it and the same thing happens.

http://stackoverflow.com/comment/35430282
has text: Hello Abdul. Do you know what kind of mathematical function would plot an ecg-like plot? That is what you think about first, then try to implement that and if you get stuck at that point somewhere, you should rephrase your question.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23167879
score: 1

http://stackoverflow.com/comment/35425586
comment on: http://stackoverflow.com/a/23165005
has text: You only have to create a `JLabel`, the way you did with `JTextField`. Then, in the `actionPerformed` of `text`, you add `label.setText(text.getText())`.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/23202046
has answer: http://stackoverflow.com/a/26881520
has comment: http://stackoverflow.com/comment/35490173
score: 95
has comment: http://stackoverflow.com/comment/42319170
linked to: http://stackoverflow.com/q/11536848
tagged with: ssl
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35489981
has title: What is Keystore?
has answer: http://stackoverflow.com/a/26888423
has body: I have been getting: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target . . Caused by: javax.net.ssl.SSLHandshakeException: sun.security.validator. ValidatorException: PKIX path building failed: sun.security.provider. certpath.SunCertPathBuilderException: unable to find valid certification path to requested target Searching on how to resolve this exception I have come across the term Keystore which I do not understand. What is Keystore in simple terms? How it is related to SSL?
linked to: http://stackoverflow.com/q/6340918
downvote count: 0
favorite count: 0
upvote count: 95
has answer: http://stackoverflow.com/a/59054300
type: Question
has comment: http://stackoverflow.com/comment/42318295
tagged with: keystore
has comment: http://stackoverflow.com/comment/35489978
tagged with: java
has comment: http://stackoverflow.com/comment/35490205
answer count: 3

http://stackoverflow.com/comment/35539734
type: Comment
has text: yes, I was trying to look for a duplicate too, since I thought I just saw the same question a few months ago with a good answer. Maybe it got deleted. But I did find an older answer of Jon Skeet's that I linked.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23229502

http://stackoverflow.com/comment/35550457
type: Comment
comment on: http://stackoverflow.com/a/23235539
has text: How does your answer expand on, or add to, the well established Q and A this question is a Dup of?
score: 0
type: AnswerComment

http://stackoverflow.com/q/23146584
possible better answer: http://stackoverflow.com/a/23146661
type: Question
has answer: http://stackoverflow.com/a/23146661
tagged with: arrays
downvote count: 0
has comment: http://stackoverflow.com/comment/35393939
has answer: http://stackoverflow.com/a/23147163
answer count: 2
accepted answer: http://stackoverflow.com/a/23147163
favorite count: 0
tagged with: user-input
has title: Why is my code always allowing duplicate names?
has comment: http://stackoverflow.com/comment/35393547
type: AnsweredQuestion
score: 1
has body: I have a question about writing a code that can check if what the user inputs (a string) is a duplicate of a string that an array already stored: First of all I want to point out I checked with the question on here about duplicates but they are either answered with importing packages other than Scanner or checking duplicates in an already int or string stored arrays. This is different: int numberOfPigs = Integer.parseInt( keyboard.nextLine() ); Pigs pigArray = new pigs[numberOfPigs]; for (int i = 0; i &lt; pigArray.length; i++){ System.out.println("Pig name: " + (i+1)); String name = keyboard.nextLine(); String [] tempArray = new String [numberOfPigs]; tempArray[i]=name; for (int k = i+1; k &lt; pigArray.length; k++){ while (tempArray[i].equals( tempArray[k])){ System.out.println("The ID is duplicate."); tempArrays[i] = keyboard.nextLine(); } System.out.println("Not a duplicate! Yay."); } ...code not over. the for loop with int i still has to go through several inputs from user before looping back to the beginning and go through i++ with taking in the next pig name. The rest part of the code I have no problem with, it's just that whenever i run this code, the duplicates are still allowed in... Any tips are appreciated. Thank you.
tagged with: java
tagged with: duplicates
upvote count: 1
has comment: http://stackoverflow.com/comment/35393506

http://stackoverflow.com/q/23174520
has comment: http://stackoverflow.com/comment/35442158
answer count: 1
has answer: http://stackoverflow.com/a/23226880
score: 0
has body: I have been trying to add in .ttf fonts to my android mobile application. I am using the Libgdx engine to create my application, and have tried to add in the True Type extension to allow the use of .ttf fonts. Here is the code that I am running to try and create a font. FreeTypeFontGenerator generator = new FreeTypeFontGenerator(Gdx.files.internal("data/fonts/font.ttf")); BitmapFont font = generator.generateFont(12); generator.dispose(); When I call this code, my application gives me the Unfortunately, X has stopped. message and no other information. I have included the gdx-freetype-sources.jar and the gdx-freetype.jar in both the core and android projects. I have clicked the option to export them on both projects. And I have included the two libgdx-freetype.so files in the armeabi and armeabi-v7a folders. Can anyone tell me why this is not working? Edit: Here is my error output code in the 'LogCat' 04-19 15:33:08.479: E/AndroidRuntime(31195): FATAL EXCEPTION: GLThread 7533 04-19 15:33:08.479: E/AndroidRuntime(31195): Process: com.zach.nice, PID: 31195 04-19 15:33:08.479: E/AndroidRuntime(31195): java.lang.NoSuchFieldError: com.badlogic.gdx.graphics.g2d.BitmapFont$Glyph.id 04-19 15:33:08.479: E/AndroidRuntime(31195): at com.badlogic.gdx.graphics.g2d.freetype.FreeTypeFontGenerator.generateData(FreeTypeFontGenerator.java:288) 04-19 15:33:08.479: E/AndroidRuntime(31195): at com.badlogic.gdx.graphics.g2d.freetype.FreeTypeFontGenerator.generateFont(FreeTypeFontGenerator.java:137) 04-19 15:33:08.479: E/AndroidRuntime(31195): at com.badlogic.gdx.graphics.g2d.freetype.FreeTypeFontGenerator.generateFont(FreeTypeFontGenerator.java:148) 04-19 15:33:08.479: E/AndroidRuntime(31195): at com.zach.nice.Nice.create(Nice.java:53) 04-19 15:33:08.479: E/AndroidRuntime(31195): at com.badlogic.gdx.backends.android.AndroidGraphics.onSurfaceChanged(AndroidGraphics.java:292) 04-19 15:33:08.479: E/AndroidRuntime(31195): at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1…
tagged with: android
has title: LIBGDX FreeTypeFontGenerator - Crash on Android
type: UnansweredQuestion
tagged with: truetype
linked to: http://stackoverflow.com/q/19877955
type: Question
tagged with: libgdx
tagged with: java
has comment: http://stackoverflow.com/comment/35442266
has comment: http://stackoverflow.com/comment/35442016

object
tags question: http://stackoverflow.com/q/23152199
tags question: http://stackoverflow.com/q/23218248
tags question: http://stackoverflow.com/q/23277777
tags question: http://stackoverflow.com/q/23165956
tag name: object
tags question: http://stackoverflow.com/q/23233925
tags question: http://stackoverflow.com/q/23232020
tags question: http://stackoverflow.com/q/23181358
tags question: http://stackoverflow.com/q/23270459
tags question: http://stackoverflow.com/q/23194702
tags question: http://stackoverflow.com/q/23144850
tags question: http://stackoverflow.com/q/23245019
tags question: http://stackoverflow.com/q/23279140
tags question: http://stackoverflow.com/q/23160481
tags question: http://stackoverflow.com/q/23174116
tags question: http://stackoverflow.com/q/23165611
tags question: http://stackoverflow.com/q/23174138
tags question: http://stackoverflow.com/q/23178398
tags question: http://stackoverflow.com/q/23171207
tags question: http://stackoverflow.com/q/23233839
tags question: http://stackoverflow.com/q/23177900
tags question: http://stackoverflow.com/q/23264857
tags question: http://stackoverflow.com/q/23222828
tags question: http://stackoverflow.com/q/23165449
tags question: http://stackoverflow.com/q/23145416
tags question: http://stackoverflow.com/q/23279329
tags question: http://stackoverflow.com/q/23245781
tags question: http://stackoverflow.com/q/23137392
tags question: http://stackoverflow.com/q/23138528
tags question: http://stackoverflow.com/q/23246803
tags question: http://stackoverflow.com/q/23130695
tags question: http://stackoverflow.com/q/23254659
tags question: http://stackoverflow.com/q/23179683
tags question: http://stackoverflow.com/q/23271686
tags question: http://stackoverflow.com/q/23158493
type: Tag
tags question: http://stackoverflow.com/q/23138905
tags question: http://stackoverflow.com/q/23187111

http://stackoverflow.com/q/23213869
upvote count: 4
answer count: 2
linked to: http://stackoverflow.com/q/22053683
downvote count: 0
accepted answer: http://stackoverflow.com/a/23221294
favorite count: 0
linked to: http://stackoverflow.com/q/20551681
has answer: http://stackoverflow.com/a/23214143
tagged with: spring
has answer: http://stackoverflow.com/a/23221294
has title: Defining a spring active profile within a test use case
type: AnsweredQuestion
tagged with: java
type: Question
tagged with: spring-test
possible better answer: http://stackoverflow.com/a/23214143
has body: Using Spring 4, I've got the following test setup: @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(classes = JpaConfig.class) @ActiveProfiles(resolver = TestResolver.class) public class SimpleTest { The TestResolver has been implemented as: public class TestResolver implements ActiveProfilesResolver { @Override public String[] resolve(Class&lt;?&gt; aClass) { String[] profiles = new String[1]; profiles[0] = "test"; return profiles; } } JpaConfig has been annotated with PropertySource @Configuration @PropertySource("classpath:properties/application-${spring.profiles.active:dev}.properties") @EnableJpaRepositories(basePackages={"com.my.namespace.repositories"}) public class JpaConfig { Whenever I run the SimpleTest it tries to locate: properties/application-dev.properties while I expected it to be properties/application-test.properties. What's I'm trying to accomplish here has been based on the following post: Spring integration tests with profile
score: 4

http://stackoverflow.com/comment/35572213
comment on: http://stackoverflow.com/q/23247816
score: 0
has text: I suggest you pick a language, Java or C#.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/64873819
has comment: http://stackoverflow.com/comment/114699118
answers question: http://stackoverflow.com/q/23273230
type: Answer
upvote count: 3
has body: Simple, Should use @Spy annotation with @InjectMocks annotation.
score: -2
downvote count: 5

http://stackoverflow.com/q/23211589
has title: Error(1,1)illegalcharacter '\ufeff' when compiling on android studio
has answer: http://stackoverflow.com/a/54978330
has comment: http://stackoverflow.com/comment/35508323
downvote count: 0
has answer: http://stackoverflow.com/a/57809483
tagged with: ide
has comment: http://stackoverflow.com/comment/35507821
answer count: 16
score: 43
has answer: http://stackoverflow.com/a/52271355
has comment: http://stackoverflow.com/comment/35507409
has answer: http://stackoverflow.com/a/60584328
has answer: http://stackoverflow.com/a/38240423
tagged with: android
has answer: http://stackoverflow.com/a/44421778
favorite count: 0
tagged with: android-studio
has answer: http://stackoverflow.com/a/40312066
has comment: http://stackoverflow.com/comment/35507498
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/30199828
has answer: http://stackoverflow.com/a/28664104
linked to: http://stackoverflow.com/q/17151830
has comment: http://stackoverflow.com/comment/35507833
has answer: http://stackoverflow.com/a/33644948
has body: I got an Eclipse project source code(I was told that on Android Studio, maybe they just confused), and I start to migrating the code to android studio refers to http://developer.android.com/sdk/installing/migrate.html But it doesn't work. so I import the project from path directly and it transfers to the android-studio project automatically, but still, something wrong when I am compiling. Error:(1, 1) error: illegalcharacter: '\ufeff' the error position refers to package com.bla.blabla; Please help me, thanks
has answer: http://stackoverflow.com/a/46703815
has answer: http://stackoverflow.com/a/41148203
has comment: http://stackoverflow.com/comment/57519774
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/42247524
has answer: http://stackoverflow.com/a/77198374
upvote count: 43
has answer: http://stackoverflow.com/a/49695459
has answer: http://stackoverflow.com/a/58092951

http://stackoverflow.com/q/23185608
has comment: http://stackoverflow.com/comment/35467834
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/35461007
has answer: http://stackoverflow.com/a/23185634
has answer: http://stackoverflow.com/a/23186106
score: 0
has comment: http://stackoverflow.com/comment/35461529
has title: reading input and calling the array index
has body: I'll try explaining my problem without listing code since it is an assignment and I don't want any plagiarism occurring, but if needs be then I will post it up. I'm currently reading entries from a text file, like the following : John James 383838 Paul Size 38525 Steve Dog 45455 I have my scanInput class setup to do this. I can call e.g. getNumber() and it will only ever return the most recent one. In this case being 45455. I am using a counter in my method e.g. array[count].setNumber and then once it's read through the 3 surname, initial and number it goes count++; So I assume it should then go back into the while loop and read the others. I'm a bit confused. No matter which index I call it'll always return the most recent one. For example object.ScanInput(); System.out.println(object.getEntry()[2].getNumber()); will return the same value ( the most recent entry number in the txt file ). So it doesn't matter which index is called, the same value is always returned.
has comment: http://stackoverflow.com/comment/35461095
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35461123
tagged with: java
has comment: http://stackoverflow.com/comment/35460971

http://stackoverflow.com/comment/35707801
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23286834
has text: Kaczy, thank you for help. I need every endpoint to be processed using only it's separate thread (i.e. one thread per consumer, but by default camel creates 4 threads: every consumer have 2 processing threads). I'll try seda. Thanks a lot.

http://stackoverflow.com/q/23156396
possible better answer: http://stackoverflow.com/a/23156539
has body: I need Help. I want a toast to show the Internet status in my application. It is working good for wifi and mobile data packet (Mobile Internet ). But when Internet is totally disconnected it shows nothing. I don't know how to do this. here is my code public class ConnectivityReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { Log.d("myapp", "action: " + intent.getAction()); ConnectivityManager cm = (ConnectivityManager)context.getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo activeNetwork = cm.getActiveNetworkInfo(); boolean isConnected = activeNetwork != null &amp;&amp; activeNetwork.isConnectedOrConnecting(); if(isConnected) { if(activeNetwork.getType() == ConnectivityManager.TYPE_WIFI) { Toast toast = Toast.makeText(context, "Connected to wifi", Toast.LENGTH_LONG); toast.show(); } else if(activeNetwork.getType() == ConnectivityManager.TYPE_MOBILE) { Toast toast = Toast.makeText(context, "Connected to Mobile Data Pakage", Toast.LENGTH_LONG); toast.show(); } else { Toast toast = Toast.makeText(context, "Not Connected", Toast.LENGTH_LONG); toast.show(); } also try this but compiler show error. Kindly help me. Thanks in advance. else if(activeNetwork.getType() == ConnectivityManager.EXTRA_NO_CONNECTIVITY) { Toast toast = Toast.makeText(context, "Not Connected", Toast.LENGTH_LONG); toast.show(); Manifesto &lt;receiver android:name="com.networkstatechange.ConnectivityReceiver" &gt; &lt;intent-filter&gt; &lt;action android:name="android.net.conn.CONNECTIVITY_CHANGE" /&gt; &lt;/intent-filter&gt; &lt;/receiver&gt;
tagged with: android
tagged with: android-intent
has comment: http://stackoverflow.com/comment/35409407
tagged with: android-toast
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23156530
has title: How to show internet not connected in android
tagged with: java
has answer: http://stackoverflow.com/a/23156473
accepted answer: http://stackoverflow.com/a/23156473
has answer: http://stackoverflow.com/a/23156539
type: Question
score: 0
answer count: 3

http://stackoverflow.com/a/23255668
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23255484
score: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/23255484
has body: In that case, move the contents of the actionPerformed method to the class and then invoke that method from within actionPerformed. For example: private void buttonPressed { pTurn++; if(pTurn % 2 == 0) { display.append("\n Player 2 Cup 1"); } if(pTurn % 2 !=0) { display.append("\n Player 1 Cup 1")} } } Then in your actionPerformed method: button1.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { OuterClass.this.buttonPressed(); } } ); Where OuterClass is the name of your class.

http://stackoverflow.com/comment/35417910
has text: @AnubianNoob: incorrect. See, for example, [GObject](https://developer.gnome.org/gobject/stable/).
type: Comment
comment on: http://stackoverflow.com/q/23160896
type: QuestionComment
score: 2

http://stackoverflow.com/a/59964029
has body: public class StackProb { public static void main(String[] args) { Scanner sc = new Scanner(System.in); List&lt;Boolean&gt; list = new ArrayList&lt;&gt;(); while (sc.hasNextLine()) { String s=sc.nextLine(); if(!s.isEmpty()) { list.add(isBalanced(s)); //System.out.println(isBalanced(s)); }else { sc.close(); break; } } for (int i = 0; i &lt; list.size(); i++) { System.out.println(list.get(i) + " "); } } private static boolean isBalanced(String s) { boolean res = false; Stack&lt;Character&gt; stack = new Stack(); int countA = 0; int countB = 0; for (int i = 0; i &lt; s.length(); i++) { if(s.charAt(i)=='{' || s.charAt(i)=='(' || s.charAt(i)=='[') { stack.push(s.charAt(i)); countA++; } if(s.charAt(i)=='}' || s.charAt(i)==')' || s.charAt(i)==']') { stack.push(s.charAt(i)); countB++; } if(stack.firstElement()=='}' || stack.firstElement()==')' || stack.firstElement()==']') { countB++; } } if(countA==countB) { return true; } return false; } }
score: 0
has comment: http://stackoverflow.com/comment/106045226
answers question: http://stackoverflow.com/q/23187539
type: Answer

http://stackoverflow.com/q/23235502
tagged with: java
duplicate of: http://stackoverflow.com/q/513832
has comment: http://stackoverflow.com/comment/35550202
type: Question
score: -1
has title: when does java create a new object for string
has answer: http://stackoverflow.com/a/23235550
upvote count: 3
accepted answer: http://stackoverflow.com/a/23235550
linked to: http://stackoverflow.com/q/2486191
linked to: http://stackoverflow.com/q/3801343
answer count: 1
duplicate of: http://stackoverflow.com/q/2486191
favorite count: 0
linked to: http://stackoverflow.com/q/2009228
has body: When we do String a=new String("mac"); String b=new String("mac"); if(b == a) { System.out.println("condition 1 is true"); } if(b.equals(a)) { System.out.println("condition 2 is true"); } condition 1 fails and condition 2 is true since b and a are two different objects But when we do String a="mac"; String b="mac"; if(b == a) { System.out.println("condition 1 is true"); } if(b.equals(a)) { System.out.println("condition 2 is true"); } Both the conditions are true. Why didn't java create a new object for second case. If java creates a new object only when we use new() then if we give different values to both the strings then what happens internally in java?
downvote count: 4
linked to: http://stackoverflow.com/q/513832
has comment: http://stackoverflow.com/comment/35550204
type: AnsweredQuestion

http://stackoverflow.com/comment/35524329
type: QuestionComment
comment on: http://stackoverflow.com/q/23221189
has text: Added some more code in, that's all I have
score: 0
type: Comment

http://stackoverflow.com/comment/35573379
type: QuestionComment
has text: Wait would it not be more correct to say previous = null; since previus is pointing to the last node?
comment on: http://stackoverflow.com/q/23248278
score: 0
type: Comment

http://stackoverflow.com/q/23213498
has body: Guys am trying to close frame within applet... my program is working but the problem is that the frame which will get created within applet is not closing... what should i do... it gives me Exception while closing frame window: C:\jdk1.6.0\bin&gt;appletviewer me.java Exception in thread "AWT-EventQueue-1" java.security.AccessControlException: access denied (java.lang.RuntimePermission exitVM.0) at java.security.AccessControlContext.checkPermission(AccessControlContext.java:323) at java.security.AccessController.checkPermission(AccessController.java:546) Here is my code: import java.awt.*; import java.applet.*; import java.awt.event.*; /*&lt;applet code="me.class" height=500 width=500&gt;&lt;/applet&gt;*/ class se extends Frame { String msg; public se() { msg="This is Frame"; addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }); } public void paint(Graphics g) { g.drawString(msg,10,100); } } public class me extends Applet { public void init() { se s1=new se(); s1.setSize(400,400); s1.setVisible(true); s1.setTitle("The JAVA GAMER"); } public void paint(Graphics g) { g.drawString("This is Applet",10,100); } }
answer count: 1
tagged with: frame
has comment: http://stackoverflow.com/comment/35551637
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/6255106
tagged with: java
has answer: http://stackoverflow.com/a/23236494
has comment: http://stackoverflow.com/comment/35566353
tagged with: accesscontrolexception
type: Question
has title: How to close frame within applet?
tagged with: applet
tagged with: awt
score: 0

http://stackoverflow.com/comment/35636987
comment on: http://stackoverflow.com/q/23282129
has text: The error message indicates it's looking for a java source file named zetcode/Version.java. The tutorial has the source included so you could create the file by cut and paste then run the javac command again. The zetcode directory is the Java package name.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/67032793
comment on: http://stackoverflow.com/q/23169559
has text: did you solved it??
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/35408563
type: AnswerComment
comment on: http://stackoverflow.com/a/23155987
type: Comment
has text: My problem is is that I have no idea what to put in the code portion of the for loop.
score: 0

http://stackoverflow.com/a/23158966
score: 0
has body: YOu can read whole line and split that line on whitespaces. Print the info you want. See String#split() Something like below (scanner.hasNextLine()) { // Split the line and return array of String String[] line = scanner.nextLine().split("\\s+"); // get you info // print your info }
answers question: http://stackoverflow.com/q/23158871
type: Answer

http://stackoverflow.com/q/23156135
has comment: http://stackoverflow.com/comment/35408668
has body: Hello world, I made an instant messenger with the server and the client that runs on a localhost, but I want to put the client on another computer but it cannot connect to the server without the localhost, please can I get some help(codes) that i can use to connect the client on another computer to the server on my own computer without the use of a localhost.
favorite count: 0
has answer: http://stackoverflow.com/a/23156167
type: AnsweredQuestion
tagged with: java
score: 0
upvote count: 1
possible better answer: http://stackoverflow.com/a/23156241
downvote count: 1
has answer: http://stackoverflow.com/a/23156241
type: Question
has comment: http://stackoverflow.com/comment/35408659
accepted answer: http://stackoverflow.com/a/23156167
has title: Java - Connecting a client to a server without the localhost
has comment: http://stackoverflow.com/comment/35408865
answer count: 2

http://stackoverflow.com/comment/35550970
score: 2
comment on: http://stackoverflow.com/q/23235826
has text: Just because some threads are waiting doesn't mean that the program will take more time to complete. All your parallel tasks are competing for some shared resources (CPU, memory, network, database?), and just throwing more threads at the problem won't magically make the code faster (it's usually the opposite). If your tasks are CPU-bound, for example, having a number of threads equal to the number of CPU cores has a good chance of making the code faster than with 100 or more threads. Threads cost memory, and switching between threads takes time.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23185587
score: 0
answer count: 1
tagged with: client
type: UnansweredQuestion
has body: Guys am sick of this client and server chat program plz help me my program is compiled and runing but the problem is that when i trying to pass the msg to the server its not working it pass by itself..now what correction i do... Server Code: import java.io.*; import java.net.*; class serv { ServerSocket s; Socket c; DataInputStream dis; DataOutputStream dos; BufferedReader disi; public serv() { try { s = new ServerSocket(2000,0,InetAddress.getLocalHost()); System.out.println("Server is Created"); c = s.accept(); System.out.println("Request Accepted"); } catch(Exception e) { System.out.println(e); } } public void talk()throws IOException,UnknownHostException { dis = new DataInputStream(c.getInputStream()); dos = new DataOutputStream(c.getOutputStream()); disi = new BufferedReader(new InputStreamReader(System.in)); while(true) { String str = new String(disi.readLine()); dos.writeUTF(str); System.out.println(str); } } public static void main(String args[]) { try { serv c = new serv(); c.talk(); } catch(Exception e) { e.printStackTrace(); } } } Client Code: import java.io.*; import java.net.*; class clien { Socket c; DataInputStream dis; BufferedReader disi; DataOutputStream dos; public clien()throws IOException,UnknownHostException { c=new Socket(InetAddress.getLocalHost(),2000); System.out.println("Request is sended"); } public void talk()throws IOException,UnknownHostException { try { dis=new DataInputStream(c.getInputStream()); dos=new DataOutputStream(c.getOutputStream()); disi=new BufferedReader(new InputStreamReader(System.in)); while(true) { String str=new String(disi.readLine()); dos.writeUTF(str); System.out.println(str); } } catch(Exception e) { e.printStackTrace(); } } public static void main(String args[]) { try { clien c=new clien(); c.talk(); } catch(Exception e){ } } }
tagged with: java
type: Question
tagged with: chat
has title: Java Client Server Chat Program
tagged with: java-io
has answer: http://stackoverflow.com/a/23186324

http://stackoverflow.com/q/23239777
has answer: http://stackoverflow.com/a/23240148
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
type: Question
tagged with: iterator
tagged with: configuration
has title: Best practices for storing configuration in java
possible better answer: http://stackoverflow.com/a/23240287
answer count: 2
has answer: http://stackoverflow.com/a/23240287
upvote count: 1
has body: I am developing java library that calls a HTTP script on one of multiple server to process data. The core functionality works ok and now I am looking into configuration issues. The library needs a few information (URL,Username,Password,...) of the server and if the connection fails it needs to get another until it gets response (simple High Availability). And there can be multiple different set of servers (i.e. for standard vs high-priority requests). Maybe even the order of the servers can be randomized for load balancing. And in the future we may want to implement some sort of server state monitoring into this mechanism. I have to add that I am new to java so my ideas may be biased to solutions from other languages. My first idea was to create class for storing single server config and then some sort of configuration manager that would be iterable (it would return iterator iterating over the server configs) and serializable. That way the library could get iterator and iterate over servers until it gets valid response (or run out of servers). And users of our class could use whichever mechanism for storing the configuration they need. I tried to implement this and I ran into some questions: How should iterator access the data of the configuration manager - the server configurations themselves and any other data that may be relevant to iterating? Should the configuration manager "render" some sort of simple list when creating the iterator? Or should the iterator access configuration manager's internal fields? Or should the configurationManager be the iterator itself? Is there any way how to extend serialization of the class if it would need to use fields that are not serializable (probably it will non happen but I want to be ready if it does) Is this a viable approach or should I rather use any library (Commons configuration or Java Properties)?
accepted answer: http://stackoverflow.com/a/23240148
favorite count: 0
tagged with: serialization

http://stackoverflow.com/comment/35613663
has text: Thank You Zach...... Zach my drop down in iframe is not working i tried many different methods but couldn't make it work but when i use the same code for my demo project it is working and my demo project is only in html
comment on: http://stackoverflow.com/a/23264403
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/23177390
score: 2
upvote count: 2
has body: the text fields don't appear at the sizes I have set them Suggest a size in the number of columns: song1 = new JTextField(5)
has comment: http://stackoverflow.com/comment/35500681
has comment: http://stackoverflow.com/comment/35481609
downvote count: 0
has comment: http://stackoverflow.com/comment/35480226
type: Answer
answers question: http://stackoverflow.com/q/23171455

http://stackoverflow.com/comment/35550339
score: 0
type: Comment
has text: I am using history class . when i press back space its history token goes change . how can i prompt user when history change
comment on: http://stackoverflow.com/a/23225554
type: AnswerComment

http://stackoverflow.com/comment/35607123
comment on: http://stackoverflow.com/q/23267099
score: 0
type: Comment
type: QuestionComment
has text: it wont allow me to clean because it says there are errors

http://stackoverflow.com/q/23237665
answer count: 4
has answer: http://stackoverflow.com/a/23238105
tagged with: collections
has answer: http://stackoverflow.com/a/23238115
type: AnsweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/23237697
has answer: http://stackoverflow.com/a/23237717
has body: This is my first class public class User { String name; int age; public User(String name,int age) { name=this.name; age=this.age; } @Override public boolean equals(Object obj) { User u=(User)obj; if(this.age==u.age) { return this.name.equals(u.name); } else { return false; } } public int hashcode() { return this.name.hashCode()+this.age; } @Override public String toString() { return String.format("Name %s", this.name); } } This is my second class public class MainClass { public static void main(String args[]) { java.util.Set s=new java.util.HashSet(); s.add(new Integer(10)); s.add(new Integer(1)); s.add(new Integer(5)); s.add(new Integer(3)); s.add(new Integer(6)); s.add(new Integer(9)); s.add(new User("Amit",25)); s.add(new User("Amit",25)); java.util.Iterator it=s.iterator(); while(it.hasNext()) { System.out.println(it.next()); } } } When I run my second program name is returned as null.
possible better answer: http://stackoverflow.com/a/23237717
score: 0
has title: Name is returning null in Collections?
accepted answer: http://stackoverflow.com/a/23238105

http://stackoverflow.com/comment/35387214
score: 2
comment on: http://stackoverflow.com/q/23143344
type: Comment
has text: How would `foo()` equal 4 work in `if(4)`?
type: QuestionComment

http://stackoverflow.com/comment/35557803
has text: can you edit to show more code, specifically the function?im currently thinking arr might be out of scope.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23238725
score: 0

http://stackoverflow.com/a/23144548
has comment: http://stackoverflow.com/comment/35389443
accepted answer of: http://stackoverflow.com/q/23144429
type: Answer
has body: Either void addCompetiton(Competition raffles){ this.raffles = raffles; } or void addCompetiton(Competition competition){ raffles = competition; } I gather that your problem was having the same name for the parameter as for the field. One may use this.raffles for the field.
score: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23144429

http://stackoverflow.com/comment/35370786
type: Comment
comment on: http://stackoverflow.com/a/23133857
has text: i removed the space in my first suggestion and it worked :D `set(* @Audit *.*)`. what is the difference compared to your suggestion?
type: AnswerComment
score: 0

http://stackoverflow.com/comment/35383399
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/23141216
has text: I am guessing that it is a spill off from your previous error. Correct that one and see if that sorts it out :)

http://stackoverflow.com/q/23237670
has title: Get the timestamp of a file without downloading?
has answer: http://stackoverflow.com/a/23237788
has body: Is it possible to get the timestamp of a file without having to download it fully, if the file is fetched from a https link? If not, is it possible to only fetch some chunks of the file and then check the timestamp before downloading the full file?
tagged with: java
type: Question
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23237788
score: 0
answer count: 1

http://stackoverflow.com/q/23280792
has answer: http://stackoverflow.com/a/23281333
accepted answer: http://stackoverflow.com/a/23281333
score: 0
answer count: 2
tagged with: string
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/23281461
tagged with: java
has body: I'd like to build a collection of String (any complex data structure like a collection) that I can use, efficiently, as "example" to know where I can split a given string. In example I had this String collection: abaco code, exchange. bold word can be bold. tree folder, and tree of leaf. and a given string: omecodeexchangeuthercanbetreeofword and obtain, from algorithm, something like: ome code exchange uther can be tree of word The part "ome" and "uther" cannot be splitted, so will be left as is (it would be nice if I mark this part like NOT-RECOGNIZED). I try to analyse KMP algorithm, but are too much far away from my needs, and I'd like to organize collection in a efficient time manner (less than linear to collection size). I forget to say: the split are on string with natural language words mixed with slang words all without spaces I already tried a weighted word dictionary based dynamic algorithm, but is too much subjects to errors for equivalent weight on wrong split ("wrong" i mean for natural language) I need the best result for this split, using word sequence from string collections as "good example"
type: Question
has comment: http://stackoverflow.com/comment/35633824
tagged with: algorithm
has answer: http://stackoverflow.com/a/23281461
has title: Split a string from example of other string collection

http://stackoverflow.com/q/23277853
answer count: 3
possible better answer: http://stackoverflow.com/a/23861788
downvote count: 0
has answer: http://stackoverflow.com/a/23861788
score: 1
favorite count: 0
has answer: http://stackoverflow.com/a/23283591
tagged with: hbase
has title: Will HBase scan over rows that do not contain families that I want returned
tagged with: crud
tagged with: nosql
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23304559
tagged with: java
upvote count: 1
type: Question
tagged with: hadoop
has body: I'm using HBase CDH3, and I'm designing my HBase table. Let's say all my rowkeys are hashed, and I have 2 column families colFamA and colFamB. For each row, there will be values stored in either colFamA or colFamB, but not both. If I set up a scanner to scan over every row, and I specify in my scanner Scan scan = new Scan(); scan.addFamily(Bytes.toBytes("colFamA"); hTable.getScanner(scan); so I only want colFamA values, and not colFamB values, will my scanner still have to scan over rows that contain no data for colFamA (i.e. rows with only colFamB values)? Will the fact that there is colFamB slow down this scan even though I'm not adding it as a column to be returned in my scan?
accepted answer: http://stackoverflow.com/a/23304559

http://stackoverflow.com/q/23258134
score: 0
tagged with: nullpointerexception
has body: While running the code below I keep getting a null pointer exception can anyone help? It is a method for pulling a random word from a txt document for a word game. While I am running it in JCreator it works perfectly but as soon as I try to open it in a browser it stops working. Thanks. public String getaword() { try { BufferedReader in = new BufferedReader(new FileReader("sample.txt")); String str=null; ArrayList&lt;String&gt; lines = new ArrayList&lt;String&gt;(); while((str = in.readLine()) != null) { lines.add(str); words = lines.toArray(new String[lines.size()]); } } catch (Exception e) { e.getStackTrace(); } Random r = new Random(); int num; num = new Integer (r.nextInt(words.length)); return words[num]; }
answer count: 0
type: UnansweredQuestion
has title: Can't figure out how to clear this exception
has comment: http://stackoverflow.com/comment/35591665
has comment: http://stackoverflow.com/comment/35591480
tagged with: java
has comment: http://stackoverflow.com/comment/35593466
type: Question
has comment: http://stackoverflow.com/comment/35591429

http://stackoverflow.com/a/23338909
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/23171202
downvote count: 0
has body: $(document).ready(function(){ $('input[type="file"]').ajaxfileupload({ 'action': 'imageupload.action', 'onComplete': function(response) { $('#upload').hide(); alert("File SAVED!!"); }, 'onStart': function() { $('#upload').show(); } }); }); &lt;/script&gt;
score: 1

http://stackoverflow.com/a/23139116
type: Answer
has body: But what I want to know is that what will happen if it would not throw a Exception and let the iteration and modification happened concurrently. This is hypothetical because the respective (non-concurrent) collections don't work that way. If we hypothesize that they did allow "concurrent" modification, then we still cannot answer without making assumptions about how iteration would then be implemented. Finally, assuming that we just removed the fast-fail tests, then the behaviour will be collection specific. Looking at your analysis for the HashMap case, you have to consider the internal state of the iterator object. I haven't looked at any specific implementation code, but a typical HashMap iterator will have an index for a hash chain in the main hash array, and a pointer to a node within the hash chain: A Map.remove won't change the hashmap size, so the chain index won't be invalidated. However, if the wrong entry was removed, we could find that the iterator's node pointer could refer to a node that is no longer in the chain. This could cause the iteration to return deleted map entries. You are correct that a Map.put that triggered a resize could cause the entries to be redistributed. This could cause some entries to be skipped, and others to be returned twice.
answers question: http://stackoverflow.com/q/23138523
score: 2
upvote count: 2
downvote count: 0

http://stackoverflow.com/a/23292926
upvote count: 2
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/23290391
answers question: http://stackoverflow.com/q/23290391
downvote count: 0
has body: Read the below articles for details Making a web service request parameter a required field How can I make a WebMethod parameter required XmlElement annotation dissallowed with WebParam To put it simply, you need to use the @XmlElement(required=true) for more details refer to the above posts.
type: AcceptedAnswer

ucanaccess
tag name: ucanaccess
tags question: http://stackoverflow.com/q/23193143
type: Tag

http://stackoverflow.com/comment/35588056
type: Comment
has text: @NatanCox I'm not sure a memory leak is really the same as simply using up all your memory.
comment on: http://stackoverflow.com/q/23253605
score: 2
type: QuestionComment

http://stackoverflow.com/q/23284509
has comment: http://stackoverflow.com/comment/35642008
accepted answer: http://stackoverflow.com/a/23285237
has comment: http://stackoverflow.com/comment/35640468
has comment: http://stackoverflow.com/comment/35640641
answer count: 1
has title: How do final fields NOT leak memory?
downvote count: 0
has comment: http://stackoverflow.com/comment/35640398
favorite count: 0
score: 8
upvote count: 8
has comment: http://stackoverflow.com/comment/35642117
has comment: http://stackoverflow.com/comment/35640787
tagged with: memory-leaks
has body: I have been, without a question, using the final keyword for years to denote fields that should not change for the lifetime of an instance/class. Suddenly this occured to me... So given this example: public class TestFinalGC{ private TestFinalGC(){} private final Object obj = new Object(); public static void main(String []args){ TestFinalGC instance = new TestFinalGC(); // instance Ref -&gt; actual instance -&gt;? obj ref-&gt; actual obj System.out.println(instance.obj); instance = null; //say GC makes sweep here... what happens? //lets assume theres more code, obj would obviously be eligible for GC on app exit. } } How does the obj member NOT leak here? Are final fields automatically WeakReferences such that if the strong references to parent(s) are nulled, they are eligible for garbage collection? The JLS does not seem to note anything special about final Update: So this question of mine was founded on the premise that "reachability" and strong/weak references are closely related. There is this confusing oracle doc on reachability that leads me to believe that nested references should always be "strongly reachable". Hence, I do null my nested object references in all my objects, but it appears that this obviously should not be the case from all of the comments I am receiving. So regarding "reachability", then, is it simply just that nested object references are no longer considered "reachable" if parent references are no longer reachable? It could be is true that the premise of this problem is incorrect, but there is still intriguing information to consolidate here.
tagged with: garbage-collection
has comment: http://stackoverflow.com/comment/35640375
has comment: http://stackoverflow.com/comment/35640642
has answer: http://stackoverflow.com/a/23285237
type: AnsweredQuestion
tagged with: final
tagged with: java
has comment: http://stackoverflow.com/comment/35640813
type: Question
has comment: http://stackoverflow.com/comment/35641662
has comment: http://stackoverflow.com/comment/35640387
linked to: http://stackoverflow.com/q/10841674

http://stackoverflow.com/comment/35821577
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/23200186
has text: You need to obtain the thread dump when it happens, it will obviously show what is going on. Check [this](http://stackoverflow.com/questions/12842344/generate-a-java-thread-dump-without-restarting) and linked questions for different ways of obtaining java thread dumps.
type: Comment

http://stackoverflow.com/a/23135598
answers question: http://stackoverflow.com/q/23135466
upvote count: 1
has comment: http://stackoverflow.com/comment/35372849
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/35372785
has comment: http://stackoverflow.com/comment/35372675
has body: Your ImageButton's declaration is wrong. Change imageButton = (ImageButton) findViewById(R.id.imageButton1); with imageButton = (ImageButton) v.findViewById(R.id.imageButton1);
type: Answer

oop
tags question: http://stackoverflow.com/q/23234617
tags question: http://stackoverflow.com/q/23181799
tags question: http://stackoverflow.com/q/23134595
tags question: http://stackoverflow.com/q/23211468
tags question: http://stackoverflow.com/q/23166696
tags question: http://stackoverflow.com/q/23182643
tag name: oop
tags question: http://stackoverflow.com/q/23174138
tags question: http://stackoverflow.com/q/23173680
tags question: http://stackoverflow.com/q/23171207
tags question: http://stackoverflow.com/q/23284940
tags question: http://stackoverflow.com/q/23256406
tags question: http://stackoverflow.com/q/23155112
tags question: http://stackoverflow.com/q/23231215
tags question: http://stackoverflow.com/q/23215862
tags question: http://stackoverflow.com/q/23188063
tags question: http://stackoverflow.com/q/23150227
tags question: http://stackoverflow.com/q/23186564
tags question: http://stackoverflow.com/q/23227571
tags question: http://stackoverflow.com/q/23178486
tags question: http://stackoverflow.com/q/23160790
tags question: http://stackoverflow.com/q/23161362
tags question: http://stackoverflow.com/q/23183059
tags question: http://stackoverflow.com/q/23229735
tags question: http://stackoverflow.com/q/23179211
tags question: http://stackoverflow.com/q/23246803
tags question: http://stackoverflow.com/q/23247816
tags question: http://stackoverflow.com/q/23278799
tags question: http://stackoverflow.com/q/23143259
tags question: http://stackoverflow.com/q/23189470
type: Tag

http://stackoverflow.com/comment/35522904
type: QuestionComment
comment on: http://stackoverflow.com/q/23215064
has text: sry but i have edited it and corrected it
score: 0
type: Comment

getparameter
tag name: getparameter
type: Tag
tags question: http://stackoverflow.com/q/23273583
tags question: http://stackoverflow.com/q/23193137

http://stackoverflow.com/a/23176077
upvote count: 1
answers question: http://stackoverflow.com/q/23176030
type: Answer
has body: Because the copmpiler is almost always right. In this case, your local declaration of Image playbutton is never initialized. It's a different variable than the one you have before the method, and declaring it locally hides the first (global) one of the same name.
has comment: http://stackoverflow.com/comment/35500351
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/35500273

http://stackoverflow.com/comment/35468311
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23189391
has text: This isn't entirely clear; what exactly is the issue with performing bit-packing?
score: 0

http://stackoverflow.com/a/23186628
score: 3
has comment: http://stackoverflow.com/comment/35463536
has body: Situation A should be faster. Vertex processing will be the same. After that, clipping to the view volume is applied. In situation A, part of the polygon will be clipped, while the whole polygon goes through in situation B. After that, the polygon is rasterized, and the resulting fragments go into fragment processing. Since there are fewer fragments in situation A, there's less work to do in this stage. The fragment shader does the texture sampling, so only the visible parts of the texture will be sampled in this case. Clipping can also happen after the fragments are generated, but I would always expect it to be done before the fragment shader. While there will always be less work in situation A, this doesn't necessarily mean that you'll see a speed difference in the rendering. You could have bottlenecks in other parts of the pipeline, or in your app code.
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23186192
type: Answer
has comment: http://stackoverflow.com/comment/35463717
upvote count: 3
accepted answer of: http://stackoverflow.com/q/23186192

http://stackoverflow.com/a/24217335
has body: I was using oracle's jdk and running sudo apt-get install openjdk-7-jre solved my problem.
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23277062
type: Answer
score: 3
downvote count: 0
upvote count: 3
accepted answer of: http://stackoverflow.com/q/23277062

http://stackoverflow.com/comment/35672435
type: Comment
comment on: http://stackoverflow.com/a/23280434
has text: THANKS, @Joop. What you wrote worked fine. This is one of the hardest tasks I've come across. Netbeans Help didn't. But could you please tell me how to fix this line: `myStream = Class.forName("gbl/Maine"). getClassLoader(). getResourceAsStream("/HighlightInput");`. I don't know what the heck the Netbeans directory structure is, nor what class name to use. And I'd like to know why; otherwise, this will be a permanent problem. If you have the time.
score: 0
type: AnswerComment

prepared-statement
tags question: http://stackoverflow.com/q/23143199
type: Tag
tags question: http://stackoverflow.com/q/23234137
tags question: http://stackoverflow.com/q/23238809
tags question: http://stackoverflow.com/q/23199378
tags question: http://stackoverflow.com/q/23212949
tag name: prepared-statement

http://stackoverflow.com/comment/35386282
type: AnswerComment
score: 0
has text: i also tried this http://pastebin.com/tUkDgUPS , where do i put this `PlaceholderFragment` ?
type: Comment
comment on: http://stackoverflow.com/a/23142549

http://stackoverflow.com/comment/35641700
type: AnswerComment
type: Comment
has text: ariti, that sounds like it should just work, without your doing anything fancy at all. What problems are you encountering?
comment on: http://stackoverflow.com/a/23276370
score: 0

http://stackoverflow.com/q/23152256
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/23152553
tagged with: android
has body: I am a newbie in dealing with Git. I am using Git in eclipse. My main project contains the google-play-services_lib has a library project. Recently I did Git -&gt; Fetch from remote repository and now when I do Git -&gt; Pull in main project, I get conflicts in google-play-services_lib which I never changed (generated files changes). I want to ignore the library project changes from Git pull in eclipse. Whenever I take Git pull from main Project, I always get the following conflict in eclipse- Checkout conflict with files: google-play-services_lib/bin/AndroidManifest.xml google-play-services_lib/bin/R.txt google-play-services_lib/bin/google-play-services_lib.jar google-play-services_lib/bin/jarlist.cache So though these conflicts are system generated changes, I always want to ignore them. I used Team -&gt; Disconnect on google-play-services_lib, but this only disconnected me from Git for the library google-play-services_lib. I used Team -&gt; Ignore on google-play-services_lib, but this did nothing in resolving conflicts. I used Team -&gt; Untrack on google-play-services_lib, but this added all files in google-play-services_lib in the conflict state.
accepted answer: http://stackoverflow.com/a/23152553
type: AnsweredQuestion
tagged with: java
tagged with: git
type: Question
has title: How to ignore library project from Git pull?
tagged with: eclipse

http://stackoverflow.com/comment/35568074
score: 0
comment on: http://stackoverflow.com/q/23236879
type: Comment
type: QuestionComment
has text: Try to export war file in following way and check if web.xml is in WEB-INF directory: http://help.eclipse.org/juno/index.jsp?topic=%2Forg.eclipse.wst.webtools.doc.user%2Ftopics%2Ftwcrewar.html

http://stackoverflow.com/q/23232683
has comment: http://stackoverflow.com/comment/35545281
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/35545303
accepted answer: http://stackoverflow.com/a/23233016
tagged with: wav
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/23233016
has body: I know about the clip.stop() method, however it doesn't seem to work within when I have it inside the key_events. It just causes an Error. Well I know why it causes the error. Because I'm asking it to essentially stop a clip that doesn't exist until a few lines later. But using this same logic or close to it if possible, how could I recode that so it knows to select the previous clip that was playing from a previous key_event. The functionality I'm intending for is: When F1 is pressed, a wav plays. When F2 is pressed, current wav STOPS, new wav STARTS. When F3 is pressed, current wav STOPS, new wav STARTS. Etc etc etc. case KeyEvent.VK_F1: try { //stop any sound clip.stop(); sample = AudioSystem.getAudioInputStream(getURL(filename)); //create a sound buffer Clip clip = AudioSystem.getClip(); //load the audio file clip.open(sample); //play sample clip.start(); } catch (MalformedURLException ez) { } catch (IOException ez) { } catch (LineUnavailableException ez) { } catch (UnsupportedAudioFileException ez) { } catch (Exception ez) { } break; case KeyEvent.VK_F2: try { //stop any sound clip.stop(); sample = AudioSystem.getAudioInputStream(getURL(filename2)); //create a sound buffer Clip clip = AudioSystem.getClip(); //load the audio file clip.open(sample); //play sample clip.start(); } catch (MalformedURLException ez) { } catch (IOException ez) { } catch (LineUnavailableException ez) { } catch (UnsupportedAudioFileException ez) { } catch (Exception ez) { } break; case KeyEvent.VK_F3: try { //stop any sound clip.stop(); sample = AudioSystem.getAudioInputStream(getURL(filename3)); //create a sound buffer Clip clip = AudioSystem.getClip(); //load the audio file clip.open(sample); //play sample clip.start(); } catch (MalformedURLException ez) { } catch (IOException ez) { } catch (LineUnavailableException ez) { } catch (UnsupportedAudioFileException ez) { } catch (Exception ez) { } break; case KeyEvent.VK_F4: try { //stop any sound clip.stop(); sample = AudioSystem.getAudioI…
upvote count: 1
has title: In Java, How do you stop a previous audio file when another audio file starts using key_events
type: Question
tagged with: audio
type: AnsweredQuestion

http://stackoverflow.com/q/23278349
tagged with: scala
has answer: http://stackoverflow.com/a/23281038
upvote count: 1
accepted answer: http://stackoverflow.com/a/23281038
has comment: http://stackoverflow.com/comment/35633609
type: AnsweredQuestion
has title: java.util.list as parameter in scala class method to be used in Java code
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/35633420
has comment: http://stackoverflow.com/comment/35633040
has comment: http://stackoverflow.com/comment/35633398
type: Question
has comment: http://stackoverflow.com/comment/35634412
has body: I'm trying to do something like this in scala: class SessionObject { def setParameter(parameterOne : String): Unit = { //Doing some stuff } def getResult(javaListParameter: java.util.List[String]): JsonObject = { //doing some stuff } } Once I compile the scala code I'm trying to use it in Java as a library. Something like this: SessionObject object = new SessionObject(); object.setParameter("Something"); List&lt;String&gt; theList = new ArrayList&lt;String&gt;(); object.getResult(theList); However, I'm not able to see/access the "getResult" method in Java. Is this a scala limitation or I'm missing something? Thanks! EDIT: I tried this solution, however doesn't seem to work. Any method that uses java.util.List as a parameter or as a result cannot be used in java code. Forgot to mention the compiler info. I'm using the maven-scala-plugin version 2.15.2 with scala version 2.10.3 EDIT: Ok, as wingedsubmariner suggested, I ignored the IDE pre-compiling hints and compiled anyway. Now I'm getting this: method com.*.*.*.*.SessionObject.getResult(java.lang.String,scala.collection.immutable.List&lt;java.lang.String&gt;,java.lang.String,scala.collection.immutable.List&lt;java.lang.String&gt;) is not applicable (actual argument java.util.List&lt;java.lang.String&gt; cannot be converted to scala.collection.immutable.List&lt;java.lang.String&gt; by method invocation conversion) method com.*.*.*.*.SessionObject.getResult(java.lang.String,java.util.ArrayList&lt;java.lang.String&gt;,java.lang.String,java.util.ArrayList&lt;java.lang.String&gt;) is not applicable (actual argument java.util.List&lt;java.lang.String&gt; cannot be converted to java.util.ArrayList&lt;java.lang.String&gt; by method invocation conversion) This seems to tell me that somehow the java.util.List parameter definition is being ignored.
linked to: http://stackoverflow.com/q/21435358
has comment: http://stackoverflow.com/comment/35633798
downvote count: 0
has comment: http://stackoverflow.com/comment/35633488
answer count: 1
has comment: http://stackoverflow.com/comment/35633450
favorite count: 0
has comment: http://stackoverflow.com/comment/35633943

http://stackoverflow.com/comment/35587361
score: 0
has text: Are you suggesting to use a `ThreadPoolExecutor` to handle my threads? If yes, I was using this before migrating to `Volley`, but I had two main problems: 1) I was losing some requests because the queue was full, Volley has an unbounded queue. 2) Some requests were removed from the queue because they were waiting too long.
type: Comment
comment on: http://stackoverflow.com/a/23255889
type: AnswerComment

http://stackoverflow.com/q/23256685
favorite count: 0
has answer: http://stackoverflow.com/a/23260727
type: UnansweredQuestion
upvote count: 1
tagged with: spring
has answer: http://stackoverflow.com/a/23318983
type: Question
tagged with: spring-boot
tagged with: java
has body: I want to be able to leverage the Spring Boot datasource auto-configuration. However it doesn't support all the features I'm using, logValidationErrors in particular. spring: datasource: driverClassName: oracle.jdbc.OracleDriver url: jdbc:jtds:sqlserver://111.11.11.11/DataBaseName username: someuser password: somepass testOnBorrow: true testWhileIdle: true validationQuery: select /* validationQuery */ 1 from dual minEvictableIdleTimeMillis: 1000 validationInterval: 30000 These aren't currently used: logValidationErrors: true maxAge: 1800000 # //30 Minute idle age removeAbondoned: true Can I just grab the created DataSource bean and set those values manually? Or is there a better way to extend or wrap the autoconfiguration? See here for more about logValidationErrors, etc: https://tomcat.apache.org/tomcat-8.0-doc/jdbc-pool.html
answer count: 3
has title: How to extend Spring Boot's DataSourceAutoConfiguration
has answer: http://stackoverflow.com/a/23260703
downvote count: 0
score: 1

http://stackoverflow.com/comment/35539457
type: AnswerComment
type: Comment
has text: Furthermore, you will see that a multipart/form-data request has all fields (files + form fields) separated by "--boundary" strings, with the last field terminated by "--boundary--". You are sending "--boundary--" *twice*, which is not good. For every field you are sending, you need a part saying "--boundary", "Content-Disposition: form-data; name='somefield'", "Content-Type: text/plain", followed by a newline and the actual value for 'somefield'.
comment on: http://stackoverflow.com/a/23188661
score: 0

http://stackoverflow.com/comment/35550830
score: 0
type: Comment
type: QuestionComment
has text: `Conjunto<Categoria>` not extends `ArrayList <Categoria>` but in main.java you used `Conjunto <Integer>()` confusing totally.
comment on: http://stackoverflow.com/q/23235852

http://stackoverflow.com/a/23146780
answers question: http://stackoverflow.com/q/23146492
has body: You can do it with a ArrayList&lt;double[][]&gt; as Ted explained. ArrayList&lt;double[][]&gt; dataList = new ArrayList&lt;double[][]&gt;(); The reason for the error is, double[][] is itself an Object, whereas Double[][] is an array of references to Double array of references to the Double objects.
type: Answer
score: 0

http://stackoverflow.com/a/23214838
answers question: http://stackoverflow.com/q/23214754
score: 0
has comment: http://stackoverflow.com/comment/35516004
type: Answer
has comment: http://stackoverflow.com/comment/35516231
has comment: http://stackoverflow.com/comment/35513222
has body: -cp and -jar cannot be combined - you can use just one of them

http://stackoverflow.com/q/23211378
has answer: http://stackoverflow.com/a/23223186
tagged with: java
has body: i'm writing a piece of code to display images in JXTable retrieved from a database everything works fines .I have fixed the row height of that table , now i want to change the row height dynamically using mouse. How to acheive this . I know setRowHeight(100) will be useful how can i pass value dynamically to that . Thanks inadvance
type: Question
answer count: 1
has comment: http://stackoverflow.com/comment/35510153
tagged with: swingx
has comment: http://stackoverflow.com/comment/35507718
has title: How to resize row height of JXTable
score: 0
tagged with: jxtable
has comment: http://stackoverflow.com/comment/35507272
tagged with: preferredsize
type: UnansweredQuestion
tagged with: swing

http://stackoverflow.com/a/23137861
downvote count: 0
score: 1
has body: getSort() isn't static and can't be called from main. You need to make it static.
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/23137758

http://stackoverflow.com/a/42815355
answers question: http://stackoverflow.com/q/23151837
has body: Here is is a sample for files permissions on UNIX/Linux platforms import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.nio.file.attribute.PosixFileAttributes; import java.nio.file.attribute.PosixFilePermission; import java.nio.file.attribute.PosixFilePermissions; import java.util.Set; class A { public static void main(String[] args) throws Exception { //Make sure file exists e.g. Unix path structure Path p = Paths.get("/a/b/Log.txt"); PosixFileAttributes posix = Files.readAttributes(p, PosixFileAttributes.class); //Set Permissions if needs be for the file Log.txt Set&lt;PosixFilePermission&gt; perms = PosixFilePermissions.fromString("rw-r--r--"); Files.setPosixFilePermissions(p, perms); //Output the various attributes of the file named Log.txt System.out.println(posix.group()); System.out.println(posix.permissions()); System.out.println(posix.owner()); } }
score: 0
type: Answer

http://stackoverflow.com/comment/35574257
comment on: http://stackoverflow.com/a/23248480
score: 0
has text: Wow :) Simple and easy :) Thank You very much!
type: AnswerComment
type: Comment

http://stackoverflow.com/q/23189672
type: Question
tagged with: get
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/35479847
has comment: http://stackoverflow.com/comment/35468778
has title: Java "Get" and "Set" Methods
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/53283339
tagged with: set
tagged with: methods
has answer: http://stackoverflow.com/a/23189764
has body: I have two classes, in class Player i have the variable which is defined as private int collectedDots and I want to access in another class Exit. I have defined the Get and Set method within class Player as such: public void setCollectedDots(int cd) { collectedDots = cd; } public int getCollectedDots() { return collectedDots; } But now I want to access the collectedDots field from the Exit class. When I copy those two methods into the Exit class I keep getting the error cannot find symbol - variable collectedDots. It was my understanding that I would then be able to retrieve the collectedDots variable from the Player class once I set the get and set methods.. Any ideas where i'm going wrong?
tagged with: java
has comment: http://stackoverflow.com/comment/35469107

http://stackoverflow.com/a/49361709
answers question: http://stackoverflow.com/q/23187539
type: Answer
score: 0
has body: Using node reference we can check easily import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; public class CloseBracketsBalance { private static final Map&lt;String, String&gt; closeBracket= new HashMap&lt;&gt;(); private static final List&lt;String&gt; allBrac = new ArrayList&lt;&gt;(); static { allBrac.add("["); allBrac.add("]"); allBrac.add("{"); allBrac.add("}"); allBrac.add("("); allBrac.add(")"); closeBracket.put("]", "["); closeBracket.put("}", "{"); closeBracket.put(")", "("); } public static void main(String[] args) { System.out.println(checkSheetIsbalance("[{}({[]{}(dsfd)})]")); // return true System.out.println(checkSheetIsbalance("[{}({[]{}(dsfd}))]")); // return false } public static boolean checkSheetIsbalance(String c) { char[] charArr = c.toCharArray(); Node node = null; for(int i=0,j=charArr.length;i&lt;j;i++) { String ch = charArr[i]+""; if(!allBrac.contains(ch)) { continue; } if(closeBracket.containsKey(ch)) { // node close bracket if(node == null) { return false; } if(!(node.nodeElement).equals(closeBracket.get(ch))) { return false; } node = node.parent; } else { //make node for open bracket node = new Node(ch, node); } } if(node != null) { return false; } return true; } } class Node { public String nodeElement; public Node parent; public Node(String el, Node p) { this.nodeElement = el; this.parent = p; } }

http://stackoverflow.com/comment/35506254
has text: @brianChiem So is the error when accessing `list` or when accessing `byteAdd`? When you print the values of `position` and `t`, which one of them is "3" at that point? "3" is an invalid index into one of those two arrays. Find out which, find out why, and fix it.
comment on: http://stackoverflow.com/q/23210857
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23187111
accepted answer: http://stackoverflow.com/a/23187173
has comment: http://stackoverflow.com/comment/35464289
downvote count: 1
type: Question
tagged with: object
tagged with: java
score: -1
has comment: http://stackoverflow.com/comment/35464212
tagged with: class
tagged with: search
upvote count: 0
has comment: http://stackoverflow.com/comment/35464315
tagged with: arrays
answer count: 1
has answer: http://stackoverflow.com/a/23187173
favorite count: 0
has title: Java - Search through object in a different method and print that method in the main method?
type: AnsweredQuestion
has body: I'm trying to search through an object saved in a different class by using a method, and then print the method output via the main method, but as of now it's not working. I'm getting errors in the main method saying cannot make static reference to the non-static method. I'm not supposed to be taking in Gerbil[] gerbilArray as a parameter but that's the only way I know for how to search through the object. Any help with printing or fixing my method? Here's my method line which searches through the object (so you know what I'm calling): public String searchForGerbil(String search, Gerbil[] gerbilArray) { Here's the line in the main method calling the method above: System.out.println("Which gerbil would you like to search? (Enter lab ID)"); String search = keyboard.next(); System.out.println( searchForGerbil(search, gerbilArray) ); // I've also break; // tried searchForGerbil(search, Gerbil[]) but both are giving me // errors.

http://stackoverflow.com/a/23361716
answers question: http://stackoverflow.com/q/23147092
score: 1
upvote count: 1
downvote count: 0
has body: public int uploadFile(String directoryPath, String file_path){ if (siteHost.isEmpty() || !isLogin) return ERROR_LOGIN; String webserviceUrl = "http://site:port/_vti_bin/listdata.svc/SharedDocuments"; String slug = "http://site:port/Shared%20Documents/filename"; File file = new File(file_path); if (file == null) return ERROR_FILE; String file_name = file.getName(); ContentBody filebody = new FileBody(file); HttpPost post = new HttpPost(webserviceUrl); post.getParams().setBooleanParameter(CoreProtocolPNames.USE_EXPECT_CONTINUE, false); post.setHeader("Content-Type","multipart/form-data"); post.setHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); post.setHeader("Accept-Encoding", "gzip, deflate"); post.setHeader("Accept-Language", "zh-cn,zh;q=0.8,en-us;q=0.5,en;q=0.3"); post.setHeader("User-Agent", "Mozilla/5.0 (Android; Mobile; rv:28.0) Gecko/28.0 Firefox/28.0"); post.addHeader("Slug",slug); MultipartEntity multipartContent = new MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE); multipartContent.addPart(file_name, filebody); post.setEntity(multipartContent); ; try { HttpResponse response = defaultHttpClient.execute(post); int resCode = response.getStatusLine().getStatusCode(); if (resCode != 201) return ERROR_UPLOAD; } catch (IOException e) { e.printStackTrace(); return ERROR_UPLOAD; } return ERROR_SUCCESS; }
type: Answer

http://stackoverflow.com/a/36844364
answers question: http://stackoverflow.com/q/23253696
score: 0
type: Answer
has body: The reason I need this is because we (the team) have implemented Grunt.js into the build process by adding it to the playRunHooks. Depending on whether the application is running in DEV mode or not we want to enable/disable some Grunt tasks. Since you say build process and are looking to hook into the application when it's running in prod mode I think the place you're really looking to hook into is the dist command. In that case you'll want to create some tasks for your build file and get creative with .dependsOn to incorporate them. SBT has a way of running external processes such that you could define a simple inputKey in your build.sbt file like so: val doGulpRelease = inputKey[Unit]("Runs gulp --release") doGulpRelease := { val s = streams.value s.log.info("Preparing to run my task") "gulp --release" ! s.log s.log.info("Done with my task") } Then, to hook into the dist process of play, you can set it to depend on a task created from the above: dist in Universal &lt;&lt;= (dist in Universal).dependsOn(doGulpRelease.toTask("")) This will cause your dist command to also run your custom build command, which in this case would do whatever the release task was defined to do. In the same vein, if you need some build process to run for your tests, use test in Test and dependsOn to run whatever you need to. It seems to me you're asking an XY problem but if is the case that you're not and you really do need to run grunt subprocess's from within your running play app then you'll need to use the Global Object and hook into the onStart/onShutDown hooks and create some type of job runner for yourself. You could start here for some hints on running background tasks in play and besides that google is your friend. Note: You may need to do some imports at the top of your build.sbt file to use the above code, and it will also depend on your sbt version, but with 0.13.5 I believe it is: import sbt.complete._ import complete.DefaultParsers._ import com.typesafe.sbt.packager.Keys._

http://stackoverflow.com/q/23176974
score: 6
tagged with: garbage-collection
has comment: http://stackoverflow.com/comment/35446194
type: Question
has title: How full does the old generation have to be to trigger a major GC cycle?
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23177440
tagged with: java
has body: I am working on resolving a high garbage collection utilization rate in our production environment, and was wondering if setting a large heap size guaranteeing that the old generation will never be really filled up would prevent triggering a major GC cycle. For that to be true, I imagine that there is a certain threshold mark at which a major GC cycle gets triggered. If this assumption is true, can someone please let me know what that number is? If not, I would appreciate an explanation of how these major cycles are actually triggered and if my large heap strategy has a potential of working.
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/35461389
tagged with: heap-memory
has answer: http://stackoverflow.com/a/23177440
tagged with: size
upvote count: 6
favorite count: 0

http://stackoverflow.com/comment/35640666
type: AnswerComment
comment on: http://stackoverflow.com/a/23221992
score: 0
type: Comment
has text: Oh I forgot to tell you something, I asked this question in bootstrap github repo but this is how they response : https://github.com/twbs/bootstrap/issues/13404

http://stackoverflow.com/a/24061464
answers question: http://stackoverflow.com/q/23200602
has body: Their is something buggy with Apache HTTP server when using a non standard ssl Port other that 443. When the URL is being sent the Port is stripped out in the request object. Alternatively getting the URL from the Request Header is a good option. That option did not fit my needs as i have one website to the user but the Content i displayed in the Iframe of the website is actually loading the data on a different tomcat (Which is AWS server). So basically the request header gave the URL of the main URL than the URL of the website running inside of the iframe. I have a workaround that fits to my project need to store the URL of the website with in the IFrame to get from a properties file and use it .
accepted answer of: http://stackoverflow.com/q/23200602
score: 0
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/a/23220890
type: Answer
upvote count: 1
has body: You can place both loops in different functions and pass both balance and interesRate as arguments, like below. import java.util.Scanner; public class BankInterest { static public double annualInterest(double balance, double interestRate) { int years = 0; while (years &lt; 10) { double interest = balance * interestRate; balance = balance + interest; years++; } return balance; } static public double monthlyInterest(double balance, double interestRate) { int months = 0; while (months &lt; 120) { double interest = balance * interestRate/12; balance = balance + interest; months++; } return balance; } public static void main(String args[]) { Scanner keyboard = new Scanner(System.in); System.out.println("Please enter your balance: "); double balance = keyboard.nextDouble(); System.out.println("Please enter the ann1ual interest rate in decimal form: "); double interestRate = keyboard.nextDouble(); System.out.println("Balance after 10 years with annual interest is " + annualInterest(balance, interestRate)); System.out.println("Balance after 10 years with monthly interest rate is " + monthlyInterest(balance, interestRate)); } }
answers question: http://stackoverflow.com/q/23219945
score: 1
accepted answer of: http://stackoverflow.com/q/23219945
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/35642801
comment on: http://stackoverflow.com/q/23285447
score: 0
type: Comment
type: QuestionComment
has text: you need to keep track of this id so after adding a row to table just get the id and keep it with your user information. or use user name as the key to update information as it seems it will also be unique

http://stackoverflow.com/q/23212291
has comment: http://stackoverflow.com/comment/35508623
has body: I need a container to hold 2D arrays (up to 1000 at most). I'm a bit unsure of which container would be best, as there are several alternatives. What i think would be the best is an array containing the 2D arrays, but is this possible? And if it is, how do I initialize this array?
has comment: http://stackoverflow.com/comment/35508630
has comment: http://stackoverflow.com/comment/35511211
has title: Array containing 2Darrays
tagged with: multidimensional-array
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35508618
answer count: 0
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/35508822
type: Question
tagged with: arrays

http://stackoverflow.com/a/23145592
answers question: http://stackoverflow.com/q/23145158
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/35467087
has body: The question is, do I need to do option two if I'm worried about optimizing this sort of method? Definitely yes. If performance is a concern (and most of the time it is not!), then you need it. The compiler optimizes a lot but on a very different scale. Basically, it works with one method only and it optimizes the most commonly used path there in. Due to heavy inlining it can sort of optimize across method calls, but nothing like the above. It can also optimize away needless allocations, but only in very simple cases. Maybe something like int sum(int... a) { int result = 0; for (int x : a) result += x; return result; } Calling sum(1, 2, 3) means allocating int[3] for the varargs arguments and this can be eliminated (if the compiler really does it is a different question). It can even find out that the result is a constant (which I doubt it really does). If the result doesn't get used, it can perform dead code elimination (this happens rather often). Your example involves allocating a whole HashMap and all its entries, and is several orders of magnitude more complicated. The compiler has no idea how a HashMap works and it can't find out e.g., that after m.addAll(m1) the set m contains all member of m1. No way. This is an algorithmical optimization rather than low-level. That's what humans are still needed for. For things the compiler could do (but currently fails to), see e.g. these questions of mine concerning associativity and bounds checks.
type: Answer
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/35482189
accepted answer of: http://stackoverflow.com/q/23145158

http://stackoverflow.com/a/23222580
accepted answer of: http://stackoverflow.com/q/23222482
has comment: http://stackoverflow.com/comment/35526857
score: 2
answers question: http://stackoverflow.com/q/23222482
upvote count: 2
has comment: http://stackoverflow.com/comment/35527086
has comment: http://stackoverflow.com/comment/35527167
has body: Well, the first problem that I see is that List.size() refers to the number of objects you have added to the the List, which will be zero initially until you actually add items after initialization. You should do: for (int i = 1; i &lt;= Capacity; i++) { totallist.add(i); } instead. Edit: As for the second half of your question, what you're asking isn't clear. Do you mean you want to remove all of the items contained in one list if the other list also contains those items?
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/35527450
type: Answer

http://stackoverflow.com/comment/35631557
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23279647
has text: You can alter one or all of the indexes in the array inside your function, but that form of assignment does not work.
score: 0

http://stackoverflow.com/comment/35504055
has text: @MadProgrammer: the app is 30fps and the ticks are called for each frame. How do I calculate `fractionOverTime` in your example? I just stubbed in `.01` which is why I'm getting the easing I think.
comment on: http://stackoverflow.com/q/23209060
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35437302
type: Comment
type: QuestionComment
has text: can you explain what do you mean by adding a TextView to another? what you wrote is valid but use {} like Fllo said
comment on: http://stackoverflow.com/q/23171947
score: 0

http://stackoverflow.com/comment/35398367
comment on: http://stackoverflow.com/a/23147905
type: AnswerComment
score: 0
type: Comment
has text: Unfortunately responsse is still `<ns:getRes xmlns:ns="http://test/com/xsd"> <ns:return/> </ns:getRes>`

http://stackoverflow.com/q/23131526
score: 0
tagged with: java
answer count: 1
tagged with: mongodb
has answer: http://stackoverflow.com/a/23132291
type: UnansweredQuestion
has body: I am trying update document with object id but not getting result. Here is my code please help me DBCollection patients= db.getCollection("Patients"); BasicDBObject doc = new BasicDBObject(); doc.put("name","seshu"); DBObject update=`new` BasicDBObject().append("_id",ObjectId("534e1c8e40a8af540cd01ff4")); patients`enter code here`.update(update, doc);
has title: can we update a document in mongodb using _id in java?
type: Question

http://stackoverflow.com/comment/35492626
type: QuestionComment
has text: @demongolem if I use the long instead of double it gives me output as `-1`
comment on: http://stackoverflow.com/q/23203309
score: 1
type: Comment

http://stackoverflow.com/q/23172229
has comment: http://stackoverflow.com/comment/35437824
has comment: http://stackoverflow.com/comment/35437914
downvote count: 0
score: 1
tagged with: java
has title: Converting calendar to date in dd-MMM-yyyy format
type: Question
has comment: http://stackoverflow.com/comment/35437775
tagged with: simpledateformat
has comment: http://stackoverflow.com/comment/35437918
answer count: 2
upvote count: 1
has answer: http://stackoverflow.com/a/23188792
has comment: http://stackoverflow.com/comment/35437806
favorite count: 0
has comment: http://stackoverflow.com/comment/35437782
has comment: http://stackoverflow.com/comment/35437988
has comment: http://stackoverflow.com/comment/35437893
has answer: http://stackoverflow.com/a/23172298
type: UnansweredQuestion
has body: I am trying to add 17 days to 10-APR-2014 and convert the date to dd-MMM-yyyy format, but I am getting Sun Apr 27 00:00:00 GMT+05:30 2014. Here is my code: import java.util.*; import java.text.*; public class HelloWorld{ public static void main(String []args){ SimpleDateFormat sdf = new SimpleDateFormat("dd-MMM-yyyy"); Calendar c = Calendar.getInstance(); c.setTime(new Date()); c.add(Calendar.DATE, 17); String output = sdf.format(c.getTime()); System.out.println(output); System.out.print(new SimpleDateFormat("dd-MMM-yyyy").parse(output)); } } How can I make the output be 27-Apr-2014?

http://stackoverflow.com/q/23236054
has comment: http://stackoverflow.com/comment/35551300
has answer: http://stackoverflow.com/a/23237136
tagged with: paintcomponent
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35552241
score: 1
tagged with: java
has title: Drawing an assembled image to the JPanel
upvote count: 1
tagged with: swing
tagged with: bufferedimage
type: Question
tagged with: graphics
has comment: http://stackoverflow.com/comment/35552100
accepted answer: http://stackoverflow.com/a/23237136
has comment: http://stackoverflow.com/comment/35551510
has comment: http://stackoverflow.com/comment/35551623
has comment: http://stackoverflow.com/comment/35551855
has comment: http://stackoverflow.com/comment/35551902
has comment: http://stackoverflow.com/comment/35551967
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/35551532
has comment: http://stackoverflow.com/comment/35552122
has body: I am working on a program that I can use to present topics in front of my class. While MS Powerpoint and similar programs are nice, I feel like they are lacking in some areas. I am not trying to re-create these programs, I am only trying to make a program where I can type text into String arrays, add images, and position them all on the screen. Currently my program opens a fullscreen dark window with a little X in the top left, which when clicked will close the program. Here is the class file: import java.awt.Color; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.MouseInfo; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.awt.image.BufferedImage; import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; import java.util.HashMap; import java.util.Scanner; import javax.imageio.ImageIO; import javax.swing.JFrame; import javax.swing.JPanel; public class Main { static JFrame frame; static MyPanel panel; static MouseListener listener; static final int letterWidth = 6; static final int letterHeight = 9; static final int letterRow = 10; static final int letterCol = 11; static final int letterNum = 110; static String[] textA = {"Hello World,", "Here is a test", "of what I can do.", "Isn't it neat?!" }; static int textX = 100; static int textY = 100; public static void main(String[] args){ System.out.println("Welcome to Presenter"); System.out.println("Beginning loading"); frame = new JFrame(); panel = new MyPanel(); listener = new MouseListener(){ public void mouseClicked(MouseEvent arg0) { if(arg0.getButton() ==MouseEvent.BUTTON1){ //Close button int x = (int) MouseInfo.getPointerInfo().getLocation().getX(); int y = (int) MouseInfo.getPointerInfo().getLocation().getY(); if(x&gt;20 &amp;&amp; x&lt;48 &amp;&amp; y&gt;20 &amp;&amp; y&lt;56){ frame.dispose(); System.exit(0); } } } public void mouseEntered(MouseEvent arg0) {} public void mouseExited(MouseEvent arg0) {} public void mousePressed(M…

http://stackoverflow.com/q/23274539
type: Question
score: 3
tagged with: java
upvote count: 3
has title: maven-license-plugin: Use license for parentPom for all children
answer count: 1
favorite count: 0
has body: I am trying to use the maven-license-plugin to get license and header information for a multimodule project. I want to avoid having multiple copies of the license around and keep the pom files as easy to maintain as possible. To that end, I've put the plugin information into the parentPom in the element. I fully configured the plugin and put the necessary files into the parent project as well. So, in the parent, I have: org.codehaus.mojo license-maven-plugin 1.6 my_license ${project.baseUri}/src/license first update-file-header process-sources I then put a reference to this plugin into one of the children pom files: org.codehaus.mojo license-maven-plugin The child fails to build though because it tries to find the licenses.properties file along the child's project path, not the parent's. How do I get the children to look for licenses.properties in the parent project?
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23343851
accepted answer: http://stackoverflow.com/a/23343851
downvote count: 0
tagged with: maven

http://stackoverflow.com/comment/95032717
comment on: http://stackoverflow.com/a/23155867
type: AnswerComment
score: 0
type: Comment
has text: Indeed, using `find()` requires a bit of plumbing for how you find matches in a text. But that was not the OP's question, hence the simpler pattern for the use case at hand.

http://stackoverflow.com/a/23210003
score: 0
has body: I'm not getting any issues with heap space, but after reaching '?' all the new rooms still have '?', most likely because (char) ('?' + 1) will keep returning '?'. Perhaps this is a bug with your version of Java. What is your OS and JDK version?
has comment: http://stackoverflow.com/comment/35505055
answers question: http://stackoverflow.com/q/23209866
type: Answer

http://stackoverflow.com/comment/35524937
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23218697
has text: Do you think forwarding here only what is the requirement.?I mean where should these lines be written RequestDispatcher dispatcher = request.getRequestDispatcher("pagename.jsp"); dispatcher.forward(request, response);

http://stackoverflow.com/comment/35458459
has text: Did you copy-paste the content of your build.properties?
comment on: http://stackoverflow.com/q/23184274
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/35620955
score: 0
type: AnswerComment
type: Comment
has text: I checked the working directory, it was slightly different to where Netbeans had put my text file, so I copied the textfile to the reported working directory, but I am still getting a file not found error
comment on: http://stackoverflow.com/a/23273778

http://stackoverflow.com/q/23251241
type: Question
answer count: 2
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/23251587
has comment: http://stackoverflow.com/comment/35578337
possible better answer: http://stackoverflow.com/a/23251467
tagged with: executorservice
has answer: http://stackoverflow.com/a/23251587
has body: I want to submit a new task within an existing task in case of a failure(Exception), but had some issues running the code below: public class TestTask implements Runnable{ private int myInt; private ExecutorService exec; public TestTask(int x, ExecutorService s){ this.myInt=x; this.exec=s; } @Override public void run() { try{ //print number if it's odd; otherwise throw exception if(this.myInt%2 ==0) throw new Exception(); else System.out.println("Asynchronous task: "+ this.myInt); //do sth } catch (Exception e) { System.out.println("resubmitting.."); //## TODO: PROBLEM?? this.exec.execute(new TestTask(this.myInt+1, this.exec)); } } public static void main(String[] args) { int NTHREADS =2; final ExecutorService service= Executors.newFixedThreadPool(NTHREADS); //run tasks for(int i=0; i&lt;10; i++){ service.execute(new TestTask(i, service) ); } //... } //.... The code compiles and runs for a few steps then throws java.util.concurrent.RejectedExecutionException. Any ideas how to interpret this and how to fix? Thanks! [EDIT: Stack Trace added below] resubmitting.. Asynchronous task: 1 resubmitting.. Asynchronous task: 3 resubmitting.. Asynchronous task: 5 resubmitting.. Exception in thread "pool-1-thread-2" java.util.concurrent.RejectedExecutionException: Task pe.ads.TestTask@4e19b97c rejected from java.util.concurrent.ThreadPoolExecutor@322ba3e4[Shutting down, pool size = 2, active threads = 2, queued tasks = 8, completed tasks = 3] at java.util.concurrent.ThreadPoolExecutor$AbortPolicy.rejectedExecution(ThreadPoolExecutor.java:2048) at java.util.concurrent.ThreadPoolExecutor.reject(ThreadPoolExecutor.java:821) at java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:1372) at pe.ads.TestTask.run(TestTask.java:26) 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) Exception in thread "pool-1-thread-…
upvote count: 2
tagged with: multithreading
has comment: http://stackoverflow.com/comment/35578702
score: 2
type: AnsweredQuestion
has title: Task execution with ExecutorService: Can I submit task within another task?
has comment: http://stackoverflow.com/comment/35578769
has answer: http://stackoverflow.com/a/23251467
tagged with: threadpool
tagged with: java
has comment: http://stackoverflow.com/comment/35578625

github
tags question: http://stackoverflow.com/q/23281598
tag name: github
type: Tag

http://stackoverflow.com/comment/35629756
score: 0
has text: The problem that I have now is the first time I use the reHash method if works perfect. The second and third time it doesn't work good. All the values goes to the same position of the hashTable. Why this happens?
type: Comment
comment on: http://stackoverflow.com/a/23272264
type: AnswerComment

http://stackoverflow.com/q/23161904
type: Question
has comment: http://stackoverflow.com/comment/35419711
tagged with: java
upvote count: 4
downvote count: 0
answer count: 1
has body: So i have downloaded new Netbeans 8 version some time ago. In this new version everytime when i declare private variable and assign to it value only once netbeans suggests me to make field final because is never changed. Ok I understand what final variable is but **whats the advantage in declaring private final int x=3; variable aka constant over private int x=3; and never change it ** i thought about Concurrency ? - But this doesnt make sense for me if value of non-final variable remains the same whole time Speed ?- I think this may be the reason(some caching ?) but im not sure Any clarification will be appreciated
score: 4
favorite count: 0
has title: Why Netbeans suggests making variable final
tagged with: constants
tagged with: netbeans
has answer: http://stackoverflow.com/a/23161932
has comment: http://stackoverflow.com/comment/35420142
type: UnansweredQuestion

http://stackoverflow.com/a/23160382
score: 1
downvote count: 0
type: Answer
has body: When the fragment is started, it creates a new, empty list. In the first onClick in Monday_fragment, it replaces the list with one created from entryLogs. When you return from Monday_list_fragment, the onCreate method is called, and the list and entryLogs are overwritten with new, empty ones. The onCreate method can be called multiple times, including when the device orientation changes. You need to rethink how and when you set up the state of your fragment.
upvote count: 1
has comment: http://stackoverflow.com/comment/35417465
answers question: http://stackoverflow.com/q/23160112

http://stackoverflow.com/q/23287702
favorite count: 0
has answer: http://stackoverflow.com/a/23295851
score: 6
answer count: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23287884
tagged with: java
accepted answer: http://stackoverflow.com/a/23287739
upvote count: 7
downvote count: 1
type: Question
possible better answer: http://stackoverflow.com/a/23287731
has answer: http://stackoverflow.com/a/23287739
has title: assertTrue with "instanceof" vs assertEquals
has comment: http://stackoverflow.com/comment/35646184
has answer: http://stackoverflow.com/a/23287731
has body: I wonder why this fails: assertEquals(Key.class, expectedKey.getClass()); and this does not: assertTrue(expectedKey instanceof Key); Is there a real difference between the two?
tagged with: junit

http://stackoverflow.com/a/23158314
has comment: http://stackoverflow.com/comment/35449661
type: Answer
has body: Best way to do so is to read both files and store your login/password pairs in a HashMap&lt;String, String&gt; Then you can easily check, if entered login-password pair is a match. Map&lt;String, String&gt; map = new HashMap&lt;&gt;(); while(fileout.hasNext() &amp;&amp; fileout2.hasNext()){ username = fileout.next(); password = fileout2.next(); map.put(username, password); } ... if (password.equals(map.get(username)) { ... }
accepted answer of: http://stackoverflow.com/q/23158218
has comment: http://stackoverflow.com/comment/35457693
has comment: http://stackoverflow.com/comment/35433239
answers question: http://stackoverflow.com/q/23158218
score: 0
type: AcceptedAnswer

http://stackoverflow.com/comment/35486464
type: QuestionComment
has text: You could use a `PreparedStatement` and bind a `java.sql.Timestamp` instance.
comment on: http://stackoverflow.com/q/23200124
score: 1
type: Comment

http://stackoverflow.com/comment/35397667
type: Comment
type: AnswerComment
has text: Stupit Mistake on my part
comment on: http://stackoverflow.com/a/23149224
score: 0

http://stackoverflow.com/comment/35536856
score: 0
type: QuestionComment
type: Comment
has text: can we see the structure of the two tables in question?
comment on: http://stackoverflow.com/q/23228108

http://stackoverflow.com/q/23132400
favorite count: 0
type: UnansweredQuestion
tagged with: outputstream
score: -1
has title: FileNotFoundException from new FileOutputStream
has comment: http://stackoverflow.com/comment/35366675
tagged with: access-denied
has answer: http://stackoverflow.com/a/23132757
downvote count: 1
type: Question
has body: I am trying to make a program that will get all files within a jar file, and then copy them. This is the code I am using to copying files: public static void copyFolder(File src, File dest) throws IOException{ if(src.isDirectory()){ //if directory not exists, create it if(!dest.exists()){ dest.mkdir(); System.out.println("Directory copied from " + src + " to " + dest); } //list all the directory contents String files[] = src.list(); for (String file : files) { //construct the src and dest file structure File srcFile = new File(src, file); File destFile = new File(dest, file); //recursive copy copyFolder(srcFile,destFile); } }else{ //if file, then copy it //Use bytes stream to support all file types InputStream in = new FileInputStream(src); OutputStream out = new FileOutputStream(dest); byte[] buffer = new byte[1024]; int length; //copy the file content in bytes while ((length = in.read(buffer)) &gt; 0){ out.write(buffer, 0, length); } in.close(); out.close(); System.out.println("File copied from " + src + " to " + dest); } } But there is an error - java.io.FileNotFoundException: (Access is denied) in OutputStream out = new FileOutputStream(dest);. Now, I have no idea why or what does that really mean? How can I fix it? Plus, I have absolutely no idea how to extract files from a jar file. I have seen the ZipFile class but I don't really know how to use it... So that leaves me with 3 questions: 1. Whats wrong with the copying code? 2. What does Access is denied mean? 3. Can anyone give me a method for getting files from a jar file? Because jar.listFiles() returns an empty list. Thanks in advance!
tagged with: java
linked to: http://stackoverflow.com/q/1529611
upvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/35366573
tagged with: jar

http://stackoverflow.com/q/23237749
tagged with: java
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35727626
has comment: http://stackoverflow.com/comment/35624928
type: Question
has title: Output of the webdriver program is not coming in the right format(tabular way)
has body: import java.util.List; import java.util.concurrent.TimeUnit; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.firefox.FirefoxDriver; public class WebTable_Dynamic { public static void main(String[] args) { WebDriver driver= new FirefoxDriver(); driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS); driver.get("http://www.w3schools.com/tags/tag_table.asp"); WebElement element=driver.findElement(By.xpath("//table[@class='reference notranslate']")); List&lt;WebElement&gt; rows=element.findElements(By.tagName("tr")); for(int rowNum=1;rowNum&lt;rows.size();rowNum++){ List&lt;WebElement&gt; cells=rows.get(rowNum).findElements(By.tagName("td")); for(int colNum=0;colNum&lt;cells.size();colNum++){ System.out.print(cells.get(colNum).getText()); System.out.print("----"); } System.out.println(); } driver.close(); } } My program is extracting the elements from a table. Currently I am not getting the output in a tabular way due to line break &lt;br&gt; tags in the cell content. Can someone guide me in getting the o/p in a tabular way?
tagged with: selenium-webdriver
answer count: 0
score: 0
has comment: http://stackoverflow.com/comment/35590536

http://stackoverflow.com/comment/46750158
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23152786
score: 0
has text: I added another solution(?)

http://stackoverflow.com/comment/35367508
type: Comment
has text: The only other thing I can see is that your not creating a fragment of type FragmentClass, your just creating a plain old Fragment and allocating it your arguments instead of your fragment class. Try FragmentClass Fragment = new FragmentClass();
type: AnswerComment
comment on: http://stackoverflow.com/a/23132616
score: 0

http://stackoverflow.com/q/23244390
has body: I've trying to count how many matching patterns are there in a string. I'm new to using java.util.regex and I was planning on using matcher.groupCount() to get the number of matching groups. Since according to the documentation it returns the number of capturing groups. Returns the number of capturing groups in this matcher's pattern. Group zero denotes the entire pattern by convention. It is not included in this count. Any non-negative integer smaller than or equal to the value returned by this method is guaranteed to be a valid group index for this matcher. Here's a simplified example of my problem: Pattern pattern = Pattern.compile("@"); Matcher matcher = pattern.matcher("@#@#@#@#@"); System.out.println(matcher.groupCount()); Its output is 0. Which part did I misunderstand? How do I count the number of matching patterns?
downvote count: 0
has title: groupCount() in java.util.regex.Matcher always returns 0
has comment: http://stackoverflow.com/comment/35565922
has answer: http://stackoverflow.com/a/23244470
answer count: 3
accepted answer: http://stackoverflow.com/a/23244470
tagged with: regex
favorite count: 0
type: AnsweredQuestion
upvote count: 3
linked to: http://stackoverflow.com/q/12413974
type: Question
score: 3
possible better answer: http://stackoverflow.com/a/23244484
tagged with: java
has answer: http://stackoverflow.com/a/23244484
has answer: http://stackoverflow.com/a/23244527

http://stackoverflow.com/comment/35444610
score: 0
type: Comment
has text: I cannot use abstract class for various reasons
comment on: http://stackoverflow.com/a/23175968
type: AnswerComment

http://stackoverflow.com/comment/35650666
has text: All Spring jar should be in the same varsion and be sure that there is no other copies of them. I mean in differnt versions. E.g. `org.springframework.context-3.0.4.RELEASE.jar, org.springframework.beans_3.0.5.RELEASE.jar` is bad. They both should be at least 3.0.5. However it isn't the last version: http://projects.spring.io/spring-framework/
type: Comment
comment on: http://stackoverflow.com/a/23289801
score: 0
type: AnswerComment

http://stackoverflow.com/q/23181978
has title: Enhance library for Java 8 while keeping backwards compatibility
has comment: http://stackoverflow.com/comment/35457833
downvote count: 0
score: 8
favorite count: 0
has answer: http://stackoverflow.com/a/23192695
upvote count: 8
type: UnansweredQuestion
tagged with: java-8
answer count: 4
tagged with: backwards-compatibility
tagged with: java
has body: I'm developing an open source library in Java and would like to ensure that it is convenient for Java 8 users, and takes advantage of new concepts in Java 8 wherever possible (lambdas etc.) At the same time I absolutely need to maintain backwards compatibility (the library must still be usable for people using Java 6 or 7). What useful features from Java 8 can I adopt that would be beneficial for library users without breaking library compatibility for users of older Java versions?
has answer: http://stackoverflow.com/a/23275771
has answer: http://stackoverflow.com/a/23204766
type: Question
has comment: http://stackoverflow.com/comment/35455314
has answer: http://stackoverflow.com/a/23182684

http://stackoverflow.com/a/23184292
has body: You have to add the support library to your project 1.Download support library from SDK Manager 2.Right click project in eclipse -> add support library Compatibility issues may occur I recommend Updating to Keplar
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23184230

http://stackoverflow.com/comment/37023429
type: AnswerComment
comment on: http://stackoverflow.com/a/23397113
type: Comment
score: 0
has text: @ChristianSisti I meant to provide your own implementation, I only linked the other class, so you can see how it's done.

http://stackoverflow.com/comment/35419489
score: 0
comment on: http://stackoverflow.com/q/23161586
type: Comment
type: QuestionComment
has text: It's not really clear what you mean by "Model.listSubjectsWithProperty does not work with typed literal". If you added a typed literal somewhere, you'll need to give a typed literal, not a plain literal, to listSubjectsWithProperty.

http://stackoverflow.com/q/23188913
has answer: http://stackoverflow.com/a/23376480
upvote count: 9
tagged with: java
has body: I'm trying to write a job scheduling system in GWT that maintains an array of exceptions (Class&lt;? extends Exception&gt;[] exceptions), that might be resolved by retrying the job. For this, if the scheduler catches an exception, I need to see if this exception matches one of the classes in the array. So, I would like to have a function like this: boolean offerRetry(Exception exception) { for (Class&lt;? extends Exception&gt; e: exceptions) if (e.isInstance(exception)) return true; return false; } Unfortunately Class.isInstance(...) isn't available in GWT. Is there a good work-around for this? My current best guess is something like this: public static boolean isInstance(Class&lt;?&gt; clazz, Object o) { if ((clazz==null) || (o==null)) return false; if (clazz.isInterface()) throw new UnsupportedOperationException(); Class&lt;?&gt; oClazz = o.getClass(); while (oClazz!=null) { if (oClazz.equals(clazz)) return true; oClazz = oClazz.getSuperclass(); } return false; } Unfortunately, this approach does not support testing against interfaces, and I don't have any idea how to fix that either as Class.getInterfaces() is also not available. But would this approach at least work the same way as Java's Class.isInstance in all other cases, excluding interfaces? Specifically, if I look at GWT's source for Class.java, the getSuperclass() method contains a check of isClassMetadataEnabled(), which might return false (but I don't know in which cases), as it contains a comment saying "This body may be replaced by the compiler". Or is there a better way entirely to do this?
tagged with: class
score: 9
answer count: 2
downvote count: 0
has title: GWT work-around for missing Class.isInstance()
favorite count: 0
tagged with: instanceof
has comment: http://stackoverflow.com/comment/35541140
has answer: http://stackoverflow.com/a/26001394
has comment: http://stackoverflow.com/comment/35543007
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35545264
type: Question
tagged with: gwt

otto
tag name: otto
type: Tag
tags question: http://stackoverflow.com/q/23265544

http://stackoverflow.com/q/23285609
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35642372
has answer: http://stackoverflow.com/a/23285700
tagged with: dictionary
has comment: http://stackoverflow.com/comment/35642384
tagged with: multimap
has answer: http://stackoverflow.com/a/23287123
has body: Currently I have a map containing key as a string &amp; values as a list of strings. Map> How can I convert these values from list of strings to a single string? eg: Below are the values which are contained in my map . {id=[1057-27620], name=[apple,mango,banana], color=[apple:red, mango:yellow, banana:black&amp;yellow], place=[greece]} I want the above to be stored in Map&lt;String,String&gt;as {id="1057-27620", name="apple,mango,banana", color="apple:red, mango:yellow, banana:black&amp;yellow", place="greece"} How do I do that?
downvote count: 1
type: Question
tagged with: hashmap
tagged with: java
has comment: http://stackoverflow.com/comment/35642593
score: -1
has title: How do I convert the values in a Map from List of Strings to a String?
has comment: http://stackoverflow.com/comment/35642383
answer count: 3
has comment: http://stackoverflow.com/comment/35642416
upvote count: 0
has answer: http://stackoverflow.com/a/23285667

http://stackoverflow.com/q/23194316
type: Question
has title: Is string Object Created in Heap if we use new String("abcd")
has comment: http://stackoverflow.com/comment/35476300
has answer: http://stackoverflow.com/a/23194874
score: 3
has body: String s1 = new String("anil"); String s2 = s1.toUpperCase(); String s3 = s1.toLowerCase(); System.out.println(s1 == s2); System.out.println(s1 == s3); if string object created in heap then both are false.But it gives false,true.
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/23194609
linked to: http://stackoverflow.com/q/513832
answer count: 5
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23194401
has answer: http://stackoverflow.com/a/23194503
duplicate of: http://stackoverflow.com/q/513832
has comment: http://stackoverflow.com/comment/35476669
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/23194601

http://stackoverflow.com/comment/35490723
type: QuestionComment
comment on: http://stackoverflow.com/q/23194290
score: 0
type: Comment
has text: Welcome to Stack Overflow! For help formatting your posts, click on the big fat orange question mark in the editor. Also, *always* be sure to read the descriptions that appear when selecting tags!

httpsurlconnection
type: Tag
tags question: http://stackoverflow.com/q/23276541
tag name: httpsurlconnection

http://stackoverflow.com/q/23206535
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35498620
tagged with: java
has comment: http://stackoverflow.com/comment/35499077
has title: Eclipse deleted every project and file
type: Question
tagged with: eclipse
score: 0
has comment: http://stackoverflow.com/comment/35501000
has comment: http://stackoverflow.com/comment/35498622
has body: I just encountered a HUGE problem w/ eclipse. It deleted EVERY SINGLE file in EVERY SINGLE project in my workspace. No Joke. I have nothing but the .project files. When I tried to restore from local history it said there was nothing. I made a backup but somehow that got deleted as well. I'm starting to think that Eclipse is NOT reliable because this is the second time this has happened to me. Is there a way to get the projects back ? because I had a project that I had been working on for about 3 months and I need it. I use Windows 8.1 Update 1 if that changes anything.
answer count: 0

http://stackoverflow.com/a/23273533
type: Answer
has body: If this line completes successfully: int[][] scanArray = new int[someMethodThatCenReturnZero()][2]; Then this can never happen: if (scanArray == null) { PApplet.println("null"); } The result of calling new will never be null. Instead you should check scanArray.length == 0.
answers question: http://stackoverflow.com/q/23273223
score: 0

http://stackoverflow.com/comment/35415678
comment on: http://stackoverflow.com/q/23159579
score: 0
type: Comment
type: QuestionComment
has text: We need more information before we can help you. What does "doesn't seem to work correctly." mean (i.e. what are you seeing). Also, post the relevant code (parent layout, scaling, rotations, etc.) otherwise you will get wild guesses rather than helpful answers.

http://stackoverflow.com/comment/35490326
type: AnswerComment
score: 0
has text: "third value" would be the x[2] spot in zero based
type: Comment
comment on: http://stackoverflow.com/a/23202077

http://stackoverflow.com/a/23197677
type: Answer
has body: ClassCastException API Specifications clearly says: Thrown to indicate that the code has attempted to cast an object to a subclass of which it is not an instance. ClassCastException occurs at runtime because compiler believes that the cast may be a valid one. Eg: // The below line will compile but ClassCastException will be raised at runtime Integer i = (Integer) new Object(); Incompatible type error can easily be resolved by the compiler at compile time itself. It simply looks if the class to which you are trying to cast a specific object falls in the same hierarchy. Eg: String str = "abc"; &lt;br&gt;Integer number = (Integer) str; // Compile Error : Integer and String are not in the same hierarchy
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/23197564
downvote count: 0

http://stackoverflow.com/comment/35526022
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23221784
has text: For delete document I use UpdateRequest req = new UpdateRequest(); req.deleteByQuery("documentId:"documentId);
score: 0

http://stackoverflow.com/comment/35470182
score: 0
has text: If you could easily bypass Windows Defender from untrusted software, it wouldn't be doing its job, would it?
type: QuestionComment
comment on: http://stackoverflow.com/q/23190544
type: Comment

http://stackoverflow.com/comment/82379489
type: Comment
score: 1
has text: CriteriaDelete<MyEntity> is not a truncate operation.Please do not mess delete and truncate with each others.Especially,using oracle as a DB it can cause a really big performance issue using delete instead of truncate with big tables.
type: AnswerComment
comment on: http://stackoverflow.com/a/23272332

http://stackoverflow.com/a/23278772
score: 2
upvote count: 2
accepted answer of: http://stackoverflow.com/q/23278685
type: AcceptedAnswer
downvote count: 0
has body: The generic type parameter that Java infers from the call to Arrays.asList is the common type of the arguments to asList -- Integer, so the new ArrayList is an ArrayList&lt;Integer&gt;, not an ArrayList&lt;Double&gt;. Java won't throw a ClassCastException at List&lt;Double&gt; listD = (List&lt;Double&gt;) listI;, because at runtime, type erasure has already happened, and to the JVM, the code looks like this: List listD = (List) listI; That is perfectly fine to the JVM. The ClassCastException comes later, from attempting to cast the Integer that is really coming from casting the list to a Double. With generics, the Java compiler will insert an implicit cast to the generic type parameter, in this case, Double, when an item is retrieved. However, it's really an Integer. There should have been a warning, on the cast when you compiled this code, about an "unchecked cast" when casting the List&lt;?&gt; to a List&lt;Double&gt;. It warns you about the very possibility that you've demonstrated - a potential ClassCastException later.
type: Answer
answers question: http://stackoverflow.com/q/23278685

http://stackoverflow.com/comment/35545950
comment on: http://stackoverflow.com/a/23213544
has text: For future reference the '.' and '..' are part of relative urls, using "./images/myimage.png" would also have worked, '.' refers to the current working directory, '..' looks in the directory directly above your current working directory. I would check out relative urls you are sure to come across them in the future. Cheers
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/a/23169114
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/23168910
score: 4
answers question: http://stackoverflow.com/q/23168910
upvote count: 4
has body: Looks like the following line was introduced at this commit https://github.com/apache/tomcat/blob/bd8122700c2e70e5adbaddcd289fb1a974f981fe/java/org/apache/tomcat/util/net/NioEndpoint.java As far as I can tell this is NioEndpoint is using blocking ServerSocketChannel in order for it to block and wait for an incoming connection and only after it accepts it it processes this incoming socket channel in a non-blocking manner (see setSocketOptions method). The alternative to make ServerSocketChannel a non-blocking one will result as author points out into a busy read - that is a thread will be constantly polling for incoming connections as accept() in non-blocking mode may return null. You can find some useful explanation here. P.S. I presume that cryptic APR stands for Apache Portable Runtime.

http://stackoverflow.com/a/23174692
downvote count: 1
answers question: http://stackoverflow.com/q/23174265
has body: Try to escape the space with back slash.. Like C:\program\folder\ \name\java\jdk\bin
score: 0
type: Answer
upvote count: 1

http://stackoverflow.com/a/23178412
score: 1
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23178389
has body: This line: Scanner scanner = new Scanner(new File("Test.txt")); is inside the curly braces of the try block. Therefore, it is visible only within those curly braces. To make sure it's visible outside, declare the variable before the try: Scanner scanner; and then, inside the try block, just assign to it, don't declare it (the difference is that you don't include the type name; that makes it an assignment statement): scanner = new Scanner(new File("Test.txt"));
answers question: http://stackoverflow.com/q/23178389
type: Answer
downvote count: 0

http://stackoverflow.com/q/23260201
has comment: http://stackoverflow.com/comment/35602700
upvote count: 1
has body: i am trying to convert my html to pdf file in java using itext.i am using eclipse editor,i have add two jar file xmlworker-5.4.3.jar, itextpdf-5.1.0.jar in classpath.my code is given beloow Document document = new Document(); PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("pdf.pdf")); document.open(); XMLWorkerHelper.getInstance().parseXHtml(writer, document,new FileInputStream("index.html")); System.out.println( "PDF Created!" ); when i run above code it gives me exception. i don't know how to solve it. my exception is given below Exception in thread "main" java.lang.NoSuchMethodError: com.itextpdf.text.log.LoggerFactory.getLogger(Ljava/lang/Class;)Lcom/itextpdf /text/log/Loger; at com.itextpdf.tool.xml.net.FileRetrieveImpl.&lt;clinit&gt; (FileRetrieveImpl.java:67)at com.itextpdf.tool.xml.css.StyleAttrCSSResolver. &lt;init&gt; (StyleAttrCSSResolver.java:113) at com.itextpdf.tool.xml.css.StyleAttrCSSResolver.&lt;init&gt; (StyleAttrCSSResolver.java:102) at com.itextpdf.tool.xml.css.StyleAttrCSSResolver.&lt;init&gt; (StyleAttrCSSResolver.java:90) at om.itextpdf.tool.xml.XMLWorkerHelper.parseXHtml(XMLWorkerHelper.java:213) at df.tool.xml.XMLWorkerHelper.parseXHtml(XMLWorkerHelper.java:185) at com.ps.App.main(App.java:47) i think my error will at this place XMLWorkerHelper.getInstance().parseXHtml(writer, document,new FileInputStream("index.html")); Help me hove to solve this exception..... Thanks in advance.
tagged with: http://stackoverflow.com/tag/pdf
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/23260617
has title: exception during convert html to pdf using itext
downvote count: 0
score: 1
tagged with: java
tagged with: itext
type: Question
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23260617
tagged with: xmlworker

http://stackoverflow.com/comment/35461271
score: 0
type: AnswerComment
has text: yes, of course. needed methods determines by type of object(not by link type)
type: Comment
comment on: http://stackoverflow.com/a/23182634

http://stackoverflow.com/q/23217972
has title: JPA throws no EntityExistsException but generates a duplicate row (auto generated PK)
score: 0
answer count: 2
tagged with: eclipselink
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23218211
has answer: http://stackoverflow.com/a/23218632
tagged with: java
has comment: http://stackoverflow.com/comment/35519322
type: Question
has comment: http://stackoverflow.com/comment/35521538
tagged with: jpa
has body: I am new to JPA and was experimenting a bit in hope of figuring out the Entity lifecycle model. I expected the code below to throw an EntityExistsException. However, instead of throwing the expected exception, it just creates a new row in database table with a new primary key (incremented by one). Can anyone explain this? I suspect it might have something to do with the @GeneratedValue annotation on my ID field in combination with my autoincrementing primary key in the corresponding table. Below you can find 3 snippets: the code I try to run, my entity definition and my table design. I would like to thank you in advance for shining your light on my misunderstanding. Kind regards ps: I use eclipselink as jpa implementation and a Derby database Script: Teacher teacher = new Teacher("John","Doe","English"); //Persist John Doe EntityManager em = Persistence.createEntityManagerFactory("jpatest").createEntityManager(); em.getTransaction().begin(); em.persist(teacher); em.getTransaction().commit(); em.close(); //Try to persist John Doe a second time em = Persistence.createEntityManagerFactory("jpatest").createEntityManager(); em.getTransaction().begin(); em.persist(teacher); em.getTransaction().commit(); //I Expect a throw here em.close(); Table Design: CREATE TABLE teachers (id INT GENERATED ALWAYS AS IDENTITY, firstname VARCHAR(20) ,lastname VARCHAR(40), PRIMARY KEY(id)) Entity definition: package testpackage; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Table; import javax.persistence.Transient; @Entity @Table(name="teachers", schema="USERNAME") public class Teacher { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private int id; private String firstName; private String lastName; @Transient private String course; /** * Zero argument constructor for JPA */ Teacher(){ } public Teacher(String firstName, String lastName, String course){ this.f…
tagged with: derby

http://stackoverflow.com/comment/35447746
has text: Ow wow. Just import YoutubePlayerAPI.jar into Unity as well huh. So dumb of me :D. It's late. Thanks man!
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23177808
score: 0

http://stackoverflow.com/a/23158511
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23158311
has body: First, it seems you are calling methods in an inappropriate way, producing a repeating cycle: paint() invokes update() update() invokes repaint() repaint() invokes paint() ... Then, respect to double buffering, I hope this link will be useful for you: Double Buffering with awt Regards,
accepted answer of: http://stackoverflow.com/q/23158311
type: AcceptedAnswer

http://stackoverflow.com/comment/35616849
type: AnswerComment
has text: I think it might be related to GRADLE-2532 as well from reading the comments on that. Let me change to using the other gradle wrapper and I'll let you know.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23271847

http://stackoverflow.com/q/23290423
favorite count: 0
possible better answer: http://stackoverflow.com/a/23290480
has answer: http://stackoverflow.com/a/23290482
type: AnsweredQuestion
has body: boolean method(int value) { switch(value) { case 0: return false; case 1: return true; default: Assert.fail("Unhandled value."); } } This fails compilation with the error "Method must return a result" even though Assert.fail() does nothing but throw an AssertionError. If I throw an AssertionError myself instead of calling Assert.fail() it compiles.
score: 1
tagged with: java
tagged with: throws
tagged with: methods
type: Question
has answer: http://stackoverflow.com/a/23290480
downvote count: 0
tagged with: assert
has comment: http://stackoverflow.com/comment/35650971
answer count: 3
upvote count: 1
tagged with: assertions
has title: "Method must return a result" when calling another method that only throws an exception
has answer: http://stackoverflow.com/a/23290500
accepted answer: http://stackoverflow.com/a/23290500

http://stackoverflow.com/comment/35481874
type: AnswerComment
comment on: http://stackoverflow.com/a/23197698
score: 0
has text: Nice answer in a short time! I want to up vote 10 times.
type: Comment

http://stackoverflow.com/q/23141598
has body: I am trying to read a extremely large file to an array. it is obvious that i am not reading it to an array at the moment but that is not the problem i am having. it is about 600 million digits and this seems to cause it to get an error. Exception in thread "main" java.lang.OutOfMemoryError: Java heap space BufferedReader brWorld = null; String World; brWorld = new BufferedReader(new FileReader("Saves/" + Name)); World = brWorld.readLine(); String Numbers = World; String[] LoadWorld = Numbers.split(""); for(int x = 0; x &lt; MaterialArray.length * MaterialArray.length; x++){ System.out.println(String.valueOf(LoadWorld[x])); } Im Loading a would into an array for my game. Is there any way of loading a text file this big? thanks Liam
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/35384080
tagged with: java
has answer: http://stackoverflow.com/a/23141833
has answer: http://stackoverflow.com/a/23141719
type: Question
tagged with: for-loop
has title: Reading a Large File to an array java.lang.OutOfMemoryError: Java heap space
tagged with: bufferedreader
has comment: http://stackoverflow.com/comment/35384046
answer count: 2
upvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/35384649
tagged with: out-of-memory
has comment: http://stackoverflow.com/comment/35384457
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35384034

http://stackoverflow.com/q/23159589
has comment: http://stackoverflow.com/comment/35416464
has comment: http://stackoverflow.com/comment/35416137
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35416373
has body: I used the sound Manager API to create a music player. tutoriel of creating playlist audio the player is in the form of a list of tags (a), and I want to apply a voting system for my songs. every time I click on a link "a", a div appears (contains star) to give an evaluation and make the database update. I use it for ajax and servlet: ajax code: function voter(){ $('#informations .container .votes_main .votes_gray .votes_buttons a').click(function () { valide= true; var voteVal = $(this).attr('id'); $.ajax({ type:'GET', contentType: "charset=utf-8", url:''+encodeURI('/RecommandationDefault/rating?vote='+voteVal), success:function(response){ alert(response); }, error: function(e){ alert('Error: ' + e); } }); }); return false; } servlet code: /* * To change this template, choose Tools | Templates * and open the template in the editor. */ package votes; import java.io.IOException; import java.io.PrintWriter; import java.sql.ResultSet; import java.sql.SQLException; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @WebServlet(name="rating") public class rating extends HttpServlet { protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { } @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { int i=0; response.setContentType("text/plain"); response.setCharacterEncoding("UTF-8"); response.getWriter().write("salut"); i++; System.out.println("executé "+i+" fois"); } @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { } @Override public String getServletInfo() { return "Short description"; }// &lt;/editor-fold&gt; } when I click on a link and I vote, only one alert is displayed when I click afte…
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/35415629
tagged with: servlets
type: Question
has comment: http://stackoverflow.com/comment/35416449
tagged with: javascript
has title: ajax-servlet; doGet method execute multiple times for a single ajax call
tagged with: ajax
score: 0
tagged with: soundmanager2

http://stackoverflow.com/comment/35586379
score: 0
comment on: http://stackoverflow.com/a/23255259
type: Comment
has text: or he could look at my solution which does the job with a single additional line. I dont think a thread dedicated to nothing but running another thread is very good design (which is what this code is doing).
type: AnswerComment

http://stackoverflow.com/q/23211625
type: AnsweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/49702190
score: 1
has body: When I try to run my Android Application and I include the "javaee-api-7.0.jar" in my libs folder, I get the following error at compilation time: [2014-04-22 11:27:53 - firstApp] Dx trouble processing "javax/management/j2ee/ListenerRegistration.class": Ill-advised or mistaken usage of a core class (java.* or javax.*) when not building a core library. This is often due to inadvertently including a core library file in your application's project, when using an IDE (such as Eclipse). If you are sure you're not intentionally defining a core class, then this is the most likely explanation of what's going on. However, you might actually be trying to define a class in a core namespace, the source of which you may have taken, for example, from a non-Android virtual machine project. This will most assuredly not work. At a minimum, it jeopardizes the compatibility of your app with future versions of the platform. It is also often of questionable legality. If you really intend to build a core library -- which is only appropriate as part of creating a full virtual machine distribution, as opposed to compiling an application -- then use the "--core-library" option to suppress this error message. If you go ahead and use "--core-library" but are in fact building an application, then be forewarned that your application will still fail to build or run, at some point. Please be prepared for angry customers who find, for example, that your application ceases to function once they upgrade their operating system. You will be to blame for this problem. If you are legitimately using some code that happens to be in a core package, then the easiest safe alternative you have is to repackage that code. That is, move the classes in question into your own package namespace. This means that they will never be in conflict with core system classes. JarJar is a tool that may help you in this endeavor. If you find that you cannot do this, then that is an indication that the path you are on will ulti…
favorite count: 0
has comment: http://stackoverflow.com/comment/35507486
has comment: http://stackoverflow.com/comment/35507413
answer count: 2
has comment: http://stackoverflow.com/comment/35508515
possible better answer: http://stackoverflow.com/a/30828743
upvote count: 1
has answer: http://stackoverflow.com/a/30828743
has comment: http://stackoverflow.com/comment/35507515
has answer: http://stackoverflow.com/a/30839178
has comment: http://stackoverflow.com/comment/35508418
has comment: http://stackoverflow.com/comment/35509492
tagged with: java
tagged with: jakarta-ee
has comment: http://stackoverflow.com/comment/35509628
downvote count: 0
has title: Cannot include "javaee-api-7.0.jar" in Android Application
accepted answer: http://stackoverflow.com/a/30839178
type: Question

http://stackoverflow.com/comment/35549746
comment on: http://stackoverflow.com/q/23235150
score: 0
type: Comment
type: QuestionComment
has text: i am not using the socket here to send the screen shots

http://stackoverflow.com/a/23257964
has comment: http://stackoverflow.com/comment/35590916
score: 1
accepted answer of: http://stackoverflow.com/q/23257373
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23257373
has body: If your Unicode font has the hearts, clubs, diamonds and spades symbols, then all you need to do to draw them in the color of your choice is the same as drawing any other character in the color of your choice: simply use setColor. Now you should start from the "filled" version of spades, hearts, diamonds and clubs, they are: - spade: ♠ - heart: ♥ (use 2665 instead of 2661) - diamonds: ♦ (use 2666 instead of 2662) - clubs: ♣b Then you simply do: g.setColor(Color.RED); g.drawString("♥"); And then you change the color, say, back to black to draw text and back to red/black for suits (or red, black, blue and green if you want to use a "four-color deck").
upvote count: 1
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/44274352

http://stackoverflow.com/comment/35629391
type: Comment
type: QuestionComment
score: 0
has text: No there was no misinterpretation. I simple downvoted this question because there are already an infinite amount of answers to it.
comment on: http://stackoverflow.com/q/23272331

http://stackoverflow.com/q/23254651
answer count: 2
tagged with: arrays
tagged with: string
score: 0
has body: Driver Class: //Objective: make a 10X10 Grid appear //it should be a red and white or black and white //checkerboard. public Checkers() { con.setLayout(new FlowLayout()); for (int xDimension = 0; xDimension&lt;theGrid.length; xDimension++) { for (int yDimension = 0; yDimension&lt; theGrid[xDimension].length; yDimension++) { theGrid[xDimension][yDimension] = new Block(xDimension,yDimension); } } //pass in the row and column numbers to the constructor //these will define where the Blocks appear. t.start(); setDefaultCloseOperation(EXIT_ON_CLOSE); } public void paint(Graphics gr) { Image i=createImage(getSize().width, getSize().height); Graphics2D g2 = (Graphics2D)i.getGraphics(); for (int x = 0; x &lt; theGrid.length; x++) { for (int y = 0; y &lt; theGrid[x].length; y++) { theGrid[x][y].draw(g2); } } g2.dispose(); gr.drawImage(i, 0, 0, this); } } Block Class: public class Block { private int x, y, width, height, rowNum, colNum; private Color color; public Block(int xDimension, int yDimension) { Random ra = new Random(); xDimension = rowNum; yDimension = colNum; //finish public void draw(Graphics2D gt) { // put your code here if (rowNum % 2 == 0) { if (colNum % 2 == 0) { gt.fillRect(x, y, 20, 20); gt.setColor(Color.RED); } else if (colNum % 2 == 1) { gt.fillRect(x, y, 20, 20); gt.setColor(Color.WHITE); } } else if (rowNum % 2 == 1) { if (colNum % 2 == 0) { gt.fillRect(x, y, 20, 20); gt.setColor(Color.WHITE); } else if (colNum % 2 == 1) { gt.fillRect(x, y, 20, 20); gt.setColor(Color.RED); } } //Red/Black/white color. gt.drawString("R:"+rowNum+", C:"+colNum, x+3, y +3); } public void getLocation() { } } For programming, we're making a checkerboard using code our teacher has made but we have to fill in the rest. He left instructions via //. The gist of this assigment is to program a checkerboard, (with alternating colors, every other block is red) and within the block, it lets you know what row and column the block is located in. I'm having difficulty simply getting my pr…
has answer: http://stackoverflow.com/a/23256370
has title: Checkerboard using arrays and object oriented programming
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23255020
tagged with: java
tagged with: draw
type: Question

hazelcast
tags question: http://stackoverflow.com/q/23256919
type: Tag
tag name: hazelcast
tags question: http://stackoverflow.com/q/23141917
tags question: http://stackoverflow.com/q/23139027

http://stackoverflow.com/a/36169395
type: Answer
answers question: http://stackoverflow.com/q/23187109
downvote count: 0
has body: I had the same problem after migrating from Spring 3.2 to 4 but I wanted to logout using a link on the view. The Spring doco (http://docs.spring.io/spring-security/site/docs/current/reference/htmlsingle/#csrf-include-csrf-token-form) explains how to do it in the view. I used this snippet in the JSP to do the logout: &lt;%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %&gt; &lt;form:form action="${pageContext.request.contextPath}/logout" method="POST"&gt; &lt;input type="submit" value="Logout" /&gt; &lt;/form:form&gt;
score: 12
upvote count: 12
has comment: http://stackoverflow.com/comment/71188861

http://stackoverflow.com/a/23209587
type: Answer
has body: You can disable input for an EditText without any visible indication by setting it's input type to InputType.TYPE_NULL. An example would look like: import android.text.InputType; . . . myEditText..setInputType(InputType.TYPE_NULL); Note that this behavior doesn't exactly jive with what the reference docs seem to be saying and that there doesn't appear to be an XML equivalent.
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/35504429
has comment: http://stackoverflow.com/comment/35505229
upvote count: 2
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23209084
answers question: http://stackoverflow.com/q/23209084

http://stackoverflow.com/comment/35379488
type: Comment
comment on: http://stackoverflow.com/q/23138989
type: QuestionComment
has text: `size()` doesn't exist, as this is a Libgdx Array object: com.badlogic.gdx.utils.Array;
score: 0

http://stackoverflow.com/comment/35599412
type: Comment
score: 0
comment on: http://stackoverflow.com/q/23262150
type: QuestionComment
has text: Unfortunately, this is the only URL we can get. We are trying to automate the file download process in selenium. As it can't handle download windows, I am trying to get the file from Java. BTW its an internal site.

http://stackoverflow.com/comment/35629144
has text: If you're using Eclipse, try MAT: https://www.eclipse.org/mat/ This will give you good information about leak suspects. I am using Netty 3.6.6 and I have no such problems. Can you post the code of your custom `UpstreamHandler`s and `DownstreamHandler`s?
score: 0
comment on: http://stackoverflow.com/q/23261778
type: Comment
type: QuestionComment

import
type: Tag
tags question: http://stackoverflow.com/q/23236493
tag name: import
tags question: http://stackoverflow.com/q/23163695
tags question: http://stackoverflow.com/q/23180177
tags question: http://stackoverflow.com/q/23162322
tags question: http://stackoverflow.com/q/23187405
tags question: http://stackoverflow.com/q/23251473
tags question: http://stackoverflow.com/q/23286678

http://stackoverflow.com/comment/35451673
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23179513
type: AnswerComment
has text: but actually your answers was not yet successful, but the outline is the same :D okay

http://stackoverflow.com/a/23183821
upvote count: 7
type: Answer
downvote count: 0
score: 7
has body: Try this String str = "help, me!"; StringTokenizer st = new StringTokenizer(str, ", !", true); while (st.hasMoreElements()) { System.out.println(st.nextElement());; } Output: help , &lt;- space me !
answers question: http://stackoverflow.com/q/23183744
has comment: http://stackoverflow.com/comment/35457629

http://stackoverflow.com/a/23274029
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23273936
type: Answer
downvote count: 0
score: 6
has comment: http://stackoverflow.com/comment/35621730
has body: From jls-4.12.4 A variable of primitive type or type String, that is final and initialized with a compile-time constant expression (§15.28), is called a constant variable. Also section 13.1 says (emphasis mine) 3..References to fields that are constant variables (§4.12.4) are resolved at compile time to the constant value that is denoted. No reference to such a field should be present in the code in a binary file (except in the class or interface containing the field, which will have code to initialize it). Such a field must always appear to have been initialized (§12.4.2); the default initial value for the type of such a field must never be observed. It means that compile-time constant expression from constant variables will be put directly in code by compiler (it will be inlined) not read from final reference at runtime. For instance if you execute main method from Bar class class Foo{ static{ System.out.println("test if class will be loaded"); } public static final int x = 42; } class Bar{ public static void main(String [] args){ System.out.println(Foo.x); } } you will see no output from static block of Foo class which means Foo class hasn't been loaded, which means that value of Foo.x didn't come from this class. In fact Bar was compiled this way class Bar{ public static void main(String [] args){ System.out.println(42); // reference Foo.x will be removed by compiler // and replaced with actual value because // compiler assumes that value can't/shouldn't // change at runtime } } So even changing value of Foo.x at runtime will not affect value printed in main method in Bar class. You can't change that mechanism. Possible way around would be initializing your final fields with values created at runtime time (they wouldn't exist at compile time, which will prevent them from being compile-time constant expressions). So instead of public static final String x = "foo"; try public static final String x = new String("foo"); or in case of primitive types use Unboxing lik…
has comment: http://stackoverflow.com/comment/35623865
upvote count: 6
has comment: http://stackoverflow.com/comment/35623956
accepted answer of: http://stackoverflow.com/q/23273936

http://stackoverflow.com/comment/35495158
has text: Not extending, per se, but rather writing the elements to the text file via the above methods. Well, I guess what you're suggesting is correct.
score: 0
comment on: http://stackoverflow.com/a/23204782
type: AnswerComment
type: Comment

http://stackoverflow.com/q/23219219
linked to: http://stackoverflow.com/q/2472376
tagged with: spring
tagged with: java
tagged with: classpath
type: Question
answer count: 1
tagged with: applicationcontext
has answer: http://stackoverflow.com/a/23219330
score: 0
has title: ClassPathXmlApplicationContext from a Runtime.getRuntime.exec
has body: I developp a web app in eclipse with spring to handle dependency injection &amp; maven to deploy. I'm trying to make work this little code : public class MainExternal { public static void main( String[] args ) throws Exception{ @SuppressWarnings("resource") ApplicationContext appContext = new ClassPathXmlApplicationContext( "classpath*:webConfiguration/applicationContext.xml"); ProjectBo projectBo = (ProjectBo) appContext.getBean("projectBo"); System.out.println("-&gt; Im 'in "); /************* PRINT OUT *************/ Project project = projectBo.findByNameOfStudy("Profiler"); List&lt;User&gt; listUser = (List&lt;User&gt;) projectBo.findUsers(project); for (User myUser : listUser) { System.out.println("User :"+myUser.getFirstname()); } } When i run it inside eclipse, it works. But when i call it from my web app like followed, it doesn't work : public void throwAnalyse(){ System.out.println("-&gt;I call my function"); try { String[] command= {"java","-cp", "/Users/JP/git/CleanOmicsTracer/target/CleanOmicsTracer.jar", "com.clb.genomic.lyon.external.MainExternal"}; Process p = Runtime.getRuntime().exec(command); //////////////////////////////////////////// //test for remote command String line; BufferedReader bri = new BufferedReader(new InputStreamReader(p.getInputStream())); BufferedReader bre = new BufferedReader(new InputStreamReader(p.getErrorStream())); while ((line = bri.readLine()) != null) { System.out.println(line); } bri.close(); while ((line = bre.readLine()) != null) { System.out.println(line); } bre.close(); p.waitFor(); } catch (IOException e) { e.printStackTrace(); } catch (InterruptedException e) { e.printStackTrace(); } System.out.println("End of programme"); } When i tried to execute from console as : java -cp /Users/JP/git/CleanOmicsTracer/target/CleanOmicsTracer.jar com.clb.genomic.lyon.external.MainExternal It doesn't work anymore and throws : Exception in thread "main" java.lang.NoClassDefFoundError: org/springframework/context/ApplicationContext…
type: UnansweredQuestion

http://stackoverflow.com/a/23212098
score: 0
has comment: http://stackoverflow.com/comment/35508353
has body: you can do this : String patternFormat = "slider\">%d "; pattern = Pattern.compile(String.format(patternFormat, 1)); pattern = Pattern.compile(String.format(patternFormat, 2));
has comment: http://stackoverflow.com/comment/35508514
type: Answer
answers question: http://stackoverflow.com/q/23212001
has comment: http://stackoverflow.com/comment/35508312

http://stackoverflow.com/a/23253100
type: AcceptedAnswer
downvote count: 0
upvote count: 8
type: Answer
accepted answer of: http://stackoverflow.com/q/23246850
has body: I don't know POI internal implementation, but my guess would be that they need a seekable stream. The streams returned by servlets (and networking in general) aren't seekable. Try reading the whole contents and then wrapping it in ByteArrayInputStream: byte[] bytes = getBytes(item.openStream()); InputStream stream = new ByteArrayInputStream(bytes); public static byte[] getBytes(InputStream is) throws IOException { ByteArrayOutputStream buffer = new ByteArrayOutputStream(); int len; byte[] data = new byte[100000]; while ((len = is.read(data, 0, data.length)) != -1) { buffer.write(data, 0, len); } buffer.flush(); return buffer.toByteArray(); }
answers question: http://stackoverflow.com/q/23246850
has comment: http://stackoverflow.com/comment/35593901
score: 8

http://stackoverflow.com/comment/35376963
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23137252
has text: @user3443891 - I noticed you haven't accepted any answers to your questions. Don't forget to upvote any answers that helped you and click the 'tick' to accept one answer as the most useful.
score: 0

http://stackoverflow.com/q/23151756
favorite count: 0
tagged with: bigdata
linked to: http://stackoverflow.com/q/375913
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35410218
tagged with: performance
has body: I have a file of size around 4-5 Gigs(nearly billion lines). From every line of the file, I have to parse the array of integers and the additional integer info and update my custom data structure. My class to hold such information looks like class Holder { private int[][] arr = new int[1000000000][5]; // assuming that max array size is 5 private int[] meta = new int[1000000000]; } A sample line from the file looks like (1_23_4_55) 99 Every index in the arr &amp; meta corresponds to the line number in the file. From the above line, I extract the array of integers first and then the meta information. In that case, --pseudo_code-- arr[line_num] = new int[]{1, 23, 4, 55} meta[line_num]=99 Right now, I am using BufferedReader object and it's readLine method to read each line &amp; use character level operations to parse the integer array and meta information from each line and populate the Holder instance. But, it takes almost half an hour to complete this entire operation. I used both java Serialization &amp; Externalizable(write the meta and arr) to serialize and deserialize this HUGE Holder instance. And with both of them, the time to serialize is almost half an hour and to deserialize is also almost half an hour. I would appreciate your suggestions on dealing with this kind of problem &amp; would definitely love to hear your part of story if any. P.S. Main Memory is not a problem. I have almost 50 GB of RAM in my machine. I have also increased the BufferedReader size to 40 MB (Of course, I can increase this upto 100 MB considering that disk access takes approx. 100 MB/sec). Even cores and CPU is not a problem. EDIT I The code that I am using to do this task is provided below(after anonymizing very few information); public class BigFileParser { private int parsePositiveInt(final String s) { int num = 0; int sign = -1; final int len = s.length(); final char ch = s.charAt(0); if (ch == '-') sign = 1; else num = '0' - ch; int i = 1; while (i &lt; len) num = num * 10 + '0…
tagged with: java
has answer: http://stackoverflow.com/a/23156016
type: Question
upvote count: 4
has comment: http://stackoverflow.com/comment/35401475
has answer: http://stackoverflow.com/a/23154257
possible better answer: http://stackoverflow.com/a/23154581
has comment: http://stackoverflow.com/comment/35401749
has comment: http://stackoverflow.com/comment/35405832
has comment: http://stackoverflow.com/comment/35410042
has answer: http://stackoverflow.com/a/23154581
has title: How to parse a huge file line by line, serialize & deserialize a huge object efficiently?
downvote count: 0
score: 4
has comment: http://stackoverflow.com/comment/35401556
has answer: http://stackoverflow.com/a/23156281
accepted answer: http://stackoverflow.com/a/23156016
has comment: http://stackoverflow.com/comment/35409775
answer count: 4

http://stackoverflow.com/comment/35526258
comment on: http://stackoverflow.com/a/23222166
score: 0
type: Comment
type: AnswerComment
has text: @T.J.Crowder that I wasn't aware of then and will update the answer for.

http://stackoverflow.com/comment/35371571
score: 0
type: AnswerComment
type: Comment
has text: There is absolutely no problem with a getter method returning null. A problem would only be to try to call methods on an object that points to null.
comment on: http://stackoverflow.com/a/23135052

http://stackoverflow.com/a/23246351
has comment: http://stackoverflow.com/comment/35569680
score: 0
has body: You can implement getModel().selectStudent(selectedObject); and getModel().deselectStudent(selectedObject); instead. In here, selectedObject should be the object itself and not just the index. The model should point to the objects instead of indexes. It's good to remember that you can make your model point to the exact objects you created. You just have to make sure the correct objects are being pointed to.
has comment: http://stackoverflow.com/comment/35606018
type: Answer
answers question: http://stackoverflow.com/q/23245227
has comment: http://stackoverflow.com/comment/35577149
has comment: http://stackoverflow.com/comment/35590692
has comment: http://stackoverflow.com/comment/35598580

http://stackoverflow.com/comment/35426893
score: 0
type: Comment
has text: @user3550680> I say it's just confusing to translate (convert) in place.
type: AnswerComment
comment on: http://stackoverflow.com/a/23165758

http://stackoverflow.com/comment/35478411
score: 0
type: AnswerComment
has text: You can use the RSA algorithm using the `Cipher` class. In that case you simply encrypt the key you want to share with the public key and decrypt it with the private key (of the server). This won't however give you perfect forward secrecy; i.e. the ciphertext created by using the session key can be read if the RSA private key ever becomes known. Note that - on the other hand - DH may not contain authentication and is therefore usually susceptible to man in the middle attacks. Take a look at TLS to see how this can be solved.
type: Comment
comment on: http://stackoverflow.com/a/23187629

http://stackoverflow.com/comment/35395939
comment on: http://stackoverflow.com/q/23147895
type: QuestionComment
type: Comment
has text: @andy I changed my code to SpawnLevel.class.getResourceAsStream(path) and now when I run it through command prompt, it's giving me exceptions that say imageIo.read(Unknown Source).
score: 0

http://stackoverflow.com/comment/35475909
score: 0
has text: i used any number above 32 and below 0 it doesnt shows error
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23194084

http://stackoverflow.com/a/23206048
score: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23205772
has comment: http://stackoverflow.com/comment/35497918
has comment: http://stackoverflow.com/comment/35497697
upvote count: 2
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35497869
type: Answer
has body: You call commit() on the transaction but you don't call beginTransaction() before the new replace(...) command. Edit: Maybe this was not clear. I meant: public void goToMain(View v) { FragmentTransaction transaction = getFragmentManager().beginTransaction(); transaction.replace(R.id.container, mainFragment); transaction.addToBackStack(null); transaction.commit(); } and so on. You can not reuse your transaction, so don't save it. Create a new one.
has comment: http://stackoverflow.com/comment/35497977
answers question: http://stackoverflow.com/q/23205772

http://stackoverflow.com/comment/35576409
type: Comment
comment on: http://stackoverflow.com/a/23176188
score: 0
type: AnswerComment
has text: I understand what you are saying, but I'm not sure as to how to implement that. Your third point I understand and i changed that

cryptography
tag name: cryptography
tags question: http://stackoverflow.com/q/23144236
tags question: http://stackoverflow.com/q/23180634
type: Tag
tags question: http://stackoverflow.com/q/23193554
tags question: http://stackoverflow.com/q/23285597
tags question: http://stackoverflow.com/q/23250112
tags question: http://stackoverflow.com/q/23213234
tags question: http://stackoverflow.com/q/23148611
tags question: http://stackoverflow.com/q/23167830
tags question: http://stackoverflow.com/q/23186288
tags question: http://stackoverflow.com/q/23256949
tags question: http://stackoverflow.com/q/23130255

http://stackoverflow.com/a/23210367
has comment: http://stackoverflow.com/comment/35562695
type: Answer
has comment: http://stackoverflow.com/comment/35505873
score: 1
has body: public void degreeFilter(ValueChangeEvent dege) { Object[] objArr = (Object[])dege.getNewValue(); for (int x = 0; x &lt; objArr.length; x++) { Object obj = objArr[x]; System.out.println(obj.toString()); degree=obj.toString(); } }
accepted answer of: http://stackoverflow.com/q/23197353
has comment: http://stackoverflow.com/comment/35570453
answers question: http://stackoverflow.com/q/23197353
upvote count: 1
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/35417531
type: QuestionComment
comment on: http://stackoverflow.com/q/23160635
score: 0
has text: It seems that CheckRow is in a fragment. Is that correct?
type: Comment

http://stackoverflow.com/q/23153168
has answer: http://stackoverflow.com/a/23153384
has answer: http://stackoverflow.com/a/23153581
has comment: http://stackoverflow.com/comment/35403623
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23153643
score: -2
tagged with: java
has comment: http://stackoverflow.com/comment/49804080
has answer: http://stackoverflow.com/a/23157775
has answer: http://stackoverflow.com/a/31452507
has comment: http://stackoverflow.com/comment/35403909
has answer: http://stackoverflow.com/a/23153586
type: Question
has answer: http://stackoverflow.com/a/23153274
upvote count: 1
has body: I have a String in Java with the following path: E:\HTML\project\img\image.jpg. I want to change it to \img\image.jpg How can I do this?
has title: How to change string prefix part in Java
answer count: 7
tagged with: string
favorite count: 0
downvote count: 3

http://stackoverflow.com/comment/35667793
type: Comment
comment on: http://stackoverflow.com/a/23262854
type: AnswerComment
score: 0
has text: In the event that the request to get the response fails, I still would like to test to see if the method that handles the response is functioning correctly

http://stackoverflow.com/q/23166896
upvote count: 2
has comment: http://stackoverflow.com/comment/35428679
has body: The query that I want to be executed in MongoDB is as follows db.idx.update({"keyword":"Some dynamic keyword"}, {$addToSet:{url: "Some dynamic url"}}, {upsert: True}) I need the java equivalent of this MongoDB query, I have tried a lot but I keep on getting errors. I am new to both Java and MongoDB but I'm eager to learn, so, please help me out! And also if you can then explain me the JSON for this query and it's structure. Thanks a million in advance :D (Y) EDIT :- What I have tried :- client = new MongoClient("localhost"); db = client.getDB("idx"); BasicDBObject lurl = new BasicDBObject(); BasicDBObject lurl2 = new BasicDBObject(); BasicDBObject lkey = new BasicDBObject(); for(Element e : links){ DBCollection colls = db.getCollection(e.text()); lurl.put("$addToSet", e.attr("href")); lurl2.put("url", new BasicDBObject(lurl)); lkey.put("keyword", e.text()); colls.update(lkey, lurl2, true, false); } The errors that I receive are :- Exception in thread "main" java.lang.IllegalArgumentException: Document field names can't start with '$' (Bad Key: '$addToSet') at com.mongodb.DBCollection.validateKey(DBCollection.java:1829) at com.mongodb.DBCollection._checkKeys(DBCollection.java:1787) at com.mongodb.DBCollection._checkValue(DBCollection.java:1810) at com.mongodb.DBCollection._checkKeys(DBCollection.java:1788) at com.mongodb.DBCollection._checkObject(DBCollection.java:1774) at com.mongodb.DBCollectionImpl.update(DBCollectionImpl.java:250) at com.mongodb.DBCollection.update(DBCollection.java:191) at com.mongodb.DBCollection.update(DBCollection.java:224) at myse.MySE.extractLinkData(MySE.java:55) at myse.MySE.crawl(MySE.java:61) at myse.MySE.main(MySE.java:69) Java Result: 1 BUILD SUCCESSFUL (total time: 13 seconds)
type: AnsweredQuestion
score: 2
tagged with: java
has title: Using $addToSet and upsert in java for an embedded document having specific JSON
type: Question
has comment: http://stackoverflow.com/comment/35428973
tagged with: mongodb
has answer: http://stackoverflow.com/a/23167311
accepted answer: http://stackoverflow.com/a/23167311
has comment: http://stackoverflow.com/comment/35429222
downvote count: 0
has comment: http://stackoverflow.com/comment/35428831
answer count: 1
favorite count: 0
tagged with: mongodb-query
has comment: http://stackoverflow.com/comment/35429155

http://stackoverflow.com/comment/35559405
type: Comment
score: 1
has text: You seem to be encapsulating rather than extending. Both are reasonable things to do but this is a mish-mash of the two
comment on: http://stackoverflow.com/q/23240777
type: QuestionComment

http://stackoverflow.com/comment/35606932
type: QuestionComment
comment on: http://stackoverflow.com/q/23267017
has text: What do you want to convert to HTML page? Do you mean you want to generate HTML page with Java?
score: 0
type: Comment

http://stackoverflow.com/a/23227334
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/35536773
score: 3
accepted answer of: http://stackoverflow.com/q/23227141
answers question: http://stackoverflow.com/q/23227141
has body: You set signal = false after the wait(). Sequence of events. sender calls take() sender prints signal is set to true receiver is notified sender calls wait() receiver wakes receiver prints sender is notified signal is true so no wait() signal is set to false release() method ends receiver loops receiver prints signal is false so wait() sender wakes and exits immediately as nothing to do So you have several issues Your sender doesn't loop You set signal at the wrong time
has comment: http://stackoverflow.com/comment/35536720
upvote count: 3
type: AcceptedAnswer

http://stackoverflow.com/q/23239767
has answer: http://stackoverflow.com/a/23239964
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/23241163
tagged with: java
has answer: http://stackoverflow.com/a/23240152
type: Question
has body: I am trying to access WhatsApp database folder exists in Environment.getExternalStorageDirectory().getAbsolutePath() + /WhatsApp/Databases location in un-rooted device. My aim is to collect these files and decrypt them and show each messages to Web portal. Here is the code to collect these files: String path = Environment.getExternalStorageDirectory().getAbsolutePath() + location; f = new File(path); final File file[]=f.listFiles(); final int size = file.length; Whenever i am running on rooted device, It is working but on some unrooted devices it is throwing nullpointer because it is not able to get the list of all database files. My question is: Is it possible to ready WhatsApp Database files when device is not root? or is there any way to do it?
has title: Can't read files from SDcard folder in Android device?
score: 0
answer count: 3
tagged with: android-listview
tagged with: whatsapp

http://stackoverflow.com/q/23233510
tagged with: opengl
has comment: http://stackoverflow.com/comment/35551190
tagged with: java
tagged with: lwjgl
has answer: http://stackoverflow.com/a/23264581
has title: Opengl Rendering - Anything outside of the z range -1 to 1 doesn't appear?
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/35556369
has answer: http://stackoverflow.com/a/23240196
has comment: http://stackoverflow.com/comment/35547405
score: 0
has comment: http://stackoverflow.com/comment/35556830
has body: Anything I render outside of the range 1 to -1 (in the z-range) just doesn't appear on the screen. I've been trying everything, including using different matrices to try to transform vertices outside of 1 to -1 into this range but nothing seems to work. I'll put my code in below. It consists of a model class where data is stored, a shader program(which I won't include - its pretty simple) and a main class. Vertex Shader #version 330 core in vec4 in_Position; in vec4 in_Color; out vec4 pass_Color; void main(void) { gl_Position = in_Position; pass_Color = in_Color; } Fragment Shader #version 330 core in vec4 pass_Color; out vec4 out_Color; void main(void) { out_Color = pass_Color; } Model Class package util; import static org.lwjgl.opengl.GL11.*; import static org.lwjgl.opengl.GL15.*; import static org.lwjgl.opengl.GL30.*; import static org.lwjgl.opengl.GL20.*; import java.nio.ByteBuffer; import java.nio.FloatBuffer; public class Model { // Vertex Array ID int vaoID; // VBO ID's int vboVertexID, vboColorID, vboIndexID; // Vertex Count int numVertices, numIndices; public Model(FloatBuffer vertexData, int vertexCount, FloatBuffer colorData, int colorCount, ByteBuffer indexData, int indexCount) { // Create the vertex array vaoID = glGenVertexArrays(); // Select the vertex array bind(); // Attach vertex data attachVertexData(vertexData, vertexCount); // Attach Color data attachColorData(colorData, colorCount); // Deselect the vertex array unbind(); // Indice attachment attachIndexArray(indexData); // Set the vertex count numVertices = vertexCount; numIndices = indexCount; } /** * Attach some vertex data */ public void attachVertexData(FloatBuffer vertexData, int vertexCount) { // Create the buffer vboVertexID = glGenBuffers(); // Bind the new buffer glBindBuffer(GL_ARRAY_BUFFER, vboVertexID); // Give the data to the GPU glBufferData(GL_ARRAY_BUFFER, vertexData, GL_STATIC_DRAW); // Set the location of the data within the vertex array glVertexAttribPointer(0, vertexCount, G…
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35547605
has comment: http://stackoverflow.com/comment/35547875
has comment: http://stackoverflow.com/comment/35558042

http://stackoverflow.com/q/23247910
tagged with: tomcat
has body: I have a JRebel+Tomcat server run via IntelliJ on my Work (*NIX) machine, and occasionally I'd love to have JRebel update Classes/Resources when I'm at my home (*NIX) machine remotely connected via SSH. e.g. home $ ssh work work $ cd workspace/foo/bar/baz work $ hey-jrebel-go-update-classes I handle this today by VNC'ing into my work machine, then in IntelliJ executing "Update Classes and Resources" on my running Tomcat instance, then log back out. It's rather silly since I'm already SSH'd in. Is there a way to kick off this process via command-line?
tagged with: ssh
has title: Reload Classes via ssh on intellij-run jrebel tomcat server
possible better answer: http://stackoverflow.com/a/23250226
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23250226
tagged with: java
tagged with: jrebel
accepted answer: http://stackoverflow.com/a/23252318
type: Question
tagged with: intellij-idea
has answer: http://stackoverflow.com/a/23252318
score: 0
answer count: 2

http://stackoverflow.com/comment/35535194
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23226320
has text: Thanks for the reference, I'll give that a read.
type: Comment

http://stackoverflow.com/a/23238023
type: Answer
score: 2
answers question: http://stackoverflow.com/q/23237808
downvote count: 0
has body: If you debug it, with pen and paper, it would be simple to see what is going on. Basically - it go to the end of the string and start printing char by char from the end to the start.
upvote count: 2

http://stackoverflow.com/a/23234625
has comment: http://stackoverflow.com/comment/35570663
type: Answer
has body: This is the function to draw an arc in Slick2D: public void drawArc(float x1, float y1, float width, float height, float start, float end) Since it appears that Slick draws these arcs clock-wise (0 - 360 degrees) then you can do some simple arithmetic to get the effect that you wish. A and B are your original angles that you wish to draw the arc in between like 0 and 90 degrees. drawArc(0,0,1,1,A,B) will render an arc from A to B, but we want an arc from C to D which is the same arc as A to B but counter-clock wise. Since you already know the values of A and B (like 0 and 90) you can get the values for C and D with the following: C = 360 - B D = 360 - A So now we can just use drawArc(0,0,1,1,C,D). Test it with values: A = 0 B = 90 C = 360 - 90 = 270 D = 360 - 0 = 360 This will plot an arc from 270 to 360 which is the same as an arc from 0 to 90 counter-clock wise.
score: 4
has comment: http://stackoverflow.com/comment/35570904
has comment: http://stackoverflow.com/comment/35634507
upvote count: 4
has comment: http://stackoverflow.com/comment/35626028
accepted answer of: http://stackoverflow.com/q/23234549
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23234549

http://stackoverflow.com/comment/35495664
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23204036
has text: thank you alfred, though currently GCD Api seems to be very limited in functionality it looks very promising.

http://stackoverflow.com/comment/35365345
has text: You are missing the code which actually CALLS the webservice. The problem is likely there. I suspect the client is sending a PUT request to a webservice which expects a GET request.
comment on: http://stackoverflow.com/q/23131681
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/comment/93142400
type: AnswerComment
type: Comment
score: 1
has text: This answer should be the accepted one, because it uses Java 8's Time API.
comment on: http://stackoverflow.com/a/23249401

http://stackoverflow.com/comment/35495691
comment on: http://stackoverflow.com/q/23196381
type: Comment
has text: Have run into that error several times, and unchecking Project > Build Automatically followed by manually building it (and then signing the app, where the error usually occurs for me) did the trick. As for the style errors, try going to Show View > Problems, highlight the X's for the styles file only, and then delete the problems, followed by cleaning the project. Any time I change the styles.xml file it throws the same issues based on it not recognizing the compatibility/normal packages, but ends up running fine.
score: 1
type: QuestionComment

http://stackoverflow.com/q/23187145
tagged with: treemap
has comment: http://stackoverflow.com/comment/35464201
accepted answer: http://stackoverflow.com/a/23187258
type: Question
has body: I'm trying to sort a map in java by date key using TreeMap. Here's my code public static void sort() { BufferedReader br; String line; String[] data; Date date ; DateFormat df = new SimpleDateFormat("dd-mm-YYY"); Map&lt;Date,String&gt; map = new TreeMap&lt;Date,String&gt;(); try { br = new BufferedReader(new FileReader( "/home/user/Desktop/train/2013-training_set.txt")); int i=0; while ((line = br.readLine()) != null) { ++i; data = line.split(":"); map.put(df.parse(data[1]), line); } System.out.println(map.size()+" i = "+i); Set st = mp.entrySet(); Iterator it = st.iterator(); while (it.hasNext()) { Map.Entry me = (Map.Entry) it.next(); System.out.print(me.getKey() + "-&gt;:"); System.out.println(me.getValue()); } } catch (Exception e) { e.printStackTrace(); } } The date[1] contains the date in string format and looks like (e.g. 21-3-2013). The problem is that it stores in the TreeMap(mp) only 12 key-value pairs(one for each month) instead of the 103(i) expected. Any ideas ?
has comment: http://stackoverflow.com/comment/35464334
downvote count: 0
tagged with: sorting
favorite count: 0
has comment: http://stackoverflow.com/comment/58731405
has answer: http://stackoverflow.com/a/79502987
tagged with: dictionary
score: 1
answer count: 4
has title: Sorting a map by date key in Java
has answer: http://stackoverflow.com/a/23187258
has answer: http://stackoverflow.com/a/23187346
upvote count: 1
has answer: http://stackoverflow.com/a/79502881
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/23187346
linked to: http://stackoverflow.com/q/35416679
tagged with: java

http://stackoverflow.com/comment/111025811
score: 0
type: AnswerComment
has text: I've also pointed out in the edited code, if any dimension is size 0, there is no way to continue to count any dimensions after that one. In fact, if the array was allocated via the ```multianewarray```, any further dimensions are not even allocated. According to JVM Spec, ```If any count value is zero, no subsequent dimensions are allocated.```
comment on: http://stackoverflow.com/a/23231357
type: Comment

http://stackoverflow.com/q/23197207
tagged with: mongodb
has answer: http://stackoverflow.com/a/23212415
score: 3
has title: Spring Data REST : custom query for MongoDB repository
accepted answer: http://stackoverflow.com/a/23212415
answer count: 1
downvote count: 0
favorite count: 0
has body: I am trying to create a custom query from the Spring guide : Accessing MongoDB Data with REST according to the Reference 4.4 Custom Implementations. But my custom method is not available from the repository's REST interface (/user/search). (e.g. Browser is unable to find localhost:8080/user/search/GetByKidsAge?age=1) Could someone help me to figured this out and give me some suggestions? Thanks a lot !! Below is my code: UserRepositoryCustom.java public interface UserRepositoryCustom { public List&lt;User&gt; GetByKidsAge(@Param("age") int age); } UserRepositoryImpl.java public class UserRepositoryImpl implements UserRepositoryCustom { @Override public List&lt;User&gt; GetByKidsAge(int age) { return /*perform query*/; } } UserRepository.java @RepositoryRestResource(collectionResourceRel = "user", path = "user") public interface UserRepository extends MongoRepository&lt;User, String&gt;, UserRepositoryCustom { List&lt;User&gt; findByLastName(@Param("name") String name); }
tagged with: rest
tagged with: spring
type: AnsweredQuestion
upvote count: 3
tagged with: java
tagged with: spring-data
type: Question

http://stackoverflow.com/a/23132521
downvote count: 0
has comment: http://stackoverflow.com/comment/35367309
has body: Well, a HashSet doesn't retain the insertion order. If you want that, use LinkedHashSet. And please use a parameterized version.
upvote count: 3
has comment: http://stackoverflow.com/comment/35367526
type: Answer
answers question: http://stackoverflow.com/q/23132488
score: 3

http://stackoverflow.com/comment/35496192
has text: But there's a poroblem in here to... in fact when I close the client and I reopen it, the server won't accept the connection. I didn't tryed it, but I'm quite sure that it will do that. Anyway I've got an idea in how to fix it
type: Comment
comment on: http://stackoverflow.com/a/23203404
score: 0
type: AnswerComment

http://stackoverflow.com/comment/35647327
type: AnswerComment
score: 0
type: Comment
has text: Can you help me with one more thing??
comment on: http://stackoverflow.com/a/23185774

session-timeout
type: Tag
tags question: http://stackoverflow.com/q/23195795
tag name: session-timeout

http://stackoverflow.com/q/23258885
has title: issue instantiating object of Java generic class
has comment: http://stackoverflow.com/comment/35592616
answer count: 1
has body: I've been going around in circles trying to understand Java generics. I'm having trouble instantiating an object of a generic class. Any insight to where I'm going wrong? In one document, the generic class: public class SearchSortAlgorithms&lt;T&gt; implements SearchSortADT&lt;T&gt; { … public void quickSort(T[] list, int length) { recQuickSort(list, 0, length - 1); } … } In another: public class TestQuickSort { public static void main(String [] args) { // define an Integer array of 50000 elements Integer[] anArray = new Integer[5000]; // load the array with random numbers using // a for loop and Math.random() method - (int)(Math.random()*50000) for (int i = 0; i &lt; anArray.length; i++) { anArray[i] = (int)(Math.random() * i); } // print the first 50 array elemnts with a for loop // using System.out.print for (int j = 0; j &lt;= 50; j++) { System.out.print(anArray[j] + " "); } System.out.println(); // define an object of SearchSortAlgorithm with Integer data type // use this object to call the quickSort method with parameters: your array name and size-5000 SearchSortAlgorithms&lt;Integer&gt; anotherArray = new SearchSortAlgorithms&lt;Integer&gt;(); //This is where I get my error message anotherArray.quickSort(anArray, 5000); // print out the first 50 array elements with a for loop // they have to be sorted now for (int k = 0; k &lt;= 50; k++) { System.out.print(anotherArray[k] + " "); } } } Error message: java:39: array required, but SearchSortAlgorithms&lt;java.lang.Integer&gt; found
tagged with: generics
has comment: http://stackoverflow.com/comment/35592604
has comment: http://stackoverflow.com/comment/35592644
type: AnsweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/23258915
accepted answer: http://stackoverflow.com/a/23258915
score: 0

http://stackoverflow.com/q/23178601
score: 1
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/23178919
type: Question
has comment: http://stackoverflow.com/comment/35452352
has body: I am using Spring framework and Spring Data JPA to develop an application. Below are one of the repository interface and service class. public interface UserRepository extends JpaRepository&lt;User, Long&gt; User findByName(String name); User findByEmail(String email); } public class DefaultUserService implements UserService { @Inject protected UserRepository userRepo; @Override public User getUserById(Long id) { return userRepo.findOne(id); } @Override public User getUserByName(String name) { return userRepo.findByName(name); } @Override public User getUserByEmail(String email) { return userRepo.findByEmail(email); } } As stated by many experts, service layer design should be coarse grained and focused on application operations. Looking at the service class above, I believe that is not a good design as it directly expose all finder methods from the repository. Since all 3 service methods above are returning the same object type (User), I would want to expose only one finder method instead of three that able to encapsulate all finder logic. public class DefaultUserService implements UserService { @Inject protected UserRepository userRepo; // what would be the arguments and logic for this method. @Override public User getUser() { } } I appreciate if anyone can point me the solution on how to solve this design issue?
tagged with: spring-data-jpa
has title: Spring service class contains too many finder methods
downvote count: 0
answer count: 1
tagged with: service
favorite count: 0
type: UnansweredQuestion
tagged with: spring

http://stackoverflow.com/q/23252025
has title: Is there a way to display a floating number in its' binary form?
has comment: http://stackoverflow.com/comment/35579774
has comment: http://stackoverflow.com/comment/35579667
type: AnsweredQuestion
has body: Let's say I have a floating number in java. How can I print it in it's binary form? Is there a simple method to use in the java library? I am talking about IEEE 754 floating point. Or would I have to write it from scratch? I'd also like to print it out.
has comment: http://stackoverflow.com/comment/35579753
has comment: http://stackoverflow.com/comment/35580030
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/35580447
type: Question
linked to: http://stackoverflow.com/q/5157664
has comment: http://stackoverflow.com/comment/35579714
tagged with: format
linked to: http://stackoverflow.com/q/23230748
has comment: http://stackoverflow.com/comment/35580535
upvote count: 1
answer count: 1
linked to: http://stackoverflow.com/q/397692
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/35579728
has answer: http://stackoverflow.com/a/23252067
accepted answer: http://stackoverflow.com/a/23252067

http://stackoverflow.com/a/23172749
has body: there are 2 mistakes in this for (i=0;i==input.length();i++);//the misbehaving loop{ i==input.length() should be i&lt;input.length() there should not be ; after for loop for (i=0;i==input.length();i++); should be for (i=0;i&lt;input.length();i++)
accepted answer of: http://stackoverflow.com/q/23172717
has comment: http://stackoverflow.com/comment/35438780
answers question: http://stackoverflow.com/q/23172717
score: 2
has comment: http://stackoverflow.com/comment/35438737
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 2

http://stackoverflow.com/a/23168399
has body: Yes, if you have a method with a varargs parameter like this: public void foo(String... names) and you call it like this: foo("x", "y", "z"); then the compiler just converts that into: foo(new String[] { "x", "y", "z"}); The type of the names parameter is String[], and can be used just like any other array variable. Note that it could still be null: String[] nullNames = null; foo(nullNames); See the documentation for varargs for more information. This does not mean that varargs are interchangeable with arrays - you still need to declare the method to accept varargs. For example, if your method were declared as: public void foo(String[] names) then the first way of calling it would not compile.
type: Answer
score: 29
upvote count: 29
answers question: http://stackoverflow.com/q/23168342
accepted answer of: http://stackoverflow.com/q/23168342
has comment: http://stackoverflow.com/comment/35431375
has comment: http://stackoverflow.com/comment/35431621
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/23265379
tagged with: java
type: Question
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/23265550
accepted answer: http://stackoverflow.com/a/23265550
favorite count: 0
has title: JFileChooser cancel button returning APPROVE_OPTION
has comment: http://stackoverflow.com/comment/35604100
upvote count: 3
has body: this is my first question here so please bear with me. I have this JFileChooser here, and even though I hit "Cancel" in the window, it returns APPROVE_OPTION as oppose to CANCEL_OPTION. It is a save dialog which I open like this returnVal_2 = fileChooser_2.showSaveDialog(frame); And here is the initialization and usage of it fileChooser_2 = new JFileChooser(); fileChooser_2.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (returnVal_2 == JFileChooser.APPROVE_OPTION) { savePath = fileChooser_2.getCurrentDirectory(); System.out.println("yes"); } else if (returnVal_2 == JFileChooser.CANCEL_OPTION) { System.out.println("no"); } } }); It works as it's supposed to when I hit "Save" (which by the way, also returns APPROVE_OPTION).
type: AnsweredQuestion
score: 3

http://stackoverflow.com/a/23208458
upvote count: 1
accepted answer of: http://stackoverflow.com/q/23208416
answers question: http://stackoverflow.com/q/23208416
type: AcceptedAnswer
downvote count: 0
has body: To return an ArrayList, you'll need to declare a local ArrayList, add the element to the list, then return the list. Like this: public ArrayList&lt;Task&gt; findTasksByDate(Date date) { ArrayList&lt;Task&gt; returnList = new ArrayList&lt;Task&gt;(); while(i&lt;taskMan.size()); { for (Task element: taskMan) { if (date.equals(taskMan.get(i).getDueDate())) { returnList.add(taskMan.get(i)); return returnList; } return null; } i++; } }
type: Answer
has comment: http://stackoverflow.com/comment/35502142
score: 1

http://stackoverflow.com/q/23199874
downvote count: 0
tagged with: java
possible better answer: http://stackoverflow.com/a/23200152
has title: Convert ArrayList<subclass> to ArrayList<superclass>
type: Question
score: 3
upvote count: 3
answer count: 2
has body: I have three classes: Blob, Food and Predator, all of which are subclasses of the abstract class Organism. I also have an ArrayList for each class: blobs, foods and predators I'm writing a function that will choose a 'target' for an organism depending on what type it is. The organism is passed as a parameter and then an appropriate target is chosen - if a Blob is passed then it should target a Food, if a Predator is passed then it should target a Blob, and if a Food is passed then it should target a Predator. Right now I have: ArrayList&lt;Food&gt; foods = new ArrayList&lt;Food&gt;(); ArrayList&lt;Blob&gt; blobs = new ArrayList&lt;Blob&gt;(); ArrayList&lt;Predator&gt; predators = new ArrayList&lt;Predator&gt;(); public Organism pickTarget(Organism o){ ArrayList&lt;Organism&gt; search = new ArrayList&lt;Organism&gt;(); if(o.getClass() == Blob.class){ search = foods; } else if(o.getClass() == Predator.class){ search = blobs; } else if(o.getClass() == Food.class){ search = predators; } Organism target = search.get(0); for(Organism organism:search){ //do stuff to pick a target from assigned search space } return target; } So the idea here is to intialise a generic Organisms ArrayList, then assign one of the existing ArrayLists to it depending on what type the parameter is. That ArrayList will then be searched for the most suitable target which is returned. But I'm getting a type mismatch error when I try to assign an existing ArrayList to the search variable. 'Cannot convert from ArrayList&lt;Food&gt; to ArrayList&lt;Organism&gt; ', for example. Does anybody know of a solution to a problem like this? Converting from a subclass to a superclass isn't usually an issue so I'm hoping that there is a solution for ArrayLists.
favorite count: 0
has answer: http://stackoverflow.com/a/23200152
has answer: http://stackoverflow.com/a/23200015
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23200015

http://stackoverflow.com/a/23214955
has body: Do you run this program as root or Administrator ? If not, only these users can open a socket with a port between 0 and 1024.
has comment: http://stackoverflow.com/comment/35513677
score: 0
answers question: http://stackoverflow.com/q/23214860
type: Answer

http://stackoverflow.com/comment/35388587
type: Comment
type: QuestionComment
has text: Post exception stack trace.
score: 0
comment on: http://stackoverflow.com/q/23144062

http://stackoverflow.com/q/23235027
downvote count: 0
upvote count: 2
accepted answer: http://stackoverflow.com/a/23235172
has body: I'm a novice at Java, and I've been trying to use java.util.timer to reset an existing timer after taking the right command input. However, I've been unable to cancel the timertask properly, so the timer thread runs multiple instances of the timertask if the method is called multiple times. Any help would be appreciated. Edit: I've changed the location of new Timer(), but it doesn't seem to have fixed it. Timer timer = new Timer(); TimerTask ttimer = new TimerTask() { public void run() { System.out.println("ping"); } }; public static void main (String[] args) { Timer timer = new Timer(); while (true) { //BufferedReader to read input //Something if (input[0].equals("r")) { time t = new time(); time.RestartTimer(); } } } public void RestartTimer() { ttimer.cancel(); timer.cancel(); Timer timer = new Timer(); TimerTask ttimer = new TimerTask() { public void run() { System.out.println("ping"); } }; timer.scheduleAtFixedRate(ttimer, 10000, 10000); }
favorite count: 0
has answer: http://stackoverflow.com/a/23235172
tagged with: timer
possible better answer: http://stackoverflow.com/a/23235307
type: AnsweredQuestion
score: 2
has title: Java timer.cancel() not stopping timer
tagged with: java
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/23235307

http://stackoverflow.com/a/23138105
answers question: http://stackoverflow.com/q/23137966
upvote count: 1
has comment: http://stackoverflow.com/comment/35377741
has comment: http://stackoverflow.com/comment/35377566
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/35440271
score: 1
type: Answer
accepted answer of: http://stackoverflow.com/q/23137966
has body: You need to do your linecount, word count and character count all inside a single loop. By having 3 functions, the very first function call to lineNum iterates over your scanner object, then the other two function calls return 0 because the scanner object has already read the file and as it is at the end of the file there is nothing left to read. I would suggest you edit your teachers code, in particular the while loop. Remove the 3 functions and the corresponding function calls and have the program do all of your counting inside the loop inside the main() function. int lineCount = 0; int wordCount = 0; int charCount = 0; while (input.hasNextLine()) { // read a line from the input file String line = input.nextLine(); // increment line count lineCount++; // split line into words and increment word count String str [] = line.split((" ")); for ( int i = 0; i &lt;str.length ; i ++) { if (str [i].length() &gt; 0) { wordCount ++; } } // increment char count charCount += (line.length()); } EDIT Given that you have said you need to use 2 methods, heres what I suggest: Move the word counting code above (the for loop) into a function of its own, it takes a String argument (the current line) and returns an integer. You can keep calling this from inside the loop. wordCount += countWordsInString(line);
has comment: http://stackoverflow.com/comment/35488076

http://stackoverflow.com/q/23237934
has body: I am trying to run jar file from a java program I found this link : here. I use the following code: ProcessBuilder pb = new ProcessBuilder("CEDDextractor_all_img.jar", "-jar", "cedd/"); pb.directory(new File("cedd/")); Process p = pb.start(); However I m getting the error: Could not load image: Cannot run program "cedd/CEDDextractor_all_img.jar" (in directory "cedd"): CreateProcess error=193, %1 is not a valid Win32 application. I am little bit confused with the paths I need to specify. Batch command: java -jar CEDDextractor_all_img.jar -file "file.jpg"
type: AnsweredQuestion
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/23238244
has answer: http://stackoverflow.com/a/23238046
has answer: http://stackoverflow.com/a/23238244
type: Question
answer count: 2
accepted answer: http://stackoverflow.com/a/23238046
has title: Run a jar file from a java file
downvote count: 0
tagged with: jar
favorite count: 0
linked to: http://stackoverflow.com/q/4936266
tagged with: process
upvote count: 1

http://stackoverflow.com/comment/35646405
score: 0
type: Comment
type: QuestionComment
has text: so if I will set org.quartz.jobStore.isClustered = false , will it cause Job will be execusted in both the severs ?
comment on: http://stackoverflow.com/q/23287754

http://stackoverflow.com/a/23263262
upvote count: 3
downvote count: 1
has comment: http://stackoverflow.com/comment/35600735
type: Answer
score: 2
answers question: http://stackoverflow.com/q/23261215
has comment: http://stackoverflow.com/comment/114844037
has body: First in general you can't use properties in versions: ProjectA/pom.xml com.org projectA pom 1.0.0-SNAPSHOT Second you shouldn't need to use relative path in your childs: core/pom.xml projectA com.org 1.0.0-SNAPSHOT core This brings me to the point if you have a persistence/pom.xml core com.org 1.0.0-SNAPSHOT Done use things like ../../ this is usually an indicator that your structure is wrong. BUT: Starting with Maven 3.2.1 you can use special properties to define the versions you like. The following placeholders are allowed in versions: ${revision}, ${changelist}, and ${sha1} This means if you like you can use them but only with Maven 3.2.1 so you need to change it to things like this: ProjectA/pom.xml com.org projectA pom ${revision} and in core: projectA com.org ${revision} core But this means you need to call maven everytime like this: mvn -Drevision=1.0.0-SNAPSHOT clean package which will work. You have to be carefull if you use your project within Eclipse etc. Apart from the above i can not recommend to use it this way.
has comment: http://stackoverflow.com/comment/114844033

http://stackoverflow.com/comment/35501042
has text: @EJP Hmm, yeah. Um. You are right of course. Should I call them Sun implementation classes? Normally I would just say you should not use `sun.*` classes, but Sun has unhelpfully created a few API's with `sun.*` packages, although those are not distributed with the JRE.
type: Comment
comment on: http://stackoverflow.com/a/23201118
score: 0
type: AnswerComment

http://stackoverflow.com/a/23282494
type: Answer
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/23282478
has body: When you do: vowel = 'a'+'e'+'i'+'o'+'u'; You get a character equal to the values of those chars added up. Characters in java are stored as numbers. Instead, do String.replace on each vowel. Replace: name = name.replace( vowel,'*'); With: name = name.replaceAll("[aeiou]",'*');
downvote count: 0

http://stackoverflow.com/a/23240077
answers question: http://stackoverflow.com/q/23239847
upvote count: 1
score: 1
has body: You can always get the char value for any ASCII character in java by doing (char) [asciiValue] in this case (char) 11 to get vertical tab. File Separator is available using File.seperator, I believe.
downvote count: 0
type: Answer

http://stackoverflow.com/q/23197896
tagged with: web-services
has comment: http://stackoverflow.com/comment/35544110
type: Question
score: 0
has title: Publish webservice using Spring framework at Java SE project
type: UnansweredQuestion
has body: I am able to publish webservices using Endpoint.publish() method. besides I have used spring framework in many Java EE project and Java SE project. Does spring provide a way of publishing webservice at Java SE project?
tagged with: spring
has comment: http://stackoverflow.com/comment/35594674
answer count: 0
tagged with: java

http://stackoverflow.com/comment/35384966
type: Comment
comment on: http://stackoverflow.com/a/23141688
score: 0
type: AnswerComment
has text: These are really useful tricks. I am slightly confuse on the error jsp page you just told me. If you can provide me an example how would I show different error pages for invalid request for two jsp page then it can help me to understand better. :(

recaptcha
tag name: recaptcha
type: Tag
tags question: http://stackoverflow.com/q/23174979

http://stackoverflow.com/comment/35483865
has text: I read that i can use -StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder() .permitAll().build(); StrictMode.setThreadPolicy(policy); instead of a AsyncTask or thread is it correct?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23198602

http://stackoverflow.com/a/23169927
answers question: http://stackoverflow.com/q/23169837
has comment: http://stackoverflow.com/comment/35434623
has comment: http://stackoverflow.com/comment/35434777
has comment: http://stackoverflow.com/comment/35434563
has comment: http://stackoverflow.com/comment/35434819
has body: Yes this will just starts both the Timer simultaneously.By using this code. CountDownLatch latch = new CountDownLatch(2); new Thread(new MyThread(tx1, tx2,latch)).start(); new Thread(new MyThread(tx1, tx2,latch)).start(); try { latch.await(); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } But you can make the second timer to be executed after the first timer finishes. Just put this after the first timer finishes. new Thread(new MyThread(tx1, tx2,latch)).start();
score: 0
has comment: http://stackoverflow.com/comment/35436103
type: Answer
has comment: http://stackoverflow.com/comment/35434794

http://stackoverflow.com/comment/35529781
comment on: http://stackoverflow.com/q/23223986
has text: Looking at the sample, I think what you actually need is to turn the string into a 2 dimensional integer array `int[][]`. Is that correct?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23200164
score: 0
answers question: http://stackoverflow.com/q/23199885
type: Answer
has body: Using JSP scriplets - bad code practice. Use JSTL or another tag libs. Also you can write your own tags

http://stackoverflow.com/comment/52125619
type: Comment
has text: Where do you change your "java runtime command"? I tried Project > Preferences > Run/Debug Settings , picked some configurations, clicked Edit, Arguments tab, VM arguments.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23212426

http://stackoverflow.com/q/23164532
has title: How can a taglet know about the class it's located in?
answer count: 1
score: 0
has answer: http://stackoverflow.com/a/23164533
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/23138806
tagged with: taglet
tagged with: java
tagged with: javadoc
has body: As far as I can see the taglet api has exactly one class in its package: Taglet, if you change Taglet.html to package-summary.html, there's nothing else in it (and there's this mildly scary message: As of JDK version 1.5, replaced by com.sun.tools.doclets.internal.toolkit.util. which I'm assuming that does not affect the Taglet interface itself.) There is nothing in the interface that knows anything about the class in which the taglet resides--nothing about its context. Is there anyway to get the name of the class in which the taglet is being "called" from? The class that has the JavaDoc block in which {@.myTaglet} exists? As a hack, I'm thinking of forcing the user to set it with {@.thisClass my.package.AClass} at the top, before using any of my custom taglets. Better ideas would be great. (Here's Sun's taglet overview.) (Also, please consider looking at my previous question, which is another taglet question: How to make inline taglets (which require com.sun) more cross-platform? Is there a non-Oracle/more-cross-platform javadoc parser?)
type: Question

http://stackoverflow.com/comment/59430948
type: QuestionComment
comment on: http://stackoverflow.com/q/23249331
score: 0
has text: Maybe it is a duplicate, but searching for the 52.0 message error take me here.
type: Comment

http://stackoverflow.com/q/23239542
accepted answer: http://stackoverflow.com/a/23239641
has answer: http://stackoverflow.com/a/23239916
score: 0
has comment: http://stackoverflow.com/comment/35557351
has answer: http://stackoverflow.com/a/23240009
tagged with: android
answer count: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23239641
tagged with: java
has answer: http://stackoverflow.com/a/23239672
has body: I have a problem trying to check if a EditText is empty or not. I have found a lot of solutions but all of them reffer to a string variable. I wanna check if a value that is Integer between 0 and 10 is empty or not. Here is my code: int value = Integer.parseInt(instances.getText().toString());; if (value &gt; 10) Toast.makeText(getApplicationContext(), "Enter a value between 0 and 10!", Toast.LENGTH_SHORT).show(); else if (value &lt; 0) Toast.makeText(getApplicationContext(), "Enter a value between 0 and 10!", Toast.LENGTH_SHORT).show(); else if (value &gt;= 0 &amp;&amp; value &lt;= 10) { schimba(v); } If I enter a number > 10 I get the toast, same if I enter a negative number.The function work great when I enter the number between 0 and 10 but if I let empty I get an error and I need to create the condition but I can't find something to integer. Any help would be great, thank you in advance.
type: Question
has comment: http://stackoverflow.com/comment/35557328
possible better answer: http://stackoverflow.com/a/23239672
has title: Android app, check if EditText with INTEGER is empty or not
has comment: http://stackoverflow.com/comment/35557354

primary-key
tags question: http://stackoverflow.com/q/23221096
tag name: primary-key
type: Tag

http://stackoverflow.com/comment/35546439
has text: @rush001 `this` and `super` still mean two different things. I suggest for clarity that *you* do the replacing, *in your question,* so we can all agree what you're actually talking about.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23232859
type: Comment

http://stackoverflow.com/comment/35507752
type: QuestionComment
comment on: http://stackoverflow.com/q/23211494
score: 0
has text: They are up to date too.
type: Comment

http://stackoverflow.com/comment/35576714
score: 0
type: Comment
type: QuestionComment
has text: Put breakpoint in this code..i.e. `name`,markbook[i] or like wise cases...
comment on: http://stackoverflow.com/q/23250438

http://stackoverflow.com/q/23196216
has comment: http://stackoverflow.com/comment/35490194
downvote count: 0
has title: Gson doesn't parse enum field in custom class
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35490652
has comment: http://stackoverflow.com/comment/35491141
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: gson
type: Question
has answer: http://stackoverflow.com/a/23228569
has body: My model classes: public class Model { ....... public ArrayList&lt;Job&gt; Jobs; } public class Job { public ActionType Action; ........ public enum ActionType { NONE(0), ....... GOTO(9); private int number; private ActionType(int number) { this.number = number; } public int getNumber() { return this.number; } public static ActionType fromKey(int number) { for(ActionType type : ActionType.values()) { if(type.getNumber() == number) { return type; } } return null; } } } Custom deserializer: public class ActionTypeDeserializer implements JsonDeserializer&lt;ActionType&gt; { @Override public ActionType deserialize(JsonElement element, Type arg1, JsonDeserializationContext arg2) throws JsonParseException { int key = element.getAsInt(); return ActionType.fromKey(key); } } And here I parse the JSON document: GsonBuilder gsonBuilder = new GsonBuilder(); gsonBuilder.registerTypeAdapter(ActionType.class, new ActionTypeDeserializer()); Gson gson = gsonBuilder.create(); result = gson.fromJson(valuesArray, new TypeToken&lt;Collection&lt;Model&gt;&gt;(){}.getType()); And example of "Jobs" array: [ { "Id":1, "Jobs":[ { "Action":1, "ItemDescription":"" }, { "Action":2, "ItemDescription":"Item C" } ] } ] The problem is that Action is always null in Job class instance.
upvote count: 1
answer count: 1
favorite count: 0
tagged with: android

http://stackoverflow.com/a/23133701
has comment: http://stackoverflow.com/comment/35370166
has comment: http://stackoverflow.com/comment/35369166
has body: You are right - strings are immutable in Java. Which means, that everytime you do something with string a new string with new contents is created. The only difference is that when you explicitly call new operator it creates a brand new String, which is not taken from so-called "string pool". E.g.: "A" == "A" can be true (not guaranteed, though), but "A" == new String("A") is always false.
type: Answer
has comment: http://stackoverflow.com/comment/35369031
answers question: http://stackoverflow.com/q/23133525
score: -1
has comment: http://stackoverflow.com/comment/35369617
has comment: http://stackoverflow.com/comment/35369425
has comment: http://stackoverflow.com/comment/35369067
has comment: http://stackoverflow.com/comment/35369448
downvote count: 1
has comment: http://stackoverflow.com/comment/35369529
upvote count: 0

http://stackoverflow.com/comment/35588885
type: Comment
comment on: http://stackoverflow.com/q/23255162
score: 0
type: QuestionComment
has text: @RyanHosford I see you're using a `SourceDataLine` rather than a `Clip`; are you concerned about the size of your audio file fitting in to memory? If not, is there another reason that requires you to use `SourceDataLine`?

http://stackoverflow.com/a/23148088
has comment: http://stackoverflow.com/comment/35397041
upvote count: 3
has body: You can put it in the root by putting it in "src/main/webapp"
accepted answer of: http://stackoverflow.com/q/23148055
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23148055
has comment: http://stackoverflow.com/comment/98653329
type: Answer
score: 3

http://stackoverflow.com/q/23175232
type: UnansweredQuestion
score: 1
tagged with: java
tagged with: loops
type: Question
has comment: http://stackoverflow.com/comment/35443103
has answer: http://stackoverflow.com/a/23175324
has answer: http://stackoverflow.com/a/23175251
answer count: 3
tagged with: for-loop
upvote count: 1
has comment: http://stackoverflow.com/comment/35443113
has title: JAVA: Substitute for a break statement?
favorite count: 0
has body: For some ridiculous reason my professor has prohibited us from using break statements in our programs to terminate loops. I am making a Connect Four program and am using for loops to simulate the player dropping a checker. If my loops look like this: for(int i = LOWEST_ROW_INDEX; i &gt;= 0; i--) { if(gb[i][rChoice].equals(". ")) { gb[i][rChoice] = "r "; break; //CANNOT USE BREAK } } What could I do instead of a break statement to terminate this for loop?
has answer: http://stackoverflow.com/a/23177517
tagged with: break
downvote count: 0

http://stackoverflow.com/comment/35639815
type: Comment
type: QuestionComment
has text: Then what is happening is you have a scriptlet in your redirect.jsp which is throwing a Null pointer exception in certain situations. Probably you are accessing a request attribute which is null and performing an operation on it. Try to add a few null checks in the page.
score: 3
comment on: http://stackoverflow.com/q/23283853

http://stackoverflow.com/q/23198869
has comment: http://stackoverflow.com/comment/35484120
tagged with: jdbc
has title: How to handle Symbol not find Error?
has body: I am writing a program for registration form in java and I've created the connection class separately.But while compiling my register.java class I'm getting symbol not found error. Please check if anyone could help . This is the code for my Connection class. import java.sql.*; class JDBCConnection { Connection con=null; public Connection getConnection() { try { Class.forName("oracle.jdbc.driver.OracleDriver"); con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:XE","cloud","cloud"); } catch(ClassNotFoundException ce) { ce.printStackTrace(); } catch(SQLException sqe) { sqe.printStackTrace(); } return con; } } And code for the Register class is as follows : import javax.servlet.http.*; import java.io.*; import java.sql.*; import java.util.*; public class Register1 extends HttpServlet { public void doGet(HttpServletRequest req,HttpServletResponse res) throws IOException { PrintWriter out=res.getWriter(); String str= req.getParameter("First"); String str1 = req.getParameter("Last"); String str2=req.getParameter("Uname"); String str3=req.getParameter("Month"); String day=req.getParameter("Day"); String year=req.getParameter("Year"); String str4=req.getParameter("Gen"); String str5=req.getParameter("Phone"); String str6=req.getParameter("Mail"); out.println("&lt;html&gt;"); out.println("&lt;body&gt;"); out.println("&lt;form action=\"../Page(1).html\"&gt;"); JDBCConnection obj=new JDBCConnection(); Connection con=obj.getConnection(); String query="insert into Register values(?,?,?,?,?,?,?,?,?)"; int i=0; try { PreparedStatement ps=con.prepareStatement(query); ps.setString(1, str); ps.setString(2, str1); ps.setString(3, str2); ps.setString(4, day); ps.setString(5,str3); ps.setString(6,year); ps.setString(7,str4); ps.setString(8,str5); ps.setString(9,str6); i=ps.executeUpdate(); } catch(Exception e) { e.printStackTrace(); } if(i==1) { res.sendRedirect("../Page(1).html"); } out.println("&lt;/html&gt;"); out.println("&lt;/body&gt;"); out.println("&lt;/form &gt;")…
type: UnansweredQuestion
score: 1
upvote count: 1
tagged with: java
has comment: http://stackoverflow.com/comment/35484379
type: Question
answer count: 1
has answer: http://stackoverflow.com/a/23198925
downvote count: 0
favorite count: 0

filewriter
tag name: filewriter
tags question: http://stackoverflow.com/q/23275629
tags question: http://stackoverflow.com/q/23143655
tags question: http://stackoverflow.com/q/23273562
tags question: http://stackoverflow.com/q/23252506
tags question: http://stackoverflow.com/q/23187128
type: Tag

http://stackoverflow.com/comment/36553621
comment on: http://stackoverflow.com/q/23169918
has text: Does this question help? [How do I run JUnit tests from inside my java application?](http://stackoverflow.com/questions/2543912/how-do-i-run-junit-tests-from-inside-my-java-application)
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23140315
tagged with: mockito
has title: difference between spy and direct object
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/35383582
has answer: http://stackoverflow.com/a/23141388
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23141207
has body: As far as i have gathered knowledge on Mockito, when we spy an object and call any method on it then its real implementation is executed. class Abc { public int fun() { //to do stuff return 5; } } Test Using spy: Class AbcTest { public void testFun() { Abc ob= spy(Abc.class); ob.fun(); //calls real implementation //Other stuff } } Test Without spy: Class AbcTest { public void testFun() { Abc ob=new Abc(); ob.fun(); //other stuff } } What is the difference b/w calling the real implementation of a method using above two methods??
tagged with: java
type: Question
tagged with: testing

http://stackoverflow.com/comment/35674855
type: QuestionComment
has text: @Affe: No, it's not "automatically marshalled into objects in the server" - it is saved as an XML file there.
comment on: http://stackoverflow.com/q/23280931
score: 0
type: Comment

http://stackoverflow.com/q/23172199
tagged with: java
has comment: http://stackoverflow.com/comment/35437828
tagged with: mysql
has title: extracting from DB using JDBC and creating array
possible better answer: http://stackoverflow.com/a/23172515
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/35437863
tagged with: arrays
accepted answer: http://stackoverflow.com/a/23172504
tagged with: arraylist
score: 0
has comment: http://stackoverflow.com/comment/35437938
has answer: http://stackoverflow.com/a/23172504
tagged with: jdbc
has comment: http://stackoverflow.com/comment/35438027
has answer: http://stackoverflow.com/a/23172515
has body: i'm trying to extract from mysql database, but my code keeps throwing nullpointerexception and think its because no array is beeing created, what am i doing wrong ? here's the code: -- thanks ! public ArrayList&lt;String&gt; getRow(String quEry, String db){ String url = "jdbc:mysql://localhost:3306/"+db; try { conn = DriverManager.getConnection(url, "root", ""); } catch (SQLException e) { } try{ query = conn.prepareStatement(quEry); }catch(Exception e){ } try { getRow_Method_Result = query.executeQuery(); } catch (SQLException e) { } try{ while(getRow_Method_Result.next()){ row_result.add(getRow_Method_Result.getString(1)); row_result.add(getRow_Method_Result.getString(2)); row_result.add(getRow_Method_Result.getString(3)); row_result.add(getRow_Method_Result.getString(4)); } }catch(Exception e){ } return row_result; } public static void main(String[] args) { ConectorBaseDatos OBJ_testGetRowMethod = new ConectorBaseDatos(); ArrayList&lt;String&gt; rowListResult_ofMethos = OBJ_testGetRowMethod.getRow("SELECT * FROM `arbitros`", "fifa"); System.out.println(rowListResult_ofMethos.toString()); } i have tried to create this as a String[][] array but since this is a little more complicated decided to create it first as an ArrayList then this result insert it into ArrayList&lt;ArrayList&lt;String&gt;&gt; but just STUCK HERE
has comment: http://stackoverflow.com/comment/35438011
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35437905

http://stackoverflow.com/comment/35580314
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23252298
has text: `JPanel mainCard = new JPanel(new BoxLayout(mainCard, BoxLayout.PAGE_AXIS));` I changed it to box layout and it is returning an error and underlines the second `mainCard`, how so?
type: AnswerComment

http://stackoverflow.com/q/23192058
has answer: http://stackoverflow.com/a/23224459
has answer: http://stackoverflow.com/a/60236197
tagged with: z3
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/60236197
downvote count: 1
type: Question
answer count: 2
accepted answer: http://stackoverflow.com/a/23224459
upvote count: 5
score: 4
has body: I have installed the Z3 API for Java and I am trying to use it but I can't find any documentation that explains how to use this API. The only resource I have found so far is the source code and the example program, so I wanted to know if anyone was aware of any other documentation for the Z3 Java API.
has title: Z3 Java API documentation
favorite count: 0

http://stackoverflow.com/a/23231306
has comment: http://stackoverflow.com/comment/35544904
has comment: http://stackoverflow.com/comment/35548540
has comment: http://stackoverflow.com/comment/35545055
has comment: http://stackoverflow.com/comment/35544929
has comment: http://stackoverflow.com/comment/35545012
upvote count: 1
has comment: http://stackoverflow.com/comment/35544953
answers question: http://stackoverflow.com/q/23227576
has comment: http://stackoverflow.com/comment/35545030
has body: There is no getBytes() method. The getData() method always returns the byte array you initialized it with. The internal length is always updated to the actual length of the packet received. The internal byte array is never grown to accomodate a larger packet, contrary to your assertion. One of the consequences is that if you keep receiving into the same DatagramSocket, its length keeps shrinking to the size of the smallest datagram received so far. So you must at a minimum reset the length to the length of the byte array before each receive.
has comment: http://stackoverflow.com/comment/35544719
type: Answer
has comment: http://stackoverflow.com/comment/46576825
downvote count: 0
has comment: http://stackoverflow.com/comment/35545087
has comment: http://stackoverflow.com/comment/35548177
score: 1

http://stackoverflow.com/comment/35469893
has text: Thank you! Although it crashes after the first input, it still gives me an idea as to what I'm doing wrong. Thanks.
comment on: http://stackoverflow.com/a/23152671
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/23198289
type: Answer
has comment: http://stackoverflow.com/comment/35483054
score: 2
answers question: http://stackoverflow.com/q/23197874
has body: You do not need a second for loop. Count of occurrence of number in a column can be found by private int countOccurrencesInCol(int col, int d){ for (int i = 0; i &lt; grid.length; i++){ if (grid[i][col] == d){ count++; } } return count; } Hope this helps! Good luck!
has comment: http://stackoverflow.com/comment/35483022
downvote count: 0
upvote count: 2

http://stackoverflow.com/comment/35573826
type: AnswerComment
has text: So how can i actually add/remove elements in my List, Map or whatever while im iterating it? I need to do it.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23248840

http://stackoverflow.com/comment/35601949
score: 0
has text: @qazerty23 post your full stack trace here.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23264224

http://stackoverflow.com/comment/35433379
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23169701
has text: Define 'from anywhere' in such a way that it excludes drag and drop, and paste, but includes something else.
score: 0

http://stackoverflow.com/a/23184840
answers question: http://stackoverflow.com/q/23184806
type: Answer
has comment: http://stackoverflow.com/comment/35459482
has body: Restarted Eclipse ? Seems like it crashed. Maybe you copy the folder of the project and import it as a new project.
upvote count: 1
has comment: http://stackoverflow.com/comment/35459550
downvote count: 0
score: 1